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

#include "DungeonMgr.h"

Collaboration diagram for DungeonMgr:

Protected Attributes

ManagerDB m_db
 
SystemGPoint m_gp
 

Private Attributes

bool m_initalized
 
AnomalyMgrm_anomMgr
 
SpawnMgrm_spawnMgr
 
SystemManagerm_system
 
PyServiceMgrm_services
 
std::vector< Dungeon::GroupDatam_anomalyItems
 
std::map< uint32, std::vector
< uint32 > > 
m_dungeonList
 

DungeonMgr.cpp

Dungeon management system for EVEmu

: Allan

Date
: 12 December 2015 : 27 August 2017
 DungeonMgr (SystemManager *system, PyServiceMgr &svc)
 
 ~DungeonMgr ()
 
bool Init (AnomalyMgr *anomMgr, SpawnMgr *spawnMgr)
 
void Process ()
 
void Load ()
 
bool MakeDungeon (CosmicSignature &sig)
 
bool Create (uint32 templateID, CosmicSignature &sig)
 
void CreateDeco (uint32 templateID, CosmicSignature &sig)
 
int8 GetFaction (uint32 factionID)
 
int8 GetRandLevel ()
 
void AddDecoToVector (uint8 dunType, uint32 templateID, std::vector< uint16 > &groupVec)
 

Detailed Description

Definition at line 91 of file DungeonMgr.h.

Constructor & Destructor Documentation

DungeonMgr::DungeonMgr ( SystemManager system,
PyServiceMgr svc 
)

Definition at line 161 of file DungeonMgr.cpp.

References m_anomalyItems, and m_initalized.

162 : m_system(mgr),
163 m_services(svc),
164 m_anomMgr(nullptr),
165 m_spawnMgr(nullptr)
166 {
167  m_initalized = false;
168  m_anomalyItems.clear();
169 }
SystemManager * m_system
Definition: DungeonMgr.h:117
std::vector< Dungeon::GroupData > m_anomalyItems
Definition: DungeonMgr.h:126
PyServiceMgr & m_services
Definition: DungeonMgr.h:118
bool m_initalized
Definition: DungeonMgr.h:113
AnomalyMgr * m_anomMgr
Definition: DungeonMgr.h:115
SpawnMgr * m_spawnMgr
Definition: DungeonMgr.h:116
DungeonMgr::~DungeonMgr ( )

Definition at line 171 of file DungeonMgr.cpp.

172 {
173  //for now we're deleting everything till i can write proper item handling code
174 
175  /* this is not needed as all items are temp at this time.
176  for (auto cur : m_dungeonList)
177  for (auto item : cur.second)
178  InventoryDB::DeleteItem(item);
179  */
180 }

Member Function Documentation

void DungeonMgr::AddDecoToVector ( uint8  dunType,
uint32  templateID,
std::vector< uint16 > &  groupVec 
)
private

Definition at line 782 of file DungeonMgr.cpp.

References _log, EvE::Trig::Deg2Rad(), SystemManager::GetSecValue(), IsEven(), m_anomalyItems, m_system, MakeRandomInt(), sDunDataMgr, Dungeon::GroupData::typeCatID, Dungeon::GroupData::typeGrpID, Dungeon::GroupData::typeID, Dungeon::GroupData::typeName, Dungeon::GroupData::x, Dungeon::GroupData::y, and Dungeon::GroupData::z.

Referenced by CreateDeco().

