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

#include "GenericModule.h"

Inheritance diagram for GenericModule:
Collaboration diagram for GenericModule:

Public Member Functions

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 ActiveModuleGetActiveModule ()
 
virtual PassiveModuleGetPassiveModule ()
 
virtual MiningLaserGetMiningModule ()
 
virtual ProspectorGetProspectModule ()
 
virtual TurretModuleGetTurretModule ()
 
virtual SuperWeaponGetSuperWeapon ()
 
virtual RigModuleGetRigModule ()
 
virtual SubSystemModuleGetSubSystemModule ()
 
virtual CynoModuleGetCynoModule ()
 
virtual bool IsGenericModule () const
 
virtual bool IsPassiveModule () const
 
virtual bool IsActiveModule () const
 
virtual bool IsMiningLaser () const
 
virtual bool IsProspectModule () const
 
virtual bool IsCynoModule () 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 Process ()
 
virtual void Deactivate (std::string effect="")
 
virtual void AbortCycle ()
 
virtual void LoadCharge (InventoryItemRef charge)
 
virtual void UnloadCharge ()
 
virtual void ReloadCharge ()
 
virtual void RemoveRig ()
 
virtual void DestroyRig ()
 
virtual void ReprocessCharge ()
 
virtual void Activate (uint16 effectID, uint32 targetID=0, int16 repeat=0)
 
virtual void RemoveTarget (SystemEntity *pSE)
 
virtual bool IsSuccess ()
 
virtual void Update ()
 
virtual uint16 GetReloadTime ()
 
virtual uint32 GetTargetID ()
 

Protected Attributes

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
 

GenericModule.cpp

base module class : Allan

Date
: 10 June 2015 -UD/RW 02 April 2017
 GenericModule (ModuleItemRef mRef, ShipItemRef sRef)
 
virtual ~GenericModule ()
 
void Online ()
 
void Offline ()
 
void ProcessEffects (int8 state, bool active=false)
 
void Repair (EvilNumber amount)
 
virtual void Overload ()
 
virtual void DeOverload ()
 
int8 GetModulePowerLevel ()
 
const char * GetModuleStateName (int8 state)
 

Detailed Description

Definition at line 32 of file GenericModule.h.

Constructor & Destructor Documentation

GenericModule::GenericModule ( ModuleItemRef  mRef,
ShipItemRef  sRef 
)

Definition at line 22 of file GenericModule.cpp.

References _log, ItemType::HasEffect(), hiPower, InventoryItem::itemID(), launcherFitted, loPower, m_hiPower, m_launcher, m_loPower, m_medPower, m_rigSlot, m_subSystem, m_turret, medPower, InventoryItem::name(), rigSlot, subSystem, turretFitted, and InventoryItem::type().

23 : m_repeat(0),
24 m_modRef(mRef),
25 m_shipRef(sRef),
29 m_linked(false),
30 m_linkMaster(false),
31 m_isWarpSafe(false),
32 m_overLoaded(false),
33 m_chargeLoaded(false),
34 m_hiPower(false),
35 m_medPower(false),
36 m_loPower(false),
37 m_rigSlot(false),
38 m_subSystem(false),
39 m_turret(false),
40 m_launcher(false)
41 {
42  if (mRef->type().HasEffect(EVEEffectID::loPower)) {
43  m_loPower = true;
44  } else if (mRef->type().HasEffect(EVEEffectID::medPower)) {
45  m_medPower = true;
46  } else if (mRef->type().HasEffect(EVEEffectID::hiPower)) {
47  m_hiPower = true;
49  m_turret = true;
50  } else if (mRef->type().HasEffect(EVEEffectID::launcherFitted)) {
51  m_launcher = true;
52  }
53  } else if (mRef->type().HasEffect(EVEEffectID::rigSlot)) {
54  m_rigSlot = true;
55  } else if (mRef->type().HasEffect(EVEEffectID::subSystem)) {
56  m_subSystem = true;
57  }
58 
59  _log(MODULE__DEBUG, "Created GenericModule %p for item %s (%u).", this, mRef->name(), mRef->itemID());
60 }
#define _log(type, fmt,...)
Definition: logsys.h:124
bool HasEffect(uint16 effectID) const
Definition: ItemType.cpp:208
const char * name()
ModuleItemRef m_modRef
const ItemType & type() const
ShipItemRef m_shipRef
InventoryItemRef m_chargeRef
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

GenericModule::~GenericModule ( )
virtual

Definition at line 62 of file GenericModule.cpp.

63 {
64 
65 }

Member Function Documentation

virtual void GenericModule::AbortCycle ( )
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 115 of file GenericModule.h.

Referenced by ModuleManager::UnfitModule().

115 { /* do nothing here */ }

Here is the caller graph for this function:

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

Reimplemented in ActiveModule, Prospector, and CynoModule.

Definition at line 128 of file GenericModule.h.

Referenced by ModuleManager::Activate().

129  { /* do nothing here */ }

Here is the caller graph for this function:

virtual void GenericModule::Deactivate ( std::string  effect = "")
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 114 of file GenericModule.h.

Referenced by ModuleManager::Deactivate().

114 { /* do nothing here */ }

Here is the caller graph for this function:

void GenericModule::DeOverload ( )
virtual

Reimplemented in ActiveModule.

Definition at line 232 of file GenericModule.cpp.

References RefPtr< X >::get(), Client::GetChar(), ShipItem::GetPilot(), m_modRef, m_shipRef, FX::State::Overloaded, ProcessEffects(), and sFxProc.

