EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CynoModule Class Reference

#include "CynoModule.h"

Inheritance diagram for CynoModule:
Collaboration diagram for CynoModule:

Public Member Functions

virtual ~CynoModule ()
 
virtual CynoModuleGetCynoModule ()
 
virtual bool IsCynoModule () const
 
- Public Member Functions inherited from ActiveModule
virtual ~ActiveModule ()
 
virtual ActiveModuleGetActiveModule ()
 
virtual bool IsActiveModule () const
 
virtual void ApplyDamage ()
 
virtual uint16 GetReloadTime ()
 
virtual uint32 GetTargetID ()
 
SystemEntityGetTargetSE ()
 
 ActiveModule (ModuleItemRef mRef, ShipItemRef sRef)
 
virtual void Process ()
 
virtual void LoadCharge (InventoryItemRef charge)
 
virtual void UnloadCharge ()
 
virtual void Overload ()
 
virtual void AbortCycle ()
 
virtual void DeOverload ()
 
virtual void Deactivate (std::string effect="")
 
virtual void RemoveTarget (SystemEntity *pSE)
 
virtual void Update ()
 
virtual void ReprocessCharge ()
 
void LaunchProbe ()
 
void LaunchMissile ()
 
void LaunchSnowBall ()
 
void ApplyEffect (int8 state, bool active=false)
 
void ShowEffect (bool active=false, bool abort=false)
 
- Public Member Functions inherited from GenericModule
ModuleItemRef GetSelf ()
 
ShipItemRef GetShipRef ()
 
void Repair ()
 
bool HasAttribute (uint32 attrID)
 
void SetAttribute (uint32 attrID, EvilNumber val, bool update=true)
 
void ResetAttribute (uint32 attrID)
 
EvilNumber GetAttribute (uint32 attrID)
 
bool isWarpSafe ()
 
bool isTurretFitted ()
 
bool isLauncherFitted ()
 
virtual PassiveModuleGetPassiveModule ()
 
virtual MiningLaserGetMiningModule ()
 
virtual ProspectorGetProspectModule ()
 
virtual TurretModuleGetTurretModule ()
 
virtual SuperWeaponGetSuperWeapon ()
 
virtual RigModuleGetRigModule ()
 
virtual SubSystemModuleGetSubSystemModule ()
 
virtual bool IsGenericModule () const
 
virtual bool IsPassiveModule () const
 
virtual bool IsMiningLaser () const
 
virtual bool IsProspectModule () const
 
virtual bool IsRigModule () const
 
virtual bool IsSubSystemModule () const
 
bool IsLoaded ()
 
bool IsTurretModule ()
 
bool IsLauncherModule ()
 
bool IsOverloaded ()
 
bool IsLinked ()
 
bool IsMaster ()
 
bool IsDamaged ()
 
bool IsActive ()
 
bool IsLoading ()
 
bool isOnline ()
 
bool isLowPower ()
 
bool isHighPower ()
 
bool isMediumPower ()
 
bool isRig ()
 
bool isSubSystem ()
 
uint32 itemID ()
 
uint32 typeID ()
 
uint32 groupID ()
 
EVEItemFlags flag ()
 
void SetChargeRef (InventoryItemRef iRef)
 
void SetModuleState (int8 state)
 
void SetChargeState (int8 state)
 
void SetLinked (bool set=false)
 
void SetLinkMaster (bool set=false)
 
int8 GetModuleState ()
 
int8 GetChargeState ()
 
InventoryItemRef GetLoadedChargeRef ()
 
virtual void ReloadCharge ()
 
virtual void RemoveRig ()
 
virtual void DestroyRig ()
 
virtual bool IsSuccess ()
 
 GenericModule (ModuleItemRef mRef, ShipItemRef sRef)
 
virtual ~GenericModule ()
 
void Online ()
 
void Offline ()
 
void ProcessEffects (int8 state, bool active=false)
 
void Repair (EvilNumber amount)
 
int8 GetModulePowerLevel ()
 

Private Attributes

ClientpClient
 
ShipSEpShipSE
 
SystemEntitycSE
 
bool m_firstRun
 
float m_shipVelocity
 
EVEItemFlags m_holdFlag
 

CynoModule.cpp

Cynosural field generator module class : James

Date
: 8 October 2021
 CynoModule (ModuleItemRef mRef, ShipItemRef sRef)
 
