AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WGWorkshop Struct Reference

#include "BattlefieldWG.h"

Public Member Functions

 WGWorkshop (BattlefieldWG *_bf, uint8 _workshopId)
 
void GiveControlTo (TeamId team, bool init)
 
void UpdateGraveyardAndWorkshop ()
 
void Save ()
 

Public Attributes

BattlefieldWGbf
 
uint8 workshopId
 
TeamId teamControl
 
uint32 state
 

Detailed Description

Constructor & Destructor Documentation

◆ WGWorkshop()

WGWorkshop::WGWorkshop ( BattlefieldWG _bf,
uint8  _workshopId 
)
inline
1459 {
1460 ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
1461
1462 bf = _bf;
1463 workshopId = _workshopId;
1466 }
#define ASSERT
Definition: Errors.h:68
uint8 const WG_MAX_WORKSHOP
Definition: BattlefieldWG.h:1064
@ BATTLEFIELD_WG_OBJECTSTATE_NONE
Definition: BattlefieldWG.h:499
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
TeamId teamControl
Definition: BattlefieldWG.h:1454
uint32 state
Definition: BattlefieldWG.h:1456
uint8 workshopId
Definition: BattlefieldWG.h:1452
BattlefieldWG * bf
Definition: BattlefieldWG.h:1450

References ASSERT, BATTLEFIELD_WG_OBJECTSTATE_NONE, bf, state, TEAM_NEUTRAL, teamControl, WG_MAX_WORKSHOP, and workshopId.

Member Function Documentation

◆ GiveControlTo()

void WGWorkshop::GiveControlTo ( TeamId  team,
bool  init 
)
inline
1469 {
1470 switch (team)
1471 {
1472 case TEAM_NEUTRAL:
1473 {
1474 // Send warning message to all player to inform a faction attack to a workshop
1475 // alliance / horde attacking a workshop
1476 bf->SendWarning(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
1477
1478 // Updating worldstate, update icon to neutral
1481
1482 // Found associate graveyard and update it
1486
1487 teamControl = team;
1488 break;
1489 }
1490 case TEAM_ALLIANCE:
1491 case TEAM_HORDE:
1492 {
1493 // Updating worldstate
1496
1497 // Warning message
1498 if (!init) // workshop taken - alliance
1499 bf->SendWarning(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
1500
1501 // Found associate graveyard and update it
1505
1506 teamControl = team;
1507 break;
1508 }
1509 }
1510
1511 if (!init)
1512 {
1513 bf->UpdateCounterVehicle(false);
1515 }
1516 }
const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP]
Definition: BattlefieldWG.h:1074
@ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT
Definition: BattlefieldWG.h:500
@ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT
Definition: BattlefieldWG.h:506
@ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT
Definition: BattlefieldWG.h:503
@ BATTLEFIELD_WG_WORKSHOP_KEEP_WEST
Definition: BattlefieldWG.h:517
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
void GiveControlTo(TeamId team)
Definition: Battlefield.cpp:746
void SendWarning(uint8 id, WorldObject const *target=nullptr)
Definition: Battlefield.cpp:473
BfGraveyard * GetGraveyardById(uint32 id) const
Definition: Battlefield.cpp:581
void SendUpdateWorldState(uint32 field, uint32 value)
Update data of a worldstate to all players present in zone.
Definition: Battlefield.cpp:479
void UpdateCounterVehicle(bool init)
Vehicle world states update.
Definition: BattlefieldWG.cpp:297
uint32 GetAreaByGraveyardId(uint8 gId) const
Definition: BattlefieldWG.cpp:539
void CapturePointTaken(uint32 areaId)
Definition: BattlefieldWG.cpp:335

References BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT, BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT, BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT, BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, bf, BattlefieldWG::CapturePointTaken(), BattlefieldWG::GetAreaByGraveyardId(), Battlefield::GetGraveyardById(), BfGraveyard::GiveControlTo(), Battlefield::SendUpdateWorldState(), Battlefield::SendWarning(), state, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, teamControl, BattlefieldWG::UpdateCounterVehicle(), workshopId, and WorkshopsData.

Referenced by WintergraspCapturePoint::ChangeTeam(), BattlefieldWG::SetupBattlefield(), and UpdateGraveyardAndWorkshop().

◆ Save()

void WGWorkshop::Save ( )
inline
1527 {
1528 sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state);
1529 }
#define sWorld
Definition: World.h:444

References state, sWorld, workshopId, and WorkshopsData.

◆ UpdateGraveyardAndWorkshop()

void WGWorkshop::UpdateGraveyardAndWorkshop ( )
inline
1519 {
1522 else
1524 }
TeamId
Definition: SharedDefines.h:759
TeamId GetDefenderTeam()
Definition: Battlefield.h:277
void GiveControlTo(TeamId team, bool init)
Definition: BattlefieldWG.h:1468

References BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, bf, Battlefield::GetDefenderTeam(), Battlefield::GetGraveyardById(), BfGraveyard::GiveControlTo(), GiveControlTo(), teamControl, and workshopId.

Member Data Documentation

◆ bf

◆ state

uint32 WGWorkshop::state

Referenced by GiveControlTo(), Save(), and WGWorkshop().

◆ teamControl

TeamId WGWorkshop::teamControl

◆ workshopId

uint8 WGWorkshop::workshopId