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

#include "ItemType.h"

Inheritance diagram for ItemType:
Collaboration diagram for ItemType:

Public Member Functions

virtual ~ItemType ()
 
uint16 id () const
 
uint16 groupID () const
 
const std::string & groupName () const
 
uint8 categoryID () const
 
float radius () const
 
float mass () const
 
float volume () const
 
float capacity () const
 
uint8 race () const
 
const std::string & name () const
 
const std::string & description () const
 
uint16 portionSize () const
 
double basePrice () const
 
uint32 marketGroupID () const
 
float chanceOfDuplicating () const
 
bool published () const
 
bool refinable () const
 
bool recyclable () const
 
const bool HasAttribute (const uint16 attributeID) const
 
EvilNumber GetAttribute (const uint16 attributeID) const
 
const void CopyAttributes (InventoryItem &itemRef) const
 
bool HasReqSkill (const uint16 skillID) const
 
void GetEffectMap (const int8 state, std::map< uint16, Effect > &effectMap) const
 
uint16 GetDefaultEffect () const
 
bool HasEffect (uint16 effectID) const
 

Static Public Member Functions

static ItemTypeLoad (uint16 typeID)
 

Public Attributes

std::unordered_multimap< int8,
Effect
m_stateFxMap
 

Protected Member Functions

 ItemType (uint16 _id, const Inv::TypeData &_data)
 
virtual bool _Load ()
 
void LoadEffects ()
 

Static Protected Member Functions

template<class _Ty >
static _Ty * Load (uint16 typeID)
 
template<class _Ty >
static _Ty * _Load (uint16 typeID)
 
template<class _Ty >
static _Ty * _LoadType (uint16 typeID, const Inv::TypeData &data)
 

Private Attributes

Inv::GrpData m_group
 
Inv::TypeData m_type
 
uint16 m_defaultFxID
 
std::map< uint16, uint8m_reqSkillMap
 
std::map< uint16, EvilNumberm_AttributeMap
 

Detailed Description

Definition at line 58 of file ItemType.h.

Constructor & Destructor Documentation

virtual ItemType::~ItemType ( )
inlinevirtual

Definition at line 60 of file ItemType.h.

60 { /* do nothing here */ }
ItemType::ItemType ( uint16  _id,
const Inv::TypeData _data 
)
protected

Definition at line 39 of file ItemType.cpp.

References _log, Inv::TypeData::groupID, Inv::GrpData::id, Inv::TypeData::id, m_AttributeMap, m_group, m_type, name(), and sDataMgr.

Referenced by _LoadType().

40 : m_type(_data),
41  m_defaultFxID(0),
43 {
44  // assert for data consistency
45  assert(m_type.id == _id);
46  sDataMgr.GetGroup(_data.groupID, m_group);
47  assert(_data.groupID == m_group.id);
48  m_AttributeMap.clear();
49 
50  _log(ITEM__TRACE, "Created ItemType object %p for type %s (%u).", this, name().c_str(), id());
51 }
#define _log(type, fmt,...)
Definition: logsys.h:124
const std::string & name() const
Definition: ItemType.h:74
Inv::TypeData m_type
Definition: ItemType.h:158
uint16 m_defaultFxID
Definition: ItemType.h:159
Inv::GrpData m_group
Definition: ItemType.h:157
std::map< uint16, EvilNumber > m_AttributeMap
Definition: ItemType.h:162
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

Member Function Documentation

template<class _Ty >
static _Ty* ItemType::_Load ( uint16  typeID)
inlinestaticprotected
Todo:
this needs work. other items we need are "non-published"

Definition at line 128 of file ItemType.h.

References Inv::TypeData::groupID, Inv::TypeData::id, Inv::TypeData::published, and sDataMgr.

129  {
130  // pull data
131  Inv::TypeData data = Inv::TypeData();
132  sDataMgr.GetType(typeID, data);
133  if (data.id == 0)
134  return nullptr;
136  if (data.groupID > 23) // gID < 23 are map items. will need to search for others
137  if (!data.published)
138  return nullptr;
139 
140  return _Ty::template _LoadType<_Ty>(typeID, data );
141  }
#define sDataMgr
bool ItemType::_Load ( )
protectedvirtual

Definition at line 114 of file ItemType.cpp.