virtual void Activate (uint16 effectID, uint32 targetID=0, int16 repeat=0)
 
virtual void DeactivateCycle (bool abort=false)
 
virtual uint32 DoCycle ()
 
virtual bool CanActivate ()
 
void SendOnJumpBeaconChange (bool status=false)
 
void CreateCyno ()
 

Additional Inherited Members

- Protected Member Functions inherited from ActiveModule
uint32 GetRemainingCycleTimeMS ()
 
void StopTimer ()
 
void Clear ()
 
void ProcessActiveCycle ()
 
void UpdateCharge (uint16 attrID, uint16 testAttrID, uint16 srcAttrID, InventoryItemRef iRef)
 
void UpdateDamage (uint16 attrID, uint16 srcAttrID, InventoryItemRef iRef)
 
void SetSlaveData (ShipSE *pShip)
 
void ConsumeCharge ()
 
void SetTimer (uint32 time)
 
- Protected Member Functions inherited from GenericModule
const char * GetModuleStateName (int8 state)
 
- Protected Attributes inherited from ActiveModule
SystemBubblem_bubble
 
SystemEntitym_targetSE
 
DestinyManagerm_destinyMgr
 
SystemManagerm_sysMgr
 
TargetManagerm_targMgr
 
uint16 m_reloadTime
 
uint16 m_effectID
 
uint32 m_targetID
 
bool m_Stop:1
 
bool m_usesCharge:1
 
bool m_needsCharge:1
 
bool m_needsTarget:1
 
- Protected Attributes inherited from GenericModule
ModuleItemRef m_modRef
 
ShipItemRef m_shipRef
 
InventoryItemRef m_chargeRef
 
int8 m_ModuleState
 
int8 m_ChargeState
 
int16 m_repeat
 
bool m_linkMaster:1
 
bool m_linked:1
 
bool m_isWarpSafe:1
 
bool m_hiPower:1
 
bool m_medPower:1
 
bool m_loPower:1
 
bool m_rigSlot:1
 
bool m_subSystem:1
 
bool m_launcher:1
 
bool m_turret:1
 
bool m_overLoaded:1
 
bool m_chargeLoaded:1
 

Detailed Description

Definition at line 16 of file CynoModule.h.

Constructor & Destructor Documentation

CynoModule::CynoModule ( ModuleItemRef  mRef,
ShipItemRef  sRef 
)

Definition at line 14 of file CynoModule.cpp.

References AttrDuration, EvilNumber::get_float(), GenericModule::GetAttribute(), Client::GetChar(), ShipItem::GetPilot(), Character::GetSkillLevel(), ShipItem::HasPilot(), GenericModule::m_shipRef, pClient, GenericModule::SetAttribute(), and EvESkill::Survey.

15 : ActiveModule(mRef, sRef),
16 cSE(nullptr),
17 pClient(nullptr),
18 pShipSE(nullptr),
19 m_firstRun(true),
20 m_shipVelocity(0.0f)
21 {
22  if (!m_shipRef->HasPilot())
23  return;
24 
26 
27  // increase scan speed by level of survey skill
28  float cycleTime = GetAttribute(AttrDuration).get_float();
29  cycleTime *= (1 + (0.03f * (pClient->GetChar()->GetSkillLevel(EvESkill::Survey, true))));
30  SetAttribute(AttrDuration, cycleTime);
31 }
ActiveModule(ModuleItemRef mRef, ShipItemRef sRef)
virtual bool HasPilot()
Definition: Ship.h:71
CharacterRef GetChar() const
Definition: Client.h:164
Client * pClient
Definition: CynoModule.h:34
void SetAttribute(uint32 attrID, EvilNumber val, bool update=true)
Definition: GenericModule.h:51
bool m_firstRun
Definition: CynoModule.h:38
ShipItemRef m_shipRef
SystemEntity * cSE
Definition: CynoModule.h:36
ShipSE * pShipSE
Definition: CynoModule.h:35
float m_shipVelocity
Definition: CynoModule.h:40
virtual Client * GetPilot()
Definition: Ship.h:72
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
Definition: Character.cpp:575
float get_float()
Definition: EvilNumber.cpp:184
EvilNumber GetAttribute(uint32 attrID)
Definition: GenericModule.h:53

