private static void OnLogin(LoginEventArgs e) { Mobile m = e.Mobile; if (m.AccessLevel > AccessLevel.GameMaster) { return; } ShadowguardInstance inst = GetInstance(m.Location, m.Map); if (inst != null) { ShadowguardEncounter encounter = inst.Encounter; if (encounter == null) { StormLevelGump menu = new StormLevelGump(m); menu.BeginClose(); m.SendGump(menu); } else if (m != encounter.PartyLeader) { Party p = Party.Get(encounter.PartyLeader); if (p == null || !p.Contains(m)) { StormLevelGump menu = new StormLevelGump(m); menu.BeginClose(); m.SendGump(menu); } } } }
private static void OnLogin(LoginEventArgs e) { Mobile m = e.Mobile; if (m.AccessLevel > AccessLevel.GameMaster) { return; } ShadowguardInstance inst = GetInstance(m.Location, m.Map); if (inst != null) { ShadowguardEncounter encounter = inst.Encounter; if (encounter == null) { ShadowguardEncounter.MovePlayer(m, Instance.KickLocation, true); } else if (m != encounter.PartyLeader) { Party p = Party.Get(encounter.PartyLeader); if (p == null || !p.Contains(m)) { ShadowguardEncounter.MovePlayer(m, Instance.KickLocation, true); } } } }
public void OnEncounterComplete(ShadowguardEncounter encounter, bool expired) { Encounters.Remove(encounter); CheckQueue(); if (!expired) { Mobile m = encounter.PartyLeader; if (m == null) { return; } Party p = Party.Get(m); if (p != null) { foreach (PartyMemberInfo info in p.Members) { AddToTable(info.Mobile, encounter.Encounter); } } else { AddToTable(m, encounter.Encounter); } } }
public virtual void Summon() { int max = MaxSummons; ShadowguardEncounter inst = ShadowguardController.GetEncounter(this.Location, this.Map); if (inst != null) { max += inst.PartySize() * 2; } if (this.Map == null || this.SummonTypes == null || this.SummonTypes.Length == 0 || TotalSummons() > max) { return; } int count = Utility.RandomList(1, 2, 2, 2, 3, 3, 4, 5); for (int i = 0; i < count; i++) { Point3D p = Combatant.Location; for (int j = 0; j < 10; j++) { int x = Utility.RandomMinMax(p.X - 3, p.X + 3); int y = Utility.RandomMinMax(p.Y - 3, p.Y + 3); int z = this.Map.GetAverageZ(x, y); if (this.Map.CanSpawnMobile(x, y, z)) { p = new Point3D(x, y, z); break; } } BaseCreature spawn = Activator.CreateInstance(SummonTypes[Utility.Random(SummonTypes.Length)]) as BaseCreature; if (spawn != null) { spawn.MoveToWorld(p, this.Map); spawn.Team = this.Team; spawn.SummonMaster = this; Timer.DelayCall(TimeSpan.FromSeconds(1), (o) => { BaseCreature s = o as BaseCreature; if (s != null) { s.Combatant = this.Combatant; } }, spawn); AddHelper(spawn); } } _NextSummon = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 40)); }
public ShadowguardCypress(ShadowguardEncounter encounter, VirtueType type) : base(Utility.RandomList(3320, 3323, 3326, 3329)) { VirtueType = type; Encounter = encounter; Foilage = new ShadowguardCypressFoilage(Utility.RandomMinMax(this.ItemID + 1, this.ItemID + 2), this); Movable = false; }
private static void OnDisconnected(DisconnectedEventArgs e) { ShadowguardEncounter encounter = ShadowguardController.GetEncounter(e.Mobile.Location, e.Mobile.Map); if (encounter != null) { encounter.CheckPlayerStatus(e.Mobile); } }
public override void Deserialize(GenericReader reader) { Instance = this; base.Deserialize(reader); int version = reader.ReadInt(); InitializeInstances(); Encounters = new List <ShadowguardEncounter>(); Addons = new List <BaseAddon>(); Queue = new Dictionary <Mobile, EncounterType>(); KickLocation = reader.ReadPoint3D(); Lobby = reader.ReadRect2D(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { var encounter = ShadowguardEncounter.ConstructEncounter((EncounterType)reader.ReadInt()); encounter.Deserialize(reader); AddEncounter(encounter); } count = reader.ReadInt(); for (int i = 0; i < count; i++) { if (Table == null) { Table = new Dictionary <Mobile, EncounterType>(); } Mobile m = reader.ReadMobile(); if (m != null) { Table[m] = (EncounterType)reader.ReadInt(); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { BaseAddon addon = reader.ReadItem() as BaseAddon; if (addon != null) { Addons.Add(addon); } } StartTimer(); }
public void OnEncounterComplete(ShadowguardEncounter encounter, bool expired) { Encounters.Remove(encounter); CheckQueue(); if (!expired) { foreach (PlayerMobile pm in encounter.Region.GetEnumeratedMobiles().OfType <PlayerMobile>()) { AddToTable(pm, encounter.Encounter); } } }
public override void OnClick() { ShadowguardInstance instance = ShadowguardController.GetInstance(_From.Location, _From.Map); if (instance != null && instance.Region.Contains(_From.Location)) { ShadowguardEncounter.MovePlayer(_From, ShadowguardController.Instance.KickLocation); if (instance.Encounter != null) { instance.Encounter.CheckPlayerStatus(_From); } } }
public void OnEncounterComplete(ShadowguardEncounter encounter, bool expired) { Encounters.Remove(encounter); CheckQueue(); if (!expired) { Mobile m = encounter.PartyLeader; if (m == null) { return; } if (encounter.Encounter == EncounterType.Roof) { if (Table != null && Table.ContainsKey(m)) { Table.Remove(m); if (Table.Count == 0) { Table = null; } return; } } if (Table != null && Table.ContainsKey(m)) { if ((Table[m] & encounter.Encounter) == 0) { Table[m] |= encounter.Encounter; } } else { if (Table == null) { Table = new Dictionary <Mobile, EncounterType>(); } Table[m] = encounter.Encounter; } } }
private static void OnLogin(LoginEventArgs e) { Mobile m = e.Mobile; if (m.AccessLevel > AccessLevel.GameMaster) { return; } ShadowguardInstance inst = GetInstance(m.Location, m.Map); if (inst != null) { ShadowguardEncounter encounter = inst.Encounter; if (encounter == null) { Timer.DelayCall(TimeSpan.FromSeconds(1), mob => { ShadowguardEncounter.MovePlayer(mob, Instance.KickLocation, true); /*StormLevelGump menu = new StormLevelGump(mob); * menu.BeginClose(); * mob.SendGump(menu);*/ }, m); } else if (m != encounter.PartyLeader) { Party p = Party.Get(encounter.PartyLeader); if (m is PlayerMobile && !encounter.Participants.Contains((PlayerMobile)m)) { Timer.DelayCall(TimeSpan.FromSeconds(1), mob => { ShadowguardEncounter.MovePlayer(mob, Instance.KickLocation, true); /*StormLevelGump menu = new StormLevelGump(mob); * menu.BeginClose(); * mob.SendGump(menu);*/ }, m); } } } }
} // Cursed Suit of Armor public CursedSuitOfArmor(ShadowguardEncounter encounter) : base(0x151A) { Encounter = encounter; Movable = false; }
public ShadowguardApple(ShadowguardEncounter encounter, ShadowguardCypress tree) : base(0x9D0) { Encounter = encounter; Tree = tree; }
public void AddEncounter(ShadowguardEncounter encounter) { Encounters.Add(encounter); }
public void CheckQueue() { if (Queue.Count == 0) { return; } bool message = false; List <Mobile> copy = new List <Mobile>(Queue.Keys); for (int i = 0; i < copy.Count; i++) { Mobile m = copy[i]; if (m.Map != Map.TerMur || m.NetState == null) { RemoveFromQueue(m); if (i == 0) { message = true; } continue; } for (var index = 0; index < Encounters.Count; index++) { ShadowguardEncounter inst = Encounters[index]; if (inst.PartyLeader == m) { if (i == 0) { message = true; } RemoveFromQueue(m); } } if (Queue.Count > 0) { message = true; Timer.DelayCall(TimeSpan.FromMinutes(2), mobile => { if (Queue.ContainsKey(m)) { EncounterType type = Queue[m]; ShadowguardInstance instance = GetAvailableInstance(type); if (instance != null && instance.TryBeginEncounter(m, true, type)) { RemoveFromQueue(m); } } }, m); } break; } ColUtility.Free(copy); if (message && Queue.Count > 0) { ColUtility.For(Queue.Keys, (i, mob) => { Party p = Party.Get(mob); if (p != null) { for (var index = 0; index < p.Members.Count; index++) { var info = p.Members[index]; info.Mobile.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next"); } } //A Shadowguard encounter has opened. You are currently ~1_NUM~ in the //queue. If you are next, you may proceed to the entry stone to join. else { mob.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next"); } }); } }
public bool CanTryEncounter(Mobile m, EncounterType encounter) { Party p = Party.Get(m); if (p != null && p.Leader != m) { m.SendLocalizedMessage(1156184); // You may not start a Shadowguard encounter while in a party unless you are the party leader. return(false); } if (encounter == EncounterType.Roof) { if (p != null) { for (var index = 0; index < p.Members.Count; index++) { PartyMemberInfo info = p.Members[index]; if (Table == null || !Table.ContainsKey(info.Mobile) || (Table[info.Mobile] & EncounterType.Required) != EncounterType.Required) { m.SendLocalizedMessage(1156249); // All members of your party must complete each of the Shadowguard Towers before attempting the finale. return(false); } } } else if (Table == null || !Table.ContainsKey(m) || (Table[m] & EncounterType.Required) != EncounterType.Required) { m.SendLocalizedMessage(1156196); // You must complete each level of Shadowguard before attempting the Roof. return(false); } } if (p != null) { for (var index = 0; index < p.Members.Count; index++) { PartyMemberInfo info = p.Members[index]; for (var i = 0; i < Encounters.Count; i++) { ShadowguardEncounter enc = Encounters[i]; if (enc.PartyLeader != null) { Party party = Party.Get(enc.PartyLeader); if (enc.PartyLeader == info.Mobile || party != null && party.Contains(info.Mobile)) { m.SendLocalizedMessage(1156189, info.Mobile.Name); // ~1_NAME~ in your party is already attempting to join a Shadowguard encounter. Start a new party without them or wait until they are finished and try again. return(false); } } foreach (Mobile mob in Queue.Keys) { if (mob != null) { Party party = Party.Get(mob); if (mob == info.Mobile || party != null && party.Contains(info.Mobile)) { m.SendLocalizedMessage(1156189, info.Mobile.Name); // ~1_NAME~ in your party is already attempting to join a Shadowguard encounter. Start a new party without them or wait until they are finished and try again. return(false); } } } } } } for (var index = 0; index < Encounters.Count; index++) { ShadowguardEncounter instance = Encounters[index]; if (instance.PartyLeader == m) { return(false); } } return(true); }