Referenced by ActiveModule::DeOverload(), and ModuleManager::DeOverload().

233 {
235  sFxProc.ApplyEffects(m_modRef.get(), m_shipRef->GetPilot()->GetChar().get(), m_shipRef.get(), true);
236  //m_modRef->ClearModifiers();
237 }
void ProcessEffects(int8 state, bool active=false)
CharacterRef GetChar() const
Definition: Client.h:164
ModuleItemRef m_modRef
ShipItemRef m_shipRef
X * get() const
Definition: RefPtr.h:213
#define sFxProc
virtual Client * GetPilot()
Definition: Ship.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void GenericModule::DestroyRig ( )
inlinevirtual

Reimplemented in RigModule.

Definition at line 125 of file GenericModule.h.

125 { /* do nothing here */ }
EVEItemFlags GenericModule::flag ( )
inline

Definition at line 100 of file GenericModule.h.

References InventoryItem::flag(), and m_modRef.

Referenced by ModuleManager::DamageModule(), ShipItem::HeatDamageCheck(), ShipItem::LinkWeaponLoop(), ShipItem::LoadLinkedWeapons(), ModuleManager::SortModulesBySlotDec(), ModuleManager::UnfitModule(), ModuleManager::UninstallRig(), and ModuleManager::UnloadCharge().

100 { return m_modRef->flag(); }
ModuleItemRef m_modRef
EVEItemFlags flag() const

Here is the call graph for this function:

Here is the caller graph for this function:

virtual ActiveModule* GenericModule::GetActiveModule ( )
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 60 of file GenericModule.h.

Referenced by Offline().

60 { return nullptr; }

Here is the caller graph for this function:

int8 GenericModule::GetChargeState ( )
inline

Definition at line 109 of file GenericModule.h.

References m_ChargeState.

109 { return m_ChargeState; }
virtual CynoModule* GenericModule::GetCynoModule ( )
inlinevirtual

Reimplemented in CynoModule.

Definition at line 68 of file GenericModule.h.

68 { return nullptr; }
InventoryItemRef GenericModule::GetLoadedChargeRef ( )
inline

Definition at line 110 of file GenericModule.h.

References m_chargeRef.

Referenced by ModuleManager::GetLoadedChargeOnModule(), ModuleManager::LoadCharge(), and ModuleManager::UnloadCharge().

110 { return m_chargeRef; }
InventoryItemRef m_chargeRef

Here is the caller graph for this function:

virtual MiningLaser* GenericModule::GetMiningModule ( )
inlinevirtual

Reimplemented in MiningLaser.

Definition at line 62 of file GenericModule.h.

62 { return nullptr; }
int8 GenericModule::GetModulePowerLevel ( )

Definition at line 292 of file GenericModule.cpp.

References Module::Bank::High, Module::Bank::Low, m_hiPower, m_loPower, m_medPower, m_rigSlot, m_subSystem, Module::Bank::Mid, Module::Bank::Rig, Module::Bank::Subsystem, and Module::Bank::Undefined.

292  {
293  {
294  if (m_hiPower) {
295  return Module::Bank::High;
296  } else if (m_medPower) {
297  return Module::Bank::Mid;
298  } else if (m_loPower) {
299  return Module::Bank::Low;
300  } else if (m_rigSlot) {
301  return Module::Bank::Rig;
302  } else if (m_subSystem) {
304  } else {
306  }
307  }
308 }
int8 GenericModule::GetModuleState ( )
inline

Definition at line 108 of file GenericModule.h.

References m_ModuleState.

Referenced by ModuleManager::Deactivate().

108 { return m_ModuleState; }

Here is the caller graph for this function:

const char * GenericModule::GetModuleStateName ( int8  state)
protected

Definition at line 275 of file GenericModule.cpp.

References Module::State::Activated, Module::State::Deactivating, Module::State::Loaded, Module::State::Loading, EVEPOS::Harmonic::Offline, Online, Module::State::Reloading, Module::State::Unfitted, and Module::State::Unloaded.

Referenced by ActiveModule::AbortCycle(), ActiveModule::Deactivate(), ActiveModule::DeactivateCycle(), and Online().

276 {
277  using namespace Module;
278  switch(state) {
279  case State::Unloaded: return "Unloaded";
280  case State::Loaded: return "Loaded";
281  case State::Loading: return "Loading";
282  case State::Reloading: return "Reloading";
283  case State::Unfitted: return "Unfitted";
284  case State::Offline: return "Offline";
285  case State::Online: return "Online";
286  case State::Activated: return "Activated";
287  case State::Deactivating: return "Deactivating";
288  default: return "Invalid";
289  }
290 }
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state

Here is the caller graph for this function:

virtual PassiveModule* GenericModule::GetPassiveModule ( )
inlinevirtual

Reimplemented in PassiveModule.

Definition at line 61 of file GenericModule.h.

61 { return nullptr; }
virtual Prospector* GenericModule::GetProspectModule ( )
inlinevirtual

Reimplemented in Prospector.

Definition at line 63 of file GenericModule.h.

Referenced by ActiveModule::Deactivate(), and TargetManager::Destroyed().

63 { return nullptr; }

Here is the caller graph for this function:

virtual uint16 GenericModule::GetReloadTime ( )
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 140 of file GenericModule.h.

140 { return 0; }
virtual RigModule* GenericModule::GetRigModule ( )
inlinevirtual

Reimplemented in RigModule.

Definition at line 66 of file GenericModule.h.

66 { return nullptr; }
ShipItemRef GenericModule::GetShipRef ( )
inline

