* [sql/updates/2008_10_22_01_mangos_quest_template.sql] Implemented honor rewards from quests

This commit is contained in:
arrai 2008-10-22 01:20:18 +02:00
parent 6892cc3d2c
commit 406ac0abe5
8 changed files with 45 additions and 48 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE `quest_template`
ADD `RewHonorableKills` INT UNSIGNED NOT NULL AFTER `RewRepValue5`;

View file

@ -23,6 +23,13 @@
namespace MaNGOS namespace MaNGOS
{ {
namespace Honor
{
inline uint32 hk_honor_at_level(uint32 level, uint32 count=1)
{
return ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
}
}
namespace XP namespace XP
{ {
typedef enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY }; typedef enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY };

View file

@ -22,6 +22,7 @@
#include "Opcodes.h" #include "Opcodes.h"
#include "WorldPacket.h" #include "WorldPacket.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "Formulas.h"
GossipMenu::GossipMenu() GossipMenu::GossipMenu()
{ {
@ -464,7 +465,8 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
data << uint32(pQuest->GetRewOrReqMoney()); data << uint32(pQuest->GetRewOrReqMoney());
} }
data << uint32(0); // Honor points reward, not implemented // 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(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)
@ -539,7 +541,8 @@ 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
data << uint32(0); // Honor points reward, not implemented // rewarded honor points
data << uint32(MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << uint32(pQuest->GetSrcItemId()); data << uint32(pQuest->GetSrcItemId());
data << uint32(pQuest->GetFlags() & 0xFFFF); data << uint32(pQuest->GetFlags() & 0xFFFF);
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)
@ -673,11 +676,13 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
} }
data << uint32(pQuest->GetRewOrReqMoney()); data << uint32(pQuest->GetRewOrReqMoney());
data << uint32(0x00); // new 2.3.0. Honor points
// 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(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
data << uint32(0); // Honor points reward, not implemented data << uint32(0x00); // unk, NOT honor
pSession->SendPacket( &data ); pSession->SendPacket( &data );
sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() );
} }

View file

@ -2735,11 +2735,11 @@ void ObjectMgr::LoadQuests()
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 89 90 91 92 93 94 95 96 97 98 // 89 90 91 92 93 94 95 96 97 98
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5," "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 99 100 101 102 103 104 105 106 107 108 // 99 100 101 102 103 104 105 106 107 108 109
"RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," "RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 109 110 111 112 113 114 115 116 117 118 // 110 111 112 113 114 115 116 117 118 119
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 119 120 // 120 121
"StartScript, CompleteScript" "StartScript, CompleteScript"
" FROM quest_template"); " FROM quest_template");
if(result == NULL) if(result == NULL)

View file

