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

#include "Structure.h"

Inheritance diagram for StructureItem:
Collaboration diagram for StructureItem:

Public Member Functions

const ItemTypetype () const
 
void SetMySE (SystemEntity *pSE)
 
SystemEntityGetMySE ()
 
- 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 ()
 
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)
 
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 Protected Member Functions

template<class _Ty >
static RefPtr< _Ty > _LoadItem (uint32 structureID, const ItemType &type, const 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
 

Friends

class InventoryItem
 

Structure.cpp

Generic Base Class for POS items and entities.

: Allan

Date
: unknown Updates: James
static StructureItemRef Load (uint32 structureID)
 
static StructureItemRef Spawn (ItemData &data)
 
virtual void Delete ()
 
virtual void Rename (std::string name)
 
virtual void AddItem (InventoryItemRef iRef)
 
virtual void RemoveItem (InventoryItemRef iRef)
 
PyObjectStructureGetInfo ()
 
 StructureItem (uint32 _structureID, const ItemType &_itemType, const ItemData &_data)
 
virtual ~StructureItem ()
 
virtual bool _Load ()
 

Additional Inherited Members

- 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)
 
- Public Attributes inherited from InventoryItem
std::multimap< int8, fxDatam_modifiers
 
- 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...
 
- 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 Structure.

Definition at line 30 of file Structure.h.

Constructor & Destructor Documentation

StructureItem::StructureItem ( uint32  _structureID,
const ItemType _itemType,
const ItemData _data 
)
protected

Definition at line 45 of file Structure.cpp.

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

Referenced by _LoadItem().

46  : InventoryItem(_structureID, _itemType, _data)
47 {
49  _log(ITEM__TRACE, "Created StructureItem for %s (%u).", name(), itemID());
50  _log(POS__TRACE, "Created StructureItem for %s (%u).", name(), itemID());
51 }
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * name()
friend class InventoryItem
Definition: Structure.h:33
Inventory * pInventory
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

StructureItem::~StructureItem ( )
protectedvirtual

Definition at line 53 of file Structure.cpp.

References InventoryItem::pInventory, and SafeDelete().

54 {
56 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
Inventory * pInventory

Here is the call graph for this function:

Member Function Documentation

bool StructureItem::_Load ( )
protectedvirtual

Reimplemented from InventoryItem.

Definition at line 63 of file Structure.cpp.

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

64 {
65  if (!pInventory->LoadContents())
66  return false;
67 
68  return InventoryItem::_Load();
69 }
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> StructureItem::_LoadItem ( uint32  structureID,
const ItemType type,
const ItemData data 
)
inlinestaticprotected

Definition at line 63 of file Structure.h.

References _log, ItemType::categoryID(), EVEDB::invCategories::Orbitals, sConfig, sDataMgr, EVEDB::invCategories::SovereigntyStructure, EVEDB::invCategories::Structure, StructureItem(), EVEDB::invCategories::StructureUpgrade, and EvE::traceStack().

64  {
69  _log(ITEM__ERROR, "Trying to load %s as Structure.", sDataMgr.GetCategoryName(type.categoryID()));
70  if (sConfig.debug.StackTrace)
72  return RefPtr<_Ty>();
73  }
74 
75  return StructureItemRef( new StructureItem(structureID, type, data ) );
76  }
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
uint8 categoryID() const
Definition: ItemType.h:66
RefPtr< StructureItem > StructureItemRef
Definition: ItemRef.h:60
void traceStack(void)
Definition: misc.cpp:169
StructureItem(uint32 _structureID, const ItemType &_itemType, const ItemData &_data)
Definition: Structure.cpp:45
Reference-counting-based smart pointer.
Definition: RefPtr.h:133
#define sDataMgr

Here is the call graph for this function:

void StructureItem::AddItem ( InventoryItemRef  iRef)
virtual

Reimplemented from InventoryItem.

Definition at line 158 of file Structure.cpp.

References InventoryItem::AddItem(), RefPtr< X >::get(), SystemEntity::GetCOSE(), SystemEntity::IsCOSE(), mySE, and CustomsSE::VerifyAddItem().

159 {
160  if (iRef.get() == nullptr)
161  return;
162 
163  // test for item types and verify flags here...
164 
166 
167  if (mySE->IsCOSE())
168  mySE->GetCOSE()->VerifyAddItem(iRef);
169 }
SystemEntity * mySE
Definition: Structure.h:79
virtual void AddItem(InventoryItemRef iRef)
virtual CustomsSE * GetCOSE()
Definition: SystemEntity.h:128
void VerifyAddItem(InventoryItemRef iRef)
virtual bool IsCOSE()
Definition: SystemEntity.h:164
X * get() const
Definition: RefPtr.h:213

