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

#include "AnomalyMgr.h"

Collaboration diagram for AnomalyMgr:

Protected Attributes

ManagerDB m_mdb
 
ServiceDB m_sdb
 
SystemGPoint m_gp
 

Private Attributes

BeltMgrm_beltMgr
 
DungeonMgrm_dungMgr
 
SpawnMgrm_spawnMgr
 
SystemManagerm_system
 
PyServiceMgrm_services
 
Timer m_spawnTimer
 
Timer m_procTimer
 
bool m_initalized
 
uint8 m_maxSigs
 
uint8 m_Sigs
 
int8 m_WH
 
int8 m_Grav
 
int8 m_Mag
 
int8 m_Ladar
 
int8 m_Radar
 
int8 m_Unrated
 
int8 m_Complex
 
uint16 m_Anoms
 
std::map< uint32, CosmicSignaturem_sigByItemID
 
std::map< uint32, CosmicSignaturem_anomByItemID
 
std::map< std::string,
CosmicSignature
m_sigBySigID
 

AnomalyMgr.cpp

Anomaly management system for EVEmu

: Allan

Date
: 12 December 2015 (original idea) : 3 August 2017 (begin implementation)
 AnomalyMgr (SystemManager *mgr, PyServiceMgr &svc)
 
 ~AnomalyMgr ()
 
bool Init (BeltMgr *beltMgr, DungeonMgr *dungMgr, SpawnMgr *spawnMgr)
 
void Close ()
 
void Process ()
 
void SaveAnomaly ()
 
void CreateAnomaly (int8 typeID=0)
 
void LoadAnomalies ()
 
void AddSignal (SystemEntity *pSE, uint32 id=0)
 
void RemoveSignal (uint32 itemID)
 
void GetAnomalyList (std::vector< CosmicSignature > &sig)
 
void GetSignatureList (std::vector< CosmicSignature > &sig)
 
uint32 GetAnomalyID (std::string &sigID)
 
GPoint GetAnomalyPos (std::string &sigID)
 
const char * GetScanGroupName (uint8 groupID=0)
 
uint8 GetDungeonType ()
 

Detailed Description

Definition at line 29 of file AnomalyMgr.h.

Constructor & Destructor Documentation

AnomalyMgr::AnomalyMgr ( SystemManager mgr,
PyServiceMgr svc 
)

Definition at line 49 of file AnomalyMgr.cpp.

References m_initalized, m_sigByItemID, and m_sigBySigID.

50 :m_services(svc),
51 m_system(mgr),
52 m_beltMgr(nullptr),
53 m_dungMgr(nullptr),
54 m_spawnMgr(nullptr),
55 m_spawnTimer(0),
56 m_procTimer(0)
57 {
58  m_initalized = false;
59 
60  m_sigBySigID.clear();
61  m_sigByItemID.clear();
62 }
bool m_initalized
Definition: AnomalyMgr.h:74
SpawnMgr * m_spawnMgr
Definition: AnomalyMgr.h:67
std::map< std::string, CosmicSignature > m_sigBySigID
Definition: AnomalyMgr.h:95
Timer m_procTimer
Definition: AnomalyMgr.h:72
PyServiceMgr & m_services
Definition: AnomalyMgr.h:69
BeltMgr * m_beltMgr
Definition: AnomalyMgr.h:65
SystemManager * m_system
Definition: AnomalyMgr.h:68
std::map< uint32, CosmicSignature > m_sigByItemID
Definition: AnomalyMgr.h:93
DungeonMgr * m_dungMgr
Definition: AnomalyMgr.h:66
Timer m_spawnTimer
Definition: AnomalyMgr.h:71
AnomalyMgr::~AnomalyMgr ( )

Definition at line 64 of file AnomalyMgr.cpp.

65 {
66  // this shouldnt be needed...SysMgr should handle all objects in their systems
67  /*
68  InventoryItemRef iRef(nullptr);
69  for (auto sig : m_sigByItemID) {
70  iRef = sItemFactory.GetItem(sig.first);
71  if (iRef.get() == nullptr)
72  continue;
73  iRef->Delete();
74  }
75  */
76 }

Member Function Documentation

void AnomalyMgr::AddSignal ( SystemEntity pSE,
uint32  id = 0 
)

Definition at line 422 of file AnomalyMgr.cpp.

