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

#include "DungeonMgr.h"

Inheritance diagram for DungeonDataMgr:
Collaboration diagram for DungeonDataMgr:

Public Member Functions

 ~DungeonDataMgr ()
 
uint32 GetDungeonID ()
 
- Public Member Functions inherited from Singleton< DungeonDataMgr >
 Singleton ()
 Primary constructor. More...
 

Public Attributes

ActiveDungeonDef activeDungeons
 
DunEntryDef entrys
 
DunRoomsDef rooms
 
DunGroupsDef groups
 

Protected Types

typedef std::map< uint32,
Dungeon::Template
DunTemplateDef
 
typedef
std::unordered_multimap
< uint32, Dungeon::ActiveData
ActiveDungeonDef
 
typedef
std::unordered_multimap
< uint32, Dungeon::RoomData
DunRoomsDef
 
typedef
std::unordered_multimap
< uint32, Dungeon::EntryData
DunEntryDef
 
typedef
std::unordered_multimap
< uint32, Dungeon::GroupData
DunGroupsDef
 

Protected Attributes

DunTemplateDef templates
 

Private Attributes

uint32 m_dungeonID
 

DungeonMgr.cpp

Dungeon management system for EVEmu

: Allan

Date
: 12 December 2015 : 27 August 2017
 DungeonDataMgr ()
 
int Initialize ()
 
void AddDungeon (Dungeon::ActiveData &dungeon)
 
void GetDungeons (std::vector< Dungeon::ActiveData > &dunList)
 
bool GetTemplate (uint32 templateID, Dungeon::Template &dTemplate)
 
const char * GetDungeonType (int8 typeID)
 
void Populate ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 37 of file DungeonMgr.h.

Member Typedef Documentation

typedef std::unordered_multimap<uint32, Dungeon::ActiveData> DungeonDataMgr::ActiveDungeonDef
protected

Definition at line 58 of file DungeonMgr.h.

typedef std::unordered_multimap<uint32, Dungeon::EntryData> DungeonDataMgr::DunEntryDef
protected

Definition at line 60 of file DungeonMgr.h.

typedef std::unordered_multimap<uint32, Dungeon::GroupData> DungeonDataMgr::DunGroupsDef
protected

Definition at line 61 of file DungeonMgr.h.

typedef std::unordered_multimap<uint32, Dungeon::RoomData> DungeonDataMgr::DunRoomsDef
protected

Definition at line 59 of file DungeonMgr.h.

Definition at line 57 of file DungeonMgr.h.

Constructor & Destructor Documentation

DungeonDataMgr::DungeonDataMgr ( )

Definition at line 23 of file DungeonMgr.cpp.

References DUNGEON_ID, and m_dungeonID.

24 {
26 }
#define DUNGEON_ID
Definition: EVE_Defines.h:187
uint32 m_dungeonID
Definition: DungeonMgr.h:74
DungeonDataMgr::~DungeonDataMgr ( )
inline

Definition at line 42 of file DungeonMgr.h.

42 { /* nothing do to yet */ }

Member Function Documentation

void DungeonDataMgr::AddDungeon ( Dungeon::ActiveData dungeon)

Definition at line 120 of file DungeonMgr.cpp.

References _log, activeDungeons, Dungeon::ActiveData::dunItemID, Dungeon::ActiveData::dunTemplateID, and Dungeon::ActiveData::systemID.

121 {
122  activeDungeons.emplace(dungeon.systemID, dungeon);
123  _log(COSMIC_MGR__DEBUG, "Added Dungeon %u (%u) in systemID %u to active dungeon list.", dungeon.dunItemID, dungeon.dunTemplateID, dungeon.systemID);
124  //ManagerDB::SaveActiveDungeon(dungeon);
125 }
#define _log(type, fmt,...)
Definition: logsys.h:124
ActiveDungeonDef activeDungeons
Definition: DungeonMgr.h:66
uint32 DungeonDataMgr::GetDungeonID ( )
inline

Definition at line 52 of file DungeonMgr.h.

References m_dungeonID.

52 { return ++m_dungeonID; }
uint32 m_dungeonID
Definition: DungeonMgr.h:74
void DungeonDataMgr::GetDungeons ( std::vector< Dungeon::ActiveData > &  dunList)

Definition at line 127 of file DungeonMgr.cpp.

References activeDungeons.

128 {
129  for (auto cur : activeDungeons)
130  dunList.push_back(cur.second);
131 }
ActiveDungeonDef activeDungeons
Definition: DungeonMgr.h:66
const char * DungeonDataMgr::GetDungeonType ( int8  typeID)

