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

#include "SpawnMgr.h"

Collaboration diagram for SpawnMgr:

Public Member Functions

 ~SpawnMgr ()
 
void SetDungMgr (DungeonMgr *pDmgr)
 
void StopRatTimer ()
 
void StopRatGroupTimer ()
 
bool IsRatSpawnEnabled ()
 
bool IsInitialized ()
 
bool IsRatTimerStarted ()
 

Protected Types

typedef std::vector< NPC * > RatSpawningVec
 
typedef std::vector
< SystemBubble * > 
RatBubbleVec
 
typedef std::vector< SpawnGroupRatSpawnGroupVec
 
typedef std::vector
< RatSpawnClass
RatSpawnClassVec
 
typedef std::vector
< RatFactionGroups
RatFactionGroupsVec
 
typedef std::map< uint8, uint16RatFactionGroupsMap
 
typedef std::multimap< uint16,
SpawnEntry
SpawnEntryDef
 

Private Attributes

SystemManagerm_system
 
PyServiceMgrm_services
 
DungeonMgrm_dungMgr
 
Timer m_ratTimer
 
Timer m_ratGroupTimer
 
Timer m_missionTimer
 
Timer m_incursionTimer
 
Timer m_deadspaceTimer
 
bool m_ratEnabled
 
bool m_initalized
 
uint16 m_groupTimerSetTime
 
uint32 m_spawnID
 
RatBubbleVec m_bubbles
 
SpawnEntryDef m_spawns
 
RatSpawningVec m_ratSpawns
 
RatSpawnGroupVec m_toSpawn
 
RatSpawnClassVec m_ratSpawnClass
 
RatFactionGroupsMap m_factionGroups
 

SpawnMgr.cpp

NPC Spawn management system for EVEmu

: Allan

Date
: 15 July 2015
 SpawnMgr (SystemManager *mgr, PyServiceMgr &svc)
 
bool Init ()
 
void Process ()
 
void WarpOutSpawn (NPC *pNPC, SystemBubble *pBubble)
 
void MoveSpawn (NPC *pNPC, SystemBubble *pBubble)
 
std::string GetSpawnClassName (int8 sClass)
 
std::string GetSpawnGroupName (int8 sGroup)
 
bool DoSpawnForBubble (SystemBubble *pBubble)
 
void DoSpawnForAnomaly (SystemBubble *pBubble, uint8 spawnClass)
 
void DoSpawnForMission (SystemBubble *pBubble, uint32 regionID)
 
void DoSpawnForIncursion (SystemBubble *pBubble, uint32 regionID)
 
bool IsChaining (uint16 bubbleID)
 
void SpawnKilled (SystemBubble *pBubble, uint32 itemID)
 
void StartRatTimer ()
 
void StartRatGroupTimer ()
 
bool FindSpawnForBubble (uint16 bubbleID)
 
bool PrepSpawn (SystemBubble *pBubble, uint8 sClass=Spawn::Class::None, uint8 level=0)
 
void MakeSpawn (SystemBubble *pBubble, uint32 factionID, uint8 sClass, uint8 level, bool anomaly=false)
 
void ReSpawn (SystemBubble *pBubble, SpawnEntry &spawnEntry)
 
void RemoveSpawn (uint16 bubbleID, uint32 itemID)
 
uint8 GetSpawnGroup (uint8 sClass)
 
uint16 GetRandTypeID (uint8 sClass)
 

Detailed Description

Definition at line 25 of file SpawnMgr.h.

Member Typedef Documentation

typedef std::vector<SystemBubble*> SpawnMgr::RatBubbleVec
protected

Definition at line 75 of file SpawnMgr.h.

typedef std::map<uint8, uint16> SpawnMgr::RatFactionGroupsMap
protected

Definition at line 79 of file SpawnMgr.h.

typedef std::vector<RatFactionGroups> SpawnMgr::RatFactionGroupsVec
protected

Definition at line 78 of file SpawnMgr.h.

typedef std::vector<RatSpawnClass> SpawnMgr::RatSpawnClassVec
protected

Definition at line 77 of file SpawnMgr.h.

typedef std::vector<SpawnGroup> SpawnMgr::RatSpawnGroupVec
protected

Definition at line 76 of file SpawnMgr.h.

typedef std::vector<NPC*> SpawnMgr::RatSpawningVec
protected

Definition at line 74 of file SpawnMgr.h.

typedef std::multimap<uint16, SpawnEntry> SpawnMgr::SpawnEntryDef
protected

Definition at line 80 of file SpawnMgr.h.

Constructor & Destructor Documentation

SpawnMgr::SpawnMgr ( SystemManager mgr,
PyServiceMgr svc 
)
Todo:
this can be updated to spawn mission, anomaly and deadspace rats. change all roidRat to somethingelse to better explain/describe the maps and how they're used. add objects for mission, anomaly and deadspace rats as needed to aid in tracking/deleting.

add booleans for checking roam/static spawns and add anomaly checks to enable spawn mgr.

Todo:
this class needs a bit more tweaking to work as designed...may/may not spawn all types correctly at this time.

Definition at line 40 of file SpawnMgr.cpp.

References m_bubbles, m_factionGroups, m_initalized, m_ratEnabled, m_ratSpawnClass, m_ratSpawns, m_spawnID, m_spawns, and m_toSpawn.

41 : m_system(mgr),
42  m_services(svc),
43  m_ratTimer(0),
44  m_ratGroupTimer(0),
45  m_missionTimer(0),
48 {
49  m_spawnID = 1;
50 
51  m_ratEnabled = false;
52  m_initalized = false;
53 
54  m_spawns.clear();
55  m_bubbles.clear();
56  m_toSpawn.clear();
57  m_ratSpawns.clear();
58  m_ratSpawnClass.clear(); // not used
59  m_factionGroups.clear();
60 }
Timer m_deadspaceTimer
Definition: SpawnMgr.h:92
bool m_ratEnabled
Definition: SpawnMgr.h:94
RatBubbleVec m_bubbles
Definition: SpawnMgr.h:101
uint32 m_spawnID
Definition: SpawnMgr.h:99
Timer m_ratGroupTimer
Definition: SpawnMgr.h:89
SystemManager * m_system
Definition: SpawnMgr.h:84
Timer m_ratTimer
Definition: SpawnMgr.h:88
RatSpawnClassVec m_ratSpawnClass
Definition: SpawnMgr.h:105
RatFactionGroupsMap m_factionGroups
Definition: SpawnMgr.h:107
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
Timer m_missionTimer
Definition: SpawnMgr.h:90
bool m_initalized
Definition: SpawnMgr.h:95
PyServiceMgr & m_services
Definition: SpawnMgr.h:85
RatSpawnGroupVec m_toSpawn
Definition: SpawnMgr.h:104
RatSpawningVec m_ratSpawns
Definition: SpawnMgr.h:103
Timer m_incursionTimer
Definition: SpawnMgr.h:91
SpawnMgr::~SpawnMgr ( )
inline

Definition at line 29 of file SpawnMgr.h.

29 { /* nothing do to yet */ }

Member Function Documentation

void SpawnMgr::DoSpawnForAnomaly ( SystemBubble pBubble,
uint8  spawnClass 
)

Definition at line 309 of file SpawnMgr.cpp.

References PrepSpawn(), and SystemBubble::SetAnomaly().

Referenced by DungeonMgr::Create().

310 {
311  if (pBubble == nullptr)
312  return;
313  pBubble->SetAnomaly();
314  PrepSpawn(pBubble, spawnClass);
315 }
bool PrepSpawn(SystemBubble *pBubble, uint8 sClass=Spawn::Class::None, uint8 level=0)
Definition: SpawnMgr.cpp:376
void SetAnomaly(bool set=true)
Definition: SystemBubble.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

bool SpawnMgr::DoSpawnForBubble ( SystemBubble pBubble)

Definition at line 344 of file SpawnMgr.cpp.

References _log, FindSpawnForBubble(), SystemBubble::GetID(), GetTimeUSeconds(), SystemManager::IncGateSpawnCount(), SystemManager::IncRatSpawnCount(), SystemBubble::IsBelt(), SystemBubble::IsGate(), m_ratEnabled, m_system, PrepSpawn(), sConfig, SystemBubble::SetSpawned(), Profile::spawn, and sProfiler.

Referenced by SystemManager::DoSpawnForBubble().

345 {
346  if (!m_ratEnabled)
347  return false;
348  if (pBubble == nullptr)
349  return false;
350  double profileStartTime = GetTimeUSeconds();
351 
352  if (FindSpawnForBubble(pBubble->GetID())) {
353  _log(SPAWN__TRACE, "SpawnMgr::FindSpawnForBubble() returned true for bubble %u.", pBubble->GetID());
354  pBubble->SetSpawned(true); // bubble flag to avoid multiple spawns in same bubble.
355  return false;
356  } else {
357  if (PrepSpawn(pBubble)) {
358  pBubble->SetSpawned(true); // bubble flag to avoid multiple spawns in same bubble.
359  } else {
360  _log(SPAWN__TRACE, "SpawnMgr::PrepSpawn() returned false for bubble %u.", pBubble->GetID());
361  return false;
362  }
363  }
364 
365  if (pBubble->IsBelt())
367  if (pBubble->IsGate())
369 
370  /* this will throw off the accuracy of the profile, as this and SpawnMgr::Process() use the same data container */
371  if (sConfig.debug.UseProfiling)
372  sProfiler.AddTime(Profile::spawn, GetTimeUSeconds() - profileStartTime);
373  return true;
374 }
#define sConfig
A macro for easier access to the singleton.
bool IsBelt()
Definition: SystemBubble.h:64
bool m_ratEnabled
Definition: SpawnMgr.h:94
#define _log(type, fmt,...)
Definition: logsys.h:124
void IncRatSpawnCount()
Definition: SystemManager.h:96
#define sProfiler
Definition: dbcore.cpp:39
bool PrepSpawn(SystemBubble *pBubble, uint8 sClass=Spawn::Class::None, uint8 level=0)
Definition: SpawnMgr.cpp:376
double GetTimeUSeconds()
Definition: utils_time.cpp:116
SystemManager * m_system
Definition: SpawnMgr.h:84
uint16 GetID()
Definition: SystemBubble.h:91
bool FindSpawnForBubble(uint16 bubbleID)
Definition: SpawnMgr.cpp:811
bool IsGate()
Definition: SystemBubble.h:65
void IncGateSpawnCount()
Definition: SystemManager.h:98
void SetSpawned(bool set=true)
Definition: SystemBubble.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

