mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
[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.
--HG--
branch : trunk
This commit is contained in:
5
sql/updates/54_world.sql
Normal file
5
sql/updates/54_world.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
CREATE TABLE `game_event_battleground_holiday` (
|
||||
`event` int(10) unsigned NOT NULL,
|
||||
`bgflag` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`event`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
@@ -86,6 +86,7 @@ BattleGround::BattleGround()
|
||||
|
||||
m_PrematureCountDown = false;
|
||||
m_PrematureCountDown = 0;
|
||||
m_HonorMode = BG_NORMAL;
|
||||
}
|
||||
|
||||
BattleGround::~BattleGround()
|
||||
@@ -537,7 +538,6 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
if(!Source)
|
||||
Source = plr;
|
||||
RewardMark(plr,ITEM_WINNER_COUNT);
|
||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, 20);
|
||||
RewardQuest(plr);
|
||||
}
|
||||
else
|
||||
@@ -1466,3 +1466,11 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void BattleGround::SetHoliday(bool is_holiday)
|
||||
{
|
||||
if(is_holiday)
|
||||
m_HonorMode = BG_HOLIDAY;
|
||||
else
|
||||
m_HonorMode = BG_NORMAL;
|
||||
}
|
||||
|
||||
@@ -95,8 +95,7 @@ enum BattleGroundTimeIntervals
|
||||
START_DELAY3 = 15000, // ms used only in arena
|
||||
RESPAWN_ONE_DAY = 86400, // secs
|
||||
RESPAWN_IMMEDIATELY = 0, // secs
|
||||
BUFF_RESPAWN_TIME = 180, // secs
|
||||
BG_HONOR_SCORE_TICKS = 330 // points
|
||||
BUFF_RESPAWN_TIME = 180 // secs
|
||||
};
|
||||
|
||||
enum BattleGroundBuffObjects
|
||||
@@ -239,6 +238,13 @@ class BattleGroundScore
|
||||
uint32 HealingDone;
|
||||
};
|
||||
|
||||
enum BGHonorMode
|
||||
{
|
||||
BG_NORMAL = 0,
|
||||
BG_HOLIDAY,
|
||||
BG_HONOR_MODE_NUM
|
||||
};
|
||||
|
||||
/*
|
||||
This class is used to:
|
||||
1. Add player to battleground
|
||||
@@ -432,6 +438,7 @@ class BattleGround
|
||||
// can be extended in in BG subclass
|
||||
|
||||
void HandleTriggerBuff(uint64 const& go_guid);
|
||||
void SetHoliday(bool is_holiday);
|
||||
|
||||
// TODO: make this protected:
|
||||
typedef std::vector<uint64> BGObjects;
|
||||
@@ -479,6 +486,7 @@ class BattleGround
|
||||
|
||||
bool m_BuffChange;
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
private:
|
||||
/* Battleground */
|
||||
uint32 m_TypeID; //Battleground type, defined in enum BattleGroundTypeId
|
||||
|
||||
@@ -30,6 +30,17 @@
|
||||
#include "World.h"
|
||||
#include "Util.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
uint32 BG_AB_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
|
||||
330, // normal honor
|
||||
200 // holiday
|
||||
};
|
||||
|
||||
uint32 BG_AB_ReputationScoreTicks[BG_HONOR_MODE_NUM] = {
|
||||
200, // normal honor
|
||||
150 // holiday
|
||||
};
|
||||
|
||||
BattleGroundAB::BattleGroundAB()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
@@ -186,15 +197,15 @@ void BattleGroundAB::Update(time_t diff)
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if( m_ReputationScoreTics[team] >= 200 )
|
||||
if( m_ReputationScoreTics[team] >= BG_AB_ReputationScoreTicks[m_HonorMode] )
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= 200;
|
||||
m_ReputationScoreTics[team] -= BG_AB_ReputationScoreTicks[m_HonorMode];
|
||||
}
|
||||
if( m_HonorScoreTics[team] >= BG_HONOR_SCORE_TICKS )
|
||||
if( m_HonorScoreTics[team] >= BG_AB_HonorScoreTicks[m_HonorMode] )
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardHonorToTeam(20, ALLIANCE) : RewardHonorToTeam(20, HORDE);
|
||||
m_HonorScoreTics[team] -= BG_HONOR_SCORE_TICKS;
|
||||
m_HonorScoreTics[team] -= BG_AB_HonorScoreTicks[m_HonorMode];
|
||||
}
|
||||
if( !m_IsInformedNearVictory && m_TeamScores[team] > 1800 )
|
||||
{
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
#include "World.h"
|
||||
#include "Util.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
|
||||
330, // normal honor
|
||||
200 // holiday
|
||||
};
|
||||
|
||||
BattleGroundEY::BattleGroundEY()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
@@ -159,10 +165,10 @@ void BattleGroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
uint8 team_index = GetTeamIndexByTeamId(Team);
|
||||
m_TeamScores[team_index] += Points;
|
||||
m_HonorScoreTics[team_index] += Points;
|
||||
if (m_HonorScoreTics[team_index] >= BG_HONOR_SCORE_TICKS)
|
||||
if (m_HonorScoreTics[team_index] >= BG_EY_HonorScoreTicks[m_HonorMode])
|
||||
{
|
||||
RewardHonorToTeam(20, Team);
|
||||
m_HonorScoreTics[team_index] -= BG_HONOR_SCORE_TICKS;
|
||||
m_HonorScoreTics[team_index] -= BG_EY_HonorScoreTicks[m_HonorMode];
|
||||
}
|
||||
UpdateTeamScore(Team);
|
||||
}
|
||||
|
||||
@@ -1784,3 +1784,14 @@ void BattleGroundMgr::ToggleArenaTesting()
|
||||
m_ArenaTesting = !m_ArenaTesting;
|
||||
sWorld.SendWorldText(LANG_ARENA_TESTING, m_ArenaTesting ? "on" : "off");
|
||||
}
|
||||
|
||||
void BattleGroundMgr::SetHolidayWeekends(uint32 mask)
|
||||
{
|
||||
for(uint32 bgtype = 1; bgtype <= 8; ++bgtype)
|
||||
{
|
||||
if(BattleGround * bg = GetBattleGroundTemplate(bgtype))
|
||||
{
|
||||
bg->SetHoliday(mask & (1 << bgtype));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,8 @@ class BattleGroundMgr
|
||||
void ToggleArenaTesting();
|
||||
const bool isArenaTesting() const { return m_ArenaTesting; }
|
||||
|
||||
void SetHolidayWeekends(uint32 mask);
|
||||
|
||||
private:
|
||||
|
||||
/* Battlegrounds */
|
||||
|
||||
@@ -29,6 +29,25 @@
|
||||
#include "Language.h"
|
||||
#include "World.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
enum BG_WSG_Rewards
|
||||
{
|
||||
BG_WSG_WIN = 0,
|
||||
BG_WSG_FLAG_CAP,
|
||||
BG_WSG_MAP_COMPLETE,
|
||||
BG_WSG_REWARD_NUM
|
||||
};
|
||||
|
||||
uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
|
||||
{20,40,40}, // normal honor
|
||||
{60,40,80} // holiday
|
||||
};
|
||||
|
||||
uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
|
||||
{0,35,0}, // normal honor
|
||||
{0,45,0} // holiday
|
||||
};
|
||||
|
||||
BattleGroundWS::BattleGroundWS()
|
||||
{
|
||||
m_BgObjects.resize(BG_WS_OBJECT_MAX);
|
||||
@@ -241,8 +260,8 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, 35, ALLIANCE); // +35 reputation
|
||||
RewardHonorToTeam(40, ALLIANCE); // +40 bonushonor
|
||||
RewardReputationToTeam(890, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +35 reputation
|
||||
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +40 bonushonor
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -258,8 +277,8 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, 35, HORDE); // +35 reputation
|
||||
RewardHonorToTeam(40, HORDE); // +40 bonushonor
|
||||
RewardReputationToTeam(889, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +35 reputation
|
||||
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +40 bonushonor
|
||||
}
|
||||
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
@@ -287,6 +306,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
|
||||
|
||||
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner);
|
||||
EndBattleGround(winner);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Player.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(GameEvent);
|
||||
|
||||
@@ -868,6 +869,50 @@ void GameEvent::LoadFromDB()
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// set all flags to 0
|
||||
mGameEventBattleGroundHolidays.resize(mGameEvent.size(),0);
|
||||
// load game event battleground flags
|
||||
// 0 1
|
||||
result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday");
|
||||
|
||||
count = 0;
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar3(1);
|
||||
bar3.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u battleground holidays in game events", count );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
barGoLink bar3( result->GetRowCount() );
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
bar3.step();
|
||||
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
|
||||
if(event_id >= mGameEvent.size())
|
||||
{
|
||||
sLog.outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
++count;
|
||||
|
||||
mGameEventBattleGroundHolidays[event_id] = fields[1].GetUInt32();
|
||||
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battleground holidays in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GameEvent::GetNPCFlag(Creature * cr)
|
||||
@@ -991,6 +1036,8 @@ void GameEvent::UnApplyEvent(uint16 event_id)
|
||||
UpdateEventNPCFlags(event_id);
|
||||
// remove vendor items
|
||||
UpdateEventNPCVendor(event_id, false);
|
||||
// update bg holiday
|
||||
UpdateBattleGroundSettings();
|
||||
}
|
||||
|
||||
void GameEvent::ApplyNewEvent(uint16 event_id)
|
||||
@@ -1019,6 +1066,8 @@ void GameEvent::ApplyNewEvent(uint16 event_id)
|
||||
UpdateEventNPCFlags(event_id);
|
||||
// add vendor items
|
||||
UpdateEventNPCVendor(event_id, true);
|
||||
// update bg holiday
|
||||
UpdateBattleGroundSettings();
|
||||
}
|
||||
|
||||
void GameEvent::UpdateEventNPCFlags(uint16 event_id)
|
||||
@@ -1047,6 +1096,14 @@ void GameEvent::UpdateEventNPCFlags(uint16 event_id)
|
||||
}
|
||||
}
|
||||
|
||||
void GameEvent::UpdateBattleGroundSettings()
|
||||
{
|
||||
uint32 mask = 0;
|
||||
for(ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr )
|
||||
mask |= mGameEventBattleGroundHolidays[*itr];
|
||||
sBattleGroundMgr.SetHolidayWeekends(mask);
|
||||
}
|
||||
|
||||
void GameEvent::UpdateEventNPCVendor(uint16 event_id, bool activate)
|
||||
{
|
||||
for(NPCVendorList::iterator itr = mGameEventVendors[event_id].begin(); itr != mGameEventVendors[event_id].end(); ++itr)
|
||||
|
||||
@@ -118,6 +118,7 @@ class GameEvent
|
||||
void UpdateEventQuests(uint16 event_id, bool Activate);
|
||||
void UpdateEventNPCFlags(uint16 event_id);
|
||||
void UpdateEventNPCVendor(uint16 event_id, bool activate);
|
||||
void UpdateBattleGroundSettings();
|
||||
bool CheckOneGameEventConditions(uint16 event_id);
|
||||
void SaveWorldEventStateToDB(uint16 event_id);
|
||||
bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
|
||||
@@ -141,6 +142,7 @@ class GameEvent
|
||||
typedef std::vector<NPCFlagList> GameEventNPCFlagMap;
|
||||
typedef std::pair<uint16 /*event id*/, uint32 /*gossip id*/> EventNPCGossipIdPair;
|
||||
typedef std::map<uint32 /*guid*/, EventNPCGossipIdPair> GuidEventNpcGossipIdMap;
|
||||
typedef std::vector<uint32> GameEventBitmask;
|
||||
GameEventQuestMap mGameEventCreatureQuests;
|
||||
GameEventQuestMap mGameEventGameObjectQuests;
|
||||
GameEventNPCVendorMap mGameEventVendors;
|
||||
@@ -148,6 +150,7 @@ class GameEvent
|
||||
GameEventGuidMap mGameEventCreatureGuids;
|
||||
GameEventGuidMap mGameEventGameobjectGuids;
|
||||
GameEventDataMap mGameEvent;
|
||||
GameEventBitmask mGameEventBattleGroundHolidays;
|
||||
QuestIdToEventConditionMap mQuestToEventConditions;
|
||||
GameEventNPCFlagMap mGameEventNPCFlags;
|
||||
GuidEventNpcGossipIdMap mNPCGossipIds;
|
||||
|
||||
Reference in New Issue
Block a user