References AttrCapacity, AttrMass, AttrRaceID, AttrRadius, AttrRequiredSkill1, AttrRequiredSkill1Level, AttrRequiredSkill2, AttrRequiredSkill2Level, AttrRequiredSkill3, AttrRequiredSkill3Level, AttrRequiredSkill4, AttrRequiredSkill4Level, AttrRequiredSkill5, AttrRequiredSkill5Level, AttrRequiredSkill6, AttrRequiredSkill6Level, AttrVolume, Inv::TypeData::capacity, GetAttribute(), HasAttribute(), Inv::TypeData::id, LoadEffects(), m_AttributeMap, m_reqSkillMap, m_type, Inv::TypeData::mass, Inv::TypeData::race, Inv::TypeData::radius, sDataMgr, and Inv::TypeData::volume.

115 {
116  // load type attribs
117  std::vector< DmgTypeAttribute > typeAttrVec;
118  sDataMgr.GetDgmTypeAttrVec(m_type.id, typeAttrVec);
119  for (auto cur : typeAttrVec)
120  m_AttributeMap.insert(std::pair<uint16, EvilNumber>(cur.attributeID, cur.value));
121 
122  // load attributes that are needed but NOT in default DgmTypeAttributes set (but found in invTypes)
123  if (m_type.mass)
124  m_AttributeMap.insert(std::pair<uint16, EvilNumber>(AttrMass, m_type.mass));
125  if (m_type.radius)
126  m_AttributeMap.insert(std::pair<uint16, EvilNumber>(AttrRadius, m_type.radius));
127  if (m_type.volume)
128  m_AttributeMap.insert(std::pair<uint16, EvilNumber>(AttrVolume, m_type.volume));
129  if (m_type.capacity)
130  m_AttributeMap.insert(std::pair<uint16, EvilNumber>(AttrCapacity, m_type.capacity));
131  if (m_type.race)
132  m_AttributeMap.insert(std::pair<uint16, EvilNumber>(AttrRaceID, m_type.race));
133 
134  // load required skills and levels into their own map, for later checks
136  m_reqSkillMap.insert(std::pair<uint16, uint8>((uint16)GetAttribute(AttrRequiredSkill1).get_uint32(), (uint8)GetAttribute(AttrRequiredSkill1Level).get_uint32()));
138  m_reqSkillMap.insert(std::pair<uint16, uint8>((uint16)GetAttribute(AttrRequiredSkill2).get_uint32(), (uint8)GetAttribute(AttrRequiredSkill2Level).get_uint32()));
140  m_reqSkillMap.insert(std::pair<uint16, uint8>((uint16)GetAttribute(AttrRequiredSkill3).get_uint32(), (uint8)GetAttribute(AttrRequiredSkill3Level).get_uint32()));
142  m_reqSkillMap.insert(std::pair<uint16, uint8>((uint16)GetAttribute(AttrRequiredSkill4).get_uint32(), (uint8)GetAttribute(AttrRequiredSkill4Level).get_uint32()));
144  m_reqSkillMap.insert(std::pair<uint16, uint8>((uint16)GetAttribute(AttrRequiredSkill5).get_uint32(), (uint8)GetAttribute(AttrRequiredSkill5Level).get_uint32()));
146  m_reqSkillMap.insert(std::pair<uint16, uint8>((uint16)GetAttribute(AttrRequiredSkill6).get_uint32(), (uint8)GetAttribute(AttrRequiredSkill6Level).get_uint32()));
147 
148  LoadEffects();
149 
150  return true;
151 }
unsigned __int8 uint8
Definition: eve-compat.h:46
const bool HasAttribute(const uint16 attributeID) const
Definition: ItemType.cpp:160
std::map< uint16, uint8 > m_reqSkillMap
Definition: ItemType.h:161
EvilNumber GetAttribute(const uint16 attributeID) const
Definition: ItemType.cpp:168
void LoadEffects()
Definition: ItemType.cpp:190
Inv::TypeData m_type
Definition: ItemType.h:158
std::map< uint16, EvilNumber > m_AttributeMap
Definition: ItemType.h:162
unsigned __int16 uint16
Definition: eve-compat.h:48
#define sDataMgr

Here is the call graph for this function:

template<class _Ty >
_Ty * ItemType::_LoadType ( uint16  typeID,
const Inv::TypeData data 
)
staticprotected

Definition at line 58 of file ItemType.cpp.

References _log, EVEDB::invCategories::Accessories, EVEDB::invCategories::AncientRelics, EVEDB::invCategories::Asteroid, EVEDB::invCategories::Blueprint, Inv::GrpData::catID, EVEDB::invCategories::Celestial, EVEDB::invCategories::Charge, EVEDB::invCategories::Commodity, EVEDB::invCategories::Deployable, EVEDB::invCategories::Drone, EVEDB::invCategories::Entity, Inv::TypeData::groupID, Inv::GrpData::id, EVEDB::invCategories::Implant, ItemType(), EVEDB::invCategories::Material, EVEDB::invCategories::Module, EVEDB::invCategories::Orbitals, EVEDB::invCategories::Owner, EVEDB::invCategories::PlanetaryCommodities, EVEDB::invCategories::PlanetaryInteraction, EVEDB::invCategories::PlanetaryResources, sDataMgr, EVEDB::invCategories::Ship, EVEDB::invCategories::Skill, EVEDB::invCategories::Station, EVEDB::invGroups::Station, EVEDB::invCategories::Structure, and InventoryItem::typeID().

