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

#include "Container.h"

Inheritance diagram for WreckContainer:
Collaboration diagram for WreckContainer:

Public Member Functions

 WreckContainer (uint32 _containerID, const ItemType &_containerType, const ItemData &_data)
 
virtual ~WreckContainer ()
 
virtual void Delete ()
 
virtual void RemoveItem (InventoryItemRef iRef)
 
double GetCapacity (EVEItemFlags flag) const
 
void ValidateAddItem (EVEItemFlags flag, InventoryItemRef item) const
 
const ItemTypetype () const
 
PyObjectWreckContainerGetInfo ()
 
bool IsEmpty ()
 
void MakeSlimItemChange ()
 
void SetMySE (SystemEntity *pSE)
 
void Salvaged ()
 
- Public Member Functions inherited from InventoryItem
 InventoryItem (uint32 _itemID, const ItemType &_type, const ItemData &_data)
 
 InventoryItem (const InventoryItem &oth)
 
 InventoryItem (InventoryItem &&oth) noexcept
 
InventoryItemoperator= (const InventoryItem &oth)=delete
 
InventoryItemoperator= (InventoryItem &&oth)=delete
 
virtual ~InventoryItem () noexcept
 
virtual ShipItemGetShipItem ()
 
virtual ModuleItemGetModuleItem ()
 
virtual bool IsShipItem ()
 
virtual bool IsModuleItem ()
 
virtual void Rename (std::string name)
 
InventoryGetMyInventory ()
 
bool contraband () const
 
bool isSingleton () const
 
int32 quantity () const
 
uint32 itemID () const
 
uint32 ownerID () const
 
uint32 locationID () const
 
EVEItemFlags flag () const
 
const GPointposition () const
 
const ItemTypetype () const
 
const std::string & itemName () const
 
const std::string & customInfo () const
 
const char * name ()
 
uint16 typeID () const
 
uint16 groupID () const
 
double radius () const
 
uint8 categoryID () const
 
bool isGlobal () const
 
bool IsOnline ()
 
void SetPosition (const GPoint &pos)
 
void SetCustomInfo (const char *ci)
 
void ChangeOwner (uint32 new_owner, bool notify=false)
 