783 {
784  // templateID = (sig.dungeonType *10000) + (sec *1000) + (type *100) + (level *10) + factionID;
785  uint8 factionID = templateID % 10;
786  uint8 level = templateID / 10 % 10;
787  uint8 type = templateID / 100 % 10;
788  uint8 sec = templateID / 1000 % 10;
789 
790  int8 step = 0;
791  uint16 count = 0, radius = 0, pos = 10000 * level;
792  double theta = 0;
793 
794  // level is 0 to 9, system multiplier is 0.1 to 2.0 (x10 is 1-20)
795  level *= (m_system->GetSecValue() *10); // config variable here?
796  // set origLevel 0 to 18, rounding up
797  uint8 origLevel = ceil(level /10);
798  if (origLevel < 1)
799  origLevel = 1;
800  for (auto cur : groupVec) {
801  level = origLevel;
802  count = sDunDataMgr.groups.count(cur);
803  if (count < 1)
804  continue;
805 
806  _log(COSMIC_MGR__DEBUG, "DungeonMgr::AddDecoToVector() - %s(%u): faction %u, group %u, type %u, level %u, count %u, baseLvl %u",\
807  sDunDataMgr.GetDungeonType(dunType), dunType, factionID, \
808  cur, type, level, count, origLevel);
809 
810  auto groupRange = sDunDataMgr.groups.equal_range(cur);
811  auto it = groupRange.first;
812  double degreeSeparation = (250/level);
813  // make 1-20 random items in the anomaly based on system trusec
814  for (uint8 i=0; i < level; ++i) {
816  step = MakeRandomInt(1,count);
817  std::advance(it,step); // this is some fancy shit here
818  grp.typeID = it->second.typeID;
819  grp.typeName = it->second.typeName;
820  grp.typeGrpID = it->second.typeGrpID;
821  grp.typeCatID = it->second.typeCatID;
822  // site size and item radius determine position
823  radius = it->second.radius;
824  //if (sig.dungeonType == Gravimetric) {
825  theta = EvE::Trig::Deg2Rad(degreeSeparation * i);
826  //theta = MakeRandomFloat(0, EvE::Trig::Pi);
827  grp.x = (radius + pos * std::cos(theta)) * (IsEven(MakeRandomInt(0,10)) ? -1 : 1);
828  grp.z = (radius + pos * std::sin(theta)) * -1;
829  /*
830  grp.y = MakeRandomFloat(-radius, radius);
831  } else if (IsEven(MakeRandomInt(0,10))) {
832  grp.x = (pos + it->second.x + (radius*2)) * (IsEven(MakeRandomInt(0,10)) ? -1 : 1);
833  grp.z = pos + it->second.z + radius;
834  } else {
835  grp.x = (pos + it->second.x + radius) * -1;
836  grp.z = (pos + it->second.z + (radius*2)) * -1;
837  } */
838  grp.y = it->second.y + MakeRandomInt(-5000, radius * 2);
839  m_anomalyItems.push_back(grp);
840  it = groupRange.first;
841  }
842  }
843 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define _log(type, fmt,...)
Definition: logsys.h:124
signed __int8 int8
Definition: eve-compat.h:45
SystemManager * m_system
Definition: DungeonMgr.h:117
bool IsEven(int64 number)
Definition: misc.h:88
std::vector< Dungeon::GroupData > m_anomalyItems
Definition: DungeonMgr.h:126
double Deg2Rad(double deg)
Definition: Trig.h:25
float GetSecValue()
#define sDunDataMgr
Definition: DungeonMgr.h:78
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
std::string typeName
Definition: EVE_Dungeon.h:193
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool DungeonMgr::Create ( uint32  templateID,
CosmicSignature sig 
)
Todo:
make specific table for dungeon items: dungeonID, systemID, entity shit if we decide to keep them.

Definition at line 257 of file DungeonMgr.cpp.

References _log, SystemManager::AddEntity(), CosmicSignature::bubbleID, BeltMgr::Create(), CreateDeco(), SpawnMgr::DoSpawnForAnomaly(), CosmicSignature::dungeonType, Dungeon::Template::dunName, Dungeon::Template::dunRoomID, Dungeon::Template::dunSpawnClass, factionRogueDrones, flagNone, SystemManager::GetBeltMgr(), SystemManager::GetID(), SystemBubble::GetID(), SystemManager::GetServiceMgr(), Dungeon::Type::Gravimetric, items, m_anomalyItems, m_dungeonList, m_spawnMgr, m_system, NULL_ORIGIN(), CosmicSignature::ownerID, CosmicSignature::position, sBubbleMgr, sDataMgr, sDunDataMgr, CosmicSignature::sigItemID, CosmicSignature::sigName, CosmicSignature::sigTypeID, sItemFactory, InventoryItem::SpawnItem(), SystemEntity::SysBubble(), CosmicSignature::systemID, Dungeon::GroupData::typeCatID, Dungeon::GroupData::typeGrpID, Dungeon::GroupData::typeID, Dungeon::GroupData::typeName, Dungeon::Type::Wormhole, Dungeon::GroupData::x, Ga::GaVec3::x, y(), Dungeon::GroupData::y, Ga::GaVec3::y, Dungeon::GroupData::z, and Ga::GaVec3::z.

Referenced by MakeDungeon().

258 {
259  Dungeon::Template dTemplate = Dungeon::Template();
260  if (!sDunDataMgr.GetTemplate(templateID, dTemplate))
261  return false;
262 
263  if (dTemplate.dunRoomID == 0) {
264  _log(COSMIC_MGR__ERROR, "DungeonMgr::Create() - roomID is 0 for template %u.", templateID);
265  return false;
266  }
267 
268  if ((sig.dungeonType < Dungeon::Type::Wormhole) // 1 - 5
269  or (sig.ownerID == factionRogueDrones)) {
270  sig.sigName = dTemplate.dunName;
271  } else {
272  sig.sigName = sDataMgr.GetFactionName(sig.ownerID);
273  sig.sigName += dTemplate.dunName;
274  }
275 
276  // spawn and save actual anomaly item // typeID, ownerID, locationID, flag, name, &_position
278  /*
279  std::string info = "Dungeon: ";
280  info += sig.sigName;
281  info += " in ";
282  info += m_system->GetName();
283  */
284  ItemData iData(sig.sigTypeID, sig.ownerID, sig.systemID, flagNone, sig.sigName.c_str(), sig.position/*, info*/);
285  InventoryItemRef iRef = InventoryItem::SpawnItem(sItemFactory.GetNextTempID(), iData);
286  if (iRef.get() == nullptr) // make error and exit
287  return false;
288  CelestialSE* cSE = new CelestialSE(iRef, *(m_system->GetServiceMgr()), m_system);
289  if (cSE == nullptr)
290  return false; // we'll get over it.
291  // dont add signal thru sysMgr. signal is added when this returns to anomMgr
292  m_system->AddEntity(cSE, false);
293  sig.sigItemID = iRef->itemID();
294  sig.bubbleID = cSE->SysBubble()->GetID();
295 
296  _log(COSMIC_MGR__TRACE, "DungeonMgr::Create() - %s using templateID %u and roomID %i", sig.sigName.c_str(), templateID, dTemplate.dunRoomID);
297 
298  /* do we need this? persistent dungeons?
299  if ((typeID == 1) or (typeID == 8) or (typeID == 9) or (typeID == 10)) {
300  // setup data to save active dungeon
301  ActiveDungeon dungeon = ActiveDungeon();
302  dungeon.dunExpiryTime = Win32TimeNow() + (EvE::Time::Day * 3); // 3 days - i know this isnt right. just for testing.
303  dungeon.dunTemplateID = templateID;
304  dungeon.dunItemID = sig.sigItemID;
305  dungeon.state = 0; //dunType here.
306  dungeon.systemID = sig.systemID;
307  dungeon.x = sig.x;
308  dungeon.y = sig.y;
309  dungeon.z = sig.z;
310  sDunDataMgr.AddDungeon(dungeon);
311  } */
312 
313  /* roomID format. ABCD
314  * A = roomtype - 1:combat, 2:rescue, 3:capture, 4:salvage, 5:relic, 6:hacking, 7:roids, 8:clouds, 9:recon
315  * B = level - 0:none, 1:f, 2:d, 3:c, 4:af/ad, 5:bc, 6:ac, 7:bs, 8:abs, 9:hard
316  * C = amount/size - 0:code defined 1:small(1-5), 2:medium(2-10), 3:large(5-25), 4:enormous(10-50), 5:colossal(20-100), 6-9:ice
317  * D = faction - 0=drone, 1:Serpentis, 2:Angel, 3:Blood, 4:Guristas, 5:Sansha, 6:Amarr, 7:Caldari, 8:Gallente, 9:Minmatar
318  * D = sublevel - 0:gas, 1-5:ore, 6-9:ice
319  */
320 
321  int16 x=0, y=0, z=0;
322  Dungeon::GroupData grp;
323  auto roomRange = sDunDataMgr.rooms.equal_range(dTemplate.dunRoomID);
324  for (auto it = roomRange.first; it != roomRange.second; ++it) {
325  x = it->second.x;
326  y = it->second.y;
327  z = it->second.z;
328  auto groupRange = sDunDataMgr.groups.equal_range(it->second.dunGroupID);
329  for (auto it2 = groupRange.first; it2 != groupRange.second; ++it2) {
330  grp.typeCatID = it2->second.typeCatID;
331  grp.typeGrpID = it2->second.typeGrpID;
332  grp.typeName = it2->second.typeName;
333  grp.typeID = it2->second.typeID;
334  grp.x = (x + it2->second.x);
335  grp.y = (y + it2->second.y);
336  grp.z = (z + it2->second.z);
337  m_anomalyItems.push_back(grp);
338  }
339  }
341  // dungeon template for grav sites just give 'extra' roid data
342  int16 size = m_anomalyItems.size();
343  uint8 divisor = 10;
344  if (size < 100)
345  divisor = 100;
346  float chance = (100.0 /size) /divisor;
347  if (chance < 0.01)
348  chance = 0.01;
349  std::unordered_multimap<float, uint16> roidTypes;
350  for (auto cur : m_anomalyItems)
351  roidTypes.emplace(chance, cur.typeID);
352 
353  m_system->GetBeltMgr()->Create(sig, roidTypes);
354  // clear out extra roids data to continue with room deco
355  m_anomalyItems.clear();
356  } else {
357  // other types have a chance for roids.
358  }
359 
360  // create deco items for this dungeon
361  CreateDeco(templateID, sig);
362 
363  // item spawning method
364  uint32 systemID = m_system->GetID();
365  std::vector<uint32> items;
366  GPoint pos2(NULL_ORIGIN);
367  std::vector<Dungeon::GroupData>::iterator itr = m_anomalyItems.begin(), end = m_anomalyItems.end();
368  while (itr != end) {
369  pos2.x = sig.position.x + itr->x;
370  pos2.y = sig.position.y + itr->y;
371  pos2.z = sig.position.z + itr->z;
372  // typeID, ownerID, locationID, flag, name, &_position
373  ItemData dData(itr->typeID, sig.ownerID, systemID, flagNone, itr->typeName.c_str(), pos2);
374  iRef = InventoryItem::SpawnItem(sItemFactory.GetNextTempID(), dData);
375  if (iRef.get() == nullptr) // we'll survive...
376  continue;
377  // should ALL of these be CelestialSEs?
378  cSE = new CelestialSE(iRef, *(m_system->GetServiceMgr()), m_system);
379  m_system->AddEntity(cSE, false);
380  items.push_back(iRef->itemID());
381  ++itr;
382  }
383 
384  if (dTemplate.dunSpawnClass > 0)
386 
387  _log(COSMIC_MGR__TRACE, "DungeonMgr::Create() - dungeonID %u created for %s with %u items.", \
388  sig.sigItemID, sig.sigName.c_str(), m_anomalyItems.size());
389 
390  m_anomalyItems.clear();
391  if (!items.empty())
392  m_dungeonList.emplace(sig.sigItemID, items);
393 
394  return true;
395 }
unsigned __int8 uint8
Definition: eve-compat.h:46
void AddEntity(SystemEntity *pSE, bool addSignal=true)
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
static InventoryItemRef SpawnItem(uint32 itemID, const ItemData &data)
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
bool Create(CosmicSignature &sig, std::unordered_multimap< float, uint16 > &roidTypes)
Definition: BeltMgr.cpp:244
uint32 GetID() const
Definition: SystemManager.h:80
std::string sigName
GaFloat x
Definition: GaTypes.h:207
std::map< uint32, std::vector< uint32 > > m_dungeonList
Definition: DungeonMgr.h:128
SystemManager * m_system
Definition: DungeonMgr.h:117
Definition: gpoint.h:33
std::vector< Dungeon::GroupData > m_anomalyItems
Definition: DungeonMgr.h:126
uint16 GetID()
Definition: SystemBubble.h:91
static const GPoint NULL_ORIGIN(0, 0, 0)
BeltMgr * GetBeltMgr()
void CreateDeco(uint32 templateID, CosmicSignature &sig)
Definition: DungeonMgr.cpp:651
unsigned __int32 uint32
Definition: eve-compat.h:50
PyServiceMgr * GetServiceMgr()
Definition: SystemManager.h:88
void DoSpawnForAnomaly(SystemBubble *pBubble, uint8 spawnClass)
Definition: SpawnMgr.cpp:309
GaFloat y
Definition: GaTypes.h:207
#define sDunDataMgr
Definition: DungeonMgr.h:78
std::string dunName
Definition: EVE_Dungeon.h:167
signed __int16 int16
Definition: eve-compat.h:47
std::string typeName
Definition: EVE_Dungeon.h:193
#define sItemFactory
Definition: ItemFactory.h:165
#define sBubbleMgr
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all items
SpawnMgr * m_spawnMgr
Definition: DungeonMgr.h:116
GaFloat z
Definition: GaTypes.h:207
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void DungeonMgr::CreateDeco ( uint32  templateID,
CosmicSignature sig 
)
protected
Todo:
this needs work for proper sizing of deco.

