EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Celestial.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 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
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: Bloody.Rabbit
24 */
25 
26 #ifndef __CELESTIAL__H__INCL__
27 #define __CELESTIAL__H__INCL__
28 
29 #include "EVEServerConfig.h"
30 #include "StaticDataMgr.h"
32 #include "system/SystemEntity.h"
33 
38 {
39 public:
41  double _radius = 0.0,
42  double _security = 0.0,
43  uint8 _celestialIndex = 0,
44  uint8 _orbitIndex = 0
45  );
46 
47 /* these have to be public for inventorydb to load into them */
48  double radius;
49  double security;
52 };
53 
58 : public InventoryItem
59 {
60  friend class InventoryItem; // to let it construct us
61 public:
62  CelestialObject(uint32 _celestialID, const ItemType &_type, const ItemData &_data);
63  CelestialObject(uint32 _celestialID, const ItemType &_type, const ItemData &_data, const CelestialObjectData &_cData);
64  virtual ~CelestialObject() { /* do nothing here */ }
65 
66  static CelestialObjectRef Load( uint32 celestialID);
67  static CelestialObjectRef Spawn( ItemData &data);
68 
69  void Delete();
70 
71  double radius() const { return m_radius; }
72  double security() const { return m_security; }
74  uint8 orbitIndex() const { return m_orbitIndex; }
75 
76 protected:
78  //virtual bool _Load();
79 
80  // Template loader:
81  template<class _Ty>
82  static RefPtr<_Ty> _LoadItem( uint32 celestialID, const ItemType &type, const ItemData &data)
83  {
85  _log(ITEM__ERROR, "Trying to load %s as Celestial.", sDataMgr.GetCategoryName(type.categoryID()));
86  if (sConfig.debug.StackTrace)
88  return RefPtr<_Ty>();
89  }
90 
92  if (!sItemFactory.db()->GetCelestialObject(celestialID, cData))
93  return RefPtr<_Ty>();
94 
95  return CelestialObjectRef( new CelestialObject(celestialID, type, data, cData ) );
96  }
97 
98  static uint32 CreateItemID( ItemData &data);
99 
100  /* these have to be public for inventorydb to load into them. */
101  double m_radius;
102  double m_security;
105 };
106 
107 
111 class PyServiceMgr;
112 
114 public:
116  virtual ~CelestialSE() { /* Do nothing here */ }
117 
118  /* class type pointer querys. */
119  virtual const CelestialSE* GetCelestialSE() { return this; }
120  /* class type tests. */
121  virtual bool IsCelestialSE() { return true; }
122 
123  /* SystemEntity interface */
124  virtual void MakeDamageState(DoDestinyDamageState &into);
125 
126 };
127 
128 class AnomalySE : public CelestialSE {
129 public:
131  virtual ~AnomalySE() { /* Do nothing here */ }
132 
133  /* class type pointer querys. */
134  virtual AnomalySE* GetAnomalySE() { return this; }
135  /* class type tests. */
136  /* Base */
137  virtual bool IsAnomalySE() { return true; }
138 
139  /* SystemEntity interface */
140  virtual void EncodeDestiny( Buffer& into );
141 
142  virtual PyDict* MakeSlimItem();
143 };
144 
145 class WormholeSE : public CelestialSE {
146 public:
148  virtual ~WormholeSE() { /* Do nothing here */ }
149 
150  /* class type pointer querys. */
151  virtual WormholeSE* GetWormholeSE() { return this; }
152  /* class type tests. */
153  /* Base */
154  virtual bool IsWormholeSE() { return true; }
155 
156  /* SystemEntity interface */
157  virtual void EncodeDestiny( Buffer& into );
158 
159  virtual PyDict* MakeSlimItem();
160 
161 private:
168 };
169 
170 namespace WormHole {
171  namespace Class {
172  enum {
173  Unknown1 = 0,
174  Unknown2 = 1,
175  Unknown3 = 2,
176  Unknown4 = 3,
179  Deadly = 6,
180  HiSec = 7,
181  LoSec = 8,
183  };
184  }
185 
186  namespace Age {
187  enum {
188  New = 0,
190  Decaying = 2,
192  };
193  }
194 
195  namespace Size {
196  // these are fuzzy logic
197  enum {
198  Full = 10,
199  Reduced = 5,
201  };
202  }
203 }
204 
205 #endif /* !__CELESTIAL__H__INCL__ */
206 
207 
#define sConfig
A macro for easier access to the singleton.
virtual void EncodeDestiny(Buffer &into)
Definition: Celestial.cpp:127
unsigned __int8 uint8
Definition: eve-compat.h:46
virtual bool IsWormholeSE()
Definition: Celestial.h:154
AnomalySE(CelestialObjectRef self, PyServiceMgr &services, SystemManager *system)
Definition: Celestial.cpp:121
static CelestialObjectRef Load(uint32 celestialID)
Definition: Celestial.cpp:67
#define _log(type, fmt,...)
Definition: logsys.h:124
static uint32 CreateItemID(ItemData &data)
Definition: Celestial.cpp:86
Python's dictionary.
Definition: PyRep.h:719
virtual const CelestialSE * GetCelestialSE()
Definition: Celestial.h:119
CelestialObjectData(double _radius=0.0, double _security=0.0, uint8 _celestialIndex=0, uint8 _orbitIndex=0)
Definition: Celestial.cpp:36
virtual bool IsCelestialSE()
Definition: Celestial.h:121
double security() const
Definition: Celestial.h:72
uint8 orbitIndex() const
Definition: Celestial.h:74
uint16 m_count
Definition: Celestial.h:165
static RefPtr< _Ty > _LoadItem(uint32 celestialID, const ItemType &type, const ItemData &data)
Definition: Celestial.h:82
static CelestialObjectRef Spawn(ItemData &data)
Definition: Celestial.cpp:72
virtual bool _Load()
uint8 celestialIndex() const
Definition: Celestial.h:73
RefPtr< CelestialObject > CelestialObjectRef
Definition: ItemRef.h:55
CelestialObject(uint32 _celestialID, const ItemType &_type, const ItemData &_data)
Definition: Celestial.cpp:47
signed __int8 int8
Definition: eve-compat.h:45
float m_wormholeSize
Definition: Celestial.h:163
virtual ~AnomalySE()
Definition: Celestial.h:131
uint8 categoryID() const
Definition: ItemType.h:66
virtual AnomalySE * GetAnomalySE()
Definition: Celestial.h:134
const ItemType & type() const
virtual ~WormholeSE()
Definition: Celestial.h:148
uint16 m_nebulaType
Definition: Celestial.h:167
uint8 m_orbitIndex
Definition: Celestial.h:104
Generic class for buffers.
Definition: Buffer.h:40
PyTuple * MakeDamageState()
double radius() const
Definition: Celestial.h:71
uint16 m_dunSpawnID
Definition: Celestial.h:166
virtual WormholeSE * GetWormholeSE()
Definition: Celestial.h:151
virtual ~CelestialSE()
Definition: Celestial.h:116
double m_security
Definition: Celestial.h:102
unsigned __int32 uint32
Definition: eve-compat.h:50
double m_radius
Definition: Celestial.h:101
virtual PyDict * MakeSlimItem()
Definition: Celestial.cpp:153
virtual bool IsAnomalySE()
Definition: Celestial.h:137
WormholeSE(CelestialObjectRef self, PyServiceMgr &services, SystemManager *system)
Definition: Celestial.cpp:164
signed __int64 int64
Definition: eve-compat.h:51
CelestialSE(InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
Definition: Celestial.cpp:95
int64 m_expiryDate
Definition: Celestial.h:164
virtual void EncodeDestiny(Buffer &into)
Definition: Celestial.cpp:178
virtual PyDict * MakeSlimItem()
Definition: Celestial.cpp:203
uint8 m_celestialIndex
Definition: Celestial.h:103
void traceStack(void)
Definition: misc.cpp:169
virtual ~CelestialObject()
Definition: Celestial.h:64
#define sItemFactory
Definition: ItemFactory.h:165
int8 m_wormholeAge
Definition: Celestial.h:162
unsigned __int16 uint16
Definition: eve-compat.h:48
Reference-counting-based smart pointer.
Definition: RefPtr.h:133
#define sDataMgr