References _log, Dungeon::Type::Anomaly, Scanning::Group::Anomaly, EVEDB::invCategories::Asteroid, AttrScanAllStrength, AttrScanStrengthDronesProbes, AttrScanStrengthShips, AttrScanStrengthStructures, AttrSignatureRadius, CosmicSignature::bubbleID, InventoryItem::categoryID(), EVEDB::invCategories::Celestial, EVEDB::invCategories::Charge, EVEDB::invGroups::Cosmic_Anomaly, EVEDB::invTypes::CosmicAnomaly, EVEDB::invTypes::CosmicSignature, EVEDB::invCategories::Deployable, EVEDB::invCategories::Drone, Scanning::Group::DroneOrProbe, CosmicSignature::dungeonType, EVEDB::invCategories::Entity, RefPtr< X >::get(), EvilNumber::get_float(), InventoryItem::GetAttribute(), SystemManager::GetID(), SystemBubble::GetID(), GetScanGroupName(), SystemEntity::GetSelf(), InventoryItem::groupID(), InventoryItem::itemID(), InventoryItem::itemName(), m_anomByItemID, m_initalized, m_sigByItemID, m_sigBySigID, m_system, InventoryItem::name(), EVEDB::invCategories::Orbitals, InventoryItem::ownerID(), CosmicSignature::ownerID, InventoryItem::position(), CosmicSignature::position, CosmicSignature::scanAttributeID, CosmicSignature::scanGroupID, sEntityList, EVEDB::invCategories::Ship, Scanning::Group::Ship, CosmicSignature::sigGroupID, CosmicSignature::sigID, CosmicSignature::sigItemID, CosmicSignature::sigName, CosmicSignature::sigStrength, CosmicSignature::sigTypeID, EVEDB::invCategories::SovereigntyStructure, Scanning::Group::Structure, EVEDB::invCategories::Structure, EVEDB::invCategories::StructureUpgrade, SystemEntity::SysBubble(), CosmicSignature::systemID, and InventoryItem::typeID().

Referenced by SystemManager::AddEntity(), and SystemManager::AddMarker().

423 {
424  if (!m_initalized)
425  return;
426 
427  // shouldnt need this while `check(IsTestServer)` is disabled
428  //if (!m_procTimer.Enabled())
429  // m_procTimer.Start(120000); // 2m
430 
431  /* ALL SEs sent here by SysMgr except Globals and NPCs
432  * we will determine here what is added and it's base sigStrength.
433  * this is sill WIP.
434  * see Scan.xmlp and EVE_Scanning.h for client data
435  */
436  InventoryItemRef iRef = pSE->GetSelf();
437  if (iRef.get() == nullptr)
438  return; // we'll get over it.
441  sig.ownerID = iRef->ownerID();
442  if (id) {
443  sig.sigID = id;
444  } else {
445  sig.sigID = sEntityList.GetAnomalyID();
446  }
447  sig.sigItemID = iRef->itemID();
448  sig.sigName = iRef->itemName();
449  sig.systemID = m_system->GetID();
450  sig.position = iRef->position();
451  // this will be wrong for capital ships and larger (maybe bs also)
453  // get bubbleID, which is only used for .siglist command
454  sig.bubbleID = pSE->SysBubble()->GetID();
455 
456 /* Signal Strength Base Data
457  * Band 1/5 1/10 1/15 1/20 1/25 1/40 1/45 1/60 1/80
458  * Percentage 20.0% 10.0% 6.67% 5.0% 4.0% 2.5% 2.22% 1.67% 1.25%
459  */
460 
461  // if scanGroupID is anom or sig, use scanAttributeID to determine site type (in client code)
462  // scanGroupID must be one of the 5 groups coded in client (sig, anom, ship, drone, structure)
463  // scanGroupID of sig and anom are cached on client side (min time is 5m)
464  switch (iRef->categoryID()) {
469  sig.sigTypeID = iRef->typeID();
470  sig.sigGroupID = iRef->groupID();
473  //sig.sigStrength = 1.0;
474  } break;
476  //511 shipScanResistance
477  sig.sigTypeID = iRef->typeID();
478  sig.sigGroupID = iRef->groupID();
481  //sig.sigStrength = 1.0;
482  } break;
484  case EVEDB::invCategories::Charge: // probes, missiles (at time of scan), and ??
485  case EVEDB::invCategories::Deployable: { // mobile warp disruptor
486  sig.sigTypeID = iRef->typeID();
487  sig.sigGroupID = iRef->groupID();
490  sig.sigStrength = 0.0667;
491  } break;
492  case EVEDB::invCategories::Asteroid:{ // this wont hit (addSignal=false)
493  return; // we're not adding roids to list
494  };
496  case EVEDB::invCategories::Celestial: //wrecks
497  default: {
501  sig.scanAttributeID = AttrScanAllStrength; // Unknown
502  //sig.sigStrength = 1.0; // this will need to be adjusted for entity/celestial types
503  } break;
504  }
505 
506  _log(COSMIC_MGR__MESSAGE, "AnomalyMgr::AddSignal() - adding %s to anomaly list as %s(%u) with %.3f%% sigStrength.", \
507  iRef->name(), GetScanGroupName(sig.scanGroupID), sig.scanGroupID, sig.sigStrength *100);
508 
509  // add new sig to our maps, but these are not added to anom/sig counts
510  m_sigBySigID.emplace(sig.sigID, sig);
512  m_anomByItemID.emplace(sig.sigItemID, sig);
513  } else {
514  m_sigByItemID.emplace(sig.sigItemID, sig);
515  }
516 }
bool m_initalized
Definition: AnomalyMgr.h:74
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 ownerID() const
Definition: InventoryItem.h:99
const GPoint & position() const
std::string sigID
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
const char * GetScanGroupName(uint8 groupID=0)
Definition: AnomalyMgr.cpp:539
std::map< std::string, CosmicSignature > m_sigBySigID
Definition: AnomalyMgr.h:95
#define sEntityList
Definition: EntityList.h:208
uint32 GetID() const
Definition: SystemManager.h:80
const char * name()
std::string sigName
uint16 groupID() const
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
uint16 GetID()
Definition: SystemBubble.h:91
std::map< uint32, CosmicSignature > m_anomByItemID
Definition: AnomalyMgr.h:94
X * get() const
Definition: RefPtr.h:213
SystemManager * m_system
Definition: AnomalyMgr.h:68
const std::string & itemName() const
EvilNumber GetAttribute(const uint16 attrID) const
float get_float()
Definition: EvilNumber.cpp:184
uint16 typeID() const
std::map< uint32, CosmicSignature > m_sigByItemID
Definition: AnomalyMgr.h:93
uint8 categoryID() const
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

