aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Chat/Chat.cpp2
-rw-r--r--src/server/game/Chat/Chat.h2
-rw-r--r--src/server/game/Chat/Commands/Level3.cpp16
-rw-r--r--src/server/game/DataStores/DBCStructure.h4
-rw-r--r--src/server/game/DataStores/DBCfmt.h2
-rw-r--r--src/server/game/Entities/Item/ItemPrototype.h11
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp127
-rw-r--r--src/server/game/Globals/ObjectMgr.h21
-rw-r--r--src/server/game/Server/Protocol/Handlers/ItemHandler.cpp37
-rw-r--r--src/server/game/World/World.cpp20
10 files changed, 205 insertions, 37 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index a976a2fcafc..f62dee975da 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -479,10 +479,12 @@ ChatCommand * ChatHandler::getCommandTable()
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuOptionCommand, "", NULL },
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL },
{ "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
+ { "item_set_names", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemSetNamesCommand, "", NULL },
{ "locales_achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesAchievementRewardCommand,"", NULL },
{ "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL },
{ "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL },
{ "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL },
+ { "locales_item_set_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemSetNameCommand, "", NULL },
{ "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL },
{ "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL },
{ "locales_points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPointsOfInterestCommand, "", NULL },
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index a298ca03881..6b102129c8a 100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -378,10 +378,12 @@ class ChatHandler
bool HandleReloadGOQuestRelationsCommand(const char* args);
bool HandleReloadGOQuestInvRelationsCommand(const char* args);
bool HandleReloadItemEnchantementsCommand(const char* args);
+ bool HandleReloadItemSetNamesCommand(const char* args);
bool HandleReloadLocalesAchievementRewardCommand(const char* args);
bool HandleReloadLocalesCreatureCommand(const char* args);
bool HandleReloadLocalesGameobjectCommand(const char* args);
bool HandleReloadLocalesItemCommand(const char* args);
+ bool HandleReloadLocalesItemSetNameCommand(const char* args);
bool HandleReloadLocalesNpcTextCommand(const char* args);
bool HandleReloadLocalesPageTextCommand(const char* args);
bool HandleReloadLocalesPointsOfInterestCommand(const char* args);
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index abdb99ee5e5..d7ebfbf912e 100644
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -1284,6 +1284,14 @@ bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*)
return true;
}
+bool ChatHandler::HandleReloadItemSetNamesCommand(const char*)
+{
+ sLog.outString("Re-Loading Item set names...");
+ LoadRandomEnchantmentsTable();
+ SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
+ return true;
+}
+
bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg)
{
if (sWorld.IsScriptScheduled())
@@ -1502,6 +1510,14 @@ bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/)
return true;
}
+bool ChatHandler::HandleReloadLocalesItemSetNameCommand(const char* /*arg*/)
+{
+ sLog.outString("Re-Loading Locales Item set name... ");
+ objmgr.LoadItemSetNameLocales();
+ SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded.");
+ return true;
+}
+
bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/)
{
sLog.outString("Re-Loading Locales NPC Text ... ");
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 112aef734e7..f3ed1e09b12 100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1080,12 +1080,14 @@ struct ItemRandomSuffixEntry
uint32 prefix[5]; // 22-24 m_allocationPct
};
+#define MAX_ITEM_SET_ITEMS 10
struct ItemSetEntry
{
//uint32 id // 0 m_ID
char* name[16]; // 1-16 m_name_lang
// 17 string flags, unused
- //uint32 itemId[17]; // 18-34 m_itemID
+ uint32 itemId[MAX_ITEM_SET_ITEMS]; // 18-27 m_itemID
+ //uint32 unknown[7]; // 28-34 unk, all 0
uint32 spells[8]; // 35-42 m_setSpellID
uint32 items_to_triggerspell[8]; // 43-50 m_setThreshold
uint32 required_skill_id; // 51 m_requiredSkill
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 1f1b010a6fd..e791e304d8c 100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -72,7 +72,7 @@ const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiix";
const char ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxix";
const char ItemRandomPropertiesfmt[]="nxiiiiissssssssssssssssx";
const char ItemRandomSuffixfmt[]="nssssssssssssssssxxiiiiiiiiii";
-const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
+const char ItemSetEntryfmt[]="dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
const char LFGDungeonEntryfmt[]="nxxxxxxxxxxxxxxxxxiiiiiiixixxixixxxxxxxxxxxxxxxxx";
const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxssssssssssssssssx";
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index 31025005a15..797ccd6faaf 100644
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
@@ -661,6 +661,17 @@ struct ItemLocale
std::vector<std::string> Description;
};
+struct ItemSetNameEntry
+{
+ std::string name;
+ uint32 InventoryType;
+};
+
+struct ItemSetNameLocale
+{
+ std::vector<std::string> Name;
+};
+
// 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()
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 8b3cf97a3fe..89ce93b5d80 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2368,7 +2368,132 @@ void ObjectMgr::LoadItemPrototypes()
}
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
- sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dnc`", *itr);
+ sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dbc`", *itr);
+}
+
+void ObjectMgr::LoadItemSetNameLocales()
+{
+ mItemSetNameLocaleMap.clear(); // need for reload case
+
+ QueryResult_AutoPtr result = WorldDatabase.Query("SELECT `entry`,`name_loc1`,`name_loc2`,`name_loc3`,`name_loc4`,`name_loc5`,`name_loc6`,`name_loc7`,`name_loc8` FROM `locales_item_set_name`");
+
+ if (!result)
+ return;
+
+ barGoLink bar(result->GetRowCount());
+
+ do
+ {
+ Field *fields = result->Fetch();
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+
+ ItemSetNameLocale& data = mItemSetNameLocaleMap[entry];
+
+ for (uint8 i = 1; i < MAX_LOCALE; ++i)
+ {
+ std::string str = fields[i].GetCppString();
+ if (!str.empty())
+ {
+ int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+ if (idx >= 0)
+ {
+ if (data.Name.size() <= idx)
+ data.Name.resize(idx+1);
+
+ data.Name[idx] = str;
+ }
+ }
+ }
+ } while (result->NextRow());
+
+ sLog.outString();
+ sLog.outString(">> Loaded %lu Item set name locale strings", (uint32)mItemSetNameLocaleMap.size());
+}
+
+void ObjectMgr::LoadItemSetNames()
+{
+ mItemSetNameMap.clear(); // needed for reload case
+
+ QueryResult_AutoPtr result = WorldDatabase.Query("SELECT `entry`,`name`,`InventoryType` FROM `item_set_names`");
+
+ uint32 count = 0;
+ std::set<uint32> itemSetItems;
+
+ // fill item set member ids
+ for (uint32 entryId = 0; entryId < sItemSetStore.GetNumRows(); ++entryId)
+ {
+ ItemSetEntry const* setEntry = sItemSetStore.LookupEntry(entryId);
+ if (!setEntry)
+ continue;
+
+ for (uint32 i = 0; i < MAX_ITEM_SET_ITEMS; ++i)
+ if (setEntry->itemId[i])
+ itemSetItems.insert(setEntry->itemId[i]);
+ }
+
+ if (result)
+ {
+ barGoLink bar(result->GetRowCount());
+ do
+ {
+ Field *fields = result->Fetch();
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+ if (itemSetItems.find(entry) == itemSetItems.end())
+ {
+ sLog.outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
+ continue;
+ }
+
+ ItemSetNameEntry &data = mItemSetNameMap[entry];
+ data.name = fields[1].GetCppString();
+
+ uint32 invType = fields[2].GetUInt32();
+ if (invType >= MAX_INVTYPE)
+ {
+ sLog.outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
+ invType = INVTYPE_NON_EQUIP;
+ }
+
+ data.InventoryType = invType;
+ itemSetItems.erase(entry);
+ ++count;
+ } while (result->NextRow());
+ }
+ else
+ {
+ barGoLink bar(1);
+ bar.step();
+
+ sLog.outString();
+ sLog.outErrorDb(">> Loaded 0 item set names. DB table `item_set_names` is empty.");
+ }
+
+ if (!itemSetItems.empty())
+ {
+ ItemPrototype const* pProto;
+ for (std::set<uint32>::iterator itr = itemSetItems.begin(); itr != itemSetItems.end(); ++itr)
+ {
+ uint32 entry = *itr;
+ // add data from item_template if available
+ if (pProto = GetItemPrototype(entry))
+ {
+ sLog.outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry);
+ ItemSetNameEntry &data = mItemSetNameMap[entry];
+ data.name = pProto->Name1;
+ data.InventoryType = pProto->InventoryType;
+ ++count;
+ }
+ else
+ sLog.outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry);
+ }
+ }
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u item set names", count);
}
void ObjectMgr::LoadVehicleAccessories()
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index eeeb871c98e..a5e3989d452 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -164,6 +164,7 @@ typedef UNORDERED_MAP<uint32,GameObjectData> GameObjectDataMap;
typedef UNORDERED_MAP<uint32,CreatureLocale> CreatureLocaleMap;
typedef UNORDERED_MAP<uint32,GameObjectLocale> GameObjectLocaleMap;
typedef UNORDERED_MAP<uint32,ItemLocale> ItemLocaleMap;
+typedef UNORDERED_MAP<uint32,ItemSetNameLocale> ItemSetNameLocaleMap;
typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap;
typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap;
typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap;
@@ -431,6 +432,14 @@ class ObjectMgr
static ItemPrototype const* GetItemPrototype(uint32 id) { return sItemStorage.LookupEntry<ItemPrototype>(id); }
+ ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId)
+ {
+ ItemSetNameMap::iterator itr = mItemSetNameMap.find(itemId);
+ if(itr != mItemSetNameMap.end())
+ return &itr->second;
+ return NULL;
+ }
+
static InstanceTemplate const* GetInstanceTemplate(uint32 map)
{
return sInstanceTemplate.LookupEntry<InstanceTemplate>(map);
@@ -607,6 +616,8 @@ class ObjectMgr
void LoadGameobjectRespawnTimes();
void LoadItemPrototypes();
void LoadItemLocales();
+ void LoadItemSetNames();
+ void LoadItemSetNameLocales();
void LoadQuestLocales();
void LoadNpcTextLocales();
void LoadPageTextLocales();
@@ -740,6 +751,12 @@ class ObjectMgr
if (itr == mItemLocaleMap.end()) return NULL;
return &itr->second;
}
+ ItemSetNameLocale const* GetItemSetNameLocale(uint32 entry) const
+ {
+ ItemSetNameLocaleMap::const_iterator itr = mItemSetNameLocaleMap.find(entry);
+ if (itr == mItemSetNameLocaleMap.end())return NULL;
+ return &itr->second;
+ }
QuestLocale const* GetQuestLocale(uint32 entry) const
{
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
@@ -1045,6 +1062,9 @@ class ObjectMgr
HalfNameMap PetHalfName0;
HalfNameMap PetHalfName1;
+ typedef UNORDERED_MAP<uint32, ItemSetNameEntry> ItemSetNameMap;
+ ItemSetNameMap mItemSetNameMap;
+
MapObjectGuids mMapObjectGuids;
CreatureDataMap mCreatureDataMap;
CreatureLinkedRespawnMap mCreatureLinkedRespawnMap;
@@ -1052,6 +1072,7 @@ class ObjectMgr
GameObjectDataMap mGameObjectDataMap;
GameObjectLocaleMap mGameObjectLocaleMap;
ItemLocaleMap mItemLocaleMap;
+ ItemSetNameLocaleMap mItemSetNameLocaleMap;
QuestLocaleMap mQuestLocaleMap;
NpcTextLocaleMap mNpcTextLocaleMap;
PageTextLocaleMap mPageTextLocaleMap;
diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp
index 897ee7dcfd3..e9b9004804a 100644
--- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp
@@ -1003,40 +1003,25 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
recv_data.read_skip<uint64>(); // guid
sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
- ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
- if (pProto)
+ ItemSetNameEntry const *pName = objmgr.GetItemSetNameEntry(itemid);
+ if (pName)
{
- std::string Name;
- Name = pProto->Name1;
-
+ std::string Name = pName->name;
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
- ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId);
- if (il)
- {
- if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
- Name = il->Name[loc_idx];
- }
+ ItemSetNameLocale const *isnl = objmgr.GetItemSetNameLocale(itemid);
+ if (isnl)
+ if (isnl->Name.size() > size_t(loc_idx) && !isnl->Name[loc_idx].empty())
+ Name = isnl->Name[loc_idx];
}
- // guess size
- WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+10));
- data << uint32(pProto->ItemId);
+
+ WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4));
+ data << uint32(itemid);
data << Name;
- data << uint32(pProto->InventoryType);
+ data << uint32(pName->InventoryType);
SendPacket(&data);
- return;
}
-// This is a BS check, there are lots of items listed in Item.dbc that do not even exist on official -- so we can NEVER get the data for them.
-// If you *really* want to spam your error log -- uncomment this.
-/* else
- {
- // listed in dbc or not expected to exist unknown item
- if (sItemStore.LookupEntry(itemid))
- sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid);
- else
- sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid);
- } */
}
void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 0f34fc83ffb..0041bbaecc8 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1320,6 +1320,7 @@ void World::SetInitialWorldSettings()
objmgr.LoadCreatureLocales();
objmgr.LoadGameObjectLocales();
objmgr.LoadItemLocales();
+ objmgr.LoadItemSetNameLocales();
objmgr.LoadQuestLocales();
objmgr.LoadNpcTextLocales();
objmgr.LoadPageTextLocales();
@@ -1332,7 +1333,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Page Texts...");
objmgr.LoadPageTexts();
- sLog.outString("Loading Game Object Templates..."); // must be after LoadPageTexts
+ sLog.outString("Loading Game Object Templates..."); // must be after LoadPageTexts
objmgr.LoadGameobjectInfo();
sLog.outString("Loading Spell Rank Data...");
@@ -1371,9 +1372,12 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
- sLog.outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
+ sLog.outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
objmgr.LoadItemPrototypes();
+ sLog.outString("Loading Item set names..."); // must be after LoadItemPrototypes
+ objmgr.LoadItemSetNames();
+
sLog.outString("Loading Creature Model Based Info Data...");
objmgr.LoadCreatureModelInfo();
@@ -1408,15 +1412,15 @@ void World::SetInitialWorldSettings()
objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
sLog.outString("Loading Vehicle Accessories...");
- objmgr.LoadVehicleAccessories(); // must be after LoadCreatureTemplates()
+ objmgr.LoadVehicleAccessories(); // must be after LoadCreatureTemplates()
- sLog.outString("Loading Creature Respawn Data..."); // must be after PackInstances()
+ sLog.outString("Loading Creature Respawn Data..."); // must be after PackInstances()
objmgr.LoadCreatureRespawnTimes();
sLog.outString("Loading Gameobject Data...");
objmgr.LoadGameobjects();
- sLog.outString("Loading Gameobject Respawn Data..."); // must be after PackInstances()
+ sLog.outString("Loading Gameobject Respawn Data..."); // must be after PackInstances()
objmgr.LoadGameobjectRespawnTimes();
sLog.outString("Loading Objects Pooling Data...");
@@ -1440,7 +1444,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data...");
objmgr.LoadNPCSpellClickSpells();
- sLog.outString("Loading SpellArea Data..."); // must be after quest load
+ sLog.outString("Loading SpellArea Data..."); // must be after quest load
spellmgr.LoadSpellAreas();
sLog.outString("Loading AreaTrigger definitions...");
@@ -1603,7 +1607,7 @@ void World::SetInitialWorldSettings()
sLog.outString(">>> Scripts loaded");
sLog.outString();
- sLog.outString("Loading Scripts text locales..."); // must be after Load*Scripts calls
+ sLog.outString("Loading Scripts text locales..."); // must be after Load*Scripts calls
objmgr.LoadDbScriptStrings();
sLog.outString("Loading CreatureEventAI Texts...");
@@ -1671,7 +1675,7 @@ void World::SetInitialWorldSettings()
sLog.outString("Starting Arena Season...");
gameeventmgr.StartArenaSeason();
- sLog.outString("Loading World States..."); // must be loaded before battleground and outdoor PvP
+ sLog.outString("Loading World States..."); // must be loaded before battleground and outdoor PvP
LoadWorldStates();
///- Initialize Looking For Group