Definition at line 651 of file DungeonMgr.cpp.

References AddDecoToVector(), Dungeon::Type::Anomaly, CosmicSignature::dungeonType, Dungeon::Type::Escalation, Dungeon::Type::Gravimetric, Dungeon::Type::Ladar, Dungeon::Type::Magnetometric, Dungeon::Type::Radar, Dungeon::Type::Rated, and Dungeon::Type::Unrated.

Referenced by Create().

652 {
654  /* templateID format. ABCDE
655  * A = site - 1:mission, 2:grav, 3:mag, 4:radar, 5:ladar, 6:ded, 7:anomaly, 8:unrated, 9:escalation
656  * B = sec - mission: 1-9 (incomplete); others - sysSec: 1=hi, 2=lo, 3=null, 4=mid;
657  * C = type - grav: ore 0-5, ice 6-9; anomaly: 1-5; mission: 1-9; mag: *see below*; ded: 1-8; ladar/radar: 1-8
658  * D = level - mission: 1-9; grav: ore 1-3, ice 0; mag: *see below*; radar: 1-norm; 2-digital(nullsec); ladar: 1; anomaly: 1-5
659  * E = faction - 0=code defined, 1=Serpentis, 2=Angel, 3=Blood, 4=Guristas, 5=Sansha, 6=Drones, 7=region sov, 8=region rat, 9=other
660  *
661  * NOTE: mag sites have multiple types and levels based on other variables.
662  * levels are defined as relic(1), salvage(2), and drone(3), with salvage being dominant.
663  * for hisec and losec, types are 1-8 for relic and salvage. there are no drone mag sites here
664  * for nullsec, relic site types are 1-8, salvage site types are 1-4, and drone site types are 1-7
665  *
666  * NOTE: faction can only be 8 for grav and anomaly sites, unless drones (6). all others MUST use 1-6
667  */
668 
669  // templateID = (sig.dungeonType *10000) + (sec *1000) + (type *100) + (level *10) + factionID;
670  uint8 factionID = templateID % 10;
671  uint8 level = templateID / 10 % 10;
672  uint8 type = templateID / 100 % 10;
673  //uint8 sec = templateID / 1000 % 10;
674 
675  // create groupIDs for this dungeon, and add to vector
676  // NOTE: these are NOT invGroups here....
677  std::vector<uint16> groupVec;
678  groupVec.clear();
679  // all groups get the worthless mining types and misc deco items
680  groupVec.push_back(131); //misc roids
681  groupVec.push_back(132); //worthless mining types
682  groupVec.push_back(691); // misc
683  // add worthless shit to vector
684  AddDecoToVector(sig.dungeonType, templateID, groupVec);
685  // clear out vector before adding specific types
686  groupVec.clear();
687 
688  using namespace Dungeon::Type;
689  switch (sig.dungeonType) {
690  case Mission: { //1
691  } break;
692  case Gravimetric: { //2
693  groupVec.push_back(130); //named roids
694  groupVec.push_back(160); //asteroid colony items
695  groupVec.push_back(620); // Starbase
696  groupVec.push_back(630); // Habitation
697  } break;
698  case Magnetometric: { //3
699  groupVec.push_back(620); // Starbase
700  groupVec.push_back(630); // Habitation
701  groupVec.push_back(640); // Stationary
702  groupVec.push_back(650); // Indestructible
703  groupVec.push_back(660); // Forcefield
704  groupVec.push_back(670); // Shipyard
705  groupVec.push_back(680); // Construction
706  groupVec.push_back(690); // Storage
707  } break;
708  case Radar: { //4
709  groupVec.push_back(130); //named roids
710  groupVec.push_back(160); //asteroid colony items
711  groupVec.push_back(630); // Habitation
712  groupVec.push_back(640); // Stationary
713  } break;
714  case Ladar: { //5
715  groupVec.push_back(160); //asteroid colony items
716  groupVec.push_back(670); // Shipyard
717  groupVec.push_back(680); // Construction
718  groupVec.push_back(690); // Storage
719  } break;
720  case Anomaly: //7
721  case Rated: { //10
722  groupVec.push_back(430); //lco misc
723  groupVec.push_back(431); //lco Habitation
724  groupVec.push_back(432); //lco drug labs
725  groupVec.push_back(433); //lco Starbase
726  groupVec.push_back(630); // Habitation
727  groupVec.push_back(640); // Stationary
728  groupVec.push_back(650); // Indestructible
729  } break;
730  case Unrated: { //8
731  groupVec.push_back(430); //lco misc
732  groupVec.push_back(431); //lco Habitation
733  groupVec.push_back(432); //lco drug labs
734  groupVec.push_back(433); //lco Starbase
735  } break;
736  case Escalation: { //9
737  groupVec.push_back(640); // Stationary
738  groupVec.push_back(650); // Indestructible
739  } break;
740  }
741  // add misc shit to vector
742  AddDecoToVector(sig.dungeonType, templateID, groupVec);
743  // clear out vector before adding specific faction types
744  groupVec.clear();
745  switch (sig.dungeonType) {
746  case Anomaly: //7
747  case Unrated: //8
748  case Escalation: //9
749  case Rated: { //10
750  switch (factionID) {
751  case 1: { //Serpentis
752  groupVec.push_back(401); //faction lco
753  groupVec.push_back(601); //faction base
754  } break;
755  case 2: { //Angel
756  groupVec.push_back(402); //faction lco
757  groupVec.push_back(602); //faction base
758  } break;
759  case 3: { //Blood
760  groupVec.push_back(403); //faction lco
761  groupVec.push_back(603); //faction base
762  } break;
763  case 4: { //Guristas
764  groupVec.push_back(404); //faction lco
765  groupVec.push_back(604); //faction base
766  } break;
767  case 5: { //Sansha
768  groupVec.push_back(405); //faction lco
769  groupVec.push_back(605); //faction base
770  } break;
771  case 6: { //Drones
772  groupVec.push_back(406); //faction lco
773  groupVec.push_back(606); //faction base
774  } break;
775  // make error for default or 0 here?
776  }
777  }
778  }
779  AddDecoToVector(sig.dungeonType, templateID, groupVec);
780 }
unsigned __int8 uint8
Definition: eve-compat.h:46
void AddDecoToVector(uint8 dunType, uint32 templateID, std::vector< uint16 > &groupVec)
Definition: DungeonMgr.cpp:782

