[9309] Implement DB storage for new quest_template field 'RewXPId'.

Values 0-8, used to display XP reward in client log.
Please note that calculation of quest XP has changed, and formula must be corrected accordingly.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-05 14:28:28 +01:00
parent cb33736a5a
commit f73b778cde
9 changed files with 76 additions and 64 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `cache_id` int(10) default '0',
`required_9297_01_mangos_item_template` bit(1) default NULL `required_9309_01_mangos_quest_template` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -13804,6 +13804,7 @@ CREATE TABLE `quest_template` (
`NextQuestId` mediumint(9) NOT NULL default '0', `NextQuestId` mediumint(9) NOT NULL default '0',
`ExclusiveGroup` mediumint(9) NOT NULL default '0', `ExclusiveGroup` mediumint(9) NOT NULL default '0',
`NextQuestInChain` mediumint(8) unsigned NOT NULL default '0', `NextQuestInChain` mediumint(8) unsigned NOT NULL default '0',
`RewXPId` tinyint(3) unsigned NOT NULL default '0',
`SrcItemId` mediumint(8) unsigned NOT NULL default '0', `SrcItemId` mediumint(8) unsigned NOT NULL default '0',
`SrcItemCount` tinyint(3) unsigned NOT NULL default '0', `SrcItemCount` tinyint(3) unsigned NOT NULL default '0',
`SrcSpell` mediumint(8) unsigned NOT NULL default '0', `SrcSpell` mediumint(8) unsigned NOT NULL default '0',

View file

@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_9297_01_mangos_item_template required_9309_01_mangos_quest_template bit;
ALTER TABLE quest_template ADD COLUMN RewXPId tinyint(3) unsigned NOT NULL default '0' AFTER NextQuestInChain;

View file

@ -260,6 +260,7 @@ pkgdata_DATA = \
9291_02_mangos_locales_quest.sql \ 9291_02_mangos_locales_quest.sql \
9296_01_mangos_spell_chain.sql \ 9296_01_mangos_spell_chain.sql \
9297_01_mangos_item_template.sql \ 9297_01_mangos_item_template.sql \
9309_01_mangos_quest_template.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -500,4 +501,5 @@ EXTRA_DIST = \
9291_02_mangos_locales_quest.sql \ 9291_02_mangos_locales_quest.sql \
9296_01_mangos_spell_chain.sql \ 9296_01_mangos_spell_chain.sql \
9297_01_mangos_item_template.sql \ 9297_01_mangos_item_template.sql \
9309_01_mangos_quest_template.sql \
README README

View file

@ -470,6 +470,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
data << uint32(0); // Rewarded chosen items hidden data << uint32(0); // Rewarded chosen items hidden
data << uint32(0); // Rewarded items hidden data << uint32(0); // Rewarded items hidden
data << uint32(0); // Rewarded money hidden data << uint32(0); // Rewarded money hidden
data << uint32(0); // Rewarded XP hidden
} }
else else
{ {
@ -512,9 +513,9 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
} }
data << uint32(pQuest->GetRewOrReqMoney()); data << uint32(pQuest->GetRewOrReqMoney());
data << uint32(pQuest->XPValue(pSession->GetPlayer()));
} }
data << uint32(0);
// rewarded honor points. Multiply with 10 to satisfy client // rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << float(0); // new 3.3.0 data << float(0); // new 3.3.0
@ -601,7 +602,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
data << uint32(0); // RequiredOpositeRepValue, required faction value with another (oposite) faction (objective) data << uint32(0); // RequiredOpositeRepValue, required faction value with another (oposite) faction (objective)
data << uint32(pQuest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0 data << uint32(pQuest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0
data << uint32(0); // column index in QuestXP.dbc (row based on quest level) data << uint32(pQuest->GetRewXPId()); // column index in QuestXP.dbc (row based on quest level)
if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
data << uint32(0); // Hide money rewarded data << uint32(0); // Hide money rewarded

View file

@ -3284,35 +3284,37 @@ void ObjectMgr::LoadQuests()
QueryResult *result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue," QueryResult *result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue,"
// 9 10 11 12 13 14 15 16 // 9 10 11 12 13 14 15 16
"RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime," "RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
// 17 18 19 20 21 22 23 24 25 26 27 28 // 17 18 19 20 21 22 23 24 25
"QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, SrcItemId, SrcItemCount, SrcSpell," "QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain,"
// 29 30 31 32 33 34 35 36 37 38 39 // 26 27 28 29
"RewXPId, SrcItemId, SrcItemCount, SrcSpell,"
// 30 31 32 33 34 35 36 37 38 39 40
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4," "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 40 41 42 43 44 45 46 47 48 49 50 51 // 41 42 43 44 45 46 47 48 49 50 51 52
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6," "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6,"
// 52 53 54 55 56 57 58 59 // 53 54 55 56 57 58 59 60
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4," "ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4,"
// 60 61 62 63 64 65 66 67 // 61 62 63 64 65 66 67 68
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4," "ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
// 68 69 70 71 // 69 70 71 72
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4," "ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4,"
// 72 73 74 75 76 77 // 73 74 75 76 77 78
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6," "RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
// 78 79 80 81 82 83 // 79 80 81 82 83 84
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6," "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
// 84 85 86 87 88 89 90 91 // 85 86 87 88 89 90 91 92
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 92 93 94 95 96 97 98 99 100 101 // 93 94 95 96 97 98 99 100 101 102
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5," "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 102 103 104 105 106 107 108 109 110 111 112 // 103 104 105 106 107 108 109 110 111 112 113
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," "RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 113 114 115 116 117 118 119 120 // 114 115 116 117 118 119 120 121
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4," "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4,"
// 121 122 123 124 125 126 // 122 123 124 125 126 127
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," "IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 127 128 129 130 // 128 129 130 131
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4," "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
// 131 132 // 132 133
"StartScript, CompleteScript" "StartScript, CompleteScript"
" FROM quest_template"); " FROM quest_template");
if(result == NULL) if(result == NULL)