@ -12047,6 +12047,10 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
ModifyMoney( pQuest->GetRewOrReqMoney() ); ModifyMoney( pQuest->GetRewOrReqMoney() );
// honor reward
if(pQuest->GetRewHonorableKills())
RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills()));
// title reward // title reward
if(pQuest->GetCharTitleId()) if(pQuest->GetCharTitleId())
{ {

View file

@ -101,28 +101,29 @@ 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[94+i].GetInt32(); RewRepValue[i] = questRecord[94+i].GetInt32();
RewOrReqMoney = questRecord[99].GetInt32(); RewHonorableKills = questRecord[99].GetUInt32();
RewMoneyMaxLevel = questRecord[100].GetUInt32(); RewOrReqMoney = questRecord[100].GetInt32();
RewSpell = questRecord[101].GetUInt32(); RewMoneyMaxLevel = questRecord[101].GetUInt32();
RewSpellCast = questRecord[102].GetUInt32(); RewSpell = questRecord[102].GetUInt32();
RewMailTemplateId = questRecord[103].GetUInt32(); RewSpellCast = questRecord[103].GetUInt32();
RewMailDelaySecs = questRecord[104].GetUInt32(); RewMailTemplateId = questRecord[104].GetUInt32();
PointMapId = questRecord[105].GetUInt32(); RewMailDelaySecs = questRecord[105].GetUInt32();
PointX = questRecord[106].GetFloat(); PointMapId = questRecord[106].GetUInt32();
PointY = questRecord[107].GetFloat(); PointX = questRecord[107].GetFloat();
PointOpt = questRecord[108].GetUInt32(); PointY = questRecord[108].GetFloat();
PointOpt = questRecord[109].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[109+i].GetUInt32(); DetailsEmote[i] = questRecord[110+i].GetUInt32();
IncompleteEmote = questRecord[113].GetUInt32(); IncompleteEmote = questRecord[114].GetUInt32();
CompleteEmote = questRecord[114].GetUInt32(); CompleteEmote = questRecord[115].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[115+i].GetInt32(); OfferRewardEmote[i] = questRecord[116+i].GetInt32();
QuestStartScript = questRecord[119].GetUInt32(); QuestStartScript = questRecord[120].GetUInt32();
QuestCompleteScript = questRecord[120].GetUInt32(); QuestCompleteScript = questRecord[121].GetUInt32();
QuestFlags |= SpecialFlags << 16; QuestFlags |= SpecialFlags << 16;

View file

@ -198,6 +198,7 @@ class Quest
std::string GetRequestItemsText() const { return RequestItemsText; } std::string GetRequestItemsText() const { return RequestItemsText; }
std::string GetEndText() const { return EndText; } std::string GetEndText() const { return EndText; }
int32 GetRewOrReqMoney() const; int32 GetRewOrReqMoney() const;
uint32 GetRewHonorableKills() const { return RewHonorableKills; }
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; }
@ -287,6 +288,7 @@ class Quest
std::string OfferRewardText; std::string OfferRewardText;
std::string RequestItemsText; std::string RequestItemsText;
std::string EndText; std::string EndText;
uint32 RewHonorableKills;
int32 RewOrReqMoney; int32 RewOrReqMoney;
uint32 RewMoneyMaxLevel; uint32 RewMoneyMaxLevel;
uint32 RewSpell; uint32 RewSpell;

View file

@ -1935,9 +1935,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return; return;
case 43873: // Headless Horseman Laugh case 43873: // Headless Horseman Laugh
if(caster->GetTypeId() == TYPEID_PLAYER) if(caster->GetTypeId() == TYPEID_PLAYER)
{
((Player*)caster)->PlaySound(11965, false); ((Player*)caster)->PlaySound(11965, false);
}
return; return;
case 46354: // Blood Elf Illusion case 46354: // Blood Elf Illusion
if(caster) if(caster)
@ -2489,16 +2487,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{ {
// remove other shapeshift before applying a new one // remove other shapeshift before applying a new one
if(m_target->m_ShapeShiftFormSpellId) if(m_target->m_ShapeShiftFormSpellId)
{
m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId,this); m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId,this);
}
m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form); m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form);
if(modelid > 0) if(modelid > 0)
{
m_target->SetDisplayId(modelid); m_target->SetDisplayId(modelid);
}
if(PowerType != POWER_MANA) if(PowerType != POWER_MANA)
{ {
@ -2528,17 +2522,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{ {
m_target->SetPower(POWER_ENERGY,0); m_target->SetPower(POWER_ENERGY,0);
if(urand(1,100) <= FurorChance) if(urand(1,100) <= FurorChance)
{
m_target->CastSpell(m_target,17099,true,NULL,this); m_target->CastSpell(m_target,17099,true,NULL,this);
}
} }
else else
{ {
m_target->SetPower(POWER_RAGE,0); m_target->SetPower(POWER_RAGE,0);
if(urand(1,100) <= FurorChance) if(urand(1,100) <= FurorChance)
{
m_target->CastSpell(m_target,17057,true,NULL,this); m_target->CastSpell(m_target,17057,true,NULL,this);
}
} }
break; break;
} }
@ -2930,9 +2920,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
m_target->SetCharmerGUID(0); m_target->SetCharmerGUID(0);
if(m_target->GetTypeId() == TYPEID_PLAYER) if(m_target->GetTypeId() == TYPEID_PLAYER)
{
((Player*)m_target)->setFactionForRace(m_target->getRace()); ((Player*)m_target)->setFactionForRace(m_target->getRace());
}
else if(m_target->GetTypeId() == TYPEID_UNIT) else if(m_target->GetTypeId() == TYPEID_UNIT)
{ {
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
@ -3039,9 +3027,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
m_target->SetCharmerGUID(0); m_target->SetCharmerGUID(0);
if(m_target->GetTypeId() == TYPEID_PLAYER) if(m_target->GetTypeId() == TYPEID_PLAYER)
{
((Player*)m_target)->setFactionForRace(m_target->getRace()); ((Player*)m_target)->setFactionForRace(m_target->getRace());
}
else else
{ {
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
@ -3604,9 +3590,7 @@ void Aura::HandleModTaunt(bool apply, bool Real)
return; return;
if(apply) if(apply)
{
m_target->TauntApply(caster); m_target->TauntApply(caster);
}
else else
{ {
// When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
@ -4276,18 +4260,14 @@ void Aura::HandleAuraModBaseResistancePCT(bool apply, bool Real)
{ {
//pets only have base armor //pets only have base armor
if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
{
m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply);
}
} }
else else
{ {
for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
{ {
if(m_modifier.m_miscvalue & int32(1<<x)) if(m_modifier.m_miscvalue & int32(1<<x))
{
m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply);
}
} }
} }
} }
@ -4365,9 +4345,7 @@ void Aura::HandleModPercentStat(bool apply, bool Real)
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{ {
if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1)
{
m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply);
}
} }
} }
@ -5282,9 +5260,7 @@ void Aura::HandleAuraEmpathy(bool apply, bool Real)
CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_target->GetEntry()); CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_target->GetEntry());
if(ci && ci->type == CREATURE_TYPE_BEAST) if(ci && ci->type == CREATURE_TYPE_BEAST)
{
m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}
} }
void Aura::HandleAuraUntrackable(bool apply, bool Real) void Aura::HandleAuraUntrackable(bool apply, bool Real)