diff options
| author | Shauren <shauren.trinity@gmail.com> | 2015-02-22 10:29:12 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2015-02-22 10:29:12 +0100 |
| commit | 5c4fd7ac4fc5121f7ac620fc4ffdfae939420ba1 (patch) | |
| tree | f007d5c099c9eb1501dfebb58672499f075be6fc /src/server/game | |
| parent | e36fb12359c7dcd7f74b1c9bf8ddfcbad44d273a (diff) | |
Core/DataStores: Added tables for all loaded DB2 stores
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 182 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.h | 66 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Structure.h | 76 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2fmt.h | 58 | ||||
| -rw-r--r-- | src/server/game/DataStores/DBCfmt.h | 1 | ||||
| -rw-r--r-- | src/server/game/Handlers/QueryHandler.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Movement/Waypoints/Path.h | 12 | ||||
| -rw-r--r-- | src/server/game/Server/Packets/QueryPackets.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Server/Packets/QueryPackets.h | 6 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 12 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/World/World.cpp | 9 |
12 files changed, 216 insertions, 221 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index fed1c1e60b3..44ac3d8ca19 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -23,36 +23,37 @@ #include "World.h" #include <functional> -DB2Storage<BroadcastTextEntry> sBroadcastTextStore(BroadcastTextEntryfmt, HOTFIX_SEL_BROADCAST_TEXT); -DB2Storage<CurvePointEntry> sCurvePointStore(CurvePointEntryfmt); -DB2Storage<HolidaysEntry> sHolidaysStore(HolidaysEntryfmt); -DB2Storage<ItemEntry> sItemStore(Itemfmt); -DB2Storage<ItemAppearanceEntry> sItemAppearanceStore(ItemAppearanceEntryfmt); -DB2Storage<ItemBonusEntry> sItemBonusStore(ItemBonusEntryfmt); -DB2Storage<ItemBonusTreeNodeEntry> sItemBonusTreeNodeStore(ItemBonusTreeNodeEntryfmt); -DB2Storage<ItemCurrencyCostEntry> sItemCurrencyCostStore(ItemCurrencyCostfmt); -DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfmt); -DB2Storage<ItemEffectEntry> sItemEffectStore(ItemEffectEntryfmt); -DB2Storage<ItemModifiedAppearanceEntry> sItemModifiedAppearanceStore(ItemModifiedAppearanceEntryfmt); -DB2Storage<ItemSparseEntry> sItemSparseStore(ItemSparsefmt); -DB2Storage<ItemXBonusTreeEntry> sItemXBonusTreeStore(ItemXBonusTreeEntryfmt); -DB2Storage<KeyChainEntry> sKeyChainStore(KeyChainfmt); -DB2Storage<MountEntry> sMountStore(Mountfmt); -DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore(OverrideSpellDataEntryfmt); -DB2Storage<PhaseGroupEntry> sPhaseGroupStore(PhaseGroupEntryfmt); -DB2Storage<SpellAuraRestrictionsEntry> sSpellAuraRestrictionsStore(SpellAuraRestrictionsEntryfmt); -DB2Storage<SpellCastingRequirementsEntry> sSpellCastingRequirementsStore(SpellCastingRequirementsEntryfmt); -DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore(SpellClassOptionsEntryfmt); -DB2Storage<SpellLearnSpellEntry> sSpellLearnSpellStore(SpellLearnSpellEntryfmt); -DB2Storage<SpellMiscEntry> sSpellMiscStore(SpellMiscEntryfmt); -DB2Storage<SpellPowerEntry> sSpellPowerStore(SpellPowerEntryfmt); +DB2Storage<BroadcastTextEntry> sBroadcastTextStore(BroadcastTextFormat, HOTFIX_SEL_BROADCAST_TEXT); +DB2Storage<CurvePointEntry> sCurvePointStore(CurvePointFormat, HOTFIX_SEL_CURVE_POINT); +DB2Storage<HolidaysEntry> sHolidaysStore(HolidaysEntryFormat, HOTFIX_SEL_HOLIDAYS); +DB2Storage<ItemAppearanceEntry> sItemAppearanceStore(ItemAppearanceFormat, HOTFIX_SEL_ITEM_APPEARANCE); +DB2Storage<ItemBonusEntry> sItemBonusStore(ItemBonusFormat, HOTFIX_SEL_ITEM_BONUS); +DB2Storage<ItemBonusTreeNodeEntry> sItemBonusTreeNodeStore(ItemBonusTreeNodeFormat, HOTFIX_SEL_ITEM_BONUS_TREE_NODE); +DB2Storage<ItemCurrencyCostEntry> sItemCurrencyCostStore(ItemCurrencyCostFormat, HOTFIX_SEL_ITEM_CURRENCY_COST); +DB2Storage<ItemEffectEntry> sItemEffectStore(ItemEffectFormat, HOTFIX_SEL_ITEM_EFFECT); +DB2Storage<ItemEntry> sItemStore(ItemFormat, HOTFIX_SEL_ITEM); +DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostFormat, HOTFIX_SEL_ITEM_EXTENDED_COST); +DB2Storage<ItemModifiedAppearanceEntry> sItemModifiedAppearanceStore(ItemModifiedAppearanceFormat, HOTFIX_SEL_ITEM_MODIFIED_APPEARANCE); +DB2Storage<ItemSparseEntry> sItemSparseStore(ItemSparseFormat, HOTFIX_SEL_ITEM_SPARSE); +DB2Storage<ItemXBonusTreeEntry> sItemXBonusTreeStore(ItemXBonusTreeFormat, HOTFIX_SEL_ITEM_X_BONUS_TREE); +DB2Storage<KeyChainEntry> sKeyChainStore(KeyChainFormat, HOTFIX_SEL_KEY_CHAIN); +DB2Storage<MountEntry> sMountStore(MountFormat, HOTFIX_SEL_MOUNT); +DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore(OverrideSpellDataFormat, HOTFIX_SEL_OVERRIDE_SPELL_DATA); +DB2Storage<PhaseGroupEntry> sPhaseGroupStore(PhaseGroupFormat, HOTFIX_SEL_PHASE_GROUP); +DB2Storage<SpellAuraRestrictionsEntry> sSpellAuraRestrictionsStore(SpellAuraRestrictionsFormat, HOTFIX_SEL_SPELL_AURA_RESTRICTIONS); +DB2Storage<SpellCastingRequirementsEntry> sSpellCastingRequirementsStore(SpellCastingRequirementsFormat, HOTFIX_SEL_SPELL_CASTING_REQUIREMENTS); +DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore(SpellClassOptionsFormat, HOTFIX_SEL_SPELL_CLASS_OPTIONS); +DB2Storage<SpellLearnSpellEntry> sSpellLearnSpellStore(SpellLearnSpellFormat, HOTFIX_SEL_SPELL_LEARN_SPELL); +DB2Storage<SpellMiscEntry> sSpellMiscStore(SpellMiscFormat, HOTFIX_SEL_SPELL_MISC); +DB2Storage<SpellPowerEntry> sSpellPowerStore(SpellPowerFormat, HOTFIX_SEL_SPELL_POWER); +DB2Storage<SpellReagentsEntry> sSpellReagentsStore(SpellReagentsFormat, HOTFIX_SEL_SPELL_REAGENTS); +DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostFormat, HOTFIX_SEL_SPELL_RUNE_COST); +DB2Storage<SpellTotemsEntry> sSpellTotemsStore(SpellTotemsFormat, HOTFIX_SEL_SPELL_TOTEMS); +DB2Storage<TaxiNodesEntry> sTaxiNodesStore(TaxiNodesFormat, HOTFIX_SEL_TAXI_NODES); +DB2Storage<TaxiPathEntry> sTaxiPathStore(TaxiPathFormat, HOTFIX_SEL_TAXI_PATH); +DB2Storage<TaxiPathNodeEntry> sTaxiPathNodeStore(TaxiPathNodeFormat, HOTFIX_SEL_TAXI_PATH_NODE); + SpellPowerBySpellIDMap sSpellPowerBySpellIDStore; -DB2Storage<SpellReagentsEntry> sSpellReagentsStore(SpellReagentsEntryfmt); -DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostEntryfmt); -DB2Storage<SpellTotemsEntry> sSpellTotemsStore(SpellTotemsEntryfmt); -DB2Storage<TaxiNodesEntry> sTaxiNodesStore(TaxiNodesEntryfmt); -DB2Storage<TaxiPathEntry> sTaxiPathStore(TaxiPathEntryfmt); -DB2Storage<TaxiPathNodeEntry> sTaxiPathNodeStore(TaxiPathNodeEntryfmt, HOTFIX_SEL_TAXI_PATH_NODE); TaxiMask sTaxiNodesMask; TaxiMask sOldContinentsNodesMask; TaxiMask sHordeTaxiNodesMask; @@ -66,19 +67,19 @@ typedef std::list<std::string> DB2StoreProblemList; uint32 DB2FilesCount = 0; template<class T> -inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Manager::StorageMap& stores, DB2Storage<T>& storage, std::string const& db2_path, std::string const& filename) +inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Manager::StorageMap& stores, DB2Storage<T>* storage, std::string const& db2_path, std::string const& filename) { // compatibility format and C++ structure sizes - ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T), + ASSERT(DB2FileLoader::GetFormatRecordSize(storage->GetFormat()) == sizeof(T), "Size of '%s' set by format string (%u) not equal size of C++ structure (" SZFMTD ").", - filename.c_str(), DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T)); + filename.c_str(), DB2FileLoader::GetFormatRecordSize(storage->GetFormat()), sizeof(T)); ++DB2FilesCount; std::string db2_filename = db2_path + filename; - if (storage.Load(db2_filename.c_str(), uint32(sWorld->GetDefaultDbcLocale()))) + if (storage->Load(db2_filename.c_str(), uint32(sWorld->GetDefaultDbcLocale()))) { - storage.LoadFromDB(); + storage->LoadFromDB(); for (uint32 i = 0; i < TOTAL_LOCALES; ++i) { @@ -92,13 +93,12 @@ inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, D localizedName.push_back('/'); localizedName.append(filename); - if (!storage.LoadStringsFrom(localizedName.c_str(), i)) + if (!storage->LoadStringsFrom(localizedName.c_str(), i)) availableDb2Locales &= ~(1 << i); // mark as not available for speedup next checks } - storage.LoadStringsFromDB(i); + storage->LoadStringsFromDB(i); } - } else { @@ -106,7 +106,7 @@ inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, D if (FILE* f = fopen(db2_filename.c_str(), "rb")) { std::ostringstream stream; - stream << db2_filename << " exists, and has " << storage.GetFieldCount() << " field(s) (expected " << strlen(storage.GetFormat()) << "). Extracted file might be from wrong client version."; + stream << db2_filename << " exists, and has " << storage->GetFieldCount() << " field(s) (expected " << strlen(storage->GetFormat()) << "). Extracted file might be from wrong client version."; std::string buf = stream.str(); errlist.push_back(buf); fclose(f); @@ -115,45 +115,47 @@ inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, D errlist.push_back(db2_filename); } - stores[storage.GetHash()] = &storage; + stores[storage->GetHash()] = storage; } void DB2Manager::LoadStores(std::string const& dataPath) { + uint32 oldMSTime = getMSTime(); + std::string db2Path = dataPath + "dbc/"; DB2StoreProblemList bad_db2_files; uint32 availableDb2Locales = 0xFF; - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sBroadcastTextStore, db2Path, "BroadcastText.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sCurvePointStore, db2Path, "CurvePoint.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sHolidaysStore, db2Path, "Holidays.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemStore, db2Path, "Item.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemAppearanceStore, db2Path, "ItemAppearance.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemBonusStore, db2Path, "ItemBonus.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemBonusTreeNodeStore, db2Path, "ItemBonusTreeNode.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemEffectStore, db2Path, "ItemEffect.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemModifiedAppearanceStore, db2Path, "ItemModifiedAppearance.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemSparseStore, db2Path, "Item-sparse.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sItemXBonusTreeStore, db2Path, "ItemXBonusTree.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sKeyChainStore, db2Path, "KeyChain.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sMountStore, db2Path, "Mount.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sOverrideSpellDataStore, db2Path, "OverrideSpellData.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sPhaseGroupStore, db2Path, "PhaseXPhaseGroup.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellAuraRestrictionsStore, db2Path, "SpellAuraRestrictions.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellCastingRequirementsStore, db2Path, "SpellCastingRequirements.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellClassOptionsStore, db2Path, "SpellClassOptions.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellLearnSpellStore, db2Path, "SpellLearnSpell.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellMiscStore, db2Path, "SpellMisc.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellPowerStore, db2Path, "SpellPower.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellReagentsStore, db2Path, "SpellReagents.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellRuneCostStore, db2Path, "SpellRuneCost.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sSpellTotemsStore, db2Path, "SpellTotems.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sTaxiNodesStore, db2Path, "TaxiNodes.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sTaxiPathStore, db2Path, "TaxiPath.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, _stores, sTaxiPathNodeStore, db2Path, "TaxiPathNode.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sBroadcastTextStore, db2Path, "BroadcastText.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sCurvePointStore, db2Path, "CurvePoint.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sHolidaysStore, db2Path, "Holidays.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemAppearanceStore, db2Path, "ItemAppearance.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemBonusStore, db2Path, "ItemBonus.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemBonusTreeNodeStore, db2Path, "ItemBonusTreeNode.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemEffectStore, db2Path, "ItemEffect.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemModifiedAppearanceStore, db2Path, "ItemModifiedAppearance.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemSparseStore, db2Path, "Item-sparse.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemStore, db2Path, "Item.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sItemXBonusTreeStore, db2Path, "ItemXBonusTree.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sKeyChainStore, db2Path, "KeyChain.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sMountStore, db2Path, "Mount.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sOverrideSpellDataStore, db2Path, "OverrideSpellData.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sPhaseGroupStore, db2Path, "PhaseXPhaseGroup.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellAuraRestrictionsStore, db2Path, "SpellAuraRestrictions.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellCastingRequirementsStore, db2Path, "SpellCastingRequirements.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellClassOptionsStore, db2Path, "SpellClassOptions.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellLearnSpellStore, db2Path, "SpellLearnSpell.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellMiscStore, db2Path, "SpellMisc.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellPowerStore, db2Path, "SpellPower.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellReagentsStore, db2Path, "SpellReagents.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellRuneCostStore, db2Path, "SpellRuneCost.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellTotemsStore, db2Path, "SpellTotems.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sTaxiNodesStore, db2Path, "TaxiNodes.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sTaxiPathNodeStore, db2Path, "TaxiPathNode.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sTaxiPathStore, db2Path, "TaxiPath.db2"); for (uint32 i = 0; i < sItemBonusStore.GetNumRows(); ++i) if (ItemBonusEntry const* bonus = sItemBonusStore.LookupEntry(i)) @@ -209,6 +211,7 @@ void DB2Manager::LoadStores(std::string const& dataPath) for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i) if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i)) sTaxiPathSetBySource[entry->From][entry->To] = TaxiPathBySourceAndDestination(entry->ID, entry->Cost); + uint32 pathCount = sTaxiPathStore.GetNumRows(); // Calculate path nodes count @@ -317,7 +320,7 @@ void DB2Manager::LoadStores(std::string const& dataPath) exit(1); } - TC_LOG_INFO("misc", ">> Initialized %d DB2 data stores.", DB2FilesCount); + TC_LOG_INFO("server.loading", ">> Initialized %d DB2 data stores in %u ms", DB2FilesCount, GetMSTimeDiffToNow(oldMSTime)); } DB2StorageBase const* DB2Manager::GetStorage(uint32 type) const @@ -333,7 +336,7 @@ void DB2Manager::LoadHotfixData() { uint32 oldMSTime = getMSTime(); - QueryResult result = HotfixDatabase.Query("SELECT TableHash, RecordID, `Timestamp` FROM hotfix_data"); + QueryResult result = HotfixDatabase.Query("SELECT TableHash, RecordID, `Timestamp`, Deleted FROM hotfix_data"); if (!result) { @@ -355,6 +358,13 @@ void DB2Manager::LoadHotfixData() info.Timestamp = fields[2].GetUInt32(); _hotfixData.push_back(info); + if (fields[3].GetBool()) + { + auto itr = _stores.find(info.TableHash); + if (itr != _stores.end()) + itr->second->EraseRecord(info.Entry); + } + ++count; } while (result->NextRow()); @@ -407,21 +417,13 @@ uint32 DB2Manager::GetHeirloomItemLevel(uint32 curveId, uint32 level) const return uint32(previousItr->second->Y); // Lowest scaling point } -uint32 DB2Manager::GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const +DB2Manager::ItemBonusList DB2Manager::GetItemBonusList(uint32 bonusListId) const { - auto itr = _itemDisplayIDs.find(itemId | (appearanceModId << 24)); - if (itr != _itemDisplayIDs.end()) + auto itr = _itemBonusLists.find(bonusListId); + if (itr != _itemBonusLists.end()) return itr->second; - // Fall back to unmodified appearance - if (appearanceModId) - { - itr = _itemDisplayIDs.find(itemId); - if (itr != _itemDisplayIDs.end()) - return itr->second; - } - - return 0; + return ItemBonusList(); } std::set<uint32> DB2Manager::GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const @@ -445,13 +447,21 @@ std::set<uint32> DB2Manager::GetItemBonusTree(uint32 itemId, uint32 itemBonusTre return bonusListIDs; } -DB2Manager::ItemBonusList DB2Manager::GetItemBonusList(uint32 bonusListId) const +uint32 DB2Manager::GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const { - auto itr = _itemBonusLists.find(bonusListId); - if (itr != _itemBonusLists.end()) + auto itr = _itemDisplayIDs.find(itemId | (appearanceModId << 24)); + if (itr != _itemDisplayIDs.end()) return itr->second; - return ItemBonusList(); + // Fall back to unmodified appearance + if (appearanceModId) + { + itr = _itemDisplayIDs.find(itemId); + if (itr != _itemDisplayIDs.end()) + return itr->second; + } + + return 0; } MountEntry const* DB2Manager::GetMount(uint32 spellId) const diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index f43dd2098f2..70152d67299 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -22,36 +22,34 @@ #include "DB2Structure.h" #include "SharedDefines.h" -extern DB2Storage<BroadcastTextEntry> sBroadcastTextStore; -extern DB2Storage<HolidaysEntry> sHolidaysStore; -extern DB2Storage<ItemEntry> sItemStore; -extern DB2Storage<ItemCurrencyCostEntry> sItemCurrencyCostStore; -extern DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore; -extern DB2Storage<ItemEffectEntry> sItemEffectStore; -extern DB2Storage<ItemSparseEntry> sItemSparseStore; -extern DB2Storage<KeyChainEntry> sKeyChainStore; -extern DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore; -extern DB2Storage<PhaseGroupEntry> sPhaseGroupStore; -extern DB2Storage<SpellAuraRestrictionsEntry> sSpellAuraRestrictionsStore; +extern DB2Storage<BroadcastTextEntry> sBroadcastTextStore; +extern DB2Storage<HolidaysEntry> sHolidaysStore; +extern DB2Storage<ItemCurrencyCostEntry> sItemCurrencyCostStore; +extern DB2Storage<ItemEffectEntry> sItemEffectStore; +extern DB2Storage<ItemEntry> sItemStore; +extern DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore; +extern DB2Storage<ItemSparseEntry> sItemSparseStore; +extern DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore; +extern DB2Storage<PhaseGroupEntry> sPhaseGroupStore; +extern DB2Storage<SpellAuraRestrictionsEntry> sSpellAuraRestrictionsStore; extern DB2Storage<SpellCastingRequirementsEntry> sSpellCastingRequirementsStore; -extern DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore; -extern DB2Storage<SpellLearnSpellEntry> sSpellLearnSpellStore; -extern DB2Storage<SpellMiscEntry> sSpellMiscStore; -extern DB2Storage<SpellPowerEntry> sSpellPowerStore; -extern SpellPowerBySpellIDMap sSpellPowerBySpellIDStore; -extern DB2Storage<SpellReagentsEntry> sSpellReagentsStore; -extern DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore; -extern DB2Storage<SpellTotemsEntry> sSpellTotemsStore; -extern DB2Storage<TaxiNodesEntry> sTaxiNodesStore; -extern DB2Storage<TaxiPathEntry> sTaxiPathStore; -extern DB2Storage<TaxiPathNodeEntry> sTaxiPathNodeStore; -extern TaxiMask sTaxiNodesMask; -extern TaxiMask sOldContinentsNodesMask; -extern TaxiMask sHordeTaxiNodesMask; -extern TaxiMask sAllianceTaxiNodesMask; -extern TaxiMask sDeathKnightTaxiNodesMask; -extern TaxiPathSetBySource sTaxiPathSetBySource; -extern TaxiPathNodesByPath sTaxiPathNodesByPath; +extern DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore; +extern DB2Storage<SpellLearnSpellEntry> sSpellLearnSpellStore; +extern DB2Storage<SpellMiscEntry> sSpellMiscStore; +extern DB2Storage<SpellPowerEntry> sSpellPowerStore; +extern DB2Storage<SpellReagentsEntry> sSpellReagentsStore; +extern DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore; +extern DB2Storage<SpellTotemsEntry> sSpellTotemsStore; +extern DB2Storage<TaxiNodesEntry> sTaxiNodesStore; +extern DB2Storage<TaxiPathEntry> sTaxiPathStore; + +extern TaxiMask sTaxiNodesMask; +extern TaxiMask sOldContinentsNodesMask; +extern TaxiMask sHordeTaxiNodesMask; +extern TaxiMask sAllianceTaxiNodesMask; +extern TaxiMask sDeathKnightTaxiNodesMask; +extern TaxiPathSetBySource sTaxiPathSetBySource; +extern TaxiPathNodesByPath sTaxiPathNodesByPath; struct HotfixNotify { @@ -67,10 +65,10 @@ class DB2Manager public: typedef std::map<uint32 /*hash*/, DB2StorageBase*> StorageMap; typedef std::map<uint32 /*curveID*/, std::map<uint32/*index*/, CurvePointEntry const*, std::greater<uint32>>> HeirloomCurvesContainer; - typedef std::unordered_map<uint32 /*itemId | appearanceMod << 24*/, uint32> ItemDisplayIdContainer; typedef std::vector<ItemBonusEntry const*> ItemBonusList; typedef std::unordered_map<uint32 /*bonusListId*/, ItemBonusList> ItemBonusListContainer; typedef std::unordered_multimap<uint32 /*itemId*/, uint32 /*bonusTreeId*/> ItemToBonusTreeContainer; + typedef std::unordered_map<uint32 /*itemId | appearanceMod << 24*/, uint32> ItemDisplayIdContainer; typedef std::unordered_map<uint32, std::set<ItemBonusTreeNodeEntry const*>> ItemBonusTreeContainer; typedef std::unordered_map<uint32, MountEntry const*> MountContainer; typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer; @@ -90,9 +88,9 @@ public: static char const* GetBroadcastTextValue(BroadcastTextEntry const* broadcastText, LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false); uint32 GetHeirloomItemLevel(uint32 curveId, uint32 level) const; - uint32 GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const; - std::set<uint32> GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const; ItemBonusList GetItemBonusList(uint32 bonusListId) const; + std::set<uint32> GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const; + uint32 GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const; MountEntry const* GetMount(uint32 spellId) const; std::set<uint32> GetPhasesForGroup(uint32 group) const; @@ -101,10 +99,10 @@ private: HotfixData _hotfixData; HeirloomCurvesContainer _heirloomCurvePoints; - ItemDisplayIdContainer _itemDisplayIDs; ItemBonusListContainer _itemBonusLists; - ItemToBonusTreeContainer _itemToBonusTree; ItemBonusTreeContainer _itemBonusTrees; + ItemDisplayIdContainer _itemDisplayIDs; + ItemToBonusTreeContainer _itemToBonusTree; MountContainer _mountsBySpellId; PhaseGroupContainer _phasesByGroup; }; diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h index 30044aed5ce..4fcbf093f2d 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -62,25 +62,12 @@ struct HolidaysEntry uint32 Region; // 27 uint32 Looping; // 28 uint32 CalendarFlags[MAX_HOLIDAY_FLAGS]; // 29-38 - //uint32 HolidayNameID; // 39 HolidayNames.dbc - //uint32 HolidayDescriptionID; // 40 HolidayDescriptions.dbc + uint32 HolidayNameID; // 39 HolidayNames.dbc + uint32 HolidayDescriptionID; // 40 HolidayDescriptions.dbc LocalizedString* TextureFilename; // 41 uint32 Priority; // 42 uint32 CalendarFilterType; // 43 (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday) - //uint32 Flags; // 44 (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1) -}; - -struct ItemEntry -{ - uint32 ID; // 0 - uint32 Class; // 1 - uint32 SubClass; // 2 - int32 SoundOverrideSubclass; // 3 - int32 Material; // 4 - uint32 InventoryType; // 5 - uint32 Sheath; // 6 - uint32 FileDataID; // 7 - uint32 GroupSoundsID; // 8 + uint32 Flags; // 44 (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1) }; struct ItemAppearanceEntry @@ -110,7 +97,7 @@ struct ItemBonusTreeNodeEntry struct ItemCurrencyCostEntry { - //uint32 ID; // 0 + uint32 ID; // 0 uint32 ItemId; // 1 }; @@ -127,6 +114,19 @@ struct ItemEffectEntry int32 CategoryCooldown; // 8 }; +struct ItemEntry +{ + uint32 ID; // 0 + uint32 Class; // 1 + uint32 SubClass; // 2 + int32 SoundOverrideSubclass; // 3 + int32 Material; // 4 + uint32 InventoryType; // 5 + uint32 Sheath; // 6 + uint32 FileDataID; // 7 + uint32 GroupSoundsID; // 8 +}; + #define MAX_ITEM_EXT_COST_ITEMS 5 #define MAX_ITEM_EXT_COST_CURRENCIES 5 @@ -259,8 +259,8 @@ struct OverrideSpellDataEntry { uint32 ID; // 0 uint32 SpellID[MAX_OVERRIDE_SPELL]; // 1-10 - //uint32 Flags; // 11 - //char* PlayerActionbarFileDataID; // 12 + uint32 Flags; // 11 + uint32 PlayerActionbarFileDataID; // 12 }; struct PhaseGroupEntry @@ -272,7 +272,7 @@ struct PhaseGroupEntry struct SpellAuraRestrictionsEntry { - //uint32 ID; // 0 + uint32 ID; // 0 uint32 CasterAuraState; // 1 uint32 TargetAuraState; // 2 uint32 ExcludeCasterAuraState; // 3 @@ -285,12 +285,12 @@ struct SpellAuraRestrictionsEntry struct SpellCastingRequirementsEntry { - //uint32 ID; // 0 + uint32 ID; // 0 uint32 FacingCasterFlags; // 1 - //uint32 MinFactionID; // 1 - //uint32 MinReputation; // 3 + uint32 MinFactionID; // 1 + uint32 MinReputation; // 3 uint32 RequiredAreasID; // 4 - //uint32 RequiredAuraVision; // 5 + uint32 RequiredAuraVision; // 5 uint32 RequiresSpellFocus; // 6 }; @@ -335,7 +335,7 @@ struct SpellMiscEntry uint32 SpellIconID; // 21 uint32 ActiveIconID; // 22 uint32 SchoolMask; // 23 - //float Unk; // 24 + float MultistrikeSpeedMod; // 24 }; struct SpellPowerEntry @@ -347,13 +347,14 @@ struct SpellPowerEntry uint32 ManaCost; // 4 uint32 ManaCostPerLevel; // 5 uint32 ManaCostPerSecond; // 6 - //uint32 Unk4; // 7 (All 0 except one spell: 22570) - //uint32 Unk5; // 8 - //uint32 Unk6; // 9 + uint32 ManaCostAdditional; // 7 Spell uses [ManaCost, ManaCost+ManaCostAdditional] power - affects tooltip parsing as multiplier on SpellEffectEntry::EffectPointsPerResource + // only SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL, SPELL_EFFECT_WEAPON_PERCENT_DAMAGE, SPELL_EFFECT_WEAPON_DAMAGE, SPELL_EFFECT_NORMALIZED_WEAPON_DMG + uint32 PowerDisplayID; // 8 + uint32 UnitPowerBarID; // 9 float ManaCostPercentage; // 10 float ManaCostPercentagePerSecond; // 11 uint32 RequiredAura; // 12 - //uint32 Unk9; // 13 + float HealthCostPercentage; // 13 }; #define MAX_SPELL_REAGENTS 8 @@ -363,19 +364,18 @@ struct SpellReagentsEntry uint32 ID; // 0 int32 Reagent[MAX_SPELL_REAGENTS]; // 1-8 uint32 ReagentCount[MAX_SPELL_REAGENTS]; // 9-16 - //uint32 Unk1; // 17 - //uint32 Unk2; // 18 + uint32 CurrencyID; // 17 + uint32 CurrencyCount; // 18 }; struct SpellRuneCostEntry { uint32 ID; // 0 - uint32 RuneCost[3]; // 1-3 (0=blood, 1=frost, 2=unholy) - //uint32 Unk; // 4 (All 0 except for 2 ids: 2510, 2748) - uint32 RunePowerGain; // 5 + uint32 RuneCost[4]; // 1-4 (0=blood, 1=unholy, 2=frost, 3=death) + uint32 RunicPower; // 5 - bool NoRuneCost() const { return RuneCost[0] == 0 && RuneCost[1] == 0 && RuneCost[2] == 0; } - bool NoRunicPowerGain() const { return RunePowerGain == 0; } + bool NoRuneCost() const { return RuneCost[0] == 0 && RuneCost[1] == 0 && RuneCost[2] == 0 && RuneCost[3] == 0; } + bool NoRunicPowerGain() const { return RunicPower == 0; } }; #define MAX_SPELL_TOTEMS 2 @@ -383,7 +383,7 @@ struct SpellRuneCostEntry struct SpellTotemsEntry { uint32 ID; // 0 - uint32 TotemCategory[MAX_SPELL_TOTEMS]; // 1 + uint32 RequiredTotemCategoryID[MAX_SPELL_TOTEMS]; // 1 uint32 Totem[MAX_SPELL_TOTEMS]; // 2 }; @@ -396,7 +396,7 @@ struct TaxiNodesEntry uint32 MountCreatureID[2]; // 6-7 uint32 ConditionID; // 8 uint32 Flags; // 9 - float MapOffset[2]; // 10-11 + DBCPosition2D MapOffset; // 10-11 }; struct TaxiPathEntry diff --git a/src/server/game/DataStores/DB2fmt.h b/src/server/game/DataStores/DB2fmt.h index 84b69ef03b4..ba088b2cbb1 100644 --- a/src/server/game/DataStores/DB2fmt.h +++ b/src/server/game/DataStores/DB2fmt.h @@ -18,34 +18,34 @@ #ifndef TRINITY_DB2SFRM_H #define TRINITY_DB2SFRM_H -char const BroadcastTextEntryfmt[] = "nissiiiiiiiii"; -char const CurvePointEntryfmt[] = "niiff"; -char const HolidaysEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix"; -char const Itemfmt[] = "niiiiiiii"; -char const ItemAppearanceEntryfmt[] = "nii"; -char const ItemBonusEntryfmt[] = "niiiii"; -char const ItemBonusTreeNodeEntryfmt[] = "niiii"; -char const ItemCurrencyCostfmt[] = "xn"; -char const ItemExtendedCostEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -char const ItemEffectEntryfmt[] = "niiiiiiii"; -char const ItemModifiedAppearanceEntryfmt[] = "niiiii"; -char const ItemSparsefmt[] = "niiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffffffiiifisssssiiiiiiiiiiiiiiiiiiifiiifiii"; -char const ItemXBonusTreeEntryfmt[] = "nii"; -char const KeyChainfmt[] = "nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; -char const Mountfmt[] = "niiisssiii"; -char const OverrideSpellDataEntryfmt[] = "niiiiiiiiiixx"; -char const PhaseGroupEntryfmt[] = "nii"; -char const SpellAuraRestrictionsEntryfmt[] = "diiiiiiii"; -char const SpellCastingRequirementsEntryfmt[] = "dixxixi"; -char const SpellClassOptionsEntryfmt[] = "niiiiii"; -char const SpellLearnSpellEntryfmt[] = "niii"; -char const SpellMiscEntryfmt[] = "niiiiiiiiiiiiiiiiifiiiiix"; -char const SpellPowerEntryfmt[] = "niiiiiixxxffix"; -char const SpellReagentsEntryfmt[] = "niiiiiiiiiiiiiiiixx"; -char const SpellRuneCostEntryfmt[] = "niiixi"; -char const SpellTotemsEntryfmt[] = "niiii"; -char const TaxiNodesEntryfmt[] = "nifffsiiiiff"; -char const TaxiPathEntryfmt[] = "niii"; -char const TaxiPathNodeEntryfmt[] = "niiifffiiii"; +char const BroadcastTextFormat[] = "nissiiiiiiiii"; +char const CurvePointFormat[] = "niiff"; +char const HolidaysEntryFormat[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisiii"; +char const ItemFormat[] = "niiiiiiii"; +char const ItemAppearanceFormat[] = "nii"; +char const ItemBonusFormat[] = "niiiii"; +char const ItemBonusTreeNodeFormat[] = "niiii"; +char const ItemCurrencyCostFormat[] = "in"; +char const ItemExtendedCostFormat[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +char const ItemEffectFormat[] = "niiiiiiii"; +char const ItemModifiedAppearanceFormat[] = "niiiii"; +char const ItemSparseFormat[] = "niiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffffffiiifisssssiiiiiiiiiiiiiiiiiiifiiifiii"; +char const ItemXBonusTreeFormat[] = "nii"; +char const KeyChainFormat[] = "nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; +char const MountFormat[] = "niiisssiii"; +char const OverrideSpellDataFormat[] = "niiiiiiiiiiii"; +char const PhaseGroupFormat[] = "nii"; +char const SpellAuraRestrictionsFormat[] = "niiiiiiii"; +char const SpellCastingRequirementsFormat[] = "niiiiii"; +char const SpellClassOptionsFormat[] = "niiiiii"; +char const SpellLearnSpellFormat[] = "niii"; +char const SpellMiscFormat[] = "niiiiiiiiiiiiiiiiifiiiiif"; +char const SpellPowerFormat[] = "niiiiiiiiiffif"; +char const SpellReagentsFormat[] = "niiiiiiiiiiiiiiiiii"; +char const SpellRuneCostFormat[] = "niiiii"; +char const SpellTotemsFormat[] = "niiii"; +char const TaxiNodesFormat[] = "nifffsiiiiff"; +char const TaxiPathFormat[] = "niii"; +char const TaxiPathNodeFormat[] = "niiifffiiii"; #endif diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index f6612fca298..7832ace476d 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -154,7 +154,6 @@ char const SpellRadiusfmt[] = "nxfff"; char const SpellRangefmt[] = "nffffixx"; char const SpellScalingEntryfmt[] = "niiiifiii"; char const SpellTargetRestrictionsEntryfmt[] = "niiffiiii"; -char const SpellPowerEntryfmt[] = "diiiiixf"; char const SpellInterruptsEntryfmt[] = "diiiiiii"; char const SpellEquippedItemsEntryfmt[] = "diiiii"; char const SpellAuraOptionsEntryfmt[] = "niiiiiiii"; diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 6883ec13aac..2addf293986 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -410,9 +410,8 @@ void WorldSession::HandleDBQueryBulk(WorldPackets::Query::DBQueryBulk& packet) if (store->HasRecord(rec.RecordID)) { response.RecordID = rec.RecordID; - response.Locale = GetSessionDbcLocale(); response.Timestamp = sDB2Manager.GetHotfixDate(rec.RecordID, packet.TableHash); - response.Data = store; + store->WriteRecord(rec.RecordID, GetSessionDbcLocale(), response.Data); } else { diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h index bb8abc37eb3..844089cf393 100644 --- a/src/server/game/Movement/Waypoints/Path.h +++ b/src/server/game/Movement/Waypoints/Path.h @@ -28,8 +28,8 @@ struct PathNode PathNode(float _x, float _y, float _z): x(_x), y(_y), z(_z) { } float x, y, z; }; -template<typename PathElem, typename PathNode = PathElem> +template<typename PathElem, typename PathNode = PathElem> class Path { public: @@ -37,7 +37,7 @@ class Path bool empty() const { return i_nodes.empty(); } void resize(unsigned int sz) { i_nodes.resize(sz); } void clear() { i_nodes.clear(); } - void erase(uint32 idx) { i_nodes.erase(i_nodes.begin()+idx); } + void erase(uint32 idx) { i_nodes.erase(i_nodes.begin() + idx); } void crop(unsigned int start, unsigned int end) { while (start && !i_nodes.empty()) @@ -56,10 +56,10 @@ class Path float GetTotalLength(uint32 start, uint32 end) const { float len = 0.0f; - for (uint32 idx=start+1; idx < end; ++idx) + for (uint32 idx = start + 1; idx < end; ++idx) { PathNode const& node = i_nodes[idx]; - PathNode const& prev = i_nodes[idx-1]; + PathNode const& prev = i_nodes[idx - 1]; float xd = node.x - prev.x; float yd = node.y - prev.y; float zd = node.z - prev.z; @@ -76,7 +76,7 @@ class Path if (curnode > 0) { - PathNode const& node = i_nodes[curnode-1]; + PathNode const& node = i_nodes[curnode - 1]; float xd = x - node.x; float yd = y - node.y; float zd = z - node.z; @@ -95,6 +95,4 @@ class Path std::deque<PathElem> i_nodes; }; -typedef Path<PathNode> SimplePath; - #endif diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp index 83c91fc7d2a..b2c192ce1bb 100644 --- a/src/server/game/Server/Packets/QueryPackets.cpp +++ b/src/server/game/Server/Packets/QueryPackets.cpp @@ -267,14 +267,8 @@ WorldPacket const* WorldPackets::Query::DBReply::Write() _worldPacket << TableHash; _worldPacket << RecordID; _worldPacket << Timestamp; - - size_t sizePos = _worldPacket.wpos(); - _worldPacket << int32(0); // size of next block - - if (Data) - Data->WriteRecord(RecordID, Locale, _worldPacket); - - _worldPacket.put<int32>(sizePos, _worldPacket.wpos() - sizePos - sizeof(int32)); + _worldPacket << uint32(Data.size()); + _worldPacket.append(Data); return &_worldPacket; } diff --git a/src/server/game/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h index 97648385a50..56c8b6521bc 100644 --- a/src/server/game/Server/Packets/QueryPackets.h +++ b/src/server/game/Server/Packets/QueryPackets.h @@ -20,7 +20,6 @@ #include "Packet.h" #include "Creature.h" -#include "DB2Stores.h" #include "NPCHandler.h" #include "G3D/Vector3.h" @@ -200,10 +199,7 @@ namespace WorldPackets uint32 TableHash = 0; uint32 Timestamp = 0; int32 RecordID = 0; - - // These are not sent directly - uint32 Locale = 0; - DB2StorageBase const* Data = nullptr; + ByteBuffer Data; }; class HotfixNotifyBlob final : public ServerPacket diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ed7ba3b788c..44012185f11 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4525,14 +4525,14 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death - for (uint32 i = 0; i < RUNE_DEATH; ++i) + for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i) { runeCost[i] = src->RuneCost[i]; if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this); } - runeCost[RUNE_DEATH] = MAX_RUNES; // calculated later + runeCost[RUNE_DEATH] += MAX_RUNES; for (uint32 i = 0; i < MAX_RUNES; ++i) { @@ -4565,15 +4565,13 @@ void Spell::TakeRunePower(bool didHit) int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death - for (uint32 i = 0; i < RUNE_DEATH; ++i) + for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i) { runeCost[i] = runeCostData->RuneCost[i]; if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this); } - runeCost[RUNE_DEATH] = 0; // calculated later - for (uint32 i = 0; i < MAX_RUNES; ++i) { RuneType rune = player->GetCurrentRune(i); @@ -4585,7 +4583,7 @@ void Spell::TakeRunePower(bool didHit) } } - runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST]; + runeCost[RUNE_DEATH] += runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST]; if (runeCost[RUNE_DEATH] > 0) { @@ -4610,7 +4608,7 @@ void Spell::TakeRunePower(bool didHit) // you can gain some runic power when use runes if (didHit) - if (int32 rp = int32(runeCostData->RunePowerGain * sWorld->getRate(RATE_POWER_RUNICPOWER_INCOME))) + if (int32 rp = int32(runeCostData->RunicPower * sWorld->getRate(RATE_POWER_RUNICPOWER_INCOME))) player->ModifyPower(POWER_RUNIC_POWER, int32(rp)); } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 46b7c2f92e4..14fcef182a0 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1114,7 +1114,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntryMap const& ef // SpellTotemsEntry SpellTotemsEntry const* _totem = GetSpellTotems(); for (uint8 i = 0; i < 2; ++i) - TotemCategory[i] = _totem ? _totem->TotemCategory[i] : 0; + TotemCategory[i] = _totem ? _totem->RequiredTotemCategoryID[i] : 0; for (uint8 i = 0; i < 2; ++i) Totem[i] = _totem ? _totem->Totem[i] : 0; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 0e4f430b322..236bd4cc6db 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1456,6 +1456,12 @@ void World::SetInitialWorldSettings() LoadDBCStores(m_dataPath); sDB2Manager.LoadStores(m_dataPath); + TC_LOG_INFO("misc", "Loading hotfix info..."); + sDB2Manager.LoadHotfixData(); + + // Close hotfix database - it is only used during DB2 loading + HotfixDatabase.Close(); + sSpellMgr->LoadPetFamilySpellsStore(); TC_LOG_INFO("server.loading", "Loading SpellInfo store..."); @@ -1958,9 +1964,6 @@ void World::SetInitialWorldSettings() LoadCharacterInfoStore(); - TC_LOG_INFO("misc", "Loading hotfix info..."); - sDB2Manager.LoadHotfixData(); - TC_LOG_INFO("server.loading", "Loading race and class expansion requirements..."); sObjectMgr->LoadRaceAndClassExpansionRequirements(); |
