public void TryBuyItem(Mobile from, Item item) { if (item.Deleted || !Backpack.Items.Contains(item) || !m_ItemTable.ContainsKey(item)) { from.SendMessage("This item is no longer available."); return; } int points = (int)Server.Engines.Points.PointsSystem.DespiseCrystals.GetPoints(from); int cost = m_ItemTable[item]; if (points >= cost) { //DespiseController.Instance.DeductDespisePoints(from, cost); Server.Engines.Points.PointsSystem.DespiseCrystals.DeductPoints(from, cost); item.Movable = true; if (from.Backpack == null || !from.Backpack.TryDropItem(from, item, false)) { item.MoveToWorld(from.Location, from.Map); } from.SendLocalizedMessage(1153427, cost.ToString()); // You have spent ~1_AMT~ Dungeon Crystal Points of Despise. InternalGump.Resend(this); } else { from.SendMessage("You need {0} more Despise dungeon crystal points for this.", cost - points); } }
private void DoRestock() { List <Item> list = new List <Item>(Backpack.Items); m_ItemTable.Clear(); InternalGump.Clear(); foreach (Item item in list) { item.Delete(); } int count = Utility.RandomMinMax(m_ItemCountMin, m_ItemCountMax); for (int i = 0; i < count; i++) { Item item; switch (Utility.Random(3)) { default: case 0: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, false, true); break; case 1: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, true, false); break; case 2: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(true, false, false); break; } int weight = 0; if (0.10 > Utility.RandomDouble()) { int budget = Utility.RandomMinMax(500, 860); RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(500, 860), 0, ReforgedPrefix.None, ReforgedSuffix.None); weight += budget / 3; } else { int props = Utility.RandomMinMax(3, 5); if (props == 5 && 0.05 > Utility.RandomDouble()) { props++; weight += 100; } if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, 0, props, m_IntensityMin, m_IntensityMax); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, 0, props, m_IntensityMin, m_IntensityMax); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, 0, props, m_IntensityMin, m_IntensityMax); } else if (item is BaseHat) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, 0, props, m_IntensityMin, m_IntensityMax); } } m_ItemTable[item] = (int)((weight + Server.SkillHandlers.Imbuing.GetTotalWeight(item, -1, false, true)) * 31.5); item.Movable = false; Backpack.DropItem(item); } m_NextRestock = DateTime.UtcNow + TimeSpan.FromMinutes(Utility.RandomMinMax(m_RestockMin, m_RestockMax)); }