58  {
59  Inv::GrpData gData = Inv::GrpData();
60  sDataMgr.GetGroup(data.groupID, gData);
61 
62  switch (gData.catID) { // not complete list
63  /*
64  * not handled / not needed ?
65  case EVEDB::invCategories::_System:
66  case EVEDB::invCategories::Trading:
67  case EVEDB::invCategories::Bonus:
68  case EVEDB::invCategories::Reaction:
69  */
71  return CharacterType::_LoadType<CharacterType>(typeID, data );
72  }
74  if (gData.id == EVEDB::invGroups::Station)
75  return StationType::_LoadType<StationType>(typeID, data );
76  // i dont think we need anything specific for station services here...
77  //case EVEDB::invGroups::Station_Services:
78  } break;
80  return BlueprintType::_LoadType<BlueprintType>(typeID, data );
81  }
83  case EVEDB::invCategories::Accessories: // clone, voucher, outpost improvement/upgrade, plex
98  // these are called but not sure if they need to be coded specifically
99  } break;
103  // these probably dont need to be coded specifically
104  } break;
105  default:
106  _log(ITEM__MESSAGE, "type %u (group: %u, cat: %u) called _LoadType, but is not handled.", typeID, gData.id, gData.catID);
107  break;
108  }
109 
110  // nothing special, create generic object:
111  return new ItemType(typeID, data);
112 }
#define _log(type, fmt,...)
Definition: logsys.h:124
ItemType(uint16 _id, const Inv::TypeData &_data)
Definition: ItemType.cpp:39
#define sDataMgr

Here is the call graph for this function:

double ItemType::basePrice ( ) const
inline

Definition at line 78 of file ItemType.h.

References Inv::TypeData::basePrice, and m_type.

78 { return m_type.basePrice; }
Inv::TypeData m_type
Definition: ItemType.h:158
double basePrice
Definition: EVE_Inventory.h:88
float ItemType::capacity ( ) const
inline

Definition at line 71 of file ItemType.h.

References Inv::TypeData::capacity, and m_type.

Referenced by Concord::Concord(), ContainerSE::ContainerSE(), DroneSE::DroneSE(), NPC::NPC(), Sentry::Sentry(), CargoContainer::Spawn(), WreckContainer::Spawn(), InventoryItem::Spawn(), and WreckSE::WreckSE().

71 { return m_type.capacity; }
Inv::TypeData m_type
Definition: ItemType.h:158

Here is the caller graph for this function:

float ItemType::chanceOfDuplicating ( ) const
inline

Definition at line 80 of file ItemType.h.

References Inv::TypeData::chanceOfDuplicating, and m_type.

80 { return m_type.chanceOfDuplicating; }
float chanceOfDuplicating
Definition: EVE_Inventory.h:83
Inv::TypeData m_type
Definition: ItemType.h:158
const void ItemType::CopyAttributes ( InventoryItem itemRef) const

Definition at line 153 of file ItemType.cpp.

References m_AttributeMap, and InventoryItem::SetAttribute().

Referenced by AttributeMap::Load().

154 {
155  // set attributes in the item's own attrMap.
156  for (auto cur : m_AttributeMap)
157  itemRef.SetAttribute(cur.first, cur.second, false);
158 }
void SetAttribute(uint16 attrID, int num, bool notify=true)
std::map< uint16, EvilNumber > m_AttributeMap
Definition: ItemType.h:162

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& ItemType::description ( ) const
inline

Definition at line 75 of file ItemType.h.

References Inv::TypeData::description, and m_type.

75 { return m_type.description; }
std::string description
Definition: EVE_Inventory.h:90
Inv::TypeData m_type
Definition: ItemType.h:158
EvilNumber ItemType::GetAttribute ( const uint16  attributeID) const

Definition at line 168 of file ItemType.cpp.

References m_AttributeMap.

Referenced by _Load(), and InventoryItem::GetDefaultAttribute().

169 {
171  if (itr != m_AttributeMap.end())
172  return itr->second;
173  return 0;
174 }
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()()() itemID() attributeID(value)-Sets attributeID of itemID to value." ) COMMAND( fit
AttrMap::const_iterator AttrMapConstItr
Definition: AttributeMap.h:36
std::map< uint16, EvilNumber > m_AttributeMap
Definition: ItemType.h:162

