mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-05 11:26:35 +00:00
Merge upstream
This commit is contained in:
+85
-75
@@ -166,7 +166,7 @@ ItemInst* Inventory::GetItem(int16 slot_id) const
|
||||
ItemInst* result = nullptr;
|
||||
|
||||
// Cursor
|
||||
if (slot_id == EmuConstants::CURSOR) {
|
||||
if (slot_id == MainCursor) {
|
||||
// Cursor slot
|
||||
result = m_cursor.peek_front();
|
||||
}
|
||||
@@ -188,7 +188,7 @@ ItemInst* Inventory::GetItem(int16 slot_id) const
|
||||
result = _GetItem(m_inv, slot_id);
|
||||
}
|
||||
else if ((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) ||
|
||||
(slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) || (slot_id == EmuConstants::POWER_SOURCE)) {
|
||||
(slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) || (slot_id == MainPowerSource)) {
|
||||
// Equippable slots (on body)
|
||||
result = _GetItem(m_worn, slot_id);
|
||||
}
|
||||
@@ -318,7 +318,7 @@ bool Inventory::CheckNoDrop(int16 slot_id) {
|
||||
if (!inst) return false;
|
||||
if (!inst->GetItem()->NoDrop) return true;
|
||||
if (inst->GetItem()->ItemClass == 1) {
|
||||
for (uint8 i = 0; i < 10; i++) {
|
||||
for (uint8 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) {
|
||||
ItemInst* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i));
|
||||
if (bagitem && !bagitem->GetItem()->NoDrop) return true;
|
||||
}
|
||||
@@ -332,26 +332,30 @@ ItemInst* Inventory::PopItem(int16 slot_id)
|
||||
{
|
||||
ItemInst* p = nullptr;
|
||||
|
||||
if (slot_id == MainCursor) { // Cursor
|
||||
if (slot_id == MainCursor) {
|
||||
p = m_cursor.pop();
|
||||
}
|
||||
else if ((slot_id >= 0 && slot_id <= 21) || (slot_id >= 400 && slot_id <= 404) || (slot_id == 9999)) { // Worn slots
|
||||
else if ((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || (slot_id == MainPowerSource)) {
|
||||
p = m_worn[slot_id];
|
||||
m_worn.erase(slot_id);
|
||||
}
|
||||
else if ((slot_id >= 22 && slot_id <= 29)) {
|
||||
else if ((slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END)) {
|
||||
p = m_inv[slot_id];
|
||||
m_inv.erase(slot_id);
|
||||
}
|
||||
else if (slot_id >= 2000 && slot_id <= 2023) { // Bank slots
|
||||
else if (slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) {
|
||||
p = m_worn[slot_id];
|
||||
m_worn.erase(slot_id);
|
||||
}
|
||||
else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) {
|
||||
p = m_bank[slot_id];
|
||||
m_bank.erase(slot_id);
|
||||
}
|
||||
else if (slot_id >= 2500 && slot_id <= 2501) { // Shared bank slots
|
||||
else if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_END) {
|
||||
p = m_shbank[slot_id];
|
||||
m_shbank.erase(slot_id);
|
||||
}
|
||||
else if (slot_id >= 3000 && slot_id <= 3007) { // Trade window slots
|
||||
else if (slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END) {
|
||||
p = m_trade[slot_id];
|
||||
m_trade.erase(slot_id);
|
||||
}
|
||||
@@ -371,7 +375,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) {
|
||||
|
||||
if (ItemToTry->Stackable) {
|
||||
|
||||
for (int16 i = 22; i <= 29; i++) {
|
||||
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
|
||||
|
||||
ItemInst* InvItem = GetItem(i);
|
||||
|
||||
@@ -387,9 +391,9 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) {
|
||||
}
|
||||
if (InvItem && InvItem->IsType(ItemClassContainer)) {
|
||||
|
||||
int16 BaseSlotID = Inventory::CalcSlotId(i, 0);
|
||||
int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN);
|
||||
uint8 BagSize = InvItem->GetItem()->BagSlots;
|
||||
for (uint8 BagSlot = 0; BagSlot < BagSize; BagSlot++) {
|
||||
for (uint8 BagSlot = SUB_BEGIN; BagSlot < BagSize; BagSlot++) {
|
||||
|
||||
InvItem = GetItem(BaseSlotID + BagSlot);
|
||||
|
||||
@@ -408,7 +412,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) {
|
||||
}
|
||||
}
|
||||
|
||||
for (int16 i = 22; i <= 29; i++) {
|
||||
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
|
||||
|
||||
ItemInst* InvItem = GetItem(i);
|
||||
|
||||
@@ -431,11 +435,11 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) {
|
||||
}
|
||||
else if (InvItem->IsType(ItemClassContainer) && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) {
|
||||
|
||||
int16 BaseSlotID = Inventory::CalcSlotId(i, 0);
|
||||
int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN);
|
||||
|
||||
uint8 BagSize = InvItem->GetItem()->BagSlots;
|
||||
|
||||
for (uint8 BagSlot = 0; BagSlot<BagSize; BagSlot++) {
|
||||
for (uint8 BagSlot = SUB_BEGIN; BagSlot<BagSize; BagSlot++) {
|
||||
|
||||
InvItem = GetItem(BaseSlotID + BagSlot);
|
||||
|
||||
@@ -611,14 +615,14 @@ int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where)
|
||||
int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow)
|
||||
{
|
||||
// Check basic inventory
|
||||
for (int16 i = 22; i <= 29; i++) {
|
||||
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
|
||||
if (!GetItem(i))
|
||||
// Found available slot in personal inventory
|
||||
return i;
|
||||
}
|
||||
|
||||
if (!for_bag) {
|
||||
for (int16 i = 22; i <= 29; i++) {
|
||||
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
|
||||
const ItemInst* inst = GetItem(i);
|
||||
if (inst && inst->IsType(ItemClassContainer)
|
||||
&& inst->GetItem()->BagSize >= min_size)
|
||||
@@ -628,11 +632,11 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
|
||||
continue;
|
||||
}
|
||||
|
||||
int16 base_slot_id = Inventory::CalcSlotId(i, 0);
|
||||
int16 base_slot_id = Inventory::CalcSlotId(i, SUB_BEGIN);
|
||||
|
||||
uint8 slots = inst->GetItem()->BagSlots;
|
||||
uint8 j;
|
||||
for (j = 0; j<slots; j++) {
|
||||
for (j = SUB_BEGIN; j<slots; j++) {
|
||||
if (!GetItem(base_slot_id + j))
|
||||
// Found available slot within bag
|
||||
return (base_slot_id + j);
|
||||
@@ -658,10 +662,10 @@ int16 Inventory::CalcSlotId(int16 slot_id) {
|
||||
parent_slot_id = EmuConstants::GENERAL_BEGIN + (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE;
|
||||
|
||||
else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END)
|
||||
parent_slot_id = EmuConstants::CURSOR;
|
||||
parent_slot_id = MainCursor;
|
||||
|
||||
/*
|
||||
// this is not a bag range...
|
||||
// this is not a bag range... using this risks over-writing existing items
|
||||
else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END)
|
||||
parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE;
|
||||
*/
|
||||
@@ -686,7 +690,7 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
|
||||
|
||||
int16 slot_id = INVALID_INDEX;
|
||||
|
||||
if (bagslot_id == EmuConstants::CURSOR || bagslot_id == 8000)
|
||||
if (bagslot_id == MainCursor || bagslot_id == 8000)
|
||||
slot_id = EmuConstants::CURSOR_BAG_BEGIN + bagidx;
|
||||
|
||||
else if (bagslot_id >= EmuConstants::GENERAL_BEGIN && bagslot_id <= EmuConstants::GENERAL_END)
|
||||
@@ -714,7 +718,7 @@ uint8 Inventory::CalcBagIdx(int16 slot_id) {
|
||||
index = (slot_id - EmuConstants::CURSOR_BAG_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots
|
||||
|
||||
/*
|
||||
// this is not a bag range...
|
||||
// this is not a bag range... using this risks over-writing existing items
|
||||
else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END)
|
||||
index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE;
|
||||
*/
|
||||
@@ -806,41 +810,41 @@ bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_S
|
||||
// Test whether a given slot can support a container item
|
||||
bool Inventory::SupportsContainers(int16 slot_id)
|
||||
{
|
||||
if ((slot_id >= 22 && slot_id <= 30) || // Personal inventory slots
|
||||
(slot_id >= 2000 && slot_id <= 2023) || // Bank slots
|
||||
(slot_id >= 2500 && slot_id <= 2501) || // Shared bank slots
|
||||
(slot_id == MainCursor) || // Cursor
|
||||
(slot_id >= 3000 && slot_id <= 3007)) // Trade window
|
||||
if ((slot_id == MainCursor) ||
|
||||
(slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END) ||
|
||||
(slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) ||
|
||||
(slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_END) ||
|
||||
(slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int Inventory::GetSlotByItemInst(ItemInst *inst) {
|
||||
if (!inst)
|
||||
return -1;
|
||||
return INVALID_INDEX;
|
||||
|
||||
int i = GetSlotByItemInstCollection(m_worn, inst);
|
||||
if (i != -1) {
|
||||
if (i != INVALID_INDEX) {
|
||||
return i;
|
||||
}
|
||||
|
||||
i = GetSlotByItemInstCollection(m_inv, inst);
|
||||
if (i != -1) {
|
||||
if (i != INVALID_INDEX) {
|
||||
return i;
|
||||
}
|
||||
|
||||
i = GetSlotByItemInstCollection(m_bank, inst);
|
||||
if (i != -1) {
|
||||
if (i != INVALID_INDEX) {
|
||||
return i;
|
||||
}
|
||||
|
||||
i = GetSlotByItemInstCollection(m_shbank, inst);
|
||||
if (i != -1) {
|
||||
if (i != INVALID_INDEX) {
|
||||
return i;
|
||||
}
|
||||
|
||||
i = GetSlotByItemInstCollection(m_trade, inst);
|
||||
if (i != -1) {
|
||||
if (i != INVALID_INDEX) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -848,7 +852,7 @@ int Inventory::GetSlotByItemInst(ItemInst *inst) {
|
||||
return MainCursor;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
|
||||
void Inventory::dumpEntireInventory() {
|
||||
@@ -963,29 +967,33 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst)
|
||||
|
||||
int16 result = INVALID_INDEX;
|
||||
|
||||
if (slot_id == MainCursor) { // Cursor
|
||||
if (slot_id == MainCursor) {
|
||||
// Replace current item on cursor, if exists
|
||||
m_cursor.pop(); // no memory delete, clients of this function know what they are doing
|
||||
m_cursor.push_front(inst);
|
||||
result = slot_id;
|
||||
}
|
||||
else if ((slot_id >= 0 && slot_id <= 21) || (slot_id >= 400 && slot_id <= 404) || (slot_id == 9999)) { // Worn slots
|
||||
else if ((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || (slot_id == MainPowerSource)) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if ((slot_id >= 22 && slot_id <= 29)) {
|
||||
else if ((slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END)) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= 2000 && slot_id <= 2023) { // Bank slots
|
||||
else if (slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= 2500 && slot_id <= 2501) { // Shared bank slots
|
||||
else if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_END) {
|
||||
m_shbank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= 3000 && slot_id <= 3007) { // Trade window slots
|
||||
else if (slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END) {
|
||||
m_trade[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
@@ -1024,9 +1032,9 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, ui
|
||||
return it->first;
|
||||
}
|
||||
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (inst->GetAugmentItemID(i) == item_id && quantity <= 1)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
}
|
||||
// Go through bag, if bag
|
||||
@@ -1039,9 +1047,9 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, ui
|
||||
if (quantity_found >= quantity)
|
||||
return Inventory::CalcSlotId(it->first, itb->first);
|
||||
}
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1068,9 +1076,9 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
|
||||
if (quantity_found >= quantity)
|
||||
return MainCursor;
|
||||
}
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (inst->GetAugmentItemID(i) == item_id && quantity <= 1)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
}
|
||||
// Go through bag, if bag
|
||||
@@ -1083,9 +1091,9 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
|
||||
if (quantity_found >= quantity)
|
||||
return Inventory::CalcSlotId(MainCursor, itb->first);
|
||||
}
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1179,10 +1187,10 @@ int16 Inventory::_HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32
|
||||
return it->first;
|
||||
|
||||
ItemInst* Aug;
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
Aug = inst->GetAugment(i);
|
||||
if (Aug && Aug->GetItem()->LoreGroup == loregroup)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
}
|
||||
// Go through bag, if bag
|
||||
@@ -1194,10 +1202,10 @@ int16 Inventory::_HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32
|
||||
return Inventory::CalcSlotId(it->first, itb->first);
|
||||
|
||||
ItemInst* Aug2;
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
Aug2 = baginst->GetAugment(i);
|
||||
if (Aug2 && Aug2->GetItem()->LoreGroup == loregroup)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1222,10 +1230,10 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
|
||||
return MainCursor;
|
||||
|
||||
ItemInst* Aug;
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
Aug = inst->GetAugment(i);
|
||||
if (Aug && Aug->GetItem()->LoreGroup == loregroup)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
}
|
||||
// Go through bag, if bag
|
||||
@@ -1238,10 +1246,10 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
|
||||
|
||||
|
||||
ItemInst* Aug2;
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
Aug2 = baginst->GetAugment(i);
|
||||
if (Aug2 && Aug2->GetItem()->LoreGroup == loregroup)
|
||||
return SLOT_AUGMENT; // Only one augment per slot.
|
||||
return legacy::SLOT_AUGMENT; // Only one augment per slot.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1417,14 +1425,15 @@ bool ItemInst::IsEquipable(int16 slot_id) const
|
||||
if (!m_item)
|
||||
return false;
|
||||
|
||||
if (slot_id == 9999) {
|
||||
slot_id = 22;
|
||||
// another "shouldn't do" fix..will be fixed in future updates (requires code and database work)
|
||||
if (slot_id == MainPowerSource) {
|
||||
slot_id = MainGeneral1;
|
||||
uint32 slot_mask = (1 << slot_id);
|
||||
if (slot_mask & m_item->Slots)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (slot_id < 22) {
|
||||
if ((uint16)slot_id <= EmuConstants::EQUIPMENT_END) {
|
||||
uint32 slot_mask = (1 << slot_id);
|
||||
if (slot_mask & m_item->Slots)
|
||||
return true;
|
||||
@@ -1433,13 +1442,14 @@ bool ItemInst::IsEquipable(int16 slot_id) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ItemInst::AvailableWearSlot(uint32 aug_wear_slots) const
|
||||
{
|
||||
bool ItemInst::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->ItemClass != ItemClassCommon || !m_item)
|
||||
return false;
|
||||
|
||||
int i;
|
||||
for (i = 0; i<23; i++) {
|
||||
for (i = EmuConstants::EQUIPMENT_BEGIN; i <= MainGeneral1; i++) { // MainGeneral1 should be EmuConstants::EQUIPMENT_END
|
||||
if (m_item->Slots & (1 << i)) {
|
||||
if (aug_wear_slots & (1 << i))
|
||||
break;
|
||||
@@ -1455,7 +1465,7 @@ int8 ItemInst::AvailableAugmentSlot(int32 augtype) const
|
||||
return -1;
|
||||
|
||||
int i;
|
||||
for (i = 0; i<5; i++) {
|
||||
for (i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (!GetItem(i)) {
|
||||
if (augtype == -1 || (m_item->AugSlotType[i] && ((1 << (m_item->AugSlotType[i] - 1)) & augtype)))
|
||||
break;
|
||||
@@ -1463,7 +1473,7 @@ int8 ItemInst::AvailableAugmentSlot(int32 augtype) const
|
||||
|
||||
}
|
||||
|
||||
return (i<5) ? i : -1;
|
||||
return (i < EmuConstants::ITEM_COMMON_SIZE) ? i : INVALID_INDEX;
|
||||
}
|
||||
|
||||
// Retrieve item inside container
|
||||
@@ -1481,7 +1491,7 @@ ItemInst* ItemInst::GetItem(uint8 index) const
|
||||
uint32 ItemInst::GetItemID(uint8 slot) const
|
||||
{
|
||||
const ItemInst *item;
|
||||
uint32 id = 0;
|
||||
uint32 id = NO_ITEM;
|
||||
if ((item = GetItem(slot)) != nullptr)
|
||||
id = item->GetItem()->ID;
|
||||
|
||||
@@ -1586,12 +1596,12 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
|
||||
uint8 ItemInst::FirstOpenSlot() const
|
||||
{
|
||||
uint8 slots = m_item->BagSlots, i;
|
||||
for (i = 0; i<slots; i++) {
|
||||
for (i = SUB_BEGIN; i < slots; i++) {
|
||||
if (!GetItem(i))
|
||||
break;
|
||||
}
|
||||
|
||||
return (i<slots) ? i : 0xff;
|
||||
return (i < slots) ? i : INVALID_INDEX;
|
||||
}
|
||||
|
||||
uint8 ItemInst::GetTotalItemCount() const
|
||||
@@ -1600,7 +1610,7 @@ uint8 ItemInst::GetTotalItemCount() const
|
||||
|
||||
if (m_item->ItemClass != ItemClassContainer) { return item_count; }
|
||||
|
||||
for (int idx = 0; idx < m_item->BagSlots; idx++) { if (GetItem(idx)) { item_count++; } }
|
||||
for (int idx = SUB_BEGIN; idx < m_item->BagSlots; idx++) { if (GetItem(idx)) { item_count++; } }
|
||||
|
||||
return item_count;
|
||||
}
|
||||
@@ -1610,7 +1620,7 @@ bool ItemInst::IsNoneEmptyContainer()
|
||||
if (m_item->ItemClass != ItemClassContainer)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < m_item->BagSlots; ++i)
|
||||
for (int i = SUB_BEGIN; i < m_item->BagSlots; ++i)
|
||||
if (GetItem(i))
|
||||
return true;
|
||||
|
||||
@@ -1628,7 +1638,7 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const
|
||||
|
||||
uint32 ItemInst::GetAugmentItemID(uint8 slot) const
|
||||
{
|
||||
uint32 id = 0;
|
||||
uint32 id = NO_ITEM;
|
||||
if (m_item->ItemClass == ItemClassCommon) {
|
||||
return GetItemID(slot);
|
||||
}
|
||||
@@ -1645,7 +1655,7 @@ void ItemInst::PutAugment(uint8 slot, const ItemInst& augment)
|
||||
|
||||
void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id)
|
||||
{
|
||||
if (item_id != 0) {
|
||||
if (item_id != NO_ITEM) {
|
||||
const ItemInst* aug = db->CreateItem(item_id);
|
||||
if (aug)
|
||||
{
|
||||
@@ -1673,7 +1683,7 @@ ItemInst* ItemInst::RemoveAugment(uint8 index)
|
||||
|
||||
bool ItemInst::IsAugmented()
|
||||
{
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; ++i)
|
||||
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; ++i)
|
||||
if (GetAugmentItemID(i))
|
||||
return true;
|
||||
|
||||
@@ -1790,8 +1800,8 @@ bool ItemInst::IsSlotAllowed(int16 slot_id) const {
|
||||
if (!m_item) { return false; }
|
||||
else if (Inventory::SupportsContainers(slot_id)) { return true; }
|
||||
else if (m_item->Slots & (1 << slot_id)) { return true; }
|
||||
else if (slot_id == 9999 && (m_item->Slots & (1 << 22))) { return true; }
|
||||
else if (slot_id != 9999 && slot_id > 21) { return true; }
|
||||
else if (slot_id == MainPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... <watch>
|
||||
else if (slot_id != MainPowerSource && slot_id > EmuConstants::EQUIPMENT_END) { return true; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -365,7 +365,7 @@ public:
|
||||
bool IsActivated() { return m_activated; }
|
||||
void SetActivated(bool activated) { m_activated = activated; }
|
||||
int8 GetEvolveLvl() const { return m_evolveLvl; }
|
||||
void SetScaling(bool v) { m_scaling = v; }
|
||||
void SetScaling(bool v) { m_scaling = v; }
|
||||
|
||||
void Initialize(SharedDatabase *db = nullptr);
|
||||
void ScaleItem();
|
||||
@@ -413,9 +413,9 @@ protected:
|
||||
|
||||
//
|
||||
// Items inside of this item (augs or contents);
|
||||
std::map<uint8, ItemInst*> m_contents; // Zero-based index: min=0, max=9
|
||||
std::map<std::string, std::string> m_custom_data;
|
||||
std::map<std::string, Timer> m_timers;
|
||||
std::map<uint8, ItemInst*> m_contents; // Zero-based index: min=0, max=9
|
||||
std::map<std::string, std::string> m_custom_data;
|
||||
std::map<std::string, Timer> m_timers;
|
||||
};
|
||||
|
||||
class EvolveInfo {
|
||||
|
||||
+2
-2
@@ -605,7 +605,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
|
||||
// now the inventory
|
||||
std::string invquery;
|
||||
for (int16 i=EmuConstants::POSSESSIONS_BEGIN; i<=EmuConstants::BANK_BAGS_END;)
|
||||
for (int16 i=EmuConstants::EQUIPMENT_BEGIN; i<=EmuConstants::BANK_BAGS_END;)
|
||||
{
|
||||
const ItemInst* newinv = inv->GetItem(i);
|
||||
if (!newinv)
|
||||
@@ -622,7 +622,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
#endif
|
||||
}
|
||||
|
||||
if (i == EmuConstants::CURSOR) {
|
||||
if (i == MainCursor) {
|
||||
i = EmuConstants::GENERAL_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
|
||||
+80
-68
@@ -877,74 +877,6 @@ enum InventoryMainTypes : int16 {
|
||||
_MainCount
|
||||
};
|
||||
|
||||
enum InventorySlot
|
||||
{
|
||||
////////////////////////
|
||||
// Equip slots
|
||||
////////////////////////
|
||||
|
||||
//SLOT_CHARM = 0,
|
||||
//SLOT_EAR01 = 1,
|
||||
//SLOT_HEAD = 2,
|
||||
//SLOT_FACE = 3,
|
||||
//SLOT_EAR02 = 4,
|
||||
//SLOT_NECK = 5,
|
||||
//SLOT_SHOULDER = 6,
|
||||
//SLOT_ARMS = 7,
|
||||
//SLOT_BACK = 8,
|
||||
//SLOT_BRACER01 = 9,
|
||||
//SLOT_BRACER02 = 10,
|
||||
//SLOT_RANGE = 11,
|
||||
//SLOT_HANDS = 12,
|
||||
//SLOT_PRIMARY = 13,
|
||||
//SLOT_SECONDARY = 14,
|
||||
//SLOT_RING01 = 15,
|
||||
//SLOT_RING02 = 16,
|
||||
//SLOT_CHEST = 17,
|
||||
//SLOT_LEGS = 18,
|
||||
//SLOT_FEET = 19,
|
||||
//SLOT_WAIST = 20,
|
||||
//SLOT_AMMO = 21,
|
||||
|
||||
////////////////////////
|
||||
// All other slots
|
||||
////////////////////////
|
||||
//SLOT_PERSONAL_BEGIN = 22,
|
||||
//SLOT_PERSONAL_END = 29,
|
||||
|
||||
//SLOT_CURSOR = 30,
|
||||
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // Last item on cursor queue
|
||||
// Cursor bag slots are 331->340 (10 slots)
|
||||
|
||||
// Personal Inventory Slots
|
||||
// Slots 1 through 8 are slots 22->29
|
||||
// Inventory bag slots are 251->330 (10 slots per bag)
|
||||
|
||||
// Tribute slots are 400-404? (upper bound unknown)
|
||||
// storing these in worn item's map
|
||||
|
||||
// Bank slots
|
||||
// Bank slots 1 through 16 are slots 2000->2015
|
||||
// Bank bag slots are 2031->2190
|
||||
|
||||
// Shared bank slots
|
||||
// Shared bank slots 1 through 2 are slots 2500->2501
|
||||
// Shared bank bag slots are 2531->2550
|
||||
|
||||
// Trade session slots
|
||||
// Trade slots 1 through 8 are slots 3000->3007
|
||||
// Trade bag slots are technically 0->79 when passed to client,
|
||||
// but in our code, we treat them as slots 3100->3179
|
||||
|
||||
// Slot used in OP_TradeSkillCombine for world tradeskill containers
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001//,
|
||||
//SLOT_POWER_SOURCE = 9999//,
|
||||
// Value recognized by client for destroying an item
|
||||
//SLOT_INVALID = (int16)0xFFFF
|
||||
};
|
||||
|
||||
#define INVALID_INDEX -1
|
||||
#define NOT_USED 0
|
||||
#define NO_ITEM 0
|
||||
@@ -956,4 +888,84 @@ enum InventorySlot
|
||||
#define SUB_BEGIN 0
|
||||
#define AUG_BEGIN 0
|
||||
|
||||
namespace legacy {
|
||||
// this is for perl and other legacy systems
|
||||
|
||||
typedef enum {
|
||||
SLOT_CHARM = 0,
|
||||
SLOT_EAR01 = 1,
|
||||
SLOT_HEAD = 2,
|
||||
SLOT_FACE = 3,
|
||||
SLOT_EAR02 = 4,
|
||||
SLOT_NECK = 5,
|
||||
SLOT_SHOULDER = 6,
|
||||
SLOT_ARMS = 7,
|
||||
SLOT_BACK = 8,
|
||||
SLOT_BRACER01 = 9,
|
||||
SLOT_BRACER02 = 10,
|
||||
SLOT_RANGE = 11,
|
||||
SLOT_HANDS = 12,
|
||||
SLOT_PRIMARY = 13,
|
||||
SLOT_SECONDARY = 14,
|
||||
SLOT_RING01 = 15,
|
||||
SLOT_RING02 = 16,
|
||||
SLOT_CHEST = 17,
|
||||
SLOT_LEGS = 18,
|
||||
SLOT_FEET = 19,
|
||||
SLOT_WAIST = 20,
|
||||
SLOT_POWER_SOURCE = 9999,
|
||||
SLOT_AMMO = 21,
|
||||
SLOT_GENERAL_1 = 22,
|
||||
SLOT_GENERAL_2 = 23,
|
||||
SLOT_GENERAL_3 = 24,
|
||||
SLOT_GENERAL_4 = 25,
|
||||
SLOT_GENERAL_5 = 26,
|
||||
SLOT_GENERAL_6 = 27,
|
||||
SLOT_GENERAL_7 = 28,
|
||||
SLOT_GENERAL_8 = 29,
|
||||
//SLOT_GENERAL_9 = not supported
|
||||
//SLOT_GENERAL_10 = not supported
|
||||
SLOT_CURSOR = 30,
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001,
|
||||
SLOT_INVALID = (int16)0xFFFF,
|
||||
|
||||
SLOT_POSSESSIONS_BEGIN = 0,
|
||||
SLOT_POSSESSIONS_END = 30,
|
||||
|
||||
SLOT_EQUIPMENT_BEGIN = 0,
|
||||
SLOT_EQUIPMENT_END = 21,
|
||||
|
||||
SLOT_PERSONAL_BEGIN = 22,
|
||||
SLOT_PERSONAL_END = 29,
|
||||
SLOT_PERSONAL_BAGS_BEGIN = 251,
|
||||
SLOT_PERSONAL_BAGS_END = 330,
|
||||
|
||||
SLOT_CURSOR_BAG_BEGIN = 331,
|
||||
SLOT_CURSOR_BAG_END = 340,
|
||||
|
||||
SLOT_TRIBUTE_BEGIN = 400,
|
||||
SLOT_TRIBUTE_END = 404,
|
||||
|
||||
SLOT_BANK_BEGIN = 2000,
|
||||
SLOT_BANK_END = 2023,
|
||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||
SLOT_BANK_BAGS_END = 2270,
|
||||
|
||||
SLOT_SHARED_BANK_BEGIN = 2500,
|
||||
SLOT_SHARED_BANK_END = 2501,
|
||||
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
|
||||
SLOT_SHARED_BANK_BAGS_END = 2550,
|
||||
|
||||
SLOT_TRADE_BEGIN = 3000,
|
||||
SLOT_TRADE_END = 3007,
|
||||
SLOT_TRADE_BAGS_BEGIN = 3031,
|
||||
SLOT_TRADE_BAGS_END = 3110,
|
||||
|
||||
SLOT_WORLD_BEGIN = 4000,
|
||||
SLOT_WORLD_END = 4009
|
||||
} InventorySlot;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+187
-2
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "StringUtil.h"
|
||||
|
||||
//
|
||||
// class ServerConstants
|
||||
// class EmuConstants
|
||||
//
|
||||
uint16 EmuConstants::InventoryMapSize(int16 map) {
|
||||
switch (map) {
|
||||
@@ -255,8 +255,193 @@ std::string EmuConstants::InventoryAugName(int16 aug) {
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
// legacy-related functions
|
||||
//
|
||||
// class ClientLimits
|
||||
// these should work for the first-stage coversions..but, once the new system is up and going..conversions will be incompatible
|
||||
// without limiting server functions and other aspects, such as augment control, bag size, etc. A complete remapping will be
|
||||
// required when bag sizes over 10 and direct manipulation of augments are implemented, due to the massive increase in range usage.
|
||||
//
|
||||
// (current personal/cursor bag range {251..340}, or 90 slots ... conversion translated range would be {10000..12804}, or 2805 slots...
|
||||
// these would have to be hard-coded into all perl code to allow access to full range of the new system - actual limits would be
|
||||
// less, based on bag size..but, the range must be full and consistent to avoid translation issues -- similar changes to other ranges
|
||||
// (240 versus 6120 slots for bank bags, for example...))
|
||||
/*
|
||||
int EmuConstants::ServerToPerlSlot(int server_slot) { // set r/s
|
||||
switch (server_slot) {
|
||||
case legacy::SLOT_CURSOR_END:
|
||||
return legacy::SLOT_CURSOR_END;
|
||||
case INVALID_INDEX:
|
||||
return legacy::SLOT_INVALID;
|
||||
case MainPowerSource:
|
||||
return legacy::SLOT_POWER_SOURCE;
|
||||
case MainAmmo:
|
||||
return legacy::SLOT_AMMO;
|
||||
case MainCursor:
|
||||
return legacy::SLOT_CURSOR;
|
||||
case legacy::SLOT_TRADESKILL:
|
||||
return legacy::SLOT_TRADESKILL;
|
||||
case legacy::SLOT_AUGMENT:
|
||||
return legacy::SLOT_AUGMENT;
|
||||
default:
|
||||
int perl_slot = legacy::SLOT_INVALID;
|
||||
|
||||
// activate the internal checks as needed
|
||||
if (server_slot >= EmuConstants::EQUIPMENT_BEGIN && server_slot <= MainWaist) {
|
||||
perl_slot = server_slot;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::GENERAL_BEGIN && server_slot <= EmuConstants::GENERAL_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BEGIN - EmuConstants::GENERAL_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_PERSONAL_BEGIN || perl_slot > legacy::SLOT_PERSONAL_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::GENERAL_BAGS_BEGIN && server_slot <= EmuConstants::GENERAL_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BAGS_BEGIN - EmuConstants::GENERAL_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_PERSONAL_BAGS_BEGIN || perl_slot > legacy::SLOT_PERSONAL_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_CURSOR_BAG_BEGIN - EmuConstants::CURSOR_BAG_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_CURSOR_BAG_BEGIN || perl_slot > legacy::SLOT_CURSOR_BAG_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::TRIBUTE_BEGIN && server_slot <= EmuConstants::TRIBUTE_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_TRIBUTE_BEGIN - EmuConstants::TRADE_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_TRIBUTE_BEGIN || perl_slot > legacy::SLOT_TRIBUTE_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::BANK_BEGIN && server_slot <= EmuConstants::BANK_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_BANK_BEGIN - EmuConstants::BANK_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_BANK_BEGIN || perl_slot > legacy::SLOT_BANK_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::BANK_BAGS_BEGIN && server_slot <= EmuConstants::BANK_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_BANK_BAGS_BEGIN - EmuConstants::BANK_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_BANK_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::SHARED_BANK_BEGIN && server_slot <= EmuConstants::SHARED_BANK_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BEGIN - EmuConstants::SHARED_BANK_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_SHARED_BANK_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && server_slot <= EmuConstants::SHARED_BANK_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BAGS_BEGIN - EmuConstants::SHARED_BANK_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_SHARED_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::TRADE_BEGIN && server_slot <= EmuConstants::TRADE_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_TRADE_BEGIN - EmuConstants::TRADE_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_TRADE_BEGIN || perl_slot > legacy::SLOT_TRADE_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::TRADE_BAGS_BEGIN && server_slot <= EmuConstants::TRADE_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_TRADE_BAGS_BEGIN - EmuConstants::TRADE_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_TRADE_BAGS_BEGIN || perl_slot > legacy::SLOT_TRADE_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::WORLD_BEGIN && server_slot <= EmuConstants::WORLD_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_WORLD_BEGIN - EmuConstants::WORLD_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_WORLD_BEGIN || perl_slot > legacy::SLOT_WORLD_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= 8000 && server_slot <= 8999) { // this range may be limited to 36 in the future (client size)
|
||||
perl_slot = server_slot;
|
||||
}
|
||||
|
||||
return perl_slot;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
int EmuConstants::PerlToServerSlot(int perl_slot) { // set r/s
|
||||
switch (perl_slot) {
|
||||
case legacy::SLOT_CURSOR_END:
|
||||
return legacy::SLOT_CURSOR_END;
|
||||
case legacy::SLOT_INVALID:
|
||||
return INVALID_INDEX;
|
||||
case legacy::SLOT_POWER_SOURCE:
|
||||
return MainPowerSource;
|
||||
case legacy::SLOT_AMMO:
|
||||
return MainAmmo;
|
||||
case legacy::SLOT_CURSOR:
|
||||
return MainCursor;
|
||||
case legacy::SLOT_TRADESKILL:
|
||||
return legacy::SLOT_TRADESKILL;
|
||||
case legacy::SLOT_AUGMENT:
|
||||
return legacy::SLOT_AUGMENT;
|
||||
default:
|
||||
int server_slot = INVALID_INDEX;
|
||||
|
||||
// activate the internal checks as needed
|
||||
if (perl_slot >= legacy::SLOT_EQUIPMENT_BEGIN && perl_slot <= legacy::SLOT_WAIST) {
|
||||
server_slot = perl_slot;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_PERSONAL_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::GENERAL_BEGIN - legacy::SLOT_PERSONAL_BEGIN;
|
||||
//if (server_slot < EmuConstants::GENERAL_BEGIN || server_slot > EmuConstants::GENERAL_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_PERSONAL_BAGS_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::GENERAL_BAGS_BEGIN - legacy::SLOT_PERSONAL_BAGS_BEGIN;
|
||||
//if (server_slot < EmuConstants::GENERAL_BAGS_BEGIN || server_slot > EmuConstants::GENERAL_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_CURSOR_BAG_BEGIN && perl_slot <= legacy::SLOT_CURSOR_BAG_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::CURSOR_BAG_BEGIN - legacy::SLOT_CURSOR_BAG_BEGIN;
|
||||
//if (server_slot < EmuConstants::CURSOR_BAG_BEGIN || server_slot > EmuConstants::CURSOR_BAG_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_TRIBUTE_BEGIN && perl_slot <= legacy::SLOT_TRIBUTE_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::TRIBUTE_BEGIN - legacy::SLOT_TRIBUTE_BEGIN;
|
||||
//if (server_slot < EmuConstants::TRIBUTE_BEGIN || server_slot > EmuConstants::TRIBUTE_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_BANK_BEGIN && perl_slot <= legacy::SLOT_BANK_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::BANK_BEGIN - legacy::SLOT_BANK_BEGIN;
|
||||
//if (server_slot < EmuConstants::BANK_BEGIN || server_slot > EmuConstants::BANK_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_BANK_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::BANK_BAGS_BEGIN - legacy::SLOT_BANK_BAGS_BEGIN;
|
||||
//if (server_slot < EmuConstants::BANK_BAGS_BEGIN || server_slot > EmuConstants::BANK_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_SHARED_BANK_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BEGIN - legacy::SLOT_SHARED_BANK_BEGIN;
|
||||
//if (server_slot < EmuConstants::SHARED_BANK_BEGIN || server_slot > EmuConstants::SHARED_BANK_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_SHARED_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BAGS_BEGIN - legacy::SLOT_SHARED_BANK_BAGS_END;
|
||||
//if (server_slot < EmuConstants::SHARED_BANK_BAGS_BEGIN || server_slot > EmuConstants::SHARED_BANK_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_TRADE_BEGIN && perl_slot <= legacy::SLOT_TRADE_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::TRADE_BEGIN - legacy::SLOT_TRADE_BEGIN;
|
||||
//if (server_slot < EmuConstants::TRADE_BEGIN || server_slot > EmuConstants::TRADE_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_TRADE_BAGS_BEGIN && perl_slot <= legacy::SLOT_TRADE_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::TRADE_BAGS_BEGIN - legacy::SLOT_TRADE_BAGS_BEGIN;
|
||||
//if (server_slot < EmuConstants::TRADE_BAGS_BEGIN || server_slot > EmuConstants::TRADE_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_WORLD_BEGIN && perl_slot <= legacy::SLOT_WORLD_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::WORLD_BEGIN - legacy::SLOT_WORLD_BEGIN;
|
||||
//if (server_slot < EmuConstants::WORLD_BEGIN || server_slot > EmuConstants::WORLD_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= 8000 && perl_slot <= 8999) { // this range may be limited to 36 in the future (client size)
|
||||
server_slot = perl_slot;
|
||||
}
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// class EQLimits
|
||||
//
|
||||
// client validation
|
||||
bool EQLimits::IsValidClientVersion(uint32 version) {
|
||||
|
||||
+17
-13
@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//#include "../common/patches/RoF2_constants.h"
|
||||
|
||||
// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! ***
|
||||
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to them change are made!! ***
|
||||
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! ***
|
||||
|
||||
// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system
|
||||
|
||||
@@ -86,15 +86,10 @@ public:
|
||||
|
||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
||||
static const int16 POSSESSIONS_BEGIN = MainCharm;
|
||||
static const int16 POSSESSIONS_END = MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = MainCharm;
|
||||
static const int16 EQUIPMENT_END = MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
||||
|
||||
static const int16 POWER_SOURCE = MainPowerSource; // temp
|
||||
|
||||
static const int16 GENERAL_BEGIN = MainGeneral1;
|
||||
static const int16 GENERAL_END = MainGeneral8;
|
||||
static const uint16 GENERAL_SIZE = 8;
|
||||
@@ -102,7 +97,6 @@ public:
|
||||
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
||||
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 CURSOR = MainCursor;
|
||||
static const int16 CURSOR_BAG_BEGIN = 331;
|
||||
static const int16 CURSOR_BAG_END_OFFSET = 9;
|
||||
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
|
||||
@@ -128,23 +122,20 @@ public:
|
||||
|
||||
static const int16 WORLD_BEGIN = 4000;
|
||||
static const int16 WORLD_END = 4009;
|
||||
static const int16 WORLD_SIZE = 10;
|
||||
static const int16 WORLD_SIZE = MAP_WORLD_SIZE;
|
||||
|
||||
static const int16 TRIBUTE_BEGIN = 400;
|
||||
static const int16 TRIBUTE_END = 404;
|
||||
static const int16 TRIBUTE_SIZE = 5;
|
||||
static const int16 TRIBUTE_SIZE = MAP_TRIBUTE_SIZE;
|
||||
|
||||
static const int16 CORPSE_BEGIN = 22;
|
||||
//static const int16 CORPSE_END = RoF::consts::CORPSE_END; // not ready for use
|
||||
|
||||
static const int16 MATERIAL_BEGIN = MaterialHead;
|
||||
static const int16 MATERIAL_END = MaterialSecondary;
|
||||
static const int16 MATERIAL_TINT_END = MaterialFeet;
|
||||
static const int16 MATERIAL_SIZE = _MaterialCount;
|
||||
|
||||
static const int16 TINTABLE_BEGIN = MaterialHead;
|
||||
static const int16 TINTABLE_END = MaterialFeet;
|
||||
static const int16 TINTABLE_SIZE = 7;
|
||||
|
||||
// items
|
||||
// common and container sizes will not increase until the new 'location' struct is implemented
|
||||
static const uint16 ITEM_COMMON_SIZE = Underfoot::consts::ITEM_COMMON_SIZE;
|
||||
@@ -158,6 +149,10 @@ public:
|
||||
static const uint32 BANDOLIERS_COUNT = Titanium::consts::BANDOLIERS_COUNT; // count = number of bandolier instances
|
||||
static const uint32 BANDOLIER_SIZE = Titanium::consts::BANDOLIER_SIZE; // size = number of equipment slots in bandolier instance
|
||||
static const uint32 POTION_BELT_SIZE = Titanium::consts::POTION_BELT_SIZE;
|
||||
|
||||
// legacy-related functions
|
||||
//static int ServerToPerlSlot(int slot); // encode
|
||||
//static int PerlToServerSlot(int slot); // decode
|
||||
};
|
||||
|
||||
class EQLimits {
|
||||
@@ -204,3 +199,12 @@ public:
|
||||
};
|
||||
|
||||
#endif /* EQ_LIMITS_H */
|
||||
|
||||
/*
|
||||
Working Notes:
|
||||
--------------
|
||||
|
||||
- full review of client_packet.cpp and client translators needed
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@@ -103,6 +103,52 @@ const EQClientVersion Strategy::ClientVersion() const
|
||||
#include "SSDefine.h"
|
||||
|
||||
|
||||
/*
|
||||
// Converts Server Slot IDs to Client62 Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToClient62Slot(uint32 ServerSlot) {
|
||||
uint32 Client62Slot;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Client62 Slot IDs to Server Slot IDs for use in Decodes
|
||||
static inline uint32 Client62ToServerSlot(uint32 Client62Slot) {
|
||||
uint32 ServerSlot;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Server Corpse Slot IDs to Client62 Corpse Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToClient62CorpseSlot(uint32 ServerCorpse) {
|
||||
uint32 Client62Corpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Client62 Corpse Slot IDs to Server Corpse Slot IDs for use in Decodes
|
||||
static inline uint32 Client62ToServerCorpseSlot(uint32 Client62Corpse) {
|
||||
uint32 ServerCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
static inline uint32 RemovePowerSourceBit(uint32 slots) { // shouldn't need to add one..just grab the actual server reference, if so...
|
||||
static const uint32 BIT21 = 1 << 21;
|
||||
static const uint32 BIT22 = 1 << 22;
|
||||
static const uint32 KEEPBITS = ~(BIT21 | BIT22);
|
||||
|
||||
bool wearammo = slots & BIT22;
|
||||
|
||||
slots &= KEEPBITS;
|
||||
|
||||
if (wearammo)
|
||||
slots |= BIT21;
|
||||
|
||||
return slots;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
EAT_ENCODE(OP_ZoneServerReady)
|
||||
EAT_ENCODE(OP_GuildMemberLevelUpdate)
|
||||
|
||||
|
||||
@@ -126,9 +126,6 @@ namespace Client62 {
|
||||
static const uint16 MAP_KRONO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
static const int16 POSSESSIONS_BEGIN = slots::MainCharm;
|
||||
static const int16 POSSESSIONS_END = slots::MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
|
||||
static const int16 EQUIPMENT_END = slots::MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
|
||||
@@ -159,7 +156,7 @@ namespace Client62 {
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_END_NPC = 3003;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
+268
-262
@@ -107,125 +107,123 @@ const EQClientVersion Strategy::ClientVersion() const
|
||||
|
||||
#include "SSDefine.h"
|
||||
|
||||
// Converts Titanium Slot IDs to RoF Slot IDs for use in Encodes
|
||||
static inline structs::ItemSlotStruct TitaniumToRoFSlot(uint32 TitaniumSlot)
|
||||
{
|
||||
|
||||
// Converts Server Slot IDs to RoF Slot IDs for use in Encodes
|
||||
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 ServerSlot) {
|
||||
structs::ItemSlotStruct RoFSlot;
|
||||
RoFSlot.SlotType = 0xffff;
|
||||
RoFSlot.Unknown02 = 0;
|
||||
RoFSlot.MainSlot = 0xffff;
|
||||
RoFSlot.SubSlot = 0xffff;
|
||||
RoFSlot.AugSlot = 0xffff;
|
||||
RoFSlot.Unknown01 = 0;
|
||||
RoFSlot.SlotType = INVALID_INDEX;
|
||||
RoFSlot.Unknown02 = NOT_USED;
|
||||
RoFSlot.MainSlot = INVALID_INDEX;
|
||||
RoFSlot.SubSlot = INVALID_INDEX;
|
||||
RoFSlot.AugSlot = INVALID_INDEX;
|
||||
RoFSlot.Unknown01 = NOT_USED;
|
||||
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (TitaniumSlot < 56 || TitaniumSlot == 9999) // Main Inventory and Cursor
|
||||
{
|
||||
RoFSlot.SlotType = 0;
|
||||
RoFSlot.MainSlot = TitaniumSlot;
|
||||
if (TitaniumSlot == 9999)
|
||||
{
|
||||
RoFSlot.MainSlot = 21;
|
||||
}
|
||||
else if (TitaniumSlot >= 30) // Cursor and Extended Corpse Inventory
|
||||
{
|
||||
if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // Main Inventory and Cursor
|
||||
RoFSlot.SlotType = maps::MapPossessions;
|
||||
RoFSlot.MainSlot = ServerSlot;
|
||||
|
||||
if (ServerSlot == MainPowerSource)
|
||||
RoFSlot.MainSlot = slots::MainPowerSource;
|
||||
|
||||
else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory
|
||||
RoFSlot.MainSlot += 3;
|
||||
}
|
||||
else if (TitaniumSlot > 20)
|
||||
{
|
||||
|
||||
else if (ServerSlot >= MainAmmo) // (> 20)
|
||||
RoFSlot.MainSlot += 1;
|
||||
}
|
||||
|
||||
/*else if (ServerSlot < 51) { // Cursor Buffer
|
||||
RoFSlot.SlotType = maps::MapLimbo;
|
||||
RoFSlot.MainSlot = ServerSlot - 31;
|
||||
}*/
|
||||
|
||||
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341)
|
||||
RoFSlot.SlotType = maps::MapPossessions;
|
||||
TempSlot = ServerSlot - 1;
|
||||
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
|
||||
|
||||
if (RoFSlot.MainSlot >= slots::MainGeneral9) // (> 30)
|
||||
RoFSlot.MainSlot = slots::MainCursor;
|
||||
}
|
||||
|
||||
else if (ServerSlot >= EmuConstants::TRIBUTE_BEGIN && ServerSlot <= EmuConstants::TRIBUTE_END) { // Tribute
|
||||
RoFSlot.SlotType = maps::MapTribute;
|
||||
RoFSlot.MainSlot = ServerSlot - EmuConstants::TRIBUTE_BEGIN;
|
||||
}
|
||||
|
||||
else if (ServerSlot >= EmuConstants::BANK_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END) {
|
||||
RoFSlot.SlotType = maps::MapBank;
|
||||
TempSlot = ServerSlot - EmuConstants::BANK_BEGIN;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) { // (> 30)
|
||||
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
else if (ServerSlot >= EmuConstants::SHARED_BANK_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END) {
|
||||
RoFSlot.SlotType = maps::MapSharedBank;
|
||||
TempSlot = ServerSlot - EmuConstants::SHARED_BANK_BEGIN;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) { // (> 30)
|
||||
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
else if (ServerSlot >= EmuConstants::TRADE_BEGIN && ServerSlot <= EmuConstants::TRADE_BAGS_END) {
|
||||
RoFSlot.SlotType = maps::MapTrade;
|
||||
TempSlot = ServerSlot - EmuConstants::TRADE_BEGIN;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
|
||||
if (TempSlot > 30) {
|
||||
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE);
|
||||
}
|
||||
|
||||
}
|
||||
/*else if (TitaniumSlot < 51) // Cursor Buffer
|
||||
{
|
||||
RoFSlot.SlotType = 5;
|
||||
RoFSlot.MainSlot = TitaniumSlot - 31;
|
||||
}*/
|
||||
else if (TitaniumSlot > 250 && TitaniumSlot < 341)
|
||||
{
|
||||
RoFSlot.SlotType = 0;
|
||||
TempSlot = TitaniumSlot - 1;
|
||||
RoFSlot.MainSlot = int(TempSlot / 10) - 2;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * 10);
|
||||
if (RoFSlot.MainSlot > 30)
|
||||
{
|
||||
RoFSlot.MainSlot = 33;
|
||||
}
|
||||
}
|
||||
else if (TitaniumSlot > 399 && TitaniumSlot < 405) // Tribute
|
||||
{
|
||||
RoFSlot.SlotType = 6;
|
||||
RoFSlot.MainSlot = TitaniumSlot - 400;
|
||||
}
|
||||
else if (TitaniumSlot > 1999 && TitaniumSlot < 2271)
|
||||
{
|
||||
RoFSlot.SlotType = 1;
|
||||
TempSlot = TitaniumSlot - 2000;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
if (TempSlot > 30)
|
||||
{
|
||||
RoFSlot.MainSlot = int(TempSlot / 10) - 3;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * 10);
|
||||
}
|
||||
}
|
||||
else if (TitaniumSlot > 2499 && TitaniumSlot < 2551)
|
||||
{
|
||||
RoFSlot.SlotType = 2;
|
||||
TempSlot = TitaniumSlot - 2500;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
if (TempSlot > 30)
|
||||
{
|
||||
RoFSlot.MainSlot = int(TempSlot / 10) - 3;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * 10);
|
||||
}
|
||||
}
|
||||
else if (TitaniumSlot > 2999 && TitaniumSlot < 3180)
|
||||
{
|
||||
RoFSlot.SlotType = 3;
|
||||
TempSlot = TitaniumSlot - 3000;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
if (TempSlot > 99)
|
||||
{
|
||||
/*
|
||||
// OLD CODE:
|
||||
if (TempSlot > 99) {
|
||||
if (TempSlot > 100)
|
||||
{
|
||||
RoFSlot.MainSlot = int((TempSlot - 100) / 10);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
RoFSlot.MainSlot = 0;
|
||||
}
|
||||
|
||||
RoFSlot.SubSlot = TempSlot - (100 + RoFSlot.MainSlot);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (TitaniumSlot > 3999 && TitaniumSlot < 4009)
|
||||
{
|
||||
RoFSlot.SlotType = 4;
|
||||
TempSlot = TitaniumSlot - 4000;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::WORLD_BEGIN && ServerSlot <= EmuConstants::WORLD_END) {
|
||||
RoFSlot.SlotType = maps::MapWorld;
|
||||
TempSlot = ServerSlot - EmuConstants::WORLD_BEGIN;
|
||||
RoFSlot.MainSlot = TempSlot;
|
||||
}
|
||||
|
||||
_log(NET__ERROR, "Convert Titanium Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", TitaniumSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
|
||||
_log(NET__ERROR, "Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
|
||||
|
||||
return RoFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 RoFToTitaniumSlot(structs::ItemSlotStruct RoFSlot)
|
||||
{
|
||||
uint32 TitaniumSlot = 0xffffffff;
|
||||
// Converts RoF Slot IDs to Server Slot IDs for use in Decodes
|
||||
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct RoFSlot) {
|
||||
uint32 ServerSlot = INVALID_INDEX;
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (RoFSlot.SlotType == 0 && RoFSlot.MainSlot < 57) // Worn/Personal Inventory and Cursor (Originally 51)
|
||||
{
|
||||
if (RoFSlot.MainSlot == 21) // Power Source
|
||||
{
|
||||
TempSlot = 9999;
|
||||
}
|
||||
else if (RoFSlot.MainSlot >= 33) // Cursor and Extended Corpse Inventory
|
||||
{
|
||||
if (RoFSlot.SlotType == maps::MapPossessions && RoFSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51)
|
||||
if (RoFSlot.MainSlot == slots::MainPowerSource)
|
||||
TempSlot = MainPowerSource;
|
||||
|
||||
else if (RoFSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
|
||||
TempSlot = RoFSlot.MainSlot - 3;
|
||||
}
|
||||
/*else if (RoFSlot.MainSlot == 31 || RoFSlot.MainSlot == 32) { // 9th and 10th RoF inventory/corpse slots
|
||||
|
||||
/*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.
|
||||
@@ -235,171 +233,171 @@ static inline uint32 RoFToTitaniumSlot(structs::ItemSlotStruct RoFSlot)
|
||||
|
||||
// For now, it's probably best to leave as-is and let this work itself out in the inventory rework.
|
||||
}*/
|
||||
else if (RoFSlot.MainSlot >= 22) // Ammo and Main Inventory
|
||||
{
|
||||
|
||||
else if (RoFSlot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory
|
||||
TempSlot = RoFSlot.MainSlot - 1;
|
||||
}
|
||||
else // Worn Slots
|
||||
{
|
||||
|
||||
else // Worn Slots
|
||||
TempSlot = RoFSlot.MainSlot;
|
||||
}
|
||||
|
||||
if (RoFSlot.SubSlot >= 0) // Bag Slots
|
||||
{
|
||||
TempSlot = ((TempSlot + 3) * 10) + RoFSlot.SubSlot + 1;
|
||||
}
|
||||
if (RoFSlot.SubSlot >= SUB_BEGIN) // Bag Slots
|
||||
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
|
||||
|
||||
TitaniumSlot = TempSlot;
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
else if (RoFSlot.SlotType == 1) // Bank Slots
|
||||
{
|
||||
TempSlot = 2000;
|
||||
if (RoFSlot.SubSlot >= 0)
|
||||
{
|
||||
TempSlot += ((RoFSlot.MainSlot + 3) * 10) + RoFSlot.SubSlot + 1;
|
||||
}
|
||||
|
||||
else if (RoFSlot.SlotType == maps::MapBank) {
|
||||
TempSlot = EmuConstants::BANK_BEGIN;
|
||||
|
||||
if (RoFSlot.SubSlot >= SUB_BEGIN)
|
||||
TempSlot += ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
|
||||
|
||||
else
|
||||
{
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
}
|
||||
TitaniumSlot = TempSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
else if (RoFSlot.SlotType == 2) // Shared Bank Slots
|
||||
{
|
||||
TempSlot = 2500;
|
||||
if (RoFSlot.SubSlot >= 0)
|
||||
{
|
||||
TempSlot += ((RoFSlot.MainSlot + 3) * 10) + RoFSlot.SubSlot + 1;
|
||||
}
|
||||
|
||||
else if (RoFSlot.SlotType == maps::MapSharedBank) {
|
||||
TempSlot = EmuConstants::SHARED_BANK_BEGIN;
|
||||
|
||||
if (RoFSlot.SubSlot >= SUB_BEGIN)
|
||||
TempSlot += ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
|
||||
|
||||
else
|
||||
{
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
}
|
||||
TitaniumSlot = TempSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
else if (RoFSlot.SlotType == 3) // Trade Slots
|
||||
{
|
||||
TempSlot = 3000;
|
||||
if (RoFSlot.SubSlot >= 0)
|
||||
{
|
||||
TempSlot += 100 + (RoFSlot.MainSlot * 10) + RoFSlot.SubSlot;
|
||||
}
|
||||
|
||||
else if (RoFSlot.SlotType == maps::MapTrade) {
|
||||
TempSlot = EmuConstants::TRADE_BEGIN;
|
||||
|
||||
if (RoFSlot.SubSlot >= SUB_BEGIN)
|
||||
TempSlot += ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
|
||||
// OLD CODE:
|
||||
//TempSlot += 100 + (RoFSlot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot;
|
||||
|
||||
else
|
||||
{
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
}
|
||||
TitaniumSlot = TempSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
else if (RoFSlot.SlotType == 4) // Tradeskill Container Slots
|
||||
{
|
||||
TempSlot = 4000;
|
||||
if (RoFSlot.MainSlot >= 0)
|
||||
{
|
||||
|
||||
else if (RoFSlot.SlotType == maps::MapWorld) {
|
||||
TempSlot = EmuConstants::WORLD_BEGIN;
|
||||
|
||||
if (RoFSlot.MainSlot >= SUB_BEGIN)
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
}
|
||||
TitaniumSlot = TempSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
/*else if (RoFSlot.SlotType == 5) // Cursor Buffer
|
||||
{
|
||||
|
||||
/*else if (RoFSlot.SlotType == maps::MapLimbo) { // Cursor Buffer
|
||||
TempSlot = 31;
|
||||
if (RoFSlot.MainSlot >= 0)
|
||||
{
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
}
|
||||
TitaniumSlot = TempSlot;
|
||||
}*/
|
||||
_log(NET__ERROR, "Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Titanium Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, TitaniumSlot);
|
||||
|
||||
return TitaniumSlot;
|
||||
if (RoFSlot.MainSlot >= 0)
|
||||
TempSlot += RoFSlot.MainSlot;
|
||||
|
||||
ServerSlot = TempSlot;
|
||||
}*/
|
||||
|
||||
_log(NET__ERROR, "Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 MainInvRoFToTitaniumSlot(structs::MainInvItemSlotStruct RoFSlot)
|
||||
{
|
||||
uint32 TitaniumSlot = 0xffffffff;
|
||||
// Converts Server MainInv Slot IDs to RoF MainInv Slot IDs for use in Encodes
|
||||
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 ServerSlot) {
|
||||
structs::MainInvItemSlotStruct RoFSlot;
|
||||
RoFSlot.MainSlot = INVALID_INDEX;
|
||||
RoFSlot.SubSlot = INVALID_INDEX;
|
||||
RoFSlot.AugSlot = INVALID_INDEX;
|
||||
RoFSlot.Unknown01 = NOT_USED;
|
||||
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (RoFSlot.MainSlot < 57) // Worn/Personal Inventory and Cursor (Originally 33)
|
||||
{
|
||||
if (RoFSlot.MainSlot == 21)
|
||||
{
|
||||
TempSlot = 9999;
|
||||
}
|
||||
else if (RoFSlot.MainSlot >= 33) // Cursor and Extended Corpse Inventory
|
||||
{
|
||||
if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // (< 52)
|
||||
RoFSlot.MainSlot = ServerSlot;
|
||||
|
||||
if (ServerSlot == MainPowerSource)
|
||||
RoFSlot.MainSlot = slots::MainPowerSource;
|
||||
|
||||
else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory
|
||||
RoFSlot.MainSlot += 3;
|
||||
|
||||
else if (ServerSlot >= MainAmmo) // Ammo and Personl Inventory
|
||||
RoFSlot.MainSlot += 1;
|
||||
|
||||
/*else if (ServerSlot >= MainCursor) { // Cursor
|
||||
RoFSlot.MainSlot = slots::MainCursor;
|
||||
|
||||
if (ServerSlot > 30)
|
||||
RoFSlot.SubSlot = (ServerSlot + 3) - 33;
|
||||
}*/
|
||||
}
|
||||
|
||||
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) {
|
||||
TempSlot = ServerSlot - 1;
|
||||
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
|
||||
}
|
||||
|
||||
_log(NET__ERROR, "Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
|
||||
|
||||
return RoFSlot;
|
||||
}
|
||||
|
||||
// Converts RoF MainInv Slot IDs to Server MainInv Slot IDs for use in Decodes
|
||||
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct RoFSlot) {
|
||||
uint32 ServerSlot = INVALID_INDEX;
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (RoFSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33)
|
||||
if (RoFSlot.MainSlot == slots::MainPowerSource)
|
||||
TempSlot = MainPowerSource;
|
||||
|
||||
else if (RoFSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
|
||||
TempSlot = RoFSlot.MainSlot - 3;
|
||||
}
|
||||
/*else if (RoFSlot.MainSlot == 31 || RoFSlot.MainSlot == 32) { // 9th and 10th RoF inventory slots
|
||||
|
||||
/*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.MainSlot >= 22) // Main Inventory and Ammo Slots
|
||||
{
|
||||
|
||||
else if (RoFSlot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots
|
||||
TempSlot = RoFSlot.MainSlot - 1;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
TempSlot = RoFSlot.MainSlot;
|
||||
}
|
||||
|
||||
if (RoFSlot.SubSlot >= 0) // Bag Slots
|
||||
{
|
||||
TempSlot = ((TempSlot + 3) * 10) + RoFSlot.SubSlot + 1;
|
||||
}
|
||||
if (RoFSlot.SubSlot >= SUB_BEGIN) // Bag Slots
|
||||
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
|
||||
|
||||
TitaniumSlot = TempSlot;
|
||||
ServerSlot = TempSlot;
|
||||
}
|
||||
|
||||
_log(NET__ERROR, "Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Titanium Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, TitaniumSlot);
|
||||
_log(NET__ERROR, "Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
|
||||
|
||||
return TitaniumSlot;
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
// Converts Titanium Slot IDs to RoF Slot IDs for use in Encodes
|
||||
static inline structs::MainInvItemSlotStruct MainInvTitaniumToRoFSlot(uint32 TitaniumSlot)
|
||||
{
|
||||
structs::MainInvItemSlotStruct RoFSlot;
|
||||
RoFSlot.MainSlot = 0xffff;
|
||||
RoFSlot.SubSlot = 0xffff;
|
||||
RoFSlot.AugSlot = 0xffff;
|
||||
RoFSlot.Unknown01 = 0;
|
||||
uint32 TempSlot = 0;
|
||||
|
||||
if (TitaniumSlot < 56 || TitaniumSlot == 9999) // (Originally 52)
|
||||
{
|
||||
RoFSlot.MainSlot = TitaniumSlot;
|
||||
if (TitaniumSlot == 9999)
|
||||
{
|
||||
RoFSlot.MainSlot = 21;
|
||||
}
|
||||
else if (TitaniumSlot > 29) // Cursor and Extended Corpse Inventory
|
||||
{
|
||||
RoFSlot.MainSlot += 3;
|
||||
}
|
||||
else if(TitaniumSlot > 20) // Ammo and Personl Inventory
|
||||
{
|
||||
RoFSlot.MainSlot += 1;
|
||||
}
|
||||
/*else if (TitaniumSlot > 29) // Cursor
|
||||
{
|
||||
RoFSlot.MainSlot = 33;
|
||||
if (TitaniumSlot > 30)
|
||||
{
|
||||
RoFSlot.SubSlot = (TitaniumSlot + 3) - 33;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else if (TitaniumSlot > 250 && TitaniumSlot < 341)
|
||||
{
|
||||
TempSlot = TitaniumSlot - 1;
|
||||
RoFSlot.MainSlot = int(TempSlot / 10) - 2;
|
||||
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * 10);
|
||||
}
|
||||
|
||||
_log(NET__ERROR, "Convert Titanium Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", TitaniumSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
|
||||
|
||||
return RoFSlot;
|
||||
/*
|
||||
// Converts Server Corpse Slot IDs to RoF Corpse Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToRoFCorpseSlot(uint32 ServerCorpse) {
|
||||
uint32 RoFCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts RoF Corpse Slot IDs to Server Corpse Slot IDs for use in Decodes
|
||||
static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse) {
|
||||
uint32 ServerCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
ENCODE(OP_TaskHistoryReply)
|
||||
{
|
||||
@@ -2839,7 +2837,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct);
|
||||
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
OUT(npcid);
|
||||
eq->itemslot = MainInvTitaniumToRoFSlot(emu->itemslot);
|
||||
eq->itemslot = ServerToRoFMainInvSlot(emu->itemslot);
|
||||
//OUT(itemslot);
|
||||
OUT(quantity);
|
||||
OUT(price);
|
||||
@@ -2849,7 +2847,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE(OP_ApplyPoison) {
|
||||
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
|
||||
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
eq->inventorySlot = MainInvTitaniumToRoFSlot(emu->inventorySlot);
|
||||
eq->inventorySlot = ServerToRoFMainInvSlot(emu->inventorySlot);
|
||||
OUT(success);
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -2859,7 +2857,7 @@ ENCODE(OP_RecipeAutoCombine) {
|
||||
SETUP_DIRECT_ENCODE(RecipeAutoCombine_Struct, structs::RecipeAutoCombine_Struct);
|
||||
OUT(object_type);
|
||||
OUT(some_id);
|
||||
eq->container_slot = TitaniumToRoFSlot(emu->unknown1);
|
||||
eq->container_slot = ServerToRoFSlot(emu->unknown1);
|
||||
structs::ItemSlotStruct RoFSlot;
|
||||
RoFSlot.SlotType = 8; // Observed
|
||||
RoFSlot.Unknown02 = 0;
|
||||
@@ -2877,8 +2875,8 @@ ENCODE(OP_DeleteItem) {
|
||||
ENCODE_LENGTH_EXACT(DeleteItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToRoFSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToRoFSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToRoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToRoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -2889,8 +2887,8 @@ ENCODE(OP_MoveItem) {
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToRoFSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToRoFSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToRoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToRoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -2899,7 +2897,7 @@ ENCODE(OP_ItemVerifyReply) {
|
||||
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
||||
SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct);
|
||||
|
||||
eq->slot = TitaniumToRoFSlot(emu->slot);
|
||||
eq->slot = ServerToRoFSlot(emu->slot);
|
||||
OUT(spell);
|
||||
OUT(target);
|
||||
|
||||
@@ -2983,7 +2981,7 @@ ENCODE(OP_TributeItem) {
|
||||
ENCODE_LENGTH_EXACT(TributeItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
eq->slot = TitaniumToRoFSlot(emu->slot);
|
||||
eq->slot = ServerToRoFSlot(emu->slot);
|
||||
OUT(quantity);
|
||||
OUT(tribute_master_id);
|
||||
OUT(tribute_points);
|
||||
@@ -3091,7 +3089,7 @@ ENCODE(OP_AdventureMerchantSell) {
|
||||
|
||||
eq->unknown000 = 1;
|
||||
OUT(npcid);
|
||||
eq->slot = MainInvTitaniumToRoFSlot(emu->slot);
|
||||
eq->slot = ServerToRoFMainInvSlot(emu->slot);
|
||||
OUT(charges);
|
||||
OUT(sell_price);
|
||||
|
||||
@@ -3822,7 +3820,7 @@ ENCODE(OP_CastSpell)
|
||||
OUT(slot);
|
||||
}
|
||||
OUT(spell_id);
|
||||
eq->inventoryslot = TitaniumToRoFSlot(emu->inventoryslot);
|
||||
eq->inventoryslot = ServerToRoFSlot(emu->inventoryslot);
|
||||
//OUT(inventoryslot);
|
||||
OUT(target_id);
|
||||
FINISH_ENCODE();
|
||||
@@ -3878,7 +3876,7 @@ ENCODE(OP_AltCurrencySell)
|
||||
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
OUT(merchant_entity_id);
|
||||
eq->slot_id = TitaniumToRoFSlot(emu->slot_id);
|
||||
eq->slot_id = ServerToRoFSlot(emu->slot_id);
|
||||
OUT(charges);
|
||||
OUT(cost);
|
||||
FINISH_ENCODE();
|
||||
@@ -4090,7 +4088,7 @@ DECODE(OP_AltCurrencySellSelection)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = RoFToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = RoFToServerSlot(eq->slot_id);
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
@@ -4099,7 +4097,7 @@ DECODE(OP_AltCurrencySell)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = RoFToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = RoFToServerSlot(eq->slot_id);
|
||||
IN(charges);
|
||||
IN(cost);
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4209,7 +4207,7 @@ DECODE(OP_AdventureMerchantSell) {
|
||||
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->slot = MainInvRoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = RoFToServerMainInvSlot(eq->slot);
|
||||
IN(charges);
|
||||
IN(sell_price);
|
||||
|
||||
@@ -4221,7 +4219,7 @@ DECODE(OP_ApplyPoison) {
|
||||
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
|
||||
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
emu->inventorySlot = MainInvRoFToTitaniumSlot(eq->inventorySlot);
|
||||
emu->inventorySlot = RoFToServerMainInvSlot(eq->inventorySlot);
|
||||
IN(success);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4231,7 +4229,7 @@ DECODE(OP_ItemVerifyRequest) {
|
||||
DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct);
|
||||
SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct);
|
||||
|
||||
emu->slot = RoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = RoFToServerSlot(eq->slot);
|
||||
IN(target);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4241,7 +4239,7 @@ DECODE(OP_Consume) {
|
||||
DECODE_LENGTH_EXACT(structs::Consume_Struct);
|
||||
SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
|
||||
|
||||
emu->slot = RoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = RoFToServerSlot(eq->slot);
|
||||
IN(auto_consumed);
|
||||
IN(type);
|
||||
|
||||
@@ -4261,7 +4259,7 @@ DECODE(OP_CastSpell) {
|
||||
IN(slot);
|
||||
}
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = RoFToTitaniumSlot(eq->inventoryslot);
|
||||
emu->inventoryslot = RoFToServerSlot(eq->inventoryslot);
|
||||
//IN(inventoryslot);
|
||||
IN(target_id);
|
||||
|
||||
@@ -4273,8 +4271,8 @@ DECODE(OP_DeleteItem)
|
||||
DECODE_LENGTH_EXACT(structs::DeleteItem_Struct);
|
||||
SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
emu->from_slot = RoFToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = RoFToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = RoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = RoFToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4287,8 +4285,8 @@ DECODE(OP_MoveItem)
|
||||
|
||||
//_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot);
|
||||
_log(NET__ERROR, "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.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
|
||||
emu->from_slot = RoFToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = RoFToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = RoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = RoFToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
_hex(NET__ERROR, eq, sizeof(structs::MoveItem_Struct));
|
||||
@@ -4514,7 +4512,7 @@ DECODE(OP_ShopPlayerSell) {
|
||||
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->itemslot = MainInvRoFToTitaniumSlot(eq->itemslot);
|
||||
emu->itemslot = RoFToServerMainInvSlot(eq->itemslot);
|
||||
//IN(itemslot);
|
||||
IN(quantity);
|
||||
IN(price);
|
||||
@@ -4611,7 +4609,7 @@ DECODE(OP_TributeItem) {
|
||||
DECODE_LENGTH_EXACT(structs::TributeItem_Struct);
|
||||
SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
emu->slot = RoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = RoFToServerSlot(eq->slot);
|
||||
IN(quantity);
|
||||
IN(tribute_master_id);
|
||||
IN(tribute_points);
|
||||
@@ -4635,9 +4633,9 @@ DECODE(OP_TradeSkillCombine) {
|
||||
DECODE_LENGTH_EXACT(structs::NewCombine_Struct);
|
||||
SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct);
|
||||
|
||||
int16 slot_id = RoFToTitaniumSlot(eq->container_slot);
|
||||
int16 slot_id = RoFToServerSlot(eq->container_slot);
|
||||
if (slot_id == 4000) {
|
||||
slot_id = SLOT_TRADESKILL; // 1000
|
||||
slot_id = legacy::SLOT_TRADESKILL; // 1000
|
||||
}
|
||||
emu->container_slot = slot_id;
|
||||
|
||||
@@ -4650,7 +4648,7 @@ DECODE(OP_RecipeAutoCombine) {
|
||||
|
||||
IN(object_type);
|
||||
IN(some_id);
|
||||
emu->unknown1 = RoFToTitaniumSlot(eq->container_slot);
|
||||
emu->unknown1 = RoFToServerSlot(eq->container_slot);
|
||||
IN(recipe_id);
|
||||
IN(reply_code);
|
||||
|
||||
@@ -4661,7 +4659,7 @@ DECODE(OP_AugmentItem) {
|
||||
DECODE_LENGTH_EXACT(structs::AugmentItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct);
|
||||
|
||||
emu->container_slot = RoFToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = RoFToServerSlot(eq->container_slot);
|
||||
//emu->augment_slot = eq->augment_slot;
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -4872,7 +4870,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
hdr.stacksize = stackable ? charges : 1;
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
structs::ItemSlotStruct slot_id = TitaniumToRoFSlot(slot_id_in);
|
||||
structs::ItemSlotStruct slot_id = ServerToRoFSlot(slot_id_in);
|
||||
|
||||
hdr.slot_type = (merchant_slot == 0) ? slot_id.SlotType : 9; // 9 is merchant 20 is reclaim items?
|
||||
hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot;
|
||||
@@ -5074,7 +5072,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
isbs.augrestrict = item->AugRestrict;
|
||||
|
||||
|
||||
for(int x = 0; x < 5; ++x)
|
||||
for(int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
|
||||
{
|
||||
isbs.augslots[x].type = item->AugSlotType[x];
|
||||
isbs.augslots[x].visible = item->AugSlotVisible[x];
|
||||
@@ -5326,11 +5324,11 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count = 0;
|
||||
|
||||
char *SubSerializations[10];
|
||||
char *SubSerializations[10]; // <watch>
|
||||
|
||||
uint32 SubLengths[10];
|
||||
|
||||
for(int x = 0; x < 10; ++x) {
|
||||
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
|
||||
|
||||
SubSerializations[x] = nullptr;
|
||||
|
||||
@@ -5342,22 +5340,30 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count++;
|
||||
|
||||
if(slot_id_in >= 22 && slot_id_in < 30)
|
||||
SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
else if(slot_id_in >= 2000 && slot_id_in <= 2023)
|
||||
SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
else if(slot_id_in >= 2500 && slot_id_in <= 2501)
|
||||
SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
if(slot_id_in >= EmuConstants::GENERAL_BEGIN && slot_id_in <= EmuConstants::GENERAL_END) // (< 30) - no cursor?
|
||||
//SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
SubSlotNumber = (((slot_id_in + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + x + 1);
|
||||
else if(slot_id_in >= EmuConstants::BANK_BEGIN && slot_id_in <= EmuConstants::BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::BANK_BAGS_BEGIN + x);
|
||||
else if(slot_id_in >= EmuConstants::SHARED_BANK_BEGIN && slot_id_in <= EmuConstants::SHARED_BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::SHARED_BANK_BAGS_BEGIN + x);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // ???????
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
ss.write((const char*)&iqbs, sizeof(RoF::structs::ItemQuaternaryBodyStruct));
|
||||
|
||||
for(int x = 0; x < 10; ++x) {
|
||||
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
|
||||
|
||||
if(SubSerializations[x]) {
|
||||
|
||||
|
||||
@@ -130,9 +130,6 @@ namespace RoF {
|
||||
|
||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||
// (bag slots and main slots beyond Possessions are assigned for compatibility with current server coding)
|
||||
static const int16 POSSESSIONS_BEGIN = slots::MainCharm;
|
||||
static const int16 POSSESSIONS_END = slots::MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
|
||||
static const int16 EQUIPMENT_END = slots::MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
|
||||
@@ -163,7 +160,7 @@ namespace RoF {
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_END_NPC = 3003;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
+97
-88
@@ -108,70 +108,71 @@ const EQClientVersion Strategy::ClientVersion() const
|
||||
#include "SSDefine.h"
|
||||
|
||||
|
||||
// Converts Titanium Slot IDs to SoD Slot IDs for use in Encodes
|
||||
static inline uint32 TitaniumToSoDSlot(uint32 TitaniumSlot) {
|
||||
// Converts Server Slot IDs to SoD Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToSoDSlot(uint32 ServerSlot) {
|
||||
uint32 SoDSlot = 0;
|
||||
|
||||
if(TitaniumSlot >= 21 && TitaniumSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
{
|
||||
SoDSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor
|
||||
{
|
||||
SoDSlot = TitaniumSlot + 11;
|
||||
}
|
||||
else if(TitaniumSlot >= 2031 && TitaniumSlot <= 2270) // Bank Bag Slots
|
||||
{
|
||||
SoDSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot >= 2531 && TitaniumSlot <= 2550) // Shared Bank Bag Slots
|
||||
{
|
||||
SoDSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot == 9999) //Unused slot ID to give a place to save Power Slot
|
||||
{
|
||||
SoDSlot = 21;
|
||||
}
|
||||
if (ServerSlot >= MainAmmo && ServerSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
SoDSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END)
|
||||
SoDSlot = ServerSlot + 11;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END)
|
||||
SoDSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END)
|
||||
SoDSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot == MainPowerSource)
|
||||
SoDSlot = slots::MainPowerSource;
|
||||
|
||||
else
|
||||
{
|
||||
SoDSlot = TitaniumSlot;
|
||||
}
|
||||
SoDSlot = ServerSlot;
|
||||
|
||||
return SoDSlot;
|
||||
}
|
||||
|
||||
// Converts SoD Slot IDs to Titanium Slot IDs for use in Decodes
|
||||
static inline uint32 SoDToTitaniumSlot(uint32 SoDSlot) {
|
||||
uint32 TitaniumSlot = 0;
|
||||
// Converts SoD Slot IDs to Server Slot IDs for use in Decodes
|
||||
static inline uint32 SoDToServerSlot(uint32 SoDSlot) {
|
||||
uint32 ServerSlot = 0;
|
||||
|
||||
if(SoDSlot >= 22 && SoDSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
{
|
||||
TitaniumSlot = SoDSlot - 1;
|
||||
}
|
||||
else if(SoDSlot >= 262 && SoDSlot <= 351) // Bag Slots for Normal Inventory and Cursor
|
||||
{
|
||||
TitaniumSlot = SoDSlot - 11;
|
||||
}
|
||||
else if(SoDSlot >= 2032 && SoDSlot <= 2271) // Bank Bag Slots
|
||||
{
|
||||
TitaniumSlot = SoDSlot - 1;
|
||||
}
|
||||
else if(SoDSlot >= 2532 && SoDSlot <= 2551) // Shared Bank Bag Slots
|
||||
{
|
||||
TitaniumSlot = SoDSlot - 1;
|
||||
}
|
||||
else if(SoDSlot == 21)
|
||||
{
|
||||
TitaniumSlot = 9999; //Unused slot ID to give a place to save Power Slot
|
||||
}
|
||||
if(SoDSlot >= slots::MainAmmo && SoDSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = SoDSlot - 1;
|
||||
|
||||
else if(SoDSlot >= consts::GENERAL_BAGS_BEGIN && SoDSlot <= consts::CURSOR_BAG_END)
|
||||
ServerSlot = SoDSlot - 11;
|
||||
|
||||
else if(SoDSlot >= consts::BANK_BAGS_BEGIN && SoDSlot <= consts::BANK_BAGS_END)
|
||||
ServerSlot = SoDSlot - 1;
|
||||
|
||||
else if(SoDSlot >= consts::SHARED_BANK_BAGS_BEGIN && SoDSlot <= consts::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = SoDSlot - 1;
|
||||
|
||||
else if(SoDSlot == slots::MainPowerSource)
|
||||
ServerSlot = MainPowerSource;
|
||||
|
||||
else
|
||||
{
|
||||
TitaniumSlot = SoDSlot;
|
||||
}
|
||||
ServerSlot = SoDSlot;
|
||||
|
||||
return TitaniumSlot;
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
/*
|
||||
// Converts Server Corpse Slot IDs to SoD Corpse Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToSoDCorpseSlot(uint32 ServerCorpse) {
|
||||
uint32 SoDCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts SoD Corpse Slot IDs to Server Corpse Slot IDs for use in Decodes
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 SoDCorpse) {
|
||||
uint32 ServerCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
ENCODE(OP_OpenNewTasksWindow) {
|
||||
|
||||
@@ -1838,7 +1839,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct);
|
||||
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
OUT(npcid);
|
||||
eq->itemslot = TitaniumToSoDSlot(emu->itemslot);
|
||||
eq->itemslot = ServerToSoDSlot(emu->itemslot);
|
||||
OUT(quantity);
|
||||
OUT(price);
|
||||
FINISH_ENCODE();
|
||||
@@ -1847,7 +1848,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE(OP_ApplyPoison) {
|
||||
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
|
||||
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
eq->inventorySlot = TitaniumToSoDSlot(emu->inventorySlot);
|
||||
eq->inventorySlot = ServerToSoDSlot(emu->inventorySlot);
|
||||
OUT(success);
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -1856,8 +1857,8 @@ ENCODE(OP_DeleteItem) {
|
||||
ENCODE_LENGTH_EXACT(DeleteItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToSoDSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoDSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1868,8 +1869,8 @@ ENCODE(OP_MoveItem) {
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToSoDSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoDSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1879,7 +1880,7 @@ ENCODE(OP_ItemVerifyReply) {
|
||||
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
||||
SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct);
|
||||
|
||||
eq->slot = TitaniumToSoDSlot(emu->slot);
|
||||
eq->slot = ServerToSoDSlot(emu->slot);
|
||||
OUT(spell);
|
||||
OUT(target);
|
||||
|
||||
@@ -1929,7 +1930,7 @@ ENCODE(OP_TributeItem) {
|
||||
ENCODE_LENGTH_EXACT(TributeItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
eq->slot = TitaniumToSoDSlot(emu->slot);
|
||||
eq->slot = ServerToSoDSlot(emu->slot);
|
||||
OUT(quantity);
|
||||
OUT(tribute_master_id);
|
||||
OUT(tribute_points);
|
||||
@@ -1976,7 +1977,7 @@ ENCODE(OP_ReadBook) {
|
||||
else
|
||||
eq->window = emu->window;
|
||||
OUT(type);
|
||||
eq->invslot = TitaniumToSoDSlot(emu->invslot);
|
||||
eq->invslot = ServerToSoDSlot(emu->invslot);
|
||||
strn0cpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile));
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -2037,7 +2038,7 @@ ENCODE(OP_AdventureMerchantSell) {
|
||||
|
||||
eq->unknown000 = 1;
|
||||
OUT(npcid);
|
||||
eq->slot = TitaniumToSoDSlot(emu->slot);
|
||||
eq->slot = ServerToSoDSlot(emu->slot);
|
||||
OUT(charges);
|
||||
OUT(sell_price);
|
||||
|
||||
@@ -2568,7 +2569,7 @@ ENCODE(OP_AltCurrencySell)
|
||||
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
OUT(merchant_entity_id);
|
||||
eq->slot_id = TitaniumToSoDSlot(emu->slot_id);
|
||||
eq->slot_id = ServerToSoDSlot(emu->slot_id);
|
||||
OUT(charges);
|
||||
OUT(cost);
|
||||
FINISH_ENCODE();
|
||||
@@ -2622,7 +2623,7 @@ DECODE(OP_AdventureMerchantSell) {
|
||||
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->slot = SoDToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoDToServerSlot(eq->slot);
|
||||
IN(charges);
|
||||
IN(sell_price);
|
||||
|
||||
@@ -2634,7 +2635,7 @@ DECODE(OP_ApplyPoison) {
|
||||
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
|
||||
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
emu->inventorySlot = SoDToTitaniumSlot(eq->inventorySlot);
|
||||
emu->inventorySlot = SoDToServerSlot(eq->inventorySlot);
|
||||
IN(success);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2644,7 +2645,7 @@ DECODE(OP_ItemVerifyRequest) {
|
||||
DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct);
|
||||
SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct);
|
||||
|
||||
emu->slot = SoDToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoDToServerSlot(eq->slot);
|
||||
IN(target);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2654,7 +2655,7 @@ DECODE(OP_Consume) {
|
||||
DECODE_LENGTH_EXACT(structs::Consume_Struct);
|
||||
SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
|
||||
|
||||
emu->slot = SoDToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoDToServerSlot(eq->slot);
|
||||
IN(auto_consumed);
|
||||
IN(type);
|
||||
|
||||
@@ -2667,7 +2668,7 @@ DECODE(OP_CastSpell) {
|
||||
|
||||
IN(slot);
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = SoDToTitaniumSlot(eq->inventoryslot);
|
||||
emu->inventoryslot = SoDToServerSlot(eq->inventoryslot);
|
||||
IN(target_id);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2678,8 +2679,8 @@ DECODE(OP_DeleteItem)
|
||||
DECODE_LENGTH_EXACT(structs::DeleteItem_Struct);
|
||||
SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
emu->from_slot = SoDToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = SoDToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2692,8 +2693,8 @@ DECODE(OP_MoveItem)
|
||||
|
||||
_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
|
||||
emu->from_slot = SoDToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = SoDToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2900,7 +2901,7 @@ DECODE(OP_ShopPlayerSell) {
|
||||
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->itemslot = SoDToTitaniumSlot(eq->itemslot);
|
||||
emu->itemslot = SoDToServerSlot(eq->itemslot);
|
||||
IN(quantity);
|
||||
IN(price);
|
||||
|
||||
@@ -2969,7 +2970,7 @@ DECODE(OP_TributeItem) {
|
||||
DECODE_LENGTH_EXACT(structs::TributeItem_Struct);
|
||||
SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
emu->slot = SoDToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoDToServerSlot(eq->slot);
|
||||
IN(quantity);
|
||||
IN(tribute_master_id);
|
||||
IN(tribute_points);
|
||||
@@ -2982,7 +2983,7 @@ DECODE(OP_ReadBook) {
|
||||
SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct);
|
||||
|
||||
IN(type);
|
||||
emu->invslot = SoDToTitaniumSlot(eq->invslot);
|
||||
emu->invslot = SoDToServerSlot(eq->invslot);
|
||||
emu->window = (uint8) eq->window;
|
||||
strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile));
|
||||
|
||||
@@ -2993,7 +2994,7 @@ DECODE(OP_TradeSkillCombine) {
|
||||
DECODE_LENGTH_EXACT(structs::NewCombine_Struct);
|
||||
SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct);
|
||||
|
||||
emu->container_slot = SoDToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = SoDToServerSlot(eq->container_slot);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -3002,7 +3003,7 @@ DECODE(OP_AugmentItem) {
|
||||
DECODE_LENGTH_EXACT(structs::AugmentItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct);
|
||||
|
||||
emu->container_slot = SoDToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = SoDToServerSlot(eq->container_slot);
|
||||
emu->augment_slot = eq->augment_slot;
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -3077,7 +3078,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
hdr.stacksize = stackable ? charges : 1;
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
int32 slot_id = TitaniumToSoDSlot(slot_id_in);
|
||||
int32 slot_id = ServerToSoDSlot(slot_id_in);
|
||||
|
||||
hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot;
|
||||
hdr.price = inst->GetPrice();
|
||||
@@ -3460,11 +3461,11 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count = 0;
|
||||
|
||||
char *SubSerializations[10];
|
||||
char *SubSerializations[10]; // <watch>
|
||||
|
||||
uint32 SubLengths[10];
|
||||
|
||||
for(int x = 0; x < 10; ++x) {
|
||||
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
|
||||
|
||||
SubSerializations[x] = nullptr;
|
||||
|
||||
@@ -3476,15 +3477,23 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count++;
|
||||
|
||||
if(slot_id_in >= 22 && slot_id_in < 30)
|
||||
SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
else if(slot_id_in >= 2000 && slot_id_in <= 2023)
|
||||
SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
else if(slot_id_in >= 2500 && slot_id_in <= 2501)
|
||||
SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
if (slot_id_in >= EmuConstants::GENERAL_BEGIN && slot_id_in <= EmuConstants::GENERAL_END) // (< 30) - no cursor?
|
||||
//SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
SubSlotNumber = (((slot_id_in + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + x + 1);
|
||||
else if (slot_id_in >= EmuConstants::BANK_BEGIN && slot_id_in <= EmuConstants::BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::BANK_BAGS_BEGIN + x);
|
||||
else if (slot_id_in >= EmuConstants::SHARED_BANK_BEGIN && slot_id_in <= EmuConstants::SHARED_BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::SHARED_BANK_BAGS_BEGIN + x);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // ???????
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -3534,7 +3543,7 @@ DECODE(OP_AltCurrencySellSelection)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = SoDToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = SoDToServerSlot(eq->slot_id);
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
@@ -3543,7 +3552,7 @@ DECODE(OP_AltCurrencySell)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = SoDToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = SoDToServerSlot(eq->slot_id);
|
||||
IN(charges);
|
||||
IN(cost);
|
||||
FINISH_DIRECT_DECODE();
|
||||
|
||||
@@ -127,9 +127,6 @@ namespace SoD {
|
||||
static const uint16 MAP_KRONO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
static const int16 POSSESSIONS_BEGIN = slots::MainCharm;
|
||||
static const int16 POSSESSIONS_END = slots::MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
|
||||
static const int16 EQUIPMENT_END = slots::MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
|
||||
@@ -160,8 +157,8 @@ namespace SoD {
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_END_NPC = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031; // no change from Ti?
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
|
||||
+98
-88
@@ -107,70 +107,72 @@ const EQClientVersion Strategy::ClientVersion() const
|
||||
#include "SSDefine.h"
|
||||
|
||||
|
||||
// Converts Titanium Slot IDs to SoF Slot IDs for use in Encodes
|
||||
static inline uint32 TitaniumToSoFSlot(uint32 TitaniumSlot) {
|
||||
// Converts Server Slot IDs to SoF Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToSoFSlot(uint32 ServerSlot) {
|
||||
uint32 SoFSlot = 0;
|
||||
|
||||
if(TitaniumSlot >= 21 && TitaniumSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
{
|
||||
SoFSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor
|
||||
{
|
||||
SoFSlot = TitaniumSlot + 11;
|
||||
}
|
||||
else if(TitaniumSlot >= 2031 && TitaniumSlot <= 2270) // Bank Bag Slots
|
||||
{
|
||||
SoFSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot >= 2531 && TitaniumSlot <= 2550) // Shared Bank Bag Slots
|
||||
{
|
||||
SoFSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot == 9999) //Unused slot ID to give a place to save Power Slot
|
||||
{
|
||||
SoFSlot = 21;
|
||||
}
|
||||
if (ServerSlot >= MainAmmo && ServerSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
SoFSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END)
|
||||
SoFSlot = ServerSlot + 11;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END)
|
||||
SoFSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END)
|
||||
SoFSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot == MainPowerSource)
|
||||
SoFSlot = slots::MainPowerSource;
|
||||
|
||||
else
|
||||
{
|
||||
SoFSlot = TitaniumSlot;
|
||||
}
|
||||
SoFSlot = ServerSlot;
|
||||
|
||||
return SoFSlot;
|
||||
}
|
||||
|
||||
// Converts Sof Slot IDs to Titanium Slot IDs for use in Decodes
|
||||
static inline uint32 SoFToTitaniumSlot(uint32 SoFSlot) {
|
||||
uint32 TitaniumSlot = 0;
|
||||
// Converts SoF Slot IDs to Server Slot IDs for use in Decodes
|
||||
static inline uint32 SoFToServerSlot(uint32 SoFSlot) {
|
||||
uint32 ServerSlot = 0;
|
||||
|
||||
if(SoFSlot >= 22 && SoFSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
{
|
||||
TitaniumSlot = SoFSlot - 1;
|
||||
}
|
||||
else if(SoFSlot >= 262 && SoFSlot <= 351) // Bag Slots for Normal Inventory and Cursor
|
||||
{
|
||||
TitaniumSlot = SoFSlot - 11;
|
||||
}
|
||||
else if(SoFSlot >= 2032 && SoFSlot <= 2271) // Bank Bag Slots
|
||||
{
|
||||
TitaniumSlot = SoFSlot - 1;
|
||||
}
|
||||
else if(SoFSlot >= 2532 && SoFSlot <= 2551) // Shared Bank Bag Slots
|
||||
{
|
||||
TitaniumSlot = SoFSlot - 1;
|
||||
}
|
||||
else if(SoFSlot == 21)
|
||||
{
|
||||
TitaniumSlot = 9999; //Unused slot ID to give a place to save Power Slot
|
||||
}
|
||||
if(SoFSlot >= slots::MainAmmo && SoFSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = SoFSlot - 1;
|
||||
|
||||
else if(SoFSlot >= consts::GENERAL_BAGS_BEGIN && SoFSlot <= consts::CURSOR_BAG_END)
|
||||
ServerSlot = SoFSlot - 11;
|
||||
|
||||
else if(SoFSlot >= consts::BANK_BAGS_BEGIN && SoFSlot <= consts::BANK_BAGS_END)
|
||||
ServerSlot = SoFSlot - 1;
|
||||
|
||||
else if(SoFSlot >= consts::SHARED_BANK_BAGS_BEGIN && SoFSlot <= consts::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = SoFSlot - 1;
|
||||
|
||||
else if(SoFSlot == slots::MainPowerSource)
|
||||
ServerSlot = MainPowerSource;
|
||||
|
||||
else
|
||||
{
|
||||
TitaniumSlot = SoFSlot;
|
||||
}
|
||||
ServerSlot = SoFSlot;
|
||||
|
||||
|
||||
return TitaniumSlot;
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
/*
|
||||
// Converts Server Corpse Slot IDs to SoF Corpse Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToSoFCorpseSlot(uint32 ServerCorpse) {
|
||||
uint32 SoFCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts SoF Corpse Slot IDs to Server Corpse Slot IDs for use in Decodes
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 SoFCorpse) {
|
||||
uint32 ServerCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
ENCODE(OP_OpenNewTasksWindow) {
|
||||
|
||||
@@ -1421,7 +1423,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct);
|
||||
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
OUT(npcid);
|
||||
eq->itemslot = TitaniumToSoFSlot(emu->itemslot);
|
||||
eq->itemslot = ServerToSoFSlot(emu->itemslot);
|
||||
OUT(quantity);
|
||||
OUT(price);
|
||||
FINISH_ENCODE();
|
||||
@@ -1430,7 +1432,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE(OP_ApplyPoison) {
|
||||
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
|
||||
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
eq->inventorySlot = TitaniumToSoFSlot(emu->inventorySlot);
|
||||
eq->inventorySlot = ServerToSoFSlot(emu->inventorySlot);
|
||||
OUT(success);
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -1439,8 +1441,8 @@ ENCODE(OP_DeleteItem) {
|
||||
ENCODE_LENGTH_EXACT(DeleteItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToSoFSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1451,8 +1453,8 @@ ENCODE(OP_MoveItem) {
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToSoFSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1462,7 +1464,7 @@ ENCODE(OP_ItemVerifyReply) {
|
||||
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
||||
SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct);
|
||||
|
||||
eq->slot = TitaniumToSoFSlot(emu->slot);
|
||||
eq->slot = ServerToSoFSlot(emu->slot);
|
||||
OUT(spell);
|
||||
OUT(target);
|
||||
|
||||
@@ -1566,7 +1568,7 @@ ENCODE(OP_TributeItem) {
|
||||
ENCODE_LENGTH_EXACT(TributeItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
eq->slot = TitaniumToSoFSlot(emu->slot);
|
||||
eq->slot = ServerToSoFSlot(emu->slot);
|
||||
OUT(quantity);
|
||||
OUT(tribute_master_id);
|
||||
OUT(tribute_points);
|
||||
@@ -1613,7 +1615,7 @@ ENCODE(OP_ReadBook) {
|
||||
else
|
||||
eq->window = emu->window;
|
||||
OUT(type);
|
||||
eq->invslot = TitaniumToSoFSlot(emu->invslot);
|
||||
eq->invslot = ServerToSoFSlot(emu->invslot);
|
||||
strn0cpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile));
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -1674,7 +1676,7 @@ ENCODE(OP_AdventureMerchantSell) {
|
||||
|
||||
eq->unknown000 = 1;
|
||||
OUT(npcid);
|
||||
eq->slot = TitaniumToSoFSlot(emu->slot);
|
||||
eq->slot = ServerToSoFSlot(emu->slot);
|
||||
OUT(charges);
|
||||
OUT(sell_price);
|
||||
|
||||
@@ -1959,7 +1961,7 @@ ENCODE(OP_AltCurrencySell)
|
||||
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
OUT(merchant_entity_id);
|
||||
eq->slot_id = TitaniumToSoFSlot(emu->slot_id);
|
||||
eq->slot_id = ServerToSoFSlot(emu->slot_id);
|
||||
OUT(charges);
|
||||
OUT(cost);
|
||||
FINISH_ENCODE();
|
||||
@@ -2011,7 +2013,7 @@ DECODE(OP_AdventureMerchantSell) {
|
||||
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->slot = SoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoFToServerSlot(eq->slot);
|
||||
IN(charges);
|
||||
IN(sell_price);
|
||||
|
||||
@@ -2022,7 +2024,7 @@ DECODE(OP_ApplyPoison) {
|
||||
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
|
||||
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
emu->inventorySlot = SoFToTitaniumSlot(eq->inventorySlot);
|
||||
emu->inventorySlot = SoFToServerSlot(eq->inventorySlot);
|
||||
IN(success);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2032,7 +2034,7 @@ DECODE(OP_ItemVerifyRequest) {
|
||||
DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct);
|
||||
SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct);
|
||||
|
||||
emu->slot = SoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoFToServerSlot(eq->slot);
|
||||
IN(target);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2042,7 +2044,7 @@ DECODE(OP_Consume) {
|
||||
DECODE_LENGTH_EXACT(structs::Consume_Struct);
|
||||
SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
|
||||
|
||||
emu->slot = SoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoFToServerSlot(eq->slot);
|
||||
IN(auto_consumed);
|
||||
IN(type);
|
||||
|
||||
@@ -2055,7 +2057,7 @@ DECODE(OP_CastSpell) {
|
||||
|
||||
IN(slot);
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = SoFToTitaniumSlot(eq->inventoryslot);
|
||||
emu->inventoryslot = SoFToServerSlot(eq->inventoryslot);
|
||||
IN(target_id);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2066,8 +2068,8 @@ DECODE(OP_DeleteItem)
|
||||
DECODE_LENGTH_EXACT(structs::DeleteItem_Struct);
|
||||
SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
emu->from_slot = SoFToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = SoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2080,8 +2082,8 @@ DECODE(OP_MoveItem)
|
||||
|
||||
_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
|
||||
emu->from_slot = SoFToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = SoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2230,7 +2232,7 @@ DECODE(OP_ShopPlayerSell) {
|
||||
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->itemslot = SoFToTitaniumSlot(eq->itemslot);
|
||||
emu->itemslot = SoFToServerSlot(eq->itemslot);
|
||||
IN(quantity);
|
||||
IN(price);
|
||||
|
||||
@@ -2298,7 +2300,7 @@ DECODE(OP_TributeItem) {
|
||||
DECODE_LENGTH_EXACT(structs::TributeItem_Struct);
|
||||
SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
emu->slot = SoFToTitaniumSlot(eq->slot);
|
||||
emu->slot = SoFToServerSlot(eq->slot);
|
||||
IN(quantity);
|
||||
IN(tribute_master_id);
|
||||
IN(tribute_points);
|
||||
@@ -2311,7 +2313,7 @@ DECODE(OP_ReadBook) {
|
||||
SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct);
|
||||
|
||||
IN(type);
|
||||
emu->invslot = SoFToTitaniumSlot(eq->invslot);
|
||||
emu->invslot = SoFToServerSlot(eq->invslot);
|
||||
emu->window = (uint8) eq->window;
|
||||
strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile));
|
||||
|
||||
@@ -2322,7 +2324,7 @@ DECODE(OP_TradeSkillCombine) {
|
||||
DECODE_LENGTH_EXACT(structs::NewCombine_Struct);
|
||||
SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct);
|
||||
|
||||
emu->container_slot = SoFToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = SoFToServerSlot(eq->container_slot);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -2331,7 +2333,7 @@ DECODE(OP_AugmentItem) {
|
||||
DECODE_LENGTH_EXACT(structs::AugmentItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct);
|
||||
|
||||
emu->container_slot = SoFToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = SoFToServerSlot(eq->container_slot);
|
||||
emu->augment_slot = eq->augment_slot;
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2396,7 +2398,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
hdr.stacksize = stackable ? charges : 1;
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
int32 slot_id = TitaniumToSoFSlot(slot_id_in);
|
||||
int32 slot_id = ServerToSoFSlot(slot_id_in);
|
||||
|
||||
hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot;
|
||||
hdr.price = inst->GetPrice();
|
||||
@@ -2778,11 +2780,11 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count = 0;
|
||||
|
||||
char *SubSerializations[10];
|
||||
char *SubSerializations[10]; // <watch>
|
||||
|
||||
uint32 SubLengths[10];
|
||||
|
||||
for(int x = 0; x < 10; ++x) {
|
||||
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
|
||||
|
||||
SubSerializations[x] = nullptr;
|
||||
|
||||
@@ -2794,15 +2796,23 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count++;
|
||||
|
||||
if(slot_id_in >= 22 && slot_id_in < 30)
|
||||
SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
else if(slot_id_in >= 2000 && slot_id_in <= 2023)
|
||||
SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
else if(slot_id_in >= 2500 && slot_id_in <= 2501)
|
||||
SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
if(slot_id_in >= EmuConstants::GENERAL_BEGIN && slot_id_in <= EmuConstants::GENERAL_END) // (< 30) - no cursor?
|
||||
//SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
SubSlotNumber = (((slot_id_in + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + x + 1);
|
||||
else if(slot_id_in >= EmuConstants::BANK_BEGIN && slot_id_in <= EmuConstants::BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::BANK_BAGS_BEGIN + x);
|
||||
else if(slot_id_in >= EmuConstants::SHARED_BANK_BEGIN && slot_id_in <= EmuConstants::SHARED_BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::SHARED_BANK_BAGS_BEGIN + x);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // ???????
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -2834,7 +2844,7 @@ DECODE(OP_AltCurrencySellSelection)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = SoFToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = SoFToServerSlot(eq->slot_id);
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
@@ -2843,7 +2853,7 @@ DECODE(OP_AltCurrencySell)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = SoFToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = SoFToServerSlot(eq->slot_id);
|
||||
IN(charges);
|
||||
IN(cost);
|
||||
FINISH_DIRECT_DECODE();
|
||||
|
||||
@@ -127,9 +127,6 @@ namespace SoF {
|
||||
static const uint16 MAP_KRONO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
static const int16 POSSESSIONS_BEGIN = slots::MainCharm;
|
||||
static const int16 POSSESSIONS_END = slots::MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
|
||||
static const int16 EQUIPMENT_END = slots::MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
|
||||
@@ -160,8 +157,8 @@ namespace SoF {
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_END_NPC = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031; // no change from Ti?
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
|
||||
@@ -104,6 +104,53 @@ const EQClientVersion Strategy::ClientVersion() const
|
||||
|
||||
#include "SSDefine.h"
|
||||
|
||||
|
||||
/*
|
||||
// Converts Server Slot IDs to Titanium Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToTitaniumSlot(uint32 ServerSlot) {
|
||||
uint32 TitaniumSlot;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Titanium Slot IDs to Server Slot IDs for use in Decodes
|
||||
static inline uint32 TitaniumToServerSlot(uint32 TitaniumSlot) {
|
||||
uint32 ServerSlot;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Server Corpse Slot IDs to Titanium Corpse Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToTitaniumCorpseSlot(uint32 ServerCorpse) {
|
||||
uint32 TitaniumCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Titanium Corpse Slot IDs to Server Corpse Slot IDs for use in Decodes
|
||||
static inline uint32 TitaniumToServerCorpseSlot(uint32 TitaniumCorpse) {
|
||||
uint32 ServerCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
static inline uint32 RemovePowerSourceBit(uint32 slots) { // shouldn't need to add one..just grab the actual server reference, if so...
|
||||
static const uint32 BIT21 = 1 << 21;
|
||||
static const uint32 BIT22 = 1 << 22;
|
||||
static const uint32 KEEPBITS = ~(BIT21 | BIT22);
|
||||
|
||||
bool wearammo = slots & BIT22;
|
||||
|
||||
slots &= KEEPBITS;
|
||||
|
||||
if (wearammo)
|
||||
slots |= BIT21;
|
||||
|
||||
return slots;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
EAT_ENCODE(OP_ZoneServerReady)
|
||||
EAT_ENCODE(OP_GuildMemberLevelUpdate)
|
||||
|
||||
|
||||
@@ -126,9 +126,6 @@ namespace Titanium {
|
||||
static const uint16 MAP_KRONO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
static const int16 POSSESSIONS_BEGIN = slots::MainCharm;
|
||||
static const int16 POSSESSIONS_END = slots::MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
|
||||
static const int16 EQUIPMENT_END = slots::MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
|
||||
@@ -159,7 +156,7 @@ namespace Titanium {
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_END_NPC = 3003;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
@@ -109,70 +109,71 @@ const EQClientVersion Strategy::ClientVersion() const
|
||||
#include "SSDefine.h"
|
||||
|
||||
|
||||
// Converts Titanium Slot IDs to Underfoot Slot IDs for use in Encodes
|
||||
static inline uint32 TitaniumToUnderfootSlot(uint32 TitaniumSlot) {
|
||||
// Converts Server Slot IDs to Underfoot Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToUnderfootSlot(uint32 ServerSlot) {
|
||||
uint32 UnderfootSlot = 0;
|
||||
|
||||
if(TitaniumSlot >= 21 && TitaniumSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
{
|
||||
UnderfootSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor
|
||||
{
|
||||
UnderfootSlot = TitaniumSlot + 11;
|
||||
}
|
||||
else if(TitaniumSlot >= 2031 && TitaniumSlot <= 2270) // Bank Bag Slots
|
||||
{
|
||||
UnderfootSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot >= 2531 && TitaniumSlot <= 2550) // Shared Bank Bag Slots
|
||||
{
|
||||
UnderfootSlot = TitaniumSlot + 1;
|
||||
}
|
||||
else if(TitaniumSlot == 9999) //Unused slot ID to give a place to save Power Slot
|
||||
{
|
||||
UnderfootSlot = 21;
|
||||
}
|
||||
if (ServerSlot >= MainAmmo && ServerSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
UnderfootSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END)
|
||||
UnderfootSlot = ServerSlot + 11;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END)
|
||||
UnderfootSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END)
|
||||
UnderfootSlot = ServerSlot + 1;
|
||||
|
||||
else if (ServerSlot == MainPowerSource)
|
||||
UnderfootSlot = slots::MainPowerSource;
|
||||
|
||||
else
|
||||
{
|
||||
UnderfootSlot = TitaniumSlot;
|
||||
}
|
||||
UnderfootSlot = ServerSlot;
|
||||
|
||||
return UnderfootSlot;
|
||||
}
|
||||
|
||||
// Converts Underfoot Slot IDs to Titanium Slot IDs for use in Decodes
|
||||
static inline uint32 UnderfootToTitaniumSlot(uint32 UnderfootSlot) {
|
||||
uint32 TitaniumSlot = 0;
|
||||
// Converts Underfoot Slot IDs to Server Slot IDs for use in Decodes
|
||||
static inline uint32 UnderfootToServerSlot(uint32 UnderfootSlot) {
|
||||
uint32 ServerSlot = 0;
|
||||
|
||||
if(UnderfootSlot >= 22 && UnderfootSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
{
|
||||
TitaniumSlot = UnderfootSlot - 1;
|
||||
}
|
||||
else if(UnderfootSlot >= 262 && UnderfootSlot <= 351) // Bag Slots for Normal Inventory and Cursor
|
||||
{
|
||||
TitaniumSlot = UnderfootSlot - 11;
|
||||
}
|
||||
else if(UnderfootSlot >= 2032 && UnderfootSlot <= 2271) // Bank Bag Slots
|
||||
{
|
||||
TitaniumSlot = UnderfootSlot - 1;
|
||||
}
|
||||
else if(UnderfootSlot >= 2532 && UnderfootSlot <= 2551) // Shared Bank Bag Slots
|
||||
{
|
||||
TitaniumSlot = UnderfootSlot - 1;
|
||||
}
|
||||
else if(UnderfootSlot == 21)
|
||||
{
|
||||
TitaniumSlot = 9999; //Unused slot ID to give a place to save Power Slot
|
||||
}
|
||||
if(UnderfootSlot >= slots::MainAmmo && UnderfootSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = UnderfootSlot - 1;
|
||||
|
||||
else if(UnderfootSlot >= consts::GENERAL_BAGS_BEGIN && UnderfootSlot <= consts::CURSOR_BAG_END)
|
||||
ServerSlot = UnderfootSlot - 11;
|
||||
|
||||
else if(UnderfootSlot >= consts::BANK_BAGS_BEGIN && UnderfootSlot <= consts::BANK_BAGS_END)
|
||||
ServerSlot = UnderfootSlot - 1;
|
||||
|
||||
else if(UnderfootSlot >= consts::SHARED_BANK_BAGS_BEGIN && UnderfootSlot <= consts::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = UnderfootSlot - 1;
|
||||
|
||||
else if(UnderfootSlot == slots::MainPowerSource)
|
||||
ServerSlot = MainPowerSource;
|
||||
|
||||
else
|
||||
{
|
||||
TitaniumSlot = UnderfootSlot;
|
||||
}
|
||||
ServerSlot = UnderfootSlot;
|
||||
|
||||
return TitaniumSlot;
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
/*
|
||||
// Converts Server Corpse Slot IDs to Underfoot Corpse Slot IDs for use in Encodes
|
||||
static inline uint32 ServerToUnderFootCorpseSlot(uint32 ServerCorpse) {
|
||||
uint32 UnderfootCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// Converts Underfoot Corpse Slot IDs to Server Corpse Slot IDs for use in Decodes
|
||||
static inline uint32 UnderfootToServerCorpseSlot(uint32 UnderfootCorpse) {
|
||||
uint32 ServerCorpse;
|
||||
// reserved
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
ENCODE(OP_OpenNewTasksWindow) {
|
||||
|
||||
@@ -1898,7 +1899,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct);
|
||||
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
OUT(npcid);
|
||||
eq->itemslot = TitaniumToUnderfootSlot(emu->itemslot);
|
||||
eq->itemslot = ServerToUnderfootSlot(emu->itemslot);
|
||||
OUT(quantity);
|
||||
OUT(price);
|
||||
FINISH_ENCODE();
|
||||
@@ -1907,7 +1908,7 @@ ENCODE(OP_ShopPlayerSell) {
|
||||
ENCODE(OP_ApplyPoison) {
|
||||
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
|
||||
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
eq->inventorySlot = TitaniumToUnderfootSlot(emu->inventorySlot);
|
||||
eq->inventorySlot = ServerToUnderfootSlot(emu->inventorySlot);
|
||||
OUT(success);
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -1916,8 +1917,8 @@ ENCODE(OP_DeleteItem) {
|
||||
ENCODE_LENGTH_EXACT(DeleteItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToUnderfootSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToUnderfootSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToUnderfootSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToUnderfootSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1928,8 +1929,8 @@ ENCODE(OP_MoveItem) {
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
eq->from_slot = TitaniumToUnderfootSlot(emu->from_slot);
|
||||
eq->to_slot = TitaniumToUnderfootSlot(emu->to_slot);
|
||||
eq->from_slot = ServerToUnderfootSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToUnderfootSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -1939,7 +1940,7 @@ ENCODE(OP_ItemVerifyReply) {
|
||||
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
||||
SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct);
|
||||
|
||||
eq->slot = TitaniumToUnderfootSlot(emu->slot);
|
||||
eq->slot = ServerToUnderfootSlot(emu->slot);
|
||||
OUT(spell);
|
||||
OUT(target);
|
||||
|
||||
@@ -1989,7 +1990,7 @@ ENCODE(OP_TributeItem) {
|
||||
ENCODE_LENGTH_EXACT(TributeItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
eq->slot = TitaniumToUnderfootSlot(emu->slot);
|
||||
eq->slot = ServerToUnderfootSlot(emu->slot);
|
||||
OUT(quantity);
|
||||
OUT(tribute_master_id);
|
||||
OUT(tribute_points);
|
||||
@@ -2036,7 +2037,7 @@ ENCODE(OP_ReadBook) {
|
||||
else
|
||||
eq->window = emu->window;
|
||||
OUT(type);
|
||||
eq->invslot = TitaniumToUnderfootSlot(emu->invslot);
|
||||
eq->invslot = ServerToUnderfootSlot(emu->invslot);
|
||||
strn0cpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile));
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -2097,7 +2098,7 @@ ENCODE(OP_AdventureMerchantSell) {
|
||||
|
||||
eq->unknown000 = 1;
|
||||
OUT(npcid);
|
||||
eq->slot = TitaniumToUnderfootSlot(emu->slot);
|
||||
eq->slot = ServerToUnderfootSlot(emu->slot);
|
||||
OUT(charges);
|
||||
OUT(sell_price);
|
||||
|
||||
@@ -2798,7 +2799,7 @@ ENCODE(OP_AltCurrencySell)
|
||||
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
|
||||
OUT(merchant_entity_id);
|
||||
eq->slot_id = TitaniumToUnderfootSlot(emu->slot_id);
|
||||
eq->slot_id = ServerToUnderfootSlot(emu->slot_id);
|
||||
OUT(charges);
|
||||
OUT(cost);
|
||||
FINISH_ENCODE();
|
||||
@@ -2892,7 +2893,7 @@ DECODE(OP_AdventureMerchantSell) {
|
||||
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->slot = UnderfootToTitaniumSlot(eq->slot);
|
||||
emu->slot = UnderfootToServerSlot(eq->slot);
|
||||
IN(charges);
|
||||
IN(sell_price);
|
||||
|
||||
@@ -2904,7 +2905,7 @@ DECODE(OP_ApplyPoison) {
|
||||
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
|
||||
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
|
||||
|
||||
emu->inventorySlot = UnderfootToTitaniumSlot(eq->inventorySlot);
|
||||
emu->inventorySlot = UnderfootToServerSlot(eq->inventorySlot);
|
||||
IN(success);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2914,7 +2915,7 @@ DECODE(OP_ItemVerifyRequest) {
|
||||
DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct);
|
||||
SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct);
|
||||
|
||||
emu->slot = UnderfootToTitaniumSlot(eq->slot);
|
||||
emu->slot = UnderfootToServerSlot(eq->slot);
|
||||
IN(target);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2924,7 +2925,7 @@ DECODE(OP_Consume) {
|
||||
DECODE_LENGTH_EXACT(structs::Consume_Struct);
|
||||
SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
|
||||
|
||||
emu->slot = UnderfootToTitaniumSlot(eq->slot);
|
||||
emu->slot = UnderfootToServerSlot(eq->slot);
|
||||
IN(auto_consumed);
|
||||
IN(type);
|
||||
|
||||
@@ -2944,7 +2945,7 @@ DECODE(OP_CastSpell) {
|
||||
IN(slot);
|
||||
}
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = UnderfootToTitaniumSlot(eq->inventoryslot);
|
||||
emu->inventoryslot = UnderfootToServerSlot(eq->inventoryslot);
|
||||
IN(target_id);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2955,8 +2956,8 @@ DECODE(OP_DeleteItem)
|
||||
DECODE_LENGTH_EXACT(structs::DeleteItem_Struct);
|
||||
SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct);
|
||||
|
||||
emu->from_slot = UnderfootToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = UnderfootToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = UnderfootToServerSlot(eq->from_slot);
|
||||
emu->to_slot = UnderfootToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2969,8 +2970,8 @@ DECODE(OP_MoveItem)
|
||||
|
||||
_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
|
||||
emu->from_slot = UnderfootToTitaniumSlot(eq->from_slot);
|
||||
emu->to_slot = UnderfootToTitaniumSlot(eq->to_slot);
|
||||
emu->from_slot = UnderfootToServerSlot(eq->from_slot);
|
||||
emu->to_slot = UnderfootToServerSlot(eq->to_slot);
|
||||
IN(number_in_stack);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -3177,7 +3178,7 @@ DECODE(OP_ShopPlayerSell) {
|
||||
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
|
||||
|
||||
IN(npcid);
|
||||
emu->itemslot = UnderfootToTitaniumSlot(eq->itemslot);
|
||||
emu->itemslot = UnderfootToServerSlot(eq->itemslot);
|
||||
IN(quantity);
|
||||
IN(price);
|
||||
|
||||
@@ -3246,7 +3247,7 @@ DECODE(OP_TributeItem) {
|
||||
DECODE_LENGTH_EXACT(structs::TributeItem_Struct);
|
||||
SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct);
|
||||
|
||||
emu->slot = UnderfootToTitaniumSlot(eq->slot);
|
||||
emu->slot = UnderfootToServerSlot(eq->slot);
|
||||
IN(quantity);
|
||||
IN(tribute_master_id);
|
||||
IN(tribute_points);
|
||||
@@ -3259,7 +3260,7 @@ DECODE(OP_ReadBook) {
|
||||
SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct);
|
||||
|
||||
IN(type);
|
||||
emu->invslot = UnderfootToTitaniumSlot(eq->invslot);
|
||||
emu->invslot = UnderfootToServerSlot(eq->invslot);
|
||||
emu->window = (uint8) eq->window;
|
||||
strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile));
|
||||
|
||||
@@ -3270,7 +3271,7 @@ DECODE(OP_TradeSkillCombine) {
|
||||
DECODE_LENGTH_EXACT(structs::NewCombine_Struct);
|
||||
SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct);
|
||||
|
||||
emu->container_slot = UnderfootToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = UnderfootToServerSlot(eq->container_slot);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -3279,7 +3280,7 @@ DECODE(OP_AugmentItem) {
|
||||
DECODE_LENGTH_EXACT(structs::AugmentItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct);
|
||||
|
||||
emu->container_slot = UnderfootToTitaniumSlot(eq->container_slot);
|
||||
emu->container_slot = UnderfootToServerSlot(eq->container_slot);
|
||||
emu->augment_slot = eq->augment_slot;
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -3488,7 +3489,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
hdr.stacksize = stackable ? charges : 1;
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
int32 slot_id = TitaniumToUnderfootSlot(slot_id_in);
|
||||
int32 slot_id = ServerToUnderfootSlot(slot_id_in);
|
||||
|
||||
hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot;
|
||||
hdr.price = inst->GetPrice();
|
||||
@@ -3894,11 +3895,11 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count = 0;
|
||||
|
||||
char *SubSerializations[10];
|
||||
char *SubSerializations[10]; // <watch>
|
||||
|
||||
uint32 SubLengths[10];
|
||||
|
||||
for(int x = 0; x < 10; ++x) {
|
||||
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
|
||||
|
||||
SubSerializations[x] = nullptr;
|
||||
|
||||
@@ -3910,15 +3911,23 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
|
||||
|
||||
iqbs.subitem_count++;
|
||||
|
||||
if(slot_id_in >= 22 && slot_id_in < 30)
|
||||
SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
else if(slot_id_in >= 2000 && slot_id_in <= 2023)
|
||||
SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
else if(slot_id_in >= 2500 && slot_id_in <= 2501)
|
||||
SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
if (slot_id_in >= EmuConstants::GENERAL_BEGIN && slot_id_in <= EmuConstants::GENERAL_END) // (< 30) - no cursor?
|
||||
//SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
|
||||
SubSlotNumber = (((slot_id_in + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + x + 1);
|
||||
else if (slot_id_in >= EmuConstants::BANK_BEGIN && slot_id_in <= EmuConstants::BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::BANK_BAGS_BEGIN + x);
|
||||
else if (slot_id_in >= EmuConstants::SHARED_BANK_BEGIN && slot_id_in <= EmuConstants::SHARED_BANK_END)
|
||||
//SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
|
||||
SubSlotNumber = (((slot_id_in - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::SHARED_BANK_BAGS_BEGIN + x);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // ???????
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -3950,7 +3959,7 @@ DECODE(OP_AltCurrencySellSelection)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = UnderfootToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = UnderfootToServerSlot(eq->slot_id);
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
@@ -3959,7 +3968,7 @@ DECODE(OP_AltCurrencySell)
|
||||
DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct);
|
||||
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
|
||||
IN(merchant_entity_id);
|
||||
emu->slot_id = UnderfootToTitaniumSlot(eq->slot_id);
|
||||
emu->slot_id = UnderfootToServerSlot(eq->slot_id);
|
||||
IN(charges);
|
||||
IN(cost);
|
||||
FINISH_DIRECT_DECODE();
|
||||
|
||||
@@ -127,9 +127,6 @@ namespace Underfoot {
|
||||
static const uint16 MAP_KRONO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
static const int16 POSSESSIONS_BEGIN = slots::MainCharm;
|
||||
static const int16 POSSESSIONS_END = slots::MainCursor;
|
||||
|
||||
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
|
||||
static const int16 EQUIPMENT_END = slots::MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
|
||||
@@ -160,8 +157,8 @@ namespace Underfoot {
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_END_NPC = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031; // no change from Ti?
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
|
||||
+31
-21
@@ -149,10 +149,10 @@ bool ret=true;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
// Delete cursor items
|
||||
if ((ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND ( (slotid >=8000 and slotid<=8999) or slotid=30 or (slotid>=331 and slotid<=340))", char_id), errbuf))) {
|
||||
if ((ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND ( (slotid >=8000 and slotid<=8999) or slotid=%i or (slotid>=%i and slotid<=%i))", char_id, MainCursor,EmuConstants::CURSOR_BAG_BEGIN,EmuConstants::CURSOR_BAG_END), errbuf))) {
|
||||
for(it=start,i=8000;it!=end;++it,i++) {
|
||||
ItemInst *inst=*it;
|
||||
if (!(ret=SaveInventory(char_id,inst,(i==8000) ? 30 : i)))
|
||||
if (!(ret=SaveInventory(char_id,inst,(i==8000) ? MainCursor : i)))
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -204,20 +204,20 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
bool ret = false;
|
||||
uint32 augslot[5] = { 0, 0, 0, 0, 0 };
|
||||
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
|
||||
|
||||
//never save tribute slots:
|
||||
if(slot_id >= 400 && slot_id <= 404)
|
||||
if(slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END)
|
||||
return(true);
|
||||
|
||||
if (inst && inst->IsType(ItemClassCommon)) {
|
||||
for(int i=0;i<5;i++) {
|
||||
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
ItemInst *auginst=inst->GetItem(i);
|
||||
augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0;
|
||||
augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
if (slot_id>=2500 && slot_id<=2600) { // Shared bank inventory
|
||||
if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { // Shared bank inventory
|
||||
if (!inst) {
|
||||
// Delete item
|
||||
uint32 account_id = GetAccountIDByChar(char_id);
|
||||
@@ -229,7 +229,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
|
||||
// Delete bag slots, if need be
|
||||
if (ret && Inventory::SupportsContainers(slot_id)) {
|
||||
safe_delete_array(query);
|
||||
int16 base_slot_id = Inventory::CalcSlotId(slot_id, 0);
|
||||
int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN);
|
||||
ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid>=%i AND slotid<%i",
|
||||
account_id, base_slot_id, (base_slot_id+10)), errbuf);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
|
||||
// Delete bag slots, if need be
|
||||
if (ret && Inventory::SupportsContainers(slot_id)) {
|
||||
safe_delete_array(query);
|
||||
int16 base_slot_id = Inventory::CalcSlotId(slot_id, 0);
|
||||
int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN);
|
||||
ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid>=%i AND slotid<%i",
|
||||
char_id, base_slot_id, (base_slot_id+10)), errbuf);
|
||||
}
|
||||
@@ -302,7 +302,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
|
||||
|
||||
// Save bag contents, if slot supports bag contents
|
||||
if (inst && inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) {
|
||||
for (uint8 idx=0; idx<10; idx++) {
|
||||
for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) {
|
||||
const ItemInst* baginst = inst->GetItem(idx);
|
||||
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
|
||||
}
|
||||
@@ -430,7 +430,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
||||
int16 slot_id = (int16)atoi(row[0]);
|
||||
uint32 item_id = (uint32)atoi(row[1]);
|
||||
int8 charges = (int8)atoi(row[2]);
|
||||
uint32 aug[5];
|
||||
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
|
||||
aug[0] = (uint32)atoi(row[3]);
|
||||
aug[1] = (uint32)atoi(row[4]);
|
||||
aug[2] = (uint32)atoi(row[5]);
|
||||
@@ -443,7 +443,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
||||
|
||||
ItemInst* inst = CreateBaseItem(item, charges);
|
||||
if (item->ItemClass == ItemClassCommon) {
|
||||
for(int i=0;i<5;i++) {
|
||||
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (aug[i]) {
|
||||
inst->PutAugment(this, i, aug[i]);
|
||||
}
|
||||
@@ -484,8 +484,8 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
||||
"Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i",
|
||||
((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id);
|
||||
|
||||
if(is_charid)
|
||||
SaveInventory(id,nullptr,slot_id);
|
||||
if (is_charid)
|
||||
SaveInventory(id, nullptr, slot_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -524,7 +524,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
uint32 item_id = atoi(row[1]);
|
||||
uint16 charges = atoi(row[2]);
|
||||
uint32 color = atoul(row[3]);
|
||||
uint32 aug[5];
|
||||
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
|
||||
aug[0] = (uint32)atoul(row[4]);
|
||||
aug[1] = (uint32)atoul(row[5]);
|
||||
aug[2] = (uint32)atoul(row[6]);
|
||||
@@ -565,7 +565,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (instnodrop || (slot_id >= 0 && slot_id <= 21 && inst->GetItem()->Attuneable))
|
||||
if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable))
|
||||
inst->SetInstNoDrop(true);
|
||||
if (color > 0)
|
||||
inst->SetColor(color);
|
||||
@@ -575,17 +575,27 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
inst->SetCharges(charges);
|
||||
|
||||
if (item->ItemClass == ItemClassCommon) {
|
||||
for(int i=0;i<5;i++) {
|
||||
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (aug[i]) {
|
||||
inst->PutAugment(this, i, aug[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slot_id>=8000 && slot_id <= 8999)
|
||||
if (slot_id >= 8000 && slot_id <= 8999) {
|
||||
put_slot_id = inv->PushCursor(*inst);
|
||||
else
|
||||
}
|
||||
// Admins: please report any occurrences of this error
|
||||
else if (slot_id >= 3111 && slot_id <= 3179) {
|
||||
LogFile->write(EQEMuLog::Error,
|
||||
"Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...",
|
||||
char_id, item_id, slot_id);
|
||||
put_slot_id = inv->PushCursor(*inst);
|
||||
}
|
||||
else {
|
||||
put_slot_id = inv->PutItem(slot_id, *inst);
|
||||
}
|
||||
|
||||
safe_delete(inst);
|
||||
|
||||
// Save ptr to item in inventory
|
||||
@@ -633,7 +643,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
|
||||
uint32 item_id = atoi(row[1]);
|
||||
int8 charges = atoi(row[2]);
|
||||
uint32 color = atoul(row[3]);
|
||||
uint32 aug[5];
|
||||
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
|
||||
aug[0] = (uint32)atoi(row[4]);
|
||||
aug[1] = (uint32)atoi(row[5]);
|
||||
aug[2] = (uint32)atoi(row[6]);
|
||||
@@ -679,7 +689,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
|
||||
inst->SetCharges(charges);
|
||||
|
||||
if (item->ItemClass == ItemClassCommon) {
|
||||
for(int i=0;i<5;i++) {
|
||||
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (aug[i]) {
|
||||
inst->PutAugment(this, i, aug[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user