TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WintergraspWorkshop Struct Reference

#include <BattlefieldWG.h>

Public Member Functions

 WintergraspWorkshop (BattlefieldWG *wg, uint8 type)
 
uint8 GetId () const
 
TeamId GetTeamControl () const
 
void AddCreature (WintergraspObjectPositionData const &obj)
 
void AddGameObject (WintergraspObjectPositionData const &obj)
 
void GiveControlTo (TeamId teamId, bool init=false)
 
void UpdateGraveyardAndWorkshop ()
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet)
 
void Save ()
 

Private Attributes

BattlefieldWG_wg
 
ObjectGuid _buildGUID
 
WintergraspGameObjectState _state
 
TeamId _teamControl
 
GuidSet _creatureOnPoint [BG_TEAMS_COUNT]
 
GuidSet _gameObjectOnPoint [BG_TEAMS_COUNT]
 
StaticWintergraspWorkshopInfo
const
_staticInfo
 

Constructor & Destructor Documentation

WintergraspWorkshop::WintergraspWorkshop ( BattlefieldWG wg,
uint8  type 
)
1425 {
1426  ASSERT(wg && type < WG_MAX_WORKSHOP);
1427 
1428  _wg = wg;
1431  _staticInfo = &WorkshopData[type];
1432 }
Definition: SharedDefines.h:994
StaticWintergraspWorkshopInfo const * _staticInfo
Definition: BattlefieldWG.h:1163
uint8 const WG_MAX_WORKSHOP
Definition: BattlefieldWG.h:448
BattlefieldWG * _wg
Definition: BattlefieldWG.h:1156
WintergraspGameObjectState _state
Definition: BattlefieldWG.h:1158
TeamId _teamControl
Definition: BattlefieldWG.h:1159
StaticWintergraspWorkshopInfo const WorkshopData[WG_MAX_WORKSHOP]
Definition: BattlefieldWG.h:1085
Definition: BattlefieldWG.h:463
#define ASSERT
Definition: Errors.h:55

Member Function Documentation

void WintergraspWorkshop::AddCreature ( WintergraspObjectPositionData const obj)
1435 {
1436  if (Creature* creature = _wg->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
1437  _creatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
1438 
1439  if (Creature* creature = _wg->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
1440  _creatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID());
1441 }
GuidSet _creatureOnPoint[BG_TEAMS_COUNT]
Definition: BattlefieldWG.h:1160
Definition: Creature.h:467
virtual Creature * SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId)
Definition: Battlefield.cpp:777
Definition: SharedDefines.h:992
BattlefieldWG * _wg
Definition: BattlefieldWG.h:1156
Definition: SharedDefines.h:993

+ Here is the call graph for this function:

