public override void AddCustomContextEntries(Mobile from, List <ContextMenuEntry> list) { base.AddCustomContextEntries(from, list); if (SystemSettings.Enabled && from.Alive && from.InRange(Location, 8)) { var vault = AccountVault.GetVault(from); var inRange = vault != null && from.Region.IsPartOf(this.Region); var open = new OpenVaultEntry(this); open.Enabled = vault != null && inRange && !from.Criminal; list.Add(open); var rent = new RentVaultEntry(this); rent.Enabled = vault == null; list.Add(rent); var claim = new ClaimVaultEntry(this); claim.Enabled = vault != null && inRange; list.Add(claim); var actions = new VaultActionsEntry(this, vault); actions.Enabled = vault != null && inRange; list.Add(actions); var locations = new VaultLocationsEntry(this); list.Add(locations); } }
public override void OnClick() { var from = Owner.From; if (from != null) { var vault = AccountVault.GetVault(from); if (vault != null && from.Region.IsPartOf(Manager.Region)) { if (from.Criminal) { from.SendLocalizedMessage(1158195); // Thou art a criminal and cannot access thy vault. } else if (!from.InRange(vault.GetWorldLocation(), 2)) { vault.MoveTo(from); } else { vault.OnDoubleClick(from); } } } }
public static bool CanAssignVault(PlayerMobile pm, AccountVault vault) { if (pm.Account == null) { pm.SendMessage("An error occured why purchasing your vault. Try again later."); } else if (HasVault(pm)) { pm.SendLocalizedMessage(1158080); // You may only rent one vault at a time at this location. } else if (vault.Account != null) { pm.SendMessage("That vault has already been claimed!"); } else if (!SystemSettings.HasBalance(pm)) { pm.SendMessage("You lack the {0} to rent the account vault for the first month!", SystemSettings.UseTokens ? "vault credits" : "gold"); } else if (pm.Criminal) { pm.SendLocalizedMessage(1158195); // Thou art a criminal and cannot access thy vault. } else { return(true); } return(false); }
public static bool ValidateMap(AccountVault v) { if (Siege.SiegeShard) { return(v.Map != Map.Trammel); } return(v.Map != Map.Felucca); }
public static bool ValidateLocation(AccountVault v) { var reg = Region.Find(v.GetWorldLocation(), v.Map); if (SystemSettings.VaultRegions.Any(r => reg.IsPartOf(r))) { return(ValidateMap(v)); } return(false); }
public override void OnClick() { if (Owner.From is PlayerMobile pm) { if (!AccountVault.HasVault(pm)) { AccountVault.TryRentVault(pm, Manager); } else { pm.SendMessage("Your account already has an account vault."); } } }
public static bool ValidateLocation(AccountVault v) { var reg = Region.Find(v.GetWorldLocation(), v.Map); for (var index = 0; index < SystemSettings.VaultRegions.Length; index++) { var r = SystemSettings.VaultRegions[index]; if (reg.IsPartOf(r)) { return(ValidateMap(v)); } } return(false); }
public static int VaultCount(string region) { int count = 0; for (var index = 0; index < AccountVault.Vaults.Count; index++) { var v = AccountVault.Vaults[index]; if (v.Account == null && Region.Find(v.GetWorldLocation(), v.Map).IsPartOf(region) && AccountVault.ValidateMap(v)) { count++; } } return(count); }
public override void OnClick() { if (Owner.From is PlayerMobile pm) { var vault = AccountVault.GetVault(pm); if (vault != null) { /*Are you sure you want to claim this vault? Doing so will forfeit any rental * time remaining and place your vault contents in your backpack.*/ BaseGump.SendGump(new PetTrainingStyleConfirmGump(pm, 1074974, 1158037, () => { vault.ClaimVault(pm); })); } else { pm.SendLocalizedMessage(1158034); // You don’t have a vault to claim. } } }
public VaultActionsGump(PlayerMobile pm, AccountVault vault) : base(pm, 500, 100) { Vault = vault; }
public static int VaultCount(string region) { return(AccountVault.Vaults.Count(v => v.Account == null && Region.Find(v.GetWorldLocation(), v.Map).IsPartOf(region) && AccountVault.ValidateMap(v))); }
public NewVaultPurchaseGump(PlayerMobile pm, AccountVault vault) : base(pm, 50, 100) { Vault = vault; }
public InternalPrompt(PlayerMobile from, AccountVault vault) { From = from; Vault = vault; }
public VaultActionsEntry(VaultManager manager, AccountVault vault) : base(1157978, 8) { Manager = manager; Vault = vault; }
public static void TryRentVault(PlayerMobile pm, AccountVault vault, VaultManager manager) { if (pm != null && pm.Account != null && !HasVault(pm)) { if (vault == null) { vault = FindNearest <AccountVault>(pm, v => v.Account == null); } if (vault != null) { if (!ValidateLocation(vault)) { Utility.WriteConsoleColor(ConsoleColor.Red, "Invalid Account Vault Location: {0} [{1}]", vault.Location.ToString(), vault.Map != null ? vault.Map.ToString() : "null map"); pm.SendMessage("You cannot rent an account vault in this location!"); } else if (!SystemSettings.HasBalance(pm)) { if (manager == null) { manager = FindNearest <VaultManager>(pm); } if (SystemSettings.UseTokens) { if (manager != null) { manager.SayTo(pm, 1158313, 0x3B2); // But thou hast not the vault tokens! Please visit the Ultima Store for more details. } else { pm.SendLocalizedMessage(1158313); // But thou hast not the vault tokens! Please visit the Ultima Store for more details. } var entry = UltimaStore.GetEntry(typeof(VaultToken)); if (entry != null) { BaseGump.SendGump(new PromoItemGump(pm, entry, 0x9CCB)); } } else if (manager != null) { manager.SayTo(pm, 0x3B2, "But thou hast not the gold! You need {0} to rent a vault!", SystemSettings.RentGoldValue.ToString("N0", CultureInfo.GetCultureInfo("en-US"))); } else { pm.SendMessage("But thou hast not the gold! You need {0} to rent a vault!", SystemSettings.RentGoldValue.ToString("N0", CultureInfo.GetCultureInfo("en-US"))); } } else { BaseGump.SendGump(new PetTrainingStyleConfirmGump(pm, 1074974, SystemSettings.RentMessage(), () => { if (CanAssignVault(pm, vault)) { vault.TakeOwnership(pm); } })); } } else { // TODO: Message? } } }
public static void TryRentVault(PlayerMobile pm, AccountVault vault) { TryRentVault(pm, vault, null); }