Skip to content

Commit

Permalink
fix header
Browse files Browse the repository at this point in the history
  • Loading branch information
leelf00 committed Dec 1, 2024
1 parent 5ff8e90 commit b0f4aed
Show file tree
Hide file tree
Showing 56 changed files with 391 additions and 334 deletions.
45 changes: 45 additions & 0 deletions sql/updates/world/2024_12_01_00_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- new keychain table struct
DROP TABLE IF EXISTS `keychain`;
CREATE TABLE `keychain` (
`ID` int unsigned NOT NULL DEFAULT '0',
`Key1` tinyint unsigned NOT NULL DEFAULT '0',
`Key2` tinyint unsigned NOT NULL DEFAULT '0',
`Key3` tinyint unsigned NOT NULL DEFAULT '0',
`Key4` tinyint unsigned NOT NULL DEFAULT '0',
`Key5` tinyint unsigned NOT NULL DEFAULT '0',
`Key6` tinyint unsigned NOT NULL DEFAULT '0',
`Key7` tinyint unsigned NOT NULL DEFAULT '0',
`Key8` tinyint unsigned NOT NULL DEFAULT '0',
`Key9` tinyint unsigned NOT NULL DEFAULT '0',
`Key10` tinyint unsigned NOT NULL DEFAULT '0',
`Key11` tinyint unsigned NOT NULL DEFAULT '0',
`Key12` tinyint unsigned NOT NULL DEFAULT '0',
`Key13` tinyint unsigned NOT NULL DEFAULT '0',
`Key14` tinyint unsigned NOT NULL DEFAULT '0',
`Key15` tinyint unsigned NOT NULL DEFAULT '0',
`Key16` tinyint unsigned NOT NULL DEFAULT '0',
`Key17` tinyint unsigned NOT NULL DEFAULT '0',
`Key18` tinyint unsigned NOT NULL DEFAULT '0',
`Key19` tinyint unsigned NOT NULL DEFAULT '0',
`Key20` tinyint unsigned NOT NULL DEFAULT '0',
`Key21` tinyint unsigned NOT NULL DEFAULT '0',
`Key22` tinyint unsigned NOT NULL DEFAULT '0',
`Key23` tinyint unsigned NOT NULL DEFAULT '0',
`Key24` tinyint unsigned NOT NULL DEFAULT '0',
`Key25` tinyint unsigned NOT NULL DEFAULT '0',
`Key26` tinyint unsigned NOT NULL DEFAULT '0',
`Key27` tinyint unsigned NOT NULL DEFAULT '0',
`Key28` tinyint unsigned NOT NULL DEFAULT '0',
`Key29` tinyint unsigned NOT NULL DEFAULT '0',
`Key30` tinyint unsigned NOT NULL DEFAULT '0',
`Key31` tinyint unsigned NOT NULL DEFAULT '0',
`Key32` tinyint unsigned NOT NULL DEFAULT '0',
`VerifiedBuild` int NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`,`VerifiedBuild`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT IGNORE INTO `keychain`(`ID`, `Key1`, `Key2`, `Key3`, `Key4`, `Key5`, `Key6`, `Key7`, `Key8`, `Key9`, `Key10`, `Key11`, `Key12`, `Key13`, `Key14`, `Key15`, `Key16`, `Key17`, `Key18`, `Key19`, `Key20`, `Key21`, `Key22`, `Key23`, `Key24`, `Key25`, `Key26`, `Key27`, `Key28`, `Key29`, `Key30`, `Key31`, `Key32`,`VerifiedBuild`)
SELECT `keyId`, `k1`, `k2`, `k3`, `k4`, `k5`, `k6`, `k7`, `k8`, `k9`, `k10`, `k11`, `k12`, `k13`, `k14`, `k15`, `k16`, `k17`, `k18`, `k19`, `k20`, `k21`, `k22`, `k23`, `k24`, `k25`, `k26`, `k27`, `k28`, `k29`, `k30`, `k31`, `k32`, 0
FROM `keychain_db2`;

DROP TABLE IF EXISTS `keychain_db2`;
15 changes: 0 additions & 15 deletions src/common/DataStores/DBCFileLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@
#include "Errors.h"
#include "Utilities/ByteConverter.h"

// enum DbcFieldFormat
// {
// FT_NA='x', //not used or unknown, 4 byte size
// FT_NA_BYTE='X', //not used or unknown, byte
// FT_STRING='s', //char*
// FT_FLOAT='f', //float
// FT_INT='i', //uint32
// FT_BYTE='b', //uint8
// FT_SORT='d', //sorted by this field, field is not included
// FT_IND='n', //the same, but parsed to data
// FT_LOGIC='l', //Logical (boolean)
// FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
// FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
// };

class TC_COMMON_API DBCFileLoader
{
public:
Expand Down
2 changes: 1 addition & 1 deletion src/common/Utilities/Hash.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_UPD_GAMEOBJECT_ZONE_AREA_DATA, "UPDATE gameobject SET zoneId = ?, areaId = ? WHERE guid = ?", CONNECTION_ASYNC);
// KeyChain.db2
PrepareStatement(WORLD_SEL_KEY_CHAIN, "SELECT ID, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key10, Key11, Key12, Key13, Key14, Key15, Key16, "
"Key17, Key18, Key19, Key20, Key21, Key22, Key23, Key24, Key25, Key26, Key27, Key28, Key29, Key30, Key31, Key32 FROM key_chain ORDER BY ID DESC", CONNECTION_SYNCH);
"Key17, Key18, Key19, Key20, Key21, Key22, Key23, Key24, Key25, Key26, Key27, Key28, Key29, Key30, Key31, Key32 FROM keychain ORDER BY ID DESC", CONNECTION_SYNCH);


}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Battlegrounds/BattlegroundMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
if (it == bgDataStore.end())
return;

PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->GetLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->GetLevel());
if (!bracketEntry)
return;

Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Battlegrounds/BattlegroundQueue.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -918,7 +918,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
return;
}

PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bgTemplate->GetMapId(), bracket_id);
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketById(bgTemplate->GetMapId(), bracket_id);
if (!bracketEntry)
{
TC_LOG_ERROR("bg.battleground", "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bgTemplate->GetMapId(), bracket_id);
Expand Down Expand Up @@ -1443,7 +1443,7 @@ void SoloQueue::DoMatchmaking(GroupQueueInfo* ginfo, uint32 extraDiff, bool stro
return;

Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg->GetMapId(), bracketId);
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketById(bg->GetMapId(), bracketId);
if (!bracketEntry)
{
TC_LOG_ERROR("server", "SoloQueue::DoMatchmaking: bg bracket entry not found for map %u bracket id %u", bg->GetMapId(), bracketId);
Expand Down Expand Up @@ -1818,7 +1818,7 @@ BattlegroundBracketId SoloQueue::GetSoloQueueBracketId()
if (!bg)
return BG_BRACKET_ID_FIRST;

PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), DEFAULT_MAX_LEVEL);
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), DEFAULT_MAX_LEVEL);
if (!bracketEntry)
return BG_BRACKET_ID_FIRST;

Expand Down
79 changes: 49 additions & 30 deletions src/server/game/DataStores/DB2Stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include "DB2fmt.h"
#include "DB2Utility.h"
#include "Common.h"
#include "Hash.h"
#include "Log.h"
#include "World.h"
#include "DBCStores.h"
#include "ObjectMgr.h"

DB2Storage<BattlePetAbilityEntry> sBattlePetAbilityStore("BattlePetAbility.db2", BattlePetAbilityfmt);
Expand Down Expand Up @@ -80,12 +80,18 @@ struct QuestPackageItem
static std::multimap<uint32, QuestPackageItem> sQuestPackageItemMap;
static std::map<uint32, uint32> sItemUpgradeIdMap;
static std::multimap<uint32, uint32> sMountSpellToItemMap;
QuestPackageItemContainer _questPackages;


std::map<uint32, uint32> sBattlePetSpellXSpeciesStore;

static std::map<uint32, BattlePetAbilities> sBattlePetSpeciesXAbilityMap;

namespace
{
QuestPackageItemContainer _questPackages;
}


template<class T>
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Manager::StorageMap& stores, DB2Storage<T>* storage, std::string const& db2Path, uint32 defaultLocale)
{
Expand Down Expand Up @@ -137,6 +143,8 @@ inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, D

uint32 DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
{
uint32 oldMSTime = getMSTime();

std::string db2Path = dataPath + "dbc/";

DB2StoreProblemList bad_db2_files;
Expand Down Expand Up @@ -201,36 +209,47 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSceneScriptPackageStore, db2Path, defaultLocale);
LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sSpellReagentsStore, db2Path, defaultLocale);
LoadDB2(availableDb2Locales, bad_db2_files, _stores, &sVignetteStore, db2Path, defaultLocale);

for (uint32 i = 0; i < sRulesetItemUpgradeStore.GetNumRows(); ++i)
TC_LOG_INFO("server.loading", "06");
// for (uint32 i = 0; i < sRulesetItemUpgradeStore.GetNumRows(); ++i)
// {
// if (auto entry = sRulesetItemUpgradeStore.LookupEntry(i))
// {
// if (entry->RulesetID != 1)
// continue;

// uint32 upgradeId = entry->ItemUpgradeID;
// ItemUpgradeEntry const* upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
// while (upgrade && upgrade->PrevItemUpgradeID)
// {
// upgradeId = upgrade->PrevItemUpgradeID;
// upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
// }
// sItemUpgradeIdMap[entry->ItemID] = upgradeId;
// }
// }
for (RulesetItemUpgradeEntry const* entry : sRulesetItemUpgradeStore)
{
if (auto entry = sRulesetItemUpgradeStore.LookupEntry(i))
if (entry->RulesetID != 1)
continue;

uint32 upgradeId = entry->ItemUpgradeID;
ItemUpgradeEntry const* upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
while (upgrade && upgrade->PrevItemUpgradeID)
{
if (entry->RulesetID != 1)
continue;

uint32 upgradeId = entry->ItemUpgradeID;
ItemUpgradeEntry const* upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
while (upgrade && upgrade->PrevItemUpgradeID)
{
upgradeId = upgrade->PrevItemUpgradeID;
upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
}
sItemUpgradeIdMap[entry->ItemID] = upgradeId;
upgradeId = upgrade->PrevItemUpgradeID;
upgrade = sItemUpgradeStore.LookupEntry(upgradeId);
}
sItemUpgradeIdMap[entry->ItemID] = upgradeId;
}
TC_LOG_INFO("server.loading", "07 size %d crash below", sQuestPackageItemStore.GetNumRows());

for (size_t i = 0; i < sQuestPackageItemStore.GetNumRows(); ++i)
for (QuestPackageItemEntry const* questPackageItem : sQuestPackageItemStore)
{
if (auto entry = sQuestPackageItemStore.LookupEntry(i))
{
sQuestPackageItemMap.insert({ entry->PackageID, { entry->ItemID, entry->ItemQuantity} });

if (entry->DisplayType != QUEST_PACKAGE_FILTER_UNMATCHED)
_questPackages[entry->PackageID].first.push_back(entry);
else
_questPackages[entry->PackageID].second.push_back(entry);
}
sQuestPackageItemMap.insert({ questPackageItem->PackageID, { questPackageItem->ItemID, questPackageItem->ItemQuantity} });
if (questPackageItem->DisplayType != QUEST_PACKAGE_FILTER_UNMATCHED)
_questPackages[questPackageItem->PackageID].first.push_back(questPackageItem);
else
_questPackages[questPackageItem->PackageID].second.push_back(questPackageItem);
}

// error checks
Expand Down Expand Up @@ -264,7 +283,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
exit(1);
}

TC_LOG_INFO("server.loading", ">> 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
Expand Down Expand Up @@ -449,7 +468,7 @@ bool IsMountCanBeAllowedForPlayer(uint32 spellId, uint32 raceMask)
return false;
}

std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 questPackageID)
std::vector<QuestPackageItemEntry const*> const* DB2Manager::GetQuestPackageItems(uint32 questPackageID) const
{
auto itr = _questPackages.find(questPackageID);
if (itr != _questPackages.end())
Expand All @@ -458,11 +477,11 @@ std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 que
return nullptr;
}

std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItemsFallback(uint32 questPackageID)
std::vector<QuestPackageItemEntry const*> const* DB2Manager::GetQuestPackageItemsFallback(uint32 questPackageID) const
{
auto itr = _questPackages.find(questPackageID);
if (itr != _questPackages.end())
return &itr->second.second;

return nullptr;
}
}
8 changes: 4 additions & 4 deletions src/server/game/DataStores/DB2Stores.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "DB2Store.h"
#include "DB2Structure.h"
#include <map>
#include <string>

TC_GAME_API extern DB2Storage<BattlePetAbilityEntry> sBattlePetAbilityStore;
Expand Down Expand Up @@ -74,13 +75,9 @@ namespace db2
BattlePetAbilities const* GetAbilitiesForPetSpecies(uint32 speciesId);
}

DB2StorageBase const* GetDB2Storage(uint32 type);

bool GetQuestRewardItemCountFromPackage(uint32 itemid, uint32 package, uint32& count);
uint32 GetUpgradeId(uint32 itemId);
bool IsMountCanBeAllowedForPlayer(uint32 spellId, uint32 raceMask);
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 questPackageID);
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItemsFallback(uint32 questPackageID);

struct HotfixNotify
{
Expand All @@ -104,6 +101,9 @@ class TC_GAME_API DB2Manager
void LoadHotfixData();
HotfixData const* GetHotfixData() const { return &_hotfixData; }

std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 questPackageID) const;
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItemsFallback(uint32 questPackageID) const;

private:
StorageMap _stores;
HotfixData _hotfixData;
Expand Down
20 changes: 10 additions & 10 deletions src/server/game/DataStores/DB2Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ struct ItemEntry

struct ItemCurrencyCostEntry
{
//uint32 Id;
uint32 ID;
uint32 ItemId;
};

Expand Down Expand Up @@ -254,15 +254,15 @@ struct ItemSparseEntry

struct ItemExtendedCostEntry
{
uint32 ID; // 0 extended-cost entry id
//uint32 reqhonorpoints; // 1 required honor points
//uint32 reqarenapoints; // 2 required arena points
uint32 RequiredArenaSlot; // 3 arena slot restrictions (min slot value)
uint32 RequiredItem[MAX_ITEM_EXT_COST_ITEMS]; // 4-8 required item id
uint32 RequiredItemCount[MAX_ITEM_EXT_COST_ITEMS]; // 9-13 required count of 1st item
uint32 RequiredPersonalArenaRating; // 14 required personal arena rating
//uint32 ItemPurchaseGroup; // 15
uint32 RequiredCurrency[MAX_ITEM_EXT_COST_CURRENCIES];// 16-20 required curency id
uint32 ID; // 0 extended-cost entry id
uint32 RequiredHonorPoints; // 1 required honor points
uint32 RequiredArenaPoints; // 2 required arena points
uint32 RequiredArenaSlot; // 3 arena slot restrictions (min slot value)
uint32 RequiredItem[MAX_ITEM_EXT_COST_ITEMS]; // 4-8 required item id
uint32 RequiredItemCount[MAX_ITEM_EXT_COST_ITEMS]; // 9-13 required count of 1st item
uint32 RequiredPersonalArenaRating; // 14 required personal arena rating
uint32 ItemPurchaseGroup; // 15
uint32 RequiredCurrency[MAX_ITEM_EXT_COST_CURRENCIES]; // 16-20 required curency id
uint32 RequiredCurrencyCount[MAX_ITEM_EXT_COST_CURRENCIES];// 21-25 required curency count
uint32 RequiredFactionId;
uint32 RequiredFactionStanding;
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/DataStores/DB2fmt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -32,9 +32,9 @@ char const ItemToBattlePetfmt[] = "ii";

char const BroadcastTextfmt[] ="nxssxxxxxxixx";
char const Itemfmt[] ="niiiiiii";
char const ItemCurrencyCostfmt[]="xn";
char const ItemCurrencyCostfmt[]="in";
char const ItemSparsefmt[]="niiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisssssiiiiiiiiiiiiiiiiiiiiiifiiifii";
char const ItemExtendedCostEntryfmt[]="nxxiiiiiiiiiiiixiiiiiiiiiiiiiii";
char const ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char const ItemUpgradeEntryfmt[] = "niiiii";
char const ItemItemToMountSpellEntryfmt[] = "ni";
char const KeyChainfmt[] = "nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
Expand Down
Loading

0 comments on commit b0f4aed

Please sign in to comment.