[9291] Implement DB storage for new quest field, CompletedText

Text will display in quest objectives window when quest is completed.
Also add locales storage

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-03 14:03:23 +01:00
parent 573651435e
commit a0a4f7a719
11 changed files with 112 additions and 66 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_9289_01_mangos_spell_proc_event` bit(1) default NULL
`required_9291_02_mangos_locales_quest` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -2782,6 +2782,14 @@ CREATE TABLE `locales_quest` (
`EndText_loc6` text,
`EndText_loc7` text,
`EndText_loc8` text,
`CompletedText_loc1` text,
`CompletedText_loc2` text,
`CompletedText_loc3` text,
`CompletedText_loc4` text,
`CompletedText_loc5` text,
`CompletedText_loc6` text,
`CompletedText_loc7` text,
`CompletedText_loc8` text,
`ObjectiveText1_loc1` text,
`ObjectiveText1_loc2` text,
`ObjectiveText1_loc3` text,
@ -13805,6 +13813,7 @@ CREATE TABLE `quest_template` (
`OfferRewardText` text,
`RequestItemsText` text,
`EndText` text,
`CompletedText` text,
`ObjectiveText1` text,
`ObjectiveText2` text,
`ObjectiveText3` text,

View file

@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_9289_01_mangos_spell_proc_event required_9291_01_mangos_quest_template bit;
ALTER TABLE quest_template ADD COLUMN CompletedText text AFTER EndText;

View file

@ -0,0 +1,10 @@
ALTER TABLE db_version CHANGE COLUMN required_9291_01_mangos_quest_template required_9291_02_mangos_locales_quest bit;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc1 text AFTER EndText_loc8;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc2 text AFTER CompletedText_loc1;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc3 text AFTER CompletedText_loc2;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc4 text AFTER CompletedText_loc3;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc5 text AFTER CompletedText_loc4;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc6 text AFTER CompletedText_loc5;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc7 text AFTER CompletedText_loc6;
ALTER TABLE locales_quest ADD COLUMN CompletedText_loc8 text AFTER CompletedText_loc7;

View file

@ -256,6 +256,8 @@ pkgdata_DATA = \
9277_01_mangos_spell_bonus_data.sql \
9288_01_mangos_spell_bonus_data.sql \
9289_01_mangos_spell_proc_event.sql \
9291_01_mangos_quest_template.sql \
9291_02_mangos_locales_quest.sql \
README
## Additional files to include when running 'make dist'
@ -492,4 +494,6 @@ EXTRA_DIST = \
9277_01_mangos_spell_bonus_data.sql \
9288_01_mangos_spell_bonus_data.sql \
9289_01_mangos_spell_proc_event.sql \
9291_01_mangos_quest_template.sql \
9291_02_mangos_locales_quest.sql \
README

View file

@ -540,12 +540,14 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
{
std::string Title,Details,Objectives,EndText;
std::string Title, Details, Objectives, EndText, CompletedText;
std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
Title = pQuest->GetTitle();
Details = pQuest->GetDetails();
Objectives = pQuest->GetObjectives();
EndText = pQuest->GetEndText();
CompletedText = pQuest->GetCompletedText();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectiveText[i] = pQuest->ObjectiveText[i];
@ -563,6 +565,8 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
Objectives=ql->Objectives[loc_idx];
if (ql->EndText.size() > (size_t)loc_idx && !ql->EndText[loc_idx].empty())
EndText=ql->EndText[loc_idx];
if (ql->CompletedText.size() > (size_t)loc_idx && !ql->CompletedText[loc_idx].empty())
CompletedText=ql->CompletedText[loc_idx];
for (int i = 0;i < QUEST_OBJECTIVES_COUNT; ++i)
if (ql->ObjectiveText[i].size() > (size_t)loc_idx && !ql->ObjectiveText[i][loc_idx].empty())
@ -651,7 +655,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
data << Objectives;
data << Details;
data << EndText;
data << uint8(0); // Return to <??> text
data << CompletedText; // display in quest objectives window once all objectives are completed
for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
{

View file

@ -3285,33 +3285,33 @@ void ObjectMgr::LoadQuests()
"RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
// 17 18 19 20 21 22 23 24 25 26 27 28
"QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, SrcItemId, SrcItemCount, SrcSpell,"
// 29 30 31 32 33 34 35 36 37 38
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 39 40 41 42 43 44 45 46 47 48 49 50
// 29 30 31 32 33 34 35 36 37 38 39
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 40 41 42 43 44 45 46 47 48 49 50 51
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6,"
// 51 52 53 54 55 56 57 58
// 52 53 54 55 56 57 58 59
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4,"
// 59 60 61 62 63 64 65 66
// 60 61 62 63 64 65 66 67
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
// 67 68 69 70
// 68 69 70 71
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4,"
// 71 72 73 74 75 76
// 72 73 74 75 76 77
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
// 77 78 79 80 81 82
// 78 79 80 81 82 83
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
// 83 84 85 86 87 88 89 90
// 84 85 86 87 88 89 90 91
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 91 92 93 94 95 96 97 98 99 100
// 92 93 94 95 96 97 98 99 100 101
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 101 102 103 104 105 106 107 108 109 110 111
// 102 103 104 105 106 107 108 109 110 111 112
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 112 113 114 115 116 117 118 119
// 113 114 115 116 117 118 119 120
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4,"
// 120 121 122 123 124 125
// 121 122 123 124 125 126
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 126 127 128 129
// 127 128 129 130
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
// 130 131
// 131 132
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
@ -3938,14 +3938,14 @@ void ObjectMgr::LoadQuestLocales()
mQuestLocaleMap.clear(); // need for reload case
QueryResult *result = WorldDatabase.Query("SELECT entry,"
"Title_loc1,Details_loc1,Objectives_loc1,OfferRewardText_loc1,RequestItemsText_loc1,EndText_loc1,ObjectiveText1_loc1,ObjectiveText2_loc1,ObjectiveText3_loc1,ObjectiveText4_loc1,"
"Title_loc2,Details_loc2,Objectives_loc2,OfferRewardText_loc2,RequestItemsText_loc2,EndText_loc2,ObjectiveText1_loc2,ObjectiveText2_loc2,ObjectiveText3_loc2,ObjectiveText4_loc2,"
"Title_loc3,Details_loc3,Objectives_loc3,OfferRewardText_loc3,RequestItemsText_loc3,EndText_loc3,ObjectiveText1_loc3,ObjectiveText2_loc3,ObjectiveText3_loc3,ObjectiveText4_loc3,"
"Title_loc4,Details_loc4,Objectives_loc4,OfferRewardText_loc4,RequestItemsText_loc4,EndText_loc4,ObjectiveText1_loc4,ObjectiveText2_loc4,ObjectiveText3_loc4,ObjectiveText4_loc4,"
"Title_loc5,Details_loc5,Objectives_loc5,OfferRewardText_loc5,RequestItemsText_loc5,EndText_loc5,ObjectiveText1_loc5,ObjectiveText2_loc5,ObjectiveText3_loc5,ObjectiveText4_loc5,"
"Title_loc6,Details_loc6,Objectives_loc6,OfferRewardText_loc6,RequestItemsText_loc6,EndText_loc6,ObjectiveText1_loc6,ObjectiveText2_loc6,ObjectiveText3_loc6,ObjectiveText4_loc6,"
"Title_loc7,Details_loc7,Objectives_loc7,OfferRewardText_loc7,RequestItemsText_loc7,EndText_loc7,ObjectiveText1_loc7,ObjectiveText2_loc7,ObjectiveText3_loc7,ObjectiveText4_loc7,"
"Title_loc8,Details_loc8,Objectives_loc8,OfferRewardText_loc8,RequestItemsText_loc8,EndText_loc8,ObjectiveText1_loc8,ObjectiveText2_loc8,ObjectiveText3_loc8,ObjectiveText4_loc8"
"Title_loc1,Details_loc1,Objectives_loc1,OfferRewardText_loc1,RequestItemsText_loc1,EndText_loc1,CompletedText_loc1,ObjectiveText1_loc1,ObjectiveText2_loc1,ObjectiveText3_loc1,ObjectiveText4_loc1,"
"Title_loc2,Details_loc2,Objectives_loc2,OfferRewardText_loc2,RequestItemsText_loc2,EndText_loc2,CompletedText_loc2,ObjectiveText1_loc2,ObjectiveText2_loc2,ObjectiveText3_loc2,ObjectiveText4_loc2,"
"Title_loc3,Details_loc3,Objectives_loc3,OfferRewardText_loc3,RequestItemsText_loc3,EndText_loc3,CompletedText_loc3,ObjectiveText1_loc3,ObjectiveText2_loc3,ObjectiveText3_loc3,ObjectiveText4_loc3,"
"Title_loc4,Details_loc4,Objectives_loc4,OfferRewardText_loc4,RequestItemsText_loc4,EndText_loc4,CompletedText_loc4,ObjectiveText1_loc4,ObjectiveText2_loc4,ObjectiveText3_loc4,ObjectiveText4_loc4,"
"Title_loc5,Details_loc5,Objectives_loc5,OfferRewardText_loc5,RequestItemsText_loc5,EndText_loc5,CompletedText_loc5,ObjectiveText1_loc5,ObjectiveText2_loc5,ObjectiveText3_loc5,ObjectiveText4_loc5,"
"Title_loc6,Details_loc6,Objectives_loc6,OfferRewardText_loc6,RequestItemsText_loc6,EndText_loc6,CompletedText_loc6,ObjectiveText1_loc6,ObjectiveText2_loc6,ObjectiveText3_loc6,ObjectiveText4_loc6,"
"Title_loc7,Details_loc7,Objectives_loc7,OfferRewardText_loc7,RequestItemsText_loc7,EndText_loc7,CompletedText_loc7,ObjectiveText1_loc7,ObjectiveText2_loc7,ObjectiveText3_loc7,ObjectiveText4_loc7,"
"Title_loc8,Details_loc8,Objectives_loc8,OfferRewardText_loc8,RequestItemsText_loc8,EndText_loc8,CompletedText_loc8,ObjectiveText1_loc8,ObjectiveText2_loc8,ObjectiveText3_loc8,ObjectiveText4_loc8"
" FROM locales_quest"
);
@ -4045,6 +4045,18 @@ void ObjectMgr::LoadQuestLocales()
data.EndText[idx] = str;
}
}
str = fields[1+10*(i-1)+6].GetCppString();
if(!str.empty())
{
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.CompletedText.size() <= idx)
data.CompletedText.resize(idx+1);
data.CompletedText[idx] = str;
}
}
for(int k = 0; k < 4; ++k)
{
str = fields[1+10*(i-1)+6+k].GetCppString();

View file

@ -57,78 +57,79 @@ Quest::Quest(Field * questRecord)
OfferRewardText = questRecord[32].GetCppString();
RequestItemsText = questRecord[33].GetCppString();
EndText = questRecord[34].GetCppString();
CompletedText = questRecord[35].GetCppString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectiveText[i] = questRecord[35+i].GetCppString();
ObjectiveText[i] = questRecord[36+i].GetCppString();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemId[i] = questRecord[39+i].GetUInt32();
ReqItemId[i] = questRecord[40+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemCount[i] = questRecord[45+i].GetUInt32();
ReqItemCount[i] = questRecord[46+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceId[i] = questRecord[51+i].GetUInt32();
ReqSourceId[i] = questRecord[52+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceCount[i] = questRecord[55+i].GetUInt32();
ReqSourceCount[i] = questRecord[56+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOId[i] = questRecord[59+i].GetInt32();
ReqCreatureOrGOId[i] = questRecord[60+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOCount[i] = questRecord[63+i].GetUInt32();
ReqCreatureOrGOCount[i] = questRecord[64+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqSpell[i] = questRecord[67+i].GetUInt32();
ReqSpell[i] = questRecord[68+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemId[i] = questRecord[71+i].GetUInt32();
RewChoiceItemId[i] = questRecord[72+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemCount[i] = questRecord[77+i].GetUInt32();
RewChoiceItemCount[i] = questRecord[78+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemId[i] = questRecord[83+i].GetUInt32();
RewItemId[i] = questRecord[84+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemCount[i] = questRecord[87+i].GetUInt32();
RewItemCount[i] = questRecord[88+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepFaction[i] = questRecord[91+i].GetUInt32();
RewRepFaction[i] = questRecord[92+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[96+i].GetInt32();
RewRepValue[i] = questRecord[97+i].GetInt32();
RewHonorableKills = questRecord[101].GetUInt32();
RewOrReqMoney = questRecord[102].GetInt32();
RewMoneyMaxLevel = questRecord[103].GetUInt32();
RewSpell = questRecord[104].GetUInt32();
RewSpellCast = questRecord[105].GetUInt32();
RewMailTemplateId = questRecord[106].GetUInt32();
RewMailDelaySecs = questRecord[107].GetUInt32();
PointMapId = questRecord[108].GetUInt32();
PointX = questRecord[109].GetFloat();
PointY = questRecord[110].GetFloat();
PointOpt = questRecord[111].GetUInt32();
RewHonorableKills = questRecord[102].GetUInt32();
RewOrReqMoney = questRecord[103].GetInt32();
RewMoneyMaxLevel = questRecord[104].GetUInt32();
RewSpell = questRecord[105].GetUInt32();
RewSpellCast = questRecord[106].GetUInt32();
RewMailTemplateId = questRecord[107].GetUInt32();
RewMailDelaySecs = questRecord[108].GetUInt32();
PointMapId = questRecord[109].GetUInt32();
PointX = questRecord[110].GetFloat();
PointY = questRecord[111].GetFloat();
PointOpt = questRecord[112].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[112+i].GetUInt32();
DetailsEmote[i] = questRecord[113+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = questRecord[116+i].GetUInt32();
DetailsEmoteDelay[i] = questRecord[117+i].GetUInt32();
IncompleteEmote = questRecord[120].GetUInt32();
CompleteEmote = questRecord[121].GetUInt32();
IncompleteEmote = questRecord[121].GetUInt32();
CompleteEmote = questRecord[122].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[122+i].GetInt32();
OfferRewardEmote[i] = questRecord[123+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[126+i].GetInt32();
OfferRewardEmoteDelay[i] = questRecord[127+i].GetInt32();
QuestStartScript = questRecord[130].GetUInt32();
QuestCompleteScript = questRecord[131].GetUInt32();
QuestStartScript = questRecord[131].GetUInt32();
QuestCompleteScript = questRecord[132].GetUInt32();
QuestFlags |= SpecialFlags << 24;

View file

@ -162,6 +162,7 @@ struct QuestLocale
std::vector<std::string> OfferRewardText;
std::vector<std::string> RequestItemsText;
std::vector<std::string> EndText;
std::vector<std::string> CompletedText;
std::vector< std::vector<std::string> > ObjectiveText;
};
@ -212,6 +213,7 @@ class Quest
std::string GetOfferRewardText() const { return OfferRewardText; }
std::string GetRequestItemsText() const { return RequestItemsText; }
std::string GetEndText() const { return EndText; }
std::string GetCompletedText() const { return CompletedText; }
int32 GetRewOrReqMoney() const;
uint32 GetRewHonorableKills() const { return RewHonorableKills; }
uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; }
@ -306,6 +308,7 @@ class Quest
std::string OfferRewardText;
std::string RequestItemsText;
std::string EndText;
std::string CompletedText;
uint32 RewHonorableKills;
int32 RewOrReqMoney;
uint32 RewMoneyMaxLevel;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9290"
#define REVISION_NR "9291"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9250_01_characters_character"
#define REVISION_DB_MANGOS "required_9289_01_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_9291_02_mangos_locales_quest"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__