Here is the call graph for this function:

virtual CynoModule::~CynoModule ( )
inlinevirtual

Definition at line 20 of file CynoModule.h.

20 { /* do nothing here */ }

Member Function Documentation

void CynoModule::Activate ( uint16  effectID,
uint32  targetID = 0,
int16  repeat = 0 
)
virtual

Reimplemented from ActiveModule.

Definition at line 33 of file CynoModule.cpp.

References _log, ActiveModule::Activate(), SystemEntity::DestinyMgr(), DestinyManager::GetMaxVelocity(), SystemManager::GetName(), Client::GetName(), Client::GetShipSE(), m_firstRun, m_shipVelocity, ActiveModule::m_Stop, ActiveModule::m_sysMgr, pClient, pShipSE, and DestinyManager::SetFrozen().

34 {
36 
37  m_firstRun = true;
38  ActiveModule::Activate(effectID, targetID, repeat);
39 
40  // check to see if Activate() was denied.
41  if (m_Stop)
42  return;
43 
44  _log(MODULE__DEBUG, "Cynosural field generator activated by %s in %s", pClient->GetName(), m_sysMgr->GetName());
45 
46  // hack to disable ship movement here
48  pShipSE->DestinyMgr()->SetFrozen(true);
49 }
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemManager * m_sysMgr
Definition: ActiveModule.h:80
Client * pClient
Definition: CynoModule.h:34
bool m_firstRun
Definition: CynoModule.h:38
DestinyManager * DestinyMgr()
Definition: SystemEntity.h:198
double GetMaxVelocity()
const char * GetName() const
Definition: Client.h:94
void SetFrozen(bool set=false)
ShipSE * pShipSE
Definition: CynoModule.h:35
float m_shipVelocity
Definition: CynoModule.h:40
const char * GetName() const
Definition: SystemManager.h:84
ShipSE * GetShipSE()
Definition: Client.h:168
virtual void Activate(uint16 effectID, uint32 targetID=0, int16 repeat=0)

Here is the call graph for this function:

bool CynoModule::CanActivate ( )
virtual
Todo:
check for active cyno jammer

Reimplemented from ActiveModule.

Definition at line 64 of file CynoModule.cpp.

References ActiveModule::CanActivate(), Ga::GaVec3::distance(), Client::GetLocationID(), SystemEntity::GetPosition(), SystemManager::GetSecValue(), TowerSE::GetSOI(), SystemBubble::GetTowerSE(), TowerSE::HasForceField(), SystemBubble::HasTower(), Client::InFleet(), SovereigntyData::jammerID, pClient, pShipSE, sConfig, Client::SendNotifyMsg(), svDataMgr, SystemEntity::SysBubble(), and Client::SystemMgr().

65 {
66  if (!pClient->InFleet())
67  throw UserError("CynoMustBeInFleet");
68 
69  if (pShipSE->SysBubble()->HasTower()) {
70  TowerSE* ptSE = pShipSE->SysBubble()->GetTowerSE();
71  if (ptSE->HasForceField())
72  if (pShipSE->GetPosition().distance(ptSE->GetPosition()) < ptSE->GetSOI())
73  throw UserError("NoCynoInPOSShields");
74  }
75 
78  //if (m_sysMgr->HasCynoJammer())
79  // throw UserError("CynosuralGenerationJammed");
80 
81  //Send message if the system is being jammed
82  SovereigntyData sovData = svDataMgr.GetSovereigntyData(pClient->GetLocationID());
83  if (sovData.jammerID != 0) {
84  pClient->SendNotifyMsg("This system is currently being jammed.");
85  return false;
86  }
87 
88  //Make sure player is not in high-sec (configurable)
89  if (!sConfig.world.highSecCyno) {
90  if (pClient->SystemMgr()->GetSecValue() >= 0.5f) {
91  pClient->SendNotifyMsg("This module may not be used in high security space.");
92  return false;
93  }
94  }
95 
96  // all specific checks pass. run generic checks in base class
98 }
#define sConfig
A macro for easier access to the singleton.
uint32 GetLocationID() const
Definition: Client.h:151
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
void SendNotifyMsg(const char *fmt,...)
Definition: Client.cpp:2776
Client * pClient
Definition: CynoModule.h:34
uint16 GetSOI()
Definition: Tower.h:90
const GPoint & GetPosition() const
Definition: SystemEntity.h:211
TowerSE * GetTowerSE()
Definition: SystemBubble.h:142
bool InFleet()
Definition: Client.h:142
SystemManager * SystemMgr() const
Definition: Client.h:92
float GetSecValue()
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
virtual bool CanActivate()
ShipSE * pShipSE
Definition: CynoModule.h:35
bool HasTower()
Definition: SystemBubble.h:141
Definition: Tower.h:19
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158
#define svDataMgr
bool HasForceField()
Definition: Tower.h:76

