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

#include "ItemFactory.h"

Inheritance diagram for ItemFactory:
Collaboration diagram for ItemFactory:

Public Member Functions

 ItemFactory ()
 
 ~ItemFactory ()
 
void Close ()
 
int Initialize ()
 
uint32 Count ()
 
void SaveItems ()
 
void RemoveItem (uint32 itemID)
 
void SetUsingClient (Client *pClient)
 
void UnsetUsingClient ()
 
void AddItem (InventoryItemRef iRef)
 
InventoryDBdb ()
 
ClientGetUsingClient ()
 
InventoryGetInventoryFromId (uint32 itemID, bool load=true)
 
InventoryGetItemContainerInventory (uint32 itemID, bool load=true)
 
const ItemTypeGetType (uint16 typeID)
 
const StationTypeGetStationType (uint16 stationTypeID)
 
const CharacterTypeGetCharacterType (uint16 characterTypeID)
 
const BlueprintTypeGetBlueprintType (uint16 blueprintTypeID)
 
const CharacterTypeGetCharacterTypeByBloodline (uint16 bloodlineID)
 
SkillRef GetSkill (uint32 skillID)
 
ShipItemRef GetShip (uint32 shipID)
 
StationItemRef GetStationItem (uint32 stationID)
 
BlueprintRef GetBlueprint (uint32 blueprintID)
 
CharacterRef GetCharacter (uint32 characterID)
 
ModuleItemRef GetModuleItem (uint32 moduleID)
 
SolarSystemRef GetSolarSystem (uint32 solarSystemID)
 
AsteroidItemRef GetAsteroid (uint32 asteroidID)
 
StructureItemRef GetStructure (uint32 structureID)
 
StationOfficeRef GetOffice (uint32 officeID)
 
InventoryItemRef GetItem (uint32 itemID)
 
InventoryItemRef GetItemContainer (uint32 itemID, bool load=true)
 
InventoryItemRef GetInventoryItemFromID (uint32 itemID, bool load=true)
 
CargoContainerRef GetCargoContainer (uint32 containerID)
 
WreckContainerRef GetWreckContainer (uint32 containerID)
 
CelestialObjectRef GetCelestialObject (uint32 celestialID)
 
ProbeItemRef GetProbeItem (uint32 probeID)
 
SkillRef SpawnSkill (ItemData &data)
 
ShipItemRef SpawnShip (ItemData &data)
 
CharacterRef SpawnCharacter (CharacterData &charData, CorpData &corpData)
 
ModuleItemRef SpawnModule (ItemData &data)
 
InventoryItemRef SpawnItem (ItemData &data)
 
InventoryItemRef SpawnTempItem (ItemData &data)
 
StationOfficeRef SpawnOffice (ItemData &idata, OfficeData &odata)
 
AsteroidItemRef SpawnAsteroid (ItemData &idata, AsteroidData &adata)
 
StructureItemRef SpawnStructure (ItemData &data)
 
CargoContainerRef SpawnCargoContainer (ItemData &data)
 
WreckContainerRef SpawnWreckContainer (ItemData &data)
 
ProbeItemRef SpawnProbe (ItemData &data)
 
uint32 GetNextNPCID ()
 
uint32 GetNextTempID ()
 
uint32 GetNextDroneID ()
 
uint32 GetNextMissileID ()
 
- Public Member Functions inherited from Singleton< ItemFactory >
 Singleton ()
 Primary constructor. More...
 

Protected Member Functions

template<class _Ty >
const _Ty * _GetType (uint16 typeID)
 
template<class _Ty >
RefPtr< _Ty > _GetItem (uint32 itemID)
 

Protected Attributes

InventoryDBm_db
 
Clientm_pClient
 
std::map< uint16, ItemType * > m_types
 
std::map< uint32,
InventoryItemRef
m_items
 
std::map< uint32,
InventoryItemRef
m_staticItems
 
std::map< uint32,
InventoryItemRef
m_dynamicItems
 

Private Attributes

uint32 m_nextNPCID
 
