private void CreateGlow(ClickFlag flag) { if (_glowObject != null) { _glowObject.RemoveFromWorld(); } // Spawn objective glow (Big Poofy Glowy Nuet) GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858); if (glowProto != null) { GameObject_spawn spawn = new GameObject_spawn { Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID(), WorldO = flag.Heading, WorldX = flag.WorldPosition.X, WorldY = flag.WorldPosition.Y, WorldZ = (ushort)flag.WorldPosition.Z, ZoneId = Region.RegionId, }; spawn.BuildFromProto(glowProto); _glowObject = new GameObject(spawn); _glowObject.VfxState = (byte)flag.Owner; Region.AddObject(_glowObject, spawn.ZoneId); } }
public DominationScenarioKhaine(Scenario_Info info, int tier) : base(info, tier) { foreach (Scenario_Object scenarioObject in info.ScenObjects.OrderBy(e => e.Identifier).ToList()) { if (scenarioObject.Type == "Flag") { ClickFlag clickFlag = new ClickFlag(scenarioObject.Identifier, scenarioObject.ObjectiveName, scenarioObject.WorldPosX, scenarioObject.WorldPosY, scenarioObject.PosZ, scenarioObject.Heading, scenarioObject.PointGain, scenarioObject.PointOverTimeGain, new ClickFlag.ClickFlagDelegate(OnHold), new ClickFlag.ClickFlagDelegate(OnCaptured)); Flags.Add(clickFlag); Region.AddObject(clickFlag, info.MapId); clickFlag.Open = true; clickFlag.Owner = 0; clickFlag.ShowGlow = true; clickFlag.HoldDuration = 0; clickFlag.CaptureCastTime = 10; } else { LoadScenarioObject(scenarioObject); } } }
private void OnHold(ClickFlag flag) { for (int i = 0; i < 2; i++) { foreach (Player plr in Players[i]) { if (plr == null || plr.IsDisposed || !plr.IsInWorld()) { continue; } flag.SendFlagInfo(plr); flag.SendMeTo(plr); } } }
public DominationScenarioPushCenter(Scenario_Info info, int tier) : base(info, tier) { int i = 0; int flagCount = info.ScenObjects.Where(e => e.Type == "Flag").ToList().Count; foreach (Scenario_Object scenarioObject in info.ScenObjects.OrderBy(e => e.Identifier).ToList()) { if (scenarioObject.Type == "Flag") { ClickFlag clickFlag = new ClickFlag(scenarioObject.Identifier, scenarioObject.ObjectiveName, scenarioObject.WorldPosX, scenarioObject.WorldPosY, scenarioObject.PosZ, scenarioObject.Heading, scenarioObject.PointGain, scenarioObject.PointOverTimeGain, new ClickFlag.ClickFlagDelegate(OnHold), new ClickFlag.ClickFlagDelegate(OnCaptured)); Flags.Add(clickFlag); Region.AddObject(clickFlag, info.MapId); clickFlag.Open = false; if (i < (flagCount / 2)) { clickFlag.Open = false; clickFlag.Owner = 1; } else if (i == flagCount / 2) { clickFlag.Open = true; clickFlag.Owner = 0; CurrentFlag = clickFlag; CreateGlow(CurrentFlag); } else { clickFlag.Open = false; clickFlag.Owner = 2; } i++; } else { LoadScenarioObject(scenarioObject); } } }
private void OnHold(ClickFlag flag) { for (int i = 0; i < 2; i++) { foreach (Player plr in Players[i]) { if (plr == null || plr.IsDisposed || !plr.IsInWorld()) { continue; } flag.SendFlagInfo(plr); flag.SendMeTo(plr); if (_glowObject != null) { _glowObject.VfxState = (byte)flag.HoldOwner; } } } }
private void OnCaptured(ClickFlag flag) { flag.GlowOwner = flag.Owner; EvtInterface.RemoveEvent(Lock); for (int i = 0; i < 2; i++) { foreach (Player plr in Players[i]) { if (plr == null || plr.IsDisposed || !plr.IsInWorld()) { continue; } flag.SendFlagInfo(plr); flag.SendFlagState(plr); flag.SendMeTo(plr); } } if (flag.Owner == (int)Realms.REALMS_REALM_ORDER) { PlaySoundToAll(580); } else if (flag.Owner == (int)Realms.REALMS_REALM_DESTRUCTION) { PlaySoundToAll(818); } if (Flags[0].Owner == Flags[1].Owner) { Broadcast(new[] { (Flags[0].Owner == (int)Realms.REALMS_REALM_ORDER ? "Order" : "Destruction") + " will lock down both control points in 15 seconds!" }, ChatLogFilters.CHATLOGFILTERS_C_WHITE, Localized_text.CHAT_TAG_DEFAULT); EvtInterface.AddEvent(Lock, 15000, 1); } }
private void OnCaptured(ClickFlag flag) { for (int i = 0; i < 2; i++) { foreach (Player plr in Players[i]) { if (plr == null || plr.IsDisposed || !plr.IsInWorld()) { continue; } flag.SendFlagInfo(plr); flag.SendFlagState(plr); flag.SendMeTo(plr); } } if (flag.Owner == 0) { return; // Nothing to do, probably a canceled capture } GivePoints(flag.Owner, flag.CapturePoints); int index = Flags.IndexOf(flag); //leave the last flag open for capture if (index == 0 || index == Flags.Count - 1) { flag.Open = true; } else { flag.Open = false; } //unlock foward flag if (flag.Owner == 1) { for (int i = index + 1; i < Flags.Count; i++) { Flags[i].Open = true; CurrentFlag = Flags[i]; Flags[i].HoldOwner = 0; Flags[i].Owner = 0; break; } } else if (flag.Owner == 2) { for (int i = index - 1; i >= 0; i--) { Flags[i].Open = true; CurrentFlag = Flags[i]; Flags[i].HoldOwner = 0; Flags[i].Owner = 0; break; } } CreateGlow(CurrentFlag); string packetString = $"{flag.ObjectiveName} is now {(flag.Owner == 1 ? "Order" : "Destruction")} controlled!"; for (int i = 0; i < 2; i++) { foreach (Player plr in Players[i]) { SendObjectiveStates(plr); CurrentFlag.SendMeTo(plr); plr.SendLocalizeString(packetString, SystemData.ChatLogFilters.CHATLOGFILTERS_C_WHITE, Localized_text.CHAT_TAG_DEFAULT); } } }