feat(Core/DBLayer): replace char const* to std::string_view (#10211)

* feat(Core/DBLayer): replace `char const*` to `std::string_view`

* CString

* 1

* chore(Core/Misc): code cleanup

* cl

* db fix

* fmt style sql

* to fmt

* py

* del old

* 1

* 2

* 3

* 1

* 1
This commit is contained in:
Kargatum
2022-02-05 06:37:11 +07:00
committed by GitHub
parent d6ead1d1e0
commit de13bf426e
140 changed files with 5055 additions and 4882 deletions

View File

@@ -30,39 +30,39 @@ Quest::Quest(Field* questRecord)
_rewItemsCount = 0;
_rewChoiceItemsCount = 0;
Id = questRecord[0].GetUInt32();
Method = questRecord[1].GetUInt8();
Level = questRecord[2].GetInt16();
MinLevel = questRecord[3].GetUInt8();
ZoneOrSort = questRecord[4].GetInt16();
Type = questRecord[5].GetUInt16();
SuggestedPlayers = questRecord[6].GetUInt8();
TimeAllowed = questRecord[7].GetUInt32();
AllowableRaces = questRecord[8].GetUInt16();
RequiredFactionId1 = questRecord[9].GetUInt16();
RequiredFactionId2 = questRecord[10].GetUInt16();
RequiredFactionValue1 = questRecord[11].GetInt32();
RequiredFactionValue2 = questRecord[12].GetInt32();
RewardNextQuest = questRecord[13].GetUInt32();
RewardXPDifficulty = questRecord[14].GetUInt8();
RewardMoney = questRecord[15].GetInt32();
RewardMoneyDifficulty = questRecord[16].GetUInt32();
RewardBonusMoney = questRecord[17].GetUInt32();
RewardDisplaySpell = questRecord[18].GetUInt32();
RewardSpell = questRecord[19].GetInt32();
RewardHonor = questRecord[20].GetUInt32();
RewardKillHonor = questRecord[21].GetFloat();
StartItem = questRecord[22].GetUInt32();
Flags = questRecord[23].GetUInt32();
RewardTitleId = questRecord[24].GetUInt8();
RequiredPlayerKills = questRecord[25].GetUInt8();
RewardTalents = questRecord[26].GetUInt8();
RewardArenaPoints = questRecord[27].GetUInt16();
Id = questRecord[0].Get<uint32>();
Method = questRecord[1].Get<uint8>();
Level = questRecord[2].Get<int16>();
MinLevel = questRecord[3].Get<uint8>();
ZoneOrSort = questRecord[4].Get<int16>();
Type = questRecord[5].Get<uint16>();
SuggestedPlayers = questRecord[6].Get<uint8>();
TimeAllowed = questRecord[7].Get<uint32>();
AllowableRaces = questRecord[8].Get<uint16>();
RequiredFactionId1 = questRecord[9].Get<uint16>();
RequiredFactionId2 = questRecord[10].Get<uint16>();
RequiredFactionValue1 = questRecord[11].Get<int32>();
RequiredFactionValue2 = questRecord[12].Get<int32>();
RewardNextQuest = questRecord[13].Get<uint32>();
RewardXPDifficulty = questRecord[14].Get<uint8>();
RewardMoney = questRecord[15].Get<int32>();
RewardMoneyDifficulty = questRecord[16].Get<uint32>();
RewardBonusMoney = questRecord[17].Get<uint32>();
RewardDisplaySpell = questRecord[18].Get<uint32>();
RewardSpell = questRecord[19].Get<int32>();
RewardHonor = questRecord[20].Get<uint32>();
RewardKillHonor = questRecord[21].Get<float>();
StartItem = questRecord[22].Get<uint32>();
Flags = questRecord[23].Get<uint32>();
RewardTitleId = questRecord[24].Get<uint8>();
RequiredPlayerKills = questRecord[25].Get<uint8>();
RewardTalents = questRecord[26].Get<uint8>();
RewardArenaPoints = questRecord[27].Get<uint16>();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
RewardItemId[i] = questRecord[28 + i * 2].GetUInt32();
RewardItemIdCount[i] = questRecord[29 + i * 2].GetUInt16();
RewardItemId[i] = questRecord[28 + i * 2].Get<uint32>();
RewardItemIdCount[i] = questRecord[29 + i * 2].Get<uint16>();
if (RewardItemId[i])
++_rewItemsCount;
@@ -70,8 +70,8 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
RewardChoiceItemId[i] = questRecord[36 + i * 2].GetUInt32();
RewardChoiceItemCount[i] = questRecord[37 + i * 2].GetUInt16();
RewardChoiceItemId[i] = questRecord[36 + i * 2].Get<uint32>();
RewardChoiceItemCount[i] = questRecord[37 + i * 2].Get<uint16>();
if (RewardChoiceItemId[i])
++_rewChoiceItemsCount;
@@ -79,26 +79,26 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewardFactionId[i] = questRecord[48 + i * 3].GetUInt16();
RewardFactionValueId[i] = questRecord[49 + i * 3].GetInt32();
RewardFactionValueIdOverride[i] = questRecord[50 + i * 3].GetInt32();
RewardFactionId[i] = questRecord[48 + i * 3].Get<uint16>();
RewardFactionValueId[i] = questRecord[49 + i * 3].Get<int32>();
RewardFactionValueIdOverride[i] = questRecord[50 + i * 3].Get<int32>();
}
POIContinent = questRecord[63].GetUInt16();
POIx = questRecord[64].GetFloat();
POIy = questRecord[65].GetFloat();
POIPriority = questRecord[66].GetUInt32();
Title = questRecord[67].GetString();
Objectives = questRecord[68].GetString();
Details = questRecord[69].GetString();
AreaDescription = questRecord[70].GetString();
CompletedText = questRecord[71].GetString();
POIContinent = questRecord[63].Get<uint16>();
POIx = questRecord[64].Get<float>();
POIy = questRecord[65].Get<float>();
POIPriority = questRecord[66].Get<uint32>();
Title = questRecord[67].Get<std::string>();
Objectives = questRecord[68].Get<std::string>();
Details = questRecord[69].Get<std::string>();
AreaDescription = questRecord[70].Get<std::string>();
CompletedText = questRecord[71].Get<std::string>();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
RequiredNpcOrGo[i] = questRecord[72 + i].GetInt32();
RequiredNpcOrGoCount[i] = questRecord[76 + i].GetUInt16();
ObjectiveText[i] = questRecord[101 + i].GetString();
RequiredNpcOrGo[i] = questRecord[72 + i].Get<int32>();
RequiredNpcOrGoCount[i] = questRecord[76 + i].Get<uint16>();
ObjectiveText[i] = questRecord[101 + i].Get<std::string>();
if (RequiredNpcOrGo[i])
++_reqCreatureOrGOcount;
@@ -106,21 +106,21 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
ItemDrop[i] = questRecord[80 + i].GetUInt32();
ItemDropQuantity[i] = questRecord[84 + i].GetUInt16();
ItemDrop[i] = questRecord[80 + i].Get<uint32>();
ItemDropQuantity[i] = questRecord[84 + i].Get<uint16>();
}
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
RequiredItemId[i] = questRecord[88 + i].GetUInt32();
RequiredItemCount[i] = questRecord[94 + i].GetUInt16();
RequiredItemId[i] = questRecord[88 + i].Get<uint32>();
RequiredItemCount[i] = questRecord[94 + i].Get<uint16>();
if (RequiredItemId[i])
++_reqItemsCount;
}
// int8 Unknown0 = questRecord[100].GetUInt8();
// int32 VerifiedBuild = questRecord[105].GetInt32();
// int8 Unknown0 = questRecord[100].Get<uint8>();
// int32 VerifiedBuild = questRecord[105].Get<int32>();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
@@ -136,49 +136,49 @@ Quest::Quest(Field* questRecord)
void Quest::LoadQuestDetails(Field* fields)
{
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = fields[1 + i].GetUInt16();
DetailsEmote[i] = fields[1 + i].Get<uint16>();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = fields[5 + i].GetUInt32();
DetailsEmoteDelay[i] = fields[5 + i].Get<uint32>();
}
void Quest::LoadQuestRequestItems(Field* fields)
{
EmoteOnComplete = fields[1].GetUInt16();
EmoteOnIncomplete = fields[2].GetUInt16();
RequestItemsText = fields[3].GetString();
EmoteOnComplete = fields[1].Get<uint16>();
EmoteOnIncomplete = fields[2].Get<uint16>();
RequestItemsText = fields[3].Get<std::string>();
}
void Quest::LoadQuestOfferReward(Field* fields)
{
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = fields[1 + i].GetUInt16();
OfferRewardEmote[i] = fields[1 + i].Get<uint16>();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = fields[5 + i].GetUInt32();
OfferRewardEmoteDelay[i] = fields[5 + i].Get<uint32>();
OfferRewardText = fields[9].GetString();
OfferRewardText = fields[9].Get<std::string>();
}
void Quest::LoadQuestTemplateAddon(Field* fields)
{
MaxLevel = fields[1].GetUInt8();
RequiredClasses = fields[2].GetUInt32();
SourceSpellid = fields[3].GetUInt32();
PrevQuestId = fields[4].GetInt32();
NextQuestId = fields[5].GetUInt32();
ExclusiveGroup = fields[6].GetInt32();
RewardMailTemplateId = fields[7].GetUInt32();
RewardMailDelay = fields[8].GetUInt32();
RequiredSkillId = fields[9].GetUInt16();
RequiredSkillPoints = fields[10].GetUInt16();
RequiredMinRepFaction = fields[11].GetUInt16();
RequiredMaxRepFaction = fields[12].GetUInt16();
RequiredMinRepValue = fields[13].GetInt32();
RequiredMaxRepValue = fields[14].GetInt32();
StartItemCount = fields[15].GetUInt8();
RewardMailSenderEntry = fields[16].GetUInt32();
SpecialFlags = fields[17].GetUInt8();
MaxLevel = fields[1].Get<uint8>();
RequiredClasses = fields[2].Get<uint32>();
SourceSpellid = fields[3].Get<uint32>();
PrevQuestId = fields[4].Get<int32>();
NextQuestId = fields[5].Get<uint32>();
ExclusiveGroup = fields[6].Get<int32>();
RewardMailTemplateId = fields[7].Get<uint32>();
RewardMailDelay = fields[8].Get<uint32>();
RequiredSkillId = fields[9].Get<uint16>();
RequiredSkillPoints = fields[10].Get<uint16>();
RequiredMinRepFaction = fields[11].Get<uint16>();
RequiredMaxRepFaction = fields[12].Get<uint16>();
RequiredMinRepValue = fields[13].Get<int32>();
RequiredMaxRepValue = fields[14].Get<int32>();
StartItemCount = fields[15].Get<uint8>();
RewardMailSenderEntry = fields[16].Get<uint32>();
SpecialFlags = fields[17].Get<uint8>();
if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT)
Flags |= QUEST_FLAGS_AUTO_ACCEPT;