public void RemoveTest() { Doll cloneDorothy = dorothy.Copy(); // Doll with several accessories. Dress dorothyDress = pinkPartyDress.Copy() as Dress; Purse dorothyPurse = premiumPurse.Copy() as Purse; Necklace dorothyNecklace = diamondNecklace.Copy() as Necklace; Bracelet dorothyBraceletA = braidedBracelet.Copy() as Bracelet; Bracelet dorothyBraceletB = diamondBracelet.Copy() as Bracelet; Bracelet dorothyBraceletC = fantasyBraceletA.Copy() as Bracelet; Bracelet dorothyBraceletD = fantasyBraceletB.Copy() as Bracelet; cloneDorothy.Wear(dorothyDress); cloneDorothy.Wear(dorothyPurse); cloneDorothy.Wear(dorothyNecklace); cloneDorothy.Wear(dorothyBraceletA); cloneDorothy.Wear(dorothyBraceletB); cloneDorothy.Wear(dorothyBraceletC); cloneDorothy.Wear(dorothyBraceletD); // Removing a doll's dress will remove all accessories at once. cloneDorothy.Remove(dorothyDress); Assert.AreEqual(cloneDorothy.TotalAccessories, 0); }
public Player( AvatarState avatarState, CharacterSheet characterSheet, CharacterLevelSheet characterLevelSheet, EquipmentItemSetEffectSheet equipmentItemSetEffectSheet ) : base( null, characterSheet, avatarState.characterId, avatarState.level) { // FIXME 중복 코드 제거할 것 Exp.Current = avatarState.exp; Inventory = avatarState.inventory; worldInformation = avatarState.worldInformation; weapon = null; armor = null; belt = null; necklace = null; ring = null; monsterMap = new CollectionMap(); eventMap = new CollectionMap(); hairIndex = avatarState.hair; lensIndex = avatarState.lens; earIndex = avatarState.ear; tailIndex = avatarState.tail; PostConstruction(characterLevelSheet, equipmentItemSetEffectSheet); }
void LoadData() { ///暂时暴力存放数据 ItemDictionary = new Dictionary <int, Item>(); Weapon weapon1 = new Weapon(0, "武器1", "武器1武器1武器1武器1武器1", 100 , 1, "ItemPicture/weapon1", 1, 20); Weapon weapon2 = new Weapon(1, "武器2", "武器2武器2武器2武器2武器2", 200 , 1, "ItemPicture/weapon2", 1, 20); Weapon weapon3 = new Weapon(2, "武器3", "武器3武器3武器3武器3武器3", 300 , 1, "ItemPicture/weapon3", 1, 20); Ring ring = new Ring(3, "戒指", "戒指戒指戒指戒指戒指戒指", 400, 1, "ItemPicture/ring", 5, 20, 10); Necklace necklace = new Necklace(4, "项链", "项链项链项链项链项链", 500, 1, "ItemPicture/necklace", 5, 20, 10); Armor armor = new Armor(5, "护甲", "护甲护甲护甲护甲护甲护甲", 600, 1, "ItemPicture/armor", 6, 100); Medicine medicine1 = new Medicine(6, "小血瓶", "小血瓶小血瓶小血瓶小血瓶", 20, 1, "ItemPicture/hp1", 1, 50, 0); Medicine medicine2 = new Medicine(7, "大血瓶", "大血瓶大血瓶大血瓶大血瓶", 20, 1, "ItemPicture/hp2", 1, 150, 0); Medicine medicine3 = new Medicine(8, "小蓝瓶", "小蓝瓶小蓝瓶小蓝瓶小蓝瓶", 20, 1, "ItemPicture/mp1", 1, 0, 100); ItemDictionary.Add(weapon1.Id, weapon1); ItemDictionary.Add(weapon2.Id, weapon2); ItemDictionary.Add(weapon3.Id, weapon3); ItemDictionary.Add(ring.Id, ring); ItemDictionary.Add(armor.Id, armor); ItemDictionary.Add(necklace.Id, necklace); ItemDictionary.Add(medicine1.Id, medicine1); ItemDictionary.Add(medicine2.Id, medicine2); ItemDictionary.Add(medicine3.Id, medicine3); }
public Player( int level, CharacterSheet characterSheet, CharacterLevelSheet characterLevelSheet, EquipmentItemSetEffectSheet equipmentItemSetEffectSheet ) : base( null, characterSheet, GameConfig.DefaultAvatarCharacterId, level) { Exp.Current = characterLevelSheet[level].Exp; Inventory = new Inventory(); worldInformation = null; weapon = null; armor = null; belt = null; necklace = null; ring = null; monsterMap = new CollectionMap(); eventMap = new CollectionMap(); hairIndex = 0; lensIndex = 0; earIndex = 0; tailIndex = 0; PostConstruction(characterLevelSheet, equipmentItemSetEffectSheet); }
public Player(AvatarState avatarState, Simulator simulator) : base( simulator, simulator.CharacterSheet, avatarState.characterId, avatarState.level) { if (simulator is null) { throw new ArgumentNullException(nameof(simulator)); } // FIXME 중복 코드 제거할 것 Exp.Current = avatarState.exp; Inventory = avatarState.inventory; worldInformation = avatarState.worldInformation; weapon = null; armor = null; belt = null; necklace = null; ring = null; monsterMap = new CollectionMap(); eventMap = new CollectionMap(); hairIndex = avatarState.hair; lensIndex = avatarState.lens; earIndex = avatarState.ear; tailIndex = avatarState.tail; PostConstruction(simulator.CharacterLevelSheet, simulator.EquipmentItemSetEffectSheet); }
public KhaldunSummoner() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4) { Body = 0x190; Name = "Zealot of Khaldun"; Title = "the Summoner"; SetStr(50); SetDex(50); SetInt(100); SetHits(400); SetMana(2000); SetDamage(5, 10); SetSkill(SkillName.Wrestling, 90); SetSkill(SkillName.Tactics, 100); SetSkill(SkillName.MagicResist, 100); SetSkill(SkillName.Magery, 100); SetSkill(SkillName.EvalInt, 100); SetSkill(SkillName.Meditation, 100); VirtualArmor = 25; Fame = 10000; Karma = -10000; LeatherGloves gloves = new LeatherGloves(); gloves.Hue = 0x66D; AddItem(gloves); BoneHelm helm = new BoneHelm(); helm.Hue = 0x835; AddItem(helm); Necklace necklace = new Necklace(); necklace.Hue = 0x66D; AddItem(necklace); Cloak cloak = new Cloak(); cloak.Hue = 0x66D; AddItem(cloak); Kilt kilt = new Kilt(); kilt.Hue = 0x66D; AddItem(kilt); Sandals sandals = new Sandals(); sandals.Hue = 0x66D; AddItem(sandals); }
public async Task <IActionResult> OnPostAsync(int id) { Necklace = necklaceService.GetNecklace(id); await necklaceService.DeleteNecklaceAsync(Necklace.JewelryID); return(RedirectToPage("AllNecklaces")); }
public void EquipNecklace(Necklace necklace) { var pc = player.GetComponent <PlayerCharacter>(); var prevNecklace = pc.necklace; pc.ModifyStats(prevNecklace, necklace); pc.necklace = necklace; }
public KhaldunSummoner() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4) { Body = 0x190; Title = "the Summoner"; SetStr(1254, 1381); SetDex(93, 135); SetInt(745, 810); SetHits(694, 875); SetDamage(12, 20); SetSkill(SkillName.Wrestling, 90.1, 100.0); SetSkill(SkillName.Tactics, 90.1, 100.0); SetSkill(SkillName.MagicResist, 90.1, 100.0); SetSkill(SkillName.Magery, 90.1, 100.0); SetSkill(SkillName.EvalInt, 100.0); SetSkill(SkillName.Meditation, 120.1, 130.0); VirtualArmor = 36; Fame = 10000; Karma = -10000; LeatherGloves gloves = new LeatherGloves(); gloves.Hue = 0x66D; gloves.Identified = true; AddItem(Immovable(gloves)); BoneHelm helm = new BoneHelm(); helm.Hue = 0x835; helm.Identified = true; AddItem(Immovable(helm)); Necklace necklace = new Necklace(); necklace.Hue = 0x66D; AddItem(Immovable(necklace)); Cloak cloak = new Cloak(); cloak.Hue = 0x66D; AddItem(Immovable(cloak)); Kilt kilt = new Kilt(); kilt.Hue = 0x66D; AddItem(Immovable(kilt)); Sandals sandals = new Sandals(); sandals.Hue = 0x66D; AddItem(Immovable(sandals)); }
private void FillNecklaceForm(Necklace item) { necklacePanel.Enabled = true; PlayerModifiersDict = item.Modifiers; if (PlayerModifiersDict == null) { PlayerModifiersDict = new Dictionary <PlayerModifiers, int>(); } }
public static Necklace GenerateNecklace() { var necklace = new Necklace { name = "Random Necklace", description = "" }; return(necklace); }
private void newItem_Click(object sender, EventArgs e) { ItemTypePopup popup = new ItemTypePopup(); DialogResult result = popup.ShowDialog(); if (result == DialogResult.OK) { int nextId = -1; List <ItemBase> items = new List <ItemBase>(); foreach (var item in itemBox.Items) { items.Add(item as ItemBase); } for (int i = 0; nextId == -1; i++) { if (items.Any(x => x.ItemId == i) == false) { nextId = i; } } ItemBase toAdd = null; switch (popup.itemType.SelectedItem) { case "Armor": toAdd = new Armor("New Item", nextId, Rarity.Common); break; case "Consumable": toAdd = new Consumable("New Item", nextId, Rarity.Common); break; case "Necklace": toAdd = new Necklace("New Item", nextId, Rarity.Common); break; case "Resource": toAdd = new Resource("New Item", nextId, Rarity.Common); break; case "Ring": toAdd = new Ring("New Item", nextId, Rarity.Common); break; case "Weapon": toAdd = new Weapon("New Item", nextId, Rarity.Common); break; } itemBox.Items.Add(toAdd); itemBox.SelectedItem = toAdd; } popup.Dispose(); }
public void Serialize() { Assert.NotNull(_necklaceRow); var costume = new Necklace(_necklaceRow, Guid.NewGuid(), 0); var serialized = costume.Serialize(); var deserialized = new Necklace((Bencodex.Types.Dictionary)serialized); Assert.Equal(costume, deserialized); }
public IActionResult Index(Necklace necklace) { if (ModelState.IsValid) { _necklaceRepository.AddNecklaceInDb(necklace); return(RedirectToAction("ItemAddedSuccess")); } return(View(necklace)); }
public async Task DeleteNecklaceAsync(int id) { Necklace necklaceToDelete = necklaces.Find(necklace => necklace.JewelryID == id); if (necklaceToDelete != null) { necklaces.Remove(necklaceToDelete); await DbCrudMethods.DeleteObjectAsync(necklaceToDelete); } }
public Necklace DropNecklace(Character attacker) { var necklace = new Necklace { name = "Random Necklace", description = "" }; attacker.GetComponent <ObjectSpawner>().CreateFloatingStatusText("NECKLACE FOUND", "Necklace found."); return(necklace); }
public IActionResult OnGet(int id) { Necklace = necklaceService.GetNecklace(id); if (Necklace == null) { RedirectToPage("/NotFound"); } return(Page()); }
private void EquipNecklace(int number) { if (necklace != null) { inventory.items.Add(necklace); } ModifyStats(necklace, inventory.items[number]); necklace = (Necklace)(inventory.items[number]); inventory.items.RemoveAt(number); GetComponent <HotbarUser>().CmdRefreshAbilityInfo(); }
public Necklace ConvertTo() { var obj = new Necklace { name = name, level = level, description = description, quality = quality }; obj.stats = ConvertStatsTo(statKeys, statValues); return(obj); }
private void Equip(IReadOnlyList <Inventory.Item> items, EquipmentItemSetEffectSheet sheet) { _costumes = items.Select(i => i.item) .OfType <Costume>() .Where(e => e.equipped) .ToList(); _equipments = items.Select(i => i.item) .OfType <Equipment>() .Where(e => e.equipped) .ToList(); foreach (var equipment in _equipments) { switch (equipment.ItemSubType) { case ItemSubType.Weapon: weapon = equipment as Weapon; break; case ItemSubType.Armor: armor = equipment as Armor; defElementType = equipment.ElementalType; break; case ItemSubType.Belt: belt = equipment as Belt; break; case ItemSubType.Necklace: necklace = equipment as Necklace; break; case ItemSubType.Ring: ring = equipment as Ring; break; default: throw new RequiredBlockIndexException(); } } Stats.SetEquipments(_equipments, sheet); foreach (var skill in _equipments.SelectMany(equipment => equipment.Skills)) { Skills.Add(skill); } foreach (var buffSkill in _equipments.SelectMany(equipment => equipment.BuffSkills)) { Skills.Add(buffSkill); } }
public void Awake() { StatBuilder(); SpellBook = new List <Ability>(); SpellBook.Add(new NormalAttack(this)); SpellBook.Add(new HeroicStrike(this)); SpellBook.Add(new Heal(this)); WeaponSlot = new Weapon(typeI.ord); ArmourSlot = new Armour(typeI.ord); NeckSlot = new Necklace(typeI.ord); CalcEqupmentStats(); ResultStats = CalcResStats(); Alive = true; }
private bool EquipNecklace(Necklace item, out ItemBase replacedItem) { if (ReferenceEquals(Necklace, item)) { // Necklace is the same. Fail. replacedItem = null; return(false); } // Necklace is new. Replace old necklace replacedItem = Necklace; Necklace = item; return(true); }
private static void Main(string[] args) { //System.Console.ReadLine(); PageantJury ConcursoPrueba = new PageantJury(); Doll doll = new Doll("2Pac"); Accessory vestido = new Dress(15, Dress.EColor.Black, Dress.EDressCategory.Casual); doll.Wear(vestido); Accessory accesorio = new Necklace(20000); doll.Wear(accesorio); doll.Remove(vestido); ConcursoPrueba.AddContestant(doll); doll = new Doll("Snoop Dog"); accesorio = new Dress(10, Dress.EColor.White, Dress.EDressCategory.Suit); doll.Wear(accesorio); accesorio = new Necklace(60); doll.Wear(accesorio); accesorio = new Bracelet(160); doll.Wear(accesorio); ConcursoPrueba.AddContestant(doll); doll = new Doll("Mexicano 777"); accesorio = new Dress(25, Dress.EColor.Pink, Dress.EDressCategory.Party); doll.Wear(accesorio); ConcursoPrueba.AddContestant(doll); doll = new Doll("El judio"); accesorio = new Dress(5, Dress.EColor.Green, Dress.EDressCategory.Casual); doll.Wear(accesorio); accesorio = new Bracelet(700); doll.Wear(accesorio); ConcursoPrueba.AddContestant(doll); if (ConcursoPrueba.GetWinner() == null) { System.Console.WriteLine("Sin ganador"); } else { System.Console.WriteLine("ganador = " + ConcursoPrueba.GetWinner().Name); } System.Console.WriteLine("Pulse enter para salir"); System.Console.ReadLine(); }
public void SerializeWithDotNetAPI() { Assert.NotNull(_necklaceRow); var costume = new Necklace(_necklaceRow, Guid.NewGuid(), 0); var formatter = new BinaryFormatter(); using var ms = new MemoryStream(); formatter.Serialize(ms, costume); ms.Seek(0, SeekOrigin.Begin); var deserialized = (Necklace)formatter.Deserialize(ms); Assert.Equal(costume, deserialized); }
public void ChangeNecklace(Necklace newequipment) { if (necklace != null) { strength -= necklace.str; defence -= necklace.def; speed -= necklace.spd; maxHp -= necklace.hp; if (hp > maxHp) { hp = maxHp; } maxMp -= necklace.mp; if (mp > maxMp) { mp = maxMp; } strength -= necklace.str; constitution -= necklace.con; intelligence -= necklace.iNt; dexterity -= necklace.dex; lucky -= necklace.luk; } necklace = newequipment; attack += necklace.att; defence += necklace.def; speed += necklace.spd; maxHp += necklace.hp; maxMp += necklace.mp; strength += necklace.str; constitution += necklace.con; intelligence += necklace.iNt; dexterity += necklace.dex; lucky += necklace.luk; tSTR = strength; tDEX = dexterity; tLUK = lucky; tCON = constitution; tINT = intelligence; if (CharacterUi.MyInstance.necklace != null) { BagScript.MyInstance.AddItem(CharacterUi.MyInstance.necklace); } CharacterUi.MyInstance.necklace = necklace; }
public static SavedNecklace ConvertFrom(Necklace accessory) { if (accessory == null) { return(null); } var obj = new SavedNecklace { name = accessory.name, level = accessory.level, description = accessory.description, quality = accessory.quality }; obj.ConvertStatsFrom(accessory.stats); return(obj); }
public void WearTest() { // Restricted wears Doll cloneBelle = belle.Copy(); // Doll using a suit can't equip a necklace Doll cloneAnastasia = anastasia.Copy(); // Doll using a green dress can't equip a necklace Doll cloneDorothy = dorothy.Copy(); // Doll using a purse can't equip a new purse; Doll cloneNataliya = nataliya.Copy(); // Doll without a dress can't equip anything else Dress belleSuit = cheapBlackOfficeSuit.Copy() as Dress; Purse bellePurse = cheapPurseA.Copy() as Purse; Necklace belleNecklace = fantasyNecklaceA.Copy() as Necklace; cloneBelle.Wear(belleSuit); cloneBelle.Wear(bellePurse); cloneBelle.Wear(belleNecklace); Assert.AreEqual(cloneBelle.TotalAccessories, 2); Dress anastasiaDress = greenPartyDress.Copy() as Dress; Necklace anastasiaNecklace = diamondNecklace.Copy() as Necklace; cloneAnastasia.Wear(anastasiaDress); Assert.AreEqual(cloneAnastasia.Wear(anastasiaNecklace), false); Dress dorothyDress = blueCasualDress.Copy() as Dress; Purse dorothyPurse = midPurse.Copy() as Purse; Purse dorothyNewPurse = premiumPurse.Copy() as Purse; cloneDorothy.Wear(dorothyDress); cloneDorothy.Wear(dorothyPurse); Assert.AreEqual(dorothy.Wear(dorothyNewPurse), false); Assert.AreEqual(cloneNataliya.Wear(belleNecklace), false); Assert.AreEqual(cloneNataliya.TotalAccessories, 0); // CloneNataliya can equip only up to 5 bracelets cloneNataliya.Wear(belleSuit); for (int i = 0; i < 10; i++) { cloneNataliya.Wear(diamondBracelet.Copy()); } Assert.AreEqual(cloneNataliya.BraceletCount, 5); }
/// <summary> /// метод одевания шмотки /// </summary> /// <param name="Item"></param> public void Equip(ItemType Item) { if (Item is Weapon) { WeaponSlot = (Weapon)Item; CalcEqupmentStats(); } if (Item is Armour) { ArmourSlot = (Armour)Item; CalcEqupmentStats(); } if (Item is Necklace) { NeckSlot = (Necklace)Item; CalcEqupmentStats(); } }
protected void SetEquipmentStat(EquipmentItemSetEffectSheet sheet) { foreach (var equipment in equipments) { switch (equipment.ItemSubType) { case ItemSubType.Weapon: weapon = equipment as Weapon; break; case ItemSubType.Armor: armor = equipment as Armor; defElementType = equipment.ElementalType; break; case ItemSubType.Belt: belt = equipment as Belt; break; case ItemSubType.Necklace: necklace = equipment as Necklace; break; case ItemSubType.Ring: ring = equipment as Ring; break; default: throw new RequiredBlockIndexException(); } } Stats.SetEquipments(equipments, sheet); foreach (var skill in equipments.SelectMany(equipment => equipment.Skills)) { Skills.Add(skill); } foreach (var buffSkill in equipments.SelectMany(equipment => equipment.BuffSkills)) { Skills.Add(buffSkill); } }
public string GetStringText(Item item) { if (item == null) { return(null); } StringBuilder content = new StringBuilder(); content.AppendFormat("<size=25><b>{0}</b></size>\n\n", item.Name); content.AppendFormat("等级:{0}\n", item.Level); switch (item.Type) { case ItemType.Armor: Armor armor = item as Armor; content.AppendFormat("防御:{0}\n", armor.Defense); break; case ItemType.Medicine: Medicine medicine = item as Medicine; content.AppendFormat("Hp:{0}\nMp:{1}\n", medicine.Hp, medicine.Mp); break; case ItemType.Necklace: Necklace necklace = item as Necklace; content.AppendFormat("攻击范围+:{0}\n攻击速度+:{1}\n", necklace.SkillRange, necklace.SkillSpeed); break; case ItemType.Ring: Ring ring = item as Ring; content.AppendFormat("抗疲劳+:{0}\n抗毒+:{1}\n", ring.DefendWeak, ring.DefendPoison); break; case ItemType.Weapon: Weapon weapon = item as Weapon; content.AppendFormat("攻击+:{0}\n", weapon.Damage); break; default: break; } content.AppendFormat("购买价格:{0}\n\n详情:{1}\n", item.Price, item.Detail); return(content.ToString()); }
public List<BaseItem> GetAllItemsInNpcBag(byte bag, int npcId) { DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag); bagIdParameter.DbType = DbType.Byte; DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId); characterIdParameter.DbType = DbType.Int32; List<BaseItem> items = new List<BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_PRICE = reader.GetOrdinal(DbNames.ITEM_PRICE); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_DURABILITY = reader.GetOrdinal(DbNames.ITEM_DURABILITY); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_MAXIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if(BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon) { b = new Hammer(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.Durability = reader.GetInt32(ordinalITEM_DURABILITY); e.MaxDurability = e.Durability; e.Damage = reader.GetInt16(ordinalITEM_DAMAGE); e.Defence = reader.GetInt16(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUETRIES); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_PRICE); items.Add(b); } reader.Close(); _db.Close(); return items; }
public BaseItem GetItemByItemID(int itemID) { DbParameter itemIdParameter = _db.CreateParameter(DbNames.GETITEMBYITEMID_ITEMID_PARAMETER, itemID); itemIdParameter.DbType = DbType.Int32; BaseItem b = null; _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETITEMBYITEMID_STOREDPROC, CommandType.StoredProcedure, itemIdParameter); int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID); int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA); int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS); int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL); int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES); int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES); int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE); int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES); int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE); int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE); int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING); int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE); int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF); int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER); int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE); int ordinalITEM_REBIRTHHOLEITEM = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLEITEM); int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES); int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1); int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2); int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3); int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4); int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1); int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2); int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3); int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES); c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1); c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1); c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2); c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2); c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3); c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3); c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4); c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES); e.Durability = reader.GetInt16(ordinalITEM_CURDURA); e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA); e.Damage = reader.GetInt16(ordinalITEM_DAMAGE); e.Defence = reader.GetInt16(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.Plus = reader.GetByte(ordinalITEM_PLUS); e.Slvl = reader.GetByte(ordinalITEM_SLVL); e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES); e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES); e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE); e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES); e.DragonDamage = reader.GetInt16(ordinalITEM_DRAGONDAMAGE); e.DragonDefence = reader.GetInt16(ordinalITEM_DRAGONDEFENCE); e.DragonAttackRating = reader.GetInt16(ordinalITEM_DRAGONATTACKRATING); e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE); e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF); e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER); e.RebirthHole = reader.GetByte(ordinalITEM_REBIRTHHOLE); e.RebirthHoleItem = reader.GetByte(ordinalITEM_REBIRTHHOLEITEM); e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } b.ItemID = reader.GetInt32(ordinalITEM_ITEMID); b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID); b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_COST); } reader.Close(); _db.Close(); return b; }
public override void OnDoubleClick( Mobile m ) { Item RewardItem = null; if( IsChildOf( m.Backpack ) ) { switch (Utility.Random(11)) { case 0: { RewardItem = new GoldNecklace(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 1: { RewardItem = new GoldBeadNecklace(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 2: { RewardItem = new SilverNecklace(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 3: { RewardItem = new SilverBeadNecklace(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 4: { RewardItem = new GoldBracelet(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 5: { RewardItem = new SilverBracelet(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 6: { RewardItem = new GoldRing(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 7: { RewardItem = new SilverRing(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 8: { RewardItem = new SilverEarrings(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 9: { RewardItem = new GoldEarrings(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } case 10: { RewardItem = new Necklace(); RewardItem.Hue = Utility.RandomList(Sphere.RareHues); break; } } m.AddToBackpack(RewardItem); Delete(); } else m.SendAsciiMessage( "That must be in your pack for you to use it." ); }
public BaseItem GetRebirthPillDrop(Monster m) { DbParameter levelParameter = _db.CreateParameter(DbNames.GETPILLDROPITEM_LEVEL_PARAMETER, m.Level); levelParameter.DbType = DbType.Int32; List<BaseItem> items = new List<BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETPILLDROPITEM_STOREDPROC, CommandType.StoredProcedure, levelParameter); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.DROPITEM_DURABILITY); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES); e.Durability = reader.GetInt32(ordinalITEM_MAXDURA); e.MaxDurability = reader.GetInt32(ordinalITEM_MAXDURA); e.Damage = reader.GetInt32(ordinalITEM_DAMAGE); e.Defence = reader.GetInt32(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } if (BKind == (byte)bKindStones.RbItem) { b = new RbHoleItem(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } if (BKind == (byte)bKindBooks.RebirdBook) { b = new RebirthBook(); } if (BKind == (byte)bKindBooks.FourthBook) { b = new FourthBook(); } if (BKind == (byte)bKindBooks.FeSkillBook) { b = new FeSkillBook(); } if (BKind == (byte)bKindBooks.FeBook) { b = new FiveElementBook(); } if (BKind == (byte)bKindBooks.FocusBook) { b = new FocusBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } if (BType == (byte)bType.StoreTag) { b = new StoreTag(); StoreTag tag = b as StoreTag; tag.TimeLeft = reader.GetInt16(ordinalITEM_MAXDURA); tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA); } if (BType == (byte)bType.PetItem) { if (BKind == (byte)bKindPetItems.Taming) b = new TameItem(); if (BKind == (byte)bKindPetItems.Food) b = new PetFood(); if (BKind == (byte)bKindPetItems.Potion) b = new PetPotion(); if (BKind == (byte)bKindPetItems.Resurect) b = new PetResurrectItem(); PetItem p = b as PetItem; p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE); p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE); p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); } if (BType == (byte)bType.Pill) { if (BKind == (byte)bKindPills.Rebirth) b = new RebirthPill(); RebirthPill p = b as RebirthPill; p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS); p.ToRebirth = (byte)(p.RequiredRebirth + 1); p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX); } b.ItemID = 0; b.OwnerID = 0; b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = 0; b.Slot = 0; b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = 1; b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_COST); items.Add(b); } reader.Close(); _db.Close(); if (items.Count > 0) { Random rand = new Random(); int itemPos = rand.Next(0, items.Count); return items[itemPos]; } else return null; }
public List<BaseItem> GetAllItemsInBag(byte bag, int characterId) { DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_BAGID_PARAMETER, bag); bagIdParameter.DbType = DbType.Byte; DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_CHARACTERID_PARAMETER, characterId); characterIdParameter.DbType = DbType.Int32; List<BaseItem> items = new List<BaseItem>(); _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter); int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID); int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID); int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID); int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE); int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND); int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID); int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST); int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS); int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT); int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL); int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX); int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR); int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA); int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE); int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES); int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA); int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA); int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE); int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE); int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING); int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED); int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE); int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE); int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA); int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN); int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN); int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL); int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS); int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL); int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES); int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES); int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE); int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES); int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE); int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE); int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING); int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE); int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF); int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER); int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE); int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT); int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID); int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE); int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE); int ordinalITEM_IMBUEDATA = reader.GetOrdinal(DbNames.ITEM_IMBUEDATA); int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID); int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL); int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA); int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES); int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES); int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1); int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2); int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3); int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4); int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1); int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2); int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3); int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4); int ordinalITEM_PETID = reader.GetOrdinal(DbNames.ITEM_PETID); int ordinalITEM_DAMAGEABSORB = reader.GetOrdinal(DbNames.ITEM_DAMAGEABSORB); int ordinalITEM_DEFENSEABSORB = reader.GetOrdinal(DbNames.ITEM_DEFENSEABSORB); int ordinalITEM_ATTACKRATINGABSORB = reader.GetOrdinal(DbNames.ITEM_ATTACKRATINGABSORB); int ordinalITEM_LIFEABSORB = reader.GetOrdinal(DbNames.ITEM_LIFEABSORB); int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG); int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT); int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX); int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY); while (reader.Read()) { BaseItem b = null; int BType = reader.GetByte(ordinalITEM_BTYPE); int BKind = reader.GetByte(ordinalITEM_BKIND); if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape || BType == (byte)bType.Mirror) { if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon) { b = new Sword(); } if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon) { b = new Blade(); } if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon) { b = new Fan(); } if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon) { b = new Brush(); } if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon) { b = new Claw(); } if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon) { b = new Axe(); } if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon) { b = new Talon(); } if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon) { b = new Tonfa(); } if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes) { b = new Clothes(); } if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes) { b = new Dress(); } if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes) { b = new Armor(); } if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes) { b = new LeatherClothes(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat) { b = new Hood(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat) { b = new Tiara(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat) { b = new Helmet(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat) { b = new Hat(); } if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes) { b = new SmBoots(); } if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes) { b = new MageBoots(); } if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes) { b = new WarriorShoes(); } if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes) { b = new GhostFighterShoes(); } if (BKind == 0 && BType == (byte)bType.Ring) { b = new Ring(); } if (BKind == 0 && BType == (byte)bType.Necklace) { b = new Necklace(); } if (BType == (byte)bType.Cape) { b = new Cape(); Cape c = b as Cape; c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES); c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES); c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1); c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1); c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2); c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2); c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3); c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3); c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4); c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4); } if (BType == (byte)bType.Mirror) { // bkind 4 = mirror, 0 = jar b = new Mirror(); Mirror m = b as Mirror; m.PetID = reader.GetInt32(ordinalITEM_PETID); m.LifeAbsorb = reader.GetInt16(ordinalITEM_LIFEABSORB); m.DamageAbsorb = reader.GetInt16(ordinalITEM_DAMAGEABSORB); m.DefenseAbsorb = reader.GetInt16(ordinalITEM_DEFENSEABSORB); m.AttackRatingAbsorb = reader.GetInt16(ordinalITEM_ATTACKRATINGABSORB); } Equipment e = b as Equipment; e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX); e.RequiredStrength = reader.GetInt16(ordinalITEM_STR); e.RequiredStamina = reader.GetInt16(ordinalITEM_STA); e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE); e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES); e.Durability = reader.GetInt16(ordinalITEM_CURDURA); e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA); e.Damage = reader.GetInt32(ordinalITEM_DAMAGE); e.Defence = reader.GetInt32(ordinalITEM_DEFENCE); e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING); e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED); e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE); e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA); e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN); e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN); e.Critical = reader.GetInt16(ordinalITEM_CRITICAL); e.Plus = reader.GetByte(ordinalITEM_PLUS); e.Slvl = reader.GetByte(ordinalITEM_SLVL); e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES); e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES); e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE); e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES); e.DragonDamage = reader.GetInt32(ordinalITEM_DRAGONDAMAGE); e.DragonDefence = reader.GetInt32(ordinalITEM_DRAGONDEFENCE); e.DragonAttackRating = reader.GetInt32(ordinalITEM_DRAGONATTACKRATING); e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE); e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF); e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER); e.RebirthHole = reader.GetInt16(ordinalITEM_REBIRTHHOLE); e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT); } if (BType == (byte)bType.ImbueItem) { if (BKind == (byte)bKindStones.Black) { b = new Black(); } if (BKind == (byte)bKindStones.White) { b = new White(); } if (BKind == (byte)bKindStones.Red) { b = new Red(); } if (BKind == (byte)bKindStones.Dragon) { b = new Dragon(); } if (BKind == (byte)bKindStones.RbItem) { b = new RbHoleItem(); } ImbueItem im = b as ImbueItem; im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE); im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE); im.ImbueData = reader.GetByte(ordinalITEM_IMBUEDATA); } if (BType == (byte)bType.Potion) { if (BKind == (byte)bKindPotions.Normal) { b = new Potion(); } if (BKind == (byte)bKindPotions.Elixir) { b = new Elixir(); } PotionItem pot = b as PotionItem; pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE); pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA); } if (BType == (byte)bType.Book) { if (BKind == (byte)bKindBooks.SoftBook) { b = new SoftBook(); } if (BKind == (byte)bKindBooks.HardBook) { b = new HardBook(); } if (BKind == (byte)bKindBooks.RebirdBook) { b = new RebirthBook(); } if (BKind == (byte)bKindBooks.FourthBook) { b = new FourthBook(); } if (BKind == (byte)bKindBooks.FeSkillBook) { b = new FeSkillBook(); } if (BKind == (byte)bKindBooks.FeBook) { b = new FiveElementBook(); } if (BKind == (byte)bKindBooks.FocusBook) { b = new FocusBook(); } BookItem book = b as BookItem; book.RequiredClass = reader.GetByte(ordinalITEM_CLASS); book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID); book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL); book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA); } if (BType == (byte)bType.Bead) { if (BKind == (byte)bKindBeads.Normal) { b = new Bead(); } BeadItem bead = b as BeadItem; bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID); } if (BType == (byte)bType.StoreTag) { b = new StoreTag(); StoreTag tag = b as StoreTag; tag.TimeLeft = reader.GetInt16(ordinalITEM_CURDURA); tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA); } if (BType == (byte)bType.PetItem) { if (BKind == (byte)bKindPetItems.Taming) b = new TameItem(); if (BKind == (byte)bKindPetItems.Food) b = new PetFood(); if (BKind == (byte)bKindPetItems.Potion) b = new PetPotion(); if (BKind == (byte)bKindPetItems.Resurect) b = new PetResurrectItem(); PetItem p = b as PetItem; p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE); p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE); p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE); } if (BType == (byte)bType.Pill) { if (BKind == (byte)bKindPills.Rebirth) b = new RebirthPill(); RebirthPill p = b as RebirthPill; p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL); p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS); p.ToRebirth = (byte)(p.RequiredRebirth + 1); p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX); } b.ItemID = reader.GetInt32(ordinalITEM_ITEMID); b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID); b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID); b.VisualID = reader.GetInt16(ordinalITEM_VISUALID); b.Bag = reader.GetByte(ordinalITEM_BAG); b.Slot = reader.GetByte(ordinalITEM_SLOT); b.bType = reader.GetByte(ordinalITEM_BTYPE); b.bKind = reader.GetByte(ordinalITEM_BKIND); b.RequiredClass = reader.GetByte(ordinalITEM_CLASS); b.Amount = reader.GetInt16(ordinalITEM_AMOUNT); b.SizeX = reader.GetByte(ordinalITEM_SIZEX); b.SizeY = reader.GetByte(ordinalITEM_SIZEY); b.Price = reader.GetInt32(ordinalITEM_COST); items.Add(b); } reader.Close(); _db.Close(); return items; }
static void Main(string[] args) { Necklace blah = new Necklace(); Console.Out.WriteLine(blah.inequity(1, new int[] {})); Console.In.ReadLine(); }