Definition at line 43 of file GenericModule.h.

References m_shipRef.

Referenced by TargetManager::AddTargetModule(), and TargetManager::RemoveTargetModule().

43 { return m_shipRef; }
ShipItemRef m_shipRef

Here is the caller graph for this function:

virtual SubSystemModule* GenericModule::GetSubSystemModule ( )
inlinevirtual

Reimplemented in SubSystemModule.

Definition at line 67 of file GenericModule.h.

67 { return nullptr; }
virtual SuperWeapon* GenericModule::GetSuperWeapon ( )
inlinevirtual

Definition at line 65 of file GenericModule.h.

65 { return nullptr; }
virtual uint32 GenericModule::GetTargetID ( )
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 141 of file GenericModule.h.

141 { return 0; }
virtual TurretModule* GenericModule::GetTurretModule ( )
inlinevirtual

Reimplemented in TurretModule.

Definition at line 64 of file GenericModule.h.

64 { return nullptr; }
uint32 GenericModule::groupID ( )
inline

Definition at line 99 of file GenericModule.h.

References InventoryItem::groupID(), and m_modRef.

Referenced by ActiveModule::Activate(), ModuleManager::addModuleRef(), ActiveModule::CanActivate(), ActiveModule::DeactivateCycle(), ModuleManager::deleteModuleRef(), TargetManager::Destroyed(), ActiveModule::ShowEffect(), and ModuleManager::UninstallRig().

99 { return m_modRef->groupID(); }
ModuleItemRef m_modRef
uint16 groupID() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool GenericModule::HasAttribute ( uint32  attrID)
inline

Definition at line 50 of file GenericModule.h.

References InventoryItem::HasAttribute(), and m_modRef.

Referenced by ModuleManager::Activate().

50 { return m_modRef->HasAttribute(attrID); }
bool HasAttribute(const uint16 attrID) const
ModuleItemRef m_modRef

Here is the call graph for this function:

Here is the caller graph for this function:

bool GenericModule::IsActive ( )
inline

Definition at line 86 of file GenericModule.h.

References Module::State::Activated, Module::State::Deactivating, and m_ModuleState.

Referenced by ShipItem::LinkWeapon(), and ShipItem::MoveModuleSlot().

Here is the caller graph for this function:

virtual bool GenericModule::IsActiveModule ( ) const
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 72 of file GenericModule.h.

Referenced by Offline().

72 { return false; }

Here is the caller graph for this function:

virtual bool GenericModule::IsCynoModule ( ) const
inlinevirtual

Reimplemented in CynoModule.

Definition at line 75 of file GenericModule.h.

75 { return false; }
bool GenericModule::IsDamaged ( )
inline

Definition at line 85 of file GenericModule.h.

References AttrDamage, EvilZero, InventoryItem::GetAttribute(), and m_modRef.

Referenced by ShipItem::LinkWeapon().

ModuleItemRef m_modRef
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
EvilNumber GetAttribute(const uint16 attrID) const

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool GenericModule::IsGenericModule ( ) const
inlinevirtual

Definition at line 70 of file GenericModule.h.

70 { return true; }
bool GenericModule::isHighPower ( )
inline

Definition at line 92 of file GenericModule.h.

References m_hiPower.

Referenced by ModuleManager::addModuleRef(), ModuleManager::deleteModuleRef(), and ShipItem::HeatDamageCheck().

92 { return m_hiPower; }

Here is the caller graph for this function:

bool GenericModule::isLauncherFitted ( )
inline

Definition at line 57 of file GenericModule.h.

References ItemType::HasEffect(), launcherFitted, m_modRef, and InventoryItem::type().

Referenced by ModuleManager::addModuleRef(), and ModuleManager::deleteModuleRef().

bool HasEffect(uint16 effectID) const
Definition: ItemType.cpp:208
ModuleItemRef m_modRef
const ItemType & type() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool GenericModule::IsLauncherModule ( )
inline

Definition at line 81 of file GenericModule.h.

References m_launcher.

81 { return m_launcher; }
bool GenericModule::IsLinked ( )
inline

Definition at line 83 of file GenericModule.h.

References m_linked.

Referenced by ModuleManager::Activate(), SystemEntity::ApplyDamage(), ShipItem::HeatDamageCheck(), Missile::Missile(), and ModuleManager::UnfitModule().

83 { return m_linked; }

Here is the caller graph for this function:

bool GenericModule::IsLoaded ( )
inline

Definition at line 79 of file GenericModule.h.

References RefPtr< X >::get(), m_chargeLoaded, and m_chargeRef.

Referenced by ModuleManager::GetLoadedChargeOnModule(), ModuleManager::Initialize(), ShipItem::LinkWeapon(), ModuleManager::LoadCharge(), ModuleManager::UnfitModule(), and ModuleManager::UnloadCharge().

79 { return (m_chargeLoaded and (m_chargeRef.get() != nullptr)); }
InventoryItemRef m_chargeRef
X * get() const
Definition: RefPtr.h:213

Here is the call graph for this function:

Here is the caller graph for this function:

bool GenericModule::IsLoading ( )
inline

Definition at line 87 of file GenericModule.h.

References Module::State::Loading, and m_ModuleState.

Referenced by ShipItem::LinkWeapon().

Here is the caller graph for this function:

bool GenericModule::isLowPower ( )
inline

Definition at line 91 of file GenericModule.h.

References m_loPower.

Referenced by ModuleManager::addModuleRef(), ModuleManager::deleteModuleRef(), and ShipItem::HeatDamageCheck().

91 { return m_loPower; }

