mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/AdventureJournal: Check if player can access adventure journal with ChrClassUIDisplay.db2
This commit is contained in:
15
sql/updates/hotfixes/master/2021_03_14_01_hotfixes.sql
Normal file
15
sql/updates/hotfixes/master/2021_03_14_01_hotfixes.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
--
|
||||
-- Table structure for table `chr_class_ui_display`
|
||||
--
|
||||
DROP TABLE IF EXISTS `chr_class_ui_display`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `chr_class_ui_display` (
|
||||
`ID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`ChrClassesID` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`AdvGuidePlayerConditionID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`SplashPlayerConditionID` 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 */;
|
||||
@@ -290,6 +290,11 @@ void HotfixDatabaseConnection::DoPrepareStatements()
|
||||
PREPARE_LOCALE_STMT(HOTFIX_SEL_CHAT_CHANNELS, "SELECT ID, Name_lang, Shortcut_lang FROM chat_channels_locale WHERE (`VerifiedBuild` > 0) = ?"
|
||||
" AND locale = ?", CONNECTION_SYNCH);
|
||||
|
||||
// ChrClassUiDisplay.db2
|
||||
PrepareStatement(HOTFIX_SEL_CHR_CLASS_UI_DISPLAY, "SELECT ID, ChrClassesID, AdvGuidePlayerConditionID, SplashPlayerConditionID"
|
||||
" FROM chr_class_ui_display WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
|
||||
PREPARE_MAX_ID_STMT(HOTFIX_SEL_CHR_CLASS_UI_DISPLAY, "SELECT MAX(ID) + 1 FROM chr_class_ui_display", CONNECTION_SYNCH);
|
||||
|
||||
// ChrClasses.db2
|
||||
PrepareStatement(HOTFIX_SEL_CHR_CLASSES, "SELECT Name, Filename, NameMale, NameFemale, PetNameToken, Description, RoleInfoString, DisabledString, "
|
||||
"HyphenatedNameMale, HyphenatedNameFemale, ID, CreateScreenFileDataID, SelectScreenFileDataID, IconFileDataID, LowResScreenFileDataID, Flags, "
|
||||
|
||||
@@ -184,6 +184,9 @@ enum HotfixDatabaseStatements : uint32
|
||||
HOTFIX_SEL_CHAT_CHANNELS_MAX_ID,
|
||||
HOTFIX_SEL_CHAT_CHANNELS_LOCALE,
|
||||
|
||||
HOTFIX_SEL_CHR_CLASS_UI_DISPLAY,
|
||||
HOTFIX_SEL_CHR_CLASS_UI_DISPLAY_MAX_ID,
|
||||
|
||||
HOTFIX_SEL_CHR_CLASSES,
|
||||
HOTFIX_SEL_CHR_CLASSES_MAX_ID,
|
||||
HOTFIX_SEL_CHR_CLASSES_LOCALE,
|
||||
|
||||
@@ -932,6 +932,22 @@ struct ChatChannelsLoadInfo
|
||||
}
|
||||
};
|
||||
|
||||
struct ChrClassUiDisplayLoadInfo
|
||||
{
|
||||
static DB2LoadInfo const* Instance()
|
||||
{
|
||||
static DB2FieldMeta const fields[] =
|
||||
{
|
||||
{ false, FT_INT, "ID" },
|
||||
{ false, FT_BYTE, "ChrClassesID" },
|
||||
{ false, FT_INT, "AdvGuidePlayerConditionID" },
|
||||
{ false, FT_INT, "SplashPlayerConditionID" },
|
||||
};
|
||||
static DB2LoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, ChrClassUIDisplayMeta::Instance(), HOTFIX_SEL_CHR_CLASS_UI_DISPLAY);
|
||||
return &loadInfo;
|
||||
}
|
||||
};
|
||||
|
||||
struct ChrClassesLoadInfo
|
||||
{
|
||||
static DB2LoadInfo const* Instance()
|
||||
|
||||
@@ -87,6 +87,7 @@ DB2Storage<CharTitlesEntry> sCharTitlesStore("CharTitles.db2
|
||||
DB2Storage<CharacterLoadoutEntry> sCharacterLoadoutStore("CharacterLoadout.db2", CharacterLoadoutLoadInfo::Instance());
|
||||
DB2Storage<CharacterLoadoutItemEntry> sCharacterLoadoutItemStore("CharacterLoadoutItem.db2", CharacterLoadoutItemLoadInfo::Instance());
|
||||
DB2Storage<ChatChannelsEntry> sChatChannelsStore("ChatChannels.db2", ChatChannelsLoadInfo::Instance());
|
||||
DB2Storage<ChrClassUIDisplayEntry> sChrClassUIDisplayStore("ChrClassUIDisplay.db2", ChrClassUiDisplayLoadInfo::Instance());
|
||||
DB2Storage<ChrClassesEntry> sChrClassesStore("ChrClasses.db2", ChrClassesLoadInfo::Instance());
|
||||
DB2Storage<ChrClassesXPowerTypesEntry> sChrClassesXPowerTypesStore("ChrClassesXPowerTypes.db2", ChrClassesXPowerTypesLoadInfo::Instance());
|
||||
DB2Storage<ChrCustomizationChoiceEntry> sChrCustomizationChoiceStore("ChrCustomizationChoice.db2", ChrCustomizationChoiceLoadInfo::Instance());
|
||||
@@ -393,6 +394,7 @@ namespace
|
||||
std::unordered_map<uint32 /*azeritePowerSetId*/, std::vector<AzeritePowerSetMemberEntry const*>> _azeritePowers;
|
||||
std::unordered_map<std::pair<uint32 /*azeriteUnlockSetId*/, ItemContext>, std::array<uint8, MAX_AZERITE_EMPOWERED_TIER>> _azeriteTierUnlockLevels;
|
||||
std::unordered_map<std::pair<uint32 /*itemId*/, ItemContext>, AzeriteUnlockMappingEntry const*> _azeriteUnlockMappings;
|
||||
std::array<ChrClassUIDisplayEntry const*, MAX_CLASSES> _uiDisplayByClass;
|
||||
std::array<std::array<uint32, MAX_POWERS>, MAX_CLASSES> _powersByClass;
|
||||
std::unordered_map<uint32 /*chrCustomizationOptionId*/, std::vector<ChrCustomizationChoiceEntry const*>> _chrCustomizationChoicesByOption;
|
||||
std::unordered_map<std::pair<uint8, uint8>, ChrModelEntry const*> _chrModelsByRaceAndGender;
|
||||
@@ -620,6 +622,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
|
||||
LOAD_DB2(sCharacterLoadoutStore);
|
||||
LOAD_DB2(sCharacterLoadoutItemStore);
|
||||
LOAD_DB2(sChatChannelsStore);
|
||||
LOAD_DB2(sChrClassUIDisplayStore);
|
||||
LOAD_DB2(sChrClassesStore);
|
||||
LOAD_DB2(sChrClassesXPowerTypesStore);
|
||||
LOAD_DB2(sChrCustomizationChoiceStore);
|
||||
@@ -935,6 +938,12 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
|
||||
ASSERT(BATTLE_PET_SPECIES_MAX_ID >= sBattlePetSpeciesStore.GetNumRows(),
|
||||
"BATTLE_PET_SPECIES_MAX_ID (%d) must be equal to or greater than %u", BATTLE_PET_SPECIES_MAX_ID, sBattlePetSpeciesStore.GetNumRows());
|
||||
|
||||
for (ChrClassUIDisplayEntry const* uiDisplay : sChrClassUIDisplayStore)
|
||||
{
|
||||
ASSERT(uiDisplay->ChrClassesID < MAX_CLASSES);
|
||||
_uiDisplayByClass[uiDisplay->ChrClassesID] = uiDisplay;
|
||||
}
|
||||
|
||||
{
|
||||
std::set<ChrClassesXPowerTypesEntry const*, ChrClassesXPowerTypesEntryComparator> powers;
|
||||
for (ChrClassesXPowerTypesEntry const* power : sChrClassesXPowerTypesStore)
|
||||
@@ -1793,6 +1802,12 @@ char const* DB2Manager::GetBroadcastTextValue(BroadcastTextEntry const* broadcas
|
||||
return broadcastText->Text[DEFAULT_LOCALE];
|
||||
}
|
||||
|
||||
ChrClassUIDisplayEntry const* DB2Manager::GetUiDisplayForClass(Classes unitClass) const
|
||||
{
|
||||
ASSERT(unitClass < MAX_CLASSES);
|
||||
return _uiDisplayByClass[unitClass];
|
||||
}
|
||||
|
||||
char const* DB2Manager::GetClassName(uint8 class_, LocaleConstant locale /*= DEFAULT_LOCALE*/)
|
||||
{
|
||||
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
|
||||
|
||||
@@ -337,6 +337,7 @@ public:
|
||||
std::vector<AzeritePowerSetMemberEntry const*> const* GetAzeritePowers(uint32 itemId) const;
|
||||
uint32 GetRequiredAzeriteLevelForAzeritePowerTier(uint32 azeriteUnlockSetId, ItemContext context, uint32 tier) const;
|
||||
static char const* GetBroadcastTextValue(BroadcastTextEntry const* broadcastText, LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false);
|
||||
ChrClassUIDisplayEntry const* GetUiDisplayForClass(Classes unitClass) const;
|
||||
static char const* GetClassName(uint8 class_, LocaleConstant locale = DEFAULT_LOCALE);
|
||||
uint32 GetPowerIndexByClass(Powers power, uint32 classId) const;
|
||||
std::vector<ChrCustomizationChoiceEntry const*> const* GetCustomiztionChoices(uint32 chrCustomizationOptionId) const;
|
||||
|
||||
@@ -549,6 +549,14 @@ struct ChatChannelsEntry
|
||||
int32 Ruleset;
|
||||
};
|
||||
|
||||
struct ChrClassUIDisplayEntry
|
||||
{
|
||||
uint32 ID;
|
||||
uint8 ChrClassesID;
|
||||
uint32 AdvGuidePlayerConditionID;
|
||||
uint32 SplashPlayerConditionID;
|
||||
};
|
||||
|
||||
struct ChrClassesEntry
|
||||
{
|
||||
LocalizedString Name;
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
void WorldSession::HandleAdventureJournalOpenQuest(WorldPackets::AdventureJournal::AdventureJournalOpenQuest& openQuest)
|
||||
{
|
||||
if (ChrClassUIDisplayEntry const* uiDisplay = sDB2Manager.GetUiDisplayForClass(Classes(_player->getClass())))
|
||||
if (!_player->MeetPlayerCondition(uiDisplay->AdvGuidePlayerConditionID))
|
||||
return;
|
||||
|
||||
AdventureJournalEntry const* adventureJournal = sAdventureJournalStore.LookupEntry(openQuest.AdventureJournalID);
|
||||
if (!adventureJournal)
|
||||
return;
|
||||
@@ -41,6 +45,10 @@ void WorldSession::HandleAdventureJournalOpenQuest(WorldPackets::AdventureJourna
|
||||
|
||||
void WorldSession::HandleAdventureJournalUpdateSuggestions(WorldPackets::AdventureJournal::AdventureJournalUpdateSuggestions& updateSuggestions)
|
||||
{
|
||||
if (ChrClassUIDisplayEntry const* uiDisplay = sDB2Manager.GetUiDisplayForClass(Classes(_player->getClass())))
|
||||
if (!_player->MeetPlayerCondition(uiDisplay->AdvGuidePlayerConditionID))
|
||||
return;
|
||||
|
||||
WorldPackets::AdventureJournal::AdventureJournalDataResponse response;
|
||||
response.OnLevelUp = updateSuggestions.OnLevelUp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user