From 9761affc8dcc9cc54ba13bad4e1522d3b3ffda42 Mon Sep 17 00:00:00 2001 From: Discover- Date: Wed, 4 Sep 2013 09:35:21 +0200 Subject: [PATCH 01/14] Core/SAI: Make SMART_TARGET_OWNER_OR_SUMMONER also work for creatures summoned by spells --- src/server/game/AI/SmartScripts/SmartScript.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f94a3e7906..e6fab90673 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2509,8 +2509,15 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* case SMART_TARGET_OWNER_OR_SUMMONER: { if (me) - if (Unit* owner = ObjectAccessor::GetUnit(*me, me->GetCharmerOrOwnerGUID())) + { + uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID(); + + if (!charmerOrOwnerGuid) + charmerOrOwnerGuid = me->GetCreatorGUID(); + + if (Unit* owner = ObjectAccessor::GetUnit(*me, charmerOrOwnerGuid)) l->push_back(owner); + } break; } case SMART_TARGET_THREAT_LIST: From 926edaf49dd91c8d550919f8a37b90c59011b2e0 Mon Sep 17 00:00:00 2001 From: Discover- Date: Wed, 4 Sep 2013 14:07:27 +0200 Subject: [PATCH 02/14] Tabs to spaces... --- src/server/game/AI/SmartScripts/SmartScript.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e6fab90673..111ac53e67 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2509,15 +2509,15 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* case SMART_TARGET_OWNER_OR_SUMMONER: { if (me) - { - uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID(); + { + uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID(); - if (!charmerOrOwnerGuid) - charmerOrOwnerGuid = me->GetCreatorGUID(); + if (!charmerOrOwnerGuid) + charmerOrOwnerGuid = me->GetCreatorGUID(); if (Unit* owner = ObjectAccessor::GetUnit(*me, charmerOrOwnerGuid)) l->push_back(owner); - } + } break; } case SMART_TARGET_THREAT_LIST: From 9ce70fb3c945e7c10c63d78d18e479a1c11b6211 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Thu, 5 Sep 2013 21:51:02 +0200 Subject: [PATCH 03/14] Core/Guild: Fix memory leak on Guild disband Fix memory leak when disbanding a Guild, removed from GuildMgr but never deleted. Due to the different ways of how Guild::Disband() and Guild::DeleteMember() are called, each call to these methods has a different way to delete the Guild if empty/invalid. Valgrind log: 2,127 (240 direct, 1,887 indirect) bytes in 1 blocks are definitely lost in loss record 54 of 81 at operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by guild_commandscript::HandleGuildCreateCommand(ChatHandler*, char const*) (cs_guild.cpp:91) by ChatHandler::ExecuteCommandInTable(ChatCommand*, char const*, std::string const&) (Chat.cpp:339) by ChatHandler::ExecuteCommandInTable(ChatCommand*, char const*, std::string const&) (Chat.cpp:320) by ChatHandler::ParseCommands(char const*) (Chat.cpp:466) by WorldSession::HandleMessagechatOpcode(WorldPacket&) (ChatHandler.cpp:217) by WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:317) by World::UpdateSessions(unsigned int) (World.cpp:2632) by World::Update(unsigned int) (World.cpp:1989) by WorldRunnable::run() (WorldRunnable.cpp:60) by ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186) by ACE_OS_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so) --- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Guilds/Guild.cpp | 13 ++++++++++++- src/server/game/Guilds/Guild.h | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/scripts/Commands/cs_guild.cpp | 3 ++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b1ee724e5f..9bdc1ebdfc 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4713,7 +4713,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC if (uint32 guildId = GetGuildIdFromDB(playerguid)) if (Guild* guild = sGuildMgr->GetGuildById(guildId)) - guild->DeleteMember(guid); + guild->DeleteMember(guid, false, false, true); // remove from arena teams LeaveAllArenaTeams(playerguid); diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index ab0f1e572f..cc15d15fdf 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1578,6 +1578,8 @@ void Guild::HandleAcceptMember(WorldSession* session) void Guild::HandleLeaveMember(WorldSession* session) { Player* player = session->GetPlayer(); + bool disband = false; + // If leader is leaving if (_IsLeader(player)) { @@ -1585,8 +1587,11 @@ void Guild::HandleLeaveMember(WorldSession* session) // Leader cannot leave if he is not the last member SendCommandResult(session, GUILD_COMMAND_QUIT, ERR_GUILD_LEADER_LEAVE); else + { // Guild is disbanded if leader leaves. Disband(); + disband = true; + } } else { @@ -1599,6 +1604,9 @@ void Guild::HandleLeaveMember(WorldSession* session) } sCalendarMgr->RemovePlayerGuildEventsAndSignups(player->GetGUID(), GetId()); + + if (disband) + delete this; } void Guild::HandleRemoveMember(WorldSession* session, std::string const& name) @@ -1812,6 +1820,7 @@ void Guild::HandleDisband(WorldSession* session) { Disband(); TC_LOG_DEBUG(LOG_FILTER_GUILD, "Guild Successfully Disbanded"); + delete this; } } @@ -2272,7 +2281,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) return true; } -void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked) +void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool canDeleteGuild) { uint32 lowguid = GUID_LOPART(guid); Player* player = ObjectAccessor::FindPlayer(guid); @@ -2294,6 +2303,8 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked) if (!newLeader) { Disband(); + if (canDeleteGuild) + delete this; return; } diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index fab39f48fc..4d8987dbbf 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -727,7 +727,7 @@ public: // Members // Adds member to guild. If rankId == GUILD_RANK_NONE, lowest rank is assigned. bool AddMember(uint64 guid, uint8 rankId = GUILD_RANK_NONE); - void DeleteMember(uint64 guid, bool isDisbanding = false, bool isKicked = false); + void DeleteMember(uint64 guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false); bool ChangeMemberRank(uint64 guid, uint8 newRank); // Bank diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 6a7e6c5ded..9e1dbc133a 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1918,7 +1918,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32())) - guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER)); + guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true); } if (!HasPermission(RBAC_PERM_TWO_SIDE_ADD_FRIEND)) diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index 0af0da1084..040c68dbac 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -118,6 +118,7 @@ public: return false; targetGuild->Disband(); + delete targetGuild; return true; } @@ -164,7 +165,7 @@ public: if (!targetGuild) return false; - targetGuild->DeleteMember(targetGuid, false, true); + targetGuild->DeleteMember(targetGuid, false, true, true); return true; } From 3816fb440ff34cff5a0b82b990ac70e2db373045 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Fri, 6 Sep 2013 21:49:30 +0200 Subject: [PATCH 04/14] Core/Battleground: Fix scoreboard Fix scoreboard broken in 07d793b94b60941ea08fd6170d8165994452c49c . A local variable in a loop stored data of the iterator before incrementing it. --- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 557cb9de09..62ffb0fb83 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -262,8 +262,8 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) Battleground::BattlegroundScoreMap::const_iterator itr2 = bg->GetPlayerScoresBegin(); for (Battleground::BattlegroundScoreMap::const_iterator itr = itr2; itr != bg->GetPlayerScoresEnd();) { - BattlegroundScore* score = itr2->second; itr2 = itr++; + BattlegroundScore* score = itr2->second; if (!bg->IsPlayerInBattleground(itr2->first)) { TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true)); From fab0f461c0ff114c3bd667a843a55e924a7dfb83 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sat, 7 Sep 2013 00:16:10 +0200 Subject: [PATCH 05/14] Core/Condition: Added CONDITION_SOURCE_TYPE_PHASE_DEFINITION define for only 4.3.4 branch --- src/server/game/Conditions/ConditionMgr.cpp | 5 +++++ src/server/game/Conditions/ConditionMgr.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index ada7909e9f..5e4ca1de73 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1500,6 +1500,11 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) } break; } + case CONDITION_SOURCE_TYPE_PHASE_DEFINITION: + { + TC_LOG_ERROR(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_PHASE_DEFINITION:: is only for 4.3.4 branch, skipped"); + return false; + } case CONDITION_SOURCE_TYPE_GOSSIP_MENU: case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: case CONDITION_SOURCE_TYPE_SMART_EVENT: diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 07eab29e53..4e3225ca8a 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -129,7 +129,8 @@ enum ConditionSourceType CONDITION_SOURCE_TYPE_SMART_EVENT = 22, CONDITION_SOURCE_TYPE_NPC_VENDOR = 23, CONDITION_SOURCE_TYPE_SPELL_PROC = 24, - CONDITION_SOURCE_TYPE_MAX = 25 // MAX + CONDITION_SOURCE_TYPE_PHASE_DEFINITION = 25, // only 4.3.4 + CONDITION_SOURCE_TYPE_MAX = 26 // MAX }; enum ComparisionType From f66120060adf15d39c7a40fa9c4e501e024a6a21 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sat, 7 Sep 2013 01:21:36 +0200 Subject: [PATCH 06/14] Scripts/Spells: drop obsolete code --- sql/updates/world/2013_09_06_02_world_misc.sql | 4 ++++ src/server/game/Spells/SpellEffects.cpp | 9 --------- src/server/scripts/Spells/spell_quest.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 12 deletions(-) create mode 100644 sql/updates/world/2013_09_06_02_world_misc.sql diff --git a/sql/updates/world/2013_09_06_02_world_misc.sql b/sql/updates/world/2013_09_06_02_world_misc.sql new file mode 100644 index 0000000000..47ac870f97 --- /dev/null +++ b/sql/updates/world/2013_09_06_02_world_misc.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=28481; +DELETE FROM `smart_scripts` WHERE `entryorguid`=28481 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(28481, 0, 0, 0, 8, 0, 100, 0, 51769, 0, 0, 0, 11, 51738, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Runeforge (SE) - On Spellhit Emblazon Runeblade - Cast Shadow Storm'); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index edb2139bd4..98c188df08 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3879,15 +3879,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) npc->LoadEquipment(); return; } - // Emblazon Runeblade - case 51770: - { - if (!m_originalCaster) - return; - - m_originalCaster->CastSpell(m_originalCaster, damage, false); - break; - } // Deathbolt from Thalgran Blightbringer // reflected by Freya's Ward // Retribution by Sevenfold Retribution diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 85f655372c..6b56c51d6e 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2118,12 +2118,13 @@ class spell_q12619_emblazon_runeblade : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff); } void Register() OVERRIDE { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_q12619_emblazon_runeblade_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_q12619_emblazon_runeblade_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -2145,7 +2146,7 @@ class spell_q12619_emblazon_runeblade_effect : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), false); } void Register() OVERRIDE From 80516db48c2e59349daf34e014415b6e512f182a Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sat, 7 Sep 2013 13:32:04 +0100 Subject: [PATCH 07/14] Core/Battlegrounds: Allow random BG winner/loser rewards to be configurable Signed-off-by: Machiavelli --- .../game/Battlegrounds/Battleground.cpp | 6 ++--- src/server/game/Battlegrounds/Battleground.h | 10 -------- .../game/Battlegrounds/BattlegroundMgr.cpp | 6 ++--- src/server/game/World/World.cpp | 8 +++++++ src/server/game/World/World.h | 6 +++++ src/server/worldserver/worldserver.conf.dist | 23 +++++++++++++++++++ 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 21c054c879..211ab6caf7 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -886,9 +886,9 @@ void Battleground::EndBattleground(uint32 winner) } } - uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST; - uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST; - uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST; + uint32 winner_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST); + uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); + uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST); // Reward winner team if (team == winner) diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 1f18054201..76ff08e028 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -143,16 +143,6 @@ enum BattlegroundBuffObjects BG_OBJECTID_BERSERKERBUFF_ENTRY = 179905 }; -enum BattlegroundRandomRewards -{ - BG_REWARD_WINNER_HONOR_FIRST = 30, - BG_REWARD_WINNER_ARENA_FIRST = 25, - BG_REWARD_WINNER_HONOR_LAST = 15, - BG_REWARD_WINNER_ARENA_LAST = 0, - BG_REWARD_LOSER_HONOR_FIRST = 5, - BG_REWARD_LOSER_HONOR_LAST = 5 -}; - const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY }; enum BattlegroundStatus diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 62ffb0fb83..936cc88462 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -828,9 +828,9 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid if (!player) return; - uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST; - uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST; - uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST; + uint32 winner_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST); + uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST); + uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); winner_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills)); loser_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills)); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index cf6ad3f988..b1dc05e8d6 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1195,6 +1195,14 @@ void World::LoadConfigSettings(bool reload) // Accountpassword Secruity m_int_configs[CONFIG_ACC_PASSCHANGESEC] = sConfigMgr->GetIntDefault("Account.PasswordChangeSecurity", 0); + // Random Battleground Rewards + m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorFirst", 30); + m_int_configs[CONFIG_BG_REWARD_WINNER_ARENA_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerArenaFirst", 25); + m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorLast", 15); + m_int_configs[CONFIG_BG_REWARD_WINNER_ARENA_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerArenaLast", 0); + m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorFirst", 5); + m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorLast", 5); + // Max instances per hour m_int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetIntDefault("AccountInstancesPerHour", 5); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 907491437c..edcabf7109 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -330,6 +330,12 @@ enum WorldIntConfigs CONFIG_PACKET_SPOOF_BANMODE, CONFIG_PACKET_SPOOF_BANDURATION, CONFIG_ACC_PASSCHANGESEC, + CONFIG_BG_REWARD_WINNER_HONOR_FIRST, + CONFIG_BG_REWARD_WINNER_ARENA_FIRST, + CONFIG_BG_REWARD_WINNER_HONOR_LAST, + CONFIG_BG_REWARD_WINNER_ARENA_LAST, + CONFIG_BG_REWARD_LOSER_HONOR_FIRST, + CONFIG_BG_REWARD_LOSER_HONOR_LAST, INT_CONFIG_VALUE_COUNT }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index dbf2a80823..cd9c475c5a 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2137,6 +2137,29 @@ Battleground.GiveXPForKills = 0 Battleground.Random.ResetHour = 6 +# +# Battleground.RewardWinnerHonorFirst +# Battleground.RewardWinnerArenaFirst +# Battleground.RewardWinnerHonorLast +# Battleground.RewardWinnerArenaLast +# Battleground.RewardLoserHonorFirst +# Battleground.RewardLoserHonorLast +# Description: Random Battlegrounds / call to the arms rewards +# Default: 30 - Battleground.RewardWinnerHonorFirst +# 25 - Battleground.RewardWinnerArenaFirst +# 15 - Battleground.RewardWinnerHonorLast +# 0 - Battleground.RewardWinnerArenaLast +# 5 - Battleground.RewardLoserHonorFirst +# 5 - Battleground.RewardLoserHonorLast +# + +Battleground.RewardWinnerHonorFirst = 30 +Battleground.RewardWinnerArenaFirst = 25 +Battleground.RewardWinnerHonorLast = 15 +Battleground.RewardWinnerArenaLast = 0 +Battleground.RewardLoserHonorFirst = 5 +Battleground.RewardLoserHonorLast = 5 + # ################################################################################################### From e8675dd4ed7c97ea4e22d94d3981031d357d9e5f Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Sat, 7 Sep 2013 15:17:56 +0100 Subject: [PATCH 08/14] Scripts/Blood Furnace: Fix possible compile errors on old VS versions --- .../HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 54a1ccece5..8b23390160 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -306,7 +306,7 @@ class instance_blood_furnace : public InstanceMapScript void ResetPrisoners(const std::set& prisoners) { - for (std::set::iterator i = prisoners.begin(); i != prisoners.end(); ++i) + for (std::set::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) if (Creature* prisoner = instance->GetCreature(*i)) ResetPrisoner(prisoner); } @@ -400,7 +400,7 @@ class instance_blood_furnace : public InstanceMapScript void ActivatePrisoners(const std::set& prisoners) { - for (std::set::iterator i = prisoners.begin(); i != prisoners.end(); ++i) + for (std::set::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) if (Creature* prisoner = instance->GetCreature(*i)) { prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); From 00f3e423a523ab306ca183f6500c56c19518ea7c Mon Sep 17 00:00:00 2001 From: Filip Date: Sat, 7 Sep 2013 19:03:12 +0200 Subject: [PATCH 09/14] DB/Updates: AI fixups By @Aokromes, fixes #10733 #10728 --- sql/updates/world/2013_09_07_00_world_updates.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sql/updates/world/2013_09_07_00_world_updates.sql diff --git a/sql/updates/world/2013_09_07_00_world_updates.sql b/sql/updates/world/2013_09_07_00_world_updates.sql new file mode 100644 index 0000000000..93999e6202 --- /dev/null +++ b/sql/updates/world/2013_09_07_00_world_updates.sql @@ -0,0 +1,6 @@ +-- Scourge Tactics +UPDATE `smart_scripts` SET `link`=1 WHERE `entryorguid`=30273 AND `id`=0; +UPDATE `smart_scripts` SET `event_type`=61 WHERE `entryorguid`=30273 AND `id`=1; +-- Abjurist Belmara & Conjurer Luminrath +UPDATE `smart_scripts` SET `target_type`=7 WHERE `entryorguid`=19546 AND `id`=2; +UPDATE `smart_scripts` SET `target_type`=7, `target_param1`=0 WHERE `entryorguid`=19580 AND `id`=2; From 7eddda990530d96fcee465fb0948cb238069a443 Mon Sep 17 00:00:00 2001 From: NaydSucks Date: Sat, 7 Sep 2013 21:22:22 +0200 Subject: [PATCH 10/14] DB/Sai: Teron Gorefiend, I am... Added horde version for the script also. --- sql/updates/world/2013_09_07_01_world_sai.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sql/updates/world/2013_09_07_01_world_sai.sql diff --git a/sql/updates/world/2013_09_07_01_world_sai.sql b/sql/updates/world/2013_09_07_01_world_sai.sql new file mode 100644 index 0000000000..6afbe15f7b --- /dev/null +++ b/sql/updates/world/2013_09_07_01_world_sai.sql @@ -0,0 +1,4 @@ +-- Do not delete query id 0 +DELETE FROM `smart_scripts` WHERE `entryorguid` =21797 AND `source_type`=0 AND `id`>0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21797, 0, 1, 0, 19, 0, 100, 0, 10645, 0, 0, 0, 80, 2179700, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Ancient Shadowmoon Spirit - On Quest Accept - Run Script'); From fcf9552934aa671840e76293764cbfe60e7732a7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 8 Sep 2013 12:15:13 +0200 Subject: [PATCH 11/14] Core/SmartScripts: Fixed heap corruption in SMART_ACTION_EQUIP Closes #10739 --- src/server/game/AI/SmartScripts/SmartScript.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 111ac53e67..3a14e8946e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1447,7 +1447,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!einfo) { TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry()); - delete targets; break; } @@ -1991,13 +1990,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u e.GetTargetType() == SMART_TARGET_OWNER_OR_SUMMONER || e.GetTargetType() == SMART_TARGET_ACTION_INVOKER || e.GetTargetType() == SMART_TARGET_CLOSEST_ENEMY || e.GetTargetType() == SMART_TARGET_CLOSEST_FRIENDLY) { - if (ObjectList* targets = GetTargets(e, unit)) - { - if (WorldObject* target = targets->front()) - (*itr)->ToCreature()->SetHomePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation()); - - delete targets; - } + (*itr)->ToCreature()->SetHomePosition((*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ(), (*itr)->GetOrientation()); } else TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SET_HOME_POS is invalid, skipping"); From 688a35e25dc70b000d87f128a631262768ed7cc9 Mon Sep 17 00:00:00 2001 From: Filip Date: Sun, 8 Sep 2013 17:57:12 +0200 Subject: [PATCH 12/14] DB/SAI: Trapping the Light Fantastic (10674) & Gather the Orbs (10859) Fixes #7202 Adds support for the Alliance quest also, and makes the orbs go in tandem with the horde version script. --- sql/updates/world/2013_09_08_00_world_sai.sql | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sql/updates/world/2013_09_08_00_world_sai.sql diff --git a/sql/updates/world/2013_09_08_00_world_sai.sql b/sql/updates/world/2013_09_08_00_world_sai.sql new file mode 100644 index 0000000000..9a65ea9291 --- /dev/null +++ b/sql/updates/world/2013_09_08_00_world_sai.sql @@ -0,0 +1,68 @@ +-- Trapping the Light Fantastic (10674) & Gather the Orbs (10859) +SET @GOB_TRAP := 185011; -- Multi-Spectrum Light Trap +SET @NPC_BUNNY := 21926; -- Multi-Spectrum Light Trap Bunny +SET @ORB_TOTEM := 22333; -- Orb Collecting Totem +SET @NPC_CREDIT := 21929; -- Trapping the Light Kill Credit Trigger +SET @NPC_ORB1 := 20635; -- Razaani Light Orb +SET @NPC_ORB2 := 20771; -- Razaani Light Orb - Mini +SET @SPELL_PULL := 28337; -- Magnetic Pull +SET @ARC_EXPLOSION := 35426; -- Arcane Explosion + +DELETE FROM `creature_template_addon` WHERE `entry` IN (@NPC_ORB1,@NPC_ORB2); +INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(20635,0,0,0,4097,0,'32566'), +(20771,0,0,0,4097,0,'32566'); + +UPDATE `creature_template` SET `AIName`='SmartAI',`unit_flags`=unit_flags|0x02000000,`flags_extra`=130,`ScriptName`='' WHERE `entry` IN (@NPC_ORB1,@NPC_ORB2); +DELETE FROM `creature_ai_scripts` WHERE `creature_id` IN (@NPC_ORB1,@NPC_ORB2); +UPDATE `creature` SET `MovementType`=0 WHERE `id`=@NPC_ORB1; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC_ORB1,@NPC_ORB1*100,@NPC_ORB1*101,@NPC_ORB2,@NPC_ORB2*100,@NPC_ORB2*101) AND `source_type` IN (0,9); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +-- Alliance Version +(@NPC_ORB1,0,0,0,8,0,100,0,@SPELL_PULL,0,0,0,80,@NPC_ORB1*100,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Orb Bunny - On Spellhit - Start Action Script'), +(@NPC_ORB1*100,9,0,0,0,0,100,0,1000,1000,0,0,11,@ARC_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Orb Bunny - On Script - Cast Arcane Explosion'), +(@NPC_ORB1*100,9,1,0,0,0,100,0,500,500,0,0,45,1,1,0,0,0,0,19,@NPC_BUNNY,5,0,0,0,0,0, 'Orb Bunny - On Script - Cast Arcane Explosion'), +(@NPC_ORB1*100,9,2,0,0,0,100,0,0,0,0,0,41,100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Orb Bunny - On Script - Despawn'), +-- Horde Version +(@NPC_ORB1,0,1,0,38,0,100,0,0,1,30000,30000,69,1,0,0,0,0,0,19,@ORB_TOTEM,20,0,0,0,0,0, 'Light Orb - On Data Set 0 1 - Move to totem'), +(@NPC_ORB1,0,2,3,34,0,100,1,8,1,0,0,11,@ARC_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - On point 1 reached - Cast arcane explosion'), +(@NPC_ORB1,0,3,4,61,0,100,0,0,0,0,0,33,@NPC_CREDIT,0,0,0,0,0,12,1,0,0,0,0,0,0, 'Light Orb - On Link - Call kill credit'), +(@NPC_ORB1,0,4,0,61,0,100,0,0,0,0,0,80,@NPC_ORB1*101,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - On Link - Start action list to display arcase explosion'), +(@NPC_ORB1*101,9,0,0,0,0,100,0,0,0,0,0,47,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - Action 0 - Set unseen'), +(@NPC_ORB1*101,9,1,0,0,0,100,0,0,0,0,0,41,100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - Action 1 - Despawn in 100 ms'), +-- Alliance Version +(@NPC_ORB2,0,0,0,8,0,100,0,@SPELL_PULL,0,0,0,80,@NPC_ORB2*100,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Orb Bunny - On Spellhit - Start Action Script'), +(@NPC_ORB2*100,9,0,0,0,0,100,0,1000,1000,0,0,11,@ARC_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Orb Bunny - On Script - Cast Arcane Explosion'), +(@NPC_ORB2*100,9,1,0,0,0,100,0,500,500,0,0,45,1,1,0,0,0,0,19,@NPC_BUNNY,5,0,0,0,0,0, 'Orb Bunny - On Script - Cast Arcane Explosion'), +(@NPC_ORB2*100,9,2,0,0,0,100,0,0,0,0,0,41,100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Orb Bunny - On Script - Despawn'), +-- Horde Version +(@NPC_ORB2,0,1,0,38,0,100,0,1,1,30000,30000,69,1,0,0,0,0,0,19,@ORB_TOTEM,20,0,0,0,0,0, 'Light Orb - On Data Set 0 1 - Move to totem'), +(@NPC_ORB2,0,2,3,34,0,100,1,8,1,0,0,11,@ARC_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - On point 1 reached - Cast arcane explosion'), +(@NPC_ORB2,0,3,4,61,0,100,0,0,0,0,0,33,@NPC_CREDIT,0,0,0,0,0,12,1,0,0,0,0,0,0, 'Light Orb - On Link - Call kill credit'), +(@NPC_ORB2,0,4,0,61,0,100,0,0,0,0,0,80,@NPC_ORB2*101,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - On Link - Start action list to display arcase explosion'), +(@NPC_ORB2*101,9,0,0,0,0,100,0,0,0,0,0,47,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - Action 0 - Set unseen'), +(@NPC_ORB2*101,9,1,0,0,0,100,0,0,0,0,0,41,100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Light Orb - Action 1 - Despawn in 100 ms'); + +-- Alliance Multi-Spectrum Light Trap +UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=130,`ScriptName`='' WHERE `entry`=@NPC_BUNNY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC_BUNNY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@NPC_BUNNY,0,0,0,54,0,100,1,0,0,0,0,50,@GOB_TRAP,30000,0,0,0,0,1,0,0,0,0,0,0,0, 'Multi-Spectrum Light Trap - On spawn - Summon gob'), +(@NPC_BUNNY,0,1,0,1,0,100,1,0,0,0,0,9,0,0,0,0,0,0,15,@GOB_TRAP,0,0,0,0,0,0, 'Multi-Spectrum Light Trap - OOC - Activate gob'), +-- +(@NPC_BUNNY,0,2,0,1,0,100,1,3000,3000,3000,3000,11,@SPELL_PULL,0,0,0,0,0,19,@NPC_ORB1,20,0,0,0,0,0, 'Multi-Spectrum Light Trap - OOC 3 sec - Pull Razaani Light Orb'), +(@NPC_BUNNY,0,3,0,1,0,100,1,3000,3000,3000,3000,11,@SPELL_PULL,0,0,0,0,0,19,@NPC_ORB2,20,0,0,0,0,0, 'Multi-Spectrum Light Trap - OOC 3 sec - Pull Razaani Light Orb - Mini'), +(@NPC_BUNNY,0,4,5,38,0,100,1,1,1,0,0,33,@NPC_CREDIT,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Multi-Spectrum Light Trap - On Data Set - Give Quest Credit'), +(@NPC_BUNNY,0,5,0,61,0,100,1,0,0,0,0,9,0,0,0,0,0,0,15,@GOB_TRAP,0,0,0,0,0,0, 'Link - Activate gob - Gob'); + +-- Horde Totem +UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=0,`ScriptName`='' WHERE `entry`=@ORB_TOTEM; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ORB_TOTEM; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ORB_TOTEM,0,0,1,54,0,100,0,0,0,0,0,45,0,1,0,0,0,0,19,@NPC_ORB1,20,0,0,0,0,0, 'Orb collecting totem - On spawned - Set Data 0 1'), +(@ORB_TOTEM,0,1,2,61,0,100,0,0,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Orb collecting totem - On Link - Store invoker'), +(@ORB_TOTEM,0,2,0,61,0,100,0,0,0,0,0,100,1,0,0,0,0,0,19,@NPC_ORB1,20,0,0,0,0,0, 'Orb collecting totem - On Link - Send stored target list 1'), +-- +(@ORB_TOTEM,0,3,4,54,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,@NPC_ORB2,20,0,0,0,0,0, 'Orb collecting totem - On spawned - Set Data 0 1'), +(@ORB_TOTEM,0,4,5,61,0,100,0,0,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Orb collecting totem - On Link - Store invoker'), +(@ORB_TOTEM,0,5,0,61,0,100,0,0,0,0,0,100,1,0,0,0,0,0,19,@NPC_ORB2,20,0,0,0,0,0, 'Orb collecting totem - On Link - Send stored target list 1'); From 79307bc884e69e9f8dd60bd5a592a2a6b0a32e4a Mon Sep 17 00:00:00 2001 From: Filip Date: Sun, 8 Sep 2013 18:10:08 +0200 Subject: [PATCH 13/14] DB/Update: Needs null spawndist --- sql/updates/world/2013_09_08_01_world_update.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2013_09_08_01_world_update.sql diff --git a/sql/updates/world/2013_09_08_01_world_update.sql b/sql/updates/world/2013_09_08_01_world_update.sql new file mode 100644 index 0000000000..e2046f0267 --- /dev/null +++ b/sql/updates/world/2013_09_08_01_world_update.sql @@ -0,0 +1,2 @@ +-- -.- >.> <.< -_- ._. +UPDATE `creature` SET `spawndist`=0 WHERE`id`=20635; From be5cf42ec392e8526d3180e51ffaacb84e883fae Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 9 Sep 2013 17:44:07 +0200 Subject: [PATCH 14/14] Core/SmartAI: Fixed creatures using SAI not attacking its charmer after it breaks Closes #7601 --- src/server/game/AI/SmartScripts/SmartAI.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index a1862c07d1..a56d0f94f2 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -699,6 +699,10 @@ void SmartAI::InitializeAI() void SmartAI::OnCharmed(bool apply) { GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply); + + if (!apply && !me->IsInEvadeMode() && me->GetUInt64Value(UNIT_FIELD_CHARMEDBY)) + if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetUInt64Value(UNIT_FIELD_CHARMEDBY))) + AttackStart(charmer); } void SmartAI::DoAction(int32 param)