void SpawnMgr::DoSpawnForIncursion ( SystemBubble pBubble,
uint32  regionID 
)

Definition at line 317 of file SpawnMgr.cpp.

References IsRegionID, and SystemBubble::SetIncursion().

318 {
319  if (pBubble == nullptr)
320  return;
321  if (!IsRegionID(regionID))
322  return;
323  pBubble->SetIncursion();
324  // unknown parameters at this time
325 }
void SetIncursion(bool set=true)
Definition: SystemBubble.h:74
#define IsRegionID(itemID)
Definition: EVE_Defines.h:273

Here is the call graph for this function:

void SpawnMgr::DoSpawnForMission ( SystemBubble pBubble,
uint32  regionID 
)

Definition at line 327 of file SpawnMgr.cpp.

References IsRegionID, and SystemBubble::SetMission().

328 {
329  if (pBubble == nullptr)
330  return;
331  if (!IsRegionID(regionID))
332  return;
333  pBubble->SetMission();
334  // unknown parameters at this time
335 
336  /* this needs to deal with multiple things.
337  * 1- npc types per template
338  * 2- faction per template
339  * 3- waves per template.
340  * 4- more/others?
341  */
342 }
void SetMission(bool set=true)
Definition: SystemBubble.h:73
#define IsRegionID(itemID)
Definition: EVE_Defines.h:273

Here is the call graph for this function:

bool SpawnMgr::FindSpawnForBubble ( uint16  bubbleID)
protected

Definition at line 811 of file SpawnMgr.cpp.

References m_spawns.

Referenced by DoSpawnForBubble().

811  {
812  if (m_spawns.find(bubbleID) != m_spawns.end())
813  return true;
814 
815  return false;
816 }
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102

Here is the caller graph for this function:

uint16 SpawnMgr::GetRandTypeID ( uint8  sClass)
protected

Definition at line 818 of file SpawnMgr.cpp.

References m_factionGroups, and sDataMgr.

Referenced by PrepSpawn().

819 {
820  uint16 groupID = 0;
821  RatFactionGroupsMap::iterator itr = m_factionGroups.find(sClass);
822  if (itr != m_factionGroups.end())
823  groupID = itr->second;
824  return sDataMgr.GetRandRatType(sClass, groupID);
825 }
RatFactionGroupsMap m_factionGroups
Definition: SpawnMgr.h:107
unsigned __int16 uint16
Definition: eve-compat.h:48
#define sDataMgr

Here is the caller graph for this function:

std::string SpawnMgr::GetSpawnClassName ( int8  sClass)

Definition at line 952 of file SpawnMgr.cpp.

References Spawn::Class::Annex, Spawn::Class::Assembly, Spawn::Class::Average, Spawn::Class::Base, Spawn::Class::Burrow, Spawn::Class::Center, Spawn::Class::ChemicalYard, Spawn::Class::Cluster, Spawn::Class::Collection, Spawn::Class::Commander, Spawn::Class::Complex, Spawn::Class::Crazy, Spawn::Class::Crumbling, Spawn::Class::Decayed, Spawn::Class::Den, Spawn::Class::DesolateSite, Spawn::Class::DirtySite, Spawn::Class::Easy, Spawn::Class::Fair, Spawn::Class::Fortress, Spawn::Class::Gathering, Spawn::Class::Hard, Spawn::Class::Hauler, Spawn::Class::HauntedYard, Spawn::Class::Haven, Spawn::Class::Herd, Spawn::Class::Hideaway, Spawn::Class::Hideout, Spawn::Class::Hierarchy, Spawn::Class::Horde, Spawn::Class::Hub, Spawn::Class::Independence, Spawn::Class::Insane, Spawn::Class::Lookout, Spawn::Class::Looted, Spawn::Class::Mainframe, Spawn::Class::Medium, Spawn::Class::Menagerie, Spawn::Class::None, Spawn::Class::Officer, Spawn::Class::Outpost, Spawn::Class::Patrol, Spawn::Class::Port, Spawn::Class::Pristine, Spawn::Class::Radiance, Spawn::Class::RallyPoint, Spawn::Class::Ransacked, Spawn::Class::Refuge, Spawn::Class::Ruined, Spawn::Class::Ruins, Spawn::Class::Sanctum, Spawn::Class::Server, Spawn::Class::Shard, Spawn::Class::Squad, Spawn::Class::StagingPoint, Spawn::Class::Surveillance, Spawn::Class::Tower, Spawn::Class::TrialYard, Spawn::Class::Vigil, Spawn::Class::Watch, and Spawn::Class::Yard.

Referenced by MakeSpawn(), and PrepSpawn().

953 {
954  switch(sClass) {
955  case Spawn::Class::None: return "None";
956  case Spawn::Class::Easy: return "Easy";
957  case Spawn::Class::Fair: return "Fair";
958  case Spawn::Class::Average: return "Average";
959  case Spawn::Class::Medium: return "Medium";
960  case Spawn::Class::Hard: return "Hard";
961  case Spawn::Class::Crazy: return "Crazy";
962  case Spawn::Class::Insane: return "Insane";
963  case Spawn::Class::Hauler: return "Hauler";
964  case Spawn::Class::Commander: return "Commander";
965  case Spawn::Class::Officer: return "Officer";
966  case Spawn::Class::Hideaway: return "Hideaway";
967  case Spawn::Class::Burrow: return "Burrow";
968  case Spawn::Class::Refuge: return "Refuge";
969  case Spawn::Class::Den: return "Den";
970  case Spawn::Class::Yard: return "Yard";
971  case Spawn::Class::RallyPoint: return "RallyPoint";
972  case Spawn::Class::Port: return "Port";
973  case Spawn::Class::Hub: return "Hub";
974  case Spawn::Class::Haven: return "Haven";
975  case Spawn::Class::Sanctum: return "Sanctum";
976  case Spawn::Class::Cluster: return "Cluster";
977  case Spawn::Class::Collection: return "Collection";
978  case Spawn::Class::Assembly: return "Assembly";
979  case Spawn::Class::Gathering: return "Gathering";
980  case Spawn::Class::Surveillance: return "Surveillance";
981  case Spawn::Class::Menagerie: return "Menagerie";
982  case Spawn::Class::Herd: return "Herd";
983  case Spawn::Class::Squad: return "Squad";
984  case Spawn::Class::Patrol: return "Patrol";
985  case Spawn::Class::Horde: return "Horde";
986  case Spawn::Class::Hideout: return "Hideout";
987  case Spawn::Class::Lookout: return "Lookout";
988  case Spawn::Class::Watch: return "Watch";
989  case Spawn::Class::Vigil: return "Vigil";
990  case Spawn::Class::Outpost: return "Outpost";
991  case Spawn::Class::Annex: return "Annex";
992  case Spawn::Class::Base: return "Base";
993  case Spawn::Class::Fortress: return "Fortress";
994  case Spawn::Class::Complex: return "Complex";
995  case Spawn::Class::StagingPoint: return "StagingPoint";
996  case Spawn::Class::HauntedYard: return "HauntedYard";
997  case Spawn::Class::DesolateSite: return "DesolateSite";
998  case Spawn::Class::ChemicalYard: return "ChemicalYard";
999  case Spawn::Class::TrialYard: return "TrialYard";
1000  case Spawn::Class::DirtySite: return "DirtySite";
1001  case Spawn::Class::Ruins: return "Ruins";
1002  case Spawn::Class::Independence: return "Independence";
1003  case Spawn::Class::Radiance: return "Radiance";
1004  case Spawn::Class::Hierarchy: return "Hierarchy";
1005  case Spawn::Class::Crumbling: return "Crumbling";
1006  case Spawn::Class::Decayed: return "Decayed";
1007  case Spawn::Class::Ruined: return "Ruined";
1008  case Spawn::Class::Looted: return "Looted";
1009  case Spawn::Class::Ransacked: return "Ransacked";
1010  case Spawn::Class::Pristine: return "Pristine";
1011  case Spawn::Class::Shard: return "Shard";
1012  case Spawn::Class::Tower: return "Tower";
1013  case Spawn::Class::Mainframe: return "Mainframe";
1014  case Spawn::Class::Center: return "Center";
1015  case Spawn::Class::Server: return "Server";
1016  default: return "Invalid";
1017  }
1018  return "Undefined";
1019 }

Here is the caller graph for this function:

uint8 SpawnMgr::GetSpawnGroup ( uint8  sClass)
protected

Definition at line 858 of file SpawnMgr.cpp.

