Changeset 50

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

[svn] Enabled game events to change the honor and reputation gaining speed in battlegrounds. This is done by a new table in the world database, game_event_battleground_holiday. Structure is the following:
event - id of the game event
bgflag - bitmask, used to set which battleground(s) give extra honor/reputation when the event is active. To add extra honor on a battleground, use 2 bgTypeId as mask. Multiple battlegrounds can be set by logical 'or' ('|') operation.
You will need database data for the table, please check trinitydatabase.org.

Original author: w12x
Date: 2008-10-17 16:36:07-05:00

Location:
trunk
Files:
1 added
9 modified

Legend:

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

    r44 r50  
    8787    m_PrematureCountDown = false; 
    8888    m_PrematureCountDown = 0; 
     89    m_HonorMode = BG_NORMAL; 
    8990} 
    9091 
     
    538539                Source = plr; 
    539540            RewardMark(plr,ITEM_WINNER_COUNT); 
    540             UpdatePlayerScore(plr, SCORE_BONUS_HONOR, 20); 
    541541            RewardQuest(plr); 
    542542        } 
     
    14671467    return count; 
    14681468} 
     1469 
     1470void BattleGround::SetHoliday(bool is_holiday) 
     1471{ 
     1472    if(is_holiday) 
     1473        m_HonorMode = BG_HOLIDAY; 
     1474    else 
     1475        m_HonorMode = BG_NORMAL; 
     1476} 
  • trunk/src/game/BattleGround.h

    r44 r50  
    9696    RESPAWN_ONE_DAY                 = 86400,                // secs 
    9797    RESPAWN_IMMEDIATELY             = 0,                    // secs 
    98     BUFF_RESPAWN_TIME               = 180,                  // secs 
    99     BG_HONOR_SCORE_TICKS            = 330                   // points 
     98    BUFF_RESPAWN_TIME               = 180                  // secs 
    10099}; 
    101100 
     
    240239}; 
    241240 
     241enum BGHonorMode 
     242{ 
     243    BG_NORMAL = 0, 
     244    BG_HOLIDAY, 
     245    BG_HONOR_MODE_NUM 
     246}; 
     247 
    242248/* 
    243249This class is used to: 
     
    433439 
    434440        void HandleTriggerBuff(uint64 const& go_guid); 
     441        void SetHoliday(bool is_holiday); 
    435442 
    436443        // TODO: make this protected: 
     
    480487        bool   m_BuffChange; 
    481488 
     489        BGHonorMode m_HonorMode; 
    482490    private: 
    483491        /* Battleground */ 
  • trunk/src/game/BattleGroundAB.cpp

    r44 r50  
    3030#include "World.h" 
    3131#include "Util.h" 
     32 
     33// these variables aren't used outside of this file, so declare them only here 
     34uint32 BG_AB_HonorScoreTicks[BG_HONOR_MODE_NUM] = { 
     35    330, // normal honor 
     36    200  // holiday 
     37}; 
     38 
     39uint32 BG_AB_ReputationScoreTicks[BG_HONOR_MODE_NUM] = { 
     40    200, // normal honor 
     41    150  // holiday 
     42}; 
    3243 
    3344BattleGroundAB::BattleGroundAB() 
     
    187198                m_HonorScoreTics[team] += BG_AB_TickPoints[points]; 
    188199                m_ReputationScoreTics[team] += BG_AB_TickPoints[points]; 
    189                 if( m_ReputationScoreTics[team] >= 200 ) 
     200                if( m_ReputationScoreTics[team] >= BG_AB_ReputationScoreTicks[m_HonorMode] ) 
    190201                { 
    191202                    (team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE); 
    192                     m_ReputationScoreTics[team] -= 200; 
     203                    m_ReputationScoreTics[team] -= BG_AB_ReputationScoreTicks[m_HonorMode]; 
    193204                } 
    194                 if( m_HonorScoreTics[team] >= BG_HONOR_SCORE_TICKS ) 
     205                if( m_HonorScoreTics[team] >= BG_AB_HonorScoreTicks[m_HonorMode] ) 
    195206                { 
    196207                    (team == BG_TEAM_ALLIANCE) ? RewardHonorToTeam(20, ALLIANCE) : RewardHonorToTeam(20, HORDE); 
    197                     m_HonorScoreTics[team] -= BG_HONOR_SCORE_TICKS; 
     208                    m_HonorScoreTics[team] -= BG_AB_HonorScoreTicks[m_HonorMode]; 
    198209                } 
    199210                if( !m_IsInformedNearVictory && m_TeamScores[team] > 1800 ) 
  • trunk/src/game/BattleGroundEY.cpp

    r44 r50  
    3131#include "Util.h" 
    3232 
     33// these variables aren't used outside of this file, so declare them only here 
     34uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = { 
     35    330, // normal honor 
     36    200  // holiday 
     37}; 
     38 
    3339BattleGroundEY::BattleGroundEY() 
    3440{ 
     
    160166    m_TeamScores[team_index] += Points; 
    161167    m_HonorScoreTics[team_index] += Points; 
    162     if (m_HonorScoreTics[team_index] >= BG_HONOR_SCORE_TICKS) 
     168    if (m_HonorScoreTics[team_index] >= BG_EY_HonorScoreTicks[m_HonorMode]) 
    163169    { 
    164170        RewardHonorToTeam(20, Team); 
    165         m_HonorScoreTics[team_index] -= BG_HONOR_SCORE_TICKS; 
     171        m_HonorScoreTics[team_index] -= BG_EY_HonorScoreTicks[m_HonorMode]; 
    166172    } 
    167173    UpdateTeamScore(Team); 
  • trunk/src/game/BattleGroundMgr.cpp

    r44 r50  
    17851785    sWorld.SendWorldText(LANG_ARENA_TESTING, m_ArenaTesting ? "on" : "off"); 
    17861786} 
     1787 
     1788void BattleGroundMgr::SetHolidayWeekends(uint32 mask) 
     1789{ 
     1790    for(uint32 bgtype = 1; bgtype <= 8; ++bgtype) 
     1791    { 
     1792        if(BattleGround * bg = GetBattleGroundTemplate(bgtype)) 
     1793        { 
     1794            bg->SetHoliday(mask & (1 << bgtype)); 
     1795        } 
     1796    } 
     1797} 
  • trunk/src/game/BattleGroundMgr.h

    r44 r50  
    235235        const bool isArenaTesting() const { return m_ArenaTesting; } 
    236236 
     237        void SetHolidayWeekends(uint32 mask); 
     238 
    237239    private: 
    238240 
  • trunk/src/game/BattleGroundWS.cpp

    r49 r50  
    3030#include "World.h" 
    3131 
     32// these variables aren't used outside of this file, so declare them only here 
     33enum BG_WSG_Rewards 
     34{ 
     35    BG_WSG_WIN = 0, 
     36    BG_WSG_FLAG_CAP, 
     37    BG_WSG_MAP_COMPLETE, 
     38    BG_WSG_REWARD_NUM 
     39}; 
     40 
     41uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { 
     42    {20,40,40}, // normal honor 
     43    {60,40,80}  // holiday 
     44}; 
     45 
     46uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { 
     47    {0,35,0}, // normal honor 
     48    {0,45,0}  // holiday 
     49}; 
     50 
    3251BattleGroundWS::BattleGroundWS() 
    3352{ 
     
    242261            AddPoint(ALLIANCE, 1); 
    243262        PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); 
    244         RewardReputationToTeam(890, 35, ALLIANCE);          // +35 reputation 
    245         RewardHonorToTeam(40, ALLIANCE);                    // +40 bonushonor 
     263        RewardReputationToTeam(890, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE);          // +35 reputation 
     264        RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE);                    // +40 bonushonor 
    246265    } 
    247266    else 
     
    259278            AddPoint(HORDE, 1); 
    260279        PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); 
    261         RewardReputationToTeam(889, 35, HORDE);             // +35 reputation 
    262         RewardHonorToTeam(40, HORDE);                       // +40 bonushonor 
     280        RewardReputationToTeam(889, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], HORDE);             // +35 reputation 
     281        RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], HORDE);                       // +40 bonushonor 
    263282    } 
    264283 
     
    288307        UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); 
    289308 
     309        RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner); 
    290310        EndBattleGround(winner); 
    291311    } 
  • trunk/src/game/GameEvent.cpp

    r44 r50  
    2929#include "GossipDef.h" 
    3030#include "Player.h" 
     31#include "BattleGroundMgr.h" 
    3132 
    3233INSTANTIATE_SINGLETON_1(GameEvent); 
     
    866867        sLog.outString(); 
    867868        sLog.outString( ">> Loaded %u npc gossip textids in game events", count ); 
     869 
     870        delete result; 
     871    } 
     872 
     873    // set all flags to 0 
     874    mGameEventBattleGroundHolidays.resize(mGameEvent.size(),0); 
     875    // load game event battleground flags 
     876    //                                   0     1 
     877    result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday"); 
     878 
     879    count = 0; 
     880    if( !result ) 
     881    { 
     882        barGoLink bar3(1); 
     883        bar3.step(); 
     884 
     885        sLog.outString(); 
     886        sLog.outString(">> Loaded %u battleground holidays in game events", count ); 
     887    } 
     888    else 
     889    { 
     890 
     891        barGoLink bar3( result->GetRowCount() ); 
     892        do 
     893        { 
     894            Field *fields = result->Fetch(); 
     895 
     896            bar3.step(); 
     897 
     898            uint16 event_id = fields[0].GetUInt16(); 
     899 
     900            if(event_id >= mGameEvent.size()) 
     901            { 
     902                sLog.outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`",event_id); 
     903                continue; 
     904            } 
     905 
     906            ++count; 
     907 
     908            mGameEventBattleGroundHolidays[event_id] = fields[1].GetUInt32(); 
     909 
     910        } while( result->NextRow() ); 
     911        sLog.outString(); 
     912        sLog.outString( ">> Loaded %u battleground holidays in game events", count ); 
    868913 
    869914        delete result; 
     
    9921037    // remove vendor items 
    9931038    UpdateEventNPCVendor(event_id, false); 
     1039    // update bg holiday 
     1040    UpdateBattleGroundSettings(); 
    9941041} 
    9951042 
     
    10201067    // add vendor items 
    10211068    UpdateEventNPCVendor(event_id, true); 
     1069    // update bg holiday 
     1070    UpdateBattleGroundSettings(); 
    10221071} 
    10231072 
     
    10461095        } 
    10471096    } 
     1097} 
     1098 
     1099void GameEvent::UpdateBattleGroundSettings() 
     1100{ 
     1101    uint32 mask = 0; 
     1102    for(ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr ) 
     1103        mask |= mGameEventBattleGroundHolidays[*itr]; 
     1104    sBattleGroundMgr.SetHolidayWeekends(mask); 
    10481105} 
    10491106 
  • trunk/src/game/GameEvent.h

    r44 r50  
    119119        void UpdateEventNPCFlags(uint16 event_id); 
    120120        void UpdateEventNPCVendor(uint16 event_id, bool activate); 
     121        void UpdateBattleGroundSettings(); 
    121122        bool CheckOneGameEventConditions(uint16 event_id); 
    122123        void SaveWorldEventStateToDB(uint16 event_id); 
     
    142143        typedef std::pair<uint16 /*event id*/, uint32 /*gossip id*/> EventNPCGossipIdPair; 
    143144        typedef std::map<uint32 /*guid*/, EventNPCGossipIdPair> GuidEventNpcGossipIdMap; 
     145        typedef std::vector<uint32> GameEventBitmask; 
    144146        GameEventQuestMap mGameEventCreatureQuests; 
    145147        GameEventQuestMap mGameEventGameObjectQuests; 
     
    149151        GameEventGuidMap  mGameEventGameobjectGuids; 
    150152        GameEventDataMap  mGameEvent; 
     153        GameEventBitmask  mGameEventBattleGroundHolidays; 
    151154        QuestIdToEventConditionMap mQuestToEventConditions; 
    152155        GameEventNPCFlagMap mGameEventNPCFlags;