Here is the caller graph for this function:

uint16 ItemType::GetDefaultEffect ( ) const
inline

Definition at line 95 of file ItemType.h.

References m_defaultFxID.

Referenced by ActiveModule::ShowEffect().

95 { return m_defaultFxID; }
uint16 m_defaultFxID
Definition: ItemType.h:159

Here is the caller graph for this function:

void ItemType::GetEffectMap ( const int8  state,
std::map< uint16, Effect > &  effectMap 
) const

Definition at line 217 of file ItemType.cpp.

References m_stateFxMap.

Referenced by GenericModule::ProcessEffects().

218 {
219  auto itr = m_stateFxMap.equal_range(state);
220  for (auto it = itr.first; it != itr.second; ++it)
221  effectMap.insert(std::pair<uint16, Effect>(it->second.effectID, it->second));
222 }
std::unordered_multimap< int8, Effect > m_stateFxMap
Definition: ItemType.h:154
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 kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state

Here is the caller graph for this function:

const std::string& ItemType::groupName ( ) const
inline

Definition at line 65 of file ItemType.h.

References m_group, and Inv::GrpData::name.

65 { return m_group.name; }
std::string name
Definition: EVE_Inventory.h:68
Inv::GrpData m_group
Definition: ItemType.h:157
const bool ItemType::HasAttribute ( const uint16  attributeID) const

Definition at line 160 of file ItemType.cpp.

References m_AttributeMap.

Referenced by _Load().

161 {
163  if (itr != m_AttributeMap.end())
164  return true;
165  return false;
166 }
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()()() itemID() attributeID(value)-Sets attributeID of itemID to value." ) COMMAND( fit
AttrMap::const_iterator AttrMapConstItr
Definition: AttributeMap.h:36
std::map< uint16, EvilNumber > m_AttributeMap
Definition: ItemType.h:162

Here is the caller graph for this function:

bool ItemType::HasEffect ( uint16  effectID) const

Definition at line 208 of file ItemType.cpp.

References m_stateFxMap.

Referenced by ShipItem::FindAvailableModuleSlot(), GenericModule::GenericModule(), GenericModule::isLauncherFitted(), GenericModule::isTurretFitted(), and ShipItem::TryModuleLimitChecks().

209 {
210  std::unordered_multimap<int8, Effect>::const_iterator itr = m_stateFxMap.begin();
211  for (; itr != m_stateFxMap.end(); ++itr)
212  if (itr->second.effectID == effectID)
213  return true;
214  return false;
215 }
std::unordered_multimap< int8, Effect > m_stateFxMap
Definition: ItemType.h:154

Here is the caller graph for this function:

bool ItemType::HasReqSkill ( const uint16  skillID) const

Definition at line 176 of file ItemType.cpp.

References m_reqSkillMap.

Referenced by InventoryItem::HasReqSkill().

177 {
178  std::map<uint16, uint8>::const_iterator itr = m_reqSkillMap.find(skillID);
179  if (itr != m_reqSkillMap.end())
180  return true;
181  /* this part will get prequisites for required skills...this isnt right
182  for (auto cur : m_reqSkillMap)
183  if (sItemFactory.GetType(cur.first)->HasReqSkill(skillID))
184  return true;
185  */
186 
187  return false;
188 }
std::map< uint16, uint8 > m_reqSkillMap
Definition: ItemType.h:161
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 caller graph for this function:

ItemType * ItemType::Load ( uint16  typeID)
static

Definition at line 53 of file ItemType.cpp.

References InventoryItem::typeID().

53  {
54  return ItemType::Load<ItemType>(typeID);
55 }

Here is the call graph for this function:

template<class _Ty >
static _Ty* ItemType::Load ( uint16  typeID)
inlinestaticprotected

Definition at line 110 of file ItemType.h.

111  {
112  // static load
113  _Ty *t = _Ty::template _Load<_Ty>(typeID);
114  if (t == nullptr)
115  return nullptr;
116 
117  // dynamic load
118  if (!t->_Load()) {
119  delete t;
120  return nullptr;
121  }
122 
123  return t;
124  }
void ItemType::LoadEffects ( )
protected

Definition at line 190 of file ItemType.cpp.

References _log, Inv::TypeData::id, m_defaultFxID, m_stateFxMap, m_type, and sFxDataMgr.

Referenced by _Load().