void Move (uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
 
void Donate (uint32 new_owner=ownerSystem, uint32 new_location=locTemp, EVEItemFlags new_flag=flagNone, bool notify=true)
 
void SendItemChange (uint32 toID, std::map< int32, PyRep * > &changes)
 
void MergeTypesInCargo (ShipItem *pShip, EVEItemFlags flag=flagNone)
 
bool ChangeSingleton (bool singleton, bool notify=false)
 
bool AlterQuantity (int32 qty, bool notify=false)
 
bool SetQuantity (int32 qty, bool notify=false, bool deleteOnZero=true)
 
bool SetFlag (EVEItemFlags flag, bool notify=false)
 
void SetOwner (uint32 ownerID)
 
void SaveItem ()
 
void UpdateLocation ()
 
void UpdateLocation (uint32 locID)
 
virtual InventoryItemRef Split (int32 qty=0, bool notify=true, bool silent=false)
 
virtual bool Merge (InventoryItemRef to_merge, int32 qty=0, bool notify=true)
 
virtual void Relocate (uint32 locID=0, EVEItemFlags flag=flagNone)
 
virtual void AddItem (InventoryItemRef iRef)
 
double GetPackagedVolume ()
 
virtual void SetPlayer (Client *pClient)
 
virtual bool HasPilot ()
 
virtual ClientGetPilot ()
 
void ToVirtual (uint32 locationID)
 
PyRepGetItem () const
 
void GetItemRow (PyPackedRow *into) const
 
void GetItemStatusRow (PyPackedRow *into) const
 
void GetChargeStatusRow (uint32 shipID, PyPackedRow *into) const
 
bool Populate (Rsp_CommonGetInfo_Entry &into)
 
PyListGetItemInfo () const
 
PyObjectItemGetInfo ()
 
PyPackedRowGetItemRow () const
 
PyPackedRowGetItemStatusRow () const
 
PyPackedRowGetChargeStatusRow (uint32 shipID) const
 
bool SkillCheck (InventoryItemRef refItem)
 
void ClearModifiers ()
 
void AddModifier (fxData &data)
 
void RemoveModifier (fxData &data)
 
void ResetAttributes ()
 
bool HasReqSkill (const uint16 skillID)
 
AttributeMapGetAttributeMap ()
 
int64 GetTimeStamp ()
 
void SetAttribute (uint16 attrID, int num, bool notify=true)
 
void SetAttribute (uint16 attrID, uint32 num, bool notify=true)
 
void SetAttribute (uint16 attrID, int64 num, bool notify=true)
 
void SetAttribute (uint16 attrID, float num, bool notify=true)
 
void SetAttribute (uint16 attrID, double num, bool notify=true)
 
void SetAttribute (uint16 attrID, EvilNumber num, bool notify=true)
 
void MultiplyAttribute (uint16 attrID, EvilNumber num, bool notify=false)
 
bool HasAttribute (const uint16 attrID) const
 
bool HasAttribute (const uint16 attrID, EvilNumber &value) const
 
bool SaveAttributes ()
 
void ResetAttribute (uint16 attrID, bool notify=false)
 
void DeleteAttribute (uint16 attrID)
 
EvilNumber GetAttribute (const uint16 attrID) const
 
EvilNumber GetDefaultAttribute (const uint16 attrID) const
 
- Public Member Functions inherited from RefObject
 RefObject (size_t initRefCount)
 Initializes reference count. More...
 
virtual ~RefObject ()
 Destructor; must be virtual. More...
 
size_t GetCount ()
 

Static Public Member Functions

static WreckContainerRef Load (uint32 containerID)
 
static WreckContainerRef Spawn (ItemData &data)
 
- Static Public Member Functions inherited from InventoryItem
static uint32 CreateItemID (ItemData &data)
 
static uint32 CreateTempItemID (ItemData &data)
 
static InventoryItemRef Load (uint32 itemID)
 
static InventoryItemRef SpawnItem (uint32 itemID, const ItemData &data)
 
static InventoryItemRef Spawn (ItemData &data)
 
static InventoryItemRef SpawnTemp (ItemData &data)
 

Protected Member Functions

virtual bool _Load ()
 
- Protected Member Functions inherited from RefObject
void IncRef () const
 Increments reference count of object by one. More...
 
void DecRef () const
 Decrements reference count of object by one. More...
 

Static Protected Member Functions

template<class _Ty >
static RefPtr< _Ty > _LoadItem (uint32 containerID, const ItemType &type, const ItemData &data)
 
static uint32 CreateItemID (ItemData &data)
 
- Static Protected Member Functions inherited from InventoryItem
template<class _Ty >
static RefPtr< _Ty > Load (uint32 itemID)
 
template<class _Ty >
static RefPtr< _Ty > _Load (uint32 itemID)
 
template<class _Ty >
static RefPtr< _Ty > _LoadItem (uint32 itemID, const ItemType &type, const ItemData &data)
 

Private Attributes

SystemEntitymySE
 
bool m_delete
 
bool m_salvaged
 

Friends

class InventoryItem
 

Additional Inherited Members

- Public Attributes inherited from InventoryItem
std::multimap< int8, fxDatam_modifiers
 
- Protected Attributes inherited from InventoryItem
InventorypInventory
 
uint32 m_itemID
 
AttributeMappAttributeMap
 
- Protected Attributes inherited from RefObject
size_t mRefCount
 Reference count of instance. More...
 
bool mDeleted
 

Detailed Description

InventoryItem which represents wreck container. Author: Allan

Definition at line 184 of file Container.h.

Constructor & Destructor Documentation

WreckContainer::WreckContainer ( uint32  _containerID,
const ItemType _containerType,
const ItemData _data 
)

Definition at line 381 of file Container.cpp.

References _log, InventoryItem::itemID(), m_salvaged, InventoryItem::name(), and InventoryItem::pInventory.

Referenced by _LoadItem().

382 : InventoryItem(_containerID, _containerType, _data),
383 m_delete(false)
384 {
386  m_salvaged = false;
387 
388  _log(ITEM__TRACE, "Created WreckContainer object for item %s (%u).", name(), itemID());
389 }
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * name()
Inventory * pInventory
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
uint32 itemID() const
Definition: InventoryItem.h:98
friend class InventoryItem
Definition: Container.h:187

Here is the call graph for this function:

Here is the caller graph for this function:

WreckContainer::~WreckContainer ( )
virtual

Definition at line 391 of file Container.cpp.

References InventoryItem::pInventory, SafeDelete(), and Inventory::Unload().

392 {
393  if (pInventory != nullptr)
394  pInventory->Unload();
396 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
void Unload()
Definition: Inventory.cpp:62
Inventory * pInventory

Here is the call graph for this function:

Member Function Documentation

bool WreckContainer::_Load ( )
protectedvirtual

Reimplemented from InventoryItem.

Definition at line 403 of file Container.cpp.

References InventoryItem::_Load(), Inventory::LoadContents(), and InventoryItem::pInventory.

403  {
404  if (!pInventory->LoadContents( ) )
405  return false;
406 
407  return InventoryItem::_Load();
408 }
virtual bool _Load()
Inventory * pInventory
bool LoadContents()
Definition: Inventory.cpp:113

Here is the call graph for this function:

template<class _Ty >
static RefPtr<_Ty> WreckContainer::_LoadItem ( uint32  containerID,
const ItemType type,
const ItemData data 
)
inlinestaticprotected

Definition at line 217 of file Container.h.

References _log, ItemType::categoryID(), ItemType::groupID(), sConfig, sDataMgr, EvE::traceStack(), EVEDB::invGroups::Wreck, and WreckContainer().

217  {
218  if (type.groupID() != EVEDB::invGroups::Wreck) {
219  _log(ITEM__ERROR, "Trying to load %s as Wreck.", sDataMgr.GetCategoryName(type.categoryID()));
220  if (sConfig.debug.StackTrace)
221  EvE::traceStack();
222  return RefPtr<_Ty>();
223  }
224  return WreckContainerRef( new WreckContainer(containerID, type, data ) );
225  }
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 groupID() const
Definition: ItemType.h:64
RefPtr< WreckContainer > WreckContainerRef
Definition: ItemRef.h:62
uint8 categoryID() const
Definition: ItemType.h:66
WreckContainer(uint32 _containerID, const ItemType &_containerType, const ItemData &_data)
Definition: Container.cpp:381
void traceStack(void)
Definition: misc.cpp:169
Reference-counting-based smart pointer.
Definition: RefPtr.h:133
#define sDataMgr

Here is the call graph for this function:

uint32 WreckContainer::CreateItemID ( ItemData data)
staticprotected

Definition at line 427 of file Container.cpp.

References InventoryItem::CreateItemID().

Referenced by Spawn().

428 {
429  return InventoryItem::CreateItemID(data);
430 }
static uint32 CreateItemID(ItemData &data)

Here is the call graph for this function:

Here is the caller graph for this function:

void WreckContainer::Delete ( )
virtual

Reimplemented from InventoryItem.

Definition at line 432 of file Container.cpp.

References InventoryItem::Delete(), Inventory::DeleteContents(), Inventory::LoadContents(), m_delete, and InventoryItem::pInventory.

433 {
434  // verify this is actually called correctly
435  m_delete = true;
439 }
void DeleteContents()
Definition: Inventory.cpp:273
Inventory * pInventory
bool LoadContents()
Definition: Inventory.cpp:113
virtual void Delete()

Here is the call graph for this function:

double WreckContainer::GetCapacity ( EVEItemFlags  flag) const

Definition at line 441 of file Container.cpp.

References Inventory::GetCapacity(), and InventoryItem::pInventory.

442 {
443  return pInventory->GetCapacity(flag);
444 }
float GetCapacity(EVEItemFlags flag) const
Definition: Inventory.cpp:642
Inventory * pInventory
EVEItemFlags flag() const

Here is the call graph for this function:

bool WreckContainer::IsEmpty ( )
inline

Definition at line 206 of file Container.h.

References Inventory::IsEmpty(), and InventoryItem::pInventory.

Referenced by WreckSE::IsEmpty(), and WreckSE::MakeSlimItem().

206 { return pInventory->IsEmpty(); }
Inventory * pInventory
bool IsEmpty()
Definition: Inventory.h:55

Here is the call graph for this function:

Here is the caller graph for this function:

WreckContainerRef WreckContainer::Load ( uint32  containerID)
static

Definition at line 398 of file Container.cpp.

Referenced by Spawn().

399 {
400  return InventoryItem::Load<WreckContainer>(containerID );
401 }

Here is the caller graph for this function:

void WreckContainer::MakeSlimItemChange ( )

Definition at line 490 of file Container.cpp.

References SystemBubble::BubblecastDestinyUpdate(), InventoryItem::itemID(), m_delete, SystemEntity::MakeSlimItem(), mySE, PyTuple::SetItem(), and SystemEntity::SysBubble().

Referenced by RemoveItem().

491 {
492  if (m_delete)
493  return;
494  if ((mySE == nullptr) or (mySE->SysBubble() == nullptr))
495  return;
496  PyDict* slimPod = mySE->MakeSlimItem();
497  PyTuple* shipData = new PyTuple(2);
498  shipData->SetItem(0, new PyLong(itemID()));
499  shipData->SetItem(1, new PyObject( "foo.SlimItem", slimPod));
500  PyTuple* updates = new PyTuple(2);
501  updates->SetItem(0, new PyString("OnSlimItemChange"));
502  updates->SetItem(1, shipData);
503  //consumes updates
504  mySE->SysBubble()->BubblecastDestinyUpdate(&updates, "destiny" );
505 }
Python string.
Definition: PyRep.h:430
Python's dictionary.
Definition: PyRep.h:719
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
Python tuple.
Definition: PyRep.h:567
virtual PyDict * MakeSlimItem()
Python object.
Definition: PyRep.h:826
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
void BubblecastDestinyUpdate(std::vector< PyTuple * > &updates, const char *desc) const
SystemEntity * mySE
Definition: Container.h:230
uint32 itemID() const
Definition: InventoryItem.h:98
Python long integer.
Definition: PyRep.h:261

Here is the call graph for this function:

Here is the caller graph for this function:

void WreckContainer::RemoveItem ( InventoryItemRef  iRef)
virtual

Reimplemented from InventoryItem.

Definition at line 474 of file Container.cpp.

References _log, RefPtr< X >::get(), Inventory::IsEmpty(), InventoryItem::itemID(), m_salvaged, MakeSlimItemChange(), InventoryItem::name(), InventoryItem::pInventory, and InventoryItem::RemoveItem().

475 {
476  if (iRef.get() == nullptr)
477  return;
478 
480 
481  if (m_salvaged)
482  return;
483 
484  if (pInventory->IsEmpty()) {
486  _log(INV__INFO, "WreckContainer::IsEmpty() for %s(%u)", name(), itemID());
487  }
488 }
#define _log(type, fmt,...)
Definition: logsys.h:124
virtual void RemoveItem(InventoryItemRef iRef)
const char * name()
Inventory * pInventory
X * get() const
Definition: RefPtr.h:213
void MakeSlimItemChange()
Definition: Container.cpp:490
bool IsEmpty()
Definition: Inventory.h:55
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

void WreckContainer::Salvaged ( )
inline

Definition at line 209 of file Container.h.

References m_salvaged.

Referenced by WreckSE::Salvaged().

209 { m_salvaged = true; }

Here is the caller graph for this function:

void WreckContainer::SetMySE ( SystemEntity pSE)
inline

Definition at line 208 of file Container.h.

References mySE.

Referenced by DynamicEntityFactory::BuildEntity().

208 { mySE = pSE;}
SystemEntity * mySE
Definition: Container.h:230

Here is the caller graph for this function:

WreckContainerRef WreckContainer::Spawn ( ItemData data)
static

Definition at line 410 of file Container.cpp.

References AttrArmorDamage, AttrCapacity, AttrMass, AttrRadius, AttrShieldCapacity, AttrShieldCharge, AttrVolume, ItemType::capacity(), CreateItemID(), EvilZero, InventoryItem::GetAttribute(), Load(), ItemType::mass(), ItemType::radius(), InventoryItem::SetAttribute(), type(), and ItemType::volume().

Referenced by InventoryItem::Spawn(), and ItemFactory::SpawnWreckContainer().

410  {
411  uint32 containerID = WreckContainer::CreateItemID(data );
412  if (containerID == 0 )
413  return WreckContainerRef(nullptr);
414  WreckContainerRef wreckRef = WreckContainer::Load(containerID );
415 
416  // Create default dynamic attributes in the AttributeMap:
417  wreckRef->SetAttribute(AttrShieldCharge, wreckRef->GetAttribute(AttrShieldCapacity), false); // Shield Charge
418  wreckRef->SetAttribute(AttrArmorDamage, EvilZero, false); // Armor Damage
419  wreckRef->SetAttribute(AttrMass, wreckRef->type().mass(), false); // Mass
420  wreckRef->SetAttribute(AttrRadius, wreckRef->type().radius(), false); // Radius
421  wreckRef->SetAttribute(AttrVolume, wreckRef->type().volume(), false); // Volume
422  wreckRef->SetAttribute(AttrCapacity, wreckRef->type().capacity(), false); // Capacity
423 
424  return wreckRef;
425 }
static uint32 CreateItemID(ItemData &data)
Definition: Container.cpp:427
float capacity() const
Definition: ItemType.h:71
RefPtr< WreckContainer > WreckContainerRef
Definition: ItemRef.h:62
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
const ItemType & type() const
Definition: Container.h:202
float mass() const
Definition: ItemType.h:69
void SetAttribute(uint16 attrID, int num, bool notify=true)
unsigned __int32 uint32
Definition: eve-compat.h:50
EvilNumber GetAttribute(const uint16 attrID) const
float radius() const
Definition: ItemType.h:68
float volume() const
Definition: ItemType.h:70
static WreckContainerRef Load(uint32 containerID)
Definition: Container.cpp:398

Here is the call graph for this function:

Here is the caller graph for this function:

const ItemType& WreckContainer::type ( ) const
inline

Definition at line 202 of file Container.h.

References InventoryItem::type().

Referenced by Spawn().

202 { return InventoryItem::type(); }
const ItemType & type() const

Here is the call graph for this function:

Here is the caller graph for this function:

void WreckContainer::ValidateAddItem ( EVEItemFlags  flag,
InventoryItemRef  item 
) const

Definition at line 465 of file Container.cpp.

References sLog, and EvE::traceStack().

466 {
467  // throw();
468  // no code here. should NOT be able to add items to a wreck container.
469  //_log(INV__ERROR, "Adding item to wreck.");
470  sLog.Error("ValidateAddItem", "Adding item to wreck");
471  EvE::traceStack();
472 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
void traceStack(void)
Definition: misc.cpp:169

Here is the call graph for this function:

PyObject * WreckContainer::WreckContainerGetInfo ( )

Definition at line 446 of file Container.cpp.

References codelog, InventoryItem::itemID(), Inventory::LoadContents(), InventoryItem::name(), InventoryItem::pInventory, and InventoryItem::Populate().

447 {
448  if (!pInventory->LoadContents()) {
449  codelog( ITEM__ERROR, "%s (%u): Failed to load contents for WreckContainerGetInfo", name(), itemID() );
450  return nullptr;
451  }
452 
453  Rsp_CommonGetInfo result;
454  Rsp_CommonGetInfo_Entry entry;
455 
456  //first populate the WreckContainer.
457  if (!Populate( entry ) )
458  return nullptr; //print already done.
459 
460  result.items[ itemID() ] = entry.Encode();
461 
462  return result.Encode();
463 }
const char * name()
Inventory * pInventory
#define codelog(type, fmt,...)
Definition: logsys.h:128
bool Populate(Rsp_CommonGetInfo_Entry &into)
bool LoadContents()
Definition: Inventory.cpp:113
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Friends And Related Function Documentation

friend class InventoryItem
friend

Definition at line 187 of file Container.h.

Member Data Documentation

bool WreckContainer::m_delete
private

Definition at line 231 of file Container.h.

Referenced by Delete(), and MakeSlimItemChange().

bool WreckContainer::m_salvaged
private

Definition at line 232 of file Container.h.

Referenced by RemoveItem(), Salvaged(), and WreckContainer().

SystemEntity* WreckContainer::mySE
private

Definition at line 230 of file Container.h.

Referenced by MakeSlimItemChange(), and SetMySE().


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