Definition at line 143 of file DungeonMgr.cpp.

References Dungeon::Type::Anomaly, Dungeon::Type::Escalation, Dungeon::Type::Gravimetric, Dungeon::Type::Ladar, Dungeon::Type::Magnetometric, Dungeon::Type::Mission, Dungeon::Type::Radar, Dungeon::Type::Rated, Dungeon::Type::Unrated, and Dungeon::Type::Wormhole.

144 {
145  switch (typeID) {
146  case Dungeon::Type::Mission: return "Mission";
147  case Dungeon::Type::Gravimetric: return "Gravimetric";
148  case Dungeon::Type::Magnetometric: return "Magnetometric";
149  case Dungeon::Type::Radar: return "Radar";
150  case Dungeon::Type::Ladar: return "Ladar";
151  case Dungeon::Type::Rated: return "Rated";
152  case Dungeon::Type::Anomaly: return "Anomaly";
153  case Dungeon::Type::Unrated: return "Unrated";
154  case Dungeon::Type::Escalation: return "Escalation";
155  case Dungeon::Type::Wormhole: return "Wormhole";
156  default: return "Invalid";
157  }
158 }
bool DungeonDataMgr::GetTemplate ( uint32  templateID,
Dungeon::Template dTemplate 
)

Definition at line 133 of file DungeonMgr.cpp.

References _log, and templates.

133  {
134  std::map<uint32, Dungeon::Template>::iterator itr = templates.find(templateID);
135  if (itr == templates.end()) {
136  _log(COSMIC_MGR__ERROR, "DungeonDataMgr - templateID %u not found.", templateID);
137  return false;
138  }
139  dTemplate = itr->second;
140  return true;
141 }
#define _log(type, fmt,...)
Definition: logsys.h:124
DunTemplateDef templates
Definition: DungeonMgr.h:63
int DungeonDataMgr::Initialize ( )

Definition at line 28 of file DungeonMgr.cpp.

References ManagerDB::ClearDungeons(), Populate(), and sLog.

