Exemplo n.º 1
0
            public ChampLevelData.SpawnTypes ChampType;                 // spawn type this relates to

            //public SummonReq(){}
            public SummonReq(Type item, int amnt, ChampLevelData.SpawnTypes cst)
            {
                //Assign properties
                ItemType  = item;
                Amount    = amnt;
                ChampType = cst;
            }
Exemplo n.º 2
0
        //Plasma :  This code is called from OnSpeech() and is repsonsible for
        //finding a viable sacirifce and if so to start the summoning
        protected void SummonStart(ChampLevelData.SpawnTypes ChampType)
        {
            //now check the floor for the appropriate sacrifice
            SummonReq Req  = null;
            ArrayList Reqs = new ArrayList();

            //Check through requirements array and add all for this type of spawn
            for (int i = 0; i < m_SummonReqs.GetLength(0); ++i)
            {
                if (m_SummonReqs[i].ChampType == ChampType)
                {
                    Reqs.Add(m_SummonReqs[i]);
                }
            }

            //Now search the floor for appropriate sacrifice(s)
            if (Reqs.Count > 0)
            {
                //pla: 08/26 changed range to 1
                IPooledEnumerable eable = m_Speaker.GetItemsInRange(1);
                foreach (Item item in eable)
                {
                    for (int count = 0; count < Reqs.Count; ++count)
                    {
                        Req = ((SummonReq)Reqs[count]);
                        if (item.GetType().IsAssignableFrom(Req.ItemType) && item.Amount >= Req.Amount /*  || item.GetType().IsSubclassOf( Req.ItemType ) */)
                        {
                            //Found sacrifice, make it non-movable whilst the summon is in progress
                            item.Movable  = false;
                            m_SummonTimer = null;
                            //Start summon timer
                            m_Summoning   = true;
                            m_SummonTimer = new SummonTimer(item, Req.ChampType, this, m_bGraphics);
                            eable.Free();
                            return;
                        }
                    }
                }
                eable.Free();
            }
            this.PublicOverheadMessage(0, 0x3B2, false, "The Champion does not see a worthy sacrifice");
        }
Exemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            TimeSpan ts = TimeSpan.Zero;

            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_LevelScale = reader.ReadDouble();
                goto case 2;
            }

            case 2:
            {
                m_LevelError = (LevelErrors)reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                ts = reader.ReadDeltaTime() - DateTime.Now;
                goto case 0;
            }

            case 0:
            {
                // read it all back in
                m_Type = ((ChampLevelData.SpawnTypes)reader.ReadInt());

                int a = reader.ReadInt();
                SpawnLevels = new ArrayList();

                // create new level array through deserialise constructors
                for (int i = 0; i < a; ++i)
                {
                    SpawnLevels.Add(new ChampLevelData(reader));
                }

                m_Monsters     = reader.ReadMobileList();
                m_FreeMonsters = reader.ReadMobileList();
                m_LevelCounter = reader.ReadInt();
                m_Kills        = reader.ReadInt();
                m_ExpireTime   = reader.ReadDateTime();
                m_NavDest      = (NavDestinations)reader.ReadInt();

                // the bools
                m_bActive   = reader.ReadBool();
                m_bGraphics = reader.ReadBool();

                // if graphics were on remake them thru deserialise constructor
                if (m_bGraphics)
                {
                    m_Graphics = new ChampGraphics(this, reader);
                }

                // and the restart...
                m_bRestart     = reader.ReadBool();
                m_RestartDelay = reader.ReadTimeSpan();

                if (reader.ReadBool() && !m_bActive && m_bRestart)
                {
                    // in this case the champ is activley in restart mode, so create new timer
                    //pla: 13/01/07
                    //changed so we don't lose time on restart
                    if (ts == TimeSpan.Zero)
                    {
                        DoTimer(m_RestartDelay);
                    }
                    else
                    {
                        DoTimer(ts);
                    }
                }
                else if (m_bActive)
                {
                    // if spawn was active then start the wheels turning...
                    StartSlice();
                }

                break;
            }
            }
        }
Exemplo n.º 4
0
			public ChampLevelData.SpawnTypes ChampType;	// spawn type this relates to

			//public SummonReq(){}			
			public SummonReq( Type item, int amnt, ChampLevelData.SpawnTypes cst )
			{
				//Assign properties
				ItemType = item;
				Amount = amnt;
				ChampType = cst;
			}			
Exemplo n.º 5
0
			public SummonTimer( Item sacrifice, ChampLevelData.SpawnTypes cst, ChampSummon cs, bool gfx ) : base(TimeSpan.FromSeconds(3))
			{
				Sacrifice = sacrifice; ChampType = cst; Champ = cs; bGraphics = gfx;						
				Start();
			}
Exemplo n.º 6
0
		public override void Deserialize( GenericReader reader )
		{
            TimeSpan ts = TimeSpan.Zero;

			base.Deserialize( reader );

			int version = reader.ReadInt();
			
			switch ( version )
			{
				case 3:
					{
						m_LevelScale = reader.ReadDouble();
						goto case 2;
					}
        case 2:
        {
            m_LevelError = (LevelErrors)reader.ReadInt();
            goto case 1;
        }
        case 1:
        {                                      
            ts = reader.ReadDeltaTime() - DateTime.Now;                    
            goto case 0;
        }
				case 0:
				{

					// read it all back in									
					m_Type = ((ChampLevelData.SpawnTypes)reader.ReadInt());

					int a = reader.ReadInt();
					SpawnLevels  = new ArrayList();
					
					// create new level array through deserialise constructors
					for( int i = 0 ; i < a; ++i )
						SpawnLevels.Add( new ChampLevelData( reader ) );	

					m_Monsters = reader.ReadMobileList();
					m_FreeMonsters = reader.ReadMobileList();
					m_LevelCounter = reader.ReadInt();
					m_Kills = reader.ReadInt();
					m_ExpireTime = reader.ReadDateTime();
					m_NavDest = (NavDestinations)reader.ReadInt();
					
					// the bools
					m_bActive = reader.ReadBool();
					m_bGraphics = reader.ReadBool();					

					// if graphics were on remake them thru deserialise constructor
					if( m_bGraphics )
						m_Graphics = new ChampGraphics(this, reader);

					// and the restart...
					m_bRestart = reader.ReadBool();
					m_RestartDelay = reader.ReadTimeSpan();
					
					if( reader.ReadBool() && !m_bActive && m_bRestart )
					{
						// in this case the champ is activley in restart mode, so create new timer
						//pla: 13/01/07
						//changed so we don't lose time on restart
						if (ts == TimeSpan.Zero)
								DoTimer(m_RestartDelay);
						else
								DoTimer(ts);
					}
					else if( m_bActive )
					{					
						// if spawn was active then start the wheels turning...
						StartSlice();
					}
										
					break;
				}
				
			}

		}
Exemplo n.º 7
0
 public SummonTimer(Item sacrifice, ChampLevelData.SpawnTypes cst, ChampSummon cs, bool gfx)
     : base(TimeSpan.FromSeconds(3))
 {
     Sacrifice = sacrifice; ChampType = cst; Champ = cs; bGraphics = gfx;
     Start();
 }