Here is the caller graph for this function:

bool GenericModule::IsMaster ( )
inline

Definition at line 84 of file GenericModule.h.

References m_linkMaster.

Referenced by ModuleManager::Activate(), ShipItem::HeatDamageCheck(), and ShipItem::OfflineGroup().

84 { return m_linkMaster; }

Here is the caller graph for this function:

bool GenericModule::isMediumPower ( )
inline

Definition at line 93 of file GenericModule.h.

References m_medPower.

Referenced by ModuleManager::addModuleRef(), ModuleManager::deleteModuleRef(), and ShipItem::HeatDamageCheck().

93 { return m_medPower; }

Here is the caller graph for this function:

virtual bool GenericModule::IsMiningLaser ( ) const
inlinevirtual

Reimplemented in MiningLaser.

Definition at line 73 of file GenericModule.h.

Referenced by TargetManager::AddTargetModule().

73 { return false; }

Here is the caller graph for this function:

bool GenericModule::isOnline ( )
inline

Definition at line 90 of file GenericModule.h.

References InventoryItem::IsOnline(), and m_modRef.

Referenced by ModuleManager::Activate(), ShipItem::LinkWeapon(), ModuleManager::Offline(), and ModuleManager::Online().

90 { return m_modRef->IsOnline(); }
ModuleItemRef m_modRef

Here is the call graph for this function:

Here is the caller graph for this function:

bool GenericModule::IsOverloaded ( )
inline

Definition at line 82 of file GenericModule.h.

References m_overLoaded.

82 { return m_overLoaded; }
virtual bool GenericModule::IsPassiveModule ( ) const
inlinevirtual

Reimplemented in PassiveModule.

Definition at line 71 of file GenericModule.h.

71 { return false; }
virtual bool GenericModule::IsProspectModule ( ) const
inlinevirtual

Reimplemented in Prospector.

Definition at line 74 of file GenericModule.h.

Referenced by ActiveModule::Deactivate().

74 { return false; }

Here is the caller graph for this function:

bool GenericModule::isRig ( )
inline

Definition at line 94 of file GenericModule.h.

References m_rigSlot.

Referenced by ModuleManager::addModuleRef(), ModuleManager::deleteModuleRef(), Offline(), and Online().

94 { return m_rigSlot; }

Here is the caller graph for this function:

virtual bool GenericModule::IsRigModule ( ) const
inlinevirtual

Reimplemented in RigModule.

Definition at line 76 of file GenericModule.h.

76 { return false; } // check this in m_rigSlot?
bool GenericModule::isSubSystem ( )
inline

Definition at line 95 of file GenericModule.h.

References m_subSystem.

Referenced by ModuleManager::addModuleRef(), and ModuleManager::deleteModuleRef().

95 { return m_subSystem; }

Here is the caller graph for this function:

virtual bool GenericModule::IsSubSystemModule ( ) const
inlinevirtual

Reimplemented in SubSystemModule.

Definition at line 77 of file GenericModule.h.

77 { return false; } // check this in m_subSystem?
virtual bool GenericModule::IsSuccess ( )
inlinevirtual

Reimplemented in Prospector.

Definition at line 133 of file GenericModule.h.

Referenced by ActiveModule::DeactivateCycle(), and ActiveModule::ShowEffect().

133 { return false; }

Here is the caller graph for this function:

bool GenericModule::isTurretFitted ( )
inline

Definition at line 56 of file GenericModule.h.

References ItemType::HasEffect(), m_modRef, turretFitted, and InventoryItem::type().

Referenced by ModuleManager::addModuleRef(), and ModuleManager::deleteModuleRef().

bool HasEffect(uint16 effectID) const
Definition: ItemType.cpp:208
ModuleItemRef m_modRef
const ItemType & type() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool GenericModule::IsTurretModule ( )
inline

Definition at line 80 of file GenericModule.h.

References m_turret.

80 { return m_turret; }
bool GenericModule::isWarpSafe ( )
inline

Definition at line 55 of file GenericModule.h.

References m_isWarpSafe.

55 { return m_isWarpSafe; }
virtual void GenericModule::LoadCharge ( InventoryItemRef  charge)
inlinevirtual

Reimplemented in ActiveModule, MiningLaser, and TurretModule.

Definition at line 118 of file GenericModule.h.

Referenced by ModuleManager::Initialize(), and ModuleManager::LoadCharge().

118 { /* do nothing here */ }

Here is the caller graph for this function:

void GenericModule::Offline ( )

Definition at line 157 of file GenericModule.cpp.

References _log, ActiveModule::AbortCycle(), fxData::action, Module::State::Activated, AttrCpu, AttrCpuLoad, AttrOnline, AttrPower, AttrPowerLoad, Module::State::Deactivating, EvilZero, RefPtr< X >::get(), GetActiveModule(), GetAttribute(), InventoryItem::GetAttribute(), Client::GetChar(), ShipItem::GetPilot(), FX::Action::Invalid, IsActiveModule(), Client::IsDocked(), ShipItem::IsPopped(), isRig(), ShipItem::IsUndocking(), itemID(), Module::State::Loaded, m_chargeRef, m_ChargeState, m_modRef, m_ModuleState, m_shipRef, ItemType::m_stateFxMap, InventoryItem::name(), Module::State::Offline, FX::State::Online, FX::State::Passive, ProcessEffects(), SetAttribute(), InventoryItem::SetAttribute(), ModuleItem::SetOnline(), sFxDataMgr, sFxProc, fxData::srcRef, InventoryItem::type(), and Module::State::Unfitted.