References Spawn::Class::Annex, Spawn::Group::Anomaly, Spawn::Class::Assembly, Spawn::Class::Average, Spawn::Class::Base, Spawn::Class::Burrow, Spawn::Class::Center, Spawn::Class::ChemicalYard, Spawn::Class::Cluster, Spawn::Class::Collection, Spawn::Group::Combat, Spawn::Class::Commander, Spawn::Class::Complex, Spawn::Class::Crazy, Spawn::Class::Crumbling, Spawn::Group::Deadspace, Spawn::Class::Decayed, Spawn::Class::Den, Spawn::Class::DesolateSite, Spawn::Class::DirtySite, Spawn::Class::Easy, Spawn::Class::Extra, Spawn::Class::Fair, Spawn::Class::Fortress, Spawn::Class::Gathering, Spawn::Class::Hard, Spawn::Class::Hauler, Spawn::Class::HauntedYard, Spawn::Class::Haven, Spawn::Class::Hell, Spawn::Class::Herd, Spawn::Class::Hideaway, Spawn::Class::Hideout, Spawn::Class::Hierarchy, Spawn::Class::Horde, Spawn::Class::Hub, Spawn::Class::Independence, Spawn::Class::Insane, Spawn::Class::Lookout, Spawn::Class::Looted, Spawn::Class::Mainframe, Spawn::Class::Medium, Spawn::Class::Menagerie, Spawn::Class::None, Spawn::Group::None, Spawn::Class::Officer, Spawn::Class::Outpost, Spawn::Class::Patrol, Spawn::Class::Port, Spawn::Class::Pristine, Spawn::Class::Radiance, Spawn::Class::RallyPoint, Spawn::Class::Ransacked, Spawn::Class::Refuge, Spawn::Group::Roaming, Spawn::Class::Ruined, Spawn::Class::Ruins, Spawn::Class::Sanctum, Spawn::Class::Server, Spawn::Class::Shard, Spawn::Class::Squad, Spawn::Class::StagingPoint, Spawn::Class::Surveillance, Spawn::Class::Tower, Spawn::Class::TrialYard, Spawn::Class::Vigil, Spawn::Class::Watch, and Spawn::Class::Yard.

Referenced by MakeSpawn().

859 {
860  switch (sClass) {
861  case Spawn::Class::Extra: // placeholder - not used yet
862  case Spawn::Class::None:
863  return Spawn::Group::None;
864  case Spawn::Class::Easy:
865  case Spawn::Class::Fair:
868  case Spawn::Class::Hard:
869  case Spawn::Class::Crazy:
871  case Spawn::Class::Hell:
875  return Spawn::Group::Roaming;
879  case Spawn::Class::Den:
880  case Spawn::Class::Yard:
882  case Spawn::Class::Port:
883  case Spawn::Class::Hub:
884  case Spawn::Class::Haven:
892  case Spawn::Class::Herd:
893  case Spawn::Class::Squad:
895  case Spawn::Class::Horde:
896  return Spawn::Group::Anomaly;
899  case Spawn::Class::Watch:
900  case Spawn::Class::Vigil:
902  case Spawn::Class::Annex:
903  case Spawn::Class::Base:
912  case Spawn::Class::Ruins:
916  return Spawn::Group::Combat;
923  case Spawn::Class::Shard:
924  case Spawn::Class::Tower:
929  }
930  // default
931  return Spawn::Group::None;
932 }

Here is the caller graph for this function:

std::string SpawnMgr::GetSpawnGroupName ( int8  sGroup)

Definition at line 934 of file SpawnMgr.cpp.

References Spawn::Group::Anomaly, Spawn::Group::Combat, Spawn::Group::Deadspace, Spawn::Group::Escalation, Spawn::Group::Incursion, Spawn::Group::Mission, Spawn::Group::None, Spawn::Group::Roaming, Spawn::Group::Sleeper, and Spawn::Group::Static.

Referenced by MakeSpawn().

935 {
936  switch(sGroup) {
937  case Spawn::Group::None: return "None";
938  case Spawn::Group::Roaming: return "Roaming";
939  case Spawn::Group::Static: return "Static";
940  case Spawn::Group::Anomaly: return "Anomaly";
941  case Spawn::Group::Combat: return "Combat";
942  case Spawn::Group::Deadspace: return "Deadspace";
943  case Spawn::Group::Mission: return "Mission";
944  case Spawn::Group::Incursion: return "Incursion";
945  case Spawn::Group::Sleeper: return "Sleeper";
946  case Spawn::Group::Escalation: return "Escalation";
947  default: return "Invalid";
948  }
949  return "Undefined";
950 }

Here is the caller graph for this function:

bool SpawnMgr::Init ( )

Definition at line 62 of file SpawnMgr.cpp.

References _log, SystemManager::BeltCount(), SystemManager::GetID(), SystemManager::GetName(), m_groupTimerSetTime, m_initalized, m_ratEnabled, m_system, and sConfig.

Referenced by SystemManager::LoadCosmicMgrs().

63 {
64  // even if belt spawns arent activated, still allow anomaly spawnining
65  m_initalized = true;
66 
67  if (!sConfig.npc.RoamingSpawns and !sConfig.npc.StaticSpawns) {
68  _log(COSMIC_MGR__MESSAGE, "Belt Spawns Disabled while Initializing SpawnMgr for %s(%u) - config option off.", m_system->GetName(), m_system->GetID());
69  return true;
70  }
71 
72  if (m_system->BeltCount() < 1) {
73  _log(COSMIC_MGR__MESSAGE, "Belt Spawns Disabled while Initializing SpawnMgr for %s(%u) - no belts.", m_system->GetName(), m_system->GetID());
74  return true;
75  }
76 
77  m_ratEnabled = true;
78  m_groupTimerSetTime = 150; // (in seconds) 2.5m default check time. this will allow a max wait time of 7.5m for respawn
79 
80  _log(COSMIC_MGR__MESSAGE, "SpawnMgr Fully Initialized for %s(%u)", m_system->GetName(), m_system->GetID());
81  return m_initalized;
82 }
#define sConfig
A macro for easier access to the singleton.
bool m_ratEnabled
Definition: SpawnMgr.h:94
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetID() const
Definition: SystemManager.h:80
SystemManager * m_system
Definition: SpawnMgr.h:84
uint16 m_groupTimerSetTime
Definition: SpawnMgr.h:97
const char * GetName() const
Definition: SystemManager.h:84
bool m_initalized
Definition: SpawnMgr.h:95
uint8 BeltCount()

Here is the call graph for this function:

Here is the caller graph for this function:

bool SpawnMgr::IsChaining ( uint16  bubbleID)

Definition at line 827 of file SpawnMgr.cpp.

References m_spawns.

Referenced by NPCAIMgr::Process().

828 {
829  bool rsp = false;
830  auto range = m_spawns.equal_range(bubbleID);
831  auto itr = range.first;
832  while (itr != range.second) {
833  if (itr->second.enabled);
834  rsp = true;
835  ++itr;
836  }
837 
838  return rsp;
839 }
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102

Here is the caller graph for this function:

bool SpawnMgr::IsInitialized ( )
inline

Definition at line 59 of file SpawnMgr.h.

References m_initalized.

Referenced by SystemManager::DoSpawnForBubble().

59 { return m_initalized; }
bool m_initalized
Definition: SpawnMgr.h:95

Here is the caller graph for this function:

bool SpawnMgr::IsRatSpawnEnabled ( )
inline

Definition at line 58 of file SpawnMgr.h.

References m_ratEnabled.

58 { return m_ratEnabled; }
bool m_ratEnabled
Definition: SpawnMgr.h:94
bool SpawnMgr::IsRatTimerStarted ( )
inline

Definition at line 60 of file SpawnMgr.h.

References Timer::Enabled(), and m_ratTimer.

60 { return m_ratTimer.Enabled(); }
bool Enabled() const
Definition: timer.h:41
Timer m_ratTimer
Definition: SpawnMgr.h:88

Here is the call graph for this function:

void SpawnMgr::MakeSpawn ( SystemBubble pBubble,
uint32  factionID,
uint8  sClass,
uint8  level,
bool  anomaly = false 
)
protected
Todo:
make method to get/use template positioning data for spawns here

Definition at line 655 of file SpawnMgr.cpp.

References _log, SystemManager::AddNPC(), FactionData::allianceID, SpawnEntry::corpID, FactionData::corporationID, SpawnEntry::enabled, SpawnEntry::factionID, FactionData::factionID, factionRogueDrones, flagNone, RefPtr< X >::get(), SystemBubble::GetCenter(), SystemManager::GetID(), SystemBubble::GetID(), SystemManager::GetName(), GetSpawnClassName(), GetSpawnGroup(), GetSpawnGroupName(), ItemType::groupID(), SpawnEntry::groupID, InventoryItem::itemID(), SpawnEntry::itemID, SpawnEntry::level, m_bubbles, m_ratSpawns, m_services, m_spawnID, m_spawns, m_system, m_toSpawn, MakeRandomInt(), GPoint::MakeRandomPointOnSphere(), Dungeon::Event::Msg::NPC, SpawnEntry::number, Spawn::Class::Officer, FactionData::ownerID, sDataMgr, sEntityList, sItemFactory, SpawnEntry::spawnClass, SpawnEntry::spawnGroup, SpawnEntry::spawnID, SpawnEntry::stamp, SpawnEntry::total, InventoryItem::type(), and SpawnEntry::typeID.

Referenced by PrepSpawn(), and SpawnKilled().

