Skip to content

Commit

Permalink
Merge 3.3.5 to 3.3.5-nemesis_anticheat
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions committed Feb 24, 2025
2 parents 6bb93b7 + c9ba09a commit b7e89f2
Show file tree
Hide file tree
Showing 50 changed files with 726 additions and 593 deletions.
2 changes: 2 additions & 0 deletions sql/updates/world/3.3.5/2025_02_20_00_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Update Knot Thimblejack spawn coordinates
UPDATE `creature` SET `position_x`=581.0821533203125, `position_y`=523.2933349609375, `position_z`=-25.31939697265625, `orientation`=2.722713708877563476, `VerifiedBuild`=59207 WHERE `guid`=56804 AND `id`=14338;
2 changes: 2 additions & 0 deletions sql/updates/world/3.3.5/2025_02_20_01_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--
DELETE FROM `creature` WHERE `id`=16097;
8 changes: 8 additions & 0 deletions sql/updates/world/3.3.5/2025_02_20_02_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
UPDATE `playercreateinfo_action` SET `action`=20154 WHERE `action`=21084;

DELETE FROM `spell_ranks` WHERE `first_spell_id`=20154;
INSERT INTO `spell_ranks` (`first_spell_id`, `spell_id`, `rank`) VALUES
(20154,20154,1),
(20154,21084,2);

UPDATE `trainer_spell` SET `SpellId`=10321 WHERE `SpellId`=20271;
5 changes: 5 additions & 0 deletions sql/updates/world/3.3.5/2025_02_20_03_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pal_seal_of_righteousness';
DELETE FROM `spell_script_names` WHERE `spell_id`=21084 AND `ScriptName`='spell_pal_seals';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(-20154,'spell_pal_seal_of_righteousness'),
(-20154,'spell_pal_seals');
19 changes: 9 additions & 10 deletions src/common/Asio/DeadlineTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@
#ifndef DeadlineTimer_h__
#define DeadlineTimer_h__

#include <boost/asio/deadline_timer.hpp>
#include "Duration.h"
#include <boost/asio/basic_waitable_timer.hpp>
#include <boost/asio/io_context.hpp>

namespace Trinity
namespace Trinity::Asio
{
namespace Asio
{
class DeadlineTimer : public boost::asio::basic_deadline_timer<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime>, boost::asio::io_context::executor_type>
{
public:
using basic_deadline_timer::basic_deadline_timer;
};
}
class DeadlineTimer : public boost::asio::basic_waitable_timer<std::chrono::steady_clock, boost::asio::wait_traits<std::chrono::steady_clock>, boost::asio::io_context::executor_type>
{
public:
using basic_waitable_timer::basic_waitable_timer;
};
}

