コード例 #1
0
        public void OnTarget(Mobile from, object obj)
        {
            // TODO: Need details on how oil cloths should get consumed here

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else if (obj is Item && ((Item)obj).RootParent != from)
            {
                from.SendLocalizedMessage(1005425); // You may only wipe down items you are holding or carrying.
            }
            else if (obj is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)obj;

                if (weapon.Poison == null || weapon.PoisonCharges <= 0)
                {
                    from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422); // Hmmmm... this does not need to be cleaned.
                }
                else
                {
                    if (weapon.PoisonCharges < 2)
                    {
                        weapon.PoisonCharges = 0;
                    }
                    else
                    {
                        weapon.PoisonCharges -= 2;
                    }

                    if (weapon.PoisonCharges > 0)
                    {
                        from.SendLocalizedMessage(1005423); // You have removed some of the caustic substance, but not all.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1010497); // You have cleaned the item.
                    }
                }
            }
            else if (obj == from && obj is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)obj;

                if (pm.BodyMod == 183 || pm.BodyMod == 184)
                {
                    pm.SavagePaintExpiration = TimeSpan.Zero;

                    pm.BodyMod = 0;
                    pm.HueMod  = -1;

                    from.SendLocalizedMessage(1040006); // You wipe away all of your body paint.

                    Consume();
                }
                else
                {
                    from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422); // Hmmmm... this does not need to be cleaned.
                }
            }
            else if (obj is DyeTub)
            {
                DyeTub tub = (DyeTub)obj;

                if (!tub.Redyable)
                {
                    tub.Redyable = true;
                    tub.Charges  = 0;
                    tub.DyedHue  = 0;
                    from.SendMessage("Vous nettoyez le bac de teinture");

                    Consume();
                }
            }

            #region Firebomb
            else if (obj is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)obj;

                if (beverage.Content == BeverageType.Liquor)
                {
                    Firebomb bomb = new Firebomb(beverage.ItemID);
                    bomb.Name = beverage.Name;

                    beverage.ReplaceWith(bomb);

                    from.SendLocalizedMessage(1060580); // You prepare a firebomb.
                    Consume();
                }
            }
            else if (obj is Firebomb)
            {
                from.SendLocalizedMessage(1060579); // That is already a firebomb!
            }
            #endregion
            else
            {
                from.SendLocalizedMessage(1005426); // The cloth will not work on that.
            }
        }