Example #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            m_Solution = new PuzzleChestSolution(reader);

            int length = reader.ReadEncodedInt();

            for (int i = 0; i < length; i++)
            {
                PuzzleChestCylinder cylinder = (PuzzleChestCylinder)reader.ReadInt();

                if (length == m_Hints.Length)
                {
                    m_Hints[i] = cylinder;
                }
            }
            if (length != m_Hints.Length)
            {
                InitHints();
            }

            int guesses = reader.ReadEncodedInt();

            for (int i = 0; i < guesses; i++)
            {
                Mobile m = reader.ReadMobile();
                PuzzleChestSolutionAndTime sol = new PuzzleChestSolutionAndTime(reader);

                m_Guesses[m] = sol;
            }
        }
Example #2
0
        public PuzzleChestSolutionAndTime GetLastGuess(Mobile m)
        {
            PuzzleChestSolutionAndTime pcst = null;

            m_Guesses.TryGetValue(m, out pcst);
            return(pcst);
        }
Example #3
0
        public void SubmitSolution(Mobile m, PuzzleChestSolution solution)
        {
            int correctCylinders, correctColors;

            if (solution.Matches(Solution, out correctCylinders, out correctColors))
            {
                LockPick(m);

                DisplayTo(m);
            }
            else
            {
                m_Guesses[m] = new PuzzleChestSolutionAndTime(DateTime.UtcNow, solution);

                m.SendGump(new StatusGump(correctCylinders, correctColors));

                DoDamage(m);
            }
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadEncodedInt();

			m_Solution = new PuzzleChestSolution( reader );

			int length = reader.ReadEncodedInt();
			for ( int i = 0; i < length; i++ )
			{
				PuzzleChestCylinder cylinder = (PuzzleChestCylinder) reader.ReadInt();

				if ( length == m_Hints.Length )
					m_Hints[i] = cylinder;
			}
			if ( length != m_Hints.Length )
				InitHints();

			int guesses = reader.ReadEncodedInt();
			for ( int i = 0; i < guesses; i++ )
			{
				Mobile m = reader.ReadMobile();
				PuzzleChestSolutionAndTime sol = new PuzzleChestSolutionAndTime( reader );

				m_Guesses[m] = sol;
			}
		}
		public void SubmitSolution( Mobile m, PuzzleChestSolution solution )
		{
			int correctCylinders, correctColors;

			if ( solution.Matches( this.Solution, out correctCylinders, out correctColors ) )
			{
				LockPick( m );

				DisplayTo( m );
			}
			else
			{
				m_Guesses[m] = new PuzzleChestSolutionAndTime( DateTime.Now, solution );

				m.SendGump( new StatusGump( correctCylinders, correctColors ) );

				DoDamage( m );
			}
		}