aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp8
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp20
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBot.cpp4
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp4
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp96
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h2
-rw-r--r--src/server/game/Chat/ChatLink.cpp16
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp23
-rw-r--r--src/server/game/DataStores/DB2Stores.h3
-rw-r--r--src/server/game/DataStores/DB2Structure.h426
-rw-r--r--src/server/game/DataStores/DB2Utility.cpp153
-rw-r--r--src/server/game/DataStores/DB2Utility.h40
-rw-r--r--src/server/game/DataStores/DB2fmt.h2
-rw-r--r--src/server/game/DataStores/DBCStores.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp8
-rw-r--r--src/server/game/Entities/Creature/Creature.h4
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp2
-rw-r--r--src/server/game/Entities/Item/Container/Bag.cpp12
-rw-r--r--src/server/game/Entities/Item/Container/Bag.h4
-rw-r--r--src/server/game/Entities/Item/Item.cpp162
-rw-r--r--src/server/game/Entities/Item/Item.h12
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.cpp4
-rw-r--r--src/server/game/Entities/Item/ItemTemplate.cpp149
-rw-r--r--src/server/game/Entities/Item/ItemTemplate.h (renamed from src/server/game/Entities/Item/ItemPrototype.h)208
-rw-r--r--src/server/game/Entities/Player/Player.cpp354
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp8
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp382
-rw-r--r--src/server/game/Globals/ObjectMgr.h2
-rw-r--r--src/server/game/Groups/Group.cpp6
-rw-r--r--src/server/game/Guilds/Guild.cpp2
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp14
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp54
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp2
-rw-r--r--src/server/game/Handlers/LootHandler.cpp4
-rw-r--r--src/server/game/Handlers/MailHandler.cpp8
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp2
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp18
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp8
-rw-r--r--src/server/game/Loot/LootMgr.cpp36
-rw-r--r--src/server/game/Quests/QuestDef.cpp4
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.cpp4
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp4
-rw-r--r--src/server/game/Spells/Spell.cpp44
-rw-r--r--src/server/game/Spells/SpellEffects.cpp30
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp12
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp12
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp4
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp7
-rw-r--r--src/server/scripts/Commands/cs_send.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp12
-rw-r--r--src/server/scripts/World/npc_professions.cpp2
52 files changed, 968 insertions, 1435 deletions
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 35fb5ec4d76..fcafd9c6d01 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -364,7 +364,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(miscValue1);
if (!pProto)
return false;
- return pProto->ItemLevel >= equipped_item.item_level && pProto->Quality >= equipped_item.item_quality;
+ return pProto->GetBaseItemLevel() >= equipped_item.item_level && pProto->GetQuality() >= equipped_item.item_quality;
}
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID:
return source->GetMapId() == map_id.mapId;
@@ -2720,7 +2720,7 @@ bool AchievementMgr<T>::RequirementsSatisfied(AchievementCriteriaEntry const* ac
if (!miscValue1)
return false;
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(uint32(miscValue1));
- if (!proto || proto->Quality < ITEM_QUALITY_EPIC)
+ if (!proto || proto->GetQuality() < ITEM_QUALITY_EPIC)
return false;
break;
}
@@ -2800,7 +2800,7 @@ bool AchievementMgr<T>::AdditionalRequirementsSatisfied(AchievementCriteriaEntry
{
// miscValue1 is itemid
ItemTemplate const* const item = sObjectMgr->GetItemTemplate(uint32(miscValue1));
- if (!item || item->Quality < reqValue)
+ if (!item || item->GetQuality() < reqValue)
return false;
break;
}
@@ -2808,7 +2808,7 @@ bool AchievementMgr<T>::AdditionalRequirementsSatisfied(AchievementCriteriaEntry
{
// miscValue1 is itemid
ItemTemplate const* const item = sObjectMgr->GetItemTemplate(uint32(miscValue1));
- if (!item || item->Quality != reqValue)
+ if (!item || item->GetQuality() != reqValue)
return false;
break;
}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 74b1271f185..bdbf1e5c29e 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -64,7 +64,7 @@ AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count)
{
- uint32 MSV = pItem->GetTemplate()->SellPrice;
+ uint32 MSV = pItem->GetTemplate()->GetSellPrice();
if (MSV <= 0)
return AH_MINIMUM_DEPOSIT;
@@ -123,7 +123,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
uint32 ownerAccId = ObjectMgr::GetPlayerAccountIdByGUID(ownerGuid);
sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
- bidderName.c_str(), bidderAccId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
+ bidderName.c_str(), bidderAccId, pItem->GetTemplate()->GetDefaultLocaleName(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
}
// receiver exist
@@ -551,35 +551,35 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
ItemTemplate const* proto = item->GetTemplate();
- if (itemClass != 0xffffffff && proto->Class != itemClass)
+ if (itemClass != 0xffffffff && proto->GetClass() != itemClass)
continue;
- if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
+ if (itemSubClass != 0xffffffff && proto->GetSubClass() != itemSubClass)
continue;
- if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
+ if (inventoryType != 0xffffffff && proto->GetInventoryType() != inventoryType)
continue;
- if (quality != 0xffffffff && proto->Quality != quality)
+ if (quality != 0xffffffff && proto->GetQuality() != quality)
continue;
- if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
+ if (levelmin != 0 && (proto->GetRequiredLevel() < levelmin || (levelmax != 0 && proto->GetRequiredLevel() > levelmax)))
continue;
- if (usable != 0x00 && player->CanUseItem(item) != EQUIP_ERR_OK)
+ if (usable != 0 && player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
// Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey)
// No need to do any of this if no search term was entered
if (!wsearchedname.empty())
{
- std::string name = proto->Name1;
+ std::string name = proto->GetDefaultLocaleName();
if (name.empty())
continue;
// local name
if (loc_idx >= 0)
- if (ItemLocale const* il = sObjectMgr->GetItemLocale(proto->ItemId))
+ if (ItemLocale const* il = sObjectMgr->GetItemLocale(proto->GetId()))
ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
// DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
index 6bf5fa0aaa5..6745f3e317c 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
@@ -371,8 +371,8 @@ void AuctionHouseBot::PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo)
ItemTemplate const* prototype = item->GetTemplate();
if (!auctionEntry->owner) // Add only ahbot items
{
- if (prototype->Quality < MAX_AUCTION_QUALITY)
- ++statusInfo[i].QualityInfo[prototype->Quality];
+ if (prototype->GetQuality() < MAX_AUCTION_QUALITY)
+ ++statusInfo[i].QualityInfo[prototype->GetQuality()];
++statusInfo[i].ItemsCount;
}
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
index 6e7425a75a3..85f8b180705 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
@@ -17,7 +17,7 @@
#include "Log.h"
#include "Item.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
#include "AuctionHouseBotBuyer.h"
AuctionBotBuyer::AuctionBotBuyer(): _checkInterval(20)
@@ -345,7 +345,7 @@ void AuctionBotBuyer::AddNewAuctionBuyerBotBid(BuyerConfiguration& config)
ItemTemplate const* prototype = item->GetTemplate();
- uint32 basePrice = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
+ uint32 basePrice = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_BUYER) ? prototype->GetBuyPrice() : prototype->GetSellPrice();
basePrice *= item->GetCount();
uint32 maxBuyablePrice = (basePrice * config.BuyerPriceRatio) / 100;
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:
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h
index 42677a52f49..349474311b8 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h
@@ -19,7 +19,7 @@
#define AUCTION_HOUSE_BOT_SELLER_H
#include "Define.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
#include "AuctionHouseBot.h"
struct ItemToSell
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index eb99a19cf78..ed8c2598832 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -121,9 +121,9 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate item's color
- if (_color != ItemQualityColors[_item->Quality])
+ if (_color != ItemQualityColors[_item->GetQuality()])
{
- TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color);
+ TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->GetQuality()], _color);
return false;
}
// Number of various item properties after item entry
@@ -167,13 +167,11 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
return true;
}
-inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* locale, char* suffixStrings) const
+inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* /*locale*/, char* suffixStrings) const
{
std::stringstream ss;
- if (locale == NULL || index >= locale->Name.size())
- ss << _item->Name1;
- else
- ss << locale->Name[index];
+ ss << _item->GetName(LocaleConstant(index));
+
if (suffixStrings)
ss << ' ' << suffixStrings[index];
return ss.str();
@@ -188,7 +186,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
bool res = (FormatName(LOCALE_enUS, NULL, suffixStrings) == buffer);
if (!res)
{
- ItemLocale const* il = sObjectMgr->GetItemLocale(_item->ItemId);
+ ItemLocale const* il = sObjectMgr->GetItemLocale(_item->GetId());
for (uint8 index = LOCALE_koKR; index < TOTAL_LOCALES; ++index)
{
if (FormatName(index, il, suffixStrings) == buffer)
@@ -199,7 +197,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
}
}
if (!res)
- TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId);
+ TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->GetId());
return res;
}
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index ae488a5f449..e6b3e8947c0 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -18,19 +18,18 @@
#include "DB2Stores.h"
#include "DBCStores.h"
#include "DB2fmt.h"
-#include "DB2Utility.h"
#include "Common.h"
#include "Log.h"
#include "World.h"
DB2Storage<HolidaysEntry> sHolidaysStore(HolidaysEntryfmt);
-DB2Storage<ItemEntry> sItemStore(Itemfmt, &DB2Utilities::HasItemEntry, &DB2Utilities::WriteItemDbReply);
+DB2Storage<ItemEntry> sItemStore(Itemfmt);
DB2Storage<ItemAppearanceEntry> sItemAppearanceStore(ItemAppearanceEntryfmt);
ItemDisplayIDMap sItemDisplayIDMap;
DB2Storage<ItemCurrencyCostEntry> sItemCurrencyCostStore(ItemCurrencyCostfmt);
DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfmt);
DB2Storage<ItemEffectEntry> sItemEffectStore(ItemEffectEntryfmt);
-DB2Storage<ItemSparseEntry> sItemSparseStore(ItemSparsefmt, &DB2Utilities::HasItemSparseEntry, &DB2Utilities::WriteItemSparseDbReply);
+DB2Storage<ItemSparseEntry> sItemSparseStore(ItemSparsefmt);
DB2Storage<KeyChainEntry> sKeyChainStore(KeyChainfmt);
DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore(OverrideSpellDataEntryfmt);
DB2Storage<PhaseGroupEntry> sPhaseGroupStore(PhaseGroupEntryfmt);
@@ -153,11 +152,7 @@ void LoadDB2Stores(std::string const& dataPath)
if (PhaseGroupEntry const* group = sPhaseGroupStore.LookupEntry(i))
if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseID))
sPhasesByGroup[group->PhaseGroupID].insert(phase->ID);
-
- for (uint32 i = 0; i < sItemAppearanceStore.GetNumRows(); ++i)
- if (ItemAppearanceEntry const* entry = sItemAppearanceStore.LookupEntry(i))
- sItemDisplayIDMap[entry->FileDataID] = entry->DisplayID;
-
+
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->From][entry->To] = TaxiPathBySourceAndDestination(entry->ID, entry->Cost);
@@ -174,12 +169,12 @@ void LoadDB2Stores(std::string const& dataPath)
pathLength[entry->PathID] = entry->NodeIndex + 1;
}
}
-
+
// Set path length
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
-
+
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
@@ -281,14 +276,6 @@ DB2StorageBase const* GetDB2Storage(uint32 type)
return NULL;
}
-uint32 GetItemDisplayID(uint32 appearanceID)
-{
- auto itr = sItemDisplayIDMap.find(appearanceID);
- if (itr != sItemDisplayIDMap.end())
- return itr->second;
- return 0;
-}
-
std::set<uint32> const& GetPhasesForGroup(uint32 group)
{
return sPhasesByGroup[group];
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 6521ea930a8..1d3869e7c74 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -26,7 +26,6 @@
extern DB2Storage<HolidaysEntry> sHolidaysStore;
extern DB2Storage<ItemEntry> sItemStore;
extern DB2Storage<ItemAppearanceEntry> sItemAppearanceStore;
-extern ItemDisplayIDMap sItemDisplayIDMap;
extern DB2Storage<ItemCurrencyCostEntry> sItemCurrencyCostStore;
extern DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore;
extern DB2Storage<ItemEffectEntry> sItemEffectStore;
@@ -58,8 +57,6 @@ void LoadDB2Stores(std::string const& dataPath);
DB2StorageBase const* GetDB2Storage(uint32 type);
-uint32 GetItemDisplayID(uint32 appearanceID);
-
std::set<uint32> const& GetPhasesForGroup(uint32 group);
#endif
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index 8e91ec8396f..351b9eff8ed 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -20,141 +20,70 @@
#include "Common.h"
#include "DBCEnums.h"
-#include "ItemPrototype.h"
#include "Path.h"
-// GCC has alternative #pragma pack(N) syntax and old gcc version does not support pack(push, N), also any gcc version does not support it at some platform
-#if defined(__GNUC__)
-#pragma pack(1)
-#else
#pragma pack(push, 1)
-#endif
-
-// Structures used to access raw DB2 data and required packing to portability
#define MAX_HOLIDAY_DURATIONS 10
#define MAX_HOLIDAY_DATES 16
#define MAX_HOLIDAY_FLAGS 10
+#define MAX_ITEM_PROTO_FLAGS 3
+#define MAX_ITEM_PROTO_SOCKETS 3
+#define MAX_ITEM_PROTO_STATS 10
struct HolidaysEntry
{
- uint32 ID; // 0
- uint32 Duration[MAX_HOLIDAY_DURATIONS]; // 1-10
- uint32 Date[MAX_HOLIDAY_DATES]; // 11-26 (dates in unix time starting at January, 1, 2000)
- uint32 Region; // 27
- uint32 Looping; // 28
- uint32 CalendarFlags[MAX_HOLIDAY_FLAGS]; // 29-38
- //uint32 HolidayNameID; // 39 HolidayNames.dbc
- //uint32 HolidayDescriptionID; // 40 HolidayDescriptions.dbc
- char* TextureFilename; // 41
- uint32 Priority; // 42
- uint32 CalendarFilterType; // 43 (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday)
- //uint32 Flags; // 44 (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1)
+ uint32 ID; // 0
+ uint32 Duration[MAX_HOLIDAY_DURATIONS]; // 1-10
+ uint32 Date[MAX_HOLIDAY_DATES]; // 11-26 (dates in unix time starting at January, 1, 2000)
+ uint32 Region; // 27
+ uint32 Looping; // 28
+ uint32 CalendarFlags[MAX_HOLIDAY_FLAGS]; // 29-38
+ //uint32 HolidayNameID; // 39 HolidayNames.dbc
+ //uint32 HolidayDescriptionID; // 40 HolidayDescriptions.dbc
+ char* TextureFilename; // 41
+ uint32 Priority; // 42
+ uint32 CalendarFilterType; // 43 (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday)
+ //uint32 Flags; // 44 (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1)
};
struct ItemEntry
{
- uint32 ID; // 0
- uint32 Class; // 1
- uint32 SubClass; // 2
- int32 SoundOverrideSubclass; // 3
- int32 Material; // 4
- uint32 InventoryType; // 5
- uint32 Sheath; // 6
- uint32 FileDataID; // 7
- uint32 GroupSoundsID; // 8
+ uint32 ID; // 0
+ uint32 Class; // 1
+ uint32 SubClass; // 2
+ int32 SoundOverrideSubclass; // 3
+ int32 Material; // 4
+ uint32 InventoryType; // 5
+ uint32 Sheath; // 6
+ uint32 FileDataID; // 7
+ uint32 GroupSoundsID; // 8
};
struct ItemAppearanceEntry
{
- uint32 ID; // 0 (reference to ItemModifiedAppearance.db2?)
- uint32 DisplayID; // 1
- uint32 FileDataID; // 2
+ uint32 ID; // 0 (reference to ItemModifiedAppearance.db2?)
+ uint32 DisplayID; // 1
+ uint32 IconFileDataID; // 2
};
struct ItemCurrencyCostEntry
{
- //uint32 ID; // 0
- uint32 ItemId; // 1
+ //uint32 ID; // 0
+ uint32 ItemId; // 1
};
struct ItemEffectEntry
{
- uint32 ID; // 0
- uint32 ItemID; // 1
- uint32 OrderIndex; // 2
- uint32 SpellID; // 3
- uint32 Trigger; // 4
- uint32 Charges; // 5
- int32 Cooldown; // 6
- uint32 Category; // 7
- int32 CategoryCooldown; // 8
-};
-
-struct ItemSparseEntry
-{
- uint32 ID; // 0
- uint32 Quality; // 1
- uint32 Flags[MAX_ITEM_PROTO_FLAGS]; // 2-4
- float Unk1; // 5
- float Unk2; // 6
- uint32 BuyCount; // 7
- uint32 BuyPrice; // 8
- uint32 SellPrice; // 9
- uint32 InventoryType; // 10
- int32 AllowableClass; // 11
- int32 AllowableRace; // 12
- uint32 ItemLevel; // 13
- int32 RequiredLevel; // 14
- uint32 RequiredSkill; // 15
- uint32 RequiredSkillRank; // 16
- uint32 RequiredSpell; // 17
- uint32 RequiredHonorRank; // 18
- uint32 RequiredCityRank; // 19
- uint32 RequiredReputationFaction; // 20
- uint32 RequiredReputationRank; // 21
- uint32 MaxCount; // 22
- uint32 Stackable; // 23
- uint32 ContainerSlots; // 24
- int32 ItemStatType[MAX_ITEM_PROTO_STATS]; // 25 - 34
- uint32 ItemStatValue[MAX_ITEM_PROTO_STATS]; // 35 - 44
- int32 ItemStatUnk1[MAX_ITEM_PROTO_STATS]; // 45 - 54
- int32 ItemStatUnk2[MAX_ITEM_PROTO_STATS]; // 55 - 64
- uint32 ScalingStatDistribution; // 65
- uint32 DamageType; // 66
- uint32 Delay; // 67
- float RangedModRange; // 68
- uint32 Bonding; // 69
- LocalizedString* Name; // 70
- LocalizedString* Name2; // 71
- LocalizedString* Name3; // 72
- LocalizedString* Name4; // 73
- LocalizedString* Description; // 74
- uint32 PageText; // 75
- uint32 LanguageID; // 76
- uint32 PageMaterial; // 77
- uint32 StartQuest; // 78
- uint32 LockID; // 79
- int32 Material; // 80
- uint32 Sheath; // 81
- uint32 RandomProperty; // 82
- uint32 RandomSuffix; // 83
- uint32 ItemSet; // 84
- uint32 Area; // 85
- uint32 Map; // 86
- uint32 BagFamily; // 87
- uint32 TotemCategory; // 88
- uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS]; // 89-91
- uint32 SocketBonus; // 92
- uint32 GemProperties; // 93
- float ArmorDamageModifier; // 94
- uint32 Duration; // 95
- uint32 ItemLimitCategory; // 96
- uint32 HolidayID; // 97
- float StatScalingFactor; // 98
- uint32 CurrencySubstitutionID; // 99
- uint32 CurrencySubstitutionCount; // 100
- uint32 ItemNameDescriptionID; // 101
+ uint32 ID; // 0
+ uint32 ItemID; // 1
+ uint32 OrderIndex; // 2
+ uint32 SpellID; // 3
+ uint32 Trigger; // 4
+ uint32 Charges; // 5
+ int32 Cooldown; // 6
+ uint32 Category; // 7
+ int32 CategoryCooldown; // 8
};
#define MAX_ITEM_EXT_COST_ITEMS 5
@@ -162,15 +91,15 @@ struct ItemSparseEntry
struct ItemExtendedCostEntry
{
- uint32 ID; // 0 extended-cost entry id
- uint32 RequiredHonorPoints; // 1 required honor points
- uint32 RequiredArenaPoints; // 2 required arena points
- uint32 RequiredArenaSlot; // 3 arena slot restrictions (min slot value)
- uint32 RequiredItem[MAX_ITEM_EXT_COST_ITEMS]; // 4-8 required item id
- uint32 RequiredItemCount[MAX_ITEM_EXT_COST_ITEMS]; // 9-13 required count of 1st item
- uint32 RequiredPersonalArenaRating; // 14 required personal arena rating
- uint32 ItemPurchaseGroup; // 15
- uint32 RequiredCurrency[MAX_ITEM_EXT_COST_CURRENCIES];// 16-20 required curency id
+ uint32 ID; // 0 extended-cost entry id
+ uint32 RequiredHonorPoints; // 1 required honor points
+ uint32 RequiredArenaPoints; // 2 required arena points
+ uint32 RequiredArenaSlot; // 3 arena slot restrictions (min slot value)
+ uint32 RequiredItem[MAX_ITEM_EXT_COST_ITEMS]; // 4-8 required item id
+ uint32 RequiredItemCount[MAX_ITEM_EXT_COST_ITEMS]; // 9-13 required count of 1st item
+ uint32 RequiredPersonalArenaRating; // 14 required personal arena rating
+ uint32 ItemPurchaseGroup; // 15
+ uint32 RequiredCurrency[MAX_ITEM_EXT_COST_CURRENCIES]; // 16-20 required curency id
uint32 RequiredCurrencyCount[MAX_ITEM_EXT_COST_CURRENCIES];// 21-25 required curency count
uint32 RequiredFactionId;
uint32 RequiredFactionStanding;
@@ -178,6 +107,72 @@ struct ItemExtendedCostEntry
uint32 RequiredAchievement;
};
+struct ItemSparseEntry
+{
+ uint32 ID; // 0
+ uint32 Quality; // 1
+ uint32 Flags[MAX_ITEM_PROTO_FLAGS]; // 2-4
+ float Unk1; // 5
+ float Unk2; // 6
+ uint32 BuyCount; // 7
+ uint32 BuyPrice; // 8
+ uint32 SellPrice; // 9
+ uint32 InventoryType; // 10
+ int32 AllowableClass; // 11
+ int32 AllowableRace; // 12
+ uint32 ItemLevel; // 13
+ int32 RequiredLevel; // 14
+ uint32 RequiredSkill; // 15
+ uint32 RequiredSkillRank; // 16
+ uint32 RequiredSpell; // 17
+ uint32 RequiredHonorRank; // 18
+ uint32 RequiredCityRank; // 19
+ uint32 RequiredReputationFaction; // 20
+ uint32 RequiredReputationRank; // 21
+ uint32 MaxCount; // 22
+ uint32 Stackable; // 23
+ uint32 ContainerSlots; // 24
+ int32 ItemStatType[MAX_ITEM_PROTO_STATS]; // 25 - 34
+ int32 ItemStatValue[MAX_ITEM_PROTO_STATS]; // 35 - 44
+ int32 ItemStatAllocation[MAX_ITEM_PROTO_STATS]; // 45 - 54
+ float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]; // 55 - 64
+ uint32 ScalingStatDistribution; // 65
+ uint32 DamageType; // 66
+ uint32 Delay; // 67
+ float RangedModRange; // 68
+ uint32 Bonding; // 69
+ LocalizedString* Name; // 70
+ LocalizedString* Name2; // 71
+ LocalizedString* Name3; // 72
+ LocalizedString* Name4; // 73
+ LocalizedString* Description; // 74
+ uint32 PageText; // 75
+ uint32 LanguageID; // 76
+ uint32 PageMaterial; // 77
+ uint32 StartQuest; // 78
+ uint32 LockID; // 79
+ int32 Material; // 80
+ uint32 Sheath; // 81
+ uint32 RandomProperty; // 82
+ uint32 RandomSuffix; // 83
+ uint32 ItemSet; // 84
+ uint32 Area; // 85
+ uint32 Map; // 86
+ uint32 BagFamily; // 87
+ uint32 TotemCategory; // 88
+ uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS]; // 89-91
+ uint32 SocketBonus; // 92
+ uint32 GemProperties; // 93
+ float ArmorDamageModifier; // 94
+ uint32 Duration; // 95
+ uint32 ItemLimitCategory; // 96
+ uint32 HolidayID; // 97
+ float StatScalingFactor; // 98
+ uint32 CurrencySubstitutionID; // 99
+ uint32 CurrencySubstitutionCount; // 100
+ uint32 ItemNameDescriptionID; // 101
+};
+
#define KEYCHAIN_SIZE 32
struct KeyChainEntry
@@ -190,10 +185,10 @@ struct KeyChainEntry
struct OverrideSpellDataEntry
{
- uint32 ID; // 0
- uint32 SpellID[MAX_OVERRIDE_SPELL]; // 1-10
- //uint32 Flags; // 11
- //char* PlayerActionbarFileDataID; // 12
+ uint32 ID; // 0
+ uint32 SpellID[MAX_OVERRIDE_SPELL]; // 1-10
+ //uint32 Flags; // 11
+ //char* PlayerActionbarFileDataID; // 12
};
struct PhaseGroupEntry
@@ -205,99 +200,99 @@ struct PhaseGroupEntry
struct SpellAuraRestrictionsEntry
{
- //uint32 ID; // 0
- uint32 CasterAuraState; // 1
- uint32 TargetAuraState; // 2
- uint32 ExcludeCasterAuraState; // 3
- uint32 ExcludeTargetAuraState; // 4
- uint32 CasterAuraSpell; // 5
- uint32 TargetAuraSpell; // 6
- uint32 ExcludeCasterAuraSpell; // 7
- uint32 ExcludeTargetAuraSpell; // 8
+ //uint32 ID; // 0
+ uint32 CasterAuraState; // 1
+ uint32 TargetAuraState; // 2
+ uint32 ExcludeCasterAuraState; // 3
+ uint32 ExcludeTargetAuraState; // 4
+ uint32 CasterAuraSpell; // 5
+ uint32 TargetAuraSpell; // 6
+ uint32 ExcludeCasterAuraSpell; // 7
+ uint32 ExcludeTargetAuraSpell; // 8
};
struct SpellCastingRequirementsEntry
{
- //uint32 ID; // 0
- uint32 FacingCasterFlags; // 1
- //uint32 MinFactionID; // 1
- //uint32 MinReputation; // 3
- uint32 RequiredAreasID; // 4
- //uint32 RequiredAuraVision; // 5
- uint32 RequiresSpellFocus; // 6
+ //uint32 ID; // 0
+ uint32 FacingCasterFlags; // 1
+ //uint32 MinFactionID; // 1
+ //uint32 MinReputation; // 3
+ uint32 RequiredAreasID; // 4
+ //uint32 RequiredAuraVision; // 5
+ uint32 RequiresSpellFocus; // 6
};
struct SpellClassOptionsEntry
{
- uint32 ID; // 0
- uint32 ModalNextSpell; // 1
- flag128 SpellClassMask; // 2
- uint32 SpellClassSet; // 3
+ uint32 ID; // 0
+ uint32 ModalNextSpell; // 1
+ flag128 SpellClassMask; // 2
+ uint32 SpellClassSet; // 3
};
struct SpellMiscEntry
{
- uint32 ID; // 0
- uint32 Attributes; // 1
- uint32 AttributesEx; // 2
- uint32 AttributesExB; // 3
- uint32 AttributesExC; // 4
- uint32 AttributesExD; // 5
- uint32 AttributesExE; // 6
- uint32 AttributesExF; // 7
- uint32 AttributesExG; // 8
- uint32 AttributesExH; // 9
- uint32 AttributesExI; // 10
- uint32 AttributesExJ; // 11
- uint32 AttributesExK; // 12
- uint32 AttributesExL; // 13
- uint32 AttributesExM; // 14
- uint32 CastingTimeIndex; // 15
- uint32 DurationIndex; // 16
- uint32 RangeIndex; // 17
- float Speed; // 18
- uint32 SpellVisualID[2]; // 19-20
- uint32 SpellIconID; // 21
- uint32 ActiveIconID; // 22
- uint32 SchoolMask; // 23
- //float Unk; // 24
+ uint32 ID; // 0
+ uint32 Attributes; // 1
+ uint32 AttributesEx; // 2
+ uint32 AttributesExB; // 3
+ uint32 AttributesExC; // 4
+ uint32 AttributesExD; // 5
+ uint32 AttributesExE; // 6
+ uint32 AttributesExF; // 7
+ uint32 AttributesExG; // 8
+ uint32 AttributesExH; // 9
+ uint32 AttributesExI; // 10
+ uint32 AttributesExJ; // 11
+ uint32 AttributesExK; // 12
+ uint32 AttributesExL; // 13
+ uint32 AttributesExM; // 14
+ uint32 CastingTimeIndex; // 15
+ uint32 DurationIndex; // 16
+ uint32 RangeIndex; // 17
+ float Speed; // 18
+ uint32 SpellVisualID[2]; // 19-20
+ uint32 SpellIconID; // 21
+ uint32 ActiveIconID; // 22
+ uint32 SchoolMask; // 23
+ //float Unk; // 24
};
struct SpellPowerEntry
{
- uint32 ID; // 0
- uint32 SpellID; // 1
- uint32 PowerIndex; // 2
- uint32 PowerType; // 3
- uint32 ManaCost; // 4
- uint32 ManaCostPerLevel; // 5
- uint32 ManaCostPerSecond; // 6
- //uint32 Unk4; // 7 (All 0 except one spell: 22570)
- //uint32 Unk5; // 8
- //uint32 Unk6; // 9
- float ManaCostPercentage; // 10
- float ManaCostPercentagePerSecond; // 11
- uint32 RequiredAura; // 12
- //uint32 Unk9; // 13
+ uint32 ID; // 0
+ uint32 SpellID; // 1
+ uint32 PowerIndex; // 2
+ uint32 PowerType; // 3
+ uint32 ManaCost; // 4
+ uint32 ManaCostPerLevel; // 5
+ uint32 ManaCostPerSecond; // 6
+ //uint32 Unk4; // 7 (All 0 except one spell: 22570)
+ //uint32 Unk5; // 8
+ //uint32 Unk6; // 9
+ float ManaCostPercentage; // 10
+ float ManaCostPercentagePerSecond; // 11
+ uint32 RequiredAura; // 12
+ //uint32 Unk9; // 13
};
#define MAX_SPELL_REAGENTS 8
struct SpellReagentsEntry
{
- uint32 ID; // 0
- int32 Reagent[MAX_SPELL_REAGENTS]; // 1-8
- uint32 ReagentCount[MAX_SPELL_REAGENTS]; // 9-16
- //uint32 Unk1; // 17
- //uint32 Unk2; // 18
+ uint32 ID; // 0
+ int32 Reagent[MAX_SPELL_REAGENTS]; // 1-8
+ uint32 ReagentCount[MAX_SPELL_REAGENTS]; // 9-16
+ //uint32 Unk1; // 17
+ //uint32 Unk2; // 18
};
struct SpellRuneCostEntry
{
- uint32 ID; // 0
- uint32 RuneCost[3]; // 1-3 (0=blood, 1=frost, 2=unholy)
- //uint32 Unk; // 4 (All 0 except for 2 ids: 2510, 2748)
- uint32 RunePowerGain; // 5
+ uint32 ID; // 0
+ uint32 RuneCost[3]; // 1-3 (0=blood, 1=frost, 2=unholy)
+ //uint32 Unk; // 4 (All 0 except for 2 ids: 2510, 2748)
+ uint32 RunePowerGain; // 5
bool NoRuneCost() const { return RuneCost[0] == 0 && RuneCost[1] == 0 && RuneCost[2] == 0; }
bool NoRunicPowerGain() const { return RunePowerGain == 0; }
@@ -307,50 +302,45 @@ struct SpellRuneCostEntry
struct SpellTotemsEntry
{
- uint32 ID; // 0
- uint32 TotemCategory[MAX_SPELL_TOTEMS]; // 1
- uint32 Totem[MAX_SPELL_TOTEMS]; // 2
+ uint32 ID; // 0
+ uint32 TotemCategory[MAX_SPELL_TOTEMS]; // 1
+ uint32 Totem[MAX_SPELL_TOTEMS]; // 2
};
struct TaxiNodesEntry
{
- uint32 ID; // 0
- uint32 MapID; // 1
- DBCPosition3D Pos; // 2-4
- char* Name_lang; // 5
- uint32 MountCreatureID[2]; // 6-7
- uint32 ConditionID; // 8
- uint32 Flags; // 9
- float MapOffset[2]; // 10-11
+ uint32 ID; // 0
+ uint32 MapID; // 1
+ DBCPosition3D Pos; // 2-4
+ char* Name_lang; // 5
+ uint32 MountCreatureID[2]; // 6-7
+ uint32 ConditionID; // 8
+ uint32 Flags; // 9
+ float MapOffset[2]; // 10-11
};
struct TaxiPathEntry
{
- uint32 ID; // 0
- uint32 From; // 1
- uint32 To; // 2
- uint32 Cost; // 3
+ uint32 ID; // 0
+ uint32 From; // 1
+ uint32 To; // 2
+ uint32 Cost; // 3
};
struct TaxiPathNodeEntry
{
- uint32 ID; // 0
- uint32 PathID; // 1
- uint32 NodeIndex; // 2
- uint32 MapID; // 3
- DBCPosition3D Loc; // 4-6
- uint32 Flags; // 7
- uint32 Delay; // 8
- uint32 ArrivalEventID; // 9
- uint32 DepartureEventID; // 10
+ uint32 ID; // 0
+ uint32 PathID; // 1
+ uint32 NodeIndex; // 2
+ uint32 MapID; // 3
+ DBCPosition3D Loc; // 4-6
+ uint32 Flags; // 7
+ uint32 Delay; // 8
+ uint32 ArrivalEventID; // 9
+ uint32 DepartureEventID; // 10
};
-// GCC has alternative #pragma pack(N) syntax and old gcc version does not support pack(push, N), also any gcc version does not support it at some platform
-#if defined(__GNUC__)
-#pragma pack()
-#else
#pragma pack(pop)
-#endif
typedef std::map<uint32, uint32> ItemDisplayIDMap;
diff --git a/src/server/game/DataStores/DB2Utility.cpp b/src/server/game/DataStores/DB2Utility.cpp
deleted file mode 100644
index a835547b640..00000000000
--- a/src/server/game/DataStores/DB2Utility.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "DB2Utility.h"
-#include "ObjectMgr.h"
-
-inline bool ItemExists(uint32 id)
-{
- return sObjectMgr->GetItemTemplate(id) != NULL;
-}
-
-bool DB2Utilities::HasItemEntry(DB2Storage<ItemEntry> const& /*store*/, uint32 id)
-{
- return ItemExists(id);
-}
-
-bool DB2Utilities::HasItemSparseEntry(DB2Storage<ItemSparseEntry> const& /*store*/, uint32 id)
-{
- return ItemExists(id);
-}
-
-void DB2Utilities::WriteItemDbReply(DB2Storage<ItemEntry> const& /*store*/, uint32 id, uint32 /*locale*/, ByteBuffer& buffer)
-{
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(id);
- ASSERT(proto);
-
- buffer << uint32(proto->ItemId);
- buffer << uint32(proto->Class);
- buffer << uint32(proto->SubClass);
- buffer << int32(proto->SoundOverrideSubclass);
- buffer << int32(proto->Material);
- buffer << uint32(proto->InventoryType);
- buffer << uint32(proto->Sheath);
- buffer << uint32(proto->FileDataID);
- buffer << uint32(proto->GroupSoundsID);
-}
-
-void DB2Utilities::WriteItemSparseDbReply(DB2Storage<ItemSparseEntry> const& /*store*/, uint32 id, uint32 locale, ByteBuffer& buffer)
-{
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(id);
- ASSERT(proto);
-
- ItemLocale const* localeData = locale ? sObjectMgr->GetItemLocale(id) : NULL;
-
- buffer << uint32(proto->ItemId);
- buffer << uint32(proto->Quality);
-
- for (uint32 i = 0; i < MAX_ITEM_PROTO_FLAGS; ++i)
- buffer << uint32(proto->Flags[i]);
-
- buffer << float(proto->Unk1);
- buffer << float(proto->Unk2);
- buffer << uint32(proto->BuyCount);
- buffer << int32(proto->BuyPrice);
- buffer << uint32(proto->SellPrice);
- buffer << uint32(proto->InventoryType);
- buffer << int32(proto->AllowableClass);
- buffer << int32(proto->AllowableRace);
- buffer << uint32(proto->ItemLevel);
- buffer << uint32(proto->RequiredLevel);
- buffer << uint32(proto->RequiredSkill);
- buffer << uint32(proto->RequiredSkillRank);
- buffer << uint32(proto->RequiredSpell);
- buffer << uint32(proto->RequiredHonorRank);
- buffer << uint32(proto->RequiredCityRank);
- buffer << uint32(proto->RequiredReputationFaction);
- buffer << uint32(proto->RequiredReputationRank);
- buffer << int32(proto->MaxCount);
- buffer << int32(proto->Stackable);
- buffer << uint32(proto->ContainerSlots);
-
- for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
- buffer << uint32(proto->ItemStat[x].ItemStatType);
-
- for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
- buffer << int32(proto->ItemStat[x].ItemStatValue);
-
- for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
- buffer << int32(proto->ItemStat[x].ItemStatUnk1);
-
- for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
- buffer << int32(proto->ItemStat[x].ItemStatUnk2);
-
- buffer << uint32(proto->ScalingStatDistribution);
- buffer << uint32(proto->DamageType);
- buffer << uint32(proto->Delay);
- buffer << float(proto->RangedModRange);
- buffer << uint32(proto->Bonding);
-
- // item name
- std::string name = proto->Name1;
- if (localeData)
- ObjectMgr::GetLocaleString(localeData->Name, locale, name);
-
- buffer << uint16(name.length());
- if (name.length())
- buffer << name;
-
- for (uint32 i = 0; i < 3; ++i) // other 3 names
- buffer << uint16(0);
-
- std::string desc = proto->Description;
- if (localeData)
- ObjectMgr::GetLocaleString(localeData->Description, locale, desc);
-
- buffer << uint16(desc.length());
- if (desc.length())
- buffer << desc;
-
- buffer << uint32(proto->PageText);
- buffer << uint32(proto->LanguageID);
- buffer << uint32(proto->PageMaterial);
- buffer << uint32(proto->StartQuest);
- buffer << uint32(proto->LockID);
- buffer << int32(proto->Material);
- buffer << uint32(proto->Sheath);
- buffer << uint32(proto->RandomProperty);
- buffer << uint32(proto->RandomSuffix);
- buffer << uint32(proto->ItemSet);
-
- buffer << uint32(proto->Area);
- buffer << uint32(proto->Map);
- buffer << uint32(proto->BagFamily);
- buffer << uint32(proto->TotemCategory);
-
- for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
- buffer << uint32(proto->Socket[x].Color);
-
- buffer << uint32(proto->socketBonus);
- buffer << uint32(proto->GemProperties);
- buffer << float(proto->ArmorDamageModifier);
- buffer << int32(proto->Duration);
- buffer << uint32(proto->ItemLimitCategory);
- buffer << uint32(proto->HolidayId);
- buffer << float(proto->StatScalingFactor); // StatScalingFactor
- buffer << uint32(proto->CurrencySubstitutionId);
- buffer << uint32(proto->CurrencySubstitutionCount);
- buffer << uint32(proto->ItemNameDescriptionID);
-}
diff --git a/src/server/game/DataStores/DB2Utility.h b/src/server/game/DataStores/DB2Utility.h
deleted file mode 100644
index f2d58de91ca..00000000000
--- a/src/server/game/DataStores/DB2Utility.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef DB2PACKETWRITER_H
-#define DB2PACKETWRITER_H
-
-#include "Define.h"
-
-template<class T>
-class DB2Storage;
-class ByteBuffer;
-struct ItemEntry;
-struct ItemSparseEntry;
-
-namespace DB2Utilities
-{
- //
- bool HasItemEntry(DB2Storage<ItemEntry> const& store, uint32 id);
- bool HasItemSparseEntry(DB2Storage<ItemSparseEntry> const& store, uint32 id);
-
- //
- void WriteItemDbReply(DB2Storage<ItemEntry> const& store, uint32 id, uint32 locale, ByteBuffer& buffer);
- void WriteItemSparseDbReply(DB2Storage<ItemSparseEntry> const& store, uint32 id, uint32 locale, ByteBuffer& buffer);
-}
-
-#endif // DB2PACKETWRITER_H
diff --git a/src/server/game/DataStores/DB2fmt.h b/src/server/game/DataStores/DB2fmt.h
index f47efa43f89..b6175e1a5b0 100644
--- a/src/server/game/DataStores/DB2fmt.h
+++ b/src/server/game/DataStores/DB2fmt.h
@@ -22,7 +22,7 @@ char const HolidaysEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix";
char const Itemfmt[]="niiiiiiii";
char const ItemAppearanceEntryfmt[]="nii";
char const ItemCurrencyCostfmt[]="xn";
-char const ItemSparsefmt[]="niiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifisssssiiiiiiiiiiiiiiiiiiifiiifiii";
+char const ItemSparsefmt[]="niiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffffffiiifisssssiiiiiiiiiiiiiiiiiiifiiifiii";
char const ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char const ItemEffectEntryfmt[]="niiiiiiii";
char const KeyChainfmt[]="nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 0b9c7423690..0b1b1aa068e 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -24,7 +24,7 @@
#include "SpellMgr.h"
#include "TransportMgr.h"
#include "DBCfmt.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
#include "Timer.h"
#include "ObjectDefines.h"
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 7dbb87bcbf3..499c87e8c58 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2355,13 +2355,13 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
{
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
- if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
+ if ((vCount->count + diff * pProto->GetBuyCount()) >= vItem->maxcount)
{
m_vendorItemCounts.erase(itr);
return vItem->maxcount;
}
- vCount->count += diff * pProto->BuyCount;
+ vCount->count += diff * pProto->GetBuyCount();
vCount->lastIncrementTime = ptime;
}
@@ -2393,8 +2393,8 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
{
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
- if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
- vCount->count += diff * pProto->BuyCount;
+ if ((vCount->count + diff * pProto->GetBuyCount()) < vItem->maxcount)
+ vCount->count += diff * pProto->GetBuyCount();
else
vCount->count = vItem->maxcount;
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index e9212b50933..02cd0149ebd 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -22,7 +22,7 @@
#include "Common.h"
#include "Unit.h"
#include "UpdateMask.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
#include "LootMgr.h"
#include "DatabaseEnv.h"
#include "Cell.h"
@@ -349,7 +349,7 @@ struct VendorItem
uint8 Type;
//helpers
- bool IsGoldRequired(ItemTemplate const* pProto) const { return pProto->Flags[1] & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
+ bool IsGoldRequired(ItemTemplate const* pProto) const { return pProto->GetFlags2() & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
};
typedef std::vector<VendorItem*> VendorItemList;
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 2b07683d335..68e1ebb3ab5 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -744,7 +744,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGU
data << uint32(quest->RequiredItemCount[i]);
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
+ data << uint32(/*itemTemplate->DisplayInfoID*/);
else
data << uint32(0);
}
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 0e4b2990bd3..6642bd05e34 100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -74,7 +74,7 @@ bool Bag::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner
{
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
- if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
+ if (!itemProto || itemProto->GetContainerSlots() > MAX_BAG_SIZE)
return false;
Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
@@ -93,7 +93,7 @@ bool Bag::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner
SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
// Setting the number of Slots the Container has
- SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots);
+ SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->GetContainerSlots());
// Cleaning 20 slots
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
@@ -116,7 +116,7 @@ bool Bag::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fie
return false;
ItemTemplate const* itemProto = GetTemplate(); // checked in Item::LoadFromDB
- SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots);
+ SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->GetContainerSlots());
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
@@ -203,12 +203,12 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
count += pItem->GetCount();
}
- if (eItem && eItem->GetTemplate()->GemProperties)
+ if (eItem && eItem->GetTemplate()->GetGemProperties())
{
for (uint32 i=0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
- if (pItem && pItem != eItem && pItem->GetTemplate()->Socket[0].Color)
+ if (pItem && pItem != eItem && pItem->GetTemplate()->ExtendedData->SocketColor[0])
count += pItem->GetGemCountWithID(item);
}
}
@@ -223,7 +223,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem)
if (Item* pItem = m_bagslot[i])
if (pItem != skipItem)
if (ItemTemplate const* pProto = pItem->GetTemplate())
- if (pProto->ItemLimitCategory == limitCategory)
+ if (pProto->GetItemLimitCategory() == limitCategory)
count += m_bagslot[i]->GetCount();
return count;
diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h
index 09da4530478..1b66d711e6a 100644
--- a/src/server/game/Entities/Item/Container/Bag.h
+++ b/src/server/game/Entities/Item/Container/Bag.h
@@ -23,7 +23,7 @@
#define MAX_BAG_SIZE 36 // 2.0.12
#include "Item.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
class Bag : public Item
{
@@ -68,7 +68,7 @@ class Bag : public Item
inline Item* NewItemOrBag(ItemTemplate const* proto)
{
- return (proto->InventoryType == INVTYPE_BAG) ? new Bag : new Item;
+ return (proto->GetInventoryType() == INVTYPE_BAG) ? new Bag : new Item;
}
#endif
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 7af87c20935..01e7285d741 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -33,13 +33,13 @@
void AddItemsSetItem(Player* player, Item* item)
{
ItemTemplate const* proto = item->GetTemplate();
- uint32 setid = proto->ItemSet;
+ uint32 setid = proto->GetItemSet();
ItemSetEntry const* set = sItemSetStore.LookupEntry(setid);
if (!set)
{
- TC_LOG_ERROR("sql.sql", "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId);
+ TC_LOG_ERROR("sql.sql", "Item set %u for item (id %u) not found, mods not applied.", setid, proto->GetId());
return;
}
@@ -114,13 +114,13 @@ void AddItemsSetItem(Player* player, Item* item)
void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
{
- uint32 setid = proto->ItemSet;
+ uint32 setid = proto->GetItemSet();
ItemSetEntry const* set = sItemSetStore.LookupEntry(setid);
if (!set)
{
- TC_LOG_ERROR("sql.sql", "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId);
+ TC_LOG_ERROR("sql.sql", "Item set #%u for item #%u not found, mods not removed.", setid, proto->GetId());
return;
}
@@ -174,65 +174,65 @@ bool ItemCanGoIntoBag(ItemTemplate const* pProto, ItemTemplate const* pBagProto)
if (!pProto || !pBagProto)
return false;
- switch (pBagProto->Class)
+ switch (pBagProto->GetClass())
{
case ITEM_CLASS_CONTAINER:
- switch (pBagProto->SubClass)
+ switch (pBagProto->GetSubClass())
{
case ITEM_SUBCLASS_CONTAINER:
return true;
case ITEM_SUBCLASS_SOUL_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_SOUL_SHARDS))
return false;
return true;
case ITEM_SUBCLASS_HERB_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_HERBS))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_HERBS))
return false;
return true;
case ITEM_SUBCLASS_ENCHANTING_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENCHANTING_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_ENCHANTING_SUPP))
return false;
return true;
case ITEM_SUBCLASS_MINING_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_MINING_SUPP))
return false;
return true;
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENGINEERING_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_ENGINEERING_SUPP))
return false;
return true;
case ITEM_SUBCLASS_GEM_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_GEMS))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_GEMS))
return false;
return true;
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_LEATHERWORKING_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_LEATHERWORKING_SUPP))
return false;
return true;
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_INSCRIPTION_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_INSCRIPTION_SUPP))
return false;
return true;
case ITEM_SUBCLASS_TACKLE_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_FISHING_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_FISHING_SUPP))
return false;
return true;
case ITEM_SUBCLASS_COOKING_CONTAINER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_COOKING_SUPP))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_COOKING_SUPP))
return false;
return true;
default:
return false;
}
case ITEM_CLASS_QUIVER:
- switch (pBagProto->SubClass)
+ switch (pBagProto->GetSubClass())
{
case ITEM_SUBCLASS_QUIVER:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_ARROWS))
return false;
return true;
case ITEM_SUBCLASS_AMMO_POUCH:
- if (!(pProto->BagFamily & BAG_FAMILY_MASK_BULLETS))
+ if (!(pProto->GetBagFamily() & BAG_FAMILY_MASK_BULLETS))
return false;
return true;
default:
@@ -287,7 +287,7 @@ bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owne
for (uint8 i = 0; i < itemProto->Effects.size(); ++i)
SetSpellCharges(i, itemProto->Effects[i].Charges);
- SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration);
+ SetUInt32Value(ITEM_FIELD_DURATION, itemProto->GetDuration());
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
return true;
}
@@ -435,9 +435,9 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
uint32 duration = fields[3].GetUInt32();
SetUInt32Value(ITEM_FIELD_DURATION, duration);
// update duration if need, and remove if not need
- if ((proto->Duration == 0) != (duration == 0))
+ if ((proto->GetDuration() == 0) != (duration == 0))
{
- SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration);
+ SetUInt32Value(ITEM_FIELD_DURATION, proto->GetDuration());
need_save = true;
}
@@ -448,7 +448,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32());
// Remove bind flag for items vs NO_BIND set
- if (IsSoulBound() && proto->Bonding == NO_BIND)
+ if (IsSoulBound() && proto->GetBonding() == NO_BIND)
{
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, false);
need_save = true;
@@ -545,19 +545,19 @@ uint32 Item::GetSkill()
ItemTemplate const* proto = GetTemplate();
- switch (proto->Class)
+ switch (proto->GetClass())
{
case ITEM_CLASS_WEAPON:
- if (proto->SubClass >= MAX_ITEM_SUBCLASS_WEAPON)
+ if (proto->GetSubClass() >= MAX_ITEM_SUBCLASS_WEAPON)
return 0;
else
- return item_weapon_skills[proto->SubClass];
+ return item_weapon_skills[proto->GetSubClass()];
case ITEM_CLASS_ARMOR:
- if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
+ if (proto->GetSubClass() >= MAX_ITEM_SUBCLASS_ARMOR)
return 0;
else
- return item_armor_skills[proto->SubClass];
+ return item_armor_skills[proto->GetSubClass()];
default:
return 0;
@@ -572,20 +572,20 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
return 0;
// item must have one from this field values not null if it can have random enchantments
- if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
+ if ((!itemProto->GetRandomProperty()) && (!itemProto->GetRandomSuffix()))
return 0;
// item can have not null only one from field values
- if ((itemProto->RandomProperty) && (itemProto->RandomSuffix))
+ if ((itemProto->GetRandomProperty()) && (itemProto->GetRandomSuffix()))
{
- TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
+ TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->GetId(), itemProto->GetRandomProperty(), itemProto->GetRandomSuffix());
return 0;
}
// RandomProperty case
- if (itemProto->RandomProperty)
+ if (itemProto->GetRandomProperty())
{
- uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
+ uint32 randomPropId = GetItemEnchantMod(itemProto->GetRandomProperty());
ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
if (!random_id)
{
@@ -598,7 +598,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
// RandomSuffix case
else
{
- uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix);
+ uint32 randomPropId = GetItemEnchantMod(itemProto->GetRandomSuffix());
ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
if (!random_id)
{
@@ -824,7 +824,7 @@ InventoryResult Item::CanBeMergedPartlyWith(ItemTemplate const* proto) const
return EQUIP_ERR_LOOT_GONE;
// check item type
- if (GetEntry() != proto->ItemId)
+ if (GetEntry() != proto->GetId())
return EQUIP_ERR_CANT_STACK;
// check free space (full stacks can't be target of merge
@@ -846,12 +846,12 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
if (spellInfo->IsAbilityOfSkillType(SKILL_ENCHANTING)) // only for enchanting spells
return true;
- if (spellInfo->EquippedItemClass != int32(proto->Class))
+ if (spellInfo->EquippedItemClass != int32(proto->GetClass()))
return false; // wrong item class
if (spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
{
- if ((spellInfo->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
+ if ((spellInfo->EquippedItemSubClassMask & (1 << proto->GetSubClass())) == 0)
return false; // subclass not present in mask
}
}
@@ -859,11 +859,11 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
if (spellInfo->EquippedItemInventoryTypeMask != 0) // 0 == any inventory type
{
// Special case - accept weapon type for main and offhand requirements
- if (proto->InventoryType == INVTYPE_WEAPON &&
+ if (proto->GetInventoryType() == INVTYPE_WEAPON &&
(spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
return true;
- else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
+ else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->GetInventoryType())) == 0)
return false; // inventory type not present in mask
}
@@ -925,7 +925,7 @@ bool Item::GemsFitSockets() const
{
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
{
- uint8 SocketColor = GetTemplate()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color;
+ uint8 SocketColor = GetTemplate()->GetSocketColor(enchant_slot - SOCK_ENCHANTMENT_SLOT);
if (!SocketColor) // no socket slot
continue;
@@ -946,7 +946,7 @@ bool Item::GemsFitSockets() const
ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
if (gemProto)
{
- GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
+ GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GetGemProperties());
if (gemProperty)
GemColor = gemProperty->Type;
}
@@ -994,7 +994,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
if (!gemProto)
continue;
- if (gemProto->ItemLimitCategory == limitCategory)
+ if (gemProto->GetItemLimitCategory() == limitCategory)
++count;
}
return count;
@@ -1003,7 +1003,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
{
ItemTemplate const* proto = GetTemplate();
- return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId));
+ return proto && ((proto->GetMap() && proto->GetMap() != cur_mapId) || (proto->GetArea() && proto->GetArea() != cur_zoneId));
}
void Item::SendUpdateSockets()
@@ -1227,17 +1227,17 @@ bool Item::CanBeTransmogrified() const
if (!proto)
return false;
- if (proto->Quality == ITEM_QUALITY_LEGENDARY)
+ if (proto->GetQuality() == ITEM_QUALITY_LEGENDARY)
return false;
- if (proto->Class != ITEM_CLASS_ARMOR &&
- proto->Class != ITEM_CLASS_WEAPON)
+ if (proto->GetClass() != ITEM_CLASS_ARMOR &&
+ proto->GetClass() != ITEM_CLASS_WEAPON)
return false;
- if (proto->Class == ITEM_CLASS_WEAPON && proto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
+ if (proto->GetClass() == ITEM_CLASS_WEAPON && proto->GetSubClass() == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
return false;
- if (proto->Flags[1] & ITEM_FLAGS_EXTRA_CANNOT_BE_TRANSMOG)
+ if (proto->GetFlags2() & ITEM_FLAGS_EXTRA_CANNOT_BE_TRANSMOG)
return false;
if (!HasStats())
@@ -1253,20 +1253,20 @@ bool Item::CanTransmogrify() const
if (!proto)
return false;
- if (proto->Flags[1] & ITEM_FLAGS_EXTRA_CANNOT_TRANSMOG)
+ if (proto->GetFlags2() & ITEM_FLAGS_EXTRA_CANNOT_TRANSMOG)
return false;
- if (proto->Quality == ITEM_QUALITY_LEGENDARY)
+ if (proto->GetQuality() == ITEM_QUALITY_LEGENDARY)
return false;
- if (proto->Class != ITEM_CLASS_ARMOR &&
- proto->Class != ITEM_CLASS_WEAPON)
+ if (proto->GetClass() != ITEM_CLASS_ARMOR &&
+ proto->GetClass() != ITEM_CLASS_WEAPON)
return false;
- if (proto->Class == ITEM_CLASS_WEAPON && proto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
+ if (proto->GetClass() == ITEM_CLASS_WEAPON && proto->GetSubClass() == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
return false;
- if (proto->Flags[1] & ITEM_FLAGS_EXTRA_CAN_TRANSMOG)
+ if (proto->GetFlags2() & ITEM_FLAGS_EXTRA_CAN_TRANSMOG)
return true;
if (!HasStats())
@@ -1283,27 +1283,27 @@ bool Item::CanTransmogrifyItemWithItem(Item const* transmogrified, Item const* t
ItemTemplate const* proto1 = transmogrifier->GetTemplate(); // source
ItemTemplate const* proto2 = transmogrified->GetTemplate(); // dest
- if (proto1->ItemId == proto2->ItemId)
+ if (proto1->GetId() == proto2->GetId())
return false;
if (!transmogrified->CanTransmogrify() || !transmogrifier->CanBeTransmogrified())
return false;
- if (proto1->InventoryType == INVTYPE_BAG ||
- proto1->InventoryType == INVTYPE_RELIC ||
- proto1->InventoryType == INVTYPE_BODY ||
- proto1->InventoryType == INVTYPE_FINGER ||
- proto1->InventoryType == INVTYPE_TRINKET ||
- proto1->InventoryType == INVTYPE_AMMO ||
- proto1->InventoryType == INVTYPE_QUIVER)
+ if (proto1->GetInventoryType() == INVTYPE_BAG ||
+ proto1->GetInventoryType() == INVTYPE_RELIC ||
+ proto1->GetInventoryType() == INVTYPE_BODY ||
+ proto1->GetInventoryType() == INVTYPE_FINGER ||
+ proto1->GetInventoryType() == INVTYPE_TRINKET ||
+ proto1->GetInventoryType() == INVTYPE_AMMO ||
+ proto1->GetInventoryType() == INVTYPE_QUIVER)
return false;
- if (proto1->SubClass != proto2->SubClass && (proto1->Class != ITEM_CLASS_WEAPON || !proto2->IsRangedWeapon() || !proto1->IsRangedWeapon()))
+ if (proto1->GetSubClass() != proto2->GetSubClass() && (proto1->GetClass() != ITEM_CLASS_WEAPON || !proto2->IsRangedWeapon() || !proto1->IsRangedWeapon()))
return false;
- if (proto1->InventoryType != proto2->InventoryType &&
- (proto1->Class != ITEM_CLASS_WEAPON || (proto2->InventoryType != INVTYPE_WEAPONMAINHAND && proto2->InventoryType != INVTYPE_WEAPONOFFHAND)) &&
- (proto1->Class != ITEM_CLASS_ARMOR || (proto1->InventoryType != INVTYPE_CHEST && proto2->InventoryType != INVTYPE_ROBE && proto1->InventoryType != INVTYPE_ROBE && proto2->InventoryType != INVTYPE_CHEST)))
+ if (proto1->GetInventoryType() != proto2->GetInventoryType() &&
+ (proto1->GetClass() != ITEM_CLASS_WEAPON || (proto2->GetInventoryType() != INVTYPE_WEAPONMAINHAND && proto2->GetInventoryType() != INVTYPE_WEAPONOFFHAND)) &&
+ (proto1->GetClass() != ITEM_CLASS_ARMOR || (proto1->GetInventoryType() != INVTYPE_CHEST && proto2->GetInventoryType() != INVTYPE_ROBE && proto1->GetInventoryType() != INVTYPE_ROBE && proto2->GetInventoryType() != INVTYPE_CHEST)))
return false;
return true;
@@ -1316,7 +1316,7 @@ bool Item::HasStats() const
ItemTemplate const* proto = GetTemplate();
for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
- if (proto->ItemStat[i].ItemStatValue != 0)
+ if (proto->GetItemStatValue(i) != 0)
return true;
return false;
@@ -1327,14 +1327,14 @@ uint32 Item::GetSellPrice(ItemTemplate const* proto, bool& normalSellPrice)
{
normalSellPrice = true;
- if (proto->Flags[1] & ITEM_FLAGS_EXTRA_HAS_NORMAL_PRICE)
+ if (proto->GetFlags2() & ITEM_FLAGS_EXTRA_HAS_NORMAL_PRICE)
{
- return proto->BuyPrice;
+ return proto->GetBuyPrice();
}
else
{
- ImportPriceQualityEntry const* qualityPrice = sImportPriceQualityStore.LookupEntry(proto->Quality + 1);
- ItemPriceBaseEntry const* basePrice = sItemPriceBaseStore.LookupEntry(proto->ItemLevel);
+ ImportPriceQualityEntry const* qualityPrice = sImportPriceQualityStore.LookupEntry(proto->GetQuality() + 1);
+ ItemPriceBaseEntry const* basePrice = sItemPriceBaseStore.LookupEntry(proto->GetBaseItemLevel());
if (!qualityPrice || !basePrice)
return 0;
@@ -1342,7 +1342,7 @@ uint32 Item::GetSellPrice(ItemTemplate const* proto, bool& normalSellPrice)
float qualityFactor = qualityPrice->Factor;
float baseFactor = 0.0f;
- uint32 inventoryType = proto->InventoryType;
+ uint32 inventoryType = proto->GetInventoryType();
if (inventoryType == INVTYPE_WEAPON ||
inventoryType == INVTYPE_2HWEAPON ||
@@ -1377,7 +1377,7 @@ uint32 Item::GetSellPrice(ItemTemplate const* proto, bool& normalSellPrice)
if (!armorPrice)
return 0;
- switch (proto->SubClass)
+ switch (proto->GetSubClass())
{
case ITEM_SUBCLASS_ARMOR_MISCELLANEOUS:
case ITEM_SUBCLASS_ARMOR_CLOTH:
@@ -1425,7 +1425,7 @@ uint32 Item::GetSellPrice(ItemTemplate const* proto, bool& normalSellPrice)
weapType = 4;
break;
default:
- return proto->BuyPrice;
+ return proto->GetBuyPrice();
}
if (weapType != -1)
@@ -1438,7 +1438,7 @@ uint32 Item::GetSellPrice(ItemTemplate const* proto, bool& normalSellPrice)
}
normalSellPrice = false;
- return uint32(qualityFactor * proto->Unk1 * proto->Unk2 * typeFactor * baseFactor);
+ return uint32(qualityFactor * proto->GetUnk1() * proto->GetUnk2() * typeFactor * baseFactor);
}
}
@@ -1446,8 +1446,8 @@ uint32 Item::GetSpecialPrice(ItemTemplate const* proto, uint32 minimumPrice /*=
{
uint32 cost = 0;
- if (proto->Flags[1] & ITEM_FLAGS_EXTRA_HAS_NORMAL_PRICE)
- cost = proto->SellPrice;
+ if (proto->GetFlags2() & ITEM_FLAGS_EXTRA_HAS_NORMAL_PRICE)
+ cost = proto->GetSellPrice();
else
{
bool normalPrice;
@@ -1455,19 +1455,19 @@ uint32 Item::GetSpecialPrice(ItemTemplate const* proto, uint32 minimumPrice /*=
if (!normalPrice)
{
- if (proto->BuyCount <= 1)
+ if (proto->GetBuyCount() <= 1)
{
- ItemClassEntry const* classEntry = sItemClassStore.LookupEntry(proto->Class);
+ ItemClassEntry const* classEntry = sItemClassStore.LookupEntry(proto->GetClass());
if (classEntry)
cost *= classEntry->PriceMod;
else
cost = 0;
}
else
- cost /= 4 * proto->BuyCount;
+ cost /= 4 * proto->GetBuyCount();
}
else
- cost = proto->SellPrice;
+ cost = proto->GetSellPrice();
}
if (cost < minimumPrice)
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 8c91c24b943..bf2d48d902a 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -22,7 +22,7 @@
#include "Common.h"
#include "Object.h"
#include "LootMgr.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
#include "DatabaseEnv.h"
class SpellInfo;
@@ -229,8 +229,8 @@ class Item : public Object
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, val); }
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND); }
- bool IsBoundAccountWide() const { return (GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
- bool IsBattlenetAccountBound() const { return (GetTemplate()->Flags[1] & ITEM_FLAGS_EXTRA_BNET_ACCOUNT_BOUND) != 0; }
+ bool IsBoundAccountWide() const { return (GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
+ bool IsBattlenetAccountBound() const { return (GetTemplate()->GetFlags2() & ITEM_FLAGS_EXTRA_BNET_ACCOUNT_BOUND) != 0; }
bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const;
virtual void SaveToDB(SQLTransaction& trans);
@@ -255,7 +255,7 @@ class Item : public Object
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); }
- bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
+ bool IsBag() const { return GetTemplate()->GetInventoryType() == INVTYPE_BAG; }
bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
bool IsNotEmptyBag() const;
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
@@ -330,13 +330,15 @@ class Item : public Object
uState = state;
}
- bool hasQuest(uint32 quest_id) const override { return GetTemplate()->StartQuest == quest_id; }
+ bool hasQuest(uint32 quest_id) const override { return GetTemplate()->GetStartQuest() == quest_id; }
bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; }
bool HasStats() const;
bool IsPotion() const { return GetTemplate()->IsPotion(); }
bool IsVellum() const { return GetTemplate()->IsVellum(); }
bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
bool IsRangedWeapon() const { return GetTemplate()->IsRangedWeapon(); }
+ uint32 GetItemLevel() const { return GetTemplate()->GetItemLevel(GetDynamicValues(ITEM_DYNAMIC_FIELD_BONUSLIST_IDS)); }
+ uint32 GetDisplayId() const { return GetTemplate()->GetDisplayId(GetDynamicValues(ITEM_DYNAMIC_FIELD_BONUSLIST_IDS)); }
// Item Refund system
void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = NULL);
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index ea9e24dff94..8bfe6ce3ee3 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -124,10 +124,10 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
if (!itemProto)
return 0;
- if (!itemProto->RandomSuffix)
+ if (!itemProto->GetRandomSuffix())
return 0;
- return GetRandomPropertyPoints(itemProto->ItemLevel, itemProto->Quality, itemProto->InventoryType, itemProto->SubClass);
+ return GetRandomPropertyPoints(itemProto->GetBaseItemLevel(), itemProto->GetQuality(), itemProto->GetInventoryType(), itemProto->GetSubClass());
}
uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
diff --git a/src/server/game/Entities/Item/ItemTemplate.cpp b/src/server/game/Entities/Item/ItemTemplate.cpp
new file mode 100644
index 00000000000..bbcdde214c1
--- /dev/null
+++ b/src/server/game/Entities/Item/ItemTemplate.cpp
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "DBCStores.h"
+#include "DB2Stores.h"
+#include "World.h"
+#include "ItemTemplate.h"
+
+char const* ItemTemplate::GetName(LocaleConstant locale) const
+{
+ if (!strlen(ExtendedData->Name->Str[locale]))
+ return GetDefaultLocaleName();
+
+ return ExtendedData->Name->Str[locale];
+}
+
+char const* ItemTemplate::GetDefaultLocaleName() const
+{
+ return ExtendedData->Name->Str[sWorld->GetDefaultDbcLocale()];
+}
+
+uint32 ItemTemplate::GetItemLevel(std::vector<uint32> const& bonuses) const
+{
+ uint32 baseItemLevel = ExtendedData->ItemLevel;
+ return baseItemLevel;
+}
+
+uint32 ItemTemplate::GetDisplayId(std::vector<uint32> const& bonusListIDs) const
+{
+ return 0;
+}
+
+uint32 ItemTemplate::GetArmor(uint32 itemLevel) const
+{
+ uint32 quality = GetQuality() != ITEM_QUALITY_HEIRLOOM ? GetQuality() : ITEM_QUALITY_RARE;
+ if (quality > ITEM_QUALITY_ARTIFACT)
+ return 0;
+
+ // all items but shields
+ if (GetClass() != ITEM_CLASS_ARMOR || GetSubClass() != ITEM_SUBCLASS_ARMOR_SHIELD)
+ {
+ ItemArmorQualityEntry const* armorQuality = sItemArmorQualityStore.LookupEntry(itemLevel);
+ ItemArmorTotalEntry const* armorTotal = sItemArmorTotalStore.LookupEntry(itemLevel);
+ if (!armorQuality || !armorTotal)
+ return 0;
+
+ uint32 inventoryType = GetInventoryType();
+ if (inventoryType == INVTYPE_ROBE)
+ inventoryType = INVTYPE_CHEST;
+
+ ArmorLocationEntry const* location = sArmorLocationStore.LookupEntry(inventoryType);
+ if (!location)
+ return 0;
+
+ if (GetSubClass() < ITEM_SUBCLASS_ARMOR_CLOTH || GetSubClass() > ITEM_SUBCLASS_ARMOR_PLATE)
+ return 0;
+
+ return uint32(armorQuality->QualityMod[quality] * armorTotal->Value[GetSubClass() - 1] * location->Modifier[GetSubClass() - 1] + 0.5f);
+ }
+
+ // shields
+ ItemArmorShieldEntry const* shield = sItemArmorShieldStore.LookupEntry(itemLevel);
+ if (!shield)
+ return 0;
+
+ return uint32(shield->Quality[quality] + 0.5f);
+}
+
+void ItemTemplate::GetDamage(uint32 itemLevel, float& minDamage, float& maxDamage) const
+{
+ minDamage = maxDamage = 0.0f;
+ uint32 quality = GetQuality() != ITEM_QUALITY_HEIRLOOM ? GetQuality() : ITEM_QUALITY_RARE;
+ if (GetClass() != ITEM_CLASS_WEAPON || quality > ITEM_QUALITY_ARTIFACT)
+ return;
+
+ DBCStorage<ItemDamageEntry>* store = NULL;
+ // get the right store here
+ if (GetInventoryType() > INVTYPE_RANGEDRIGHT)
+ return;
+
+ switch (GetInventoryType())
+ {
+ case INVTYPE_AMMO:
+ store = &sItemDamageAmmoStore;
+ break;
+ case INVTYPE_2HWEAPON:
+ if (GetFlags2() & ITEM_FLAGS_EXTRA_CASTER_WEAPON)
+ store = &sItemDamageTwoHandCasterStore;
+ else
+ store = &sItemDamageTwoHandStore;
+ break;
+ case INVTYPE_RANGED:
+ case INVTYPE_THROWN:
+ case INVTYPE_RANGEDRIGHT:
+ switch (GetSubClass())
+ {
+ case ITEM_SUBCLASS_WEAPON_WAND:
+ store = &sItemDamageWandStore;
+ break;
+ case ITEM_SUBCLASS_WEAPON_THROWN:
+ store = &sItemDamageThrownStore;
+ break;
+ case ITEM_SUBCLASS_WEAPON_BOW:
+ case ITEM_SUBCLASS_WEAPON_GUN:
+ case ITEM_SUBCLASS_WEAPON_CROSSBOW:
+ store = &sItemDamageRangedStore;
+ break;
+ default:
+ return;
+ }
+ break;
+ case INVTYPE_WEAPON:
+ case INVTYPE_WEAPONMAINHAND:
+ case INVTYPE_WEAPONOFFHAND:
+ if (GetFlags2() & ITEM_FLAGS_EXTRA_CASTER_WEAPON)
+ store = &sItemDamageOneHandCasterStore;
+ else
+ store = &sItemDamageOneHandStore;
+ break;
+ default:
+ return;
+ }
+
+ ASSERT(store);
+
+ ItemDamageEntry const* damageInfo = store->LookupEntry(itemLevel);
+ if (!damageInfo)
+ return;
+
+ float dps = damageInfo->DPS[quality];
+ float avgDamage = dps * GetDelay() * 0.001f;
+ minDamage = (GetStatScalingFactor() * -0.5f + 1.0f) * avgDamage;
+ maxDamage = floor(float(avgDamage * (GetStatScalingFactor() * 0.5f + 1.0f) + 0.5f));
+}
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemTemplate.h
index 3846f7dd642..e44c1e99d42 100644
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemTemplate.h
@@ -19,7 +19,7 @@
#ifndef _ITEMPROTOTYPE_H
#define _ITEMPROTOTYPE_H
-#include "Common.h"
+#include "DB2Structure.h"
#include "SharedDefines.h"
enum ItemModType
@@ -573,26 +573,7 @@ const uint32 MaxItemSubclassValues[MAX_ITEM_CLASS] =
MAX_ITEM_SUBCLASS_GLYPH
};
-// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
-#if defined(__GNUC__)
-#pragma pack(1)
-#else
#pragma pack(push, 1)
-#endif
-
-struct _ItemStat
-{
- uint32 ItemStatType;
- int32 ItemStatValue;
- int32 ItemStatUnk1;
- int32 ItemStatUnk2;
-};
-
-struct _Socket
-{
- uint32 Color;
- uint32 Content;
-};
struct ItemEffect
{
@@ -604,91 +585,70 @@ struct ItemEffect
int32 CategoryCooldown;
};
-// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
-#if defined(__GNUC__)
-#pragma pack()
-#else
#pragma pack(pop)
-#endif
-
-#define MAX_ITEM_PROTO_FLAGS 3
-#define MAX_ITEM_PROTO_DAMAGES 2 // changed in 3.1.0
-#define MAX_ITEM_PROTO_SOCKETS 3
-#define MAX_ITEM_PROTO_STATS 10
struct ItemTemplate
{
- uint32 ItemId;
- uint32 Class; // id from ItemClass.dbc
- uint32 SubClass; // id from ItemSubClass.dbc
- int32 SoundOverrideSubclass; // < 0: id from ItemSubClass.dbc, used to override weapon sound from actual SubClass
- std::string Name1;
- uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc
- uint32 FileDataID;
- uint32 GroupSoundsID;
- uint32 Quality;
- uint32 Flags[MAX_ITEM_PROTO_FLAGS];
- float Unk1;
- float Unk2;
- uint32 BuyCount;
- int32 BuyPrice;
- uint32 SellPrice;
- uint32 InventoryType;
- uint32 AllowableClass;
- uint32 AllowableRace;
- uint32 ItemLevel;
- uint32 RequiredLevel;
- uint32 RequiredSkill; // id from SkillLine.dbc
- uint32 RequiredSkillRank;
- uint32 RequiredSpell; // id from Spell.dbc
- uint32 RequiredHonorRank;
- uint32 RequiredCityRank;
- uint32 RequiredReputationFaction; // id from Faction.dbc
- uint32 RequiredReputationRank;
- int32 MaxCount; // <= 0: no limit
- int32 Stackable; // 0: not allowed, -1: put in player coin info tab and don't limit stacking (so 1 slot)
- uint32 ContainerSlots;
- _ItemStat ItemStat[MAX_ITEM_PROTO_STATS];
- uint32 ScalingStatDistribution; // id from ScalingStatDistribution.dbc
- uint32 DamageType; // id from Resistances.dbc
- uint32 Delay;
- float RangedModRange;
- std::vector<ItemEffect> Effects;
- uint32 Bonding;
- std::string Description;
- uint32 PageText;
- uint32 LanguageID;
- uint32 PageMaterial;
- uint32 StartQuest; // id from QuestCache.wdb
- uint32 LockID;
- int32 Material; // id from Material.dbc
- uint32 Sheath;
- int32 RandomProperty; // id from ItemRandomProperties.dbc
- int32 RandomSuffix; // id from ItemRandomSuffix.dbc
- uint32 ItemSet; // id from ItemSet.dbc
+ ItemEntry const* BasicData;
+ ItemSparseEntry const* ExtendedData;
+
+ uint32 GetId() const { return BasicData->ID; }
+ uint32 GetClass() const { return BasicData->Class; }
+ uint32 GetSubClass() const { return BasicData->SubClass; }
+ uint32 GetQuality() const { return ExtendedData->Quality; }
+ uint32 GetFlags() const { return ExtendedData->Flags[0]; }
+ uint32 GetFlags2() const { return ExtendedData->Flags[1]; }
+ uint32 GetFlags3() const { return ExtendedData->Flags[2]; }
+ float GetUnk1() const { return ExtendedData->Unk1; }
+ float GetUnk2() const { return ExtendedData->Unk2; }
+ uint32 GetBuyCount() const { return std::max(ExtendedData->BuyCount, 1u); }
+ uint32 GetBuyPrice() const { return ExtendedData->BuyPrice; }
+ uint32 GetSellPrice() const { return ExtendedData->SellPrice; }
+ InventoryType GetInventoryType() const { return InventoryType(ExtendedData->InventoryType); }
+ int32 GetAllowableClass() const { return ExtendedData->AllowableClass; }
+ int32 GetAllowableRace() const { return ExtendedData->AllowableRace; }
+ uint32 GetBaseItemLevel() const { return ExtendedData->ItemLevel; }
+ int32 GetRequiredLevel() const { return ExtendedData->RequiredLevel; }
+ uint32 GetRequiredSkill() const { return ExtendedData->RequiredSkill; }
+ uint32 GetRequiredSkillRank() const { return ExtendedData->RequiredSkillRank; }
+ uint32 GetRequiredSpell() const { return ExtendedData->RequiredSpell; }
+ uint32 GetRequiredReputationFaction() const { return ExtendedData->RequiredReputationFaction; }
+ uint32 GetRequiredReputationRank() const { return ExtendedData->RequiredReputationRank; }
+ uint32 GetMaxCount() const { return ExtendedData->MaxCount; }
+ uint32 GetContainerSlots() const { return ExtendedData->ContainerSlots; }
+ int32 GetItemStatType(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->ItemStatType[index]; }
+ int32 GetItemStatValue(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->ItemStatValue[index]; }
+ int32 GetItemStatAllocation(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->ItemStatAllocation[index]; }
+ float GetItemStatSocketCostMultiplier(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->ItemStatSocketCostMultiplier[index]; }
+ uint32 GetScalingStatDistribution() const { return ExtendedData->ScalingStatDistribution; }
+ uint32 GetDamageType() const { return ExtendedData->DamageType; }
+ uint32 GetDelay() const { return ExtendedData->Delay; }
+ ItemBondingType GetBonding() const { return ItemBondingType(ExtendedData->Bonding); }
+ char const* GetName(LocaleConstant locale) const;
+ uint32 GetPageText() const { return ExtendedData->PageText; }
+ uint32 GetStartQuest() const { return ExtendedData->StartQuest; }
+ uint32 GetLockID() const { return ExtendedData->LockID; }
+ uint32 GetRandomProperty() const { return ExtendedData->RandomProperty; }
+ uint32 GetRandomSuffix() const { return ExtendedData->RandomSuffix; }
+ uint32 GetItemSet() const { return ExtendedData->ItemSet; }
+ uint32 GetArea() const { return ExtendedData->Area; }
+ uint32 GetMap() const { return ExtendedData->Map; }
+ uint32 GetBagFamily() const { return ExtendedData->BagFamily; }
+ SocketColor GetSocketColor(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return SocketColor(ExtendedData->SocketColor[index]); }
+ uint32 GetSocketBonus() const { return ExtendedData->SocketBonus; }
+ uint32 GetGemProperties() const { return ExtendedData->GemProperties; }
+ float GetArmorDamageModifier() const { return ExtendedData->ArmorDamageModifier; }
+ uint32 GetDuration() const { return ExtendedData->Duration; }
+ uint32 GetItemLimitCategory() const { return ExtendedData->ItemLimitCategory; }
+ HolidayIds GetHolidayID() const { return HolidayIds(ExtendedData->HolidayID); }
+ float GetStatScalingFactor() const { return ExtendedData->StatScalingFactor; }
+ uint32 GetBaseArmor() const { return GetArmor(ExtendedData->ItemLevel); }
+ void GetBaseDamage(float& minDamage, float& maxDamage) const { GetDamage(ExtendedData->ItemLevel, minDamage, maxDamage); }
+
uint32 MaxDurability;
- uint32 Area; // id from AreaTable.dbc
- uint32 Map; // id from Map.dbc
- uint32 BagFamily; // bit mask (1 << id from ItemBagFamily.dbc)
- uint32 TotemCategory; // id from TotemCategory.dbc
- _Socket Socket[MAX_ITEM_PROTO_SOCKETS];
- uint32 socketBonus; // id from SpellItemEnchantment.dbc
- uint32 GemProperties; // id from GemProperties.dbc
- float ArmorDamageModifier;
- uint32 Duration;
- uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc
- uint32 HolidayId; // id from Holidays.dbc
- float StatScalingFactor;
- uint32 CurrencySubstitutionId; // May be used instead of a currency
- uint32 CurrencySubstitutionCount;
- uint32 ItemNameDescriptionID;
+ std::vector<ItemEffect> Effects;
// extra fields, not part of db2 files
- float DamageMin;
- float DamageMax;
- float DPS;
- uint32 Armor;
- float SpellPPMRate;
uint32 ScriptId;
uint32 DisenchantID;
uint32 RequiredDisenchantSkill;
@@ -696,11 +656,12 @@ struct ItemTemplate
uint32 MinMoneyLoot;
uint32 MaxMoneyLoot;
uint32 FlagsCu;
+ float SpellPPMRate;
// helpers
bool CanChangeEquipStateInCombat() const
{
- switch (InventoryType)
+ switch (GetInventoryType())
{
case INVTYPE_RELIC:
case INVTYPE_SHIELD:
@@ -708,7 +669,7 @@ struct ItemTemplate
return true;
}
- switch (Class)
+ switch (GetClass())
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_PROJECTILE:
@@ -718,47 +679,30 @@ struct ItemTemplate
return false;
}
- bool IsCurrencyToken() const { return (BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) != 0; }
+ bool IsCurrencyToken() const { return (GetBagFamily() & BAG_FAMILY_MASK_CURRENCY_TOKENS) != 0; }
uint32 GetMaxStackSize() const
{
- return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
+ return (ExtendedData->Stackable == 2147483647 || ExtendedData->Stackable <= 0) ? uint32(0x7FFFFFFF - 1) : uint32(ExtendedData->Stackable);
}
- float GetItemLevelIncludingQuality() const
- {
- float itemLevel = (float)ItemLevel;
- switch (Quality)
- {
- case ITEM_QUALITY_POOR:
- case ITEM_QUALITY_NORMAL:
- case ITEM_QUALITY_UNCOMMON:
- case ITEM_QUALITY_ARTIFACT:
- case ITEM_QUALITY_HEIRLOOM:
- itemLevel -= 13; // leaving this as a separate statement since we do not know the real behavior in this case
- break;
- case ITEM_QUALITY_RARE:
- itemLevel -= 13;
- break;
- case ITEM_QUALITY_EPIC:
- case ITEM_QUALITY_LEGENDARY:
- default:
- break;
- }
- return std::max<float>(0.f, itemLevel);
- }
-
- bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
- bool IsVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ENCHANTMENT; }
- bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags[0] & ITEM_PROTO_FLAG_CONJURED); }
+ bool IsPotion() const { return GetClass() == ITEM_CLASS_CONSUMABLE && GetSubClass() == ITEM_SUBCLASS_POTION; }
+ bool IsVellum() const { return GetClass() == ITEM_CLASS_TRADE_GOODS && GetSubClass() == ITEM_SUBCLASS_ENCHANTMENT; }
+ bool IsConjuredConsumable() const { return GetClass() == ITEM_CLASS_CONSUMABLE && (GetFlags() & ITEM_PROTO_FLAG_CONJURED); }
bool IsRangedWeapon() const
{
- return Class == ITEM_CLASS_WEAPON ||
- SubClass == ITEM_SUBCLASS_WEAPON_BOW ||
- SubClass == ITEM_SUBCLASS_WEAPON_GUN ||
- SubClass == ITEM_SUBCLASS_WEAPON_CROSSBOW;
+ return GetClass() == ITEM_CLASS_WEAPON ||
+ GetSubClass() == ITEM_SUBCLASS_WEAPON_BOW ||
+ GetSubClass() == ITEM_SUBCLASS_WEAPON_GUN ||
+ GetSubClass() == ITEM_SUBCLASS_WEAPON_CROSSBOW;
}
+
+ char const* GetDefaultLocaleName() const;
+ uint32 GetItemLevel(std::vector<uint32> const& bonusListIDs) const;
+ uint32 GetDisplayId(std::vector<uint32> const& bonusListIDs) const;
+ uint32 GetArmor(uint32 itemLevel) const;
+ void GetDamage(uint32 itemLevel, float& minDamage, float& maxDamage) const;
};
// Benchmarked: Faster than std::map (insert/find)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 9dec399f452..e10d4a6262e 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -1145,10 +1145,10 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
continue;
// BuyCount by default
- uint32 count = iProto->BuyCount;
+ uint32 count = iProto->GetBuyCount();
// special amount for food/drink
- if (iProto->Class == ITEM_CLASS_CONSUMABLE && iProto->SubClass == ITEM_SUBCLASS_FOOD_DRINK)
+ if (iProto->GetClass() == ITEM_CLASS_CONSUMABLE && iProto->GetSubClass() == ITEM_SUBCLASS_FOOD_DRINK)
{
if (iProto->Effects.size() >= 1)
{
@@ -5001,8 +5001,8 @@ void Player::CreateCorpse()
{
if (m_items[i])
{
- iDisplayID = m_items[i]->GetTemplate()->DisplayInfoID;
- iIventoryType = m_items[i]->GetTemplate()->InventoryType;
+ iDisplayID = m_items[i]->GetDisplayId();
+ iIventoryType = m_items[i]->GetTemplate()->GetInventoryType();
_cfi = iDisplayID | (iIventoryType << 24);
corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi);
@@ -5165,14 +5165,14 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
{
ItemTemplate const* ditemProto = item->GetTemplate();
- DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
+ DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->GetBaseItemLevel());
if (!dcost)
{
- TC_LOG_ERROR("entities.player.items", "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
+ TC_LOG_ERROR("entities.player.items", "RepairDurability: Wrong item lvl %u", ditemProto->GetBaseItemLevel());
return TotalCost;
}
- uint32 dQualitymodEntryId = (ditemProto->Quality+1)*2;
+ uint32 dQualitymodEntryId = (ditemProto->GetQuality() + 1) * 2;
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
if (!dQualitymodEntry)
{
@@ -5181,12 +5181,12 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
}
uint32 dmultiplier = 0;
- if (ditemProto->Class == ITEM_CLASS_WEAPON)
- dmultiplier = dcost->WeaponSubClassCost[ditemProto->SubClass];
- else if (ditemProto->Class == ITEM_CLASS_ARMOR)
- dmultiplier = dcost->ArmorSubClassCost[ditemProto->SubClass];
+ if (ditemProto->GetClass() == ITEM_CLASS_WEAPON)
+ dmultiplier = dcost->WeaponSubClassCost[ditemProto->GetSubClass()];
+ else if (ditemProto->GetClass() == ITEM_CLASS_ARMOR)
+ dmultiplier = dcost->ArmorSubClassCost[ditemProto->GetSubClass()];
- uint32 costs = uint32(LostDurability*dmultiplier*double(dQualitymodEntry->QualityMod));
+ uint32 costs = uint32(LostDurability * dmultiplier * double(dQualitymodEntry->QualityMod));
costs = uint32(costs * discountMod * sWorld->getRate(RATE_REPAIRCOST));
@@ -5737,8 +5737,8 @@ void Player::SetRegularAttackTime()
if (tmpitem && !tmpitem->IsBroken())
{
ItemTemplate const* proto = tmpitem->GetTemplate();
- if (proto->Delay)
- SetAttackTime(WeaponAttackType(i), proto->Delay);
+ if (proto->GetDelay())
+ SetAttackTime(WeaponAttackType(i), proto->GetDelay());
}
else
SetAttackTime(WeaponAttackType(i), BASE_ATTACK_TIME); // If there is no weapon reset attack time to base (might have been changed from forms)
@@ -7787,7 +7787,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
uint8 attacktype = Player::GetAttackBySlot(slot);
- if (proto->Socket[0].Color) //only (un)equipping of items with sockets can influence metagems, so no need to waste time with normal items
+ if (proto->GetSocketColor(0)) //only (un)equipping of items with sockets can influence metagems, so no need to waste time with normal items
CorrectMetaGemEnchants(slot, apply);
if (attacktype < MAX_ATTACK)
@@ -7805,7 +7805,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
if (slot >= INVENTORY_SLOT_BAG_END || !proto)
return;
- ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL;
+ ScalingStatDistributionEntry const* ssd = proto->GetScalingStatDistribution() ? sScalingStatDistributionStore.LookupEntry(proto->GetScalingStatDistribution()) : NULL;
if (only_level_scale && !ssd)
return;
@@ -7828,12 +7828,12 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
if (ssd->StatID[i] < 0)
continue;
statType = ssd->StatID[i];
- val = (ssv->GetStatMultiplier(proto->InventoryType) * ssd->Modifier[i]) / 10000;
+ val = (ssv->GetStatMultiplier(proto->GetInventoryType()) * ssd->Modifier[i]) / 10000;
}
else
{
- statType = proto->ItemStat[i].ItemStatType;
- val = proto->ItemStat[i].ItemStatValue;
+ statType = proto->GetItemStatType(i);
+ val = proto->GetItemStatValue(i);
}
if (val == 0)
@@ -8002,23 +8002,23 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
}
// Apply Spell Power from ScalingStatValue if set
- if (ssv && proto->Flags[1] & ITEM_FLAGS_EXTRA_CASTER_WEAPON)
+ if (ssv && proto->GetFlags2() & ITEM_FLAGS_EXTRA_CASTER_WEAPON)
if (int32 spellbonus = int32(ssv->SpellPower))
ApplySpellPowerBonus(spellbonus, apply);
// If set ScalingStatValue armor get it or use item armor
- uint32 armor = proto->Armor;
- if (ssv && proto->Class == ITEM_CLASS_ARMOR)
- armor = ssv->GetArmor(proto->InventoryType, proto->SubClass - 1);
- else if (armor && proto->ArmorDamageModifier)
- armor -= uint32(proto->ArmorDamageModifier);
+ uint32 armor = proto->GetBaseArmor();
+ if (ssv && proto->GetClass() == ITEM_CLASS_ARMOR)
+ armor = ssv->GetArmor(proto->GetInventoryType(), proto->GetSubClass() - 1);
+ else if (armor && proto->GetArmorDamageModifier())
+ armor -= uint32(proto->GetArmorDamageModifier());
if (armor)
{
UnitModifierType modType = TOTAL_VALUE;
- if (proto->Class == ITEM_CLASS_ARMOR)
+ if (proto->GetClass() == ITEM_CLASS_ARMOR)
{
- switch (proto->SubClass)
+ switch (proto->GetSubClass())
{
case ITEM_SUBCLASS_ARMOR_CLOTH:
case ITEM_SUBCLASS_ARMOR_LEATHER:
@@ -8033,14 +8033,14 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
}
// Add armor bonus from ArmorDamageModifier if > 0
- if (proto->ArmorDamageModifier > 0)
- HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->ArmorDamageModifier), apply);
+ if (proto->GetArmorDamageModifier() > 0)
+ HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->GetArmorDamageModifier()), apply);
WeaponAttackType attType = BASE_ATTACK;
if (slot == EQUIPMENT_SLOT_RANGED && (
- proto->InventoryType == INVTYPE_RANGED || proto->InventoryType == INVTYPE_THROWN ||
- proto->InventoryType == INVTYPE_RANGEDRIGHT))
+ proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_THROWN ||
+ proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
{
attType = RANGED_ATTACK;
}
@@ -8059,8 +8059,8 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
float damage = 0.0f;
if (slot == EQUIPMENT_SLOT_RANGED && (
- proto->InventoryType == INVTYPE_RANGED || proto->InventoryType == INVTYPE_THROWN ||
- proto->InventoryType == INVTYPE_RANGEDRIGHT))
+ proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_THROWN ||
+ proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
{
attType = RANGED_ATTACK;
}
@@ -8069,18 +8069,18 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
attType = OFF_ATTACK;
}
- float minDamage = proto->DamageMin;
- float maxDamage = proto->DamageMax;
+ float minDamage, maxDamage;
+ proto->GetBaseDamage(minDamage, maxDamage);
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
int32 extraDPS = 0;
if (ssv)
{
float damageMultiplier = 0.0f;
- extraDPS = ssv->GetDPSAndDamageMultiplier(proto->SubClass, (proto->Flags[1] & ITEM_FLAGS_EXTRA_CASTER_WEAPON) != 0, &damageMultiplier);
+ extraDPS = ssv->GetDPSAndDamageMultiplier(proto->GetSubClass(), (proto->GetFlags2() & ITEM_FLAGS_EXTRA_CASTER_WEAPON) != 0, &damageMultiplier);
if (extraDPS)
{
- float average = extraDPS * proto->Delay / 1000.0f;
+ float average = extraDPS * proto->GetDelay() / 1000.0f;
minDamage = (1.0f - damageMultiplier) * average;
maxDamage = (1.0f + damageMultiplier) * average;
}
@@ -8098,17 +8098,17 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
SetBaseWeaponDamage(attType, MAXDAMAGE, damage);
}
- if (proto->Delay && !IsInFeralForm())
+ if (proto->GetDelay() && !IsInFeralForm())
{
if (slot == EQUIPMENT_SLOT_RANGED)
- SetAttackTime(RANGED_ATTACK, apply ? proto->Delay: BASE_ATTACK_TIME);
+ SetAttackTime(RANGED_ATTACK, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
else if (slot == EQUIPMENT_SLOT_MAINHAND)
- SetAttackTime(BASE_ATTACK, apply ? proto->Delay: BASE_ATTACK_TIME);
+ SetAttackTime(BASE_ATTACK, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
else if (slot == EQUIPMENT_SLOT_OFFHAND)
- SetAttackTime(OFF_ATTACK, apply ? proto->Delay: BASE_ATTACK_TIME);
+ SetAttackTime(OFF_ATTACK, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
}
- if (CanModifyStats() && (damage || proto->Delay))
+ if (CanModifyStats() && (damage || proto->GetDelay()))
UpdateDamagePhysical(attType);
}
@@ -8298,7 +8298,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (ItemTemplate const* proto = item->GetTemplate())
{
// Additional check for weapons
- if (proto->Class == ITEM_CLASS_WEAPON)
+ if (proto->GetClass() == ITEM_CLASS_WEAPON)
{
// offhand item cannot proc from main hand hit etc
EquipmentSlots slot;
@@ -8406,7 +8406,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (entry)
{
if (entry->PPMChance)
- chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
+ chance = GetPPMProcChance(proto->GetDelay(), entry->PPMChance, spellInfo);
else if (entry->customChance)
chance = (float)entry->customChance;
}
@@ -8443,7 +8443,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
if (!spellInfo)
{
- TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
+ TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->GetId(), learn_spell_id);
SendEquipError(EQUIP_ERR_INTERNAL_BAG_ERROR, item, NULL);
return;
}
@@ -8472,7 +8472,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effectData.SpellID);
if (!spellInfo)
{
- TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, effectData.SpellID);
+ TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->GetId(), effectData.SpellID);
continue;
}
@@ -8531,7 +8531,7 @@ void Player::_RemoveAllItemMods()
continue;
// item set bonuses not dependent from item broken state
- if (proto->ItemSet)
+ if (proto->GetItemSet())
RemoveItemsSetItem(this, proto);
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
@@ -8595,7 +8595,7 @@ void Player::_ApplyAllItemMods()
continue;
// item set bonuses not dependent from item broken state
- if (proto->ItemSet)
+ if (proto->GetItemSet())
AddItemsSetItem(this, m_items[i]);
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
@@ -9780,7 +9780,7 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
slots[1] = NULL_SLOT;
slots[2] = NULL_SLOT;
slots[3] = NULL_SLOT;
- switch (proto->InventoryType)
+ switch (proto->GetInventoryType())
{
case INVTYPE_HEAD:
slots[0] = EQUIPMENT_SLOT_HEAD;
@@ -9848,7 +9848,7 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
{
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
{
- if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
+ if (mhWeaponProto->GetSubClass() == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->GetSubClass() == ITEM_SUBCLASS_WEAPON_STAFF)
{
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
break;
@@ -9858,13 +9858,13 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
if (GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
{
- if (proto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || proto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
+ if (proto->GetSubClass() == ITEM_SUBCLASS_WEAPON_POLEARM || proto->GetSubClass() == ITEM_SUBCLASS_WEAPON_STAFF)
{
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
break;
}
}
- if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF)
+ if (CanDualWield() && CanTitanGrip() && proto->GetSubClass() != ITEM_SUBCLASS_WEAPON_POLEARM && proto->GetSubClass() != ITEM_SUBCLASS_WEAPON_STAFF)
slots[1] = EQUIPMENT_SLOT_OFFHAND;
break;
case INVTYPE_TABARD:
@@ -9986,10 +9986,10 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (Bag* pBag = GetBagByPos(i))
count += pBag->GetItemCount(item, skipItem);
- if (skipItem && skipItem->GetTemplate()->GemProperties)
+ if (skipItem && skipItem->GetTemplate()->GetGemProperties())
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
+ if (pItem != skipItem && pItem->GetTemplate()->GetSocketColor(0))
count += pItem->GetGemCountWithID(item);
if (inBankAlso)
@@ -10004,10 +10004,10 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (Bag* pBag = GetBagByPos(i))
count += pBag->GetItemCount(item, skipItem);
- if (skipItem && skipItem->GetTemplate()->GemProperties)
+ if (skipItem && skipItem->GetTemplate()->GetGemProperties())
for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
+ if (pItem != skipItem && pItem->GetTemplate()->GetSocketColor(0))
count += pItem->GetGemCountWithID(item);
}
@@ -10021,7 +10021,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem)
if (ItemTemplate const* pProto = pItem->GetTemplate())
- if (pProto->ItemLimitCategory == limitCategory)
+ if (pProto->GetItemLimitCategory() == limitCategory)
count += pItem->GetCount();
for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
@@ -10032,7 +10032,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem)
if (ItemTemplate const* pProto = pItem->GetTemplate())
- if (pProto->ItemLimitCategory == limitCategory)
+ if (pProto->GetItemLimitCategory() == limitCategory)
count += pItem->GetCount();
for (int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
@@ -10120,7 +10120,7 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable /*= f
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, slot);
else
item = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
- if (!item || item->GetTemplate()->Class != ITEM_CLASS_WEAPON)
+ if (!item || item->GetTemplate()->GetClass() != ITEM_CLASS_WEAPON)
return NULL;
if (!useable)
@@ -10139,7 +10139,7 @@ Item* Player::GetShield(bool useable) const
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
else
item = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
- if (!item || item->GetTemplate()->Class != ITEM_CLASS_ARMOR)
+ if (!item || item->GetTemplate()->GetClass() != ITEM_CLASS_ARMOR)
return NULL;
if (!useable)
@@ -10336,7 +10336,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_
}
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
- if (pProto && pProto->GemProperties)
+ if (pProto && pProto->GetGemProperties())
{
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
@@ -10344,7 +10344,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_
continue;
Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if (pItem && pItem->GetTemplate()->Socket[0].Color)
+ if (pItem && pItem->GetTemplate()->GetSocketColor(0))
{
tempcount += pItem->GetGemCountWithID(item);
if (tempcount >= count)
@@ -10372,14 +10372,14 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32
if (!pProto)
continue;
- if (pProto->ItemLimitCategory == limitCategory)
+ if (pProto->GetItemLimitCategory() == limitCategory)
{
tempcount += pItem->GetCount();
if (tempcount >= count)
return true;
}
- if (pProto->Socket[0].Color || pItem->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
+ if (pProto->GetSocketColor(0) || pItem->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
{
tempcount += pItem->GetGemCountWithLimitCategory(limitCategory);
if (tempcount >= count)
@@ -10404,24 +10404,24 @@ InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item
return EQUIP_ERR_LOOT_GONE;
// no maximum
- if ((pProto->MaxCount <= 0 && pProto->ItemLimitCategory == 0) || pProto->MaxCount == 2147483647)
+ if ((pProto->GetMaxCount() <= 0 && pProto->GetItemLimitCategory() == 0) || pProto->GetMaxCount() == 2147483647)
return EQUIP_ERR_OK;
- if (pProto->MaxCount > 0)
+ if (pProto->GetMaxCount() > 0)
{
- uint32 curcount = GetItemCount(pProto->ItemId, true, pItem);
- if (curcount + count > uint32(pProto->MaxCount))
+ uint32 curcount = GetItemCount(pProto->GetId(), true, pItem);
+ if (curcount + count > uint32(pProto->GetMaxCount()))
{
if (no_space_count)
- *no_space_count = count + curcount - pProto->MaxCount;
+ *no_space_count = count + curcount - pProto->GetMaxCount();
return EQUIP_ERR_ITEM_MAX_COUNT;
}
}
// check unique-equipped limit
- if (pProto->ItemLimitCategory)
+ if (pProto->GetItemLimitCategory())
{
- ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(pProto->ItemLimitCategory);
+ ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(pProto->GetItemLimitCategory());
if (!limitEntry)
{
if (no_space_count)
@@ -10431,13 +10431,13 @@ InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item
if (limitEntry->Flags == ITEM_LIMIT_CATEGORY_MODE_HAVE)
{
- uint32 curcount = GetItemCountWithLimitCategory(pProto->ItemLimitCategory, pItem);
+ uint32 curcount = GetItemCountWithLimitCategory(pProto->GetItemLimitCategory(), pItem);
if (curcount + count > uint32(limitEntry->Quantity))
{
if (no_space_count)
*no_space_count = count + curcount - limitEntry->Quantity;
if (itemLimitCategory)
- *itemLimitCategory = pProto->ItemLimitCategory;
+ *itemLimitCategory = pProto->GetItemLimitCategory();
return EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS;
}
}
@@ -10491,7 +10491,7 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP
if (!pBagProto)
return EQUIP_ERR_WRONG_BAG_TYPE;
- if (slot >= pBagProto->ContainerSlots)
+ if (slot >= pBagProto->GetContainerSlots())
return EQUIP_ERR_WRONG_BAG_TYPE;
if (!ItemCanGoIntoBag(pProto, pBagProto))
@@ -10544,7 +10544,7 @@ InventoryResult Player::CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, Ite
return EQUIP_ERR_WRONG_BAG_TYPE;
// specialized bag mode or non-specilized
- if (non_specialized != (pBagProto->Class == ITEM_CLASS_CONTAINER && pBagProto->SubClass == ITEM_SUBCLASS_CONTAINER))
+ if (non_specialized != (pBagProto->GetClass() == ITEM_CLASS_CONTAINER && pBagProto->GetSubClass() == ITEM_SUBCLASS_CONTAINER))
return EQUIP_ERR_WRONG_BAG_TYPE;
if (!ItemCanGoIntoBag(pProto, pBagProto))
@@ -10718,7 +10718,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
if (bag != NULL_BAG)
{
// search stack in bag for merge to
- if (pProto->Stackable != 1)
+ if (pProto->GetMaxStackSize() != 1)
{
if (bag == INVENTORY_SLOT_BAG_0) // inventory
{
@@ -10815,7 +10815,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
// not specific bag or have space for partly store only in specific bag
// search stack for merge to
- if (pProto->Stackable != 1)
+ if (pProto->GetMaxStackSize() != 1)
{
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
@@ -10835,7 +10835,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
return EQUIP_ERR_ITEM_MAX_COUNT;
}
- if (pProto->BagFamily)
+ if (pProto->GetBagFamily())
{
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
@@ -10874,7 +10874,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
}
// search free slot - special bag case
- if (pProto->BagFamily)
+ if (pProto->GetBagFamily())
{
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
@@ -10999,7 +10999,7 @@ InventoryResult Player::CanStoreItems(Item** items, int count, uint32* itemLimit
return res;
// search stack for merge to
- if (pProto->Stackable != 1)
+ if (pProto->GetMaxStackSize() != 1)
{
bool b_found = false;
@@ -11040,7 +11040,7 @@ InventoryResult Player::CanStoreItems(Item** items, int count, uint32* itemLimit
}
// special bag case
- if (pProto->BagFamily)
+ if (pProto->GetBagFamily())
{
bool b_found = false;
@@ -11051,7 +11051,7 @@ InventoryResult Player::CanStoreItems(Item** items, int count, uint32* itemLimit
pBagProto = bag->GetTemplate();
// not plain container check
- if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
+ if (pBagProto && (pBagProto->GetClass() != ITEM_CLASS_CONTAINER || pBagProto->GetSubClass() != ITEM_SUBCLASS_CONTAINER) &&
ItemCanGoIntoBag(pProto, pBagProto))
{
for (uint32 j = 0; j < bag->GetBagSize(); j++)
@@ -11092,14 +11092,14 @@ InventoryResult Player::CanStoreItems(Item** items, int count, uint32* itemLimit
pBagProto = bag->GetTemplate();
// special bag already checked
- if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
+ if (pBagProto && (pBagProto->GetClass() != ITEM_CLASS_CONTAINER || pBagProto->GetSubClass() != ITEM_SUBCLASS_CONTAINER))
continue;
for (uint32 j = 0; j < bag->GetBagSize(); j++)
{
- if (bagCounts[t-INVENTORY_SLOT_BAG_START][j] == 0)
+ if (bagCounts[t - INVENTORY_SLOT_BAG_START][j] == 0)
{
- bagCounts[t-INVENTORY_SLOT_BAG_START][j] = 1;
+ bagCounts[t - INVENTORY_SLOT_BAG_START][j] = 1;
b_found = true;
break;
}
@@ -11172,14 +11172,14 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
}
- if (IsInCombat()&& (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer != 0)
+ if (IsInCombat() && (pProto->GetClass() == ITEM_CLASS_WEAPON || pProto->GetInventoryType() == INVTYPE_RELIC) && m_weaponChangeTimer != 0)
return EQUIP_ERR_CLIENT_LOCKED_OUT; // maybe exist better err
if (IsNonMeleeSpellCast(false))
return EQUIP_ERR_CLIENT_LOCKED_OUT;
}
- ScalingStatDistributionEntry const* ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0;
+ ScalingStatDistributionEntry const* ssd = pProto->GetScalingStatDistribution() ? sScalingStatDistributionStore.LookupEntry(pProto->GetScalingStatDistribution()) : 0;
// check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < getLevel())
return EQUIP_ERR_NOT_EQUIPPABLE;
@@ -11230,22 +11230,22 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
return res2;
// check unique-equipped special item classes
- if (pProto->Class == ITEM_CLASS_QUIVER)
+ if (pProto->GetClass() == ITEM_CLASS_QUIVER)
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
if (Item* pBag = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pBag != pItem)
if (ItemTemplate const* pBagProto = pBag->GetTemplate())
- if (pBagProto->Class == pProto->Class && (!swap || pBag->GetSlot() != eslot))
- return (pBagProto->SubClass == ITEM_SUBCLASS_AMMO_POUCH)
+ if (pBagProto->GetClass() == pProto->GetClass() && (!swap || pBag->GetSlot() != eslot))
+ return (pBagProto->GetSubClass() == ITEM_SUBCLASS_AMMO_POUCH)
? EQUIP_ERR_ONLY_ONE_AMMO
: EQUIP_ERR_ONLY_ONE_QUIVER;
- uint32 type = pProto->InventoryType;
+ uint32 type = pProto->GetInventoryType();
if (eslot == EQUIPMENT_SLOT_OFFHAND)
{
// Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
- if (type == INVTYPE_WEAPON && pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM)
+ if (type == INVTYPE_WEAPON && pProto->GetSubClass() == ITEM_SUBCLASS_WEAPON_POLEARM)
return EQUIP_ERR_2HSKILLNOTFOUND;
else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
{
@@ -11356,7 +11356,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
if (pItem->IsCurrencyToken())
{
TC_LOG_ERROR("entities.player", "Possible hacking attempt: Player %s [%s] tried to move token [%s entry: %u] out of the currency bag!",
- GetName().c_str(), GetGUID().ToString().c_str(), pItem->GetGUID().ToString().c_str(), pProto->ItemId);
+ GetName().c_str(), GetGUID().ToString().c_str(), pItem->GetGUID().ToString().c_str(), pProto->GetId());
return EQUIP_ERR_CANT_SWAP;
}
@@ -11398,7 +11398,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
return EQUIP_ERR_BAG_IN_BAG;
// search stack in bag for merge to
- if (pProto->Stackable != 1)
+ if (pProto->GetMaxStackSize() != 1)
{
if (bag == INVENTORY_SLOT_BAG_0)
{
@@ -11450,7 +11450,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
// not specific bag or have space for partly store only in specific bag
// search stack for merge to
- if (pProto->Stackable != 1)
+ if (pProto->GetMaxStackSize() != 1)
{
// in slots
res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
@@ -11461,7 +11461,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
return EQUIP_ERR_OK;
// in special bags
- if (pProto->BagFamily)
+ if (pProto->GetBagFamily())
{
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
@@ -11486,7 +11486,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
}
// search free place in special bag
- if (pProto->BagFamily)
+ if (pProto->GetBagFamily())
{
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
@@ -11546,7 +11546,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const
bool allowEquip = false;
uint32 itemSkill = pItem->GetSkill();
// Armor that is binded to account can "morph" from plate to mail, etc. if skill is not learned yet.
- if (pProto->Quality == ITEM_QUALITY_HEIRLOOM && pProto->Class == ITEM_CLASS_ARMOR && !HasSkill(itemSkill))
+ if (pProto->GetQuality() == ITEM_QUALITY_HEIRLOOM && pProto->GetClass() == ITEM_CLASS_ARMOR && !HasSkill(itemSkill))
{
/// @todo when you right-click already equipped item it throws EQUIP_ERR_PROFICIENCY_NEEDED.
// In fact it's a visual bug, everything works properly... I need sniffs of operations with
@@ -11568,7 +11568,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const
return EQUIP_ERR_PROFICIENCY_NEEDED;
}
- if (pProto->RequiredReputationFaction && uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank)
+ if (pProto->GetRequiredReputationFaction() && uint32(GetReputationRank(pProto->GetRequiredReputationFaction())) < pProto->GetRequiredReputationRank())
return EQUIP_ERR_CANT_EQUIP_REPUTATION;
return EQUIP_ERR_OK;
@@ -11584,31 +11584,31 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
if (!proto)
return EQUIP_ERR_ITEM_NOT_FOUND;
- if ((proto->Flags[1] & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
+ if ((proto->GetFlags2() & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
return EQUIP_ERR_CANT_EQUIP_EVER;
- if ((proto->Flags[1] & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
+ if ((proto->GetFlags2() & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
return EQUIP_ERR_CANT_EQUIP_EVER;
- if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
+ if ((proto->GetAllowableClass() & getClassMask()) == 0 || (proto->GetAllowableRace() & getRaceMask()) == 0)
return EQUIP_ERR_CANT_EQUIP_EVER;
- if (proto->RequiredSkill != 0)
+ if (proto->GetRequiredSkill() != 0)
{
- if (GetSkillValue(proto->RequiredSkill) == 0)
+ if (GetSkillValue(proto->GetRequiredSkill()) == 0)
return EQUIP_ERR_PROFICIENCY_NEEDED;
- else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
+ else if (GetSkillValue(proto->GetRequiredSkill()) < proto->GetRequiredSkillRank())
return EQUIP_ERR_CANT_EQUIP_SKILL;
}
- if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
+ if (proto->GetRequiredSpell() != 0 && !HasSpell(proto->GetRequiredSpell()))
return EQUIP_ERR_PROFICIENCY_NEEDED;
- if (getLevel() < proto->RequiredLevel)
+ if (getLevel() < proto->GetRequiredLevel())
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
// If World Event is not active, prevent using event dependant items
- if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
+ if (proto->GetHolidayID() && !IsHolidayActive(proto->GetHolidayID()))
return EQUIP_ERR_CLIENT_LOCKED_OUT;
// learning (recipes, mounts, pets, etc.)
@@ -11643,54 +11643,54 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje
SKILL_FISHING
}; //Copy from function Item::GetSkill()
- if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
+ if ((proto->GetAllowableClass() & getClassMask()) == 0 || (proto->GetAllowableRace() & getRaceMask()) == 0)
return EQUIP_ERR_CANT_EQUIP_EVER;
- if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
+ if (proto->GetRequiredSpell() != 0 && !HasSpell(proto->GetRequiredSpell()))
return EQUIP_ERR_PROFICIENCY_NEEDED;
- if (proto->RequiredSkill != 0)
+ if (proto->GetRequiredSkill() != 0)
{
- if (!GetSkillValue(proto->RequiredSkill))
+ if (!GetSkillValue(proto->GetRequiredSkill()))
return EQUIP_ERR_PROFICIENCY_NEEDED;
- else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
+ else if (GetSkillValue(proto->GetRequiredSkill()) < proto->GetRequiredSkillRank())
return EQUIP_ERR_CANT_EQUIP_SKILL;
}
uint8 _class = getClass();
- if (proto->Class == ITEM_CLASS_WEAPON && GetSkillValue(item_weapon_skills[proto->SubClass]) == 0)
+ if (proto->GetClass() == ITEM_CLASS_WEAPON && GetSkillValue(item_weapon_skills[proto->GetSubClass()]) == 0)
return EQUIP_ERR_PROFICIENCY_NEEDED;
- if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass > ITEM_SUBCLASS_ARMOR_MISCELLANEOUS && proto->SubClass < ITEM_SUBCLASS_ARMOR_BUCKLER && proto->InventoryType != INVTYPE_CLOAK)
+ if (proto->GetClass() == ITEM_CLASS_ARMOR && proto->GetSubClass() > ITEM_SUBCLASS_ARMOR_MISCELLANEOUS && proto->GetSubClass() < ITEM_SUBCLASS_ARMOR_BUCKLER && proto->GetInventoryType() != INVTYPE_CLOAK)
{
if (_class == CLASS_WARRIOR || _class == CLASS_PALADIN || _class == CLASS_DEATH_KNIGHT)
{
if (getLevel() < 40)
{
- if (proto->SubClass != ITEM_SUBCLASS_ARMOR_MAIL)
+ if (proto->GetSubClass() != ITEM_SUBCLASS_ARMOR_MAIL)
return EQUIP_ERR_CLIENT_LOCKED_OUT;
}
- else if (proto->SubClass != ITEM_SUBCLASS_ARMOR_PLATE)
+ else if (proto->GetSubClass() != ITEM_SUBCLASS_ARMOR_PLATE)
return EQUIP_ERR_CLIENT_LOCKED_OUT;
}
else if (_class == CLASS_HUNTER || _class == CLASS_SHAMAN)
{
if (getLevel() < 40)
{
- if (proto->SubClass != ITEM_SUBCLASS_ARMOR_LEATHER)
+ if (proto->GetSubClass() != ITEM_SUBCLASS_ARMOR_LEATHER)
return EQUIP_ERR_CLIENT_LOCKED_OUT;
}
- else if (proto->SubClass != ITEM_SUBCLASS_ARMOR_MAIL)
+ else if (proto->GetSubClass() != ITEM_SUBCLASS_ARMOR_MAIL)
return EQUIP_ERR_CLIENT_LOCKED_OUT;
}
if (_class == CLASS_ROGUE || _class == CLASS_DRUID)
- if (proto->SubClass != ITEM_SUBCLASS_ARMOR_LEATHER)
+ if (proto->GetSubClass() != ITEM_SUBCLASS_ARMOR_LEATHER)
return EQUIP_ERR_CLIENT_LOCKED_OUT;
if (_class == CLASS_MAGE || _class == CLASS_PRIEST || _class == CLASS_WARLOCK)
- if (proto->SubClass != ITEM_SUBCLASS_ARMOR_CLOTH)
+ if (proto->GetSubClass() != ITEM_SUBCLASS_ARMOR_CLOTH)
return EQUIP_ERR_CLIENT_LOCKED_OUT;
}
@@ -11783,9 +11783,9 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
if (!pItem)
return NULL;
- if (pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
- pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
- (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
+ if (pItem->GetTemplate()->GetBonding() == BIND_WHEN_PICKED_UP ||
+ pItem->GetTemplate()->GetBonding() == BIND_QUEST_ITEM ||
+ (pItem->GetTemplate()->GetBonding() == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem->SetBinding(true);
Bag* pBag = (bag == INVENTORY_SLOT_BAG_0) ? NULL : GetBagByPos(bag);
@@ -11826,9 +11826,9 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
}
else
{
- if (pItem2->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
- pItem2->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
- (pItem2->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
+ if (pItem2->GetTemplate()->GetBonding() == BIND_WHEN_PICKED_UP ||
+ pItem2->GetTemplate()->GetBonding() == BIND_QUEST_ITEM ||
+ (pItem2->GetTemplate()->GetBonding() == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem2->SetBinding(true);
pItem2->SetCount(pItem2->GetCount() + count);
@@ -11900,12 +11900,12 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
ItemTemplate const* pProto = pItem->GetTemplate();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
- if (pProto && pProto->ItemSet)
+ if (pProto && pProto->GetItemSet())
AddItemsSetItem(this, pItem);
_ApplyItemMods(pItem, slot, true);
- if (pProto && IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
+ if (pProto && IsInCombat() && (pProto->GetClass() == ITEM_CLASS_WEAPON || pProto->GetInventoryType() == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
{
uint32 cooldownSpell = getClass() == CLASS_ROGUE ? 6123 : 6119;
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
@@ -12029,7 +12029,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem)
return;
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
- if (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM)
+ if (pItem->GetTemplate()->GetBonding() == BIND_WHEN_EQUIPED || pItem->GetTemplate()->GetBonding() == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->GetBonding() == BIND_QUEST_ITEM)
pItem->SetBinding(true);
TC_LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry());
@@ -12075,7 +12075,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
ItemTemplate const* pProto = pItem->GetTemplate();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
- if (pProto && pProto->ItemSet)
+ if (pProto && pProto->GetItemSet())
RemoveItemsSetItem(this, pProto);
_ApplyItemMods(pItem, slot, false);
@@ -12222,7 +12222,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
ItemTemplate const* pProto = pItem->GetTemplate();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
- if (pProto && pProto->ItemSet)
+ if (pProto && pProto->GetItemSet())
RemoveItemsSetItem(this, pProto);
_ApplyItemMods(pItem, slot, false);
@@ -12261,7 +12261,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
// Delete rolled money / loot from db.
// MUST be done before RemoveFromWorld() or GetTemplate() fails
if (ItemTemplate const* pTmp = pItem->GetTemplate())
- if (pTmp->Flags[0] & ITEM_PROTO_FLAG_OPENABLE)
+ if (pTmp->GetFlags() & ITEM_PROTO_FLAG_OPENABLE)
pItem->ItemContainerDeleteLootMoneyAndLootItemsFromDB();
if (IsInWorld() && update)
@@ -13039,7 +13039,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 4), pItem->GetGUID());
if (ItemTemplate const* proto = pItem->GetTemplate())
- SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->SellPrice * pItem->GetCount());
+ SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->GetSellPrice() * pItem->GetCount());
else
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
@@ -13103,7 +13103,7 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint
case EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW:
{
ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
- data << uint32(proto ? proto->RequiredLevel : 0);
+ data << uint32(proto ? proto->GetRequiredLevel() : 0);
break;
}
default:
@@ -13142,7 +13142,7 @@ bool Player::IsUseEquipedWeapon(bool mainhand) const
bool Player::IsTwoHandUsed() const
{
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
- return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
+ return mainItem && mainItem->GetTemplate()->GetInventoryType() == INVTYPE_2HWEAPON && !CanTitanGrip();
}
void Player::TradeCancel(bool sendback)
@@ -13377,13 +13377,13 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
// Cogwheel gems dont have requirement data set in SpellItemEnchantment.dbc, but they do have it in Item-sparse.db2
if (ItemTemplate const* gem = sObjectMgr->GetItemTemplate(pEnchant->SRCItemID))
- if (gem->RequiredSkill && GetSkillValue(gem->RequiredSkill) < gem->RequiredSkillRank)
+ if (gem->GetRequiredSkill() && GetSkillValue(gem->GetRequiredSkill()) < gem->GetRequiredSkillRank())
return;
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
if ((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
- && !item->GetTemplate()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
+ && !item->GetTemplate()->GetSocketColor(slot - SOCK_ENCHANTMENT_SLOT))
{
// Check if the requirements for the prismatic socket are met before applying the gem stats
SpellItemEnchantmentEntry const* pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
@@ -13674,12 +13674,12 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
float addValue = 0.0f;
if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
{
- addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
+ addValue = float(enchant_amount * item->GetTemplate()->GetDelay() / 1000.0f);
HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply);
}
else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
{
- addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
+ addValue = float(enchant_amount * item->GetTemplate()->GetDelay() / 1000.0f);
HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply);
}
}
@@ -13753,7 +13753,7 @@ void Player::UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
if ((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
- && !m_items[i]->GetTemplate()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
+ && !m_items[i]->GetTemplate()->GetSocketColor(slot - SOCK_ENCHANTMENT_SLOT))
{
SpellItemEnchantmentEntry const* pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
@@ -14592,7 +14592,7 @@ void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver)
bool destroyItem = true;
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- if (quest->RequiredItemId[i] == item->GetEntry() && item->GetTemplate()->MaxCount > 0)
+ if (quest->RequiredItemId[i] == item->GetEntry() && item->GetTemplate()->GetMaxCount() > 0)
{
destroyItem = false;
break;
@@ -15500,7 +15500,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
ASSERT(item);
bool destroyItem = true;
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
- if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
+ if (item->GetStartQuest() == questId && srcItemId == quest->RequiredItemId[n])
destroyItem = false;
if (destroyItem)
@@ -16304,7 +16304,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
// 'unique' item
- if (pProto->MaxCount && int32(GetItemCount(itemid, true)) < pProto->MaxCount)
+ if (pProto->GetMaxCount() && int32(GetItemCount(itemid, true)) < pProto->GetMaxCount())
return true;
// allows custom amount drop when not 0
@@ -17805,7 +17805,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
remove = true;
}
// "Conjured items disappear if you are logged out for more than 15 minutes"
- else if (timeDiff > 15 * MINUTE && proto->Flags[0] & ITEM_PROTO_FLAG_CONJURED)
+ else if (timeDiff > 15 * MINUTE && proto->GetFlags() & ITEM_PROTO_FLAG_CONJURED)
{
TC_LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (%s, name: '%s', diff: %u) has conjured item (%s, entry: %u) with expired lifetime (15 minutes). Deleting item.",
GetGUID().ToString().c_str(), GetName().c_str(), timeDiff, item->GetGUID().ToString().c_str(), item->GetEntry());
@@ -17871,14 +17871,14 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE);
}
}
- else if (proto->HolidayId)
+ else if (proto->GetHolidayID())
{
remove = true;
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
{
- if (uint32(events[*itr].holiday_id) == proto->HolidayId)
+ if (uint32(events[*itr].holiday_id) == proto->GetHolidayID())
{
remove = false;
break;
@@ -18689,7 +18689,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
else if (mapDiff->hasErrorMessage) // if (missingAchievement) covered by this case
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
else if (missingItem)
- GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), LevelMin, sObjectMgr->GetItemTemplate(missingItem)->Name1.c_str());
+ GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), LevelMin, sObjectMgr->GetItemTemplate(missingItem)->GetName(GetSession()->GetSessionDbcLocale()));
else if (LevelMin)
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED), LevelMin);
}
@@ -21304,7 +21304,7 @@ void Player::InitDisplayIds()
inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore)
{
- uint32 stacks = count / pProto->BuyCount;
+ uint32 stacks = count / pProto->GetBuyCount();
ItemPosCountVec vDest;
uint16 uiDest = 0;
InventoryResult msg = bStore ?
@@ -21356,7 +21356,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
if (!bStore)
AutoUnequipOffhandIfNeed();
- if (pProto->Flags[0] & ITEM_PROTO_FLAG_REFUNDABLE && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1)
+ if (pProto->GetFlags() & ITEM_PROTO_FLAG_REFUNDABLE && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1)
{
it->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
it->SetRefundRecipient(GetGUID());
@@ -21542,13 +21542,13 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
return false;
}
- if (!(pProto->AllowableClass & getClassMask()) && pProto->Bonding == BIND_WHEN_PICKED_UP && !IsGameMaster())
+ if (!(pProto->GetAllowableClass() & getClassMask()) && pProto->GetBonding() == BIND_WHEN_PICKED_UP && !IsGameMaster())
{
SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0);
return false;
}
- if (!IsGameMaster() && ((pProto->Flags[1] & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeam() == ALLIANCE) || (pProto->Flags[1] == ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeam() == HORDE)))
+ if (!IsGameMaster() && ((pProto->GetFlags2() & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeam() == ALLIANCE) || (pProto->GetFlags2() == ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeam() == HORDE)))
return false;
Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
@@ -21591,14 +21591,14 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
// check current item amount if it limited
if (crItem->maxcount != 0)
{
- if (creature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
+ if (creature->GetVendorItemCurrentCount(crItem) < pProto->GetBuyCount() * count)
{
SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0);
return false;
}
}
- if (pProto->RequiredReputationFaction && (uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank))
+ if (pProto->GetRequiredReputationFaction() && (uint32(GetReputationRank(pProto->GetRequiredReputationFaction())) < pProto->GetRequiredReputationRank()))
{
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0);
return false;
@@ -21607,17 +21607,17 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
if (crItem->ExtendedCost)
{
// Can only buy full stacks for extended cost
- if (count % pProto->BuyCount)
+ if (count % pProto->GetBuyCount())
{
SendEquipError(EQUIP_ERR_CANT_BUY_QUANTITY, NULL, NULL);
return false;
}
- uint32 stacks = count / pProto->BuyCount;
+ uint32 stacks = count / pProto->GetBuyCount();
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
if (!iece)
{
- TC_LOG_ERROR("entities.player", "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
+ TC_LOG_ERROR("entities.player", "Item %u have wrong ExtendedCost field value %u", pProto->GetId(), crItem->ExtendedCost);
return false;
}
@@ -21682,15 +21682,15 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
}
uint32 price = 0;
- if (crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32)
+ if (crItem->IsGoldRequired(pProto) && pProto->GetBuyPrice() > 0) //Assume price cannot be negative (do not know why it is int32)
{
- uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
+ uint32 maxCount = MAX_MONEY_AMOUNT / pProto->GetBuyPrice();
if ((uint32)count > maxCount)
{
- TC_LOG_ERROR("entities.player", "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId);
+ TC_LOG_ERROR("entities.player", "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->GetId());
count = (uint8)maxCount;
}
- price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
+ price = pProto->GetBuyPrice() * count; //it should not exceed MAX_MONEY_AMOUNT
// reputation discount
price = uint32(floor(price * GetReputationPriceDiscount(creature)));
@@ -21728,7 +21728,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
if (crItem->maxcount != 0) // bought
{
- if (pProto->Quality > ITEM_QUALITY_EPIC || (pProto->Quality == ITEM_QUALITY_EPIC && pProto->ItemLevel >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
+ if (pProto->GetQuality() > ITEM_QUALITY_EPIC || (pProto->GetQuality() == ITEM_QUALITY_EPIC && pProto->GetBaseItemLevel() >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
if (Guild* guild = GetGuild())
guild->AddGuildNews(GUILD_NEWS_ITEM_PURCHASED, GetGUID(), 0, item);
return true;
@@ -22103,7 +22103,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
if (i == slot)
continue;
Item* pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if (pItem2 && !pItem2->IsBroken() && pItem2->GetTemplate()->Socket[0].Color)
+ if (pItem2 && !pItem2->IsBroken() && pItem2->GetTemplate()->GetSocketColor(0))
{
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{
@@ -22123,7 +22123,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
if (!gemProto)
continue;
- GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
+ GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GetGemProperties());
if (!gemProperty)
continue;
@@ -22180,7 +22180,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply)
Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
- if (!pItem || !pItem->GetTemplate()->Socket[0].Color)
+ if (!pItem || !pItem->GetTemplate()->GetSocketColor(0))
continue;
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
@@ -22222,7 +22222,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply)
Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
- if (!pItem || !pItem->GetTemplate()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
+ if (!pItem || !pItem->GetTemplate()->GetSocketColor(0)) //if item has no sockets or no item is equipped go to next item
continue;
//cycle all (gem)enchants
@@ -23717,11 +23717,11 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
return;
// unequip offhand weapon if player doesn't have dual wield anymore
- if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
+ if (!CanDualWield() && (offItem->GetTemplate()->GetInventoryType() == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->GetInventoryType() == INVTYPE_WEAPON))
force = true;
// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
- if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
+ if (!force && (CanTitanGrip() || (offItem->GetTemplate()->GetInventoryType() != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
return;
ItemPosCountVec off_dest;
@@ -24951,7 +24951,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
--loot->unlootedCount;
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
- if (proto->Quality > ITEM_QUALITY_EPIC || (proto->Quality == ITEM_QUALITY_EPIC && proto->ItemLevel >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
+ if (proto->GetQuality() > ITEM_QUALITY_EPIC || (proto->GetQuality() == ITEM_QUALITY_EPIC && proto->GetBaseItemLevel() >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
if (Guild* guild = GetGuild())
guild->AddGuildNews(GUILD_NEWS_ITEM_LOOTED, GetGUID(), 0, item->itemid);
@@ -25121,8 +25121,8 @@ InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limi
continue;
// include for check equip another gems with same limit category for not equipped item (and then not counted)
- uint32 gem_limit_count = !pItem->IsEquipped() && pGem->ItemLimitCategory
- ? pItem->GetGemCountWithLimitCategory(pGem->ItemLimitCategory) : 1;
+ uint32 gem_limit_count = !pItem->IsEquipped() && pGem->GetItemLimitCategory()
+ ? pItem->GetGemCountWithLimitCategory(pGem->GetItemLimitCategory()) : 1;
if (InventoryResult res = CanEquipUniqueItem(pGem, eslot, gem_limit_count))
return res;
@@ -25134,17 +25134,17 @@ InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limi
InventoryResult Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot, uint32 limit_count) const
{
// check unique-equipped on item
- if (itemProto->Flags[0] & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
+ if (itemProto->GetFlags() & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
{
// there is an equip limit on this item
- if (HasItemOrGemWithIdEquipped(itemProto->ItemId, 1, except_slot))
+ if (HasItemOrGemWithIdEquipped(itemProto->GetId(), 1, except_slot))
return EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE;
}
// check unique-equipped limit
- if (itemProto->ItemLimitCategory)
+ if (itemProto->GetItemLimitCategory())
{
- ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(itemProto->ItemLimitCategory);
+ ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(itemProto->GetItemLimitCategory());
if (!limitEntry)
return EQUIP_ERR_NOT_EQUIPPABLE;
@@ -25154,7 +25154,7 @@ InventoryResult Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8
return EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS;
// there is an equip limit on this item
- if (HasItemOrGemWithLimitCategoryEquipped(itemProto->ItemLimitCategory, limitEntry->Quantity - limit_count + 1, except_slot))
+ if (HasItemOrGemWithLimitCategoryEquipped(itemProto->GetItemLimitCategory(), limitEntry->Quantity - limit_count + 1, except_slot))
return EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED;
}
@@ -26368,7 +26368,7 @@ float Player::GetAverageItemLevel()
continue;
if (m_items[i] && m_items[i]->GetTemplate())
- sum += m_items[i]->GetTemplate()->GetItemLevelIncludingQuality();
+ sum += m_items[i]->GetItemLevel();
++count;
}
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5761fac56e2..412948034b2 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -406,7 +406,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
{
float weaponSpeed = BASE_ATTACK_TIME / 1000.f;
if (Item* weapon = GetWeaponForAttack(BASE_ATTACK, true))
- weaponSpeed = weapon->GetTemplate()->Delay / 1000;
+ weaponSpeed = weapon->GetTemplate()->GetDelay() / 1000;
if (GetShapeshiftForm() == FORM_CAT)
{
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index be26299f6fd..35bd9767b77 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12938,7 +12938,7 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
if (!Weapon)
return 2.4f; // fist attack
- switch (Weapon->GetTemplate()->InventoryType)
+ switch (Weapon->GetTemplate()->GetInventoryType())
{
case INVTYPE_2HWEAPON:
return 3.3f;
@@ -12950,7 +12950,7 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
default:
- return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
+ return Weapon->GetTemplate()->GetSubClass() == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
}
}
@@ -13128,14 +13128,14 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const
if (player->IsInFeralForm())
return false;
- if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->GetSubClass()) & spellProto->EquippedItemSubClassMask))
return false;
}
else if (spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
{
// Check if player is wearing shield
Item* item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
- if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->GetSubClass()) & spellProto->EquippedItemSubClassMask))
return false;
}
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 4da985c7bb6..bbd11c830c9 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2273,106 +2273,6 @@ void ObjectMgr::LoadItemLocales()
TC_LOG_INFO("server.loading", ">> Loaded %u Item locale strings in %u ms", uint32(_itemLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
-void FillItemDamageFields(float* minDamage, float* maxDamage, float* dps, uint32 itemLevel, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32 delay, float statScalingFactor, uint32 inventoryType, uint32 flags2)
-{
- *minDamage = *maxDamage = *dps = 0.0f;
- if (itemClass != ITEM_CLASS_WEAPON || quality > ITEM_QUALITY_ARTIFACT)
- return;
-
- DBCStorage<ItemDamageEntry>* store = NULL;
- // get the right store here
- if (inventoryType > 0xD + 13)
- return;
-
- switch (inventoryType)
- {
- case INVTYPE_AMMO:
- store = &sItemDamageAmmoStore;
- break;
- case INVTYPE_2HWEAPON:
- if (flags2 & ITEM_FLAGS_EXTRA_CASTER_WEAPON)
- store = &sItemDamageTwoHandCasterStore;
- else
- store = &sItemDamageTwoHandStore;
- break;
- case INVTYPE_RANGED:
- case INVTYPE_THROWN:
- case INVTYPE_RANGEDRIGHT:
- switch (itemSubClass)
- {
- case ITEM_SUBCLASS_WEAPON_WAND:
- store = &sItemDamageWandStore;
- break;
- case ITEM_SUBCLASS_WEAPON_THROWN:
- store = &sItemDamageThrownStore;
- break;
- case ITEM_SUBCLASS_WEAPON_BOW:
- case ITEM_SUBCLASS_WEAPON_GUN:
- case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- store = &sItemDamageRangedStore;
- break;
- default:
- return;
- }
- break;
- case INVTYPE_WEAPON:
- case INVTYPE_WEAPONMAINHAND:
- case INVTYPE_WEAPONOFFHAND:
- if (flags2 & ITEM_FLAGS_EXTRA_CASTER_WEAPON)
- store = &sItemDamageOneHandCasterStore;
- else
- store = &sItemDamageOneHandStore;
- break;
- default:
- return;
- }
-
- ASSERT(store);
-
- ItemDamageEntry const* damageInfo = store->LookupEntry(itemLevel);
- if (!damageInfo)
- return;
-
- *dps = damageInfo->DPS[quality];
- float avgDamage = *dps * delay * 0.001f;
- *minDamage = (statScalingFactor * -0.5f + 1.0f) * avgDamage;
- *maxDamage = floor(float(avgDamage* (statScalingFactor * 0.5f + 1.0f) + 0.5f));
-}
-
-uint32 FillItemArmor(uint32 itemlevel, uint32 itemClass, uint32 itemSubclass, uint32 quality, uint32 inventoryType)
-{
- if (quality > ITEM_QUALITY_ARTIFACT)
- return 0;
-
- // all items but shields
- if (itemClass != ITEM_CLASS_ARMOR || itemSubclass != ITEM_SUBCLASS_ARMOR_SHIELD)
- {
- ItemArmorQualityEntry const* armorQuality = sItemArmorQualityStore.LookupEntry(itemlevel);
- ItemArmorTotalEntry const* armorTotal = sItemArmorTotalStore.LookupEntry(itemlevel);
- if (!armorQuality || !armorTotal)
- return 0;
-
- if (inventoryType == INVTYPE_ROBE)
- inventoryType = INVTYPE_CHEST;
-
- ArmorLocationEntry const* location = sArmorLocationStore.LookupEntry(inventoryType);
- if (!location)
- return 0;
-
- if (itemSubclass < ITEM_SUBCLASS_ARMOR_CLOTH || itemSubclass > ITEM_SUBCLASS_ARMOR_PLATE)
- return 0;
-
- return uint32(armorQuality->QualityMod[quality] * armorTotal->Value[itemSubclass - 1] * location->Modifier[itemSubclass - 1] + 0.5f);
- }
-
- // shields
- ItemArmorShieldEntry const* shield = sItemArmorShieldStore.LookupEntry(itemlevel);
- if (!shield)
- return 0;
-
- return uint32(shield->Quality[quality] + 0.5f);
-}
-
uint32 FillMaxDurability(uint32 itemClass, uint32 itemSubClass, uint32 inventoryType, uint32 quality, uint32 itemLevel)
{
if (itemClass != ITEM_CLASS_ARMOR && itemClass != ITEM_CLASS_WEAPON)
@@ -2460,12 +2360,12 @@ void FillDisenchantFields(uint32* disenchantID, uint32* requiredDisenchantSkill,
{
*disenchantID = 0;
*(int32*)requiredDisenchantSkill = -1;
- if ((itemTemplate.Flags[0] & (ITEM_PROTO_FLAG_CONJURED | ITEM_PROTO_FLAG_UNK6)) ||
- itemTemplate.Bonding == BIND_QUEST_ITEM || itemTemplate.Area || itemTemplate.Map ||
- itemTemplate.Stackable > 1 ||
- itemTemplate.Quality < ITEM_QUALITY_UNCOMMON || itemTemplate.Quality > ITEM_QUALITY_EPIC ||
- !(itemTemplate.Class == ITEM_CLASS_ARMOR || itemTemplate.Class == ITEM_CLASS_WEAPON) ||
- !(Item::GetSpecialPrice(&itemTemplate) || sItemCurrencyCostStore.LookupEntry(itemTemplate.ItemId)))
+ if ((itemTemplate.GetFlags() & (ITEM_PROTO_FLAG_CONJURED | ITEM_PROTO_FLAG_UNK6)) ||
+ itemTemplate.GetBonding() == BIND_QUEST_ITEM || itemTemplate.GetArea() || itemTemplate.GetMap() ||
+ itemTemplate.GetMaxStackSize() > 1 ||
+ itemTemplate.GetQuality() < ITEM_QUALITY_UNCOMMON || itemTemplate.GetQuality() > ITEM_QUALITY_EPIC ||
+ !(itemTemplate.GetClass() == ITEM_CLASS_ARMOR || itemTemplate.GetClass() == ITEM_CLASS_WEAPON) ||
+ !(Item::GetSpecialPrice(&itemTemplate) || sItemCurrencyCostStore.LookupEntry(itemTemplate.GetId())))
return;
for (uint32 i = 0; i < sItemDisenchantLootStore.GetNumRows(); ++i)
@@ -2474,19 +2374,19 @@ void FillDisenchantFields(uint32* disenchantID, uint32* requiredDisenchantSkill,
if (!disenchant)
continue;
- if (disenchant->ItemClass == itemTemplate.Class &&
- disenchant->ItemQuality == itemTemplate.Quality &&
- disenchant->MinItemLevel <= itemTemplate.ItemLevel &&
- disenchant->MaxItemLevel >= itemTemplate.ItemLevel)
+ if (disenchant->ItemClass == itemTemplate.GetClass() &&
+ disenchant->ItemQuality == itemTemplate.GetQuality() &&
+ disenchant->MinItemLevel <= itemTemplate.GetBaseItemLevel() &&
+ disenchant->MaxItemLevel >= itemTemplate.GetBaseItemLevel())
{
if (disenchant->ID == 60 || disenchant->ID == 61) // epic item disenchant ilvl range 66-99 (classic)
{
- if (itemTemplate.RequiredLevel > 60 || itemTemplate.RequiredSkillRank > 300)
+ if (itemTemplate.GetRequiredLevel() > 60 || itemTemplate.GetRequiredSkillRank() > 300)
continue; // skip to epic item disenchant ilvl range 90-199 (TBC)
}
else if (disenchant->ID == 66 || disenchant->ID == 67) // epic item disenchant ilvl range 90-199 (TBC)
{
- if (itemTemplate.RequiredLevel <= 60 || (itemTemplate.RequiredSkill && itemTemplate.RequiredSkillRank <= 300))
+ if (itemTemplate.GetRequiredLevel() <= 60 || (itemTemplate.GetRequiredSkill() && itemTemplate.GetRequiredSkillRank() <= 300))
continue;
}
@@ -2501,7 +2401,6 @@ void ObjectMgr::LoadItemTemplates()
{
uint32 oldMSTime = getMSTime();
uint32 sparseCount = 0;
- uint32 dbCount = 0;
for (uint32 itemId = 0; itemId < sItemSparseStore.GetNumRows(); ++itemId)
{
@@ -2512,97 +2411,17 @@ void ObjectMgr::LoadItemTemplates()
ItemTemplate& itemTemplate = _itemTemplateStore[itemId];
- itemTemplate.ItemId = itemId;
- itemTemplate.Class = db2Data->Class;
- itemTemplate.SubClass = db2Data->SubClass;
- itemTemplate.SoundOverrideSubclass = db2Data->SoundOverrideSubclass;
- itemTemplate.Name1 = sparse->Name->Str[sWorld->GetDefaultDbcLocale()];
- itemTemplate.DisplayInfoID = GetItemDisplayID(db2Data->FileDataID);
- itemTemplate.FileDataID = db2Data->FileDataID;
- itemTemplate.GroupSoundsID = db2Data->GroupSoundsID;
- itemTemplate.Quality = sparse->Quality;
- memcpy(itemTemplate.Flags, sparse->Flags, sizeof(itemTemplate.Flags));
- itemTemplate.Unk1 = sparse->Unk1;
- itemTemplate.Unk2 = sparse->Unk2;
- itemTemplate.BuyCount = std::max(sparse->BuyCount, 1u);
- itemTemplate.BuyPrice = sparse->BuyPrice;
- itemTemplate.SellPrice = sparse->SellPrice;
- itemTemplate.InventoryType = db2Data->InventoryType;
- itemTemplate.AllowableClass = sparse->AllowableClass;
- itemTemplate.AllowableRace = sparse->AllowableRace;
- itemTemplate.ItemLevel = sparse->ItemLevel;
- itemTemplate.RequiredLevel = sparse->RequiredLevel;
- itemTemplate.RequiredSkill = sparse->RequiredSkill;
- itemTemplate.RequiredSkillRank = sparse->RequiredSkillRank;
- itemTemplate.RequiredSpell = sparse->RequiredSpell;
- itemTemplate.RequiredHonorRank = sparse->RequiredHonorRank;
- itemTemplate.RequiredCityRank = sparse->RequiredCityRank;
- itemTemplate.RequiredReputationFaction = sparse->RequiredReputationFaction;
- itemTemplate.RequiredReputationRank = sparse->RequiredReputationRank;
- itemTemplate.MaxCount = sparse->MaxCount;
- itemTemplate.Stackable = sparse->Stackable;
- itemTemplate.ContainerSlots = sparse->ContainerSlots;
- for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
- {
- itemTemplate.ItemStat[i].ItemStatType = sparse->ItemStatType[i];
- itemTemplate.ItemStat[i].ItemStatValue = sparse->ItemStatValue[i];
- itemTemplate.ItemStat[i].ItemStatUnk1 = sparse->ItemStatUnk1[i];
- itemTemplate.ItemStat[i].ItemStatUnk2 = sparse->ItemStatUnk2[i];
- }
-
- itemTemplate.ScalingStatDistribution = sparse->ScalingStatDistribution;
-
- // cache item damage
- FillItemDamageFields(&itemTemplate.DamageMin, &itemTemplate.DamageMax, &itemTemplate.DPS, sparse->ItemLevel,
- db2Data->Class, db2Data->SubClass, sparse->Quality, sparse->Delay, sparse->StatScalingFactor,
- sparse->InventoryType, sparse->Flags[1]);
-
- itemTemplate.DamageType = sparse->DamageType;
- itemTemplate.Armor = FillItemArmor(sparse->ItemLevel, db2Data->Class, db2Data->SubClass, sparse->Quality, sparse->InventoryType);
- itemTemplate.Delay = sparse->Delay;
- itemTemplate.RangedModRange = sparse->RangedModRange;
+ itemTemplate.BasicData = db2Data;
+ itemTemplate.ExtendedData = sparse;
- itemTemplate.SpellPPMRate = 0.0f;
- itemTemplate.Bonding = sparse->Bonding;
- itemTemplate.Description = sparse->Description->Str[sWorld->GetDefaultDbcLocale()];
- itemTemplate.PageText = sparse->PageText;
- itemTemplate.LanguageID = sparse->LanguageID;
- itemTemplate.PageMaterial = sparse->PageMaterial;
- itemTemplate.StartQuest = sparse->StartQuest;
- itemTemplate.LockID = sparse->LockID;
- itemTemplate.Material = sparse->Material;
- itemTemplate.Sheath = sparse->Sheath;
- itemTemplate.RandomProperty = sparse->RandomProperty;
- itemTemplate.RandomSuffix = sparse->RandomSuffix;
- itemTemplate.ItemSet = sparse->ItemSet;
itemTemplate.MaxDurability = FillMaxDurability(db2Data->Class, db2Data->SubClass, sparse->InventoryType, sparse->Quality, sparse->ItemLevel);
- itemTemplate.Area = sparse->Area;
- itemTemplate.Map = sparse->Map;
- itemTemplate.BagFamily = sparse->BagFamily;
- itemTemplate.TotemCategory = sparse->TotemCategory;
- for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i)
- {
- itemTemplate.Socket[i].Color = sparse->SocketColor[i];
- // TODO: 6.x update/remove this
- itemTemplate.Socket[i].Content = 0;
- }
-
- itemTemplate.socketBonus = sparse->SocketBonus;
- itemTemplate.GemProperties = sparse->GemProperties;
- FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate);
-
- itemTemplate.ArmorDamageModifier = sparse->ArmorDamageModifier;
- itemTemplate.Duration = sparse->Duration;
- itemTemplate.ItemLimitCategory = sparse->ItemLimitCategory;
- itemTemplate.HolidayId = sparse->HolidayID;
- itemTemplate.StatScalingFactor = sparse->StatScalingFactor;
- itemTemplate.CurrencySubstitutionId = sparse->CurrencySubstitutionID;
- itemTemplate.CurrencySubstitutionCount = sparse->CurrencySubstitutionCount;
- itemTemplate.ItemNameDescriptionID = sparse->ItemNameDescriptionID;
itemTemplate.ScriptId = 0;
+ FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate);
itemTemplate.FoodType = 0;
itemTemplate.MinMoneyLoot = 0;
itemTemplate.MaxMoneyLoot = 0;
+ itemTemplate.FlagsCu = 0;
+ itemTemplate.SpellPPMRate = 0.0f;
++sparseCount;
}
@@ -2617,8 +2436,6 @@ void ObjectMgr::LoadItemTemplates()
if (itemItr == _itemTemplateStore.end())
continue;
- ItemTemplate& itemTemplate = itemItr->second;
-
ItemEffect effect;
effect.SpellID = effectEntry->SpellID;
effect.Trigger = effectEntry->Trigger;
@@ -2626,168 +2443,7 @@ void ObjectMgr::LoadItemTemplates()
effect.Cooldown = effectEntry->Cooldown;
effect.Category = effectEntry->Category;
effect.CategoryCooldown = effectEntry->CategoryCooldown;
- itemTemplate.Effects.push_back(effect);
- }
-
- // Load missing items from item_template AND overwrite data from Item-sparse.db2 (item_template is supposed to contain Item-sparse.adb data)
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- QueryResult result = WorldDatabase.Query("SELECT entry, Class, SubClass, SoundOverrideSubclass, Name, DisplayId, Quality, Flags, FlagsExtra, Unk430_1, Unk430_2, BuyCount, BuyPrice, SellPrice, "
- // 14 15 16 17 18 19 20 21
- "InventoryType, AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, "
- // 22 23 24 25 26 27 28
- "RequiredHonorRank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, "
- // 29 30 31 32 33 34 35 36
- "stat_type1, stat_value1, stat_unk1_1, stat_unk2_1, stat_type2, stat_value2, stat_unk1_2, stat_unk2_2, "
- // 37 38 39 40 41 42 43 44
- "stat_type3, stat_value3, stat_unk1_3, stat_unk2_3, stat_type4, stat_value4, stat_unk1_4, stat_unk2_4, "
- // 45 46 47 48 49 50 51 52
- "stat_type5, stat_value5, stat_unk1_5, stat_unk2_5, stat_type6, stat_value6, stat_unk1_6, stat_unk2_6, "
- // 53 54 55 56 57 58 59 60
- "stat_type7, stat_value7, stat_unk1_7, stat_unk2_7, stat_type8, stat_value8, stat_unk1_8, stat_unk2_8, "
- // 61 62 63 64 65 66 67 68
- "stat_type9, stat_value9, stat_unk1_9, stat_unk2_9, stat_type10, stat_value10, stat_unk1_10, stat_unk2_10, "
- // 69 70 71 72
- "ScalingStatDistribution, DamageType, Delay, RangedModRange, "
- // 73 74 75 76 77 78
- "spellid_1, spelltrigger_1, spellcharges_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, "
- // 79 80 81 82 83 84
- "spellid_2, spelltrigger_2, spellcharges_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, "
- // 85 86 87 88 89 90
- "spellid_3, spelltrigger_3, spellcharges_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, "
- // 91 92 93 94 95 96
- "spellid_4, spelltrigger_4, spellcharges_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, "
- // 97 98 99 100 101 102
- "spellid_5, spelltrigger_5, spellcharges_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, "
- // 103 104 105 106 107 108 109 110
- "Bonding, Description, PageText, LanguageID, PageMaterial, StartQuest, LockID, Material, "
- // 111 112 113 114 115 116 117 118
- "Sheath, RandomProperty, RandomSuffix, ItemSet, Area, Map, BagFamily, TotemCategory, "
- // 119 120 121 122 123 124 125
- "SocketColor_1, SocketContent_1, SocketColor_2, SocketContent_2, SocketColor_3, SocketContent_3, SocketBonus, "
- // 126 127 128 129 130 131
- "GemProperties, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, StatScalingFactor, "
- // 132 133
- "CurrencySubstitutionId, CurrencySubstitutionCount "
- "FROM item_template");
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 itemId = fields[0].GetUInt32();
- if (_itemTemplateStore.find(itemId) != _itemTemplateStore.end())
- --sparseCount;
-
- ItemTemplate& itemTemplate = _itemTemplateStore[itemId];
-
- itemTemplate.ItemId = itemId;
- itemTemplate.Class = uint32(fields[1].GetUInt8());
- itemTemplate.SubClass = uint32(fields[2].GetUInt8());
- itemTemplate.SoundOverrideSubclass = fields[3].GetInt8();
- itemTemplate.Name1 = fields[4].GetString();
- itemTemplate.DisplayInfoID = fields[5].GetUInt32();
- itemTemplate.Quality = uint32(fields[6].GetUInt8());
- itemTemplate.Flags[0] = fields[7].GetUInt32();
- itemTemplate.Flags[1] = fields[8].GetUInt32();
- itemTemplate.Unk1 = fields[9].GetFloat();
- itemTemplate.Unk2 = fields[10].GetFloat();
- itemTemplate.BuyCount = uint32(fields[11].GetUInt8());
- itemTemplate.BuyPrice = int32(fields[12].GetInt64());
- itemTemplate.SellPrice = fields[13].GetUInt32();
-
- itemTemplate.InventoryType = uint32(fields[14].GetUInt8());
- itemTemplate.AllowableClass = fields[15].GetInt32();
- itemTemplate.AllowableRace = fields[16].GetInt32();
- itemTemplate.ItemLevel = uint32(fields[17].GetUInt16());
- itemTemplate.RequiredLevel = uint32(fields[18].GetUInt8());
- itemTemplate.RequiredSkill = uint32(fields[19].GetUInt16());
- itemTemplate.RequiredSkillRank = uint32(fields[20].GetUInt16());
- itemTemplate.RequiredSpell = fields[21].GetUInt32();
- itemTemplate.RequiredHonorRank = fields[22].GetUInt32();
- itemTemplate.RequiredCityRank = fields[23].GetUInt32();
- itemTemplate.RequiredReputationFaction = uint32(fields[24].GetUInt16());
- itemTemplate.RequiredReputationRank = uint32(fields[25].GetUInt16());
- itemTemplate.MaxCount = fields[26].GetInt32();
- itemTemplate.Stackable = fields[27].GetInt32();
- itemTemplate.ContainerSlots = uint32(fields[28].GetUInt8());
- for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
- {
- itemTemplate.ItemStat[i].ItemStatType = uint32(fields[29 + i * 4 + 0].GetUInt8());
- itemTemplate.ItemStat[i].ItemStatValue = int32(fields[29 + i * 4 + 1].GetInt16());
- itemTemplate.ItemStat[i].ItemStatUnk1 = fields[29 + i * 4 + 2].GetInt32();
- itemTemplate.ItemStat[i].ItemStatUnk2 = fields[29 + i * 4 + 3].GetInt32();
- }
-
- itemTemplate.ScalingStatDistribution = uint32(fields[69].GetUInt16());
-
- // cache item damage
- FillItemDamageFields(&itemTemplate.DamageMin, &itemTemplate.DamageMax, &itemTemplate.DPS, itemTemplate.ItemLevel,
- itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, fields[71].GetUInt16(),
- fields[131].GetFloat(), itemTemplate.InventoryType, itemTemplate.Flags[1]);
-
- itemTemplate.DamageType = fields[70].GetUInt8();
- itemTemplate.Armor = FillItemArmor(itemTemplate.ItemLevel, itemTemplate.Class,
- itemTemplate.SubClass, itemTemplate.Quality,
- itemTemplate.InventoryType);
-
- itemTemplate.Delay = fields[71].GetUInt16();
- itemTemplate.RangedModRange = fields[72].GetFloat();
- // TODO: 6.x move this to new itemeffect table (probably itemeffect_dbc?)
- itemTemplate.Effects.resize(3);
- for (uint32 i = 0; i < 3; ++i)
- {
- itemTemplate.Effects[i].SpellID = fields[73 + 6 * i + 0].GetInt32();
- itemTemplate.Effects[i].Trigger = uint32(fields[73 + 6 * i + 1].GetUInt8());
- itemTemplate.Effects[i].Charges = int32(fields[73 + 6 * i + 2].GetInt16());
- itemTemplate.Effects[i].Cooldown = fields[73 + 6 * i + 3].GetInt32();
- itemTemplate.Effects[i].Category = uint32(fields[73 + 6 * i + 4].GetUInt16());
- itemTemplate.Effects[i].CategoryCooldown = fields[73 + 6 * i + 5].GetInt32();
- }
-
- itemTemplate.SpellPPMRate = 0.0f;
- itemTemplate.Bonding = uint32(fields[103].GetUInt8());
- itemTemplate.Description = fields[104].GetString();
- itemTemplate.PageText = fields[105].GetUInt32();
- itemTemplate.LanguageID = uint32(fields[106].GetUInt8());
- itemTemplate.PageMaterial = uint32(fields[107].GetUInt8());
- itemTemplate.StartQuest = fields[108].GetUInt32();
- itemTemplate.LockID = fields[109].GetUInt32();
- itemTemplate.Material = int32(fields[110].GetInt8());
- itemTemplate.Sheath = uint32(fields[111].GetUInt8());
- itemTemplate.RandomProperty = fields[112].GetUInt32();
- itemTemplate.RandomSuffix = fields[113].GetInt32();
- itemTemplate.ItemSet = fields[114].GetUInt32();
- itemTemplate.MaxDurability = FillMaxDurability(itemTemplate.Class, itemTemplate.SubClass,
- itemTemplate.InventoryType, itemTemplate.Quality, itemTemplate.ItemLevel);
-
- itemTemplate.Area = fields[115].GetUInt32();
- itemTemplate.Map = uint32(fields[116].GetUInt16());
- itemTemplate.BagFamily = fields[117].GetUInt32();
- itemTemplate.TotemCategory = fields[118].GetUInt32();
- for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i)
- {
- itemTemplate.Socket[i].Color = uint32(fields[119 + i*2].GetUInt8());
- itemTemplate.Socket[i].Content = fields[119 + i * 2 + 1].GetUInt32();
- }
-
- itemTemplate.socketBonus = fields[125].GetUInt32();
- itemTemplate.GemProperties = fields[126].GetUInt32();
- FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate);
-
- itemTemplate.ArmorDamageModifier = fields[127].GetFloat();
- itemTemplate.Duration = fields[128].GetUInt32();
- itemTemplate.ItemLimitCategory = uint32(fields[129].GetInt16());
- itemTemplate.HolidayId = fields[130].GetUInt32();
- itemTemplate.StatScalingFactor = fields[131].GetFloat();
- itemTemplate.CurrencySubstitutionId = fields[132].GetInt32();
- itemTemplate.CurrencySubstitutionCount = fields[133].GetInt32();
- itemTemplate.ScriptId = 0;
- itemTemplate.FoodType = 0;
- itemTemplate.MinMoneyLoot = 0;
- itemTemplate.MaxMoneyLoot = 0;
- ++dbCount;
- } while (result->NextRow());
+ itemItr->second.Effects.push_back(effect);
}
// Check if item templates for DBC referenced character start outfit are present
@@ -2813,7 +2469,7 @@ void ObjectMgr::LoadItemTemplates()
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
- TC_LOG_INFO("server.loading", ">> Loaded %u item templates from Item-sparse.db2 and %u from database in %u ms", sparseCount, dbCount, GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u item templates in %u ms", sparseCount, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemTemplateAddon()
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 14f845dcd1b..9b83ce27392 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -28,7 +28,7 @@
#include "TemporarySummon.h"
#include "Corpse.h"
#include "QuestDef.h"
-#include "ItemPrototype.h"
+#include "ItemTemplate.h"
#include "NPCHandler.h"
#include "DatabaseEnv.h"
#include "Mail.h"
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 9c4a2a5a2d1..88cc2b54388 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -956,7 +956,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
}
//roll for over-threshold item if it's one-player loot
- if (item->Quality >= uint32(m_lootThreshold))
+ if (item->GetQuality() >= uint32(m_lootThreshold))
{
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>()->Generate());
Roll* r = new Roll(newitemGUID, *i);
@@ -1101,7 +1101,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
item = sObjectMgr->GetItemTemplate(i->itemid);
//roll for over-threshold item if it's one-player loot
- if (item->Quality >= uint32(m_lootThreshold))
+ if (item->GetQuality() >= uint32(m_lootThreshold))
{
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>()->Generate());
Roll* r = new Roll(newitemGUID, *i);
@@ -1134,7 +1134,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
if (item->DisenchantID && m_maxEnchantingLevel >= item->RequiredDisenchantSkill)
r->rollVoteMask |= ROLL_FLAG_TYPE_DISENCHANT;
- if (item->Flags[1] & ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED)
+ if (item->GetFlags2() & ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED)
r->rollVoteMask &= ~ROLL_FLAG_TYPE_NEED;
loot->items[itemSlot].is_blocked = true;
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 0b703d4bcb2..d3dddfcfd3a 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -1022,7 +1022,7 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const
sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(),
"GM %s (%s) (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank named: %s (Guild ID: " UI64FMTD ")",
m_pPlayer->GetName().c_str(), m_pPlayer->GetGUID().ToString().c_str(), m_pPlayer->GetSession()->GetAccountId(),
- pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(),
+ pFrom->GetItem()->GetTemplate()->GetDefaultLocaleName(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(),
m_pGuild->GetName().c_str(), m_pGuild->GetId());
}
}
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index fcd96ec9370..70474f593b9 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -210,11 +210,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
}
if (itemEntry == 0)
- itemEntry = item->GetTemplate()->ItemId;
+ itemEntry = item->GetTemplate()->GetId();
if (sAuctionMgr->GetAItem(item->GetGUID().GetCounter()) || !item->CanBeTraded() || item->IsNotEmptyBag() ||
- item->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
- item->GetCount() < count[i] || itemEntry != item->GetTemplate()->ItemId)
+ item->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
+ item->GetCount() < count[i] || itemEntry != item->GetTemplate()->GetId())
{
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
@@ -279,7 +279,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
if (HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->GetDefaultLocaleName(), item->GetEntry(), item->GetCount());
}
AH->Id = sObjectMgr->GenerateAuctionID();
@@ -296,7 +296,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->auctionHouseEntry = auctionHouseEntry;
TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: %s %s is selling item %s %s to auctioneer " UI64FMTD " with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u",
- _player->GetGUID().ToString().c_str(), _player->GetName().c_str(), item->GetGUID().ToString().c_str(), item->GetTemplate()->Name1.c_str(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ _player->GetGUID().ToString().c_str(), _player->GetName().c_str(), item->GetGUID().ToString().c_str(), item->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(item);
auctionHouse->AddAuction(AH);
@@ -327,7 +327,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
if (HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->GetDefaultLocaleName(), newItem->GetEntry(), newItem->GetCount());
}
AH->Id = sObjectMgr->GenerateAuctionID();
@@ -344,7 +344,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->auctionHouseEntry = auctionHouseEntry;
TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: %s %s is selling %s %s to auctioneer " UI64FMTD " with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u",
- _player->GetGUID().ToString().c_str(), _player->GetName().c_str(), newItem->GetGUID().ToString().c_str(), newItem->GetTemplate()->Name1.c_str(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ _player->GetGUID().ToString().c_str(), _player->GetName().c_str(), newItem->GetGUID().ToString().c_str(), newItem->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(newItem);
auctionHouse->AddAuction(AH);
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 482661e35f5..b892cb67e29 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -334,7 +334,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
return;
}
- if (pItem->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_INDESTRUCTIBLE)
+ if (pItem->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_INDESTRUCTIBLE)
{
_player->SendEquipError(EQUIP_ERR_DROP_BOUND_ITEM, NULL, NULL);
return;
@@ -356,7 +356,7 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
Item* pItem = _player->GetItemByPos(bag, slot);
- if (pItem && pItem->GetTemplate()->PageText)
+ if (pItem && pItem->GetTemplate()->GetPageText())
{
WorldPacket data;
@@ -448,7 +448,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
ItemTemplate const* pProto = pItem->GetTemplate();
if (pProto)
{
- if (pProto->SellPrice > 0)
+ if (pProto->GetSellPrice() > 0)
{
if (count < pItem->GetCount()) // need split items
{
@@ -478,7 +478,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
_player->AddItemToBuyBackSlot(pItem);
}
- uint32 money = pProto->SellPrice * count;
+ uint32 money = pProto->GetSellPrice() * count;
_player->ModifyMoney(money);
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
}
@@ -664,12 +664,12 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
if (!_player->IsGameMaster()) // ignore conditions if GM on
{
// Respect allowed class
- if (!(itemTemplate->AllowableClass & _player->getClassMask()) && itemTemplate->Bonding == BIND_WHEN_PICKED_UP)
+ if (!(itemTemplate->GetAllowableClass() & _player->getClassMask()) && itemTemplate->GetBonding() == BIND_WHEN_PICKED_UP)
continue;
// Only display items in vendor lists for the team the player is on
- if ((itemTemplate->Flags[1] & ITEM_FLAGS_EXTRA_HORDE_ONLY && _player->GetTeam() == ALLIANCE) ||
- (itemTemplate->Flags[1] & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && _player->GetTeam() == HORDE))
+ if ((itemTemplate->GetFlags2() & ITEM_FLAGS_EXTRA_HORDE_ONLY && _player->GetTeam() == ALLIANCE) ||
+ (itemTemplate->GetFlags2() & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && _player->GetTeam() == HORDE))
continue;
// Items sold out are not displayed in list
@@ -684,7 +684,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
continue;
}
- int32 price = vendorItem->IsGoldRequired(itemTemplate) ? uint32(floor(itemTemplate->BuyPrice * discountMod)) : 0;
+ int32 price = vendorItem->IsGoldRequired(itemTemplate) ? uint32(floor(itemTemplate->GetBuyPrice() * discountMod)) : 0;
if (int32 priceMod = _player->GetTotalAuraModifier(SPELL_AURA_MOD_VENDOR_ITEMS_PRICES))
price -= CalculatePct(price, priceMod);
@@ -694,7 +694,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
item.ExtendedCostID = vendorItem->ExtendedCost;
item.Type = vendorItem->Type;
item.Quantity = leftInStock;
- item.StackCount = itemTemplate->BuyCount;
+ item.StackCount = itemTemplate->GetBuyCount();
item.Price = price;
item.Item.ItemID = vendorItem->item;
@@ -965,7 +965,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
return;
}
- if (!(gift->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_WRAPPER)) // cheating: non-wrapper wrapper
+ if (!(gift->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_WRAPPER)) // cheating: non-wrapper wrapper
{
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL);
return;
@@ -1016,7 +1016,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
}
// maybe not correct check (it is better than nothing)
- if (item->GetTemplate()->MaxCount > 0)
+ if (item->GetTemplate()->GetMaxCount() > 0)
{
_player->SendEquipError(EQUIP_ERR_CANT_WRAP_UNIQUE, item, NULL);
return;
@@ -1094,11 +1094,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS];
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage
- GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GemProperties) : NULL;
+ GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GetGemProperties()) : NULL;
// Find first prismatic socket
int32 firstPrismatic = 0;
- while (firstPrismatic < MAX_GEM_SOCKETS && itemProto->Socket[firstPrismatic].Color)
+ while (firstPrismatic < MAX_GEM_SOCKETS && itemProto->ExtendedData->SocketColor[firstPrismatic])
++firstPrismatic;
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //check for hack maybe
@@ -1107,7 +1107,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
continue;
// tried to put gem in socket where no socket exists (take care about prismatic sockets)
- if (!itemProto->Socket[i].Color)
+ if (!itemProto->ExtendedData->SocketColor[i])
{
// no prismatic socket
if (!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
@@ -1118,19 +1118,19 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
}
// tried to put normal gem in meta socket
- if (itemProto->Socket[i].Color == SOCKET_COLOR_META && GemProps[i]->Type != SOCKET_COLOR_META)
+ if (itemProto->GetSocketColor(i) == SOCKET_COLOR_META && GemProps[i]->Type != SOCKET_COLOR_META)
return;
// tried to put meta gem in normal socket
- if (itemProto->Socket[i].Color != SOCKET_COLOR_META && GemProps[i]->Type == SOCKET_COLOR_META)
+ if (itemProto->GetSocketColor(i) != SOCKET_COLOR_META && GemProps[i]->Type == SOCKET_COLOR_META)
return;
// tried to put normal gem in cogwheel socket
- if (itemProto->Socket[i].Color == SOCKET_COLOR_COGWHEEL && GemProps[i]->Type != SOCKET_COLOR_COGWHEEL)
+ if (itemProto->GetSocketColor(i) == SOCKET_COLOR_COGWHEEL && GemProps[i]->Type != SOCKET_COLOR_COGWHEEL)
return;
// tried to put cogwheel gem in normal socket
- if (itemProto->Socket[i].Color != SOCKET_COLOR_COGWHEEL && GemProps[i]->Type == SOCKET_COLOR_COGWHEEL)
+ if (itemProto->GetSocketColor(i) != SOCKET_COLOR_COGWHEEL && GemProps[i]->Type == SOCKET_COLOR_COGWHEEL)
return;
}
@@ -1152,7 +1152,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
ItemTemplate const* iGemProto = Gems[i]->GetTemplate();
// unique item (for new and already placed bit removed enchantments
- if (iGemProto->Flags[0] & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
+ if (iGemProto->GetFlags() & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
@@ -1161,7 +1161,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
if (Gems[j])
{
- if (iGemProto->ItemId == Gems[j]->GetEntry())
+ if (iGemProto->GetId() == Gems[j]->GetEntry())
{
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL);
return;
@@ -1171,7 +1171,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
{
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
{
- if (iGemProto->ItemId == enchantEntry->SRCItemID)
+ if (iGemProto->GetId() == enchantEntry->SRCItemID)
{
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL);
return;
@@ -1183,9 +1183,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
// unique limit type item
int32 limit_newcount = 0;
- if (iGemProto->ItemLimitCategory)
+ if (iGemProto->GetItemLimitCategory())
{
- if (ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
+ if (ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->GetItemLimitCategory()))
{
// NOTE: limitEntry->mode is not checked because if item has limit then it is applied in equip case
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
@@ -1193,7 +1193,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
if (Gems[j])
{
// new gem
- if (iGemProto->ItemLimitCategory == Gems[j]->GetTemplate()->ItemLimitCategory)
+ if (iGemProto->GetItemLimitCategory() == Gems[j]->GetTemplate()->GetItemLimitCategory())
++limit_newcount;
}
else if (OldEnchants[j])
@@ -1201,7 +1201,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
// existing gem
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if (ItemTemplate const* jProto = sObjectMgr->GetItemTemplate(enchantEntry->SRCItemID))
- if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
+ if (iGemProto->GetItemLimitCategory() == jProto->GetItemLimitCategory())
++limit_newcount;
}
}
@@ -1254,7 +1254,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
if (SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
{
_player->ApplyEnchantment(itemTarget, BONUS_ENCHANTMENT_SLOT, false);
- itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetTemplate()->socketBonus : 0), 0, 0, _player->GetGUID());
+ itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetTemplate()->GetSocketBonus() : 0), 0, 0, _player->GetGUID());
_player->ApplyEnchantment(itemTarget, BONUS_ENCHANTMENT_SLOT, true);
//it is not displayed, client has an inbuilt system to determine if the bonus is activated
}
@@ -1518,7 +1518,7 @@ void WorldSession::HandleTransmogrifyItems(WorldPacket& recvData)
transmogrified[i]->SetNotRefundable(player);
transmogrified[i]->ClearSoulboundTradeable(player);
- if (transmogrifier[i]->GetTemplate()->Bonding == BIND_WHEN_EQUIPED || transmogrifier[i]->GetTemplate()->Bonding == BIND_WHEN_USE)
+ if (transmogrifier[i]->GetTemplate()->GetBonding() == BIND_WHEN_EQUIPED || transmogrifier[i]->GetTemplate()->GetBonding() == BIND_WHEN_USE)
transmogrifier[i]->SetBinding(true);
transmogrifier[i]->SetOwnerGUID(player->GetGUID());
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 39e3edb30ed..78f15b1fda7 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -74,7 +74,7 @@ void BuildQuestReward(WorldPacket& data, Quest const* quest, Player* player)
{
ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId);
data << uint32(itemId);
- data << uint32(item ? item->DisplayInfoID : 0);
+ data << uint32(/*item ? item->DisplayInfoID :*/ 0);
data << uint32(quest->RewardItemIdCount[i]);
data << uint8(0); // Is currency
}
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 56c4feebf77..745e6f110aa 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -334,7 +334,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
ItemTemplate const* proto = pItem->GetTemplate();
// destroy only 5 items from stack in case prospecting and milling
- if (proto->Flags[0] & (ITEM_PROTO_FLAG_PROSPECTABLE | ITEM_PROTO_FLAG_MILLABLE))
+ if (proto->GetFlags() & (ITEM_PROTO_FLAG_PROSPECTABLE | ITEM_PROTO_FLAG_MILLABLE))
{
pItem->m_lootGenerated = false;
pItem->loot.clear();
@@ -350,7 +350,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
else
{
// Only delete item if no loot or money (unlooted loot is saved to db) or if it isn't an openable item
- if (pItem->loot.isLooted() || !(proto->Flags[0] & ITEM_PROTO_FLAG_OPENABLE))
+ if (pItem->loot.isLooted() || !(proto->GetFlags() & ITEM_PROTO_FLAG_OPENABLE))
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
}
return; // item can be looted only single player
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 60cde45e8c4..5cf8b32dd1f 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -252,7 +252,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (Item* item = player->GetItemByGuid(itemGUIDs[i]))
{
ItemTemplate const* itemProto = item->GetTemplate();
- if (!itemProto || !(itemProto->Flags[0] & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT))
+ if (!itemProto || !(itemProto->GetFlags() & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT))
{
accountBound = false;
break;
@@ -306,7 +306,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
}
}
- if (item->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
+ if (item->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
{
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
return;
@@ -350,7 +350,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
{
sLog->outCommand(GetAccountId(), "GM %s (%s) (Account: %u) mail item: %s (Entry: %u Count: %u) "
"to: %s (%s) (Account: %u)", GetPlayerName().c_str(), _player->GetGUID().ToString().c_str(), GetAccountId(),
- item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(),
+ item->GetTemplate()->GetDefaultLocaleName(), item->GetEntry(), item->GetCount(),
receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
}
@@ -575,7 +575,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
sender_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receiver mail item: %s (Entry: %u Count: %u) and send COD money: " UI64FMTD " to player: %s (Account: %u)",
- GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
+ GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->GetDefaultLocaleName(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
}
else if (!receiver)
sender_accId = ObjectMgr::GetPlayerAccountIdByGUID(sender_guid);
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 1326a6eeba2..819075a54c5 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -189,7 +189,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
}
ItemPosCountVec dest;
- InventoryResult msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount);
+ InventoryResult msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->GetBuyCount());
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, NULL, NULL, charterid);
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index a6bd43f72c6..0b468ca0b47 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -124,7 +124,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
}
// some item classes can be used only in equipped state
- if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped())
+ if (proto->GetInventoryType() != INVTYPE_NON_EQUIP && !pItem->IsEquipped())
{
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
return;
@@ -138,14 +138,14 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
}
// only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB)
- if (proto->Class == ITEM_CLASS_CONSUMABLE && !(proto->Flags[0] & ITEM_PROTO_FLAG_USEABLE_IN_ARENA) && pUser->InArena())
+ if (proto->GetClass() == ITEM_CLASS_CONSUMABLE && !(proto->GetFlags() & ITEM_PROTO_FLAG_USEABLE_IN_ARENA) && pUser->InArena())
{
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
return;
}
// don't allow items banned in arena
- if (proto->Flags[0] & ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA && pUser->InArena())
+ if (proto->GetFlags() & ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA && pUser->InArena())
{
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
return;
@@ -167,7 +167,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
}
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
- if (pItem->GetTemplate()->Bonding == BIND_WHEN_USE || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM)
+ if (pItem->GetTemplate()->GetBonding() == BIND_WHEN_USE || pItem->GetTemplate()->GetBonding() == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->GetBonding() == BIND_QUEST_ITEM)
{
if (!pItem->IsSoulBound())
{
@@ -219,16 +219,16 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
}
// Verify that the bag is an actual bag or wrapped item that can be used "normally"
- if (!(proto->Flags[0] & ITEM_PROTO_FLAG_OPENABLE) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
+ if (!(proto->GetFlags() & ITEM_PROTO_FLAG_OPENABLE) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
{
pUser->SendEquipError(EQUIP_ERR_CLIENT_LOCKED_OUT, item, NULL);
TC_LOG_ERROR("network", "Possible hacking attempt: Player %s [%s] tried to open item [%s, entry: %u] which is not openable!",
- pUser->GetName().c_str(), pUser->GetGUID().ToString().c_str(), item->GetGUID().ToString().c_str(), proto->ItemId);
+ pUser->GetName().c_str(), pUser->GetGUID().ToString().c_str(), item->GetGUID().ToString().c_str(), proto->GetId());
return;
}
// locked item
- uint32 lockId = proto->LockID;
+ uint32 lockId = proto->GetLockID();
if (lockId)
{
LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
@@ -371,7 +371,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::SpellCastRequest&
// not have spell in spellbook
return;
}
-
+
if (Player* plr = caster->ToPlayer())
{
uint32 specId = plr->GetActiveTalentSpec();
@@ -703,7 +703,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
data << uint32(0);
else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
- data << uint32(item->GetTemplate()->DisplayInfoID);
+ data << uint32(item->GetDisplayId());
else
data << uint32(0);
}
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 8a4a70ec0fb..dd5563e7a52 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -138,7 +138,7 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
data.WriteBit(creatorGuid[2]);
data.WriteBit(creatorGuid[3]);
data.WriteBit(creatorGuid[5]);
- data.WriteBit(item->GetTemplate()->LockID != 0);
+ data.WriteBit(item->GetTemplate()->GetLockID() != 0);
data.WriteBit(creatorGuid[0]);
itemData.WriteByteSeq(creatorGuid[1]);
@@ -179,7 +179,7 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
itemData.WriteByteSeq(giftCreatorGuid[7]);
itemData.WriteByteSeq(giftCreatorGuid[4]);
- itemData << uint32(item->GetTemplate()->ItemId);
+ itemData << uint32(item->GetTemplate()->GetId());
itemData.WriteByteSeq(giftCreatorGuid[0]);
@@ -227,7 +227,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
{
sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
- myItems[i]->GetTemplate()->Name1.c_str(), myItems[i]->GetEntry(), myItems[i]->GetCount(),
+ myItems[i]->GetTemplate()->GetDefaultLocaleName(), myItems[i]->GetEntry(), myItems[i]->GetCount(),
trader->GetName().c_str(), trader->GetSession()->GetAccountId());
}
@@ -245,7 +245,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
{
sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
- hisItems[i]->GetTemplate()->Name1.c_str(), hisItems[i]->GetEntry(), hisItems[i]->GetCount(),
+ hisItems[i]->GetTemplate()->GetDefaultLocaleName(), hisItems[i]->GetEntry(), hisItems[i]->GetCount(),
_player->GetName().c_str(), _player->GetSession()->GetAccountId());
}
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 5ec917c4381..9d65691b927 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -298,9 +298,9 @@ bool LootStoreItem::Roll(bool rate) const
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
- float qualityModifier = pProto && rate ? sWorld->getRate(qualityToRate[pProto->Quality]) : 1.0f;
+ float qualityModifier = pProto && rate ? sWorld->getRate(qualityToRate[pProto->GetQuality()]) : 1.0f;
- return roll_chance_f(chance*qualityModifier);
+ return roll_chance_f(chance * qualityModifier);
}
// Checks correctness of values
@@ -364,7 +364,7 @@ LootItem::LootItem(LootStoreItem const& li)
conditions = li.conditions;
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
- freeforall = proto && (proto->Flags[0] & ITEM_PROTO_FLAG_PARTY_LOOT);
+ freeforall = proto && (proto->GetFlags() & ITEM_PROTO_FLAG_PARTY_LOOT);
follow_loot_rules = proto && (proto->FlagsCu & ITEM_FLAGS_CU_FOLLOW_LOOT_RULES);
needs_quest = li.needs_quest;
@@ -391,18 +391,18 @@ bool LootItem::AllowedForPlayer(Player const* player) const
return false;
// not show loot for players without profession or those who already know the recipe
- if ((pProto->Flags[0] & ITEM_PROTO_FLAG_SMART_LOOT) && (!player->HasSkill(pProto->RequiredSkill) || player->HasSpell(pProto->Effects[1].SpellID)))
+ if ((pProto->GetFlags() & ITEM_PROTO_FLAG_SMART_LOOT) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1].SpellID)))
return false;
// not show loot for not own team
- if ((pProto->Flags[1] & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeam() != HORDE)
+ if ((pProto->GetFlags2() & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeam() != HORDE)
return false;
- if ((pProto->Flags[1] & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
+ if ((pProto->GetFlags2() & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
return false;
// check quest requirements
- if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
+ if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->GetStartQuest() && player->GetQuestStatus(pProto->GetStartQuest()) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
return false;
return true;
@@ -440,7 +440,7 @@ void Loot::AddItem(LootStoreItem const& item)
// non-conditional one-player only items are counted here,
// free for all items are counted in FillFFALoot(),
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
- if (!item.needs_quest && item.conditions.empty() && !(proto->Flags[0] & ITEM_PROTO_FLAG_PARTY_LOOT))
+ if (!item.needs_quest && item.conditions.empty() && !(proto->GetFlags() & ITEM_PROTO_FLAG_PARTY_LOOT))
++unlootedCount;
}
}
@@ -479,7 +479,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
for (uint8 i = 0; i < items.size(); ++i)
{
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(items[i].itemid))
- if (proto->Quality < uint32(group->GetLootThreshold()))
+ if (proto->GetQuality() < uint32(group->GetLootThreshold()))
items[i].is_underthreshold = true;
}
}
@@ -858,7 +858,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li)
{
b << uint32(li.itemid);
b << uint32(li.count); // nr of items of this type
- b << uint32(sObjectMgr->GetItemTemplate(li.itemid)->DisplayInfoID);
+ b << uint32(/*sObjectMgr->GetItemTemplate(li.itemid)->DisplayInfoID*/);
b << uint32(li.randomSuffix);
b << uint32(li.randomPropertyId);
//b << uint8(0); // slot type - will send after this function call
@@ -1657,8 +1657,8 @@ void LoadLootTemplates_Item()
// remove real entries and check existence loot
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
- if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end() && itr->second.Flags[0] & ITEM_PROTO_FLAG_OPENABLE)
- lootIdSet.erase(itr->second.ItemId);
+ if (lootIdSet.find(itr->second.GetId()) != lootIdSet.end() && itr->second.GetFlags() & ITEM_PROTO_FLAG_OPENABLE)
+ lootIdSet.erase(itr->second.GetId());
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Item.ReportUnusedIds(lootIdSet);
@@ -1682,11 +1682,11 @@ void LoadLootTemplates_Milling()
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
{
- if (!(itr->second.Flags[0] & ITEM_PROTO_FLAG_MILLABLE))
+ if (!(itr->second.GetFlags() & ITEM_PROTO_FLAG_MILLABLE))
continue;
- if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end())
- lootIdSet.erase(itr->second.ItemId);
+ if (lootIdSet.find(itr->second.GetId()) != lootIdSet.end())
+ lootIdSet.erase(itr->second.GetId());
}
// output error for any still listed (not referenced from appropriate table) ids
@@ -1745,11 +1745,11 @@ void LoadLootTemplates_Prospecting()
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
{
- if (!(itr->second.Flags[0] & ITEM_PROTO_FLAG_PROSPECTABLE))
+ if (!(itr->second.GetFlags() & ITEM_PROTO_FLAG_PROSPECTABLE))
continue;
- if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end())
- lootIdSet.erase(itr->second.ItemId);
+ if (lootIdSet.find(itr->second.GetId()) != lootIdSet.end())
+ lootIdSet.erase(itr->second.GetId());
}
// output error for any still listed (not referenced from appropriate table) ids
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index f39314ba119..3d9ee0367d5 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -250,7 +250,7 @@ void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
+ data << uint32(/*itemTemplate->DisplayInfoID*/);
else
data << uint32(0);
}
@@ -263,7 +263,7 @@ void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
+ data << uint32(/*itemTemplate->DisplayInfoID*/);
else
data << uint32(0);
}
diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp
index a99842cc2cb..b15b939f60c 100644
--- a/src/server/game/Server/Packets/CharacterPackets.cpp
+++ b/src/server/game/Server/Packets/CharacterPackets.cpp
@@ -118,8 +118,8 @@ WorldPackets::Character::EnumCharactersResult::CharacterInfo::CharacterInfo(Fiel
}
}
- VisualItems[slot].DisplayId = proto->DisplayInfoID;
- VisualItems[slot].InventoryType = uint8(proto->InventoryType);
+ VisualItems[slot].DisplayId = 0/*proto->DisplayInfoID*/;
+ VisualItems[slot].InventoryType = uint8(proto->GetInventoryType());
}
}
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 9037715152a..cf19e9df359 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -1849,7 +1849,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
else
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
- if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->GetSubClass()) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
}
}
@@ -1857,7 +1857,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
{
// Check if player is wearing shield
Item* item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
- if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->GetSubClass()) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
}
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index f376e0979b2..15a58cf76a8 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -623,7 +623,7 @@ m_spellValue(new SpellValue(caster->GetMap()->GetDifficulty(), m_spellInfo)), m_
// wand case
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
- m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->DamageType);
+ m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->GetDamageType());
if (!originalCasterGUID.IsEmpty())
m_originalCasterGUID = originalCasterGUID;
@@ -3831,8 +3831,8 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
if (effect->ItemType)
item = effect->ItemType;
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item);
- if (proto && proto->ItemLimitCategory)
- packet.FailedArg1 = proto->ItemLimitCategory;
+ if (proto && proto->GetItemLimitCategory())
+ packet.FailedArg1 = proto->GetItemLimitCategory();
break;
}
case SPELL_FAILED_PREVENTED_BY_MECHANIC:
@@ -4554,7 +4554,7 @@ void Spell::TakeCastItem()
if (charges)
{
(charges > 0) ? --charges : ++charges; // abs(charges) less at 1 after use
- if (proto->Stackable == 1)
+ if (proto->GetMaxStackSize() == 1)
m_CastItem->SetSpellCharges(i, charges);
m_CastItem->SetState(ITEM_CHANGED, player);
}
@@ -4764,7 +4764,7 @@ void Spell::TakeReagents()
ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : NULL;
// do not take reagents for these item casts
- if (castItemTemplate && castItemTemplate->Flags[0] & ITEM_PROTO_FLAG_TRIGGERED_CAST)
+ if (castItemTemplate && castItemTemplate->GetFlags() & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return;
Player* p_caster = m_caster->ToPlayer();
@@ -4780,7 +4780,7 @@ void Spell::TakeReagents()
uint32 itemcount = m_spellInfo->ReagentCount[x];
// if CastItem is also spell reagent
- if (castItemTemplate && castItemTemplate->ItemId == itemid)
+ if (castItemTemplate && castItemTemplate->GetId() == itemid)
{
for (int s = 0; s < castItemTemplate->Effects.size(); ++s)
{
@@ -5331,7 +5331,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!pet->HaveInDiet(foodItem->GetTemplate()))
return SPELL_FAILED_WRONG_PET_FOOD;
- if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel))
+ if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->GetBaseItemLevel()))
return SPELL_FAILED_FOOD_LOWLEVEL;
if (m_caster->IsInCombat() || pet->IsInCombat())
@@ -5439,7 +5439,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM_TARGET
if (effect->TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET &&
!m_targets.GetGOTarget() &&
- (!pTempItem || !pTempItem->GetTemplate()->LockID || !pTempItem->IsLocked()))
+ (!pTempItem || !pTempItem->GetTemplate()->GetLockID() || !pTempItem->IsLocked()))
return SPELL_FAILED_BAD_TARGETS;
if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() &&
@@ -5457,7 +5457,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
}
else if (Item* itm = m_targets.GetItemTarget())
- lockId = itm->GetTemplate()->LockID;
+ lockId = itm->GetTemplate()->GetLockID();
SkillType skillId = SKILL_NONE;
int32 reqSkillValue = 0;
@@ -6146,7 +6146,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_CHARGES_REMAIN;
// consumable cast item checks
- if (proto->Class == ITEM_CLASS_CONSUMABLE && m_targets.GetUnitTarget())
+ if (proto->GetClass() == ITEM_CLASS_CONSUMABLE && m_targets.GetUnitTarget())
{
// such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
SpellCastResult failReason = SPELL_CAST_OK;
@@ -6215,7 +6215,7 @@ SpellCastResult Spell::CheckItems()
}
// do not take reagents for these item casts
- if (!(m_CastItem && m_CastItem->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_TRIGGERED_CAST))
+ if (!(m_CastItem && m_CastItem->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_TRIGGERED_CAST))
{
bool checkReagents = !(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST) && !player->CanNoReagentCast(m_spellInfo);
// Not own traded item (in trader trade slot) requires reagents even if triggered spell
@@ -6295,7 +6295,7 @@ SpellCastResult Spell::CheckItems()
{
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(effect->ItemType);
/// @todo Needs review
- if (pProto && !(pProto->ItemLimitCategory))
+ if (pProto && !(pProto->GetItemLimitCategory()))
{
player->SendEquipError(msg, NULL, NULL, effect->ItemType);
return SPELL_FAILED_DONT_REPORT;
@@ -6322,7 +6322,7 @@ SpellCastResult Spell::CheckItems()
if (m_targets.GetItemTarget()->GetOwner() != m_caster)
return SPELL_FAILED_NOT_TRADEABLE;
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
- if (m_CastItem && m_CastItem->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_TRIGGERED_CAST)
+ if (m_CastItem && m_CastItem->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return SPELL_FAILED_TOTEM_CATEGORY;
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, effect->ItemType, 1);
@@ -6339,7 +6339,7 @@ SpellCastResult Spell::CheckItems()
if (!targetItem)
return SPELL_FAILED_ITEM_NOT_FOUND;
- if (targetItem->GetTemplate()->ItemLevel < m_spellInfo->BaseLevel)
+ if (targetItem->GetTemplate()->GetBaseItemLevel() < m_spellInfo->BaseLevel)
return SPELL_FAILED_LOWLEVEL;
bool isItemUsable = false;
@@ -6371,7 +6371,7 @@ SpellCastResult Spell::CheckItems()
{
uint32 numSockets = 0;
for (uint32 socket = 0; socket < MAX_ITEM_PROTO_SOCKETS; ++socket)
- if (targetItem->GetTemplate()->Socket[socket].Color)
+ if (targetItem->GetTemplate()->GetSocketColor(socket))
++numSockets;
if (numSockets == MAX_ITEM_PROTO_SOCKETS || targetItem->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
@@ -6425,7 +6425,7 @@ SpellCastResult Spell::CheckItems()
if (!itemProto)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
- uint32 item_quality = itemProto->Quality;
+ uint32 item_quality = itemProto->GetQuality();
// 2.0.x addon: Check player enchanting level against the item disenchanting requirements
uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill;
if (item_disenchantskilllevel == uint32(-1))
@@ -6434,7 +6434,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_LOW_CASTLEVEL;
if (item_quality > 4 || item_quality < 2)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
- if (itemProto->Class != ITEM_CLASS_WEAPON && itemProto->Class != ITEM_CLASS_ARMOR)
+ if (itemProto->GetClass() != ITEM_CLASS_WEAPON && itemProto->GetClass() != ITEM_CLASS_ARMOR)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (!itemProto->DisenchantID)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
@@ -6445,13 +6445,13 @@ SpellCastResult Spell::CheckItems()
if (!m_targets.GetItemTarget())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//ensure item is a prospectable ore
- if (!(m_targets.GetItemTarget()->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_PROSPECTABLE))
+ if (!(m_targets.GetItemTarget()->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_PROSPECTABLE))
return SPELL_FAILED_CANT_BE_PROSPECTED;
//prevent prospecting in trade slot
if (m_targets.GetItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//Check for enough skill in jewelcrafting
- uint32 item_prospectingskilllevel = m_targets.GetItemTarget()->GetTemplate()->RequiredSkillRank;
+ uint32 item_prospectingskilllevel = m_targets.GetItemTarget()->GetTemplate()->GetRequiredSkillRank();
if (item_prospectingskilllevel >player->GetSkillValue(SKILL_JEWELCRAFTING))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required ores in inventory
@@ -6468,13 +6468,13 @@ SpellCastResult Spell::CheckItems()
if (!m_targets.GetItemTarget())
return SPELL_FAILED_CANT_BE_MILLED;
//ensure item is a millable herb
- if (!(m_targets.GetItemTarget()->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_MILLABLE))
+ if (!(m_targets.GetItemTarget()->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_MILLABLE))
return SPELL_FAILED_CANT_BE_MILLED;
//prevent milling in trade slot
if (m_targets.GetItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_MILLED;
//Check for enough skill in inscription
- uint32 item_millingskilllevel = m_targets.GetItemTarget()->GetTemplate()->RequiredSkillRank;
+ uint32 item_millingskilllevel = m_targets.GetItemTarget()->GetTemplate()->GetRequiredSkillRank();
if (item_millingskilllevel > player->GetSkillValue(SKILL_INSCRIPTION))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required herbs in inventory
@@ -6496,7 +6496,7 @@ SpellCastResult Spell::CheckItems()
if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
- switch (pItem->GetTemplate()->SubClass)
+ switch (pItem->GetTemplate()->GetSubClass())
{
case ITEM_SUBCLASS_WEAPON_THROWN:
{
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index da904bf3f3b..2ea5b76c7ca 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1499,15 +1499,15 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
}
// set the "Crafted by ..." property of the item
- if (pItem->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
+ if (pItem->GetTemplate()->GetClass() != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->GetClass() != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetGUID());
// send info to the client
player->SendNewItem(pItem, num_to_add, true, bgType == 0);
- if (pProto->Quality > ITEM_QUALITY_EPIC || (pProto->Quality == ITEM_QUALITY_EPIC && pProto->ItemLevel >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
+ if (pProto->GetQuality() > ITEM_QUALITY_EPIC || (pProto->GetQuality() == ITEM_QUALITY_EPIC && pProto->GetBaseItemLevel() >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
if (Guild* guild = player->GetGuild())
- guild->AddGuildNews(GUILD_NEWS_ITEM_CRAFTED, player->GetGUID(), 0, pProto->ItemId);
+ guild->AddGuildNews(GUILD_NEWS_ITEM_CRAFTED, player->GetGUID(), 0, pProto->GetId());
// we succeeded in creating at least one item, so a levelup is possible
@@ -1878,7 +1878,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
}
else if (itemTarget)
{
- lockId = itemTarget->GetTemplate()->LockID;
+ lockId = itemTarget->GetTemplate()->GetLockID();
guid = itemTarget->GetGUID();
}
else
@@ -2551,7 +2551,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
else
{
// do not increase skill if vellum used
- if (!(m_CastItem && m_CastItem->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_TRIGGERED_CAST))
+ if (!(m_CastItem && m_CastItem->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_TRIGGERED_CAST))
player->UpdateCraftSkill(m_spellInfo->Id);
uint32 enchant_id = effectInfo->MiscValue;
@@ -2571,7 +2571,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
{
sLog->outCommand(player->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
player->GetName().c_str(), player->GetSession()->GetAccountId(),
- itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(),
+ itemTarget->GetTemplate()->GetDefaultLocaleName(), itemTarget->GetEntry(),
item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId());
}
@@ -2636,7 +2636,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex /*effIndex*/)
{
sLog->outCommand(player->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
player->GetName().c_str(), player->GetSession()->GetAccountId(),
- itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(),
+ itemTarget->GetTemplate()->GetDefaultLocaleName(), itemTarget->GetEntry(),
item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId());
}
@@ -2717,7 +2717,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
{
sLog->outCommand(player->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
player->GetName().c_str(), player->GetSession()->GetAccountId(),
- itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(),
+ itemTarget->GetTemplate()->GetDefaultLocaleName(), itemTarget->GetEntry(),
item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId());
}
@@ -2991,7 +2991,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex /*effIndex*/)
// 50% more damage with daggers
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
- if (item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
+ if (item->GetTemplate()->GetSubClass() == ITEM_SUBCLASS_WEAPON_DAGGER)
totalDamagePercentMod *= 1.5f;
}
break;
@@ -4179,7 +4179,7 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
if (!pet->IsAlive())
return;
- int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel);
+ int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->GetBaseItemLevel());
if (benefit <= 0)
return;
@@ -4972,7 +4972,7 @@ void Spell::EffectProspecting(SpellEffIndex /*effIndex*/)
if (!player)
return;
- if (!itemTarget || !(itemTarget->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_PROSPECTABLE))
+ if (!itemTarget || !(itemTarget->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_PROSPECTABLE))
return;
if (itemTarget->GetCount() < 5)
@@ -4981,7 +4981,7 @@ void Spell::EffectProspecting(SpellEffIndex /*effIndex*/)
if (sWorld->getBoolConfig(CONFIG_SKILL_PROSPECTING))
{
uint32 SkillValue = player->GetPureSkillValue(SKILL_JEWELCRAFTING);
- uint32 reqSkillValue = itemTarget->GetTemplate()->RequiredSkillRank;
+ uint32 reqSkillValue = itemTarget->GetTemplate()->GetRequiredSkillRank();
player->UpdateGatherSkill(SKILL_JEWELCRAFTING, SkillValue, reqSkillValue);
}
@@ -4997,7 +4997,7 @@ void Spell::EffectMilling(SpellEffIndex /*effIndex*/)
if (!player)
return;
- if (!itemTarget || !(itemTarget->GetTemplate()->Flags[0] & ITEM_PROTO_FLAG_MILLABLE))
+ if (!itemTarget || !(itemTarget->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_MILLABLE))
return;
if (itemTarget->GetCount() < 5)
@@ -5006,7 +5006,7 @@ void Spell::EffectMilling(SpellEffIndex /*effIndex*/)
if (sWorld->getBoolConfig(CONFIG_SKILL_MILLING))
{
uint32 SkillValue = player->GetPureSkillValue(SKILL_INSCRIPTION);
- uint32 reqSkillValue = itemTarget->GetTemplate()->RequiredSkillRank;
+ uint32 reqSkillValue = itemTarget->GetTemplate()->GetRequiredSkillRank();
player->UpdateGatherSkill(SKILL_INSCRIPTION, SkillValue, reqSkillValue);
}
@@ -5415,7 +5415,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
// level of pet summoned using engineering item based at engineering skill level
if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER)
if (ItemTemplate const* proto = m_CastItem->GetTemplate())
- if (proto->RequiredSkill == SKILL_ENGINEERING)
+ if (proto->GetRequiredSkill() == SKILL_ENGINEERING)
if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING))
level = skill202 / 5;
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index 47f20c622bf..d746b07af75 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -381,7 +381,7 @@ public:
if (localeIndex >= 0)
{
uint8 ulocaleIndex = uint8(localeIndex);
- if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId))
+ if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.GetId()))
{
if (il->Name.size() > ulocaleIndex && !il->Name[ulocaleIndex].empty())
{
@@ -396,9 +396,9 @@ public:
}
if (handler->GetSession())
- handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
+ handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.GetId(), itr->second.GetId(), name.c_str());
else
- handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
+ handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.GetId(), name.c_str());
if (!found)
found = true;
@@ -409,7 +409,7 @@ public:
}
}
- std::string name = itr->second.Name1;
+ std::string name = itr->second.GetDefaultLocaleName();
if (name.empty())
continue;
@@ -422,9 +422,9 @@ public:
}
if (handler->GetSession())
- handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
+ handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.GetId(), itr->second.GetId(), name.c_str());
else
- handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
+ handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.GetId(), name.c_str());
if (!found)
found = true;
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 52b8b859c21..5a99d30100b 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1239,14 +1239,14 @@ public:
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
{
- if (itr->second.ItemSet == itemSetId)
+ if (itr->second.GetItemSet() == itemSetId)
{
found = true;
ItemPosCountVec dest;
- InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.GetId(), 1);
if (msg == EQUIP_ERR_OK)
{
- Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
+ Item* item = playerTarget->StoreNewItem(dest, itr->second.GetId(), true);
// remove binding (let GM give it to another player later)
if (player == playerTarget)
@@ -1258,8 +1258,8 @@ public:
}
else
{
- player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
- handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
+ player->SendEquipError(msg, NULL, NULL, itr->second.GetId());
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.GetId(), 1);
}
}
}
@@ -2601,7 +2601,7 @@ public:
handler->GetSession()->SendShowMailBox(player->GetGUID());
return true;
}
-
+
static bool HandleAurasCommand(ChatHandler* handler, char const* args)
{
Unit* target = handler->GetSession()->GetPlayer()->GetSelectedUnit();
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 3e841f45f59..9a347463e15 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -361,7 +361,7 @@ public:
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
- handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, itemTemplate->Name1.c_str(), maxcount, incrtime, extendedcost);
+ handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, itemTemplate->GetDefaultLocaleName(), maxcount, incrtime, extendedcost);
return true;
}
@@ -583,7 +583,7 @@ public:
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
- handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, itemTemplate->Name1.c_str());
+ handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, itemTemplate->GetDefaultLocaleName());
return true;
}
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 8138a755f87..91ccd358f93 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -80,11 +80,14 @@ public:
// check item starting quest (it can work incorrectly if added without item in inventory)
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
- ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
+ ItemTemplateContainer::const_iterator result = std::find_if(itc->begin(), itc->end(), [quest](ItemTemplateContainer::value_type const& value)
+ {
+ return value.second.GetStartQuest() == quest->GetQuestId();
+ });
if (result != itc->end())
{
- handler->PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, result->second.ItemId);
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, result->second.GetId());
handler->SetSentErrorMessage(true);
return false;
}
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index 8c0ba551423..c42ebe5655e 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -152,7 +152,7 @@ public:
}
uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1;
- if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount)))
+ if (itemCount < 1 || (item_proto->GetMaxCount() > 0 && itemCount > uint32(item_proto->GetMaxCount())))
{
handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId);
handler->SetSentErrorMessage(true);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index cdbbf755390..b3106839199 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -752,8 +752,8 @@ class instance_ulduar : public InstanceMapScript
if (Player* player = itr->GetSource())
for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot)
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
- if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
- _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
+ if (item->GetItemLevel() > _maxWeaponItemLevel)
+ _maxWeaponItemLevel = item->GetItemLevel();
}
else if (state == IN_PROGRESS)
{
@@ -772,11 +772,11 @@ class instance_ulduar : public InstanceMapScript
{
if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED)
{
- if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
- _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
+ if (item->GetItemLevel() > _maxWeaponItemLevel)
+ _maxWeaponItemLevel = item->GetItemLevel();
}
- else if (item->GetTemplate()->ItemLevel > _maxArmorItemLevel)
- _maxArmorItemLevel = item->GetTemplate()->ItemLevel;
+ else if (item->GetItemLevel() > _maxArmorItemLevel)
+ _maxArmorItemLevel = item->GetItemLevel();
}
}
}
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index 3e89041a9e9..32607236f9e 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -247,7 +247,7 @@ bool EquippedOk(Player* player, uint32 spellId)
for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; ++j)
{
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
- if (item && item->GetTemplate()->RequiredSpell == reqSpell)
+ if (item && item->GetTemplate()->GetRequiredSpell() == reqSpell)
{
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
TC_LOG_DEBUG("scripts", "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());