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
1457 {
1458 ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
1459
1460 bf = _bf;
1461 workshopId = _workshopId;
1464 }
#define ASSERT
Definition: Errors.h:68
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
uint8 const WG_MAX_WORKSHOP
Definition: BattlefieldWG.h:1062
@ BATTLEFIELD_WG_OBJECTSTATE_NONE
Definition: BattlefieldWG.h:497
TeamId teamControl
Definition: BattlefieldWG.h:1452
uint32 state
Definition: BattlefieldWG.h:1454
uint8 workshopId
Definition: BattlefieldWG.h:1450
BattlefieldWG * bf
Definition: BattlefieldWG.h:1448

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
1467 {
1468 switch (team)
1469 {
1470 case TEAM_NEUTRAL:
1471 {
1472 // Send warning message to all player to inform a faction attack to a workshop
1473 // alliance / horde attacking a workshop
1474 bf->SendWarning(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
1475
1476 // Updating worldstate, update icon to neutral
1479
1480 // Found associate graveyard and update it
1484
1485 teamControl = team;
1486 break;
1487 }
1488 case TEAM_ALLIANCE:
1489 case TEAM_HORDE:
1490 {
1491 // Updating worldstate
1494
1495 // Warning message
1496 if (!init) // workshop taken - alliance
1497 bf->SendWarning(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
1498
1499 // Found associate graveyard and update it
1503
1504 teamControl = team;
1505 break;
1506 }
1507 }
1508
1509 if (!init)
1510 {
1511 bf->UpdateCounterVehicle(false);
1513 }
1514 }
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP]
Definition: BattlefieldWG.h:1072
@ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT
Definition: BattlefieldWG.h:498
@ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT
Definition: BattlefieldWG.h:504
@ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT
Definition: BattlefieldWG.h:501
@ BATTLEFIELD_WG_WORKSHOP_KEEP_WEST
Definition: BattlefieldWG.h:515
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
1525 {
1526 sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state);
1527 }
#define sWorld
Definition: World.h:443

References state, sWorld, workshopId, and WorkshopsData.

◆ UpdateGraveyardAndWorkshop()

void WGWorkshop::UpdateGraveyardAndWorkshop ( )
inline
1517 {
1520 else
1522 }
TeamId
Definition: SharedDefines.h:759
TeamId GetDefenderTeam()
Definition: Battlefield.h:275
void GiveControlTo(TeamId team, bool init)
Definition: BattlefieldWG.h:1466

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