void AnomalyMgr::Close ( )

Definition at line 171 of file AnomalyMgr.cpp.

References _log, SystemManager::GetID(), SystemManager::GetName(), and m_system.

Referenced by SystemManager::UnloadSystem().

172 {
173  _log(COSMIC_MGR__MESSAGE, "Closing AnomalyMgr for %s(%u).", m_system->GetName(), m_system->GetID());
174 }
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetID() const
Definition: SystemManager.h:80
SystemManager * m_system
Definition: AnomalyMgr.h:68
const char * GetName() const
Definition: SystemManager.h:84

Here is the call graph for this function:

Here is the caller graph for this function:

void AnomalyMgr::CreateAnomaly ( int8  typeID = 0)
Todo:
check distances based on system size

Definition at line 207 of file AnomalyMgr.cpp.

References _log, Dungeon::Type::Anomaly, Scanning::Group::Anomaly, AttrScanAllStrength, AttrScanGravimetricStrength, AttrScanLadarStrength, AttrScanMagnetometricStrength, AttrScanRadarStrength, CosmicSignature::bubbleID, EVEDB::invGroups::Cosmic_Anomaly, EVEDB::invGroups::Cosmic_Signature, EVEDB::invTypes::CosmicAnomaly, EVEDB::invTypes::CosmicSignature, EVEDB::invTypes::DeadspaceSignature, CosmicSignature::dungeonType, Dungeon::Type::Escalation, factionRogueDrones, SystemGPoint::GetAnomalyPoint(), GetDungeonType(), SystemManager::GetID(), SystemManager::GetName(), SystemManager::GetRegionID(), Dungeon::Type::Gravimetric, Dungeon::Type::Ladar, m_anomByItemID, m_Anoms, m_dungMgr, m_gp, m_sigByItemID, m_sigBySigID, m_Sigs, m_system, Dungeon::Type::Magnetometric, DungeonMgr::MakeDungeon(), MakeRandomFloat(), CosmicSignature::ownerID, CosmicSignature::position, Dungeon::Type::Radar, Dungeon::Type::Rated, CosmicSignature::scanAttributeID, CosmicSignature::scanGroupID, sConfig, sDataMgr, sDunDataMgr, sEntityList, CosmicSignature::sigGroupID, CosmicSignature::sigID, CosmicSignature::sigItemID, CosmicSignature::sigName, Scanning::Group::Signature, CosmicSignature::sigStrength, CosmicSignature::sigTypeID, sWHMgr, CosmicSignature::systemID, Dungeon::Type::Unrated, and Dungeon::Type::Wormhole.

Referenced by Process().