uint32 m_nextTempID
 
uint32 m_nextDroneID
 
uint32 m_nextMissileID
 

Additional Inherited Members

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

Detailed Description

Definition at line 54 of file ItemFactory.h.

Constructor & Destructor Documentation

ItemFactory::ItemFactory ( )

Definition at line 48 of file ItemFactory.cpp.

49 :m_pClient(nullptr),
50 m_nextTempID(0),
51 m_nextNPCID(0),
52 m_nextDroneID(0),
54 m_db(nullptr)
55 {
56 }
uint32 m_nextMissileID
Definition: ItemFactory.h:160
uint32 m_nextNPCID
Definition: ItemFactory.h:157
uint32 m_nextDroneID
Definition: ItemFactory.h:159
Client * m_pClient
Definition: ItemFactory.h:141
InventoryDB * m_db
Definition: ItemFactory.h:140
uint32 m_nextTempID
Definition: ItemFactory.h:158
ItemFactory::~ItemFactory ( )

Definition at line 58 of file ItemFactory.cpp.

References m_db, and SafeDelete().

59 {
61 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
InventoryDB * m_db
Definition: ItemFactory.h:140

Here is the call graph for this function:

Member Function Documentation

template<class _Ty >
RefPtr< _Ty > ItemFactory::_GetItem ( uint32  itemID)
protected

Definition at line 288 of file ItemFactory.cpp.

References _log, item(), m_items, minAgent, and RefPtr< X >::StaticCast().

289 {
290  std::map<uint32, InventoryItemRef>::iterator itr = m_items.find(itemID);
291  if (itr == m_items.end()) {
292  if (itemID < minAgent) {
293  _log(ITEM__WARNING, "ItemFactory::_GetItem() called on invalid Item %u", itemID);
294  //if (sConfig.debug.StackTrace)
295  // EvE::traceStack();
296  return RefPtr<_Ty>();
297  }
298 
299  // load the item
300  RefPtr<_Ty> item = _Ty::Load(itemID);
301  if (!item)
302  return RefPtr<_Ty>();
303 
304  //we keep the original ref.
305  itr = m_items.insert(std::make_pair(itemID, item)).first;
306  }
307  // return to the user.
308  return RefPtr<_Ty>::StaticCast(itr->second);
309 }
#define _log(type, fmt,...)
Definition: logsys.h:124
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
#define minAgent
Definition: EVE_Defines.h:101
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
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
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

template<class _Ty >
const _Ty * ItemFactory::_GetType ( uint16  typeID)
protected

Definition at line 251 of file ItemFactory.cpp.

References m_types.

251  {
252  std::map<uint16, ItemType*>::iterator itr = m_types.find(typeID);
253  if (itr == m_types.end()) {
254  _Ty* type = _Ty::Load(typeID);
255  if (type == nullptr)
256  return nullptr;
257 
258  // insert into cache
259  itr = m_types.insert(std::make_pair(typeID, type)).first;
260  }
261  return static_cast<const _Ty *>(itr->second);
262 }
std::map< uint16, ItemType * > m_types
Definition: ItemFactory.h:143
void ItemFactory::AddItem ( InventoryItemRef  iRef)

Definition at line 129 of file ItemFactory.cpp.

References IsTempItem, m_items, minAgent, and sLog.

Referenced by SpawnAsteroid(), SpawnCargoContainer(), SpawnItem(), SpawnModule(), SpawnOffice(), SpawnProbe(), SpawnShip(), SpawnSkill(), SpawnStructure(), and SpawnWreckContainer().

130 {
131  if (IsTempItem(iRef->itemID()))
132  return;
133 
134  if (iRef->itemID() < minAgent) {
135  sLog.Warning("ItemFactory::AddItem()", "Trying to Add invalid UID %u for %s", iRef->itemID(), iRef->name());
136  return;
137  }
138  m_items.emplace(iRef->itemID(), iRef);
139 }
const char * name()
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
#define minAgent
Definition: EVE_Defines.h:101
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
#define IsTempItem(itemID)
Definition: EVE_Defines.h:333
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the caller graph for this function:

void ItemFactory::Close ( )

Definition at line 84 of file ItemFactory.cpp.

References m_items, m_pClient, m_types, SafeDelete(), and sLog.

85 {
86  sLog.Warning(" ItemFactory", "%u Items, %u Types still in list", \
87  m_items.size(), m_types.size());
88  // types
89  for (auto cur : m_types)
90  SafeDelete(cur.second);
91  m_types.clear();
92  // items
93  //for (auto cur : m_items)
94  // delete(cur.second.get());
95  m_items.clear();
96  // Set Client pointer to NULL
97  m_pClient = nullptr;
98 }
std::map< uint16, ItemType * > m_types
Definition: ItemFactory.h:143
Client * m_pClient
Definition: ItemFactory.h:141
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144

Here is the call graph for this function:

uint32 ItemFactory::Count ( )
inline

Definition at line 63 of file ItemFactory.h.

References m_items.

63 { return m_items.size(); }
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
InventoryDB* ItemFactory::db ( )
inline

Definition at line 71 of file ItemFactory.h.

References m_db.

71 { return m_db; }
InventoryDB * m_db
Definition: ItemFactory.h:140
AsteroidItemRef ItemFactory::GetAsteroid ( uint32  asteroidID)

Definition at line 351 of file ItemFactory.cpp.

352 {
353  return _GetItem<AsteroidItem>(asteroidID);
354 }
BlueprintRef ItemFactory::GetBlueprint ( uint32  blueprintID)

Definition at line 316 of file ItemFactory.cpp.

317 {
318  return _GetItem<Blueprint>(blueprintID);
319 }
const BlueprintType * ItemFactory::GetBlueprintType ( uint16  blueprintTypeID)

Definition at line 268 of file ItemFactory.cpp.

268  {
269  return _GetType<BlueprintType>(blueprintTypeID);
270 }
CargoContainerRef ItemFactory::GetCargoContainer ( uint32  containerID)

Definition at line 366 of file ItemFactory.cpp.

367 {
368  return _GetItem<CargoContainer>(containerID);
369 }
CelestialObjectRef ItemFactory::GetCelestialObject ( uint32  celestialID)

Definition at line 331 of file ItemFactory.cpp.

332 {
333  return _GetItem<CelestialObject>(celestialID);
334 }
CharacterRef ItemFactory::GetCharacter ( uint32  characterID)

Definition at line 321 of file ItemFactory.cpp.

322 {
323  return _GetItem<Character>(characterID);
324 }
const CharacterType * ItemFactory::GetCharacterType ( uint16  characterTypeID)

Definition at line 272 of file ItemFactory.cpp.

Referenced by GetCharacterTypeByBloodline().

272  {
273  return _GetType<CharacterType>(characterTypeID);
274 }

Here is the caller graph for this function:

const CharacterType * ItemFactory::GetCharacterTypeByBloodline ( uint16  bloodlineID)

Definition at line 276 of file ItemFactory.cpp.

References GetCharacterType(), and InventoryDB::GetCharacterTypeByBloodline().

276  {
277  // Unfortunately, we have it indexed by typeID, so we must get it ...
278  uint16 characterTypeID;
279  if (!InventoryDB::GetCharacterTypeByBloodline(bloodlineID, characterTypeID))
280  return nullptr;
281  return GetCharacterType(characterTypeID);
282 }
static bool GetCharacterTypeByBloodline(uint8 bloodlineID, uint16 &characterTypeID)
Definition: InventoryDB.cpp:91
const CharacterType * GetCharacterType(uint16 characterTypeID)
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Inventory * ItemFactory::GetInventoryFromId ( uint32  itemID,
bool  load = true 
)

Definition at line 171 of file ItemFactory.cpp.

References RefPtr< X >::get(), GetItem(), IsValidLocation, and m_items.

171  {
172  // do we need to check trade containers here?
173  if (!IsValidLocation(itemID))
174  return nullptr;
175 
176  InventoryItemRef iRef(nullptr);
177  std::map<uint32, InventoryItemRef>::iterator itr = m_items.find(itemID);
178  if (itr != m_items.end()) {
179  iRef = itr->second;
180  } else if (load) {
181  iRef = GetItem(itemID);
182  }
183 
184  if (iRef.get() == nullptr)
185  return nullptr;
186 
187  return iRef->GetMyInventory();
188 }
InventoryItemRef GetItem(uint32 itemID)
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
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
#define IsValidLocation(itemID)
Definition: EVE_Defines.h:209

Here is the call graph for this function:

InventoryItemRef ItemFactory::GetInventoryItemFromID ( uint32  itemID,
bool  load = true 
)

Definition at line 190 of file ItemFactory.cpp.

References GetItem(), and m_items.

190  {
191  InventoryItemRef iRef(nullptr);
192  std::map<uint32, InventoryItemRef>::iterator itr = m_items.find(itemID);
193  if (itr != m_items.end()) {
194  iRef = itr->second;
195  } else if (load) {
196  iRef = GetItem(itemID);
197  }
198 
199  return iRef;
200 }
InventoryItemRef GetItem(uint32 itemID)
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
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 call graph for this function:

InventoryItemRef ItemFactory::GetItem ( uint32  itemID)

Definition at line 311 of file ItemFactory.cpp.

References itemID().

Referenced by GetInventoryFromId(), GetInventoryItemFromID(), GetItemContainer(), and GetItemContainerInventory().

312 {
313  return _GetItem<InventoryItem>(itemID);
314 }
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 call graph for this function:

Here is the caller graph for this function:

InventoryItemRef ItemFactory::GetItemContainer ( uint32  itemID,
bool  load = true 
)

Definition at line 202 of file ItemFactory.cpp.

References RefPtr< X >::get(), GetItem(), and m_items.

203 {
204  InventoryItemRef iRef(nullptr);
205  std::map<uint32, InventoryItemRef>::iterator itr = m_items.find(itemID);
206  if (itr != m_items.end()) {
207  iRef = itr->second;
208  itr = m_items.find(iRef->locationID());
209  iRef = itr->second;
210  } else if (load) {
211  iRef = GetItem(itemID);
212  itr = m_items.find(itemID);
213  if (itr != m_items.end()) {
214  iRef = itr->second;
215  itr = m_items.find(iRef->locationID());
216  iRef = itr->second;
217  }
218  }
219 
220  if (iRef.get() == nullptr)
221  return InventoryItemRef(nullptr);
222 
223  return iRef;
224 }
InventoryItemRef GetItem(uint32 itemID)
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
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 call graph for this function:

Inventory * ItemFactory::GetItemContainerInventory ( uint32  itemID,
bool  load = true 
)

Definition at line 226 of file ItemFactory.cpp.

References RefPtr< X >::get(), GetItem(), and m_items.

227 {
228  InventoryItemRef iRef(nullptr);
229  std::map<uint32, InventoryItemRef>::iterator itr = m_items.find(itemID);
230  if (itr != m_items.end()) {
231  iRef = itr->second;
232  itr = m_items.find(iRef->locationID());
233  iRef = itr->second;
234  } else if (load) {
235  iRef = GetItem(itemID);
236  itr = m_items.find(itemID);
237  if (itr != m_items.end()) {
238  iRef = itr->second;
239  itr = m_items.find(iRef->locationID());
240  iRef = itr->second;
241  }
242  }
243 
244  if (iRef.get() == nullptr)
245  return nullptr;
246 
247  return iRef->GetMyInventory();
248 }
InventoryItemRef GetItem(uint32 itemID)
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
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 call graph for this function:

ModuleItemRef ItemFactory::GetModuleItem ( uint32  moduleID)

Definition at line 376 of file ItemFactory.cpp.

377 {
378  return _GetItem<ModuleItem>(moduleID);
379 }
uint32 ItemFactory::GetNextDroneID ( )

Definition at line 162 of file ItemFactory.cpp.

References m_nextDroneID.

162  {
163  return ++m_nextDroneID;
164 }
uint32 m_nextDroneID
Definition: ItemFactory.h:159
uint32 ItemFactory::GetNextMissileID ( )

Definition at line 166 of file ItemFactory.cpp.

References m_nextMissileID.

167 {
168  return ++m_nextMissileID;
169 }
uint32 m_nextMissileID
Definition: ItemFactory.h:160
uint32 ItemFactory::GetNextNPCID ( )
Todo:
add PI item spawners here
Todo:
add Sleeper item spawners here

Definition at line 157 of file ItemFactory.cpp.

References m_nextNPCID.

158 {
159  return ++m_nextNPCID;
160 }
uint32 m_nextNPCID
Definition: ItemFactory.h:157
uint32 ItemFactory::GetNextTempID ( )

Definition at line 146 of file ItemFactory.cpp.

References m_nextTempID, PLANET_PIN_ID, and TEMP_ENTITY_ID.

147 {
148  if (m_nextTempID < PLANET_PIN_ID) {
149  ++m_nextTempID;
150  } else {
152  }
153 
154  return m_nextTempID;
155 }
#define PLANET_PIN_ID
Definition: EVE_Defines.h:179
#define TEMP_ENTITY_ID
Definition: EVE_Defines.h:178
uint32 m_nextTempID
Definition: ItemFactory.h:158
StationOfficeRef ItemFactory::GetOffice ( uint32  officeID)

Definition at line 356 of file ItemFactory.cpp.

357 {
358  return _GetItem<StationOffice>(officeID);
359 }
ProbeItemRef ItemFactory::GetProbeItem ( uint32  probeID)

Definition at line 381 of file ItemFactory.cpp.

381  {
382  return _GetItem<ProbeItem>(probeID);
383 }
ShipItemRef ItemFactory::GetShip ( uint32  shipID)

Definition at line 326 of file ItemFactory.cpp.

327 {
328  return _GetItem<ShipItem>(shipID);
329 }
SkillRef ItemFactory::GetSkill ( uint32  skillID)

Definition at line 346 of file ItemFactory.cpp.

References skillID().

347 {
348  return _GetItem<Skill>(skillID);
349 }
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()()() itemID() itemID Fits selected item to active ship() skillID(level)-gives skillID to specified level." ) COMMAND( online

Here is the call graph for this function:

SolarSystemRef ItemFactory::GetSolarSystem ( uint32  solarSystemID)

Definition at line 336 of file ItemFactory.cpp.

337 {
338  return _GetItem<SolarSystem>(solarSystemID);
339 }
StationItemRef ItemFactory::GetStationItem ( uint32  stationID)

Definition at line 341 of file ItemFactory.cpp.

342 {
343  return _GetItem<StationItem>(stationID);
344 }
const StationType * ItemFactory::GetStationType ( uint16  stationTypeID)

Definition at line 283 of file ItemFactory.cpp.

283  {
284  return _GetType<StationType>(stationTypeID);
285 }
StructureItemRef ItemFactory::GetStructure ( uint32  structureID)

Definition at line 361 of file ItemFactory.cpp.

362 {
363  return _GetItem<StructureItem>(structureID);
364 }
const ItemType * ItemFactory::GetType ( uint16  typeID)

Definition at line 264 of file ItemFactory.cpp.

264  {
265  return _GetType<ItemType>(typeID);
266 }
Client* ItemFactory::GetUsingClient ( )
inline

Definition at line 73 of file ItemFactory.h.

References m_pClient.

73 { return m_pClient; }
Client * m_pClient
Definition: ItemFactory.h:141
WreckContainerRef ItemFactory::GetWreckContainer ( uint32  containerID)

Definition at line 371 of file ItemFactory.cpp.

372 {
373  return _GetItem<WreckContainer>(containerID);
374 }
int ItemFactory::Initialize ( )

Definition at line 63 of file ItemFactory.cpp.

References ManagerDB::DeleteSpawnedRats(), InventoryDB::DeleteTrackingCans(), DRONE_ID, m_db, m_items, m_nextDroneID, m_nextMissileID, m_nextNPCID, m_nextTempID, MISSILE_ID, NPC_ID, sConfig, sLog, and TEMP_ENTITY_ID.

64 {
65  ManagerDB::DeleteSpawnedRats(); // takes ~31.2s to run on main, 0.005s on dev
66 
67  if (sConfig.debug.DeleteTrackingCans)
69 
70  m_items.clear();
71 
72  // Initialize ID Authority variables:
77 
78  m_db = new InventoryDB();
79 
80  sLog.Blue(" ItemFactory", "Item Factory Initialized.");
81  return 1;
82 }
#define sConfig
A macro for easier access to the singleton.
uint32 m_nextMissileID
Definition: ItemFactory.h:160
uint32 m_nextNPCID
Definition: ItemFactory.h:157
uint32 m_nextDroneID
Definition: ItemFactory.h:159
static void DeleteSpawnedRats()
Definition: ManagerDB.cpp:462
#define NPC_ID
Definition: EVE_Defines.h:182
#define DRONE_ID
Definition: EVE_Defines.h:181
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
static void DeleteTrackingCans()
InventoryDB * m_db
Definition: ItemFactory.h:140
#define MISSILE_ID
Definition: EVE_Defines.h:186
#define TEMP_ENTITY_ID
Definition: EVE_Defines.h:178
uint32 m_nextTempID
Definition: ItemFactory.h:158

Here is the call graph for this function:

void ItemFactory::RemoveItem ( uint32  itemID)

Definition at line 141 of file ItemFactory.cpp.

References m_items.

142 {
143  m_items.erase(itemID);
144 }
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
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 ItemFactory::SaveItems ( )

Definition at line 100 of file ItemFactory.cpp.

References Inv::SaveData::contraband, Inv::SaveData::customInfo, InventoryDB::DeleteTrackingCans(), Inv::SaveData::flag, GetTimeMSeconds(), IsPlayerItem, Inv::SaveData::itemID, items, Inv::SaveData::locationID, m_items, Inv::SaveData::ownerID, Inv::SaveData::position, Inv::SaveData::quantity, ItemDB::SaveItems(), sConfig, Inv::SaveData::singleton, sLog, and Inv::SaveData::typeID.

100  {
101  if (sConfig.debug.DeleteTrackingCans)
103  uint32 count(0);
104  double startTime = GetTimeMSeconds();
105  std::vector<Inv::SaveData> items;
106  items.clear();
107  for (auto cur : m_items) {
108  if (IsPlayerItem(cur.first)) { // this is a hack for now. will eventually move to static/dynamic item maps
109  cur.second->SaveAttributes();
110  Inv::SaveData data = Inv::SaveData();
111  data.itemID = cur.first;
112  data.contraband = cur.second->contraband();
113  data.flag = cur.second->flag();
114  data.locationID = cur.second->locationID();
115  data.ownerID = cur.second->ownerID();
116  data.position = cur.second->position();
117  data.quantity = cur.second->quantity();
118  data.singleton = cur.second->isSingleton();
119  data.typeID = cur.second->typeID();
120  data.customInfo = cur.second->customInfo();
121  items.push_back(data);
122  ++count;
123  }
124  }
125  ItemDB::SaveItems(items);
126  sLog.Warning(" SaveItems", "Saved %u Dynamic Items in %.3fms.", count, (GetTimeMSeconds() -startTime));
127 }
#define sConfig
A macro for easier access to the singleton.
static void SaveItems(std::vector< Inv::SaveData > &data)
Definition: ItemDB.cpp:264
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
std::string customInfo
double GetTimeMSeconds()
Definition: utils_time.cpp:104
#define IsPlayerItem(itemID)
Definition: EVE_Defines.h:256
EVEItemFlags flag
Definition: EVE_Inventory.h:97
std::map< uint32, InventoryItemRef > m_items
Definition: ItemFactory.h:144
static void DeleteTrackingCans()
unsigned __int32 uint32
Definition: eve-compat.h:50
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

Here is the call graph for this function:

void ItemFactory::SetUsingClient ( Client pClient)
inline

Definition at line 67 of file ItemFactory.h.

References m_pClient.

67 { m_pClient = pClient; }
Client * m_pClient
Definition: ItemFactory.h:141
AsteroidItemRef ItemFactory::SpawnAsteroid ( ItemData idata,
AsteroidData adata 
)

Definition at line 431 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and AsteroidItem::Spawn().

432 {
433  AsteroidItemRef iRef = AsteroidItem::Spawn(idata, adata);
434  if (iRef.get() != nullptr)
435  AddItem(iRef);
436 
437  return iRef;
438 }
static AsteroidItemRef Spawn(ItemData &idata, AsteroidData &adata)
Definition: Asteroid.cpp:33
X * get() const
Definition: RefPtr.h:213
void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

CargoContainerRef ItemFactory::SpawnCargoContainer ( ItemData data)

Definition at line 449 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and CargoContainer::Spawn().

450 {
452  if (iRef.get() != nullptr)
453  AddItem(iRef);
454 
455  return iRef;
456 }
static CargoContainerRef Spawn(ItemData &data)
Definition: Container.cpp:70
X * get() const
Definition: RefPtr.h:213
void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

CharacterRef ItemFactory::SpawnCharacter ( CharacterData charData,
CorpData corpData 
)

Definition at line 400 of file ItemFactory.cpp.

References Character::Spawn().

400  {
401  CharacterRef iRef = Character::Spawn(charData, corpData);
402  return iRef;
403 }
static CharacterRef Spawn(CharacterData &charData, CorpData &corpData)
Definition: Character.cpp:321

Here is the call graph for this function:

InventoryItemRef ItemFactory::SpawnItem ( ItemData data)

Definition at line 387 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and InventoryItem::Spawn().

387  {
389  if (iRef.get() != nullptr)
390  AddItem(iRef);
391 
392  return iRef;
393 }
X * get() const
Definition: RefPtr.h:213
static InventoryItemRef Spawn(ItemData &data)
void AddItem(InventoryItemRef iRef)

Here is the call graph for this function:

ModuleItemRef ItemFactory::SpawnModule ( ItemData data)

Definition at line 467 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and ModuleItem::Spawn().

468 {
469  ModuleItemRef iRef = ModuleItem::Spawn(data);
470  if (iRef.get() != nullptr)
471  AddItem(iRef);
472 
473  return iRef;
474 }
static ModuleItemRef Spawn(ItemData &data)
Definition: ModuleItem.cpp:27
X * get() const
Definition: RefPtr.h:213
void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

StationOfficeRef ItemFactory::SpawnOffice ( ItemData idata,
OfficeData odata 
)

Definition at line 440 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and StationOffice::Spawn().

441 {
442  StationOfficeRef iRef = StationOffice::Spawn(idata, odata);
443  if (iRef.get() != nullptr)
444  AddItem(iRef);
445 
446  return iRef;
447 }
X * get() const
Definition: RefPtr.h:213
static StationOfficeRef Spawn(ItemData &idata, OfficeData &odata)
void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

ProbeItemRef ItemFactory::SpawnProbe ( ItemData data)

Definition at line 476 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and ProbeItem::Spawn().

477 {
478  ProbeItemRef iRef = ProbeItem::Spawn(data);
479  if (iRef.get() != nullptr)
480  AddItem(iRef);
481 
482  return iRef;
483 }
X * get() const
Definition: RefPtr.h:213
static ProbeItemRef Spawn(ItemData &data)
Definition: Probes.cpp:52
void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

ShipItemRef ItemFactory::SpawnShip ( ItemData data)

Definition at line 405 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and ShipItem::Spawn().

405  {
406  ShipItemRef iRef = ShipItem::Spawn(data);
407  if (iRef.get() != nullptr)
408  AddItem(iRef);
409 
410  return iRef;
411 }
static ShipItemRef Spawn(ItemData &data)
Definition: Ship.cpp:51
X * get() const
Definition: RefPtr.h:213
void AddItem(InventoryItemRef iRef)

Here is the call graph for this function:

SkillRef ItemFactory::SpawnSkill ( ItemData data)

creates new InventoryItem, saves to db, caches it and returns a RefPtr.

Parameters
[in]dataItem data (for entity table).
[in]charDataCharacter data.
[in]corpDataCharacter's corporation-membership data.
Returns
RefPtr to _Ty; NULL if load failed.

Definition at line 413 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and Skill::Spawn().

414 {
415  SkillRef iRef = Skill::Spawn(data);
416  if (iRef.get() != nullptr)
417  AddItem(iRef);
418 
419  return iRef;
420 }
static SkillRef Spawn(ItemData &data)
Definition: Skill.cpp:52
X * get() const
Definition: RefPtr.h:213
void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

StructureItemRef ItemFactory::SpawnStructure ( ItemData data)

Definition at line 422 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and StructureItem::Spawn().

423 {
425  if (iRef.get() != nullptr)
426  AddItem(iRef);
427 
428  return iRef;
429 }
X * get() const
Definition: RefPtr.h:213
void AddItem(InventoryItemRef iRef)
static StructureItemRef Spawn(ItemData &data)
Definition: Structure.cpp:71
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

InventoryItemRef ItemFactory::SpawnTempItem ( ItemData data)

Definition at line 395 of file ItemFactory.cpp.

References InventoryItem::SpawnTemp().

395  {
397  return iRef;
398 }
static InventoryItemRef SpawnTemp(ItemData &data)

Here is the call graph for this function:

WreckContainerRef ItemFactory::SpawnWreckContainer ( ItemData data)

Definition at line 458 of file ItemFactory.cpp.

References AddItem(), RefPtr< X >::get(), and WreckContainer::Spawn().

459 {
461  if (iRef.get() != nullptr)
462  AddItem(iRef);
463 
464  return iRef;
465 }
X * get() const
Definition: RefPtr.h:213
static WreckContainerRef Spawn(ItemData &data)
Definition: Container.cpp:410
void AddItem(InventoryItemRef iRef)

Here is the call graph for this function:

void ItemFactory::UnsetUsingClient ( )
inline

Definition at line 68 of file ItemFactory.h.

References m_pClient.

68 { m_pClient = nullptr; }
Client * m_pClient
Definition: ItemFactory.h:141

Member Data Documentation

InventoryDB* ItemFactory::m_db
protected

Definition at line 140 of file ItemFactory.h.

Referenced by db(), Initialize(), and ~ItemFactory().

std::map<uint32, InventoryItemRef> ItemFactory::m_dynamicItems
protected

Definition at line 146 of file ItemFactory.h.

uint32 ItemFactory::m_nextDroneID
private

Definition at line 159 of file ItemFactory.h.

Referenced by GetNextDroneID(), and Initialize().

uint32 ItemFactory::m_nextMissileID
private

Definition at line 160 of file ItemFactory.h.

Referenced by GetNextMissileID(), and Initialize().

uint32 ItemFactory::m_nextNPCID
private

Definition at line 157 of file ItemFactory.h.

Referenced by GetNextNPCID(), and Initialize().

uint32 ItemFactory::m_nextTempID
private

Definition at line 158 of file ItemFactory.h.

Referenced by GetNextTempID(), and Initialize().

Client* ItemFactory::m_pClient
protected

Definition at line 141 of file ItemFactory.h.

Referenced by Close(), GetUsingClient(), SetUsingClient(), and UnsetUsingClient().

std::map<uint32, InventoryItemRef> ItemFactory::m_staticItems
protected

Definition at line 145 of file ItemFactory.h.

std::map<uint16, ItemType*> ItemFactory::m_types
protected

Definition at line 143 of file ItemFactory.h.

Referenced by _GetType(), and Close().


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