#endif // DeadlineTimer_h__
4 changes: 2 additions & 2 deletions src/common/Metric/Metric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void Metric::ScheduleSend()
{
if (_enabled)
{
_batchTimer->expires_from_now(boost::posix_time::seconds(_updateInterval));
_batchTimer->expires_after(std::chrono::seconds(_updateInterval));
_batchTimer->async_wait(std::bind(&Metric::SendBatch, this));
}
else
Expand Down Expand Up @@ -250,7 +250,7 @@ void Metric::ScheduleOverallStatusLog()
{
if (_enabled)
{
_overallStatusTimer->expires_from_now(boost::posix_time::seconds(_overallStatusTimerInterval));
_overallStatusTimer->expires_after(std::chrono::seconds(_overallStatusTimerInterval));
_overallStatusTimer->async_wait([this](const boost::system::error_code&)
{
_overallStatusTimerTriggered = true;
Expand Down
12 changes: 6 additions & 6 deletions src/server/authserver/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,20 @@ int main(int argc, char** argv)
// Enabled a timed callback for handling the database keep alive ping
int32 dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30);
std::shared_ptr<Trinity::Asio::DeadlineTimer> dbPingTimer = std::make_shared<Trinity::Asio::DeadlineTimer>(*ioContext);
dbPingTimer->expires_from_now(boost::posix_time::minutes(dbPingInterval));
dbPingTimer->expires_after(std::chrono::minutes(dbPingInterval));
dbPingTimer->async_wait(std::bind(&KeepDatabaseAliveHandler, std::weak_ptr<Trinity::Asio::DeadlineTimer>(dbPingTimer), dbPingInterval, std::placeholders::_1));

int32 banExpiryCheckInterval = sConfigMgr->GetIntDefault("BanExpiryCheckInterval", 60);
std::shared_ptr<Trinity::Asio::DeadlineTimer> banExpiryCheckTimer = std::make_shared<Trinity::Asio::DeadlineTimer>(*ioContext);
banExpiryCheckTimer->expires_from_now(boost::posix_time::seconds(banExpiryCheckInterval));
banExpiryCheckTimer->expires_after(std::chrono::seconds(banExpiryCheckInterval));
banExpiryCheckTimer->async_wait(std::bind(&BanExpiryHandler, std::weak_ptr<Trinity::Asio::DeadlineTimer>(banExpiryCheckTimer), banExpiryCheckInterval, std::placeholders::_1));

#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
std::shared_ptr<Trinity::Asio::DeadlineTimer> serviceStatusWatchTimer;
if (m_ServiceStatus != -1)
{
serviceStatusWatchTimer = std::make_shared<Trinity::Asio::DeadlineTimer>(*ioContext);
serviceStatusWatchTimer->expires_from_now(boost::posix_time::seconds(1));
serviceStatusWatchTimer->expires_after(1s);
serviceStatusWatchTimer->async_wait(std::bind(&ServiceStatusWatcher,
std::weak_ptr<Trinity::Asio::DeadlineTimer>(serviceStatusWatchTimer),
std::weak_ptr<Trinity::Asio::IoContext>(ioContext),
Expand Down Expand Up @@ -306,7 +306,7 @@ void KeepDatabaseAliveHandler(std::weak_ptr<Trinity::Asio::DeadlineTimer> dbPing
TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive");
LoginDatabase.KeepAlive();

dbPingTimer->expires_from_now(boost::posix_time::minutes(dbPingInterval));
dbPingTimer->expires_after(std::chrono::minutes(dbPingInterval));
dbPingTimer->async_wait(std::bind(&KeepDatabaseAliveHandler, dbPingTimerRef, dbPingInterval, std::placeholders::_1));
}
}
Expand All @@ -321,7 +321,7 @@ void BanExpiryHandler(std::weak_ptr<Trinity::Asio::DeadlineTimer> banExpiryCheck
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS));

banExpiryCheckTimer->expires_from_now(boost::posix_time::seconds(banExpiryCheckInterval));
banExpiryCheckTimer->expires_after(std::chrono::seconds(banExpiryCheckInterval));
banExpiryCheckTimer->async_wait(std::bind(&BanExpiryHandler, banExpiryCheckTimerRef, banExpiryCheckInterval, std::placeholders::_1));
}
}
Expand All @@ -338,7 +338,7 @@ void ServiceStatusWatcher(std::weak_ptr<Trinity::Asio::DeadlineTimer> serviceSta
ioContext->stop();
else if (std::shared_ptr<Trinity::Asio::DeadlineTimer> serviceStatusWatchTimer = serviceStatusWatchTimerRef.lock())
{
serviceStatusWatchTimer->expires_from_now(boost::posix_time::seconds(1));
serviceStatusWatchTimer->expires_after(1s);
serviceStatusWatchTimer->async_wait(std::bind(&ServiceStatusWatcher, serviceStatusWatchTimerRef, ioContextRef, std::placeholders::_1));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Creature/Trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ namespace Trainer

player->ModifyMoney(-moneyCost);

npc->SendPlaySpellVisual(179);
npc->SendPlaySpellImpact(player->GetGUID(), 362);
npc->SendPlaySpellVisualKit(179, 0); // 53 SpellCastDirected
player->SendPlaySpellVisualKit(362, 1); // 113 EmoteSalute

// learn explicitly or cast explicitly
if (trainerSpell->IsCastable())
Expand Down
80 changes: 21 additions & 59 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,8 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
SetPvpFlag(UNIT_BYTE2_FLAG_PVP);
SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}

SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);
SetModCastingSpeed(1.0f); // fix cast time showed in spell tooltip on client
SetHoverHeight(1.0f); // default for players in 3.0.3

SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); // -1 is default value

Expand All @@ -512,37 +511,9 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
SetFacialStyle(createInfo->FacialHair);
SetRestState((GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0) ? REST_STATE_RAF_LINKED : REST_STATE_NOT_RAF_LINKED);
SetNativeGender(Gender(createInfo->Gender));
SetArenaFaction(0);

SetUInt32Value(PLAYER_GUILDID, 0);
SetGuildRank(0);
SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);

for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled
SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);

