diff options
-rw-r--r-- | src/server/game/AI/CoreAI/PetAI.cpp | 3 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 14 | ||||
-rw-r--r-- | src/server/game/Handlers/CharacterHandler.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/server/game/Server/WorldSession.cpp | 53 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 4 |
6 files changed, 42 insertions, 45 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index f0a75403c8c..7c640f9a66d 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -89,7 +89,8 @@ void PetAI::UpdateAI(uint32 diff) if (me->GetVictim() && me->EnsureVictim()->IsAlive()) { // is only necessary to stop casting, the pet must not exit combat - if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me)) + if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL) && // ignore channeled spells (Pin, Seduction) + me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me)) { me->InterruptNonMeleeSpells(false); return; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index abc16256b73..8b09df988cf 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -774,7 +774,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (damagetype != NODAMAGE && damage) { - if (victim != this && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back + if (victim != this && victim->GetTypeId() == TYPEID_PLAYER && // does not support creature push_back + (!spellProto || !(spellProto->AttributesEx7 & SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE))) { if (damagetype != DOT) if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL]) @@ -1834,14 +1835,15 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage())); dmgInfo.AbsorbDamage(splitDamage); - uint32 splitted = splitDamage; uint32 split_absorb = 0; - DealDamageMods(caster, splitted, &split_absorb); + DealDamageMods(caster, splitDamage, &split_absorb); - SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false); + SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitDamage, schoolMask, split_absorb, 0, false, 0, false); - CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL); - DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false); + CleanDamage cleanDamage = CleanDamage(splitDamage, 0, BASE_ATTACK, MELEE_HIT_NORMAL); + DealDamage(caster, splitDamage, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false); + // break 'Fear' and similar auras + caster->ProcDamageAndSpellFor(true, this, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_NORMAL_HIT, BASE_ATTACK, (*itr)->GetSpellInfo(), splitDamage); } } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index f4ea4971190..1dd4f10fd90 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -243,8 +243,6 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/) { - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, false); - // remove expired bans PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS); CharacterDatabase.Execute(stmt); @@ -681,7 +679,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte data << uint8(CHAR_CREATE_SUCCESS); SendPacket(&data); - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); std::string IP_str = GetRemoteAddress(); TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); @@ -758,8 +755,6 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) WorldPacket data(SMSG_CHAR_DELETE, 1); data << uint8(CHAR_DELETE_SUCCESS); SendPacket(&data); - - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); } void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) @@ -1168,7 +1163,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName) { - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); if (!result) { WorldPacket data(SMSG_CHAR_RENAME, 1); @@ -1426,8 +1420,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) stmt->setUInt32(0, GUID_LOPART(guid)); // TODO: Make async with callback - // TODO 2: Allow opcode at end of callback - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -1682,8 +1674,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint8 playerClass = nameData->m_class; uint8 level = nameData->m_level; - // TO Do: Make async and allow opcode on callback - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); + // TO Do: Make async PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES); stmt->setUInt32(0, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 0704c4eb9fe..fdf06a8f7e3 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -533,7 +533,7 @@ enum SpellAttr7 SPELL_ATTR7_IS_CHEAT_SPELL = 0x00000008, // 3 Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS SPELL_ATTR7_UNK4 = 0x00000010, // 4 Only 47883 (Soulstone Resurrection) and test spell. SPELL_ATTR7_SUMMON_PLAYER_TOTEM = 0x00000020, // 5 Only Shaman player totems. - SPELL_ATTR7_UNK6 = 0x00000040, // 6 Dark Surge, Surge of Light, Burning Breath triggers (boss spells). + SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE = 0x00000040, // 6 Does not cause spell pushback on damage SPELL_ATTR7_UNK7 = 0x00000080, // 7 66218 (Launch) spell. SPELL_ATTR7_HORDE_ONLY = 0x00000100, // 8 Teleports, mounts and other spells. SPELL_ATTR7_ALLIANCE_ONLY = 0x00000200, // 9 Teleports, mounts and other spells. diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index a784a5d636d..9f052b75386 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -569,7 +569,6 @@ void WorldSession::LogoutPlayer(bool save) m_playerLogout = false; m_playerSave = false; m_playerRecentlyLogout = true; - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); LogoutRequest(0); } @@ -1252,8 +1251,9 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co if (++packetCounter.amountCounter > maxPacketCounterAllowed) { dosTriggered = true; - TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, flooding packet (opc: %s (0x%X), count: %u)", - Session->GetAccountId(), Session->GetRemoteAddress().c_str(), opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter); + TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Character: %s, flooding packet (opc: %s (0x%X), count: %u)", + Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetPlayerName().c_str(), + opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter); } // Then check if player is sending packets not allowed @@ -1303,26 +1303,28 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co uint32 maxPacketCounterAllowed; switch (opcode) { + // These opcodes are spammed by few addons so a very high limit is required + case CMSG_QUEST_QUERY: case CMSG_MESSAGECHAT: - { - maxPacketCounterAllowed = 500; - break; - } - - case CMSG_ATTACKSTOP: case CMSG_ITEM_QUERY_SINGLE: case CMSG_ITEM_NAME_QUERY: - case CMSG_GUILD_QUERY: + case CMSG_GAMEOBJECT_QUERY: case CMSG_NAME_QUERY: case CMSG_PET_NAME_QUERY: - case CMSG_GAMEOBJECT_QUERY: case CMSG_CREATURE_QUERY: case CMSG_NPC_TEXT_QUERY: + case CMSG_QUESTGIVER_STATUS_QUERY: + { + maxPacketCounterAllowed = 5000; + break; + } + + case CMSG_ATTACKSTOP: + case CMSG_GUILD_QUERY: case CMSG_ARENA_TEAM_QUERY: case CMSG_TAXINODE_STATUS_QUERY: case CMSG_TAXIQUERYAVAILABLENODES: case CMSG_QUESTGIVER_QUERY_QUEST: - case CMSG_QUEST_QUERY: case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY: case CMSG_QUERY_QUESTS_COMPLETED: case CMSG_QUEST_POI_QUERY: @@ -1340,28 +1342,35 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case MSG_QUERY_NEXT_MAIL_TIME: case MSG_GUILD_EVENT_LOG_QUERY: case MSG_MOVE_SET_FACING: + case CMSG_INSPECT: { - maxPacketCounterAllowed = 200; + maxPacketCounterAllowed = 500; break; } case CMSG_REQUEST_PARTY_MEMBER_STATS: case CMSG_WHO: + case CMSG_SETSHEATHED: + case CMSG_CONTACT_LIST: + case CMSG_GUILD_SET_PUBLIC_NOTE: + case CMSG_GUILD_SET_OFFICER_NOTE: { maxPacketCounterAllowed = 50; break; } - case CMSG_SETSHEATHED: - case CMSG_CONTACT_LIST: + case CMSG_SPELLCLICK: + case CMSG_GAMEOBJ_USE: + case CMSG_GAMEOBJ_REPORT_USE: + case MSG_RAID_TARGET_UPDATE: + case CMSG_QUESTGIVER_COMPLETE_QUEST: + case CMSG_PLAYER_VEHICLE_ENTER: + case CMSG_PETITION_SIGN: { - maxPacketCounterAllowed = 10; + maxPacketCounterAllowed = 20; break; } - case CMSG_GAMEOBJ_USE: - case CMSG_GAMEOBJ_REPORT_USE: - case CMSG_SPELLCLICK: case CMSG_PLAYER_LOGOUT: case CMSG_LOGOUT_REQUEST: case CMSG_LOGOUT_CANCEL: @@ -1404,7 +1413,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_REQUEST_VEHICLE_EXIT: case CMSG_LEARN_PREVIEW_TALENTS: case CMSG_LEARN_PREVIEW_TALENTS_PET: - case CMSG_PLAYER_VEHICLE_ENTER: case CMSG_CONTROLLER_EJECT_PASSENGER: case CMSG_EQUIPMENT_SET_SAVE: case CMSG_DELETEEQUIPMENT_SET: @@ -1416,11 +1424,9 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_QUESTGIVER_CANCEL: case CMSG_QUESTLOG_REMOVE_QUEST: case CMSG_QUEST_CONFIRM_ACCEPT: - case CMSG_QUESTGIVER_COMPLETE_QUEST: case CMSG_DISMISS_CRITTER: case CMSG_REPOP_REQUEST: case CMSG_PETITION_BUY: - case CMSG_PETITION_SIGN: case CMSG_TURN_IN_PETITION: case CMSG_COMPLETE_CINEMATIC: case CMSG_ITEM_REFUND: @@ -1468,8 +1474,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_GUILD_DISBAND: case CMSG_GUILD_LEADER: case CMSG_GUILD_MOTD: - case CMSG_GUILD_SET_PUBLIC_NOTE: - case CMSG_GUILD_SET_OFFICER_NOTE: case CMSG_GUILD_RANK: case CMSG_GUILD_ADD_RANK: case CMSG_GUILD_DEL_RANK: @@ -1486,7 +1490,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case MSG_SET_DUNGEON_DIFFICULTY: case MSG_SET_RAID_DIFFICULTY: case MSG_RANDOM_ROLL: - case MSG_RAID_TARGET_UPDATE: case MSG_PARTY_ASSIGNMENT: case MSG_RAID_READY_CHECK: { diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index f96a30c903a..dea67b5222d 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -205,7 +205,7 @@ class spell_pri_divine_hymn : public SpellScriptLoader void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -336,7 +336,7 @@ class spell_pri_hymn_of_hope : public SpellScriptLoader void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; |