Exemplo n.º 1
0
            protected override void OnTick()
            {
                if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime)
                {
                    Terminate();
                    return;
                }

                if (m_LastMoveTime != m_From.LastMoveTime)
                {
                    m_From.SendLocalizedMessage(503023);                       // You cannot move around while digging up treasure. You will need to start digging anew.
                    Terminate();
                    return;
                }

                int z      = (m_Chest != null) ? m_Chest.Z + m_Chest.ItemData.Height : int.MinValue;
                int height = 16;

                if (z > m_Location.Z)
                {
                    height -= (z - m_Location.Z);
                }
                else
                {
                    z = m_Location.Z;
                }

                if (!m_Map.CanFit(m_Location.X, m_Location.Y, z, height, true, true, false))
                {
                    m_From.SendLocalizedMessage(503024);                       // You stop digging because something is directly on top of the treasure chest.
                    Terminate();
                    return;
                }

                m_Count++;

                m_From.RevealingAction();
                m_From.Direction = m_From.GetDirectionTo(m_Location);

                if (m_Count > 1 && m_Dirt1 == null)
                {
                    m_Dirt1 = new TreasureChestDirt();
                    m_Dirt1.MoveToWorld(m_Location, m_Map);

                    m_Dirt2 = new TreasureChestDirt();
                    m_Dirt2.MoveToWorld(new Point3D(m_Location.X, m_Location.Y - 1, m_Location.Z), m_Map);
                }

                if (m_Count == 5)
                {
                    m_Dirt1.Turn1();
                }
                else if (m_Count == 10)
                {
                    m_Dirt1.Turn2();
                    m_Dirt2.Turn2();
                }
                else if (m_Count > 10)
                {
                    if (m_Chest == null)
                    {
                        m_Chest = new TreasureMapChest(m_From, m_TreasureMap.Level, true, m_Map);
                        m_Chest.MoveToWorld(new Point3D(m_Location.X, m_Location.Y, m_Location.Z - 15), m_Map);
                    }
                    else
                    {
                        m_Chest.Z++;
                    }

                    Effects.PlaySound(m_Chest, m_Map, 0x33B);
                }

                if (m_Chest != null && m_Chest.Location.Z >= m_Location.Z)
                {
                    Stop();
                    m_From.EndAction(typeof(TreasureMap));

                    m_TreasureMap.Completed   = true;
                    m_TreasureMap.CompletedBy = m_From;

                    m_Chest.Temporary = false;

                    SpawnGuardians();
                }
                else
                {
                    if (m_From.Body.IsHuman && !m_From.Mounted)
                    {
                        m_From.Animate(11, 5, 1, true, false, 0);
                    }

                    new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start();
                }
            }
Exemplo n.º 2
0
            protected override void OnTick()
            {
                if (this.m_NextSkillTime != this.m_From.NextSkillTime || this.m_NextSpellTime != this.m_From.NextSpellTime || this.m_NextActionTime != this.m_From.NextActionTime)
                {
                    this.Terminate();
                    return;
                }

                if (this.m_LastMoveTime != this.m_From.LastMoveTime)
                {
                    this.m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew.
                    this.Terminate();
                    return;
                }

                int z      = (this.m_Chest != null) ? this.m_Chest.Z + this.m_Chest.ItemData.Height : int.MinValue;
                int height = 16;

                if (z > this.m_Location.Z)
                {
                    height -= (z - this.m_Location.Z);
                }
                else
                {
                    z = this.m_Location.Z;
                }

                if (!this.m_Map.CanFit(this.m_Location.X, this.m_Location.Y, z, height, true, true, false))
                {
                    this.m_From.SendLocalizedMessage(503024); // You stop digging because something is directly on top of the treasure chest.
                    this.Terminate();
                    return;
                }

                this.m_Count++;

                this.m_From.RevealingAction();
                this.m_From.Direction = this.m_From.GetDirectionTo(this.m_Location);

                if (this.m_Count > 1 && this.m_Dirt1 == null)
                {
                    this.m_Dirt1 = new TreasureChestDirt();
                    this.m_Dirt1.MoveToWorld(this.m_Location, this.m_Map);

                    this.m_Dirt2 = new TreasureChestDirt();
                    this.m_Dirt2.MoveToWorld(new Point3D(this.m_Location.X, this.m_Location.Y - 1, this.m_Location.Z), this.m_Map);
                }

                if (this.m_Count == 5)
                {
                    this.m_Dirt1.Turn1();
                }
                else if (this.m_Count == 10)
                {
                    this.m_Dirt1.Turn2();
                    this.m_Dirt2.Turn2();
                }
                else if (this.m_Count > 10)
                {
                    if (this.m_Chest == null)
                    {
                        this.m_Chest = new TreasureMapChest(this.m_From, this.m_TreasureMap.Level, true);
                        this.m_Chest.MoveToWorld(new Point3D(this.m_Location.X, this.m_Location.Y, this.m_Location.Z - 15), this.m_Map);
                    }
                    else
                    {
                        this.m_Chest.Z++;
                    }

                    Effects.PlaySound(this.m_Chest, this.m_Map, 0x33B);
                }

                if (this.m_Chest != null && this.m_Chest.Location.Z >= this.m_Location.Z)
                {
                    this.Stop();
                    this.m_From.EndAction(typeof(TreasureMap));

                    this.m_Chest.Temporary         = false;
                    this.m_TreasureMap.Completed   = true;
                    this.m_TreasureMap.CompletedBy = this.m_From;

                    int spawns;
                    switch (this.m_TreasureMap.Level)
                    {
                    case 0:
                        spawns = 3;
                        break;

                    case 1:
                        spawns = 0;
                        break;

                    default:
                        spawns = 4;
                        break;
                    }

                    for (int i = 0; i < spawns; ++i)
                    {
                        BaseCreature bc = Spawn(this.m_TreasureMap.Level, this.m_Chest.Location, this.m_Chest.Map, null, true);

                        if (bc != null)
                        {
                            this.m_Chest.Guardians.Add(bc);
                        }
                    }
                }
                else
                {
                    if (this.m_From.Body.IsHuman && !this.m_From.Mounted)
                    {
                        this.m_From.Animate(11, 5, 1, true, false, 0);
                    }

                    new SoundTimer(this.m_From, 0x125 + (this.m_Count % 2)).Start();
                }
            }