Here is the call graph for this function:

Here is the caller graph for this function:

int8 DungeonMgr::GetFaction ( uint32  factionID)
private

Definition at line 599 of file DungeonMgr.cpp.

References factionAmarr, factionAmmatar, factionAngel, factionBloodRaider, factionCaldari, factionGallente, factionGuristas, factionMinmatar, factionRogueDrones, factionSanshas, factionSerpentis, SystemManager::GetRegionID(), m_system, and sDataMgr.

Referenced by MakeDungeon().

600 {
601  switch (factionID) {
602  case factionAngel: return 2;
603  case factionSanshas: return 5;
604  case factionGuristas: return 4;
605  case factionSerpentis: return 1;
606  case factionBloodRaider: return 3;
607  case factionRogueDrones: return 6;
608  case 0: return 7;
609  // these are incomplete. set to default (region rat)
610  case factionAmarr:
611  case factionAmmatar:
612  case factionCaldari:
613  case factionGallente:
614  case factionMinmatar:
615  default:
616  return GetFaction(sDataMgr.GetRegionRatFaction(m_system->GetRegionID()));
617  }
618 }
SystemManager * m_system
Definition: DungeonMgr.h:117
uint32 GetRegionID()
Definition: SystemManager.h:81
int8 GetFaction(uint32 factionID)
Definition: DungeonMgr.cpp:599
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

