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

#include "ModuleItem.h"

Inheritance diagram for ModuleItem:
Collaboration diagram for ModuleItem:

Public Member Functions

virtual ~ModuleItem ()
 
virtual ModuleItemGetModuleItem ()
 
virtual bool IsModuleItem ()
 
- 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 bool IsShipItem ()
 
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 void Delete ()
 
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)
 
virtual void RemoveItem (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 Protected Member Functions

template<class _Ty >
static RefPtr< _Ty > _LoadItem (uint32 modID, 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)
 

Friends

class InventoryItem
 

ModuleItem.cpp

module item class : Allan

Date
: 20 June 2019
void SetOnline (bool online=false, bool isRig=false)
 
static ModuleItemRef Load (uint32 modID)
 
static ModuleItemRef Spawn (ItemData &data)
 
 ModuleItem (uint32 _modID, const ItemType &_type, const ItemData &_data)
 
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

Definition at line 19 of file ModuleItem.h.

Constructor & Destructor Documentation

virtual ModuleItem::~ModuleItem ( )
inlinevirtual

Definition at line 24 of file ModuleItem.h.

24 { /* do nothing here */ }
ModuleItem::ModuleItem ( uint32  _modID,
const ItemType _type,
const ItemData _data 
)
protected

Definition at line 16 of file ModuleItem.cpp.

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

Referenced by _LoadItem().

17 : InventoryItem(_modID, _type, _data)
18 {
19  _log(ITEM__TRACE, "Created ModuleItem for %s(%u).", name(), itemID());
20 }
friend class InventoryItem
Definition: ModuleItem.h:22
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * name()
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

Member Function Documentation

bool ModuleItem::_Load ( )
protectedvirtual

Reimplemented from InventoryItem.

Definition at line 43 of file ModuleItem.cpp.

References InventoryItem::_Load(), Client::IsCharCreation(), and sItemFactory.

44 {
45  Client* pClient = sItemFactory.GetUsingClient();
46  // test for character creation (which throws errors here and isnt really needed)
47  if ((pClient != nullptr) and pClient->IsCharCreation())
48  return true;
49 
50  // load attributes
51  if (!InventoryItem::_Load())
52  return false;
53 
54  return true;
55 }
bool IsCharCreation()
Definition: Client.h:433
virtual bool _Load()
Definition: Client.h:66
#define sItemFactory
Definition: ItemFactory.h:165

Here is the call graph for this function:

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

Definition at line 46 of file ModuleItem.h.

References _log, ItemType::categoryID(), EVEDB::invCategories::Module, ModuleItem(), sConfig, sDataMgr, EVEDB::invCategories::Subsystem, and EvE::traceStack().

46  {
49  return ModuleItemRef( new ModuleItem(modID, type, data ) );
50 
51  _log(ITEM__ERROR, "Trying to load %s as Module.", sDataMgr.GetCategoryName(type.categoryID()));
52  if (sConfig.debug.StackTrace)
54  return RefPtr<_Ty>();
55  }
#define sConfig
A macro for easier access to the singleton.
ModuleItem(uint32 _modID, const ItemType &_type, const ItemData &_data)
Definition: ModuleItem.cpp:16
RefPtr< ModuleItem > ModuleItemRef
Definition: ItemRef.h:58
#define _log(type, fmt,...)
Definition: logsys.h:124
uint8 categoryID() const
Definition: ItemType.h:66
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:

virtual ModuleItem* ModuleItem::GetModuleItem ( )
inlinevirtual

Reimplemented from InventoryItem.

Definition at line 27 of file ModuleItem.h.

27 { return this; }
virtual bool ModuleItem::IsModuleItem ( )
inlinevirtual

Reimplemented from InventoryItem.

Definition at line 29 of file ModuleItem.h.

29 { return true; }
ModuleItemRef ModuleItem::Load ( uint32  modID)
static

Definition at line 22 of file ModuleItem.cpp.

Referenced by Spawn().

23 {
24  return InventoryItem::Load<ModuleItem>(modID);
25 }

Here is the caller graph for this function:

void ModuleItem::SetOnline ( bool  online = false,
bool  isRig = false 
)

Definition at line 57 of file ModuleItem.cpp.

References _log, PyList::AddItem(), AttrDuration, AttrOnline, AttrSpeed, EvilNumber::get_float(), InventoryItem::GetAttribute(), GetFileTimeNow(), Client::GetShipID(), InventoryItem::HasAttribute(), Client::IsUndock(), InventoryItem::m_itemID, InventoryItem::name(), InventoryItem::ownerID(), PyStatic, Client::SendNotification(), sEntityList, and InventoryItem::SetAttribute().

Referenced by GenericModule::Offline(), and GenericModule::Online().

57  {
58  _log(MODULE__DEBUG, "ModuleItem::SetOnline() - set module %s(%u) to %s", \
59  name(), m_itemID, (online ? "Online" : "Offline"));
60 
61  if (!isRig) // rigs DO NOT get isOnline attrib set.
62  SetAttribute(AttrOnline, (online?1:0));
63 
64  Client* pClient = sEntityList.FindClientByCharID(ownerID());
65  if (pClient == nullptr) {
66  _log(MODULE__WARNING, "ModuleItem::SetOnline() - No client object found using m_ownerID (%u) for module %s(%u)", \
67  ownerID(), name(), m_itemID);
68  return;
69  }
70 
71  if (pClient->IsUndock())
72  return;
73 
74  GodmaEnvironment ge;
75  ge.selfID = m_itemID;
76  ge.charID = ownerID();
77  ge.shipID = pClient->GetShipID();
78  ge.target = PyStatic.NewNone();
79  ge.subLoc = PyStatic.NewNone();
80  ge.area = new PyList();
81  ge.effectID = 16;
82  Notify_OnGodmaShipEffect shipEff;
83  shipEff.itemID = ge.selfID;
84  shipEff.effectID = ge.effectID;
85  shipEff.timeNow = GetFileTimeNow();
86  shipEff.start = online;
87  shipEff.active = online;
88  shipEff.environment = ge.Encode();
89  shipEff.startTime = shipEff.timeNow;
91  shipEff.duration = (online ? GetAttribute(AttrDuration).get_float() : 0.0);
92  } else if (HasAttribute(AttrSpeed)) {
93  shipEff.duration = (online ? GetAttribute(AttrSpeed).get_float() : 0.0);
94  } else {
95  shipEff.duration = 0.0;
96  }
97 
98  shipEff.repeat = (online ? 1 : 0);
99  shipEff.error = PyStatic.NewNone();
100  PyList* events = new PyList();
101  events->AddItem(shipEff.Encode());
102  Notify_OnMultiEvent multi;
103  multi.events = events;
104  PyTuple* tmp = multi.Encode();
105  pClient->SendNotification("OnMultiEvent", "clientID", &tmp);
106 }
uint32 GetShipID() const
Definition: Client.h:150
void SendNotification(const PyAddress &dest, EVENotificationStream &noti, bool seq=true)
Definition: Client.cpp:2245
#define _log(type, fmt,...)
Definition: logsys.h:124
bool HasAttribute(const uint16 attrID) const
uint32 ownerID() const
Definition: InventoryItem.h:99
bool IsUndock()
Definition: Client.h:236
#define sEntityList
Definition: EntityList.h:208
const char * name()
Python tuple.
Definition: PyRep.h:567
void AddItem(PyRep *i)
Definition: PyRep.h:701
void SetAttribute(uint16 attrID, int num, bool notify=true)
#define PyStatic
Definition: PyRep.h:1209
Definition: Client.h:66
double GetFileTimeNow()
Definition: utils_time.cpp:84
EvilNumber GetAttribute(const uint16 attrID) const
float get_float()
Definition: EvilNumber.cpp:184
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

Here is the caller graph for this function:

ModuleItemRef ModuleItem::Spawn ( ItemData data)
static

Definition at line 27 of file ModuleItem.cpp.

References InventoryItem::CreateItemID(), RefPtr< X >::get(), Load(), and InventoryItem::SaveItem().

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

28 {
29  uint32 modID = InventoryItem::CreateItemID(data);
30  if ( modID == 0 )
31  return ModuleItemRef(nullptr);
32 
33  ModuleItemRef modRef = ModuleItem::Load(modID);
34  if (modRef.get() == nullptr) {
35  // make error msg here for failure to load module?
36  return ModuleItemRef(nullptr);
37  }
38 
39  modRef->SaveItem();
40  return modRef;
41 }
RefPtr< ModuleItem > ModuleItemRef
Definition: ItemRef.h:58
X * get() const
Definition: RefPtr.h:213
unsigned __int32 uint32
Definition: eve-compat.h:50
static uint32 CreateItemID(ItemData &data)
static ModuleItemRef Load(uint32 modID)
Definition: ModuleItem.cpp:22
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:

Friends And Related Function Documentation

friend class InventoryItem
friend

Definition at line 22 of file ModuleItem.h.


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