656 {
657  _log(SPAWN__MESSAGE, "SpawnMgr::MakeSpawn() - Creating spawn class %s for %s in bubbleID %u (anomaly = %s).", \
658  GetSpawnClassName(sClass).c_str(), sDataMgr.GetFactionName(factionID).c_str(), pBubble->GetID(), anomaly?"true":"false");
659 
660  /* the point here is to have all belt rats spawn outside their belt's bubble.
661  * to make it 'realistic', they will need the appearance of warping in from some random point,
662  * to somewhere around bubble center. this will make their origin appear elsewhere,
663  * but not from same place every time. they're pirates, they got other shit to do, too.
664  * eventually, when other systems are working, npcs will appear to 'warp in' from a hideout in the current system.
665  * this particular bit is not general knowledge and will have to be thought out a bit more before coding.
666  *
667  * for non-rat spawns, this is the intial spawn which and they will already be in pocket.
668  * waves will be spawned at structure (template positioning data), OR will warp in if no structure in pocket
669  */
670  GPoint startPos(pBubble->GetCenter());
671  GPoint warpToPoint(startPos);
672 
673  std::string name = "BeltRat";
674  if (anomaly) {
675  name = GetSpawnClassName(sClass);
676  } else {
678  // ratspawn will warp in, others will not.
679  startPos.MakeRandomPointOnSphere(MakeRandomInt(10, 15) *100000); //1-1m5 km from current bubble center
680  }
681 
682  uint32 corpID = sDataMgr.GetFactionCorp(factionID);
683  FactionData data = FactionData();
684  data.allianceID = factionID; // this is to set wreck salvage correctly (tests for faction)
685  data.corporationID = corpID;
686  data.factionID = (factionID == factionRogueDrones ? 0 : factionID); // the faction of rogue drones is wrong....should be "0" for client to use it right.
687  data.ownerID = corpID;
688 
689  NPC* pNPC(nullptr);
690  InventoryItemRef iRef(nullptr);
691  for (auto cur : m_toSpawn) {
692  /*
693  * ItemData( uint32 _typeID, uint32 _ownerID, uint32 _locationID, EVEItemFlags _flag, const char *_name = "",
694  * const GPoint &_position = NULL_ORIGIN, const char *_customInfo = "", bool _contraband = false);
695  */
696  ItemData idata(cur.typeID, corpID, m_system->GetID(), flagNone, "", startPos, name.c_str());
697  for (uint8 x=0; x < cur.quantity; ++x) {
698  iRef = sItemFactory.SpawnItem(idata);
699  if (iRef.get() == nullptr) {
700  _log(SPAWN__ERROR, "Failed to spawn item type %u.", cur.typeID);
701  continue;
702  }
703 
704  _log(SPAWN__POP, "SpawnMgr::MakeSpawn - Spawning NPC type %u (%u)", cur.typeID, iRef->itemID());
705 
706  pNPC = new NPC(iRef, m_services, m_system, data, this);
707  if (pNPC == nullptr)
708  continue;
709 
710  if (!pNPC->Load()) {
711  _log(SPAWN__ERROR, "Failed to load NPC data for NPC %u with type %u, depoping.", pNPC->GetID(), pNPC->GetSelf()->typeID());
712  pNPC->Delete();
713  continue;
714  }
715 
716  m_system->AddNPC(pNPC);
717 
718  pNPC->DestinyMgr()->SetPosition(startPos);
719  // begin warp. this may have to be looked into later for timing of large spawns (>6)
720  // actually looks kinda cool when larger ships come in later...
721  if (sClass <= Spawn::Class::Officer) { // ratspawn will warp in, others will not.
722  // adjust warpIn point so show some variation instead of a straight line.
723  GPoint warpTo(warpToPoint);
724  warpTo.MakeRandomPointOnSphere(sClass *1000); // random point <class (1-12)> x 1k from center
725  pNPC->DestinyMgr()->WarpTo(warpTo, (MakeRandomInt(-5, 10) *1000));
726  }
727 
728  SpawnEntry se = SpawnEntry();
729  se.enabled = false;
730  se.groupID = iRef->type().groupID();
731  se.itemID = iRef->itemID();
732  se.total = cur.quantity;
733  se.number = x+1;
734  se.typeID = cur.typeID;
735  se.spawnID = m_spawnID;
736  se.corpID = corpID;
737  se.factionID = factionID;
738  se.spawnClass = sClass;
739  se.spawnGroup = GetSpawnGroup(sClass);
740  se.level = level;
741  if (sClass <= Spawn::Class::Officer) { // this spawn is for rat.
742  se.stamp = 0; // this is for respawn time...do not set here.
743  } else {
744  se.stamp = sEntityList.GetStamp(); // set time of this spawn for ??
745  }
746  m_spawns.emplace(pBubble->GetID(), se);
747  _log(SPAWN__TRACE, "MakeSpawn() adding SpawnEntry with ID %u to m_spawns. Class: %s, Group:%s, Level: %u.", \
748  se.spawnID, GetSpawnClassName(se.spawnClass).c_str(), GetSpawnGroupName(se.spawnGroup).c_str(), level);
749  }
750  }
751 
752  ++m_spawnID;
753  m_bubbles.push_back(pBubble);
754 
755  //cleanup
756  m_toSpawn.clear();
757  m_ratSpawns.clear();
758 
759  _log(SPAWN__TRACE, "MakeSpawn() completed in %s(%u) with %u bubbles in m_bubbles and %u entities in m_spawns.", \
760  m_system->GetName(), m_system->GetID(), m_bubbles.size(), m_spawns.size());
761 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 spawnID
RatBubbleVec m_bubbles
Definition: SpawnMgr.h:101
uint32 m_spawnID
Definition: SpawnMgr.h:99
#define sEntityList
Definition: EntityList.h:208
uint32 GetID() const
Definition: SystemManager.h:80
Definition: gpoint.h:33
SystemManager * m_system
Definition: SpawnMgr.h:84
uint16 GetID()
Definition: SystemBubble.h:91
Definition: NPC.h:41
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 corporationID
uint8 spawnClass
void AddNPC(NPC *pNPC)
std::string GetSpawnGroupName(int8 sGroup)
Definition: SpawnMgr.cpp:934
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
const char * GetName() const
Definition: SystemManager.h:84
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
std::string GetSpawnClassName(int8 sClass)
Definition: SpawnMgr.cpp:952
uint32 factionID
uint8 spawnGroup
#define sItemFactory
Definition: ItemFactory.h:165
uint8 GetSpawnGroup(uint8 sClass)
Definition: SpawnMgr.cpp:858
PyServiceMgr & m_services
Definition: SpawnMgr.h:85
uint16 groupID
RatSpawnGroupVec m_toSpawn
Definition: SpawnMgr.h:104
GPoint GetCenter()
Definition: SystemBubble.h:93
RatSpawningVec m_ratSpawns
Definition: SpawnMgr.h:103
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void SpawnMgr::MoveSpawn ( NPC pNPC,
SystemBubble pBubble 
)

Definition at line 141 of file SpawnMgr.cpp.

References _log, SystemBubble::CountNPCs(), SystemBubble::GetID(), SystemEntity::GetID(), SystemEntity::GetName(), m_spawns, SystemBubble::SetSpawned(), and SystemEntity::SysBubble().

Referenced by NPCAIMgr::WarpOut().

142 {
143  if (pNPC == nullptr)
144  return;
145  if (pBubble == nullptr)
146  return;
147  uint32 npcID = pNPC->GetID();
148  _log(SPAWN__TRACE, "MoveSpawn() called by %s(%u) from bubbleID %u to bubbleID %u", pNPC->GetName(), npcID, pNPC->SysBubble()->GetID(), pBubble->GetID() );
149 
150  // get npc spawn data and add to new location
151  auto range = m_spawns.equal_range(pNPC->SysBubble()->GetID());
152  auto itr = range.first;
153  while (itr != range.second) {
154  if (itr->second.itemID == npcID) {
155  m_spawns.emplace(pBubble->GetID(), itr->second);
156  m_spawns.erase(itr);
157  break;
158  }
159  ++itr;
160  }
161 
162  //find out if any rats remain before setting bubble spawned to false
163  if (pNPC->SysBubble()->CountNPCs() < 2)
164  pNPC->SysBubble()->SetSpawned(false);
165  // this will NOT count as new bubble being spawned.
166  //pBubble->SetSpawned(true);
167 }
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
uint16 GetID()
Definition: SystemBubble.h:91
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 CountNPCs()
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
void SetSpawned(bool set=true)
Definition: SystemBubble.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

bool SpawnMgr::PrepSpawn ( SystemBubble pBubble,
uint8  sClass = Spawn::Class::None,
uint8  level = 0 
)
protected
Todo:
test for overseer wave and spawn correct overseer for this anomaly
Todo:
make templates/functions/whatever for sending msgs to players local for waves

Definition at line 376 of file SpawnMgr.cpp.

References _log, Spawn::Class::Average, Spawn::Class::BeltSpawn, Spawn::Class::Commander, Spawn::Class::Crazy, Spawn::Class::Easy, factionRogueDrones, Spawn::Class::Fair, GetRandTypeID(), SystemManager::GetRegionID(), SystemManager::GetSecValue(), GetSpawnClassName(), Spawn::Class::Hard, Spawn::Class::Hauler, Spawn::Class::Hell, Spawn::Class::Insane, is_log_enabled, SystemBubble::IsBelt(), SystemBubble::IsGate(), m_factionGroups, m_system, m_toSpawn, MakeRandomFloat(), MakeRandomInt(), MakeSpawn(), Spawn::Class::Medium, Spawn::Class::None, Spawn::Class::Officer, SpawnGroup::quantity, sConfig, sDataMgr, and SpawnGroup::typeID.

Referenced by DoSpawnForAnomaly(), and DoSpawnForBubble().

377 {
378  if (pBubble == nullptr)
379  return false;
380  float secRating = m_system->GetSecValue();
381  bool anomaly = false;
382  // get faction for this region
383  uint32 factionID = factionRogueDrones; // default to rogue drones. this is my internal rogue drone factionID.
384  if (sConfig.npc.RatFaction) { // is RatFaction set in config?
385  factionID = sConfig.npc.RatFaction;
386  } else if (MakeRandomFloat() > 0.05) { // 5% chance for ANY spawn to be rogue drone.
387  factionID = sDataMgr.GetRegionRatFaction(m_system->GetRegionID());
388  }
389 
390  if (is_log_enabled(SPAWN__MESSAGE))
391  _log(SPAWN__MESSAGE, "SpawnMgr::PrepSpawn() - faction: %s, region %u. (config set %s)", \
392  sDataMgr.GetFactionName(factionID).c_str(), m_system->GetRegionID(), (sConfig.npc.RatFaction?"true":"false"));
393 
394  // if rat, get possible spawn groups for this secRating.
395  if (sClass == Spawn::Class::None) {
396  if ((secRating < 0.2) and pBubble->IsBelt()) { // check for hauler, commander, officer spawn, but ONLY in a belt
397  //NOTE random checks here are for TESTING only....all rates are high. make config option later?
398  double rand = MakeRandomFloat();
399  if (rand < 0.1) { // officer spawn
400  if (factionID != factionRogueDrones) { //but not for drones. they dont have officers..make this the rare drone hauler spawn (which isnt written yet)
401  sClass = Spawn::Class::Officer;
402  } else {
403  sClass = Spawn::Class::Hauler;
404  }
405  } else if (rand < 0.15) { // commander spawn
406  sClass = Spawn::Class::Commander;
407  } else if (rand < 0.25) { // hauler spawn
408  if (factionID != factionRogueDrones)
409  sClass = Spawn::Class::Hauler;
410  }
411  }
412  } else {
413  // we were called from anomaly, incursion or mission to spawn npcs
414  anomaly = true;
415  }
416 
417  if (sClass == Spawn::Class::None) {
418  if (pBubble->IsBelt()) {
419  if ((factionID != factionRogueDrones) and (MakeRandomFloat() < 0.08)) { // second chance for hauler spawn, but include ALL secRating in this one
420  sClass = Spawn::Class::Hauler;
421  } else { // gonna be a 'regular' trusec-based spawn in a belt.
422  if (secRating < -0.7) {
423  sClass = Spawn::Class::Insane;
424  } else if (secRating < -0.4) {
425  sClass = Spawn::Class::Crazy;
426  } else if (secRating < -0.1) {
427  sClass = Spawn::Class::Hard;
428  } else if (secRating < 0.3) {
429  sClass = Spawn::Class::Medium;
430  } else if (secRating < 0.6) {
431  sClass = Spawn::Class::Average;
432  } else if (secRating < 0.85) {
433  sClass = Spawn::Class::Fair;
434  } else {
435  sClass = Spawn::Class::Easy;
436  }
437  }
438  if ((secRating < 0) and (sClass < Spawn::Class::Hauler))
439  if (MakeRandomFloat() < 0.1)
440  sClass = Spawn::Class::Hell;
441  } else if (pBubble->IsGate()) { // gate spawns are smaller/easier than roid spawns
442  if (secRating < -0.7) {
443  sClass = Spawn::Class::Hard;
444  } else if (secRating < -0.4) {
445  sClass = Spawn::Class::Medium;
446  } else if (secRating < -0.1) {
447  sClass = Spawn::Class::Average;
448  } else if (secRating < 0.3) {
449  sClass = Spawn::Class::Fair;
450  } else {
451  sClass = Spawn::Class::Easy;
452  }
453  } else {
454  // make error here?
455  }
456  }
457 
458  // get faction's shipClass and groupID map...is this feasible? it's fine...there's only 21 at this time.
459  if (sDataMgr.GetNPCGroups(factionID, m_factionGroups)) {
460  if (is_log_enabled(SPAWN__MESSAGE))
461  _log(SPAWN__MESSAGE, "SpawnMgr::PrepSpawn() - m_factionGroups size is %u.", m_factionGroups.size()); //should be 21 (22 for drones)
462  } else {
463  _log(SPAWN__ERROR, "SpawnMgr::PrepSpawn() - No RatFaction data for faction %u. Cancelling spawn.", factionID);
464  return false;
465  }
466 
467  RatSpawnClassVec spawnEntry;
468  if (sDataMgr.GetNPCClasses(sClass, spawnEntry)) {
469  if (is_log_enabled(SPAWN__MESSAGE))
470  _log(SPAWN__MESSAGE, "SpawnMgr::PrepSpawn() - spawnEntry - size: %u, class: %s(%u).", spawnEntry.size(), GetSpawnClassName(sClass).c_str(), sClass);
471  } else {
472  _log(SPAWN__ERROR, "SpawnMgr::PrepSpawn() - No NPC Class data for %u (%s). Cancelling spawn.", sClass, GetSpawnClassName(sClass).c_str());
473  return false;
474  }
475 
476  if (anomaly) {
477  // anomaly, incursion or mission
478  ++level; // increment wave
479  // check wave # vs possible waves. (oob check)
480  if (spawnEntry.size() < level) {
481  _log(SPAWN__ERROR, "SpawnMgr::PrepSpawn() - spawnEntry.size (%u) < level (%u) for anomaly class %s. Cancelling spawn.", spawnEntry.size(), level, GetSpawnClassName(sClass).c_str());
482  return false;
483  }
486  } else if (sClass == Spawn::Class::Hauler) {
487  // split hauler spawns based on trusec
488  if (secRating < -0.8) { level = MakeRandomInt(4, 7); }
489  else if (secRating < -0.5) { level = MakeRandomInt(3, 6); }
490  else if (secRating < -0.2) { level = MakeRandomInt(2, 5); }
491  else if (secRating < 0.1) { level = MakeRandomInt(1, 4); }
492  else if (secRating < 0.4) { level = MakeRandomInt(1, 3); }
493  else if (secRating < 0.7) { level = 2; }
494  else { level = 1; }
495  } else if (sClass <= Spawn::Class::Hell) {
496  level = MakeRandomInt(0, spawnEntry.size()); // random belt/gate spawn type.
497  } else {
498  // do we need anything else here?
499  }
500 
501  // get ship class data from spawnEntry.at(subtype)
502  // and put this spawn's group information in class designators
503  uint8 f = spawnEntry.at(level).f;
504  uint8 af = spawnEntry.at(level).af;
505  uint8 d = spawnEntry.at(level).d;
506  uint8 c = spawnEntry.at(level).c;
507  uint8 ac = spawnEntry.at(level).ac;
508  uint8 bc = spawnEntry.at(level).bc;
509  uint8 bs = spawnEntry.at(level).bs;
510  uint8 h = spawnEntry.at(level).h;
511  uint8 o = spawnEntry.at(level).o;
512  uint8 cf = spawnEntry.at(level).cf;
513  uint8 cd = spawnEntry.at(level).cd;
514  uint8 cc = spawnEntry.at(level).cc;
515  uint8 cbc = spawnEntry.at(level).cbc;
516  uint8 cbs = spawnEntry.at(level).cbs;
517  spawnEntry.clear();
518 
519  // get typeIDs to spawn based on info in m_factionGroups and ship designators and put into Spawn Vector
520  // figure out how to distuinguish between roid, anomaly, incursion and mission defs for this....
521  uint8 shipClass = 0;
522  if (sClass > Spawn::Class::BeltSpawn)
523  shipClass = 14;
524  SpawnGroup toSpawn = SpawnGroup();
525  // these types are for ALL spawn types.
526  if (f > 0) {
527  toSpawn.typeID = GetRandTypeID(1 + shipClass);
528  toSpawn.quantity = f;
529  m_toSpawn.push_back(toSpawn);
530  }
531  if (af > 0) {
532  toSpawn.typeID = GetRandTypeID(2 + shipClass);
533  toSpawn.quantity = af;
534  m_toSpawn.push_back(toSpawn);
535  }
536  if (d > 0) {
537  toSpawn.typeID = GetRandTypeID(3 + shipClass);
538  toSpawn.quantity = d;
539  m_toSpawn.push_back(toSpawn);
540  }
541  if (c > 0) {
542  toSpawn.typeID = GetRandTypeID(4 + shipClass);
543  toSpawn.quantity = c;
544  m_toSpawn.push_back(toSpawn);
545  }
546  if (ac > 0) {
547  toSpawn.typeID = GetRandTypeID(5 + shipClass);
548  toSpawn.quantity = ac;
549  m_toSpawn.push_back(toSpawn);
550  }
551  if (bc > 0) {
552  toSpawn.typeID = GetRandTypeID(6 + shipClass);
553  toSpawn.quantity = bc;
554  m_toSpawn.push_back(toSpawn);
555  }
556  if (bs > 0) {
557  toSpawn.typeID = GetRandTypeID(7 + shipClass);
558  toSpawn.quantity = bs;
559  m_toSpawn.push_back(toSpawn);
560  }
561  // end of possible non-roid rat types. following are for belt/gate only
562  if (sClass < Spawn::Class::BeltSpawn) {
563  if (h > 0) {
564  toSpawn.typeID = GetRandTypeID(8);
565  toSpawn.quantity = h;
566  m_toSpawn.push_back(toSpawn);
567  }
568  if ((o > 0) and (factionID != factionRogueDrones)) { //drones do NOT have officers (internal type 9).
569  toSpawn.typeID = GetRandTypeID(9);
570  toSpawn.quantity = o;
571  m_toSpawn.push_back(toSpawn);
572  }
573  if (cf > 0) {
574  toSpawn.typeID = GetRandTypeID(10);
575  toSpawn.quantity = cf;
576  m_toSpawn.push_back(toSpawn);
577  }
578  if (cd > 0) {
579  toSpawn.typeID = GetRandTypeID(11);
580  toSpawn.quantity = cd;
581  m_toSpawn.push_back(toSpawn);
582  }
583  if (cc > 0) {
584  toSpawn.typeID = GetRandTypeID(12);
585  toSpawn.quantity = cc;
586  m_toSpawn.push_back(toSpawn);
587  }
588  if (cbc > 0) {
589  toSpawn.typeID = GetRandTypeID(13);
590  toSpawn.quantity = cbc;
591  m_toSpawn.push_back(toSpawn);
592  }
593  if (cbs > 0) {
594  toSpawn.typeID = GetRandTypeID(14);
595  toSpawn.quantity = cbs;
596  m_toSpawn.push_back(toSpawn);
597  }
598  }
599 
600  if (factionID == factionRogueDrones) {
601  if ((bc > 0) or (bs > 0)) {
602  if (sClass < Spawn::Class::BeltSpawn) {
603  toSpawn.typeID = GetRandTypeID(9);
604  } else if (sClass > Spawn::Class::BeltSpawn) {
605  toSpawn.typeID = GetRandTypeID(22);
606  }
607  // spawn 4 swarm ships for each bc/bs
608  toSpawn.quantity = ((bs > 0 ? bs : bc) *4);
609  m_toSpawn.push_back(toSpawn);
610  } else if (o > 0) {
611  // drones dont have officers. spawn swarm x10
612  if (sClass < Spawn::Class::BeltSpawn) {
613  toSpawn.typeID = GetRandTypeID(9);
614  } else if (sClass > Spawn::Class::BeltSpawn) {
615  toSpawn.typeID = GetRandTypeID(22);
616  }
617  toSpawn.quantity = o *10;
618  m_toSpawn.push_back(toSpawn);
619  }
620  }
621 
622  //cleanup
623  m_factionGroups.clear();
624 
625  if (m_toSpawn.size() > 0) {
626  if (is_log_enabled(SPAWN__MESSAGE))
627  _log(SPAWN__MESSAGE, "SpawnMgr::PrepSpawn() - toSpawn size is %u.", m_toSpawn.size()); //variable
628  MakeSpawn(pBubble, factionID, sClass, level, anomaly);
629  return true;
630  } else {
631  _log(SPAWN__ERROR, "SpawnMgr::PrepSpawn() - Nothing to spawn.");
632  }
633 
634  return false;
635 }
#define sConfig
A macro for easier access to the singleton.
unsigned __int8 uint8
Definition: eve-compat.h:46
bool IsBelt()
Definition: SystemBubble.h:64
#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
std::vector< RatSpawnClass > RatSpawnClassVec
Definition: SpawnMgr.h:77
void MakeSpawn(SystemBubble *pBubble, uint32 factionID, uint8 sClass, uint8 level, bool anomaly=false)
Definition: SpawnMgr.cpp:655
#define is_log_enabled(type)
Definition: logsys.h:78
SystemManager * m_system
Definition: SpawnMgr.h:84
float GetSecValue()
unsigned __int32 uint32
Definition: eve-compat.h:50
RatFactionGroupsMap m_factionGroups
Definition: SpawnMgr.h:107
bool IsGate()
Definition: SystemBubble.h:65
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
std::string GetSpawnClassName(int8 sClass)
Definition: SpawnMgr.cpp:952
uint32 GetRegionID()
Definition: SystemManager.h:81
uint16 GetRandTypeID(uint8 sClass)
Definition: SpawnMgr.cpp:818
RatSpawnGroupVec m_toSpawn
Definition: SpawnMgr.h:104
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void SpawnMgr::Process ( )

Definition at line 85 of file SpawnMgr.cpp.

References _log, Timer::Check(), Timer::Disable(), Timer::Enabled(), SystemManager::GetID(), SystemManager::GetName(), GetTimeUSeconds(), m_initalized, m_ratEnabled, m_ratGroupTimer, m_spawns, m_system, ReSpawn(), sBubbleMgr, sConfig, sEntityList, Profile::spawn, and sProfiler.

Referenced by SystemManager::ProcessTic().

85  {
86  if (!m_initalized)
87  return;
88  if (!m_ratEnabled)
89  return;
90 
91  double profileStartTime = GetTimeUSeconds();
92  // called by SystemManager::Process() for each system. this will need to be fast.
93  // check timers and call approprate functions as needed.
94 
95  // will have to think about this one a bit to implement properly (and quickly)
96  /* current implentation uses a single timer for entire system
97  * timer goes off, do the following...
98  * loop thru all spawned bubbles in system
99  * spawn rats as needed to fill spawn groups
100  * kill timer after all spawns are full
101  * this should be a single check for each iteration. if multiple rats are killed, timer remains counting down from initial setting.
102  * if all rats are respawned, then a rat is killed again (in this system), the timer is reset and the system begins again.
103  * each time the group timer is hit, it will check for missing rats in each spawn group. if there is a missing rat, that rat is
104  * respawned and the timer is reset, to check again. this *should* enable chain-ratting.
105  *
106  * this will need work for correct operation as intended.
107  * process should look at all SpawnEntryDefs for each bubble, and spawn according to number/total for that bubble's spawnID
108  * right now, that number isnt updated when rats are killed. will have to work on coding that correctly
109  */
110  if (m_ratGroupTimer.Enabled())
111  if (m_ratGroupTimer.Check()) {
112  bool killTimer = true;
113  SpawnEntryDef::iterator itr = m_spawns.begin(), end = m_spawns.end();
114  while (itr != end) {
115  if (itr->second.enabled) {
116  killTimer = false;
117  if (itr->second.stamp < sEntityList.GetStamp()) {
118  ++itr;
119  continue;
120  }
121  _log(SPAWN__TRACE, "Process() calling Respawn for SpawnEntryID %u (0x%X)", \
122  itr->second.spawnID, &itr->second);
123  // this means check SpawnEntry for 'missing' SpawnGroup members and respawn as needed.
124  ReSpawn(sBubbleMgr.FindBubbleByID(itr->first), itr->second);
125  itr->second.enabled = false;
126  }
127  ++itr;
128  }
129 
130  if (killTimer) {
132  _log(SPAWN__MESSAGE, "SpawnMgr::Process() - Rat Spawn Groups full (or no spawns) for %s(%u). RatGroup Timer disabled.", \
133  m_system->GetName(), m_system->GetID());
134  }
135  }
136 
137  if (sConfig.debug.UseProfiling)
138  sProfiler.AddTime(Profile::spawn, GetTimeUSeconds() - profileStartTime);
139 }
#define sConfig
A macro for easier access to the singleton.
bool m_ratEnabled
Definition: SpawnMgr.h:94
#define _log(type, fmt,...)
Definition: logsys.h:124
void Disable()
Definition: timer.h:39
#define sProfiler
Definition: dbcore.cpp:39
#define sEntityList
Definition: EntityList.h:208
uint32 GetID() const
Definition: SystemManager.h:80
Timer m_ratGroupTimer
Definition: SpawnMgr.h:89
double GetTimeUSeconds()
Definition: utils_time.cpp:116
SystemManager * m_system
Definition: SpawnMgr.h:84
bool Enabled() const
Definition: timer.h:41
bool Check(bool reset=true)
Definition: timer.cpp:62
void ReSpawn(SystemBubble *pBubble, SpawnEntry &spawnEntry)
Definition: SpawnMgr.cpp:763
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
const char * GetName() const
Definition: SystemManager.h:84
bool m_initalized
Definition: SpawnMgr.h:95
#define sBubbleMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void SpawnMgr::RemoveSpawn ( uint16  bubbleID,
uint32  itemID 
)
protected