208 {
209  // compile data for new system anomaly.
211  sig.systemID = m_system->GetID();
212  sig.sigID = sEntityList.GetAnomalyID();
213  // *Mgr will determine name, itemID and sigStrength.
214  sig.sigItemID = 0;
215  sig.sigName = "Test Name Here";
216  //default to 1/80
217  sig.sigStrength = 0.0125;
218  // default to rogue drones
220  if (sConfig.debug.AnomalyFaction) {
221  sig.ownerID = sConfig.debug.AnomalyFaction;
222  } else if (MakeRandomFloat() > 0.1) { // 10% chance to be rogue drones
223  sig.ownerID = sDataMgr.GetRegionRatFaction(m_system->GetRegionID());
224  }
225 
226  // there are some regions that dont have rat factions....what do we do in that case??
227  //if (sig.ownerID == 0)
228  // return; // make error here?
229 
230  if (typeID == 0) {
231  sig.dungeonType = GetDungeonType();
232  } else { // proc calling anomaly or mission/escalation being setup.
233  sig.dungeonType = typeID;
234  }
235 
236  if (sig.dungeonType == 0) {
237  _log(COSMIC_MGR__ERROR, "Dungeon Type returned 0 for %s in %s(%u)", \
238  sig.sigName.c_str(), m_system->GetName(), m_system->GetID());
239  return;
240  }
241 
243 
244  // some sites will use sys sov for ships. use this for them....
245  // sig.ownerID = sDataMgr.GetRegionFaction(m_system->GetRegionID());
246  using namespace Dungeon::Type;
247  switch(sig.dungeonType) {
248  case Gravimetric: { // 2
253  } break;
254  case Magnetometric: { // 3,
255  sig.sigTypeID = EVEDB::invTypes::DeadspaceSignature;// need probes and exploring skills
259  } break;
260  case Radar: { // 4,
265  } break;
266  case Ladar: { // 5,
271  } break;
272  case Wormhole: { // 6
273  // enable WH to be warped to...they are deco only at this time.
274  // once working, these will be by probe only, and removed from anomaly list
278  sig.scanAttributeID = AttrScanAllStrength; // Unknown
279  // hand off to WHMgr for creation and exit after return
280  sWHMgr.Create(sig);
281  // creation failure will set itemID to 0
282  if (sig.sigItemID) {
283  m_sigBySigID.emplace(sig.sigID, sig);
284  m_sigByItemID.emplace(sig.sigItemID, sig);
285  }
286  return;
287  } break;
288  case Anomaly: { // 7 simple combat sites
293  sig.sigStrength = 1.0f;
294  } break;
295  case Mission: { // 1
299  sig.scanAttributeID = AttrScanAllStrength; // Unknown
300  // we're not counting mission shit in sig count
301  }
302  // these will use default for now. revisit later when system matures more and i better understand how to implement them.
303  case Escalation: // 9
304  case Unrated: // 8
305  case Rated: { // 10
309  sig.scanAttributeID = AttrScanAllStrength; // Unknown
310  } break;
311  // error or denied
312  case 0:
313  default:
314  return;
315  }
316 
317  // create and register here
318  // all anomalies will be created/populated by dungMgr, except WH (handed off to WHMgr above)
320  if (!m_dungMgr->MakeDungeon(sig)) // pass by ref here, so other vars can be set.
321  return;
322  // add new sig to sysSigMaps
323  m_sigBySigID.emplace(sig.sigID, sig);
325  m_anomByItemID.emplace(sig.sigItemID, sig);
326  ++m_Anoms;
327  } else {
328  m_sigByItemID.emplace(sig.sigItemID, sig);
329  ++m_Sigs;
330  }
331 
332  //m_mdb.SaveAnomaly(sig);
333 
334  _log(COSMIC_MGR__MESSAGE, "AnomalyMgr::Create() - Created Signal %s(%u) for %s in %s(%u), bubbleID %u with %.3f%% sigStrength.", \
335  sDunDataMgr.GetDungeonType(sig.dungeonType), sig.dungeonType, \
336  sig.sigName.c_str(), m_system->GetName(), sig.systemID, sig.bubbleID, sig.sigStrength *100);
337 }
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
bool MakeDungeon(CosmicSignature &sig)
Definition: DungeonMgr.cpp:417
std::string sigID
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114
SystemGPoint m_gp
Definition: AnomalyMgr.h:59
std::map< std::string, CosmicSignature > m_sigBySigID
Definition: AnomalyMgr.h:95
#define sEntityList
Definition: EntityList.h:208
uint32 GetID() const
Definition: SystemManager.h:80
uint8 GetDungeonType()
Definition: AnomalyMgr.cpp:339
std::string sigName
std::map< uint32, CosmicSignature > m_anomByItemID
Definition: AnomalyMgr.h:94
SystemManager * m_system
Definition: AnomalyMgr.h:68
#define sDunDataMgr
Definition: DungeonMgr.h:78
#define sWHMgr
Definition: WormholeMgr.h:59
const char * GetName() const
Definition: SystemManager.h:84
uint32 GetRegionID()
Definition: SystemManager.h:81
const GPoint GetAnomalyPoint(SystemManager *pSys)
uint16 m_Anoms
Definition: AnomalyMgr.h:90
uint8 m_Sigs
Definition: AnomalyMgr.h:78
std::map< uint32, CosmicSignature > m_sigByItemID
Definition: AnomalyMgr.h:93
DungeonMgr * m_dungMgr
Definition: AnomalyMgr.h:66
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 AnomalyMgr::GetAnomalyID ( std::string &  sigID)

Definition at line 403 of file AnomalyMgr.cpp.

References m_sigBySigID.

