コード例 #1
0
ファイル: Chainsaw.cs プロジェクト: slawdis/uoodyssey-scripts
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseLog)
                {
                    BaseLog m_Log = (BaseLog)targeted;

                    if (m_Log.Deleted)
                    {
                        return;
                    }

                    if (!from.InRange(m_Log.GetWorldLocation(), 2))
                    {
                        from.SendMessage("The logs are too far away.");
                        return;
                    }

                    double difficulty;

                    switch (m_Log.Resource)
                    {
                    default: difficulty = 40.0; break;

                    case CraftResource.AshTree: difficulty = 55.0; break;

                    case CraftResource.CherryTree: difficulty = 60.0; break;

                    case CraftResource.EbonyTree: difficulty = 65.0; break;

                    case CraftResource.GoldenOakTree: difficulty = 70.0; break;

                    case CraftResource.HickoryTree: difficulty = 75.0; break;

                    case CraftResource.MahoganyTree: difficulty = 80.0; break;

                    case CraftResource.DriftwoodTree: difficulty = 80.0; break;

                    case CraftResource.OakTree: difficulty = 85.0; break;

                    case CraftResource.PineTree: difficulty = 90.0; break;

                    case CraftResource.GhostTree: difficulty = 90.0; break;

                    case CraftResource.RosewoodTree: difficulty = 95.0; break;

                    case CraftResource.WalnutTree: difficulty = 99.0; break;

                    case CraftResource.PetrifiedTree: difficulty = 99.9; break;

                    case CraftResource.ElvenTree: difficulty = 100.1; break;
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Lumberjacking].Value)
                    {
                        from.SendMessage("You have no idea how to best cut this type of wood!");
                        return;
                    }

                    if (from.CheckTargetSkill(SkillName.Lumberjacking, targeted, minSkill, maxSkill))
                    {
                        if (m_Log.Amount <= 0)
                        {
                            from.SendMessage("There is not enough wood in this pile to make a board.");
                        }
                        else
                        {
                            int           amount = m_Log.Amount;
                            BaseWoodBoard wood   = m_Log.GetLog();
                            m_Log.Delete();
                            wood.Amount = amount;
                            from.AddToBackpack(wood);
                            from.PlaySound(0x21C);
                            from.SendMessage("You cut the logs and put some boards in your backpack.");
                            m_Tool.ConsumeCharge(from);
                        }
                    }
                    else
                    {
                        int amount = m_Log.Amount;
                        int lose   = Utility.RandomMinMax(1, amount);

                        if (amount < 2 || lose == amount)
                        {
                            m_Log.Delete();
                            from.SendMessage("You try to cut the logs but ruin all of the wood.");
                            m_Tool.ConsumeCharge(from);
                        }
                        else
                        {
                            m_Log.Amount = amount - lose;
                            from.SendMessage("You try to cut the logs but ruin some of the wood.");
                            m_Tool.ConsumeCharge(from);
                        }

                        from.PlaySound(0x21C);
                    }
                }
                else
                {
                    from.SendMessage("You can only use this on logs.");
                }
            }
コード例 #2
0
 public InternalTarget(BaseLog log) :  base(2, false, TargetFlags.None)
 {
     m_Log = log;
 }
