diff --git a/Source/Framework/Constants/BattleGroundsConst.cs b/Source/Framework/Constants/BattleGroundsConst.cs index 6dfcc9dbe..32ef6f716 100644 --- a/Source/Framework/Constants/BattleGroundsConst.cs +++ b/Source/Framework/Constants/BattleGroundsConst.cs @@ -172,6 +172,17 @@ namespace Framework.Constants NotEvenAScratch, } + public struct BattlegroundBroadcastTexts + { + public const uint AllianceWins = 10633; + public const uint HordeWins = 10634; + + public const uint StartTwoMinutes = 18193; + public const uint StartOneMinute = 18194; + public const uint StartHalfMinute = 18195; + public const uint HasBegun = 18196; + } + public enum BattlegroundSounds { HordeWins = 8454, @@ -306,6 +317,14 @@ namespace Framework.Constants } //Arenas + public struct ArenaBroadcastTexts + { + public const uint OneMinute = 15740; + public const uint ThirtySeconds = 15741; + public const uint FifteenSeconds = 15739; + public const uint HasBegun = 15742; + } + public struct ArenaSpellIds { public const uint AllianceGoldFlag = 32724; diff --git a/Source/Framework/Constants/Language.cs b/Source/Framework/Constants/Language.cs index f368a1ddd..d576899bf 100644 --- a/Source/Framework/Constants/Language.cs +++ b/Source/Framework/Constants/Language.cs @@ -654,79 +654,7 @@ namespace Framework.Constants // End Level 3 List, Continued At 1100 - // Battleground - BgAWins = 600, - BgHWins = 601, - - BgWsStartTwoMinutes = 753, - BgWsStartOneMinute = 602, - BgWsStartHalfMinute = 603, - BgWsHasBegun = 604, - - BgWsCapturedHf = 605, - BgWsCapturedAf = 606, - BgWsDroppedHf = 607, - BgWsDroppedAf = 608, - BgWsReturnedAf = 609, - BgWsReturnedHf = 610, - BgWsPickedupHf = 611, - BgWsPickedupAf = 612, - BgWsFPlaced = 613, - BgWsAllianceFlagRespawned = 614, - BgWsHordeFlagRespawned = 615, - - BgEyStartTwoMinutes = 755, - BgEyStartOneMinute = 636, - BgEyStartHalfMinute = 637, - BgEyHasBegun = 638, - - BgAbAlly = 650, - BgAbHorde = 651, - BgAbNodeStables = 652, - BgAbNodeBlacksmith = 653, - BgAbNodeFarm = 654, - BgAbNodeLumberMill = 655, - BgAbNodeGoldMine = 656, - BgAbNodeTaken = 657, - BgAbNodeDefended = 658, - BgAbNodeAssaulted = 659, - BgAbNodeClaimed = 660, - - BgAbStartTwoMinutes = 754, - BgAbStartOneMinute = 661, - BgAbStartHalfMinute = 662, - BgAbHasBegun = 663, - BgAbANearVictory = 664, - BgAbHNearVictory = 665, - BgMarkByMail = 666, - - BgEyHasTakenAMTower = 667, - BgEyHasTakenHMTower = 668, - BgEyHasTakenADRuins = 669, - BgEyHasTakenHDRuins = 670, - BgEyHasTakenABTower = 671, - BgEyHasTakenHBTower = 672, - BgEyHasTakenAFRuins = 673, - BgEyHasTakenHFRuins = 674, - BgEyHasLostAMTower = 675, - BgEyHasLostHMTower = 676, - BgEyHasLostADRuins = 677, - BgEyHasLostHDRuins = 678, - BgEyHasLostABTower = 679, - BgEyHasLostHBTower = 680, - BgEyHasLostAFRuins = 681, - BgEyHasLostHFRuins = 682, - BgEyHasTakenFlag = 683, - BgEyCapturedFlagA = 684, - BgEyCapturedFlagH = 685, - BgEyDroppedFlag = 686, - BgEyResetedFlag = 687, - - ArenaOneToolow = 700, - ArenaOneMinute = 701, - ArenaThirtySeconds = 702, - ArenaFifteenSeconds = 703, - ArenaHasBegun = 704, + // 600-704 - free WaitBeforeSpeaking = 705, NotEquippedItem = 706, @@ -749,9 +677,7 @@ namespace Framework.Constants ArenaGroupTooLarge = 721, // "Your Group Is Too Large For This Arena. Please Regroup To Join." ArenaYourTeamOnly = 722, // "Your Group Has Members Not In Your Arena Team. Please Regroup To Join." ArenaNotEnoughPlayers = 723, // "Your Group Does Not Have Enough Players To Join This Match." - ArenaGoldWins = 724, // "The Gold Team Wins!" - ArenaGreenWins = 725, // "The Green Team Wins!" - // = 726, Not Used + // 724-726 - free BgGroupOfflineMember = 727, // "Your Group Has An Offline Member. Please Remove Him Before Joining." BgGroupMixedFaction = 728, // "Your Group Has Players From The Opposing Faction. You Can'T Join The Battleground As A Group." BgGroupMixedLevels = 729, // "Your Group Has Players From Different Battleground Brakets. You Can'T Join As Group." @@ -778,15 +704,13 @@ namespace Framework.Constants // = 749, See PinfoAccOs BattlegroundPrematureFinishWarning = 750, // "Not Enough Players. This Game Will Close In %U Mins." BattlegroundPrematureFinishWarningSecs = 751, // "Not Enough Players. This Game Will Close In %U Seconds." - // = 752, See PinfoAccIp - // BgWsStartTwoMinutes = 753, - Defined Above - // BgAbStartTwoMinutes = 754, - Defined Above - // BgEyStartTwoMinutes = 755, - Defined Above - - // Room For Bg/Arena = 773-784, 788-799 Not Used + // = 752, See PinfoAccIp + // 753-755 - free + // Room For Bg/Arena = 773-784 ArenaTesting = 785, AutoAnn = 786, AnnounceColor = 787, + // 788-799 - free // In Game Strings PetInvalidName = 800, @@ -1030,42 +954,7 @@ namespace Framework.Constants DebugAreatriggerOn = 1202, DebugAreatriggerOff = 1203, DebugAreatriggerEntered = 1204, - - // Isle Of Conquest - BgIcStartTwoMinutes = 1205, - BgIcStartOneMinute = 1206, - BgIcStartHalfMinute = 1207, - BgIcHasBegun = 1208, - BgIcAllianceKeep = 1209, - BgIcHordeKeep = 1210, - BgIcTeamWins = 1211, - BgIcWestGateDestroyed = 1212, - BgIcEastGateDestroyed = 1213, - BgIcSouthGateDestroyed = 1214, - BgIcNorthGateDestroyed = 1215, - BgIcTeamAssaultedNode1 = 1216, - BgIcTeamDefendedNode = 1217, - BgIcTeamAssaultedNode2 = 1218, - BgIcTeamHasTakenNode = 1219, - BgIcWorkshop = 1220, - BgIcDocks = 1221, - BgIcRefinery = 1222, - BgIcQuarry = 1223, - BgIcHangar = 1224, - // 1225-1299 - BgIcAlliance = 1300, - BgIcHorde = 1301, - - // 1302-1325 - // Av - BgAvStartOneMinute = 1326, - BgAvStartHalfMinute = 1327, - BgAvHasBegun = 1328, - BgAvANearLose = 1329, - BgAvHNearLose = 1330, - // 1331-1332 - BgAvStartTwoMinutes = 1333, - // Free Ids 1334-2002 + // 1205-2002 - free // Ticket Strings 2003-2028 CommandTicketclosed = 2003, @@ -1230,14 +1119,7 @@ namespace Framework.Constants OpvpZmGossipAlliance = 10054, OpvpZmGossipHorde = 10055, - BgSaStartTwoMinutes = 10056, - BgSaStartOneMinute = 10057, - BgSaStartHalfMinute = 10058, - // Unused 10059-10062 - BgSaAllianceCapturedRelic = 10063, //The Alliance Captured The Titan Portal! - BgSaHordeCapturedRelic = 10064, //The Horde Captured The Titan Portal! - BgSaRoundTwoOneMinute = 10065, //Round 2 Of The Battle For The Strand Of The Ancients Begins In 1 Minute. - BgSaRoundTwoStartHalfMinute = 10066, //Round 2 Begins In 30 Seconds. Prepare Yourselves! + // 10056-10066 - free // Use For Custom Patches 11000-11999 AutoBroadcast = 11000, diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index c77efebe8..85e982ffd 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -771,7 +771,7 @@ namespace Game.AI me.DoFleeToGetAssistance(); if (e.Action.flee.withEmote != 0) { - var builder = new BroadcastTextBuilder(me, ChatMsg.MonsterEmote, (uint)BroadcastTextIds.FleeForAssist); + var builder = new BroadcastTextBuilder(me, ChatMsg.MonsterEmote, (uint)BroadcastTextIds.FleeForAssist, me.GetGender()); Global.CreatureTextMgr.SendChatPacket(me, builder, ChatMsg.Emote); } Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_FLEE_FOR_ASSIST: Creature {0} DoFleeToGetAssistance", me.GetGUID().ToString()); @@ -1040,7 +1040,7 @@ namespace Game.AI me.CallForHelp(e.Action.callHelp.range); if (e.Action.callHelp.withEmote != 0) { - var builder = new BroadcastTextBuilder(me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp); + var builder = new BroadcastTextBuilder(me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, me.GetGender()); Global.CreatureTextMgr.SendChatPacket(me, builder, ChatMsg.MonsterEmote); } Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature {0}", me.GetGUID().ToString()); diff --git a/Source/Game/Achievements/AchievementManager.cs b/Source/Game/Achievements/AchievementManager.cs index 695e743fd..10b52360d 100644 --- a/Source/Game/Achievements/AchievementManager.cs +++ b/Source/Game/Achievements/AchievementManager.cs @@ -607,7 +607,7 @@ namespace Game.Achievements Guild guild = Global.GuildMgr.GetGuildById(_owner.GetGuildId()); if (guild) { - BroadcastTextBuilder say_builder = new BroadcastTextBuilder(_owner, ChatMsg.GuildAchievement, (uint)BroadcastTextIds.AchivementEarned, _owner, achievement.Id); + BroadcastTextBuilder say_builder = new BroadcastTextBuilder(_owner, ChatMsg.GuildAchievement, (uint)BroadcastTextIds.AchivementEarned, _owner.GetGender(), _owner, achievement.Id); var say_do = new LocalizedPacketDo(say_builder); guild.BroadcastWorker(say_do, _owner); } @@ -624,7 +624,7 @@ namespace Game.Achievements // if player is in world he can tell his friends about new achievement else if (_owner.IsInWorld) { - BroadcastTextBuilder _builder = new BroadcastTextBuilder(_owner, ChatMsg.Achievement, (uint)BroadcastTextIds.AchivementEarned, _owner, achievement.Id); + BroadcastTextBuilder _builder = new BroadcastTextBuilder(_owner, ChatMsg.Achievement, (uint)BroadcastTextIds.AchivementEarned, _owner.GetGender(), _owner, achievement.Id); var _localizer = new LocalizedPacketDo(_builder); var _worker = new PlayerDistWorker(_owner, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), _localizer); Cell.VisitWorldObjects(_owner, _worker, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay)); diff --git a/Source/Game/Arenas/Arena.cs b/Source/Game/Arenas/Arena.cs index 4b6d5adbe..e947acc8e 100644 --- a/Source/Game/Arenas/Arena.cs +++ b/Source/Game/Arenas/Arena.cs @@ -34,10 +34,10 @@ namespace Game.Arenas StartDelayTimes[BattlegroundConst.EventIdThird] = BattlegroundStartTimeIntervals.Delay15s; StartDelayTimes[BattlegroundConst.EventIdFourth] = BattlegroundStartTimeIntervals.None; - StartMessageIds[BattlegroundConst.EventIdFirst] = CypherStrings.ArenaOneMinute; - StartMessageIds[BattlegroundConst.EventIdSecond] = CypherStrings.ArenaThirtySeconds; - StartMessageIds[BattlegroundConst.EventIdThird] = CypherStrings.ArenaFifteenSeconds; - StartMessageIds[BattlegroundConst.EventIdFourth] = CypherStrings.ArenaHasBegun; + StartMessageIds[BattlegroundConst.EventIdFirst] = ArenaBroadcastTexts.OneMinute; + StartMessageIds[BattlegroundConst.EventIdSecond] = ArenaBroadcastTexts.ThirtySeconds; + StartMessageIds[BattlegroundConst.EventIdThird] = ArenaBroadcastTexts.FifteenSeconds; + StartMessageIds[BattlegroundConst.EventIdFourth] = ArenaBroadcastTexts.HasBegun; } public override void AddPlayer(Player player) diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 418a7700e..202d2e10a 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -51,11 +51,11 @@ namespace Game.BattleGrounds StartDelayTimes[BattlegroundConst.EventIdSecond] = BattlegroundStartTimeIntervals.Delay1m; StartDelayTimes[BattlegroundConst.EventIdThird] = BattlegroundStartTimeIntervals.Delay30s; StartDelayTimes[BattlegroundConst.EventIdFourth] = BattlegroundStartTimeIntervals.None; - //we must set to some default existing values - StartMessageIds[BattlegroundConst.EventIdFirst] = CypherStrings.BgWsStartTwoMinutes; - StartMessageIds[BattlegroundConst.EventIdSecond] = CypherStrings.BgWsStartOneMinute; - StartMessageIds[BattlegroundConst.EventIdThird] = CypherStrings.BgWsStartHalfMinute; - StartMessageIds[BattlegroundConst.EventIdFourth] = CypherStrings.BgWsHasBegun; + + StartMessageIds[BattlegroundConst.EventIdFirst] = BattlegroundBroadcastTexts.StartTwoMinutes; + StartMessageIds[BattlegroundConst.EventIdSecond] = BattlegroundBroadcastTexts.StartOneMinute; + StartMessageIds[BattlegroundConst.EventIdThird] = BattlegroundBroadcastTexts.StartHalfMinute; + StartMessageIds[BattlegroundConst.EventIdFourth] = BattlegroundBroadcastTexts.HasBegun; } public virtual void Dispose() @@ -379,20 +379,23 @@ namespace Game.BattleGrounds StartingEventCloseDoors(); SetStartDelayTime(StartDelayTimes[BattlegroundConst.EventIdFirst]); - // First start warning - 2 or 1 Time.Minute - SendMessageToAll(StartMessageIds[BattlegroundConst.EventIdFirst], ChatMsg.BgSystemNeutral); + // First start warning - 2 or 1 Minute + if (StartMessageIds[BattlegroundConst.EventIdFirst] != 0) + SendBroadcastText(StartMessageIds[BattlegroundConst.EventIdFirst], ChatMsg.BgSystemNeutral); } // After 1 Time.Minute or 30 seconds, warning is signaled else if (GetStartDelayTime() <= (int)StartDelayTimes[BattlegroundConst.EventIdSecond] && !m_Events.HasAnyFlag(BattlegroundEventFlags.Event2)) { m_Events |= BattlegroundEventFlags.Event2; - SendMessageToAll(StartMessageIds[BattlegroundConst.EventIdSecond], ChatMsg.BgSystemNeutral); + if (StartMessageIds[BattlegroundConst.EventIdSecond] != 0) + SendBroadcastText(StartMessageIds[BattlegroundConst.EventIdSecond], ChatMsg.BgSystemNeutral); } // After 30 or 15 seconds, warning is signaled else if (GetStartDelayTime() <= (int)StartDelayTimes[BattlegroundConst.EventIdThird] && !m_Events.HasAnyFlag(BattlegroundEventFlags.Event3)) { m_Events |= BattlegroundEventFlags.Event3; - SendMessageToAll(StartMessageIds[BattlegroundConst.EventIdThird], ChatMsg.BgSystemNeutral); + if (StartMessageIds[BattlegroundConst.EventIdThird] != 0) + SendBroadcastText(StartMessageIds[BattlegroundConst.EventIdThird], ChatMsg.BgSystemNeutral); } // Delay expired (after 2 or 1 Time.Minute) else if (GetStartDelayTime() <= 0 && !m_Events.HasAnyFlag(BattlegroundEventFlags.Event4)) @@ -401,7 +404,8 @@ namespace Game.BattleGrounds StartingEventOpenDoors(); - SendMessageToAll(StartMessageIds[BattlegroundConst.EventIdFourth], ChatMsg.RaidBossEmote); + if (StartMessageIds[BattlegroundConst.EventIdFourth] != 0) + SendBroadcastText(StartMessageIds[BattlegroundConst.EventIdFourth], ChatMsg.RaidBossEmote); SetStatus(BattlegroundStatus.InProgress); SetStartDelayTime(StartDelayTimes[BattlegroundConst.EventIdFourth]); @@ -554,6 +558,19 @@ namespace Game.BattleGrounds Global.CreatureTextMgr.SendChat(source, textId, target); } + public void SendBroadcastText(uint id, ChatMsg msgType, WorldObject target = null) + { + if (!CliDB.BroadcastTextStorage.ContainsKey(id)) + { + Log.outError(LogFilter.Battleground, $"Battleground.SendBroadcastText: `broadcast_text` (ID: {id}) was not found"); + return; + } + + BroadcastTextBuilder builder = new BroadcastTextBuilder(null, msgType, id, Gender.Male, target); + LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + BroadcastWorker(localizer); + } + public void PlaySoundToAll(uint soundID) { SendPacketToAll(new PlaySound(ObjectGuid.Empty, soundID)); @@ -635,23 +652,22 @@ namespace Game.BattleGrounds { RemoveFromBGFreeSlotQueue(); - CypherStrings winmsg_id = 0; bool guildAwarded = false; if (winner == Team.Alliance) { - winmsg_id = isBattleground() ? CypherStrings.BgAWins : CypherStrings.ArenaGoldWins; + if (isBattleground()) + SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral); PlaySoundToAll((uint)BattlegroundSounds.AllianceWins); - SetWinner(BattlegroundTeamId.Alliance); } else if (winner == Team.Horde) { - winmsg_id = isBattleground() ? CypherStrings.BgHWins : CypherStrings.ArenaGreenWins; + if (isBattleground()) + SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral); PlaySoundToAll((uint)BattlegroundSounds.HordeWins); - SetWinner(BattlegroundTeamId.Horde); } else @@ -789,9 +805,6 @@ namespace Game.BattleGrounds player.UpdateCriteria(CriteriaTypes.CompleteBattleground, 1); } - - if (winmsg_id != 0) - SendMessageToAll(winmsg_id, ChatMsg.BgSystemNeutral); } public uint GetBonusHonorFromKill(uint kills) @@ -1540,31 +1553,24 @@ namespace Game.BattleGrounds return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex); } - public void SendMessageToAll(CypherStrings entry, ChatMsg type, Player source = null) + public void SendMessageToAll(CypherStrings entry, ChatMsg msgType, Player source = null) { if (entry == 0) return; - var bg_builder = new BattlegroundChatBuilder(type, entry, source); - var bg_do = new LocalizedPacketDo(bg_builder); - BroadcastWorker(bg_do); + CypherStringChatBuilder builder = new CypherStringChatBuilder(null, msgType, entry, source); + LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + BroadcastWorker(localizer); } - public void SendMessageToAll(CypherStrings entry, ChatMsg type, Player source, params object[] args) + public void SendMessageToAll(CypherStrings entry, ChatMsg msgType, Player source, params object[] args) { if (entry == 0) return; - var bg_builder = new BattlegroundChatBuilder(type, entry, source, args); - var bg_do = new LocalizedPacketDo(bg_builder); - BroadcastWorker(bg_do); - } - - public void SendMessage2ToAll(CypherStrings entry, ChatMsg type, Player source, CypherStrings arg1 = 0, CypherStrings arg2 = 0) - { - var bg_builder = new Battleground2ChatBuilder(type, entry, source, arg1, arg2); - var bg_do = new LocalizedPacketDo(bg_builder); - BroadcastWorker(bg_do); + CypherStringChatBuilder builder = new CypherStringChatBuilder(null, msgType, entry, source, args); + LocalizedPacketDo localizer = new LocalizedPacketDo(builder); + BroadcastWorker(localizer); } void EndNow() @@ -1975,7 +1981,7 @@ namespace Game.BattleGrounds BattlegroundEventFlags m_Events; public BattlegroundStartTimeIntervals[] StartDelayTimes = new BattlegroundStartTimeIntervals[4]; // this must be filled inructors! - public CypherStrings[] StartMessageIds = new CypherStrings[4]; + public uint[] StartMessageIds = new uint[4]; public bool m_BuffChange; bool m_IsRandom; @@ -2053,61 +2059,6 @@ namespace Game.BattleGrounds #endregion } - class BattlegroundChatBuilder : MessageBuilder - { - public BattlegroundChatBuilder(ChatMsg msgtype, CypherStrings textId, Player source, params object[] args) - { - _msgtype = msgtype; - _textId = textId; - _source = source; - _args = args; - } - - public override ServerPacket Invoke(LocaleConstant loc_idx = LocaleConstant.enUS) - { - string text = Global.ObjectMgr.GetCypherString(_textId, loc_idx); - string str = string.Format(text, _args); - var packet = new ChatPkt(); - packet.Initialize(_msgtype, Language.Universal, _source, _source, str); - return packet; - } - - ChatMsg _msgtype; - CypherStrings _textId; - Player _source; - object[] _args; - } - - class Battleground2ChatBuilder : MessageBuilder - { - public Battleground2ChatBuilder(ChatMsg msgtype, CypherStrings textId, Player source, CypherStrings arg1, CypherStrings arg2) - { - _msgtype = msgtype; - _textId = textId; - _source = source; - _arg1 = arg1; - _arg2 = arg2; - } - - public override ServerPacket Invoke(LocaleConstant loc_idx = LocaleConstant.enUS) - { - string text = Global.ObjectMgr.GetCypherString(_textId, loc_idx); - string arg1str = _arg1 != 0 ? Global.ObjectMgr.GetCypherString(_arg1, loc_idx) : ""; - string arg2str = _arg2 != 0 ? Global.ObjectMgr.GetCypherString(_arg2, loc_idx) : ""; - - string str = string.Format(text, arg1str, arg2str); - var packet = new ChatPkt(); - packet.Initialize(_msgtype, Language.Universal, _source, _source, str); - return packet; - } - - ChatMsg _msgtype; - CypherStrings _textId; - Player _source; - CypherStrings _arg1; - CypherStrings _arg2; - } - public class BattlegroundPlayer { public long OfflineRemoveTime; // for tracking and removing offline players from queue after 5 Time.Minutes diff --git a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs index 42bb92a28..825345b92 100644 --- a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs +++ b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs @@ -54,11 +54,6 @@ namespace Game.BattleGrounds.Zones m_HonorTics = 0; m_ReputationTics = 0; - - StartMessageIds[BattlegroundConst.EventIdFirst] = CypherStrings.BgAbStartTwoMinutes; - StartMessageIds[BattlegroundConst.EventIdSecond] = CypherStrings.BgAbStartOneMinute; - StartMessageIds[BattlegroundConst.EventIdThird] = CypherStrings.BgAbStartHalfMinute; - StartMessageIds[BattlegroundConst.EventIdFourth] = CypherStrings.BgAbHasBegun; } public override void PostUpdateImpl(uint diff) @@ -98,19 +93,17 @@ namespace Game.BattleGrounds.Zones // create new occupied banner _CreateBanner(node, ABNodeStatus.Occupied, teamIndex, true); _SendNodeUpdate(node); - _NodeOccupied(node, (teamIndex == 0) ? Team.Alliance : Team.Horde); + _NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde); // Message to chatlog if (teamIndex == 0) { - // FIXME: team and node names not localized - SendMessage2ToAll(CypherStrings.BgAbNodeTaken, ChatMsg.BgSystemAlliance, null, CypherStrings.BgAbAlly, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceTaken, ChatMsg.BgSystemAlliance); PlaySoundToAll(SoundCapturedAlliance); } else { - // FIXME: team and node names not localized - SendMessage2ToAll(CypherStrings.BgAbNodeTaken, ChatMsg.BgSystemHorde, null, CypherStrings.BgAbHorde, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeTaken, ChatMsg.BgSystemHorde); PlaySoundToAll(SoundCapturedHorde); } } @@ -156,9 +149,9 @@ namespace Game.BattleGrounds.Zones if (!m_IsInformedNearVictory && m_TeamScores[team] > WarningNearVictoryScore) { if (team == TeamId.Alliance) - SendMessageToAll(CypherStrings.BgAbANearVictory, ChatMsg.BgSystemNeutral); + SendBroadcastText(ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral); else - SendMessageToAll(CypherStrings.BgAbHNearVictory, ChatMsg.BgSystemNeutral); + SendBroadcastText(ABBattlegroundBroadcastTexts.HordeNearVictory, ChatMsg.BgSystemNeutral); PlaySoundToAll(SoundNearVictory); m_IsInformedNearVictory = true; } @@ -303,27 +296,6 @@ namespace Game.BattleGrounds.Zones SpawnBGObject(obj, BattlegroundConst.RespawnOneDay); } - CypherStrings _GetNodeNameId(byte node) - { - switch (node) - { - case ABBattlegroundNodes.NodeStables: - return CypherStrings.BgAbNodeStables; - case ABBattlegroundNodes.NodeBlacksmith: - return CypherStrings.BgAbNodeBlacksmith; - case ABBattlegroundNodes.NodeFarm: - return CypherStrings.BgAbNodeFarm; - case ABBattlegroundNodes.NodeLumberMill: - return CypherStrings.BgAbNodeLumberMill; - case ABBattlegroundNodes.NodeGoldMine: - return CypherStrings.BgAbNodeGoldMine; - default: - Contract.Assert(false); - break; - } - return 0; - } - public override void FillInitialWorldStates(InitWorldStates packet) { byte[] plusArray = { 0, 2, 3, 0, 1 }; @@ -472,10 +444,10 @@ namespace Game.BattleGrounds.Zones m_NodeTimers[node] = FlagCapturingTime; // FIXME: team and node names not localized - if (teamIndex == 0) - SendMessage2ToAll(CypherStrings.BgAbNodeClaimed, ChatMsg.BgSystemAlliance, source, _GetNodeNameId(node), CypherStrings.BgAbAlly); + if (teamIndex == TeamId.Alliance) + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceClaims, ChatMsg.BgSystemAlliance, source); else - SendMessage2ToAll(CypherStrings.BgAbNodeClaimed, ChatMsg.BgSystemHorde, source, _GetNodeNameId(node), CypherStrings.BgAbHorde); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeClaims, ChatMsg.BgSystemHorde, source); sound = SoundClaimed; } @@ -495,11 +467,10 @@ namespace Game.BattleGrounds.Zones _SendNodeUpdate(node); m_NodeTimers[node] = FlagCapturingTime; - // FIXME: node names not localized if (teamIndex == TeamId.Alliance) - SendMessage2ToAll(CypherStrings.BgAbNodeAssaulted, ChatMsg.BgSystemAlliance, source, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source); else - SendMessage2ToAll(CypherStrings.BgAbNodeAssaulted, ChatMsg.BgSystemHorde, source, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source); } // If contested, change back to occupied else @@ -515,11 +486,10 @@ namespace Game.BattleGrounds.Zones m_NodeTimers[node] = 0; _NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde); - // FIXME: node names not localized if (teamIndex == TeamId.Alliance) - SendMessage2ToAll(CypherStrings.BgAbNodeDefended, ChatMsg.BgSystemAlliance, source, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceDefended, ChatMsg.BgSystemAlliance, source); else - SendMessage2ToAll(CypherStrings.BgAbNodeDefended, ChatMsg.BgSystemHorde, source, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeDefended, ChatMsg.BgSystemHorde, source); } sound = (teamIndex == TeamId.Alliance) ? SoundAssaultedAlliance : SoundAssaultedHorde; } @@ -537,11 +507,10 @@ namespace Game.BattleGrounds.Zones _NodeDeOccupied(node); m_NodeTimers[node] = FlagCapturingTime; - // FIXME: node names not localized if (teamIndex == TeamId.Alliance) - SendMessage2ToAll(CypherStrings.BgAbNodeAssaulted, ChatMsg.BgSystemAlliance, source, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source); else - SendMessage2ToAll(CypherStrings.BgAbNodeAssaulted, ChatMsg.BgSystemHorde, source, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source); sound = (teamIndex == TeamId.Alliance) ? SoundAssaultedAlliance : SoundAssaultedHorde; } @@ -551,9 +520,9 @@ namespace Game.BattleGrounds.Zones { // FIXME: team and node names not localized if (teamIndex == TeamId.Alliance) - SendMessage2ToAll(CypherStrings.BgAbNodeTaken, ChatMsg.BgSystemAlliance, null, CypherStrings.BgAbAlly, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceTaken, ChatMsg.BgSystemAlliance); else - SendMessage2ToAll(CypherStrings.BgAbNodeTaken, ChatMsg.BgSystemHorde, null, CypherStrings.BgAbHorde, _GetNodeNameId(node)); + SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeTaken, ChatMsg.BgSystemHorde); } PlaySoundToAll(sound); } @@ -1001,6 +970,49 @@ namespace Game.BattleGrounds.Zones public const int AllCount = 7; // All Nodes (Dynamic And Static) } + struct ABBattlegroundBroadcastTexts + { + public const uint AllianceNearVictory = 10598; + public const uint HordeNearVictory = 10599; + + public static ABNodeInfo[] ABNodes = + { + new ABNodeInfo(ABBattlegroundNodes.NodeStables, 10199, 10200, 10203, 10204, 10201, 10202, 10286, 10287), + new ABNodeInfo(ABBattlegroundNodes.NodeBlacksmith, 10211, 10212, 10213, 10214, 10215, 10216, 10290, 10291), + new ABNodeInfo(ABBattlegroundNodes.NodeFarm, 10217, 10218, 10219, 10220, 10221, 10222, 10288, 10289), + new ABNodeInfo(ABBattlegroundNodes.NodeLumberMill, 10224, 10225, 10226, 10227, 10228, 10229, 10284, 10285), + new ABNodeInfo(ABBattlegroundNodes.NodeGoldMine, 10230, 10231, 10232, 10233, 10234, 10235, 10282, 10283) + }; + } + + struct ABNodeInfo + { + public ABNodeInfo(uint nodeId, uint textAllianceAssaulted, uint textHordeAssaulted, uint textAllianceTaken, uint textHordeTaken, uint textAllianceDefended, uint textHordeDefended, uint textAllianceClaims, uint textHordeClaims) + { + NodeId = nodeId; + TextAllianceAssaulted = textAllianceAssaulted; + TextHordeAssaulted = textHordeAssaulted; + TextAllianceTaken = textAllianceTaken; + TextHordeTaken = textHordeTaken; + TextAllianceDefended = textAllianceDefended; + TextHordeDefended = textHordeDefended; + TextAllianceClaims = textAllianceClaims; + TextHordeClaims = textHordeClaims; + } + + public uint NodeId; + public uint TextAllianceAssaulted; + public uint TextHordeAssaulted; + public uint TextAllianceTaken; + public uint TextHordeTaken; + public uint TextAllianceDefended; + public uint TextHordeDefended; + public uint TextAllianceClaims; + public uint TextHordeClaims; + } + + + enum ABNodeStatus { Neutral = 0, diff --git a/Source/Game/BattleGrounds/Zones/EyeofStorm.cs b/Source/Game/BattleGrounds/Zones/EyeofStorm.cs index 327ee7045..6a1d8e41d 100644 --- a/Source/Game/BattleGrounds/Zones/EyeofStorm.cs +++ b/Source/Game/BattleGrounds/Zones/EyeofStorm.cs @@ -59,11 +59,6 @@ namespace Game.BattleGrounds.Zones for (byte i = 0; i < 2 * EotSPoints.PointsMax; ++i) m_CurrentPointPlayersCount[i] = 0; - - StartMessageIds[BattlegroundConst.EventIdFirst] = CypherStrings.BgEyStartTwoMinutes; - StartMessageIds[BattlegroundConst.EventIdSecond] = CypherStrings.BgEyStartOneMinute; - StartMessageIds[BattlegroundConst.EventIdThird] = CypherStrings.BgEyStartHalfMinute; - StartMessageIds[BattlegroundConst.EventIdFourth] = CypherStrings.BgEyHasBegun; } public override void PostUpdateImpl(uint diff) @@ -300,17 +295,6 @@ namespace Game.BattleGrounds.Zones void UpdateTeamScore(int team) { uint 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 >= EotSScoreIds.MaxTeamScore) { score = EotSScoreIds.MaxTeamScore; @@ -584,7 +568,7 @@ namespace Game.BattleGrounds.Zones if (send_message) { - SendMessageToAll(CypherStrings.BgEyResetedFlag, ChatMsg.BgSystemNeutral); + SendBroadcastText(EotSBroadcastTexts.FlagReset, ChatMsg.BgSystemNeutral); PlaySoundToAll(EotSSoundIds.FlagReset); // flags respawned sound... } @@ -644,9 +628,9 @@ namespace Game.BattleGrounds.Zones UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.WaitRespawn); if (player.GetTeam() == Team.Alliance) - SendMessageToAll(CypherStrings.BgEyDroppedFlag, ChatMsg.BgSystemAlliance, null); + SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemAlliance, null); else - SendMessageToAll(CypherStrings.BgEyDroppedFlag, ChatMsg.BgSystemHorde, null); + SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemHorde, null); } public override void EventPlayerClickedOnFlag(Player player, GameObject target_obj) @@ -676,9 +660,9 @@ namespace Game.BattleGrounds.Zones player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.EnterPvpCombat); if (player.GetTeam() == Team.Alliance) - SendMessageToAll(CypherStrings.BgEyHasTakenFlag, ChatMsg.BgSystemAlliance, null, player.GetName()); + SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemAlliance, player); else - SendMessageToAll(CypherStrings.BgEyHasTakenFlag, ChatMsg.BgSystemHorde, null, player.GetName()); + SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemHorde, player); } void EventTeamLostPoint(Player player, int Point) @@ -687,7 +671,7 @@ namespace Game.BattleGrounds.Zones return; //Natural point - Team Team = (Team)m_PointOwnedByTeam[Point]; + Team Team = m_PointOwnedByTeam[Point]; if (Team == 0) return; @@ -717,9 +701,9 @@ namespace Game.BattleGrounds.Zones m_PointState[Point] = EotSPointState.NoOwner; if (Team == Team.Alliance) - SendMessageToAll(EotSMisc.m_LosingPointTypes[Point].MessageIdAlliance, ChatMsg.BgSystemAlliance, player); + SendBroadcastText(EotSMisc.m_LosingPointTypes[Point].MessageIdAlliance, ChatMsg.BgSystemAlliance, player); else - SendMessageToAll(EotSMisc.m_LosingPointTypes[Point].MessageIdHorde, ChatMsg.BgSystemHorde, player); + SendBroadcastText(EotSMisc.m_LosingPointTypes[Point].MessageIdHorde, ChatMsg.BgSystemHorde, player); UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); @@ -761,9 +745,9 @@ namespace Game.BattleGrounds.Zones m_PointState[Point] = EotSPointState.UnderControl; if (Team == Team.Alliance) - SendMessageToAll(EotSMisc.m_CapturingPointTypes[Point].MessageIdAlliance, ChatMsg.BgSystemAlliance, player); + SendBroadcastText(EotSMisc.m_CapturingPointTypes[Point].MessageIdAlliance, ChatMsg.BgSystemAlliance, player); else - SendMessageToAll(EotSMisc.m_CapturingPointTypes[Point].MessageIdHorde, ChatMsg.BgSystemHorde, player); + SendBroadcastText(EotSMisc.m_CapturingPointTypes[Point].MessageIdHorde, ChatMsg.BgSystemHorde, player); if (!BgCreatures[Point].IsEmpty()) DelCreature(Point); @@ -807,27 +791,22 @@ namespace Game.BattleGrounds.Zones player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.EnterPvpCombat); if (player.GetTeam() == Team.Alliance) + { + SendBroadcastText(EotSBroadcastTexts.AllianceCapturedFlag, ChatMsg.BgSystemAlliance, player); PlaySoundToAll(EotSSoundIds.FlagCapturedAlliance); + } else + { + SendBroadcastText(EotSBroadcastTexts.HordeCapturedFlag, ChatMsg.BgSystemHorde, player); PlaySoundToAll(EotSSoundIds.FlagCapturedHorde); + } SpawnBGObject((int)BgObjectType, BattlegroundConst.RespawnImmediately); m_FlagsTimer = EotSMisc.FlagRespawnTime; m_FlagCapturedBgObjectType = BgObjectType; - uint team_id = 0; - if (player.GetTeam() == Team.Alliance) - { - team_id = TeamId.Alliance; - SendMessageToAll(CypherStrings.BgEyCapturedFlagA, ChatMsg.BgSystemAlliance, player); - } - else - { - team_id = TeamId.Horde; - SendMessageToAll(CypherStrings.BgEyCapturedFlagH, ChatMsg.BgSystemHorde, player); - } - + int team_id = player.GetTeam() == Team.Alliance ? TeamId.Alliance : TeamId.Horde; if (m_TeamPointsCount[team_id] > 0) AddPoints(player.GetTeam(), EotSMisc.FlagPoints[m_TeamPointsCount[team_id] - 1]); @@ -1050,7 +1029,7 @@ namespace Game.BattleGrounds.Zones struct BattlegroundEYLosingPointStruct { - public BattlegroundEYLosingPointStruct(int _SpawnNeutralObjectType, int _DespawnObjectTypeAlliance, CypherStrings _MessageIdAlliance, int _DespawnObjectTypeHorde, CypherStrings _MessageIdHorde) + public BattlegroundEYLosingPointStruct(int _SpawnNeutralObjectType, int _DespawnObjectTypeAlliance, uint _MessageIdAlliance, int _DespawnObjectTypeHorde, uint _MessageIdHorde) { SpawnNeutralObjectType = _SpawnNeutralObjectType; DespawnObjectTypeAlliance = _DespawnObjectTypeAlliance; @@ -1061,14 +1040,14 @@ namespace Game.BattleGrounds.Zones public int SpawnNeutralObjectType; public int DespawnObjectTypeAlliance; - public CypherStrings MessageIdAlliance; + public uint MessageIdAlliance; public int DespawnObjectTypeHorde; - public CypherStrings MessageIdHorde; + public uint MessageIdHorde; } struct BattlegroundEYCapturingPointStruct { - public BattlegroundEYCapturingPointStruct(int _DespawnNeutralObjectType, int _SpawnObjectTypeAlliance, CypherStrings _MessageIdAlliance, int _SpawnObjectTypeHorde, CypherStrings _MessageIdHorde, uint _GraveYardId) + public BattlegroundEYCapturingPointStruct(int _DespawnNeutralObjectType, int _SpawnObjectTypeAlliance, uint _MessageIdAlliance, int _SpawnObjectTypeHorde, uint _MessageIdHorde, uint _GraveYardId) { DespawnNeutralObjectType = _DespawnNeutralObjectType; SpawnObjectTypeAlliance = _SpawnObjectTypeAlliance; @@ -1080,9 +1059,9 @@ namespace Game.BattleGrounds.Zones public int DespawnNeutralObjectType; public int SpawnObjectTypeAlliance; - public CypherStrings MessageIdAlliance; + public uint MessageIdAlliance; public int SpawnObjectTypeHorde; - public CypherStrings MessageIdHorde; + public uint MessageIdHorde; public uint GraveYardId; } @@ -1123,20 +1102,49 @@ namespace Game.BattleGrounds.Zones }; public static BattlegroundEYLosingPointStruct[] m_LosingPointTypes = { - new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerFelReaverCenter, EotSObjectTypes.ABannerFelReaverCenter, CypherStrings.BgEyHasLostAFRuins, EotSObjectTypes.HBannerFelReaverCenter, CypherStrings.BgEyHasLostHFRuins), - new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerBloodElfCenter, EotSObjectTypes.ABannerBloodElfCenter, CypherStrings.BgEyHasLostABTower, EotSObjectTypes.HBannerBloodElfCenter, CypherStrings.BgEyHasLostHBTower), - new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerDraeneiRuinsCenter, EotSObjectTypes.ABannerDraeneiRuinsCenter, CypherStrings.BgEyHasLostADRuins, EotSObjectTypes.HBannerDraeneiRuinsCenter, CypherStrings.BgEyHasLostHDRuins), - new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerMageTowerCenter, EotSObjectTypes.ABannerMageTowerCenter, CypherStrings.BgEyHasLostAMTower, EotSObjectTypes.HBannerMageTowerCenter, CypherStrings.BgEyHasLostHMTower) + new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerFelReaverCenter, EotSObjectTypes.ABannerFelReaverCenter, EotSBroadcastTexts.AllianceLostFelReaverRuins, EotSObjectTypes.HBannerFelReaverCenter, EotSBroadcastTexts.HordeLostFelReaverRuins), + new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerBloodElfCenter, EotSObjectTypes.ABannerBloodElfCenter, EotSBroadcastTexts.AllianceLostBloodElfTower, EotSObjectTypes.HBannerBloodElfCenter, EotSBroadcastTexts.HordeLostBloodElfTower), + new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerDraeneiRuinsCenter, EotSObjectTypes.ABannerDraeneiRuinsCenter, EotSBroadcastTexts.AllianceLostDraeneiRuins, EotSObjectTypes.HBannerDraeneiRuinsCenter, EotSBroadcastTexts.HordeLostDraeneiRuins), + new BattlegroundEYLosingPointStruct(EotSObjectTypes.NBannerMageTowerCenter, EotSObjectTypes.ABannerMageTowerCenter, EotSBroadcastTexts.AllianceLostMageTower, EotSObjectTypes.HBannerMageTowerCenter, EotSBroadcastTexts.HordeLostMageTower) }; public static BattlegroundEYCapturingPointStruct[] m_CapturingPointTypes = { - new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerFelReaverCenter, EotSObjectTypes.ABannerFelReaverCenter, CypherStrings.BgEyHasTakenAFRuins, EotSObjectTypes.HBannerFelReaverCenter, CypherStrings.BgEyHasTakenHFRuins, EotSGaveyardIds.FelReaver), - new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerBloodElfCenter, EotSObjectTypes.ABannerBloodElfCenter, CypherStrings.BgEyHasTakenABTower, EotSObjectTypes.HBannerBloodElfCenter, CypherStrings.BgEyHasTakenHBTower, EotSGaveyardIds.BloodElf), - new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerDraeneiRuinsCenter, EotSObjectTypes.ABannerDraeneiRuinsCenter, CypherStrings.BgEyHasTakenADRuins, EotSObjectTypes.HBannerDraeneiRuinsCenter, CypherStrings.BgEyHasTakenHDRuins, EotSGaveyardIds.DraeneiRuins), - new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerMageTowerCenter, EotSObjectTypes.ABannerMageTowerCenter, CypherStrings.BgEyHasTakenAMTower, EotSObjectTypes.HBannerMageTowerCenter, CypherStrings.BgEyHasTakenHMTower, EotSGaveyardIds.MageTower) + new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerFelReaverCenter, EotSObjectTypes.ABannerFelReaverCenter, EotSBroadcastTexts.AllianceTakenFelReaverRuins, EotSObjectTypes.HBannerFelReaverCenter, EotSBroadcastTexts.HordeTakenFelReaverRuins, EotSGaveyardIds.FelReaver), + new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerBloodElfCenter, EotSObjectTypes.ABannerBloodElfCenter, EotSBroadcastTexts.AllianceTakenBloodElfTower, EotSObjectTypes.HBannerBloodElfCenter, EotSBroadcastTexts.HordeTakenBloodElfTower, EotSGaveyardIds.BloodElf), + new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerDraeneiRuinsCenter, EotSObjectTypes.ABannerDraeneiRuinsCenter, EotSBroadcastTexts.AllianceTakenDraeneiRuins, EotSObjectTypes.HBannerDraeneiRuinsCenter, EotSBroadcastTexts.HordeTakenDraeneiRuins, EotSGaveyardIds.DraeneiRuins), + new BattlegroundEYCapturingPointStruct(EotSObjectTypes.NBannerMageTowerCenter, EotSObjectTypes.ABannerMageTowerCenter, EotSBroadcastTexts.AllianceTakenMageTower, EotSObjectTypes.HBannerMageTowerCenter, EotSBroadcastTexts.HordeTakenMageTower, EotSGaveyardIds.MageTower) }; } + struct EotSBroadcastTexts + { + public const uint AllianceTakenFelReaverRuins = 17828; + public const uint HordeTakenFelReaverRuins = 17829; + public const uint AllianceLostFelReaverRuins = 17835; + public const uint HordeLostFelReaverRuins = 17836; + + public const uint AllianceTakenBloodElfTower = 17819; + public const uint HordeTakenBloodElfTower = 17823; + public const uint AllianceLostBloodElfTower = 17831; + public const uint HordeLostBloodElfTower = 17832; + + public const uint AllianceTakenDraeneiRuins = 17826; + public const uint HordeTakenDraeneiRuins = 17827; + public const uint AllianceLostDraeneiRuins = 17833; + public const uint HordeLostDraeneiRuins = 17834; + + public const uint AllianceTakenMageTower = 17824; + public const uint HordeTakenMageTower = 17825; + public const uint AllianceLostMageTower = 17837; + public const uint HordeLostMageTower = 17838; + + public const uint TakenFlag = 18359; + public const uint FlagDropped = 18361; + public const uint FlagReset = 18364; + public const uint AllianceCapturedFlag = 18375; + public const uint HordeCapturedFlag = 18384; + } + struct EotSWorldStateIds { public const uint AllianceResources = 2749; diff --git a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs index 251597f49..0bf23b624 100644 --- a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs +++ b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs @@ -28,9 +28,6 @@ namespace Game.BattleGrounds.Zones { public BgStrandOfAncients() { - StartMessageIds[BattlegroundConst.EventIdFirst] = CypherStrings.BgSaStartTwoMinutes; - StartMessageIds[BattlegroundConst.EventIdSecond] = CypherStrings.BgSaStartOneMinute; - StartMessageIds[BattlegroundConst.EventIdThird] = CypherStrings.BgSaStartHalfMinute; StartMessageIds[BattlegroundConst.EventIdFourth] = 0; BgObjects = new ObjectGuid[SAObjectTypes.MaxObj]; @@ -323,7 +320,7 @@ namespace Game.BattleGrounds.Zones { SignaledRoundTwo = true; InitSecondRound = false; - SendMessageToAll(CypherStrings.BgSaRoundTwoOneMinute, ChatMsg.BgSystemNeutral); + SendBroadcastText(SABroadcastTexts.RoundTwoStartOneMinute, ChatMsg.BgSystemNeutral); } } else @@ -385,7 +382,7 @@ namespace Game.BattleGrounds.Zones if (!SignaledRoundTwoHalfMin) { SignaledRoundTwoHalfMin = true; - SendMessageToAll(CypherStrings.BgSaRoundTwoStartHalfMinute, ChatMsg.BgSystemNeutral); + SendBroadcastText(SABroadcastTexts.RoundTwoStartHalfMinute, ChatMsg.BgSystemNeutral); } } StartShips(); @@ -922,9 +919,9 @@ namespace Game.BattleGrounds.Zones if (clicker.GetTeamId() == Attackers) { if (clicker.GetTeamId() == TeamId.Alliance) - SendMessageToAll(CypherStrings.BgSaAllianceCapturedRelic, ChatMsg.BgSystemNeutral); + SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral); else - SendMessageToAll(CypherStrings.BgSaHordeCapturedRelic, ChatMsg.BgSystemNeutral); + SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral); if (Status == SAStatus.RoundOne) { @@ -1366,7 +1363,7 @@ namespace Game.BattleGrounds.Zones }; public static uint[] ObjEntries = - { + { 190722, 190727, 190724, @@ -1419,6 +1416,15 @@ namespace Game.BattleGrounds.Zones }; } + struct SABroadcastTexts + { + public const uint AllianceCapturedTitanPortal = 28944; + public const uint HordeCapturedTitanPortal = 28945; + + public const uint RoundTwoStartOneMinute = 29448; + public const uint RoundTwoStartHalfMinute = 29449; + } + enum SAStatus { NotStarted = 0, diff --git a/Source/Game/BattleGrounds/Zones/WarsongGluch.cs b/Source/Game/BattleGrounds/Zones/WarsongGluch.cs index 6e462b14f..c28d35a79 100644 --- a/Source/Game/BattleGrounds/Zones/WarsongGluch.cs +++ b/Source/Game/BattleGrounds/Zones/WarsongGluch.cs @@ -30,10 +30,9 @@ namespace Game.BattleGrounds.Zones BgObjects = new ObjectGuid[WSGObjectTypes.Max]; BgCreatures = new ObjectGuid[WSGCreatureTypes.Max]; - StartMessageIds[BattlegroundConst.EventIdFirst] = CypherStrings.BgWsStartTwoMinutes; - StartMessageIds[BattlegroundConst.EventIdSecond] = CypherStrings.BgWsStartOneMinute; - StartMessageIds[BattlegroundConst.EventIdThird] = CypherStrings.BgWsStartHalfMinute; - StartMessageIds[BattlegroundConst.EventIdFourth] = CypherStrings.BgWsHasBegun; + StartMessageIds[BattlegroundConst.EventIdSecond] = WSGBroadcastTexts.StartOneMinute; + StartMessageIds[BattlegroundConst.EventIdThird] = WSGBroadcastTexts.StartHalfMinute; + StartMessageIds[BattlegroundConst.EventIdFourth] = WSGBroadcastTexts.BattleHasBegun; } public override void PostUpdateImpl(uint diff) @@ -250,7 +249,7 @@ namespace Game.BattleGrounds.Zones //when map_update will be allowed for Battlegrounds this code will be useless SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnImmediately); SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnImmediately); - SendMessageToAll(CypherStrings.BgWsFPlaced, ChatMsg.BgSystemNeutral); + SendBroadcastText(WSGBroadcastTexts.FlagsPlaced, ChatMsg.BgSystemNeutral); PlaySoundToAll(WSGSound.FlagsRespawned); // flag respawned sound... } _bothFlagsKept = false; @@ -263,16 +262,11 @@ namespace Game.BattleGrounds.Zones RespawnFlag(team, false); if (team == Team.Alliance) - { SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnImmediately); - SendMessageToAll(CypherStrings.BgWsAllianceFlagRespawned, ChatMsg.BgSystemNeutral); - } else - { SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnImmediately); - SendMessageToAll(CypherStrings.BgWsHordeFlagRespawned, ChatMsg.BgSystemNeutral); - } + SendBroadcastText(WSGBroadcastTexts.FlagsPlaced, ChatMsg.BgSystemNeutral); PlaySoundToAll(WSGSound.FlagsRespawned); GameObject obj = GetBgMap().GetGameObject(GetDroppedFlagGUID(team)); @@ -338,9 +332,9 @@ namespace Game.BattleGrounds.Zones SpawnBGObject(WSGObjectTypes.AFlag, WSGTimerOrScore.FlagRespawnTime); if (player.GetTeam() == Team.Alliance) - SendMessageToAll(CypherStrings.BgWsCapturedHf, ChatMsg.BgSystemAlliance, player); + SendBroadcastText(WSGBroadcastTexts.CapturedHordeFlag, ChatMsg.BgSystemAlliance, player); else - SendMessageToAll(CypherStrings.BgWsCapturedAf, ChatMsg.BgSystemHorde, player); + SendBroadcastText(WSGBroadcastTexts.CapturedAllianceFlag, ChatMsg.BgSystemHorde, player); UpdateFlagState(player.GetTeam(), WSGFlagState.WaitRespawn); // flag state none UpdateTeamScore(player.GetTeamId()); @@ -448,12 +442,12 @@ namespace Game.BattleGrounds.Zones if (player.GetTeam() == Team.Alliance) { - SendMessageToAll(CypherStrings.BgWsDroppedHf, ChatMsg.BgSystemHorde, player); + SendBroadcastText(WSGBroadcastTexts.HordeFlagDropped, ChatMsg.BgSystemHorde, player); UpdateWorldState(WSGWorldStates.FlagUnkHorde, 0xFFFFFFFF); } else { - SendMessageToAll(CypherStrings.BgWsDroppedAf, ChatMsg.BgSystemAlliance, player); + SendBroadcastText(WSGBroadcastTexts.AllianceFlagDropped, ChatMsg.BgSystemAlliance, player); UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 0xFFFFFFFF); } @@ -466,15 +460,11 @@ namespace Game.BattleGrounds.Zones if (GetStatus() != BattlegroundStatus.InProgress) return; - CypherStrings message_id = 0; - ChatMsg type = ChatMsg.BgSystemNeutral; - //alliance flag picked up from base if (player.GetTeam() == Team.Horde && GetFlagState(Team.Alliance) == WSGFlagState.OnBase && BgObjects[WSGObjectTypes.AFlag] == target_obj.GetGUID()) { - message_id = CypherStrings.BgWsPickedupAf; - type = ChatMsg.BgSystemHorde; + SendBroadcastText(WSGBroadcastTexts.AllianceFlagPickedUp, ChatMsg.BgSystemHorde, player); PlaySoundToAll(WSGSound.AllianceFlagPickedUp); SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay); SetAllianceFlagPicker(player.GetGUID()); @@ -492,8 +482,7 @@ namespace Game.BattleGrounds.Zones if (player.GetTeam() == Team.Alliance && GetFlagState(Team.Horde) == WSGFlagState.OnBase && BgObjects[WSGObjectTypes.HFlag] == target_obj.GetGUID()) { - message_id = CypherStrings.BgWsPickedupHf; - type = ChatMsg.BgSystemAlliance; + SendBroadcastText(WSGBroadcastTexts.HordeFlagPickedUp, ChatMsg.BgSystemAlliance, player); PlaySoundToAll(WSGSound.HordeFlagPickedUp); SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay); SetHordeFlagPicker(player.GetGUID()); @@ -513,8 +502,7 @@ namespace Game.BattleGrounds.Zones { if (player.GetTeam() == Team.Alliance) { - message_id = CypherStrings.BgWsReturnedAf; - type = ChatMsg.BgSystemAlliance; + SendBroadcastText(WSGBroadcastTexts.AllianceFlagReturned, ChatMsg.BgSystemAlliance, player); UpdateFlagState(Team.Horde, WSGFlagState.WaitRespawn); RespawnFlag(Team.Alliance, false); SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnImmediately); @@ -524,8 +512,7 @@ namespace Game.BattleGrounds.Zones } else { - message_id = CypherStrings.BgWsPickedupAf; - type = ChatMsg.BgSystemHorde; + SendBroadcastText(WSGBroadcastTexts.AllianceFlagPickedUp, ChatMsg.BgSystemHorde, player); PlaySoundToAll(WSGSound.AllianceFlagPickedUp); SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay); SetAllianceFlagPicker(player.GetGUID()); @@ -548,8 +535,7 @@ namespace Game.BattleGrounds.Zones { if (player.GetTeam() == Team.Horde) { - message_id = CypherStrings.BgWsReturnedHf; - type = ChatMsg.BgSystemHorde; + SendBroadcastText(WSGBroadcastTexts.HordeFlagReturned, ChatMsg.BgSystemHorde, player); UpdateFlagState(Team.Alliance, WSGFlagState.WaitRespawn); RespawnFlag(Team.Horde, false); SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnImmediately); @@ -559,8 +545,7 @@ namespace Game.BattleGrounds.Zones } else { - message_id = CypherStrings.BgWsPickedupHf; - type = ChatMsg.BgSystemAlliance; + SendBroadcastText(WSGBroadcastTexts.HordeFlagPickedUp, ChatMsg.BgSystemAlliance, player); PlaySoundToAll(WSGSound.HordeFlagPickedUp); SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay); SetHordeFlagPicker(player.GetGUID()); @@ -577,10 +562,6 @@ namespace Game.BattleGrounds.Zones //target_obj.Delete(); } - if (message_id == 0) - return; - - SendMessageToAll(message_id, type, player); player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.EnterPvpCombat); } @@ -1117,5 +1098,22 @@ namespace Game.BattleGrounds.Zones public const uint AllianceFlagPickedUp = 8174; public const uint FlagsRespawned = 8232; } + + struct WSGBroadcastTexts + { + public const uint StartOneMinute = 10015; + public const uint StartHalfMinute = 10016; + public const uint BattleHasBegun = 10014; + + public const uint CapturedHordeFlag = 9801; + public const uint CapturedAllianceFlag = 9802; + public const uint FlagsPlaced = 9803; + public const uint AllianceFlagPickedUp = 9804; + public const uint AllianceFlagDropped = 9805; + public const uint HordeFlagPickedUp = 9807; + public const uint HordeFlagDropped = 9806; + public const uint AllianceFlagReturned = 9808; + public const uint HordeFlagReturned = 9809; + } #endregion } diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 97af854e6..7cadfd1cf 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -359,11 +359,11 @@ namespace Game.Entities { if (!CliDB.BroadcastTextStorage.ContainsKey(textId)) { - Log.outError(LogFilter.Unit, "Unit.Talk: `broadcast_text` was not {0} found", textId); + Log.outError(LogFilter.Unit, "Unit.Talk: `broadcast_text` (Id: {0}) was not found", textId); return; } - var builder = new BroadcastTextBuilder(this, msgType, textId, target); + var builder = new BroadcastTextBuilder(this, msgType, textId, GetGender(), target); var localizer = new LocalizedPacketDo(builder); var worker = new PlayerDistWorker(this, textRange, localizer); Cell.VisitWorldObjects(this, worker, textRange); diff --git a/Source/Game/Text/ChatTextBuilder.cs b/Source/Game/Text/ChatTextBuilder.cs index 1ad4ee0b1..3bbc63d63 100644 --- a/Source/Game/Text/ChatTextBuilder.cs +++ b/Source/Game/Text/ChatTextBuilder.cs @@ -32,11 +32,12 @@ namespace Game.Chat public class BroadcastTextBuilder : MessageBuilder { - public BroadcastTextBuilder(Unit obj, ChatMsg msgtype, uint id, WorldObject target = null, uint achievementId = 0) + public BroadcastTextBuilder(WorldObject obj, ChatMsg msgtype, uint textId, Gender gender, WorldObject target = null, uint achievementId = 0) { _source = obj; _msgType = msgtype; - _textId = id; + _textId = textId; + _gender = gender; _target = target; _achievementId = achievementId; } @@ -45,13 +46,14 @@ namespace Game.Chat { BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(_textId); var packet = new ChatPkt(); - packet.Initialize(_msgType, bct != null ? (Language)bct.Language : Language.Universal, _source, _target, bct != null ? Global.DB2Mgr.GetBroadcastTextValue(bct, locale, _source.GetGender()) : "", _achievementId, "", locale); + packet.Initialize(_msgType, bct != null ? (Language)bct.Language : Language.Universal, _source, _target, bct != null ? Global.DB2Mgr.GetBroadcastTextValue(bct, locale, _gender) : "", _achievementId, "", locale); return packet; } - Unit _source; + WorldObject _source; ChatMsg _msgType; uint _textId; + Gender _gender; WorldObject _target; uint _achievementId; } @@ -80,4 +82,36 @@ namespace Game.Chat Language _language; WorldObject _target; } + + class CypherStringChatBuilder : MessageBuilder + { + public CypherStringChatBuilder(WorldObject obj, ChatMsg msgType, CypherStrings textId, WorldObject target = null, object[] args = null) + { + _source = obj; + _msgType = msgType; + _textId = textId; + _target = target; + _args = args; + } + + public override ServerPacket Invoke(LocaleConstant locale) + { + ChatPkt packet = new ChatPkt(); + + string text = Global.ObjectMgr.GetCypherString(_textId, locale); + + if (_args != null) + packet.Initialize(_msgType, Language.Universal, _source, _target, string.Format(text, _args), 0, "", locale); + else + packet.Initialize(_msgType, Language.Universal, _source, _target, text, 0, "", locale); + + return packet; + } + + WorldObject _source; + ChatMsg _msgType; + CypherStrings _textId; + WorldObject _target; + object[] _args; + } } 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 000000000..adb43a547 --- /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;