mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance
This commit is contained in:
+1
-1
@@ -701,7 +701,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
/* Insert starting inventory... */
|
||||
std::string invquery;
|
||||
for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) {
|
||||
const ItemInst* newinv = inv->GetItem(i);
|
||||
const EQEmu::ItemInstance* newinv = inv->GetItem(i);
|
||||
if (newinv) {
|
||||
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
||||
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
|
||||
|
||||
@@ -2071,7 +2071,7 @@ struct AdventureLeaderboard_Struct
|
||||
/*struct Item_Shop_Struct {
|
||||
uint16 merchantid;
|
||||
uint8 itemtype;
|
||||
EQEmu::ItemBase item;
|
||||
EQEmu::ItemData item;
|
||||
uint8 iss_unknown001[6];
|
||||
};*/
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
|
||||
}
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id)
|
||||
bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
|
||||
{
|
||||
if (!(Races & GetPlayerRaceBit(race_id)))
|
||||
return false;
|
||||
@@ -178,32 +178,32 @@ bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsClassCommon()
|
||||
bool EQEmu::ItemData::IsClassCommon() const
|
||||
{
|
||||
return (ItemClass == item::ItemClassCommon);
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsClassBag()
|
||||
bool EQEmu::ItemData::IsClassBag() const
|
||||
{
|
||||
return (ItemClass == item::ItemClassBag);
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsClassBook()
|
||||
bool EQEmu::ItemData::IsClassBook() const
|
||||
{
|
||||
return (ItemClass == item::ItemClassBook);
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsType1HWeapon()
|
||||
bool EQEmu::ItemData::IsType1HWeapon() const
|
||||
{
|
||||
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing));
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsType2HWeapon()
|
||||
bool EQEmu::ItemData::IsType2HWeapon() const
|
||||
{
|
||||
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
|
||||
}
|
||||
|
||||
bool EQEmu::ItemBase::IsTypeShield()
|
||||
bool EQEmu::ItemData::IsTypeShield() const
|
||||
{
|
||||
return (ItemType == item::ItemTypeShield);
|
||||
}
|
||||
|
||||
+13
-33
@@ -17,8 +17,8 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_ITEM_BASE_H
|
||||
#define COMMON_ITEM_BASE_H
|
||||
#ifndef COMMON_ITEM_DATA_H
|
||||
#define COMMON_ITEM_DATA_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -50,17 +50,6 @@
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace item {
|
||||
enum ItemAttributeBit : uint32 {
|
||||
bit_ItemAttributeNone = 0x00000000,
|
||||
bit_ItemAttributeLore = 0x00000001,
|
||||
bit_ItemAttributeArtifact = 0x00000002,
|
||||
bit_ItemAttributeSummoned = 0x00000004,
|
||||
bit_ItemAttributeMagic = 0x00000008,
|
||||
bit_ItemAttributeAugment = 0x00000010,
|
||||
bit_ItemAttributePendingLore = 0x00000020,
|
||||
bit_ItemAttributeUnknown = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
enum ItemClass {
|
||||
ItemClassCommon = 0,
|
||||
ItemClassBag,
|
||||
@@ -354,8 +343,8 @@ namespace EQEmu
|
||||
//ProcRate
|
||||
};
|
||||
|
||||
extern uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type);
|
||||
extern uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit);
|
||||
uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type);
|
||||
uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit);
|
||||
|
||||
} /*item*/
|
||||
|
||||
@@ -364,10 +353,9 @@ namespace EQEmu
|
||||
const void * inst;
|
||||
};
|
||||
|
||||
struct ItemBase {
|
||||
struct ItemData {
|
||||
// Non packet based fields
|
||||
uint8 MinStatus;
|
||||
uint8 ItemDataType; // memset to item::ItemDataBase ('0') during mmf load
|
||||
|
||||
// Packet based fields
|
||||
uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book
|
||||
@@ -543,23 +531,15 @@ namespace EQEmu
|
||||
char ScrollName[65];
|
||||
//BardName
|
||||
|
||||
bool IsEquipable(uint16 Race, uint16 Class);
|
||||
bool IsClassCommon();
|
||||
bool IsClassBag();
|
||||
bool IsClassBook();
|
||||
bool IsType1HWeapon();
|
||||
bool IsType2HWeapon();
|
||||
bool IsTypeShield();
|
||||
|
||||
bool IsEquipable(uint16 Race, uint16 Class) const { return const_cast<ItemBase*>(this)->IsEquipable(Race, Class); }
|
||||
bool IsClassCommon() const { return const_cast<ItemBase*>(this)->IsClassCommon(); }
|
||||
bool IsClassBag() const { return const_cast<ItemBase*>(this)->IsClassBag(); }
|
||||
bool IsClassBook() const { return const_cast<ItemBase*>(this)->IsClassBook(); }
|
||||
bool IsType1HWeapon() const { return const_cast<ItemBase*>(this)->IsType1HWeapon(); }
|
||||
bool IsType2HWeapon() const { return const_cast<ItemBase*>(this)->IsType2HWeapon(); }
|
||||
bool IsTypeShield() const { return const_cast<ItemBase*>(this)->IsTypeShield(); }
|
||||
bool IsEquipable(uint16 Race, uint16 Class) const;
|
||||
bool IsClassCommon() const;
|
||||
bool IsClassBag() const;
|
||||
bool IsClassBook() const;
|
||||
bool IsType1HWeapon() const;
|
||||
bool IsType2HWeapon() const;
|
||||
bool IsTypeShield() const;
|
||||
};
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_ITEM_BASE_H*/
|
||||
#endif /*COMMON_ITEM_DATA_H*/
|
||||
|
||||
+176
-176
File diff suppressed because it is too large
Load Diff
+262
-261
@@ -21,8 +21,8 @@
|
||||
// These classes could be optimized with database reads/writes by storing
|
||||
// a status flag indicating how object needs to interact with database
|
||||
|
||||
#ifndef COMMON_ITEM_H
|
||||
#define COMMON_ITEM_H
|
||||
#ifndef COMMON_ITEM_INSTANCE_H
|
||||
#define COMMON_ITEM_INSTANCE_H
|
||||
|
||||
|
||||
class ItemParse; // Parses item packets
|
||||
@@ -51,7 +51,7 @@ namespace ItemField
|
||||
};
|
||||
};
|
||||
|
||||
// Specifies usage type for item inside ItemInst
|
||||
// Specifies usage type for item inside EQEmu::ItemInstance
|
||||
enum ItemInstTypes
|
||||
{
|
||||
ItemInstNormal = 0,
|
||||
@@ -76,7 +76,10 @@ enum {
|
||||
invWhereCursor = 0x20
|
||||
};
|
||||
|
||||
class ItemInst;
|
||||
namespace EQEmu
|
||||
{
|
||||
class ItemInstance;
|
||||
}
|
||||
|
||||
// ########################################
|
||||
// Class: Queue
|
||||
@@ -89,24 +92,24 @@ public:
|
||||
// Public Methods
|
||||
/////////////////////////
|
||||
|
||||
inline std::list<ItemInst*>::const_iterator cbegin() { return m_list.cbegin(); }
|
||||
inline std::list<ItemInst*>::const_iterator cend() { return m_list.cend(); }
|
||||
inline std::list<EQEmu::ItemInstance*>::const_iterator cbegin() { return m_list.cbegin(); }
|
||||
inline std::list<EQEmu::ItemInstance*>::const_iterator cend() { return m_list.cend(); }
|
||||
|
||||
inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t
|
||||
inline bool empty() { return m_list.empty(); }
|
||||
|
||||
void push(ItemInst* inst);
|
||||
void push_front(ItemInst* inst);
|
||||
ItemInst* pop();
|
||||
ItemInst* pop_back();
|
||||
ItemInst* peek_front() const;
|
||||
void push(EQEmu::ItemInstance* inst);
|
||||
void push_front(EQEmu::ItemInstance* inst);
|
||||
EQEmu::ItemInstance* pop();
|
||||
EQEmu::ItemInstance* pop_back();
|
||||
EQEmu::ItemInstance* peek_front() const;
|
||||
|
||||
protected:
|
||||
/////////////////////////
|
||||
// Protected Members
|
||||
/////////////////////////
|
||||
|
||||
std::list<ItemInst*> m_list;
|
||||
std::list<EQEmu::ItemInstance*> m_list;
|
||||
};
|
||||
|
||||
// ########################################
|
||||
@@ -114,7 +117,7 @@ protected:
|
||||
// Character inventory
|
||||
class Inventory
|
||||
{
|
||||
friend class ItemInst;
|
||||
friend class EQEmu::ItemInstance;
|
||||
public:
|
||||
///////////////////////////////
|
||||
// Public Methods
|
||||
@@ -138,29 +141,29 @@ public:
|
||||
EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; }
|
||||
|
||||
static void CleanDirty();
|
||||
static void MarkDirty(ItemInst *inst);
|
||||
static void MarkDirty(EQEmu::ItemInstance *inst);
|
||||
|
||||
// Retrieve a writeable item at specified slot
|
||||
ItemInst* GetItem(int16 slot_id) const;
|
||||
ItemInst* GetItem(int16 slot_id, uint8 bagidx) const;
|
||||
EQEmu::ItemInstance* GetItem(int16 slot_id) const;
|
||||
EQEmu::ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const;
|
||||
|
||||
inline std::list<ItemInst*>::const_iterator cursor_cbegin() { return m_cursor.cbegin(); }
|
||||
inline std::list<ItemInst*>::const_iterator cursor_cend() { return m_cursor.cend(); }
|
||||
inline std::list<EQEmu::ItemInstance*>::const_iterator cursor_cbegin() { return m_cursor.cbegin(); }
|
||||
inline std::list<EQEmu::ItemInstance*>::const_iterator cursor_cend() { return m_cursor.cend(); }
|
||||
|
||||
inline int CursorSize() { return m_cursor.size(); }
|
||||
inline bool CursorEmpty() { return m_cursor.empty(); }
|
||||
|
||||
// Retrieve a read-only item from inventory
|
||||
inline const ItemInst* operator[](int16 slot_id) const { return GetItem(slot_id); }
|
||||
inline const EQEmu::ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); }
|
||||
|
||||
// Add item to inventory
|
||||
int16 PutItem(int16 slot_id, const ItemInst& inst);
|
||||
int16 PutItem(int16 slot_id, const EQEmu::ItemInstance& inst);
|
||||
|
||||
// Add item to cursor queue
|
||||
int16 PushCursor(const ItemInst& inst);
|
||||
int16 PushCursor(const EQEmu::ItemInstance& inst);
|
||||
|
||||
// Get cursor item in front of queue
|
||||
ItemInst* GetCursorItem();
|
||||
EQEmu::ItemInstance* GetCursorItem();
|
||||
|
||||
// Swap items in inventory
|
||||
bool SwapItem(int16 slot_a, int16 slot_b);
|
||||
@@ -172,10 +175,10 @@ public:
|
||||
bool CheckNoDrop(int16 slot_id);
|
||||
|
||||
// Remove item from inventory (and take control of memory)
|
||||
ItemInst* PopItem(int16 slot_id);
|
||||
EQEmu::ItemInstance* PopItem(int16 slot_id);
|
||||
|
||||
// Check whether there is space for the specified number of the specified item.
|
||||
bool HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity);
|
||||
bool HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity);
|
||||
|
||||
// Check whether item exists in inventory
|
||||
// where argument specifies OR'd list of invWhere constants to look
|
||||
@@ -191,7 +194,7 @@ public:
|
||||
|
||||
// Locate an available inventory slot
|
||||
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
|
||||
int16 FindFreeSlotForTradeItem(const ItemInst* inst);
|
||||
int16 FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst);
|
||||
|
||||
// Calculate slot_id for an item within a bag
|
||||
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
||||
@@ -200,7 +203,7 @@ public:
|
||||
static int16 CalcSlotFromMaterial(uint8 material);
|
||||
static uint8 CalcMaterialFromSlot(int16 equipslot);
|
||||
|
||||
static bool CanItemFitInContainer(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container);
|
||||
static bool CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container);
|
||||
|
||||
// Test for valid inventory casting slot
|
||||
bool SupportsClickCasting(int16 slot_id);
|
||||
@@ -209,7 +212,7 @@ public:
|
||||
// Test whether a given slot can support a container item
|
||||
static bool SupportsContainers(int16 slot_id);
|
||||
|
||||
int GetSlotByItemInst(ItemInst *inst);
|
||||
int GetSlotByItemInst(EQEmu::ItemInstance *inst);
|
||||
|
||||
uint8 FindBrightestLightType();
|
||||
|
||||
@@ -229,31 +232,31 @@ protected:
|
||||
// Protected Methods
|
||||
///////////////////////////////
|
||||
|
||||
int GetSlotByItemInstCollection(const std::map<int16, ItemInst*> &collection, ItemInst *inst);
|
||||
void dumpItemCollection(const std::map<int16, ItemInst*> &collection);
|
||||
void dumpBagContents(ItemInst *inst, std::map<int16, ItemInst*>::const_iterator *it);
|
||||
int GetSlotByItemInstCollection(const std::map<int16, EQEmu::ItemInstance*> &collection, EQEmu::ItemInstance *inst);
|
||||
void dumpItemCollection(const std::map<int16, EQEmu::ItemInstance*> &collection);
|
||||
void dumpBagContents(EQEmu::ItemInstance *inst, std::map<int16, EQEmu::ItemInstance*>::const_iterator *it);
|
||||
|
||||
// Retrieves item within an inventory bucket
|
||||
ItemInst* _GetItem(const std::map<int16, ItemInst*>& bucket, int16 slot_id) const;
|
||||
EQEmu::ItemInstance* _GetItem(const std::map<int16, EQEmu::ItemInstance*>& bucket, int16 slot_id) const;
|
||||
|
||||
// Private "put" item into bucket, without regard for what is currently in bucket
|
||||
int16 _PutItem(int16 slot_id, ItemInst* inst);
|
||||
int16 _PutItem(int16 slot_id, EQEmu::ItemInstance* inst);
|
||||
|
||||
// Checks an inventory bucket for a particular item
|
||||
int16 _HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, uint8 quantity);
|
||||
int16 _HasItem(std::map<int16, EQEmu::ItemInstance*>& bucket, uint32 item_id, uint8 quantity);
|
||||
int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity);
|
||||
int16 _HasItemByUse(std::map<int16, ItemInst*>& bucket, uint8 use, uint8 quantity);
|
||||
int16 _HasItemByUse(std::map<int16, EQEmu::ItemInstance*>& bucket, uint8 use, uint8 quantity);
|
||||
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
|
||||
int16 _HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32 loregroup);
|
||||
int16 _HasItemByLoreGroup(std::map<int16, EQEmu::ItemInstance*>& bucket, uint32 loregroup);
|
||||
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
|
||||
|
||||
|
||||
// Player inventory
|
||||
std::map<int16, ItemInst*> m_worn; // Items worn by character
|
||||
std::map<int16, ItemInst*> m_inv; // Items in character personal inventory
|
||||
std::map<int16, ItemInst*> m_bank; // Items in character bank
|
||||
std::map<int16, ItemInst*> m_shbank; // Items in character shared bank
|
||||
std::map<int16, ItemInst*> m_trade; // Items in a trade session
|
||||
std::map<int16, EQEmu::ItemInstance*> m_worn; // Items worn by character
|
||||
std::map<int16, EQEmu::ItemInstance*> m_inv; // Items in character personal inventory
|
||||
std::map<int16, EQEmu::ItemInstance*> m_bank; // Items in character bank
|
||||
std::map<int16, EQEmu::ItemInstance*> m_shbank; // Items in character shared bank
|
||||
std::map<int16, EQEmu::ItemInstance*> m_trade; // Items in a trade session
|
||||
ItemInstQueue m_cursor; // Items on cursor: FIFO
|
||||
|
||||
private:
|
||||
@@ -265,271 +268,269 @@ private:
|
||||
class SharedDatabase;
|
||||
|
||||
// ########################################
|
||||
// Class: ItemInst
|
||||
// Class: EQEmu::ItemInstance
|
||||
// Base class for an instance of an item
|
||||
// An item instance encapsulates item data + data specific
|
||||
// to an item instance (includes dye, augments, charges, etc)
|
||||
class ItemInst
|
||||
namespace EQEmu
|
||||
{
|
||||
public:
|
||||
/////////////////////////
|
||||
// Methods
|
||||
/////////////////////////
|
||||
class ItemInstance {
|
||||
public:
|
||||
/////////////////////////
|
||||
// Methods
|
||||
/////////////////////////
|
||||
|
||||
// Constructors/Destructor
|
||||
ItemInst(const EQEmu::ItemBase* item = nullptr, int16 charges = 0);
|
||||
// Constructors/Destructor
|
||||
ItemInstance(const ItemData* item = nullptr, int16 charges = 0);
|
||||
|
||||
ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0);
|
||||
ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges = 0);
|
||||
|
||||
ItemInst(ItemInstTypes use_type);
|
||||
ItemInstance(ItemInstTypes use_type);
|
||||
|
||||
ItemInst(const ItemInst& copy);
|
||||
ItemInstance(const ItemInstance& copy);
|
||||
|
||||
~ItemInst();
|
||||
~ItemInstance();
|
||||
|
||||
// Query item type
|
||||
bool IsType(EQEmu::item::ItemClass item_class) const;
|
||||
// Query item type
|
||||
bool IsType(EQEmu::item::ItemClass item_class) const;
|
||||
|
||||
bool IsClassCommon();
|
||||
bool IsClassBag();
|
||||
bool IsClassBook();
|
||||
bool IsClassCommon() const;
|
||||
bool IsClassBag() const;
|
||||
bool IsClassBook() const;
|
||||
|
||||
bool IsClassCommon() const { return const_cast<ItemInst*>(this)->IsClassCommon(); }
|
||||
bool IsClassBag() const { return const_cast<ItemInst*>(this)->IsClassBag(); }
|
||||
bool IsClassBook() const { return const_cast<ItemInst*>(this)->IsClassBook(); }
|
||||
// Can item be stacked?
|
||||
bool IsStackable() const;
|
||||
bool IsCharged() const;
|
||||
|
||||
// Can item be stacked?
|
||||
bool IsStackable() const;
|
||||
bool IsCharged() const;
|
||||
// Can item be equipped by/at?
|
||||
bool IsEquipable(uint16 race, uint16 class_) const;
|
||||
bool IsEquipable(int16 slot_id) const;
|
||||
|
||||
// Can item be equipped by/at?
|
||||
bool IsEquipable(uint16 race, uint16 class_) const;
|
||||
bool IsEquipable(int16 slot_id) const;
|
||||
//
|
||||
// Augments
|
||||
//
|
||||
bool IsAugmentable() const;
|
||||
bool AvailableWearSlot(uint32 aug_wear_slots) const;
|
||||
int8 AvailableAugmentSlot(int32 augtype) const;
|
||||
bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const;
|
||||
inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); }
|
||||
|
||||
//
|
||||
// Augments
|
||||
//
|
||||
bool IsAugmentable() const;
|
||||
bool AvailableWearSlot(uint32 aug_wear_slots) const;
|
||||
int8 AvailableAugmentSlot(int32 augtype) const;
|
||||
bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const;
|
||||
inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); }
|
||||
inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); }
|
||||
|
||||
inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); }
|
||||
//
|
||||
// Contents
|
||||
//
|
||||
ItemInstance* GetItem(uint8 slot) const;
|
||||
uint32 GetItemID(uint8 slot) const;
|
||||
inline const ItemInstance* operator[](uint8 slot) const { return GetItem(slot); }
|
||||
void PutItem(uint8 slot, const ItemInstance& inst);
|
||||
void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id) { return; } // not defined anywhere...
|
||||
void DeleteItem(uint8 slot);
|
||||
ItemInstance* PopItem(uint8 index);
|
||||
void Clear();
|
||||
void ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent);
|
||||
uint8 FirstOpenSlot() const;
|
||||
uint8 GetTotalItemCount() const;
|
||||
bool IsNoneEmptyContainer();
|
||||
std::map<uint8, ItemInstance*>* GetContents() { return &m_contents; }
|
||||
|
||||
//
|
||||
// Contents
|
||||
//
|
||||
ItemInst* GetItem(uint8 slot) const;
|
||||
uint32 GetItemID(uint8 slot) const;
|
||||
inline const ItemInst* operator[](uint8 slot) const { return GetItem(slot); }
|
||||
void PutItem(uint8 slot, const ItemInst& inst);
|
||||
void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id) { return; } // not defined anywhere...
|
||||
void DeleteItem(uint8 slot);
|
||||
ItemInst* PopItem(uint8 index);
|
||||
void Clear();
|
||||
void ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent);
|
||||
uint8 FirstOpenSlot() const;
|
||||
uint8 GetTotalItemCount() const;
|
||||
bool IsNoneEmptyContainer();
|
||||
std::map<uint8, ItemInst*>* GetContents() { return &m_contents; }
|
||||
//
|
||||
// Augments
|
||||
//
|
||||
ItemInstance* GetAugment(uint8 slot) const;
|
||||
uint32 GetAugmentItemID(uint8 slot) const;
|
||||
void PutAugment(uint8 slot, const ItemInstance& inst);
|
||||
void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id);
|
||||
void DeleteAugment(uint8 slot);
|
||||
ItemInstance* RemoveAugment(uint8 index);
|
||||
bool IsAugmented();
|
||||
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const;
|
||||
bool UpdateOrnamentationInfo();
|
||||
static bool CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll = false);
|
||||
|
||||
//
|
||||
// Augments
|
||||
//
|
||||
ItemInst* GetAugment(uint8 slot) const;
|
||||
uint32 GetAugmentItemID(uint8 slot) const;
|
||||
void PutAugment(uint8 slot, const ItemInst& inst);
|
||||
void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id);
|
||||
void DeleteAugment(uint8 slot);
|
||||
ItemInst* RemoveAugment(uint8 index);
|
||||
bool IsAugmented();
|
||||
ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const;
|
||||
bool UpdateOrnamentationInfo();
|
||||
static bool CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container, bool AllowAll = false);
|
||||
|
||||
// Has attack/delay?
|
||||
bool IsWeapon() const;
|
||||
bool IsAmmo() const;
|
||||
// Has attack/delay?
|
||||
bool IsWeapon() const;
|
||||
bool IsAmmo() const;
|
||||
|
||||
// Accessors
|
||||
const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); }
|
||||
const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); }
|
||||
const EQEmu::ItemBase* GetItem() const;
|
||||
const EQEmu::ItemBase* GetUnscaledItem() const;
|
||||
// Accessors
|
||||
const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); }
|
||||
const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); }
|
||||
const ItemData* GetItem() const;
|
||||
const ItemData* GetUnscaledItem() const;
|
||||
|
||||
int16 GetCharges() const { return m_charges; }
|
||||
void SetCharges(int16 charges) { m_charges = charges; }
|
||||
int16 GetCharges() const { return m_charges; }
|
||||
void SetCharges(int16 charges) { m_charges = charges; }
|
||||
|
||||
uint32 GetPrice() const { return m_price; }
|
||||
void SetPrice(uint32 price) { m_price = price; }
|
||||
uint32 GetPrice() const { return m_price; }
|
||||
void SetPrice(uint32 price) { m_price = price; }
|
||||
|
||||
void SetColor(uint32 color) { m_color = color; }
|
||||
uint32 GetColor() const { return m_color; }
|
||||
void SetColor(uint32 color) { m_color = color; }
|
||||
uint32 GetColor() const { return m_color; }
|
||||
|
||||
uint32 GetMerchantSlot() const { return m_merchantslot; }
|
||||
void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; }
|
||||
uint32 GetMerchantSlot() const { return m_merchantslot; }
|
||||
void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; }
|
||||
|
||||
int32 GetMerchantCount() const { return m_merchantcount; }
|
||||
void SetMerchantCount(int32 count) { m_merchantcount = count; }
|
||||
int32 GetMerchantCount() const { return m_merchantcount; }
|
||||
void SetMerchantCount(int32 count) { m_merchantcount = count; }
|
||||
|
||||
int16 GetCurrentSlot() const { return m_currentslot; }
|
||||
void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; }
|
||||
int16 GetCurrentSlot() const { return m_currentslot; }
|
||||
void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; }
|
||||
|
||||
// Is this item already attuned?
|
||||
bool IsAttuned() const { return m_attuned; }
|
||||
void SetAttuned(bool flag) { m_attuned=flag; }
|
||||
// Is this item already attuned?
|
||||
bool IsAttuned() const { return m_attuned; }
|
||||
void SetAttuned(bool flag) { m_attuned = flag; }
|
||||
|
||||
std::string GetCustomDataString() const;
|
||||
std::string GetCustomData(std::string identifier);
|
||||
void SetCustomData(std::string identifier, std::string value);
|
||||
void SetCustomData(std::string identifier, int value);
|
||||
void SetCustomData(std::string identifier, float value);
|
||||
void SetCustomData(std::string identifier, bool value);
|
||||
void DeleteCustomData(std::string identifier);
|
||||
std::string GetCustomDataString() const;
|
||||
std::string GetCustomData(std::string identifier);
|
||||
void SetCustomData(std::string identifier, std::string value);
|
||||
void SetCustomData(std::string identifier, int value);
|
||||
void SetCustomData(std::string identifier, float value);
|
||||
void SetCustomData(std::string identifier, bool value);
|
||||
void DeleteCustomData(std::string identifier);
|
||||
|
||||
// Allows treatment of this object as though it were a pointer to m_item
|
||||
operator bool() const { return (m_item != nullptr); }
|
||||
// Allows treatment of this object as though it were a pointer to m_item
|
||||
operator bool() const { return (m_item != nullptr); }
|
||||
|
||||
// Compare inner Item_Struct of two ItemInst objects
|
||||
bool operator==(const ItemInst& right) const { return (this->m_item == right.m_item); }
|
||||
bool operator!=(const ItemInst& right) const { return (this->m_item != right.m_item); }
|
||||
// Compare inner Item_Struct of two ItemInstance objects
|
||||
bool operator==(const ItemInstance& right) const { return (this->m_item == right.m_item); }
|
||||
bool operator!=(const ItemInstance& right) const { return (this->m_item != right.m_item); }
|
||||
|
||||
// Clone current item
|
||||
ItemInst* Clone() const;
|
||||
// Clone current item
|
||||
ItemInstance* Clone() const;
|
||||
|
||||
bool IsSlotAllowed(int16 slot_id) const;
|
||||
bool IsSlotAllowed(int16 slot_id) const;
|
||||
|
||||
bool IsScaling() const { return m_scaling; }
|
||||
bool IsEvolving() const { return (m_evolveLvl >= 1); }
|
||||
uint32 GetExp() const { return m_exp; }
|
||||
void SetExp(uint32 exp) { m_exp = exp; }
|
||||
void AddExp(uint32 exp) { m_exp += exp; }
|
||||
bool IsActivated() { return m_activated; }
|
||||
void SetActivated(bool activated) { m_activated = activated; }
|
||||
int8 GetEvolveLvl() const { return m_evolveLvl; }
|
||||
void SetScaling(bool v) { m_scaling = v; }
|
||||
uint32 GetOrnamentationIcon() const { return m_ornamenticon; }
|
||||
void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; }
|
||||
uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; }
|
||||
void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; }
|
||||
uint32 GetOrnamentHeroModel(int32 material_slot = -1) const;
|
||||
void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; }
|
||||
uint32 GetRecastTimestamp() const { return m_recast_timestamp; }
|
||||
void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; }
|
||||
bool IsScaling() const { return m_scaling; }
|
||||
bool IsEvolving() const { return (m_evolveLvl >= 1); }
|
||||
uint32 GetExp() const { return m_exp; }
|
||||
void SetExp(uint32 exp) { m_exp = exp; }
|
||||
void AddExp(uint32 exp) { m_exp += exp; }
|
||||
bool IsActivated() { return m_activated; }
|
||||
void SetActivated(bool activated) { m_activated = activated; }
|
||||
int8 GetEvolveLvl() const { return m_evolveLvl; }
|
||||
void SetScaling(bool v) { m_scaling = v; }
|
||||
uint32 GetOrnamentationIcon() const { return m_ornamenticon; }
|
||||
void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; }
|
||||
uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; }
|
||||
void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; }
|
||||
uint32 GetOrnamentHeroModel(int32 material_slot = -1) const;
|
||||
void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; }
|
||||
uint32 GetRecastTimestamp() const { return m_recast_timestamp; }
|
||||
void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; }
|
||||
|
||||
void Initialize(SharedDatabase *db = nullptr);
|
||||
void ScaleItem();
|
||||
bool EvolveOnAllKills() const;
|
||||
int8 GetMaxEvolveLvl() const;
|
||||
uint32 GetKillsNeeded(uint8 currentlevel);
|
||||
void Initialize(SharedDatabase *db = nullptr);
|
||||
void ScaleItem();
|
||||
bool EvolveOnAllKills() const;
|
||||
int8 GetMaxEvolveLvl() const;
|
||||
uint32 GetKillsNeeded(uint8 currentlevel);
|
||||
|
||||
std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; }
|
||||
void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
|
||||
|
||||
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||
std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; }
|
||||
void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
|
||||
|
||||
std::map<std::string, Timer>& GetTimers() { return m_timers; }
|
||||
void SetTimer(std::string name, uint32 time);
|
||||
void StopTimer(std::string name);
|
||||
void ClearTimers();
|
||||
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||
|
||||
// Get a total of a stat, including augs
|
||||
// These functions should be used in place of other code manually totaling
|
||||
// to centralize where it is done to make future changes easier (ex. whenever powersources come around)
|
||||
// and to minimize errors. CalcItemBonuses however doesn't use these in interest of performance
|
||||
// by default these do not recurse into augs
|
||||
int GetItemArmorClass(bool augments = false) const;
|
||||
int GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments = false) const;
|
||||
// These two differ in the fact that they're quick checks (they are checked BEFORE the one above
|
||||
int GetItemElementalFlag(bool augments = false) const;
|
||||
int GetItemElementalDamage(bool augments = false) const;
|
||||
int GetItemRecommendedLevel(bool augments = false) const;
|
||||
int GetItemRequiredLevel(bool augments = false) const;
|
||||
int GetItemWeaponDamage(bool augments = false) const;
|
||||
int GetItemBackstabDamage(bool augments = false) const;
|
||||
// these two are just quick checks
|
||||
int GetItemBaneDamageBody(bool augments = false) const;
|
||||
int GetItemBaneDamageRace(bool augments = false) const;
|
||||
int GetItemBaneDamageBody(bodyType against, bool augments = false) const;
|
||||
int GetItemBaneDamageRace(uint16 against, bool augments = false) const;
|
||||
int GetItemMagical(bool augments = false) const;
|
||||
int GetItemHP(bool augments = false) const;
|
||||
int GetItemMana(bool augments = false) const;
|
||||
int GetItemEndur(bool augments = false) const;
|
||||
int GetItemAttack(bool augments = false) const;
|
||||
int GetItemStr(bool augments = false) const;
|
||||
int GetItemSta(bool augments = false) const;
|
||||
int GetItemDex(bool augments = false) const;
|
||||
int GetItemAgi(bool augments = false) const;
|
||||
int GetItemInt(bool augments = false) const;
|
||||
int GetItemWis(bool augments = false) const;
|
||||
int GetItemCha(bool augments = false) const;
|
||||
int GetItemMR(bool augments = false) const;
|
||||
int GetItemFR(bool augments = false) const;
|
||||
int GetItemCR(bool augments = false) const;
|
||||
int GetItemPR(bool augments = false) const;
|
||||
int GetItemDR(bool augments = false) const;
|
||||
int GetItemCorrup(bool augments = false) const;
|
||||
int GetItemHeroicStr(bool augments = false) const;
|
||||
int GetItemHeroicSta(bool augments = false) const;
|
||||
int GetItemHeroicDex(bool augments = false) const;
|
||||
int GetItemHeroicAgi(bool augments = false) const;
|
||||
int GetItemHeroicInt(bool augments = false) const;
|
||||
int GetItemHeroicWis(bool augments = false) const;
|
||||
int GetItemHeroicCha(bool augments = false) const;
|
||||
int GetItemHeroicMR(bool augments = false) const;
|
||||
int GetItemHeroicFR(bool augments = false) const;
|
||||
int GetItemHeroicCR(bool augments = false) const;
|
||||
int GetItemHeroicPR(bool augments = false) const;
|
||||
int GetItemHeroicDR(bool augments = false) const;
|
||||
int GetItemHeroicCorrup(bool augments = false) const;
|
||||
int GetItemHaste(bool augments = false) const;
|
||||
std::map<std::string, Timer>& GetTimers() { return m_timers; }
|
||||
void SetTimer(std::string name, uint32 time);
|
||||
void StopTimer(std::string name);
|
||||
void ClearTimers();
|
||||
|
||||
protected:
|
||||
//////////////////////////
|
||||
// Protected Members
|
||||
//////////////////////////
|
||||
std::map<uint8, ItemInst*>::const_iterator _cbegin() { return m_contents.cbegin(); }
|
||||
std::map<uint8, ItemInst*>::const_iterator _cend() { return m_contents.cend(); }
|
||||
// Get a total of a stat, including augs
|
||||
// These functions should be used in place of other code manually totaling
|
||||
// to centralize where it is done to make future changes easier (ex. whenever powersources come around)
|
||||
// and to minimize errors. CalcItemBonuses however doesn't use these in interest of performance
|
||||
// by default these do not recurse into augs
|
||||
int GetItemArmorClass(bool augments = false) const;
|
||||
int GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments = false) const;
|
||||
// These two differ in the fact that they're quick checks (they are checked BEFORE the one above
|
||||
int GetItemElementalFlag(bool augments = false) const;
|
||||
int GetItemElementalDamage(bool augments = false) const;
|
||||
int GetItemRecommendedLevel(bool augments = false) const;
|
||||
int GetItemRequiredLevel(bool augments = false) const;
|
||||
int GetItemWeaponDamage(bool augments = false) const;
|
||||
int GetItemBackstabDamage(bool augments = false) const;
|
||||
// these two are just quick checks
|
||||
int GetItemBaneDamageBody(bool augments = false) const;
|
||||
int GetItemBaneDamageRace(bool augments = false) const;
|
||||
int GetItemBaneDamageBody(bodyType against, bool augments = false) const;
|
||||
int GetItemBaneDamageRace(uint16 against, bool augments = false) const;
|
||||
int GetItemMagical(bool augments = false) const;
|
||||
int GetItemHP(bool augments = false) const;
|
||||
int GetItemMana(bool augments = false) const;
|
||||
int GetItemEndur(bool augments = false) const;
|
||||
int GetItemAttack(bool augments = false) const;
|
||||
int GetItemStr(bool augments = false) const;
|
||||
int GetItemSta(bool augments = false) const;
|
||||
int GetItemDex(bool augments = false) const;
|
||||
int GetItemAgi(bool augments = false) const;
|
||||
int GetItemInt(bool augments = false) const;
|
||||
int GetItemWis(bool augments = false) const;
|
||||
int GetItemCha(bool augments = false) const;
|
||||
int GetItemMR(bool augments = false) const;
|
||||
int GetItemFR(bool augments = false) const;
|
||||
int GetItemCR(bool augments = false) const;
|
||||
int GetItemPR(bool augments = false) const;
|
||||
int GetItemDR(bool augments = false) const;
|
||||
int GetItemCorrup(bool augments = false) const;
|
||||
int GetItemHeroicStr(bool augments = false) const;
|
||||
int GetItemHeroicSta(bool augments = false) const;
|
||||
int GetItemHeroicDex(bool augments = false) const;
|
||||
int GetItemHeroicAgi(bool augments = false) const;
|
||||
int GetItemHeroicInt(bool augments = false) const;
|
||||
int GetItemHeroicWis(bool augments = false) const;
|
||||
int GetItemHeroicCha(bool augments = false) const;
|
||||
int GetItemHeroicMR(bool augments = false) const;
|
||||
int GetItemHeroicFR(bool augments = false) const;
|
||||
int GetItemHeroicCR(bool augments = false) const;
|
||||
int GetItemHeroicPR(bool augments = false) const;
|
||||
int GetItemHeroicDR(bool augments = false) const;
|
||||
int GetItemHeroicCorrup(bool augments = false) const;
|
||||
int GetItemHaste(bool augments = false) const;
|
||||
|
||||
friend class Inventory;
|
||||
protected:
|
||||
//////////////////////////
|
||||
// Protected Members
|
||||
//////////////////////////
|
||||
std::map<uint8, ItemInstance*>::const_iterator _cbegin() { return m_contents.cbegin(); }
|
||||
std::map<uint8, ItemInstance*>::const_iterator _cend() { return m_contents.cend(); }
|
||||
|
||||
friend class Inventory;
|
||||
|
||||
|
||||
void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; }
|
||||
void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; }
|
||||
|
||||
ItemInstTypes m_use_type; // Usage type for item
|
||||
const EQEmu::ItemBase* m_item; // Ptr to item data
|
||||
int16 m_charges; // # of charges for chargeable items
|
||||
uint32 m_price; // Bazaar /trader price
|
||||
uint32 m_color;
|
||||
uint32 m_merchantslot;
|
||||
int16 m_currentslot;
|
||||
bool m_attuned;
|
||||
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
|
||||
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||
uint32 m_exp;
|
||||
int8 m_evolveLvl;
|
||||
bool m_activated;
|
||||
EQEmu::ItemBase* m_scaledItem;
|
||||
EvolveInfo* m_evolveInfo;
|
||||
bool m_scaling;
|
||||
uint32 m_ornamenticon;
|
||||
uint32 m_ornamentidfile;
|
||||
uint32 m_ornament_hero_model;
|
||||
uint32 m_recast_timestamp;
|
||||
ItemInstTypes m_use_type; // Usage type for item
|
||||
const ItemData* m_item; // Ptr to item data
|
||||
int16 m_charges; // # of charges for chargeable items
|
||||
uint32 m_price; // Bazaar /trader price
|
||||
uint32 m_color;
|
||||
uint32 m_merchantslot;
|
||||
int16 m_currentslot;
|
||||
bool m_attuned;
|
||||
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
|
||||
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||
uint32 m_exp;
|
||||
int8 m_evolveLvl;
|
||||
bool m_activated;
|
||||
ItemData* m_scaledItem;
|
||||
EvolveInfo* m_evolveInfo;
|
||||
bool m_scaling;
|
||||
uint32 m_ornamenticon;
|
||||
uint32 m_ornamentidfile;
|
||||
uint32 m_ornament_hero_model;
|
||||
uint32 m_recast_timestamp;
|
||||
|
||||
//
|
||||
// Items inside of this item (augs or contents);
|
||||
std::map<uint8, ItemInst*> m_contents; // Zero-based index: min=0, max=9
|
||||
std::map<std::string, std::string> m_custom_data;
|
||||
std::map<std::string, Timer> m_timers;
|
||||
};
|
||||
//
|
||||
// Items inside of this item (augs or contents);
|
||||
std::map<uint8, ItemInstance*> m_contents; // Zero-based index: min=0, max=9
|
||||
std::map<std::string, std::string> m_custom_data;
|
||||
std::map<std::string, Timer> m_timers;
|
||||
};
|
||||
}
|
||||
|
||||
class EvolveInfo {
|
||||
public:
|
||||
friend class ItemInst;
|
||||
friend class EQEmu::ItemInstance;
|
||||
//temporary
|
||||
uint16 LvlKills[9];
|
||||
uint32 FirstItem;
|
||||
@@ -541,4 +542,4 @@ public:
|
||||
~EvolveInfo();
|
||||
};
|
||||
|
||||
#endif /*COMMON_ITEM_H*/
|
||||
#endif /*COMMON_ITEM_INSTANCE_H*/
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace RoF
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot);
|
||||
@@ -596,7 +596,7 @@ namespace RoF
|
||||
ob.write((const char*)&item_count, sizeof(uint32));
|
||||
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -1533,7 +1533,7 @@ namespace RoF
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -5209,9 +5209,9 @@ namespace RoF
|
||||
return NextItemInstSerialNumber;
|
||||
}
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
RoF::structs::ItemSerializationHeader hdr;
|
||||
|
||||
@@ -5623,7 +5623,7 @@ namespace RoF
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace RoF2
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot, ItemPacketType PacketType = ItemPacketInvalid);
|
||||
@@ -671,7 +671,7 @@ namespace RoF2
|
||||
ob.write((const char*)&item_count, sizeof(uint32));
|
||||
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -1609,7 +1609,7 @@ namespace RoF2
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -5499,9 +5499,9 @@ namespace RoF2
|
||||
return NextItemInstSerialNumber;
|
||||
}
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type)
|
||||
{
|
||||
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
RoF2::structs::ItemSerializationHeader hdr;
|
||||
|
||||
@@ -5923,7 +5923,7 @@ namespace RoF2
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -2423,7 +2423,7 @@ struct AdventureLeaderboard_Struct
|
||||
/*struct Item_Shop_Struct {
|
||||
uint16 merchantid;
|
||||
uint8 itemtype;
|
||||
ItemBase item;
|
||||
ItemData item;
|
||||
uint8 iss_unknown001[6];
|
||||
};*/
|
||||
|
||||
|
||||
@@ -2450,7 +2450,7 @@ struct AdventureLeaderboard_Struct
|
||||
/*struct Item_Shop_Struct {
|
||||
uint16 merchantid;
|
||||
uint8 itemtype;
|
||||
ItemBase item;
|
||||
ItemData item;
|
||||
uint8 iss_unknown001[6];
|
||||
};*/
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace SoD
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline uint32 ServerToSoDSlot(uint32 ServerSlot);
|
||||
@@ -396,7 +396,7 @@ namespace SoD
|
||||
ob.write((const char*)&item_count, sizeof(uint32));
|
||||
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -1060,7 +1060,7 @@ namespace SoD
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -3553,9 +3553,9 @@ namespace SoD
|
||||
return NextItemInstSerialNumber;
|
||||
}
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
SoD::structs::ItemSerializationHeader hdr;
|
||||
|
||||
@@ -3870,7 +3870,7 @@ namespace SoD
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1970,7 +1970,7 @@ struct AdventureLeaderboard_Struct
|
||||
/*struct Item_Shop_Struct {
|
||||
uint16 merchantid;
|
||||
uint8 itemtype;
|
||||
ItemBase item;
|
||||
ItemData item;
|
||||
uint8 iss_unknown001[6];
|
||||
};*/
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace SoF
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline uint32 ServerToSoFSlot(uint32 serverSlot);
|
||||
@@ -378,7 +378,7 @@ namespace SoF
|
||||
ob.write((const char*)&item_count, sizeof(uint32));
|
||||
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -857,7 +857,7 @@ namespace SoF
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -2923,9 +2923,9 @@ namespace SoF
|
||||
return NextItemInstSerialNumber;
|
||||
}
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
SoF::structs::ItemSerializationHeader hdr;
|
||||
|
||||
@@ -3238,7 +3238,7 @@ namespace SoF
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Titanium
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline int16 ServerToTitaniumSlot(uint32 serverSlot);
|
||||
@@ -329,7 +329,7 @@ namespace Titanium
|
||||
EQEmu::OutBuffer::pos_type last_pos = ob.tellp();
|
||||
|
||||
for (int r = 0; r < itemcount; r++, eq++) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -815,7 +815,7 @@ namespace Titanium
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -2216,10 +2216,10 @@ namespace Titanium
|
||||
}
|
||||
|
||||
// file scope helper methods
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const char* protection = "\\\\\\\\\\";
|
||||
const EQEmu::ItemBase* item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData* item = inst->GetUnscaledItem();
|
||||
|
||||
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
|
||||
|
||||
@@ -2440,7 +2440,7 @@ namespace Titanium
|
||||
for (int index = SUB_INDEX_BEGIN; index < invbag::ItemBagSize; ++index) {
|
||||
ob << '|';
|
||||
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace UF
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline uint32 ServerToUFSlot(uint32 serverSlot);
|
||||
@@ -541,7 +541,7 @@ namespace UF
|
||||
ob.write((const char*)&item_count, sizeof(uint32));
|
||||
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -1293,7 +1293,7 @@ namespace UF
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -3847,9 +3847,9 @@ namespace UF
|
||||
return NextItemInstSerialNumber;
|
||||
}
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
UF::structs::ItemSerializationHeader hdr;
|
||||
|
||||
@@ -3893,7 +3893,7 @@ namespace UF
|
||||
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
|
||||
uint16 ornaIcon = 0;
|
||||
if (inst->GetOrnamentationAug(ornamentationAugtype)) {
|
||||
const EQEmu::ItemBase *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
|
||||
const EQEmu::ItemData *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
|
||||
ornaIcon = aug_weap->Icon;
|
||||
|
||||
ob.write(aug_weap->IDFile, strlen(aug_weap->IDFile));
|
||||
@@ -4225,7 +4225,7 @@ namespace UF
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -2011,7 +2011,7 @@ struct AdventureLeaderboard_Struct
|
||||
/*struct Item_Shop_Struct {
|
||||
uint16 merchantid;
|
||||
uint8 itemtype;
|
||||
ItemBase item;
|
||||
ItemData item;
|
||||
uint8 iss_unknown001[6];
|
||||
};*/
|
||||
|
||||
|
||||
+2
-2
@@ -147,7 +147,7 @@ void EQEmu::SayLinkEngine::generate_body()
|
||||
|
||||
memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct));
|
||||
|
||||
const EQEmu::ItemBase* item_data = nullptr;
|
||||
const EQEmu::ItemData* item_data = nullptr;
|
||||
|
||||
switch (m_LinkType) {
|
||||
case saylink::SayLinkBlank:
|
||||
@@ -250,7 +250,7 @@ void EQEmu::SayLinkEngine::generate_text()
|
||||
return;
|
||||
}
|
||||
|
||||
const EQEmu::ItemBase* item_data = nullptr;
|
||||
const EQEmu::ItemData* item_data = nullptr;
|
||||
|
||||
switch (m_LinkType) {
|
||||
case saylink::SayLinkBlank:
|
||||
|
||||
+6
-6
@@ -26,11 +26,11 @@
|
||||
|
||||
|
||||
struct ServerLootItem_Struct;
|
||||
class ItemInst;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
struct ItemBase;
|
||||
struct ItemData;
|
||||
class ItemInstance;
|
||||
struct SayLinkBody_Struct;
|
||||
|
||||
namespace saylink {
|
||||
@@ -67,9 +67,9 @@ namespace EQEmu
|
||||
SayLinkEngine();
|
||||
|
||||
void SetLinkType(saylink::SayLinkType link_type) { m_LinkType = link_type; }
|
||||
void SetItemData(const EQEmu::ItemBase* item_data) { m_ItemData = item_data; }
|
||||
void SetItemData(const EQEmu::ItemData* item_data) { m_ItemData = item_data; }
|
||||
void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_data; }
|
||||
void SetItemInst(const ItemInst* item_inst) { m_ItemInst = item_inst; }
|
||||
void SetItemInst(const ItemInstance* item_inst) { m_ItemInst = item_inst; }
|
||||
|
||||
// mainly for saylinks..but, not limited to
|
||||
void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; }
|
||||
@@ -103,9 +103,9 @@ namespace EQEmu
|
||||
void generate_text();
|
||||
|
||||
int m_LinkType;
|
||||
const ItemBase* m_ItemData;
|
||||
const ItemData* m_ItemData;
|
||||
const ServerLootItem_Struct* m_LootData;
|
||||
const ItemInst* m_ItemInst;
|
||||
const ItemInstance* m_ItemInst;
|
||||
|
||||
uint8 m_Proxy_unknown_1;
|
||||
uint32 m_ProxyItemID;
|
||||
|
||||
+37
-37
@@ -99,7 +99,7 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
|
||||
return EntitledTime;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iterator &start, std::list<ItemInst*>::const_iterator &end)
|
||||
bool SharedDatabase::SaveCursor(uint32 char_id, std::list<EQEmu::ItemInstance*>::const_iterator &start, std::list<EQEmu::ItemInstance*>::const_iterator &end)
|
||||
{
|
||||
// Delete cursor items
|
||||
std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i "
|
||||
@@ -116,7 +116,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iter
|
||||
int i = 8000;
|
||||
for(auto it = start; it != end; ++it, i++) {
|
||||
if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high
|
||||
ItemInst *inst = *it;
|
||||
EQEmu::ItemInstance *inst = *it;
|
||||
int16 use_slot = (i == 8000) ? EQEmu::legacy::SlotCursor : i;
|
||||
if (!SaveInventory(char_id, inst, use_slot)) {
|
||||
return false;
|
||||
@@ -126,7 +126,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iter
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst)
|
||||
bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst)
|
||||
{
|
||||
// Delete cursor items
|
||||
std::string query = StringFormat("SELECT itemid, charges FROM sharedbank "
|
||||
@@ -159,7 +159,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id) {
|
||||
bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) {
|
||||
|
||||
//never save tribute slots:
|
||||
if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END)
|
||||
@@ -189,13 +189,13 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
|
||||
return UpdateInventorySlot(char_id, inst, slot_id);
|
||||
}
|
||||
|
||||
bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) {
|
||||
bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) {
|
||||
// need to check 'inst' argument for valid pointer
|
||||
|
||||
uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 };
|
||||
if (inst->IsClassCommon()) {
|
||||
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
|
||||
ItemInst *auginst = inst->GetItem(i);
|
||||
EQEmu::ItemInstance *auginst = inst->GetItem(i);
|
||||
augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
|
||||
// Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID'
|
||||
// messages through attrition (and the modded code in SaveInventory)
|
||||
for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) {
|
||||
const ItemInst* baginst = inst->GetItem(idx);
|
||||
const EQEmu::ItemInstance* baginst = inst->GetItem(idx);
|
||||
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
|
||||
}
|
||||
|
||||
@@ -236,13 +236,13 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) {
|
||||
bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) {
|
||||
// need to check 'inst' argument for valid pointer
|
||||
|
||||
uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 };
|
||||
if (inst->IsClassCommon()) {
|
||||
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
|
||||
ItemInst *auginst = inst->GetItem(i);
|
||||
EQEmu::ItemInstance *auginst = inst->GetItem(i);
|
||||
augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0;
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst,
|
||||
// Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID'
|
||||
// messages through attrition (and the modded code in SaveInventory)
|
||||
for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) {
|
||||
const ItemInst* baginst = inst->GetItem(idx);
|
||||
const EQEmu::ItemInstance* baginst = inst->GetItem(idx);
|
||||
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
|
||||
|
||||
bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) {
|
||||
|
||||
const EQEmu::ItemBase* myitem;
|
||||
const EQEmu::ItemData* myitem;
|
||||
|
||||
std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items "
|
||||
"WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND "
|
||||
@@ -385,7 +385,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv,
|
||||
if(!myitem)
|
||||
continue;
|
||||
|
||||
ItemInst* myinst = CreateBaseItem(myitem, charges);
|
||||
EQEmu::ItemInstance* myinst = CreateBaseItem(myitem, charges);
|
||||
|
||||
if(slot < 0)
|
||||
slot = inv->FindFreeSlot(0, 0);
|
||||
@@ -436,7 +436,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
|
||||
aug[4] = (uint32)atoi(row[7]);
|
||||
aug[5] = (uint32)atoi(row[8]);
|
||||
|
||||
const EQEmu::ItemBase *item = GetItem(item_id);
|
||||
const EQEmu::ItemData *item = GetItem(item_id);
|
||||
|
||||
if (!item) {
|
||||
Log.Out(Logs::General, Logs::Error,
|
||||
@@ -447,7 +447,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
|
||||
|
||||
int16 put_slot_id = INVALID_INDEX;
|
||||
|
||||
ItemInst *inst = CreateBaseItem(item, charges);
|
||||
EQEmu::ItemInstance *inst = CreateBaseItem(item, charges);
|
||||
if (inst && item->IsClassCommon()) {
|
||||
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
|
||||
if (aug[i])
|
||||
@@ -539,7 +539,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
|
||||
uint32 ornament_idfile = (uint32)atoul(row[13]);
|
||||
uint32 ornament_hero_model = (uint32)atoul(row[14]);
|
||||
|
||||
const EQEmu::ItemBase *item = GetItem(item_id);
|
||||
const EQEmu::ItemData *item = GetItem(item_id);
|
||||
|
||||
if (!item) {
|
||||
Log.Out(Logs::General, Logs::Error,
|
||||
@@ -550,7 +550,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
|
||||
|
||||
int16 put_slot_id = INVALID_INDEX;
|
||||
|
||||
ItemInst *inst = CreateBaseItem(item, charges);
|
||||
EQEmu::ItemInstance *inst = CreateBaseItem(item, charges);
|
||||
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
@@ -679,12 +679,12 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
|
||||
uint32 ornament_idfile = (uint32)atoul(row[13]);
|
||||
uint32 ornament_hero_model = (uint32)atoul(row[14]);
|
||||
|
||||
const EQEmu::ItemBase *item = GetItem(item_id);
|
||||
const EQEmu::ItemData *item = GetItem(item_id);
|
||||
int16 put_slot_id = INVALID_INDEX;
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
ItemInst *inst = CreateBaseItem(item, charges);
|
||||
EQEmu::ItemInstance *inst = CreateBaseItem(item, charges);
|
||||
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
@@ -816,7 +816,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
|
||||
items_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
||||
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
|
||||
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemData>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemData>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
Log.Out(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what());
|
||||
@@ -828,7 +828,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
|
||||
void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id)
|
||||
{
|
||||
EQEmu::FixedMemoryHashSet<EQEmu::ItemBase> hash(reinterpret_cast<uint8 *>(data), size, items, max_item_id);
|
||||
EQEmu::FixedMemoryHashSet<EQEmu::ItemData> hash(reinterpret_cast<uint8 *>(data), size, items, max_item_id);
|
||||
|
||||
std::string ndbuffer;
|
||||
bool disableNoRent = false;
|
||||
@@ -856,7 +856,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::ItemBase item;
|
||||
EQEmu::ItemData item;
|
||||
|
||||
const std::string query = "SELECT source,"
|
||||
#define F(x) "`"#x"`,"
|
||||
@@ -869,7 +869,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
memset(&item, 0, sizeof(EQEmu::ItemBase));
|
||||
memset(&item, 0, sizeof(EQEmu::ItemData));
|
||||
|
||||
item.ItemClass = (uint8)atoi(row[ItemField::itemclass]);
|
||||
strcpy(item.Name, row[ItemField::name]);
|
||||
@@ -1086,7 +1086,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
}
|
||||
}
|
||||
|
||||
const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) {
|
||||
const EQEmu::ItemData* SharedDatabase::GetItem(uint32 id) {
|
||||
if (id == 0)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -1105,7 +1105,7 @@ const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const EQEmu::ItemBase* SharedDatabase::IterateItems(uint32* id) {
|
||||
const EQEmu::ItemData* SharedDatabase::IterateItems(uint32* id) {
|
||||
if(!items_hash || !id) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1250,18 +1250,18 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Create appropriate ItemInst class
|
||||
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
|
||||
// Create appropriate EQEmu::ItemInstance class
|
||||
EQEmu::ItemInstance* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
|
||||
{
|
||||
const EQEmu::ItemBase* item = nullptr;
|
||||
ItemInst* inst = nullptr;
|
||||
const EQEmu::ItemData* item = nullptr;
|
||||
EQEmu::ItemInstance* inst = nullptr;
|
||||
|
||||
item = GetItem(item_id);
|
||||
if (item) {
|
||||
inst = CreateBaseItem(item, charges);
|
||||
|
||||
if (inst == nullptr) {
|
||||
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
|
||||
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()");
|
||||
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1279,15 +1279,15 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
|
||||
}
|
||||
|
||||
|
||||
// Create appropriate ItemInst class
|
||||
ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
|
||||
// Create appropriate EQEmu::ItemInstance class
|
||||
EQEmu::ItemInstance* SharedDatabase::CreateItem(const EQEmu::ItemData* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
|
||||
{
|
||||
ItemInst* inst = nullptr;
|
||||
EQEmu::ItemInstance* inst = nullptr;
|
||||
if (item) {
|
||||
inst = CreateBaseItem(item, charges);
|
||||
|
||||
if (inst == nullptr) {
|
||||
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
|
||||
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()");
|
||||
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1304,8 +1304,8 @@ ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges,
|
||||
return inst;
|
||||
}
|
||||
|
||||
ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 charges) {
|
||||
ItemInst* inst = nullptr;
|
||||
EQEmu::ItemInstance* SharedDatabase::CreateBaseItem(const EQEmu::ItemData* item, int16 charges) {
|
||||
EQEmu::ItemInstance* inst = nullptr;
|
||||
if (item) {
|
||||
// if maxcharges is -1 that means it is an unlimited use item.
|
||||
// set it to 1 charge so that it is usable on creation
|
||||
@@ -1315,10 +1315,10 @@ ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 char
|
||||
if(charges <= 0 && item->Stackable)
|
||||
charges = 1;
|
||||
|
||||
inst = new ItemInst(item, charges);
|
||||
inst = new EQEmu::ItemInstance(item, charges);
|
||||
|
||||
if (inst == nullptr) {
|
||||
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()");
|
||||
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateBaseItem()");
|
||||
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
+13
-13
@@ -34,7 +34,6 @@
|
||||
|
||||
class EvolveInfo;
|
||||
class Inventory;
|
||||
class ItemInst;
|
||||
struct BaseDataStruct;
|
||||
struct InspectMessage_Struct;
|
||||
struct PlayerProfile_Struct;
|
||||
@@ -45,7 +44,8 @@ struct LootDrop_Struct;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
struct ItemBase;
|
||||
struct ItemData;
|
||||
class ItemInstance;
|
||||
class MemoryMappedFile;
|
||||
}
|
||||
|
||||
@@ -76,13 +76,13 @@ class SharedDatabase : public Database
|
||||
/*
|
||||
Character Inventory
|
||||
*/
|
||||
bool SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iterator &start, std::list<ItemInst*>::const_iterator &end);
|
||||
bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id);
|
||||
bool SaveCursor(uint32 char_id, std::list<EQEmu::ItemInstance*>::const_iterator &start, std::list<EQEmu::ItemInstance*>::const_iterator &end);
|
||||
bool SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id);
|
||||
bool DeleteSharedBankSlot(uint32 char_id, int16 slot_id);
|
||||
bool DeleteInventorySlot(uint32 char_id, int16 slot_id);
|
||||
bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id);
|
||||
bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id);
|
||||
bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst);
|
||||
bool UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id);
|
||||
bool UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id);
|
||||
bool VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst);
|
||||
bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid);
|
||||
int32 GetSharedPlatinum(uint32 account_id);
|
||||
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
||||
@@ -99,9 +99,9 @@ class SharedDatabase : public Database
|
||||
/*
|
||||
Item Methods
|
||||
*/
|
||||
ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
|
||||
ItemInst* CreateItem(const EQEmu::ItemBase* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
|
||||
ItemInst* CreateBaseItem(const EQEmu::ItemBase* item, int16 charges = 0);
|
||||
EQEmu::ItemInstance* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
|
||||
EQEmu::ItemInstance* CreateItem(const EQEmu::ItemData* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
|
||||
EQEmu::ItemInstance* CreateBaseItem(const EQEmu::ItemData* item, int16 charges = 0);
|
||||
|
||||
/*
|
||||
Shared Memory crap
|
||||
@@ -111,8 +111,8 @@ class SharedDatabase : public Database
|
||||
void GetItemsCount(int32 &item_count, uint32 &max_id);
|
||||
void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id);
|
||||
bool LoadItems(const std::string &prefix);
|
||||
const EQEmu::ItemBase* IterateItems(uint32* id);
|
||||
const EQEmu::ItemBase* GetItem(uint32 id);
|
||||
const EQEmu::ItemData* IterateItems(uint32* id);
|
||||
const EQEmu::ItemData* GetItem(uint32 id);
|
||||
const EvolveInfo* GetEvolveInfo(uint32 loregroup);
|
||||
|
||||
//faction lists
|
||||
@@ -149,7 +149,7 @@ class SharedDatabase : public Database
|
||||
|
||||
std::unique_ptr<EQEmu::MemoryMappedFile> skill_caps_mmf;
|
||||
std::unique_ptr<EQEmu::MemoryMappedFile> items_mmf;
|
||||
std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>> items_hash;
|
||||
std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemData>> items_hash;
|
||||
std::unique_ptr<EQEmu::MemoryMappedFile> faction_mmf;
|
||||
std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>> faction_hash;
|
||||
std::unique_ptr<EQEmu::MemoryMappedFile> loot_table_mmf;
|
||||
|
||||
Reference in New Issue
Block a user