Renamed class Inventory to EQEmu::InventoryProfile

This commit is contained in:
Uleat
2016-10-17 04:59:00 -04:00
parent 1cb79c8c1f
commit 04f4fd652b
33 changed files with 586 additions and 573 deletions
+1 -1
View File
@@ -672,7 +672,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
}
/* This only for new Character creation storing */
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv) {
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) {
uint32 charid = 0;
char zone[50];
float x, y, z;
+6 -2
View File
@@ -37,10 +37,14 @@
//atoi is not uint32 or uint32 safe!!!!
#define atoul(str) strtoul(str, nullptr, 10)
class Inventory;
class MySQLRequestResult;
class Client;
namespace EQEmu
{
class InventoryProfile;
}
struct EventLogDetails_Struct {
uint32 id;
char accountname[64];
@@ -109,7 +113,7 @@ public:
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv);
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
bool UpdateName(const char* oldname, const char* newname);
/* General Information Queries */
File diff suppressed because it is too large Load Diff
+117 -114
View File
@@ -73,156 +73,159 @@ protected:
};
// ########################################
// Class: Inventory
// Class: EQEmu::InventoryProfile
// Character inventory
class Inventory
namespace EQEmu
{
friend class EQEmu::ItemInstance;
public:
///////////////////////////////
// Public Methods
///////////////////////////////
Inventory() { m_inventory_version = EQEmu::versions::InventoryVersion::Unknown; m_inventory_version_set = false; }
~Inventory();
class InventoryProfile
{
friend class ItemInstance;
public:
///////////////////////////////
// Public Methods
///////////////////////////////
// inv2 creep
bool SetInventoryVersion(EQEmu::versions::InventoryVersion inventory_version) {
if (!m_inventory_version_set) {
m_inventory_version = EQEmu::versions::ValidateInventoryVersion(inventory_version);
return (m_inventory_version_set = true);
InventoryProfile() { m_inventory_version = versions::InventoryVersion::Unknown; m_inventory_version_set = false; }
~InventoryProfile();
// inv2 creep
bool SetInventoryVersion(versions::InventoryVersion inventory_version) {
if (!m_inventory_version_set) {
m_inventory_version = versions::ValidateInventoryVersion(inventory_version);
return (m_inventory_version_set = true);
}
else {
return false;
}
}
else {
return false;
}
}
bool SetInventoryVersion(EQEmu::versions::ClientVersion client_version) { return SetInventoryVersion(EQEmu::versions::ConvertClientVersionToInventoryVersion(client_version)); }
bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToInventoryVersion(client_version)); }
EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; }
versions::InventoryVersion InventoryVersion() { return m_inventory_version; }
static void CleanDirty();
static void MarkDirty(EQEmu::ItemInstance *inst);
static void CleanDirty();
static void MarkDirty(ItemInstance *inst);
// Retrieve a writeable item at specified slot
EQEmu::ItemInstance* GetItem(int16 slot_id) const;
EQEmu::ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const;
// Retrieve a writeable item at specified slot
ItemInstance* GetItem(int16 slot_id) const;
ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const;
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 std::list<ItemInstance*>::const_iterator cursor_cbegin() { return m_cursor.cbegin(); }
inline std::list<ItemInstance*>::const_iterator cursor_cend() { return m_cursor.cend(); }
inline int CursorSize() { return m_cursor.size(); }
inline bool CursorEmpty() { return m_cursor.empty(); }
inline int CursorSize() { return m_cursor.size(); }
inline bool CursorEmpty() { return m_cursor.empty(); }
// Retrieve a read-only item from inventory
inline const EQEmu::ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); }
// Retrieve a read-only item from inventory
inline const ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); }
// Add item to inventory
int16 PutItem(int16 slot_id, const EQEmu::ItemInstance& inst);
// Add item to inventory
int16 PutItem(int16 slot_id, const ItemInstance& inst);
// Add item to cursor queue
int16 PushCursor(const EQEmu::ItemInstance& inst);
// Add item to cursor queue
int16 PushCursor(const ItemInstance& inst);
// Get cursor item in front of queue
EQEmu::ItemInstance* GetCursorItem();
// Get cursor item in front of queue
ItemInstance* GetCursorItem();
// Swap items in inventory
bool SwapItem(int16 slot_a, int16 slot_b);
// Swap items in inventory
bool SwapItem(int16 slot_a, int16 slot_b);
// Remove item from inventory
bool DeleteItem(int16 slot_id, uint8 quantity=0);
// Remove item from inventory
bool DeleteItem(int16 slot_id, uint8 quantity = 0);
// Checks All items in a bag for No Drop
bool CheckNoDrop(int16 slot_id);
// Checks All items in a bag for No Drop
bool CheckNoDrop(int16 slot_id);
// Remove item from inventory (and take control of memory)
EQEmu::ItemInstance* PopItem(int16 slot_id);
// Remove item from inventory (and take control of memory)
ItemInstance* PopItem(int16 slot_id);
// Check whether there is space for the specified number of the specified item.
bool HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity);
// Check whether there is space for the specified number of the specified item.
bool HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByUse(uint8 use, uint8 quantity = 0, uint8 where = 0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByLoreGroup(uint32 loregroup, uint8 where = 0xFF);
// Locate an available inventory slot
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
int16 FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst);
// Locate an available inventory slot
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
int16 FindFreeSlotForTradeItem(const ItemInstance* inst);
// Calculate slot_id for an item within a bag
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag
static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id
static int16 CalcSlotFromMaterial(uint8 material);
static uint8 CalcMaterialFromSlot(int16 equipslot);
// Calculate slot_id for an item within a bag
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag
static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id
static int16 CalcSlotFromMaterial(uint8 material);
static uint8 CalcMaterialFromSlot(int16 equipslot);
static bool CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container);
static bool CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container);
// Test for valid inventory casting slot
bool SupportsClickCasting(int16 slot_id);
bool SupportsPotionBeltCasting(int16 slot_id);
// Test for valid inventory casting slot
bool SupportsClickCasting(int16 slot_id);
bool SupportsPotionBeltCasting(int16 slot_id);
// Test whether a given slot can support a container item
static bool SupportsContainers(int16 slot_id);
// Test whether a given slot can support a container item
static bool SupportsContainers(int16 slot_id);
int GetSlotByItemInst(EQEmu::ItemInstance *inst);
int GetSlotByItemInst(ItemInstance *inst);
uint8 FindBrightestLightType();
uint8 FindBrightestLightType();
void dumpEntireInventory();
void dumpWornItems();
void dumpInventory();
void dumpBankItems();
void dumpSharedBankItems();
void dumpEntireInventory();
void dumpWornItems();
void dumpInventory();
void dumpBankItems();
void dumpSharedBankItems();
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
protected:
///////////////////////////////
// Protected Methods
///////////////////////////////
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
protected:
///////////////////////////////
// Protected Methods
///////////////////////////////
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);
int GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst);
void dumpItemCollection(const std::map<int16, ItemInstance*> &collection);
void dumpBagContents(ItemInstance *inst, std::map<int16, ItemInstance*>::const_iterator *it);
// Retrieves item within an inventory bucket
EQEmu::ItemInstance* _GetItem(const std::map<int16, EQEmu::ItemInstance*>& bucket, int16 slot_id) const;
// Retrieves item within an inventory bucket
ItemInstance* _GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const;
// Private "put" item into bucket, without regard for what is currently in bucket
int16 _PutItem(int16 slot_id, EQEmu::ItemInstance* inst);
// Private "put" item into bucket, without regard for what is currently in bucket
int16 _PutItem(int16 slot_id, ItemInstance* inst);
// Checks an inventory bucket for a particular item
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, EQEmu::ItemInstance*>& bucket, uint8 use, uint8 quantity);
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
int16 _HasItemByLoreGroup(std::map<int16, EQEmu::ItemInstance*>& bucket, uint32 loregroup);
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
// Checks an inventory bucket for a particular item
int16 _HasItem(std::map<int16, ItemInstance*>& bucket, uint32 item_id, uint8 quantity);
int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity);
int16 _HasItemByUse(std::map<int16, ItemInstance*>& bucket, uint8 use, uint8 quantity);
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
int16 _HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup);
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
// Player inventory
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
// Player inventory
std::map<int16, ItemInstance*> m_worn; // Items worn by character
std::map<int16, ItemInstance*> m_inv; // Items in character personal inventory
std::map<int16, ItemInstance*> m_bank; // Items in character bank
std::map<int16, ItemInstance*> m_shbank; // Items in character shared bank
std::map<int16, ItemInstance*> m_trade; // Items in a trade session
::ItemInstQueue m_cursor; // Items on cursor: FIFO
private:
// Active inventory version
EQEmu::versions::InventoryVersion m_inventory_version;
bool m_inventory_version_set;
};
private:
// Active inventory version
versions::InventoryVersion m_inventory_version;
bool m_inventory_version_set;
};
}
#endif /*COMMON_INVENTORY_PROFILE_H*/
+69 -69
View File
@@ -207,12 +207,12 @@ EQEmu::ItemInstance::~ItemInstance()
}
// Query item type
bool EQEmu::ItemInstance::IsType(EQEmu::item::ItemClass item_class) const
bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const
{
// IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr'
// Check usage type
if ((m_use_type == ItemInstWorldContainer) && (item_class == EQEmu::item::ItemClassBag))
if ((m_use_type == ItemInstWorldContainer) && (item_class == item::ItemClassBag))
return true;
if (!m_item)
@@ -273,8 +273,8 @@ bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const
// another "shouldn't do" fix..will be fixed in future updates (requires code and database work)
int16 use_slot = INVALID_INDEX;
if (slot_id == EQEmu::inventory::slotPowerSource) { use_slot = EQEmu::inventory::slotGeneral1; }
if ((uint16)slot_id <= EQEmu::legacy::EQUIPMENT_END) { use_slot = slot_id; }
if (slot_id == inventory::slotPowerSource) { use_slot = inventory::slotGeneral1; }
if ((uint16)slot_id <= legacy::EQUIPMENT_END) { use_slot = slot_id; }
if (use_slot != INVALID_INDEX) {
if (m_item->Slots & (1 << use_slot))
@@ -289,7 +289,7 @@ bool EQEmu::ItemInstance::IsAugmentable() const
if (!m_item)
return false;
for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) {
for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) {
if (m_item->AugSlotType[index] != 0)
return true;
}
@@ -303,8 +303,8 @@ bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
if (!m_item || !m_item->IsClassCommon())
return false;
int index = EQEmu::legacy::EQUIPMENT_BEGIN;
for (; index <= EQEmu::inventory::slotGeneral1; ++index) { // MainGeneral1 should be EQEmu::legacy::EQUIPMENT_END
int index = legacy::EQUIPMENT_BEGIN;
for (; index <= inventory::slotGeneral1; ++index) { // MainGeneral1 should be legacy::EQUIPMENT_END
if (m_item->Slots & (1 << index)) {
if (aug_wear_slots & (1 << index))
break;
@@ -319,14 +319,14 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
if (!m_item || !m_item->IsClassCommon())
return INVALID_INDEX;
int index = EQEmu::inventory::socketBegin;
for (; index < EQEmu::inventory::SocketCount; ++index) {
int index = inventory::socketBegin;
for (; index < inventory::SocketCount; ++index) {
if (GetItem(index)) { continue; }
if (augtype == -1 || (m_item->AugSlotType[index] && ((1 << (m_item->AugSlotType[index] - 1)) & augtype)))
break;
}
return (index < EQEmu::inventory::SocketCount) ? index : INVALID_INDEX;
return (index < inventory::SocketCount) ? index : INVALID_INDEX;
}
bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const
@@ -416,7 +416,7 @@ void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is
continue;
}
const EQEmu::ItemData* item = inst->GetItem();
const ItemData* item = inst->GetItem();
if (item == nullptr) {
cur = m_contents.erase(cur);
continue;
@@ -469,7 +469,7 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const
return INVALID_INDEX;
uint8 slots = m_item->BagSlots, i;
for (i = EQEmu::inventory::containerBegin; i < slots; i++) {
for (i = inventory::containerBegin; i < slots; i++) {
if (!GetItem(i))
break;
}
@@ -486,7 +486,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const
if (m_item && !m_item->IsClassBag()) { return item_count; }
for (int index = EQEmu::inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } }
for (int index = inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } }
return item_count;
}
@@ -496,7 +496,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer()
if (!m_item || !m_item->IsClassBag())
return false;
for (int index = EQEmu::inventory::containerBegin; index < m_item->BagSlots; ++index) {
for (int index = inventory::containerBegin; index < m_item->BagSlots; ++index) {
if (GetItem(index))
return true;
}
@@ -518,7 +518,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio
if (!m_item || !m_item->IsClassCommon()) { return nullptr; }
if (ornamentationAugtype == 0) { return nullptr; }
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++)
for (int i = inventory::socketBegin; i < inventory::SocketCount; i++)
{
if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype)
{
@@ -587,10 +587,10 @@ bool EQEmu::ItemInstance::UpdateOrnamentationInfo() {
return ornamentSet;
}
bool EQEmu::ItemInstance::CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll) {
bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) {
if (!ItemToTry || !Container) return false;
if (ItemToTry->ItemType == EQEmu::item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0)
if (ItemToTry->ItemType == item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0)
return false;
if (AllowAll && strncasecmp(Container->CharmFile, "ITEMTRANSFIGSHIELD", 18) && strncasecmp(Container->CharmFile, "ITEMTransfigBow", 15)) {
@@ -685,7 +685,7 @@ bool EQEmu::ItemInstance::IsAugmented()
if (!m_item || !m_item->IsClassCommon())
return false;
for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) {
for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) {
if (GetAugmentItemID(index))
return true;
}
@@ -699,7 +699,7 @@ bool EQEmu::ItemInstance::IsWeapon() const
if (!m_item || !m_item->IsClassCommon())
return false;
if (m_item->ItemType == EQEmu::item::ItemTypeArrow && m_item->Damage != 0)
if (m_item->ItemType == item::ItemTypeArrow && m_item->Damage != 0)
return true;
else
return ((m_item->Damage != 0) && (m_item->Delay != 0));
@@ -710,9 +710,9 @@ bool EQEmu::ItemInstance::IsAmmo() const
if (!m_item)
return false;
if ((m_item->ItemType == EQEmu::item::ItemTypeArrow) ||
(m_item->ItemType == EQEmu::item::ItemTypeLargeThrowing) ||
(m_item->ItemType == EQEmu::item::ItemTypeSmallThrowing)
if ((m_item->ItemType == item::ItemTypeArrow) ||
(m_item->ItemType == item::ItemTypeLargeThrowing) ||
(m_item->ItemType == item::ItemTypeSmallThrowing)
) {
return true;
}
@@ -811,10 +811,10 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::Clone() const
bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const {
// 'SupportsContainers' and 'slot_id > 21' previously saw the reassigned PowerSource slot (9999 to 22) as valid
if (!m_item) { return false; }
else if (Inventory::SupportsContainers(slot_id)) { return true; }
else if (InventoryProfile::SupportsContainers(slot_id)) { return true; }
else if (m_item->Slots & (1 << slot_id)) { return true; }
else if (slot_id == EQEmu::inventory::slotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... <watch>
else if (slot_id != EQEmu::inventory::slotPowerSource && slot_id > EQEmu::legacy::EQUIPMENT_END) { return true; }
else if (slot_id == inventory::slotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... <watch>
else if (slot_id != inventory::slotPowerSource && slot_id > legacy::EQUIPMENT_END) { return true; }
else { return false; }
}
@@ -966,7 +966,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const
if (item) {
ac = item->AC;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
ac += GetAugment(i)->GetItemArmorClass();
}
@@ -1008,7 +1008,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold
}
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
GetAugment(i)->GetItemElementalDamage(magic, fire, cold, poison, disease, chromatic, prismatic, physical, corruption);
}
@@ -1025,7 +1025,7 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const
return flag;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) {
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) {
if (GetAugment(i))
flag = GetAugment(i)->GetItemElementalFlag();
if (flag)
@@ -1046,7 +1046,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const
return damage;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) {
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) {
if (GetAugment(i))
damage = GetAugment(i)->GetItemElementalDamage();
if (damage)
@@ -1065,7 +1065,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const
level = item->RecLevel;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) {
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) {
int temp = 0;
if (GetAugment(i)) {
temp = GetAugment(i)->GetItemRecommendedLevel();
@@ -1087,7 +1087,7 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const
level = item->ReqLevel;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) {
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) {
int temp = 0;
if (GetAugment(i)) {
temp = GetAugment(i)->GetItemRequiredLevel();
@@ -1109,7 +1109,7 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const
damage = item->Damage;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
damage += GetAugment(i)->GetItemWeaponDamage();
}
@@ -1125,7 +1125,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const
damage = item->BackstabDmg;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
damage += GetAugment(i)->GetItemBackstabDamage();
}
@@ -1143,7 +1143,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const
return body;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i)) {
body = GetAugment(i)->GetItemBaneDamageBody();
if (body)
@@ -1164,7 +1164,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const
return race;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i)) {
race = GetAugment(i)->GetItemBaneDamageRace();
if (race)
@@ -1184,7 +1184,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments)
damage += item->BaneDmgAmt;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
damage += GetAugment(i)->GetItemBaneDamageBody(against);
}
@@ -1201,7 +1201,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co
damage += item->BaneDmgRaceAmt;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
damage += GetAugment(i)->GetItemBaneDamageRace(against);
}
@@ -1217,7 +1217,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const
return 1;
if (augments) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i) && GetAugment(i)->GetItemMagical())
return 1;
}
@@ -1232,7 +1232,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const
if (item) {
hp = item->HP;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
hp += GetAugment(i)->GetItemHP();
}
@@ -1246,7 +1246,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const
if (item) {
mana = item->Mana;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
mana += GetAugment(i)->GetItemMana();
}
@@ -1260,7 +1260,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const
if (item) {
endur = item->Endur;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
endur += GetAugment(i)->GetItemEndur();
}
@@ -1274,7 +1274,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const
if (item) {
atk = item->Attack;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
atk += GetAugment(i)->GetItemAttack();
}
@@ -1288,7 +1288,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const
if (item) {
str = item->AStr;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
str += GetAugment(i)->GetItemStr();
}
@@ -1302,7 +1302,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const
if (item) {
sta = item->ASta;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
sta += GetAugment(i)->GetItemSta();
}
@@ -1316,7 +1316,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const
if (item) {
total = item->ADex;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemDex();
}
@@ -1330,7 +1330,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const
if (item) {
total = item->AAgi;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemAgi();
}
@@ -1344,7 +1344,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const
if (item) {
total = item->AInt;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemInt();
}
@@ -1358,7 +1358,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const
if (item) {
total = item->AWis;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemWis();
}
@@ -1372,7 +1372,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const
if (item) {
total = item->ACha;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemCha();
}
@@ -1386,7 +1386,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const
if (item) {
total = item->MR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemMR();
}
@@ -1400,7 +1400,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const
if (item) {
total = item->FR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemFR();
}
@@ -1414,7 +1414,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const
if (item) {
total = item->CR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemCR();
}
@@ -1428,7 +1428,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const
if (item) {
total = item->PR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemPR();
}
@@ -1442,7 +1442,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const
if (item) {
total = item->DR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemDR();
}
@@ -1456,7 +1456,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const
if (item) {
total = item->SVCorruption;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemCorrup();
}
@@ -1470,7 +1470,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const
if (item) {
total = item->HeroicStr;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicStr();
}
@@ -1484,7 +1484,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const
if (item) {
total = item->HeroicSta;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicSta();
}
@@ -1498,7 +1498,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const
if (item) {
total = item->HeroicDex;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicDex();
}
@@ -1512,7 +1512,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const
if (item) {
total = item->HeroicAgi;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicAgi();
}
@@ -1526,7 +1526,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const
if (item) {
total = item->HeroicInt;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicInt();
}
@@ -1540,7 +1540,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const
if (item) {
total = item->HeroicWis;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicWis();
}
@@ -1554,7 +1554,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const
if (item) {
total = item->HeroicCha;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicCha();
}
@@ -1568,7 +1568,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const
if (item) {
total = item->HeroicMR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicMR();
}
@@ -1582,7 +1582,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const
if (item) {
total = item->HeroicFR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicFR();
}
@@ -1596,7 +1596,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const
if (item) {
total = item->HeroicCR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicCR();
}
@@ -1610,7 +1610,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const
if (item) {
total = item->HeroicPR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicPR();
}
@@ -1624,7 +1624,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const
if (item) {
total = item->HeroicDR;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicDR();
}
@@ -1638,7 +1638,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const
if (item) {
total = item->HeroicSVCorrup;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i))
total += GetAugment(i)->GetItemHeroicCorrup();
}
@@ -1652,7 +1652,7 @@ int EQEmu::ItemInstance::GetItemHaste(bool augments) const
if (item) {
total = item->Haste;
if (augments)
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i)
for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i)
if (GetAugment(i)) {
int temp = GetAugment(i)->GetItemHaste();
if (temp > total)
+9 -8
View File
@@ -52,7 +52,6 @@ typedef enum {
} byFlagSetting;
class SharedDatabase;
class Inventory;
// ########################################
// Class: EQEmu::ItemInstance
@@ -61,6 +60,8 @@ class Inventory;
// to an item instance (includes dye, augments, charges, etc)
namespace EQEmu
{
class InventoryProfile;
class ItemInstance {
public:
/////////////////////////
@@ -79,7 +80,7 @@ namespace EQEmu
~ItemInstance();
// Query item type
bool IsType(EQEmu::item::ItemClass item_class) const;
bool IsType(item::ItemClass item_class) const;
bool IsClassCommon() const;
bool IsClassBag() const;
@@ -102,7 +103,7 @@ namespace EQEmu
bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const;
inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : 0); }
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 == item::ItemEffectExpendable) || (m_item->ItemType == item::ItemTypePotion)) : false); }
//
// Contents
@@ -133,7 +134,7 @@ namespace EQEmu
bool IsAugmented();
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const;
bool UpdateOrnamentationInfo();
static bool CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll = false);
static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false);
// Has attack/delay?
bool IsWeapon() const;
@@ -211,8 +212,8 @@ namespace EQEmu
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)); }
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; }
void Serialize(OutBuffer& ob, int16 slot_id) const { 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; }
@@ -278,7 +279,7 @@ namespace EQEmu
//////////////////////////
// Protected Members
//////////////////////////
friend class ::Inventory;
friend class InventoryProfile;
std::map<uint8, ItemInstance*>::const_iterator _cbegin() { return m_contents.cbegin(); }
std::map<uint8, ItemInstance*>::const_iterator _cend() { return m_contents.cend(); }
@@ -299,7 +300,7 @@ namespace EQEmu
int8 m_evolveLvl;
bool m_activated;
ItemData* m_scaledItem;
EvolveInfo* m_evolveInfo;
::EvolveInfo* m_evolveInfo;
bool m_scaling;
uint32 m_ornamenticon;
uint32 m_ornamentidfile;
+1 -1
View File
@@ -5264,7 +5264,7 @@ namespace RoF
if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
ornaIcon = inst->GetOrnamentationIcon();
heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in));
heroModel = inst->GetOrnamentHeroModel(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id_in));
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
+1 -1
View File
@@ -5555,7 +5555,7 @@ namespace RoF2
if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
ornaIcon = inst->GetOrnamentationIcon();
heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in));
heroModel = inst->GetOrnamentHeroModel(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id_in));
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
+14 -14
View File
@@ -184,7 +184,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* in
else {
// Needed to clear out bag slots that 'REPLACE' in UpdateSharedBankSlot does not overwrite..otherwise, duplication occurs
// (This requires that parent then child items be sent..which should be how they are currently passed)
if (Inventory::SupportsContainers(slot_id))
if (EQEmu::InventoryProfile::SupportsContainers(slot_id))
DeleteSharedBankSlot(char_id, slot_id);
return UpdateSharedBankSlot(char_id, inst, slot_id);
}
@@ -195,7 +195,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* in
// Needed to clear out bag slots that 'REPLACE' in UpdateInventorySlot does not overwrite..otherwise, duplication occurs
// (This requires that parent then child items be sent..which should be how they are currently passed)
if (Inventory::SupportsContainers(slot_id))
if (EQEmu::InventoryProfile::SupportsContainers(slot_id))
DeleteInventorySlot(char_id, slot_id);
return UpdateInventorySlot(char_id, inst, slot_id);
}
@@ -232,12 +232,12 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstan
auto results = QueryDatabase(query);
// Save bag contents, if slot supports bag contents
if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id))
if (inst->IsClassBag() && EQEmu::InventoryProfile::SupportsContainers(slot_id))
// 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 = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) {
const EQEmu::ItemInstance* baginst = inst->GetItem(idx);
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx));
}
if (!results.Success()) {
@@ -278,12 +278,12 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInsta
auto results = QueryDatabase(query);
// Save bag contents, if slot supports bag contents
if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) {
if (inst->IsClassBag() && EQEmu::InventoryProfile::SupportsContainers(slot_id)) {
// 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 = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) {
const EQEmu::ItemInstance* baginst = inst->GetItem(idx);
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx));
}
}
@@ -304,10 +304,10 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) {
}
// Delete bag slots, if need be
if (!Inventory::SupportsContainers(slot_id))
if (!EQEmu::InventoryProfile::SupportsContainers(slot_id))
return true;
int16 base_slot_id = Inventory::CalcSlotId(slot_id, EQEmu::inventory::containerBegin);
int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin);
query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i",
char_id, base_slot_id, (base_slot_id+10));
results = QueryDatabase(query);
@@ -330,10 +330,10 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) {
}
// Delete bag slots, if need be
if (!Inventory::SupportsContainers(slot_id))
if (!EQEmu::InventoryProfile::SupportsContainers(slot_id))
return true;
int16 base_slot_id = Inventory::CalcSlotId(slot_id, EQEmu::inventory::containerBegin);
int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin);
query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i "
"AND slotid >= %i AND slotid < %i",
account_id, base_slot_id, (base_slot_id+10));
@@ -373,7 +373,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
return true;
}
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) {
bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) {
const EQEmu::ItemData* myitem;
@@ -410,7 +410,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv,
// Retrieve shared bank inventory based on either account or character
bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool is_charid)
{
std::string query;
@@ -511,7 +511,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
}
// Overloaded: Retrieve character inventory based on character id
bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
{
// Retrieve character inventory
std::string query =
@@ -653,7 +653,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
}
// Overloaded: Retrieve character inventory based on account_id and character name
bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv)
{
// Retrieve character inventory
std::string query =
+6 -6
View File
@@ -33,7 +33,6 @@
#include <memory>
class EvolveInfo;
class Inventory;
struct BaseDataStruct;
struct InspectMessage_Struct;
struct PlayerProfile_Struct;
@@ -46,6 +45,7 @@ namespace EQEmu
{
struct ItemData;
class ItemInstance;
class InventoryProfile;
class MemoryMappedFile;
}
@@ -74,7 +74,7 @@ class SharedDatabase : public Database
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
/*
Character Inventory
Character InventoryProfile
*/
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);
@@ -83,15 +83,15 @@ class SharedDatabase : public Database
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);
bool GetSharedBank(uint32 id, EQEmu::InventoryProfile* inv, bool is_charid);
int32 GetSharedPlatinum(uint32 account_id);
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
bool GetInventory(uint32 char_id, Inventory* inv);
bool GetInventory(uint32 account_id, char* name, Inventory* inv);
bool GetInventory(uint32 char_id, EQEmu::InventoryProfile* inv);
bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv);
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
void ClearOldRecastTimestamps(uint32 char_id);
bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin);
bool SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin);
std::string GetBook(const char *txtfile);