int8 DungeonMgr::GetRandLevel ( )
private

Definition at line 620 of file DungeonMgr.cpp.

References _log, and MakeRandomFloat().

Referenced by MakeDungeon().

621 {
622  double level = MakeRandomFloat();
623  _log(COSMIC_MGR__TRACE, "DungeonMgr::GetRandLevel() - level = %.2f", level);
624 
625  if (level < 0.15) {
626  return 4;
627  } else if (level < 0.25) {
628  return 3;
629  } else if (level < 0.50) {
630  return 2;
631  } else {
632  return 1;
633  }
634 }
#define _log(type, fmt,...)
Definition: logsys.h:124
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114

Here is the call graph for this function:

Here is the caller graph for this function:

bool DungeonMgr::Init ( AnomalyMgr anomMgr,
SpawnMgr spawnMgr 
)

Definition at line 182 of file DungeonMgr.cpp.

References _log, SystemManager::GetID(), SystemManager::GetName(), Load(), m_anomMgr, m_initalized, m_spawnMgr, m_system, sConfig, and SpawnMgr::SetDungMgr().

Referenced by SystemManager::LoadCosmicMgrs().

183 {
184  m_anomMgr = anomMgr;
185  m_spawnMgr = spawnMgr;
186 
187  if (m_anomMgr == nullptr) {
188  _log(COSMIC_MGR__ERROR, "System Init Fault. anomMgr == nullptr. Not Initializing Dungeon Manager for %s(%u)", m_system->GetName(), m_system->GetID());
189  return m_initalized;
190  }
191 
192  if (m_spawnMgr == nullptr) {
193  _log(COSMIC_MGR__ERROR, "System Init Fault. spawnMgr == nullptr. Not Initializing Dungeon Manager for %s(%u)", m_system->GetName(), m_system->GetID());
194  return m_initalized;
195  }
196 
197  if (!sConfig.cosmic.DungeonEnabled){
198  _log(COSMIC_MGR__MESSAGE, "Dungeon System Disabled. Not Initializing Dungeon Manager for %s(%u)", m_system->GetName(), m_system->GetID());
199  return true;
200  }
201 
202  if (!sConfig.cosmic.AnomalyEnabled) {
203  _log(COSMIC_MGR__MESSAGE, "Anomaly System Disabled. Not Initializing Dungeon Manager for %s(%u)", m_system->GetName(), m_system->GetID());
204  return true;
205  }
206 
207  if (!sConfig.npc.RoamingSpawns and !sConfig.npc.StaticSpawns) {
208  _log(COSMIC_MGR__MESSAGE, "SpawnMgr Disabled. Not Initializing Dungeon Manager for %s(%u)", m_system->GetName(), m_system->GetID());
209  return true;
210  }
211 
212  if (!sConfig.cosmic.BeltEnabled) {
213  _log(COSMIC_MGR__MESSAGE, "BeltMgr Disabled. Not Initializing Dungeon Manager for %s(%u)", m_system->GetName(), m_system->GetID());
214  return true;
215  }
216 
217  m_spawnMgr->SetDungMgr(this);
218  Load();
219 
220  _log(COSMIC_MGR__MESSAGE, "DungeonMgr Initialized for %s(%u)", m_system->GetName(), m_system->GetID());
221 
222  m_initalized = true;
223 
224  return m_initalized;
225 }
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetID() const
Definition: SystemManager.h:80
SystemManager * m_system
Definition: DungeonMgr.h:117
void SetDungMgr(DungeonMgr *pDmgr)
Definition: SpawnMgr.h:34
void Load()
Definition: DungeonMgr.cpp:235
bool m_initalized
Definition: DungeonMgr.h:113
AnomalyMgr * m_anomMgr
Definition: DungeonMgr.h:115
const char * GetName() const
Definition: SystemManager.h:84
SpawnMgr * m_spawnMgr
Definition: DungeonMgr.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

