public override bool OnDragDrop( Mobile from, Item dropped )
 {
     if ( from.Backpack != null )
     {
         if( dropped is Bandage )
      			{
             int amount = dropped.Amount;
             from.SendMessage("You enhance all of your bandages and drop them into your pack.");
             dropped.Amount = 1;
             dropped.Consume();
             from.AddToBackpack( new EnhancedBandage( amount ) );
         }
         else if( dropped is EnhancedBandage )
      			{
             from.SendMessage("Those have already been enhanced.");
         }
         else
         {
             from.SendMessage("You can only enhance bandages.");
         }
         return false;
     }
     else
     {
         from.SendMessage("You don't have a backpack to hold the enhanced bandages! Begone!");
         return false;
     }
 }
//This method added for [bandself command to call.
		public static void BandSelfCommandCall( Mobile from, Item m_Bandage )
		{
			from.RevealingAction();

			if ( BandageContext.BeginHeal( from, from ) != null )
				m_Bandage.Consume();

		}
Exemple #3
0
        // Scriptiz : ajout d'une méthode pour la commande .bandself
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null && !Engines.ConPVP.DuelContext.IsFreeConsume(from))
                m_Bandage.Consume();

        }
Exemple #4
0
        public override bool OnDragDrop( Mobile from, Item dropped )
        {
            if ( dropped is RecallRune )
            {
                if ( !CheckAccess( from ) )
                {
                    from.SendLocalizedMessage( 502413 ); // That cannot be done while the book is locked down.
                }
                else if ( IsOpen( from ) )
                {
                    from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
                }
                else if ( m_Entries.Count < 16 )
                {
                    RecallRune rune = (RecallRune)dropped;

                    if ( rune.Marked && rune.TargetMap != null )
                    {
                        m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );

                        dropped.Delete();

                        from.Send( new PlaySound( 0x42, GetWorldLocation() ) );

                        string desc = rune.Description;

                        if ( desc == null || (desc = desc.Trim()).Length == 0 )
                            desc = "(indescript)";

                        from.SendMessage( desc );

                        return true;
                    }
                    else
                    {
                        from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 502401 ); // This runebook is full.
                }
            }
            else if ( dropped is RecallScroll )
            {
                if ( m_CurCharges < m_MaxCharges )
                {
                    from.Send( new PlaySound( 0x249, GetWorldLocation() ) );

                    int amount = dropped.Amount;

                    if ( amount > (m_MaxCharges - m_CurCharges) )
                    {
                        dropped.Consume( m_MaxCharges - m_CurCharges );
                        m_CurCharges = m_MaxCharges;
                    }
                    else
                    {
                        m_CurCharges += amount;
                        dropped.Delete();

                        return true;
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 502410 ); // This book already has the maximum amount of charges.
                }
            }

            return false;
        }