Definition at line 841 of file SpawnMgr.cpp.

References _log, and m_spawns.

Referenced by SpawnKilled().

842 {
843  auto range = m_spawns.equal_range(bubbleID);
844  auto itr = range.first;
845  while (itr != range.second) {
846  if (itr->second.itemID == itemID) {
847  _log(SPAWN__TRACE, "RemoveSpawn() found item %u in spawnID %u and removed it.", itemID, itr->second.spawnID);
848  m_spawns.erase(itr);
849  return;
850  }
851  ++itr;
852  }
853 
854  _log(SPAWN__TRACE, "RemoveSpawn() did not find item %u in bubble %u, out of %u total spawns in the map.", itemID, bubbleID, m_spawns.size());
855  return;
856 }
#define _log(type, fmt,...)
Definition: logsys.h:124
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
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

Here is the caller graph for this function:

void SpawnMgr::ReSpawn ( SystemBubble pBubble,
SpawnEntry spawnEntry 
)
protected

Definition at line 763 of file SpawnMgr.cpp.

References _log, SystemManager::AddNPC(), SpawnEntry::corpID, SystemEntity::DestinyMgr(), SpawnEntry::enabled, SpawnEntry::factionID, flagNone, SystemBubble::GetCenter(), SystemManager::GetID(), SystemBubble::GetID(), SystemEntity::GetID(), SystemEntity::GetSelf(), Spawn::Class::Insane, NPC::Load(), m_services, m_system, MakeRandomInt(), Dungeon::Event::Msg::NPC, SpawnEntry::number, SafeDelete(), sItemFactory, SpawnEntry::spawnClass, SpawnEntry::spawnID, SpawnEntry::stamp, SpawnEntry::total, InventoryItem::typeID(), SpawnEntry::typeID, and DestinyManager::WarpTo().

