Esempio n. 1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            PlayerMobile m = m_user; ToolBox box = i_box; BaseTool tool; BaseHarvestTool toola; Hatchet toolh; Container pack = m.Backpack;

            switch (info.ButtonID)
            {
            default: { break; }

            case 2: { box.OW(m); break; }

            case 3: { tool = new Tongs(); tool.UsesRemaining = box.i_S; pack.DropItem(tool); box.i_S = 0; break; }

            case 4: { tool = new MouldingPlane(); tool.UsesRemaining = box.i_C; pack.DropItem(tool); box.i_C = 0; break; }

            case 5: { tool = new TinkerTools(); tool.UsesRemaining = box.i_Ti; pack.DropItem(tool); box.i_Ti = 0; break; }

            case 6: { tool = new SewingKit(); tool.UsesRemaining = box.i_T; pack.DropItem(tool); box.i_T = 0; break; }

            case 7: { toolh = new Hatchet(); toolh.UsesRemaining = box.i_L; pack.DropItem(toolh); box.i_L = 0; break; }

            case 8: { tool = new ScribesPen(); tool.UsesRemaining = box.i_Sc; pack.DropItem(tool); box.i_Sc = 0; break; }

            case 9: { toola = new Shovel(); toola.UsesRemaining = box.i_M; pack.DropItem(toola); box.i_M = 0; break; }

            case 10: { tool = new Skillet(); tool.UsesRemaining = box.i_Co; pack.DropItem(tool); box.i_Co = 0; break; }

            case 11: { tool = new FletcherTools(); tool.UsesRemaining = box.i_F; pack.DropItem(tool); box.i_F = 0; break; }

            case 12: { tool = new MortarPestle(); tool.UsesRemaining = box.i_A; pack.DropItem(tool); box.i_A = 0; break; }

            case 13: { tool = new MalletAndChisel(); tool.UsesRemaining = box.i_St; pack.DropItem(tool); box.i_St = 0; break; }

            case 14: { tool = new MapmakersPen(); tool.UsesRemaining = box.i_Ca; pack.DropItem(tool); box.i_Ca = 0; break; }

            case 15: { GargoylesPickaxe item = new GargoylesPickaxe(); item.UsesRemaining = box.i_Garg; pack.DropItem(item); box.i_Garg = 0; break; }

            case 16: { ProspectorsTool item = new ProspectorsTool(); item.UsesRemaining = box.i_Pros; pack.DropItem(item); box.i_Pros = 0; break; }

            case 17: { Blowpipe item = new Blowpipe(); item.UsesRemaining = box.i_G; pack.DropItem(item); box.i_G = 0; break; }
            }
            if (info.ButtonID > 2)
            {
                box.NG(m, box);
            }
        }
Esempio n. 2
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_System is Mining && targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                // grave
                if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8)
                {
                    PlayerMobile player = from as PlayerMobile;

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

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones)
                            {
                                player.SendLocalizedMessage(1055037);                                   // You finish your grim work, finding some of the specific bones listed in the Hag's recipe.
                                obj.Complete();

                                return;
                            }
                        }
                    }
                }
            }

            if (m_System is Lumberjacking && targeted is IChopable)
            {
                if (m_Tool.Parent != from)
                {
                    from.SendAsciiMessage("The axe must be equipped for any serious wood chopping.");
                    //from.SendLocalizedMessage( 500487 ); // The axe must be equipped for any serious wood chopping.
                    return;
                }
                else
                {
                    ((IChopable)targeted).OnChop(from);
                }
            }
            else if (m_System is Lumberjacking && targeted is ICarvable)
            {
                from.Animate(32, 5, 1, true, false, 0);
                ((ICarvable)targeted).Carve(from, m_Tool);
            }
            else if (m_System is Lumberjacking && targeted is Log)
            {
                BaseTool tools = new FletcherTools();
                from.SendMenu(new BowFletchingMenu(from, BowFletchingMenu.Main(from), "Main", tools));
                if (tools != null)
                {
                    tools.Delete();
                }
            }
            else if (m_System is Lumberjacking && FurnitureAttribute.Check(targeted as Item))
            {
                DestroyFurniture(from, (Item)targeted);
            }
            else if (m_System is Mining && targeted is TreasureMap)
            {
                ((TreasureMap)targeted).OnBeginDig(from);
            }
            else
            {
                m_System.StartHarvesting(from, m_Tool, targeted);
            }
        }
Esempio n. 3
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                from.Animate(32, 5, 1, true, false, 0);
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is Log)
            {
                BaseTool tools = new FletcherTools();
                from.SendMenu(new BowFletchingMenu(from, BowFletchingMenu.Main(from), "Main", tools));
                if (tools != null)
                {
                    tools.Delete();
                }
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                       // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else
            {
                if (targeted is StaticTarget)
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if (itemID == 0xD15 || itemID == 0xD16)                       // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

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

                            if (qs is WitchApprenticeQuest)
                            {
                                FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                                if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                                {
                                    player.SendLocalizedMessage(1055036);                                       // You slice a red cap mushroom from its stem.
                                    obj.Complete();
                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendAsciiMessage("You can't use a bladed item on that!");                       // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendAsciiMessage("You can't use a bladed item on that!");                       // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendAsciiMessage("There's not enough wood here to harvest.");                           // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendAsciiMessage("You put some kindling into your backpack.");                              // You put some kindling into your backpack.
                            from.SendAsciiMessage("An axe would probably get you more wood.");                               // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendAsciiMessage("You can't place any kindling into your backpack!");                               // You can't place any kindling into your backpack!

                            item.Delete();
                        }
                    }
                }
            }
        }