Changeset 111 for trunk/src/game

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

[svn] * Fixed xp calculation for low level characters when grouped with a higher level player. Patch provided by Reiner030.
* Fixed positive spells being not resistable when cast on hostile units. Patch provided by QAston.
* Fixed compile warnings in gcc. Patch provided by WarHead?.

Original author: w12x
Date: 2008-10-26 11:50:07-05:00

Location:
trunk/src/game
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/ArenaTeam.cpp

    r102 r111  
    721721        return; 
    722722    // to get points, a player has to participate in at least 30% of the matches 
    723     uint32 min_plays = ceil(stats.games * 0.3); 
     723    uint32 min_plays = (uint32)ceil(stats.games * 0.3); 
    724724    for(MemberList::iterator itr = members.begin(); itr !=  members.end(); ++itr) 
    725725    { 
  • trunk/src/game/Formulas.h

    r102 r111  
    3030        inline uint32 hk_honor_at_level(uint32 level, uint32 count=1) 
    3131        { 
    32             return ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); 
     32            return (uint32) ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); 
    3333        } 
    3434    } 
  • trunk/src/game/GameEvent.cpp

    r102 r111  
    15281528    { 
    15291529        if(itr->second.done_world_state) 
    1530             plr->SendUpdateWorldState(itr->second.done_world_state, itr->second.done); 
     1530            plr->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done)); 
    15311531        if(itr->second.max_world_state) 
    1532             plr->SendUpdateWorldState(itr->second.max_world_state, itr->second.reqNum); 
    1533     } 
    1534 } 
     1532            plr->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum)); 
     1533    } 
     1534} 
  • trunk/src/game/Group.cpp

    r102 r111  
    2727#include "ObjectMgr.h" 
    2828#include "Group.h" 
     29#include "Formulas.h" 
    2930#include "ObjectAccessor.h" 
    3031#include "BattleGround.h" 
     
    786787} 
    787788 
    788 void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level) 
     789void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level) 
    789790{ 
    790791    for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) 
     
    799800        ++count; 
    800801        sum_level += member->getLevel(); 
     802        // store maximum member level 
    801803        if(!member_with_max_level || member_with_max_level->getLevel() < member->getLevel()) 
    802804            member_with_max_level = member; 
     805 
     806        uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel()); 
     807        // if the victim is higher level than the gray level of the currently examined group member, 
     808        // then set not_gray_member_with_max_level if needed. 
     809        if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level 
     810           || not_gray_member_with_max_level->getLevel() < member->getLevel())) 
     811            not_gray_member_with_max_level = member; 
    803812    } 
    804813} 
  • trunk/src/game/Group.h

    r102 r111  
    218218        GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); } 
    219219        uint32 GetMembersCount() const { return m_memberSlots.size(); } 
    220         void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level); 
     220        void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level); 
    221221        uint8  GetMemberGroup(uint64 guid) const 
    222222        { 
  • trunk/src/game/OutdoorPvPHP.cpp

    r102 r111  
    122122            BuffTeam(HORDE); 
    123123        else 
    124             BuffTeam(NULL); 
     124            BuffTeam(0); 
    125125        SendUpdateWorldState(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); 
    126126        SendUpdateWorldState(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled); 
  • trunk/src/game/Player.cpp

    r102 r111  
    589589        SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) ); 
    590590    // set starting gold 
    591     SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD)*10000 ); 
     591    SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD) ); 
    592592 
    593593    // set starting honor 
     
    1818818188        uint32 sum_level = 0; 
    1818918189        Player* member_with_max_level = NULL; 
    18190  
    18191         pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level); 
     18190        Player* not_gray_member_with_max_level = NULL; 
     18191 
     18192        // gets the max member level of the group, and the max member level that still gets XP 
     18193        pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level); 
    1819218194 
    1819318195        if(member_with_max_level) 
    1819418196        { 
    18195             xp = PvP ? 0 : Trinity::XP::Gain(member_with_max_level, pVictim); 
     18197            // PvP kills doesn't yield experience 
     18198            // also no XP gained if there is no member below gray level 
     18199            xp = (PvP || !not_gray_member_with_max_level) ? 0 : Trinity::XP::Gain(not_gray_member_with_max_level, pVictim); 
    1819618200 
    1819718201            // skip in check PvP case (for speed, not used) 
     
    1822318227 
    1822418228                    // XP updated only for alive group member 
    18225                     if(pGroupGuy->isAlive()) 
     18229                    if(pGroupGuy->isAlive() && not_gray_member_with_max_level && 
     18230                       pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) 
    1822618231                    { 
    18227                         uint32 itr_xp = uint32(xp*rate); 
     18232                        uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1); 
    1822818233 
    1822918234                        pGroupGuy->GiveXP(itr_xp, pVictim); 
  • trunk/src/game/Unit.cpp

    r110 r111  
    28282828    // All positive spells can`t miss 
    28292829    // TODO: client not show miss log for this spells - so need find info for this in dbc and use it! 
    2830     if (IsPositiveSpell(spell->Id)) 
     2830    if (IsPositiveSpell(spell->Id) 
     2831        &&(!IsHostileTo(pVictim)))  //prevent from affecting enemy by "positive" spell 
    28312832        return SPELL_MISS_NONE; 
    28322833 
  • trunk/src/game/World.cpp

    r110 r111  
    767767    m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100); 
    768768 
    769     // always use declined names in the russian client 
     769    // always use declined names in the Russian client 
    770770    m_configs[CONFIG_DECLINED_NAMES_USED] =  
    771771        (m_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfig.GetBoolDefault("DeclinedNames", false); 
     
    775775    m_configs[CONFIG_LISTEN_RANGE_YELL]      = sConfig.GetIntDefault("ListenRange.Yell", 300); 
    776776 
    777     m_configs[CONFIG_PLAYER_START_GOLD] = sConfig.GetFloatDefault("PlayerStart.Gold", 0); 
    778     if(m_configs[CONFIG_PLAYER_START_GOLD] < 0) 
    779         m_configs[CONFIG_PLAYER_START_GOLD] = 0; 
     777    m_configs[CONFIG_PLAYER_START_GOLD] = (uint32)(sConfig.GetFloatDefault("PlayerStart.Gold", 0.0f) * 10000.0f); 
    780778 
    781779    if(m_configs[CONFIG_PLAYER_START_GOLD] > MAX_MONEY_AMOUNT)