Skip to content

Commit

Permalink
[9312] Implement DB storage of new quest_template field RewHonorMulti…
Browse files Browse the repository at this point in the history
…plier

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

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Feb 6, 2010
1 parent fbac195 commit a4df644
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 43 deletions.
5 changes: 3 additions & 2 deletions sql/mangos.sql
Expand Up @@ -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_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';

--
Expand Down Expand Up @@ -13881,7 +13881,8 @@ CREATE TABLE `quest_template` (
`RewRepValue3` mediumint(9) NOT NULL default '0',
`RewRepValue4` 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',
`RewMoneyMaxLevel` int(10) unsigned NOT NULL default '0',
`RewSpell` mediumint(8) unsigned NOT NULL default '0',
Expand Down
4 changes: 4 additions & 0 deletions sql/updates/9312_01_mangos_quest_template.sql
@@ -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';
2 changes: 2 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -262,6 +262,7 @@ pkgdata_DATA = \
9297_01_mangos_item_template.sql \
9309_01_mangos_quest_template.sql \
9310_01_mangos_spell_elixir.sql \
9312_01_mangos_quest_template.sql \
README

## Additional files to include when running 'make dist'
Expand Down Expand Up @@ -504,4 +505,5 @@ EXTRA_DIST = \
9297_01_mangos_item_template.sql \
9309_01_mangos_quest_template.sql \
9310_01_mangos_spell_elixir.sql \
9312_01_mangos_quest_template.sql \
README
22 changes: 13 additions & 9 deletions src/game/GossipDef.cpp
Expand Up @@ -516,9 +516,10 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
data << uint32(pQuest->XPValue(pSession->GetPlayer()));
}

// rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << float(0); // new 3.3.0
// TODO: fixme. rewarded honor points
data << uint32(pQuest->GetRewHonorAddition());
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->GetRewSpellCast()); // casted spell
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
Expand Down Expand Up @@ -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());
}

// send only static data in this packet!
void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
{
std::string Title, Details, Objectives, EndText, CompletedText;
Expand Down Expand Up @@ -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->GetRewSpellCast()); // casted spell

// rewarded honor points (raw)
data << uint32(MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << float(0); // new reward honor (multipled by ~62 at client side)
// rewarded honor points
data << uint32(pQuest->GetRewHonorAddition());
data << float(pQuest->GetRewHonorMultiplier()); // new reward honor (multipled by ~62 at client side)

data << uint32(pQuest->GetSrcItemId()); // source item id
data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
Expand Down Expand Up @@ -771,9 +774,10 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->GetRewOrReqMoney()); // money
data << uint32(pQuest->XPValue(pSession->GetPlayer())); // xp

// rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << float(0);
// TODO: fixme. rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorAddition()));
data << float(pQuest->GetRewHonorMultiplier());

data << uint32(0x08); // unused by client?
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
data << uint32(pQuest->GetRewSpellCast()); // casted spell
Expand Down
14 changes: 8 additions & 6 deletions src/game/ObjectMgr.cpp
Expand Up @@ -3306,15 +3306,17 @@ void ObjectMgr::LoadQuests()
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 93 94 95 96 97 98 99 100 101 102
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 103 104 105 106 107 108 109 110 111 112 113
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 114 115 116 117 118 119 120 121
// 103 104 105 106 107 108
"RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast,"
// 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,"
// 122 123 124 125 126 127
// 123 124 125 126 127 128
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 128 129 130 131
// 129 130 131 132
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
// 132 133
// 133 134
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
Expand Down
6 changes: 3 additions & 3 deletions src/game/Player.cpp
Expand Up @@ -13206,8 +13206,8 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
}

// honor reward
if (pQuest->GetRewHonorableKills())
RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills()));
if (pQuest->GetRewHonorAddition())
RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorAddition()));

// title reward
if (pQuest->GetCharTitleId())
Expand Down Expand Up @@ -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(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(0);
GetSession()->SendPacket( &data );
Expand Down
39 changes: 20 additions & 19 deletions src/game/QuestDef.cpp
Expand Up @@ -102,35 +102,36 @@ Quest::Quest(Field * questRecord)
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[98+i].GetInt32();

RewHonorableKills = questRecord[103].GetUInt32();
RewOrReqMoney = questRecord[104].GetInt32();
RewMoneyMaxLevel = questRecord[105].GetUInt32();
RewSpell = questRecord[106].GetUInt32();
RewSpellCast = questRecord[107].GetUInt32();
RewMailTemplateId = questRecord[108].GetUInt32();
RewMailDelaySecs = questRecord[109].GetUInt32();
PointMapId = questRecord[110].GetUInt32();
PointX = questRecord[111].GetFloat();
PointY = questRecord[112].GetFloat();
PointOpt = questRecord[113].GetUInt32();
RewHonorAddition = questRecord[103].GetUInt32();
RewHonorMultiplier = questRecord[104].GetFloat();
RewOrReqMoney = questRecord[105].GetInt32();
RewMoneyMaxLevel = questRecord[106].GetUInt32();
RewSpell = questRecord[107].GetUInt32();
RewSpellCast = questRecord[108].GetUInt32();
RewMailTemplateId = questRecord[109].GetUInt32();
RewMailDelaySecs = questRecord[110].GetUInt32();
PointMapId = questRecord[111].GetUInt32();
PointX = questRecord[112].GetFloat();
PointY = questRecord[113].GetFloat();
PointOpt = questRecord[114].GetUInt32();

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)
DetailsEmoteDelay[i] = questRecord[118+i].GetUInt32();
DetailsEmoteDelay[i] = questRecord[119+i].GetUInt32();

IncompleteEmote = questRecord[122].GetUInt32();
CompleteEmote = questRecord[123].GetUInt32();
IncompleteEmote = questRecord[123].GetUInt32();
CompleteEmote = questRecord[124].GetUInt32();

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)
OfferRewardEmoteDelay[i] = questRecord[128+i].GetInt32();
OfferRewardEmoteDelay[i] = questRecord[129+i].GetInt32();

QuestStartScript = questRecord[132].GetUInt32();
QuestCompleteScript = questRecord[133].GetUInt32();
QuestStartScript = questRecord[133].GetUInt32();
QuestCompleteScript = questRecord[134].GetUInt32();

QuestFlags |= SpecialFlags << 24;

Expand Down
6 changes: 4 additions & 2 deletions src/game/QuestDef.h
Expand Up @@ -216,7 +216,8 @@ class Quest
std::string GetEndText() const { return EndText; }
std::string GetCompletedText() const { return CompletedText; }
int32 GetRewOrReqMoney() const;
uint32 GetRewHonorableKills() const { return RewHonorableKills; }
uint32 GetRewHonorAddition() const { return RewHonorAddition; }
float GetRewHonorMultiplier() const { return RewHonorMultiplier; }
uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; }
// use in XP calculation at client
uint32 GetRewSpell() const { return RewSpell; }
Expand Down Expand Up @@ -311,7 +312,8 @@ class Quest
std::string RequestItemsText;
std::string EndText;
std::string CompletedText;
uint32 RewHonorableKills;
uint32 RewHonorAddition;
float RewHonorMultiplier;
int32 RewOrReqMoney;
uint32 RewMoneyMaxLevel;
uint32 RewSpell;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9311"
#define REVISION_NR "9312"
#endif // __REVISION_NR_H__
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
@@ -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_9310_01_mangos_spell_elixir"
#define REVISION_DB_MANGOS "required_9312_01_mangos_quest_template"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__

0 comments on commit a4df644

Please sign in to comment.