EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GenericModule.h
Go to the documentation of this file.
1 
10 #ifndef _EVE_SHIP_MODULES_GENERIC_MODULE_H
11 #define _EVE_SHIP_MODULES_GENERIC_MODULE_H
12 
13 #include "EVEServerConfig.h"
16 #include "ship/Ship.h"
19 #include "system/SystemEntity.h"
20 
21 class ActiveModule;
22 class PassiveModule;
23 class MiningLaser;
24 class Prospector;
25 class TurretModule;
26 class SuperWeapon;
27 class RigModule;
28 class CynoModule;
29 class SubSystemModule;
30 
31 /* generic module base class */
33 {
34 public:
36  virtual ~GenericModule();
37 
38  /* generic functions handled in base class */
39  void Online(); // this function must NOT throw
40  void Offline(); // this function must NOT throw
41 
44 
45  void ProcessEffects(int8 state, bool active = false);
46 
48  void Repair(EvilNumber amount);
49 
50  bool HasAttribute(uint32 attrID) { return m_modRef->HasAttribute(attrID); }
51  void SetAttribute(uint32 attrID, EvilNumber val, bool update=true) { m_modRef->SetAttribute(attrID, val, update); }
52  void ResetAttribute(uint32 attrID) { m_modRef->ResetAttribute(attrID); }
53  EvilNumber GetAttribute(uint32 attrID) { return m_modRef->GetAttribute(attrID); }
54 
55  bool isWarpSafe() { return m_isWarpSafe; }
58 
59  /* class type pointer querys, public for anyone to access. */
60  virtual ActiveModule* GetActiveModule() { return nullptr; }
61  virtual PassiveModule* GetPassiveModule() { return nullptr; }
62  virtual MiningLaser* GetMiningModule() { return nullptr; }
63  virtual Prospector* GetProspectModule() { return nullptr; }
64  virtual TurretModule* GetTurretModule() { return nullptr; }
65  virtual SuperWeapon* GetSuperWeapon() { return nullptr; }
66  virtual RigModule* GetRigModule() { return nullptr; }
67  virtual SubSystemModule* GetSubSystemModule() { return nullptr; }
68  virtual CynoModule* GetCynoModule() { return nullptr; }
69  /* class type helpers. public for anyone to access. */
70  virtual bool IsGenericModule() const { return true; }
71  virtual bool IsPassiveModule() const { return false; }
72  virtual bool IsActiveModule() const { return false; }
73  virtual bool IsMiningLaser() const { return false; }
74  virtual bool IsProspectModule() const { return false; }
75  virtual bool IsCynoModule() const { return false; }
76  virtual bool IsRigModule() const { return false; } // check this in m_rigSlot?
77  virtual bool IsSubSystemModule() const { return false; } // check this in m_subSystem?
78 
79  bool IsLoaded() { return (m_chargeLoaded and (m_chargeRef.get() != nullptr)); }
80  bool IsTurretModule() { return m_turret; }
81  bool IsLauncherModule() { return m_launcher; }
82  bool IsOverloaded() { return m_overLoaded; }
83  bool IsLinked() { return m_linked; }
84  bool IsMaster() { return m_linkMaster; }
88 
89  /* generic access functions handled here, but set elsewhere. */
90  bool isOnline() { return m_modRef->IsOnline(); }
91  bool isLowPower() { return m_loPower; }
92  bool isHighPower() { return m_hiPower; }
93  bool isMediumPower() { return m_medPower; }
94  bool isRig() { return m_rigSlot; }
95  bool isSubSystem() { return m_subSystem; }
96 
97  uint32 itemID() { return m_modRef->itemID(); }
98  uint32 typeID() { return m_modRef->typeID(); }
99  uint32 groupID() { return m_modRef->groupID(); }
100  EVEItemFlags flag() { return m_modRef->flag(); }
101 
105  void SetLinked(bool set=false) { m_linked = set; }
106  void SetLinkMaster(bool set=false) { m_linkMaster = set; }
107 
111 
112  /* generic access functions to be handled in derived classes (must override) */
113  virtual void Process() { /* do nothing here */ }
114  virtual void Deactivate(std::string effect="") { /* do nothing here */ }
115  virtual void AbortCycle() { /* do nothing here */ }
116  // this will not move charge item.
117  // must NOT throw
118  virtual void LoadCharge(InventoryItemRef charge) { /* do nothing here */ }
119  // this will not move charge item.
120  // must NOT throw
121  virtual void UnloadCharge() { /* do nothing here */ }
122  // this will physically add charge to module,
123  virtual void ReloadCharge() { /* do nothing here */ }
124  virtual void RemoveRig() { /* do nothing here */ }
125  virtual void DestroyRig() { /* do nothing here */ }
126  virtual void ReprocessCharge() { /* do nothing here */ }
127 
128  virtual void Activate(uint16 effectID, uint32 targetID=0, int16 repeat=0)
129  { /* do nothing here */ }
130  virtual void RemoveTarget(SystemEntity* pSE) { /* do nothing here */ }
131 
132  // check for Prospector (so far) modules defaulted here for generic access
133  virtual bool IsSuccess() { return false; }
134 
135  /* generic access functions to be overridden in derived classes as needed */
136  virtual void Update() // this is used to set char mods on active modules created before pilot entered ship
137  { /* do nothing here */ }
138  virtual void Overload();
139  virtual void DeOverload();
140  virtual uint16 GetReloadTime() { return 0; }
141  virtual uint32 GetTargetID() { return 0; }
142 
143  //
145 
146 
147 protected:
148  const char* GetModuleStateName(int8 state);
149 
153 
156 
158 
159  bool m_linkMaster :1;
160  bool m_linked :1;
161  bool m_isWarpSafe :1;
162  bool m_hiPower :1;
163  bool m_medPower :1;
164  bool m_loPower :1;
165  bool m_rigSlot :1;
166  bool m_subSystem :1;
167  bool m_launcher :1;
168  bool m_turret :1;
169  bool m_overLoaded :1;
170  bool m_chargeLoaded :1;
171 };
172 
173 #endif // _EVE_SHIP_MODULES_GENERIC_MODULE_H
virtual SuperWeapon * GetSuperWeapon()
Definition: GenericModule.h:65
void ResetAttribute(uint32 attrID)
Definition: GenericModule.h:52
bool isHighPower()
Definition: GenericModule.h:92
virtual TurretModule * GetTurretModule()
Definition: GenericModule.h:64
virtual void Process()
virtual bool IsSuccess()
bool isLauncherFitted()
Definition: GenericModule.h:57
virtual bool IsCynoModule() const
Definition: GenericModule.h:75
virtual CynoModule * GetCynoModule()
Definition: GenericModule.h:68
bool IsDamaged()
Definition: GenericModule.h:85
virtual Prospector * GetProspectModule()
Definition: GenericModule.h:63
virtual void AbortCycle()
void ProcessEffects(int8 state, bool active=false)
bool isMediumPower()
Definition: GenericModule.h:93
bool HasAttribute(uint32 attrID)
Definition: GenericModule.h:50
bool HasAttribute(const uint16 attrID) const
virtual uint16 GetReloadTime()
uint32 groupID()
Definition: GenericModule.h:99
void ResetAttribute(uint16 attrID, bool notify=false)
virtual void DeOverload()
EVEItemFlags
Definition: EVE_Flags.h:13
bool isWarpSafe()
Definition: GenericModule.h:55
virtual void RemoveRig()
InventoryItemRef GetLoadedChargeRef()
virtual bool IsPassiveModule() const
Definition: GenericModule.h:71
bool HasEffect(uint16 effectID) const
Definition: ItemType.cpp:208
virtual void ReprocessCharge()
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
void SetAttribute(uint32 attrID, EvilNumber val, bool update=true)
Definition: GenericModule.h:51
bool IsTurretModule()
Definition: GenericModule.h:80
uint32 itemID()
Definition: GenericModule.h:97
signed __int8 int8
Definition: eve-compat.h:45
ModuleItemRef m_modRef
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
int8 GetChargeState()
virtual ~GenericModule()
int8 GetModuleState()
uint16 groupID() const
const ItemType & type() const
void SetChargeState(int8 state)
ShipItemRef m_shipRef
bool IsLoading()
Definition: GenericModule.h:87
virtual bool IsProspectModule() const
Definition: GenericModule.h:74
virtual void Activate(uint16 effectID, uint32 targetID=0, int16 repeat=0)
ModuleItemRef GetSelf()
Definition: GenericModule.h:42
InventoryItemRef m_chargeRef
virtual bool IsMiningLaser() const
Definition: GenericModule.h:73
bool isLowPower()
Definition: GenericModule.h:91
virtual void Update()
virtual void Overload()
void SetAttribute(uint16 attrID, int num, bool notify=true)
X * get() const
Definition: RefPtr.h:213
virtual uint32 GetTargetID()
virtual void RemoveTarget(SystemEntity *pSE)
const char * GetModuleStateName(int8 state)
int8 GetModulePowerLevel()
ShipItemRef GetShipRef()
Definition: GenericModule.h:43
unsigned __int32 uint32
Definition: eve-compat.h:50
EVEItemFlags flag() const
virtual SubSystemModule * GetSubSystemModule()
Definition: GenericModule.h:67
virtual void ReloadCharge()
bool isTurretFitted()
Definition: GenericModule.h:56
EVEItemFlags flag()
virtual bool IsSubSystemModule() const
Definition: GenericModule.h:77
virtual bool IsGenericModule() const
Definition: GenericModule.h:70
GenericModule(ModuleItemRef mRef, ShipItemRef sRef)
virtual void UnloadCharge()
EvilNumber GetAttribute(const uint16 attrID) const
signed __int16 int16
Definition: eve-compat.h:47
virtual void LoadCharge(InventoryItemRef charge)
virtual RigModule * GetRigModule()
Definition: GenericModule.h:66
void SetChargeRef(InventoryItemRef iRef)
virtual void DestroyRig()
virtual PassiveModule * GetPassiveModule()
Definition: GenericModule.h:61
virtual ActiveModule * GetActiveModule()
Definition: GenericModule.h:60
void SetLinkMaster(bool set=false)
bool IsLauncherModule()
Definition: GenericModule.h:81
bool isSubSystem()
Definition: GenericModule.h:95
virtual MiningLaser * GetMiningModule()
Definition: GenericModule.h:62
unsigned __int16 uint16
Definition: eve-compat.h:48
void SetLinked(bool set=false)
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
EvilNumber GetAttribute(uint32 attrID)
Definition: GenericModule.h:53
virtual void Deactivate(std::string effect="")
bool IsOverloaded()
Definition: GenericModule.h:82
uint16 typeID() const
void SetModuleState(int8 state)
virtual bool IsActiveModule() const
Definition: GenericModule.h:72
uint32 typeID()
Definition: GenericModule.h:98
uint32 itemID() const
Definition: InventoryItem.h:98
virtual bool IsRigModule() const
Definition: GenericModule.h:76