Esempio n. 1
0
        public override void AddGumpLayout()
        {
            AddBackground(0, 0, 440, 270, 0x2454);
            AddHtmlLocalized(10, 10, 420, 18, CenterLoc, "#1157978", 0, false, false); // Vault Actions

            bool tokens = SystemSettings.UseTokens;
            var  store  = UltimaStore.GetProfile(User);
            var  acct   = User.Account;

            AddHtmlLocalized(10, 33, 165, 18, 1157990, 0x90D, false, false);     // Vault Tokens
            AddLabel(185, 33, 0, tokens ? store.VaultTokens.ToString() : "N/A"); // vault token count

            AddHtmlLocalized(10, 51, 165, 18, 1157985, 0x90D, false, false);     // Vault Rent Account:

            if (Vault.PastDue)
            {
                AddHtmlLocalized(185, 51, 165, 18, 1158081, false, false); // Past Due
            }
            else
            {
                AddLabel(185, 51, 0, Vault.Balance.ToString("N0", CultureInfo.GetCultureInfo("en-US"))); // vault rent account count
            }

            AddHtmlLocalized(10, 69, 165, 18, 1156044, 0x90D, false, false); // Total Gold:
            AddLabel(185, 69, 0, acct != null ? acct.TotalGold.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : "0");

            AddHtmlLocalized(10, 87, 165, 18, 1156045, 0x90D, false, false); // Total Platinum:
            AddLabel(185, 87, 0, acct != null ? acct.TotalPlat.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : "0");

            //AddHtmlLocalized(10, 105, 165, 18, 1157986, 0x90D, false, false); // Vault Rent Account:
            //AddLabel(185, 105, 0, ""); // vault rend account count???

            AddHtmlLocalized(55, 141, 360, 22, tokens ? 1157983 : 1157979, 0x90D, false, false); // Deposit Vault Token into Vault Rent Account : Deposit Gold into Vault Rent Account
            if (tokens)
            {
                AddTooltip(string.Format("Transfers purchased vault tokens from the player to the vault rent account; capped at {0} tokens. Tokens added to the vault rent account will be used for auto payments of the vault rent.", SystemSettings.MaxBalance.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));
            }
            else
            {
                AddTooltip(string.Format("Transfers gold from the player's bank to the vault rent account; capped at {0} gold. Funds added to the vault rent account will be used for auto payments of the vault rent.", SystemSettings.MaxBalance.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));
            }
            AddButton(15, 141, 0xFA5, 0xFA6, 102, GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 174, 360, 22, 1158143, 0x90D, false, false);
            AddButton(15, 174, 0xFA5, 0xFA6, 103, GumpButtonType.Reply, 0);
        }
Esempio n. 2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                if (!SystemSettings.UseTokens)
                {
                    from.SendMessage("Account Vaults are not set up on this shard for Tokens. Contact staff regarding a refund.");
                }
                else
                {
                    var pm = from as PlayerMobile;

                    if (pm != null)
                    {
                        if (Account != null && (pm.Account == null || pm.Account.Username != Account))
                        {
                            pm.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item.
                        }
                        else
                        {
                            var storeProf = UltimaStore.GetProfile(pm, true);

                            if (storeProf.VaultTokens >= SystemSettings.MaxTokenBalance)
                            {
                                pm.SendLocalizedMessage(1158194); // You cannot increase the number of vault credits on this character.
                            }
                            else
                            {
                                storeProf.VaultTokens++;

                                pm.SendLocalizedMessage(1158193, storeProf.VaultTokens.ToString());

                                Delete();
                                // You have increased your storage vault credit on this character. Your total credit count is now ~1_VAL~.
                                // Visit the nearest Vault Manager to rent a storage vault.
                            }
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
            }
        }
Esempio n. 3
0
        public static bool HasBalance(PlayerMobile pm, int amount = -1)
        {
            if (UseTokens)
            {
                if (amount == -1)
                {
                    amount = RentTokenValue;
                }

                var storeProfile = UltimaStore.GetProfile(pm, false);

                return(storeProfile != null && storeProfile.VaultTokens >= amount);
            }

            if (amount == -1)
            {
                amount = RentGoldValue;
            }

            return(pm.AccountGold.TotalCurrency >= amount);
        }
Esempio n. 4
0
        public static void WithdrawBalance(PlayerMobile pm, int amount = -1)
        {
            if (amount == -1)
            {
                amount = RentValue;
            }

            if (UseTokens)
            {
                var storeProfile = UltimaStore.GetProfile(pm, false);

                if (storeProfile != null)
                {
                    storeProfile.VaultTokens -= amount;
                }
            }
            else
            {
                Banker.Withdraw(pm, amount, true);
            }
        }