View file

@ -48,88 +48,89 @@ Quest::Quest(Field * questRecord)
NextQuestId = questRecord[23].GetInt32(); NextQuestId = questRecord[23].GetInt32();
ExclusiveGroup = questRecord[24].GetInt32(); ExclusiveGroup = questRecord[24].GetInt32();
NextQuestInChain = questRecord[25].GetUInt32(); NextQuestInChain = questRecord[25].GetUInt32();
SrcItemId = questRecord[26].GetUInt32(); RewXPId = questRecord[26].GetUInt32();
SrcItemCount = questRecord[27].GetUInt32(); SrcItemId = questRecord[27].GetUInt32();
SrcSpell = questRecord[28].GetUInt32(); SrcItemCount = questRecord[28].GetUInt32();
Title = questRecord[29].GetCppString(); SrcSpell = questRecord[29].GetUInt32();
Details = questRecord[30].GetCppString(); Title = questRecord[30].GetCppString();
Objectives = questRecord[31].GetCppString(); Details = questRecord[31].GetCppString();
OfferRewardText = questRecord[32].GetCppString(); Objectives = questRecord[32].GetCppString();
RequestItemsText = questRecord[33].GetCppString(); OfferRewardText = questRecord[33].GetCppString();
EndText = questRecord[34].GetCppString(); RequestItemsText = questRecord[34].GetCppString();
CompletedText = questRecord[35].GetCppString(); EndText = questRecord[35].GetCppString();
CompletedText = questRecord[36].GetCppString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectiveText[i] = questRecord[36+i].GetCppString(); ObjectiveText[i] = questRecord[37+i].GetCppString();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemId[i] = questRecord[40+i].GetUInt32(); ReqItemId[i] = questRecord[41+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemCount[i] = questRecord[46+i].GetUInt32(); ReqItemCount[i] = questRecord[47+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceId[i] = questRecord[52+i].GetUInt32(); ReqSourceId[i] = questRecord[53+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceCount[i] = questRecord[56+i].GetUInt32(); ReqSourceCount[i] = questRecord[57+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOId[i] = questRecord[60+i].GetInt32(); ReqCreatureOrGOId[i] = questRecord[61+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOCount[i] = questRecord[64+i].GetUInt32(); ReqCreatureOrGOCount[i] = questRecord[65+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqSpell[i] = questRecord[68+i].GetUInt32(); ReqSpell[i] = questRecord[69+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemId[i] = questRecord[72+i].GetUInt32(); RewChoiceItemId[i] = questRecord[73+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemCount[i] = questRecord[78+i].GetUInt32(); RewChoiceItemCount[i] = questRecord[79+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemId[i] = questRecord[84+i].GetUInt32(); RewItemId[i] = questRecord[85+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemCount[i] = questRecord[88+i].GetUInt32(); RewItemCount[i] = questRecord[89+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepFaction[i] = questRecord[92+i].GetUInt32(); RewRepFaction[i] = questRecord[93+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[97+i].GetInt32(); RewRepValue[i] = questRecord[98+i].GetInt32();
RewHonorableKills = questRecord[102].GetUInt32(); RewHonorableKills = questRecord[103].GetUInt32();
RewOrReqMoney = questRecord[103].GetInt32(); RewOrReqMoney = questRecord[104].GetInt32();
RewMoneyMaxLevel = questRecord[104].GetUInt32(); RewMoneyMaxLevel = questRecord[105].GetUInt32();
RewSpell = questRecord[105].GetUInt32(); RewSpell = questRecord[106].GetUInt32();
RewSpellCast = questRecord[106].GetUInt32(); RewSpellCast = questRecord[107].GetUInt32();
RewMailTemplateId = questRecord[107].GetUInt32(); RewMailTemplateId = questRecord[108].GetUInt32();
RewMailDelaySecs = questRecord[108].GetUInt32(); RewMailDelaySecs = questRecord[109].GetUInt32();
PointMapId = questRecord[109].GetUInt32(); PointMapId = questRecord[110].GetUInt32();
PointX = questRecord[110].GetFloat(); PointX = questRecord[111].GetFloat();
PointY = questRecord[111].GetFloat(); PointY = questRecord[112].GetFloat();
PointOpt = questRecord[112].GetUInt32(); PointOpt = questRecord[113].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[113+i].GetUInt32(); DetailsEmote[i] = questRecord[114+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = questRecord[117+i].GetUInt32(); DetailsEmoteDelay[i] = questRecord[118+i].GetUInt32();
IncompleteEmote = questRecord[121].GetUInt32(); IncompleteEmote = questRecord[122].GetUInt32();
CompleteEmote = questRecord[122].GetUInt32(); CompleteEmote = questRecord[123].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[123+i].GetInt32(); OfferRewardEmote[i] = questRecord[124+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[127+i].GetInt32(); OfferRewardEmoteDelay[i] = questRecord[128+i].GetInt32();
QuestStartScript = questRecord[131].GetUInt32(); QuestStartScript = questRecord[132].GetUInt32();
QuestCompleteScript = questRecord[132].GetUInt32(); QuestCompleteScript = questRecord[133].GetUInt32();
QuestFlags |= SpecialFlags << 24; QuestFlags |= SpecialFlags << 24;

View file

@ -201,6 +201,7 @@ class Quest
int32 GetNextQuestId() const { return NextQuestId; } int32 GetNextQuestId() const { return NextQuestId; }
int32 GetExclusiveGroup() const { return ExclusiveGroup; } int32 GetExclusiveGroup() const { return ExclusiveGroup; }
uint32 GetNextQuestInChain() const { return NextQuestInChain; } uint32 GetNextQuestInChain() const { return NextQuestInChain; }
uint32 GetRewXPId() const { return RewXPId; }
uint32 GetCharTitleId() const { return CharTitleId; } uint32 GetCharTitleId() const { return CharTitleId; }
uint32 GetPlayersSlain() const { return PlayersSlain; } uint32 GetPlayersSlain() const { return PlayersSlain; }
uint32 GetBonusTalents() const { return BonusTalents; } uint32 GetBonusTalents() const { return BonusTalents; }
@ -299,6 +300,7 @@ class Quest
int32 NextQuestId; int32 NextQuestId;
int32 ExclusiveGroup; int32 ExclusiveGroup;
uint32 NextQuestInChain; uint32 NextQuestInChain;
uint32 RewXPId;
uint32 SrcItemId; uint32 SrcItemId;
uint32 SrcItemCount; uint32 SrcItemCount;
uint32 SrcSpell; uint32 SrcSpell;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9308" #define REVISION_NR "9309"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

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