Exemple #5
0
		public override bool OnDragDrop( Mobile from, Item item )
		{
			if( item is BasePotion )
			{
				BasePotion pot = (BasePotion)item;
				int toHold = Math.Min( 100 - m_Held, pot.Amount );


				if( toHold <= 0 )
				{
					from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
					return false;
				}
				else if( m_Held == 0 )
				{
					if( GiveBottle( from, toHold ) )
					{
						m_Type = pot.PotionEffect;
						Held = toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
				else if( pot.PotionEffect != m_Type )
				{
					from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
					return false;
				}
				else
				{
					if( GiveBottle( from, toHold ) )
					{
						Held += toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
				return false;
			}
		}
		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if ( dropped is BlankScroll && UzeraanTurmoilQuest.HasLostScrollOfPower( from ) )
			{
				FocusTo( from );

				Item scroll = new SchmendrickScrollOfPower();

				if ( !from.PlaceInBackpack( scroll ) )
				{
					scroll.Delete();
					from.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
					return false;
				}
				else
				{
					dropped.Consume();
					from.SendLocalizedMessage( 1049346 ); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product.
					return dropped.Deleted;
				}
			}

			return base.OnDragDrop( from, dropped );
		}
Exemple #7
0
		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			PlayerMobile player = from as PlayerMobile;

			if ( player != null )
			{
				UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;

				if ( qs != null && dropped is Apple && UzeraanTurmoilQuest.HasLostFertileDirt( from ) )
				{
					FocusTo( from );

					Item fertileDirt = new QuestFertileDirt();

					if ( !player.PlaceInBackpack( fertileDirt ) )
					{
						fertileDirt.Delete();
						player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
						return false;
					}
					else
					{
						dropped.Consume();
						qs.AddConversation( new DryadAppleConversation() );
						return dropped.Deleted;
					}
				}
			}

			return base.OnDragDrop( from, dropped );
		}
        public bool PourBottle( Mobile from, Item item )
        {
            if ( item is Bottle )
            {
                Container pack = from.Backpack;

                if ( pack != null )
                {
                    item.Consume(); //Consume a bottle

                    from.SendLocalizedMessage( 502242 ); // You pour some of the keg's contents into an empty bottle...

                    BasePotion pot = FillBottle();

                    if ( pack.TryDropItem( from, pot, false ) )
                    {
                        from.SendLocalizedMessage( 502243 ); // ...and place it into your backpack.
                        from.PlaySound( 0x240 );

                        if ( --Held == 0 )
                            from.SendLocalizedMessage( 502245 ); // The keg is now empty.
                    }
                    else
                    {
                        from.SendLocalizedMessage( 502244 ); // ...but there is no room for the bottle in your backpack.
                        //pot.Delete();
                        pot.MoveToWorld( pack.GetWorldLocation(), pack.Map );
                    }
                    return true;
                }
            }
            else if ( item is PotionKeg )
            {
                PotionKeg keg = item as PotionKeg;

                if ( keg.Held >= 100 )
                    from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
                else if ( m_Type != keg.Type )
                    from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
                else
                {
                    int toHold = Math.Min( 100 - keg.Held, m_Held );

                    keg.Held += toHold;

                    if ( ( m_Held -= toHold ) == 0 )
                        from.SendLocalizedMessage( 502245 ); // The keg is now empty.

                    from.PlaySound( 0x240 );

                    return true;
                }
            }

            return false;
        }
Exemple #9
0
		public virtual bool AddCharges(Mobile m, Item item, bool message)
		{
			if (m == null || m.Deleted || item == null || item.Deleted || !item.IsAccessibleTo(m))
			{
				return false;
			}

			int cost;

			if (!CanChargeWith(m, item, out cost, message))
			{
				return false;
			}

			if (item.Amount < cost)
			{
				if (message)
				{
					m.SendMessage("One charge costs {0:#,0} {1}.", cost, item.ResolveName(m));
				}

				return false;
			}

			int c = (int)Math.Min((long)(Charges + (int)Math.Floor(item.Amount / (double)cost)), Int32.MaxValue) - Charges;

			if (c <= 0)
			{
				return false;
			}

			int con = c * cost;

			item.Consume(con);

			Charges += c;

			if (message)
			{
				m.SendMessage(
					"You added {0:#,0} charge{1} to the codex and consumed {2:#,0} {3}.",
					c,
					c != 1 ? "s" : String.Empty,
					con,
					item.ResolveName());
			}

			InvalidateProperties();
			return true;
		}
 public static void EquipWeapon_OnCommand(CommandEventArgs e)
 {
     Item item = new Item();
     item.Consume();
 }
 public static void DrinkHeal_OnCommand(CommandEventArgs e)
 {
     Item item = new Item();
     item.Consume();
 }
Exemple #12
0
		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if ( dropped is RecallRune )
			{
				//Close all runebooks
				from.CloseGump( typeof( RunebookGump ) );

				if ( !CheckAccess( from ) )
				{
					from.SendLocalizedMessage( 502413 ); // That cannot be done while the book is locked down.
				}
				//else if ( IsOpen( from ) )
				//{
				//	from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
				//}
				else if ( m_Entries.Count < 16 )
				{
					RecallRune rune = (RecallRune)dropped;

					if ( rune.Marked && rune.TargetMap != null )
					{
						m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );

						dropped.Delete();

						from.Send( new PlaySound( 0x42, GetWorldLocation() ) );

						string desc = rune.Description;

						if ( desc == null || (desc = desc.Trim()).Length == 0 )
							desc = "(indescript)";

						from.SendMessage( desc );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
					}
				}
				else
				{
					from.SendLocalizedMessage( 502401 ); // This runebook is full.
				}
			}
			else if ( dropped is RecallScroll )
			{
				if ( m_CurCharges < m_MaxCharges )
				{
					from.Send( new PlaySound( 0x249, GetWorldLocation() ) );

					int amount = dropped.Amount;

					if ( amount > (m_MaxCharges - m_CurCharges) )
					{
						dropped.Consume( m_MaxCharges - m_CurCharges );
						m_CurCharges = m_MaxCharges;
					}
					else
					{
						m_CurCharges += amount;
						dropped.Delete();

						return true;
					}
				}
				else
				{
					from.SendLocalizedMessage( 502410 ); // This book already has the maximum amount of charges.
				}
			}
			else
			{
				// Adam: anything other than a scroll will get dropped into your backpack
				// (so your best sword doesn't get dropped on the ground.)
				from.AddToBackpack( dropped );
				//	For richness, we add the drop sound of the item dropped.
				from.PlaySound( dropped.GetDropSound() );
				return true;
			}

			return false;
		}
		public void AddTool( Mobile m , Item tar, int uses, ToolBox box ) {
			if ( ( tar is BaseTool || tar is BaseHarvestTool ) && uses > 0 ) {
				if ( tar is Hammer || tar is SmithHammer || tar is Tongs )
				{ this.i_S += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is TinkerTools ) { this.i_Ti += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is Skillet || tar is RollingPin || tar is FlourSifter )
				{ this.i_Co += uses; tar.Consume(); box.OW( m ); }
				else if (  tar is DovetailSaw || tar is Saw || tar is DrawKnife || tar is Froe || tar is Inshave || tar is JointingPlane || tar is MouldingPlane || tar is Nails || tar is Scorp || tar is SmoothingPlane )
				{ this.i_C += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is Shovel || tar is Pickaxe ) { this.i_M += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is Blowpipe ) { this.i_G += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is MalletAndChisel ) { this.i_St += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is SewingKit ) { this.i_T += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is FletcherTools ) { this.i_F += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is MortarPestle ) { this.i_A += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is MapmakersPen ) { this.i_Ca += uses; tar.Consume(); box.OW( m ); }
				else if ( tar is ScribesPen ) { this.i_Sc += uses; tar.Consume(); box.OW( m ); }
				else { m.SendMessage( "I do not recognize this type." ); box.NG( m, box ); } }
			else { m.SendMessage( "This is not the appropriate type of item or it has no uses left." ); box.NG( m, box ); } }
