[svn] * Implement honor rewards from quests - Source Mangos

--HG--
branch : trunk
This commit is contained in:
KingPin
2008-10-22 07:02:05 -05:00
parent bde02d6829
commit 14598dd84f
7 changed files with 43 additions and 50 deletions
+7
View File
@@ -25,6 +25,13 @@
namespace Trinity
{
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
{
typedef enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY };
+8 -5
View File
@@ -24,6 +24,7 @@
#include "Opcodes.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Formulas.h"
GossipMenu::GossipMenu()
{
@@ -466,8 +467,8 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
data << uint32(pQuest->GetRewOrReqMoney());
}
data << uint32(0); // Honor points reward, not implemented
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
// rewarded honor points. Multiply with 10 to satisfy client data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << uint32(pQuest->GetRewSpellCast()); // casted spell
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -541,7 +542,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->GetRewSpellCast()); // casted spell
data << uint32(0); // Honor points reward, not implemented
// rewarded honor points
data << uint32(Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << uint32(pQuest->GetSrcItemId());
data << uint32(pQuest->GetFlags() & 0xFFFF);
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -675,11 +677,12 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
}
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*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
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
data << uint32(0); // Honor points reward, not implemented
data << uint32(0x00); // unk, NOT honor
pSession->SendPacket( &data );
sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() );
}
+4 -5
View File
@@ -2808,11 +2808,10 @@ void ObjectMgr::LoadQuests()
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 89 90 91 92 93 94 95 96 97 98
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 99 100 101 102 103 104 105 106 107 108
"RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 109 110 111 112 113 114 115 116 117 118
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 119 120
// 99 100 101 102 103 104 105 106 107 108 109
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 110 111 112 113 114 115 116 117 118 119 "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 120 121
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
+4
View File
@@ -12376,6 +12376,10 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
ModifyMoney( pQuest->GetRewOrReqMoney() );
// honor reward
if(pQuest->GetRewHonorableKills())
RewardHonor(NULL, 0, Trinity::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills()));
// title reward
if(pQuest->GetCharTitleId())
{
+17 -16
View File
@@ -103,28 +103,29 @@ Quest::Quest(Field * questRecord)
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[94+i].GetInt32();
RewOrReqMoney = questRecord[99].GetInt32();
RewMoneyMaxLevel = questRecord[100].GetUInt32();
RewSpell = questRecord[101].GetUInt32();
RewSpellCast = questRecord[102].GetUInt32();
RewMailTemplateId = questRecord[103].GetUInt32();
RewMailDelaySecs = questRecord[104].GetUInt32();
PointMapId = questRecord[105].GetUInt32();
PointX = questRecord[106].GetFloat();
PointY = questRecord[107].GetFloat();
PointOpt = questRecord[108].GetUInt32();
RewHonorableKills = questRecord[99].GetUInt32();
RewOrReqMoney = questRecord[100].GetInt32();
RewMoneyMaxLevel = questRecord[101].GetUInt32();
RewSpell = questRecord[102].GetUInt32();
RewSpellCast = questRecord[103].GetUInt32();
RewMailTemplateId = questRecord[104].GetUInt32();
RewMailDelaySecs = questRecord[105].GetUInt32();
PointMapId = questRecord[106].GetUInt32();
PointX = questRecord[107].GetFloat();
PointY = questRecord[108].GetFloat();
PointOpt = questRecord[109].GetUInt32();
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();
CompleteEmote = questRecord[114].GetUInt32();
IncompleteEmote = questRecord[114].GetUInt32();
CompleteEmote = questRecord[115].GetUInt32();
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();
QuestCompleteScript = questRecord[120].GetUInt32();
QuestStartScript = questRecord[120].GetUInt32();
QuestCompleteScript = questRecord[121].GetUInt32();
QuestFlags |= SpecialFlags << 16;
+2
View File
@@ -200,6 +200,7 @@ class Quest
std::string GetRequestItemsText() const { return RequestItemsText; }
std::string GetEndText() const { return EndText; }
int32 GetRewOrReqMoney() const;
uint32 GetRewHonorableKills() const { return RewHonorableKills; }
uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; }
// use in XP calculation at client
uint32 GetRewSpell() const { return RewSpell; }
@@ -289,6 +290,7 @@ class Quest
std::string OfferRewardText;
std::string RequestItemsText;
std::string EndText;
uint32 RewHonorableKills;
int32 RewOrReqMoney;
uint32 RewMoneyMaxLevel;
uint32 RewSpell;
+1 -24
View File
@@ -1952,9 +1952,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return;
case 43873: // Headless Horseman Laugh
if(caster->GetTypeId() == TYPEID_PLAYER)
{
((Player*)caster)->SendPlaySound(11965, false);
}
return;
case 46354: // Blood Elf Illusion
if(caster)
@@ -2506,16 +2504,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{
// remove other shapeshift before applying a new one
if(m_target->m_ShapeShiftFormSpellId)
{
m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId,this);
}
m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form);
if(modelid > 0)
{
m_target->SetDisplayId(modelid);
}
if(PowerType != POWER_MANA)
{
@@ -2545,17 +2539,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{
m_target->SetPower(POWER_ENERGY,0);
if(urand(1,100) <= FurorChance)
{
m_target->CastSpell(m_target,17099,true,NULL,this);
}
}
else
{
m_target->SetPower(POWER_RAGE,0);
if(urand(1,100) <= FurorChance)
{
m_target->CastSpell(m_target,17057,true,NULL,this);
}
}
break;
}
@@ -2947,9 +2937,8 @@ void Aura::HandleModPossess(bool apply, bool Real)
m_target->SetCharmerGUID(0);
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
((Player*)m_target)->setFactionForRace(m_target->getRace());
}
else if(m_target->GetTypeId() == TYPEID_UNIT)
{
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
@@ -3056,9 +3045,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
m_target->SetCharmerGUID(0);
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
((Player*)m_target)->setFactionForRace(m_target->getRace());
}
else
{
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
@@ -3642,9 +3629,7 @@ void Aura::HandleModTaunt(bool apply, bool Real)
return;
if(apply)
{
m_target->TauntApply(caster);
}
else
{
// When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
@@ -4316,18 +4301,14 @@ void Aura::HandleAuraModBaseResistancePCT(bool apply, bool Real)
{
//pets only have base armor
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);
}
}
else
{
for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;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);
}
}
}
}
@@ -4405,9 +4386,7 @@ void Aura::HandleModPercentStat(bool apply, bool Real)
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
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);
}
}
}
@@ -5322,9 +5301,7 @@ void Aura::HandleAuraEmpathy(bool apply, bool Real)
CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_target->GetEntry());
if(ci && ci->type == CREATURE_TYPE_BEAST)
{
m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}
}
void Aura::HandleAuraUntrackable(bool apply, bool Real)