Core/DataStores: Load QuestLineXQuest.db2

This commit is contained in:
Shauren
2021-06-06 20:57:09 +02:00
parent 2f8e411ac7
commit 5134622a75
7 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
--
-- Table structure for table `quest_line_x_quest`
--
DROP TABLE IF EXISTS `quest_line_x_quest`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `quest_line_x_quest` (
`ID` int(10) unsigned NOT NULL DEFAULT '0',
`QuestLineID` int(10) unsigned NOT NULL DEFAULT '0',
`QuestID` int(10) unsigned NOT NULL DEFAULT '0',
`OrderIndex` int(10) unsigned NOT NULL DEFAULT '0',
`VerifiedBuild` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`,`VerifiedBuild`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@@ -1150,6 +1150,11 @@ void HotfixDatabaseConnection::DoPrepareStatements()
PREPARE_MAX_ID_STMT(HOTFIX_SEL_QUEST_INFO, "SELECT MAX(ID) + 1 FROM quest_info", CONNECTION_SYNCH);
PREPARE_LOCALE_STMT(HOTFIX_SEL_QUEST_INFO, "SELECT ID, InfoName_lang FROM quest_info_locale WHERE (`VerifiedBuild` > 0) = ? AND locale = ?", CONNECTION_SYNCH);
// QuestLineXQuest.db2
PrepareStatement(HOTFIX_SEL_QUEST_LINE_X_QUEST, "SELECT ID, QuestLineID, QuestID, OrderIndex FROM quest_line_x_quest"
" WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
PREPARE_MAX_ID_STMT(HOTFIX_SEL_QUEST_LINE_X_QUEST, "SELECT MAX(ID) + 1 FROM quest_line_x_quest", CONNECTION_SYNCH);
// QuestMoneyReward.db2
PrepareStatement(HOTFIX_SEL_QUEST_MONEY_REWARD, "SELECT ID, Difficulty1, Difficulty2, Difficulty3, Difficulty4, Difficulty5, Difficulty6, "
"Difficulty7, Difficulty8, Difficulty9, Difficulty10 FROM quest_money_reward WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);

View File

@@ -666,6 +666,9 @@ enum HotfixDatabaseStatements : uint32
HOTFIX_SEL_QUEST_INFO_MAX_ID,
HOTFIX_SEL_QUEST_INFO_LOCALE,
HOTFIX_SEL_QUEST_LINE_X_QUEST,
HOTFIX_SEL_QUEST_LINE_X_QUEST_MAX_ID,
HOTFIX_SEL_QUEST_MONEY_REWARD,
HOTFIX_SEL_QUEST_MONEY_REWARD_MAX_ID,

View File

@@ -4399,6 +4399,22 @@ struct QuestInfoLoadInfo
}
};
struct QuestLineXQuestLoadInfo
{
static DB2LoadInfo const* Instance()
{
static DB2FieldMeta const fields[] =
{
{ false, FT_INT, "ID" },
{ false, FT_INT, "QuestLineID" },
{ false, FT_INT, "QuestID" },
{ false, FT_INT, "OrderIndex" },
};
static DB2LoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, QuestLineXQuestMeta::Instance(), HOTFIX_SEL_QUEST_LINE_X_QUEST);
return &loadInfo;
}
};
struct QuestMoneyRewardLoadInfo
{
static DB2LoadInfo const* Instance()

View File

@@ -234,6 +234,7 @@ DB2Storage<PvpTalentSlotUnlockEntry> sPvpTalentSlotUnlockStore("PvpTa
DB2Storage<PvpTierEntry> sPvpTierStore("PvpTier.db2", PvpTierLoadInfo::Instance());
DB2Storage<QuestFactionRewardEntry> sQuestFactionRewardStore("QuestFactionReward.db2", QuestFactionRewardLoadInfo::Instance());
DB2Storage<QuestInfoEntry> sQuestInfoStore("QuestInfo.db2", QuestInfoLoadInfo::Instance());
DB2Storage<QuestLineXQuestEntry> sQuestLineXQuestStore("QuestLineXQuest.db2", QuestLineXQuestLoadInfo::Instance());
DB2Storage<QuestMoneyRewardEntry> sQuestMoneyRewardStore("QuestMoneyReward.db2", QuestMoneyRewardLoadInfo::Instance());
DB2Storage<QuestPackageItemEntry> sQuestPackageItemStore("QuestPackageItem.db2", QuestPackageItemLoadInfo::Instance());
DB2Storage<QuestSortEntry> sQuestSortStore("QuestSort.db2", QuestSortLoadInfo::Instance());
@@ -445,6 +446,7 @@ namespace
PowerTypesContainer _powerTypes;
std::unordered_map<uint32, uint8> _pvpItemBonus;
PvpTalentSlotUnlockEntry const* _pvpTalentSlotUnlock[MAX_PVP_TALENT_SLOTS];
std::unordered_map<uint32, std::unordered_set<QuestLineXQuestEntry const*>> _questsByQuestLine;
QuestPackageItemContainer _questPackages;
std::unordered_map<uint32, std::vector<RewardPackXCurrencyTypeEntry const*>> _rewardPackCurrencyTypes;
std::unordered_map<uint32, std::vector<RewardPackXItemEntry const*>> _rewardPackItems;
@@ -781,6 +783,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
LOAD_DB2(sPvpTierStore);
LOAD_DB2(sQuestFactionRewardStore);
LOAD_DB2(sQuestInfoStore);
LOAD_DB2(sQuestLineXQuestStore);
LOAD_DB2(sQuestMoneyRewardStore);
LOAD_DB2(sQuestPackageItemStore);
LOAD_DB2(sQuestSortStore);
@@ -1270,6 +1273,9 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
}
}
for (QuestLineXQuestEntry const* questLineQuest : sQuestLineXQuestStore)
_questsByQuestLine[questLineQuest->QuestLineID].insert(questLineQuest);
for (QuestPackageItemEntry const* questPackageItem : sQuestPackageItemStore)
{
if (questPackageItem->DisplayType != QUEST_PACKAGE_FILTER_UNMATCHED)
@@ -2726,6 +2732,11 @@ int32 DB2Manager::GetPvpTalentNumSlotsAtLevel(uint32 level, Classes class_) cons
return slots;
}
std::unordered_set<QuestLineXQuestEntry const*> const* DB2Manager::GetQuestsForQuestLine(uint32 questLineId) const
{
return Trinity::Containers::MapGetValuePtr(_questsByQuestLine, questLineId);
}
std::vector<QuestPackageItemEntry const*> const* DB2Manager::GetQuestPackageItems(uint32 questPackageID) const
{
auto itr = _questPackages.find(questPackageID);

View File

@@ -406,6 +406,7 @@ public:
static PVPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id);
uint32 GetRequiredLevelForPvpTalentSlot(uint8 slot, Classes class_) const;
int32 GetPvpTalentNumSlotsAtLevel(uint32 level, Classes class_) const;
std::unordered_set<QuestLineXQuestEntry const*> const* GetQuestsForQuestLine(uint32 questLineId) const;
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 questPackageID) const;
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItemsFallback(uint32 questPackageID) const;
uint32 GetQuestUniqueBitFlag(uint32 questId);

View File

@@ -2683,6 +2683,14 @@ struct QuestInfoEntry
uint16 Profession;
};
struct QuestLineXQuestEntry
{
uint32 ID;
uint32 QuestLineID;
uint32 QuestID;
uint32 OrderIndex;
};
struct QuestMoneyRewardEntry
{
uint32 ID;