Core/DataStores: Port refactors from Update DBC field names to generated ones (#24999)

(cherry picked from commit c92950b3e1)
This commit is contained in:
Peter Keresztes Schmidt
2020-07-12 15:36:55 +02:00
committed by Shauren
parent b7353fb927
commit 1e1679a1f7
19 changed files with 53 additions and 59 deletions

View File

@@ -279,7 +279,7 @@ public:
if (titleInfo && target->HasTitle(titleInfo))
{
std::string name = (target->GetNativeGender() == GENDER_MALE ? titleInfo->Name : titleInfo->Name1)[handler->GetSessionDbcLocale()];
std::string name = target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[loc] : titleInfo->Name1[loc];
if (name.empty())
continue;

View File

@@ -1472,8 +1472,7 @@ public:
}
if (!mEntry->IsDungeon())
{
handler->PSendSysMessage("'%s' is not a dungeon map.",
mEntry->MapName[handler->GetSessionDbcLocale()]);
handler->PSendSysMessage("'%s' is not a dungeon map.", mEntry->MapName[handler->GetSessionDbcLocale()]);
return true;
}
int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1;
@@ -1484,34 +1483,29 @@ public:
}
if (difficulty >= 0 && !sDB2Manager.GetMapDifficultyData(mEntry->ID, Difficulty(difficulty)))
{
handler->PSendSysMessage("Difficulty %d is not valid for '%s'.",
difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]);
handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]);
return true;
}
if (difficulty == -1)
{
handler->PSendSysMessage("Resetting all difficulties for '%s'.",
mEntry->MapName[handler->GetSessionDbcLocale()]);
handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->MapName[handler->GetSessionDbcLocale()]);
for (DifficultyEntry const* diff : sDifficultyStore)
{
if (sDB2Manager.GetMapDifficultyData(map, Difficulty(diff->ID)))
{
handler->PSendSysMessage("Resetting difficulty %d for '%s'.",
diff->ID, mEntry->MapName[handler->GetSessionDbcLocale()]);
handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff->ID, mEntry->MapName[handler->GetSessionDbcLocale()]);
sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(diff->ID));
}
}
}
else if (mEntry->IsNonRaidDungeon() && difficulty == DIFFICULTY_NORMAL)
{
handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.",
mEntry->MapName[handler->GetSessionDbcLocale()], difficulty);
handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", mEntry->MapName[handler->GetSessionDbcLocale()], difficulty);
}
else
{
handler->PSendSysMessage("Resetting difficulty %d for '%s'.",
difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]);
handler->PSendSysMessage("Resetting difficulty %d for '%s'.", difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]);
sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(difficulty));
}
return true;

View File

@@ -419,6 +419,7 @@ public:
{
// ... than, it prints information like "is online", where he is, etc...
onlineState = "online";
LocaleConstant locale = handler->GetSessionDbcLocale();
phases = PhasingHandler::FormatPhases(p->GetPhaseShift());
AreaTableEntry const* area = sAreaTableStore.LookupEntry(p->GetAreaId());
@@ -426,7 +427,7 @@ public:
{
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
if (zone)
zoneName = zone->AreaName[handler->GetSessionDbcLocale()];
zoneName = zone->AreaName[locale];
}
}
else

View File

@@ -250,12 +250,12 @@ public:
if (!talentInfo)
continue;
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TabID);
if (!talentTabInfo)
continue;
// prevent learn talent for different family (cheating)
if (((1 << petFamily->PetTalentType) & talentTabInfo->petTalentMask) == 0)
if (((1 << petFamily->PetTalentType) & talentTabInfo->PetTalentMask) == 0)
continue;
// search highest talent rank
@@ -263,9 +263,9 @@ public:
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
if (talentInfo->RankID[rank] != 0)
if (talentInfo->SpellRank[rank] != 0)
{
spellId = talentInfo->RankID[rank];
spellId = talentInfo->SpellRank[rank];
break;
}
}

View File

@@ -1337,13 +1337,13 @@ public:
uint32 counter = 0;
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
LocaleConstant locale = handler->GetSessionDbcLocale();
// search in Map.dbc
for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
{
if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
{
LocaleConstant locale = handler->GetSessionDbcLocale();
std::string name = mapInfo->MapName[locale];
if (name.empty())
continue;

View File

@@ -1914,13 +1914,13 @@ public:
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
if (area)
{
zoneName = area->AreaName[handler->GetSessionDbcLocale()];
zoneName = area->AreaName[locale];
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
if (zone)
{
areaName = zoneName;
zoneName = zone->AreaName[handler->GetSessionDbcLocale()];
zoneName = zone->AreaName[locale];
}
}

View File

@@ -939,7 +939,7 @@ class at_bring_your_orphan_to : public AreaTriggerScript
public:
at_bring_your_orphan_to() : AreaTriggerScript("at_bring_your_orphan_to") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* areaTrigger) override
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override
{
if (player->isDead() || !player->HasAura(SPELL_ORPHAN_OUT))
return false;
@@ -947,7 +947,7 @@ class at_bring_your_orphan_to : public AreaTriggerScript
uint32 questId = 0;
uint32 orphanId = 0;
switch (areaTrigger->ID)
switch (trigger->ID)
{
case AT_DOWN_AT_THE_DOCKS:
questId = QUEST_DOWN_AT_THE_DOCKS;

View File

@@ -184,12 +184,12 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
public:
AreaTrigger_at_sholazar_waygate() : AreaTriggerScript("at_sholazar_waygate") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* areaTrigger) override
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override
{
if (!player->isDead() && (player->GetQuestStatus(QUEST_MEETING_A_GREAT_ONE) != QUEST_STATUS_NONE ||
(player->GetQuestStatus(QUEST_THE_MAKERS_OVERLOOK) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_THE_MAKERS_PERCH) == QUEST_STATUS_REWARDED)))
{
switch (areaTrigger->ID)
switch (trigger->ID)
{
case AT_SHOLAZAR:
player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, true);
@@ -266,9 +266,9 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
_triggerTimes[AT_BREWFEST_DUROTAR] = _triggerTimes[AT_BREWFEST_DUN_MOROGH] = 0;
}
bool OnTrigger(Player* player, AreaTriggerEntry const* areaTrigger) override
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override
{
uint32 triggerId = areaTrigger->ID;
uint32 triggerId = trigger->ID;
// Second trigger happened too early after first, skip for now
if (GameTime::GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
return false;
@@ -319,17 +319,18 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
_triggerTimes[AT_AREA_52_SOUTH] = _triggerTimes[AT_AREA_52_NORTH] = _triggerTimes[AT_AREA_52_WEST] = _triggerTimes[AT_AREA_52_EAST] = 0;
}
bool OnTrigger(Player* player, AreaTriggerEntry const* areaTrigger) override
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) override
{
float x = 0.0f, y = 0.0f, z = 0.0f;
if (!player->IsAlive())
return false;
if (GameTime::GetGameTime() - _triggerTimes[areaTrigger->ID] < SUMMON_COOLDOWN)
uint32 triggerId = trigger->ID;
if (GameTime::GetGameTime() - _triggerTimes[triggerId] < SUMMON_COOLDOWN)
return false;
switch (areaTrigger->ID)
switch (triggerId)
{
case AT_AREA_52_EAST:
x = 3044.176f;
@@ -355,7 +356,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
player->SummonCreature(NPC_SPOTLIGHT, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5000);
player->AddAura(SPELL_A52_NEURALYZER, player);
_triggerTimes[areaTrigger->ID] = GameTime::GetGameTime();
_triggerTimes[trigger->ID] = GameTime::GetGameTime();
return false;
}