29 #include "../../eve-common/EVE_Mail.h"
64 _log(ITEM__TRACE,
"II::C'tor - Created Generic Item %p for item %s (%u).",
this,
m_data.
name.c_str(),
m_itemID);
70 pAttributeMap(oth.pAttributeMap),
71 pInventory(oth.pInventory),
72 m_itemID(oth.m_itemID),
75 m_timestamp(oth.m_timestamp),
78 sLog.Error(
"InventoryItem()",
"InventoryItem copy c'tor called.");
86 pAttributeMap(oth.pAttributeMap),
87 pInventory(oth.pInventory),
88 m_itemID(oth.m_itemID),
91 m_timestamp(oth.m_timestamp),
94 sLog.Error(
"InventoryItem()",
"InventoryItem move c'tor called.");
135 return InventoryItem::Load<InventoryItem>(
itemID);
143 if (iType ==
nullptr)
146 if (iRef.
get() !=
nullptr)
155 if (iType ==
nullptr) {
156 codelog(ITEM__ERROR,
"II::CreateItemID() - Invalid type returned for typeID %u", data.
typeID);
160 if (data.
name.empty())
165 _log(ITEM__MESSAGE,
"II::CreateItemID() - LocationID = 0 for item");
187 if (iType ==
nullptr) {
188 codelog(ITEM__ERROR,
"II::CreateTempItemID() - Invalid ItemType returned for typeID %u", data.
typeID);
193 if (data.
name.empty())
209 _log(ITEM__WARNING,
"II::_Load() - Failed to load attribute map for %s(%u).",
m_data.
name.c_str(),
m_itemID);
240 return ModuleItem::_LoadItem<ModuleItem>(
itemID,
type, data);
243 return Character::_LoadItem<Character>(
itemID,
type, data);
246 return Skill::_LoadItem<Skill>(
itemID,
type, data);
249 return Blueprint::_LoadItem<Blueprint>(
itemID,
type, data);
253 return AsteroidItem::_LoadItem<AsteroidItem>(itemID, type, data);
258 return ShipItem::_LoadItem<ShipItem>(
itemID,
type, data);
264 return StructureItem::_LoadItem<StructureItem>(
itemID,
type, data);
272 return ProbeItem::_LoadItem<ProbeItem>(
itemID,
type, data);
282 if (type.
id() == 27) {
283 return StationOffice::_LoadItem<StationOffice>(
itemID,
type, data);
285 return StationItem::_LoadItem<StationItem>(
itemID,
type, data);
293 return SolarSystem::_LoadItem<SolarSystem>(
itemID,
type, data);
300 return CargoContainer::_LoadItem<CargoContainer>(
itemID,
type, data);
303 return WreckContainer::_LoadItem<WreckContainer>(
itemID,
type, data);
308 return CelestialObject::_LoadItem<CelestialObject>(
itemID,
type, data);
316 return CargoContainer::_LoadItem<CargoContainer>(
itemID,
type, data);
319 return CelestialObject::_LoadItem<CelestialObject>(
itemID,
type, data);
358 _log(ITEM__WARNING,
"item %u (type %u, group %u) defaulting to generic InventoryItem.", itemID, type.
id(), type.
groupID());
361 _log(ITEM__WARNING,
"item %u (type %u, group %u, cat %u) is not handled in II::_LoadItem::Entity.", itemID, type.
id(), type.
groupID(), type.
categoryID());
366 _log(ITEM__WARNING,
"item %u (type %u, group %u, cat %u) is not handled in II::_LoadItem.", itemID, type.
id(), type.
groupID(), type.
categoryID());
379 if (iType ==
nullptr) {
380 codelog(ITEM__ERROR,
"II::SpawnTemp() - Invalid type returned for typeID %u", data.
typeID);
395 if (iType ==
nullptr) {
396 codelog(ITEM__ERROR,
"II::Spawn() - Invalid type returned for typeID %u", data.
typeID);
420 _log(ITEM__WARNING,
"II::Spawn creating generic item for type %u, cat %u.", iType->
id(), iType->
categoryID());
467 if (!
sConfig.testing.EnableDrones)
475 if (itemRef.
get() ==
nullptr)
502 _log(ITEM__ERROR,
"II::Spawn - Obsolete Probe group called.");
513 if (itemRef.
get() ==
nullptr)
525 if (stationRef.
get() ==
nullptr)
561 _log(ITEM__WARNING,
"II::Spawn item not handled - type %u, grp %u, cat %u.", iType->
id(), iType->
groupID(), iType->
categoryID());
591 if (iRef.
get() !=
nullptr) {
608 if (iRef.
get() !=
nullptr) {
618 std::map<int32, PyRep *> changes;
648 if (pClient ==
nullptr)
670 _log(ITEM__ERROR,
"II::Donate() - %u is invalid owner", new_owner);
675 _log(ITEM__ERROR,
"II::Donate() - %u is invalid location", new_location);
692 if (iRef.
get() !=
nullptr) {
710 if (iRef.
get() !=
nullptr) {
722 std::map<int32, PyRep *> changes;
723 if (new_flag != old_flag)
725 if (new_owner != old_owner)
727 if (new_location != old_location)
730 if (new_owner != old_owner) {
731 if (new_flag != old_flag)
733 if (new_owner != old_owner)
735 if (new_location != old_location)
756 if (iRef.
get() !=
nullptr) {
774 if (iRef.
get() !=
nullptr) {
790 std::map<int32, PyRep *> changes;
801 _log(ITEM__ERROR,
"II::Split() - %s(%u): Asked to split into a chunk of %i",
m_data.
name.c_str(),
m_itemID, qty);
805 _log(ITEM__ERROR,
"II::Split() - %s(%u): Failed to remove quantity of %i during split.",
m_data.
name.c_str(),
m_itemID, qty);
811 if (iRef.get() ==
nullptr)
839 if (iRef.
get() !=
nullptr) {
842 _log(ITEM__ERROR,
"II::Relocate(): new location %u not found for %s.",
852 std::map<int32, PyRep *> changes;
861 if (to_merge.
get() ==
nullptr)
865 throw CustomError (
"You cannot stack assembled items.");
877 _log(ITEM__ERROR,
"II::Merge() - %s (%u): Failed to remove quantity %u.", to_merge->
name(), to_merge->
itemID(), qty);
880 if (pClient !=
nullptr)
881 pClient->
SendErrorMsg(
"Internal Server Error. Ref: ServerError 63138");
890 if (pClient !=
nullptr)
891 pClient->
SendErrorMsg(
"Internal Server Error. Ref: ServerError 63238");
903 if (iRef.
get() ==
nullptr) {
933 codelog(ITEM__ERROR,
"II::AlterQuantity() - %s(%u): Tried to remove %i from stack of %i for ownerID %u.", \
946 _log(ITEM__ERROR,
"II::SetQuantity() - %s(%u): Failed to set quantity %i; the items singleton bit is set",
m_data.
name.c_str(),
m_itemID, qty);
958 if (pClient !=
nullptr)
959 pClient->
SendInfoModalMsg(
"Your %s has reached quantity limits of this server.<br>If you try to add any more to this stack, you will lose items. This is your only warning.",
m_data.
name.c_str());
964 std::map<int32, PyRep *> changes;
982 if (
sConfig.world.saveOnUpdate)
998 std::map<int32, PyRep *> changes;
1016 _log(ITEM__WARNING,
"%s(%u) is changing singleton to %s and qty is currently %u", \
1021 if (
sConfig.world.saveOnUpdate)
1025 std::map<int32, PyRep *> changes;
1042 if (
sConfig.world.saveOnUpdate)
1047 std::map<int32, PyRep *> changes;
1063 if (changes.empty())
1066 NotifyOnItemChange change;
1068 change.changes = changes;
1069 PyTuple *tmp = change.Encode();
1073 tmp->
Dump(ITEM__CHANGE,
" ");
1079 if (pClient ==
nullptr)
1210 result.attributes.clear();
1224 result.itemID = tuple;
1225 result.invItem =
PyStatic.NewNone();
1227 result.attributes[(*itr).first] = (*itr).second.GetPyObject();
1244 EntityEffectState es;
1251 es.env_effectID = 16;
1261 es.randomSeed =
PyStatic.NewNone();
1262 result.activeEffects[es.env_effectID] = es.Encode();
1270 result.attributes[(*itr).first] = (*itr).second.GetPyObject();
1286 Rsp_ItemGetInfo result;
1289 return result.Encode();
1293 if (ci !=
nullptr) {
1299 if (
sConfig.world.saveOnUpdate)
1314 _log(ITEM__RELOCATE,
"%s(%u) Relocating to %.2f, %.2f, %.2f.",
m_data.
name.c_str(),
\
1440 uint16 attr = 182, skill = 277;
1441 for (
int8 i = 0; i < 3; ++i, ++attr, ++skill) {
1452 attr = 1289; skill = 1287;
1453 for (
int8 i = 0; i < 2; ++i, ++attr, ++skill) {
1471 switch (data.
math) {
1487 _log(EFFECTS__TRACE,
"Clearing modifier map for %s",
m_data.
name.c_str());
1492 _log(EFFECTS__TRACE,
"Resetting attrib map for %s",
m_data.
name.c_str());
bool SetQuantity(int32 qty, bool notify=false, bool deleteOnZero=true)
#define sConfig
A macro for easier access to the singleton.
PyPackedRow * GetItemRow() const
static bool SaveItem(uint32 itemID, const ItemData &data)
RefPtr< StationItem > StationItemRef
virtual InventoryItemRef Split(int32 qty=0, bool notify=true, bool silent=false)
#define IsNPCCorp(itemID)
void Donate(uint32 new_owner=ownerSystem, uint32 new_location=locTemp, EVEItemFlags new_flag=flagNone, bool notify=true)
void SendNotification(const PyAddress &dest, EVENotificationStream ¬i, bool seq=true)
static ShipItemRef Spawn(ItemData &data)
void SetAttribute(uint16 attrID, EvilNumber &num, bool notify=true)
void SendItemChange(uint32 toID, std::map< int32, PyRep * > &changes)
void SendErrorMsg(const char *fmt,...)
PyList * GetItemInfo() const
#define IsAsteroidID(itemID)
static InventoryItemRef SpawnItem(uint32 itemID, const ItemData &data)
#define _log(type, fmt,...)
virtual bool Merge(InventoryItemRef to_merge, int32 qty=0, bool notify=true)
static RefPtr< _Ty > _LoadItem(uint32 itemID, const ItemType &type, const ItemData &data)
bool HasAttribute(const uint16 attrID) const
bool SetFlag(EVEItemFlags flag, bool notify=false)
PyRep * GetPyObject()
converts the EvilNumber into a python object.
virtual void RemoveItem(InventoryItemRef iRef)
virtual void AddItem(InventoryItemRef iRef)
static StationItemRef Load(uint32 stationID)
SystemBubble * SysBubble()
void MultiplyAttribute(uint16 attrID, EvilNumber &num, bool notify=false)
const std::string & customInfo() const
void AddItem(InventoryItemRef iRef)
A reference-counted object.
void AddColumn(const char *name, DBTYPE type)
void SendInfoModalMsg(const char *fmt,...)
static CargoContainerRef SpawnTemp(ItemData &data)
Python floating point number.
bool SkillCheck(InventoryItemRef refItem)
void BubblecastSendNotification(const char *notifyType, const char *idType, PyTuple **payload, bool seq=true)
static SkillRef Spawn(ItemData &data)
static CelestialObjectRef Spawn(ItemData &data)
AttrMapItr begin()
return the begin iterator of the AttributeMap
void RemoveItem(InventoryItemRef iRef)
void SetPosition(const GPoint &pos)
this is a class that kinda mimics how python polymorph's numbers.
PyPackedRow * GetItemStatusRow() const
virtual void Relocate(uint32 locID=0, EVEItemFlags flag=flagNone)
Advanced version of UserError that allows to send a full custom message.
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
void Move(uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
void GetChargeStatusRow(uint32 shipID, PyPackedRow *into) const
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
EvilNumber GetAttribute(const uint16 attrID) const
static ModuleItemRef Spawn(ItemData &data)
const ItemType & type() const
#define is_log_enabled(type)
#define sLog
Evaluates to a NewLog instance.
double GetPackagedVolume()
Python object "blue.DBRowDescriptor".
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
static uint32 NewItem(const ItemData &data)
std::multimap< int8, fxData > m_modifiers
AttrMap::iterator AttrMapItr
uint32 locationID() const
bool AlterQuantity(int32 qty, bool notify=false)
static InventoryItemRef SpawnTemp(ItemData &data)
static uint32 CreateTempItemID(ItemData &data)
void SetAttribute(uint16 attrID, int num, bool notify=true)
static CargoContainerRef Spawn(ItemData &data)
#define IsFittingSlot(flag)
#define IsPlayerCorp(itemID)
void ChangeOwner(uint32 new_owner, bool notify=false)
static WreckContainerRef Spawn(ItemData &data)
const std::string & name() const
bool Populate(Rsp_CommonGetInfo_Entry &into)
#define IsCharacterID(itemID)
static ProbeItemRef Spawn(ItemData &data)
bool Load(bool reset=false)
static InventoryItemRef Load(uint32 itemID)
bool ChangeSingleton(bool singleton, bool notify=false)
static InventoryItemRef Spawn(ItemData &data)
void SetCustomInfo(const char *ci)
void MultiplyAttribute(uint16 attrID, EvilNumber num, bool notify=false)
EVEItemFlags flag() const
InventoryItem(uint32 _itemID, const ItemType &_type, const ItemData &_data)
static BlueprintRef Spawn(ItemData &data, EvERam::bpData &bdata)
#define IsValidOwner(itemID)
RefPtr< InventoryItem > InventoryItemRef
static uint32 CreateItemID(ItemData &data)
static void UpdateLocation(uint32 itemID, uint32 locationID, EVEItemFlags flag)
#define IsTempItem(itemID)
#define IsCargoHoldFlag(flag)
static uint32 CreateItemID(ItemData &data)
static bool DeleteItem(uint32 itemID)
EvilNumber GetAttribute(const uint16 attrID) const
void AddModifier(fxData &data)
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
bool SetField(uint32 index, PyRep *value)
#define IsFaction(itemID)
virtual void Rename(std::string name)
virtual ~InventoryItem() noexcept
AttributeMap * pAttributeMap
AttrMapItr end()
return the end iterator of the AttributeMap
void RemoveModifier(fxData &data)
Inventory * GetMyInventory()
InventoryItemRef GetByTypeFlag(uint32 typeID, EVEItemFlags flag) const
static StructureItemRef Spawn(ItemData &data)
void MergeTypesInCargo(ShipItem *pShip, EVEItemFlags flag=flagNone)
void ToVirtual(uint32 locationID)
#define IsValidLocation(itemID)