mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[9879] Update battleground weekend world state at start/stop event.
This commit is contained in:
parent
c4247ece32
commit
d3c34e93c9
6 changed files with 60 additions and 17 deletions
|
|
@ -2043,23 +2043,35 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
|||
sLog.outString( ">> Loaded %u battlemaster entries", count );
|
||||
}
|
||||
|
||||
bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)
|
||||
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
switch (bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_AV:
|
||||
return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_AV);
|
||||
case BATTLEGROUND_EY:
|
||||
return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_EY);
|
||||
case BATTLEGROUND_WS:
|
||||
return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_WS);
|
||||
case BATTLEGROUND_SA:
|
||||
return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_SA);
|
||||
default:
|
||||
return false;
|
||||
case BATTLEGROUND_AV: return HOLIDAY_CALL_TO_ARMS_AV;
|
||||
case BATTLEGROUND_EY: return HOLIDAY_CALL_TO_ARMS_EY;
|
||||
case BATTLEGROUND_WS: return HOLIDAY_CALL_TO_ARMS_WS;
|
||||
case BATTLEGROUND_SA: return HOLIDAY_CALL_TO_ARMS_SA;
|
||||
default: return HOLIDAY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
BattleGroundTypeId BattleGroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
|
||||
{
|
||||
switch (holiday)
|
||||
{
|
||||
case HOLIDAY_CALL_TO_ARMS_AV: return BATTLEGROUND_AV;
|
||||
case HOLIDAY_CALL_TO_ARMS_EY: return BATTLEGROUND_EY;
|
||||
case HOLIDAY_CALL_TO_ARMS_WS: return BATTLEGROUND_WS;
|
||||
case HOLIDAY_CALL_TO_ARMS_SA: return BATTLEGROUND_SA;
|
||||
default: return BATTLEGROUND_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
|
||||
}
|
||||
|
||||
void BattleGroundMgr::LoadBattleEventIndexes()
|
||||
{
|
||||
BattleGroundEventIdx events;
|
||||
|
|
|
|||
|
|
@ -272,6 +272,8 @@ class BattleGroundMgr
|
|||
static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
|
||||
static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId);
|
||||
static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
static bool IsBGWeekend(BattleGroundTypeId bgTypeId);
|
||||
private:
|
||||
ACE_Thread_Mutex SchedulerLock;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(GameEventMgr);
|
||||
|
|
@ -143,7 +144,7 @@ void GameEventMgr::LoadFromDB()
|
|||
pGameEvent.end = time_t(endtime);
|
||||
pGameEvent.occurence = fields[3].GetUInt32();
|
||||
pGameEvent.length = fields[4].GetUInt32();
|
||||
pGameEvent.holiday_id = fields[5].GetUInt32();
|
||||
pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
|
||||
|
||||
|
||||
if(pGameEvent.length==0) // length>0 is validity check
|
||||
|
|
@ -152,12 +153,12 @@ void GameEventMgr::LoadFromDB()
|
|||
continue;
|
||||
}
|
||||
|
||||
if(pGameEvent.holiday_id)
|
||||
if(pGameEvent.holiday_id != HOLIDAY_NONE)
|
||||
{
|
||||
if(!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
|
||||
{
|
||||
sLog.outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id);
|
||||
pGameEvent.holiday_id = 0;
|
||||
pGameEvent.holiday_id = HOLIDAY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -454,6 +455,7 @@ uint32 GameEventMgr::Update() // return the next e
|
|||
|
||||
// disable any event specific quest (for cases where creature is spawned, but event not active).
|
||||
UpdateEventQuests(itr, false);
|
||||
UpdateWorldStates(itr, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -477,6 +479,7 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
|
|||
ChangeEquipOrModel(event_id, false);
|
||||
// Remove quests that are events only to non event npc
|
||||
UpdateEventQuests(event_id, false);
|
||||
UpdateWorldStates(event_id, false);
|
||||
}
|
||||
|
||||
void GameEventMgr::ApplyNewEvent(uint16 event_id)
|
||||
|
|
@ -494,6 +497,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
|
|||
ChangeEquipOrModel(event_id, true);
|
||||
// Add quests that are events only to non event npc
|
||||
UpdateEventQuests(event_id, true);
|
||||
UpdateWorldStates(event_id, true);
|
||||
}
|
||||
|
||||
void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||
|
|
@ -733,6 +737,25 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool Activate)
|
|||
}
|
||||
}
|
||||
|
||||
void GameEventMgr::UpdateWorldStates(uint16 event_id, bool Activate)
|
||||
{
|
||||
GameEventData const& event = mGameEvent[event_id];
|
||||
if (event.holiday_id != HOLIDAY_NONE)
|
||||
{
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::WeekendHolidayIdToBGType(event.holiday_id);
|
||||
if (bgTypeId != BATTLEGROUND_TYPE_NONE)
|
||||
{
|
||||
BattlemasterListEntry const * bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if (bl && bl->HolidayWorldStateId)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, bl->HolidayWorldStateId, Activate ? 1 : 0);
|
||||
sWorld.SendGlobalMessage(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameEventMgr::GameEventMgr()
|
||||
{
|
||||
m_IsGameEventsInit = false;
|
||||
|
|
@ -740,6 +763,9 @@ GameEventMgr::GameEventMgr()
|
|||
|
||||
MANGOS_DLL_SPEC bool IsHolidayActive( HolidayIds id )
|
||||
{
|
||||
if (id == HOLIDAY_NONE)
|
||||
return false;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||
GameEventMgr::ActiveEvents const& ae = sGameEventMgr.GetActiveEventList();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ class GameObject;
|
|||
|
||||
struct GameEventData
|
||||
{
|
||||
GameEventData() : start(1),end(0),occurence(0),length(0) {}
|
||||
GameEventData() : start(1),end(0),occurence(0),length(0), holiday_id(HOLIDAY_NONE) {}
|
||||
time_t start;
|
||||
time_t end;
|
||||
uint32 occurence;
|
||||
uint32 length;
|
||||
uint32 holiday_id;
|
||||
HolidayIds holiday_id;
|
||||
std::string description;
|
||||
|
||||
bool isValid() const { return length > 0; }
|
||||
|
|
@ -76,6 +76,7 @@ class GameEventMgr
|
|||
void GameEventUnspawn(int16 event_id);
|
||||
void ChangeEquipOrModel(int16 event_id, bool activate);
|
||||
void UpdateEventQuests(uint16 event_id, bool Activate);
|
||||
void UpdateWorldStates(uint16 event_id, bool Activate);
|
||||
protected:
|
||||
typedef std::list<uint32> GuidList;
|
||||
typedef std::list<uint16> IdList;
|
||||
|
|
|
|||
|
|
@ -1942,6 +1942,8 @@ enum CreatureEliteType
|
|||
// values based at Holidays.dbc
|
||||
enum HolidayIds
|
||||
{
|
||||
HOLIDAY_NONE = 0,
|
||||
|
||||
HOLIDAY_FIREWORKS_SPECTACULAR = 62,
|
||||
HOLIDAY_FEAST_OF_WINTER_VEIL = 141,
|
||||
HOLIDAY_NOBLEGARDEN = 181,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9878"
|
||||
#define REVISION_NR "9879"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue