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

#include "WormholeMgr.h"

Inheritance diagram for WormholeMgr:
Collaboration diagram for WormholeMgr:

Public Member Functions

WormholeMgr.cpp

WH management system for EVEmu

: Allan

Date
: 12 December 2015
 WormholeMgr ()
 
 ~WormholeMgr ()
 
void Initialize (PyServiceMgr *svc)
 
void Process ()
 
void Create (CosmicSignature &sig)
 
void CreateExit (SystemManager *pFromSys, SystemManager *pToSys)
 
- Public Member Functions inherited from Singleton< WormholeMgr >
 Singleton ()
 Primary constructor. More...
 

Private Attributes

SystemGPoint m_gp
 
ManagerDBm_mdb
 
ServiceDBm_sdb
 
PyServiceMgrm_services
 
Timer m_updateTimer
 
bool m_initalized
 
std::vector< uint32m_wormholes
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< WormholeMgr >
static WormholeMgrget ()
 
- Static Protected Attributes inherited from Singleton< WormholeMgr >
static std::shared_ptr
< WormholeMgr
mInstance
 

Detailed Description

Definition at line 29 of file WormholeMgr.h.

Constructor & Destructor Documentation

WormholeMgr::WormholeMgr ( )

Definition at line 37 of file WormholeMgr.cpp.

References m_initalized.

38 : m_updateTimer(0),
39  m_services(nullptr)
40 {
41  m_initalized = false;
42 }
bool m_initalized
Definition: WormholeMgr.h:51
Timer m_updateTimer
Definition: WormholeMgr.h:49
PyServiceMgr * m_services
Definition: WormholeMgr.h:47
WormholeMgr::~WormholeMgr ( )

Definition at line 44 of file WormholeMgr.cpp.

45 {
46  /* nothing to do here */
47 }

Member Function Documentation

void WormholeMgr::Create ( CosmicSignature sig)
Note
this creates a k162 for deco only at this time. it is more POC than usable

Definition at line 70 of file WormholeMgr.cpp.

References _log, SystemManager::AddEntity(), CosmicSignature::bubbleID, CosmicSignature::dungeonType, flagNone, SystemBubble::GetID(), SystemManager::GetName(), SystemManager::GetServiceMgr(), m_wormholes, CosmicSignature::ownerID, CosmicSignature::position, sEntityList, CosmicSignature::sigItemID, CosmicSignature::sigName, CosmicSignature::sigStrength, sItemFactory, InventoryItem::SpawnItem(), SystemEntity::SysBubble(), CosmicSignature::systemID, and Dungeon::Type::Wormhole.

71 {
72  // this really isnt needed. may need later
74  return;
75 
80  /*
81  * Band 1/5 1/10 1/15 1/20 1/25 1/40 1/45 1/60 1/80
82  * Percentage 20.0% 10.0% 6.67% 5.0% 4.0% 2.5% 2.22% 1.67% 1.25%
83  * Base sigStrength
84  * k-space
85  * 1/10 = exit(k162), hi>hi(a641), lo>c3(x702), lo>lo(x944)
86  * 1/15 = hi>c1(z971)
87  * 1/20 = hi>c2(r943),lo>c1(r943)
88  * 1/25 = hi>c3(x702),hi>lo(r051),null>c3(x702),null>lo(n944)
89  * 1/40 = hi>c4(o128),lo>c4(o128),lo>hi(b449),hi>null(v283),null>c1(z971),null>hi(b449)
90  * 1/45 = null>c2(r943),null>c4(o128)
91  * 1/60 = hi>c5(m555),lo>c5(n432),lo>null(s199),null>c5(n432)
92  * 1/80 = hi>c6(b041)
93  *
94  * w-space
95  * 1/10 = c1*hi(n110),c1>c1(h121),c2*hi(b274),c2>c1(z647),c3*lo(u210),c3>c3(n968),c4*c3(c247),c5*c5(h296),c5>null(z142),c6*c5(v911),c6>null(z142)
96  * 1/15 = c1>c2(c125),c2>c2(d382),c3>c43(t405),c4*c4(x877),c5*c6(v753),c6*c6(w237)
97  * 1/20 = c1*lo(j244),c1>c3(o883),c2*lo(a239),c2>c3(o477),c3*hi(d845),c3>c1(v301),c4*c1(p060),c5>lo(c140),c6*c3(l477),c6>lo(c140)
98  * 1/25 = c1>c4(m609),c2>c4(y683),c3>c2(i182),c4*c2(n766),c6*c4(z457)
99  * 1/40 = c1*null(z060),c1>c5(l614),c2*null(e545),c2>c5(n062),c3*null(k346),c3>c5(n770),c4*c5(h900),c5*c1(y790),c5>hi(d792),c6*c1(q317),c6>hi(d792)
100  * 1/45 = c2>c6(r474),c3>c6(a982)
101  * 1/60 = c5*c3(m267),c5*c4(e175),
102  * 1/80 = c1>c6(s804),c4*c6(u574),c5*c2(d364),c6*c2(g024)
103  *
104  * note: * instead of > means static
105  * wh to class 1,2,3,4 have 16h lifetime
106  * others have 24h lifetime
107  */
108  sig.sigStrength = 0.1;
109 
110  // create k162 here
111  sig.sigName = "WormHole K162";
112  GPoint pos(sig.position);
113  ItemData wData(30831, sig.ownerID, sig.systemID, flagNone, sig.sigName.c_str(), pos);
114  InventoryItemRef iRef = InventoryItem::SpawnItem(sItemFactory.GetNextTempID(), wData);
115  if (iRef.get() == nullptr) // we'll survive...anomaly is temp item, so not worried about deleting it here.
116  return;
117 
118  // verify system is loaded
119  SystemManager* pSysMgr = sEntityList.FindOrBootSystem(sig.systemID);
120  if (pSysMgr == nullptr) {
121  _log(COSMIC_MGR__ERROR, "WormholeMgr::Create() - Boot failure for system %u", sig.systemID);
122  return;
123  }
124 
125  CelestialSE* wSE = new CelestialSE(iRef, *(pSysMgr->GetServiceMgr()), pSysMgr);
126  if (wSE == nullptr) {
127  _log(COSMIC_MGR__ERROR, "WormholeMgr::Create() - SE Create failure for %s(%u)", iRef->name(), iRef->itemID());
128  return;
129  }
130  // set itemID to return to anomaly mgr after creation succeeds
131  sig.sigItemID = iRef->itemID();
132  // add wormhole to system (signal added to AnomalyMgr on successful return)
133  pSysMgr->AddEntity(wSE, false);
134  sig.bubbleID = wSE->SysBubble()->GetID();
135  // add exit to vector
136  m_wormholes.push_back(iRef->itemID());
137 
138  _log(COSMIC_MGR__TRACE, "WormholeMgr::Create() - Created %s in %s(%u) with %.3f%% sigStrength.", \
139  iRef->name(), pSysMgr->GetName(), sig.systemID, sig.sigStrength *100);
140 }
void AddEntity(SystemEntity *pSE, bool addSignal=true)
static InventoryItemRef SpawnItem(uint32 itemID, const ItemData &data)
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
#define sEntityList
Definition: EntityList.h:208
std::string sigName
Definition: gpoint.h:33
uint16 GetID()
Definition: SystemBubble.h:91
PyServiceMgr * GetServiceMgr()
Definition: SystemManager.h:88
const char * GetName() const
Definition: SystemManager.h:84
std::vector< uint32 > m_wormholes
Definition: WormholeMgr.h:54
#define sItemFactory
Definition: ItemFactory.h:165

Here is the call graph for this function:

void WormholeMgr::CreateExit ( SystemManager pFromSys,
SystemManager pToSys 
)

Definition at line 142 of file WormholeMgr.cpp.

References _log, EVEDB::invTypes::CosmicSignature, SystemManager::GetID(), and SystemManager::GetName().

143 {
144  // compile data for exit
146  /*
147  sig.sigID = sEntityList.GetAnomalyID();
148  sig.systemID = pToSys->GetID();
149  sig.dungeonType = Dungeon::Type::Wormhole;
150 
151  sig.sigItemID = 0;
152  sig.sigName = "WormHole K162 ";
153  //default to 1/80
154  sig.sigStrength = 0.0125;
155 
156  // determine owner - default to sleeper drones. may change later
157  sig.ownerID = factionSleepers;
158  if (MakeRandomFloat() > 0.1) // 10% chance to be rogue drones
159  sig.ownerID = sDataMgr.GetRegionRatFaction(pToSys->GetRegionID());
160 
161  sig.position = m_gp.GetAnomalyPoint(pToSys);
162 
163  // send data to Create() for processing
164  Create(sig);
165 */
166  _log(COSMIC_MGR__TRACE, "WormholeMgr::CreateExit() - Creating Exit from %s(%u) to %s(%u)", \
167  pFromSys->GetName(), pFromSys->GetID(), pToSys->GetName(), pToSys->GetID());
168 }
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetID() const
Definition: SystemManager.h:80
const char * GetName() const
Definition: SystemManager.h:84

Here is the call graph for this function:

void WormholeMgr::Initialize ( PyServiceMgr svc)

Definition at line 49 of file WormholeMgr.cpp.

References m_initalized, m_services, m_updateTimer, sLog, and Timer::Start().

49  {
50  m_services = svc;
51 
52  m_updateTimer.Start(300000); // arbitrary 5m default
53 
54  m_initalized = true;
55 
56  /* load current data, start timers, process current data, and create new items, if needed */
57 
58  sLog.Blue(" Wormhole Manager", "Wormhole Manager Initialized.");
59 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
bool m_initalized
Definition: WormholeMgr.h:51
Timer m_updateTimer
Definition: WormholeMgr.h:49
PyServiceMgr * m_services
Definition: WormholeMgr.h:47
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

void WormholeMgr::Process ( )

Definition at line 62 of file WormholeMgr.cpp.

References Timer::Check(), m_initalized, and m_updateTimer.

62  {
63  if (!m_initalized)
64  return;
65  if (m_updateTimer.Check(false)) {
66  /* do something useful here */
67  }
68 }
bool Check(bool reset=true)
Definition: timer.cpp:62
bool m_initalized
Definition: WormholeMgr.h:51
Timer m_updateTimer
Definition: WormholeMgr.h:49

Here is the call graph for this function:

Member Data Documentation

SystemGPoint WormholeMgr::m_gp
private

Definition at line 44 of file WormholeMgr.h.

bool WormholeMgr::m_initalized
private

Definition at line 51 of file WormholeMgr.h.

Referenced by Initialize(), Process(), and WormholeMgr().

ManagerDB* WormholeMgr::m_mdb
private

Definition at line 45 of file WormholeMgr.h.

ServiceDB* WormholeMgr::m_sdb
private

Definition at line 46 of file WormholeMgr.h.

PyServiceMgr* WormholeMgr::m_services
private

Definition at line 47 of file WormholeMgr.h.

Referenced by Initialize().

Timer WormholeMgr::m_updateTimer
private

Definition at line 49 of file WormholeMgr.h.

Referenced by Initialize(), and Process().

std::vector<uint32> WormholeMgr::m_wormholes
private

Definition at line 54 of file WormholeMgr.h.

Referenced by Create().


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