public static double GetPoints(Item item) { if (item is IVvVItem && ((IVvVItem)item).IsVvVItem) { return(0); } double points = 0; Type type = item.GetType(); if (Entries.ContainsKey(type)) { points = Entries[type]; // Kind of ametuar, but if this arrizes more, we'll make a seperate function if (item is SOS && ((SOS)item).IsAncient) { points = 2500; } if (item.Stackable) { points = points * item.Amount; } return(points); } else { if (item is RunicHammer) { RunicHammer hammer = (RunicHammer)item; if (hammer.Resource == CraftResource.DullCopper) { points = 5 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.ShadowIron) { points = 10 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Copper) { points = 25 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Bronze) { points = 100 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Gold) { points = 250 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Agapite) { points = 1000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Verite) { points = 4000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Valorite) { points = 8000 * hammer.UsesRemaining; } } else if (item is RunicSewingKit) { RunicSewingKit sewing = (RunicSewingKit)item; if (sewing.Resource == CraftResource.SpinedLeather) { points = 10 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.HornedLeather) { points = 100 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.BarbedLeather) { points = 400 * sewing.UsesRemaining; } } else if (item is PowerScroll) { PowerScroll ps = (PowerScroll)item; if (ps.Value == 105) { points = 50; } else if (ps.Value == 110) { points = 100; } else if (ps.Value == 115) { points = 500; } else if (ps.Value == 120) { points = 2500; } } else if (item is ScrollOfTranscendence) { SpecialScroll sot = (SpecialScroll)item; points = sot.Value / 0.1 * 2; } else if (item is Bait) { Bait bait = (Bait)item; points = 10 * bait.UsesRemaining; } else if (item is TreasureMap) { TreasureMap tmap = (TreasureMap)item; if (tmap.Level == 1) { points = 50; } else if (tmap.Level == 2) { points = 100; } else if (tmap.Level == 3) { points = 250; } else if (tmap.Level == 4) { points = 500; } else if (tmap.Level == 5) { points = 750; } else if (tmap.Level == 6) { points = 1000; } } else if (item is MidnightBracers && item.LootType == LootType.Cursed) { points = 5000; } else if (item is MonsterStatuette) { MonsterStatuette ms = (MonsterStatuette)item; if (ms.Type == MonsterStatuetteType.Slime) { points = 5000; } } else if (item is PigmentsOfTokuno || item is LesserPigmentsOfTokuno) { BasePigmentsOfTokuno pigments = (BasePigmentsOfTokuno)item; points = 500 * pigments.UsesRemaining; } else if (item is ICombatEquipment) { points = GetPointsForEquipment(item); } if (item.LootType != LootType.Blessed && points < 100 && item is IShipwreckedItem && ((IShipwreckedItem)item).IsShipwreckedItem) { points = 100; } return(points); } }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile from = sender.Mobile as PlayerMobile; for (i = 0; i < onsells[page].Length; i++) { if (info.ButtonID == i + 1) { if (Banker.GetBalance(from) >= price[page][i] && price[page][i] != 0) { var it = Activator.CreateInstance(onsells[page][i]) as Item; Banker.Withdraw(from, price[page][i]); if (it.Name != null) { from.SendMessage("购买一个" + it.Name.ToString() + ", 花费了{0}个金币", price[page][i]); } else { from.SendMessage("购买一个东东" + ", 花费{0}个金币", price[page][i]); } if (it is Pitcher) //玻璃水壶 { it = new Pitcher(BeverageType.Water); //装的是水 } //if (page == 0 && i ==3) else if (it is GlassMug) { it = new Jug(BeverageType.Water);//水壶 10次 } else if (it is MysticBook) { ((MysticBook)it).Content = (1ul << ((MysticBook)it).BookCount) - 1;//allspells } else if (it is SpellweavingBook) { ((SpellweavingBook)it).Content = (1ul << ((SpellweavingBook)it).BookCount) - 1;//allspells } else if (it is SewingKit) { it = new RunicSewingKit(CraftResource.BarbedLeather, 15); } else if (it is SmithHammer) { it = new RunicHammer(CraftResource.Valorite, 15); } from.AddToBackpack(it); from.SendSound(it.GetDropSound()); from.SendGump(new BuyGump(from, page)); } else { from.SendMessage("钱不够了"); break; } break; } } switch (info.ButtonID) { case prev: { if (page > 0) { from.SendGump(new BuyGump(from, --page)); } break; } case next: { if (page < onsells.Length - 1) { from.SendGump(new BuyGump(from, ++page)); } break; } default: case 0: case close: { break; } } }
public static double GetPoints(Item item) { double points = 0; Type type = item.GetType(); if (Entries.ContainsKey(type)) { points = Entries[type]; if (item.Stackable) { points = points * item.Amount; } return(points); } else { if (item is RunicHammer) { RunicHammer hammer = (RunicHammer)item; if (hammer.Resource == CraftResource.DullCopper) { points = 5 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.ShadowIron) { points = 10 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Copper) { points = 25 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Bronze) { points = 100 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Gold) { points = 250 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Agapite) { points = 1000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Verite) { points = 4000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Valorite) { points = 8000 * hammer.UsesRemaining; } } else if (item is RunicSewingKit) { RunicSewingKit sewing = (RunicSewingKit)item; if (sewing.Resource == CraftResource.SpinedLeather) { points = 10 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.HornedLeather) { points = 100 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.BarbedLeather) { points = 400 * sewing.UsesRemaining; } } else if (item is PowerScroll) { PowerScroll ps = (PowerScroll)item; if (ps.Value == 105) { points = 50; } else if (ps.Value == 110) { points = 100; } else if (ps.Value == 115) { points = 500; } else if (ps.Value == 120) { points = 2500; } } else if (item is ScrollofTranscendence) { SpecialScroll sot = (SpecialScroll)item; points = sot.Value / 0.1 * 2; } else if (item is Bait) { Bait bait = (Bait)item; points = 10 * bait.UsesRemaining; } else if (item is TreasureMap) { TreasureMap tmap = (TreasureMap)item; if (tmap.Level == 1) { points = 50; } else if (tmap.Level == 2) { points = 100; } else if (tmap.Level == 3) { points = 250; } else if (tmap.Level == 4) { points = 500; } else if (tmap.Level == 5) { points = 750; } else if (tmap.Level == 6) { points = 1000; } } else if (item is MidnightBracers && item.LootType == LootType.Cursed) { points = 5000; } else if (item is MonsterStatuette) { MonsterStatuette ms = (MonsterStatuette)item; if (ms.Type == MonsterStatuetteType.Slime) { points = 5000; } } else if (item is PigmentsOfTokuno || item is LesserPigmentsOfTokuno) { BasePigmentsOfTokuno pigments = (BasePigmentsOfTokuno)item; points = 500 * pigments.UsesRemaining; } return(points); } }
public void Generate(Mobile m, Container cont, bool spawning, int luck) { int index = 0; foreach (LootPackEntry entry in m_Entries) { if (!entry.AtSpawnTime && spawning) { index++; continue; } int itemIndex = Utility.Random(entry.Types.Count); bool drop = false; if (entry.DropChance >= 100) { drop = true; } else { if (entry.DropChance >= Utility.Random(100)) { //Console.WriteLine("Create: DropChance >= Creation Chance... "); drop = true; } } if (!drop) { index++; continue; } //Console.WriteLine("Create: Drop Test Passed"); /* * Item check = (Item)Activator.CreateInstance(entry.Types[itemIndex]); * * int loop = 1; * if (!check.Stackable) * loop = entry.DropAmount; */ for (int a = 0; a < ((entry.Types[itemIndex] == typeof(Gold)) ? 1 : entry.DropAmount); a++) { Item looted = null; if (entry.Types[itemIndex] == typeof(BasePotion)) { int t = Utility.Random(LootPack.LowPotions.Count); Server.LootPackItem lpi = new Server.LootPackItem(Custom.LootPack.LowPotions[t], 1); looted = lpi.Construct(true, true, true); } else if (entry.Types[itemIndex] == typeof(TreasureMap)) { looted = new TreasureMap(Utility.Random(5), Map.Felucca); ((TreasureMap)looted).Decoder = m; } else if (entry.Types[itemIndex] == typeof(BaseRunicTool)) { switch (Utility.Random(2)) { case 0: looted = new RunicSewingKit(GetRandomLeather()); break; case 1: looted = new RunicHammer(GetRandomMetal()); break; // case 2: looted = new RunicSaw(GetRandomWood()); break; // case 3: looted = new RunicFletcherTools(GetRandomWood()); break; case 2: looted = new RunicSewingKit(GetRandomLeather()); break; //J.I.C } } else { Server.LootPackItem lpi = new Server.LootPackItem(entry.Types[itemIndex], 1); looted = lpi.Construct(true, true, true); } if (looted == null) { index++; continue; } //Console.WriteLine("Create: Construct Test Passed"); //Console.WriteLine("Mutate: # of Possible Attributes = " + entry.AttributeAmount); int chance = 0; for (int b = 0; b < entry.AttributeAmount; b++) { chance = Utility.Random(100); //Console.WriteLine("Mutate: Attach Chance " + chance); int propCount = ItemProps.BonusCount(looted); if (propCount < entry.AttributeAmount && entry.AttributeChance >= chance) { //Console.WriteLine("Mutate: Prop Chance >= Attach Chance"); looted = Mutate(m, luck, looted, index, itemIndex); } } if (looted == null) { index++; continue; } // if (looted is BaseRanged/*.GetType().IsSubclassOf(typeof(BaseRanged))*/ && 1 >= Utility.Random(200)) /* { * ((BaseRanged)looted).EnergyBow = true; * ((BaseRanged)looted).EnergyCost = Utility.RandomMinMax(3, 10); * }*/ //if (looted.GetType() == typeof(ScrollofCombatSecrets) || 1 >= Utility.Random(1000)) //looted.LootType = LootType.Blessed; if (looted.Stackable) { looted.Amount = entry.DropAmount; } //Skill Bonus Bug Fix Custom.ItemProps.FixSkillBonuses(looted); if (!cont.TryDropItem(m, looted, false)) { cont.DropItem(looted); } if (entry.Types.Count > 1) { itemIndex = Utility.Random(entry.Types.Count); } if (looted.Stackable) { break; } } index++; } }