Example #1
0
        public static bool AffordsDuel(DuelStone ds, Mobile from, int price)
        {
            if (price == 0)
            {
                return(true);
            }

            if (ds.IsUsingStone(from))
            {
                return(true);
            }

            if (from.Backpack.TotalGold >= price)
            {
                from.Backpack.ConsumeTotal(typeof(Gold), price);
                from.SendAsciiMessage(price + " has been withdrawn from your account.");
                return(true);
            }
            else if ((from.BankBox.TotalGold + from.Backpack.TotalGold) >= price)
            {
                from.BankBox.ConsumeTotal(typeof(Gold), price - from.Backpack.TotalGold);
                from.Backpack.ConsumeTotal(typeof(Gold), from.Backpack.TotalGold);
                from.SendAsciiMessage(price + " has been withdrawn from your account.");
                return(true);
            }
            else
            {
                from.SendAsciiMessage("You do not have enough money for this duel!");
                return(false);
            }
        }
Example #2
0
        public static bool CanUseStone(DuelStone ds, Mobile from)
        {
            #region MutualChecks
            if (ds.DuelerLocation1 == new Point3D(0, 0, 0))
            {
                from.SendAsciiMessage("This stone has not yet been set, page a GM.");
                return(false);
            }

            if ((ds.StoneType == DuelStoneEventType.Loot2vs2 || ds.StoneType == DuelStoneEventType.Money2vs2) && ds.DuelerLocation2 == new Point3D(null))
            {
                from.SendAsciiMessage("This stone has not yet been set, page a GM.");
                return(false);
            }

            /*if( ( ds.DuelCost == 0 ) && ( ds.StoneType == DuelStoneEventType.Money1vs1 || ds.StoneType == DuelStoneEventType.Money2vs2 ) )
             * {
             *      from.SendAsciiMessage( "This stone has not yet been set, page a GM." );
             *      return false;
             * }*/

            if (from.Hits != from.HitsMax && !ds.IsUsingStone(from))
            {
                from.SendAsciiMessage("You do not have enough HP to join this duel.");
                return(false);
            }
            #endregion

            if (((ds.StoneType == DuelStoneEventType.Money1vs1 || ds.StoneType == DuelStoneEventType.Loot1vs1) && (ds.Combatant1 != null && ds.Combatant2 != null) && (ds.Combatant1 != from && ds.Combatant2 != from)))
            {
                from.SendAsciiMessage("This stone is busy!");
                return(false);
            }

            return(true);
        }
		public static bool CanUseStone( DuelStone ds, Mobile from )
		{
			#region MutualChecks
			if( ds.DuelerLocation1 == new Point3D( 0, 0, 0 ) )
			{
				from.SendAsciiMessage( "This stone has not yet been set, page a GM." );
				return false;
			}

			if( ( ds.StoneType == DuelStoneEventType.Loot2vs2 || ds.StoneType == DuelStoneEventType.Money2vs2 ) && ds.DuelerLocation2 == new Point3D( null ) )
			{
				from.SendAsciiMessage( "This stone has not yet been set, page a GM." );
				return false;
			}

			/*if( ( ds.DuelCost == 0 ) && ( ds.StoneType == DuelStoneEventType.Money1vs1 || ds.StoneType == DuelStoneEventType.Money2vs2 ) )
			{
				from.SendAsciiMessage( "This stone has not yet been set, page a GM." );
				return false;
			}*/

			if( from.Hits != from.HitsMax && !ds.IsUsingStone( from ) )
			{
				from.SendAsciiMessage( "You do not have enough HP to join this duel." );
				return false;
			}
			#endregion

			if( ( ( ds.StoneType == DuelStoneEventType.Money1vs1 || ds.StoneType == DuelStoneEventType.Loot1vs1 ) && ( ds.Combatant1 != null && ds.Combatant2 != null ) && ( ds.Combatant1 != from && ds.Combatant2 != from ) ) )
			{
				from.SendAsciiMessage( "This stone is busy!" );
				return false;
			}

			return true;
		}
		public static bool AffordsDuel( DuelStone ds, Mobile from, int price )
		{
			if( price == 0 )
				return true;

			if( ds.IsUsingStone( from ) )
				return true;

			if( from.Backpack.TotalGold >= price )
			{
				from.Backpack.ConsumeTotal( typeof( Gold ), price );
				from.SendAsciiMessage( price + " has been withdrawn from your account." );
				return true;
			}
			else if( ( from.BankBox.TotalGold + from.Backpack.TotalGold ) >= price )
			{
				from.BankBox.ConsumeTotal( typeof( Gold ), price - from.Backpack.TotalGold );
				from.Backpack.ConsumeTotal( typeof( Gold ), from.Backpack.TotalGold );
				from.SendAsciiMessage( price + " has been withdrawn from your account." );
				return true;
			}
			else
			{
				from.SendAsciiMessage( "You do not have enough money for this duel!" );
				return false;
			}
		}