Referenced by ModuleManager::DamageModule(), ModuleManager::Deactivate(), ModuleManager::Offline(), ModuleManager::UnfitModule(), and ModuleManager::UninstallRig().

158 {
159  if (m_shipRef->GetPilot()->IsDocked()) {
162  return;
163  }
164 
165  //if (m_shipRef->GetPilot()->GetShipSE()->IsDead()) // SE->IsDead() for all SEs
166  if (m_shipRef->IsPopped()) // only for player ships
167  return;
168 
169  switch(m_ModuleState) {
171  m_modRef->SetOnline(false, isRig());
172  _log(MODULE__WARNING, "GenericModule::Offline() called for unfitted module %u(%s).",itemID(), m_modRef->name());
173  return;
174  }
175  case Module::State::Offline: {
176  m_modRef->SetOnline(false, isRig());
177  _log(MODULE__WARNING, "GenericModule::Offline() called for offline module %u(%s).",itemID(), m_modRef->name());
178  return;
179  }
180  // these two should only be called for activeModules...
182  _log(MODULE__MESSAGE, "GenericModule::Offline() called for deactivating module %u(%s).",itemID(), m_modRef->name());
183  if (IsActiveModule())
185  }
187  _log(MODULE__MESSAGE, "GenericModule::Offline() called for active module %u(%s).",itemID(), m_modRef->name());
188  if (IsActiveModule())
190  }
191  }
192 
194 
195  /* code for offlining module before MOD_OFFLINE state is set. */
200 
201  _log(MODULE__MESSAGE, "GenericModule::Offline() - %u(%s) cpu: %.2f, pg: %.2f",itemID(), m_modRef->name(), cpuNeed.get_float(), pgNeed.get_float());
202 
204  if (m_chargeRef.get() == nullptr) {
205  _log(MODULE__ERROR, "GenericModule::Offline() - module %u(%s) has ChargeState(CHG_LOADED) but m_chargeRef = NULL.", \
206  itemID(), m_modRef->name());
207  } else {
208  for (auto it : m_chargeRef->type().m_stateFxMap) {
209  fxData data = fxData();
211  data.srcRef = m_chargeRef;
212  sFxProc.ParseExpression(m_modRef.get(), sFxDataMgr.GetExpression(it.second.postExpression), data, this);
213  }
214  }
215  }
216 
219  sFxProc.ApplyEffects(m_modRef.get(), m_shipRef->GetPilot()->GetChar().get(), m_shipRef.get(), true);
220 
222  m_modRef->SetOnline(false, isRig());
223 }
#define _log(type, fmt,...)
Definition: logsys.h:124
void ProcessEffects(int8 state, bool active=false)
void SetOnline(bool online=false, bool isRig=false)
Definition: ModuleItem.cpp:57
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
const char * name()
InventoryItemRef srcRef
Definition: EffectsData.h:78
CharacterRef GetChar() const
Definition: Client.h:164
void SetAttribute(uint32 attrID, EvilNumber val, bool update=true)
Definition: GenericModule.h:51
uint32 itemID()
Definition: GenericModule.h:97
std::unordered_multimap< int8, Effect > m_stateFxMap
Definition: ItemType.h:154
ModuleItemRef m_modRef
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
const ItemType & type() const
ShipItemRef m_shipRef
bool IsDocked()
Definition: Client.h:229
InventoryItemRef m_chargeRef
#define sFxDataMgr
void SetAttribute(uint16 attrID, int num, bool notify=true)
X * get() const
Definition: RefPtr.h:213
virtual void AbortCycle()
uint8 action
Definition: EffectsData.h:73
bool IsPopped()
Definition: Ship.h:89
#define sFxProc
bool IsUndocking()
Definition: Ship.h:149
virtual Client * GetPilot()
Definition: Ship.h:72
EvilNumber GetAttribute(const uint16 attrID) const
virtual ActiveModule * GetActiveModule()
Definition: GenericModule.h:60
EvilNumber GetAttribute(uint32 attrID)
Definition: GenericModule.h:53
virtual bool IsActiveModule() const
Definition: GenericModule.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void GenericModule::Online ( )

Definition at line 69 of file GenericModule.cpp.

References _log, fxData::action, AttrCpu, AttrCpuLoad, AttrCpuOutput, AttrDamage, AttrHP, AttrOnline, AttrPower, AttrPowerLoad, AttrPowerOutput, EvilOne, RefPtr< X >::get(), EvilNumber::get_float(), GetAttribute(), InventoryItem::GetAttribute(), Client::GetChar(), GetModuleStateName(), ShipItem::GetPilot(), FX::Action::Invalid, Client::IsDocked(), Client::IsLogin(), isRig(), ShipItem::IsUndocking(), itemID(), InventoryItem::itemName(), Module::State::Loaded, m_chargeLoaded, m_chargeRef, m_ChargeState, m_modRef, m_ModuleState, m_shipRef, ItemType::m_stateFxMap, InventoryItem::name(), Module::State::Offline, Module::State::Online, FX::State::Online, FX::State::Passive, ProcessEffects(), Client::SendNotifyMsg(), SetAttribute(), InventoryItem::SetAttribute(), ModuleItem::SetOnline(), sFxDataMgr, sFxProc, fxData::srcRef, InventoryItem::type(), and Module::State::Unfitted.

Referenced by ActiveModule::Activate(), ModuleManager::Activate(), ModuleManager::AddModule(), and ModuleManager::Online().

