[9312] Implement DB storage of new quest_template field RewHonorMultiplier

Also rename an existing field to RewHonorAddition.
Note: calculation of real reward must be corrected accordingly.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-06 12:16:48 +01:00
parent 7c20d0a1d8
commit 883bdbf799
10 changed files with 59 additions and 43 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_9310_01_mangos_spell_elixir` bit(1) default NULL `required_9312_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';
-- --
@ -13881,7 +13881,8 @@ CREATE TABLE `quest_template` (
`RewRepValue3` mediumint(9) NOT NULL default '0', `RewRepValue3` mediumint(9) NOT NULL default '0',
`RewRepValue4` mediumint(9) NOT NULL default '0', `RewRepValue4` mediumint(9) NOT NULL default '0',
`RewRepValue5` mediumint(9) NOT NULL default '0', `RewRepValue5` mediumint(9) NOT NULL default '0',
`RewHonorableKills` int unsigned NOT NULL default '0', `RewHonorAddition` int unsigned NOT NULL default '0',
`RewHonorMultiplier` float NOT NULL default '0',
`RewOrReqMoney` int(11) NOT NULL default '0', `RewOrReqMoney` int(11) NOT NULL default '0',
`RewMoneyMaxLevel` int(10) unsigned NOT NULL default '0', `RewMoneyMaxLevel` int(10) unsigned NOT NULL default '0',
`RewSpell` mediumint(8) unsigned NOT NULL default '0', `RewSpell` mediumint(8) unsigned NOT NULL default '0',

View file

@ -0,0 +1,4 @@
ALTER TABLE db_version CHANGE COLUMN required_9310_01_mangos_spell_elixir required_9312_01_mangos_quest_template bit;
ALTER TABLE quest_template ADD COLUMN RewHonorMultiplier float NOT NULL default '0' AFTER RewHonorableKills;
ALTER TABLE quest_template CHANGE COLUMN RewHonorableKills RewHonorAddition int unsigned NOT NULL default '0';

View file

@ -262,6 +262,7 @@ pkgdata_DATA = \
9297_01_mangos_item_template.sql \ 9297_01_mangos_item_template.sql \
9309_01_mangos_quest_template.sql \ 9309_01_mangos_quest_template.sql \
9310_01_mangos_spell_elixir.sql \ 9310_01_mangos_spell_elixir.sql \
9312_01_mangos_quest_template.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -504,4 +505,5 @@ EXTRA_DIST = \
9297_01_mangos_item_template.sql \ 9297_01_mangos_item_template.sql \
9309_01_mangos_quest_template.sql \ 9309_01_mangos_quest_template.sql \
9310_01_mangos_spell_elixir.sql \ 9310_01_mangos_spell_elixir.sql \
9312_01_mangos_quest_template.sql \
README README

View file

@ -516,9 +516,10 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
data << uint32(pQuest->XPValue(pSession->GetPlayer())); data << uint32(pQuest->XPValue(pSession->GetPlayer()));
} }
// rewarded honor points. Multiply with 10 to satisfy client // TODO: fixme. rewarded honor points
data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); data << uint32(pQuest->GetRewHonorAddition());
data << float(0); // new 3.3.0 data << float(pQuest->GetRewHonorMultiplier()); // new 3.3.0
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
data << uint32(pQuest->GetRewSpellCast()); // casted spell data << uint32(pQuest->GetRewSpellCast()); // casted spell
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@ -548,6 +549,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId()); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId());
} }
// send only static data in this packet!
void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
{ {
std::string Title, Details, Objectives, EndText, CompletedText; std::string Title, Details, Objectives, EndText, CompletedText;
@ -613,9 +615,10 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
data << uint32(pQuest->GetRewSpellCast()); // casted spell data << uint32(pQuest->GetRewSpellCast()); // casted spell
// rewarded honor points (raw) // rewarded honor points
data << uint32(MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); data << uint32(pQuest->GetRewHonorAddition());
data << float(0); // new reward honor (multipled by ~62 at client side) data << float(pQuest->GetRewHonorMultiplier()); // new reward honor (multipled by ~62 at client side)
data << uint32(pQuest->GetSrcItemId()); // source item id data << uint32(pQuest->GetSrcItemId()); // source item id
data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@ -771,9 +774,10 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->GetRewOrReqMoney()); // money data << uint32(pQuest->GetRewOrReqMoney()); // money
data << uint32(pQuest->XPValue(pSession->GetPlayer())); // xp data << uint32(pQuest->XPValue(pSession->GetPlayer())); // xp
// rewarded honor points. Multiply with 10 to satisfy client // TODO: fixme. 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->GetRewHonorAddition()));
data << float(0); data << float(pQuest->GetRewHonorMultiplier());
data << uint32(0x08); // unused by client? data << uint32(0x08); // unused by client?
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
data << uint32(pQuest->GetRewSpellCast()); // casted spell data << uint32(pQuest->GetRewSpellCast()); // casted spell

View file

@ -3306,15 +3306,17 @@ void ObjectMgr::LoadQuests()
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 93 94 95 96 97 98 99 100 101 102 // 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,"
// 103 104 105 106 107 108 109 110 111 112 113 // 103 104 105 106 107 108
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," "RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast,"
// 114 115 116 117 118 119 120 121 // 109 110 111 112 113 114
"RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 115 116 117 118 119 120 121 122
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4," "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4,"
// 122 123 124 125 126 127 // 123 124 125 126 127 128
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," "IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 128 129 130 131 // 129 130 131 132
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4," "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
// 132 133 // 133 134
"StartScript, CompleteScript" "StartScript, CompleteScript"
" FROM quest_template"); " FROM quest_template");
if(result == NULL) if(result == NULL)

