public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: m_Instance = reader.ReadItem() as PrimevalLichPuzzle; m_Altar = reader.ReadItem() as ChampionSpawn; m_Key = reader.ReadLong(); m_Successful = reader.ReadMobile(); m_Levers = reader.ReadStrongItemList <PrimevalLichPuzzleLever>(); break; } if (null == m_Levers) { m_Levers = new List <PrimevalLichPuzzleLever>(); } // if ( null != m_Instance && m_Instance.Deleted && this == m_Instance ) // { // m_Instance = null; // return; // } // // remove if no altar exists // if ( null == m_Altar ) // Timer.DelayCall( TimeSpan.FromSeconds( 0.0 ), new TimerCallback( Delete ) ); // ResetLevers(); }
// Constructor public PrimevalLichPuzzleLever(byte code, PrimevalLichPuzzle controller) : base(0x108C) { this.m_Code = code; this.m_Controller = controller; this.Movable = false; }
// Constructor public PrimevalLichPuzzle(Mobile m) : base(0x1BC3) { if (null == m || null != m_Instance) { this.Delete(); if (m_Instance.Deleted) { m_Instance = null; } return; } this.Movable = false; this.Visible = false; m_Instance = this; this.MoveToWorld(controlLoc, Map.Felucca); this.m_Levers = new List <PrimevalLichPuzzleLever>(); this.m_Altar = this.FindAltar(); if (null == this.m_Altar) { m.SendMessage(33, "Primeval Lich champion spawn not found."); this.Delete(); } else { this.UpdatePuzzleState(this.m_Altar); } }
public PrimevalLichPuzzle(Mobile m) : base(0x1BC3) { if (null == m || null != m_Instance) { Delete(); //Probably not needed, OnAfterDelete sets it null anyway if (m_Instance != null && m_Instance.Deleted) { m_Instance = null; } return; } Movable = false; Visible = false; m_Instance = this; MoveToWorld(controlLoc, Map.Felucca); m_Levers = new List <PrimevalLichPuzzleLever>(); m_Altar = FindAltar(); if (null == m_Altar) { m.SendMessage(33, "Primeval Lich champion spawn not found."); Delete(); } else { UpdatePuzzleState(m_Altar); } }
public PrimevalLichPuzzleLever(byte code, PrimevalLichPuzzle controller) : base(0x108C) { m_Code = code; m_Controller = controller; Movable = false; }
public override void OnAfterDelete() { RemovePuzzleLevers(); if (this == m_Instance) { m_Instance = null; } base.OnAfterDelete(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); this.m_Code = reader.ReadByte(); this.m_Controller = reader.ReadItem() as PrimevalLichPuzzle; // remove if no controller exists or is deleted if (null == this.m_Controller || this.m_Controller.Deleted) this.Delete(); }
// static hook for the ChampionSpawn code to update the puzzle state public static void Update(ChampionSpawn altar) { if (null != m_Instance) { if (m_Instance.Deleted) { m_Instance = null; } else if (m_Instance.ChampionAltar == altar) { m_Instance.UpdatePuzzleState(altar); } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); reader.ReadInt(); m_Code = reader.ReadByte(); m_Controller = reader.ReadItem() as PrimevalLichPuzzle; // remove if no controller exists or is deleted if (null == m_Controller || m_Controller.Deleted) { Delete(); } }
public void Start() { if (this.m_Active || this.Deleted) { return; } this.m_Active = true; this.m_HasBeenAdvanced = false; if (this.m_Timer != null) { this.m_Timer.Stop(); } this.m_Timer = new SliceTimer(this); this.m_Timer.Start(); if (this.m_RestartTimer != null) { this.m_RestartTimer.Stop(); } this.m_RestartTimer = null; if (this.m_Altar != null) { if (this.m_Champion != null) { this.m_Altar.Hue = 0x26; } else { this.m_Altar.Hue = 0; } } if (this.m_Platform != null) { this.m_Platform.Hue = 0x452; } PrimevalLichPuzzle.Update(this); }
public static void GenLichPuzzle(Mobile m) { if (null != m_Instance) { if (m != null) { m.SendMessage("Primeval Lich lever puzzle already exists: please delete the existing one first ..."); } Utility.WriteConsoleColor(ConsoleColor.Green, "Primeval Lich lever puzzle already exists: please delete the existing one first ..."); return; } if (m != null) { m.SendMessage("Generating Primeval Lich lever puzzle..."); } Utility.WriteConsoleColor(ConsoleColor.Green, "Generating Primeval Lich lever puzzle..."); PrimevalLichPuzzle control = new PrimevalLichPuzzle(m); if (null == control || control.Deleted) { if (m != null) { m.SendMessage(33, "There was a problem generating the puzzle."); } Utility.WriteConsoleColor(ConsoleColor.Green, "There was a problem generating the puzzle."); } else { if (m != null) { m.SendMessage("The puzzle was successfully generated."); } Utility.WriteConsoleColor(ConsoleColor.Green, "The puzzle was successfully generated."); WeakEntityCollection.Add("primevallich", control); } }
public static void GenLichPuzzle_OnCommand(CommandEventArgs e) { if (null != m_Instance) { e.Mobile.SendMessage("Primeval Lich lever puzzle already exists: please delete the existing one first ..."); return; } e.Mobile.SendMessage("Generating Primeval Lich lever puzzle..."); PrimevalLichPuzzle control = new PrimevalLichPuzzle(e.Mobile); if (null == control || control.Deleted) { e.Mobile.SendMessage(33, "There was a problem generating the puzzle."); } else { e.Mobile.SendMessage("The puzzle was successfully generated."); } }
public void Stop() { if (!this.m_Active || this.Deleted) { return; } this.m_Active = false; this.m_HasBeenAdvanced = false; if (this.m_Timer != null) { this.m_Timer.Stop(); } this.m_Timer = null; if (this.m_RestartTimer != null) { this.m_RestartTimer.Stop(); } this.m_RestartTimer = null; if (this.m_Altar != null) { this.m_Altar.Hue = 0; } if (this.m_Platform != null) { this.m_Platform.Hue = 0x497; } PrimevalLichPuzzle.Update(this); }
public static void GenLichPuzzle_OnCommand(CommandEventArgs e) { if (null != m_Instance) { e.Mobile.SendMessage("Primeval Lich lever puzzle already exists: please delete the existing one first ..."); return; } e.Mobile.SendMessage("Generating Primeval Lich lever puzzle..."); PrimevalLichPuzzle control = new PrimevalLichPuzzle(e.Mobile); if (null == control || control.Deleted) { e.Mobile.SendMessage(33, "There was a problem generating the puzzle."); } else { e.Mobile.SendMessage("The puzzle was successfully generated."); WeakEntityCollection.Add("primevallich", control); } }
public static void LoadSpawns() { if (m_Initialized) { return; } RemoveSpawns(); Utility.PushColor(ConsoleColor.White); Console.WriteLine("Generating Champion Spawns"); Utility.PopColor(); ChampionSpawn spawn; XmlDocument doc = new XmlDocument(); doc.Load(m_ConfigPath); foreach (XmlNode node in doc.GetElementsByTagName("championSystem")[0].ChildNodes) { if (node.Name.Equals("spawn")) { spawn = new ChampionSpawn { SpawnName = GetAttr(node, "name", "Unamed Spawner") }; string value = GetAttr(node, "type", null); if (value == null) { spawn.RandomizeType = true; } else { spawn.Type = (ChampionSpawnType)Enum.Parse(typeof(ChampionSpawnType), value); } value = GetAttr(node, "spawnMod", "1.0"); spawn.SpawnMod = XmlConvert.ToDouble(value); value = GetAttr(node, "killsMod", "1.0"); spawn.KillsMod = XmlConvert.ToDouble(value); foreach (XmlNode child in node.ChildNodes) { if (child.Name.Equals("location")) { int x = XmlConvert.ToInt32(GetAttr(child, "x", "0")); int y = XmlConvert.ToInt32(GetAttr(child, "y", "0")); int z = XmlConvert.ToInt32(GetAttr(child, "z", "0")); int r = XmlConvert.ToInt32(GetAttr(child, "radius", "0")); string mapName = GetAttr(child, "map", "Felucca"); Map map = Map.Parse(mapName); spawn.SpawnRadius = r; spawn.MoveToWorld(new Point3D(x, y, z), map); } } spawn.GroupName = GetAttr(node, "group", null); m_AllSpawns.Add(spawn); if (spawn.Type == ChampionSpawnType.Infuse) { PrimevalLichPuzzle.GenLichPuzzle(null); } } } Rotate(); m_Initialized = true; }
// static hook for the ChampionSpawn code to update the puzzle state public static void Update(ChampionSpawn altar) { if (null != m_Instance) { if (m_Instance.Deleted) m_Instance = null; else if (m_Instance.ChampionAltar == altar) m_Instance.UpdatePuzzleState(altar); } }
public override void OnAfterDelete() { this.RemovePuzzleLevers(); if (this == m_Instance) m_Instance = null; base.OnAfterDelete(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch ( version ) { case 1: m_Instance = reader.ReadItem() as PrimevalLichPuzzle; this.m_Altar = reader.ReadItem() as ChampionSpawn; this.m_Key = reader.ReadLong(); this.m_Successful = reader.ReadMobile(); this.m_Levers = reader.ReadStrongItemList<PrimevalLichPuzzleLever>(); break; } if (null == this.m_Levers) this.m_Levers = new List<PrimevalLichPuzzleLever>(); // if ( null != m_Instance && m_Instance.Deleted && this == m_Instance ) // { // m_Instance = null; // return; // } // // remove if no altar exists // if ( null == m_Altar ) // Timer.DelayCall( TimeSpan.FromSeconds( 0.0 ), new TimerCallback( Delete ) ); // ResetLevers(); }
// Constructor public PrimevalLichPuzzle(Mobile m) : base(0x1BC3) { if (null == m || null != m_Instance) { this.Delete(); if (m_Instance.Deleted) m_Instance = null; return; } this.Movable = false; this.Visible = false; m_Instance = this; this.MoveToWorld(controlLoc, Map.Felucca); this.m_Levers = new List<PrimevalLichPuzzleLever>(); this.m_Altar = this.FindAltar(); if (null == this.m_Altar) { m.SendMessage(33, "Primeval Lich champion spawn not found."); this.Delete(); } else { this.UpdatePuzzleState(this.m_Altar); } }