70 {
71  if (m_shipRef->GetPilot()->IsDocked() and (!m_shipRef->IsUndocking())) {
74  return;
75  }
76 
78  _log(MODULE__ERROR, "GenericModule::Online() called for unfitted module %u(%s).",itemID(), m_modRef->name());
79  return;
80  }
82  _log(MODULE__MESSAGE, "GenericModule::Online() called for non-offline module %u(%s). State is %s", \
84  return; // already online
85  }
86 
88  m_shipRef->GetPilot()->SendNotifyMsg("Your %s is too damaged to be put online.", m_modRef->name());
89  return;
90  /*{'messageKey': 'ModuleTooDamagedToBeOnlined', 'dataID': 17878773, 'suppressable': False, 'bodyID': 257752, 'messageType': 'notify', 'urlAudio': '', 'urlIcon': '', 'titleID': None, 'messageID': 2303}
91  * u'ModuleTooDamagedToBeOnlinedBody'}(u'The module is too damaged to be onlined'
92  */
93  }
94  // check PG and CPU usage to see if we have enough to online this module
96  if (cpuNeed > m_shipRef->GetAttribute(AttrCpuOutput)) {
97  _log(MODULE__TRACE, "GenericModule::Online() %u(%s) - not enough CPU. (%.1f/%.1f)", \
98  itemID(), m_modRef->name(), cpuNeed.get_float(), m_shipRef->GetAttribute(AttrCpuOutput).get_float());
99  if (!m_shipRef->GetPilot()->IsLogin()) {
100  m_modRef->SetOnline(false, isRig());
101  float require(GetAttribute(AttrCpu).get_float());
103  float remaining(total - m_shipRef->GetAttribute(AttrCpuLoad).get_float());
104  std::string str = "To bring " + m_modRef->itemName() + " online requires %.2f cpu units, ";
105  str += "but only %.2f of the %.2f units that your computer produces are still available.";
106  m_shipRef->GetPilot()->SendNotifyMsg(str.c_str(), require, remaining, total);
107  }
108  return;
109  }
111  if (pgNeed > m_shipRef->GetAttribute(AttrPowerOutput)) {
112  _log(MODULE__TRACE, "GenericModule::Online() %u(%s) - not enough PG. (%.1f/%.1f)", \
113  itemID(), m_modRef->name(), pgNeed.get_float(), m_shipRef->GetAttribute(AttrPowerOutput).get_float());
114  if (!m_shipRef->GetPilot()->IsLogin()) {
115  m_modRef->SetOnline(false, isRig());
116  float require(GetAttribute(AttrPower).get_float());
118  float remaining(total - m_shipRef->GetAttribute(AttrPowerLoad).get_float());
119  std::string str = "To bring " + m_modRef->itemName() + " online requires %.2f power units, ";
120  str += "but only %.2f of the %.2f units that your power core produces are still available.";
121  m_shipRef->GetPilot()->SendNotifyMsg(str.c_str(), require, remaining, total);
122  }
123  return;
124  }
125 
126  m_modRef->SetOnline(true, isRig());
128  _log(MODULE__MESSAGE, "GenericModule::Online() - %u(%s) cpu: %.2f, pg: %.2f, loaded: %s", \
129  itemID(), m_modRef->name(), cpuNeed.get_float(), pgNeed.get_float(), m_ChargeState == Module::State::Loaded?"true":"false");
130 
134  if (!m_chargeLoaded) {
135  _log(MODULE__ERROR, "GenericModule::Online() - module %u(%s) has ChargeState(CHG_LOADED) but m_chargeLoaded = false.", \
136  itemID(), m_modRef->name());
137  } else if (m_chargeRef.get() == nullptr) {
138  _log(MODULE__ERROR, "GenericModule::Online() - module %u(%s) has ChargeState(CHG_LOADED) but m_chargeRef = NULL.", \
139  itemID(), m_modRef->name());
140  } else {
141  _log(MODULE__MESSAGE, "GenericModule::Online() - module %u(%s) loading charge fx for %s.", itemID(), m_modRef->name(), m_chargeRef->name());
142  for (auto it : m_chargeRef->type().m_stateFxMap) {
143  fxData data = fxData();
145  data.srcRef = m_chargeRef;
146  sFxProc.ParseExpression(m_modRef.get(), sFxDataMgr.GetExpression(it.second.preExpression), data, this);
147  }
148  }
149  }
150 
151  // update available ship resources.
155 }
bool IsLogin()
Definition: Client.h:235
#define _log(type, fmt,...)
Definition: logsys.h:124
void ProcessEffects(int8 state, bool active=false)
void SetOnline(bool online=false, bool isRig=false)
Definition: ModuleItem.cpp:57
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
const char * name()
InventoryItemRef srcRef
Definition: EffectsData.h:78
void SendNotifyMsg(const char *fmt,...)
Definition: Client.cpp:2776
CharacterRef GetChar() const
Definition: Client.h:164
void SetAttribute(uint32 attrID, EvilNumber val, bool update=true)
Definition: GenericModule.h:51
uint32 itemID()
Definition: GenericModule.h:97
std::unordered_multimap< int8, Effect > m_stateFxMap
Definition: ItemType.h:154
ModuleItemRef m_modRef
const ItemType & type() const
ShipItemRef m_shipRef
bool IsDocked()
Definition: Client.h:229
InventoryItemRef m_chargeRef
#define sFxDataMgr
void SetAttribute(uint16 attrID, int num, bool notify=true)
X * get() const
Definition: RefPtr.h:213
const char * GetModuleStateName(int8 state)
uint8 action
Definition: EffectsData.h:73
#define sFxProc
bool IsUndocking()
Definition: Ship.h:149
const std::string & itemName() const
virtual Client * GetPilot()
Definition: Ship.h:72
EvilNumber GetAttribute(const uint16 attrID) const
EvilNumber EvilOne
Definition: EvilNumber.cpp:34
float get_float()
Definition: EvilNumber.cpp:184
EvilNumber GetAttribute(uint32 attrID)
Definition: GenericModule.h:53

