diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 35 | ||||
-rwxr-xr-x | src/server/game/World/World.cpp | 3 | ||||
-rwxr-xr-x | src/server/game/World/World.h | 1 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 8 |
4 files changed, 32 insertions, 15 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e3540bc7715..af0515e7d78 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2030,6 +2030,7 @@ void ObjectMgr::LoadItemPrototypes() sLog.outString(); // check data correctness + bool enforceDBCAttributes = sWorld.getBoolConfig(CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES); for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i) { ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype >(i); @@ -2047,8 +2048,9 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Class != dbcitem->Class) { - sLog.outErrorDb("Item (Entry: %u) does not have a correct class %u, must be %u (still using DB value).",i,proto->Class,dbcitem->Class); - // It is safe to use Class from DB + sLog.outErrorDb("Item (Entry: %u) does not have a correct class %u, must be %u .", i, proto->Class, dbcitem->Class); + if (enforceDBCAttributes) + const_cast<ItemPrototype*>(proto)->Class = dbcitem->Class; } /* disabled: have some strange wrong cases for Subclass values. for enable also uncomment Subclass field in ItemEntry structure and in Itemfmt[] @@ -2061,32 +2063,35 @@ void ObjectMgr::LoadItemPrototypes() if (proto->Unk0 != dbcitem->Unk0) { - sLog.outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i) , must be %i (still using DB value).",i,proto->Unk0,dbcitem->Unk0); - // It is safe to use Unk0 from DB + sLog.outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i) , must be %i .", i, proto->Unk0, dbcitem->Unk0); + if (enforceDBCAttributes) + const_cast<ItemPrototype*>(proto)->Unk0 = dbcitem->Unk0; } - if (proto->Material != dbcitem->Material) { - sLog.outErrorDb("Item (Entry: %u) does not have a correct material (%i), must be %i (still using DB value).",i,proto->Material,dbcitem->Material); - // It is safe to use Material from DB + sLog.outErrorDb("Item (Entry: %u) does not have a correct material (%i), must be %i .", i, proto->Material, dbcitem->Material); + if (enforceDBCAttributes) + const_cast<ItemPrototype*>(proto)->Material = dbcitem->Material; } - if (proto->InventoryType != dbcitem->InventoryType) { - sLog.outErrorDb("Item (Entry: %u) does not have a correct inventory type (%u), must be %u (still using DB value).",i,proto->InventoryType,dbcitem->InventoryType); - // It is safe to use InventoryType from DB + sLog.outErrorDb("Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", i, proto->InventoryType, dbcitem->InventoryType); + if (enforceDBCAttributes) + const_cast<ItemPrototype*>(proto)->InventoryType = dbcitem->InventoryType; } - if (proto->DisplayInfoID != dbcitem->DisplayId) { - sLog.outErrorDb("Item (Entry: %u) does not have a correct display id (%u), must be %u (using it).",i,proto->DisplayInfoID,dbcitem->DisplayId); - const_cast<ItemPrototype*>(proto)->DisplayInfoID = dbcitem->DisplayId; + sLog.outErrorDb("Item (Entry: %u) does not have a correct display id (%u), must be %u .", i, proto->DisplayInfoID, dbcitem->DisplayId); + if (enforceDBCAttributes) + const_cast<ItemPrototype*>(proto)->DisplayInfoID = dbcitem->DisplayId; } if (proto->Sheath != dbcitem->Sheath) { - sLog.outErrorDb("Item (Entry: %u) does not have a correct sheathid (%u), must be %u (using it).",i,proto->Sheath,dbcitem->Sheath); - const_cast<ItemPrototype*>(proto)->Sheath = dbcitem->Sheath; + sLog.outErrorDb("Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", i, proto->Sheath, dbcitem->Sheath); + if (enforceDBCAttributes) + const_cast<ItemPrototype*>(proto)->Sheath = dbcitem->Sheath; } + } else sLog.outErrorDb("Item (Entry: %u) does not exist in item.dbc! (not correct id?).",i); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index a0199a4d2d4..2670e63c230 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1172,6 +1172,9 @@ void World::LoadConfigSettings(bool reload) // Dungeon finder m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = sConfig.GetBoolDefault("DungeonFinder.Enable", false); + + // DBC_ItemAttributes + m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = sConfig.GetBoolDefault("DBC.EnforceItemAttributes", true); // AutoBroadcast m_bool_configs[CONFIG_AUTOBROADCAST] = sConfig.GetBoolDefault("AutoBroadcast.On", false); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index d442ad18442..998703dfb42 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -162,6 +162,7 @@ enum WorldBoolConfigs CONFIG_DUNGEON_FINDER_ENABLE, CONFIG_AUTOBROADCAST, CONFIG_ALLOW_TICKETS, + CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES, BOOL_CONFIG_VALUE_COUNT }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 2e78f8d28a1..0e5acea124f 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1370,6 +1370,14 @@ AllowTickets = 1 DungeonFinder.Enable = 0 # +# DBC.EnforceItemAttributes +# Disallow overriding item attributes stored in DBC files with values from the database +# Default: 0 - Off, Use DB values +# 1 - On, Enforce DBC Values (default) + +DBC.EnforceItemAttributes = 1 + +# ################################################################################################### ################################################################################################### |