void WintergraspWorkshop::AddGameObject ( WintergraspObjectPositionData const obj)
1444 {
1445  if (GameObject* go = _wg->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
1446  _gameObjectOnPoint[TEAM_HORDE].insert(go->GetGUID());
1447  if (GameObject* go = _wg->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
1448  _gameObjectOnPoint[TEAM_ALLIANCE].insert(go->GetGUID());
1449 }
GuidSet _gameObjectOnPoint[BG_TEAMS_COUNT]
Definition: BattlefieldWG.h:1161
GameObject * SpawnGameObject(uint32 entry, float x, float y, float z, float o)
Definition: Battlefield.cpp:812
Definition: SharedDefines.h:992
Definition: GameObject.h:880
BattlefieldWG * _wg
Definition: BattlefieldWG.h:1156
Definition: SharedDefines.h:993

+ Here is the call graph for this function:

void WintergraspWorkshop::FillInitialWorldStates ( WorldPackets::WorldState::InitWorldStates packet)
1553 {
1554  packet.Worldstates.emplace_back(uint32(_staticInfo->WorldStateId), int32(_state));
1555 }
std::list< WorldStateInfo > Worldstates
Definition: WorldStatePackets.h:47
uint32 WorldStateId
Definition: BattlefieldWG.h:1074
StaticWintergraspWorkshopInfo const * _staticInfo
Definition: BattlefieldWG.h:1163
int32_t int32
Definition: Define.h:146
WintergraspGameObjectState _state
Definition: BattlefieldWG.h:1158
uint32_t uint32
Definition: g3dmath.h:168
uint8 WintergraspWorkshop::GetId ( ) const
inline
1168 { return _staticInfo->WorkshopId; }
uint8 WorkshopId
Definition: BattlefieldWG.h:1073
StaticWintergraspWorkshopInfo const * _staticInfo
Definition: BattlefieldWG.h:1163
TeamId WintergraspWorkshop::GetTeamControl ( ) const
inline
1169 { return _teamControl; }
TeamId _teamControl
Definition: BattlefieldWG.h:1159
void WintergraspWorkshop::GiveControlTo ( TeamId  teamId,
bool  init = false 
)
1452 {
1453  switch (teamId)
1454  {
1455  case TEAM_NEUTRAL:
1456  {
1457  // Send warning message to all player for inform a faction attack a workshop
1458  // alliance / horde attacking workshop
1460  break;
1461  }
1462  case TEAM_ALLIANCE:
1463  {
1464  // Show Alliance creature
1466  if (Creature* creature = _wg->GetCreature(guid))
1467  _wg->ShowNpc(creature, creature->GetEntry() != 30499);
1468 
1469  // Hide Horde creature
1470  for (ObjectGuid guid : _creatureOnPoint[TEAM_HORDE])
1471  if (Creature* creature = _wg->GetCreature(guid))
1472  _wg->HideNpc(creature);
1473 
1474  // Show Alliance gameobject
1475  for (ObjectGuid guid : _gameObjectOnPoint[TEAM_ALLIANCE])
1476  if (GameObject* go = _wg->GetGameObject(guid))
1477  go->SetRespawnTime(RESPAWN_IMMEDIATELY);
1478 
1479  // Hide Horde gameobject
1480  for (ObjectGuid guid : _gameObjectOnPoint[TEAM_HORDE])
1481  if (GameObject* go = _wg->GetGameObject(guid))
1482  go->SetRespawnTime(RESPAWN_ONE_DAY);
1483 
1484 
1485  // Updating worldstate
1488 
1489  // Warning message
1490  if (!init)
1491  _wg->SendWarning(_staticInfo->TextIds.AllianceCapture); // workshop taken - alliance
1492 
1493  // Found associate graveyard and update it
1496  gy->GiveControlTo(TEAM_ALLIANCE);
1497 
1498  _teamControl = teamId;
1499  break;
1500  }
1501  case TEAM_HORDE:
1502  {
1503  // Show Horde creature
1504  for (ObjectGuid guid : _creatureOnPoint[TEAM_HORDE])
1505  if (Creature* creature = _wg->GetCreature(guid))
1506  _wg->ShowNpc(creature, creature->GetEntry() != 30400);
1507 
1508  // Hide Alliance creature
1509  for (ObjectGuid guid : _creatureOnPoint[TEAM_ALLIANCE])
1510  if (Creature* creature = _wg->GetCreature(guid))
1511  _wg->HideNpc(creature);
1512 
1513  // Hide Alliance gameobject
1514  for (ObjectGuid guid : _gameObjectOnPoint[TEAM_ALLIANCE])
1515  if (GameObject* go = _wg->GetGameObject(guid))
1516  go->SetRespawnTime(RESPAWN_ONE_DAY);
1517 
1518  // Show Horde gameobject
1519  for (ObjectGuid guid : _gameObjectOnPoint[TEAM_HORDE])
1520  if (GameObject* go = _wg->GetGameObject(guid))
1521  go->SetRespawnTime(RESPAWN_IMMEDIATELY);
1522 
1523  // Update worldstate
1526 
1527  // Warning message
1528  if (!init)
1529  _wg->SendWarning(_staticInfo->TextIds.HordeCapture); // workshop taken - horde
1530 
1531  // Update graveyard control
1534  gy->GiveControlTo(TEAM_HORDE);
1535 
1536  _teamControl = teamId;
1537  break;
1538  }
1539  }
1540  if (!init)
1541  _wg->UpdateCounterVehicle(false);
1542 }
Definition: Battleground.h:129
Definition: BattlefieldWG.h:467
GuidSet _gameObjectOnPoint[BG_TEAMS_COUNT]
Definition: BattlefieldWG.h:1161
uint8 AllianceAttack
Definition: BattlefieldWG.h:1079
void HideNpc(Creature *creature)
Definition: Battlefield.cpp:472
Definition: BattlefieldWG.h:492
GuidSet _creatureOnPoint[BG_TEAMS_COUNT]
Definition: BattlefieldWG.h:1160
uint32 WorldStateId
Definition: BattlefieldWG.h:1074
void UpdateCounterVehicle(bool init)
Definition: BattlefieldWG.cpp:271
Definition: BattlefieldWG.h:470
uint8 WorkshopId
Definition: BattlefieldWG.h:1073
Definition: Creature.h:467
void SendWarning(uint8 id, WorldObject const *target=nullptr)
Definition: Battlefield.cpp:433
Definition: SharedDefines.h:994
StaticWintergraspWorkshopInfo const * _staticInfo
Definition: BattlefieldWG.h:1163
void ShowNpc(Creature *creature, bool aggressive)
Definition: Battlefield.cpp:481
BfGraveyard * GetGraveyardById(uint32 id) const
Definition: Battlefield.cpp:556
Creature * GetCreature(ObjectGuid guid)
Definition: Battlefield.cpp:845
Definition: SharedDefines.h:992
Definition: GameObject.h:880
Definition: Battleground.h:128
BattlefieldWG * _wg
Definition: BattlefieldWG.h:1156
WintergraspGameObjectState _state
Definition: BattlefieldWG.h:1158
TeamId _teamControl
Definition: BattlefieldWG.h:1159
uint8 HordeAttack
Definition: BattlefieldWG.h:1081
void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Update data of a worldstate to all players present in zone.
Definition: Battlefield.cpp:439
uint8 HordeCapture
Definition: BattlefieldWG.h:1080
Definition: ObjectGuid.h:189
struct StaticWintergraspWorkshopInfo::@211 TextIds
Definition: SharedDefines.h:993
uint8 AllianceCapture
Definition: BattlefieldWG.h:1078
GameObject * GetGameObject(ObjectGuid guid)
Definition: Battlefield.cpp:852
Definition: Battlefield.h:149

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WintergraspWorkshop::Save ( )
1558 {
1559  sWorld->setWorldState(_staticInfo->WorldStateId, _state);
1560 }
uint32 WorldStateId
Definition: BattlefieldWG.h:1074
#define sWorld
Definition: World.h:887
StaticWintergraspWorkshopInfo const * _staticInfo
Definition: BattlefieldWG.h:1163
WintergraspGameObjectState _state
Definition: BattlefieldWG.h:1158
void WintergraspWorkshop::UpdateGraveyardAndWorkshop ( )
1545 {
1548  else
1549  GiveControlTo(_wg->GetDefenderTeam(), true);
1550 }
Definition: BattlefieldWG.h:492
uint8 WorkshopId
Definition: BattlefieldWG.h:1073
void GiveControlTo(TeamId teamId, bool init=false)
Definition: BattlefieldWG.cpp:1451
StaticWintergraspWorkshopInfo const * _staticInfo
Definition: BattlefieldWG.h:1163
BfGraveyard * GetGraveyardById(uint32 id) const
Definition: Battlefield.cpp:556
BattlefieldWG * _wg
Definition: BattlefieldWG.h:1156
TeamId _teamControl
Definition: BattlefieldWG.h:1159
void GiveControlTo(TeamId team)
Definition: Battlefield.cpp:720
TeamId GetDefenderTeam() const
Definition: Battlefield.h:271

+ Here is the call graph for this function:

Member Data Documentation

ObjectGuid WintergraspWorkshop::_buildGUID
private
GuidSet WintergraspWorkshop::_creatureOnPoint[BG_TEAMS_COUNT]
private
GuidSet WintergraspWorkshop::_gameObjectOnPoint[BG_TEAMS_COUNT]
private
WintergraspGameObjectState WintergraspWorkshop::_state
private
StaticWintergraspWorkshopInfo const* WintergraspWorkshop::_staticInfo
private
TeamId WintergraspWorkshop::_teamControl
private
BattlefieldWG* WintergraspWorkshop::_wg
private

The documentation for this struct was generated from the following files: