Changeset 96 for trunk

Show
Ignore:
Timestamp:
11/19/08 13:35:09 (17 years ago)
Author:
yumileroy
Message:

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

Original author: KingPin?
Date: 2008-10-22 07:02:05-05:00

Location:
trunk/src/game
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Formulas.h

    r44 r96  
    2626namespace Trinity 
    2727{ 
     28    namespace Honor 
     29    { 
     30        inline uint32 hk_honor_at_level(uint32 level, uint32 count=1) 
     31        { 
     32            return ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); 
     33        } 
     34    } 
    2835    namespace XP 
    2936    { 
  • trunk/src/game/GossipDef.cpp

    r44 r96  
    2525#include "WorldPacket.h" 
    2626#include "WorldSession.h" 
     27#include "Formulas.h" 
    2728 
    2829GossipMenu::GossipMenu() 
     
    467468    } 
    468469 
    469     data << uint32(0);                                      // Honor points reward, not implemented 
    470     data << uint32(pQuest->GetRewSpell());                  // reward spell, this spell will display (icon) (casted if RewSpellCast==0) 
     470    // rewarded honor points. Multiply with 10 to satisfy client    data << uint32(pQuest->GetRewSpell());                  // reward spell, this spell will display (icon) (casted if RewSpellCast==0) 
     471    data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); 
    471472    data << uint32(pQuest->GetRewSpellCast());              // casted spell 
    472473    data << uint32(pQuest->GetCharTitleId());               // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) 
     
    542543    data << uint32(pQuest->GetRewSpellCast());              // casted spell 
    543544 
    544     data << uint32(0);                                      // Honor points reward, not implemented 
     545    // rewarded honor points 
     546    data << uint32(Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); 
    545547    data << uint32(pQuest->GetSrcItemId()); 
    546548    data << uint32(pQuest->GetFlags() & 0xFFFF); 
     
    676678 
    677679    data << uint32(pQuest->GetRewOrReqMoney()); 
    678     data << uint32(0x00);                                   // new 2.3.0. Honor points 
     680    // rewarded honor points. Multiply with 10 to satisfy client 
     681    data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); 
    679682    data << uint32(0x08);                                   // unused by client? 
    680683    data << uint32(pQuest->GetRewSpell());                  // reward spell, this spell will display (icon) (casted if RewSpellCast==0) 
    681684    data << uint32(pQuest->GetRewSpellCast());              // casted spell 
    682     data << uint32(0);                                      // Honor points reward, not implemented 
     685    data << uint32(0x00);                                   // unk, NOT honor 
    683686    pSession->SendPacket( &data ); 
    684687    sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); 
  • trunk/src/game/ObjectMgr.cpp

    r95 r96  
    28092809    //   89              90              91              92              93              94            95            96            97            98 
    28102810        "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5," 
    2811     //   99             100               101       102           103                104               105         106     107     108 
    2812         "RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," 
    2813     //   109            110            111            112           113              114            115                116                117                118 
    2814         "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," 
    2815     //   119          120 
     2811    //   99                 100            101               102       103           104                105               106         107     108    109 
     2812        "RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," 
     2813    //   110            111            112           113              114            115                116                117                118             119        "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," 
     2814    //   120            121 
    28162815        "StartScript, CompleteScript" 
    28172816        " FROM quest_template"); 
  • trunk/src/game/Player.cpp

    r95 r96  
    1237712377    ModifyMoney( pQuest->GetRewOrReqMoney() ); 
    1237812378 
     12379    // honor reward 
     12380    if(pQuest->GetRewHonorableKills()) 
     12381        RewardHonor(NULL, 0, Trinity::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills())); 
     12382 
    1237912383    // title reward 
    1238012384    if(pQuest->GetCharTitleId()) 
  • trunk/src/game/QuestDef.cpp

    r44 r96  
    104104        RewRepValue[i] = questRecord[94+i].GetInt32(); 
    105105 
    106     RewOrReqMoney = questRecord[99].GetInt32(); 
    107     RewMoneyMaxLevel = questRecord[100].GetUInt32(); 
    108     RewSpell = questRecord[101].GetUInt32(); 
    109     RewSpellCast = questRecord[102].GetUInt32(); 
    110     RewMailTemplateId = questRecord[103].GetUInt32(); 
    111     RewMailDelaySecs = questRecord[104].GetUInt32(); 
    112     PointMapId = questRecord[105].GetUInt32(); 
    113     PointX = questRecord[106].GetFloat(); 
    114     PointY = questRecord[107].GetFloat(); 
    115     PointOpt = questRecord[108].GetUInt32(); 
     106    RewHonorableKills = questRecord[99].GetUInt32(); 
     107    RewOrReqMoney = questRecord[100].GetInt32(); 
     108    RewMoneyMaxLevel = questRecord[101].GetUInt32(); 
     109    RewSpell = questRecord[102].GetUInt32(); 
     110    RewSpellCast = questRecord[103].GetUInt32(); 
     111    RewMailTemplateId = questRecord[104].GetUInt32(); 
     112    RewMailDelaySecs = questRecord[105].GetUInt32(); 
     113    PointMapId = questRecord[106].GetUInt32(); 
     114    PointX = questRecord[107].GetFloat(); 
     115    PointY = questRecord[108].GetFloat(); 
     116    PointOpt = questRecord[109].GetUInt32(); 
    116117 
    117118    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) 
    118         DetailsEmote[i] = questRecord[109+i].GetUInt32(); 
    119  
    120     IncompleteEmote = questRecord[113].GetUInt32(); 
    121     CompleteEmote = questRecord[114].GetUInt32(); 
     119        DetailsEmote[i] = questRecord[110+i].GetUInt32(); 
     120 
     121    IncompleteEmote = questRecord[114].GetUInt32(); 
     122    CompleteEmote = questRecord[115].GetUInt32(); 
    122123 
    123124    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) 
    124         OfferRewardEmote[i] = questRecord[115+i].GetInt32(); 
    125  
    126     QuestStartScript = questRecord[119].GetUInt32(); 
    127     QuestCompleteScript = questRecord[120].GetUInt32(); 
     125        OfferRewardEmote[i] = questRecord[116+i].GetInt32(); 
     126 
     127    QuestStartScript = questRecord[120].GetUInt32(); 
     128    QuestCompleteScript = questRecord[121].GetUInt32(); 
    128129 
    129130    QuestFlags |= SpecialFlags << 16; 
  • trunk/src/game/QuestDef.h

    r44 r96  
    201201        std::string GetEndText() const { return EndText; } 
    202202        int32  GetRewOrReqMoney() const; 
     203        uint32 GetRewHonorableKills() const { return RewHonorableKills; } 
    203204        uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; } 
    204205                                                            // use in XP calculation at client 
     
    290291        std::string RequestItemsText; 
    291292        std::string EndText; 
     293        uint32 RewHonorableKills; 
    292294        int32  RewOrReqMoney; 
    293295        uint32 RewMoneyMaxLevel; 
  • trunk/src/game/SpellAuras.cpp

    r74 r96  
    19531953            case 43873:                                     // Headless Horseman Laugh 
    19541954                if(caster->GetTypeId() == TYPEID_PLAYER) 
    1955                 { 
    19561955                    ((Player*)caster)->SendPlaySound(11965, false); 
    1957                 } 
    19581956                return; 
    19591957            case 46354:                                     // Blood Elf Illusion 
     
    25072505        // remove other shapeshift before applying a new one 
    25082506        if(m_target->m_ShapeShiftFormSpellId) 
    2509         { 
    25102507            m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId,this); 
    2511         } 
    25122508 
    25132509        m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form); 
    25142510 
    25152511        if(modelid > 0) 
    2516         { 
    25172512            m_target->SetDisplayId(modelid); 
    2518         } 
    25192513 
    25202514        if(PowerType != POWER_MANA) 
     
    25462540                        m_target->SetPower(POWER_ENERGY,0); 
    25472541                        if(urand(1,100) <= FurorChance) 
    2548                         { 
    25492542                            m_target->CastSpell(m_target,17099,true,NULL,this); 
    2550                         } 
    25512543                    } 
    25522544                    else 
     
    25542546                        m_target->SetPower(POWER_RAGE,0); 
    25552547                        if(urand(1,100) <= FurorChance) 
    2556                         { 
    25572548                            m_target->CastSpell(m_target,17057,true,NULL,this); 
    2558                         } 
    25592549                    } 
    25602550                    break; 
     
    29482938 
    29492939        if(m_target->GetTypeId() == TYPEID_PLAYER) 
    2950         { 
    29512940            ((Player*)m_target)->setFactionForRace(m_target->getRace()); 
    2952         } 
     2941 
    29532942        else if(m_target->GetTypeId() == TYPEID_UNIT) 
    29542943        { 
     
    30573046 
    30583047            if(m_target->GetTypeId() == TYPEID_PLAYER) 
    3059             { 
    30603048                ((Player*)m_target)->setFactionForRace(m_target->getRace()); 
    3061             } 
    30623049            else 
    30633050            { 
     
    36433630 
    36443631    if(apply) 
    3645     { 
    36463632        m_target->TauntApply(caster); 
    3647     } 
    36483633    else 
    36493634    { 
     
    43174302        //pets only have base armor 
    43184303        if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) 
    4319         { 
    43204304            m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); 
    4321         } 
    43224305    } 
    43234306    else 
     
    43264309        { 
    43274310            if(m_modifier.m_miscvalue & int32(1<<x)) 
    4328             { 
    43294311                m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); 
    4330             } 
    43314312        } 
    43324313    } 
     
    44064387    { 
    44074388        if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) 
    4408         { 
    44094389            m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); 
    4410         } 
    44114390    } 
    44124391} 
     
    53235302    CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_target->GetEntry()); 
    53245303    if(ci && ci->type == CREATURE_TYPE_BEAST) 
    5325     { 
    53265304        m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); 
    5327     } 
    53285305} 
    53295306