Here is the call graph for this function:

void CynoModule::CreateCyno ( )
private

Definition at line 113 of file CynoModule.cpp.

References _log, SystemManager::AddEntity(), cSE, EVEDB::invTypes::CynosuralFieldI, flagNone, Client::GetCharacterID(), SystemManager::GetID(), SystemEntity::GetPosition(), ActiveModule::m_sysMgr, GPoint::MakeRandomPointOnSphere(), pClient, pShipSE, SendOnJumpBeaconChange(), Client::services(), SystemEntity::SetPosition(), and sItemFactory.

Referenced by DoCycle().

114 {
115  // do we already have a cyno field created?
116  if (cSE != nullptr)
117  return;
118 
119  // Create Cyno field here
121  InventoryItemRef cRef = sItemFactory.SpawnItem(cData);
122 
123  _log(MODULE__DEBUG, "Creating Cynosural field");
124 
125  cSE = new ItemSystemEntity(cRef, pClient->services(), m_sysMgr);
126  GPoint location(pShipSE->GetPosition());
127  location.MakeRandomPointOnSphere(1500.0f + cRef->type().radius());
128  cSE->SetPosition(location);
129  cRef->SaveItem();
131 
133 }
void SetPosition(const GPoint &pos)
Definition: SystemEntity.h:212
void AddEntity(SystemEntity *pSE, bool addSignal=true)
#define _log(type, fmt,...)
Definition: logsys.h:124
PyServiceMgr & services() const
Definition: Client.h:90
int32 GetCharacterID() const
Definition: Client.h:113
SystemManager * m_sysMgr
Definition: ActiveModule.h:80
uint32 GetID() const
Definition: SystemManager.h:80
Client * pClient
Definition: CynoModule.h:34
const GPoint & GetPosition() const
Definition: SystemEntity.h:211
Definition: gpoint.h:33
SystemEntity * cSE
Definition: CynoModule.h:36
void SendOnJumpBeaconChange(bool status=false)
Definition: CynoModule.cpp:135
ShipSE * pShipSE
Definition: CynoModule.h:35
#define sItemFactory
Definition: ItemFactory.h:165
void MakeRandomPointOnSphere(double radius)
Definition: gpoint.h:46

Here is the call graph for this function:

Here is the caller graph for this function:

void CynoModule::DeactivateCycle ( bool  abort = false)
virtual

Reimplemented from ActiveModule.

Definition at line 51 of file CynoModule.cpp.

References AttrMaxVelocity, cSE, ActiveModule::DeactivateCycle(), SystemEntity::Delete(), SystemEntity::DestinyMgr(), SystemEntity::GetSelf(), m_shipVelocity, pShipSE, SafeDelete(), SendOnJumpBeaconChange(), InventoryItem::SetAttribute(), and DestinyManager::SetFrozen().