View file

@ -13206,8 +13206,8 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
} }
// honor reward // honor reward
if (pQuest->GetRewHonorableKills()) if (pQuest->GetRewHonorAddition())
RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills())); RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorAddition()));
// title reward // title reward
if (pQuest->GetCharTitleId()) if (pQuest->GetCharTitleId())
@ -14271,7 +14271,7 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive
data << uint32(pQuest->GetRewOrReqMoney() + int32(pQuest->GetRewMoneyMaxLevel() * sWorld.getRate(RATE_DROP_MONEY))); data << uint32(pQuest->GetRewOrReqMoney() + int32(pQuest->GetRewMoneyMaxLevel() * sWorld.getRate(RATE_DROP_MONEY)));
} }
data << uint32(10*MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills())); data << uint32(10*MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorAddition()));
data << uint32(pQuest->GetBonusTalents()); // bonus talents data << uint32(pQuest->GetBonusTalents()); // bonus talents
data << uint32(0); data << uint32(0);
GetSession()->SendPacket( &data ); GetSession()->SendPacket( &data );

View file

@ -102,35 +102,36 @@ Quest::Quest(Field * questRecord)
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[98+i].GetInt32(); RewRepValue[i] = questRecord[98+i].GetInt32();
RewHonorableKills = questRecord[103].GetUInt32(); RewHonorAddition = questRecord[103].GetUInt32();
RewOrReqMoney = questRecord[104].GetInt32(); RewHonorMultiplier = questRecord[104].GetFloat();
RewMoneyMaxLevel = questRecord[105].GetUInt32(); RewOrReqMoney = questRecord[105].GetInt32();
RewSpell = questRecord[106].GetUInt32(); RewMoneyMaxLevel = questRecord[106].GetUInt32();
RewSpellCast = questRecord[107].GetUInt32(); RewSpell = questRecord[107].GetUInt32();
RewMailTemplateId = questRecord[108].GetUInt32(); RewSpellCast = questRecord[108].GetUInt32();
RewMailDelaySecs = questRecord[109].GetUInt32(); RewMailTemplateId = questRecord[109].GetUInt32();
PointMapId = questRecord[110].GetUInt32(); RewMailDelaySecs = questRecord[110].GetUInt32();
PointX = questRecord[111].GetFloat(); PointMapId = questRecord[111].GetUInt32();
PointY = questRecord[112].GetFloat(); PointX = questRecord[112].GetFloat();
PointOpt = questRecord[113].GetUInt32(); PointY = questRecord[113].GetFloat();
PointOpt = questRecord[114].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[114+i].GetUInt32(); DetailsEmote[i] = questRecord[115+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = questRecord[118+i].GetUInt32(); DetailsEmoteDelay[i] = questRecord[119+i].GetUInt32();
IncompleteEmote = questRecord[122].GetUInt32(); IncompleteEmote = questRecord[123].GetUInt32();
CompleteEmote = questRecord[123].GetUInt32(); CompleteEmote = questRecord[124].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[124+i].GetInt32(); OfferRewardEmote[i] = questRecord[125+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[128+i].GetInt32(); OfferRewardEmoteDelay[i] = questRecord[129+i].GetInt32();
QuestStartScript = questRecord[132].GetUInt32(); QuestStartScript = questRecord[133].GetUInt32();
QuestCompleteScript = questRecord[133].GetUInt32(); QuestCompleteScript = questRecord[134].GetUInt32();
QuestFlags |= SpecialFlags << 24; QuestFlags |= SpecialFlags << 24;

View file

@ -216,7 +216,8 @@ class Quest
std::string GetEndText() const { return EndText; } std::string GetEndText() const { return EndText; }
std::string GetCompletedText() const { return CompletedText; } std::string GetCompletedText() const { return CompletedText; }
int32 GetRewOrReqMoney() const; int32 GetRewOrReqMoney() const;
uint32 GetRewHonorableKills() const { return RewHonorableKills; } uint32 GetRewHonorAddition() const { return RewHonorAddition; }
float GetRewHonorMultiplier() const { return RewHonorMultiplier; }
uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; } uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; }
// use in XP calculation at client // use in XP calculation at client
uint32 GetRewSpell() const { return RewSpell; } uint32 GetRewSpell() const { return RewSpell; }
@ -311,7 +312,8 @@ class Quest
std::string RequestItemsText; std::string RequestItemsText;
std::string EndText; std::string EndText;
std::string CompletedText; std::string CompletedText;
uint32 RewHonorableKills; uint32 RewHonorAddition;
float RewHonorMultiplier;
int32 RewOrReqMoney; int32 RewOrReqMoney;
uint32 RewMoneyMaxLevel; uint32 RewMoneyMaxLevel;
uint32 RewSpell; uint32 RewSpell;

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 "9311" #define REVISION_NR "9312"
#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_9310_01_mangos_spell_elixir" #define REVISION_DB_MANGOS "required_9312_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__