Referenced by Process().

764 {
765  // we are NOT enabling spawn chaining for officer, hauler, or commander spawns.
766  if (spawnEntry.spawnClass > Spawn::Class::Insane)
767  return;
768  GPoint startPos(pBubble->GetCenter());
769  GPoint warpToPoint(startPos);
770  startPos.MakeRandomPointOnSphere(MakeRandomInt(10, 15) *100000); //1-1m5 km from bubble center
771  _log(SPAWN__TRACE, "ReSpawn() data for spawnEntryID %u 0x%X is type:%u, corp:%u, faction:%u, #:%u of %u", \
772  spawnEntry.spawnID, &spawnEntry, spawnEntry.typeID, spawnEntry.corpID, \
773  spawnEntry.factionID, spawnEntry.number, spawnEntry.total);
774  /* ItemData( uint32 _typeID, uint32 _ownerID, uint32 _locationID, EVEItemFlags _flag, const char *_name = "",
775  * const GPoint &_position = NULL_ORIGIN, const char *_customInfo = "", bool _contraband = false);
776  */
777  ItemData idata(spawnEntry.typeID, spawnEntry.corpID, m_system->GetID(), flagNone, "", startPos, "BeltRat");
778  InventoryItemRef iRef = sItemFactory.SpawnItem(idata); // will have to work on this to NOT save npc to db.
779  if (iRef.get() == nullptr) {
780  _log(SPAWN__ERROR, "Failed to spawn item type %u.", spawnEntry.typeID);
781  return;
782  }
783 
784  _log(SPAWN__POP, "SpawnMgr::ReSpawn - Spawning NPC %s(%u)", iRef->name(), iRef->itemID());
785 
786  FactionData data = FactionData();
787  data.allianceID = spawnEntry.factionID; // this is to set wreck salvage correctly (tests for faction)
788  data.corporationID = spawnEntry.corpID;
789  data.factionID = spawnEntry.factionID;
790  data.ownerID = spawnEntry.corpID;
791  NPC* pNPC = new NPC(iRef, m_services, m_system, data, this);
792  if (pNPC == nullptr) {
793  _log(SPAWN__ERROR, "Failed to create NPC SE for item type %u.", spawnEntry.typeID);
794  return;
795  }
796 
797  if (!pNPC->Load()) {
798  _log(SPAWN__ERROR, "Failed to load NPC data for NPC %u with type %u, depoping.", pNPC->GetID(), pNPC->GetSelf()->typeID());
799  SafeDelete(pNPC);
800  return;
801  }
802 
803  m_system->AddNPC(pNPC);
804  pNPC->DestinyMgr()->WarpTo(warpToPoint, (MakeRandomInt(-5, 10) *1000));
805 
806  spawnEntry.stamp = 0;
807  spawnEntry.enabled = false;
808  _log(SPAWN__TRACE, "ReSpawn() completed for spawnEntryID %u 0x%X in bubble %u.", spawnEntry.spawnID, &spawnEntry, pBubble->GetID());
809 }
#define _log(type, fmt,...)
Definition: logsys.h:124
virtual bool Load()
Definition: NPC.cpp:86
uint16 spawnID
uint32 GetID() const
Definition: SystemManager.h:80
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
Definition: gpoint.h:33
DestinyManager * DestinyMgr()
Definition: SystemEntity.h:198
SystemManager * m_system
Definition: SpawnMgr.h:84
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
uint16 GetID()
Definition: SystemBubble.h:91
uint32 GetID()
Definition: SystemEntity.h:207
Definition: NPC.h:41
uint8 spawnClass
void AddNPC(NPC *pNPC)
void WarpTo(const GPoint &where, int32 distance=0, bool autoPilot=false, SystemEntity *pSE=nullptr)
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
uint32 factionID
#define sItemFactory
Definition: ItemFactory.h:165
PyServiceMgr & m_services
Definition: SpawnMgr.h:85
uint16 typeID() const
GPoint GetCenter()
Definition: SystemBubble.h:93

