Esempio n. 1
0
		private void DealerChecksCards(Mobile from)
		{
			if (m_InUseBy != from)
			{
				m_BJInfo.status = GameStatus.Waiting;
				if (m_DealerTimer != null)
					m_DealerTimer.Stop();
				return;
			}
			string message = null;
			if (m_DealerTimer != null)
				m_DealerTimer.Stop();
			m_BJInfo.status = GameStatus.DealerTurn;
			m_BJInfo.HandInfo[0] = EvalHand(m_BJInfo.HandInfo[0]);
			if (CardSounds)
				from.PlaySound(85);
			if (!DealerMustHit(m_BJInfo.HandInfo[0], m_DealerHitsSoft17, out message))
			{
				//from.CloseGump(typeof(BlackJackCardGump),1);
                from.CloseGump(typeof(BlackJackCardGump));
				DealerStands(from, message);
				return;
			}
			//from.CloseGump(typeof(BlackJackCardGump),1);
            from.CloseGump(typeof(BlackJackCardGump));
			from.SendGump(new BlackJackCardGump(from, this, message));
			Hit(from, false);
			if (m_DealerTimer == null)
				m_DealerTimer = new DealerTimer(this, from, TimeSpan.FromMilliseconds(750));
			m_DealerTimer.Start();
		}
Esempio n. 2
0
		public override void OnDoubleClick(Mobile from)
		{
			if (!from.InRange(GetWorldLocation(), 2) && (from.AccessLevel >= AccessLevel.GameMaster))
			{
#if XMLSPAWNER
                from.SendGump(new XmlPropertiesGump(from, this));
#else
				from.SendGump(new PropertiesGump(from, this));
#endif
				return;
			}

			if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this))
			{
				from.SendLocalizedMessage(500446); // That is too far away.
				return;
			}
			if (!m_Active)
			{
				if (m_InUseBy != null && (from == InUseBy))
				{
					//from.CloseGump(typeof(BlackJackCardGump),1);
                    from.CloseGump(typeof(BlackJackCardGump));
					if (m_OnCredit != 0)
						DoCashOut(from);
				}
				from.SendMessage("Sorry, this machine is currently down for maintenance.");
				return;
			}

			m_TimeOut = DateTime.Now - m_LastPlayed;
			string message = null;
			m_DealerTimer = null;
			if (m_InUseBy == null || m_InUseBy.Deleted)
			{
				m_Bet = (int)m_MinBet;
				m_CurrentBet = m_BetTable[m_Bet];
				message = "Welcome to CEOBlackJack!";
				m_BJInfo.status = GameStatus.Waiting;
				m_BJInfo.askInsurance = false;
				m_BJInfo.totalhands = m_BJInfo.largesthand = 0;
				m_OnCredit = m_Escrow = 0;
				InUseBy = from;
			}
			else
			{
				if (m_IdleTimer < m_TimeOut)
				{
					if (m_Escrow > 0)
						m_OnCredit += m_Escrow;
                    string tempName = m_InUseBy != null ? m_InUseBy.Name : "Someone";
					if (m_InUseBy != null && m_InUseBy != from && m_OnCredit != 0)
						DoCashOut(m_InUseBy); // Previous user disconnected or something? Give them their cash before releasing.
                    from.SendMessage("{0} has left this machine idle too long, it is yours to play.", tempName); 
                    InUseBy = from;
					m_BJInfo.status = GameStatus.Waiting;
					m_BJInfo.totalhands = m_BJInfo.largesthand = 0;
					m_OnCredit = m_Escrow = 0;
				}
			}
			if (from == m_InUseBy)
			{
				if (message == null)
					message = "Welcome back.";
				//from.CloseGump(typeof(BlackJackCardGump),1);
                from.CloseGump(typeof(BlackJackCardGump));
			}
			else
			{
				string text = String.Format("{0} is currently using this machine.", m_InUseBy.Name);
				from.SendMessage(text);
				return;
			}
			if (m_TestMode)
			{
				m_OnCredit = 100000;
			}
			m_HelpGump = false;		
			//from.CloseGump(typeof(BlackJackCardGump),1);
            from.CloseGump(typeof(BlackJackCardGump));
			from.SendGump(new BlackJackCardGump(from, this, message));
		}
Esempio n. 3
0
		private void DealersTurn(Mobile from)
		{
			bool DrawCards = false;
			for (int h = 1; h < m_BJInfo.totalhands; h++)
			{
				if (m_BJInfo.HandInfo[h].status != HandStatus.Bust && m_BJInfo.HandInfo[h].status != HandStatus.BlackJack)
					DrawCards = true;
			}
			if (!DrawCards)
			{
				m_BJInfo.status = GameStatus.Waiting;
				from.SendGump(new BlackJackCardGump(from, this, null));
				return;
			}
			if (m_DealerDelay)
			{
				string message = null;
				m_BJInfo.status = GameStatus.DealerTurn;
				if (DealerMustHit(m_BJInfo.HandInfo[0], m_DealerHitsSoft17, out message))
				{
					from.SendGump(new BlackJackCardGump(from, this, message));
					Hit(from, false);
					if (m_DealerTimer == null)
						m_DealerTimer = new DealerTimer(this, from, TimeSpan.FromMilliseconds(750));
					m_DealerTimer.Start();
				}
				else
					DealerStands(from, message);
			}
			else
				DealerHits(from);
		}