Exemplo n.º 3
0
			protected override void OnTick()
			{
				if ( m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime )
				{
					Terminate();
					return;
				}

				if ( m_LastMoveTime != m_From.LastMoveTime )
				{
					m_From.SendLocalizedMessage( 503023 ); // You cannot move around while digging up treasure. You will need to start digging anew.
					Terminate();
					return;
				}

				int z = ( m_Chest != null ) ? m_Chest.Z + m_Chest.ItemData.Height : int.MinValue;
				int height = 16;

				if ( z > m_Location.Z )
					height -= ( z - m_Location.Z );
				else
					z = m_Location.Z;

				if ( !m_Map.CanFit( m_Location.X, m_Location.Y, z, height, true, true, false ) )
				{
					m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest.
					Terminate();
					return;
				}

				m_Count++;

				m_From.RevealingAction();
				m_From.Direction = m_From.GetDirectionTo( m_Location );

				if ( m_Count > 1 && m_Dirt1 == null )
				{
					m_Dirt1 = new TreasureChestDirt();
					m_Dirt1.MoveToWorld( m_Location, m_Map );

					m_Dirt2 = new TreasureChestDirt();
					m_Dirt2.MoveToWorld( new Point3D( m_Location.X, m_Location.Y - 1, m_Location.Z ), m_Map );
				}

				if ( m_Count == 5 )
				{
					m_Dirt1.Turn1();
				}
				else if ( m_Count == 10 )
				{
					m_Dirt1.Turn2();
					m_Dirt2.Turn2();
				}
				else if ( m_Count > 10 )
				{
					if ( m_Chest == null )
					{
						m_Chest = new TreasureMapChest( m_From, m_TreasureMap.Level, true );
						m_Chest.MoveToWorld( new Point3D( m_Location.X, m_Location.Y, m_Location.Z - 15 ), m_Map );
					}
					else
					{
						m_Chest.Z++;
					}

					Effects.PlaySound( m_Chest, m_Map, 0x33B );
				}

				if ( m_Chest != null && m_Chest.Location.Z >= m_Location.Z )
				{
					Stop();
					m_From.EndAction( typeof( TreasureMap ) );

					m_Chest.Temporary = false;
					m_TreasureMap.Completed = true;
					m_TreasureMap.CompletedBy = m_From;

					int spawns;
					switch ( m_TreasureMap.Level )
					{
						case 0: spawns = 3; break;
						case 1: spawns = 0; break;
						default: spawns = 4; break;
					}

					for ( int i = 0; i < spawns; ++i )
					{
						BaseCreature bc = Spawn( m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, true );

						if ( bc != null )
							m_Chest.Guardians.Add( bc );
					}
				}
				else
				{
					if ( m_From.Body.IsHuman && !m_From.Mounted )
						m_From.Animate( 11, 5, 1, true, false, 0 );

					new SoundTimer( m_From, 0x125 + (m_Count % 2) ).Start();
				}
			}
Exemplo n.º 4
0
            protected override void OnTick()
            {
                m_Count++;

                m_From.RevealingAction();
                m_From.Direction = m_From.GetDirectionTo(m_Location);

                if (m_Count > 1 && m_Dirt1 == null)
                {
                    m_Dirt1 = new TreasureChestDirt();
                    m_Dirt1.MoveToWorld(m_Location, m_Map);

                    m_Dirt2 = new TreasureChestDirt();
                    m_Dirt2.MoveToWorld(new Point3D(m_Location.X, m_Location.Y - 1, m_Location.Z), m_Map);
                }

                if (m_Count == 3)
                {
                    m_Dirt1.Turn1();
                }
                else if (m_Count == 6)
                {
                    m_Dirt1.Turn2();
                    m_Dirt2.Turn2();
                }
                else if (m_Count > 6)
                {
                    if (m_Chest == null)
                    {
                        m_Chest = new TreasureMapChest(m_From, m_TreasureMap.Level, true);
                        m_Chest.MoveToWorld(new Point3D(m_Location.X, m_Location.Y, m_Location.Z - 15), m_Map);
                    }
                    else
                    {
                        m_Chest.Z++;
                    }

                    Effects.PlaySound(m_Chest, 0x33B);
                }

                if (m_Chest != null && m_Chest.Location.Z >= m_Location.Z)
                {
                    Stop();

                    m_Chest.Temporary = false;

                    int spawns;
                    switch (m_TreasureMap.Level)
                    {
                    case 0:
                        spawns = 3;
                        break;

                    case 1:
                        spawns = 0;
                        break;

                    default:
                        spawns = 4;
                        break;
                    }

                    m_From.SendAsciiMessage(0x44, "You unleash the treasure's guardians!");
                    m_From.SendAsciiMessage(0x44, "The chest will unlock when all guardians are destroyed.");

                    for (int i = 0; i < spawns; ++i)
                    {
                        BaseCreature bc = Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, true);

                        if (bc != null)
                        {
                            m_Chest.Guardians.Add(bc);
                        }
                    }

                    m_TreasureMap.Delete();
                }
                else
                {
                    new SoundTimer(m_From, 0x125 + m_Count % 2).Start();
                }
            }