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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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