void DungeonMgr::Load ( )
Todo:
this will need more work as the system matures... for(auto dungeon : dungeons) { InventoryItemRef dungeonRef = m_system->itemFactory()->GetItem( dungeon.dungeonID ); if( !dungeonRef ) { _log(COSMIC_MGR__WARNING, "DungeonMgr::Load() - Unable to spawn dungeon item #%u:'%s' of type %u.", dungeon.dungeonID, dungeon.typeID); continue; } AsteroidSE* asteroidObj = new AsteroidSE( dungeonRef, *(m_system->GetServiceMgr()), m_system ); if( !asteroidObj ) { _log(COSMIC_MGR__WARNING, "DungeonMgr::Load() - Unable to spawn dungeon entity #%u:'%s' of type %u.", dungeon.dungeonID, dungeon.typeID); continue; } _log(COSMIC_MGR__TRACE, "DungeonMgr::Load() - Loaded dungeon %u, type %u for %s(%u)", dungeon.dungeonID, dungeon.typeID, m_system->GetName(), m_systemID ); sBubbleMgr.Add( asteroidObj ); sDunDataMgr.AddDungeon(std::pair<uint32, Dungeon::ActiveData*>(m_system->GetID(), dungeon)); }

Definition at line 235 of file DungeonMgr.cpp.

References SystemManager::GetID(), ManagerDB::GetSavedDungeons(), and m_system.

Referenced by Init().