Here is the call graph for this function:

void StructureItem::Delete ( )
virtual

Reimplemented from InventoryItem.

Definition at line 131 of file Structure.cpp.

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

132 {
133  // delete contents first
135 
137 }
void DeleteContents()
Definition: Inventory.cpp:273
Inventory * pInventory
virtual void Delete()

Here is the call graph for this function:

SystemEntity* StructureItem::GetMySE ( )
inline

Definition at line 52 of file Structure.h.

References mySE.

52 { return mySE; }
SystemEntity * mySE
Definition: Structure.h:79
StructureItemRef StructureItem::Load ( uint32  structureID)
static

Definition at line 58 of file Structure.cpp.

Referenced by Spawn().

59 {
60  return InventoryItem::Load<StructureItem>(structureID);
61 }

Here is the caller graph for this function:

void StructureItem::RemoveItem ( InventoryItemRef  iRef)
virtual

Reimplemented from InventoryItem.

Definition at line 171 of file Structure.cpp.

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

172 {
173  if (iRef.get() == nullptr)
174  return;
175 
177 }
virtual void RemoveItem(InventoryItemRef iRef)
X * get() const
Definition: RefPtr.h:213

Here is the call graph for this function:

void StructureItem::Rename ( std::string  name)
virtual

Reimplemented from InventoryItem.

Definition at line 179 of file Structure.cpp.

References SystemEntity::GetPOSSE(), StructureSE::GetState(), mySE, InventoryItem::Rename(), StructureSE::SendSlimUpdate(), and EVEPOS::EntityState::Unanchored.

180 {
182  {
185  }
186  else
187  {
188  throw UserError ("SetNameObjectMustBeAnchoredInSpace");
189  }
190  // {'FullPath': u'UI/Messages', 'messageID': 258480, 'label': u'SetNameObjectMustBeAnchoredInSpaceBody'}(u'You can only rename this type of object if it is anchored in space (and you have a right to do so).', None, None)
191 }
SystemEntity * mySE
Definition: Structure.h:79
uint8 GetState() const
Definition: Structure.h:170
const char * name()
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
virtual StructureSE * GetPOSSE()
Definition: SystemEntity.h:116
void SendSlimUpdate()
Definition: Structure.cpp:966
virtual void Rename(std::string name)

Here is the call graph for this function:

void StructureItem::SetMySE ( SystemEntity pSE)
inline

Definition at line 51 of file Structure.h.

References mySE.

51 { mySE = pSE; }
SystemEntity * mySE
Definition: Structure.h:79
StructureItemRef StructureItem::Spawn ( ItemData data)
static

Definition at line 71 of file Structure.cpp.

References AttrArmorDamage, AttrArmorEmDamageResonance, AttrArmorExplosiveDamageResonance, AttrArmorKineticDamageResonance, AttrArmorMaxDamageResonance, AttrArmorThermalDamageResonance, AttrCapacity, AttrDamage, AttrEmDamageResonance, AttrExplosiveDamageResonance, AttrIsGlobal, AttrKineticDamageResonance, AttrMass, AttrRadius, AttrShieldCapacity, AttrShieldCharge, AttrShieldEmDamageResonance, AttrShieldExplosiveDamageResonance, AttrShieldKineticDamageResonance, AttrShieldMaxDamageResonance, AttrShieldThermalDamageResonance, AttrThermalDamageResonance, AttrVolume, InventoryItem::CreateItemID(), EvilOne, EvilZero, EVEDB::invTypes::InterbusCustomsOffice, Load(), EVEDB::invTypes::PlanetaryCustomsOffice, and ItemData::typeID.

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