29 {
30  // for now, we are deleting all saved dungeons on startup. will fix this later as system matures.
32 
33  Populate();
34  sLog.Blue(" DungeonDataMgr", "Dungeon Data Manager Initialized.");
35  return 1;
36 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
static void ClearDungeons()
Definition: ManagerDB.cpp:690

Here is the call graph for this function:

void DungeonDataMgr::Populate ( )
private

Definition at line 38 of file DungeonMgr.cpp.

References Dungeon::Template::dunEntryID, Dungeon::RoomData::dunGroupID, Dungeon::Template::dunName, Dungeon::Template::dunRoomID, Dungeon::Template::dunSpawnClass, entrys, ManagerDB::GetDunEntryData(), ManagerDB::GetDunGroupData(), ManagerDB::GetDunRoomData(), ManagerDB::GetDunTemplates(), DBResultRow::GetInt(), DBQueryResult::GetRow(), DBResultRow::GetText(), GetTimeMSeconds(), groups, Dungeon::GroupData::radius, rooms, SafeDelete(), sLog, templates, Dungeon::GroupData::typeCatID, Dungeon::GroupData::typeGrpID, Dungeon::GroupData::typeID, Dungeon::GroupData::typeName, Dungeon::RoomData::x, Dungeon::GroupData::x, Dungeon::EntryData::x, Dungeon::RoomData::y, Dungeon::GroupData::y, Dungeon::EntryData::y, Dungeon::RoomData::z, Dungeon::GroupData::z, and Dungeon::EntryData::z.

Referenced by Initialize().

39 {
40  double start = GetTimeMSeconds();
41  DBQueryResult* res = new DBQueryResult();
42  DBResultRow row;
43 
45  while (res->GetRow(row)) {
46  // SELECT dunTemplateID, dunTemplateName, dunEntryID, dunSpawnID, dunRoomID FROM dunTemplates
47  Dungeon::Template dtemplates = Dungeon::Template();
48  dtemplates.dunName = row.GetText(1);
49  dtemplates.dunRoomID = row.GetInt(4);
50  dtemplates.dunEntryID = row.GetInt(2);
51  dtemplates.dunSpawnClass = row.GetInt(3);
52  templates.emplace(row.GetInt(0), dtemplates);
53  }
54 
55  //res->Reset();
57  while (res->GetRow(row)) {
58  // SELECT dunRoomID, dunGroupID, xpos, ypos, zpos FROM dunRoomData
60  drooms.dunGroupID = row.GetInt(1);
61  drooms.x = row.GetInt(2);
62  drooms.y = row.GetInt(3);
63  drooms.z = row.GetInt(4);
64  rooms.emplace(row.GetInt(0), drooms);
65  }
66 
67  //res->Reset();
69  while (res->GetRow(row)) {
70  // SELECT d.dunGroupID, d.itemTypeID, d.itemGroupID, t.typeName, t.groupID, g.categoryID, t.radius, d.xpos, d.ypos, d.zpos FROM dunGroupData
72  dgroups.typeID = row.GetInt(1);
73  dgroups.typeName = row.GetText(3);
74  dgroups.typeGrpID = row.GetInt(4);
75  dgroups.typeCatID = row.GetInt(5);
76  dgroups.radius = row.GetInt(6);
77  dgroups.x = row.GetInt(7);
78  dgroups.y = row.GetInt(8);
79  dgroups.z = row.GetInt(9);
80  groups.emplace(row.GetInt(0), dgroups);
81  }
82 
83  //res->Reset();
85  while (res->GetRow(row)) {
86  //SELECT dunEntryID, xpos, ypos, zpos FROM dunEntryData
88  dentry.x = row.GetInt(1);
89  dentry.y = row.GetInt(2);
90  dentry.z = row.GetInt(3);
91  entrys.emplace(row.GetInt(0), dentry);
92  }
93 
94  /* not ready yet
95  //res->Reset();
96  ManagerDB::GetDunSpawnInfo(*res);
97  while (res->GetRow(row)) {
98  //SELECT dunRoomSpawnID, dunRoomSpawnType, xpos, ypos, zpos
99  Dungeon::RoomSpawnInfo spawn = Dungeon::RoomSpawnInfo();
100  spawn.dunRoomSpawnID = row.GetInt(0);
101  spawn.dunRoomSpawnType = row.GetInt(1);
102  spawn.x = row.GetInt(2);
103  spawn.y = row.GetInt(3);
104  spawn.z = row.GetInt(4);
105  groups.emplace(spawn.dunRoomSpawnID, spawn);
106  } */
107 
108  // sort/save template room/group data to avoid compilation later?
109 
110  //cleanup
111  SafeDelete(res);
112 
113  //sLog.Cyan(" DungeonDataMgr", "%u rooms in %u buckets and %u groups in %u buckets for %u dungeon templates loaded in %.3fms.",\
114  rooms.size(), rooms.bucket_count(), groups.size(), groups.bucket_count(), templates.size(), (GetTimeMSeconds() - start));
115 
116  sLog.Cyan(" DungeonDataMgr", "%u entrys, %u rooms and %u groups for %u dungeon templates loaded in %.3fms.",\
117  entrys.size(), rooms.size(), groups.size(), templates.size(), (GetTimeMSeconds() - start));
118 }
const char * GetText(uint32 index) const
Definition: dbcore.h:104
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
static void GetDunRoomData(DBQueryResult &res)
Definition: ManagerDB.cpp:621
DunEntryDef entrys
Definition: DungeonMgr.h:67
static void GetDunGroupData(DBQueryResult &res)
Definition: ManagerDB.cpp:610
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
DunTemplateDef templates
Definition: DungeonMgr.h:63
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
double GetTimeMSeconds()
Definition: utils_time.cpp:104
static void GetDunTemplates(DBQueryResult &res)
Definition: ManagerDB.cpp:639
DunRoomsDef rooms
Definition: DungeonMgr.h:68
static void GetDunEntryData(DBQueryResult &res)
Definition: ManagerDB.cpp:604
std::string dunName
Definition: EVE_Dungeon.h:167
std::string typeName
Definition: EVE_Dungeon.h:193
DunGroupsDef groups
Definition: DungeonMgr.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

ActiveDungeonDef DungeonDataMgr::activeDungeons

Definition at line 66 of file DungeonMgr.h.

Referenced by AddDungeon(), and GetDungeons().

DunEntryDef DungeonDataMgr::entrys

Definition at line 67 of file DungeonMgr.h.

Referenced by Populate().

DunGroupsDef DungeonDataMgr::groups

Definition at line 69 of file DungeonMgr.h.

Referenced by Populate().

uint32 DungeonDataMgr::m_dungeonID
private

Definition at line 74 of file DungeonMgr.h.

Referenced by DungeonDataMgr(), and GetDungeonID().

DunRoomsDef DungeonDataMgr::rooms

Definition at line 68 of file DungeonMgr.h.

Referenced by Populate().

DunTemplateDef DungeonDataMgr::templates
protected

Definition at line 63 of file DungeonMgr.h.

Referenced by GetTemplate(), and Populate().


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