Exemple #14
0
        public override bool OnDragDrop( Mobile from, Item item )
		{
			if( from is PlayerMobile)
            {
                if( item is Copper || item is Silver || item is Gold )
                {
                    if(m_IsSlave)
                    {
                        this.Say("You... you want to do what?");
                        return false;
                    }
                    else
                    {
                        if(item is Copper)
                            HeldCopper += item.Amount;
                        else if (item is Silver)
                            HeldCopper += (item.Amount * 10);
                        else if (item is Gold)
                            HeldCopper += (item.Amount * 100);

                        item.Delete();

                        this.Say("I'll put this to good use in " + ( ( m_LastPaid + TimeSpan.FromDays(1) ) - DateTime.Now).Hours.ToString() + " hours.");
                        return true;
                    }
                }
                else if (item is CustomFood || item is Food)
                {
                    if(!m_IsSlave)
                    {
                        this.Say("I can pay for my own food, thank you!");
                        return false;
                    }
                    else
                    {
                        this.Say("Thank you, " + (from.Female ? "mistress" : "master") + ".");
                        if(item is CustomFood)
                            HeldFood += ( (int)(item as CustomFood).Quality * 2 );
                        else
                            HeldFood += item.Amount;

                        item.Consume();
                        return true;
                    }
                }
            }

            return false;
        }
        /// <summary>
        /// Checks if the item dropped upon the crystal can be used to recharge it.
        /// If it can, the item dropped is consumed and the crystal is charged
        /// </summary>
        /// <param name="from">Mobile dropping the item</param>
        /// <param name="dropped">Item that is being dropped</param>
        /// <param name="sendFullMessage">unused</param>
        /// <returns></returns>
        public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
        {
            if (Locked)
            {
                from.SendMessage("Dark energies repel the item.");
                return false;
            }

            if (dropped != null && dropped.VerifyMove(from))
            {
                BarrierCrystalRechargeInfo info = BarrierCrystalRechargeInfo.Get(dropped.GetType(), Desecrated == Desecration.Desecrated);

                if (info != null)
                {
                    if (Charges >= MaxCharges)
                    {
                        from.SendLocalizedMessage(500678); // This crystal is already fully charged.
                    }
                    else
                    {
                        dropped.Consume();

                        if (Charges + info.Amount >= MaxCharges)
                        {
                            Charges = MaxCharges;
                            from.SendLocalizedMessage(500679); // You completely recharge the crystal.
                        }
                        else
                        {
                            Charges += info.Amount;
                            if (ItemID != 14284)
                                from.SendLocalizedMessage(500680); // You recharge the crystal.
                            else
                                from.SendMessage("The crystal reforms as it absorbs the gem.");
                        }
                    }

                    return true;
                }
                else if (dropped is Skull)
                {
                    Skull sk = (Skull)dropped;
                    if (sk.Desecrated)
                    {
                        Desecrated = Desecration.Desecrated;
                        ToggleGuards(true);
                        sk.Consume();
                        from.SendMessage("The dark action poisons the crystal.");
                        from.SendMessage("The city guards vanish.");

                        return true;
                    }
                }
                else if (dropped is HugeSkull)
                {
                    HugeSkull sk = (HugeSkull)dropped;
                    if (sk.Desecrated)
                    {
                        Desecrated = Desecration.Desecrated;
                        ToggleGuards(true);
                        sk.Consume();
                        from.SendMessage("The dark action poisons the crystal.");
                        from.SendMessage("The city guards vanish.");

                        return true;
                    }
                }
            }

            from.SendLocalizedMessage(500681); // You cannot use this crystal on that.
            return false;
        }
        /// <summary>
        /// Checks if the item dropped upon the crystal can be used to recharge it.
        /// If it can, the item dropped is consumed and the crystal is charged
        /// </summary>
        /// <param name="from">Mobile dropping the item</param>
        /// <param name="dropped">Item that is being dropped</param>
        /// <param name="sendFullMessage">unused</param>
        /// <returns></returns>
        public override bool TryDropItem(Mobile from, Item given, bool sendFullMessage)
        {
            if (Locked)
            {
                from.SendMessage("Dark energies repel the item.");
                return false;
            }

            if (given != null && given.VerifyMove(from))
            {
                BarrierCrystalRechargeInfo info = BarrierCrystalRechargeInfo.Get(given.GetType(), MajorCrystal != null ? MajorCrystal.Desecrated == BarrierCrystal.Desecration.Desecrated : false);

                if (info != null)
                {
                    if (Charges >= MaxCharges)
                    {
                        from.SendLocalizedMessage(500678); // This crystal is already fully charged.
                    }
                    else
                    {
                        given.Consume();

                        if (Charges + info.Amount >= MaxCharges)
                        {
                            Charges = MaxCharges;
                            from.SendLocalizedMessage(500679); // You completely recharge the crystal.
                        }
                        else
                        {
                            Charges += info.Amount;
                            if (ItemID != 14284)
                                from.SendLocalizedMessage(500680); // You recharge the crystal.
                            else
                                from.SendMessage("The crystal reforms as it absorbs the gem.");
                        }
                    }

                    return true;
                }
            }

            from.SendLocalizedMessage(500681); // You cannot use this crystal on that.
            return false;
        }