예제 #1
0
        public virtual void LeverPulled(UInt16 code)
        {
            int    Correct = 0;
            Mobile m_Player;

            this.KillTimers();

            /* if one bit in each of the four nibbles is set, this is false */

            if ((this.TheirKey = (ushort)(code | (this.TheirKey <<= 4))) < 0x0FFF)
            {
                this.l_Timer = Timer.DelayCall(TimeSpan.FromSeconds(30.0), new TimerCallback(ResetPuzzle));
                return;
            }

            if (!this.CircleComplete)
            {
                this.PuzzleStatus(1050004, null); // The circle is the key...
            }
            else
            {
                if (this.TheirKey == this.MyKey)
                {
                    this.GenKey();
                    if ((this.m_Successful = (m_Player = this.GetOccupant(0))) != null)
                    {
                        SendLocationEffect(lp_Center, 0x1153, 0, 60, 1);
                        PlaySounds(lp_Center, cs1);

                        Effects.SendBoltEffect(m_Player, true);
                        m_Player.MoveToWorld(lr_Enter, Map.Malas);

                        this.m_Timer = new LampRoomTimer(this);
                        this.m_Timer.Start();
                        this.m_Enabled = false;
                    }
                }
                else
                {
                    for (int i = 0; i < 16; i++)  /* Count matching SET bits, ie correct codes */
                    {
                        if ((((this.MyKey >> i) & 1) == 1) && (((this.TheirKey >> i) & 1) == 1))
                        {
                            Correct++;
                        }
                    }

                    this.PuzzleStatus(Statue_Msg[Correct], (Correct > 0) ? Correct.ToString() : null);

                    for (int i = 0; i < 5; i++)
                    {
                        if ((m_Player = this.GetOccupant(i)) != null)
                        {
                            Timer smash = new RockTimer(m_Player, this);
                            smash.Start();
                        }
                    }
                }
            }
            this.ResetLevers();
        }
		public virtual void LeverPulled( UInt16 code )
		{
			int Correct=0;
			Mobile m_Player;

			KillTimers();

			/* if one bit in each of the four nibbles is set, this is false */

            if ((TheirKey = (ushort)(code | (TheirKey <<= 4))) < 0x0FFF)
            {
				l_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), new TimerCallback( ResetPuzzle ));
				return;
			}

			if( !CircleComplete )
			{
				PuzzleStatus( 1050004, null ); // The circle is the key...
			}
			else
			{
				if( TheirKey == MyKey )
				{
					GenKey();
					if (( m_Successful = ( m_Player=GetOccupant( 0 ))) != null )
					{
						SendLocationEffect( lp_Center,  0x1153, 0, 60, 1 ); 
						PlaySounds( lp_Center, cs1 );

						Effects.SendBoltEffect( m_Player, true );
						m_Player.MoveToWorld( lr_Enter, Map.Malas );

						m_Timer = new LampRoomTimer( this );
						m_Timer.Start();
						m_Enabled = false;
					}
				}
				else
				{
					for(int i=0; i<16; i++)  /* Count matching SET bits, ie correct codes */
					{
						if( (((MyKey>>i)&1)==1)&&(((TheirKey>>i)&1)==1) )
						{
							Correct++;
						}
					}

					PuzzleStatus( Statue_Msg[Correct], (Correct>0) ? Correct.ToString() : null );

					for (int i=0; i<5; i++)
					{
						if(( m_Player=GetOccupant( i )) != null )
						{
							Timer smash = new RockTimer( m_Player, this );
							smash.Start();
						}
					}
				}
			}
			ResetLevers();
		}