aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2019-06-04 22:36:17 +0200
committerShauren <shauren.trinity@gmail.com>2019-06-08 17:09:20 +0200
commit82c7b6c5688495d90c4ee5995a4ff74039348296 (patch)
tree8bdab07881f637c849b895cd764fd28e601aa577 /src
parent455959c6064af6f7863a6b4b57cb0ef1646bd8ef (diff)
Core/Items: Drop item random property and suffix - all random stats must be given using bonus lists
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/Implementation/CharacterDatabase.cpp14
-rw-r--r--src/server/game/Accounts/RBAC.h2
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp2
-rw-r--r--src/server/game/Chat/ChatLink.cpp26
-rw-r--r--src/server/game/Chat/ChatLink.h7
-rw-r--r--src/server/game/Entities/Item/Item.cpp104
-rw-r--r--src/server/game/Entities/Item/Item.h7
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.cpp142
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.h20
-rw-r--r--src/server/game/Entities/Item/ItemTemplate.h1
-rw-r--r--src/server/game/Entities/Player/Player.cpp73
-rw-r--r--src/server/game/Entities/Player/Player.h12
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp4
-rw-r--r--src/server/game/Groups/Group.cpp6
-rw-r--r--src/server/game/Groups/Group.h2
-rw-r--r--src/server/game/Guilds/Guild.cpp4
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp18
-rw-r--r--src/server/game/Handlers/LootHandler.cpp2
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp2
-rw-r--r--src/server/game/Handlers/VoidStorageHandler.cpp4
-rw-r--r--src/server/game/Loot/Loot.cpp2
-rw-r--r--src/server/game/Loot/Loot.h6
-rw-r--r--src/server/game/Server/Packets/ItemPacketsCommon.cpp4
-rw-r--r--src/server/game/Spells/SpellEffects.cpp2
-rw-r--r--src/server/game/World/World.cpp4
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp2
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp12
-rw-r--r--src/server/scripts/World/item_scripts.cpp4
28 files changed, 183 insertions, 305 deletions
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cpp
index cebd59b2a6d..11604c63616 100644
--- a/src/server/database/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/database/Database/Implementation/CharacterDatabase.cpp
@@ -23,7 +23,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
if (!m_reconnecting)
m_stmts.resize(MAX_CHARACTERDATABASE_STATEMENTS);
-#define SelectItemInstanceContent "ii.guid, ii.itemEntry, ii.creatorGuid, ii.giftCreatorGuid, ii.count, ii.duration, ii.charges, ii.flags, ii.enchantments, ii.randomPropertyType, ii.randomPropertyId, " \
+#define SelectItemInstanceContent "ii.guid, ii.itemEntry, ii.creatorGuid, ii.giftCreatorGuid, ii.count, ii.duration, ii.charges, ii.flags, ii.enchantments, ii.randomBonusListId, " \
"ii.durability, ii.playedTime, ii.text, ii.upgradeId, ii.battlePetSpeciesId, ii.battlePetBreedData, ii.battlePetLevel, ii.battlePetDisplayId, ii.context, ii.bonusListIDs, " \
"iit.itemModifiedAppearanceAllSpecs, iit.itemModifiedAppearanceSpec1, iit.itemModifiedAppearanceSpec2, iit.itemModifiedAppearanceSpec3, iit.itemModifiedAppearanceSpec4, " \
"iit.spellItemEnchantmentAllSpecs, iit.spellItemEnchantmentSpec1, iit.spellItemEnchantmentSpec2, iit.spellItemEnchantmentSpec3, iit.spellItemEnchantmentSpec4, " \
@@ -170,8 +170,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_ITEM_BOP_TRADE, "DELETE FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_ASYNC);
PrepareStatement(CHAR_INS_ITEM_BOP_TRADE, "INSERT INTO item_soulbound_trade_data VALUES (?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_REP_INVENTORY_ITEM, "REPLACE INTO character_inventory (guid, bag, slot, item) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyType, randomPropertyId, durability, playedTime, text, upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomPropertyType = ?, randomPropertyId = ?, durability = ?, playedTime = ?, text = ?, upgradeId = ?, battlePetSpeciesId = ?, battlePetBreedData = ?, battlePetLevel = ?, battlePetDisplayId = ?, context = ?, bonusListIDs = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomBonusListId, durability, playedTime, text, upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomBonusListId = ?, durability = ?, playedTime = ?, text = ?, upgradeId = ?, battlePetSpeciesId = ?, battlePetBreedData = ?, battlePetLevel = ?, battlePetDisplayId = ?, context = ?, bonusListIDs = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_ITEM_INSTANCE_ON_LOAD, "UPDATE item_instance SET duration = ?, flags = ?, durability = ?, upgradeId = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_ITEM_INSTANCE, "DELETE FROM item_instance WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER, "DELETE FROM item_instance WHERE owner_guid = ?", CONNECTION_ASYNC);
@@ -631,8 +631,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_CHAR_FISHINGSTEPS, "DELETE FROM character_fishingsteps WHERE guid = ?", CONNECTION_ASYNC);
// Void Storage
- PrepareStatement(CHAR_SEL_CHAR_VOID_STORAGE, "SELECT itemId, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_REP_CHAR_VOID_STORAGE_ITEM, "REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_SEL_CHAR_VOID_STORAGE, "SELECT itemId, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_REP_CHAR_VOID_STORAGE_ITEM, "REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_CHAR_VOID_STORAGE_ITEM_BY_CHAR_GUID, "DELETE FROM character_void_storage WHERE playerGuid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_CHAR_VOID_STORAGE_ITEM_BY_SLOT, "DELETE FROM character_void_storage WHERE slot = ? AND playerGuid = ?", CONNECTION_ASYNC);
@@ -649,10 +649,10 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_GUILD_FINDER_GUILD_SETTINGS, "DELETE FROM guild_finder_guild_settings WHERE guildId = ?", CONNECTION_ASYNC);
// Items that hold loot or money
- PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_type, rnd_prop, context, bonus_list_ids FROM item_loot_items WHERE container_id = ?", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_bonus, context, bonus_list_ids FROM item_loot_items WHERE container_id = ?", CONNECTION_SYNCH);
PrepareStatement(CHAR_DEL_ITEMCONTAINER_ITEMS, "DELETE FROM item_loot_items WHERE container_id = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_ITEMCONTAINER_ITEM, "DELETE FROM item_loot_items WHERE container_id = ? AND item_id = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_type, rnd_prop, context, bonus_list_ids) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_bonus, context, bonus_list_ids) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_ITEMCONTAINER_MONEY, "SELECT money FROM item_loot_money WHERE container_id = ?", CONNECTION_SYNCH);
PrepareStatement(CHAR_DEL_ITEMCONTAINER_MONEY, "DELETE FROM item_loot_money WHERE container_id = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_INS_ITEMCONTAINER_MONEY, "INSERT INTO item_loot_money (container_id, money) VALUES (?, ?)", CONNECTION_ASYNC);
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index 167bf745555..13235779fda 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -558,7 +558,7 @@ enum RBACPermissions
RBAC_PERM_COMMAND_RELOAD_SUPPORT_SYSTEM = 650,
RBAC_PERM_COMMAND_RELOAD_GOSSIP_MENU = 651,
RBAC_PERM_COMMAND_RELOAD_GOSSIP_MENU_OPTION = 652,
- RBAC_PERM_COMMAND_RELOAD_ITEM_ENCHANTMENT_TEMPLATE = 653,
+ RBAC_PERM_COMMAND_RELOAD_ITEM_RANDOM_BONUS_LIST_TEMPLATE = 653,
RBAC_PERM_COMMAND_RELOAD_ITEM_LOOT_TEMPLATE = 654,
RBAC_PERM_COMMAND_RELOAD_ITEM_SET_NAMES = 655,
RBAC_PERM_COMMAND_RELOAD_LFG_DUNGEON_REWARDS = 656,
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
index 45c6a14ec66..b2009ac8baf 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
@@ -957,7 +957,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
// Update the just created item so that if it needs random properties it has them.
// Ex: Notched Shortsword of Stamina will only generate as a Notched Shortsword without this.
- item->SetItemRandomProperties(GenerateItemRandomPropertyId(itemId));
+ item->SetItemRandomBonusList(GenerateItemRandomBonusListId(itemId));
uint32 buyoutPrice;
uint32 bidPrice = 0;
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index 88d182b0b09..95f14931869 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -186,35 +186,16 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (!CheckDelimiter(iss, DELIMITER, "item"))
return false;
- if (HasValue(iss) && !ReadInt32(iss, _randomPropertyId))
+ if (HasValue(iss) && !ReadInt32(iss, zero))
{
TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item random property id", iss.str().c_str());
return false;
}
- if (_randomPropertyId > 0)
- {
- _property = sItemRandomPropertiesStore.LookupEntry(_randomPropertyId);
- if (!_property)
- {
- TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), _randomPropertyId);
- return false;
- }
- }
- else if (_randomPropertyId < 0)
- {
- _suffix = sItemRandomSuffixStore.LookupEntry(-_randomPropertyId);
- if (!_suffix)
- {
- TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -_randomPropertyId);
- return false;
- }
- }
-
if (!CheckDelimiter(iss, DELIMITER, "item"))
return false;
- if (HasValue(iss) && !ReadInt32(iss, _randomPropertySeed))
+ if (HasValue(iss) && !ReadInt32(iss, zero))
{
TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item random property seed", iss.str().c_str());
return false;
@@ -381,7 +362,8 @@ bool ItemChatLink::ValidateName(char* buffer, char const* context)
{
ChatLink::ValidateName(buffer, context);
- LocalizedString* suffixStrings = _suffix ? _suffix->Name : (_property ? _property->Name : nullptr);
+ // TODO: use suffix from ItemNameDescription
+ LocalizedString* suffixStrings = nullptr;
for (uint8 locale = LOCALE_enUS; locale < TOTAL_LOCALES; ++locale)
{
diff --git a/src/server/game/Chat/ChatLink.h b/src/server/game/Chat/ChatLink.h
index b1397a7090f..3f6b31f45d2 100644
--- a/src/server/game/Chat/ChatLink.h
+++ b/src/server/game/Chat/ChatLink.h
@@ -59,8 +59,7 @@ protected:
class TC_GAME_API ItemChatLink : public ChatLink
{
public:
- ItemChatLink() : ChatLink(), _item(nullptr), _enchantId(0), _randomPropertyId(0), _randomPropertySeed(0), _reporterLevel(0), _reporterSpec(0), _context(0),
- _suffix(nullptr), _property(nullptr)
+ ItemChatLink() : ChatLink(), _item(nullptr), _enchantId(0), _reporterLevel(0), _reporterSpec(0), _context(0)
{
memset(_gemItemId, 0, sizeof(_gemItemId));
}
@@ -74,16 +73,12 @@ protected:
ItemTemplate const* _item;
int32 _enchantId;
int32 _gemItemId[3];
- int32 _randomPropertyId;
- int32 _randomPropertySeed;
int32 _reporterLevel;
int32 _reporterSpec;
int32 _context;
std::vector<int32> _bonusListIDs;
std::vector<std::pair<uint32, int32>> _modifiers;
std::vector<int32> _gemBonusListIDs[3];
- ItemRandomSuffixEntry const* _suffix;
- ItemRandomPropertiesEntry const* _property;
};
// QuestChatLink - link to quest
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 019264836fc..92eeca77a74 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -410,8 +410,7 @@ void Item::SaveToDB(SQLTransaction& trans)
}
stmt->setString(++index, ssEnchants.str());
- stmt->setUInt8(++index, uint8(GetItemRandomEnchantmentId().Type));
- stmt->setUInt32(++index, GetItemRandomEnchantmentId().Id);
+ stmt->setUInt32(++index, m_randomBonusListId);
stmt->setUInt16(++index, m_itemData->Durability);
stmt->setUInt32(++index, m_itemData->CreatePlayedTime);
stmt->setString(++index, m_text);
@@ -620,17 +619,17 @@ void Item::SaveToDB(SQLTransaction& trans)
bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fields, uint32 entry)
{
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyType, randomPropertyId, durability, playedTime, text,
- // 14 15 16 17 18 19 20
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text,
+ // 13 14 15 16 17 18 19
// upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs,
- // 21 22 23 24 25
+ // 20 21 22 23 24
// itemModifiedAppearanceAllSpecs, itemModifiedAppearanceSpec1, itemModifiedAppearanceSpec2, itemModifiedAppearanceSpec3, itemModifiedAppearanceSpec4,
- // 26 27 28 29 30
+ // 25 26 27 28 29
// spellItemEnchantmentAllSpecs, spellItemEnchantmentSpec1, spellItemEnchantmentSpec2, spellItemEnchantmentSpec3, spellItemEnchantmentSpec4,
- // 31 32 33 34 35 36 37 38 39 40 41 42
+ // 30 31 32 33 34 35 36 37 38 39 40 41
// gemItemId1, gemBonuses1, gemContext1, gemScalingLevel1, gemItemId2, gemBonuses2, gemContext2, gemScalingLevel2, gemItemId3, gemBonuses3, gemContext3, gemScalingLevel3
- // 43 44
+ // 42 43
// fixedScalingLevel, artifactKnowledgeLevel FROM item_instance
// create item before any checks for store correct guid
@@ -680,7 +679,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
SetItemFlags(ItemFieldFlags(itemFlags));
- uint32 durability = fields[11].GetUInt16();
+ uint32 durability = fields[10].GetUInt16();
SetDurability(durability);
// update max durability (and durability) if need
SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::MaxDurability), proto->MaxDurability);
@@ -690,10 +689,10 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
need_save = true;
}
- SetCreatePlayedTime(fields[12].GetUInt32());
- SetText(fields[13].GetString());
+ SetCreatePlayedTime(fields[11].GetUInt32());
+ SetText(fields[12].GetString());
- uint32 upgradeId = fields[14].GetUInt32();
+ uint32 upgradeId = fields[13].GetUInt32();
ItemUpgradeEntry const* rulesetUpgrade = sItemUpgradeStore.LookupEntry(sDB2Manager.GetRulesetItemUpgrade(entry));
ItemUpgradeEntry const* upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
if (!rulesetUpgrade || !upgrade || rulesetUpgrade->ItemUpgradePathID != upgrade->ItemUpgradePathID)
@@ -709,51 +708,51 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
}
SetModifier(ITEM_MODIFIER_UPGRADE_ID, upgradeId);
- SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[15].GetUInt32());
- SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[16].GetUInt32());
- SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[17].GetUInt16());
- SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[18].GetUInt32());
+ SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[14].GetUInt32());
+ SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[15].GetUInt32());
+ SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[16].GetUInt16());
+ SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[17].GetUInt32());
- SetContext(fields[19].GetUInt8());
+ SetContext(fields[18].GetUInt8());
- Tokenizer bonusListString(fields[20].GetString(), ' ');
+ Tokenizer bonusListString(fields[19].GetString(), ' ');
std::vector<int32> bonusListIDs;
bonusListIDs.reserve(bonusListString.size());
for (char const* token : bonusListString)
bonusListIDs.push_back(atoi(token));
SetBonuses(std::move(bonusListIDs));
- SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS, fields[21].GetUInt32());
- SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1, fields[22].GetUInt32());
- SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2, fields[23].GetUInt32());
- SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3, fields[24].GetUInt32());
- SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4, fields[25].GetUInt32());
+ SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS, fields[20].GetUInt32());
+ SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1, fields[21].GetUInt32());
+ SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2, fields[22].GetUInt32());
+ SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3, fields[23].GetUInt32());
+ SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4, fields[24].GetUInt32());
- SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS, fields[26].GetUInt32());
- SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1, fields[27].GetUInt32());
- SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2, fields[28].GetUInt32());
- SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3, fields[29].GetUInt32());
- SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4, fields[30].GetUInt32());
+ SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS, fields[25].GetUInt32());
+ SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1, fields[26].GetUInt32());
+ SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2, fields[27].GetUInt32());
+ SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3, fields[28].GetUInt32());
+ SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4, fields[29].GetUInt32());
uint32 const gemFields = 4;
ItemDynamicFieldGems gemData[MAX_GEM_SOCKETS];
memset(gemData, 0, sizeof(gemData));
for (uint32 i = 0; i < MAX_GEM_SOCKETS; ++i)
{
- gemData[i].ItemId = fields[31 + i * gemFields].GetUInt32();
- Tokenizer gemBonusListIDs(fields[32 + i * gemFields].GetString(), ' ');
+ gemData[i].ItemId = fields[30 + i * gemFields].GetUInt32();
+ Tokenizer gemBonusListIDs(fields[31 + i * gemFields].GetString(), ' ');
uint32 b = 0;
for (char const* token : gemBonusListIDs)
if (uint32 bonusListID = atoul(token))
gemData[i].BonusListIDs[b++] = bonusListID;
- gemData[i].Context = fields[33 + i * gemFields].GetUInt8();
+ gemData[i].Context = fields[32 + i * gemFields].GetUInt8();
if (gemData[i].ItemId)
- SetGem(i, &gemData[i], fields[34 + i * gemFields].GetUInt32());
+ SetGem(i, &gemData[i], fields[33 + i * gemFields].GetUInt32());
}
- SetModifier(ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL, fields[43].GetUInt32());
- SetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, fields[44].GetUInt32());
+ SetModifier(ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL, fields[42].GetUInt32());
+ SetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, fields[43].GetUInt32());
// Enchants must be loaded after all other bonus/scaling data
Tokenizer enchantmentTokens(fields[8].GetString(), ' ');
@@ -767,8 +766,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fie
SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), atoi(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 2]));
}
}
- m_randomEnchantment.Type = ItemRandomEnchantmentType(fields[9].GetUInt8());
- m_randomEnchantment.Id = fields[10].GetUInt32();
+ m_randomBonusListId = fields[10].GetUInt32();
// Remove bind flag for items vs BIND_NONE set
if (IsSoulBound() && GetBonding() == BIND_NONE)
@@ -923,19 +921,12 @@ uint32 Item::GetSkill()
return proto->GetSkill();
}
-void Item::SetItemRandomProperties(ItemRandomEnchantmentId const& randomPropId)
+void Item::SetItemRandomBonusList(ItemRandomBonusListId bonusListId)
{
- if (!randomPropId.Id)
+ if (!bonusListId)
return;
- switch (randomPropId.Type)
- {
- case ItemRandomEnchantmentType::BonusList:
- AddBonuses(randomPropId.Id);
- break;
- default:
- break;
- }
+ AddBonuses(bonusListId);
}
void Item::SetState(ItemUpdateState state, Player* forplayer)
@@ -1392,7 +1383,7 @@ Item* Item::CloneItem(uint32 count, Player const* player /*= nullptr*/) const
newItem->SetExpiration(m_itemData->Expiration);
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
if (player)
- newItem->SetItemRandomProperties(GetItemRandomEnchantmentId());
+ newItem->SetItemRandomBonusList(m_randomBonusListId);
return newItem;
}
@@ -2000,7 +1991,7 @@ void Item::ItemContainerSaveLootToDB()
stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_ITEMS);
- // container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_type, rnd_prop, context, bonus_list_ids
+ // container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, context, bonus_list_ids
stmt_items->setUInt64(0, loot.containerID.GetCounter());
stmt_items->setUInt32(1, _li->itemid);
stmt_items->setUInt32(2, _li->count);
@@ -2010,13 +2001,12 @@ void Item::ItemContainerSaveLootToDB()
stmt_items->setBool(6, _li->is_counted);
stmt_items->setBool(7, _li->is_underthreshold);
stmt_items->setBool(8, _li->needs_quest);
- stmt_items->setUInt8(9, uint8(_li->randomPropertyId.Type));
- stmt_items->setUInt32(10, _li->randomPropertyId.Id);
- stmt_items->setUInt8(11, _li->context);
+ stmt_items->setUInt32(9, _li->randomBonusListId);
+ stmt_items->setUInt8(10, _li->context);
std::ostringstream bonusListIDs;
for (int32 bonusListID : _li->BonusListIDs)
bonusListIDs << bonusListID << ' ';
- stmt_items->setString(12, bonusListIDs.str());
+ stmt_items->setString(11, bonusListIDs.str());
trans->Append(stmt_items);
}
}
@@ -2064,7 +2054,7 @@ bool Item::ItemContainerLoadLootFromDB()
// Fill in the rest of the LootItem from the DB
Field* fields = item_result->Fetch();
- // item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_type, rnd_prop, context, bonus_list_ids
+ // item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, context, bonus_list_ids
loot_item.itemid = fields[0].GetUInt32();
loot_item.count = fields[1].GetUInt32();
loot_item.follow_loot_rules = fields[2].GetBool();
@@ -2074,9 +2064,9 @@ bool Item::ItemContainerLoadLootFromDB()
loot_item.canSave = true;
loot_item.is_underthreshold = fields[6].GetBool();
loot_item.needs_quest = fields[7].GetBool();
- loot_item.randomPropertyId = { ItemRandomEnchantmentType(fields[8].GetUInt8()), fields[9].GetUInt32() };
- loot_item.context = fields[10].GetUInt8();
- Tokenizer bonusLists(fields[11].GetString(), ' ');
+ loot_item.randomBonusListId = fields[8].GetUInt32();
+ loot_item.context = fields[9].GetUInt8();
+ Tokenizer bonusLists(fields[10].GetString(), ' ');
std::transform(bonusLists.begin(), bonusLists.end(), std::back_inserter(loot_item.BonusListIDs), [](char const* token)
{
return int32(strtol(token, NULL, 10));
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 16184639970..cafb01c84ad 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -233,9 +233,8 @@ class TC_GAME_API Item : public Object
uint32 GetSkill();
- // RandomPropertyId (signed but stored as unsigned)
- void SetItemRandomProperties(ItemRandomEnchantmentId const& randomPropId);
- ItemRandomEnchantmentId GetItemRandomEnchantmentId() const { return m_randomEnchantment; }
+ ItemRandomBonusListId GetItemRandomBonusListId() const { return m_randomBonusListId; }
+ void SetItemRandomBonusList(ItemRandomBonusListId bonusListId);
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
@@ -383,7 +382,7 @@ class TC_GAME_API Item : public Object
uint64 m_paidMoney;
uint32 m_paidExtendedCost;
GuidSet allowedGUIDs;
- ItemRandomEnchantmentId m_randomEnchantment; // store separately to easily find which bonus list is the one randomly given for stat rerolling
+ ItemRandomBonusListId m_randomBonusListId; // store separately to easily find which bonus list is the one randomly given for stat rerolling
ObjectGuid m_childItem;
std::unordered_map<uint32, uint16> m_artifactPowerIdToIndex;
std::array<uint32, MAX_ITEM_PROTO_SOCKETS> m_gemScalingLevels;
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index 7e75ab991d5..5d2dfa77aeb 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -31,43 +31,25 @@
#include <vector>
#include <stdlib.h>
-struct EnchStoreItem
+namespace
{
- ItemRandomEnchantmentType type;
- uint32 ench;
- float chance;
-
- EnchStoreItem()
- : type(ItemRandomEnchantmentType::Property), ench(0), chance(0) { }
-
- EnchStoreItem(ItemRandomEnchantmentType _type, uint32 _ench, float _chance)
- : type(_type), ench(_ench), chance(_chance) { }
-};
-
-typedef std::vector<EnchStoreItem> EnchStoreList;
-
-class EnchantmentStore
-{
- std::unordered_map<uint32, EnchStoreList> _data[2];
-
-public:
- std::unordered_map<uint32, EnchStoreList>& operator[](ItemRandomEnchantmentType type)
+ struct RandomBonusListIds
{
- ASSERT(type != ItemRandomEnchantmentType::BonusList, "Random bonus lists do not have their own storage, use Suffix for them");
- return _data[uint8(type)];
- }
+ std::vector<int32> BonusListIDs;
+ std::vector<double> Chances;
+ };
-} static RandomItemEnch;
+ std::unordered_map<uint32, RandomBonusListIds> _storage;
+}
-void LoadRandomEnchantmentsTable()
+void LoadItemRandomBonusListTemplates()
{
uint32 oldMSTime = getMSTime();
- RandomItemEnch[ItemRandomEnchantmentType::Property].clear();
- RandomItemEnch[ItemRandomEnchantmentType::Suffix].clear();
+ _storage.clear();
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT entry, type, ench, chance FROM item_enchantment_template");
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT Id, BonusListID, Chance FROM item_random_bonus_list_template");
if (result)
{
@@ -77,113 +59,53 @@ void LoadRandomEnchantmentsTable()
{
Field* fields = result->Fetch();
- uint32 entry = fields[0].GetUInt32();
- ItemRandomEnchantmentType type = ItemRandomEnchantmentType(fields[1].GetUInt8());
- uint32 ench = fields[2].GetUInt32();
- float chance = fields[3].GetFloat();
+ uint32 id = fields[0].GetUInt32();
+ uint32 bonusListId = fields[1].GetUInt32();
+ float chance = fields[2].GetFloat();
- switch (type)
+ if (!sDB2Manager.GetItemBonusList(bonusListId))
{
- case ItemRandomEnchantmentType::Property:
- if (!sItemRandomPropertiesStore.LookupEntry(ench))
- {
- TC_LOG_ERROR("sql.sql", "Property %u used in `item_enchantment_template` by entry %u doesn't have exist in ItemRandomProperties.db2", ench, entry);
- continue;
- }
- break;
- case ItemRandomEnchantmentType::Suffix:
- if (!sItemRandomSuffixStore.LookupEntry(ench))
- {
- TC_LOG_ERROR("sql.sql", "Suffix %u used in `item_enchantment_template` by entry %u doesn't have exist in ItemRandomSuffix.db2", ench, entry);
- continue;
- }
- break;
- case ItemRandomEnchantmentType::BonusList:
- if (!sDB2Manager.GetItemBonusList(ench))
- {
- TC_LOG_ERROR("sql.sql", "Bonus list %u used in `item_enchantment_template` by entry %u doesn't have exist in ItemBonus.db2", ench, entry);
- continue;
- }
- break;
- default:
- TC_LOG_ERROR("sql.sql", "Invalid random enchantment type specified in `item_enchantment_template` table for `entry` %u `ench` %u", entry, ench);
- break;
+ TC_LOG_ERROR("sql.sql", "Bonus list %d used in `item_random_bonus_list_template` by id %u doesn't have exist in ItemBonus.db2", bonusListId, id);
+ continue;
}
if (chance < 0.000001f || chance > 100.0f)
{
- TC_LOG_ERROR("sql.sql", "Random item enchantment for entry %u type %u ench %u has invalid chance %f", entry, uint32(type), ench, chance);
+ TC_LOG_ERROR("sql.sql", "Bonus list %d used in `item_random_bonus_list_template` by id %u has invalid chance %f", bonusListId, id, chance);
continue;
}
- switch (type)
- {
- case ItemRandomEnchantmentType::Property:
- RandomItemEnch[ItemRandomEnchantmentType::Property][entry].emplace_back(type, ench, chance);
- break;
- case ItemRandomEnchantmentType::Suffix:
- case ItemRandomEnchantmentType::BonusList: // random bonus lists use RandomSuffix field in Item-sparse.db2
- RandomItemEnch[ItemRandomEnchantmentType::Suffix][entry].emplace_back(type, ench, chance);
- break;
- default:
- break;
- }
+ RandomBonusListIds& ids = _storage[id];
+ ids.BonusListIDs.push_back(bonusListId);
+ ids.Chances.push_back(chance);
++count;
} while (result->NextRow());
- TC_LOG_INFO("server.loading", ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u Random item bonus list definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
- TC_LOG_ERROR("server.loading", ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
+ TC_LOG_ERROR("server.loading", ">> Loaded 0 Random item bonus list definitions. DB table `item_random_bonus_list_template` is empty.");
}
-ItemRandomEnchantmentId GetItemEnchantMod(int32 entry, ItemRandomEnchantmentType type)
-{
- if (!entry)
- return{};
-
- if (entry == -1)
- return{};
-
- auto tab = RandomItemEnch[type].find(entry);
- if (tab == RandomItemEnch[type].end())
- {
- TC_LOG_ERROR("sql.sql", "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
- return{};
- }
-
- auto selectedItr = Trinity::Containers::SelectRandomWeightedContainerElement(tab->second, [](EnchStoreItem const& enchant)
- {
- return enchant.chance;
- });
-
- return{ selectedItr->type, selectedItr->ench };
-}
-
-ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id)
+ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id)
{
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
if (!itemProto)
- return{};
+ return 0;
// item must have one from this field values not null if it can have random enchantments
- if (!itemProto->GetRandomProperty() && !itemProto->GetRandomSuffix())
- return{};
+ if (!itemProto->RandomBonusListTemplateId)
+ return 0;
- // item can have not null only one from field values
- if (itemProto->GetRandomProperty() && itemProto->GetRandomSuffix())
+ auto tab = _storage.find(itemProto->RandomBonusListTemplateId);
+ if (tab == _storage.end())
{
- 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{};
+ TC_LOG_ERROR("sql.sql", "Item RandomBonusListTemplateId id #%u used in `item_template_addon` but it does not have records in `item_random_bonus_list_template` table.", itemProto->RandomBonusListTemplateId);
+ return 0;
}
- // RandomProperty case
- if (itemProto->GetRandomProperty())
- return GetItemEnchantMod(itemProto->GetRandomProperty(), ItemRandomEnchantmentType::Property);
- // RandomSuffix case
- else
- return GetItemEnchantMod(itemProto->GetRandomSuffix(), ItemRandomEnchantmentType::Suffix);
+ return *Trinity::Containers::SelectRandomWeightedContainerElement(tab->second.BonusListIDs, tab->second.Chances);
}
TC_GAME_API uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.h b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
index 91e208cbeb7..2a5974a9781 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.h
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
@@ -21,24 +21,10 @@
#include "Common.h"
-enum class ItemRandomEnchantmentType : uint8
-{
- Property = 0,
- Suffix = 1,
- BonusList = 2
-};
+using ItemRandomBonusListId = uint32;
-struct ItemRandomEnchantmentId
-{
- ItemRandomEnchantmentId() = default;
- ItemRandomEnchantmentId(ItemRandomEnchantmentType type, uint32 id) : Type(type), Id(id) { }
-
- ItemRandomEnchantmentType Type = ItemRandomEnchantmentType::Property;
- uint32 Id = 0;
-};
-
-TC_GAME_API void LoadRandomEnchantmentsTable();
-TC_GAME_API ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id);
+TC_GAME_API void LoadItemRandomBonusListTemplates();
+TC_GAME_API ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id);
TC_GAME_API uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subclass);
#endif
diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h
index 2e811ebbbb3..d71080dd716 100644
--- a/src/server/game/Entities/Item/ItemTemplate.h
+++ b/src/server/game/Entities/Item/ItemTemplate.h
@@ -771,6 +771,7 @@ struct TC_GAME_API ItemTemplate
uint32 MaxMoneyLoot;
uint32 FlagsCu;
float SpellPPMRate;
+ uint32 RandomBonusListTemplateId;
std::bitset<MAX_CLASSES * MAX_SPECIALIZATIONS> Specializations[3]; // one set for 1-40 level range and another for 41-109 and one for 110
uint32 ItemSpecClassMask;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index f8ae831faa9..cf67d10fe40 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -706,7 +706,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
InventoryResult msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount);
if (msg == EQUIP_ERR_OK)
{
- StoreNewItem(sDest, titem_id, true, GenerateItemRandomPropertyId(titem_id));
+ StoreNewItem(sDest, titem_id, true, GenerateItemRandomBonusListId(titem_id));
return true; // stored
}
@@ -11762,7 +11762,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje
}
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
-Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomEnchantmentId const& randomPropertyId /*= {}*/,
+Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId /*= 0*/,
GuidSet const& allowedLooters /*= GuidSet()*/, uint8 context /*= 0*/, std::vector<int32> const& bonusListIDs /*= std::vector<int32>()*/, bool addToCollection /*= true*/)
{
uint32 count = 0;
@@ -11787,7 +11787,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool updat
item = StoreItem(pos, item, update);
item->SetFixedLevel(getLevel());
- item->SetItemRandomProperties(randomPropertyId);
+ item->SetItemRandomBonusList(randomBonusListId);
if (allowedLooters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
{
@@ -15277,7 +15277,7 @@ void Player::RewardQuestPackage(uint32 questPackageId, uint32 onlyItemId /*= 0*/
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, questPackageItem->ItemID, questPackageItem->ItemQuantity) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomPropertyId(questPackageItem->ItemID));
+ Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomBonusListId(questPackageItem->ItemID));
SendNewItem(item, questPackageItem->ItemQuantity, true, false);
}
}
@@ -15296,7 +15296,7 @@ void Player::RewardQuestPackage(uint32 questPackageId, uint32 onlyItemId /*= 0*/
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, questPackageItem->ItemID, questPackageItem->ItemQuantity) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomPropertyId(questPackageItem->ItemID));
+ Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomBonusListId(questPackageItem->ItemID));
SendNewItem(item, questPackageItem->ItemQuantity, true, false);
}
}
@@ -15351,7 +15351,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, reward, quest->RewardChoiceItemCount[i]) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, reward, true, GenerateItemRandomPropertyId(reward));
+ Item* item = StoreNewItem(dest, reward, true, GenerateItemRandomBonusListId(reward));
SendNewItem(item, quest->RewardChoiceItemCount[i], true, false);
}
}
@@ -15371,7 +15371,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemCount[i]) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
+ Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId));
SendNewItem(item, quest->RewardItemCount[i], true, false);
}
else if (quest->IsDFQuest())
@@ -18550,17 +18550,17 @@ void Player::LoadCorpse(PreparedQueryResult result)
void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult artifactsResult, uint32 timeDiff)
{
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyType, randomPropertyId, durability, playedTime, text,
- // 14 15 16 17 18 19 20
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text,
+ // 13 14 15 16 17 18 19
// upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs,
- // 21 22 23 24 25
+ // 20 21 22 23 24
// itemModifiedAppearanceAllSpecs, itemModifiedAppearanceSpec1, itemModifiedAppearanceSpec2, itemModifiedAppearanceSpec3, itemModifiedAppearanceSpec4,
- // 26 27 28 29 30
+ // 25 26 27 28 29
// spellItemEnchantmentAllSpecs, spellItemEnchantmentSpec1, spellItemEnchantmentSpec2, spellItemEnchantmentSpec3, spellItemEnchantmentSpec4,
- // 31 32 33 34 35 36 37 38 39 40 41 42
+ // 30 31 32 33 34 35 36 37 38 39 40 41
// gemItemId1, gemBonuses1, gemContext1, gemScalingLevel1, gemItemId2, gemBonuses2, gemContext2, gemScalingLevel2, gemItemId3, gemBonuses3, gemContext3, gemScalingLevel3
- // 43 44
+ // 42 43
// fixedScalingLevel, artifactKnowledgeLevel FROM item_instance
// 45 46
// bag, slot
@@ -18631,8 +18631,8 @@ void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult arti
if (item->GetTemplate()->GetArtifactID() && artifactDataItr != artifactData.end())
item->LoadArtifactData(this, std::get<0>(artifactDataItr->second), std::get<1>(artifactDataItr->second), std::get<2>(artifactDataItr->second), std::get<3>(artifactDataItr->second));
- ObjectGuid bagGuid = fields[45].GetUInt64() ? ObjectGuid::Create<HighGuid::Item>(fields[45].GetUInt64()) : ObjectGuid::Empty;
- uint8 slot = fields[46].GetUInt8();
+ ObjectGuid bagGuid = fields[44].GetUInt64() ? ObjectGuid::Create<HighGuid::Item>(fields[44].GetUInt64()) : ObjectGuid::Empty;
+ uint8 slot = fields[45].GetUInt8();
GetSession()->GetCollectionMgr()->CheckHeirloomUpgrades(item);
GetSession()->GetCollectionMgr()->AddItemAppearance(item);
@@ -18759,20 +18759,20 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
do
{
- // SELECT itemId, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?
+ // SELECT itemId, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?
Field* fields = result->Fetch();
uint64 itemId = fields[0].GetUInt64();
uint32 itemEntry = fields[1].GetUInt32();
uint8 slot = fields[2].GetUInt8();
ObjectGuid creatorGuid = fields[3].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64()) : ObjectGuid::Empty;
- ItemRandomEnchantmentId randomProperty(ItemRandomEnchantmentType(fields[4].GetUInt8()), fields[5].GetUInt32());
- uint32 upgradeId = fields[6].GetUInt32();
- uint32 fixedScalingLevel = fields[7].GetUInt32();
- uint32 artifactKnowledgeLevel = fields[8].GetUInt32();
- uint8 context = fields[9].GetUInt8();
+ ItemRandomBonusListId randomBonusListId = fields[4].GetUInt32();
+ uint32 upgradeId = fields[5].GetUInt32();
+ uint32 fixedScalingLevel = fields[6].GetUInt32();
+ uint32 artifactKnowledgeLevel = fields[7].GetUInt32();
+ uint8 context = fields[8].GetUInt8();
std::vector<int32> bonusListIDs;
- Tokenizer bonusListIdTokens(fields[10].GetString(), ' ');
+ Tokenizer bonusListIdTokens(fields[9].GetString(), ' ');
for (char const* token : bonusListIdTokens)
bonusListIDs.push_back(atoul(token));
@@ -18797,7 +18797,7 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
continue;
}
- _voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomProperty, upgradeId, fixedScalingLevel, artifactKnowledgeLevel,
+ _voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel,
context, bonusListIDs);
WorldPackets::Item::ItemInstance voidInstance;
@@ -18974,7 +18974,7 @@ void Player::_LoadMailedItems(Mail* mail)
Item* item = NewItemOrBag(proto);
- ObjectGuid ownerGuid = fields[45].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[45].GetUInt64()) : ObjectGuid::Empty;
+ ObjectGuid ownerGuid = fields[44].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[44].GetUInt64()) : ObjectGuid::Empty;
if (!item->LoadFromDB(itemGuid, ownerGuid, fields, itemEntry))
{
TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems: Item (GUID: " UI64FMTD ") in mail (%u) doesn't exist, deleted from mail.", itemGuid, mail->messageID);
@@ -20558,23 +20558,22 @@ void Player::_SaveVoidStorage(SQLTransaction& trans)
}
else
{
- // REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ // REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_VOID_STORAGE_ITEM);
stmt->setUInt64(0, _voidStorageItems[i]->ItemId);
stmt->setUInt64(1, GetGUID().GetCounter());
stmt->setUInt32(2, _voidStorageItems[i]->ItemEntry);
stmt->setUInt8(3, i);
stmt->setUInt64(4, _voidStorageItems[i]->CreatorGuid.GetCounter());
- stmt->setUInt8(5, uint8(_voidStorageItems[i]->ItemRandomPropertyId.Type));
- stmt->setUInt32(6, _voidStorageItems[i]->ItemRandomPropertyId.Id);
- stmt->setUInt32(7, _voidStorageItems[i]->ItemUpgradeId);
- stmt->setUInt32(8, _voidStorageItems[i]->FixedScalingLevel);
- stmt->setUInt32(9, _voidStorageItems[i]->ArtifactKnowledgeLevel);
- stmt->setUInt8(10, _voidStorageItems[i]->Context);
+ stmt->setUInt32(5, _voidStorageItems[i]->RandomBonusListId);
+ stmt->setUInt32(6, _voidStorageItems[i]->ItemUpgradeId);
+ stmt->setUInt32(7, _voidStorageItems[i]->FixedScalingLevel);
+ stmt->setUInt32(8, _voidStorageItems[i]->ArtifactKnowledgeLevel);
+ stmt->setUInt8(9, _voidStorageItems[i]->Context);
std::ostringstream bonusListIDs;
for (int32 bonusListID : _voidStorageItems[i]->BonusListIDs)
bonusListIDs << bonusListID << ' ';
- stmt->setString(11, bonusListIDs.str());
+ stmt->setString(10, bonusListIDs.str());
}
trans->Append(stmt);
@@ -22390,7 +22389,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
}
Item* it = bStore ?
- StoreNewItem(vDest, item, true, GenerateItemRandomPropertyId(item), {}, 0, crItem->BonusListIDs, false) :
+ StoreNewItem(vDest, item, true, GenerateItemRandomBonusListId(item), {}, 0, crItem->BonusListIDs, false) :
EquipNewItem(uiDest, item, true);
if (it)
{
@@ -25677,7 +25676,7 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons
continue;
}
- Item* pItem = StoreNewItem(dest, lootItem->itemid, true, lootItem->randomPropertyId, GuidSet(), lootItem->context, lootItem->BonusListIDs);
+ Item* pItem = StoreNewItem(dest, lootItem->itemid, true, lootItem->randomBonusListId, GuidSet(), lootItem->context, lootItem->BonusListIDs);
SendNewItem(pItem, lootItem->count, false, false, broadcast);
}
}
@@ -25720,7 +25719,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot, AELootResult* aeResult/*
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
if (msg == EQUIP_ERR_OK)
{
- Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
+ Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomBonusListId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
if (qitem)
{
@@ -27152,7 +27151,7 @@ bool Player::AddItem(uint32 itemId, uint32 count)
return false;
}
- Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
+ Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId));
if (item)
SendNewItem(item, count, true, false);
else
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 922ecf09ee3..3cb5512d493 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -899,22 +899,22 @@ struct BGData
struct VoidStorageItem
{
- VoidStorageItem() : ItemId(0), ItemEntry(0), ItemRandomPropertyId(), ItemUpgradeId(0), FixedScalingLevel(0), ArtifactKnowledgeLevel(0), Context(0) { }
- VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, ItemRandomEnchantmentId randomPropertyId,
+ VoidStorageItem() : ItemId(0), ItemEntry(0), RandomBonusListId(0), ItemUpgradeId(0), FixedScalingLevel(0), ArtifactKnowledgeLevel(0), Context(0) { }
+ VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, ItemRandomBonusListId randomBonusListId,
uint32 upgradeId, uint32 fixedScalingLevel, uint32 artifactKnowledgeLevel, uint8 context, std::vector<int32> const& bonuses)
- : ItemId(id), ItemEntry(entry), CreatorGuid(creator), ItemRandomPropertyId(randomPropertyId),
+ : ItemId(id), ItemEntry(entry), CreatorGuid(creator), RandomBonusListId(randomBonusListId),
ItemUpgradeId(upgradeId), FixedScalingLevel(fixedScalingLevel), ArtifactKnowledgeLevel(artifactKnowledgeLevel), Context(context)
{
BonusListIDs.insert(BonusListIDs.end(), bonuses.begin(), bonuses.end());
}
- VoidStorageItem(VoidStorageItem&& vsi) noexcept : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid), ItemRandomPropertyId(vsi.ItemRandomPropertyId),
+ VoidStorageItem(VoidStorageItem&& vsi) noexcept : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid), RandomBonusListId(vsi.RandomBonusListId),
ItemUpgradeId(vsi.ItemUpgradeId), FixedScalingLevel(vsi.FixedScalingLevel),
ArtifactKnowledgeLevel(vsi.ArtifactKnowledgeLevel), Context(vsi.Context), BonusListIDs(std::move(vsi.BonusListIDs)) { }
uint64 ItemId;
uint32 ItemEntry;
ObjectGuid CreatorGuid;
- ItemRandomEnchantmentId ItemRandomPropertyId;
+ ItemRandomBonusListId RandomBonusListId;
uint32 ItemUpgradeId;
uint32 FixedScalingLevel;
uint32 ArtifactKnowledgeLevel;
@@ -1160,7 +1160,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool HasItemTotemCategory(uint32 TotemCategory) const;
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
- Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomEnchantmentId const& randomPropertyId = {}, GuidSet const& allowedLooters = GuidSet(), uint8 context = 0, std::vector<int32> const& bonusListIDs = std::vector<int32>(), bool addToCollection = true);
+ Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId = 0, GuidSet const& allowedLooters = GuidSet(), uint8 context = 0, std::vector<int32> const& bonusListIDs = std::vector<int32>(), bool addToCollection = true);
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
Item* EquipNewItem(uint16 pos, uint32 item, bool update);
Item* EquipItem(uint16 pos, Item* pItem, bool update);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index dc9dd093b36..c8c5e49ea24 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2920,6 +2920,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.MaxMoneyLoot = 0;
itemTemplate.FlagsCu = 0;
itemTemplate.SpellPPMRate = 0.0f;
+ itemTemplate.RandomBonusListTemplateId = 0;
itemTemplate.ItemSpecClassMask = 0;
if (std::vector<ItemSpecOverrideEntry const*> const* itemSpecOverrides = sDB2Manager.GetItemSpecOverrides(sparse->ID))
@@ -3018,7 +3019,7 @@ void ObjectMgr::LoadItemTemplateAddon()
uint32 oldMSTime = getMSTime();
uint32 count = 0;
- QueryResult result = WorldDatabase.Query("SELECT Id, FlagsCu, FoodType, MinMoneyLoot, MaxMoneyLoot, SpellPPMChance FROM item_template_addon");
+ QueryResult result = WorldDatabase.Query("SELECT Id, FlagsCu, FoodType, MinMoneyLoot, MaxMoneyLoot, SpellPPMChance, RandomBonusListTemplateId FROM item_template_addon");
if (result)
{
do
@@ -3044,6 +3045,7 @@ void ObjectMgr::LoadItemTemplateAddon()
itemTemplate.MinMoneyLoot = minMoneyLoot;
itemTemplate.MaxMoneyLoot = maxMoneyLoot;
itemTemplate.SpellPPMRate = fields[5].GetFloat();
+ itemTemplate.RandomBonusListTemplateId = fields[6].GetUInt32();
++count;
} while (result->NextRow());
}
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index ae0d99ecc85..068502a6bbe 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -45,7 +45,7 @@
#include "WorldSession.h"
Roll::Roll(LootItem const& li) : itemid(li.itemid),
-itemRandomPropId(li.randomPropertyId), itemCount(li.count),
+itemRandomBonusListId(li.randomBonusListId), itemCount(li.count),
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) { }
@@ -1264,7 +1264,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
- player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
+ player->StoreNewItem(dest, roll->itemid, true, item->randomBonusListId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
}
else
{
@@ -1317,7 +1317,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
- player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
+ player->StoreNewItem(dest, roll->itemid, true, item->randomBonusListId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
}
else
{
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 4b57b55c2ae..520d1da80dd 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -182,7 +182,7 @@ class Roll : public LootValidatorRef
ItemDisenchantLootEntry const* GetItemDisenchantLoot(Player const* player) const;
uint32 itemid;
- ItemRandomEnchantmentId itemRandomPropId;
+ ItemRandomBonusListId itemRandomBonusListId;
uint8 itemCount;
typedef std::map<ObjectGuid, RollVote> PlayerVote;
PlayerVote playerVote; //vote position correspond with player position (in group)
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 426164a0718..07e24e3c26e 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -373,7 +373,7 @@ void Guild::BankTab::LoadFromDB(Field* fields)
bool Guild::BankTab::LoadItemFromDB(Field* fields)
{
- uint8 slotId = fields[47].GetUInt8();
+ uint8 slotId = fields[46].GetUInt8();
ObjectGuid::LowType itemGuid = fields[0].GetUInt64();
uint32 itemEntry = fields[1].GetUInt32();
if (slotId >= GUILD_BANK_MAX_SLOTS)
@@ -2468,7 +2468,7 @@ void Guild::LoadBankTabFromDB(Field* fields)
bool Guild::LoadBankItemFromDB(Field* fields)
{
- uint8 tabId = fields[46].GetUInt8();
+ uint8 tabId = fields[45].GetUInt8();
if (tabId >= _GetPurchasedTabsSize())
{
TC_LOG_ERROR("guild", "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.",
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index d1d8efb074f..a0a094c699b 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -408,19 +408,19 @@ void GuildMgr::LoadGuilds()
// Delete orphan guild bank items
CharacterDatabase.DirectExecute("DELETE gbi FROM guild_bank_item gbi LEFT JOIN guild g ON gbi.guildId = g.guildId WHERE g.guildId IS NULL");
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyType, randomPropertyId, durability, playedTime, text,
- // 14 15 16 17 18 19 20
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text,
+ // 13 14 15 16 17 18 19
// upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs,
- // 21 22 23 24 25
+ // 20 21 22 23 24
// itemModifiedAppearanceAllSpecs, itemModifiedAppearanceSpec1, itemModifiedAppearanceSpec2, itemModifiedAppearanceSpec3, itemModifiedAppearanceSpec4,
- // 26 27 28 29 30
+ // 25 26 27 28 29
// spellItemEnchantmentAllSpecs, spellItemEnchantmentSpec1, spellItemEnchantmentSpec2, spellItemEnchantmentSpec3, spellItemEnchantmentSpec4,
- // 31 32 33 34 35 36 37 38 39 40 41 42
+ // 30 31 32 33 34 35 36 37 38 39 40 41
// gemItemId1, gemBonuses1, gemContext1, gemScalingLevel1, gemItemId2, gemBonuses2, gemContext2, gemScalingLevel2, gemItemId3, gemBonuses3, gemContext3, gemScalingLevel3
- // 43 44
+ // 42 43
// fixedScalingLevel, artifactKnowledgeLevel
- // 45 46 47
+ // 44 45 46
// guildid, TabId, SlotId FROM guild_bank_item gbi INNER JOIN item_instance ii ON gbi.item_guid = ii.guid
PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEMS));
@@ -434,7 +434,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint64 guildId = fields[45].GetUInt64();
+ uint64 guildId = fields[44].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankItemFromDB(fields);
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 3bd6173ae53..edffaa0d11b 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -533,7 +533,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
}
// now move item from loot to target inventory
- Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
+ Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
target->SendNewItem(newitem, uint32(item.count), false, false, true);
target->UpdateCriteria(CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
target->UpdateCriteria(CRITERIA_TYPE_LOOT_TYPE, item.itemid, item.count, loot->loot_type);
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 873b34df76a..da160a50112 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -723,7 +723,7 @@ void WorldSession::HandlePlayerChoiceResponse(WorldPackets::Quest::ChoiceRespons
ItemPosCountVec dest;
if (_player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.Id, item.Quantity) == EQUIP_ERR_OK)
{
- Item* newItem = _player->StoreNewItem(dest, item.Id, true, GenerateItemRandomPropertyId(item.Id), {}, 0, item.BonusListIDs);
+ Item* newItem = _player->StoreNewItem(dest, item.Id, true, GenerateItemRandomBonusListId(item.Id), {}, 0, item.BonusListIDs);
_player->SendNewItem(newItem, item.Quantity, true, false);
}
}
diff --git a/src/server/game/Handlers/VoidStorageHandler.cpp b/src/server/game/Handlers/VoidStorageHandler.cpp
index bf4b222510c..b951e26ed03 100644
--- a/src/server/game/Handlers/VoidStorageHandler.cpp
+++ b/src/server/game/Handlers/VoidStorageHandler.cpp
@@ -155,7 +155,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPackets::VoidStorage::VoidStor
}
VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetCreator(),
- item->GetItemRandomEnchantmentId(), item->GetModifier(ITEM_MODIFIER_UPGRADE_ID),
+ item->GetItemRandomBonusListId(), item->GetModifier(ITEM_MODIFIER_UPGRADE_ID),
item->GetModifier(ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL), item->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL),
uint8(item->m_itemData->Context), item->m_itemData->BonusListIDs);
@@ -194,7 +194,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPackets::VoidStorage::VoidStor
return;
}
- Item* item = _player->StoreNewItem(dest, itemVS->ItemEntry, true, itemVS->ItemRandomPropertyId, GuidSet(), itemVS->Context, itemVS->BonusListIDs);
+ Item* item = _player->StoreNewItem(dest, itemVS->ItemEntry, true, itemVS->RandomBonusListId, GuidSet(), itemVS->Context, itemVS->BonusListIDs);
item->SetCreator(itemVS->CreatorGuid);
item->SetModifier(ITEM_MODIFIER_UPGRADE_ID, itemVS->ItemUpgradeId);
item->SetBinding(true);
diff --git a/src/server/game/Loot/Loot.cpp b/src/server/game/Loot/Loot.cpp
index 37d0c498b82..ab32019a4cc 100644
--- a/src/server/game/Loot/Loot.cpp
+++ b/src/server/game/Loot/Loot.cpp
@@ -46,7 +46,7 @@ LootItem::LootItem(LootStoreItem const& li)
needs_quest = li.needs_quest;
- randomPropertyId = GenerateItemRandomPropertyId(itemid);
+ randomBonusListId = GenerateItemRandomBonusListId(itemid);
upgradeId = sDB2Manager.GetRulesetItemUpgrade(itemid);
context = 0;
count = 0;
diff --git a/src/server/game/Loot/Loot.h b/src/server/game/Loot/Loot.h
index dcd9978088f..709d3aceddb 100644
--- a/src/server/game/Loot/Loot.h
+++ b/src/server/game/Loot/Loot.h
@@ -133,13 +133,13 @@ enum LootSlotType
struct TC_GAME_API LootItem
{
uint32 itemid;
- ItemRandomEnchantmentId randomPropertyId;
+ ItemRandomBonusListId randomBonusListId;
int32 upgradeId;
std::vector<int32> BonusListIDs;
uint8 context;
ConditionContainer conditions; // additional loot condition
GuidSet allowedGUIDs;
- ObjectGuid rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list!
+ ObjectGuid rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list!
uint8 count : 8;
bool is_looted : 1;
bool is_blocked : 1;
@@ -155,7 +155,7 @@ struct TC_GAME_API LootItem
explicit LootItem(LootStoreItem const& li);
// Empty constructor for creating an empty LootItem to be filled in with DB data
- LootItem() : itemid(0), randomPropertyId(), upgradeId(0), context(0), count(0), is_looted(false), is_blocked(false),
+ LootItem() : itemid(0), randomBonusListId(0), upgradeId(0), context(0), count(0), is_looted(false), is_blocked(false),
freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false),
canSave(true){ };
diff --git a/src/server/game/Server/Packets/ItemPacketsCommon.cpp b/src/server/game/Server/Packets/ItemPacketsCommon.cpp
index fbc907d7b81..e94123490aa 100644
--- a/src/server/game/Server/Packets/ItemPacketsCommon.cpp
+++ b/src/server/game/Server/Packets/ItemPacketsCommon.cpp
@@ -69,11 +69,13 @@ void WorldPackets::Item::ItemInstance::Initialize(::LootItem const& lootItem)
{
ItemID = lootItem.itemid;
- if (!lootItem.BonusListIDs.empty())
+ if (!lootItem.BonusListIDs.empty() || lootItem.randomBonusListId)
{
ItemBonus = boost::in_place();
ItemBonus->BonusListIDs = lootItem.BonusListIDs;
ItemBonus->Context = lootItem.context;
+ if (lootItem.randomBonusListId)
+ ItemBonus->BonusListIDs.push_back(lootItem.randomBonusListId);
}
if (lootItem.upgradeId)
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index df7f743a17f..1c52f6e0936 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1408,7 +1408,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype, uint8 context /*= 0*/, s
if (num_to_add)
{
// create the new item and store it
- Item* pItem = player->StoreNewItem(dest, newitemid, true, GenerateItemRandomPropertyId(newitemid), GuidSet(), context, bonusListIDs);
+ Item* pItem = player->StoreNewItem(dest, newitemid, true, GenerateItemRandomBonusListId(newitemid), GuidSet(), context, bonusListIDs);
// was it successful? return error if not
if (!pItem)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 0b15b5bb4bf..2d8caeaa696 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1704,8 +1704,8 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
sSpellMgr->LoadSpellEnchantProcData();
- TC_LOG_INFO("server.loading", "Loading Item Random Enchantments Table...");
- LoadRandomEnchantmentsTable();
+ TC_LOG_INFO("server.loading", "Loading Random item bonus list definitions...");
+ LoadItemRandomBonusListTemplates();
TC_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items
DisableMgr::LoadDisables();
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 3a87ac318a0..4f8d7099fe3 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1355,7 +1355,7 @@ public:
return false;
}
- Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId), GuidSet(), 0, bonusListIDs);
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), 0, bonusListIDs);
// remove binding (let GM give it to another player later)
if (player == playerTarget)
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 380d73c2e7e..9e5048576a7 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -108,7 +108,7 @@ public:
{ "gameobject_queststarter", rbac::RBAC_PERM_COMMAND_RELOAD_GAMEOBJECT_QUESTSTARTER, true, &HandleReloadGOQuestStarterCommand, "" },
{ "gossip_menu", rbac::RBAC_PERM_COMMAND_RELOAD_GOSSIP_MENU, true, &HandleReloadGossipMenuCommand, "" },
{ "gossip_menu_option", rbac::RBAC_PERM_COMMAND_RELOAD_GOSSIP_MENU_OPTION, true, &HandleReloadGossipMenuOptionCommand, "" },
- { "item_enchantment_template", rbac::RBAC_PERM_COMMAND_RELOAD_ITEM_ENCHANTMENT_TEMPLATE, true, &HandleReloadItemEnchantementsCommand, "" },
+ { "item_random_bonus_list_template", rbac::RBAC_PERM_COMMAND_RELOAD_ITEM_RANDOM_BONUS_LIST_TEMPLATE, true, &HandleReloadItemRandomBonusListTemplatesCommand, "" },
{ "item_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_ITEM_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesItemCommand, "" },
{ "lfg_dungeon_rewards", rbac::RBAC_PERM_COMMAND_RELOAD_LFG_DUNGEON_REWARDS, true, &HandleReloadLfgRewardsCommand, "" },
{ "locales_achievement_reward", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_ACHIEVEMENT_REWARD, true, &HandleReloadLocalesAchievementRewardCommand, "" },
@@ -308,7 +308,7 @@ public:
static bool HandleReloadAllItemCommand(ChatHandler* handler, const char* /*args*/)
{
HandleReloadPageTextsCommand(handler, "a");
- HandleReloadItemEnchantementsCommand(handler, "a");
+ HandleReloadItemRandomBonusListTemplatesCommand(handler, "a");
return true;
}
@@ -878,11 +878,11 @@ public:
return true;
}
- static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadItemRandomBonusListTemplatesCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Item Random Enchantments Table...");
- LoadRandomEnchantmentsTable();
- handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded.");
+ TC_LOG_INFO("misc", "Re-Loading Random item bonus list definitions...");
+ LoadItemRandomBonusListTemplates();
+ handler->SendGlobalGMSysMessage("DB table `item_random_bonus_list_template` reloaded.");
return true;
}
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index a0649c046d2..2a1ff2d6e14 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -163,7 +163,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 39883, true, GenerateItemRandomPropertyId(39883));
+ player->StoreNewItem(dest, 39883, true, GenerateItemRandomBonusListId(39883));
return true;
}
@@ -183,7 +183,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 44718, true, GenerateItemRandomPropertyId(44718));
+ player->StoreNewItem(dest, 44718, true, GenerateItemRandomBonusListId(44718));
return true;
}