SetUInt32Value(PLAYER_FIELD_KILLS, 0);
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0);
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);

// set starting level
uint32 start_level = GetClass() != CLASS_DEATH_KNIGHT
? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
: sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL);

if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL))
{
uint32 gm_level = GetClass() != CLASS_DEATH_KNIGHT
? sWorld->getIntConfig(CONFIG_START_GM_LEVEL)
: std::max(sWorld->getIntConfig(CONFIG_START_GM_LEVEL), sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL));

if (gm_level > start_level)
start_level = gm_level;
}

SetLevel(start_level, false);
SetLevel(GetStartLevel(createInfo->Class), false);

InitRunes();

Expand Down Expand Up @@ -2026,12 +1997,12 @@ void Player::RegenerateAll()
// Food emote comes above drinking emote if we have to decide (mage regen food for example)
if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
{
SendPlaySpellVisual(SPELL_VISUAL_KIT_FOOD);
SendPlaySpellVisualKit(SPELL_VISUAL_KIT_FOOD, 0);
break;
}
else if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_POWER_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
{
SendPlaySpellVisual(SPELL_VISUAL_KIT_DRINK);
SendPlaySpellVisualKit(SPELL_VISUAL_KIT_DRINK, 0);
break;
}
}
Expand Down Expand Up @@ -2687,7 +2658,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
{
SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, 0);
SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, 0);
SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, 1.00f);
SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, 1.0f);
}

//reset attack power, damage and attack speed fields
Expand Down Expand Up @@ -11306,7 +11277,6 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
// Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
if (type == INVTYPE_WEAPON && pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM)
return EQUIP_ERR_WRONG_SLOT;

else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
{
if (!CanDualWield())
Expand Down Expand Up @@ -22231,6 +22201,19 @@ void Player::ReportedAfkBy(Player* reporter)
reporter->SendDirectMessage(reportAfkResult.Write());
}

uint8 Player::GetStartLevel(uint8 playerClass) const
{
uint8 startLevel = sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL);

if (playerClass == CLASS_DEATH_KNIGHT)
startLevel = std::max<uint8>(sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL), startLevel);

if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL))
startLevel = std::max<uint8>(sWorld->getIntConfig(CONFIG_START_GM_LEVEL), startLevel);

return startLevel;
}

WorldLocation Player::GetStartPosition() const
{
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(GetRace(), GetClass());
Expand Down Expand Up @@ -23082,31 +23065,10 @@ void Player::LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue)
if (skillValue < ability->MinSkillLineRank && ability->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE)
RemoveSpell(ability->Spell);
// need learn
else if (!IsInWorld())
AddSpell(ability->Spell, true, true, true, false, false, ability->SkillLine);
else
{
// used to avoid double Seal of Righteousness on paladins, it's the only player spell which has both spell and forward spell in auto learn
if (ability->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && ability->SupercededBySpell)
{
bool skipCurrent = false;
auto bounds = sSpellMgr->GetSkillLineAbilityMapBounds(ability->SupercededBySpell);
for (auto itr = bounds.first; itr != bounds.second; ++itr)
{
if (itr->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && skillValue >= itr->second->MinSkillLineRank)
{
skipCurrent = true;
break;
}
}

if (skipCurrent)
continue;
}

if (!IsInWorld())
AddSpell(ability->Spell, true, true, true, false, false, ability->SkillLine);
else
LearnSpell(ability->Spell, true, ability->SkillLine);
}
LearnSpell(ability->Spell, true, ability->SkillLine);
}
}

