示例#1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item iOil = targeted as Item;

                if (from.Backpack.FindItemByType(typeof(OilCloth)) == null)
                {
                    from.SendMessage("You need an oil cloth to apply this.");
                }
                else if (iOil is BaseWeapon)
                {
                    BaseWeapon xOil = (BaseWeapon)iOil;

                    if (!iOil.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You can only use this oil on items in your pack.");
                    }
                    else if (iOil.IsChildOf(from.Backpack) && MaterialInfo.IsWoodenItem(iOil))
                    {
                        if (m_Oil.Name == "wood polish ( oak )")
                        {
                            xOil.Resource = CraftResource.OakTree;
                        }
                        else if (m_Oil.Name == "wood polish ( ash )")
                        {
                            xOil.Resource = CraftResource.AshTree;
                        }
                        else if (m_Oil.Name == "wood polish ( cherry )")
                        {
                            xOil.Resource = CraftResource.CherryTree;
                        }
                        else if (m_Oil.Name == "wood polish ( walnut )")
                        {
                            xOil.Resource = CraftResource.WalnutTree;
                        }
                        else if (m_Oil.Name == "wood polish ( golden oak )")
                        {
                            xOil.Resource = CraftResource.GoldenOakTree;
                        }
                        else if (m_Oil.Name == "wood polish ( ebony )")
                        {
                            xOil.Resource = CraftResource.EbonyTree;
                        }
                        else if (m_Oil.Name == "wood polish ( hickory )")
                        {
                            xOil.Resource = CraftResource.HickoryTree;
                        }
                        else if (m_Oil.Name == "wood polish ( pine )")
                        {
                            xOil.Resource = CraftResource.PineTree;
                        }
                        else if (m_Oil.Name == "wood polish ( rosewood )")
                        {
                            xOil.Resource = CraftResource.RosewoodTree;
                        }
                        else if (m_Oil.Name == "wood polish ( mahogany )")
                        {
                            xOil.Resource = CraftResource.MahoganyTree;
                        }
                        else if (m_Oil.Name == "wood polish ( driftwood )")
                        {
                            xOil.Resource = CraftResource.DriftwoodTree;
                        }

                        from.RevealingAction();
                        from.PlaySound(0x23E);
                        from.AddToBackpack(new Bottle());
                        m_Oil.Consume();
                        from.Backpack.FindItemByType(typeof(OilCloth)).Delete();
                    }
                    else
                    {
                        from.SendMessage("You cannot rub this oil on that.");
                    }
                }
                else if (iOil is BaseArmor)
                {
                    BaseArmor xOil = (BaseArmor)iOil;

                    if (!iOil.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You can only use this oil on items in your pack.");
                    }
                    else if (iOil.IsChildOf(from.Backpack) && MaterialInfo.IsWoodenItem(iOil))
                    {
                        if (m_Oil.Name == "wood polish ( oak )")
                        {
                            xOil.Resource = CraftResource.OakTree;
                        }
                        else if (m_Oil.Name == "wood polish ( ash )")
                        {
                            xOil.Resource = CraftResource.AshTree;
                        }
                        else if (m_Oil.Name == "wood polish ( cherry )")
                        {
                            xOil.Resource = CraftResource.CherryTree;
                        }
                        else if (m_Oil.Name == "wood polish ( walnut )")
                        {
                            xOil.Resource = CraftResource.WalnutTree;
                        }
                        else if (m_Oil.Name == "wood polish ( golden oak )")
                        {
                            xOil.Resource = CraftResource.GoldenOakTree;
                        }
                        else if (m_Oil.Name == "wood polish ( ebony )")
                        {
                            xOil.Resource = CraftResource.EbonyTree;
                        }
                        else if (m_Oil.Name == "wood polish ( hickory )")
                        {
                            xOil.Resource = CraftResource.HickoryTree;
                        }
                        else if (m_Oil.Name == "wood polish ( pine )")
                        {
                            xOil.Resource = CraftResource.PineTree;
                        }
                        else if (m_Oil.Name == "wood polish ( rosewood )")
                        {
                            xOil.Resource = CraftResource.RosewoodTree;
                        }
                        else if (m_Oil.Name == "wood polish ( mahogany )")
                        {
                            xOil.Resource = CraftResource.MahoganyTree;
                        }
                        else if (m_Oil.Name == "wood polish ( driftwood )")
                        {
                            xOil.Resource = CraftResource.DriftwoodTree;
                        }

                        from.RevealingAction();
                        from.PlaySound(0x23E);
                        from.AddToBackpack(new Bottle());
                        m_Oil.Consume();
                        from.Backpack.FindItemByType(typeof(OilCloth)).Delete();
                    }
                    else
                    {
                        from.SendMessage("You cannot rub this oil on that.");
                    }
                }
                else
                {
                    from.SendMessage("You cannot rub this oil on that.");
                }
            }