Here is the call graph for this function:

Here is the caller graph for this function:

void SpawnMgr::SetDungMgr ( DungeonMgr pDmgr)
inline

Definition at line 34 of file SpawnMgr.h.

References m_dungMgr.

Referenced by DungeonMgr::Init().

34 { m_dungMgr = pDmgr; }
DungeonMgr * m_dungMgr
Definition: SpawnMgr.h:86

Here is the caller graph for this function:

void SpawnMgr::SpawnKilled ( SystemBubble pBubble,
uint32  itemID 
)

Definition at line 229 of file SpawnMgr.cpp.

References _log, SystemBubble::CountNPCs(), SystemBubble::GetID(), SystemBubble::IsAnomaly(), SystemBubble::IsBelt(), SystemBubble::IsGate(), SystemBubble::IsIncursion(), SystemBubble::IsMission(), itemID(), m_bubbles, m_spawns, m_system, MakeSpawn(), RemoveSpawn(), SystemManager::RemoveSpawnBubble(), SystemBubble::ResetBubbleRatSpawn(), sConfig, sEntityList, SystemBubble::SetSpawned(), and StartRatGroupTimer().

Referenced by NPC::Killed().

230 {
231  if (pBubble == nullptr)
232  return;
233  if (pBubble->IsBelt()) {
234  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled::Belt - called by %u.", itemID);
235  // if any SpawnEntry still exists for this bubble, reset group timer.
236  // this enables chain ratting
237  bool killed = true;
238  auto range = m_spawns.equal_range(pBubble->GetID());
239  auto itr = range.first;
240  while (itr != range.second) {
241  if (itr->second.itemID == itemID) {
242  itr->second.stamp = sEntityList.GetStamp() + sConfig.npc.RespawnTimer; // in seconds
243  itr->second.enabled = true;
244  }
245  if (!itr->second.enabled)
246  killed = false; // at least one rat left.
247  ++itr;
248  }
249  if (killed) {
250  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled - Belt Spawn has been destoyed. Resetting spawn checks for bubble %u.", pBubble->GetID());
251  // spawn destroyed. delete from list and reset bubble checks.
252  m_spawns.erase(pBubble->GetID()); // just in case....may/may not be in here.
253  m_bubbles.erase(std::find(m_bubbles.begin(), m_bubbles.end(), pBubble));
254  pBubble->ResetBubbleRatSpawn();
255  m_system->RemoveSpawnBubble(pBubble);
256  return;
257  } else {
259  }
260  } else if (pBubble->IsGate()) {
261  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled::Gate - called by %u.", itemID);
262  // we are not enabling rat chaining on gates.
263  RemoveSpawn(pBubble->GetID(), itemID);
264  if (pBubble->CountNPCs() < 2)
265  pBubble->SetSpawned(false);
266  } else if (pBubble->IsAnomaly()) {
267  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled::Anomaly - called by %u.", itemID);
268  if (m_spawns.count(pBubble->GetID()) == 1) {
269  // last npc in this wave. get data needed for next wave, if applicable.
270  SpawnEntryDef::iterator itr = m_spawns.find(pBubble->GetID());
271  if (itr == m_spawns.end())
272  return; // this is an error.
273  MakeSpawn(pBubble, itr->second.factionID, itr->second.spawnClass, itr->second.level);
274  // now remove this spawn from map.
275  m_spawns.erase(itr);
276  // unlock warp gate if applicable
277  } else if (m_spawns.count(pBubble->GetID()) < 1) {
278  // this is an error...
279  } else {
280  // there are still npcs in this wave....continue.
281  }
282 
283  /* this needs to deal with multiple things.
284  * 1- unlocking warp gates when needed per wave
285  * 2- dropping loot according to (wave/dungeon/template)?
286  * 3- after last spawn, possible escelation per dungeon type? this should signal anomaly mgr to create the escelation
287  * 4- spawn next wave, if applicable (code above...currently testing)
288  * 5- more/others?
289  */
290  } else if (pBubble->IsMission()) {
291  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled::Mission - called by %u.", itemID);
292  // placeholder - not coded yet.
293  /* this needs to deal with multiple things.
294  * 1- unlocking warp gates when needed per wave
295  * 2- dropping loot according to (wave/mission/template)?
296  * 3- setting mission completion status
297  * 4- spawn next wave, if applicable
298  * 5- more/others?
299  */
300  } else if (pBubble->IsIncursion()) {
301  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled::Incursion - called by %u.", itemID);
302  // placeholder - not coded yet.
303  } else {
304  _log(SPAWN__DEPOP, "SpawnMgr::SpawnKilled::Other - called by %u.", itemID);
305  RemoveSpawn(pBubble->GetID(), itemID);
306  }
307 }
#define sConfig
A macro for easier access to the singleton.
bool IsBelt()
Definition: SystemBubble.h:64
void StartRatGroupTimer()
Definition: SpawnMgr.cpp:215
#define _log(type, fmt,...)
Definition: logsys.h:124
bool IsMission()
Definition: SystemBubble.h:67
bool IsAnomaly()
Definition: SystemBubble.h:66
void RemoveSpawnBubble(SystemBubble *pBubble)
RatBubbleVec m_bubbles
Definition: SpawnMgr.h:101
#define sEntityList
Definition: EntityList.h:208
bool IsIncursion()
Definition: SystemBubble.h:68
void MakeSpawn(SystemBubble *pBubble, uint32 factionID, uint8 sClass, uint8 level, bool anomaly=false)
Definition: SpawnMgr.cpp:655
SystemManager * m_system
Definition: SpawnMgr.h:84
uint16 GetID()
Definition: SystemBubble.h:91
void ResetBubbleRatSpawn()
void RemoveSpawn(uint16 bubbleID, uint32 itemID)
Definition: SpawnMgr.cpp:841
uint32 CountNPCs()
bool IsGate()
Definition: SystemBubble.h:65
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
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
void SetSpawned(bool set=true)
Definition: SystemBubble.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