236 {
237  std::vector<Dungeon::ActiveData> dungeons;
255 }
uint32 GetID() const
Definition: SystemManager.h:80
SystemManager * m_system
Definition: DungeonMgr.h:117
static bool GetSavedDungeons(uint32 systemID, std::vector< Dungeon::ActiveData > &into)
Definition: ManagerDB.cpp:645

Here is the call graph for this function:

Here is the caller graph for this function:

bool DungeonMgr::MakeDungeon ( CosmicSignature sig)

Definition at line 417 of file DungeonMgr.cpp.

References _log, Dungeon::Type::Anomaly, Create(), CosmicSignature::dungeonType, Dungeon::Type::Escalation, GetFaction(), GetRandLevel(), SystemManager::GetRegionID(), SystemManager::GetSystemSecurityRating(), Dungeon::Type::Gravimetric, Dungeon::Type::Ladar, m_system, Dungeon::Type::Magnetometric, MakeRandomFloat(), MakeRandomInt(), CosmicSignature::ownerID, Dungeon::Type::Radar, Dungeon::Type::Rated, sDataMgr, sDunDataMgr, CosmicSignature::sigStrength, and Dungeon::Type::Unrated.

Referenced by AnomalyMgr::CreateAnomaly().

418 {
419  float secRating = m_system->GetSystemSecurityRating();
420  int8 sec = 1; // > 0.6
421  if (secRating < -0.2) {
422  sec = 3;
423  } else if (secRating < 0.2) {
424  sec = 4;
425  } else if (secRating < 0.6) {
426  sec = 2;
427  }
428 
429  float level(1.0f);
430  int8 type(1);
431  // need to determine region sov, region rat or other here also
432  int8 faction(GetFaction(sig.ownerID));
433 
434  using namespace Dungeon::Type;
435  switch (sig.dungeonType) {
436  case Gravimetric: { // 2
437  faction = 8; // region rat
438  // all roid types can spawn in grav sites.
439  level = MakeRandomFloat();
440  if (level < 0.1) {
441  level = 3;
442  } else if (level < 0.3) {
443  level = 2;
444  } else {
445  level = 1;
446  }
447  // sigStrength depends on roid types as well as trueSec
448  if (sec == 1) { // hi sec
449  sig.sigStrength = 0.2 /level; // 1/5 base
450  //sig.sigStrength = 0.0125; // testing 1/80
451  type = MakeRandomInt(0,5);
452  } else if (sec == 2) { // lo sec
453  sig.sigStrength = 0.1 /level; // 1/10 base
454  type = MakeRandomInt(0,3);
455  } else if (sec == 4) { // mid sec
456  sig.sigStrength = 0.0667 /level; // 1/15 base
457  type = MakeRandomInt(0,2);
458  } else { // null sec
459  sig.sigStrength = 0.05 /level; // 1/20 base
460  type = MakeRandomInt(0,2);
461  }
462  } break;
463  case Magnetometric: { // 3
464  level = MakeRandomFloat();
465  if (sec == 3) { // nullsec
466  if (level < 0.1) { // 10% to be drone site
467  level = 3;
468  type = MakeRandomInt(1,7);
469  sig.sigStrength = 0.0125; // 1/80
470  } else if (level < 0.3) { // 20% to be relic site
471  level = 1;
472  type = MakeRandomInt(1,8);
473  sig.sigStrength = 0.025; // 1/40
474  } else { // else salvage site
475  level = 1;
476  type = MakeRandomInt(1,4);
477  sig.sigStrength = 0.05; // 1/20
478  }
479  } else { // hi, mid and lo sec
480  type = MakeRandomInt(1,8);
481  if (level < 0.3) { // 20% to be relic site
482  level = 1;
483  sig.sigStrength = 0.05; // 1/20
484  } else {
485  level = 2;
486  sig.sigStrength = 0.1; // 1/10
487  }
488  }
489  if (level == 3) {
490  faction = 6; // drone
491  } else if (faction == 6) {
492  // lvls 1&2 cannot be drone. set to region pirate
493  faction = GetFaction(sDataMgr.GetRegionRatFaction(m_system->GetRegionID()));
494  }
495  } break;
496  case Radar: { // 4
497  // type 1, level 1 are covert research (ghost sites)
498  // level 2 are digital sites and region-specific (only in nullsec)
499  // both are incomplete and will be harder than reg sites.
500  type = MakeRandomInt(1,8);
501  if (sec == 1) {
502  sig.sigStrength = 0.1; // 1/10
503  if (type == 1) { // Covert Research
504  level = 1;
505  sig.sigStrength = 0.05; // 1/20
506  }
507  } else if (sec == 2) {
508  sig.sigStrength = 0.05; // 1/20
509  if (type == 1) { // Covert Research
510  level = 1;
511  sig.sigStrength = 0.025; // 1/40
512  }
513  } else if (sec == 3) {
514  sig.sigStrength = 0.025; // 1/40
515  if (faction == 0) { // this should not hit
516  level = 2;
517  sig.sigStrength = 0.0222; // 1/45
518  } else if (type == 1) { // Covert Research
519  level = 1;
520  sig.sigStrength = 0.0167; // 1/60
521  }
522  }
523  } break;
524  case Ladar: { // 5
525  faction = 0;
526  type = MakeRandomInt(1,8);
527  if (sec == 1) {
528  sig.sigStrength = 0.1; // 1/10
529  } else if (sec == 2) {
530  sig.sigStrength = 0.05; // 1/20
531  } else if (sec == 3) {
532  sig.sigStrength = 0.025; // 1/40
533  }
534  } break;
535  case Anomaly: { // 7
536  type = MakeRandomInt(1,5);
537  // if anomaly is non-drone, set template variables for types.
538  // looking over this again (years later) it dont make much sense.
539  // will have to look deeper when i have time.
540  if (faction != 6) {
541  faction = 8;
542  if (sec == 1) {
543  if (type == 1) {
544  level = GetRandLevel();
545  }
546  } else if (sec == 2) {
547  if (type == 2) {
548  level = GetRandLevel();
549  } else if (type == 4) {
550  level = GetRandLevel();
551  }
552  } else if (sec == 3) {
553  if (type == 1) {
554  level = GetRandLevel();
555  } else if (type == 3) {
556  level = GetRandLevel();
557  }
558  }
559  }
560  } break;
561  // yes, these will 'fall thru' to 'Unrated' here. this is on purpose
562  case Escalation: // 9
563  case Rated: { // 10
564  //sig.dungeonType = 9;
565  };
566  case Mission: { // 1
567  // not sure how im gonna do this one yet...make it unrated for now
568  sig.dungeonType = 8;
569  };
570  case Unrated: { // 8
571  if (faction == 6) {
572  type = MakeRandomInt(1,3);
573  } else {
574  faction = 0;
575  type = MakeRandomInt(1,5);
576  }
577  } break;
578  case 0:
579  default: {
580  sig.dungeonType = 7;
581  MakeDungeon(sig);
582  } break;
583  }
584 
585  if (faction == 7) {
586  // faction is defined to be region sovereign holder.
587  // this hasnt been written yet, so default to region rats
588  faction = GetFaction(sDataMgr.GetRegionRatFaction(m_system->GetRegionID()));
589  }
590 
591  uint32 templateID = (sig.dungeonType * 10000) + (sec * 1000) + (type * 100) + (level * 10) + faction;
592 
593  _log(COSMIC_MGR__TRACE, "DungeonMgr::MakeDungeon() - Calling Create for type %s(%u) using templateID %u", \
594  sDunDataMgr.GetDungeonType(sig.dungeonType), sig.dungeonType, templateID);
595 
596  return Create(templateID, sig);
597 }
#define _log(type, fmt,...)
Definition: logsys.h:124
bool MakeDungeon(CosmicSignature &sig)
Definition: DungeonMgr.cpp:417
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
bool Create(uint32 templateID, CosmicSignature &sig)
Definition: DungeonMgr.cpp:257
signed __int8 int8
Definition: eve-compat.h:45
SystemManager * m_system
Definition: DungeonMgr.h:117
unsigned __int32 uint32
Definition: eve-compat.h:50
#define sDunDataMgr
Definition: DungeonMgr.h:78
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
uint32 GetRegionID()
Definition: SystemManager.h:81
int8 GetRandLevel()
Definition: DungeonMgr.cpp:620
int8 GetFaction(uint32 factionID)
Definition: DungeonMgr.cpp:599
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void DungeonMgr::Process ( )

