コード例 #1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (m_Ticket.Deleted)
                {
                    return;
                }

                int number = 0;

                Item item  = null;
                Item item2 = null;

                switch (info.ButtonID)
                {
                case 1: item = new Sextant(); number = 1010494; break;                   // A sextant has been placed in your backpack.

                case 2: item = new HairRestylingDeed(); number = 501933; break;          // A coupon for a free hair restyling has been placed in your backpack.

                case 3: item = new Spellbook(0xFFFFFFFF); number = 1010495; break;       // A spellbook with all 1st to 4th circle spells has been placed in your backpack.

                case 4: item = new FireworksWand(); number = 501935; break;              // A wand of fireworks has been placed in your backpack.

                case 5: item = new Spyglass(); number = 501936; break;                   // A spyglass has been placed in your backpack.

                case 6: item = new DyeTub(); item2 = new Dyes(); number = 501937; break; // The dyes and dye tub have been placed in your backpack.
                }

                if (item != null)
                {
                    m_Ticket.Delete();

                    m_From.SendLocalizedMessage(number);
                    m_From.AddToBackpack(item);

                    if (item2 != null)
                    {
                        m_From.AddToBackpack(item2);
                    }
                }
            }
コード例 #2
0
ファイル: SupplyStoneGump.cs プロジェクト: zerodowned/annox
        public override void OnResponse(NetState state, RelayInfo info) //Function for GumpButtonType.Reply Buttons
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 0:     //Case uses the ActionIDs defenied above. Case 0 defenies the actions for the button with the action id 0
            {
                //Cancel
                from.SendMessage(33, "You decide you dont need anything.");
                break;
            }

            case 1:     //Magery Reagents
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 500))
                {
                    BagOfReagents BagOfReagents = new BagOfReagents();
                    from.AddToBackpack(BagOfReagents);
                    from.SendMessage(33, "You bought Bag of Reagents and that costs 500 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 2:     //Necro Reagents
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 500))
                {
                    BagOfNecroReagents BagOfNecroReagents = new BagOfNecroReagents();
                    from.AddToBackpack(BagOfNecroReagents);
                    from.SendMessage(33, "You bought Bag of Necromancer Reagents and that costs 500 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 3:     //Bandages
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 150))
                {
                    BagOfBandages BagOfBandages = new BagOfBandages();
                    from.AddToBackpack(BagOfBandages);
                    from.SendMessage(33, "You bought Bag of Bandages and that costs 150 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 4:     //Weapons
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 200))
                {
                    BagOfWeapons BagOfWeapons = new BagOfWeapons();
                    from.AddToBackpack(BagOfWeapons);
                    from.SendMessage(33, "You bought Bag of Weapons and that costs 200 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 5:     //Armors
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 200))
                {
                    BagOfArmors BagOfArmors = new BagOfArmors();
                    from.AddToBackpack(BagOfArmors);
                    from.SendMessage(33, "You bought Bag of Armors and that costs 200 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 6:     //Necro Reagents
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 100))
                {
                    BagOfClothing BagOfClothing = new BagOfClothing();
                    from.AddToBackpack(BagOfClothing);
                    from.SendMessage(33, "You bought Bag of Clothing and that costs 100 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 7:     //Necro Reagents
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 500))
                {
                    BagOfArrowsAndBolts BagOfArrowsAndBolts = new BagOfArrowsAndBolts();
                    from.AddToBackpack(BagOfArrowsAndBolts);
                    from.SendMessage(33, "You bought Bag of Arrows and Bolts, that costs 500 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }

            case 8:     //Hair Restyling
            {
                Item[] Gold = from.Backpack.FindItemsByType(typeof(Gold));
                if (from.Backpack.ConsumeTotal(typeof(Gold), 150))
                {
                    HairRestylingDeed HairRestylingDeed = new HairRestylingDeed();
                    from.AddToBackpack(HairRestylingDeed);
                    from.SendMessage(33, "You bought Hair Restyling Deed and that costs 150 coins");
                }
                else
                {
                    from.SendMessage(33, "You are short the coinage needed.");
                }
                break;
            }
            }
        }