diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs index d4db294..6ebe38c 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs @@ -402,8 +402,56 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem GameManager.Games.Remove(GameId); } })); + } + /// + /// Executes an action to all players in the game. + /// + /// Action to execute + public void BroadcastPlayers(Action action) + { + foreach (var player in Players) + { + action(player.Key, player.Value); + } + } + + /// + /// Executes an action to all players in the game where the predicate is true. + /// + /// Predicate to check + /// Action to execute + public void BroadcastPlayers(Func predicate, Action action) + { + foreach (var player in Players.Where(s=>predicate(s.Key, s.Value))) + { + action(player.Key, player.Value); + } + } + /// + /// Executes an action to all worlds in the game. + /// + /// Action to execute + public void BroadcastWorlds(Action action) + { + foreach (var world in Worlds) + { + action(world); + } + } + + /// + /// Executes an action to all worlds in the game. + /// + /// Predicate to check + /// Action to execute + public void BroadcastWorlds(Func predicate, Action action) + { + foreach (var world in Worlds.Where(predicate)) + { + action(world); + } } #region update & tick managment diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs index 6e37abb..1b77c41 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs @@ -197,7 +197,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem { int xpReward = (int)(Quests[Game.CurrentQuest].RewardXp * Game.XpModifier); int goldReward = (int)(Quests[Game.CurrentQuest].RewardGold * Game.GoldModifier); - if (Game.CurrentQuest != 312429) + if (Game.CurrentQuest != 312429) // open world quest { player.InGameClient.SendMessage(new QuestStepCompleteMessage() { @@ -433,14 +433,14 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem onDone); } - public void LaunchQuestTimer(int questId, float duration, Action onDone, int Meterid = 0) + public void LaunchQuestTimer(int questId, float duration, Action onDone, int masterId = 0) { foreach (var player in Game.Players.Values) { player.InGameClient.SendMessage(new QuestMeterMessage() { snoQuest = questId, - annMeter = Meterid, + annMeter = masterId, flMeter = 1f }); }; @@ -455,7 +455,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem player.InGameClient.SendMessage(new QuestMeterMessage() { snoQuest = questId, - annMeter = Meterid, + annMeter = masterId, flMeter = (QuestTimerEstimate / duration) }); };