72 {
73  uint32 structureID = InventoryItem::CreateItemID(data);
74  if (structureID < 1)
75  return StructureItemRef(nullptr);
76  StructureItemRef sRef = StructureItem::Load(structureID);
77  // check for customs offices and set global flag
79  {
80  sRef->SetAttribute(AttrIsGlobal, EvilOne);
81  }
82  // Create default dynamic attributes in the AttributeMap:
83  sRef->SetAttribute(AttrMass, sRef->type().mass(), false);
84  sRef->SetAttribute(AttrRadius, sRef->type().radius(), false);
85  sRef->SetAttribute(AttrVolume, sRef->type().volume(), false);
86  sRef->SetAttribute(AttrCapacity, sRef->type().capacity(), false);
87  sRef->SetAttribute(AttrShieldCharge, sRef->GetAttribute(AttrShieldCapacity), false);
88 
89  // Check for existence of some attributes that may or may not have already been loaded and set them
90  // to default values:
91  if (!sRef->HasAttribute(AttrDamage))
92  sRef->SetAttribute(AttrDamage, EvilZero, false);
93  if (!sRef->HasAttribute(AttrArmorDamage))
94  sRef->SetAttribute(AttrArmorDamage, EvilZero, false);
95  if (!sRef->HasAttribute(AttrArmorMaxDamageResonance))
96  sRef->SetAttribute(AttrArmorMaxDamageResonance, EvilOne, false);
97  if (!sRef->HasAttribute(AttrShieldMaxDamageResonance))
98  sRef->SetAttribute(AttrShieldMaxDamageResonance, EvilOne, false);
99 
100  // Shield Resonance
101  if (!sRef->HasAttribute(AttrShieldEmDamageResonance))
102  sRef->SetAttribute(AttrShieldEmDamageResonance, EvilOne, false);
103  if (!sRef->HasAttribute(AttrShieldExplosiveDamageResonance))
104  sRef->SetAttribute(AttrShieldExplosiveDamageResonance, EvilOne, false);
105  if (!sRef->HasAttribute(AttrShieldKineticDamageResonance))
106  sRef->SetAttribute(AttrShieldKineticDamageResonance, EvilOne, false);
107  if (!sRef->HasAttribute(AttrShieldThermalDamageResonance))
108  sRef->SetAttribute(AttrShieldThermalDamageResonance, EvilOne, false);
109  // Armor Resonance
110  if (!sRef->HasAttribute(AttrArmorEmDamageResonance))
111  sRef->SetAttribute(AttrArmorEmDamageResonance, EvilOne, false);
112  if (!sRef->HasAttribute(AttrArmorExplosiveDamageResonance))
113  sRef->SetAttribute(AttrArmorExplosiveDamageResonance, EvilOne, false);
114  if (!sRef->HasAttribute(AttrArmorKineticDamageResonance))
115  sRef->SetAttribute(AttrArmorKineticDamageResonance, EvilOne, false);
116  if (!sRef->HasAttribute(AttrArmorThermalDamageResonance))
117  sRef->SetAttribute(AttrArmorThermalDamageResonance, EvilOne, false);
118  // Hull Resonance
119  if (!sRef->HasAttribute(AttrEmDamageResonance))
120  sRef->SetAttribute(AttrEmDamageResonance, EvilOne, false);
121  if (!sRef->HasAttribute(AttrExplosiveDamageResonance))
122  sRef->SetAttribute(AttrExplosiveDamageResonance, EvilOne, false);
123  if (!sRef->HasAttribute(AttrKineticDamageResonance))
124  sRef->SetAttribute(AttrKineticDamageResonance, EvilOne, false);
125  if (!sRef->HasAttribute(AttrThermalDamageResonance))
126  sRef->SetAttribute(AttrThermalDamageResonance, EvilOne, false);
127 
128  return sRef;
129 }
static StructureItemRef Load(uint32 structureID)
Definition: Structure.cpp:58
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
unsigned __int32 uint32
Definition: eve-compat.h:50
uint16 typeID
Definition: ItemType.h:188
static uint32 CreateItemID(ItemData &data)
RefPtr< StructureItem > StructureItemRef
Definition: ItemRef.h:60
EvilNumber EvilOne
Definition: EvilNumber.cpp:34
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * StructureItem::StructureGetInfo ( )

Definition at line 139 of file Structure.cpp.

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

140 {
141  if (!pInventory->LoadContents()) {
142  codelog(ITEM__ERROR, "%s (%u): Failed to load contents for Structure", name(), m_itemID);
143  return nullptr;
144  }
145 
146  Rsp_CommonGetInfo result;
147  Rsp_CommonGetInfo_Entry entry;
148 
149  //first populate the Structure.
150  if (!Populate(entry))
151  return nullptr;
152 
153  result.items[m_itemID] = entry.Encode();
154 
155  return result.Encode();
156 }
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

Here is the call graph for this function:

const ItemType& StructureItem::type ( ) const
inline
Todo:
(Allan) will probably need to rewrite all these, too. Public fields:

Definition at line 47 of file Structure.h.

References InventoryItem::type().

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

Here is the call graph for this function:

Friends And Related Function Documentation

friend class InventoryItem
friend

Definition at line 33 of file Structure.h.

Member Data Documentation

SystemEntity* StructureItem::mySE
private

Definition at line 79 of file Structure.h.

Referenced by AddItem(), GetMySE(), Rename(), and SetMySE().


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