public override void Damage(int amount, Mobile from, bool informmount, bool checkfizzle) { if (from == null || (ShadowguardController.GetEncounter(this.Location, this.Map) != null && this.Z == from.Z)) { base.Damage(amount, from, informmount, checkfizzle); } }
public override void OnResponse(NetState state, RelayInfo info) { ShadowguardController controller = ShadowguardController.Instance; if (info.ButtonID == 123) { if (controller.RemoveFromQueue(User)) { User.SendLocalizedMessage(1156248); // You have been removed from all Shadowguard queues } } else if (info.ButtonID > 0) { int id = info.ButtonID - 1; if (id >= 0 && id < _Encounters.Length) { EncounterType type = _Encounters[id]; ShadowguardInstance inst = controller.GetAvailableInstance(type); if (controller.CanTryEncounter(User, type)) { if (inst == null) { controller.AddToQueue(User, type); } else { inst.TryBeginEncounter(User, false, type); controller.RemoveFromQueue(User); } } } } }
public override int LabelNumber => 1156235; // An Enchanting Crystal Ball public static void Initialize() { EventSink.Login += OnLogin; EventSink.Disconnected += OnDisconnected; CommandSystem.Register("AddController", AccessLevel.Administrator, e => { if (Instance == null) { ShadowguardController controller = new ShadowguardController(); controller.MoveToWorld(new Point3D(501, 2192, 50), Map.TerMur); e.Mobile.SendMessage("Shadowguard controller setup!"); } else { e.Mobile.SendMessage("A Shadowguard controller already exists!"); } }); CommandSystem.Register("CompleteAllRooms", AccessLevel.GameMaster, e => { if (Instance.Table == null) { Instance.Table = new Dictionary <Mobile, EncounterType>(); } Instance.Table[e.Mobile] = EncounterType.Bar | EncounterType.Orchard | EncounterType.Armory | EncounterType.Fountain | EncounterType.Belfry; }); }
public ShadowguardGump(PlayerMobile user) : base(100, 100) { User = user; AddPage(0); AddBackground(0, 0, 370, 320, 83); AddHtmlLocalized(10, 10, 350, 18, 1154645, "#1156164", 0x7FFF, false, false); // Shadowguard AddHtmlLocalized(10, 41, 350, 18, 1154645, "#1156181", 0x7FFF, false, false); // Select the area of Shadowguard you wish to explore... ShadowguardController controller = ShadowguardController.Instance; int index = 0; for (int i = 0; i < _Encounters.Length; i++) { EncounterType encounter = _Encounters[i]; int hue = controller.HasCompletedEncounter(User, encounter) ? Green : Red; AddHtmlLocalized(50, 72 + (index * 20), 150, 20, ShadowguardController.GetLocalization(encounter), hue, false, false); AddButton(10, 72 + (index * 20), 1209, 1210, i + 1, GumpButtonType.Reply, 0); index++; } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID > 0) { int id = info.ButtonID - 1; if (id >= 0 && id < _Encounters.Length) { ShadowguardController controller = ShadowguardController.Instance; EncounterType type = _Encounters[id]; ShadowguardInstance inst = controller.GetAvailableInstance(type); if (controller.CanTryEncounter(User, type)) { if (inst == null) { controller.AddToQueue(User, type); } else { inst.TryBeginEncounter(User, false, type); controller.RemoveFromQueue(User); } } } } }
public ShadowguardGump(PlayerMobile user) : base(100, 50) { User = user; AddBackground(0, 0, 400, 400, 83); AddHtmlLocalized(0, 10, 400, 16, 1154645, "#1156164", 0xFFFF, false, false); // Shadowguard AddHtmlLocalized(0, 45, 400, 16, 1154645, "#1156181", 0xFFFF, false, false); // Select the area of Shadowguard you wish to explore... ShadowguardController controller = ShadowguardController.Instance; int index = 0; for (int i = 0; i < _Encounters.Length; i++) { EncounterType encounter = _Encounters[i]; int hue = controller.HasCompletedEncounter(User, encounter) ? Green : Red; AddHtmlLocalized(50, 78 + (index * 20), 200, 16, ShadowguardController.GetLocalization(encounter), hue, false, false); AddButton(15, 80 + (index * 20), 1209, 1210, i + 1, GumpButtonType.Reply, 0); index++; } if (controller.IsInQueue(User)) { AddHtmlLocalized(50, 358, 200, 16, 1156247, 0xFFFFFF, false, false); // Exit Shadowguard Queues AddButton(15, 360, 1209, 1210, 123, GumpButtonType.Reply, 0); } }
public void CheckPlayerStatus(Mobile m) { if (m is PlayerMobile) { Party p = Party.Get(m); bool aliveandconnectedandpresent = false; if (p != null) { foreach (PartyMemberInfo info in p.Members) { if (info.Mobile.Alive && info.Mobile.NetState != null && ShadowguardController.GetEncounter(m.Location, m.Map) == this) { aliveandconnectedandpresent = true; } } } if (!aliveandconnectedandpresent) { Expire(false); if (p != null) { p.Members.ForEach(info => info.Mobile.SendLocalizedMessage(1156267)); // All members of your party are dead, have logged off, or have chosen to exit Shadowguard. You will be removed from the encounter shortly. } else { m.SendLocalizedMessage(1156267); // All members of your party are dead, have logged off, or have chosen to exit Shadowguard. You will be removed from the encounter shortly. } } } }
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 ExitQueueEntry(Mobile from, ShadowguardController controller) : base(1156247, 12) // Exit Shadowguard Queues { _From = from; _Controller = controller; Enabled = controller.IsInQueue(from); }
public ShadowguardInstance(ShadowguardController controller, Point3D center, Rectangle2D bounds, int index) { Controller = controller; Center = center; Index = index; Region = new ShadowguardRegion(bounds, index >= 13 ? String.Format("Roof {0}", (index - 12).ToString()) : index.ToString(), this); Region.Register(); }
public override int Damage(int amount, Mobile from, bool informmount, bool checkfizzle) { if (from == null || (ShadowguardController.GetEncounter(Location, Map) != null && Z == from.Z)) { return(base.Damage(amount, from, informmount, checkfizzle)); } return(0); }
public override void OnDeath(Container c) { if (ShadowguardController.GetEncounter(c.Location, c.Map) is BelfryEncounter) { c.DropItem(new MagicDrakeWing()); } base.OnDeath(c); }
public override void OnDoubleClick(Mobile m) { FountainEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as FountainEncounter; if (m.InRange(this.Location, 2) && encounter != null && this.ItemID != 17294 && this.ItemID != 17278) { encounter.UseSpigot(this, m); } }
private static void OnDisconnected(DisconnectedEventArgs e) { ShadowguardEncounter encounter = ShadowguardController.GetEncounter(e.Mobile.Location, e.Mobile.Map); if (encounter != null) { encounter.CheckPlayerStatus(e.Mobile); } }
public static void SetupShadowguard(Mobile from) { if (Instance != null) { return; } ShadowguardController controller = new ShadowguardController(); controller.MoveToWorld(new Point3D(501, 2192, 50), Map.TerMur); MetalDoor door = new MetalDoor(DoorFacing.NorthCCW) { Hue = 1779 }; door.MoveToWorld(new Point3D(519, 2188, 25), Map.TerMur); door = new MetalDoor(DoorFacing.SouthCW) { Hue = 1779 }; door.MoveToWorld(new Point3D(519, 2189, 25), Map.TerMur); door = new MetalDoor(DoorFacing.NorthCCW) { Hue = 1779 }; door.MoveToWorld(new Point3D(519, 2192, 25), Map.TerMur); door = new MetalDoor(DoorFacing.SouthCW) { Hue = 1779 }; door.MoveToWorld(new Point3D(519, 2193, 25), Map.TerMur); AnkhWest ankh = new AnkhWest(); ankh.MoveToWorld(new Point3D(503, 2191, 25), Map.TerMur); Item item = new Static(19343); item.MoveToWorld(new Point3D(64, 2336, 29), Map.TerMur); item = new Static(19343); item.MoveToWorld(new Point3D(160, 2336, 29), Map.TerMur); item = new Static(19343); item.MoveToWorld(new Point3D(64, 2432, 29), Map.TerMur); item = new Static(19343); item.MoveToWorld(new Point3D(160, 2432, 29), Map.TerMur); from.SendMessage("Shadowguard has been setup!"); Console.WriteLine("Shadowguard setup!"); }
public override int Damage(int amount, Mobile from, bool informMount, bool checkfizzle) { if (ShadowguardController.GetEncounter(Location, Map) is RoofEncounter encounter && from != null) { from.SendLocalizedMessage(1156254); // Minax laughs as she deflects your puny attacks! Defeat her minions to close the Time Gate! return(0); } return(base.Damage(amount, from, informMount, checkfizzle)); }
protected override bool OnMove(Direction d) { RoofEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as RoofEncounter; if (encounter != null) { Point3D spawn = encounter.SpawnPoints[0]; int x = this.X; int y = this.Y; Movement.Movement.Offset(d, ref x, ref y); Point3D p = new Point3D(x, y, this.Map.GetAverageZ(x, y)); int z = p.Z; if (p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5) { return(false); } IPooledEnumerable eable = this.Map.GetItemsInRange(p, 0); Item i = null; foreach (Item item in eable) { if (item.Z + item.ItemData.CalcHeight > z) { i = item; z = item.Z + item.ItemData.CalcHeight; } } StaticTile[] staticTiles = this.Map.Tiles.GetStaticTiles(x, y, true); foreach (StaticTile tile in staticTiles) { ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; if (tile.Z + itemData.CalcHeight > z) { z = tile.Z + itemData.CalcHeight; } } eable.Free(); if (z < this.Z) { return(false); } } return(base.OnMove(d)); }
protected override bool OnMove(Direction d) { if (ShadowguardController.GetEncounter(Location, Map) is RoofEncounter encounter) { Point3D spawn = encounter.SpawnPoints[0]; int x = X; int y = Y; Movement.Movement.Offset(d, ref x, ref y); Point3D p = new Point3D(x, y, Map.GetAverageZ(x, y)); int z = p.Z; if (p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5) { return(false); } IPooledEnumerable eable = Map.GetItemsInRange(p, 0); foreach (Item item in eable) { if (item.Z + item.ItemData.CalcHeight > z) { z = item.Z + item.ItemData.CalcHeight; } } StaticTile[] staticTiles = Map.Tiles.GetStaticTiles(x, y, true); for (var index = 0; index < staticTiles.Length; index++) { StaticTile tile = staticTiles[index]; ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; if (tile.Z + itemData.CalcHeight > z) { z = tile.Z + itemData.CalcHeight; } } eable.Free(); if (z < Z) { return(false); } } return(base.OnMove(d)); }
public override void OnDoubleClick(Mobile from) { BelfryEncounter encounter = ShadowguardController.GetEncounter(from.Location, from.Map) as BelfryEncounter; if (encounter != null && IsChildOf(from.Backpack)) { Point3D p = encounter.SpawnPoints[1]; encounter.ConvertOffset(ref p); from.MoveToWorld(p, Map.TerMur); BaseCreature.TeleportPets(from, p, from.Map); } }
public override void Damage(int amount, Mobile from, bool informMount, bool checkfizzle) { RoofEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as RoofEncounter; if (encounter != null && from != null) { from.SendLocalizedMessage(1156254); // Minax laughs as she deflects your puny attacks! Defeat her minions to close the Time Gate! return; } base.Damage(amount, from, informMount, checkfizzle); }
public override bool OnBeforeDeath() { if (ShadowguardController.GetEncounter(Location, Map) is FountainEncounter encounter) { ShadowguardCanal canal = new ShadowguardCanal(); canal.MoveToWorld(Location, Map); encounter.AddShadowguardCanal(canal); } return(base.OnBeforeDeath()); }
public override void OnThink() { base.OnThink(); if (ShadowguardController.GetEncounter(Location, Map) is BelfryEncounter encounter && Z == -20) { Point3D p = encounter.SpawnPoints[0]; encounter.ConvertOffset(ref p); MoveToWorld(p, Map); } }
public override bool OnBeforeDeath() { FountainEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as FountainEncounter; if (encounter != null) { var canal = new ShadowguardCanal(); canal.MoveToWorld(this.Location, this.Map); encounter.AddShadowguardCanal(canal); } return(base.OnBeforeDeath()); }
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 override void OnThink() { base.OnThink(); BelfryEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as BelfryEncounter; if (encounter != null && this.Z == -20) { Point3D p = encounter.SpawnPoints[0]; encounter.ConvertOffset(ref p); this.MoveToWorld(p, this.Map); } }
public override void OnThink() { base.OnThink(); if (ShadowguardController.GetEncounter(Location, Map) is RoofEncounter encounter) { Point3D spawn = encounter.SpawnPoints[0]; Point3D p = Location; encounter.ConvertOffset(ref spawn); if (Z < 30 || p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5) { MoveToWorld(spawn, Map.TerMur); } } }
public static void Initialize() { if (ShadowguardController.Instance == null) { return; } ColUtility.ForEach(ShadowguardController.Instance.Addons.Where(addon => addon.Map != Map.Internal), addon => { ShadowguardInstance instance = ShadowguardController.GetInstance(addon.Location, addon.Map); if (instance != null && !instance.InUse) { instance.ClearRegion(); } }); }
public override void OnComponentUsed(AddonComponent c, Mobile from) { if (from.InRange(c.Location, 2) && c.ItemID == 19548) { BelfryEncounter encounter = ShadowguardController.GetEncounter(c.Location, c.Map) as BelfryEncounter; if (encounter != null && encounter.Drakes != null && encounter.Drakes.Count == 0) { int toSpawn = 2 + (encounter.PartySize() * 3); for (int i = 0; i < toSpawn; i++) { encounter.SpawnDrake(this.Location, from); Effects.PlaySound(this.Location, this.Map, 0x66C); } } } }
public override void OnThink() { base.OnThink(); RoofEncounter encounter = ShadowguardController.GetEncounter(this.Location, this.Map) as RoofEncounter; if (encounter != null) { Point3D spawn = encounter.SpawnPoints[0]; Point3D p = this.Location; encounter.ConvertOffset(ref spawn); if (this.Z < 30 || p.Y < spawn.Y - 5 || p.Y > spawn.Y + 4 || p.X > spawn.X + 4 || p.X < spawn.X - 5) { this.MoveToWorld(spawn, Map.TerMur); } } }
protected override bool OnMove(Direction d) { if (ShadowguardController.GetEncounter(Location, Map) != null) { int x = X; int y = Y; Movement.Movement.Offset(d, ref x, ref y); Point3D p = new Point3D(x, y, Map.GetAverageZ(x, y)); int z = p.Z; IPooledEnumerable eable = Map.GetItemsInRange(p, 0); foreach (Item item in eable) { if (item.Z + item.ItemData.CalcHeight > z) { z = item.Z + item.ItemData.CalcHeight; } } StaticTile[] staticTiles = Map.Tiles.GetStaticTiles(x, y, true); foreach (StaticTile tile in staticTiles) { ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; if (tile.Z + itemData.CalcHeight > z) { z = tile.Z + itemData.CalcHeight; } } eable.Free(); if (z < Z) { return(false); } } return(base.OnMove(d)); }