Merge pull request #15356 from ShinDarth/quest_backports
DB/World schema backport: quest_details, _request_items and _offer_reward
This commit is contained in:
commit
e28ee38664
4 files changed
+196
-36
No files matched your search
@@ -0,0 +1,80 @@
|
||||
-- quest_details
|
||||
DROP TABLE IF EXISTS `quest_details`;
|
||||
CREATE TABLE `quest_details` (
|
||||
`ID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay1` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay2` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay3` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay4` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`VerifiedBuild` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `quest_details` (`ID`, `Emote1`, `Emote2`, `Emote3`, `Emote4`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `EmoteDelay4`, `VerifiedBuild`)
|
||||
SELECT `ID`, `DetailsEmote1`, `DetailsEmote2`, `DetailsEmote3`, `DetailsEmote4`, `DetailsEmoteDelay1`, `DetailsEmoteDelay2`, `DetailsEmoteDelay3`, `DetailsEmoteDelay4`, `VerifiedBuild` FROM `quest_template`
|
||||
WHERE `DetailsEmote1`!=0 OR `DetailsEmote2`!=0 OR `DetailsEmote3`!=0 OR `DetailsEmote4`!=0 OR `DetailsEmoteDelay1`!=0 OR `DetailsEmoteDelay2`!=0 OR `DetailsEmoteDelay3`!=0 OR `DetailsEmoteDelay4`!=0;
|
||||
|
||||
|
||||
-- quest_request_items
|
||||
DROP TABLE IF EXISTS `quest_request_items`;
|
||||
CREATE TABLE `quest_request_items` (
|
||||
`ID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteOnComplete` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteOnIncomplete` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`CompletionText` TEXT,
|
||||
`VerifiedBuild` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `quest_request_items` (`ID`, `EmoteOnComplete`, `EmoteOnIncomplete`, `CompletionText`, `VerifiedBuild`)
|
||||
SELECT `ID`, `EmoteOnComplete`, `EmoteOnIncomplete`, `RequestItemsText`, `VerifiedBuild` FROM `quest_template`
|
||||
WHERE `EmoteOnComplete`!=0 OR `EmoteOnIncomplete`!=0 OR `RequestItemsText`!='';
|
||||
|
||||
|
||||
-- quest_offer_reward
|
||||
DROP TABLE IF EXISTS `quest_offer_reward`;
|
||||
CREATE TABLE `quest_offer_reward` (
|
||||
`ID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Emote4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay1` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay2` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay3` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`EmoteDelay4` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`RewardText` TEXT,
|
||||
`VerifiedBuild` SMALLINT(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `quest_offer_reward` (`ID`, `Emote1`, `Emote2`, `Emote3`, `Emote4`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `EmoteDelay4`, `RewardText`, `VerifiedBuild`)
|
||||
SELECT `ID`, `OfferRewardEmote1`, `OfferRewardEmote2`, `OfferRewardEmote3`, `OfferRewardEmote4`, `OfferRewardEmoteDelay1`, `OfferRewardEmoteDelay2`, `OfferRewardEmoteDelay3`, `OfferRewardEmoteDelay4`, `OfferRewardText`, `VerifiedBuild` FROM `quest_template`
|
||||
WHERE `OfferRewardEmote1`!=0 OR `OfferRewardEmote2`!=0 OR `OfferRewardEmote3`!=0 OR `OfferRewardEmote4`!=0 OR `OfferRewardEmoteDelay1`!=0 OR `OfferRewardEmoteDelay2`!=0 OR `OfferRewardEmoteDelay3`!=0 OR `OfferRewardEmoteDelay4`!=0 OR `OfferRewardText`!='';
|
||||
|
||||
-- delete old fields
|
||||
ALTER TABLE `quest_template`
|
||||
DROP `DetailsEmote1`,
|
||||
DROP `DetailsEmote2`,
|
||||
DROP `DetailsEmote3`,
|
||||
DROP `DetailsEmote4`,
|
||||
DROP `DetailsEmoteDelay1`,
|
||||
DROP `DetailsEmoteDelay2`,
|
||||
DROP `DetailsEmoteDelay3`,
|
||||
DROP `DetailsEmoteDelay4`,
|
||||
DROP `EmoteOnIncomplete`,
|
||||
DROP `EmoteOnComplete`,
|
||||
DROP `RequestItemsText`,
|
||||
DROP `OfferRewardEmote1`,
|
||||
DROP `OfferRewardEmote2`,
|
||||
DROP `OfferRewardEmote3`,
|
||||
DROP `OfferRewardEmote4`,
|
||||
DROP `OfferRewardEmoteDelay1`,
|
||||
DROP `OfferRewardEmoteDelay2`,
|
||||
DROP `OfferRewardEmoteDelay3`,
|
||||
DROP `OfferRewardEmoteDelay4`,
|
||||
DROP `OfferRewardText`;
|
||||
@@ -3984,18 +3984,16 @@ void ObjectMgr::LoadQuests()
|
||||
"RewardFactionOverride1, RewardFactionOverride2, RewardFactionOverride3, RewardFactionOverride4, RewardFactionOverride5, "
|
||||
// 62 63 64 65
|
||||
"PointMapId, PointX, PointY, PointOption, "
|
||||
// 66 67 68 69 70 71 72
|
||||
"LogTitle, LogDescription, QuestDescription, EndText, OfferRewardText, RequestItemsText, QuestCompletionLog, "
|
||||
// 73 74 75 76 77 78 79 80
|
||||
// 66 67 68 69 70
|
||||
"LogTitle, LogDescription, QuestDescription, EndText, QuestCompletionLog, "
|
||||
// 71 72 73 74 75 76 77 78
|
||||
"RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, "
|
||||
// 81 82 83 84 85 86 87 88
|
||||
// 79 80 81 82 83 84 85 86
|
||||
"RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4, RequiredSourceItemCount1, RequiredSourceItemCount2, RequiredSourceItemCount3, RequiredSourceItemCount4, "
|
||||
// 89 90 91 92 93 94 95 96 97 98 99 100
|
||||
// 87 88 89 90 91 92 93 94 95 96 97 98
|
||||
"RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, "
|
||||
// 101 102 103 104 105 106 107 108 109 110 111 112 113
|
||||
"Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, "
|
||||
// 114 115 116 117 118 119 120 121 122 123
|
||||
"EmoteOnIncomplete, EmoteOnComplete, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4"
|
||||
// 99 100 101 102 103
|
||||
"Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4"
|
||||
" FROM quest_template");
|
||||
if (!result)
|
||||
{
|
||||
@@ -4015,6 +4013,75 @@ void ObjectMgr::LoadQuests()
|
||||
} while (result->NextRow());
|
||||
|
||||
std::map<uint32, uint32> usedMailTemplates;
|
||||
|
||||
// Load `quest_details`
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
result = WorldDatabase.Query("SELECT ID, Emote1, Emote2, Emote3, Emote4, EmoteDelay1, EmoteDelay2, EmoteDelay3, EmoteDelay4 FROM quest_details");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
TC_LOG_ERROR("server.loading", ">> Loaded 0 quest details. DB table `quest_details` is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 questId = fields[0].GetUInt32();
|
||||
|
||||
auto itr = _questTemplates.find(questId);
|
||||
if (itr != _questTemplates.end())
|
||||
itr->second->LoadQuestDetails(fields);
|
||||
else
|
||||
TC_LOG_ERROR("server.loading", "Table `quest_details` has data for quest %u but such quest does not exist", questId);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
// Load `quest_request_items`
|
||||
// 0 1 2 3
|
||||
result = WorldDatabase.Query("SELECT ID, EmoteOnComplete, EmoteOnIncomplete, CompletionText FROM quest_request_items");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
TC_LOG_ERROR("server.loading", ">> Loaded 0 quest request items. DB table `quest_request_items` is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 questId = fields[0].GetUInt32();
|
||||
|
||||
auto itr = _questTemplates.find(questId);
|
||||
if (itr != _questTemplates.end())
|
||||
itr->second->LoadQuestRequestItems(fields);
|
||||
else
|
||||
TC_LOG_ERROR("server.loading", "Table `quest_request_items` has data for quest %u but such quest does not exist", questId);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
// Load `quest_offer_reward`
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
result = WorldDatabase.Query("SELECT ID, Emote1, Emote2, Emote3, Emote4, EmoteDelay1, EmoteDelay2, EmoteDelay3, EmoteDelay4, RewardText FROM quest_offer_reward");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
TC_LOG_ERROR("server.loading", ">> Loaded 0 quest reward emotes. DB table `quest_offer_reward` is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 questId = fields[0].GetUInt32();
|
||||
|
||||
auto itr = _questTemplates.find(questId);
|
||||
if (itr != _questTemplates.end())
|
||||
itr->second->LoadQuestOfferReward(fields);
|
||||
else
|
||||
TC_LOG_ERROR("server.loading", "Table `quest_offer_reward` has data for quest %u but such quest does not exist", questId);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
// Load `quest_template_addon`
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
|
||||
@@ -79,49 +79,32 @@ Quest::Quest(Field* questRecord)
|
||||
Objectives = questRecord[67].GetString();
|
||||
Details = questRecord[68].GetString();
|
||||
EndText = questRecord[69].GetString();
|
||||
OfferRewardText = questRecord[70].GetString();
|
||||
RequestItemsText = questRecord[71].GetString();
|
||||
CompletedText = questRecord[72].GetString();
|
||||
CompletedText = questRecord[70].GetString();
|
||||
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
RequiredNpcOrGo[i] = questRecord[73+i].GetInt32();
|
||||
RequiredNpcOrGo[i] = questRecord[71+i].GetInt32();
|
||||
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
RequiredNpcOrGoCount[i] = questRecord[77+i].GetUInt16();
|
||||
RequiredNpcOrGoCount[i] = questRecord[75+i].GetUInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
|
||||
RequiredSourceItemId[i] = questRecord[81+i].GetUInt32();
|
||||
RequiredSourceItemId[i] = questRecord[79+i].GetUInt32();
|
||||
|
||||
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
|
||||
RequiredSourceItemCount[i] = questRecord[85+i].GetUInt16();
|
||||
RequiredSourceItemCount[i] = questRecord[83+i].GetUInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
RequiredItemId[i] = questRecord[89+i].GetUInt32();
|
||||
RequiredItemId[i] = questRecord[87+i].GetUInt32();
|
||||
|
||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
RequiredItemCount[i] = questRecord[95+i].GetUInt16();
|
||||
RequiredItemCount[i] = questRecord[93+i].GetUInt16();
|
||||
|
||||
// int8 Unknown0 = questRecord[101].GetUInt8();
|
||||
// int8 Unknown0 = questRecord[99].GetUInt8();
|
||||
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
ObjectiveText[i] = questRecord[102+i].GetString();
|
||||
ObjectiveText[i] = questRecord[100+i].GetString();
|
||||
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
DetailsEmote[i] = questRecord[106+i].GetUInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
DetailsEmoteDelay[i] = questRecord[110+i].GetUInt32();
|
||||
|
||||
EmoteOnIncomplete = questRecord[114].GetUInt16();
|
||||
EmoteOnComplete = questRecord[115].GetUInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
OfferRewardEmote[i] = questRecord[116+i].GetInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
OfferRewardEmoteDelay[i] = questRecord[120+i].GetInt32();
|
||||
|
||||
//int32 VerifiedBuild = questRecord[124].GetInt32();
|
||||
//int32 VerifiedBuild = questRecord[104].GetInt32();
|
||||
|
||||
_reqItemsCount = 0;
|
||||
_reqCreatureOrGOcount = 0;
|
||||
@@ -145,6 +128,33 @@ Quest::Quest(Field* questRecord)
|
||||
++_rewChoiceItemsCount;
|
||||
}
|
||||
|
||||
void Quest::LoadQuestDetails(Field* fields)
|
||||
{
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
DetailsEmote[i] = fields[1+i].GetUInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
DetailsEmoteDelay[i] = fields[5+i].GetUInt32();
|
||||
}
|
||||
|
||||
void Quest::LoadQuestRequestItems(Field* fields)
|
||||
{
|
||||
EmoteOnComplete = fields[1].GetUInt16();
|
||||
EmoteOnIncomplete = fields[2].GetUInt16();
|
||||
RequestItemsText = fields[3].GetString();
|
||||
}
|
||||
|
||||
void Quest::LoadQuestOfferReward(Field* fields)
|
||||
{
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
OfferRewardEmote[i] = fields[1+i].GetUInt16();
|
||||
|
||||
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
OfferRewardEmoteDelay[i] = fields[5+i].GetUInt32();
|
||||
|
||||
OfferRewardText = fields[9].GetString();
|
||||
}
|
||||
|
||||
void Quest::LoadQuestTemplateAddon(Field* fields)
|
||||
{
|
||||
MaxLevel = fields[1].GetUInt8();
|
||||
|
||||
@@ -195,6 +195,9 @@ class Quest
|
||||
friend class ObjectMgr;
|
||||
public:
|
||||
Quest(Field* questRecord);
|
||||
void LoadQuestDetails(Field* fields);
|
||||
void LoadQuestRequestItems(Field* fields);
|
||||
void LoadQuestOfferReward(Field* fields);
|
||||
void LoadQuestTemplateAddon(Field* fields);
|
||||
|
||||
uint32 XPValue(Player* player) const;
|
||||
|
||||
Reference in new issue
Block a user