404 { // <std::string, CosmicSignature>
405  std::map<std::string, CosmicSignature>::iterator itr = m_sigBySigID.find(sigID);
406  if (itr != m_sigBySigID.end())
407  return itr->second.sigItemID;
408  return 0;
409 }
std::map< std::string, CosmicSignature > m_sigBySigID
Definition: AnomalyMgr.h:95
void AnomalyMgr::GetAnomalyList ( std::vector< CosmicSignature > &  sig)

Definition at line 200 of file AnomalyMgr.cpp.

References m_anomByItemID.

Referenced by Command_siglist(), Scan::ProbeScanResult(), and Scan::ShipScanResult().

200  {
201  // sysSignatures (sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)
202  // retrieval method for scan queries
203  for (auto cur : m_anomByItemID)
204  sig.push_back(cur.second);
205 }
std::map< uint32, CosmicSignature > m_anomByItemID
Definition: AnomalyMgr.h:94

Here is the caller graph for this function:

GPoint AnomalyMgr::GetAnomalyPos ( std::string &  sigID)

Definition at line 411 of file AnomalyMgr.cpp.

References m_sigBySigID, and NULL_ORIGIN().

412 {
413  GPoint pos(NULL_ORIGIN);
414  std::map<std::string, CosmicSignature>::iterator itr = m_sigBySigID.find(sigID);
415  if (itr != m_sigBySigID.end())
416  pos = itr->second.position;
417 
418  return pos;
419 }
std::map< std::string, CosmicSignature > m_sigBySigID
Definition: AnomalyMgr.h:95
Definition: gpoint.h:33
static const GPoint NULL_ORIGIN(0, 0, 0)

Here is the call graph for this function:

uint8 AnomalyMgr::GetDungeonType ( )
protected

Definition at line 339 of file AnomalyMgr.cpp.

References _log, Dungeon::Type::Anomaly, Dungeon::Type::Escalation, Dungeon::Type::Gravimetric, Dungeon::Type::Ladar, m_Anoms, m_Complex, m_Grav, m_Ladar, m_Mag, m_maxSigs, m_Radar, m_Unrated, m_WH, Dungeon::Type::Magnetometric, MakeRandomInt(), Dungeon::Type::Radar, Dungeon::Type::Rated, sDunDataMgr, Dungeon::Type::Unrated, and Dungeon::Type::Wormhole.

Referenced by CreateAnomaly().