void SpawnMgr::StartRatGroupTimer ( )

Definition at line 215 of file SpawnMgr.cpp.

References _log, Timer::Enabled(), SystemManager::GetID(), SystemManager::GetName(), Timer::GetRemainingTime(), is_log_enabled, m_groupTimerSetTime, m_ratGroupTimer, m_system, and Timer::Start().

Referenced by SpawnKilled().

216 {
217  if (m_ratGroupTimer.Enabled()) {
218  if (is_log_enabled(SPAWN__MESSAGE))
219  _log(SPAWN__MESSAGE, "SpawnMgr::StartRatGroupTimer() - Group Spawn Timer currently running. Time left: %us", m_ratGroupTimer.GetRemainingTime() /1000);
220  return;
221  }
223 
224  if (is_log_enabled(SPAWN__MESSAGE))
225  _log(SPAWN__MESSAGE, "SpawnMgr::StartRatGroupTimer() - Group Spawn Timer started for %s(%u) at %us.", \
227 }
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetID() const
Definition: SystemManager.h:80
uint32 GetRemainingTime() const
Definition: timer.cpp:114
Timer m_ratGroupTimer
Definition: SpawnMgr.h:89
#define is_log_enabled(type)
Definition: logsys.h:78
SystemManager * m_system
Definition: SpawnMgr.h:84
bool Enabled() const
Definition: timer.h:41
uint16 m_groupTimerSetTime
Definition: SpawnMgr.h:97
const char * GetName() const
Definition: SystemManager.h:84
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 SpawnMgr::StartRatTimer ( )

Definition at line 201 of file SpawnMgr.cpp.

References _log, Timer::Enabled(), SystemManager::GetID(), SystemManager::GetName(), is_log_enabled, m_ratTimer, m_system, sConfig, and Timer::Start().

202 {
203  if (m_ratTimer.Enabled())
204  return;
205  uint16 time = sConfig.npc.RoamingTimer *1000; // s to ms
206  if (sConfig.debug.SpawnTest)
207  time = 5000; /* 5s for npc spawn testing */
208  m_ratTimer.Start(time);
209 
210  if (is_log_enabled(SPAWN__MESSAGE))
211  _log(SPAWN__MESSAGE, "SpawnMgr::StartRatTimer() - Main Spawn Timer started for %s(%u) at %u ms.", \
212  m_system->GetName(), m_system->GetID(), time);
213 }
#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
#define is_log_enabled(type)
Definition: logsys.h:78
SystemManager * m_system
Definition: SpawnMgr.h:84
bool Enabled() const
Definition: timer.h:41
Timer m_ratTimer
Definition: SpawnMgr.h:88
const char * GetName() const
Definition: SystemManager.h:84
unsigned __int16 uint16
Definition: eve-compat.h:48
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

void SpawnMgr::StopRatGroupTimer ( )
inline

Definition at line 56 of file SpawnMgr.h.

References Timer::Disable(), and m_ratGroupTimer.

void Disable()
Definition: timer.h:39
Timer m_ratGroupTimer
Definition: SpawnMgr.h:89

Here is the call graph for this function:

void SpawnMgr::StopRatTimer ( )
inline

Definition at line 54 of file SpawnMgr.h.

References Timer::Disable(), and m_ratTimer.

54 { m_ratTimer.Disable(); }
void Disable()
Definition: timer.h:39
Timer m_ratTimer
Definition: SpawnMgr.h:88

Here is the call graph for this function:

void SpawnMgr::WarpOutSpawn ( NPC pNPC,
SystemBubble pBubble 
)

Definition at line 169 of file SpawnMgr.cpp.

References _log, SystemEntity::DestinyMgr(), SystemBubble::GetCenter(), SystemBubble::GetID(), SystemEntity::GetID(), SystemEntity::GetName(), SystemManager::GetNPCSE(), m_spawns, m_system, MakeRandomFloat(), SystemBubble::SetSpawned(), SystemEntity::SysBubble(), and DestinyManager::WarpTo().

170 {
171  if (pNPC == nullptr)
172  return;
173  if (pBubble == nullptr)
174  return;
175  _log(SPAWN__TRACE, "WarpOutSpawn() called by %s(%u) from bubbleID %u to bubbleID %u", pNPC->GetName(), pNPC->GetID(), pNPC->SysBubble()->GetID(), pBubble->GetID() );
176  NPC* rNPC(nullptr);
177  auto range = m_spawns.equal_range(pNPC->SysBubble()->GetID());
178  auto itr = range.first;
179  while (itr != range.second) {
180  if (itr->second.enabled) {
181  ++itr;
182  continue;
183  }
184  rNPC = m_system->GetNPCSE(itr->second.itemID);
185  if (rNPC == nullptr) {
186  ++itr;
187  continue;
188  }
189  rNPC->DestinyMgr()->WarpTo(pBubble->GetCenter(), MakeRandomFloat(10, 30) *100);
190  rNPC->GetAIMgr()->DisableWarpOutTimer();
191  m_spawns.emplace(pBubble->GetID(), itr->second);
192  m_spawns.erase(itr);
193  ++itr;
194  }
195 
196  pNPC->SysBubble()->SetSpawned(false);
197  pBubble->SetSpawned(true);
198 }
#define _log(type, fmt,...)
Definition: logsys.h:124
NPC * GetNPCSE(uint32 entityID) const
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114
DestinyManager * DestinyMgr()
Definition: SystemEntity.h:198
SystemManager * m_system
Definition: SpawnMgr.h:84
uint16 GetID()
Definition: SystemBubble.h:91
uint32 GetID()
Definition: SystemEntity.h:207
Definition: NPC.h:41
const char * GetName() const
Definition: SystemEntity.h:210
SpawnEntryDef m_spawns
Definition: SpawnMgr.h:102
void WarpTo(const GPoint &where, int32 distance=0, bool autoPilot=false, SystemEntity *pSE=nullptr)
void SetSpawned(bool set=true)
Definition: SystemBubble.h:75
GPoint GetCenter()
Definition: SystemBubble.h:93

Here is the call graph for this function:

Member Data Documentation

RatBubbleVec SpawnMgr::m_bubbles
private

Definition at line 101 of file SpawnMgr.h.

Referenced by MakeSpawn(), SpawnKilled(), and SpawnMgr().

Timer SpawnMgr::m_deadspaceTimer
private

Definition at line 92 of file SpawnMgr.h.

DungeonMgr* SpawnMgr::m_dungMgr
private

Definition at line 86 of file SpawnMgr.h.

Referenced by SetDungMgr().

RatFactionGroupsMap SpawnMgr::m_factionGroups
private

Definition at line 107 of file SpawnMgr.h.

Referenced by GetRandTypeID(), PrepSpawn(), and SpawnMgr().

uint16 SpawnMgr::m_groupTimerSetTime
private

Definition at line 97 of file SpawnMgr.h.

Referenced by Init(), and StartRatGroupTimer().

Timer SpawnMgr::m_incursionTimer
private

Definition at line 91 of file SpawnMgr.h.

bool SpawnMgr::m_initalized
private

Definition at line 95 of file SpawnMgr.h.

Referenced by Init(), IsInitialized(), Process(), and SpawnMgr().

Timer SpawnMgr::m_missionTimer
private

Definition at line 90 of file SpawnMgr.h.

bool SpawnMgr::m_ratEnabled
private

Definition at line 94 of file SpawnMgr.h.

Referenced by DoSpawnForBubble(), Init(), IsRatSpawnEnabled(), Process(), and SpawnMgr().

Timer SpawnMgr::m_ratGroupTimer
private

Definition at line 89 of file SpawnMgr.h.

Referenced by Process(), StartRatGroupTimer(), and StopRatGroupTimer().

RatSpawnClassVec SpawnMgr::m_ratSpawnClass
private

Definition at line 105 of file SpawnMgr.h.

Referenced by SpawnMgr().

RatSpawningVec SpawnMgr::m_ratSpawns
private

Definition at line 103 of file SpawnMgr.h.

Referenced by MakeSpawn(), and SpawnMgr().

Timer SpawnMgr::m_ratTimer
private

Definition at line 88 of file SpawnMgr.h.

Referenced by IsRatTimerStarted(), StartRatTimer(), and StopRatTimer().

PyServiceMgr& SpawnMgr::m_services
private

Definition at line 85 of file SpawnMgr.h.

Referenced by MakeSpawn(), and ReSpawn().

uint32 SpawnMgr::m_spawnID
private

Definition at line 99 of file SpawnMgr.h.

Referenced by MakeSpawn(), and SpawnMgr().

SpawnEntryDef SpawnMgr::m_spawns
private
RatSpawnGroupVec SpawnMgr::m_toSpawn
private

Definition at line 104 of file SpawnMgr.h.

Referenced by MakeSpawn(), PrepSpawn(), and SpawnMgr().


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