Definition at line 228 of file DungeonMgr.cpp.

References m_initalized.

Referenced by SystemManager::ProcessTic().

228  {
229  if (!m_initalized)
230  return;
231 
232  // this is used to remove empty/completed/timed-out dungons....eventually
233 }
bool m_initalized
Definition: DungeonMgr.h:113

Here is the caller graph for this function:

Member Data Documentation

std::vector<Dungeon::GroupData> DungeonMgr::m_anomalyItems
private

Definition at line 126 of file DungeonMgr.h.

Referenced by AddDecoToVector(), Create(), and DungeonMgr().

AnomalyMgr* DungeonMgr::m_anomMgr
private

Definition at line 115 of file DungeonMgr.h.

Referenced by Init().

ManagerDB DungeonMgr::m_db
protected

Definition at line 106 of file DungeonMgr.h.

std::map<uint32, std::vector<uint32> > DungeonMgr::m_dungeonList
private

Definition at line 128 of file DungeonMgr.h.

Referenced by Create().

SystemGPoint DungeonMgr::m_gp
protected

Definition at line 107 of file DungeonMgr.h.

bool DungeonMgr::m_initalized
private

Definition at line 113 of file DungeonMgr.h.

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

PyServiceMgr& DungeonMgr::m_services
private

Definition at line 118 of file DungeonMgr.h.

SpawnMgr* DungeonMgr::m_spawnMgr
private

Definition at line 116 of file DungeonMgr.h.

Referenced by Create(), and Init().

SystemManager* DungeonMgr::m_system
private

Definition at line 117 of file DungeonMgr.h.

Referenced by AddDecoToVector(), Create(), GetFaction(), Init(), Load(), and MakeDungeon().


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