340 {
341  using namespace Dungeon::Type;
342  uint8 typeID = MakeRandomInt(2,10); // skip typeMission
343  switch(typeID) {
344  case Escalation: // 9
345  case Mission: { // 1
346  // cannot create this type here. try again.
347  return GetDungeonType();
348  } break;
349  case Gravimetric: { // 2
350  if (m_Grav < 0)
351  return GetDungeonType();
352 
353  ++m_Grav;
354  } break;
355  case Magnetometric: { // 3
356  if (m_Mag < 0)
357  return GetDungeonType();
358 
359  ++m_Mag;
360  } break;
361  case Radar: { // 4
362  if (m_Radar < 0)
363  return GetDungeonType();
364 
365  ++m_Radar;
366  } break;
367  case Ladar: { // 5
368  if (m_Ladar < 0)
369  return GetDungeonType();
370 
371  ++m_Ladar;
372  } break;
373  case Wormhole: { // 6
374  // cap at 1 per system, except k162...which ISNT created in this system (it's an exit, from WMS)
375  // this will need updating and be controlled by WMS. it will have full control of WH amounts/locations
376  if (m_WH != 0)
377  return GetDungeonType();
378 
379  ++m_WH;
380  } break;
381  case Anomaly: { // 7. this is noob dungeon, no probe required
382  if (m_Anoms > (m_maxSigs /2))
383  return GetDungeonType();
384  } break;
385  case Unrated: { // 8
386  if ((m_Unrated < 0) or (m_Unrated > 2)) // cap at 3
387  return GetDungeonType();
388 
389  ++m_Unrated;
390  } break;
391  case Rated: { // 10
392  if ((m_Complex < 0) or (m_Complex > 1)) // cap at 2
393  return GetDungeonType();
394 
395  ++m_Complex;
396  } break;
397  }
398 
399  _log(COSMIC_MGR__MESSAGE, "AnomalyMgr::GetDungeonType() - Returning %s(%u)", sDunDataMgr.GetDungeonType(typeID), typeID);
400  return typeID;
401 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define _log(type, fmt,...)
Definition: logsys.h:124
int8 m_Complex
Definition: AnomalyMgr.h:88
int8 m_Radar
Definition: AnomalyMgr.h:84
uint8 GetDungeonType()
Definition: AnomalyMgr.cpp:339
int8 m_Ladar
Definition: AnomalyMgr.h:83
uint8 m_maxSigs
Definition: AnomalyMgr.h:77
int8 m_WH
Definition: AnomalyMgr.h:80
#define sDunDataMgr
Definition: DungeonMgr.h:78
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
int8 m_Mag
Definition: AnomalyMgr.h:82
uint16 m_Anoms
Definition: AnomalyMgr.h:90
int8 m_Unrated
Definition: AnomalyMgr.h:86
int8 m_Grav
Definition: AnomalyMgr.h:81

Here is the call graph for this function:

Here is the caller graph for this function:

const char * AnomalyMgr::GetScanGroupName ( uint8  groupID = 0)

Definition at line 539 of file AnomalyMgr.cpp.

References Dungeon::Type::Anomaly, Scanning::Group::Celestial, Scanning::Group::DroneOrProbe, Scanning::Group::Scrap, Scanning::Group::Ship, Scanning::Group::Signature, and Scanning::Group::Structure.

Referenced by AddSignal(), Command_siglist(), and Scan::GetProbeDataForSig().

539  {
540  using namespace Scanning::Group;
541  switch(groupID) {
542  case Scrap: return "Scrap";
543  case Signature: return "Signature";
544  case Structure: return "Structure";
545  case DroneOrProbe: return "Drone/Probe";
546  case Celestial: return "Celestial";
547  case Anomaly: return "Anomaly";
548  case Ship: return "Ship";
549  case 0: return "Zero";
550  default: return "Invalid";
551  }
552  return "None";
553 }

Here is the caller graph for this function:

void AnomalyMgr::GetSignatureList ( std::vector< CosmicSignature > &  sig)

Definition at line 192 of file AnomalyMgr.cpp.

References m_sigByItemID.

Referenced by Command_siglist(), and Scan::ProbeScanResult().

193 {
194  // sysSignatures (sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)
195  // retrieval method for scan queries
196  for (auto cur : m_sigByItemID)
197  sig.push_back(cur.second);
198 }
std::map< uint32, CosmicSignature > m_sigByItemID
Definition: AnomalyMgr.h:93

Here is the caller graph for this function:

bool AnomalyMgr::Init ( BeltMgr beltMgr,
DungeonMgr dungMgr,
SpawnMgr spawnMgr 
)
Todo:
all anomalies are currently temp items. if/when we start saving them, create new table and itemIDs

Definition at line 78 of file AnomalyMgr.cpp.

References _log, SystemManager::GetID(), SystemManager::GetName(), SystemManager::GetSecValue(), m_Anoms, m_beltMgr, m_Complex, m_dungMgr, m_Grav, m_initalized, m_Ladar, m_Mag, m_maxSigs, m_procTimer, m_Radar, m_Sigs, m_spawnMgr, m_system, m_Unrated, m_WH, sConfig, and Timer::Start().

Referenced by SystemManager::LoadCosmicMgrs().

78  {
79  m_beltMgr = beltMgr;
80  m_dungMgr = dungMgr;
81  m_spawnMgr = spawnMgr;
82 
83  if (m_beltMgr == nullptr) {
84  _log(COSMIC_MGR__ERROR, "System Init Fault. beltMgr == nullptr. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
85  return m_initalized;
86  }
87 
88  if (m_dungMgr == nullptr) {
89  _log(COSMIC_MGR__ERROR, "System Init Fault. dungMgr == nullptr. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
90  return m_initalized;
91  }
92 
93  if (m_spawnMgr == nullptr) {
94  _log(COSMIC_MGR__ERROR, "System Init Fault. spawnMgr == nullptr. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
95  return m_initalized;
96  }
97 
98  if (!sConfig.cosmic.AnomalyEnabled) {
99  _log(COSMIC_MGR__MESSAGE, "Anomaly System Disabled. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
100  return true;
101  }
102  if (!sConfig.cosmic.DungeonEnabled){
103  _log(COSMIC_MGR__MESSAGE, "Dungeon System Disabled. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
104  return true;
105  }
106 
107  // update the next two for new mission/anomaly/deadspace data. see notes in spawn mgr
108  if (!sConfig.npc.RoamingSpawns and !sConfig.npc.StaticSpawns) {
109  _log(COSMIC_MGR__MESSAGE, "Spawn System Disabled. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
110  return true;
111  }
112 
113  if (!sConfig.cosmic.BeltEnabled) {
114  _log(COSMIC_MGR__MESSAGE, "BeltMgr System Disabled. Not Initializing Anomaly Manager for %s(%u)", m_system->GetName(), m_system->GetID());
115  return true;
116  }
117 
118  // set internal check data
119  // range is 0.1 for 1.0 system to 2.0 for -0.9 system
120  float security = m_system->GetSecValue();
121  if (sConfig.debug.IsTestServer) {
122  m_maxSigs = 2;
123  m_procTimer.Start(10000); // 10s
124  } else {
125  if (security == 2.0) { m_maxSigs = 25; }
126  else if (security > 1.501) { m_maxSigs = 20; }
127  else if (security > 1.001) { m_maxSigs = 15; }
128  else if (security > 0.751) { m_maxSigs = 12; }
129  else if (security > 0.451) { m_maxSigs = 8; }
130  else if (security > 0.251) { m_maxSigs = 5; }
131  else { m_maxSigs = 3; }
132 
133  m_procTimer.Start(120000); // 2m
134  }
135 
136  m_WH = 0;
137  m_Sigs = 0;
138  m_Anoms = 0;
139  // these use config option to (en/dis)able individual types
140  m_Grav = sConfig.exploring.Gravametric;
141  m_Mag = sConfig.exploring.Magnetometric;
142  m_Ladar = sConfig.exploring.Ladar;
143  m_Radar = sConfig.exploring.Radar;
144  m_Unrated = sConfig.exploring.Unrated;
145  m_Complex = sConfig.exploring.Complex;
146 
147  /* load current data?, start timers, process current data, and create new items, if needed */
150  _log(COSMIC_MGR__MESSAGE, "AnomalyMgr Initialized for %s(%u) with %u Max Signals for security class %0.2f. Test Server is %s", \
151  m_system->GetName(), m_system->GetID(), m_maxSigs, security, sConfig.debug.IsTestServer?"enabled":"disabled");
152 
153  return (m_initalized = true);
154 }
#define sConfig
A macro for easier access to the singleton.
bool m_initalized
Definition: AnomalyMgr.h:74
#define _log(type, fmt,...)
Definition: logsys.h:124
int8 m_Complex
Definition: AnomalyMgr.h:88
SpawnMgr * m_spawnMgr
Definition: AnomalyMgr.h:67
uint32 GetID() const
Definition: SystemManager.h:80
int8 m_Radar
Definition: AnomalyMgr.h:84
Timer m_procTimer
Definition: AnomalyMgr.h:72
int8 m_Ladar
Definition: AnomalyMgr.h:83
uint8 m_maxSigs
Definition: AnomalyMgr.h:77
int8 m_WH
Definition: AnomalyMgr.h:80
float GetSecValue()
BeltMgr * m_beltMgr
Definition: AnomalyMgr.h:65
SystemManager * m_system
Definition: AnomalyMgr.h:68
const char * GetName() const
Definition: SystemManager.h:84
int8 m_Mag
Definition: AnomalyMgr.h:82
uint16 m_Anoms
Definition: AnomalyMgr.h:90
uint8 m_Sigs
Definition: AnomalyMgr.h:78
int8 m_Unrated
Definition: AnomalyMgr.h:86
int8 m_Grav
Definition: AnomalyMgr.h:81
DungeonMgr * m_dungMgr
Definition: AnomalyMgr.h:66
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

Here is the caller graph for this function:

void AnomalyMgr::LoadAnomalies ( )

Definition at line 176 of file AnomalyMgr.cpp.

176  {
177  //. is this needed? probably not. make em all dynamic
178  // check for existing data and load accordingly.
179  // this will only hit on system load
180 
181  // get loaded type data and save in memobj for later use
182 }
void AnomalyMgr::Process ( )

sConfig.debug.IsTestServer

Definition at line 156 of file AnomalyMgr.cpp.

References Dungeon::Type::Anomaly, Timer::Check(), CreateAnomaly(), m_Anoms, m_initalized, m_maxSigs, m_procTimer, and m_Sigs.

Referenced by SystemManager::ProcessTic().

156  {
157  if (!m_initalized)
158  return;
159  if (m_procTimer.Check()) {
160  if (m_Sigs < m_maxSigs)
161  CreateAnomaly();
162  if (m_Anoms < (m_maxSigs /2))
164  }
165 
166  //if (m_spawnTimer.Check(false)) {
167  // /* do something useful here */
168  //}
169 }
bool m_initalized
Definition: AnomalyMgr.h:74
Timer m_procTimer
Definition: AnomalyMgr.h:72
uint8 m_maxSigs
Definition: AnomalyMgr.h:77
bool Check(bool reset=true)
Definition: timer.cpp:62
void CreateAnomaly(int8 typeID=0)
Definition: AnomalyMgr.cpp:207
uint16 m_Anoms
Definition: AnomalyMgr.h:90
uint8 m_Sigs
Definition: AnomalyMgr.h:78

Here is the call graph for this function:

Here is the caller graph for this function:

void AnomalyMgr::RemoveSignal ( uint32  itemID)

Definition at line 518 of file AnomalyMgr.cpp.

References _log, m_anomByItemID, m_sigByItemID, and m_sigBySigID.

Referenced by SystemManager::RemoveEntity().

519 {
520  _log(COSMIC_MGR__MESSAGE, "AnomalyMgr::RemoveSignal() - removing %u from anomaly list.", itemID);
521  // remove sig from our map
522  std::map<uint32, CosmicSignature>::iterator itr = m_sigByItemID.find(itemID);
523  if (itr != m_sigByItemID.end()) {
524  auto itr2 = m_sigBySigID.find(itr->second.sigID);
525  if (itr2 != m_sigBySigID.end())
526  m_sigBySigID.erase(itr2);
527  m_sigByItemID.erase(itr);
528  } else { // not Signature, check in Anomaly map
529  itr = m_anomByItemID.find(itemID);
530  if (itr != m_anomByItemID.end()) {
531  auto itr2 = m_sigBySigID.find(itr->second.sigID);
532  if (itr2 != m_sigBySigID.end())
533  m_sigBySigID.erase(itr2);
534  m_anomByItemID.erase(itr);
535  }
536  }
537 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::map< std::string, CosmicSignature > m_sigBySigID
Definition: AnomalyMgr.h:95
std::map< uint32, CosmicSignature > m_anomByItemID
Definition: AnomalyMgr.h:94
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
std::map< uint32, CosmicSignature > m_sigByItemID
Definition: AnomalyMgr.h:93

Here is the caller graph for this function:

void AnomalyMgr::SaveAnomaly ( )

Definition at line 184 of file AnomalyMgr.cpp.

References m_mdb, m_sigByItemID, and ManagerDB::SaveAnomaly().

185 {
186  // same as above...not needed but used for testing for now.
187  //will have to rewrite scan system to use data from here
188  for (auto sig : m_sigByItemID)
189  m_mdb.SaveAnomaly(sig.second);
190 }
ManagerDB m_mdb
Definition: AnomalyMgr.h:57
void SaveAnomaly(CosmicSignature &sig)
Definition: ManagerDB.cpp:325
std::map< uint32, CosmicSignature > m_sigByItemID
Definition: AnomalyMgr.h:93

Here is the call graph for this function:

Member Data Documentation

std::map<uint32, CosmicSignature> AnomalyMgr::m_anomByItemID
private

Definition at line 94 of file AnomalyMgr.h.

Referenced by AddSignal(), CreateAnomaly(), GetAnomalyList(), and RemoveSignal().

uint16 AnomalyMgr::m_Anoms
private

Definition at line 90 of file AnomalyMgr.h.

Referenced by CreateAnomaly(), GetDungeonType(), Init(), and Process().

BeltMgr* AnomalyMgr::m_beltMgr
private

Definition at line 65 of file AnomalyMgr.h.

Referenced by Init().

int8 AnomalyMgr::m_Complex
private

Definition at line 88 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().

DungeonMgr* AnomalyMgr::m_dungMgr
private

Definition at line 66 of file AnomalyMgr.h.

Referenced by CreateAnomaly(), and Init().

SystemGPoint AnomalyMgr::m_gp
protected

Definition at line 59 of file AnomalyMgr.h.

Referenced by CreateAnomaly().

int8 AnomalyMgr::m_Grav
private

Definition at line 81 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().

bool AnomalyMgr::m_initalized
private

Definition at line 74 of file AnomalyMgr.h.

Referenced by AddSignal(), AnomalyMgr(), Init(), and Process().

int8 AnomalyMgr::m_Ladar
private

Definition at line 83 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().

int8 AnomalyMgr::m_Mag
private

Definition at line 82 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().

uint8 AnomalyMgr::m_maxSigs
private

Definition at line 77 of file AnomalyMgr.h.

Referenced by GetDungeonType(), Init(), and Process().

ManagerDB AnomalyMgr::m_mdb
protected

Definition at line 57 of file AnomalyMgr.h.

Referenced by SaveAnomaly().

Timer AnomalyMgr::m_procTimer
private

Definition at line 72 of file AnomalyMgr.h.

Referenced by Init(), and Process().

int8 AnomalyMgr::m_Radar
private

Definition at line 84 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().

ServiceDB AnomalyMgr::m_sdb
protected

Definition at line 58 of file AnomalyMgr.h.

PyServiceMgr& AnomalyMgr::m_services
private

Definition at line 69 of file AnomalyMgr.h.

std::map<uint32, CosmicSignature> AnomalyMgr::m_sigByItemID
private
std::map<std::string, CosmicSignature> AnomalyMgr::m_sigBySigID
private
uint8 AnomalyMgr::m_Sigs
private

Definition at line 78 of file AnomalyMgr.h.

Referenced by CreateAnomaly(), Init(), and Process().

SpawnMgr* AnomalyMgr::m_spawnMgr
private

Definition at line 67 of file AnomalyMgr.h.

Referenced by Init().

Timer AnomalyMgr::m_spawnTimer
private

Definition at line 71 of file AnomalyMgr.h.

SystemManager* AnomalyMgr::m_system
private

Definition at line 68 of file AnomalyMgr.h.

Referenced by AddSignal(), Close(), CreateAnomaly(), and Init().

int8 AnomalyMgr::m_Unrated
private

Definition at line 86 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().

int8 AnomalyMgr::m_WH
private

Definition at line 80 of file AnomalyMgr.h.

Referenced by GetDungeonType(), and Init().


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