Here is the call graph for this function:

Here is the caller graph for this function:

void GenericModule::Overload ( )
virtual

Reimplemented in ActiveModule.

Definition at line 225 of file GenericModule.cpp.

References RefPtr< X >::get(), Client::GetChar(), ShipItem::GetPilot(), m_modRef, m_shipRef, FX::State::Overloaded, ProcessEffects(), and sFxProc.

Referenced by ActiveModule::Overload(), and ModuleManager::Overload().

226 {
228  sFxProc.ApplyEffects(m_modRef.get(), m_shipRef->GetPilot()->GetChar().get(), m_shipRef.get(), true);
229  //m_modRef->ClearModifiers();
230 }
void ProcessEffects(int8 state, bool active=false)
CharacterRef GetChar() const
Definition: Client.h:164
ModuleItemRef m_modRef
ShipItemRef m_shipRef
X * get() const
Definition: RefPtr.h:213
#define sFxProc
virtual Client * GetPilot()
Definition: Ship.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void GenericModule::Process ( )
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 113 of file GenericModule.h.

113 { /* do nothing here */ }
void GenericModule::ProcessEffects ( int8  state,
bool  active = false 
)

Definition at line 239 of file GenericModule.cpp.

References _log, fxData::action, RefPtr< X >::get(), ItemType::GetEffectMap(), FX::Action::Invalid, m_modRef, InventoryItem::name(), sFxDataMgr, sFxProc, fxData::srcRef, and InventoryItem::type().

Referenced by ActiveModule::ApplyEffect(), DeOverload(), Offline(), Online(), and Overload().

240 {
241  // get module/charge pre/post effects in state x
242  std::map<uint16, Effect> effectMap;
243  m_modRef->type().GetEffectMap(state, effectMap);
244  _log(EFFECTS__TRACE, "GenericModule::ProcessEffects() called for %s. effects: %u, state: %s, online: %s", \
245  m_modRef->name(), effectMap.size(), sFxProc.GetStateName(state), (active ? "true" : "false"));
246  for (auto it : effectMap) {
247  if (it.first == 16) // skip the online effect. this is done internally elsewhere
248  continue;
249  fxData data = fxData();
251  data.srcRef = m_modRef;
252  /* module and charge effects will be added/removed from it's item
253  * active/overload/gang/other effects will be applied and removed when called.
254  */
255  if (active) {
256  sFxProc.ParseExpression(m_modRef.get(), sFxDataMgr.GetExpression(it.second.preExpression), data, this);
257  } else {
258  sFxProc.ParseExpression(m_modRef.get(), sFxDataMgr.GetExpression(it.second.postExpression), data, this);
259  }
260  }
261 }
void GetEffectMap(const int8 state, std::map< uint16, Effect > &effectMap) const
Definition: ItemType.cpp:217
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * name()
InventoryItemRef srcRef
Definition: EffectsData.h:78
ModuleItemRef m_modRef
const ItemType & type() const
#define sFxDataMgr
X * get() const
Definition: RefPtr.h:213
uint8 action
Definition: EffectsData.h:73
#define sFxProc
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void GenericModule::ReloadCharge ( )
inlinevirtual

Definition at line 123 of file GenericModule.h.

123 { /* do nothing here */ }
virtual void GenericModule::RemoveRig ( )
inlinevirtual

Reimplemented in RigModule.

Definition at line 124 of file GenericModule.h.

Referenced by ModuleManager::UninstallRig().

124 { /* do nothing here */ }

Here is the caller graph for this function:

virtual void GenericModule::RemoveTarget ( SystemEntity pSE)
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 130 of file GenericModule.h.

130 { /* do nothing here */ }
void GenericModule::Repair ( )
inline

Definition at line 47 of file GenericModule.h.

References AttrDamage, m_modRef, and InventoryItem::ResetAttribute().

Referenced by ModuleManager::RepairModule().

void ResetAttribute(uint16 attrID, bool notify=false)
ModuleItemRef m_modRef

Here is the call graph for this function:

Here is the caller graph for this function:

void GenericModule::Repair ( EvilNumber  amount)

Definition at line 264 of file GenericModule.cpp.

References _log, AttrDamage, EvilZero, EvilNumber::get_int(), GetAttribute(), m_modRef, InventoryItem::name(), and SetAttribute().

265 {
266  if (GetAttribute(AttrDamage) > 0) {
267  EvilNumber newAmount = GetAttribute(AttrDamage) - amount;
268  if (newAmount < EvilZero)
269  newAmount = EvilZero;
270  SetAttribute(AttrDamage, newAmount);
271  }
272  _log(MODULE__DAMAGE, "GenericModule::Repair() - %s repaired %u damage. new damage %u", m_modRef->name(), amount, GetAttribute(AttrDamage).get_int());
273 }
#define _log(type, fmt,...)
Definition: logsys.h:124
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
const char * name()
void SetAttribute(uint32 attrID, EvilNumber val, bool update=true)
Definition: GenericModule.h:51
ModuleItemRef m_modRef
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
int64 get_int()
Definition: EvilNumber.cpp:166
EvilNumber GetAttribute(uint32 attrID)
Definition: GenericModule.h:53

