From 40a03daf823a66e89b4bbcb758545a040542f083 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 21 Mar 2009 22:43:47 -0600 Subject: [7512] Implement checks of item bag mask at server startup. Author: VladimirMangos --HG-- branch : trunk --- src/game/ItemPrototype.h | 2 +- src/game/ObjectMgr.cpp | 18 ++++++++++++++++++ src/shared/Database/DBCStores.cpp | 4 +++- src/shared/Database/DBCStores.h | 1 + src/shared/Database/DBCStructure.h | 7 +++++++ src/shared/Database/DBCfmt.cpp | 1 + 6 files changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index caf878da7e1..3967b37622b 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -559,7 +559,7 @@ struct ItemPrototype uint32 MaxDurability; uint32 Area; // id from AreaTable.dbc uint32 Map; // id from Map.dbc - uint32 BagFamily; // id from ItemBagFamily.dbc + uint32 BagFamily; // bit string (1 << id from ItemBagFamily.dbc) uint32 TotemCategory; // id from TotemCategory.dbc _Socket Socket[MAX_ITEM_PROTO_SOCKETS]; uint32 socketBonus; // id from SpellItemEnchantment.dbc diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 0db8a328d3f..fec531f96d9 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1810,6 +1810,24 @@ void ObjectMgr::LoadItemPrototypes() if(proto->Map && !sMapStore.LookupEntry(proto->Map)) sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)",i,proto->Map); + if(proto->BagFamily) + { + // check bits + for(uint32 i = 0; i < sizeof(proto->BagFamily)*8; ++i) + { + uint32 mask = 1 << i; + if((proto->BagFamily & mask)==0) + continue; + + ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(i+1); + if(!bf) + { + sLog.outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit",i); + const_cast(proto)->BagFamily &= ~mask; + } + } + } + if(proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory)) sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)",i,proto->TotemCategory); diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp index 9589865b9ac..2565eb2cc1e 100644 --- a/src/shared/Database/DBCStores.cpp +++ b/src/shared/Database/DBCStores.cpp @@ -79,6 +79,7 @@ DBCStorage sGtRegenHPPerSptStore(GtRegenHPPerSptf DBCStorage sGtRegenMPPerSptStore(GtRegenMPPerSptfmt); DBCStorage sHolidaysStore(Holidaysfmt); DBCStorage sItemStore(Itemfmt); +DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); //DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); //DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently DBCStorage sItemExtendedCostStore(ItemExtendedCostEntryfmt); @@ -196,7 +197,7 @@ void LoadDBCStores(const std::string& dataPath) { std::string dbcPath = dataPath+"dbc/"; - const uint32 DBCFilesCount = 73; + const uint32 DBCFilesCount = 74; barGoLink bar( DBCFilesCount ); @@ -271,6 +272,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtRegenMPPerSptStore, dbcPath,"gtRegenMPPerSpt.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sHolidaysStore, dbcPath,"Holidays.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemStore, dbcPath,"Item.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemBagFamilyStore, dbcPath,"ItemBagFamily.dbc"); //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemDisplayInfoStore, dbcPath,"ItemDisplayInfo.dbc"); -- not used currently //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemCondExtCostsStore, dbcPath,"ItemCondExtCosts.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemExtendedCostStore, dbcPath,"ItemExtendedCost.dbc"); diff --git a/src/shared/Database/DBCStores.h b/src/shared/Database/DBCStores.h index 0829ce5c5ee..07ed80571f9 100644 --- a/src/shared/Database/DBCStores.h +++ b/src/shared/Database/DBCStores.h @@ -171,6 +171,7 @@ extern DBCStorage sGtRegenHPPerSptStore; extern DBCStorage sGtRegenMPPerSptStore; extern DBCStorage sHolidaysStore; extern DBCStorage sItemStore; +extern DBCStorage sItemBagFamilyStore; //extern DBCStorage sItemDisplayInfoStore; -- not used currently extern DBCStorage sItemExtendedCostStore; extern DBCStorage sItemLimitCategoryStore; diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h index ec60105a230..4cb57a165f2 100644 --- a/src/shared/Database/DBCStructure.h +++ b/src/shared/Database/DBCStructure.h @@ -908,6 +908,13 @@ struct ItemEntry uint32 Sheath; // 7 }; +struct ItemBagFamilyEntry +{ + uint32 ID; // 0 + //char* name[16] // 1-16 m_name_lang + // // 17 name flags +}; + struct ItemDisplayInfoEntry { uint32 ID; // 0 m_ID diff --git a/src/shared/Database/DBCfmt.cpp b/src/shared/Database/DBCfmt.cpp index b958742ffc7..6230298b11d 100644 --- a/src/shared/Database/DBCfmt.cpp +++ b/src/shared/Database/DBCfmt.cpp @@ -57,6 +57,7 @@ const char GtRegenHPPerSptfmt[]="f"; const char GtRegenMPPerSptfmt[]="f"; const char Holidaysfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char Itemfmt[]="nixiiiii"; +const char ItemBagFamilyfmt[]="nxxxxxxxxxxxxxxxxx"; //const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx"; //const char ItemCondExtCostsEntryfmt[]="xiii"; const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiix"; -- cgit v1.2.3