diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-12-21 13:35:43 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-12-21 13:35:43 +0100 |
commit | 6dbb516b651d5d4b1988c7f450b25136b9d28a2e (patch) | |
tree | c93bee9c6b5bea94ea403b29089704c308b878f8 /src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp | |
parent | 77dc1b00dbf9baedf1785232c83d31e77d7936b3 (diff) |
Core/Items: Refactored ItemTemplate
Diffstat (limited to 'src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp')
-rw-r--r-- | src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp index f17e0efda17..70d88fd397c 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp @@ -115,7 +115,7 @@ bool AuctionBotSeller::Initialize() continue; // skip items with too high quality (code can't properly work with its) - if (prototype->Quality >= MAX_AUCTION_QUALITY) + if (prototype->GetQuality() >= MAX_AUCTION_QUALITY) continue; // forced exclude filter @@ -135,13 +135,13 @@ bool AuctionBotSeller::Initialize() if (isForcedIncludeItem) { - _itemPool[prototype->Quality][prototype->Class].push_back(itemId); + _itemPool[prototype->GetQuality()][prototype->GetClass()].push_back(itemId); ++itemsAdded; continue; } // bounding filters - switch (prototype->Bonding) + switch (prototype->GetBonding()) { case NO_BIND: if (!sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BIND_NO)) @@ -168,7 +168,7 @@ bool AuctionBotSeller::Initialize() } bool allowZero = false; - switch (prototype->Class) + switch (prototype->GetClass()) { case ITEM_CLASS_CONSUMABLE: allowZero = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_CONSUMABLE_ALLOW_ZERO); break; @@ -207,12 +207,12 @@ bool AuctionBotSeller::Initialize() { if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_SELLER)) { - if (prototype->SellPrice == 0) + if (prototype->GetSellPrice() == 0) continue; } else { - if (prototype->BuyPrice == 0) + if (prototype->GetBuyPrice() == 0) continue; } } @@ -260,28 +260,28 @@ bool AuctionBotSeller::Initialize() } // item class/subclass specific filters - switch (prototype->Class) + switch (prototype->GetClass()) { case ITEM_CLASS_ARMOR: case ITEM_CLASS_WEAPON: { if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MIN_ITEM_LEVEL)) - if (prototype->ItemLevel < value) + if (prototype->GetBaseItemLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MAX_ITEM_LEVEL)) - if (prototype->ItemLevel > value) + if (prototype->GetBaseItemLevel() > value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MIN_REQ_LEVEL)) - if (prototype->RequiredLevel < value) + if (prototype->GetRequiredLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MAX_REQ_LEVEL)) - if (prototype->RequiredLevel > value) + if (prototype->GetRequiredLevel() > value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MIN_SKILL_RANK)) - if (prototype->RequiredSkillRank < value) + if (prototype->GetRequiredSkillRank() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MAX_SKILL_RANK)) - if (prototype->RequiredSkillRank > value) + if (prototype->GetRequiredSkillRank() > value) continue; break; } @@ -290,40 +290,40 @@ bool AuctionBotSeller::Initialize() case ITEM_CLASS_PROJECTILE: { if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MIN_REQ_LEVEL)) - if (prototype->RequiredLevel < value) + if (prototype->GetRequiredLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MAX_REQ_LEVEL)) - if (prototype->RequiredLevel > value) + if (prototype->GetRequiredLevel() > value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MIN_SKILL_RANK)) - if (prototype->RequiredSkillRank < value) + if (prototype->GetRequiredSkillRank() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEM_MAX_SKILL_RANK)) - if (prototype->RequiredSkillRank > value) + if (prototype->GetRequiredSkillRank() > value) continue; break; } case ITEM_CLASS_MISCELLANEOUS: - if (prototype->SubClass == ITEM_SUBCLASS_JUNK_MOUNT) + if (prototype->GetSubClass() == ITEM_SUBCLASS_JUNK_MOUNT) { if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL)) - if (prototype->RequiredLevel < value) + if (prototype->GetRequiredLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL)) - if (prototype->RequiredLevel > value) + if (prototype->GetRequiredLevel() > value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK)) - if (prototype->RequiredSkillRank < value) + if (prototype->GetRequiredSkillRank() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK)) - if (prototype->RequiredSkillRank > value) + if (prototype->GetRequiredSkillRank() > value) continue; } - if (prototype->Flags[0] & ITEM_FLAG_UNLOCKED) + if (prototype->GetFlags() & ITEM_FLAG_UNLOCKED) { // skip any not locked lootable items (mostly quest specific or reward cases) - if (!prototype->LockID) + if (!prototype->GetLockID()) continue; if (!sAuctionBotConfig->GetConfig(CONFIG_AHBOT_LOCKBOX_ENABLED)) @@ -334,26 +334,26 @@ bool AuctionBotSeller::Initialize() case ITEM_CLASS_GLYPH: { if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL)) - if (prototype->RequiredLevel < value) + if (prototype->GetRequiredLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL)) - if (prototype->RequiredLevel > value) + if (prototype->GetRequiredLevel() > value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL)) - if (prototype->RequiredLevel < value) + if (prototype->GetRequiredLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL)) - if (prototype->RequiredLevel > value) + if (prototype->GetRequiredLevel() > value) continue; break; } case ITEM_CLASS_TRADE_GOODS: { if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_MIN_ITEM_LEVEL)) - if (prototype->ItemLevel < value) + if (prototype->GetBaseItemLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL)) - if (prototype->ItemLevel > value) + if (prototype->GetBaseItemLevel() > value) continue; break; } @@ -361,16 +361,16 @@ bool AuctionBotSeller::Initialize() case ITEM_CLASS_QUIVER: { if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL)) - if (prototype->ItemLevel < value) + if (prototype->GetBaseItemLevel() < value) continue; if (uint32 value = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL)) - if (prototype->ItemLevel > value) + if (prototype->GetBaseItemLevel() > value) continue; break; } } - _itemPool[prototype->Quality][prototype->Class].push_back(itemId); + _itemPool[prototype->GetQuality()][prototype->GetClass()].push_back(itemId); ++itemsAdded; } @@ -624,7 +624,7 @@ uint32 AuctionBotSeller::SetStat(SellerConfiguration& config) ItemTemplate const* prototype = item->GetTemplate(); if (prototype) if (!auctionEntry->owner) // Add only ahbot items - ++itemsSaved[prototype->Quality][prototype->Class]; + ++itemsSaved[prototype->GetQuality()][prototype->GetClass()]; } } @@ -682,12 +682,12 @@ bool AuctionBotSeller::GetItemsToSell(SellerConfiguration& config, ItemsToSellAr // Set items price. All important value are passed by address. void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConfiguration& config, uint32& buyp, uint32& bidp, uint32 stackCount) { - uint32 classRatio = config.GetPriceRatioPerClass(ItemClass(itemProto->Class)); - uint32 qualityRatio = config.GetPriceRatioPerQuality(AuctionQuality(itemProto->Quality)); + uint32 classRatio = config.GetPriceRatioPerClass(ItemClass(itemProto->GetClass())); + uint32 qualityRatio = config.GetPriceRatioPerQuality(AuctionQuality(itemProto->GetQuality())); uint32 priceRatio = (classRatio * qualityRatio) / 100; - uint32 buyPrice = itemProto->BuyPrice; - uint32 sellPrice = itemProto->SellPrice; + uint32 buyPrice = itemProto->GetBuyPrice(); + uint32 sellPrice = itemProto->GetSellPrice(); if (buyPrice == 0) { @@ -695,9 +695,9 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf buyPrice = sellPrice * GetSellModifier(itemProto); else { - uint32 divisor = ((itemProto->Class == 2 || itemProto->Class == 4) ? 284 : 80); - uint32 tempLevel = (itemProto->ItemLevel == 0 ? 1 : itemProto->ItemLevel); - uint32 tempQuality = (itemProto->Quality == 0 ? 1 : itemProto->Quality); + uint32 divisor = ((itemProto->GetClass() == ITEM_CLASS_WEAPON || itemProto->GetClass() == ITEM_CLASS_ARMOR) ? 284 : 80); + uint32 tempLevel = (itemProto->GetBaseItemLevel() == 0 ? 1 : itemProto->GetBaseItemLevel()); + uint32 tempQuality = (itemProto->GetQuality() == 0 ? 1 : itemProto->GetQuality()); buyPrice = tempLevel * tempQuality * GetBuyModifier(itemProto)* tempLevel / divisor; } @@ -709,7 +709,7 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_SELLER)) buyPrice = sellPrice; - uint32 basePrice = (buyPrice * stackCount * priceRatio) / (itemProto->Class == 6 ? 200 : itemProto->BuyCount) / 100; + uint32 basePrice = (buyPrice * stackCount * priceRatio) / (itemProto->GetClass() == 6 ? 200 : itemProto->GetBuyCount()) / 100; uint32 range = basePrice * 0.04; buyp = urand(basePrice - range, basePrice + range) + 1; @@ -722,7 +722,7 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf // Determine the multiplier for the sell price of any weapon without a buy price. uint32 AuctionBotSeller::GetSellModifier(ItemTemplate const* prototype) { - switch (prototype->Class) + switch (prototype->GetClass()) { case ITEM_CLASS_WEAPON: case ITEM_CLASS_ARMOR: @@ -737,11 +737,11 @@ uint32 AuctionBotSeller::GetSellModifier(ItemTemplate const* prototype) // Return the modifier by which the item's level and quality will be modified by to derive a relatively accurate price. uint32 AuctionBotSeller::GetBuyModifier(ItemTemplate const* prototype) { - switch (prototype->Class) + switch (prototype->GetClass()) { case ITEM_CLASS_CONSUMABLE: { - switch (prototype->SubClass) + switch (prototype->GetSubClass()) { case ITEM_SUBCLASS_CONSUMABLE: return 100; @@ -759,7 +759,7 @@ uint32 AuctionBotSeller::GetBuyModifier(ItemTemplate const* prototype) } case ITEM_CLASS_WEAPON: { - switch (prototype->SubClass) + switch (prototype->GetSubClass()) { case ITEM_SUBCLASS_WEAPON_AXE: case ITEM_SUBCLASS_WEAPON_MACE: @@ -781,7 +781,7 @@ uint32 AuctionBotSeller::GetBuyModifier(ItemTemplate const* prototype) } case ITEM_CLASS_ARMOR: { - switch (prototype->SubClass) + switch (prototype->GetSubClass()) { case ITEM_SUBCLASS_ARMOR_MISCELLANEOUS: case ITEM_SUBCLASS_ARMOR_CLOTH: @@ -802,7 +802,7 @@ uint32 AuctionBotSeller::GetBuyModifier(ItemTemplate const* prototype) return 50; case ITEM_CLASS_TRADE_GOODS: { - switch (prototype->SubClass) + switch (prototype->GetSubClass()) { case ITEM_SUBCLASS_TRADE_GOODS: case ITEM_SUBCLASS_PARTS: |