public ItemInstance Remove(ItemLocation location, byte quantity) { ItemInstance item = _character.itemLocationVerifier.GetItem(location); ulong instanceId = item.instanceId; if (item is null) { throw new ItemException(ItemExceptionType.Generic); } if (item.quantity < quantity) { throw new ItemException(ItemExceptionType.Amount); } item.quantity -= quantity; if (item.quantity == 0) { _itemDao.DeleteItemInstance(instanceId); _character.itemLocationVerifier.RemoveItem(item); } else { ulong[] instanceIds = new ulong[1]; byte[] quantities = new byte[1]; instanceIds[0] = instanceId; quantities[0] = item.quantity; _itemDao.UpdateItemQuantities(instanceIds, quantities); } return(item); }
/// <summary> /// Used when the there is no item already in the end location and the quantity moved is less than total quantity of /// items in the original location. /// </summary> /// <param name="to">Move to this location.</param> /// <param name="fromItem">Move a quantity from this item.</param> /// <returns> /// Result containing the original item with less quantity and a new instance with the remaining amount at the /// destination. /// </returns> private MoveResult MoveItemPlaceQuantity(ItemLocation to, ItemInstance fromItem, byte quantity) { MoveResult moveResult = new MoveResult(MoveType.PlaceQuantity); moveResult.originItem = fromItem; moveResult.originItem.quantity -= quantity; ItemSpawnParams spawnParam = new ItemSpawnParams(); spawnParam.quantity = quantity; spawnParam.itemStatuses = moveResult.originItem.statuses; const int SIZE = 1; ItemLocation[] locs = new ItemLocation[SIZE]; int[] baseIds = new int[SIZE]; ItemSpawnParams[] spawnParams = new ItemSpawnParams[SIZE]; locs[0] = to; baseIds[0] = moveResult.originItem.baseId; spawnParams[0] = spawnParam; List <ItemInstance> insertedItem = _itemDao.InsertItemInstances(fromItem.ownerId, locs, baseIds, spawnParams); _character.itemLocationVerifier.PutItem(to, insertedItem[0]); moveResult.destItem = insertedItem[0]; return(moveResult); }
public ItemInstance GetItem(ItemLocation loc) { if (loc.Equals(ItemLocation.InvalidLocation)) { return(null); } return(_zoneMap[loc.zoneType].GetContainer(loc.container).GetItem(loc.slot)); }
public ItemInstance RemoveItem(ItemLocation loc) { ItemInstance item = GetItem(loc); if (item != null) { RemoveItem(item); } return(item); }
public ItemLocation PutItemInNextOpenSlot(ItemZoneType itemZoneType, ItemInstance item) { ItemLocation nextOpenSlot = NextOpenSlot(itemZoneType); if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation)) { PutItem(nextOpenSlot, item); } return(nextOpenSlot); }
public void UpdateItemLocation(ulong instanceId, ItemLocation loc) { ulong[] instanceIds = new ulong[1] { instanceId }; ItemLocation[] locs = new ItemLocation[1] { loc }; UpdateItemLocations(instanceIds, locs); }
internal ItemInstance GetLootedItem(ItemLocation location) { ItemInstance item = _character.itemLocationVerifier.GetItem(location); if (item.currentEquipSlot != ItemEquipSlots.None) { Unequip(item.currentEquipSlot); } return(item); }
internal ItemInstance GetIdentifiedItem(ItemLocation location) { ItemInstance item = _character.itemLocationVerifier.GetItem(location); if (item.statuses.HasFlag(ItemStatuses.Unidentified)) { item.statuses &= ~ItemStatuses.Unidentified; } _itemDao.UpdateItemOwnerAndStatus(item.instanceId, _character.id, (int)item.statuses); return(item); }
/// <summary> /// Used when the there is no item already in the end location and the quantity moved is equal to the total quantity of /// items in the original location. /// </summary> /// <param name="to">Move to this location.</param> /// <param name="fromItem">Move this item.</param> /// <returns>Result with origin item null and the destination the moved item.</returns> private MoveResult MoveItemPlace(ItemLocation to, ItemInstance fromItem) { MoveResult moveResult = new MoveResult(MoveType.Place); _character.itemLocationVerifier.PutItem(to, fromItem); moveResult.destItem = fromItem; ulong[] instanceIds = new ulong[1]; ItemLocation[] locs = new ItemLocation[1]; instanceIds[0] = moveResult.destItem.instanceId; locs[0] = moveResult.destItem.location; _itemDao.UpdateItemLocations(instanceIds, locs); return(moveResult); }
public MoveResult Move(ItemLocation from, ItemLocation to, byte quantity) { ItemInstance fromItem = _character.itemLocationVerifier.GetItem(from); bool hasToItem = _character.itemLocationVerifier.HasItem(to); ItemInstance toItem = _character.itemLocationVerifier.GetItem(to); MoveResult moveResult = new MoveResult(); //check possible errors. these should only occur if client is compromised if (fromItem is null || quantity == 0) { throw new ItemException(ItemExceptionType.Generic); } if (quantity > fromItem.quantity) { throw new ItemException(ItemExceptionType.Amount); } if (quantity > 1 && quantity < fromItem.quantity && hasToItem && toItem.baseId != fromItem.baseId) { throw new ItemException(ItemExceptionType.BagLocation); } if (fromItem.location.zoneType == ItemZoneType.BagSlot && !_character.itemLocationVerifier.IsEmptyContainer(ItemZoneType.EquippedBags, fromItem.location.slot)) { throw new ItemException(ItemExceptionType.BagLocation); } if (!hasToItem && quantity == fromItem.quantity) { moveResult = MoveItemPlace(to, fromItem); } else if (!hasToItem && quantity < fromItem.quantity) { moveResult = MoveItemPlaceQuantity(to, fromItem, quantity); } else if (hasToItem && quantity == fromItem.quantity && (fromItem.baseId != toItem.baseId || fromItem.quantity == fromItem.maxStackSize)) { moveResult = MoveItemSwap(from, to, fromItem, toItem); } else if (hasToItem && quantity < fromItem.quantity && toItem.baseId == fromItem.baseId) { moveResult = MoveItemAddQuantity(fromItem, toItem, quantity); } else if (hasToItem && quantity == fromItem.quantity && toItem.baseId == fromItem.baseId && quantity <= toItem.maxStackSize - toItem.quantity) { moveResult = MoveItemAllQuantity(fromItem, toItem, quantity); } return(moveResult); }
public ItemInstance Equip(ItemLocation location, ItemEquipSlots equipSlot) { ItemInstance item = _character.itemLocationVerifier.GetItem(location); item.currentEquipSlot = equipSlot; if (_character.equippedItems.ContainsKey(equipSlot)) { _character.equippedItems[equipSlot] = item; } else { _character.equippedItems.Add(equipSlot, item); } _itemDao.UpdateItemEquipMask(item.instanceId, equipSlot); return(item); }
public bool HasItem(ItemLocation loc) { if (!_zoneMap.ContainsKey(loc.zoneType)) { return(false); } if (_zoneMap[loc.zoneType].GetContainer(loc.container) == null) { return(false); } if (_zoneMap[loc.zoneType].GetContainer(loc.container).GetItem(loc.slot) == null) { return(false); } return(true); }
public ItemLocation NextOpenSlot(ItemZoneType itemZoneType) { int nextContainerWithSpace = _zoneMap[itemZoneType].nextContainerWithSpace; if (nextContainerWithSpace != ItemZone.NO_CONTAINERS_WITH_SPACE) { int nextOpenSlot = _zoneMap[itemZoneType].GetContainer(nextContainerWithSpace).nextOpenSlot; if (nextOpenSlot != Container.NO_OPEN_SLOTS) { ItemLocation itemLocation = new ItemLocation(itemZoneType, (byte)nextContainerWithSpace, (short)nextOpenSlot); return(itemLocation); } } return(ItemLocation.InvalidLocation); }
/// <summary> /// Used when the there is an item already in the end location,the quantity moved is equal to the total quantity<br /> /// of items in the original location, and the item at the end location is a different base item or stacked full. /// </summary> /// <param name="from">Swap back to this location.</param> /// <param name="to">Move to this location.</param> /// <param name="fromItem">Move this item.</param> /// <param name="toItem">Swap this item.</param> /// <returns>Result with the origin item and destination item being the swapped items.</returns> private MoveResult MoveItemSwap(ItemLocation from, ItemLocation to, ItemInstance fromItem, ItemInstance toItem) { MoveResult moveResult = new MoveResult(MoveType.Swap); _character.itemLocationVerifier.PutItem(to, fromItem); _character.itemLocationVerifier.PutItem(from, toItem); moveResult.destItem = fromItem; moveResult.originItem = toItem; ulong[] instanceIds = new ulong[2]; ItemLocation[] locs = new ItemLocation[2]; instanceIds[0] = moveResult.originItem.instanceId; locs[0] = moveResult.originItem.location; instanceIds[1] = moveResult.destItem.instanceId; locs[1] = moveResult.destItem.location; _itemDao.UpdateItemLocations(instanceIds, locs); return(moveResult); }
/// <summary> /// </summary> /// <returns>A list of items in your adventure bag, equipped bags, bag slot, premium bag, and avatar inventory.</returns> public List <ItemInstance> LoadOwneditemInstances(NecServer server) { //Clear Equipped Items from send_data_get_self_chara_data_request _character.equippedItems.Clear(); List <ItemInstance> ownedItems = _itemDao.SelectOwnedInventoryItems(_character.id); //load bags first foreach (ItemInstance item in ownedItems) { if (item.location.zoneType == ItemZoneType.BagSlot) { ItemLocation location = item.location; //only needed on load inventory because item's location is already populated and it is not in the manager item.location = ItemLocation.InvalidLocation; //only needed on load inventory because item's location is already populated and it is not in the manager _character.itemLocationVerifier.PutItem(location, item); } } foreach (ItemInstance itemInstance in ownedItems) { if (itemInstance.location.slot < 0) //remove invalid db rows on login. { _itemDao.DeleteItemInstance(itemInstance.instanceId); continue; } if (itemInstance.location.zoneType != ItemZoneType.BagSlot) { ItemLocation location = itemInstance.location; //only needed on load inventory because item's location is already populated and it is not in the manager itemInstance.location = ItemLocation.InvalidLocation; //only needed on load inventory because item's location is already populated and it is not in the manager _character.itemLocationVerifier.PutItem(location, itemInstance); } if (itemInstance.currentEquipSlot != ItemEquipSlots.None) { _character.equippedItems.Add(itemInstance.currentEquipSlot, itemInstance); } } return(ownedItems); }
/// <summary> /// Finds the next open slot in adventure bag, equipped bags, and premium bag, in that order. /// </summary> /// <returns></returns> public ItemLocation NextOpenSlotInInventory() { ItemLocation nextOpenSlot = ItemLocation.InvalidLocation; nextOpenSlot = NextOpenSlot(ItemZoneType.AdventureBag); if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation)) { return(nextOpenSlot); } nextOpenSlot = NextOpenSlot(ItemZoneType.EquippedBags); if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation)) { return(nextOpenSlot); } nextOpenSlot = NextOpenSlot(ItemZoneType.PremiumBag); if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation)) { return(nextOpenSlot); } return(nextOpenSlot); }
public void PutItem(ItemLocation loc, ItemInstance item) { RemoveItem(item); item.location = loc; switch (loc.zoneType) { case ItemZoneType.BagSlot: { _zoneMap[ItemZoneType.EquippedBags].PutContainer(loc.slot, item.bagSize); _zoneMap[loc.zoneType].GetContainer(loc.container).PutItem(loc.slot, item); break; } default: { _zoneMap[loc.zoneType].GetContainer(loc.container).PutItem(loc.slot, item); break; } } }
public MoveResult CancelExhibit(byte slot) { //TODO don't allow cancelling auctions with bids ItemLocation itemLocation = new ItemLocation(ItemZoneType.ProbablyAuctionLots, 0, slot); ItemInstance fromItem = _character.itemLocationVerifier.GetItem(itemLocation); ItemLocation nextOpenSlot = _character.itemLocationVerifier.NextOpenSlotInInventory(); //check possible errors. these should only occur if client is compromised if (fromItem is null || nextOpenSlot.Equals(ItemLocation.InvalidLocation)) { throw new AuctionException(AuctionExceptionType.Generic); } if (fromItem.bidderSoulId > 0) { throw new AuctionException(AuctionExceptionType.BiddingCompleted); } MoveResult moveResult = MoveItemPlace(nextOpenSlot, fromItem); _itemDao.UpdateAuctionCancelExhibit(fromItem.instanceId); return(moveResult); }
//auction functions public MoveResult Exhibit(ItemLocation itemLocation, byte exhibitSlot, byte quantity, int auctionTimeSelector, ulong minBid, ulong buyoutPrice, string comment) { const int MAX_LOTS = 10; //TODO update with dimento? ItemInstance fromItem = _character.itemLocationVerifier.GetItem(itemLocation); ItemLocation exhibitLocation = new ItemLocation(ItemZoneType.ProbablyAuctionLots, 0, exhibitSlot); bool hasToItem = _character.itemLocationVerifier.HasItem(exhibitLocation); MoveResult moveResult = new MoveResult(); //check possible errors. these should only occur if client is compromised if (hasToItem) { throw new AuctionException(AuctionExceptionType.InvalidListing); } //if (currentNumLots >= MAX_LOTS) throw new AuctionException(AuctionExceptionType.LotSlotsFull); //TODO check later if too many slots if (_character.equippedItems.ContainsValue(fromItem)) { throw new AuctionException(AuctionExceptionType.EquipListing); //TODO Might not work because equipment hasn't been fleshed out } //if (false) throw new AuctionException(AuctionExceptionType.InvalidListing); //TODO CHECK IF INVALID ITEM like protect or no trade //if (false) throw new AuctionException(AuctionExceptionType.LotDimentoMedalExpired); //TODO CHECK DIMETO MEDAL ROYAL ACCOUNT STATUS //if (false) throw new AuctionException(AuctionExceptionType.ItemAlreadyListed); //TODO CHECK ITEM ALREADY_LISTED items must have a unique instance ID! if (fromItem is null || quantity == 0) { throw new AuctionException(AuctionExceptionType.Generic); } if (quantity > fromItem.quantity) { throw new AuctionException(AuctionExceptionType.IllegalItemAmount); } //int gold = _auctionDao.SelectGold(_client.Character); //TODO CHECK GOLD AMOUNT AND SUBTRACT, WAIT FOR UTIL FUNCTION //InventoryService iManager = new InventoryService(_client); //remove this //iManager.SubtractGold((int) Math.Ceiling(auctionItem.BuyoutPrice * LISTING_FEE_PERCENT)); if (quantity == fromItem.quantity) { moveResult = MoveItemPlace(exhibitLocation, fromItem); } else if (quantity < fromItem.quantity) { moveResult = MoveItemPlaceQuantity(exhibitLocation, fromItem, quantity); } moveResult.destItem.consignerSoulName = _character.name; moveResult.destItem.minimumBid = minBid; moveResult.destItem.buyoutPrice = buyoutPrice; moveResult.destItem.comment = comment; int auctionTimeInSecondsFromNow = 0; const int SECONDS_PER_FOUR_HOURS = 60 * 60 * 4; switch (auctionTimeSelector) //TODO something not working { case 0: // 4 hours auctionTimeInSecondsFromNow = SECONDS_PER_FOUR_HOURS; break; case 1: // 8 hours auctionTimeInSecondsFromNow = SECONDS_PER_FOUR_HOURS * 2; break; case 2: // 12 hours auctionTimeInSecondsFromNow = SECONDS_PER_FOUR_HOURS * 3; break; case 3: // 24 hours auctionTimeInSecondsFromNow = SECONDS_PER_FOUR_HOURS * 6; break; } moveResult.destItem.secondsUntilExpiryTime = auctionTimeInSecondsFromNow; _itemDao.UpdateAuctionExhibit(moveResult.destItem); return(moveResult); }
public ulong Sell(ItemLocation location, byte quantity) { throw new NotImplementedException(); }
internal ItemInstance GetItem(ItemLocation location) { return(_character.itemLocationVerifier.GetItem(location)); }
private ItemInstance MakeItemInstance(DbDataReader reader) { ulong instanceId = (ulong)reader.GetInt64("id"); ItemInstance itemInstance = new ItemInstance(instanceId); itemInstance.ownerId = reader.GetInt32("owner_id"); ItemZoneType zone = (ItemZoneType)reader.GetByte("zone"); byte bag = reader.GetByte("container"); short slot = reader.GetInt16("slot"); ItemLocation itemLocation = new ItemLocation(zone, bag, slot); itemInstance.location = itemLocation; itemInstance.baseId = reader.GetInt32("base_id"); itemInstance.quantity = reader.GetByte("quantity"); itemInstance.statuses = (ItemStatuses)reader.GetInt32("statuses"); itemInstance.currentEquipSlot = (ItemEquipSlots)reader.GetInt32("current_equip_slot"); itemInstance.currentDurability = reader.GetInt32("current_durability"); itemInstance.maximumDurability = reader.GetInt32("plus_maximum_durability"); if (itemInstance.maximumDurability == 0) { itemInstance.maximumDurability = 10; //toDo update item library. items shouldnt have 0 for core stats } itemInstance.enhancementLevel = reader.GetByte("enhancement_level"); itemInstance.specialForgeLevel = reader.GetByte("special_forge_level"); itemInstance.physical = reader.GetInt16("physical"); itemInstance.magical = reader.GetInt16("magical"); itemInstance.hardness = reader.GetByte("hardness"); itemInstance.plusPhysical = reader.GetInt16("plus_physical"); itemInstance.plusMagical = reader.GetInt16("plus_magical"); itemInstance.plusGp = reader.GetInt16("plus_gp"); itemInstance.plusWeight = (short)(reader.GetInt16("plus_weight") * 10); //TODO REMOVE THIS MULTIPLICATION AND FIX TRHOUGHOUT CODE itemInstance.plusRangedEff = reader.GetInt16("plus_ranged_eff"); itemInstance.plusReservoirEff = reader.GetInt16("plus_reservoir_eff"); int gemSlotNum = 0; int gemSlot1Type = reader.GetByte("gem_slot_1_type"); if (gemSlot1Type != 0) { gemSlotNum++; } int gemSlot2Type = reader.GetByte("gem_slot_2_type"); if (gemSlot2Type != 0) { gemSlotNum++; } int gemSlot3Type = reader.GetByte("gem_slot_3_type"); if (gemSlot3Type != 0) { gemSlotNum++; } GemSlot[] gemSlot = new GemSlot[gemSlotNum]; itemInstance.enchantId = reader.GetInt32("enchant_id"); itemInstance.gp = reader.GetInt16("plus_gp"); itemInstance.type = (ItemType)Enum.Parse(typeof(ItemType), reader.GetString("item_type")); itemInstance.quality = (ItemQualities)Enum.Parse(typeof(ItemQualities), reader.GetString("quality"), true); itemInstance.maxStackSize = reader.GetByte("max_stack_size"); if (reader.GetBoolean("es_hand_r")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.RightHand; } if (reader.GetBoolean("es_hand_l")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.LeftHand; } if (reader.GetBoolean("es_quiver")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Quiver; } if (reader.GetBoolean("es_head")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Head; } if (reader.GetBoolean("es_body")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Torso; } if (reader.GetBoolean("es_legs")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Legs; } if (reader.GetBoolean("es_arms")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Arms; } if (reader.GetBoolean("es_feet")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Feet; } if (reader.GetBoolean("es_mantle")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Cloak; } if (reader.GetBoolean("es_ring")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Ring; } if (reader.GetBoolean("es_earring")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Earring; } if (reader.GetBoolean("es_necklace")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Necklace; } if (reader.GetBoolean("es_belt")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Belt; } if (reader.GetBoolean("es_talkring")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.Talkring; } if (reader.GetBoolean("es_avatar_head")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.AvatarHead; } if (reader.GetBoolean("es_avatar_body")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.AvatarTorso; } if (reader.GetBoolean("es_avatar_legs")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.AvatarLegs; } if (reader.GetBoolean("es_avatar_arms")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.AvatarArms; } if (reader.GetBoolean("es_avatar_feet")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.AvatarFeet; } if (reader.GetBoolean("es_avatar_feet")) { itemInstance.equipAllowedSlots |= ItemEquipSlots.AvatarCloak; } if (reader.GetBoolean("req_hum_m")) { itemInstance.requiredRaces |= Races.HumanMale; } if (reader.GetBoolean("req_hum_f")) { itemInstance.requiredRaces |= Races.HumanFemale; } if (reader.GetBoolean("req_elf_m")) { itemInstance.requiredRaces |= Races.ElfMale; } if (reader.GetBoolean("req_elf_f")) { itemInstance.requiredRaces |= Races.ElfFemale; } if (reader.GetBoolean("req_dwf_m")) { itemInstance.requiredRaces |= Races.DwarfMale; } if (reader.GetBoolean("req_por_m")) { itemInstance.requiredRaces |= Races.PorkulMale; } if (reader.GetBoolean("req_por_f")) { itemInstance.requiredRaces |= Races.PorkulFemale; } if (reader.GetBoolean("req_gnm_f")) { itemInstance.requiredRaces |= Races.GnomeFemale; } if (reader.GetBoolean("req_fighter")) { itemInstance.requiredClasses |= Classes.Fighter; } if (reader.GetBoolean("req_thief")) { itemInstance.requiredClasses |= Classes.Thief; } if (reader.GetBoolean("req_mage")) { itemInstance.requiredClasses |= Classes.Mage; } if (reader.GetBoolean("req_priest")) { itemInstance.requiredClasses |= Classes.Priest; } if (reader.GetBoolean("req_samurai")) { itemInstance.requiredClasses |= Classes.Samurai; } if (reader.GetBoolean("req_bishop")) { itemInstance.requiredClasses |= Classes.Bishop; } if (reader.GetBoolean("req_ninja")) { itemInstance.requiredClasses |= Classes.Ninja; } if (reader.GetBoolean("req_lord")) { itemInstance.requiredClasses |= Classes.Lord; } if (reader.GetBoolean("req_clown")) { itemInstance.requiredClasses |= Classes.Clown; } if (reader.GetBoolean("req_alchemist")) { itemInstance.requiredClasses |= Classes.Alchemist; } if (reader.GetBoolean("req_lawful")) { itemInstance.requiredAlignments |= Alignments.Lawful; } if (reader.GetBoolean("req_neutral")) { itemInstance.requiredAlignments |= Alignments.Neutral; } if (reader.GetBoolean("req_chaotic")) { itemInstance.requiredAlignments |= Alignments.Chaotic; } itemInstance.requiredStrength = reader.GetByte("req_str"); itemInstance.requiredVitality = reader.GetByte("req_vit"); itemInstance.requiredDexterity = reader.GetByte("req_dex"); itemInstance.requiredAgility = reader.GetByte("req_agi"); itemInstance.requiredIntelligence = reader.GetByte("req_int"); itemInstance.requiredPiety = reader.GetByte("req_pie"); itemInstance.requiredLuck = reader.GetByte("req_luk"); itemInstance.requiredSoulRank = reader.GetByte("req_soul_rank"); //todo max soul rank itemInstance.requiredLevel = reader.GetByte("req_lvl"); itemInstance.physicalSlash = reader.GetByte("phys_slash"); itemInstance.physicalStrike = reader.GetByte("phys_strike"); itemInstance.physicalPierce = reader.GetByte("phys_pierce"); itemInstance.physicalDefenseFire = reader.GetByte("pdef_fire"); itemInstance.physicalDefenseWater = reader.GetByte("pdef_water"); itemInstance.physicalDefenseWind = reader.GetByte("pdef_wind"); itemInstance.physicalDefenseEarth = reader.GetByte("pdef_earth"); itemInstance.physicalDefenseLight = reader.GetByte("pdef_light"); itemInstance.physicalDefenseDark = reader.GetByte("pdef_dark"); itemInstance.magicalAttackFire = reader.GetByte("matk_fire"); itemInstance.magicalAttackWater = reader.GetByte("matk_water"); itemInstance.magicalAttackWind = reader.GetByte("matk_wind"); itemInstance.magicalAttackEarth = reader.GetByte("matk_earth"); itemInstance.magicalAttackLight = reader.GetByte("matk_light"); itemInstance.magicalAttackDark = reader.GetByte("matk_dark"); itemInstance.hp = reader.GetByte("seffect_hp"); itemInstance.mp = reader.GetByte("seffect_mp"); itemInstance.str = reader.GetByte("seffect_str"); itemInstance.vit = reader.GetByte("seffect_vit"); itemInstance.dex = reader.GetByte("seffect_dex"); itemInstance.agi = reader.GetByte("seffect_agi"); itemInstance.@int = reader.GetByte("seffect_int"); itemInstance.pie = reader.GetByte("seffect_pie"); itemInstance.luk = reader.GetByte("seffect_luk"); itemInstance.resistPoison = reader.GetByte("res_poison"); itemInstance.resistParalyze = reader.GetByte("res_paralyze"); itemInstance.resistPetrified = reader.GetByte("res_petrified"); itemInstance.resistFaint = reader.GetByte("res_faint"); itemInstance.resistBlind = reader.GetByte("res_blind"); itemInstance.resistSleep = reader.GetByte("res_sleep"); itemInstance.resistSilence = reader.GetByte("res_silent"); itemInstance.resistCharm = reader.GetByte("res_charm"); itemInstance.resistConfusion = reader.GetByte("res_confusion"); itemInstance.resistFear = reader.GetByte("res_fear"); //itemInstance.StatusMalus = (ItemStatusEffect)Enum.Parse(typeof(ItemStatusEffect), reader.GetString("status_malus")); itemInstance.statusMalusPercent = reader.GetInt32("status_percent"); itemInstance.objectType = reader.GetString("object_type"); //not sure what this is for itemInstance.equipSlot2 = reader.GetString("equip_slot"); //not sure what this is for itemInstance.isUseableInTown = !reader.GetBoolean("no_use_in_town"); //not sure what this is for itemInstance.isStorable = !reader.GetBoolean("no_storage"); itemInstance.isDiscardable = !reader.GetBoolean("no_discard"); itemInstance.isSellable = !reader.GetBoolean("no_sell"); itemInstance.isTradeable = !reader.GetBoolean("no_trade"); itemInstance.isTradableAfterUse = !reader.GetBoolean("no_trade_after_used"); itemInstance.isStealable = !reader.GetBoolean("no_stolen"); itemInstance.isGoldBorder = reader.GetBoolean("gold_border"); //itemInstance.Lore = reader.GetString("lore"); itemInstance.iconId = reader.GetInt32("icon"); itemInstance.talkRingName = ""; //TODO fix all the data types once mysql is implemented itemInstance.bagSize = reader.GetByte("num_of_bag_slots"); //grade, //weight itemInstance.weight = (int)(reader.GetDouble("weight") * 10000); // TODO DOUBLE CHECK THIS IS CORRECT SCALE //auction itemInstance.consignerSoulName = reader.IsDBNull("consigner_soul_name") ? "" : reader.GetString("consigner_soul_name"); itemInstance.secondsUntilExpiryTime = reader.IsDBNull("expiry_datetime") ? 0 : CalcSecondsToExpiry(reader.GetInt64("expiry_datetime")); itemInstance.minimumBid = reader.IsDBNull("min_bid") ? 0 : (ulong)reader.GetInt64("min_bid"); itemInstance.buyoutPrice = reader.IsDBNull("buyout_price") ? 0 : (ulong)reader.GetInt64("buyout_price"); itemInstance.comment = reader.IsDBNull("comment") ? "" : reader.GetString("comment"); //enhancement itemInstance = CalcEnhancement(itemInstance); return(itemInstance); }
public ItemInstance SelectItemInstance(int characterId, ItemLocation itemLocation) { throw new NotImplementedException(); }