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)
 
bool IsCapturable () const
 
void GiveControlTo (TeamId team, bool init)
 
void UpdateGraveyardAndWorkshop ()
 
void Save ()
 

Public Attributes

BattlefieldWG * bf
 
uint8 workshopId
 
TeamId teamControl
 
uint32 state
 

Detailed Description

Constructor & Destructor Documentation

◆ WGWorkshop()

WGWorkshop::WGWorkshop ( BattlefieldWG *  _bf,
uint8  _workshopId 
)
inline
1416 {
1417 ASSERT(_bf && _workshopId < WG_MAX_WORKSHOP);
1418
1419 bf = _bf;
1420 workshopId = _workshopId;
1423 }
uint8 const WG_MAX_WORKSHOP
Definition BattlefieldWG.h:1025
@ BATTLEFIELD_WG_OBJECTSTATE_NONE
Definition BattlefieldWG.h:482
#define ASSERT
Definition Errors.h:68
@ TEAM_NEUTRAL
Definition SharedDefines.h:750
TeamId teamControl
Definition BattlefieldWG.h:1411
uint32 state
Definition BattlefieldWG.h:1413
uint8 workshopId
Definition BattlefieldWG.h:1409
BattlefieldWG * bf
Definition BattlefieldWG.h:1407

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
1429 {
1430 TeamId const previousControl = teamControl;
1431
1432 switch (team)
1433 {
1434 case TEAM_NEUTRAL:
1435 {
1436 // Send warning message to all player to inform a faction attack to a workshop
1437 // alliance / horde attacking a workshop
1438 bf->SendWarning(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
1439
1440 // Updating worldstate, update icon to neutral
1443
1444 // Found associate graveyard and update it
1445 if (IsCapturable())
1448
1449 teamControl = team;
1450 break;
1451 }
1452 case TEAM_ALLIANCE:
1453 case TEAM_HORDE:
1454 {
1455 // Updating worldstate
1458
1459 // Warning message
1460 if (!init) // workshop taken - alliance
1461 bf->SendWarning(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
1462
1463 // Found associate graveyard and update it
1464 if (IsCapturable())
1467
1468 teamControl = team;
1469 break;
1470 }
1471 }
1472
1473 if (!init)
1474 {
1475 bf->UpdateCounterVehicle(false);
1477
1478 // Workshop graveyard share the workshop id. Ghosts of the team that just lost it can no
1479 // longer see a spirit guide here, so move them to a graveyard they can still use.
1480 if (IsCapturable())
1481 bf->RelocateDeadPlayers(workshopId, previousControl);
1482 }
1483 }
WGWorkshopData const WorkshopsData[WG_MAX_WORKSHOP]
Definition BattlefieldWG.h:1037
@ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT
Definition BattlefieldWG.h:483
@ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT
Definition BattlefieldWG.h:489
@ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT
Definition BattlefieldWG.h:486
TeamId
Definition SharedDefines.h:747
@ TEAM_ALLIANCE
Definition SharedDefines.h:748
@ TEAM_HORDE
Definition SharedDefines.h:749
void UpdateCounterVehicle(bool init)
Vehicle world states update.
Definition BattlefieldWG.cpp:321
uint32 GetAreaByGraveyardId(uint8 gId) const
Definition BattlefieldWG.cpp:567
void CapturePointTaken(uint32 areaId)
Definition BattlefieldWG.cpp:359
void RelocateDeadPlayers(uint8 graveyardId, TeamId losingTeam)
Definition BattlefieldWG.cpp:584
void SendWarning(uint8 id, WorldObject const *target=nullptr)
Definition Battlefield.cpp:543
BfGraveyard * GetGraveyardById(uint32 id) const
Definition Battlefield.cpp:671
void SendUpdateWorldState(uint32 field, uint32 value)
Update data of a worldstate to all players present in zone.
Definition Battlefield.cpp:549
void GiveControlTo(TeamId team)
Definition Battlefield.cpp:773
bool IsCapturable() const
Definition BattlefieldWG.h:1426

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

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

◆ IsCapturable()

bool WGWorkshop::IsCapturable ( ) const
inline
uint8 const WG_CAPTURE_WORKSHOP_COUNT
Definition BattlefieldWG.h:1028

References WG_CAPTURE_WORKSHOP_COUNT, and workshopId.

Referenced by GiveControlTo(), and UpdateGraveyardAndWorkshop().

◆ Save()

void WGWorkshop::Save ( )
inline
1494 {
1495 sWorldState->setWorldState(WorkshopsData[workshopId].worldstate, state);
1496 }
#define sWorldState
Definition WorldState.h:377

References state, sWorldState, workshopId, and WorkshopsData.

◆ UpdateGraveyardAndWorkshop()

void WGWorkshop::UpdateGraveyardAndWorkshop ( )
inline
1486 {
1487 if (IsCapturable())
1489 else
1491 }
TeamId GetDefenderTeam() const
Definition Battlefield.h:267
void GiveControlTo(TeamId team, bool init)
Definition BattlefieldWG.h:1428

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

Member Data Documentation

◆ bf

◆ state

uint32 WGWorkshop::state

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

◆ teamControl

TeamId WGWorkshop::teamControl

◆ workshopId


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