diff options
30 files changed, 364 insertions, 440 deletions
diff --git a/sql/updates/world/master/2018_01_14_00_world.sql b/sql/updates/world/master/2018_01_14_00_world.sql new file mode 100644 index 00000000000..adb43a5478d --- /dev/null +++ b/sql/updates/world/master/2018_01_14_00_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 600 AND 704; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 724 AND 726; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 753 AND 755; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1205 AND 1333; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 10056 AND 10066; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c293c1914a1..b20329cd319 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -933,7 +933,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.flee.withEmote) { - Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST); + Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST, me->getGender()); CreatureTextMgr::SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: %s DoFleeToGetAssistance", me->GetGUID().ToString().c_str()); @@ -1205,7 +1205,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u me->CallForHelp((float)e.action.callHelp.range); if (e.action.callHelp.withEmote) { - Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP); + Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP, me->getGender()); CreatureTextMgr::SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_FOR_HELP: %s", me->GetGUID().ToString().c_str()); diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 32b301d44ab..facf598d5fc 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -589,7 +589,7 @@ void PlayerAchievementMgr::SendAchievementEarned(AchievementEntry const* achieve { if (Guild* guild = sGuildMgr->GetGuildById(_owner->GetGuildId())) { - Trinity::BroadcastTextBuilder _builder(_owner, CHAT_MSG_GUILD_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, _owner, achievement->ID); + Trinity::BroadcastTextBuilder _builder(_owner, CHAT_MSG_GUILD_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, _owner->getGender(), _owner, achievement->ID); Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> _localizer(_builder); guild->BroadcastWorker(_localizer, _owner); } @@ -606,7 +606,7 @@ void PlayerAchievementMgr::SendAchievementEarned(AchievementEntry const* achieve // if player is in world he can tell his friends about new achievement else if (_owner->IsInWorld()) { - Trinity::BroadcastTextBuilder _builder(_owner, CHAT_MSG_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, _owner, achievement->ID); + Trinity::BroadcastTextBuilder _builder(_owner, CHAT_MSG_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, _owner->getGender(), _owner, achievement->ID); Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> _localizer(_builder); Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder>> _worker(_owner, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), _localizer); Cell::VisitWorldObjects(_owner, _worker, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index 1011d0e574c..b7468b8d170 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -19,7 +19,6 @@ #include "ArenaTeamMgr.h" #include "GuildMgr.h" #include "Guild.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "ObjectAccessor.h" @@ -35,10 +34,10 @@ Arena::Arena() StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = ARENA_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_SECOND] = ARENA_TEXT_START_THIRTY_SECONDS; + StartMessageIds[BG_STARTING_EVENT_THIRD] = ARENA_TEXT_START_FIFTEEN_SECONDS; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = ARENA_TEXT_START_BATTLE_HAS_BEGUN; } void Arena::AddPlayer(Player* player) diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index cfb6db45f53..eac21426e48 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.h @@ -21,6 +21,14 @@ #include "ArenaScore.h" #include "Battleground.h" +enum ArenaBroadcastTexts +{ + ARENA_TEXT_START_ONE_MINUTE = 15740, + ARENA_TEXT_START_THIRTY_SECONDS = 15741, + ARENA_TEXT_START_FIFTEEN_SECONDS = 15739, + ARENA_TEXT_START_BATTLE_HAS_BEGUN = 15742, +}; + enum ArenaSpellIds { SPELL_ALLIANCE_GOLD_FLAG = 32724, diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index f7cfa54efa2..86e05435710 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -20,7 +20,7 @@ #include "BattlegroundMgr.h" #include "BattlegroundPackets.h" #include "BattlegroundScore.h" -#include "ChatPackets.h" +#include "ChatTextBuilder.h" #include "Creature.h" #include "CreatureTextMgr.h" #include "DatabaseEnv.h" @@ -33,7 +33,6 @@ #include "Map.h" #include "MiscPackets.h" #include "ObjectAccessor.h" -#include "ObjectMgr.h" #include "Player.h" #include "ReputationMgr.h" #include "SpellAuras.h" @@ -43,76 +42,6 @@ #include "WorldStatePackets.h" #include <cstdarg> -namespace Trinity -{ - class BattlegroundChatBuilder - { - public: - BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = NULL) - : _msgtype(msgtype), _textId(textId), _source(source), _args(args) { } - - WorldPackets::Packet* operator()(LocaleConstant loc_idx) - { - char const* text = sObjectMgr->GetTrinityString(_textId, loc_idx); - if (_args) - { - // we need copy va_list before use or original va_list will corrupted - va_list ap; - va_copy(ap, *_args); - - char str[2048]; - vsnprintf(str, 2048, text, ap); - va_end(ap); - - return do_helper(&str[0]); - } - - return do_helper(text); - } - - private: - WorldPackets::Packet* do_helper(char const* text) - { - WorldPackets::Chat::Chat* packet = new WorldPackets::Chat::Chat(); - packet->Initialize(_msgtype, LANG_UNIVERSAL, _source, _source, text); - return packet; - } - - ChatMsg _msgtype; - uint32 _textId; - Player const* _source; - va_list* _args; - }; - - class Battleground2ChatBuilder - { - public: - Battleground2ChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, uint32 arg1, uint32 arg2) - : _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) { } - - WorldPackets::Packet* operator()(LocaleConstant loc_idx) - { - char const* text = sObjectMgr->GetTrinityString(_textId, loc_idx); - char const* arg1str = _arg1 ? sObjectMgr->GetTrinityString(_arg1, loc_idx) : ""; - char const* arg2str = _arg2 ? sObjectMgr->GetTrinityString(_arg2, loc_idx) : ""; - - char str[2048]; - snprintf(str, 2048, text, arg1str, arg2str); - - WorldPackets::Chat::Chat* packet = new WorldPackets::Chat::Chat(); - packet->Initialize(_msgtype, LANG_UNIVERSAL, _source, _source, str); - return packet; - } - - private: - ChatMsg _msgtype; - uint32 _textId; - Player const* _source; - uint32 _arg1; - uint32 _arg2; - }; -} // namespace Trinity - template<class Do> void Battleground::BroadcastWorker(Do& _do) { @@ -188,11 +117,11 @@ Battleground::Battleground() StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - //we must set to some default existing values - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + + StartMessageIds[BG_STARTING_EVENT_FIRST] = BG_TEXT_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_TEXT_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_TEXT_BATTLE_HAS_BEGUN; } Battleground::~Battleground() @@ -516,19 +445,22 @@ inline void Battleground::_ProcessJoin(uint32 diff) StartingEventCloseDoors(); SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FIRST]); // First start warning - 2 or 1 minute - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); + if (StartMessageIds[BG_STARTING_EVENT_FIRST]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 1 minute or 30 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) { m_Events |= BG_STARTING_EVENT_2; - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); + if (StartMessageIds[BG_STARTING_EVENT_SECOND]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 30 or 15 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) { m_Events |= BG_STARTING_EVENT_3; - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); + if (StartMessageIds[BG_STARTING_EVENT_THIRD]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // Delay expired (after 2 or 1 minute) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) @@ -537,7 +469,8 @@ inline void Battleground::_ProcessJoin(uint32 diff) StartingEventOpenDoors(); - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH], CHAT_MSG_RAID_BOSS_EMOTE); + if (StartMessageIds[BG_STARTING_EVENT_FOURTH]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_FOURTH], CHAT_MSG_BG_SYSTEM_NEUTRAL); SetStatus(STATUS_IN_PROGRESS); SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]); @@ -688,6 +621,19 @@ void Battleground::SendChatMessage(Creature* source, uint8 textId, WorldObject* sCreatureTextMgr->SendChat(source, textId, target); } +void Battleground::SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target) +{ + if (!sBroadcastTextStore.LookupEntry(id)) + { + TC_LOG_ERROR("bg.battleground", "Battleground::SendBroadcastText: `broadcast_text` (ID: %u) was not found", id); + return; + } + + Trinity::BroadcastTextBuilder builder(nullptr, msgType, id, GENDER_MALE, target); + Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> localizer(builder); + BroadcastWorker(localizer); +} + void Battleground::PlaySoundToAll(uint32 soundID) { SendPacketToAll(WorldPackets::Misc::PlaySound(ObjectGuid::Empty, soundID).Write()); @@ -751,12 +697,12 @@ void Battleground::EndBattleground(uint32 winner) { RemoveFromBGFreeSlotQueue(); - int32 winmsg_id = 0; bool guildAwarded = false; if (winner == ALLIANCE) { - winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; + if (isBattleground()) + SendBroadcastText(BG_TEXT_ALLIANCE_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound @@ -764,7 +710,8 @@ void Battleground::EndBattleground(uint32 winner) } else if (winner == HORDE) { - winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS; + if (isBattleground()) + SendBroadcastText(BG_TEXT_HORDE_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound @@ -906,9 +853,6 @@ void Battleground::EndBattleground(uint32 winner) player->UpdateCriteria(CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1); } - - if (winmsg_id) - SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL); } uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const @@ -1692,17 +1636,17 @@ bool Battleground::AddSpiritGuide(uint32 type, Position const& pos, TeamId teamI return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamId); } -void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* source) +void Battleground::SendMessageToAll(uint32 entry, ChatMsg msgType, Player const* source) { if (!entry) return; - Trinity::BattlegroundChatBuilder bg_builder(type, entry, source); - Trinity::LocalizedPacketDo<Trinity::BattlegroundChatBuilder> bg_do(bg_builder); - BroadcastWorker(bg_do); + Trinity::TrinityStringChatBuilder builder(nullptr, msgType, entry, source); + Trinity::LocalizedPacketDo<Trinity::TrinityStringChatBuilder> localizer(builder); + BroadcastWorker(localizer); } -void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...) +void Battleground::PSendMessageToAll(uint32 entry, ChatMsg msgType, Player const* source, ...) { if (!entry) return; @@ -1710,20 +1654,13 @@ void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* s va_list ap; va_start(ap, source); - Trinity::BattlegroundChatBuilder bg_builder(type, entry, source, &ap); - Trinity::LocalizedPacketDo<Trinity::BattlegroundChatBuilder> bg_do(bg_builder); - BroadcastWorker(bg_do); + Trinity::TrinityStringChatBuilder builder(nullptr, msgType, entry, source, &ap); + Trinity::LocalizedPacketDo<Trinity::TrinityStringChatBuilder> localizer(builder); + BroadcastWorker(localizer); va_end(ap); } -void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2) -{ - Trinity::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2); - Trinity::LocalizedPacketDo<Trinity::Battleground2ChatBuilder> bg_do(bg_builder); - BroadcastWorker(bg_do); -} - void Battleground::EndNow() { RemoveFromBGFreeSlotQueue(); diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 8edacecd23c..a64c5896afa 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -62,6 +62,17 @@ enum BattlegroundCriteriaId BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH, }; +enum BattlegroundBroadcastTexts +{ + BG_TEXT_ALLIANCE_WINS = 10633, + BG_TEXT_HORDE_WINS = 10634, + + BG_TEXT_START_TWO_MINUTES = 18193, + BG_TEXT_START_ONE_MINUTE = 18194, + BG_TEXT_START_HALF_MINUTE = 18195, + BG_TEXT_BATTLE_HAS_BEGUN = 18196, +}; + enum BattlegroundSounds { SOUND_HORDE_WINS = 8454, @@ -380,6 +391,7 @@ class TC_GAME_API Battleground void SendPacketToAll(WorldPacket const* packet) const; void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = NULL); + void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr); template<class Do> void BroadcastWorker(Do& _do); @@ -397,9 +409,6 @@ class TC_GAME_API Battleground void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = NULL); void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...); - // specialized version with 2 string id args - void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0); - // Raid Group Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; } void SetBgRaid(uint32 TeamID, Group* bg_raid); diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 0715a9fa3c3..0e75ef7d6a5 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -37,6 +37,7 @@ #include "DB2Stores.h" #include "DisableMgr.h" #include "GameEventMgr.h" +#include "Language.h" #include "Log.h" #include "Map.h" #include "MapInstanced.h" @@ -46,7 +47,6 @@ #include "Player.h" #include "SharedDefines.h" #include "World.h" -#include "WorldPacket.h" bool BattlegroundTemplate::IsArena() const { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 83f479d6cd4..1fb5d33d108 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -475,8 +475,6 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime); m_events.AddEvent(removeEvent, m_events.CalculateTime(INVITE_ACCEPT_WAIT_TIME)); - WorldPacket data; - uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); TC_LOG_DEBUG("bg.battleground", "Battleground: invited player %s (%s) to BG instance %u queueindex %u bgtype %u", diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 7f5df3e8286..add87a77739 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -21,14 +21,12 @@ #include "Creature.h" #include "DB2Stores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "Player.h" #include "Random.h" #include "SpellInfo.h" #include "Util.h" -#include "WorldSession.h" #include "WorldStatePackets.h" BattlegroundAB::BattlegroundAB() @@ -58,11 +56,6 @@ BattlegroundAB::BattlegroundAB() m_HonorTics = 0; m_ReputationTics = 0; - - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; } BattlegroundAB::~BattlegroundAB() { } @@ -104,19 +97,17 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) // create new occupied banner _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); - _NodeOccupied(node, (teamIndex == 0) ? ALLIANCE:HORDE); + _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE : HORDE); // Message to chatlog - if (teamIndex == 0) + if (teamIndex == TEAM_ALLIANCE) { - // FIXME: team and node names not localized - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE); } else { - // FIXME: team and node names not localized - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE); } } @@ -158,9 +149,9 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE) { if (team == TEAM_ALLIANCE) - SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_AB_TEXT_ALLIANCE_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); else - SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_AB_TEXT_HORDE_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY); m_IsInformedNearVictory = true; } @@ -307,21 +298,6 @@ void BattlegroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) SpawnBGObject(obj, RESPAWN_ONE_DAY); } -int32 BattlegroundAB::_GetNodeNameId(uint8 node) -{ - switch (node) - { - case BG_AB_NODE_STABLES: return LANG_BG_AB_NODE_STABLES; - case BG_AB_NODE_BLACKSMITH: return LANG_BG_AB_NODE_BLACKSMITH; - case BG_AB_NODE_FARM: return LANG_BG_AB_NODE_FARM; - case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL; - case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE; - default: - ABORT(); - } - return 0; -} - void BattlegroundAB::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { const uint8 plusArray[] = {0, 2, 3, 0, 1}; @@ -469,11 +445,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: team and node names not localized - if (teamIndex == 0) - SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY); + if (teamIndex == TEAM_ALLIANCE) + SendBroadcastText(ABNodes[node].TextAllianceClaims, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); + SendBroadcastText(ABNodes[node].TextHordeClaims, CHAT_MSG_BG_SYSTEM_HORDE, source); sound = BG_AB_SOUND_NODE_CLAIMED; } @@ -493,11 +468,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, source); } // If contested, change back to occupied else @@ -511,13 +485,12 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; - _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE:HORDE); + _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE : HORDE); - // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeDefended, CHAT_MSG_BG_SYSTEM_HORDE, source); } sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } @@ -535,11 +508,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _NodeDeOccupied(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, source); sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } @@ -547,11 +519,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ // If node is occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { - // FIXME: team and node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE); else - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE); } PlaySoundToAll(sound); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 59f5a8e1f66..34104fff69b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -152,6 +152,34 @@ enum BG_AB_BattlegroundNodes BG_AB_ALL_NODES_COUNT = 7 // all nodes (dynamic and static) }; +enum BG_AB_BroadcastTexts +{ + BG_AB_TEXT_ALLIANCE_NEAR_VICTORY = 10598, + BG_AB_TEXT_HORDE_NEAR_VICTORY = 10599, +}; + +struct ABNodeInfo +{ + uint32 NodeId; + uint32 TextAllianceAssaulted; + uint32 TextHordeAssaulted; + uint32 TextAllianceTaken; + uint32 TextHordeTaken; + uint32 TextAllianceDefended; + uint32 TextHordeDefended; + uint32 TextAllianceClaims; + uint32 TextHordeClaims; +}; + +ABNodeInfo const ABNodes[BG_AB_DYNAMIC_NODES_COUNT] = +{ + { BG_AB_NODE_STABLES, 10199, 10200, 10203, 10204, 10201, 10202, 10286, 10287 }, + { BG_AB_NODE_BLACKSMITH, 10211, 10212, 10213, 10214, 10215, 10216, 10290, 10291 }, + { BG_AB_NODE_FARM, 10217, 10218, 10219, 10220, 10221, 10222, 10288, 10289 }, + { BG_AB_NODE_LUMBER_MILL, 10224, 10225, 10226, 10227, 10228, 10229, 10284, 10285 }, + { BG_AB_NODE_GOLD_MINE, 10230, 10231, 10232, 10233, 10234, 10235, 10282, 10283 } +}; + enum BG_AB_NodeStatus { BG_AB_NODE_TYPE_NEUTRAL = 0, @@ -323,8 +351,6 @@ class BattlegroundAB : public Battleground void _NodeOccupied(uint8 node, Team team); void _NodeDeOccupied(uint8 node); - int32 _GetNodeNameId(uint8 node); - /* Nodes info: 0: neutral 1: ally contested diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index bcab896c4f6..44c99152a1b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -21,12 +21,9 @@ #include "CreatureAI.h" #include "DB2Stores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "MotionMaster.h" -#include "ObjectMgr.h" #include "Player.h" -#include "WorldSession.h" #include "WorldStatePackets.h" BattlegroundAV::BattlegroundAV() @@ -52,10 +49,9 @@ BattlegroundAV::BattlegroundAV() for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) InitNode(i, 0, false); - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_AV_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_AV_TEXT_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_AV_TEXT_BATTLE_HAS_BEGUN; } BattlegroundAV::~BattlegroundAV() { } @@ -265,7 +261,10 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points) } else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE) { - SendMessageToAll(teamindex == TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE); + if (teamindex == TEAM_ALLIANCE) + SendBroadcastText(BG_AV_TEXT_ALLIANCE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_ALLIANCE); + else + SendBroadcastText(BG_AV_TEXT_HORDE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_HORDE); PlaySoundToAll(AV_SOUND_NEAR_VICTORY); m_IsInformedNearVictory[teamindex] = true; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 970f32f9fc5..7c4413f68d5 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -55,6 +55,16 @@ enum SharedActions ACTION_BUFF_YELL = -30001 }; +enum BG_AV_BroadcastTexts +{ + BG_AV_TEXT_START_ONE_MINUTE = 10638, + BG_AV_TEXT_START_HALF_MINUTE = 10639, + BG_AV_TEXT_BATTLE_HAS_BEGUN = 10640, + + BG_AV_TEXT_ALLIANCE_NEAR_LOSE = 23210, + BG_AV_TEXT_HORDE_NEAR_LOSE = 23211 +}; + enum BG_AV_Sounds { /// @todo: get out if there comes a sound when neutral team captures mine diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 1d6225f6ff6..74442e6a158 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -19,7 +19,6 @@ #include "BattlegroundBE.h" #include "Log.h" #include "Player.h" -#include "WorldPacket.h" #include "WorldStatePackets.h" BattlegroundBE::BattlegroundBE() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 7486bca30ee..e1075819874 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -21,7 +21,6 @@ #include "Log.h" #include "Player.h" #include "Random.h" -#include "WorldPacket.h" #include "WorldStatePackets.h" BattlegroundDS::BattlegroundDS() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index c7ebf6950a3..84e8b89d948 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -22,7 +22,6 @@ #include "Creature.h" #include "DB2Stores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "ObjectAccessor.h" @@ -70,11 +69,6 @@ BattlegroundEY::BattlegroundEY() for (uint8 i = 0; i < 2 * EY_POINTS_MAX; ++i) m_CurrentPointPlayersCount[i] = 0; - - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; } BattlegroundEY::~BattlegroundEY() { } @@ -310,16 +304,6 @@ void BattlegroundEY::UpdatePointStatuses() void BattlegroundEY::UpdateTeamScore(uint32 Team) { uint32 score = GetTeamScore(Team); - /// @todo there should be some sound played when one team is near victory!! - and define variables - /*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE) - { - if (Team == ALLIANCE) - SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - else - SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY); - m_IsInformedNearVictory = true; - }*/ if (score >= BG_EY_MAX_TEAM_SCORE) { @@ -596,7 +580,7 @@ void BattlegroundEY::RespawnFlag(bool send_message) if (send_message) { - SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_EY_TEXT_FLAG_RESET, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound... } @@ -656,9 +640,9 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player) UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN); if (player->GetTeam() == ALLIANCE) - SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL); + SendBroadcastText(BG_EY_TEXT_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE); else - SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL); + SendBroadcastText(BG_EY_TEXT_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE); } void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) @@ -688,9 +672,9 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* target player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (player->GetTeam() == ALLIANCE) - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, player->GetName().c_str()); + SendBroadcastText(BG_EY_TEXT_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str()); + SendBroadcastText(BG_EY_TEXT_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); } void BattlegroundEY::EventTeamLostPoint(Player* player, uint32 Point) @@ -729,9 +713,9 @@ void BattlegroundEY::EventTeamLostPoint(Player* player, uint32 Point) m_PointState[Point] = EY_POINT_NO_OWNER; if (Team == ALLIANCE) - SendMessageToAll(m_LosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(m_LosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - SendMessageToAll(m_LosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(m_LosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); @@ -773,9 +757,9 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) m_PointState[Point] = EY_POINT_UNDER_CONTROL; if (Team == ALLIANCE) - SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); if (!BgCreatures[Point].IsEmpty()) DelCreature(Point); @@ -819,27 +803,22 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (player->GetTeam() == ALLIANCE) + { + SendBroadcastText(BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); + } else + { + SendBroadcastText(BG_EY_TEXT_HORDE_CAPTURED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); + } SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY); m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; m_FlagCapturedBgObjectType = BgObjectType; - uint8 team_id = 0; - if (player->GetTeam() == ALLIANCE) - { - team_id = TEAM_ALLIANCE; - SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - } - else - { - team_id = TEAM_HORDE; - SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player); - } - + uint8 team_id = player->GetTeam() == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; if (m_TeamPointsCount[team_id] > 0) AddPoints(player->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index ed1b3a19623..5c50461c8f1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -21,7 +21,6 @@ #include "Battleground.h" #include "BattlegroundScore.h" -#include "Language.h" #include "Object.h" enum BG_EY_Misc @@ -254,6 +253,35 @@ enum BG_EY_ExploitTeleportLocations EY_EXPLOIT_TELEPORT_LOCATION_HORDE = 3772 }; +enum BG_EY_BroadcastTexts +{ + BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS = 17828, + BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS = 17829, + BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS = 17835, + BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS = 17836, + + BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER = 17819, + BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER = 17823, + BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER = 17831, + BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER = 17832, + + BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS = 17826, + BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS = 17827, + BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS = 17833, + BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS = 17834, + + BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER = 17824, + BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER = 17825, + BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER = 17837, + BG_EY_TEXT_HORDE_LOST_MAGE_TOWER = 17838, + + BG_EY_TEXT_TAKEN_FLAG = 18359, + BG_EY_TEXT_FLAG_DROPPED = 18361, + BG_EY_TEXT_FLAG_RESET = 18364, + BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG = 18375, + BG_EY_TEXT_HORDE_CAPTURED_FLAG = 18384, +}; + struct BattlegroundEYPointIconsStruct { BattlegroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex) @@ -316,17 +344,17 @@ const BattlegroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] = }; const BattlegroundEYLosingPointStruct m_LosingPointTypes[EY_POINTS_MAX] = { - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS), - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER), - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS), - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER) + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS), + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER), + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS), + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_HORDE_LOST_MAGE_TOWER) }; const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] = { - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REAVER), - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF), - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER) + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS, EY_GRAVEYARD_FEL_REAVER), + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER, EY_GRAVEYARD_BLOOD_ELF), + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER, EY_GRAVEYARD_MAGE_TOWER) }; struct BattlegroundEYScore final : public BattlegroundScore diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index f7aa4f69d16..761da3d54f7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -19,10 +19,8 @@ #include "BattlegroundIC.h" #include "Creature.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" -#include "ObjectMgr.h" #include "Player.h" #include "Transport.h" #include "UnitAI.h" @@ -34,11 +32,6 @@ BattlegroundIC::BattlegroundIC() BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS + MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS + MAX_FORTRESS_TELEPORTER_EFFECTS_SPAWNS); BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS + MAX_HANGAR_NPCS_SPAWNS); - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN; - for (uint8 i = 0; i < 2; ++i) factionReinforcements[i] = MAX_REINFORCEMENTS; @@ -194,7 +187,10 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) UpdateNodeWorldState(&nodePoint[i]); HandleCapturedNodes(&nodePoint[i], false); - SendMessage2ToAll(LANG_BG_IC_TEAM_HAS_TAKEN_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (nodePoint[i].faction == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE), nodePoint[i].string); + if (nodePoint[i].faction == TEAM_ALLIANCE) + SendBroadcastText(ICNodes[i].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE); + else + SendBroadcastText(ICNodes[i].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE); nodePoint[i].needChange = false; nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; @@ -417,13 +413,6 @@ void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer) EndBattleground(killer->GetTeam()); } -void BattlegroundIC::EndBattleground(uint32 winner) -{ - SendMessage2ToAll(LANG_BG_IC_TEAM_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (winner == ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE)); - - Battleground::EndBattleground(winner); -} - void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) @@ -461,15 +450,23 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); - SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_1, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string); - SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE)); + if (nodePoint[i].faction == TEAM_ALLIANCE) + SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + else + SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player); + HandleContestedNodes(&nodePoint[i]); } else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED]) // if we are going to spawn the definitve faction banner, we dont need the timer anymore { nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; nodePoint[i].needChange = false; - SendMessage2ToAll(LANG_BG_IC_TEAM_DEFENDED_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string); + + if (nodePoint[i].faction == TEAM_ALLIANCE) + SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + else + SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_HORDE, player); + HandleCapturedNodes(&nodePoint[i], true); UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1); } @@ -812,26 +809,36 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) GetBGObject(BG_IC_GO_ALLIANCE_BANNER)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } - uint32 lang_entry = 0; - + uint32 textId; + ChatMsg msgType; switch (go->GetEntry()) { case GO_HORDE_GATE_1: - lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED; + textId = BG_IC_TEXT_FRONT_GATE_HORDE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE; break; case GO_HORDE_GATE_2: - case GO_ALLIANCE_GATE_1: - lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED; + textId = BG_IC_TEXT_WEST_GATE_HORDE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE; break; case GO_HORDE_GATE_3: + textId = BG_IC_TEXT_EAST_GATE_HORDE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE; + break; + case GO_ALLIANCE_GATE_1: + textId = BG_IC_TEXT_WEST_GATE_ALLIANCE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_HORDE; + break; case GO_ALLIANCE_GATE_2: - lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED; + textId = BG_IC_TEXT_EAST_GATE_ALLIANCE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_HORDE; break; case GO_ALLIANCE_GATE_3: - lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED; + textId = BG_IC_TEXT_FRONT_GATE_ALLIANCE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_HORDE; break; default: - break; + return; } if (go->GetEntry() == GO_HORDE_GATE_1 || go->GetEntry() == GO_HORDE_GATE_2 || go->GetEntry() == GO_HORDE_GATE_3) @@ -845,7 +852,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry); } - SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP)); + SendBroadcastText(textId, msgType); } WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveYard(Player* player) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 92c770f68eb..4fa3a424bac 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -21,7 +21,6 @@ #include "Battleground.h" #include "BattlegroundScore.h" -#include "Language.h" #include "Object.h" const uint32 BG_IC_Factions[2] = @@ -853,6 +852,36 @@ Position const BG_IC_SpiritGuidePos[MAX_NODE_TYPES+2] = {1148.65f, -1250.98f, 16.60f, 1.74f}, // last resort horde }; +enum ICBroadcastTexts +{ + BG_IC_TEXT_FRONT_GATE_HORDE_DESTROYED = 35409, + BG_IC_TEXT_FRONT_GATE_ALLIANCE_DESTROYED = 35410, + BG_IC_TEXT_WEST_GATE_HORDE_DESTROYED = 35411, + BG_IC_TEXT_WEST_GATE_ALLIANCE_DESTROYED = 35412, + BG_IC_TEXT_EAST_GATE_HORDE_DESTROYED = 35413, + BG_IC_TEXT_EAST_GATE_ALLIANCE_DESTROYED = 35414 +}; + +struct ICNodeInfo +{ + uint32 NodeId; + uint32 TextAssaulted; + uint32 TextDefended; + uint32 TextAllianceTaken; + uint32 TextHordeTaken; +}; + +ICNodeInfo const ICNodes[MAX_NODE_TYPES] = +{ + { NODE_TYPE_REFINERY, 35377, 35378, 35379, 35380 }, + { NODE_TYPE_QUARRY, 35373, 35374, 35375, 35376 }, + { NODE_TYPE_DOCKS, 35365, 35366, 35367, 35368 }, + { NODE_TYPE_HANGAR, 35369, 35370, 35371, 35372 }, + { NODE_TYPE_WORKSHOP, 35278, 35286, 35279, 35280 }, + { NODE_TYPE_GRAVEYARD_A, 35461, 35459, 35463, 35466 }, + { NODE_TYPE_GRAVEYARD_H, 35462, 35460, 35464, 35465 } +}; + // I.E: Hangar, Quarry, Graveyards .. etc struct ICNodePoint { @@ -866,18 +895,17 @@ struct ICNodePoint uint32 last_entry; // the last gameobject_entry uint32 worldStates[5]; // the worldstates that represent the node in the map ICNodeState nodeState; - uint32 string; }; -const ICNodePoint nodePointInitial[7] = +const ICNodePoint nodePointInitial[MAX_NODE_TYPES] = { - {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_REFINERY}, - {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_QUARRY}, - {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_DOCKS}, - {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_HANGAR}, - {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_WORKSHOP}, - {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_A, LANG_BG_IC_ALLIANCE_KEEP}, - {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_H, LANG_BG_IC_HORDE_KEEP} + {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_A}, + {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_H} }; enum HonorRewards @@ -942,7 +970,6 @@ class BattlegroundIC : public Battleground void SpawnLeader(uint32 teamid); void HandleKillUnit(Creature* unit, Player* killer) override; void HandleKillPlayer(Player* player, Player* killer) override; - void EndBattleground(uint32 winner) override; void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) override; void DestroyGate(Player* player, GameObject* go) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 69c6dbbbf70..136f2c7568b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -19,7 +19,6 @@ #include "BattlegroundNA.h" #include "Log.h" #include "Player.h" -#include "WorldPacket.h" #include "WorldStatePackets.h" BattlegroundNA::BattlegroundNA() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index bfef520f4e6..ad6408d68f2 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -19,7 +19,6 @@ #include "BattlegroundRL.h" #include "Log.h" #include "Player.h" -#include "WorldPacket.h" #include "WorldStatePackets.h" BattlegroundRL::BattlegroundRL() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index d735973cb76..7841908be15 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -21,7 +21,6 @@ #include "Log.h" #include "ObjectAccessor.h" #include "Player.h" -#include "WorldPacket.h" #include "WorldStatePackets.h" BattlegroundRV::BattlegroundRV() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 4d8c28da197..f0273466cd8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -21,7 +21,6 @@ #include "CreatureAI.h" #include "DB2Stores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "ObjectAccessor.h" @@ -32,10 +31,7 @@ BattlegroundSA::BattlegroundSA() { - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; // handle by Kanrethad BgObjects.resize(BG_SA_MAXOBJ); BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY); @@ -324,7 +320,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) { SignaledRoundTwo = true; InitSecondRound = false; - SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_ROUND_TWO_START_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); } } else @@ -381,7 +377,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) if (!SignaledRoundTwoHalfMin) { SignaledRoundTwoHalfMin = true; - SendMessageToAll(LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); } } StartShips(); @@ -898,9 +894,9 @@ void BattlegroundSA::TitanRelicActivated(Player* clicker) if (clicker->GetTeamId() == Attackers) { if (clicker->GetTeamId() == TEAM_ALLIANCE) - SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_ALLIANCE_CAPTURED_TITAN_PORTAL, CHAT_MSG_BG_SYSTEM_ALLIANCE); else - SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_HORDE_CAPTURED_TITAN_PORTAL, CHAT_MSG_BG_SYSTEM_HORDE); if (Status == BG_SA_ROUND_ONE) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index c6d2178047a..39b7527d122 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -482,6 +482,15 @@ float const BG_SA_GYOrientation[BG_SA_MAX_GY] = 6.148f, // defender last GY }; +enum BG_SA_BroadcastTexts +{ + BG_SA_TEXT_ALLIANCE_CAPTURED_TITAN_PORTAL = 28944, + BG_SA_TEXT_HORDE_CAPTURED_TITAN_PORTAL = 28945, + + BG_SA_TEXT_ROUND_TWO_START_ONE_MINUTE = 29448, + BG_SA_TEXT_ROUND_TWO_START_HALF_MINUTE = 29449 +}; + struct GateInfo { uint8 GateId; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index ed3bc4151b6..d62033dc077 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -18,17 +18,14 @@ #include "BattlegroundWS.h" #include "BattlegroundMgr.h" -#include "BattlegroundPackets.h" #include "DB2Stores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "Object.h" #include "ObjectAccessor.h" #include "Player.h" #include "SpellInfo.h" -#include "WorldPacket.h" #include "WorldStatePackets.h" // these variables aren't used outside of this file, so declare them only here @@ -51,10 +48,10 @@ BattlegroundWS::BattlegroundWS() BgObjects.resize(BG_WS_OBJECT_MAX); BgCreatures.resize(BG_CREATURES_MAX_WS); - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_WS_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_WS_TEXT_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_WS_TEXT_BATTLE_HAS_BEGUN; + _flagSpellForceTimer = 0; _bothFlagsKept = false; _flagDebuffState = 0; @@ -277,7 +274,7 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) //when map_update will be allowed for battlegrounds this code will be useless SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_WS_TEXT_FLAGS_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound... } _bothFlagsKept = false; @@ -290,16 +287,11 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) RespawnFlag(team, false); if (team == ALLIANCE) - { SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); - } else - { SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); - } + SendBroadcastText(BG_WS_TEXT_FLAGS_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) @@ -364,9 +356,9 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); if (player->GetTeam() == ALLIANCE) - SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(BG_WS_TEXT_CAPTURED_HORDE_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateFlagState(player->GetTeam(), 1); // flag state none UpdateTeamScore(player->GetTeamId()); @@ -474,12 +466,12 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) if (player->GetTeam() == ALLIANCE) { - SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); } else { - SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } @@ -492,15 +484,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target if (GetStatus() != STATUS_IN_PROGRESS) return; - int32 message_id = 0; - ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL; - //alliance flag picked up from base if (player->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE && BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { - message_id = LANG_BG_WS_PICKEDUP_AF; - type = CHAT_MSG_BG_SYSTEM_HORDE; + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_HORDE, player); PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SetAllianceFlagPicker(player->GetGUID()); @@ -518,8 +506,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target if (player->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE && BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { - message_id = LANG_BG_WS_PICKEDUP_HF; - type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SetHordeFlagPicker(player->GetGUID()); @@ -539,8 +526,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target { if (player->GetTeam() == ALLIANCE) { - message_id = LANG_BG_WS_RETURNED_AF; - type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_RETURNED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN); RespawnFlag(ALLIANCE, false); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); @@ -550,8 +536,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target } else { - message_id = LANG_BG_WS_PICKEDUP_AF; - type = CHAT_MSG_BG_SYSTEM_HORDE; + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_HORDE, player); PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SetAllianceFlagPicker(player->GetGUID()); @@ -574,8 +559,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target { if (player->GetTeam() == HORDE) { - message_id = LANG_BG_WS_RETURNED_HF; - type = CHAT_MSG_BG_SYSTEM_HORDE; + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_RETURNED, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN); RespawnFlag(HORDE, false); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); @@ -585,8 +569,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target } else { - message_id = LANG_BG_WS_PICKEDUP_HF; - type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SetHordeFlagPicker(player->GetGUID()); @@ -603,10 +586,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target //target_obj->Delete(); } - if (!message_id) - return; - - SendMessageToAll(message_id, type, player); player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 729012bf32f..1508a76feba 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -31,6 +31,23 @@ enum BG_WS_TimerOrScore BG_WS_SPELL_BRUTAL_TIME = 900000 }; +enum BG_WS_BroadcastTexts +{ + BG_WS_TEXT_START_ONE_MINUTE = 10015, + BG_WS_TEXT_START_HALF_MINUTE = 10016, + BG_WS_TEXT_BATTLE_HAS_BEGUN = 10014, + + BG_WS_TEXT_CAPTURED_HORDE_FLAG = 9801, + BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG = 9802, + BG_WS_TEXT_FLAGS_PLACED = 9803, + BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP = 9804, + BG_WS_TEXT_ALLIANCE_FLAG_DROPPED = 9805, + BG_WS_TEXT_HORDE_FLAG_PICKED_UP = 9807, + BG_WS_TEXT_HORDE_FLAG_DROPPED = 9806, + BG_WS_TEXT_ALLIANCE_FLAG_RETURNED = 9808, + BG_WS_TEXT_HORDE_FLAG_RETURNED = 9809, +}; + enum BG_WS_Sound { BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173, diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5ebc44b9ab7..454673bf886 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14102,11 +14102,11 @@ void Unit::Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject con { if (!sBroadcastTextStore.LookupEntry(textId)) { - TC_LOG_ERROR("entities.unit", "WorldObject::MonsterText: `broadcast_text` was not %u found", textId); + TC_LOG_ERROR("entities.unit", "WorldObject::MonsterText: `broadcast_text` (ID: %u) was not found", textId); return; } - Trinity::BroadcastTextBuilder builder(this, msgType, textId, target); + Trinity::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target); Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> localizer(builder); Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> > worker(this, textRange, localizer); Cell::VisitWorldObjects(this, worker, textRange); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 58fc0dfecc8..8f8c8ab8d92 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -634,79 +634,7 @@ enum TrinityStrings // End Level 3 list, continued at 1100 - // Battleground - LANG_BG_A_WINS = 600, - LANG_BG_H_WINS = 601, - - LANG_BG_WS_START_TWO_MINUTES = 753, - LANG_BG_WS_START_ONE_MINUTE = 602, - LANG_BG_WS_START_HALF_MINUTE = 603, - LANG_BG_WS_HAS_BEGUN = 604, - - LANG_BG_WS_CAPTURED_HF = 605, - LANG_BG_WS_CAPTURED_AF = 606, - LANG_BG_WS_DROPPED_HF = 607, - LANG_BG_WS_DROPPED_AF = 608, - LANG_BG_WS_RETURNED_AF = 609, - LANG_BG_WS_RETURNED_HF = 610, - LANG_BG_WS_PICKEDUP_HF = 611, - LANG_BG_WS_PICKEDUP_AF = 612, - LANG_BG_WS_F_PLACED = 613, - LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED = 614, - LANG_BG_WS_HORDE_FLAG_RESPAWNED = 615, - - LANG_BG_EY_START_TWO_MINUTES = 755, - LANG_BG_EY_START_ONE_MINUTE = 636, - LANG_BG_EY_START_HALF_MINUTE = 637, - LANG_BG_EY_HAS_BEGUN = 638, - - LANG_BG_AB_ALLY = 650, - LANG_BG_AB_HORDE = 651, - LANG_BG_AB_NODE_STABLES = 652, - LANG_BG_AB_NODE_BLACKSMITH = 653, - LANG_BG_AB_NODE_FARM = 654, - LANG_BG_AB_NODE_LUMBER_MILL = 655, - LANG_BG_AB_NODE_GOLD_MINE = 656, - LANG_BG_AB_NODE_TAKEN = 657, - LANG_BG_AB_NODE_DEFENDED = 658, - LANG_BG_AB_NODE_ASSAULTED = 659, - LANG_BG_AB_NODE_CLAIMED = 660, - - LANG_BG_AB_START_TWO_MINUTES = 754, - LANG_BG_AB_START_ONE_MINUTE = 661, - LANG_BG_AB_START_HALF_MINUTE = 662, - LANG_BG_AB_HAS_BEGUN = 663, - LANG_BG_AB_A_NEAR_VICTORY = 664, - LANG_BG_AB_H_NEAR_VICTORY = 665, - LANG_BG_MARK_BY_MAIL = 666, - - LANG_BG_EY_HAS_TAKEN_A_M_TOWER = 667, - LANG_BG_EY_HAS_TAKEN_H_M_TOWER = 668, - LANG_BG_EY_HAS_TAKEN_A_D_RUINS = 669, - LANG_BG_EY_HAS_TAKEN_H_D_RUINS = 670, - LANG_BG_EY_HAS_TAKEN_A_B_TOWER = 671, - LANG_BG_EY_HAS_TAKEN_H_B_TOWER = 672, - LANG_BG_EY_HAS_TAKEN_A_F_RUINS = 673, - LANG_BG_EY_HAS_TAKEN_H_F_RUINS = 674, - LANG_BG_EY_HAS_LOST_A_M_TOWER = 675, - LANG_BG_EY_HAS_LOST_H_M_TOWER = 676, - LANG_BG_EY_HAS_LOST_A_D_RUINS = 677, - LANG_BG_EY_HAS_LOST_H_D_RUINS = 678, - LANG_BG_EY_HAS_LOST_A_B_TOWER = 679, - LANG_BG_EY_HAS_LOST_H_B_TOWER = 680, - LANG_BG_EY_HAS_LOST_A_F_RUINS = 681, - LANG_BG_EY_HAS_LOST_H_F_RUINS = 682, - LANG_BG_EY_HAS_TAKEN_FLAG = 683, - LANG_BG_EY_CAPTURED_FLAG_A = 684, - LANG_BG_EY_CAPTURED_FLAG_H = 685, - LANG_BG_EY_DROPPED_FLAG = 686, - LANG_BG_EY_RESETED_FLAG = 687, - - LANG_ARENA_ONE_TOOLOW = 700, - LANG_ARENA_ONE_MINUTE = 701, - LANG_ARENA_THIRTY_SECONDS = 702, - LANG_ARENA_FIFTEEN_SECONDS = 703, - LANG_ARENA_HAS_BEGUN = 704, + // 600-704 - free LANG_WAIT_BEFORE_SPEAKING = 705, LANG_NOT_EQUIPPED_ITEM = 706, @@ -729,9 +657,7 @@ enum TrinityStrings LANG_ARENA_GROUP_TOO_LARGE = 721, // "Your group is too large for this arena. Please regroup to join." LANG_ARENA_YOUR_TEAM_ONLY = 722, // "Your group has members not in your arena team. Please regroup to join." LANG_ARENA_NOT_ENOUGH_PLAYERS = 723, // "Your group does not have enough players to join this match." - LANG_ARENA_GOLD_WINS = 724, // "The Gold Team wins!" - LANG_ARENA_GREEN_WINS = 725, // "The Green Team wins!" -// = 726, not used + // 724-726 - free LANG_BG_GROUP_OFFLINE_MEMBER = 727, // "Your group has an offline member. Please remove him before joining." LANG_BG_GROUP_MIXED_FACTION = 728, // "Your group has players from the opposing faction. You can't join the battleground as a group." LANG_BG_GROUP_MIXED_LEVELS = 729, // "Your group has players from different battleground brakets. You can't join as group." @@ -759,14 +685,13 @@ enum TrinityStrings LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING = 750, // "Not enough players. This game will close in %u mins." LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS = 751, // "Not enough players. This game will close in %u seconds." // = 752, see LANG_PINFO_ACC_IP -// LANG_BG_WS_START_TWO_MINUTES = 753, - defined above -// LANG_BG_AB_START_TWO_MINUTES = 754, - defined above -// LANG_BG_EY_START_TWO_MINUTES = 755, - defined above + // 753-755 - free - // Room for BG/ARENA = 773-784, 788-799 not used + // Room for BG/ARENA = 773-784 LANG_ARENA_TESTING = 785, LANG_AUTO_ANN = 786, LANG_ANNOUNCE_COLOR = 787, + // 788-799 - free // in game strings LANG_PET_INVALID_NAME = 800, @@ -1011,41 +936,7 @@ enum TrinityStrings LANG_DEBUG_AREATRIGGER_OFF = 1203, LANG_DEBUG_AREATRIGGER_ENTERED = 1204, - // Isle of Conquest - LANG_BG_IC_START_TWO_MINUTES = 1205, - LANG_BG_IC_START_ONE_MINUTE = 1206, - LANG_BG_IC_START_HALF_MINUTE = 1207, - LANG_BG_IC_HAS_BEGUN = 1208, - LANG_BG_IC_ALLIANCE_KEEP = 1209, - LANG_BG_IC_HORDE_KEEP = 1210, - LANG_BG_IC_TEAM_WINS = 1211, - LANG_BG_IC_WEST_GATE_DESTROYED = 1212, - LANG_BG_IC_EAST_GATE_DESTROYED = 1213, - LANG_BG_IC_SOUTH_GATE_DESTROYED = 1214, - LANG_BG_IC_NORTH_GATE_DESTROYED = 1215, - LANG_BG_IC_TEAM_ASSAULTED_NODE_1 = 1216, - LANG_BG_IC_TEAM_DEFENDED_NODE = 1217, - LANG_BG_IC_TEAM_ASSAULTED_NODE_2 = 1218, - LANG_BG_IC_TEAM_HAS_TAKEN_NODE = 1219, - LANG_BG_IC_WORKSHOP = 1220, - LANG_BG_IC_DOCKS = 1221, - LANG_BG_IC_REFINERY = 1222, - LANG_BG_IC_QUARRY = 1223, - LANG_BG_IC_HANGAR = 1224, - // 1225-1299 - LANG_BG_IC_ALLIANCE = 1300, - LANG_BG_IC_HORDE = 1301, - - // 1302-1325 - // AV - LANG_BG_AV_START_ONE_MINUTE = 1326, - LANG_BG_AV_START_HALF_MINUTE = 1327, - LANG_BG_AV_HAS_BEGUN = 1328, - LANG_BG_AV_A_NEAR_LOSE = 1329, - LANG_BG_AV_H_NEAR_LOSE = 1330, - // 1331-1332 - LANG_BG_AV_START_TWO_MINUTES = 1333, - // FREE IDS 1334-2002 + // 1205-2002 - free // Ticket Strings 2003-2028 LANG_COMMAND_TICKETCLOSED = 2003, @@ -1210,14 +1101,7 @@ enum TrinityStrings LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054, LANG_OPVP_ZM_GOSSIP_HORDE = 10055, - LANG_BG_SA_START_TWO_MINUTES = 10056, - LANG_BG_SA_START_ONE_MINUTE = 10057, - LANG_BG_SA_START_HALF_MINUTE = 10058, - // unused 10059-10062 - LANG_BG_SA_ALLIANCE_CAPTURED_RELIC = 10063, //The Alliance captured the titan portal! - LANG_BG_SA_HORDE_CAPTURED_RELIC = 10064, //The Horde captured the titan portal! - LANG_BG_SA_ROUND_TWO_ONE_MINUTE = 10065, //Round 2 of the Battle for the Strand of the Ancients begins in 1 minute. - LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE = 10066, //Round 2 begins in 30 seconds. Prepare yourselves! + // 10056-10066 - free // Use for custom patches 11000-11999 LANG_AUTO_BROADCAST = 11000, diff --git a/src/server/game/Texts/ChatTextBuilder.cpp b/src/server/game/Texts/ChatTextBuilder.cpp index 7291f2e1dbf..45827e3271b 100644 --- a/src/server/game/Texts/ChatTextBuilder.cpp +++ b/src/server/game/Texts/ChatTextBuilder.cpp @@ -18,13 +18,13 @@ #include "ChatTextBuilder.h" #include "ChatPackets.h" #include "DB2Stores.h" -#include "Unit.h" +#include <cstdarg> WorldPackets::Packet* Trinity::BroadcastTextBuilder::operator()(LocaleConstant locale) const { BroadcastTextEntry const* bct = sBroadcastTextStore.LookupEntry(_textId); WorldPackets::Chat::Chat* chat = new WorldPackets::Chat::Chat(); - chat->Initialize(_msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? DB2Manager::GetBroadcastTextValue(bct, locale, _source->getGender()) : "", _achievementId, "", locale); + chat->Initialize(_msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? DB2Manager::GetBroadcastTextValue(bct, locale, _gender) : "", _achievementId, "", locale); return chat; } @@ -34,3 +34,28 @@ WorldPackets::Packet* Trinity::CustomChatTextBuilder::operator()(LocaleConstant chat->Initialize(_msgType, _language, _source, _target, _text, 0, "", locale); return chat; } + +WorldPackets::Packet* Trinity::TrinityStringChatBuilder::operator()(LocaleConstant locale) const +{ + WorldPackets::Chat::Chat* packet = new WorldPackets::Chat::Chat(); + + char const* text = sObjectMgr->GetTrinityString(_textId, locale); + + if (_args) + { + // we need copy va_list before use or original va_list will corrupted + va_list ap; + va_copy(ap, *_args); + + static size_t const BufferSize = 2048; + char strBuffer[BufferSize]; + vsnprintf(strBuffer, BufferSize, text, ap); + va_end(ap); + + packet->Initialize(_msgType, LANG_UNIVERSAL, _source, _target, strBuffer, 0, "", locale); + } + else + packet->Initialize(_msgType, LANG_UNIVERSAL, _source, _target, text, 0, "", locale); + + return packet; +} diff --git a/src/server/game/Texts/ChatTextBuilder.h b/src/server/game/Texts/ChatTextBuilder.h index f28b67b7e8a..20258c2ddcc 100644 --- a/src/server/game/Texts/ChatTextBuilder.h +++ b/src/server/game/Texts/ChatTextBuilder.h @@ -22,7 +22,6 @@ #include "SharedDefines.h" #include <string> -class Unit; class WorldObject; namespace WorldPackets @@ -35,15 +34,16 @@ namespace Trinity class BroadcastTextBuilder { public: - BroadcastTextBuilder(Unit const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, uint32 achievementId = 0) - : _source(obj), _msgType(msgType), _textId(textId), _target(target), _achievementId(achievementId) { } + BroadcastTextBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, uint8 gender, WorldObject const* target = nullptr, uint32 achievementId = 0) + : _source(obj), _msgType(msgType), _textId(textId), _gender(gender), _target(target), _achievementId(achievementId) { } WorldPackets::Packet* operator()(LocaleConstant locale) const; private: - Unit const* _source; + WorldObject const* _source; ChatMsg _msgType; uint32 _textId; + uint8 _gender; WorldObject const* _target; uint32 _achievementId; }; @@ -63,6 +63,22 @@ namespace Trinity Language _language; WorldObject const* _target; }; + + class TrinityStringChatBuilder + { + public: + TrinityStringChatBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, va_list* args = nullptr) + : _source(obj), _msgType(msgType), _textId(textId), _target(target), _args(args) { } + + WorldPackets::Packet* operator()(LocaleConstant locale) const; + + private: + WorldObject const* _source; + ChatMsg _msgType; + uint32 _textId; + WorldObject const* _target; + va_list* _args; + }; } // namespace Trinity |