コード例 #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Deed.Deleted)
                {
                    return;
                }

                int number;

                if (m_Deed.Commodity != null)
                {
                    number = 1047028;                     // The commodity deed has already been filled.
                }
                else if (targeted is Item)
                {
                    BankBox box          = from.FindBankNoCreate();
                    string  XferResource = "...";
                    int     XferAmount   = 0;
                    int     r            = 0;

                    if (box != null && m_Deed.IsChildOf(box) && ((Item)targeted).IsChildOf(box))
                    {
                        // RESOURCE EDIT
                        if (targeted is BaseIngot) // || targeted is BaseBoards || targeted is BaseLog || targeted is BaseLeather || targeted is BaseScales || targeted is BasePowder || targeted is BaseCrystal)
                        {
                            from.SendMessage("You require a 'Special Commodity Deed' for this custom resource item...");
                            number = 1047027;
                            m_Deed.Delete();

                            BaseIngot youringots = (BaseIngot)targeted;
                            string    s_resource = Convert.ToString(youringots.Resource);
                            XferAmount = youringots.Amount;
                            switch (s_resource)
                            {
                            case "Iron": r = 1; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "DullCopper": r = 2; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "ShadowIron": r = 3; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Copper": r = 4; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Bronze": r = 5; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Gold": r = 6; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Silver": r = 7; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Agapite": r = 8; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Verite": r = 9; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Valorite": r = 10; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Jade": r = 11; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Moonstone": r = 12; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;

                            case "Sunstone": r = 13; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youringots.Delete(); break;
                                //case "": r = 13; box.DropItem(new YaksCommodityDeed(XferAmount, r)); youringots.Delete(); break;
                            }
                        }
                        else if (targeted is BaseLeather) // || targeted is BaseBoards || targeted is BaseLog || targeted is BaseLeather || targeted is BaseScales || targeted is BasePowder || targeted is BaseCrystal)
                        {
                            from.SendMessage("You require a 'Special Commodity Deed' for this custom resource item...");
                            number = 1047027;
                            m_Deed.Delete();

                            BaseLeather youritem   = (BaseLeather)targeted;
                            string      s_resource = Convert.ToString(youritem.Resource);
                            XferAmount = youritem.Amount;
                            switch (s_resource)
                            {
                            case "RegularLeather": r = 101; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "SpinedLeather": r = 102; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "HornedLeather": r = 103; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "BarbedLeather": r = 104; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "DaemonLeather": r = 105; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "DragonLeather": r = 106; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;
                            }
                        }
                        else if (targeted is BaseScales) // || targeted is BaseBoards || targeted is BaseLog || targeted is BaseLeather || targeted is BaseScales || targeted is BasePowder || targeted is BaseCrystal)
                        {
                            from.SendMessage("You require a 'Special Commodity Deed' for this custom resource item...");
                            number = 1047027;
                            m_Deed.Delete();

                            BaseScales youritem   = (BaseScales)targeted;
                            string     s_resource = Convert.ToString(youritem.Resource);
                            XferAmount = youritem.Amount;
                            switch (s_resource)
                            {
                            case "RedScales": r = 201; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "YellowScales": r = 202; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "BlackScales": r = 203; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "GreenScales": r = 204; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "WhiteScales": r = 205; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "BlueScales": r = 206; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;
                                //case "IceScales": r = 207; box.DropItem(new YaksCommodityDeed(XferAmount, r)); youritem.Delete(); break;
                            }
                        }
                        else if (targeted is BaseLog)// || targeted is BaseLog || targeted is BaseLeather || targeted is BaseScales || targeted is BasePowder || targeted is BaseCrystal)
                        {
                            from.SendMessage("You require a 'Special Commodity Deed' for this custom resource item...");
                            number = 1047027;
                            m_Deed.Delete();

                            BaseLog youritem   = (BaseLog)targeted;
                            string  s_resource = Convert.ToString(youritem.Resource);
                            XferAmount = youritem.Amount;
                            switch (s_resource)
                            {
                            case "Regular": r = 301; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Oak": r = 302; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Ash": r = 303; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Yew": r = 304; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Heartwood": r = 305; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Bloodwood": r = 306; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Frostwood": r = 307; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Pine": r = 308; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Cedar": r = 309; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Cherry": r = 310; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Mahogany": r = 311; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;
                            }
                        }
                        else if (targeted is BaseBoards)// || targeted is BaseLog || targeted is BaseLeather || targeted is BaseScales || targeted is BasePowder || targeted is BaseCrystal)
                        {
                            from.SendMessage("You require a 'Special Commodity Deed' for this custom resource item...");
                            number = 1047027;
                            m_Deed.Delete();

                            BaseBoards youritem   = (BaseBoards)targeted;
                            string     s_resource = Convert.ToString(youritem.Resource);
                            XferAmount = youritem.Amount;
                            switch (s_resource)
                            {
                            case "Regular": r = 401; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Oak": r = 402; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Ash": r = 03; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Yew": r = 404; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Heartwood": r = 405; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Bloodwood": r = 406; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Frostwood": r = 407; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Pine": r = 408; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Cedar": r = 409; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Cherry": r = 410; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;

                            case "Mahogany": r = 411; box.DropItem(new SpecialCommodityDeed(XferAmount, r)); youritem.Delete(); break;
                            }
                        }
                        else
                        {
                            if (m_Deed.SetCommodity((Item)targeted))
                            {
                                number = 1047030; // The commodity deed has been filled.
                            }
                            else
                            {
                                number = 1047027; // That is not a commodity the bankers will fill a commodity deed with.
                            }
                        }
                    }
                    else
                    {
                        number = 1047026;                         // That must be in your bank box to use it.
                    }
                }
                else
                {
                    number = 1047027;                     // That is not a commodity the bankers will fill a commodity deed with.
                }

                from.SendLocalizedMessage(number);
            }