EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Drone.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2008 The EVEmu Team
7  For the latest information visit http://evemu.mmoforge.org
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Aknor Jaden
24  Updates: Allan
25 */
26 
27 #ifndef __DRONE__H__INCL__
28 #define __DRONE__H__INCL__
29 
30 #include "Client.h"
31 #include "npc/DroneAI.h"
32 #include "system/SystemEntity.h"
33 
38 class PyServiceMgr;
39 class Item;
40 class DestinyManager;
41 class SystemManager;
42 class ServiceDB;
43 class NPCAIMgr;
44 class Damage;
45 
46 class DroneSE
47 : public DynamicSystemEntity
48 {
49 public:
50  DroneSE(InventoryItemRef drone, PyServiceMgr& services, SystemManager* pSystem, const FactionData& data);
51  virtual ~DroneSE();
52 
53  /* class type pointer querys. */
54  virtual DroneSE* GetDroneSE() { return this; }
55  /* class type tests. */
56  virtual bool IsDroneSE() { return true; }
57 
58  /* SystemEntity interface */
59  virtual void Process();
60  virtual void EncodeDestiny( Buffer& into );
61  virtual void MakeDamageState(DoDestinyDamageState &into);
62  virtual PyDict* MakeSlimItem();
63 
64  /* virtual functions default to base class and overridden as needed */
65  virtual void Killed(Damage &fatal_blow);
66  virtual void Abandon(); // reset all owner info and bubblecast new data
67 
68  virtual void TargetAdded(SystemEntity *who);
69  virtual void TargetLost(SystemEntity *who);
70  virtual void TargetedAdd(SystemEntity *who);
71  virtual void TargetedLost(SystemEntity *who);
72 
73  /* specific functions handled here. */
74  Client* GetOwner() { return m_pClient; }
75  DroneAIMgr* GetAI() { return m_AI; }
76 
77  void Launch(ShipSE* pShipSE); //add drone entity to system
78  void Online(ShipSE* pShipSE=nullptr); // if nullptr sent, assign to controlling ship
79  void Offline();
80  void StateChange();
81  //begin idle orbit around assigned ship
82  void IdleOrbit(ShipSE* pShipSE=nullptr);
83 
84  void SaveDrone();
85  void RemoveDrone();
86  void SetResists();
87  void SetOwner(Client* pClient);
88 
89  uint32 GetBounty() const { return (m_pClient == nullptr ? 0 : m_pClient->GetChar()->bounty()); }
90 
91  float GetThermal() { return m_therDamage; }
92  float GetEM() { return m_emDamage; }
93  float GetKinetic() { return m_kinDamage; }
94  float GetExplosive() { return m_expDamage; }
95  float GetSecurityRating() const { return (m_pClient == nullptr ? 0.0 : m_pClient->GetChar()->GetSecurityRating()); }
96 
97  double GetOrbitRange() { return m_orbitRange; }
98 
99  /* for destiny setstate */
100  uint8 GetState() { return m_AI->GetState(); }
103  uint32 GetTargetID() { return m_targetID/*m_targMgr->GetFirstTarget()->GetID()*/; }
104 
105  /* misc methods */
106  void Enable() { m_online = true; }
107  void Disable() { m_online = false; }
108  bool IsEnabled() { return m_online; }
109 
110  void AssignShip(ShipSE* pSE) { m_AI->AssignShip(pSE); }
111  void SetTarget(SystemEntity* pSE = nullptr) { (pSE == nullptr ? 0 : m_targetID = pSE->GetID()); }
112 
113  ShipSE* GetHomeShip() { return m_pShipSE; }
114 
115 protected:
116  Client* m_pClient; //we do not own this
117  DroneAIMgr* m_AI; //we do own this
118  ShipSE* m_pShipSE; //we do not own this
119  SystemManager* m_system; //we do not own this
120 
121 private:
122  bool m_online; // is drone within ship's control range?
126 
127  double m_orbitRange;
128  double m_emDamage;
129  double m_expDamage;
130  double m_kinDamage;
131  double m_therDamage;
132  double m_hullDamage;
136 };
137 
138 #endif /* !__DRONE__H__INCL__ */
139 
140 
DroneSE(InventoryItemRef drone, PyServiceMgr &services, SystemManager *pSystem, const FactionData &data)
Definition: Drone.cpp:40
void AssignShip(ShipSE *pSE)
Definition: DroneAI.h:62
unsigned __int8 uint8
Definition: eve-compat.h:46
uint32 m_controllerOwnerID
Definition: Drone.h:125
virtual void TargetedAdd(SystemEntity *who)
Definition: Drone.cpp:243
float GetSecurityRating() const
Definition: Character.h:289
void Online(ShipSE *pShipSE=nullptr)
Definition: Drone.cpp:153
uint32 GetControllerID()
Definition: Drone.h:101
double m_orbitRange
Definition: Drone.h:127
Python's dictionary.
Definition: PyRep.h:719
int8 GetState()
Definition: DroneAI.cpp:121
double m_expDamage
Definition: Drone.h:129
float GetThermal()
Definition: Drone.h:91
void StateChange()
Definition: Drone.cpp:204
DroneAIMgr * GetAI()
Definition: Drone.h:75
virtual void TargetedLost(SystemEntity *who)
Definition: Drone.cpp:247
float bounty() const
Definition: Character.h:287
bool m_online
Definition: Drone.h:122
CharacterRef GetChar() const
Definition: Client.h:164
float GetSecurityRating() const
Definition: Drone.h:95
void SetOwner(Client *pClient)
Definition: Drone.cpp:104
Definition: Ship.h:301
void Offline()
Definition: Drone.cpp:163
uint32 GetControllerOwnerID()
Definition: Drone.h:102
float GetEM()
Definition: Drone.h:92
Client * GetOwner()
Definition: Drone.h:74
void SetTarget(SystemEntity *pSE=nullptr)
Definition: Drone.h:111
SystemManager * m_system
Definition: Drone.h:119
Generic class for buffers.
Definition: Buffer.h:40
PyTuple * MakeDamageState()
uint32 GetTargetID()
Definition: Drone.h:103
Definition: Damage.h:33
double m_shieldCapacity
Definition: Drone.h:135
void SaveDrone()
Definition: Drone.cpp:132
virtual void TargetLost(SystemEntity *who)
Definition: Drone.cpp:239
float GetKinetic()
Definition: Drone.h:93
virtual void EncodeDestiny(Buffer &into)
Definition: Drone.cpp:268
Definition: Client.h:66
Definition: Drone.h:46
unsigned __int32 uint32
Definition: eve-compat.h:50
void Disable()
Definition: Drone.h:107
virtual void Process()
Definition: Drone.cpp:116
Client * m_pClient
Definition: Drone.h:116
virtual void Killed(Damage &fatal_blow)
Definition: Drone.cpp:371
uint32 m_controllerID
Definition: Drone.h:124
double m_shieldCharge
Definition: Drone.h:134
void Launch(ShipSE *pShipSE)
Definition: Drone.cpp:142
double m_armorDamage
Definition: Drone.h:133
double m_emDamage
Definition: Drone.h:128
virtual ~DroneSE()
Definition: Drone.cpp:100
Definition: NPCAI.h:54
ShipSE * m_pShipSE
Definition: Drone.h:118
bool IsEnabled()
Definition: Drone.h:108
virtual PyDict * MakeSlimItem()
Definition: Drone.cpp:251
virtual DroneSE * GetDroneSE()
Definition: Drone.h:54
DroneAIMgr * m_AI
Definition: Drone.h:117
double m_hullDamage
Definition: Drone.h:132
void SetResists()
Definition: Drone.cpp:355
uint8 GetState()
Definition: Drone.h:100
float GetExplosive()
Definition: Drone.h:94
virtual bool IsDroneSE()
Definition: Drone.h:56
uint32 GetBounty() const
Definition: Drone.h:89
uint32 m_targetID
Definition: Drone.h:123
virtual void Abandon()
Definition: Drone.cpp:185
void Enable()
Definition: Drone.h:106
virtual void TargetAdded(SystemEntity *who)
Definition: Drone.cpp:235
void AssignShip(ShipSE *pSE)
Definition: Drone.h:110
void RemoveDrone()
Definition: Drone.cpp:136
double GetOrbitRange()
Definition: Drone.h:97
void IdleOrbit(ShipSE *pShipSE=nullptr)
Definition: Drone.cpp:171
double m_kinDamage
Definition: Drone.h:130
ShipSE * GetHomeShip()
Definition: Drone.h:113
double m_therDamage
Definition: Drone.h:131