Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 // Constructor
 public PrimevalLichPuzzleLever(byte code, PrimevalLichPuzzle controller)
     : base(0x108C)
 {
     this.m_Code = code;
     this.m_Controller = controller;
     this.Movable = false;
 }
Exemplo n.º 3
0
        // 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);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
 public PrimevalLichPuzzleLever(byte code, PrimevalLichPuzzle controller)
     : base(0x108C)
 {
     m_Code       = code;
     m_Controller = controller;
     Movable      = false;
 }
Exemplo n.º 6
0
        public override void OnAfterDelete()
        {
            RemovePuzzleLevers();
            if (this == m_Instance)
            {
                m_Instance = null;
            }

            base.OnAfterDelete();
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
 // 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);
         }
     }
 }
Exemplo n.º 9
0
        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();
            }
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
            }
        }
Exemplo n.º 12
0
        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.");
            }
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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);
			}
        }
Exemplo n.º 15
0
        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;
        }
Exemplo n.º 16
0
 // 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);
     }
 }
Exemplo n.º 17
0
        public override void OnAfterDelete()
        {
            this.RemovePuzzleLevers();
            if (this == m_Instance)
                m_Instance = null;

            base.OnAfterDelete();
        }
Exemplo n.º 18
0
        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();
        }
Exemplo n.º 19
0
        // 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);
            }
        }