52 {
54  cSE->Delete();
55  SafeDelete(cSE);
57 
58  // hack to reinstate ship movement here
59  // may have to reset/reapply all fx for ship movement
61  pShipSE->DestinyMgr()->SetFrozen(false);
62 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
virtual void Delete()
DestinyManager * DestinyMgr()
Definition: SystemEntity.h:198
SystemEntity * cSE
Definition: CynoModule.h:36
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
void SendOnJumpBeaconChange(bool status=false)
Definition: CynoModule.cpp:135
void SetAttribute(uint16 attrID, int num, bool notify=true)
void SetFrozen(bool set=false)
ShipSE * pShipSE
Definition: CynoModule.h:35
float m_shipVelocity
Definition: CynoModule.h:40
virtual void DeactivateCycle(bool abort=false)

Here is the call graph for this function:

uint32 CynoModule::DoCycle ( )
virtual

Reimplemented from ActiveModule.

Definition at line 100 of file CynoModule.cpp.

References CreateCyno(), ActiveModule::DoCycle(), and m_firstRun.

101 {
102  // i really dont like this, but cant get it to work anywhere else...
103  uint32 retVal(0);
104  if (retVal = ActiveModule::DoCycle())
105  if (m_firstRun) {
106  m_firstRun = false;
107  CreateCyno();
108  }
109 
110  return retVal;
111 }
bool m_firstRun
Definition: CynoModule.h:38
void CreateCyno()
Definition: CynoModule.cpp:113
unsigned __int32 uint32
Definition: eve-compat.h:50
virtual uint32 DoCycle()

Here is the call graph for this function:

virtual CynoModule* CynoModule::GetCynoModule ( )
inlinevirtual

Reimplemented from GenericModule.

Definition at line 22 of file CynoModule.h.

22 { return this; }
virtual bool CynoModule::IsCynoModule ( ) const
inlinevirtual

Reimplemented from GenericModule.

Definition at line 23 of file CynoModule.h.

23 { return true; }
void CynoModule::SendOnJumpBeaconChange ( bool  status = false)
private

Definition at line 135 of file CynoModule.cpp.

References _log, cSE, Client::GetCharacterID(), Client::GetFleetID(), SystemManager::GetID(), SystemEntity::GetID(), ActiveModule::m_sysMgr, pClient, PyTuple::SetItem(), and sFltSvc.

Referenced by CreateCyno(), and DeactivateCycle().

135  {
136  //Send ProcessSovStatusChanged Notification
137  _log(MODULE__DEBUG, "Sending OnJumpBeaconChange (active = %s)", active ? "true" : "false");
138 
139  uint32 fieldID(0);
140  if (cSE != nullptr)
141  fieldID = cSE->GetID();
142 
143  PyTuple* data = new PyTuple(4);
144  data->SetItem(0, new PyInt(pClient->GetCharacterID()));
145  data->SetItem(1, new PyInt(m_sysMgr->GetID()));
146  data->SetItem(2, new PyInt(fieldID));
147  data->SetItem(3, new PyBool(active));
148 
149  std::vector<Client *> fleetClients;
150  fleetClients = sFltSvc.GetFleetClients(pClient->GetFleetID());
151  for (auto cur : fleetClients)
152  if (cur != nullptr) {
153  cur->SendNotification("OnJumpBeaconChange", "clientID", &data);
154  _log(MODULE__DEBUG, "OnJumpBeaconChange sent to %s (%u)", cur->GetName(), cur->GetCharID());
155  }
156 }
#define _log(type, fmt,...)
Definition: logsys.h:124
int32 GetCharacterID() const
Definition: Client.h:113
SystemManager * m_sysMgr
Definition: ActiveModule.h:80
uint32 GetID() const
Definition: SystemManager.h:80
Python tuple.
Definition: PyRep.h:567
Client * pClient
Definition: CynoModule.h:34
Python boolean.
Definition: PyRep.h:323
#define sFltSvc
Definition: FleetService.h:147
SystemEntity * cSE
Definition: CynoModule.h:36
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python integer.
Definition: PyRep.h:231
uint32 GetID()
Definition: SystemEntity.h:207
uint32 GetFleetID() const
Definition: Client.h:146
unsigned __int32 uint32
Definition: eve-compat.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

SystemEntity* CynoModule::cSE
private

Definition at line 36 of file CynoModule.h.

Referenced by CreateCyno(), DeactivateCycle(), and SendOnJumpBeaconChange().

bool CynoModule::m_firstRun
private

Definition at line 38 of file CynoModule.h.

Referenced by Activate(), and DoCycle().

EVEItemFlags CynoModule::m_holdFlag
private

Definition at line 42 of file CynoModule.h.

float CynoModule::m_shipVelocity
private

Definition at line 40 of file CynoModule.h.

Referenced by Activate(), and DeactivateCycle().

Client* CynoModule::pClient
private

Definition at line 34 of file CynoModule.h.

Referenced by Activate(), CanActivate(), CreateCyno(), CynoModule(), and SendOnJumpBeaconChange().

ShipSE* CynoModule::pShipSE
private

Definition at line 35 of file CynoModule.h.

Referenced by Activate(), CanActivate(), CreateCyno(), and DeactivateCycle().


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