191 {
192  std::vector< TypeEffects > typeEffMap;
193  sFxDataMgr.GetTypeEffect(m_type.id, typeEffMap);
194 
195  for (auto cur : typeEffMap) {
196  Effect mEffect(sFxDataMgr.GetEffect(cur.effectID));
197  m_stateFxMap.emplace(mEffect.effectState, mEffect);
198  if (cur.isDefault) {
199  if (m_defaultFxID) {
200  // error here to show multiple defaults set for this type
201  _log(ITEM__ERROR, "Type %u has multiple default fxID (%u/%u)", m_type.id, m_defaultFxID, cur.effectID);
202  }
203  m_defaultFxID = cur.effectID;
204  }
205  }
206 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::unordered_multimap< int8, Effect > m_stateFxMap
Definition: ItemType.h:154
#define sFxDataMgr
Inv::TypeData m_type
Definition: ItemType.h:158
uint16 m_defaultFxID
Definition: ItemType.h:159

Here is the caller graph for this function:

uint32 ItemType::marketGroupID ( ) const
inline

Definition at line 79 of file ItemType.h.

References m_type, and Inv::TypeData::marketGroupID.

79 { return m_type.marketGroupID; }
uint32 marketGroupID
Definition: EVE_Inventory.h:82
Inv::TypeData m_type
Definition: ItemType.h:158
const std::string& ItemType::name ( ) const
inline

Definition at line 74 of file ItemType.h.

References m_type, and Inv::TypeData::name.

Referenced by InventoryItem::CreateItemID(), InventoryItem::CreateTempItemID(), ItemType(), AsteroidItem::Spawn(), AsteroidItem::SpawnTemp(), and ShipItem::VerifyHoldType().

74 { return m_type.name; }
Inv::TypeData m_type
Definition: ItemType.h:158
std::string name
Definition: EVE_Inventory.h:89

Here is the caller graph for this function:

uint16 ItemType::portionSize ( ) const
inline

Definition at line 77 of file ItemType.h.

References m_type, and Inv::TypeData::portionSize.

Referenced by ReprocessingServiceBound::GetQuote().

77 { return m_type.portionSize; }
uint16 portionSize
Definition: EVE_Inventory.h:81
Inv::TypeData m_type
Definition: ItemType.h:158

Here is the caller graph for this function:

bool ItemType::published ( ) const
inline

Definition at line 82 of file ItemType.h.

References m_type, and Inv::TypeData::published.

82 { return m_type.published; }
Inv::TypeData m_type
Definition: ItemType.h:158
uint8 ItemType::race ( ) const
inline

Definition at line 72 of file ItemType.h.

References m_type, and Inv::TypeData::race.

Referenced by Character::race().

72 { return m_type.race; }
Inv::TypeData m_type
Definition: ItemType.h:158

Here is the caller graph for this function:

float ItemType::radius ( ) const
inline

Definition at line 68 of file ItemType.h.

References m_type, and Inv::TypeData::radius.

Referenced by DynamicEntityFactory::BuildEntity(), Concord::Concord(), DroneSE::DroneSE(), NPC::NPC(), Sentry::Sentry(), CargoContainer::Spawn(), WreckContainer::Spawn(), InventoryItem::Spawn(), and StationSE::StationSE().

68 { return m_type.radius; }
Inv::TypeData m_type
Definition: ItemType.h:158

Here is the caller graph for this function:

bool ItemType::recyclable ( ) const
inline

Definition at line 84 of file ItemType.h.

References Inv::TypeData::isRecyclable, and m_type.

84 { return m_type.isRecyclable; }
Inv::TypeData m_type
Definition: ItemType.h:158
bool ItemType::refinable ( ) const
inline

Definition at line 83 of file ItemType.h.

References Inv::TypeData::isRefinable, and m_type.

83 { return m_type.isRefinable; }
Inv::TypeData m_type
Definition: ItemType.h:158
float ItemType::volume ( ) const
inline

Member Data Documentation

std::map<uint16, EvilNumber> ItemType::m_AttributeMap
private

Definition at line 162 of file ItemType.h.

Referenced by _Load(), CopyAttributes(), GetAttribute(), HasAttribute(), and ItemType().

uint16 ItemType::m_defaultFxID
private

Definition at line 159 of file ItemType.h.

Referenced by GetDefaultEffect(), and LoadEffects().

Inv::GrpData ItemType::m_group
private

Definition at line 157 of file ItemType.h.

Referenced by categoryID(), groupID(), groupName(), and ItemType().

std::map<uint16, uint8> ItemType::m_reqSkillMap
private

Definition at line 161 of file ItemType.h.

Referenced by _Load(), and HasReqSkill().

std::unordered_multimap<int8, Effect> ItemType::m_stateFxMap

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