mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 16:46:37 +00:00
Inventory possessions beta testing
This commit is contained in:
+14
-16
@@ -78,28 +78,26 @@ namespace EQEmu
|
||||
} // namespace invtype
|
||||
|
||||
namespace invslot {
|
||||
using namespace Titanium::invslot::enum_;
|
||||
|
||||
const int16 SLOT_POWER_SOURCE = 9999;
|
||||
using namespace RoF2::invslot::enum_;
|
||||
|
||||
using RoF2::invslot::SLOT_INVALID;
|
||||
using RoF2::invslot::SLOT_BEGIN;
|
||||
|
||||
using Titanium::invslot::POSSESSIONS_BEGIN;
|
||||
using Titanium::invslot::POSSESSIONS_END;
|
||||
using SoF::invslot::POSSESSIONS_COUNT;
|
||||
using RoF2::invslot::POSSESSIONS_BEGIN;
|
||||
using RoF2::invslot::POSSESSIONS_END;
|
||||
using RoF2::invslot::POSSESSIONS_COUNT;
|
||||
|
||||
using Titanium::invslot::EQUIPMENT_BEGIN;
|
||||
using Titanium::invslot::EQUIPMENT_END;
|
||||
using Titanium::invslot::EQUIPMENT_COUNT;
|
||||
using RoF2::invslot::EQUIPMENT_BEGIN;
|
||||
using RoF2::invslot::EQUIPMENT_END;
|
||||
using RoF2::invslot::EQUIPMENT_COUNT;
|
||||
|
||||
using Titanium::invslot::GENERAL_BEGIN;
|
||||
using Titanium::invslot::GENERAL_END;
|
||||
using Titanium::invslot::GENERAL_COUNT;
|
||||
using RoF2::invslot::GENERAL_BEGIN;
|
||||
using RoF2::invslot::GENERAL_END;
|
||||
using RoF2::invslot::GENERAL_COUNT;
|
||||
|
||||
using Titanium::invslot::BONUS_BEGIN;
|
||||
using Titanium::invslot::BONUS_STAT_END;
|
||||
using Titanium::invslot::BONUS_SKILL_END;
|
||||
using RoF2::invslot::BONUS_BEGIN;
|
||||
using RoF2::invslot::BONUS_STAT_END;
|
||||
using RoF2::invslot::BONUS_SKILL_END;
|
||||
|
||||
using Titanium::invslot::BANK_BEGIN;
|
||||
using SoF::invslot::BANK_END;
|
||||
@@ -145,7 +143,7 @@ namespace EQEmu
|
||||
const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT;
|
||||
const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1;
|
||||
|
||||
const int16 CURSOR_BAG_BEGIN = 331;
|
||||
const int16 CURSOR_BAG_BEGIN = 351;
|
||||
const int16 CURSOR_BAG_COUNT = SLOT_COUNT;
|
||||
const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1;
|
||||
|
||||
|
||||
+199
-32
@@ -177,7 +177,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
|
||||
result = _GetItem(m_inv, slot_id);
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) ||
|
||||
(slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
(slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END)) {
|
||||
// Equippable slots (on body)
|
||||
result = _GetItem(m_worn, slot_id);
|
||||
}
|
||||
@@ -231,6 +231,25 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id, uint8 bagid
|
||||
// Put an item snto specified slot
|
||||
int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
||||
{
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
// Clean up item already in slot (if exists)
|
||||
DeleteItem(slot_id);
|
||||
|
||||
@@ -260,6 +279,60 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
{
|
||||
fail_state = swapInvalid;
|
||||
|
||||
if (slot_a <= EQEmu::invslot::POSSESSIONS_END && slot_a >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_a) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_a <= EQEmu::invbag::GENERAL_BAGS_END && slot_a >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_a - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_a <= EQEmu::invslot::BANK_END && slot_a >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_a - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_a <= EQEmu::invbag::BANK_BAGS_END && slot_a >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_a - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (slot_b <= EQEmu::invslot::POSSESSIONS_END && slot_b >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_b) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_b <= EQEmu::invbag::GENERAL_BAGS_END && slot_b >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_b - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_b <= EQEmu::invslot::BANK_END && slot_b >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_b - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_b <= EQEmu::invbag::BANK_BAGS_END && slot_b >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_b - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Temp holding areas for a and b
|
||||
ItemInstance* inst_a = GetItem(slot_a);
|
||||
ItemInstance* inst_b = GetItem(slot_b);
|
||||
@@ -269,7 +342,7 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END) || slot_b == invslot::SLOT_POWER_SOURCE) {
|
||||
if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END)) {
|
||||
auto item_a = inst_a->GetItem();
|
||||
if (!item_a) {
|
||||
fail_state = swapNullData;
|
||||
@@ -295,7 +368,7 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END) || slot_a == invslot::SLOT_POWER_SOURCE) {
|
||||
if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END)) {
|
||||
auto item_b = inst_b->GetItem();
|
||||
if (!item_b) {
|
||||
fail_state = swapNullData;
|
||||
@@ -379,11 +452,11 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
|
||||
if (slot_id == invslot::slotCursor) {
|
||||
p = m_cursor.pop();
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
p = m_worn[slot_id];
|
||||
m_worn.erase(slot_id);
|
||||
}
|
||||
else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) {
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
p = m_inv[slot_id];
|
||||
m_inv.erase(slot_id);
|
||||
}
|
||||
@@ -420,6 +493,8 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
if (ItemToTry->Stackable) {
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
ItemInstance* InvItem = GetItem(i);
|
||||
|
||||
@@ -457,6 +532,8 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
}
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
ItemInstance* InvItem = GetItem(i);
|
||||
|
||||
@@ -483,7 +560,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
|
||||
uint8 BagSize = InvItem->GetItem()->BagSlots;
|
||||
|
||||
for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot<BagSize; BagSlot++) {
|
||||
for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot < BagSize; BagSlot++) {
|
||||
|
||||
InvItem = GetItem(BaseSlotID + BagSlot);
|
||||
|
||||
@@ -663,6 +740,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
|
||||
{
|
||||
// Check basic inventory
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
if (!GetItem(i))
|
||||
// Found available slot in personal inventory
|
||||
return i;
|
||||
@@ -670,6 +750,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
|
||||
|
||||
if (!for_bag) {
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* inst = GetItem(i);
|
||||
if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size)
|
||||
{
|
||||
@@ -720,6 +803,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 1: find room for bags (caller should really ask for slots for bags first to avoid sending them to cursor..and bag item loss)
|
||||
if (inst->IsClassBag()) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
if (!m_inv[free_slot])
|
||||
return free_slot;
|
||||
}
|
||||
@@ -730,6 +816,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 2: find partial room for stackables
|
||||
if (inst->IsStackable()) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -740,6 +829,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
}
|
||||
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -763,6 +855,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 3a: find room for container-specific items (ItemClassArrow)
|
||||
if (inst->GetItem()->ItemType == item::ItemTypeArrow) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeQuiver) || !main_inst->IsClassBag())
|
||||
@@ -779,6 +874,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 3b: find room for container-specific items (ItemClassSmallThrowing)
|
||||
if (inst->GetItem()->ItemType == item::ItemTypeSmallThrowing) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeBandolier) || !main_inst->IsClassBag())
|
||||
@@ -794,6 +892,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
|
||||
// step 4: just find an empty slot
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -801,6 +902,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
}
|
||||
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (main_inst && main_inst->IsClassBag()) {
|
||||
@@ -977,12 +1081,13 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c
|
||||
bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
{
|
||||
// there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range
|
||||
if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE)
|
||||
{
|
||||
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END)
|
||||
{
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
if (inventory::Lookup(m_mob_version)->AllowClickCastFromBag)
|
||||
return true;
|
||||
}
|
||||
@@ -992,8 +1097,16 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
|
||||
bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
|
||||
{
|
||||
if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE || (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END))
|
||||
// does this have the same criteria as 'SupportsClickCasting' above? (bag clicking per client)
|
||||
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1006,7 +1119,7 @@ bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
|
||||
(slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) ||
|
||||
(slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) ||
|
||||
(slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END)
|
||||
) {
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1054,13 +1167,19 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
|
||||
uint8 brightest_light_type = 0;
|
||||
|
||||
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
|
||||
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END) && iter->first != invslot::SLOT_POWER_SOURCE) { continue; }
|
||||
if (iter->first == invslot::slotAmmo) { continue; }
|
||||
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END))
|
||||
continue;
|
||||
|
||||
if (iter->first == invslot::slotAmmo)
|
||||
continue;
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
|
||||
if (lightsource::IsLevelGreater(item->Light, brightest_light_type))
|
||||
brightest_light_type = item->Light;
|
||||
@@ -1068,15 +1187,21 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
|
||||
|
||||
uint8 general_light_type = 0;
|
||||
for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) {
|
||||
if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END) { continue; }
|
||||
if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END)
|
||||
continue;
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
|
||||
if (!item->IsClassCommon()) { continue; }
|
||||
if (item->Light < 9 || item->Light > 13) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
|
||||
if (!item->IsClassCommon())
|
||||
continue;
|
||||
if (item->Light < 9 || item->Light > 13)
|
||||
continue;
|
||||
|
||||
if (lightsource::TypeToLevel(item->Light))
|
||||
general_light_type = item->Light;
|
||||
@@ -1136,7 +1261,7 @@ int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map<int16, I
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
void EQEmu::InventoryProfile::dumpItemCollection(const std::map<int16, ItemInstance*> &collection)
|
||||
@@ -1174,6 +1299,15 @@ void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16
|
||||
// Internal Method: Retrieves item within an inventory bucket
|
||||
EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const
|
||||
{
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
|
||||
return nullptr;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (slot_id - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto it = bucket.find(slot_id);
|
||||
if (it != bucket.end()) {
|
||||
return it->second;
|
||||
@@ -1205,21 +1339,27 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
|
||||
m_cursor.push_front(inst);
|
||||
result = slot_id;
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if (slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
if (slot_id - EQEmu::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) {
|
||||
m_shbank[slot_id] = inst;
|
||||
@@ -1254,6 +1394,15 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
|
||||
uint32 quantity_found = 0;
|
||||
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1347,6 +1496,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& buc
|
||||
uint32 quantity_found = 0;
|
||||
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1411,6 +1569,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u
|
||||
int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup)
|
||||
{
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1444,7 +1611,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
// Internal Method: Checks an inventory queue type bucket for a particular item
|
||||
@@ -1487,5 +1654,5 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
|
||||
break;
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
@@ -110,9 +110,7 @@ bool EQEmu::InventorySlot::IsDeleteSlot() const
|
||||
|
||||
bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
|
||||
{
|
||||
/*if (slot_index < inventory::EquipmentBegin || slot_index > inventory::EquipmentEnd)
|
||||
return false;*/
|
||||
if ((slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END) && slot_index != invslot::SLOT_POWER_SOURCE)
|
||||
if (slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -120,8 +118,6 @@ bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
|
||||
|
||||
bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
|
||||
{
|
||||
/*if (slot_index < inventory::GeneralBegin || slot_index > inventory::GeneralEnd)
|
||||
return false;*/
|
||||
if (slot_index < invslot::GENERAL_BEGIN || slot_index > invslot::GENERAL_END)
|
||||
return false;
|
||||
|
||||
@@ -130,22 +126,18 @@ bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
|
||||
|
||||
bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
|
||||
{
|
||||
/*if (slot_index != inventory::slotCursor)
|
||||
return false;*/
|
||||
if (slot_index != invslot::slotCursor)
|
||||
return false;
|
||||
if (slot_index == invslot::slotCursor)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index)
|
||||
{
|
||||
/*if ((slot_index != inventory::slotRange) && (slot_index != inventory::slotPrimary) && (slot_index != inventory::slotSecondary))
|
||||
return false;*/
|
||||
if ((slot_index != invslot::slotRange) && (slot_index != invslot::slotPrimary) && (slot_index != invslot::slotSecondary))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
if (slot_index == invslot::slotPrimary || slot_index == invslot::slotSecondary || slot_index == invslot::slotRange)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
|
||||
|
||||
@@ -271,17 +271,10 @@ bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const
|
||||
if (!m_item)
|
||||
return false;
|
||||
|
||||
// another "shouldn't do" fix..will be fixed in future updates (requires code and database work)
|
||||
int16 use_slot = INVALID_INDEX;
|
||||
if (slot_id == invslot::SLOT_POWER_SOURCE) { use_slot = invslot::slotGeneral1; }
|
||||
if ((uint16)slot_id <= invslot::EQUIPMENT_END) { use_slot = slot_id; }
|
||||
if (slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END)
|
||||
return false;
|
||||
|
||||
if (use_slot != INVALID_INDEX) {
|
||||
if (m_item->Slots & (1 << use_slot))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ((m_item->Slots & (1 << slot_id)) != 0);
|
||||
}
|
||||
|
||||
bool EQEmu::ItemInstance::IsAugmentable() const
|
||||
@@ -298,20 +291,18 @@ bool EQEmu::ItemInstance::IsAugmentable() const
|
||||
}
|
||||
|
||||
bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
|
||||
// TODO: check to see if incoming 'aug_wear_slots' "switches" bit assignments like above...
|
||||
// (if wrong, would only affect MainAmmo and MainPowerSource augments)
|
||||
if (!m_item || !m_item->IsClassCommon())
|
||||
return false;
|
||||
|
||||
int index = invslot::EQUIPMENT_BEGIN;
|
||||
for (; index <= invslot::slotGeneral1; ++index) { // MainGeneral1 should be legacy::EQUIPMENT_END
|
||||
for (; index <= invslot::EQUIPMENT_END; ++index) {
|
||||
if (m_item->Slots & (1 << index)) {
|
||||
if (aug_wear_slots & (1 << index))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (index < 23) ? true : false;
|
||||
return (index <= EQEmu::invslot::EQUIPMENT_END);
|
||||
}
|
||||
|
||||
int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
|
||||
@@ -810,12 +801,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 (InventoryProfile::SupportsContainers(slot_id)) { return true; }
|
||||
else if (m_item->Slots & (1 << slot_id)) { return true; }
|
||||
else if (slot_id == invslot::SLOT_POWER_SOURCE && (m_item->Slots & (1 << 22))) { return true; } // got lazy... <watch>
|
||||
else if (slot_id != invslot::SLOT_POWER_SOURCE && slot_id > invslot::EQUIPMENT_END) { return true; }
|
||||
else if (slot_id > invslot::EQUIPMENT_END) { return true; } // why do we call 'InventoryProfile::SupportsContainers' with this here?
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
|
||||
+426
-272
@@ -45,18 +45,20 @@ namespace RoF
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
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 ServerToRoFSlot(uint32 serverSlot);
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot);
|
||||
static inline uint32 ServerToRoFCorpseSlot(uint32 serverCorpseSlot);
|
||||
|
||||
static inline structs::InventorySlot_Struct ServerToRoFCorpseSlot(uint32 serverCorpseSlot);
|
||||
static inline uint32 ServerToRoFCorpseMainSlot(uint32 serverCorpseSlot);
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot, int16 serverType);
|
||||
|
||||
// client to server inventory location converters
|
||||
static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rofSlot);
|
||||
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot);
|
||||
static inline uint32 RoFToServerCorpseSlot(uint32 rofCorpseSlot);
|
||||
|
||||
static inline uint32 RoFToServerCorpseSlot(structs::InventorySlot_Struct rofCorpseSlot);
|
||||
static inline uint32 RoFToServerCorpseMainSlot(uint32 rofCorpseSlot);
|
||||
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot, int16 rofType);
|
||||
|
||||
// server to client say link converter
|
||||
static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink);
|
||||
|
||||
@@ -191,7 +193,7 @@ namespace RoF
|
||||
|
||||
eq->unknown000 = 1;
|
||||
OUT(npcid);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->slot);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->slot, EQEmu::invtype::typePossessions);
|
||||
OUT(charges);
|
||||
OUT(sell_price);
|
||||
|
||||
@@ -244,7 +246,7 @@ namespace RoF
|
||||
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
OUT(merchant_entity_id);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->slot_id);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->slot_id, EQEmu::invtype::typePossessions);
|
||||
OUT(charges);
|
||||
OUT(cost);
|
||||
|
||||
@@ -268,7 +270,7 @@ namespace RoF
|
||||
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
|
||||
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->inventorySlot);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->inventorySlot, EQEmu::invtype::typePossessions);
|
||||
OUT(success);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -585,9 +587,9 @@ namespace RoF
|
||||
ob.write((const char*)&item_count, sizeof(uint32));
|
||||
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "RoF::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -667,7 +669,12 @@ namespace RoF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -1504,6 +1511,7 @@ namespace RoF
|
||||
//store away the emu struct
|
||||
uchar* __emu_buffer = in->pBuffer;
|
||||
|
||||
ItemPacket_Struct* old_item_pkt = (ItemPacket_Struct*)__emu_buffer;
|
||||
EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]);
|
||||
|
||||
EQEmu::OutBuffer ob;
|
||||
@@ -1511,9 +1519,9 @@ namespace RoF
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "RoF::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -1586,9 +1594,11 @@ namespace RoF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToRoFCorpseSlot(emu->slot_id);
|
||||
eq->slot_id = ServerToRoFCorpseMainSlot(emu->slot_id);
|
||||
OUT(auto_loot);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1756,6 +1766,8 @@ namespace RoF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToRoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToRoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -2226,7 +2238,7 @@ namespace RoF
|
||||
|
||||
outapp->WriteUInt32(profile::BANDOLIERS_SIZE);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (uint32 r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
outapp->WriteString(emu->bandoliers[r].Name);
|
||||
for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -2241,7 +2253,7 @@ namespace RoF
|
||||
}
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (uint32 r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
outapp->WriteString("");
|
||||
for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -2253,7 +2265,7 @@ namespace RoF
|
||||
|
||||
outapp->WriteUInt32(profile::POTION_BELT_SIZE);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (uint32 r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
outapp->WriteString(emu->potionbelt.Items[r].Name);
|
||||
outapp->WriteUInt32(emu->potionbelt.Items[r].ID);
|
||||
@@ -2265,7 +2277,7 @@ namespace RoF
|
||||
outapp->WriteSInt32(-1);
|
||||
}
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (uint32 r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
outapp->WriteString("");
|
||||
outapp->WriteUInt32(0);
|
||||
@@ -3041,7 +3053,7 @@ namespace RoF
|
||||
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
OUT(npcid);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->itemslot);
|
||||
eq->inventory_slot = ServerToRoFTypelessSlot(emu->itemslot, EQEmu::invtype::typePossessions);
|
||||
//OUT(itemslot);
|
||||
OUT(quantity);
|
||||
OUT(price);
|
||||
@@ -4057,7 +4069,7 @@ namespace RoF
|
||||
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->slot = RoFToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->slot = RoFToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
IN(charges);
|
||||
IN(sell_price);
|
||||
|
||||
@@ -4070,7 +4082,7 @@ namespace RoF
|
||||
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = RoFToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->slot_id = RoFToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
IN(charges);
|
||||
IN(cost);
|
||||
|
||||
@@ -4083,7 +4095,7 @@ namespace RoF
|
||||
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
|
||||
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = RoFToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->slot_id = RoFToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -4105,7 +4117,7 @@ namespace RoF
|
||||
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
|
||||
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
emu->inventorySlot = RoFToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->inventorySlot = RoFToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
IN(success);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4741,9 +4753,11 @@ namespace RoF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = RoFToServerCorpseSlot(eq->slot_id);
|
||||
emu->slot_id = RoFToServerCorpseMainSlot(eq->slot_id);
|
||||
IN(auto_loot);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4754,8 +4768,8 @@ namespace RoF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
//Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot);
|
||||
Log(Logs::General, Logs::Netcode, "[RoF] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.Type, eq->to_slot.Type, eq->from_slot.Slot, eq->to_slot.Slot, eq->from_slot.SubIndex, eq->to_slot.SubIndex, eq->from_slot.AugIndex, eq->to_slot.AugIndex, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = RoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = RoFToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
@@ -4904,7 +4918,7 @@ namespace RoF
|
||||
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->itemslot = RoFToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->itemslot = RoFToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
//IN(itemslot);
|
||||
IN(quantity);
|
||||
IN(price);
|
||||
@@ -5079,7 +5093,7 @@ namespace RoF
|
||||
return NextItemInstSerialNumber;
|
||||
}
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type)
|
||||
{
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
@@ -5092,8 +5106,16 @@ namespace RoF
|
||||
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
structs::InventorySlot_Struct slot_id = ServerToRoFSlot(slot_id_in);
|
||||
|
||||
structs::InventorySlot_Struct slot_id;
|
||||
switch (packet_type) {
|
||||
case ItemPacketLoot:
|
||||
slot_id = ServerToRoFCorpseSlot(slot_id_in);
|
||||
break;
|
||||
default:
|
||||
slot_id = ServerToRoFSlot(slot_id_in);
|
||||
break;
|
||||
}
|
||||
|
||||
hdr.slot_type = (inst->GetMerchantSlot() ? invtype::typeMerchant : slot_id.Type);
|
||||
hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot);
|
||||
hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex);
|
||||
@@ -5188,7 +5210,7 @@ namespace RoF
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -5492,318 +5514,450 @@ namespace RoF
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1), packet_type);
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot)
|
||||
{
|
||||
structs::InventorySlot_Struct RoFSlot;
|
||||
RoFSlot.Type = INVALID_INDEX;
|
||||
RoFSlot.Unknown02 = 0;
|
||||
RoFSlot.Slot = INVALID_INDEX;
|
||||
RoFSlot.SubIndex = INVALID_INDEX;
|
||||
RoFSlot.AugIndex = INVALID_INDEX;
|
||||
RoFSlot.Unknown01 = 0;
|
||||
RoFSlot.Type = invtype::TYPE_INVALID;
|
||||
RoFSlot.Unknown02 = INULL;
|
||||
RoFSlot.Slot = invslot::SLOT_INVALID;
|
||||
RoFSlot.SubIndex = invbag::SLOT_INVALID;
|
||||
RoFSlot.AugIndex = invaug::SOCKET_INVALID;
|
||||
RoFSlot.Unknown01 = INULL;
|
||||
|
||||
uint32 TempSlot = 0;
|
||||
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // Main Inventory and Cursor
|
||||
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) {
|
||||
RoFSlot.Type = invtype::typePossessions;
|
||||
RoFSlot.Slot = serverSlot;
|
||||
|
||||
if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
RoFSlot.Slot = invslot::slotPowerSource;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
RoFSlot.Slot += 3;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotAmmo) // (> 20)
|
||||
RoFSlot.Slot += 1;
|
||||
}
|
||||
|
||||
/*else if (ServerSlot < 51) { // Cursor Buffer
|
||||
RoFSlot.SlotType = maps::MapLimbo;
|
||||
RoFSlot.MainSlot = ServerSlot - 31;
|
||||
}*/
|
||||
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) { // (> 250 && < 341)
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
|
||||
|
||||
RoFSlot.Type = invtype::typePossessions;
|
||||
TempSlot = serverSlot - 1;
|
||||
RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2;
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::invbag::SLOT_COUNT);
|
||||
|
||||
if (RoFSlot.Slot >= invslot::slotGeneral9) // (> 30)
|
||||
RoFSlot.Slot = invslot::slotCursor;
|
||||
RoFSlot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN && serverSlot <= EQEmu::invslot::TRIBUTE_END) { // Tribute
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
RoFSlot.Type = invtype::typeTribute;
|
||||
RoFSlot.Slot = serverSlot - EQEmu::invslot::TRIBUTE_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::BANK_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) {
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
RoFSlot.Type = invtype::typeGuildTribute;
|
||||
RoFSlot.Slot = serverSlot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
RoFSlot.Type = invtype::typeBank;
|
||||
TempSlot = serverSlot - EQEmu::invslot::BANK_BEGIN;
|
||||
RoFSlot.Slot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) { // (> 30)
|
||||
RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3;
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
RoFSlot.Slot = serverSlot - EQEmu::invslot::BANK_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) {
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::BANK_BAGS_BEGIN;
|
||||
|
||||
RoFSlot.Type = invtype::typeBank;
|
||||
RoFSlot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
|
||||
RoFSlot.SubIndex = TempSlot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
RoFSlot.Type = invtype::typeSharedBank;
|
||||
TempSlot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN;
|
||||
RoFSlot.Slot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) { // (> 30)
|
||||
RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3;
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
RoFSlot.Slot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::TRADE_BEGIN && serverSlot <= EQEmu::invbag::TRADE_BAGS_END) {
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::SHARED_BANK_BAGS_BEGIN;
|
||||
|
||||
RoFSlot.Type = invtype::typeSharedBank;
|
||||
RoFSlot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
|
||||
RoFSlot.SubIndex = TempSlot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
RoFSlot.Type = invtype::typeTrade;
|
||||
TempSlot = serverSlot - EQEmu::invslot::TRADE_BEGIN;
|
||||
RoFSlot.Slot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) {
|
||||
RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3;
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
/*
|
||||
// OLD CODE:
|
||||
if (TempSlot > 99) {
|
||||
if (TempSlot > 100)
|
||||
RoFSlot.MainSlot = int((TempSlot - 100) / 10);
|
||||
|
||||
else
|
||||
RoFSlot.MainSlot = 0;
|
||||
|
||||
RoFSlot.SubSlot = TempSlot - (100 + RoFSlot.MainSlot);
|
||||
}
|
||||
*/
|
||||
RoFSlot.Slot = serverSlot - EQEmu::invslot::TRADE_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::WORLD_BEGIN && serverSlot <= EQEmu::invslot::WORLD_END) {
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::TRADE_BAGS_BEGIN;
|
||||
|
||||
RoFSlot.Type = invtype::typeTrade;
|
||||
RoFSlot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
|
||||
RoFSlot.SubIndex = TempSlot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
RoFSlot.Type = invtype::typeWorld;
|
||||
TempSlot = serverSlot - EQEmu::invslot::WORLD_BEGIN;
|
||||
RoFSlot.Slot = TempSlot;
|
||||
RoFSlot.Slot = serverSlot - EQEmu::invslot::WORLD_BEGIN;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Type, RoFSlot.Unknown02, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown01);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
|
||||
serverSlot, RoFSlot.Type, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown02, RoFSlot.Unknown01);
|
||||
|
||||
return RoFSlot;
|
||||
}
|
||||
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot)
|
||||
static inline structs::InventorySlot_Struct ServerToRoFCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
structs::InventorySlot_Struct RoFSlot;
|
||||
RoFSlot.Type = invtype::TYPE_INVALID;
|
||||
RoFSlot.Unknown02 = INULL;
|
||||
RoFSlot.Slot = ServerToRoFCorpseMainSlot(serverCorpseSlot);
|
||||
RoFSlot.SubIndex = invbag::SLOT_INVALID;
|
||||
RoFSlot.AugIndex = invaug::SOCKET_INVALID;
|
||||
RoFSlot.Unknown01 = INULL;
|
||||
|
||||
if (RoFSlot.Slot != invslot::SLOT_INVALID)
|
||||
RoFSlot.Type = invtype::typeCorpse;
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF Corpse Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
|
||||
serverCorpseSlot, RoFSlot.Type, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown02, RoFSlot.Unknown01);
|
||||
|
||||
return RoFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToRoFCorpseMainSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
uint32 RoFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::CORPSE_BEGIN) {
|
||||
RoFSlot = serverCorpseSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF Corpse Main Slot %i", serverCorpseSlot, RoFSlot);
|
||||
|
||||
return RoFSlot;
|
||||
}
|
||||
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot, int16 serverType)
|
||||
{
|
||||
structs::TypelessInventorySlot_Struct RoFSlot;
|
||||
RoFSlot.Slot = INVALID_INDEX;
|
||||
RoFSlot.SubIndex = INVALID_INDEX;
|
||||
RoFSlot.AugIndex = INVALID_INDEX;
|
||||
RoFSlot.Unknown01 = 0;
|
||||
RoFSlot.Slot = invslot::SLOT_INVALID;
|
||||
RoFSlot.SubIndex = invbag::SLOT_INVALID;
|
||||
RoFSlot.AugIndex = invaug::SOCKET_INVALID;
|
||||
RoFSlot.Unknown01 = INULL;
|
||||
|
||||
uint32 TempSlot = 0;
|
||||
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // (< 52)
|
||||
RoFSlot.Slot = serverSlot;
|
||||
if (serverType == EQEmu::invtype::typePossessions) {
|
||||
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) {
|
||||
RoFSlot.Slot = serverSlot;
|
||||
}
|
||||
|
||||
if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
RoFSlot.Slot = invslot::slotPowerSource;
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
RoFSlot.Slot += 3;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotAmmo) // Ammo and Personl Inventory
|
||||
RoFSlot.Slot += 1;
|
||||
|
||||
/*else if (ServerSlot >= MainCursor) { // Cursor
|
||||
RoFSlot.MainSlot = slots::MainCursor;
|
||||
|
||||
if (ServerSlot > 30)
|
||||
RoFSlot.SubSlot = (ServerSlot + 3) - 33;
|
||||
}*/
|
||||
RoFSlot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) {
|
||||
TempSlot = serverSlot - 1;
|
||||
RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2;
|
||||
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown01);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i)",
|
||||
serverSlot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, serverType, RoFSlot.Unknown01);
|
||||
|
||||
return RoFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToRoFCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
return (serverCorpseSlot + 1);
|
||||
}
|
||||
|
||||
static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rofSlot)
|
||||
{
|
||||
uint32 ServerSlot = INVALID_INDEX;
|
||||
uint32 TempSlot = 0;
|
||||
if (rofSlot.AugIndex < invaug::SOCKET_INVALID || rofSlot.AugIndex >= invaug::SOCKET_COUNT) {
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
|
||||
rofSlot.Type, rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofSlot.Unknown02, rofSlot.Unknown01, EQEmu::invslot::SLOT_INVALID);
|
||||
|
||||
if (rofSlot.Type == invtype::typePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51)
|
||||
if (rofSlot.Slot == invslot::slotPowerSource)
|
||||
TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
|
||||
else if (rofSlot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
TempSlot = rofSlot.Slot - 3;
|
||||
|
||||
/*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory/corpse slots
|
||||
// Need to figure out what to do when we get these
|
||||
|
||||
// The slot range of 0 - client_max is cross-utilized between player inventory and corpse inventory.
|
||||
// In the case of RoF, player inventory is addressed as 0 - 33 and corpse inventory is addressed as 23 - 56.
|
||||
// We 'could' assign the two new inventory slots as 9997 and 9998, and then work around their bag
|
||||
// slot assignments, but doing so may disrupt our ability to utilize the corpse looting range properly.
|
||||
|
||||
// For now, it's probably best to leave as-is and let this work itself out in the inventory rework.
|
||||
}*/
|
||||
|
||||
else if (rofSlot.Slot >= invslot::slotAmmo) // Ammo and Main Inventory
|
||||
TempSlot = rofSlot.Slot - 1;
|
||||
|
||||
else // Worn Slots
|
||||
TempSlot = rofSlot.Slot;
|
||||
|
||||
if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots
|
||||
TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
else if (rofSlot.Type == invtype::typeBank) {
|
||||
TempSlot = EQEmu::invslot::BANK_BEGIN;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
uint32 TempSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += ((rofSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1;
|
||||
switch (rofSlot.Type) {
|
||||
case invtype::typePossessions: {
|
||||
if (rofSlot.Slot >= invslot::POSSESSIONS_BEGIN && rofSlot.Slot <= invslot::POSSESSIONS_END) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = rofSlot.Slot;
|
||||
}
|
||||
|
||||
else
|
||||
TempSlot += rofSlot.Slot;
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
if (rofSlot.Slot < invslot::GENERAL_BEGIN)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
TempSlot = (rofSlot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeBank: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::BANK_SIZE) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::BANK_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeSharedBank: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::SHARED_BANK_SIZE) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTrade: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRADE_SIZE) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeWorld: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::WORLD_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeLimbo: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::LIMBO_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::slotCursor;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTribute: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeGuildTribute: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeCorpse: {
|
||||
if (rofSlot.Slot >= invslot::CORPSE_BEGIN && rofSlot.Slot <= invslot::CORPSE_END) {
|
||||
ServerSlot = rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if (rofSlot.Type == invtype::typeSharedBank) {
|
||||
TempSlot = EQEmu::invslot::SHARED_BANK_BEGIN;
|
||||
|
||||
if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += ((rofSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1;
|
||||
|
||||
else
|
||||
TempSlot += rofSlot.Slot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
else if (rofSlot.Type == invtype::typeTrade) {
|
||||
TempSlot = EQEmu::invslot::TRADE_BEGIN;
|
||||
|
||||
if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += ((rofSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1;
|
||||
// OLD CODE:
|
||||
//TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::inventory::ContainerCount) + RoFSlot.SubSlot;
|
||||
|
||||
else
|
||||
TempSlot += rofSlot.Slot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
else if (rofSlot.Type == invtype::typeWorld) {
|
||||
TempSlot = EQEmu::invslot::WORLD_BEGIN;
|
||||
|
||||
if (rofSlot.Slot >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += rofSlot.Slot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
/*else if (RoFSlot.SlotType == maps::MapLimbo) { // Cursor Buffer
|
||||
TempSlot = 31;
|
||||
|
||||
if (RoFSlot.MainSlot >= 0)
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}*/
|
||||
|
||||
else if (rofSlot.Type == invtype::typeGuildTribute) {
|
||||
ServerSlot = INVALID_INDEX;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.Type, rofSlot.Unknown02, rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofSlot.Unknown01, ServerSlot);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
|
||||
rofSlot.Type, rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofSlot.Unknown02, rofSlot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot)
|
||||
static inline uint32 RoFToServerCorpseSlot(structs::InventorySlot_Struct rofCorpseSlot)
|
||||
{
|
||||
uint32 ServerSlot = INVALID_INDEX;
|
||||
uint32 TempSlot = 0;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33)
|
||||
if (rofSlot.Slot == invslot::slotPowerSource)
|
||||
TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
|
||||
else if (rofSlot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
TempSlot = rofSlot.Slot - 3;
|
||||
|
||||
/*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory slots
|
||||
// Need to figure out what to do when we get these
|
||||
|
||||
// Same as above
|
||||
}*/
|
||||
|
||||
else if (rofSlot.Slot >= invslot::slotAmmo) // Main Inventory and Ammo Slots
|
||||
TempSlot = rofSlot.Slot - 1;
|
||||
|
||||
else
|
||||
TempSlot = rofSlot.Slot;
|
||||
|
||||
if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots
|
||||
TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
if (rofCorpseSlot.Type != invtype::typeCorpse || rofCorpseSlot.SubIndex != invbag::SLOT_INVALID || rofCorpseSlot.AugIndex != invaug::SOCKET_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofSlot.Unknown01, ServerSlot);
|
||||
else {
|
||||
ServerSlot = RoFToServerCorpseMainSlot(rofCorpseSlot.Slot);
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
|
||||
rofCorpseSlot.Type, rofCorpseSlot.Slot, rofCorpseSlot.SubIndex, rofCorpseSlot.AugIndex, rofCorpseSlot.Unknown02, rofCorpseSlot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoFToServerCorpseSlot(uint32 rofCorpseSlot)
|
||||
static inline uint32 RoFToServerCorpseMainSlot(uint32 rofCorpseSlot)
|
||||
{
|
||||
return (rofCorpseSlot - 1);
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (rofCorpseSlot <= invslot::CORPSE_END && rofCorpseSlot >= invslot::CORPSE_BEGIN) {
|
||||
ServerSlot = rofCorpseSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF Corpse Main Slot %i to Server Corpse Slot %i", rofCorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot, int16 rofType)
|
||||
{
|
||||
if (rofSlot.AugIndex < invaug::SOCKET_INVALID || rofSlot.AugIndex >= invaug::SOCKET_COUNT) {
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
|
||||
rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofType, rofSlot.Unknown01, EQEmu::invslot::SLOT_INVALID);
|
||||
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
uint32 TempSlot = invslot::SLOT_INVALID;
|
||||
|
||||
switch (rofType) {
|
||||
case invtype::typePossessions: {
|
||||
if (rofSlot.Slot >= invslot::POSSESSIONS_BEGIN && rofSlot.Slot <= invslot::POSSESSIONS_END) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
if (rofSlot.Slot < invslot::GENERAL_BEGIN)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
TempSlot = (rofSlot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeBank: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::BANK_SIZE) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::BANK_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeSharedBank: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::SHARED_BANK_SIZE) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTrade: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRADE_SIZE) {
|
||||
if (rofSlot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeWorld: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::WORLD_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeLimbo: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::LIMBO_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::slotCursor;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTribute: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeGuildTribute: {
|
||||
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeCorpse: {
|
||||
if (rofSlot.Slot >= invslot::CORPSE_BEGIN && rofSlot.Slot <= invslot::CORPSE_END) {
|
||||
ServerSlot = rofSlot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
|
||||
rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofType, rofSlot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink)
|
||||
|
||||
+432
-288
@@ -48,15 +48,17 @@ namespace RoF2
|
||||
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);
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 serverSlot);
|
||||
static inline uint32 ServerToRoF2CorpseSlot(uint32 serverCorpseSlot);
|
||||
|
||||
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot);
|
||||
static inline structs::InventorySlot_Struct ServerToRoF2CorpseSlot(uint32 serverCorpseSlot);
|
||||
static inline uint32 ServerToRoF2CorpseMainSlot(uint32 serverCorpseSlot);
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 serverSlot, int16 serverType);
|
||||
|
||||
// client to server inventory location converters
|
||||
static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot, ItemPacketType PacketType = ItemPacketInvalid);
|
||||
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot);
|
||||
static inline uint32 RoF2ToServerCorpseSlot(uint32 rof2CorpseSlot);
|
||||
|
||||
static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot);
|
||||
static inline uint32 RoF2ToServerCorpseSlot(structs::InventorySlot_Struct rof2CorpseSlot);
|
||||
static inline uint32 RoF2ToServerCorpseMainSlot(uint32 rof2CorpseSlot);
|
||||
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot, int16 rof2Type);
|
||||
|
||||
// server to client say link converter
|
||||
static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink);
|
||||
|
||||
@@ -260,7 +262,7 @@ namespace RoF2
|
||||
|
||||
eq->unknown000 = 1;
|
||||
OUT(npcid);
|
||||
eq->inventory_slot = ServerToRoF2TypelessSlot(emu->slot);
|
||||
eq->inventory_slot = ServerToRoF2TypelessSlot(emu->slot, EQEmu::invtype::typePossessions);
|
||||
OUT(charges);
|
||||
OUT(sell_price);
|
||||
|
||||
@@ -313,7 +315,7 @@ namespace RoF2
|
||||
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
OUT(merchant_entity_id);
|
||||
eq->inventory_slot = ServerToRoF2TypelessSlot(emu->slot_id);
|
||||
eq->inventory_slot = ServerToRoF2TypelessSlot(emu->slot_id, EQEmu::invtype::typePossessions);
|
||||
OUT(charges);
|
||||
OUT(cost);
|
||||
|
||||
@@ -337,7 +339,7 @@ namespace RoF2
|
||||
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
|
||||
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
eq->inventorySlot = ServerToRoF2TypelessSlot(emu->inventorySlot);
|
||||
eq->inventorySlot = ServerToRoF2TypelessSlot(emu->inventorySlot, EQEmu::invtype::typePossessions);
|
||||
OUT(success);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -655,7 +657,7 @@ namespace RoF2
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "RoF2::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -735,7 +737,12 @@ namespace RoF2
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -1582,7 +1589,7 @@ namespace RoF2
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "RoF2::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -1655,9 +1662,11 @@ namespace RoF2
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToRoF2CorpseSlot(emu->slot_id);
|
||||
eq->slot_id = ServerToRoF2CorpseMainSlot(emu->slot_id);
|
||||
OUT(auto_loot);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1825,6 +1834,8 @@ namespace RoF2
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToRoF2Slot(emu->from_slot);
|
||||
eq->to_slot = ServerToRoF2Slot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -2303,7 +2314,7 @@ namespace RoF2
|
||||
|
||||
outapp->WriteUInt32(profile::BANDOLIERS_SIZE);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (uint32 r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
outapp->WriteString(emu->bandoliers[r].Name);
|
||||
for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -2318,7 +2329,7 @@ namespace RoF2
|
||||
}
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (uint32 r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
outapp->WriteString("");
|
||||
for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -2330,7 +2341,7 @@ namespace RoF2
|
||||
|
||||
outapp->WriteUInt32(profile::POTION_BELT_SIZE);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (uint32 r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
outapp->WriteString(emu->potionbelt.Items[r].Name);
|
||||
outapp->WriteUInt32(emu->potionbelt.Items[r].ID);
|
||||
@@ -2342,7 +2353,7 @@ namespace RoF2
|
||||
outapp->WriteSInt32(-1);
|
||||
}
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (uint32 r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
outapp->WriteString("");
|
||||
outapp->WriteUInt32(0);
|
||||
@@ -3110,7 +3121,7 @@ namespace RoF2
|
||||
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
OUT(npcid);
|
||||
eq->inventory_slot = ServerToRoF2TypelessSlot(emu->itemslot);
|
||||
eq->inventory_slot = ServerToRoF2TypelessSlot(emu->itemslot, EQEmu::invtype::typePossessions);
|
||||
//OUT(itemslot);
|
||||
OUT(quantity);
|
||||
OUT(price);
|
||||
@@ -4299,7 +4310,7 @@ namespace RoF2
|
||||
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->slot = RoF2ToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->slot = RoF2ToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
IN(charges);
|
||||
IN(sell_price);
|
||||
|
||||
@@ -4312,7 +4323,7 @@ namespace RoF2
|
||||
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = RoF2ToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->slot_id = RoF2ToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
IN(charges);
|
||||
IN(cost);
|
||||
|
||||
@@ -4325,7 +4336,7 @@ namespace RoF2
|
||||
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
|
||||
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = RoF2ToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->slot_id = RoF2ToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -4347,7 +4358,7 @@ namespace RoF2
|
||||
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
|
||||
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
emu->inventorySlot = RoF2ToServerTypelessSlot(eq->inventorySlot);
|
||||
emu->inventorySlot = RoF2ToServerTypelessSlot(eq->inventorySlot, invtype::typePossessions);
|
||||
IN(success);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4981,9 +4992,11 @@ namespace RoF2
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = RoF2ToServerCorpseSlot(eq->slot_id);
|
||||
emu->slot_id = RoF2ToServerCorpseMainSlot(eq->slot_id);
|
||||
IN(auto_loot);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4994,10 +5007,13 @@ namespace RoF2
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[RoF2] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.Type, eq->to_slot.Type, eq->from_slot.Slot, eq->to_slot.Slot, eq->from_slot.SubIndex, eq->to_slot.SubIndex, eq->from_slot.AugIndex, eq->to_slot.AugIndex, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = RoF2ToServerSlot(eq->from_slot);
|
||||
emu->to_slot = RoF2ToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
//Log(Logs::General, Logs::Netcode, "[RoF2] MoveItem Slot from %u to %u, Number %u", emu->from_slot, emu->to_slot, emu->number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -5144,7 +5160,7 @@ namespace RoF2
|
||||
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->itemslot = RoF2ToServerTypelessSlot(eq->inventory_slot);
|
||||
emu->itemslot = RoF2ToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions);
|
||||
//IN(itemslot);
|
||||
IN(quantity);
|
||||
IN(price);
|
||||
@@ -5387,8 +5403,16 @@ namespace RoF2
|
||||
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
structs::InventorySlot_Struct slot_id = ServerToRoF2Slot(slot_id_in, packet_type);
|
||||
|
||||
structs::InventorySlot_Struct slot_id;
|
||||
switch (packet_type) {
|
||||
case ItemPacketLoot:
|
||||
slot_id = ServerToRoF2CorpseSlot(slot_id_in);
|
||||
break;
|
||||
default:
|
||||
slot_id = ServerToRoF2Slot(slot_id_in);
|
||||
break;
|
||||
}
|
||||
|
||||
hdr.slot_type = (inst->GetMerchantSlot() ? invtype::typeMerchant : slot_id.Type);
|
||||
hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot);
|
||||
hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex);
|
||||
@@ -5483,7 +5507,7 @@ namespace RoF2
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -5797,330 +5821,450 @@ namespace RoF2
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1), packet_type);
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1), packet_type);
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot, ItemPacketType PacketType)
|
||||
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot)
|
||||
{
|
||||
structs::InventorySlot_Struct RoF2Slot;
|
||||
RoF2Slot.Type = INVALID_INDEX;
|
||||
RoF2Slot.Unknown02 = 0;
|
||||
RoF2Slot.Slot = INVALID_INDEX;
|
||||
RoF2Slot.SubIndex = INVALID_INDEX;
|
||||
RoF2Slot.AugIndex = INVALID_INDEX;
|
||||
RoF2Slot.Unknown01 = 0;
|
||||
RoF2Slot.Type = invtype::TYPE_INVALID;
|
||||
RoF2Slot.Unknown02 = INULL;
|
||||
RoF2Slot.Slot = invslot::SLOT_INVALID;
|
||||
RoF2Slot.SubIndex = invbag::SLOT_INVALID;
|
||||
RoF2Slot.AugIndex = invaug::SOCKET_INVALID;
|
||||
RoF2Slot.Unknown01 = INULL;
|
||||
|
||||
uint32 TempSlot = 0;
|
||||
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // Main Inventory and Cursor
|
||||
if (PacketType == ItemPacketLoot)
|
||||
{
|
||||
RoF2Slot.Type = invtype::typeCorpse;
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::CORPSE_BEGIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
RoF2Slot.Type = invtype::typePossessions;
|
||||
RoF2Slot.Slot = serverSlot;
|
||||
}
|
||||
|
||||
if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
RoF2Slot.Slot = invslot::slotPowerSource;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory
|
||||
RoF2Slot.Slot += 3;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotAmmo) // (> 20)
|
||||
RoF2Slot.Slot += 1;
|
||||
}
|
||||
|
||||
/*else if (ServerSlot < 51) { // Cursor Buffer
|
||||
RoF2Slot.SlotType = maps::MapLimbo;
|
||||
RoF2Slot.MainSlot = ServerSlot - 31;
|
||||
}*/
|
||||
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) { // (> 250 && < 341)
|
||||
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) {
|
||||
RoF2Slot.Type = invtype::typePossessions;
|
||||
TempSlot = serverSlot - 1;
|
||||
RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2;
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::invbag::SLOT_COUNT);
|
||||
|
||||
if (RoF2Slot.Slot >= invslot::slotGeneral9) // (> 30)
|
||||
RoF2Slot.Slot = invslot::slotCursor;
|
||||
RoF2Slot.Slot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN && serverSlot <= EQEmu::invslot::TRIBUTE_END) { // Tribute
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
|
||||
|
||||
RoF2Slot.Type = invtype::typePossessions;
|
||||
RoF2Slot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
RoF2Slot.Type = invtype::typeTribute;
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::TRIBUTE_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::BANK_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) {
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
RoF2Slot.Type = invtype::typeGuildTribute;
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
RoF2Slot.Type = invtype::typeBank;
|
||||
TempSlot = serverSlot - EQEmu::invslot::BANK_BEGIN;
|
||||
RoF2Slot.Slot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) { // (> 30)
|
||||
RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3;
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::BANK_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) {
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::BANK_BAGS_BEGIN;
|
||||
|
||||
RoF2Slot.Type = invtype::typeBank;
|
||||
RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
|
||||
RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
RoF2Slot.Type = invtype::typeSharedBank;
|
||||
TempSlot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN;
|
||||
RoF2Slot.Slot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) { // (> 30)
|
||||
RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3;
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::TRADE_BEGIN && serverSlot <= EQEmu::invbag::TRADE_BAGS_END) {
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::SHARED_BANK_BAGS_BEGIN;
|
||||
|
||||
RoF2Slot.Type = invtype::typeSharedBank;
|
||||
RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
|
||||
RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
RoF2Slot.Type = invtype::typeTrade;
|
||||
TempSlot = serverSlot - EQEmu::invslot::TRADE_BEGIN;
|
||||
RoF2Slot.Slot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) {
|
||||
RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3;
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
/*
|
||||
// OLD CODE:
|
||||
if (TempSlot > 99) {
|
||||
if (TempSlot > 100)
|
||||
RoF2Slot.MainSlot = int((TempSlot - 100) / 10);
|
||||
|
||||
else
|
||||
RoF2Slot.MainSlot = 0;
|
||||
|
||||
RoF2Slot.SubSlot = TempSlot - (100 + RoF2Slot.MainSlot);
|
||||
}
|
||||
*/
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::TRADE_BEGIN;
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::WORLD_BEGIN && serverSlot <= EQEmu::invslot::WORLD_END) {
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::TRADE_BAGS_BEGIN;
|
||||
|
||||
RoF2Slot.Type = invtype::typeTrade;
|
||||
RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
|
||||
RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
RoF2Slot.Type = invtype::typeWorld;
|
||||
TempSlot = serverSlot - EQEmu::invslot::WORLD_BEGIN;
|
||||
RoF2Slot.Slot = TempSlot;
|
||||
RoF2Slot.Slot = serverSlot - EQEmu::invslot::WORLD_BEGIN;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.Type, RoF2Slot.Unknown02, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown01);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
|
||||
serverSlot, RoF2Slot.Type, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown02, RoF2Slot.Unknown01);
|
||||
|
||||
return RoF2Slot;
|
||||
}
|
||||
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 serverSlot)
|
||||
static inline structs::InventorySlot_Struct ServerToRoF2CorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
structs::InventorySlot_Struct RoF2Slot;
|
||||
RoF2Slot.Type = invtype::TYPE_INVALID;
|
||||
RoF2Slot.Unknown02 = INULL;
|
||||
RoF2Slot.Slot = ServerToRoF2CorpseMainSlot(serverCorpseSlot);
|
||||
RoF2Slot.SubIndex = invbag::SLOT_INVALID;
|
||||
RoF2Slot.AugIndex = invaug::SOCKET_INVALID;
|
||||
RoF2Slot.Unknown01 = INULL;
|
||||
|
||||
if (RoF2Slot.Slot != invslot::SLOT_INVALID)
|
||||
RoF2Slot.Type = invtype::typeCorpse;
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF2 Corpse Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
|
||||
serverCorpseSlot, RoF2Slot.Type, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown02, RoF2Slot.Unknown01);
|
||||
|
||||
return RoF2Slot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToRoF2CorpseMainSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
uint32 RoF2Slot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::CORPSE_BEGIN) {
|
||||
RoF2Slot = serverCorpseSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF2 Corpse Main Slot %i", serverCorpseSlot, RoF2Slot);
|
||||
|
||||
return RoF2Slot;
|
||||
}
|
||||
|
||||
static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 serverSlot, int16 serverType)
|
||||
{
|
||||
structs::TypelessInventorySlot_Struct RoF2Slot;
|
||||
RoF2Slot.Slot = INVALID_INDEX;
|
||||
RoF2Slot.SubIndex = INVALID_INDEX;
|
||||
RoF2Slot.AugIndex = INVALID_INDEX;
|
||||
RoF2Slot.Unknown01 = 0;
|
||||
RoF2Slot.Slot = invslot::SLOT_INVALID;
|
||||
RoF2Slot.SubIndex = invbag::SLOT_INVALID;
|
||||
RoF2Slot.AugIndex = invaug::SOCKET_INVALID;
|
||||
RoF2Slot.Unknown01 = INULL;
|
||||
|
||||
uint32 TempSlot = 0;
|
||||
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // (< 52)
|
||||
RoF2Slot.Slot = serverSlot;
|
||||
if (serverType == EQEmu::invtype::typePossessions) {
|
||||
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) {
|
||||
RoF2Slot.Slot = serverSlot;
|
||||
}
|
||||
|
||||
if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
RoF2Slot.Slot = invslot::slotPowerSource;
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
RoF2Slot.Slot += 3;
|
||||
|
||||
else if (serverSlot >= EQEmu::invslot::slotAmmo) // Ammo and Personl Inventory
|
||||
RoF2Slot.Slot += 1;
|
||||
|
||||
/*else if (ServerSlot >= MainCursor) { // Cursor
|
||||
RoF2Slot.MainSlot = slots::MainCursor;
|
||||
|
||||
if (ServerSlot > 30)
|
||||
RoF2Slot.SubSlot = (ServerSlot + 3) - 33;
|
||||
}*/
|
||||
RoF2Slot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) {
|
||||
TempSlot = serverSlot - 1;
|
||||
RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2;
|
||||
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::invbag::SLOT_COUNT);
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown01);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i)",
|
||||
serverSlot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, serverType, RoF2Slot.Unknown01);
|
||||
|
||||
return RoF2Slot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToRoF2CorpseSlot(uint32 serverCorpseSlot)
|
||||
static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot)
|
||||
{
|
||||
return (serverCorpseSlot - EQEmu::invslot::CORPSE_BEGIN + 1);
|
||||
}
|
||||
if (rof2Slot.AugIndex < invaug::SOCKET_INVALID || rof2Slot.AugIndex >= invaug::SOCKET_COUNT) {
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
|
||||
rof2Slot.Type, rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown02, rof2Slot.Unknown01, EQEmu::invslot::SLOT_INVALID);
|
||||
|
||||
static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot, ItemPacketType PacketType)
|
||||
{
|
||||
uint32 ServerSlot = INVALID_INDEX;
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (rof2Slot.Type == invtype::typePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51)
|
||||
if (rof2Slot.Slot == invslot::slotPowerSource)
|
||||
TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
|
||||
else if (rof2Slot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
TempSlot = rof2Slot.Slot - 3;
|
||||
|
||||
/*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory/corpse slots
|
||||
// Need to figure out what to do when we get these
|
||||
|
||||
// The slot range of 0 - client_max is cross-utilized between player inventory and corpse inventory.
|
||||
// In the case of RoF2, player inventory is addressed as 0 - 33 and corpse inventory is addressed as 23 - 56.
|
||||
// We 'could' assign the two new inventory slots as 9997 and 9998, and then work around their bag
|
||||
// slot assignments, but doing so may disrupt our ability to utilize the corpse looting range properly.
|
||||
|
||||
// For now, it's probably best to leave as-is and let this work itself out in the inventory rework.
|
||||
}*/
|
||||
|
||||
else if (rof2Slot.Slot >= invslot::slotAmmo) // Ammo and Main Inventory
|
||||
TempSlot = rof2Slot.Slot - 1;
|
||||
|
||||
else // Worn Slots
|
||||
TempSlot = rof2Slot.Slot;
|
||||
|
||||
if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots
|
||||
TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
else if (rof2Slot.Type == invtype::typeBank) {
|
||||
TempSlot = EQEmu::invslot::BANK_BEGIN;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
uint32 TempSlot = invslot::SLOT_INVALID;
|
||||
|
||||
switch (rof2Slot.Type) {
|
||||
case invtype::typePossessions: {
|
||||
if (rof2Slot.Slot >= invslot::POSSESSIONS_BEGIN && rof2Slot.Slot <= invslot::POSSESSIONS_END) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = rof2Slot.Slot;
|
||||
}
|
||||
|
||||
if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1;
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
if (rof2Slot.Slot < invslot::GENERAL_BEGIN)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
else
|
||||
TempSlot += rof2Slot.Slot;
|
||||
TempSlot = (rof2Slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
break;
|
||||
}
|
||||
case invtype::typeBank: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::BANK_SIZE) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::BANK_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeSharedBank: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::SHARED_BANK_SIZE) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTrade: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRADE_SIZE) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeWorld: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::WORLD_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeLimbo: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::LIMBO_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::slotCursor;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTribute: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeGuildTribute: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeCorpse: {
|
||||
if (rof2Slot.Slot >= invslot::CORPSE_BEGIN && rof2Slot.Slot <= invslot::CORPSE_END) {
|
||||
ServerSlot = rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if (rof2Slot.Type == invtype::typeSharedBank) {
|
||||
TempSlot = EQEmu::invslot::SHARED_BANK_BEGIN;
|
||||
|
||||
if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1;
|
||||
|
||||
else
|
||||
TempSlot += rof2Slot.Slot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.Type == invtype::typeTrade) {
|
||||
TempSlot = EQEmu::invslot::TRADE_BEGIN;
|
||||
|
||||
if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1;
|
||||
// OLD CODE:
|
||||
//TempSlot += 100 + (RoF2Slot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot;
|
||||
|
||||
else
|
||||
TempSlot += rof2Slot.Slot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.Type == invtype::typeWorld) {
|
||||
TempSlot = EQEmu::invslot::WORLD_BEGIN;
|
||||
|
||||
if (rof2Slot.Slot >= EQEmu::invbag::SLOT_BEGIN)
|
||||
TempSlot += rof2Slot.Slot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
/*else if (RoF2Slot.SlotType == maps::MapLimbo) { // Cursor Buffer
|
||||
TempSlot = 31;
|
||||
|
||||
if (RoF2Slot.MainSlot >= 0)
|
||||
TempSlot += RoF2Slot.MainSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}*/
|
||||
|
||||
else if (rof2Slot.Type == invtype::typeGuildTribute) {
|
||||
ServerSlot = INVALID_INDEX;
|
||||
}
|
||||
|
||||
else if (rof2Slot.Type == invtype::typeCorpse) {
|
||||
ServerSlot = rof2Slot.Slot + EQEmu::invslot::CORPSE_BEGIN;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rof2Slot.Type, rof2Slot.Unknown02, rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown01, ServerSlot);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
|
||||
rof2Slot.Type, rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown02, rof2Slot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot)
|
||||
static inline uint32 RoF2ToServerCorpseSlot(structs::InventorySlot_Struct rof2CorpseSlot)
|
||||
{
|
||||
uint32 ServerSlot = INVALID_INDEX;
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33)
|
||||
if (rof2Slot.Slot == invslot::slotPowerSource)
|
||||
TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
|
||||
else if (rof2Slot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory
|
||||
TempSlot = rof2Slot.Slot - 3;
|
||||
|
||||
/*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory slots
|
||||
// Need to figure out what to do when we get these
|
||||
|
||||
// Same as above
|
||||
}*/
|
||||
|
||||
else if (rof2Slot.Slot >= invslot::slotAmmo) // Main Inventory and Ammo Slots
|
||||
TempSlot = rof2Slot.Slot - 1;
|
||||
|
||||
else
|
||||
TempSlot = rof2Slot.Slot;
|
||||
|
||||
if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots
|
||||
TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (rof2CorpseSlot.Type != invtype::typeCorpse || rof2CorpseSlot.SubIndex != invbag::SLOT_INVALID || rof2CorpseSlot.AugIndex != invaug::SOCKET_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
else {
|
||||
ServerSlot = RoF2ToServerCorpseMainSlot(rof2CorpseSlot.Slot);
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown01, ServerSlot);
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
|
||||
rof2CorpseSlot.Type, rof2CorpseSlot.Slot, rof2CorpseSlot.SubIndex, rof2CorpseSlot.AugIndex, rof2CorpseSlot.Unknown02, rof2CorpseSlot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoF2ToServerCorpseSlot(uint32 rof2CorpseSlot)
|
||||
static inline uint32 RoF2ToServerCorpseMainSlot(uint32 rof2CorpseSlot)
|
||||
{
|
||||
return (rof2CorpseSlot + EQEmu::invslot::CORPSE_BEGIN - 1);
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (rof2CorpseSlot <= invslot::CORPSE_END && rof2CorpseSlot >= invslot::CORPSE_BEGIN) {
|
||||
ServerSlot = rof2CorpseSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Corpse Main Slot %i to Server Corpse Slot %i", rof2CorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot, int16 rof2Type)
|
||||
{
|
||||
if (rof2Slot.AugIndex < invaug::SOCKET_INVALID || rof2Slot.AugIndex >= invaug::SOCKET_COUNT) {
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
|
||||
rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Type, rof2Slot.Unknown01, EQEmu::invslot::SLOT_INVALID);
|
||||
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
uint32 TempSlot = invslot::SLOT_INVALID;
|
||||
|
||||
switch (rof2Type) {
|
||||
case invtype::typePossessions: {
|
||||
if (rof2Slot.Slot >= invslot::POSSESSIONS_BEGIN && rof2Slot.Slot <= invslot::POSSESSIONS_END) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
if (rof2Slot.Slot < invslot::GENERAL_BEGIN)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
TempSlot = (rof2Slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeBank: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::BANK_SIZE) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::BANK_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeSharedBank: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::SHARED_BANK_SIZE) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTrade: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRADE_SIZE) {
|
||||
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) {
|
||||
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) {
|
||||
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT;
|
||||
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeWorld: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::WORLD_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeLimbo: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::LIMBO_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::slotCursor;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeTribute: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeGuildTribute: {
|
||||
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
|
||||
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case invtype::typeCorpse: {
|
||||
if (rof2Slot.Slot >= invslot::CORPSE_BEGIN && rof2Slot.Slot <= invslot::CORPSE_END) {
|
||||
ServerSlot = rof2Slot.Slot;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
|
||||
rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Type, rof2Slot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink)
|
||||
|
||||
+181
-56
@@ -400,7 +400,7 @@ namespace SoD
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoD::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -464,7 +464,12 @@ namespace SoD
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -1064,7 +1069,7 @@ namespace SoD
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoD::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -1125,6 +1130,8 @@ namespace SoD
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToSoDCorpseSlot(emu->slot_id);
|
||||
@@ -1286,6 +1293,8 @@ namespace SoD
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoDSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1523,7 +1532,7 @@ namespace SoD
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1532,7 +1541,7 @@ namespace SoD
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1544,13 +1553,13 @@ namespace SoD
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -3139,6 +3148,8 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = SoDToServerCorpseSlot(eq->slot_id);
|
||||
@@ -3152,7 +3163,7 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[SoD] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = SoDToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToServerSlot(eq->to_slot);
|
||||
@@ -3473,7 +3484,7 @@ namespace SoD
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -3736,79 +3747,193 @@ namespace SoD
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::slotGeneral8 && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::slotGeneral9)
|
||||
SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoDSlot(uint32 serverSlot)
|
||||
{
|
||||
uint32 SoDSlot = 0;
|
||||
uint32 SoDSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
SoDSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END)
|
||||
SoDSlot = serverSlot + 11;
|
||||
else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END)
|
||||
SoDSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END)
|
||||
SoDSlot = serverSlot + 1;
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
SoDSlot = invslot::slotPowerSource;
|
||||
else
|
||||
if (serverSlot <= EQEmu::invslot::slotGeneral8) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::CORPSE_END && serverSlot >= EQEmu::invslot::slotCursor) {
|
||||
SoDSlot = serverSlot - 2;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot + 11;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
SoDSlot = serverSlot - 9;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to SoD Slot %i", serverSlot, SoDSlot);
|
||||
|
||||
return SoDSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
//uint32 SoDCorpse;
|
||||
return (serverCorpseSlot + 1);
|
||||
uint32 SoDSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) {
|
||||
SoDSlot = serverCorpseSlot;
|
||||
}
|
||||
|
||||
else if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::slotCursor) {
|
||||
SoDSlot = serverCorpseSlot - 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to SoD Corpse Slot %i", serverCorpseSlot, SoDSlot);
|
||||
|
||||
return SoDSlot;
|
||||
}
|
||||
|
||||
static inline uint32 SoDToServerSlot(uint32 sodSlot)
|
||||
{
|
||||
uint32 ServerSlot = 0;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sodSlot >= invslot::slotAmmo && sodSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = sodSlot - 1;
|
||||
else if (sodSlot >= invbag::GENERAL_BAGS_BEGIN && sodSlot <= invbag::CURSOR_BAG_END)
|
||||
ServerSlot = sodSlot - 11;
|
||||
else if (sodSlot >= invbag::BANK_BAGS_BEGIN && sodSlot <= invbag::BANK_BAGS_END)
|
||||
ServerSlot = sodSlot - 1;
|
||||
else if (sodSlot >= invbag::SHARED_BANK_BAGS_BEGIN && sodSlot <= invbag::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = sodSlot - 1;
|
||||
else if (sodSlot == invslot::slotPowerSource)
|
||||
ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
else
|
||||
if (sodSlot <= invslot::slotGeneral8) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::CORPSE_END && sodSlot >= invslot::slotCursor) {
|
||||
ServerSlot = sodSlot + 2;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invbag::GENERAL_BAGS_END && sodSlot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
ServerSlot = sodSlot - 11;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invbag::CURSOR_BAG_END && sodSlot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
ServerSlot = sodSlot + 9;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::TRIBUTE_END && sodSlot >= invslot::TRIBUTE_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::GUILD_TRIBUTE_END && sodSlot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::BANK_END && sodSlot >= invslot::BANK_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invbag::BANK_BAGS_END && sodSlot >= invbag::BANK_BAGS_BEGIN) {
|
||||
ServerSlot = sodSlot - 1;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::SHARED_BANK_END && sodSlot >= invslot::SHARED_BANK_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invbag::SHARED_BANK_BAGS_END && sodSlot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
ServerSlot = sodSlot - 1;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::TRADE_END && sodSlot >= invslot::TRADE_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invbag::TRADE_BAGS_END && sodSlot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
else if (sodSlot <= invslot::WORLD_END && sodSlot >= invslot::WORLD_BEGIN) {
|
||||
ServerSlot = sodSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoD Slot %i to Server Slot %i", sodSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return (sodCorpseSlot - 1);
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sodCorpseSlot <= invslot::slotGeneral8 && sodCorpseSlot >= invslot::slotGeneral1) {
|
||||
ServerSlot = sodCorpseSlot;
|
||||
}
|
||||
|
||||
else if (sodCorpseSlot <= invslot::CORPSE_END && sodCorpseSlot >= invslot::slotCursor) {
|
||||
ServerSlot = sodCorpseSlot + 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoD Corpse Slot %i to Server Corpse Slot %i", sodCorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink)
|
||||
|
||||
+179
-56
@@ -382,7 +382,7 @@ namespace SoF
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoF::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -445,7 +445,12 @@ namespace SoF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -861,7 +866,7 @@ namespace SoF
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoF::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -922,6 +927,8 @@ namespace SoF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToSoFCorpseSlot(emu->slot_id);
|
||||
@@ -965,6 +972,8 @@ namespace SoF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1190,7 +1199,7 @@ namespace SoF
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1199,7 +1208,7 @@ namespace SoF
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1211,13 +1220,13 @@ namespace SoF
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -2548,6 +2557,8 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = SoFToServerCorpseSlot(eq->slot_id);
|
||||
@@ -2561,7 +2572,7 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[SoF] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = SoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToServerSlot(eq->to_slot);
|
||||
@@ -2867,7 +2878,7 @@ namespace SoF
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -3129,81 +3140,193 @@ namespace SoF
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::slotGeneral8 && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::slotGeneral9)
|
||||
SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoFSlot(uint32 serverSlot)
|
||||
{
|
||||
uint32 SoFSlot = 0;
|
||||
uint32 SoFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
SoFSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END)
|
||||
SoFSlot = serverSlot + 11;
|
||||
else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END)
|
||||
SoFSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END)
|
||||
SoFSlot = serverSlot + 1;
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
SoFSlot = invslot::slotPowerSource;
|
||||
else
|
||||
if (serverSlot <= EQEmu::invslot::slotGeneral8) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::CORPSE_END && serverSlot >= EQEmu::invslot::slotCursor) {
|
||||
SoFSlot = serverSlot - 2;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
SoFSlot = serverSlot + 11;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
SoFSlot = serverSlot - 9;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
SoFSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
SoFSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
SoFSlot = serverSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to SoF Slot %i", serverSlot, SoFSlot);
|
||||
|
||||
return SoFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
//uint32 SoFCorpse;
|
||||
return (serverCorpseSlot + 1);
|
||||
uint32 SoFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) {
|
||||
SoFSlot = serverCorpseSlot;
|
||||
}
|
||||
|
||||
else if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::slotCursor) {
|
||||
SoFSlot = serverCorpseSlot - 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to SoF Corpse Slot %i", serverCorpseSlot, SoFSlot);
|
||||
|
||||
return SoFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 SoFToServerSlot(uint32 sofSlot)
|
||||
{
|
||||
uint32 ServerSlot = 0;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sofSlot >= invslot::slotAmmo && sofSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = sofSlot - 1;
|
||||
else if (sofSlot >= invbag::GENERAL_BAGS_BEGIN && sofSlot <= invbag::CURSOR_BAG_END)
|
||||
ServerSlot = sofSlot - 11;
|
||||
else if (sofSlot >= invbag::BANK_BAGS_BEGIN && sofSlot <= invbag::BANK_BAGS_END)
|
||||
ServerSlot = sofSlot - 1;
|
||||
else if (sofSlot >= invbag::SHARED_BANK_BAGS_BEGIN && sofSlot <= invbag::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = sofSlot - 1;
|
||||
else if (sofSlot == invslot::slotPowerSource)
|
||||
ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
else
|
||||
if (sofSlot <= invslot::slotGeneral8) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::CORPSE_END && sofSlot >= invslot::slotCursor) {
|
||||
ServerSlot = sofSlot + 2;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invbag::GENERAL_BAGS_END && sofSlot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
ServerSlot = sofSlot - 11;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invbag::CURSOR_BAG_END && sofSlot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
ServerSlot = sofSlot + 9;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::TRIBUTE_END && sofSlot >= invslot::TRIBUTE_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::GUILD_TRIBUTE_END && sofSlot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::BANK_END && sofSlot >= invslot::BANK_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invbag::BANK_BAGS_END && sofSlot >= invbag::BANK_BAGS_BEGIN) {
|
||||
ServerSlot = sofSlot - 1;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::SHARED_BANK_END && sofSlot >= invslot::SHARED_BANK_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invbag::SHARED_BANK_BAGS_END && sofSlot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
ServerSlot = sofSlot - 1;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::TRADE_END && sofSlot >= invslot::TRADE_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invbag::TRADE_BAGS_END && sofSlot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
else if (sofSlot <= invslot::WORLD_END && sofSlot >= invslot::WORLD_BEGIN) {
|
||||
ServerSlot = sofSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoF Slot %i to Server Slot %i", sofSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return (sofCorpseSlot - 1);
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sofCorpseSlot <= invslot::slotGeneral8 && sofCorpseSlot >= invslot::slotGeneral1) {
|
||||
ServerSlot = sofCorpseSlot;
|
||||
}
|
||||
|
||||
else if (sofCorpseSlot <= invslot::CORPSE_END && sofCorpseSlot >= invslot::slotCursor) {
|
||||
ServerSlot = sofCorpseSlot + 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoF Corpse Slot %i to Server Corpse Slot %i", sofCorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink)
|
||||
|
||||
+207
-49
@@ -335,9 +335,9 @@ namespace Titanium
|
||||
EQEmu::OutBuffer::pos_type last_pos = ob.tellp();
|
||||
|
||||
for (int r = 0; r < itemcount; r++, eq++) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, ServerToTitaniumSlot(eq->slot_id), 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "Titanium::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -367,7 +367,12 @@ namespace Titanium
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -772,21 +777,15 @@ namespace Titanium
|
||||
OUT(TargetID);
|
||||
OUT(playerid);
|
||||
|
||||
int r;
|
||||
for (r = 0; r <= 20; r++) {
|
||||
strn0cpy(eq->itemnames[r], emu->itemnames[r], sizeof(eq->itemnames[r]));
|
||||
for (int i = EQEmu::invslot::slotCharm; i <= EQEmu::invslot::slotWaist; ++i) {
|
||||
strn0cpy(eq->itemnames[i], emu->itemnames[i], sizeof(eq->itemnames[i]));
|
||||
OUT(itemicons[i]);
|
||||
}
|
||||
|
||||
// move arrow item down to last element in titanium array
|
||||
strn0cpy(eq->itemnames[21], emu->itemnames[22], sizeof(eq->itemnames[21]));
|
||||
// move ammo down to last element in titanium array
|
||||
strn0cpy(eq->itemnames[invslot::slotAmmo], emu->itemnames[EQEmu::invslot::slotAmmo], sizeof(eq->itemnames[invslot::slotAmmo]));
|
||||
eq->itemicons[invslot::slotAmmo] = emu->itemicons[EQEmu::invslot::slotAmmo];
|
||||
|
||||
int k;
|
||||
for (k = 0; k <= 20; k++) {
|
||||
OUT(itemicons[k]);
|
||||
}
|
||||
|
||||
// move arrow icon down to last element in titanium array
|
||||
eq->itemicons[21] = emu->itemicons[22];
|
||||
strn0cpy(eq->text, emu->text, sizeof(eq->text));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -821,9 +820,9 @@ namespace Titanium
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, ServerToTitaniumSlot(int_struct->slot_id), 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "Titanium::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -874,6 +873,8 @@ namespace Titanium
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToTitaniumCorpseSlot(emu->slot_id);
|
||||
@@ -903,6 +904,8 @@ namespace Titanium
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToTitaniumSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToTitaniumSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1050,7 +1053,7 @@ namespace Titanium
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1059,7 +1062,7 @@ namespace Titanium
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1071,13 +1074,13 @@ namespace Titanium
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -1936,23 +1939,18 @@ namespace Titanium
|
||||
IN(TargetID);
|
||||
IN(playerid);
|
||||
|
||||
int r;
|
||||
for (r = 0; r <= 20; r++) {
|
||||
strn0cpy(emu->itemnames[r], eq->itemnames[r], sizeof(emu->itemnames[r]));
|
||||
for (int i = invslot::slotCharm; i <= invslot::slotWaist; ++i) {
|
||||
strn0cpy(emu->itemnames[i], eq->itemnames[i], sizeof(emu->itemnames[i]));
|
||||
IN(itemicons[i]);
|
||||
}
|
||||
|
||||
// move arrow item up to last element in server array
|
||||
strn0cpy(emu->itemnames[21], "", sizeof(emu->itemnames[21]));
|
||||
strn0cpy(emu->itemnames[22], eq->itemnames[21], sizeof(emu->itemnames[22]));
|
||||
// move ammo up to last element in server array
|
||||
strn0cpy(emu->itemnames[EQEmu::invslot::slotAmmo], eq->itemnames[invslot::slotAmmo], sizeof(emu->itemnames[EQEmu::invslot::slotAmmo]));
|
||||
emu->itemicons[EQEmu::invslot::slotAmmo] = eq->itemicons[invslot::slotAmmo];
|
||||
|
||||
int k;
|
||||
for (k = 0; k <= 20; k++) {
|
||||
IN(itemicons[k]);
|
||||
}
|
||||
|
||||
// move arrow icon up to last element in server array
|
||||
emu->itemicons[21] = 0xFFFFFFFF;
|
||||
emu->itemicons[22] = eq->itemicons[21];
|
||||
// nullify power source element in server array
|
||||
strn0cpy(emu->itemnames[EQEmu::invslot::slotPowerSource], "", sizeof(emu->itemnames[EQEmu::invslot::slotPowerSource]));
|
||||
emu->itemicons[EQEmu::invslot::slotPowerSource] = 0xFFFFFFFF;
|
||||
|
||||
strn0cpy(emu->text, eq->text, sizeof(emu->text));
|
||||
|
||||
@@ -2020,6 +2018,8 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = TitaniumToServerCorpseSlot(eq->slot_id);
|
||||
@@ -2033,7 +2033,7 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[Titanium] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = TitaniumToServerSlot(eq->from_slot);
|
||||
emu->to_slot = TitaniumToServerSlot(eq->to_slot);
|
||||
@@ -2259,7 +2259,7 @@ namespace Titanium
|
||||
ob << '|' << itoa(item->NoRent);
|
||||
ob << '|' << itoa(item->NoDrop);
|
||||
ob << '|' << itoa(item->Size);
|
||||
ob << '|' << itoa(item->Slots);
|
||||
ob << '|' << itoa(Catch22(SwapBits21And22(item->Slots)));
|
||||
ob << '|' << itoa(item->Price);
|
||||
ob << '|' << itoa(item->Icon);
|
||||
ob << '|' << "0";
|
||||
@@ -2464,32 +2464,190 @@ namespace Titanium
|
||||
|
||||
static inline int16 ServerToTitaniumSlot(uint32 serverSlot)
|
||||
{
|
||||
//int16 TitaniumSlot;
|
||||
if (serverSlot == INVALID_INDEX)
|
||||
return INVALID_INDEX;
|
||||
int16 TitaniumSlot = invslot::SLOT_INVALID;
|
||||
|
||||
return serverSlot; // deprecated
|
||||
if (serverSlot <= EQEmu::invslot::slotWaist) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot == EQEmu::invslot::slotAmmo) {
|
||||
TitaniumSlot = serverSlot - 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::slotGeneral8 && serverSlot >= EQEmu::invslot::slotGeneral1) {
|
||||
TitaniumSlot = serverSlot - 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) && serverSlot >= EQEmu::invslot::slotCursor) {
|
||||
TitaniumSlot = serverSlot - 3;
|
||||
}
|
||||
|
||||
else if (serverSlot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
|
||||
TitaniumSlot = serverSlot - 4;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
TitaniumSlot = serverSlot - 20;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_16_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
TitaniumSlot = serverSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to Titanium Slot %i", serverSlot, TitaniumSlot);
|
||||
|
||||
return TitaniumSlot;
|
||||
}
|
||||
|
||||
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
//int16 TitaniumCorpse;
|
||||
return serverCorpseSlot;
|
||||
int16 TitaniumSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) {
|
||||
TitaniumSlot = serverCorpseSlot - 1;
|
||||
}
|
||||
|
||||
else if (serverCorpseSlot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) && serverCorpseSlot >= EQEmu::invslot::slotCursor) {
|
||||
TitaniumSlot = serverCorpseSlot - 3;
|
||||
}
|
||||
|
||||
else if (serverCorpseSlot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
|
||||
TitaniumSlot = serverCorpseSlot - 4;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to Titanium Corpse Slot %i", serverCorpseSlot, TitaniumSlot);
|
||||
|
||||
return TitaniumSlot;
|
||||
}
|
||||
|
||||
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot)
|
||||
{
|
||||
//uint32 ServerSlot;
|
||||
if (titaniumSlot == INVALID_INDEX)
|
||||
return INVALID_INDEX;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
return titaniumSlot; // deprecated
|
||||
if (titaniumSlot <= invslot::slotWaist) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot == invslot::slotAmmo) {
|
||||
ServerSlot = titaniumSlot + 1;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::slotGeneral8 && titaniumSlot >= invslot::slotGeneral1) {
|
||||
ServerSlot = titaniumSlot + 1;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) && titaniumSlot >= invslot::slotCursor) {
|
||||
ServerSlot = titaniumSlot + 3;
|
||||
}
|
||||
|
||||
else if (titaniumSlot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
|
||||
ServerSlot = titaniumSlot + 4;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invbag::GENERAL_BAGS_END && titaniumSlot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invbag::CURSOR_BAG_END && titaniumSlot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
ServerSlot = titaniumSlot + 20;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::TRIBUTE_END && titaniumSlot >= invslot::TRIBUTE_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::GUILD_TRIBUTE_END && titaniumSlot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::BANK_END && titaniumSlot >= invslot::BANK_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invbag::BANK_BAGS_END && titaniumSlot >= invbag::BANK_BAGS_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::SHARED_BANK_END && titaniumSlot >= invslot::SHARED_BANK_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invbag::SHARED_BANK_BAGS_END && titaniumSlot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::TRADE_END && titaniumSlot >= invslot::TRADE_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invbag::TRADE_BAGS_END && titaniumSlot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
else if (titaniumSlot <= invslot::WORLD_END && titaniumSlot >= invslot::WORLD_BEGIN) {
|
||||
ServerSlot = titaniumSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Titanium Slot %i to Server Slot %i", titaniumSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return titaniumCorpseSlot;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (titaniumCorpseSlot <= invslot::slotGeneral8 && titaniumCorpseSlot >= invslot::slotGeneral1) {
|
||||
ServerSlot = titaniumCorpseSlot + 1;
|
||||
}
|
||||
|
||||
else if (titaniumCorpseSlot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) && titaniumCorpseSlot >= invslot::slotCursor) {
|
||||
ServerSlot = titaniumCorpseSlot + 3;
|
||||
}
|
||||
|
||||
else if (titaniumCorpseSlot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
|
||||
ServerSlot = titaniumCorpseSlot + 4;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Titanium Corpse Slot %i to Server Corpse Slot %i", titaniumCorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink)
|
||||
|
||||
+181
-58
@@ -520,7 +520,7 @@ namespace UF
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "UF::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -584,7 +584,12 @@ namespace UF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -1272,7 +1277,7 @@ namespace UF
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "UF::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -1345,6 +1350,8 @@ namespace UF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToUFCorpseSlot(emu->slot_id);
|
||||
@@ -1510,6 +1517,8 @@ namespace UF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToUFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToUFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1769,7 +1778,7 @@ namespace UF
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1778,7 +1787,7 @@ namespace UF
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1790,13 +1799,13 @@ namespace UF
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -3496,6 +3505,8 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = UFToServerCorpseSlot(eq->slot_id);
|
||||
@@ -3509,7 +3520,7 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[UF] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = UFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = UFToServerSlot(eq->to_slot);
|
||||
@@ -3810,7 +3821,7 @@ namespace UF
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -4096,81 +4107,193 @@ namespace UF
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::slotGeneral8 && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::slotGeneral9)
|
||||
SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline uint32 ServerToUFSlot(uint32 serverSlot)
|
||||
{
|
||||
uint32 UnderfootSlot = 0;
|
||||
uint32 UFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
UnderfootSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END)
|
||||
UnderfootSlot = serverSlot + 11;
|
||||
else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END)
|
||||
UnderfootSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END)
|
||||
UnderfootSlot = serverSlot + 1;
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
UnderfootSlot = invslot::slotPowerSource;
|
||||
else
|
||||
UnderfootSlot = serverSlot;
|
||||
if (serverSlot <= EQEmu::invslot::slotGeneral8) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
return UnderfootSlot;
|
||||
else if (serverSlot <= EQEmu::invslot::CORPSE_END && serverSlot >= EQEmu::invslot::slotCursor) {
|
||||
UFSlot = serverSlot - 2;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot + 11;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
UFSlot = serverSlot - 9;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to UF Slot %i", serverSlot, UFSlot);
|
||||
|
||||
return UFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToUFCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
//uint32 UnderfootCorpse;
|
||||
return (serverCorpseSlot + 1);
|
||||
uint32 UFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) {
|
||||
UFSlot = serverCorpseSlot;
|
||||
}
|
||||
|
||||
else if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::slotCursor) {
|
||||
UFSlot = serverCorpseSlot - 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to UF Corpse Slot %i", serverCorpseSlot, UFSlot);
|
||||
|
||||
return UFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 UFToServerSlot(uint32 ufSlot)
|
||||
{
|
||||
uint32 ServerSlot = 0;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (ufSlot >= invslot::slotAmmo && ufSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = ufSlot - 1;
|
||||
else if (ufSlot >= invbag::GENERAL_BAGS_BEGIN && ufSlot <= invbag::CURSOR_BAG_END)
|
||||
ServerSlot = ufSlot - 11;
|
||||
else if (ufSlot >= invbag::BANK_BAGS_BEGIN && ufSlot <= invbag::BANK_BAGS_END)
|
||||
ServerSlot = ufSlot - 1;
|
||||
else if (ufSlot >= invbag::SHARED_BANK_BAGS_BEGIN && ufSlot <= invbag::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = ufSlot - 1;
|
||||
else if (ufSlot == invslot::slotPowerSource)
|
||||
ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
else
|
||||
if (ufSlot <= invslot::slotGeneral8) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::CORPSE_END && ufSlot >= invslot::slotCursor) {
|
||||
ServerSlot = ufSlot + 2;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::GENERAL_BAGS_END && ufSlot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot - 11;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::CURSOR_BAG_END && ufSlot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
ServerSlot = ufSlot + 9;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::TRIBUTE_END && ufSlot >= invslot::TRIBUTE_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::GUILD_TRIBUTE_END && ufSlot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::BANK_END && ufSlot >= invslot::BANK_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::BANK_BAGS_END && ufSlot >= invbag::BANK_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot - 1;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::SHARED_BANK_END && ufSlot >= invslot::SHARED_BANK_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::SHARED_BANK_BAGS_END && ufSlot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot - 1;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::TRADE_END && ufSlot >= invslot::TRADE_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::TRADE_BAGS_END && ufSlot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::WORLD_END && ufSlot >= invslot::WORLD_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert UF Slot %i to Server Slot %i", ufSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 UFToServerCorpseSlot(uint32 ufCorpseSlot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return (ufCorpseSlot - 1);
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (ufCorpseSlot <= invslot::slotGeneral8 && ufCorpseSlot >= invslot::slotGeneral1) {
|
||||
ServerSlot = ufCorpseSlot;
|
||||
}
|
||||
|
||||
else if (ufCorpseSlot <= invslot::CORPSE_END && ufCorpseSlot >= invslot::slotCursor) {
|
||||
ServerSlot = ufCorpseSlot + 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert UF Corpse Slot %i to Server Corpse Slot %i", ufCorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToUFSayLink(std::string& ufSayLink, const std::string& serverSayLink)
|
||||
|
||||
+48
-7
@@ -547,9 +547,12 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool
|
||||
return true;
|
||||
}
|
||||
|
||||
// Overloaded: Retrieve character inventory based on character id
|
||||
// Overloaded: Retrieve character inventory based on character id (zone entry)
|
||||
bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
{
|
||||
if (!char_id || !inv)
|
||||
return false;
|
||||
|
||||
// Retrieve character inventory
|
||||
std::string query =
|
||||
StringFormat("SELECT slotid, itemid, charges, color, augslot1, augslot2, augslot3, augslot4, augslot5, "
|
||||
@@ -566,8 +569,40 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
|
||||
auto timestamps = GetItemRecastTimestamps(char_id);
|
||||
|
||||
auto cv_conflict = false;
|
||||
auto pmask = inv->GetLookup()->PossessionsBitmask;
|
||||
auto bank_size = inv->GetLookup()->InventoryTypeSize[EQEmu::invtype::typeBank];
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
int16 slot_id = atoi(row[0]);
|
||||
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) { // Titanium thru UF check
|
||||
if ((((uint64)1 << slot_id) & pmask) == 0) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { // Titanium thru UF check
|
||||
auto parent_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << parent_slot) & pmask) == 0) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) { // Titanium check
|
||||
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= bank_size) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) { // Titanium check
|
||||
auto parent_index = ((slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if (parent_index < EQEmu::invslot::SLOT_BEGIN || parent_index >= bank_size) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 item_id = atoi(row[1]);
|
||||
uint16 charges = atoi(row[2]);
|
||||
uint32 color = atoul(row[3]);
|
||||
@@ -633,10 +668,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
inst->SetOrnamentationIDFile(ornament_idfile);
|
||||
inst->SetOrnamentHeroModel(item->HerosForgeModel);
|
||||
|
||||
if (instnodrop ||
|
||||
(((slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN && slot_id <= EQEmu::invslot::EQUIPMENT_END) ||
|
||||
slot_id == EQEmu::invslot::SLOT_POWER_SOURCE) &&
|
||||
inst->GetItem()->Attuneable))
|
||||
if (instnodrop || (inst->GetItem()->Attuneable && slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN && slot_id <= EQEmu::invslot::EQUIPMENT_END))
|
||||
inst->SetAttuned(true);
|
||||
|
||||
if (color > 0)
|
||||
@@ -684,13 +716,22 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
char_id, item_id, slot_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_conflict) {
|
||||
char char_name[64] = "";
|
||||
GetCharName(char_id, char_name);
|
||||
Log(Logs::General, Logs::Client_Login,
|
||||
"ClientVersion conflict during inventory load at zone entry for '%s' (charid: %u, inver: %s)",
|
||||
char_name, char_id, EQEmu::versions::MobVersionName(inv->InventoryVersion())
|
||||
); // this can be changed to moderate after live testing
|
||||
}
|
||||
|
||||
// Retrieve shared inventory
|
||||
return GetSharedBank(char_id, inv, true);
|
||||
}
|
||||
|
||||
// Overloaded: Retrieve character inventory based on account_id and character name
|
||||
bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv)
|
||||
// Overloaded: Retrieve character inventory based on account_id and character name (char select)
|
||||
bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv) // deprecated
|
||||
{
|
||||
// Retrieve character inventory
|
||||
std::string query =
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ class SharedDatabase : public Database
|
||||
int32 GetSharedPlatinum(uint32 account_id);
|
||||
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
||||
bool GetInventory(uint32 char_id, EQEmu::InventoryProfile* inv);
|
||||
bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv);
|
||||
bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv); // deprecated
|
||||
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
|
||||
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
|
||||
void ClearOldRecastTimestamps(uint32 char_id);
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@
|
||||
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9125
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9127
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9019
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9020
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user