/// <summary> /// Create a gold chest in the given keep. /// </summary> /// <param name="keep">Taken keep</param> /// <param name="realm">Realm that gained control of the keep</param> internal void CreateGoldChest(Keep keep, Realms realm) { Dictionary <uint, ContributionInfo> contributors = GetContributorsFromRealm((Realms)keep.Info.Realm); if (contributors.Count > 0) { Log.Info("Battlefront", $"Creating gold chest for {keep.Info.Name} for {contributors.Count} {((Realms)keep.Info.Realm == Realms.REALMS_REALM_ORDER ? "Order" : "Destruction")} contributors"); GoldChest.Create(_region, keep.Info.PQuest, ref contributors, (Realms)keep.Info.Realm == realm ? WinnerShare : LoserShare); } }
public void End() { if (_ended) { return; } if (IsDungeon()) { _stageTimeEnd = TCPManager.GetTimeStamp() + TIME_DUNGEON_RESET; EvtInterface.AddEvent(Reset, TIME_DUNGEON_RESET * 1000, 1); } else { _stageTimeEnd = TCPManager.GetTimeStamp() + TIME_PQ_RESET; EvtInterface.AddEvent(Reset, TIME_PQ_RESET * 1000, 1); } _started = false; _ended = true; foreach (uint plr in ActivePlayers) { Player targPlayer = Player.GetPlayer(plr); if (targPlayer != null) { targPlayer.SendLocalizeString(Info.Name + " Complete", ChatLogFilters.CHATLOGFILTERS_SAY, GameData.Localized_text.CHAT_TAG_MONSTER_EMOTE); //SendReinitTime(Plr, TIME_PQ_RESET); targPlayer.AddInfluence((ushort)Info.ChapterId, 500); } } //sanity check - remove players in the PQ who won without doing anything foreach (KeyValuePair <uint, ContributionInfo> kV in Players) { if (kV.Value.ActiveTimeEnd == 0) // no contribution yet { _toRemove.Add(kV); } } if (_toRemove.Count > 0) { foreach (var kVr in _toRemove) { Players.Remove(kVr.Key); } _toRemove.Clear(); } GoldChest.Create(Region, Info, ref Players, 1); // We are playing some sounds when we finish the whole PQ if (Info.SoundPQEnd != 0) { GameObject_proto Proto = GameObjectService.GetGameObjectProto(2000489); GameObject_spawn S = new GameObject_spawn(); S.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID(); S.BuildFromProto(Proto); S.WorldX = Info.GoldChestWorldX; S.WorldY = Info.GoldChestWorldY; S.WorldZ = Info.GoldChestWorldZ; S.WorldO = 0; S.ZoneId = Info.ZoneId; GameObject GOSoundPlayer = Region.CreateGameObject(S); // PQ Sound player - this will play sounds on PQ Stage, need to be setup in DB var prms = new List <object>() { GOSoundPlayer, (ushort)Info.SoundPQEnd }; GOSoundPlayer.EvtInterface.AddEvent(PlayFinalPQSound, 1 * 1000, 1, prms); //GOSoundPlayer.EvtInterface.AddEvent(Destroy, 5 * 1000, 1); } }