Here is the call graph for this function:

virtual void GenericModule::ReprocessCharge ( )
inlinevirtual

Reimplemented in ActiveModule.

Definition at line 126 of file GenericModule.h.

126 { /* do nothing here */ }
void GenericModule::ResetAttribute ( uint32  attrID)
inline

Definition at line 52 of file GenericModule.h.

References m_modRef, and InventoryItem::ResetAttribute().

Referenced by ActiveModule::Update().

52 { m_modRef->ResetAttribute(attrID); }
void ResetAttribute(uint16 attrID, bool notify=false)
ModuleItemRef m_modRef

Here is the call graph for this function:

Here is the caller graph for this function:

void GenericModule::SetAttribute ( uint32  attrID,
EvilNumber  val,
bool  update = true 
)
inline

Definition at line 51 of file GenericModule.h.

References m_modRef, and InventoryItem::SetAttribute().

Referenced by ActiveModule::ActiveModule(), CynoModule::CynoModule(), ModuleManager::DamageModule(), Offline(), Online(), Prospector::Prospector(), Repair(), Prospector::Update(), and ActiveModule::Update().

51 { m_modRef->SetAttribute(attrID, val, update); }
ModuleItemRef m_modRef
void SetAttribute(uint16 attrID, int num, bool notify=true)

Here is the call graph for this function:

Here is the caller graph for this function:

void GenericModule::SetChargeRef ( InventoryItemRef  iRef)
inline

Definition at line 102 of file GenericModule.h.

References m_chargeRef.

102 { m_chargeRef = iRef; }
InventoryItemRef m_chargeRef
void GenericModule::SetChargeState ( int8  state)
inline

Definition at line 104 of file GenericModule.h.

References m_ChargeState, and state.

104 { m_ChargeState = state; }
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state
void GenericModule::SetLinked ( bool  set = false)
inline

Definition at line 105 of file GenericModule.h.

References m_linked.

Referenced by ShipItem::LinkWeapon(), and ShipItem::LoadWeaponGroups().

105 { m_linked = set; }

Here is the caller graph for this function:

void GenericModule::SetLinkMaster ( bool  set = false)
inline

Definition at line 106 of file GenericModule.h.

References m_linkMaster.

Referenced by ShipItem::LinkWeapon(), and ShipItem::LoadWeaponGroups().

106 { m_linkMaster = set; }

Here is the caller graph for this function:

void GenericModule::SetModuleState ( int8  state)
inline

Definition at line 103 of file GenericModule.h.

References m_ModuleState, and state.

Referenced by ActiveModule::AbortCycle(), ActiveModule::Activate(), ModuleManager::AddModule(), ActiveModule::Clear(), ActiveModule::Deactivate(), MiningLaser::DeactivateCycle(), ModuleManager::Offline(), and ActiveModule::ProcessActiveCycle().

103 { m_ModuleState = state; }
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state

Here is the caller graph for this function:

uint32 GenericModule::typeID ( )
inline

Definition at line 98 of file GenericModule.h.

References m_modRef, and InventoryItem::typeID().

Referenced by ActiveModule::CanActivate(), ActiveModule::DoCycle(), ShipItem::LinkWeaponLoop(), and ModuleManager::UninstallRig().

98 { return m_modRef->typeID(); }
ModuleItemRef m_modRef
uint16 typeID() const

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void GenericModule::UnloadCharge ( )
inlinevirtual

Reimplemented in ActiveModule, MiningLaser, and TurretModule.

Definition at line 121 of file GenericModule.h.

Referenced by ModuleManager::UnloadCharge().

121 { /* do nothing here */ }

Here is the caller graph for this function:

virtual void GenericModule::Update ( )
inlinevirtual

Reimplemented in ActiveModule, and Prospector.

Definition at line 136 of file GenericModule.h.

137  { /* do nothing here */ }

Member Data Documentation

int8 GenericModule::m_ChargeState
protected
bool GenericModule::m_hiPower
protected

Definition at line 162 of file GenericModule.h.

Referenced by GenericModule(), GetModulePowerLevel(), and isHighPower().

bool GenericModule::m_isWarpSafe
protected

Definition at line 161 of file GenericModule.h.

Referenced by ActiveModule::Activate(), and isWarpSafe().

bool GenericModule::m_launcher
protected

Definition at line 167 of file GenericModule.h.

Referenced by ActiveModule::CanActivate(), GenericModule(), and IsLauncherModule().

bool GenericModule::m_linked
protected

Definition at line 160 of file GenericModule.h.

Referenced by IsLinked(), and SetLinked().

bool GenericModule::m_linkMaster
protected
bool GenericModule::m_loPower
protected

Definition at line 164 of file GenericModule.h.

Referenced by GenericModule(), GetModulePowerLevel(), and isLowPower().

bool GenericModule::m_medPower
protected

Definition at line 163 of file GenericModule.h.

Referenced by GenericModule(), GetModulePowerLevel(), and isMediumPower().

bool GenericModule::m_overLoaded
protected
bool GenericModule::m_rigSlot
protected

Definition at line 165 of file GenericModule.h.

Referenced by GenericModule(), GetModulePowerLevel(), and isRig().

bool GenericModule::m_subSystem
protected

Definition at line 166 of file GenericModule.h.

Referenced by GenericModule(), GetModulePowerLevel(), and isSubSystem().

bool GenericModule::m_turret
protected

Definition at line 168 of file GenericModule.h.

Referenced by ActiveModule::CanActivate(), GenericModule(), and IsTurretModule().


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