Expand Down
67 changes: 35 additions & 32 deletions src/server/game/Entities/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,38 +321,38 @@ enum DrunkenState

enum PlayerFlags
{
PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
PLAYER_FLAGS_AFK = 0x00000002,
PLAYER_FLAGS_DND = 0x00000004,
PLAYER_FLAGS_GM = 0x00000008,
PLAYER_FLAGS_GHOST = 0x00000010,
PLAYER_FLAGS_RESTING = 0x00000020,
PLAYER_FLAGS_UNK6 = 0x00000040,
PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
PLAYER_FLAGS_IN_PVP = 0x00000200,
PLAYER_FLAGS_HIDE_HELM = 0x00000400,
PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time
PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time
PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000,
PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?
PLAYER_FLAGS_UNK16 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
PLAYER_FLAGS_UBER = 0x00080000,
PLAYER_FLAGS_UNK20 = 0x00100000,
PLAYER_FLAGS_UNK21 = 0x00200000,
PLAYER_FLAGS_COMMENTATOR2 = 0x00400000,
PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_REQ_AMMO, SPELL_EFFECT_ATTACK, checked only for active player
PLAYER_FLAGS_UNK24 = 0x01000000, // disabled all melee ability on tab include autoattack
PLAYER_FLAGS_NO_XP_GAIN = 0x02000000,
PLAYER_FLAGS_UNK26 = 0x04000000,
PLAYER_FLAGS_UNK27 = 0x08000000,
PLAYER_FLAGS_UNK28 = 0x10000000,
PLAYER_FLAGS_UNK29 = 0x20000000,
PLAYER_FLAGS_UNK30 = 0x40000000,
PLAYER_FLAGS_UNK31 = 0x80000000
PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
PLAYER_FLAGS_AFK = 0x00000002,
PLAYER_FLAGS_DND = 0x00000004,
PLAYER_FLAGS_GM = 0x00000008,
PLAYER_FLAGS_GHOST = 0x00000010,
PLAYER_FLAGS_RESTING = 0x00000020,
PLAYER_FLAGS_VOICE_CHAT = 0x00000040,
PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
PLAYER_FLAGS_IN_PVP = 0x00000200,
PLAYER_FLAGS_HIDE_HELM = 0x00000400,
PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time
PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time
PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000,
PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?
PLAYER_FLAGS_LOW_LEVEL_RAID_ENABLED = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
PLAYER_FLAGS_UBER = 0x00080000,
PLAYER_FLAGS_UNK20 = 0x00100000,
PLAYER_FLAGS_UNK21 = 0x00200000,
PLAYER_FLAGS_COMMENTATOR2 = 0x00400000,
PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_REQ_AMMO, SPELL_EFFECT_ATTACK, checked only for active player
PLAYER_FLAGS_UNK24 = 0x01000000, // disabled all melee ability on tab include autoattack
PLAYER_FLAGS_NO_XP_GAIN = 0x02000000,
PLAYER_FLAGS_UNK26 = 0x04000000,
PLAYER_FLAGS_UNK27 = 0x08000000,
PLAYER_FLAGS_UNK28 = 0x10000000,
PLAYER_FLAGS_UNK29 = 0x20000000,
PLAYER_FLAGS_UNK30 = 0x40000000,
PLAYER_FLAGS_UNK31 = 0x80000000
};

enum PlayerBytesOffsets
Expand Down Expand Up @@ -1675,6 +1675,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
float OCTRegenMPPerSpirit() const;
float GetRatingMultiplier(CombatRating cr) const;
float GetRatingBonusValue(CombatRating cr) const;

/// Returns base spellpower bonus from spellpower stat on items
uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; }
int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; }

Expand Down Expand Up @@ -2067,6 +2069,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
float m_homebindY;
float m_homebindZ;

uint8 GetStartLevel(uint8 playerClass) const;
WorldLocation GetStartPosition() const;

// currently visible objects at player client
Expand Down
Loading

0 comments on commit b7e89f2

Please sign in to comment.