Пример #1
0
 public override void OnClick()
 {
     if (backpack == null || !backpack.IsOwner(player))
     {
         return;
     }
     backpack.AddCurrencyFromBackpack(player);
 }
Пример #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID == (int)BUTTONS.OK || backpack.Deleted || !(from is PlayerMobile))
            {
                CloseGump(from);
                return;
            }
            if (info.ButtonID == (int)BUTTONS.ADD)
            {
                from.Target = new MasterLooterAddCurrencyTarget(from, backpack);
                return;
            }
            else if (info.ButtonID == (int)BUTTONS.FILL)
            {
                backpack.AddCurrencyFromBackpack(from as PlayerMobile);
            }
            else
            {
                TextRelay amountRelay = info.GetTextEntry((int)BUTTONS.AMOUNT);
                if (amountRelay != null)
                {
                    ulong amount = 0;
                    try
                    {
                        int iAmount = Convert.ToInt32(amountRelay.Text, 10);
                        if (iAmount > 0)
                        {
                            amount = (ulong)iAmount;
                        }
                    }
                    catch { }
                    if (amount > 0)
                    {
                        if (info.ButtonID == (int)BUTTONS.GOLD && amount <= 60000 && amount <= backpack.GoldAmount)
                        {
                            backpack.GoldAmount -= amount;
                            from.AddToBackpack(new Gold((int)amount));
                            from.SendMessage(1173, "You extracted {0} gold from your Master Looter Backpack.", amount);
                        }
                        else if (info.ButtonID == (int)BUTTONS.GOLD_CHECK && amount <= 1000000 && amount <= backpack.GoldAmount)
                        {
                            backpack.GoldAmount -= amount;
                            from.AddToBackpack(new BankCheck((int)amount));
                            from.SendMessage(1173, "You extracted {0} gold from your Master Looter Backpack.", amount);
                        }
#if USE_TOKENS
                        else if (info.ButtonID == (int)BUTTONS.TOKENS && amount <= 60000 && amount <= backpack.TokensAmount)
                        {
                            backpack.TokensAmount -= amount;
                            from.AddToBackpack(new Daat99Tokens((int)amount));
                            from.SendMessage(1173, "You extracted {0} tokens from your Master Looter Backpack.", amount);
                        }
                        else if (info.ButtonID == (int)BUTTONS.TOKENS_CHECK && amount <= 1000000 && amount <= backpack.TokensAmount)
                        {
                            backpack.TokensAmount -= amount;
                            from.AddToBackpack(new TokenCheck((int)amount));
                            from.SendMessage(1173, "You extracted {0} tokens from your Master Looter Backpack.", amount);
                        }
#endif
                        else
                        {
                            from.SendMessage(1173, "You can't extract that.");
                        }
                    }
                }
            }
            SendGump(from, backpack);
        }