Merge branch 'master' into web_interface

This commit is contained in:
KimLS 2014-08-04 13:57:43 -07:00
commit dd88d0096b
61 changed files with 3927 additions and 1468 deletions

View File

@ -1,5 +1,14 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 07/31/2014 ==
Uleat: More inventory slot constant conversions. This should be the bulk of everything..but, due to the size of the server code, there
may be some hidden ones. (client_packet.cpp and the client translators still need a thorough review.)
Note: Please report any abnormal behaviour with inventory-related content..each diff file was reviewed 3 times..but, things CAN be missed.
Uleat: Test fix for client crashes in Bazaar, while actively selling, with a charm in the Trader's Satchel.
== 07/27/2014 ==
Uleat: More updates to the dictionary. Added a 'constants' file for each client translator..these will tie-in to the dictionary. Started
replacement of hard-coded numeric values with a pre-defined constant. This will help in the transition.
== 07/16/2014 ==
Uleat: Initial commit of new client/server 'dictionaries' - work in-progress... Changed equipment slot references to reflect new naming

View File

@ -74,6 +74,7 @@ SET(common_sources
patches/SoD.cpp
patches/SoF.cpp
patches/RoF.cpp
#patches/RoF2.cpp
patches/Titanium.cpp
patches/Underfoot.cpp
SocketLib/Base64.cpp
@ -195,15 +196,18 @@ SET(common_headers
ZoneNumbers.h
platform.h
patches/Client62.h
patches/Client62_constants.h
patches/Client62_itemfields.h
patches/Client62_ops.h
patches/Client62_structs.h
patches/patches.h
patches/SoD.h
patches/SoD_constants.h
patches/SoD_itemfields.h
patches/SoD_ops.h
patches/SoD_structs.h
patches/SoF.h
patches/SoF_constants.h
patches/SoF_itemfields.h
patches/SoF_opcode_list.h
patches/SoF_ops.h
@ -212,14 +216,22 @@ SET(common_headers
patches/SSDefine.h
patches/SSRegister.h
patches/RoF.h
patches/RoF_constants.h
patches/RoF_itemfields.h
patches/RoF_ops.h
patches/RoF_structs.h
#patches/RoF2.h
#patches/RoF2_constants.h
#patches/RoF2_itemfields.h
#patches/RoF2_ops.h
#patches/RoF2_structs.h
patches/Titanium.h
patches/Titanium_constants.h
patches/Titanium_itemfields.h
patches/Titanium_ops.h
patches/Titanium_structs.h
patches/Underfoot.h
patches/Underfoot_constants.h
patches/Underfoot_itemfields.h
patches/Underfoot_ops.h
patches/Underfoot_structs.h
@ -244,16 +256,19 @@ SOURCE_GROUP(Patches FILES
patches/Client62.h
patches/Client62_itemfields.h
patches/Client62_ops.h
patches/Client62_constants.h
patches/Client62_structs.h
patches/patches.h
patches/SoD.h
patches/SoD_itemfields.h
patches/SoD_ops.h
patches/SoD_constants.h
patches/SoD_structs.h
patches/SoF.h
patches/SoF_itemfields.h
patches/SoF_opcode_list.h
patches/SoF_ops.h
patches/SoF_constants.h
patches/SoF_structs.h
patches/SSDeclare.h
patches/SSDefine.h
@ -261,20 +276,29 @@ SOURCE_GROUP(Patches FILES
patches/RoF.h
patches/RoF_itemfields.h
patches/RoF_ops.h
patches/RoF_constants.h
patches/RoF_structs.h
#patches/RoF2.h
#patches/RoF2_itemfields.h
#patches/RoF2_ops.h
#patches/RoF2_constants.h
#patches/RoF2_structs.h
patches/Titanium.h
patches/Titanium_itemfields.h
patches/Titanium_ops.h
patches/Titanium_constants.h
patches/Titanium_structs.h
patches/Underfoot.h
patches/Underfoot_itemfields.h
patches/Underfoot_ops.h
patches/Underfoot_constants.h
patches/Underfoot_structs.h
patches/Client62.cpp
patches/patches.cpp
patches/SoD.cpp
patches/SoF.cpp
patches/RoF.cpp
#patches/RoF2.cpp
patches/Titanium.cpp
patches/Underfoot.cpp
)
@ -325,6 +349,7 @@ ADD_LIBRARY(common ${common_sources} ${common_headers})
IF(UNIX)
ADD_DEFINITIONS(-fPIC)
#TODO: Add "patches/RoF2.cpp" when it becomes active
SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
ENDIF(UNIX)

View File

@ -172,57 +172,57 @@ ItemInst* Inventory::GetItem(int16 slot_id) const
}
// Non bag slots
else if (slot_id >= 3000 && slot_id <= 3007) {
// Trade slots
else if (slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END) {
result = _GetItem(m_trade, slot_id);
}
else if (slot_id >= 2500 && slot_id <= 2501) {
else if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_END) {
// Shared Bank slots
result = _GetItem(m_shbank, slot_id);
}
else if (slot_id >= 2000 && slot_id <= 2023) {
else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) {
// Bank slots
result = _GetItem(m_bank, slot_id);
}
else if ((slot_id >= 22 && slot_id <= 29)) {
else if ((slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END)) {
// Personal inventory slots
result = _GetItem(m_inv, slot_id);
}
else if ((slot_id >= 0 && slot_id <= 21) || (slot_id >= 400 && slot_id <= 404) || (slot_id == 9999)) {
else if ((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) ||
(slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) || (slot_id == MainPowerSource)) {
// Equippable slots (on body)
result = _GetItem(m_worn, slot_id);
}
// Inner bag slots
else if (slot_id >= 3031 && slot_id <= 3110) {
else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) {
// Trade bag slots
ItemInst* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id));
if (inst && inst->IsType(ItemClassContainer)) {
result = inst->GetItem(Inventory::CalcBagIdx(slot_id));
}
}
else if (slot_id >= 2531 && slot_id <= 2550) {
else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) {
// Shared Bank bag slots
ItemInst* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id));
if (inst && inst->IsType(ItemClassContainer)) {
result = inst->GetItem(Inventory::CalcBagIdx(slot_id));
}
}
else if (slot_id >= 2031 && slot_id <= 2270) {
else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) {
// Bank bag slots
ItemInst* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id));
if (inst && inst->IsType(ItemClassContainer)) {
result = inst->GetItem(Inventory::CalcBagIdx(slot_id));
}
}
else if (slot_id >= 331 && slot_id <= 340) {
else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) {
// Cursor bag slots
ItemInst* inst = m_cursor.peek_front();
if (inst && inst->IsType(ItemClassContainer)) {
result = inst->GetItem(Inventory::CalcBagIdx(slot_id));
}
}
else if (slot_id >= 251 && slot_id <= 330) {
else if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) {
// Personal inventory bag slots
ItemInst* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id));
if (inst && inst->IsType(ItemClassContainer)) {
@ -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);
@ -651,67 +655,86 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
}
// Opposite of below: Get parent bag slot_id from a slot inside of bag
int16 Inventory::CalcSlotId(int16 slot_id)
{
int16 Inventory::CalcSlotId(int16 slot_id) {
int16 parent_slot_id = INVALID_INDEX;
if (slot_id >= 251 && slot_id <= 330)
parent_slot_id = IDX_INV + (slot_id - 251) / MAX_ITEMS_PER_BAG;
else if (slot_id >= 331 && slot_id <= 340)
if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END)
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 = MainCursor;
else if (slot_id >= 2000 && slot_id <= 2023)
parent_slot_id = IDX_BANK + (slot_id - 2000) / MAX_ITEMS_PER_BAG;
else if (slot_id >= 2031 && slot_id <= 2270)
parent_slot_id = IDX_BANK + (slot_id - 2031) / MAX_ITEMS_PER_BAG;
else if (slot_id >= 2531 && slot_id <= 2550)
parent_slot_id = IDX_SHBANK + (slot_id - 2531) / MAX_ITEMS_PER_BAG;
else if (slot_id >= 3100 && slot_id <= 3179)
parent_slot_id = IDX_TRADE + (slot_id - 3100) / MAX_ITEMS_PER_BAG;
/*
// 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;
*/
else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END)
parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE;
else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END)
parent_slot_id = EmuConstants::SHARED_BANK_BEGIN + (slot_id - EmuConstants::SHARED_BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE;
//else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range)
else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END)
parent_slot_id = EmuConstants::TRADE_BEGIN + (slot_id - EmuConstants::TRADE_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE;
return parent_slot_id;
}
// Calculate slot_id for an item within a bag
int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx)
{
if (!Inventory::SupportsContainers(bagslot_id)) {
int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
if (!Inventory::SupportsContainers(bagslot_id))
return INVALID_INDEX;
}
int16 slot_id = INVALID_INDEX;
if (bagslot_id == MainCursor || bagslot_id == 8000) // Cursor
slot_id = IDX_CURSOR_BAG + bagidx;
else if (bagslot_id >= 22 && bagslot_id <= 29) // Inventory slots
slot_id = IDX_INV_BAG + (bagslot_id - 22)*MAX_ITEMS_PER_BAG + bagidx;
else if (bagslot_id >= 2000 && bagslot_id <= 2023) // Bank slots
slot_id = IDX_BANK_BAG + (bagslot_id - 2000)*MAX_ITEMS_PER_BAG + bagidx;
else if (bagslot_id >= 2500 && bagslot_id <= 2501) // Shared bank slots
slot_id = IDX_SHBANK_BAG + (bagslot_id - 2500)*MAX_ITEMS_PER_BAG + bagidx;
else if (bagslot_id >= 3000 && bagslot_id <= 3007) // Trade window slots
slot_id = IDX_TRADE_BAG + (bagslot_id - 3000)*MAX_ITEMS_PER_BAG + bagidx;
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)
slot_id = EmuConstants::GENERAL_BAGS_BEGIN + (bagslot_id - EmuConstants::GENERAL_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx;
else if (bagslot_id >= EmuConstants::BANK_BEGIN && bagslot_id <= EmuConstants::BANK_END)
slot_id = EmuConstants::BANK_BAGS_BEGIN + (bagslot_id - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx;
else if (bagslot_id >= EmuConstants::SHARED_BANK_BEGIN && bagslot_id <= EmuConstants::SHARED_BANK_END)
slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx;
else if (bagslot_id >= EmuConstants::TRADE_BEGIN && bagslot_id <= EmuConstants::TRADE_END)
slot_id = EmuConstants::TRADE_BAGS_BEGIN + (bagslot_id - EmuConstants::TRADE_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx;
return slot_id;
}
uint8 Inventory::CalcBagIdx(int16 slot_id)
{
uint8 Inventory::CalcBagIdx(int16 slot_id) {
uint8 index = 0;
if (slot_id >= 251 && slot_id <= 330)
index = (slot_id - 251) % MAX_ITEMS_PER_BAG;
else if (slot_id >= 331 && slot_id <= 340)
index = (slot_id - 331) % MAX_ITEMS_PER_BAG;
else if (slot_id >= 2000 && slot_id <= 2023)
index = (slot_id - 2000) % MAX_ITEMS_PER_BAG;
else if (slot_id >= 2031 && slot_id <= 2270)
index = (slot_id - 2031) % MAX_ITEMS_PER_BAG;
else if (slot_id >= 2531 && slot_id <= 2550)
index = (slot_id - 2531) % MAX_ITEMS_PER_BAG;
else if (slot_id >= 3100 && slot_id <= 3179)
index = (slot_id - 3100) % MAX_ITEMS_PER_BAG;
else if (slot_id >= 4000 && slot_id <= 4009)
index = (slot_id - 4000) % MAX_ITEMS_PER_BAG;
if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END)
index = (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE;
else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END)
index = (slot_id - EmuConstants::CURSOR_BAG_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots
/*
// 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;
*/
else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END)
index = (slot_id - EmuConstants::BANK_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE;
else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END)
index = (slot_id - EmuConstants::SHARED_BANK_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE;
else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END)
index = (slot_id - EmuConstants::TRADE_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE;
// odd..but, ok... (probably a range-slot conversion for ItemInst* Object::item
else if (slot_id >= EmuConstants::WORLD_BEGIN && slot_id <= EmuConstants::WORLD_END)
index = (slot_id - EmuConstants::WORLD_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots
return index;
}
@ -787,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;
}
@ -829,7 +852,7 @@ int Inventory::GetSlotByItemInst(ItemInst *inst) {
return MainCursor;
}
return -1;
return INVALID_INDEX;
}
void Inventory::dumpEntireInventory() {
@ -946,29 +969,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;
}
@ -1007,9 +1034,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
@ -1022,9 +1049,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.
}
}
}
@ -1051,9 +1078,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
@ -1066,9 +1093,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.
}
}
@ -1162,10 +1189,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
@ -1177,10 +1204,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.
}
}
}
@ -1205,10 +1232,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
@ -1221,10 +1248,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.
}
}
@ -1400,14 +1427,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;
@ -1416,13 +1444,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;
@ -1438,7 +1467,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;
@ -1446,7 +1475,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
@ -1464,7 +1493,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;
@ -1569,12 +1598,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
@ -1583,7 +1612,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;
}
@ -1593,7 +1622,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;
@ -1611,7 +1640,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);
}
@ -1628,7 +1657,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)
{
@ -1656,7 +1685,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;
@ -1773,8 +1802,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; }
}

View File

@ -55,21 +55,6 @@ namespace ItemField
};
};
// Indexing positions to the beginning slot_id's for a bucket of slots
#define IDX_EQUIP 0
#define IDX_CURSOR_BAG 331
#define IDX_INV 22
#define IDX_INV_BAG 251
#define IDX_TRIBUTE 400
#define IDX_BANK 2000
#define IDX_BANK_BAG 2031
#define IDX_SHBANK 2500
#define IDX_SHBANK_BAG 2531
#define IDX_TRADE 3000
#define IDX_TRADE_BAG 3031
#define IDX_TRADESKILL 4000
#define MAX_ITEMS_PER_BAG 10
// Specifies usage type for item inside ItemInst
enum ItemInstTypes
{
@ -380,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();
@ -428,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 {

View File

@ -31,11 +31,6 @@ typedef enum {
// Values below are not implemented, as yet...
// - RoF2 is added for convenience of implementor..creation client will need to be changed once that client is actually added
// - Code will be added to 'relieve' characters of any illegal inventory items based on their client version. This will
// oversee cheats and mis-placement of starting items whenever a client is loaded.
_EQCreationClient = EQClientRoF, // bump to latest client as new ones are added (make sure that db is updated accordingly)
EmuNPC = _EQClientCount,
EmuMerc,
EmuBot,

View File

@ -707,7 +707,7 @@ bool Database::DeleteCharacter(char *name)
return true;
}
// Store new character information into the character_ and inventory tables
// Store new character information into the character_ and inventory tables (this won't store starting augments)
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext)
{
char errbuf[MYSQL_ERRMSG_SIZE];
@ -793,7 +793,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
// Doodman: Is this even used?
// now the inventory
for (i=0; i<=2270;)
for (i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::BANK_BAGS_END;)
{
const ItemInst* newinv = inv->GetItem((int16)i);
if (newinv)
@ -821,14 +821,16 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
safe_delete_array(invquery);
}
if(i==30){ //end of standard inventory/cursor, jump to internals of bags/cursor
i = 251;
if (i == MainCursor) {
i = EmuConstants::GENERAL_BAGS_BEGIN;
continue;
} else if(i==340){ //end of internals of bags/cursor, jump to bank slots
i = 2000;
}
else if (i == EmuConstants::CURSOR_BAG_END) {
i = EmuConstants::BANK_BEGIN;
continue;
} else if(i==2023){ //end of bank slots, jump to internals of bank bags
i = 2031;
}
else if (i == EmuConstants::BANK_END) {
i = EmuConstants::BANK_BAGS_BEGIN;
continue;
}

View File

@ -539,3 +539,4 @@ N(OP_MercenaryTimerRequest),
N(OP_OpenInventory),
N(OP_OpenContainer),
N(OP_Marquee),
N(OP_ClientTimeStamp),

View File

@ -873,81 +873,99 @@ enum InventoryMainTypes : int16 {
MainGeneral8,
//MainGeneral9,
//MainGeneral10,
MainCursor //,
//_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
MainCursor,
_MainCount
};
#define INVALID_INDEX -1
#define NOT_USED 0
#define NO_ITEM 0
// yes..these are redundant... but, they help to identify and define what is actually being performed
// plus, since they're pre-op's, they don't affect the actual binary size
#define MAP_BEGIN 0
#define MAIN_BEGIN 0
#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

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,22 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/*
EQEMu: Everquest Server Emulator
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EQ_DICTIONARY_H
@ -22,65 +25,140 @@
#include "types.h"
#include "eq_constants.h"
#include "clientversions.h"
#include <string>
#include "../common/patches/Client62_constants.h"
#include "../common/patches/Titanium_constants.h"
#include "../common/patches/SoF_constants.h"
#include "../common/patches/SoD_constants.h"
#include "../common/patches/Underfoot_constants.h"
#include "../common/patches/RoF_constants.h"
//#include "../common/patches/RoF2_constants.h"
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
typedef class {
// *** 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 change them are made!! ***
// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system
// (future use)
//using namespace RoF2::maps; // server inventory maps enumeration (code and database sync'd to reference)
//using namespace RoF::slots; // server possessions slots enumeration (code and database sync'd to reference)
class EmuConstants {
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
public:
// database
static const EQClientVersion CHARACTER_CREATION_CLIENT = _EQCreationClient;
static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client
// inventory
static uint16 InventoryMapSize(int16 map);
//static std::string InventoryLocationName(Location_Struct location);
static std::string InventoryMapName(int16 map);
static std::string InventoryMainName(int16 main);
static std::string InventorySubName(int16 sub);
static std::string InventoryAugName(int16 aug);
static const uint16 MAP_POSSESSIONS_SIZE = 22; //_SlotCount;
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
static const uint16 MAP_POSSESSIONS_SIZE = _MainCount;
static const uint16 MAP_BANK_SIZE = 24;
static const uint16 MAP_SHAREDBANK_SIZE = 2;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 5;
static const uint16 MAP_TROPHYTRIBUTE_SIZE = 0;
static const uint16 MAP_GUILDTRIBUTE_SIZE = 0;
static const uint16 MAP_TRIBUTE_SIZE = 5; // (need client values)
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = 22; //_SlotCount; // actual code still needs lots of work...
static const uint16 MAP_BAZAAR_SIZE = 80; //200;
static const uint16 MAP_INSPECT_SIZE = 22; //_SlotEquipmentCount;
static const uint16 MAP_REALESTATE_SIZE = 0;
static const uint16 MAP_VIEWMODPC_SIZE = NOT_USED;
static const uint16 MAP_VIEWMODBANK_SIZE = NOT_USED;
static const uint16 MAP_VIEWMODSHAREDBANK_SIZE = NOT_USED;
static const uint16 MAP_VIEWMODLIMBO_SIZE = NOT_USED;
static const uint16 MAP_ALTSTORAGE_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = _MainCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
static const uint16 MAP_BAZAAR_SIZE = 80;
static const uint16 MAP_INSPECT_SIZE = 22;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = NOT_USED;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = NOT_USED;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = NOT_USED;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = NOT_USED;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILDTROPHYTRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = 0; // this will be '1' when RoF2 is implemented
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = 0;
static const uint16 MAP_OTHER_SIZE = 0;
//static const int16 EQUIPMENT_BEGIN = _SlotEquipmentBegin;
//static const int16 EQUIPMENT_END = _SlotEquipmentEnd;
static const uint16 EQUIPMENT_SIZE = 22; //_SlotEquipmentCount; // not ready for client usage..only equipment arrays for npcs...
// 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 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 GENERAL_BEGIN = 22; //_SlotGeneralBegin;
static const int16 GENERAL_END = 29; //_SlotGeneralEnd;
static const uint16 GENERAL_SIZE = 8; //_SlotGeneralCount;
static const int16 GENERAL_BEGIN = MainGeneral1;
static const int16 GENERAL_END = MainGeneral8;
static const uint16 GENERAL_SIZE = 8;
static const int16 GENERAL_BAGS_BEGIN = 251;
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_BAG_BEGIN = 331;
static const int16 CURSOR_BAG_END_OFFSET = 9;
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2023;
static const int16 BANK_BAGS_BEGIN = 2031;
static const int16 BANK_BAGS_END_OFFSET = 239;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
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 = 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;
// items
static const uint16 ITEM_COMMON_SIZE = 5;
static const uint16 ITEM_CONTAINER_SIZE = 10;
// 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;
static const uint16 ITEM_CONTAINER_SIZE = Underfoot::consts::ITEM_CONTAINER_SIZE;
// player profile
//static const uint32 CLASS_BITMASK = 0; // needs value
//static const uint32 RACE_BITMASK = 0; // needs value
// TODO: resolve naming convention and use for bandolier count versus size
//static const uint32 BANDOLIER_COUNT = 4;
static const uint32 BANDOLIER_SIZE = 4;
static const uint32 POTION_BELT_SIZE = 5;
} EmuConstants;
// BANDOLIERS_COUNT sets maximum limit..active limit will need to be handled by the appropriate AA
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;
typedef class {
// legacy-related functions
//static int ServerToPerlSlot(int slot); // encode
//static int PerlToServerSlot(int slot); // decode
};
class EQLimits {
// values should default to a non-beneficial value..unless value conflicts with intended operation
//
// EmuConstants may be used as references..but, not every reference needs to be in EmuConstants (i.e., AllowsEmptyBagInBag(), CoinHasWeight(), etc...)
public:
// client version validation (checks to avoid crashing zone server when accessing reference arrays)
// use this inside of class Client (limits to actual clients)
@ -113,6 +191,20 @@ public:
// player profile
static bool CoinHasWeight(uint32 version);
} EQLimits;
static uint32 BandoliersCount(uint32 version);
static uint32 BandolierSize(uint32 version);
static uint32 PotionBeltSize(uint32 version);
};
#endif /* EQ_LIMITS_H */
/*
Working Notes:
--------------
- full review of client_packet.cpp and client translators needed
*/

View File

@ -721,12 +721,8 @@ struct Disciplines_Struct {
uint32 values[MAX_PP_DISCIPLINES];
};
static const uint32 TRIBUTE_SLOT_START = 400;
static const uint32 MAX_PLAYER_TRIBUTES = 5;
static const uint32 MAX_PLAYER_BANDOLIER = 4;
static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4;
static const uint32 MAX_POTIONS_IN_BELT = 4;
static const uint32 TRIBUTE_NONE = 0xFFFFFFFF;
struct Tribute_Struct {
uint32 tribute;
uint32 tier;
@ -748,10 +744,10 @@ enum { //bandolier item positions
};
struct Bandolier_Struct {
char name[32];
BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS];
BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE];
};
struct PotionBelt_Struct {
BandolierItem_Struct items[MAX_POTIONS_IN_BELT];
BandolierItem_Struct items[EmuConstants::POTION_BELT_SIZE];
};
struct MovePotionToBelt_Struct {
@ -1000,7 +996,7 @@ struct PlayerProfile_Struct
/*7212*/ uint32 tribute_points;
/*7216*/ uint32 unknown7252;
/*7220*/ uint32 tribute_active; //1=active
/*7224*/ Tribute_Struct tributes[MAX_PLAYER_TRIBUTES];
/*7224*/ Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE];
/*7264*/ Disciplines_Struct disciplines;
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
/*7744*/ char unknown7780[160];
@ -1027,7 +1023,7 @@ struct PlayerProfile_Struct
/*12800*/ uint32 expAA;
/*12804*/ uint32 aapoints; //avaliable, unspent
/*12808*/ uint8 unknown12844[36];
/*12844*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER];
/*12844*/ Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT];
/*14124*/ uint8 unknown14160[4506];
/*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use
/*19240*/ uint32 timeentitledonaccount;
@ -1470,6 +1466,16 @@ struct MoveItem_Struct
/*0008*/ uint32 number_in_stack;
};
// both MoveItem_Struct/DeleteItem_Struct server structures will be changing to a structure-based slot format..this will
// be used for handling SoF/SoD/etc... time stamps sent using the MoveItem_Struct format. (nothing will be done with this
// info at the moment..but, it forwards it on to the server for handling/future use)
struct ClientTimeStamp_Struct
{
/*0000*/ uint32 from_slot;
/*0004*/ uint32 to_slot;
/*0008*/ uint32 number_in_stack;
};
//
// from_slot/to_slot
// -1 - destroy
@ -3343,8 +3349,8 @@ struct SelectTributeReply_Struct {
struct TributeInfo_Struct {
uint32 active; //0 == inactive, 1 == active
uint32 tributes[MAX_PLAYER_TRIBUTES]; //-1 == NONE
uint32 tiers[MAX_PLAYER_TRIBUTES]; //all 00's
uint32 tributes[EmuConstants::TRIBUTE_SIZE]; //-1 == NONE
uint32 tiers[EmuConstants::TRIBUTE_SIZE]; //all 00's
uint32 tribute_master_id;
};

View File

@ -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)

View File

@ -0,0 +1,211 @@
/*
EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CLIENT62_CONSTANTS_H_
#define CLIENT62_CONSTANTS_H_
#include "../common/types.h"
namespace Client62 {
namespace maps {
typedef enum : int16 {
// this needs work to match actual client equivilents
MapPossessions = 0,
MapBank,
MapSharedBank,
MapTrade,
MapWorld,
MapLimbo,
MapTribute,
MapTrophyTribute,
MapGuildTribute,
MapMerchant,
MapDeleted,
MapCorpse,
MapBazaar,
MapInspect,
MapRealEstate,
MapViewMODPC,
MapViewMODBank,
MapViewMODSharedBank,
MapViewMODLimbo,
MapAltStorage,
MapArchived,
MapMail,
MapGuildTrophyTribute,
MapOther,
_MapCount
} InventoryMaps;
}
namespace slots {
typedef enum : int16 {
MainCharm = 0,
MainEar1,
MainHead,
MainFace,
MainEar2,
MainNeck,
MainShoulders,
MainArms,
MainBack,
MainWrist1,
MainWrist2,
MainRange,
MainHands,
MainPrimary,
MainSecondary,
MainFinger1,
MainFinger2,
MainChest,
MainLegs,
MainFeet,
MainWaist,
MainAmmo,
MainGeneral1,
MainGeneral2,
MainGeneral3,
MainGeneral4,
MainGeneral5,
MainGeneral6,
MainGeneral7,
MainGeneral8,
MainCursor,
_MainCount,
_MainEquipmentBegin = MainCharm,
_MainEquipmentEnd = MainAmmo,
_MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1),
_MainGeneralBegin = MainGeneral1,
_MainGeneralEnd = MainGeneral8,
_MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1)
} EquipmentSlots;
}
namespace consts {
static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount;
static const uint16 MAP_BANK_SIZE = 16;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 0; //?
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = slots::_MainCount;
static const uint16 MAP_BAZAAR_SIZE = 80;
static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = NOT_USED;
static const uint16 MAP_OTHER_SIZE = 0;
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
static const int16 EQUIPMENT_END = slots::MainAmmo;
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
static const int16 GENERAL_BEGIN = slots::MainGeneral1;
static const int16 GENERAL_END = slots::MainGeneral8;
static const uint16 GENERAL_SIZE = slots::_MainGeneralCount;
static const int16 GENERAL_BAGS_BEGIN = 251;
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 = slots::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;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2015;
static const int16 BANK_BAGS_BEGIN = 2031;
static const int16 BANK_BAGS_END_OFFSET = 159;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 CORPSE_BEGIN = slots::MainGeneral1;
static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor;
static const uint16 ITEM_COMMON_SIZE = 5;
static const uint16 ITEM_CONTAINER_SIZE = 10;
static const uint32 BANDOLIERS_COUNT = 4; // count = number of bandolier instances
static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance
static const uint32 POTION_BELT_SIZE = 4;
}
namespace limits {
static const bool ALLOWS_EMPTY_BAG_IN_BAG = false;
static const bool COIN_HAS_WEIGHT = true;
}
}; //end namespace Client62
#endif /*CLIENT62_CONSTANTS_H_*/
/*
Client62 Notes:
** Integer-based inventory **
ok Possessions: 0 - 30 (Corpse: 22 - 52 [Offset 22])
ok [Equipment: 0 - 21]
ok [General: 22 - 29]
ok [Cursor: 30]
ok General Bags: 251 - 330
ok Cursor Bags: 331 - 340
ok Bank: 2000 - 2015
ok Bank Bags: 2031 - 2190
ok Shared Bank: 2500 - 2501
ok Shared Bank Bags: 2531 - 2550
Trade: 3000 - 3007
(Trade Bags: 3031 - 3110 -- server values)
World: 4000 - 4009
*/

View File

@ -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)
{
@ -1200,11 +1198,11 @@ ENCODE(OP_PlayerProfile)
outapp->WriteUInt32(structs::MAX_PLAYER_BANDOLIER);
for(uint32 r = 0; r < MAX_PLAYER_BANDOLIER; r++)
for(uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++)
{
outapp->WriteString(emu->bandoliers[r].name);
for(uint32 j = 0; j < MAX_PLAYER_BANDOLIER_ITEMS; ++j)
for(uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j)
{
outapp->WriteString(emu->bandoliers[r].items[j].item_name);
outapp->WriteUInt32(emu->bandoliers[r].items[j].item_id);
@ -1212,11 +1210,11 @@ ENCODE(OP_PlayerProfile)
}
}
for(uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - MAX_PLAYER_BANDOLIER; r++)
for(uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++)
{
outapp->WriteString("");
for(uint32 j = 0; j < MAX_PLAYER_BANDOLIER_ITEMS; ++j)
for(uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j)
{
outapp->WriteString("");
outapp->WriteUInt32(0);
@ -1227,7 +1225,7 @@ ENCODE(OP_PlayerProfile)
outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT);
for(uint32 r = 0; r < MAX_POTIONS_IN_BELT; r++)
for(uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++)
{
outapp->WriteString(emu->potionbelt.items[r].item_name);
outapp->WriteUInt32(emu->potionbelt.items[r].item_id);
@ -1235,7 +1233,7 @@ ENCODE(OP_PlayerProfile)
}
for(uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - MAX_POTIONS_IN_BELT; r++)
for(uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++)
{
outapp->WriteString("");
outapp->WriteUInt32(0);
@ -1357,9 +1355,9 @@ ENCODE(OP_PlayerProfile)
outapp->WriteUInt8(0); // Unknown
outapp->WriteUInt8(0); // Unknown
outapp->WriteUInt32(MAX_PLAYER_TRIBUTES);
outapp->WriteUInt32(EmuConstants::TRIBUTE_SIZE);
for(uint32 r = 0; r < MAX_PLAYER_TRIBUTES; r++)
for(uint32 r = 0; r < EmuConstants::TRIBUTE_SIZE; r++)
{
outapp->WriteUInt32(emu->tributes[r].tribute);
outapp->WriteUInt32(emu->tributes[r].tier);
@ -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]) {

View File

@ -0,0 +1,215 @@
/*
EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef RoF_CONSTANTS_H_
#define RoF_CONSTANTS_H_
#include "../common/types.h"
namespace RoF {
namespace maps {
typedef enum : int16 {
MapPossessions = 0,
MapBank,
MapSharedBank,
MapTrade,
MapWorld,
MapLimbo,
MapTribute,
MapTrophyTribute,
MapGuildTribute,
MapMerchant,
MapDeleted,
MapCorpse,
MapBazaar,
MapInspect,
MapRealEstate,
MapViewMODPC,
MapViewMODBank,
MapViewMODSharedBank,
MapViewMODLimbo,
MapAltStorage,
MapArchived,
MapMail,
MapGuildTrophyTribute,
MapOther,
_MapCount
} InventoryMaps;
}
namespace slots {
typedef enum : int16 {
MainCharm = 0,
MainEar1,
MainHead,
MainFace,
MainEar2,
MainNeck,
MainShoulders,
MainArms,
MainBack,
MainWrist1,
MainWrist2,
MainRange,
MainHands,
MainPrimary,
MainSecondary,
MainFinger1,
MainFinger2,
MainChest,
MainLegs,
MainFeet,
MainWaist,
MainPowerSource,
MainAmmo,
MainGeneral1,
MainGeneral2,
MainGeneral3,
MainGeneral4,
MainGeneral5,
MainGeneral6,
MainGeneral7,
MainGeneral8,
MainGeneral9,
MainGeneral10,
MainCursor,
_MainCount,
_MainEquipmentBegin = MainCharm,
_MainEquipmentEnd = MainAmmo,
_MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1),
_MainGeneralBegin = MainGeneral1,
_MainGeneralEnd = MainGeneral10,
_MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1)
} EquipmentSlots;
}
namespace consts {
static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount;
static const uint16 MAP_BANK_SIZE = 24;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 0; //?
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = slots::_MainCount;
static const uint16 MAP_BAZAAR_SIZE = 200;
static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = NOT_USED;
static const uint16 MAP_OTHER_SIZE = 0;
// 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 EQUIPMENT_BEGIN = slots::MainCharm;
static const int16 EQUIPMENT_END = slots::MainAmmo;
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
static const int16 GENERAL_BEGIN = slots::MainGeneral1;
static const int16 GENERAL_END = slots::MainGeneral10;
static const uint16 GENERAL_SIZE = slots::_MainGeneralCount;
static const int16 GENERAL_BAGS_BEGIN = 251;
static const int16 GENERAL_BAGS_END_OFFSET = 99;
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
static const int16 CURSOR = slots::MainCursor;
static const int16 CURSOR_BAG_BEGIN = 351;
static const int16 CURSOR_BAG_END_OFFSET = 9;
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2023;
static const int16 BANK_BAGS_BEGIN = 2031;
static const int16 BANK_BAGS_END_OFFSET = 239;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 CORPSE_BEGIN = slots::MainGeneral1;
static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor;
static const uint16 ITEM_COMMON_SIZE = 6;
static const uint16 ITEM_CONTAINER_SIZE = 255; // 255; (server max will be 255..unsure what actual client is - test)
static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances
static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance
static const uint32 POTION_BELT_SIZE = 5;
}
namespace limits {
static const bool ALLOWS_EMPTY_BAG_IN_BAG = true;
static const bool COIN_HAS_WEIGHT = false;
}
}; //end namespace RoF
#endif /*RoF_CONSTANTS_H_*/
/*
RoF Notes:
** Structure-based inventory **
ok Possessions: ( 0, { 0 .. 33 }, -1, -1 ) (Corpse: { 23 .. 56 } [Offset 23])
ok [Equipment: ( 0, { 0 .. 22 }, -1, -1 )]
ok [General: ( 0, { 23 .. 32 }, -1, -1 )]
ok [Cursor: ( 0, 33, -1, -1 )]
General Bags: ( 0, { 23 .. 32 }, { 0 .. (maxsize - 1) }, -1 )
Cursor Bags: ( 0, 33, { 0 .. (maxsize - 1) }, -1 )
Bank: ( 1, { 0 .. 23 }, -1, -1 )
Bank Bags: ( 1, { 0 .. 23 }, { 0 .. (maxsize - 1)}, -1 )
Shared Bank: ( 2, { 0 .. 1 }, -1, -1 )
Shared Bank Bags: ( 2, { 0 .. 1 }, { 0 .. (maxsize - 1) }, -1 )
Trade: ( 3, { 0 .. 8 }, -1, -1 )
(Trade Bags: 3031 - 3110 -- server values)
World: ( 4, { 0 .. 10 }, -1, -1 )
*/

View File

@ -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();

View File

@ -0,0 +1,212 @@
/*
EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SoD_CONSTANTS_H_
#define SoD_CONSTANTS_H_
#include "../common/types.h"
namespace SoD {
namespace maps {
typedef enum : int16 {
// this needs work to match actual client equivilents
MapPossessions = 0,
MapBank,
MapSharedBank,
MapTrade,
MapWorld,
MapLimbo,
MapTribute,
MapTrophyTribute,
MapGuildTribute,
MapMerchant,
MapDeleted,
MapCorpse,
MapBazaar,
MapInspect,
MapRealEstate,
MapViewMODPC,
MapViewMODBank,
MapViewMODSharedBank,
MapViewMODLimbo,
MapAltStorage,
MapArchived,
MapMail,
MapGuildTrophyTribute,
MapOther,
_MapCount
} InventoryMaps;
}
namespace slots {
typedef enum : int16 {
MainCharm = 0,
MainEar1,
MainHead,
MainFace,
MainEar2,
MainNeck,
MainShoulders,
MainArms,
MainBack,
MainWrist1,
MainWrist2,
MainRange,
MainHands,
MainPrimary,
MainSecondary,
MainFinger1,
MainFinger2,
MainChest,
MainLegs,
MainFeet,
MainWaist,
MainPowerSource,
MainAmmo,
MainGeneral1,
MainGeneral2,
MainGeneral3,
MainGeneral4,
MainGeneral5,
MainGeneral6,
MainGeneral7,
MainGeneral8,
MainCursor,
_MainCount,
_MainEquipmentBegin = MainCharm,
_MainEquipmentEnd = MainAmmo,
_MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1),
_MainGeneralBegin = MainGeneral1,
_MainGeneralEnd = MainGeneral8,
_MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1)
} EquipmentSlots;
}
namespace consts {
static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount;
static const uint16 MAP_BANK_SIZE = 24;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 0; //?
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = slots::_MainCount;
static const uint16 MAP_BAZAAR_SIZE = 80;
static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = NOT_USED;
static const uint16 MAP_OTHER_SIZE = 0;
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
static const int16 EQUIPMENT_END = slots::MainAmmo;
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
static const int16 GENERAL_BEGIN = slots::MainGeneral1;
static const int16 GENERAL_END = slots::MainGeneral8;
static const uint16 GENERAL_SIZE = slots::_MainGeneralCount;
static const int16 GENERAL_BAGS_BEGIN = 262;
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 = slots::MainCursor;
static const int16 CURSOR_BAG_BEGIN = 342;
static const int16 CURSOR_BAG_END_OFFSET = 9;
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2023;
static const int16 BANK_BAGS_BEGIN = 2032;
static const int16 BANK_BAGS_END_OFFSET = 239;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2532;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 CORPSE_BEGIN = slots::MainGeneral1;
static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor;
static const uint16 ITEM_COMMON_SIZE = 5;
static const uint16 ITEM_CONTAINER_SIZE = 10;
static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances
static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance
static const uint32 POTION_BELT_SIZE = 5;
}
namespace limits {
static const bool ALLOWS_EMPTY_BAG_IN_BAG = false;
static const bool COIN_HAS_WEIGHT = false;
}
}; //end namespace SoD
#endif /*SoD_CONSTANTS_H_*/
/*
SoD Notes:
** Integer-based inventory **
ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23])
ok [Equipment: 0 - 22]
ok [General: 23 - 30]
ok [Cursor: 31]
ok General Bags: 262 - 341
ok Cursor Bags: 342 - 351
ok Bank: 2000 - 2023
ok Bank Bags: 2032 - 2271
ok Shared Bank: 2500 - 2501
ok Shared Bank Bags: 2532 - 2551
Trade: 3000 - 3007
(Trade Bags: 3031 - 3110 -- server values)
World: 4000 - 4009
*/

View File

@ -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();

View File

@ -0,0 +1,215 @@
/*
EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SoF_CONSTANTS_H_
#define SoF_CONSTANTS_H_
#include "../common/types.h"
namespace SoF {
namespace maps {
typedef enum : int16 {
// this needs work to match actual client equivilents
MapPossessions = 0,
MapBank,
MapSharedBank,
MapTrade,
MapWorld,
MapLimbo,
MapTribute,
MapTrophyTribute,
MapGuildTribute,
MapMerchant,
MapDeleted,
MapCorpse,
MapBazaar,
MapInspect,
MapRealEstate,
MapViewMODPC,
MapViewMODBank,
MapViewMODSharedBank,
MapViewMODLimbo,
MapAltStorage,
MapArchived,
MapMail,
MapGuildTrophyTribute,
MapOther,
_MapCount
} InventoryMaps;
}
namespace slots {
typedef enum : int16 {
MainCharm = 0,
MainEar1,
MainHead,
MainFace,
MainEar2,
MainNeck,
MainShoulders,
MainArms,
MainBack,
MainWrist1,
MainWrist2,
MainRange,
MainHands,
MainPrimary,
MainSecondary,
MainFinger1,
MainFinger2,
MainChest,
MainLegs,
MainFeet,
MainWaist,
MainPowerSource,
MainAmmo,
MainGeneral1,
MainGeneral2,
MainGeneral3,
MainGeneral4,
MainGeneral5,
MainGeneral6,
MainGeneral7,
MainGeneral8,
MainCursor,
_MainCount,
_MainEquipmentBegin = MainCharm,
_MainEquipmentEnd = MainAmmo,
_MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1),
_MainGeneralBegin = MainGeneral1,
_MainGeneralEnd = MainGeneral8,
_MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1)
} EquipmentSlots;
}
namespace consts {
static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount;
static const uint16 MAP_BANK_SIZE = 24;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 0; //?
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = slots::_MainCount;
static const uint16 MAP_BAZAAR_SIZE = 80;
static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = NOT_USED;
static const uint16 MAP_OTHER_SIZE = 0;
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
static const int16 EQUIPMENT_END = slots::MainAmmo;
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
static const int16 GENERAL_BEGIN = slots::MainGeneral1;
static const int16 GENERAL_END = slots::MainGeneral8;
static const uint16 GENERAL_SIZE = slots::_MainGeneralCount;
static const int16 GENERAL_BAGS_BEGIN = 262;
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 = slots::MainCursor;
static const int16 CURSOR_BAG_BEGIN = 342;
static const int16 CURSOR_BAG_END_OFFSET = 9;
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2023;
static const int16 BANK_BAGS_BEGIN = 2032;
static const int16 BANK_BAGS_END_OFFSET = 239;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2532;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 CORPSE_BEGIN = slots::MainGeneral1;
static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor;
static const uint16 ITEM_COMMON_SIZE = 5;
static const uint16 ITEM_CONTAINER_SIZE = 10;
static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances
static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance
static const uint32 POTION_BELT_SIZE = 5;
}
namespace limits {
static const bool ALLOWS_EMPTY_BAG_IN_BAG = false;
static const bool COIN_HAS_WEIGHT = true;
}
}; //end namespace SoF
#endif /*SoF_CONSTANTS_H_*/
/*
SoF Notes:
** Integer-based inventory **
ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23])
ok [Equipment: 0 - 22]
ok [General: 23 - 30]
ok [Cursor: 31]
ok General Bags: 262 - 341
ok Cursor Bags: 342 - 351
ok Bank: 2000 - 2023
ok Bank Bags: 2032 - 2271
ok Shared Bank: 2500 - 2501
ok Shared Bank Bags: 2532 - 2551
Trade: 3000 - 3007
(Trade Bags: 3031 - 3110 -- server values)
World: 4000 - 4009
code file reviewed..
..SerializeItem() needs work
..still needs timestamp redirect code
*/

View File

@ -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)

View File

@ -0,0 +1,211 @@
/*
EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef Titanium_CONSTANTS_H_
#define Titanium_CONSTANTS_H_
#include "../common/types.h"
namespace Titanium {
namespace maps {
typedef enum : int16 {
// this needs work to match actual client equivilents
MapPossessions = 0,
MapBank,
MapSharedBank,
MapTrade,
MapWorld,
MapLimbo,
MapTribute,
MapTrophyTribute,
MapGuildTribute,
MapMerchant,
MapDeleted,
MapCorpse,
MapBazaar,
MapInspect,
MapRealEstate,
MapViewMODPC,
MapViewMODBank,
MapViewMODSharedBank,
MapViewMODLimbo,
MapAltStorage,
MapArchived,
MapMail,
MapGuildTrophyTribute,
MapOther,
_MapCount
} InventoryMaps;
}
namespace slots {
typedef enum : int16 {
MainCharm = 0,
MainEar1,
MainHead,
MainFace,
MainEar2,
MainNeck,
MainShoulders,
MainArms,
MainBack,
MainWrist1,
MainWrist2,
MainRange,
MainHands,
MainPrimary,
MainSecondary,
MainFinger1,
MainFinger2,
MainChest,
MainLegs,
MainFeet,
MainWaist,
MainAmmo,
MainGeneral1,
MainGeneral2,
MainGeneral3,
MainGeneral4,
MainGeneral5,
MainGeneral6,
MainGeneral7,
MainGeneral8,
MainCursor,
_MainCount,
_MainEquipmentBegin = MainCharm,
_MainEquipmentEnd = MainAmmo,
_MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1),
_MainGeneralBegin = MainGeneral1,
_MainGeneralEnd = MainGeneral8,
_MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1)
} EquipmentSlots;
}
namespace consts {
static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount;
static const uint16 MAP_BANK_SIZE = 16;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 0; //?
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = slots::_MainCount;
static const uint16 MAP_BAZAAR_SIZE = 80;
static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = NOT_USED;
static const uint16 MAP_OTHER_SIZE = 0;
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
static const int16 EQUIPMENT_END = slots::MainAmmo;
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
static const int16 GENERAL_BEGIN = slots::MainGeneral1;
static const int16 GENERAL_END = slots::MainGeneral8;
static const uint16 GENERAL_SIZE = slots::_MainGeneralCount;
static const int16 GENERAL_BAGS_BEGIN = 251;
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 = slots::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;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2015;
static const int16 BANK_BAGS_BEGIN = 2031;
static const int16 BANK_BAGS_END_OFFSET = 159;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 CORPSE_BEGIN = slots::MainGeneral1;
static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor;
static const uint16 ITEM_COMMON_SIZE = 5;
static const uint16 ITEM_CONTAINER_SIZE = 10;
static const uint32 BANDOLIERS_COUNT = 4; // count = number of bandolier instances
static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance
static const uint32 POTION_BELT_SIZE = 4;
}
namespace limits {
static const bool ALLOWS_EMPTY_BAG_IN_BAG = false;
static const bool COIN_HAS_WEIGHT = true;
}
}; //end namespace Titanium
#endif /*Titanium_CONSTANTS_H_*/
/*
Titanium Notes:
** Integer-based inventory **
ok Possessions: 0 - 30 (Corpse: 22 - 52 [Offset 22])
ok [Equipment: 0 - 21]
ok [General: 22 - 29]
ok [Cursor: 30]
ok General Bags: 251 - 330
ok Cursor Bags: 331 - 340
ok Bank: 2000 - 2015
ok Bank Bags: 2031 - 2190
ok Shared Bank: 2500 - 2501
ok Shared Bank Bags: 2531 - 2550
Trade: 3000 - 3007
(Trade Bags: 3031 - 3110 -- server values)
World: 4000 - 4009
*/

View File

@ -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();

View File

@ -0,0 +1,212 @@
/*
EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef Underfoot_CONSTANTS_H_
#define Underfoot_CONSTANTS_H_
#include "../common/types.h"
namespace Underfoot {
namespace maps {
typedef enum : int16 {
// this needs work to match actual client equivilents
MapPossessions = 0,
MapBank,
MapSharedBank,
MapTrade,
MapWorld,
MapLimbo,
MapTribute,
MapTrophyTribute,
MapGuildTribute,
MapMerchant,
MapDeleted,
MapCorpse,
MapBazaar,
MapInspect,
MapRealEstate,
MapViewMODPC,
MapViewMODBank,
MapViewMODSharedBank,
MapViewMODLimbo,
MapAltStorage,
MapArchived,
MapMail,
MapGuildTrophyTribute,
MapOther,
_MapCount
} InventoryMaps;
}
namespace slots {
typedef enum : int16 {
MainCharm = 0,
MainEar1,
MainHead,
MainFace,
MainEar2,
MainNeck,
MainShoulders,
MainArms,
MainBack,
MainWrist1,
MainWrist2,
MainRange,
MainHands,
MainPrimary,
MainSecondary,
MainFinger1,
MainFinger2,
MainChest,
MainLegs,
MainFeet,
MainWaist,
MainPowerSource,
MainAmmo,
MainGeneral1,
MainGeneral2,
MainGeneral3,
MainGeneral4,
MainGeneral5,
MainGeneral6,
MainGeneral7,
MainGeneral8,
MainCursor,
_MainCount,
_MainEquipmentBegin = MainCharm,
_MainEquipmentEnd = MainAmmo,
_MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1),
_MainGeneralBegin = MainGeneral1,
_MainGeneralEnd = MainGeneral8,
_MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1)
} EquipmentSlots;
}
namespace consts {
static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount;
static const uint16 MAP_BANK_SIZE = 24;
static const uint16 MAP_SHARED_BANK_SIZE = 2;
static const uint16 MAP_TRADE_SIZE = 8;
static const uint16 MAP_WORLD_SIZE = 10;
static const uint16 MAP_LIMBO_SIZE = 36;
static const uint16 MAP_TRIBUTE_SIZE = 0; //?
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
static const uint16 MAP_MERCHANT_SIZE = 0;
static const uint16 MAP_DELETED_SIZE = 0;
static const uint16 MAP_CORPSE_SIZE = slots::_MainCount;
static const uint16 MAP_BAZAAR_SIZE = 80;
static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount;
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE;
static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE;
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE;
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
static const uint16 MAP_ARCHIVED_SIZE = 0;
static const uint16 MAP_MAIL_SIZE = 0;
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 MAP_KRONO_SIZE = NOT_USED;
static const uint16 MAP_OTHER_SIZE = 0;
static const int16 EQUIPMENT_BEGIN = slots::MainCharm;
static const int16 EQUIPMENT_END = slots::MainAmmo;
static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount;
static const int16 GENERAL_BEGIN = slots::MainGeneral1;
static const int16 GENERAL_END = slots::MainGeneral8;
static const uint16 GENERAL_SIZE = slots::_MainGeneralCount;
static const int16 GENERAL_BAGS_BEGIN = 262;
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 = slots::MainCursor;
static const int16 CURSOR_BAG_BEGIN = 342;
static const int16 CURSOR_BAG_END_OFFSET = 9;
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2023;
static const int16 BANK_BAGS_BEGIN = 2032;
static const int16 BANK_BAGS_END_OFFSET = 239;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2532;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
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;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 CORPSE_BEGIN = slots::MainGeneral1;
static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor;
static const uint16 ITEM_COMMON_SIZE = 5;
static const uint16 ITEM_CONTAINER_SIZE = 10;
static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances
static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance
static const uint32 POTION_BELT_SIZE = 5;
}
namespace limits {
static const bool ALLOWS_EMPTY_BAG_IN_BAG = false;
static const bool COIN_HAS_WEIGHT = false;
}
}; //end namespace Underfoot
#endif /*Underfoot_CONSTANTS_H_*/
/*
Underfoot Notes:
** Integer-based inventory **
ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23])
ok [Equipment: 0 - 22]
ok [General: 23 - 30]
ok [Cursor: 31]
ok General Bags: 262 - 341
ok Cursor Bags: 342 - 351
ok Bank: 2000 - 2023
ok Bank Bags: 2032 - 2271
ok Shared Bank: 2500 - 2501
ok Shared Bank Bags: 2532 - 2551
Trade: 3000 - 3007
(Trade Bags: 3031 - 3110 -- server values)
World: 4000 - 4009
*/

View File

@ -5,7 +5,7 @@ if [ -z "$1" ]; then
exit 1
fi
for ext in .cpp .h _ops.h _structs.h
for ext in .cpp .h _ops.h _constants.h _structs.h
do
cp template$ext $1$ext
perl -pi -e "s/TEMPLATE/$1/g" $1$ext

View File

@ -8,6 +8,7 @@
#include "SoF.h"
#include "SoD.h"
#include "RoF.h"
//#include "RoF2.h"
void RegisterAllPatches(EQStreamIdentifier &into) {
Client62::Register(into);
@ -16,6 +17,7 @@ void RegisterAllPatches(EQStreamIdentifier &into) {
SoD::Register(into);
Underfoot::Register(into);
RoF::Register(into);
//RoF2::Register(into);
}
void ReloadAllPatches() {
@ -25,4 +27,5 @@ void ReloadAllPatches() {
SoD::Reload();
Underfoot::Reload();
RoF::Reload();
//RoF2::Reload();
}

View File

@ -0,0 +1,20 @@
#ifndef TEMPLATE_CONSTANTS_H_
#define TEMPLATE_CONSTANTS_H_
namespace TEMPLATE {
// put constants here and #include appropriately
}; //end namespace TEMPLATE
#endif /*TEMPLATE_CONSTANTS_H_*/

View File

@ -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]);
}
@ -1710,6 +1720,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
sp[tempid].descnum = atoi(row[155]);
sp[tempid].effectdescnum = atoi(row[157]);
sp[tempid].npc_no_los = atoi(row[159]) != 0;
sp[tempid].reflectable = atoi(row[161]) != 0;
sp[tempid].bonushate=atoi(row[162]);
@ -1740,6 +1751,8 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
sp[tempid].AllowRest = atoi(row[212]) != 0;
sp[tempid].NotOutofCombat = atoi(row[213]) != 0;
sp[tempid].NotInCombat = atoi(row[214]) != 0;
sp[tempid].aemaxtargets = atoi(row[218]);
sp[tempid].maxtargets = atoi(row[219]);
sp[tempid].persistdeath = atoi(row[224]) != 0;
sp[tempid].DamageShieldType = 0;
}

View File

@ -690,7 +690,7 @@ struct SPDat_Spell_Struct
/* 156 */ //int typedescnum; // eqstr of type description
/* 157 */ int effectdescnum; // eqstr of effect description
/* 158 */ //Category Desc ID 3
/* 159 */ //bool npc_no_los;
/* 159 */ bool npc_no_los;
/* 161 */ bool reflectable;
/* 162 */ int bonushate;
/* 163 */
@ -732,8 +732,9 @@ struct SPDat_Spell_Struct
/* 212 */ bool AllowRest;
/* 213 */ bool NotOutofCombat; //Fail if cast out of combat
/* 214 */ bool NotInCombat; //Fail if cast in combat
/* 215 - 218 */
/* 219 */ //int maxtargets; // is used for beam and ring spells for target # limits (not implemented)
/* 215 - 217 */
/* 219 */ int aemaxtargets; //
/* 219 */ int maxtargets; // is used for beam and ring spells for target # limits (not implemented)
/* 220 - 223 */
/* 224 */ bool persistdeath; // buff doesn't get stripped on death
/* 225 - 236 */ // Not in DB

View File

@ -912,7 +912,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration)
//gear stuff, need to make sure there's
//no situation where this stuff can be duped
for(int x = 0; x < 21; x++)
for(int x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::EQUIPMENT_END; x++) // (< 21) added MainAmmo
{
uint32 sitem = 0;
sitem = CorpseToUse->GetWornItem(x);
@ -1318,6 +1318,8 @@ void Client::SendAA(uint32 id, int seq) {
//Prevent removal of previous AA from window if next AA belongs to a higher client version.
SendAA_Struct* saa_next = nullptr;
saa_next = zone->FindAA(saa->sof_next_id);
// hard-coding values like this is dangerous and makes adding/updating clients a nightmare...
if (saa_next &&
(((GetClientVersionBit() == 4) && (saa_next->clientver > 4))
|| ((GetClientVersionBit() == 8) && (saa_next->clientver > 5))
@ -1895,7 +1897,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id)
row = mysql_fetch_row(result);
//ATOI IS NOT UNISGNED LONG-SAFE!!!
//ATOI IS NOT UNSIGNED LONG-SAFE!!!
sendaa->cost = atoul(row[0]);
sendaa->cost2 = sendaa->cost;

View File

@ -824,17 +824,17 @@ void Client::AI_Process()
if(GetTarget() && !IsStunned() && !IsMezzed() && !GetFeigned()) {
if(attack_timer.Check()) {
Attack(GetTarget(), 13);
Attack(GetTarget(), MainPrimary);
if(GetTarget()) {
if(CheckDoubleAttack()) {
Attack(GetTarget(), 13);
Attack(GetTarget(), MainPrimary);
if(GetTarget()) {
bool triple_attack_success = false;
if((((GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER)
&& GetLevel() >= 60) || GetSpecialAbility(SPECATK_TRIPLE))
&& CheckDoubleAttack(true))
{
Attack(GetTarget(), 13, true);
Attack(GetTarget(), MainPrimary, true);
triple_attack_success = true;
}
@ -848,8 +848,8 @@ void Client::AI_Process()
if(MakeRandomInt(0, 100) < flurrychance)
{
Message_StringID(MT_NPCFlurry, YOU_FLURRY);
Attack(GetTarget(), 13, false);
Attack(GetTarget(), 13, false);
Attack(GetTarget(), MainPrimary, false);
Attack(GetTarget(), MainPrimary, false);
}
}
@ -864,7 +864,7 @@ void Client::AI_Process()
{
if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus)
{
Attack(GetTarget(), 13, false);
Attack(GetTarget(), MainPrimary, false);
}
}
}
@ -903,10 +903,10 @@ void Client::AI_Process()
if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability)
{
Attack(GetTarget(), 14);
Attack(GetTarget(), MainSecondary);
if(CheckDoubleAttack())
{
Attack(GetTarget(), 14);
Attack(GetTarget(), MainSecondary);
}
}
@ -1145,14 +1145,14 @@ void Mob::AI_Process() {
if(IsNPC()) {
int16 n_atk = CastToNPC()->GetNumberOfAttacks();
if(n_atk <= 1) {
Attack(target, 13);
Attack(target, MainPrimary);
} else {
for(int i = 0; i < n_atk; ++i) {
Attack(target, 13);
Attack(target, MainPrimary);
}
}
} else {
Attack(target, 13);
Attack(target, MainPrimary);
}
if (target) {
@ -1164,16 +1164,16 @@ void Mob::AI_Process() {
|| GetSpecialAbility(SPECATK_QUAD))
//check double attack, this is NOT the same rules that clients use...
&& RandRoll < (GetLevel() + NPCDualAttackModifier)) {
Attack(target, 13);
Attack(target, MainPrimary);
// lets see if we can do a triple attack with the main hand
//pets are excluded from triple and quads...
if ((GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD))
&& !IsPet() && RandRoll < (GetLevel() + NPCTripleAttackModifier)) {
Attack(target, 13);
Attack(target, MainPrimary);
// now lets check the quad attack
if (GetSpecialAbility(SPECATK_QUAD)
&& RandRoll < (GetLevel() + NPCQuadAttackModifier)) {
Attack(target, 13);
Attack(target, MainPrimary);
}
}
}
@ -1319,13 +1319,13 @@ void Mob::AI_Process() {
float DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel()) / 400.0f;
if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability)
{
Attack(target, 14);
Attack(target, MainSecondary);
if (CanThisClassDoubleAttack())
{
int32 RandRoll = MakeRandomInt(0, 99);
if (RandRoll < (GetLevel() + 20))
{
Attack(target, 14);
Attack(target, MainSecondary);
}
}
}
@ -2024,7 +2024,7 @@ bool Mob::Flurry(ExtraAttackOptions *opts)
int num_attacks = GetSpecialAbilityParam(SPECATK_FLURRY, 1);
num_attacks = num_attacks > 0 ? num_attacks : RuleI(Combat, MaxFlurryHits);
for (int i = 0; i < num_attacks; i++)
Attack(target, 13, false, false, false, opts);
Attack(target, MainPrimary, false, false, false, opts);
}
return true;
}
@ -2073,14 +2073,14 @@ bool Mob::Rampage(ExtraAttackOptions *opts)
if (m_target == GetTarget())
continue;
if (CombatRange(m_target)) {
Attack(m_target, 13, false, false, false, opts);
Attack(m_target, MainPrimary, false, false, false, opts);
index_hit++;
}
}
}
if (RuleB(Combat, RampageHitsTarget) && index_hit < rampage_targets)
Attack(GetTarget(), 13, false, false, false, opts);
Attack(GetTarget(), MainPrimary, false, false, false, opts);
return true;
}
@ -2099,7 +2099,7 @@ void Mob::AreaRampage(ExtraAttackOptions *opts)
index_hit = hate_list.AreaRampage(this, GetTarget(), rampage_targets, opts);
if(index_hit == 0) {
Attack(GetTarget(), 13, false, false, false, opts);
Attack(GetTarget(), MainPrimary, false, false, false, opts);
}
}

View File

@ -349,7 +349,7 @@ void Object::Close() {
ItemInst* container = this->m_inst;
if(container != nullptr)
{
for (uint8 i = 0; i < MAX_ITEMS_PER_BAG; i++)
for (uint8 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++)
{
ItemInst* inst = container->PopItem(i);
if(inst != nullptr)
@ -544,7 +544,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
EQApplicationPacket* outapp=new EQApplicationPacket(OP_ClientReady,0);
sender->QueuePacket(outapp);
safe_delete(outapp);
for (uint8 i=0; i<10; i++) {
for (uint8 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) {
const ItemInst* inst = m_inst->GetItem(i);
if (inst) {
//sender->GetInv().PutItem(i+4000,inst);

View File

@ -454,9 +454,9 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
if(damage > 0 && (aabonuses.TwoHandBluntBlock || spellbonuses.TwoHandBluntBlock || itembonuses.TwoHandBluntBlock)
&& (other->InFrontMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) {
bool equiped2 = CastToClient()->m_inv.GetItem(13);
bool equiped2 = CastToClient()->m_inv.GetItem(MainPrimary);
if(equiped2) {
uint8 TwoHandBlunt = CastToClient()->m_inv.GetItem(13)->GetItem()->ItemType;
uint8 TwoHandBlunt = CastToClient()->m_inv.GetItem(MainPrimary)->GetItem()->ItemType;
float bonusStaffBlock = 0.0f;
if(TwoHandBlunt == ItemType2HBlunt) {
@ -1248,7 +1248,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
if( Hand == MainPrimary && GetLevel() >= 28 && IsWarriorClass() )
{
// Damage bonuses apply only to hits from the main hand (Hand == 13) by characters level 28 and above
// Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above
// who belong to a melee class. If we're here, then all of these conditions apply.
ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const Item_Struct*) nullptr );
@ -2629,7 +2629,7 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
// Assert: This function should only be called for hits by the mainhand, as damage bonuses apply only to the
// weapon in the primary slot. Be sure to check that Hand == 13 before calling.
// weapon in the primary slot. Be sure to check that Hand == MainPrimary before calling.
// Assert: The caller should ensure that Weapon is actually a weapon before calling this function.
// The ItemInst::IsWeapon() method can be used to quickly determine this.
@ -3906,7 +3906,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) {
float ProcChance, ProcBonus;
on->GetDefensiveProcChances(ProcBonus, ProcChance, hand , this);
if(hand != 13)
if(hand != MainPrimary)
ProcChance /= 2;
if (bDefensiveProc){
@ -3965,7 +3965,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on
ProcBonus += static_cast<float>(itembonuses.ProcChance) / 10.0f; // Combat Effects
float ProcChance = GetProcChances(ProcBonus, hand);
if (hand != 13) //Is Archery intened to proc at 50% rate?
if (hand != MainPrimary) //Is Archery intened to proc at 50% rate?
ProcChance /= 2;
// Try innate proc on weapon
@ -4055,7 +4055,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on,
rangedattk = true;
}
if (!weapon && hand == 11 && GetSpecialAbility(SPECATK_RANGED_ATK))
if (!weapon && hand == MainRange && GetSpecialAbility(SPECATK_RANGED_ATK))
rangedattk = true;
for (uint32 i = 0; i < MAX_PROCS; i++) {
@ -4632,7 +4632,7 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) {
ProcChance = static_cast<float>(weapon_speed) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f);
if (hand != 13)
if (hand != MainPrimary)
ProcChance /= 2;
}

View File

@ -33,7 +33,7 @@ public:
//abstract virtual function implementations requird by base abstract class
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; }
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
ExtraAttackOptions *opts = nullptr) { return false; }
virtual bool HasRaid() { return false; }
virtual bool HasGroup() { return false; }

View File

@ -159,8 +159,8 @@ void Client::CalcItemBonuses(StatBonuses* newbon) {
}
//tribute items
for (i = 0; i < MAX_PLAYER_TRIBUTES; i++) {
const ItemInst* inst = m_inv[TRIBUTE_SLOT_START + i];
for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++) {
const ItemInst* inst = m_inv[EmuConstants::TRIBUTE_BEGIN + i];
if(inst == 0)
continue;
AddItemBonuses(inst, newbon, false, true);
@ -544,7 +544,7 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) {
bool food = false;
bool drink = false;
for (i = 22; i <= 29; i++)
for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_BAGS_BEGIN; i++)
{
if (food && drink)
break;
@ -560,7 +560,7 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) {
AddItemBonuses(inst, newbon);
}
}
for (i = 251; i <= 330; i++)
for (i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::GENERAL_BAGS_END; i++)
{
if (food && drink)
break;
@ -3049,26 +3049,28 @@ void NPC::CalcItemBonuses(StatBonuses *newbon)
}
}
void Client::CalcItemScale()
{
void Client::CalcItemScale() {
bool changed = false;
if(CalcItemScale(0, 21))
// MainAmmo excluded in helper function below
if(CalcItemScale(EmuConstants::EQUIPMENT_BEGIN, EmuConstants::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21)
changed = true;
if(CalcItemScale(22, 30))
if(CalcItemScale(EmuConstants::GENERAL_BEGIN, EmuConstants::GENERAL_END)) // original coding excluded MainCursor (< 30)
changed = true;
if(CalcItemScale(251, 341))
// I excluded cursor bag slots here because cursor was excluded above..if this is incorrect, change 'slot_y' here to CURSOR_BAG_END
// and 'slot_y' above to CURSOR from GENERAL_END above - or however it is supposed to be...
if(CalcItemScale(EmuConstants::GENERAL_BAGS_BEGIN, EmuConstants::GENERAL_BAGS_END)) // (< 341)
changed = true;
if(CalcItemScale(400, 405))
if(CalcItemScale(EmuConstants::TRIBUTE_BEGIN, EmuConstants::TRIBUTE_END)) // (< 405)
changed = true;
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
{
if(CalcItemScale(9999, 10000))
if(CalcItemScale(MainPowerSource, MainPowerSource))
changed = true;
}
@ -3078,15 +3080,27 @@ void Client::CalcItemScale()
}
}
bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
{
bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) {
// behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1
bool changed = false;
int i;
for (i = slot_x; i < slot_y; i++) {
ItemInst* inst = m_inv.GetItem(i);
if(inst == 0)
for (i = slot_x; i <= slot_y; i++) {
if (i == MainAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot
continue;
ItemInst* inst = m_inv.GetItem(i);
if(inst == nullptr)
continue;
// TEST CODE: test for bazaar trader crashing with charm items
if (Trader)
if (i >= EmuConstants::GENERAL_BAGS_BEGIN && i <= EmuConstants::GENERAL_BAGS_END) {
ItemInst* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i));
if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel
continue;
}
bool update_slot = false;
if(inst->IsScaling())
{
@ -3101,7 +3115,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
}
//iterate all augments
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst * a_inst = inst->GetAugment(x);
if(!a_inst)
@ -3132,22 +3146,25 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
void Client::DoItemEnterZone() {
bool changed = false;
if(DoItemEnterZone(0, 21))
// MainAmmo excluded in helper function below
if(DoItemEnterZone(EmuConstants::EQUIPMENT_BEGIN, EmuConstants::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21)
changed = true;
if(DoItemEnterZone(22, 30))
if(DoItemEnterZone(EmuConstants::GENERAL_BEGIN, EmuConstants::GENERAL_END)) // original coding excluded MainCursor (< 30)
changed = true;
if(DoItemEnterZone(251, 341))
// I excluded cursor bag slots here because cursor was excluded above..if this is incorrect, change 'slot_y' here to CURSOR_BAG_END
// and 'slot_y' above to CURSOR from GENERAL_END above - or however it is supposed to be...
if(DoItemEnterZone(EmuConstants::GENERAL_BAGS_BEGIN, EmuConstants::GENERAL_BAGS_END)) // (< 341)
changed = true;
if(DoItemEnterZone(400, 405))
if(DoItemEnterZone(EmuConstants::TRIBUTE_BEGIN, EmuConstants::TRIBUTE_END)) // (< 405)
changed = true;
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
{
if(DoItemEnterZone(9999, 10000))
if(DoItemEnterZone(MainPowerSource, MainPowerSource))
changed = true;
}
@ -3158,12 +3175,25 @@ void Client::DoItemEnterZone() {
}
bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
// behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1
bool changed = false;
for(int i = slot_x; i < slot_y; i++) {
for(int i = slot_x; i <= slot_y; i++) {
if (i == MainAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot
continue;
ItemInst* inst = m_inv.GetItem(i);
if(!inst)
continue;
// TEST CODE: test for bazaar trader crashing with charm items
if (Trader)
if (i >= EmuConstants::GENERAL_BAGS_BEGIN && i <= EmuConstants::GENERAL_BAGS_END) {
ItemInst* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i));
if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel
continue;
}
bool update_slot = false;
if(inst->IsScaling())
{
@ -3188,7 +3218,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
}
//iterate all augments
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst *a_inst = inst->GetAugment(x);
if(!a_inst)

View File

@ -475,7 +475,7 @@ void Bot::GenerateBaseStats() {
int16 CorruptionResist = _baseCorrup;
switch(this->GetClass()) {
case 1: // Warrior
case 1: // Warrior (why not just use 'case WARRIOR:'?)
Strength += 10;
Stamina += 20;
Agility += 10;
@ -3304,7 +3304,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes
int damage = 0;
uint32 hate = 0;
int Hand = 13;
int Hand = MainPrimary;
if (hate == 0 && weapon_damage > 1) hate = weapon_damage;
if(weapon_damage > 0){
@ -3427,7 +3427,7 @@ void Bot::ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg)
break;
}
if (item_slot >= 0){
if (item_slot >= EmuConstants::EQUIPMENT_BEGIN){
const ItemInst* inst = GetBotItem(item_slot);
const Item_Struct* botweapon = 0;
if(inst)
@ -4103,7 +4103,7 @@ void Bot::PetAIProcess() {
int32 RandRoll = MakeRandomInt(0, 99);
if (botPet->CanThisClassDoubleAttack() && (RandRoll < (botPet->GetLevel() + NPCDualAttackModifier)))
{
if(botPet->Attack(botPet->GetTarget(), 13))
if(botPet->Attack(botPet->GetTarget(), MainPrimary))
{}
}
}
@ -4145,13 +4145,13 @@ void Bot::PetAIProcess() {
float DualWieldProbability = (botPet->GetSkill(SkillDualWield) + botPet->GetLevel()) / 400.0f;
DualWieldProbability -= MakeRandomFloat(0, 1);
if(DualWieldProbability < 0){
botPet->Attack(botPet->GetTarget(), 14);
botPet->Attack(botPet->GetTarget(), MainSecondary);
if (botPet->CanThisClassDoubleAttack())
{
int32 RandRoll = MakeRandomInt(0, 99);
if (RandRoll < (botPet->GetLevel() + 20))
{
botPet->Attack(botPet->GetTarget(), 14);
botPet->Attack(botPet->GetTarget(), MainSecondary);
}
}
}
@ -4332,7 +4332,7 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
/* // fillspawnstruct now properly handles this -U
uint32 itemID = 0;
uint8 materialFromSlot = 0xFF;
for(int i=0; i<22; ++i) {
for(int i=EmuConstants::EQUIPMENT_BEGIN; i<=EmuConstants::EQUIPMENT_END; ++i) {
itemID = GetBotItemBySlot(i);
if(itemID != 0) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i);
@ -4348,11 +4348,11 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
void Bot::SetBotItemInSlot(uint32 slotID, uint32 itemID, const ItemInst* inst, std::string *errorMessage) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
uint32 augslot[5] = { 0, 0, 0, 0, 0 };
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
if(this->GetBotID() > 0 && slotID >= 0 && itemID > 0) {
if (this->GetBotID() > 0 && slotID >= EmuConstants::EQUIPMENT_BEGIN && itemID > NO_ITEM) {
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;
}
@ -4401,7 +4401,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) {
uint32 item_id = atoi(DataRow[1]);
uint16 charges = atoi(DataRow[2]);
uint32 color = atoul(DataRow[3]);
uint32 aug[5];
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoul(DataRow[4]);
aug[1] = (uint32)atoul(DataRow[5]);
aug[2] = (uint32)atoul(DataRow[6]);
@ -4412,7 +4412,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) {
ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]);
if(inst) {
int16 put_slot_id = INVALID_INDEX;
if(instnodrop || ((slot_id >= 0) && (slot_id <= 21) && inst->GetItem()->Attuneable))
if(instnodrop || ((slot_id >= EmuConstants::EQUIPMENT_BEGIN) && (slot_id <= EmuConstants::EQUIPMENT_END) && inst->GetItem()->Attuneable))
inst->SetInstNoDrop(true);
if(color > 0)
inst->SetColor(color);
@ -4454,7 +4454,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) {
uint32 Bot::GetBotItemBySlot(uint32 slotID) {
uint32 Result = 0;
if(this->GetBotID() > 0 && slotID >= 0) {
if(this->GetBotID() > 0 && slotID >= EmuConstants::EQUIPMENT_BEGIN) {
char* query = 0;
MYSQL_RES* DatasetResult;
MYSQL_ROW DataRow;
@ -5298,7 +5298,7 @@ void Bot::LevelBotWithClient(Client* client, uint8 level, bool sendlvlapp) {
Bot* bot = *biter;
if(bot && (bot->GetLevel() != client->GetLevel())) {
bot->SetPetChooser(false); // not sure what this does, but was in bot 'update' code
bot->CalcBotStats(false);
bot->CalcBotStats(false); // TODO: look at this and see if 'true' should be passed...
if(sendlvlapp)
bot->SendLevelAppearance();
// modified from Client::SetLevel()
@ -5456,7 +5456,7 @@ void Bot::BotAddEquipItem(int slot, uint32 id) {
if(slot > 0 && id > 0) {
uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot);
if(materialFromSlot != 0xFF) {
if(materialFromSlot != _MaterialInvalid) {
equipment[slot] = id; // npc has more than just material slots. Valid material should mean valid inventory index
SendWearChange(materialFromSlot);
}
@ -5468,7 +5468,7 @@ void Bot::BotRemoveEquipItem(int slot) {
if(slot > 0) {
uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot);
if(materialFromSlot != 0xFF) {
if(materialFromSlot != _MaterialInvalid) {
equipment[slot] = 0; // npc has more than just material slots. Valid material should mean valid inventory index
SendWearChange(materialFromSlot);
if(materialFromSlot == MaterialChest)
@ -6006,8 +6006,8 @@ void Bot::FinishTrade(Client* client, BotTradeType tradeType) {
if(client && !client->GetTradeskillObject() && (client->trade->state != Trading)) {
if(tradeType == BotTradeClientNormal) {
// Items being traded are found in the normal trade window used to trade between a Client and a Client or NPC
// Items in this mode are found in slot ids 3000 thru 3003
PerformTradeWithClient(3000, 3007, client);
// Items in this mode are found in slot ids 3000 thru 3003 - thought bots used the full 8-slot window..?
PerformTradeWithClient(EmuConstants::TRADE_BEGIN, EmuConstants::TRADE_END, client); // {3000..3007}
}
else if(tradeType == BotTradeClientNoDropNoTrade) {
// Items being traded are found on the Client's cursor slot, slot id 30. This item can be either a single item or it can be a bag.
@ -6024,7 +6024,7 @@ void Bot::FinishTrade(Client* client, BotTradeType tradeType) {
void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* client) {
if(client) {
// TODO: Figure out what the actual max slot id is
const int MAX_SLOT_ID = 3179;
const int MAX_SLOT_ID = EmuConstants::TRADE_BAGS_END; // was the old incorrect 3179..
uint32 items[MAX_SLOT_ID] = {0};
uint8 charges[MAX_SLOT_ID] = {0};
bool botCanWear[MAX_SLOT_ID] = {0};
@ -6049,7 +6049,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
std::string TempErrorMessage;
const Item_Struct* mWeaponItem = inst->GetItem();
bool failedLoreCheck = false;
for (int m = 0; m<EmuConstants::ITEM_COMMON_SIZE; ++m) {
for (int m = AUG_BEGIN; m <EmuConstants::ITEM_COMMON_SIZE; ++m) {
ItemInst *itm = inst->GetAugment(m);
if(itm)
{
@ -6069,12 +6069,12 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
botCanWear[i] = BotCanWear;
ItemInst* swap_item = nullptr;
const char* equipped[22] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back",
const char* equipped[EmuConstants::EQUIPMENT_SIZE] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back",
"Left Wrist", "Right Wrist", "Range", "Hands", "Primary Hand", "Secondary Hand",
"Left Finger", "Right Finger", "Chest", "Legs", "Feet", "Waist", "Ammo" };
bool success = false;
int how_many_slots = 0;
for(int j=0; j<22; ++j) {
for(int j = EmuConstants::EQUIPMENT_BEGIN; j <= EmuConstants::EQUIPMENT_END; ++j) {
if((mWeaponItem->Slots & (1 << j))) {
how_many_slots++;
if(!GetBotItem(j)) {
@ -6132,11 +6132,11 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
}
}
if(!success) {
for(int j=0; j<22; ++j) {
for(int j = EmuConstants::EQUIPMENT_BEGIN; j <= EmuConstants::EQUIPMENT_END; ++j) {
if((mWeaponItem->Slots & (1 << j))) {
swap_item = GetBotItem(j);
failedLoreCheck = false;
for (int k = 0; k<EmuConstants::ITEM_COMMON_SIZE; ++k) {
for (int k = AUG_BEGIN; k < EmuConstants::ITEM_COMMON_SIZE; ++k) {
ItemInst *itm = swap_item->GetAugment(k);
if(itm)
{
@ -6518,7 +6518,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
if( Hand == MainPrimary && GetLevel() >= 28 && IsWarriorClass() )
{
// Damage bonuses apply only to hits from the main hand (Hand == 13) by characters level 28 and above
// Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above
// who belong to a melee class. If we're here, then all of these conditions apply.
ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const Item_Struct*) nullptr );
@ -7129,7 +7129,7 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
int16 focus_max_real = 0;
//item focus
for(int x=0; x<=21; x++)
for(int x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::EQUIPMENT_END; x++)
{
TempItem = nullptr;
ItemInst* ins = GetBotItem(x);
@ -7163,7 +7163,7 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
}
}
for (int y = 0; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
for (int y = AUG_BEGIN; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
{
ItemInst *aug = nullptr;
aug = ins->GetAugment(y);
@ -8195,7 +8195,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) {
}
}
else { //We do a single regular attack if we attack from the front without chaotic stab
Attack(other, 13);
Attack(other, MainPrimary);
}
}
@ -8213,7 +8213,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime)
if(botweaponInst) {
primaryweapondamage = GetWeaponDamage(other, botweaponInst);
backstab_dmg = botweaponInst->GetItem()->BackstabDmg;
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; ++i)
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; ++i)
{
ItemInst *aug = botweaponInst->GetAugment(i);
if(aug)
@ -8770,7 +8770,7 @@ void Bot::EquipBot(std::string* errorMessage) {
const ItemInst* inst = 0;
const Item_Struct* item = 0;
for(int i=0; i<=21; ++i) {
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
inst = GetBotItem(i);
if(inst) {
item = inst->GetItem();
@ -11260,7 +11260,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) {
// Modded to display power source items (will only show up on SoF+ client inspect windows though.)
// I don't think bots are currently coded to use them..but, you'll have to use '#bot inventory list'
// to see them on a Titanium client when/if they are activated. -U
for(int16 L = 0; L <= 20; L++) {
for(int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) {
inst = inspectedBot->GetBotItem(L);
if(inst) {
@ -11274,28 +11274,28 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) {
}
}
inst = inspectedBot->GetBotItem(9999);
inst = inspectedBot->GetBotItem(MainPowerSource);
if(inst) {
item = inst->GetItem();
if(item) {
strcpy(insr->itemnames[21], item->Name);
insr->itemicons[21] = item->Icon;
strcpy(insr->itemnames[SoF::slots::MainPowerSource], item->Name);
insr->itemicons[SoF::slots::MainPowerSource] = item->Icon;
}
else
insr->itemicons[21] = 0xFFFFFFFF;
insr->itemicons[SoF::slots::MainPowerSource] = 0xFFFFFFFF;
}
inst = inspectedBot->GetBotItem(21);
inst = inspectedBot->GetBotItem(MainAmmo);
if(inst) {
item = inst->GetItem();
if(item) {
strcpy(insr->itemnames[22], item->Name);
insr->itemicons[22] = item->Icon;
strcpy(insr->itemnames[SoF::slots::MainAmmo], item->Name);
insr->itemicons[SoF::slots::MainAmmo] = item->Icon;
}
else
insr->itemicons[22] = 0xFFFFFFFF;
insr->itemicons[SoF::slots::MainAmmo] = 0xFFFFFFFF;
}
strcpy(insr->text, inspectedBot->GetInspectMessage().text);
@ -11309,10 +11309,10 @@ void Bot::CalcItemBonuses()
memset(&itembonuses, 0, sizeof(StatBonuses));
const Item_Struct* itemtmp = 0;
for(int i=0; i<=21; ++i) {
for (int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
const ItemInst* item = GetBotItem(i);
if(item) {
for(int j=0; j<=4; ++j) {
for(int j = AUG_BEGIN; j < EmuConstants::ITEM_COMMON_SIZE; ++j) {
const ItemInst* aug = item->GetAugment(j);
if(aug) {
itemtmp = aug->GetItem();
@ -11739,7 +11739,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(!strcasecmp(sep->arg[1], "augmentitem")) {
AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)];
in_augment->container_slot = 1000;
in_augment->container_slot = 1000; // <watch>
in_augment->unknown02[0] = 0;
in_augment->unknown02[1] = 0;
in_augment->augment_slot = -1;
@ -12155,13 +12155,13 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
return;
}
const char* equipped[22] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back",
const char* equipped[EmuConstants::EQUIPMENT_SIZE] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back",
"Left Wrist", "Right Wrist", "Range", "Hands", "Primary Hand", "Secondary Hand",
"Left Finger", "Right Finger", "Chest", "Legs", "Feet", "Waist", "Ammo" };
const ItemInst* item1 = nullptr;
const Item_Struct* item2 = nullptr;
bool is2Hweapon = false;
for(int i=0; i<22; ++i)
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i)
{
if((i == MainSecondary) && is2Hweapon) {
continue;
@ -12282,11 +12282,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
return;
int slotId = atoi(sep->arg[3]);
if(slotId > 21 || slotId < 0) {
if(slotId > EmuConstants::EQUIPMENT_END || slotId < EmuConstants::EQUIPMENT_BEGIN) {
c->Message(15, "A bot has 21 slots in its inventory, please choose a slot between 0 and 21.");
return;
}
const char* equipped[22] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back",
const char* equipped[EmuConstants::EQUIPMENT_SIZE] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back",
"Left Wrist", "Right Wrist", "Range", "Hands", "Primary Hand", "Secondary Hand",
"Left Finger", "Right Finger", "Chest", "Legs", "Feet", "Waist", "Ammo" };
@ -12303,7 +12303,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
// Don't allow the player to remove a lore item they already possess and cause a crash
bool failedLoreCheck = false;
if(itminst) {
for (int m = 0; m<EmuConstants::ITEM_COMMON_SIZE; ++m) {
for (int m = AUG_BEGIN; m < EmuConstants::ITEM_COMMON_SIZE; ++m) {
ItemInst *itma = itminst->GetAugment(m);
if(itma)
{
@ -12333,30 +12333,31 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
gearbot->BotRemoveEquipItem(slotId);
gearbot->CalcBotStats();
switch(slotId) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 8:
case 9:
case 10:
case 11:
case 13:
case 14:
case 15:
case 16:
case 17:
case 20:
case 21:
case MainCharm:
case MainEar1:
case MainHead:
case MainFace:
case MainEar2:
case MainNeck:
case MainBack:
case MainWrist1:
case MainWrist2:
case MainRange:
case MainPrimary:
case MainSecondary:
case MainFinger1:
case MainFinger2:
case MainChest:
case MainWaist:
//case MainPowerSource:
case MainAmmo:
gearbot->Say("My %s is now unequipped.", equipped[slotId]);
break;
case 6:
case 7:
case 12:
case 18:
case 19:
case MainShoulders:
case MainArms:
case MainHands:
case MainLegs:
case MainFeet:
gearbot->Say("My %s are now unequipped.", equipped[slotId]);
break;
default:
@ -12365,30 +12366,31 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
else {
switch(slotId) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 8:
case 9:
case 10:
case 11:
case 13:
case 14:
case 15:
case 16:
case 17:
case 20:
case 21:
case MainCharm:
case MainEar1:
case MainHead:
case MainFace:
case MainEar2:
case MainNeck:
case MainBack:
case MainWrist1:
case MainWrist2:
case MainRange:
case MainPrimary:
case MainSecondary:
case MainFinger1:
case MainFinger2:
case MainChest:
case MainWaist:
//case MainPowerSource:
case MainAmmo:
c->GetTarget()->Say("My %s is already unequipped.", equipped[slotId]);
break;
case 6:
case 7:
case 12:
case 18:
case 19:
case MainShoulders:
case MainArms:
case MainHands:
case MainLegs:
case MainFeet:
c->GetTarget()->Say("My %s are already unequipped.", equipped[slotId]);
break;
default:
@ -14257,10 +14259,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Mob *target = c->GetTarget();
if(target && target->IsBot()) {
for(int i=0; i<9; i++) {
for(int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) {
c->Message(15,"Equiped slot: %i , item: %i \n", i, target->CastToBot()->GetEquipment(i));
}
if(target->CastToBot()->GetEquipment(8) > 0)
if(target->CastToBot()->GetEquipment(MaterialSecondary) > 0)
c->Message(15,"This bot has an item in off-hand.");
}
return;
@ -16510,7 +16512,7 @@ int Bot::GetRawACNoShield(int &shield_ac)
{
ac -= inst->GetItem()->AC;
shield_ac = inst->GetItem()->AC;
for (uint8 i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++)
for (uint8 i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++)
{
if(inst->GetAugment(i))
{
@ -16529,7 +16531,7 @@ uint32 Bot::CalcCurrentWeight() {
ItemInst* inst;
uint32 Total = 0;
for(int i=0; i<=21; ++i) {
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
inst = GetBotItem(i);
if(inst) {
TempItem = inst->GetItem();

View File

@ -137,7 +137,7 @@ public:
//abstract virtual function implementations requird by base abstract class
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
ExtraAttackOptions *opts = nullptr);
virtual bool HasRaid() { return (GetRaid() ? true : false); }
virtual bool HasGroup() { return (GetGroup() ? true : false); }

View File

@ -4141,14 +4141,14 @@ void Client::UpdateLFP() {
uint16 Client::GetPrimarySkillValue()
{
SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill
bool equiped = m_inv.GetItem(13);
bool equiped = m_inv.GetItem(MainPrimary);
if (!equiped)
skill = SkillHandtoHand;
else {
uint8 type = m_inv.GetItem(13)->GetItem()->ItemType; //is this the best way to do this?
uint8 type = m_inv.GetItem(MainPrimary)->GetItem()->ItemType; //is this the best way to do this?
switch (type)
{
@ -5333,7 +5333,7 @@ bool Client::TryReward(uint32 claim_id)
//save
uint32 free_slot = 0xFFFFFFFF;
for(int i = 22; i < 30; ++i)
for(int i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; ++i)
{
ItemInst *item = GetInv().GetItem(i);
if(!item)
@ -5702,7 +5702,7 @@ void Client::AddCrystals(uint32 Radiant, uint32 Ebon)
SendCrystalCounts();
}
// Processes a client request to inspect a SoF client's equipment.
// Processes a client request to inspect a SoF+ client's equipment.
void Client::ProcessInspectRequest(Client* requestee, Client* requester) {
if(requestee && requester) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_InspectAnswer, sizeof(InspectResponse_Struct));
@ -5727,28 +5727,30 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) {
}
}
inst = requestee->GetInv().GetItem(9999);
inst = requestee->GetInv().GetItem(MainPowerSource);
if(inst) {
item = inst->GetItem();
if(item) {
strcpy(insr->itemnames[21], item->Name);
insr->itemicons[21] = item->Icon;
// we shouldn't do this..but, that's the way it's coded atm...
// (this type of action should be handled exclusively in the client translator)
strcpy(insr->itemnames[SoF::slots::MainPowerSource], item->Name);
insr->itemicons[SoF::slots::MainPowerSource] = item->Icon;
}
else
insr->itemicons[21] = 0xFFFFFFFF;
insr->itemicons[SoF::slots::MainPowerSource] = 0xFFFFFFFF;
}
inst = requestee->GetInv().GetItem(21);
inst = requestee->GetInv().GetItem(MainAmmo);
if(inst) {
item = inst->GetItem();
if(item) {
strcpy(insr->itemnames[22], item->Name);
insr->itemicons[22] = item->Icon;
strcpy(insr->itemnames[SoF::slots::MainAmmo], item->Name);
insr->itemicons[SoF::slots::MainAmmo] = item->Icon;
}
else
insr->itemicons[22] = 0xFFFFFFFF;
insr->itemicons[SoF::slots::MainAmmo] = 0xFFFFFFFF;
}
strcpy(insr->text, requestee->GetInspectMessage().text);
@ -6277,8 +6279,8 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
made_npc->PR = GetPR();
made_npc->Corrup = GetCorrup();
// looks
made_npc->texture = GetEquipmentMaterial(1);
made_npc->helmtexture = GetEquipmentMaterial(0);
made_npc->texture = GetEquipmentMaterial(MaterialChest);
made_npc->helmtexture = GetEquipmentMaterial(MaterialHead);
made_npc->haircolor = GetHairColor();
made_npc->beardcolor = GetBeardColor();
made_npc->eyecolor1 = GetEyeColor1();
@ -6289,9 +6291,9 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
made_npc->drakkin_heritage = GetDrakkinHeritage();
made_npc->drakkin_tattoo = GetDrakkinTattoo();
made_npc->drakkin_details = GetDrakkinDetails();
made_npc->d_meele_texture1 = GetEquipmentMaterial(7);
made_npc->d_meele_texture2 = GetEquipmentMaterial(8);
for (int i = 0; i < _MaterialCount; i++) {
made_npc->d_meele_texture1 = GetEquipmentMaterial(MaterialPrimary);
made_npc->d_meele_texture2 = GetEquipmentMaterial(MaterialSecondary);
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) {
made_npc->armor_tint[i] = GetEquipmentColor(i);
}
made_npc->loottable_id = 0;
@ -7829,17 +7831,17 @@ void Client::TickItemCheck()
if(zone->tick_items.empty()) { return; }
//Scan equip slots for items
for(i = 0; i <= 21; i++)
for(i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++)
{
TryItemTick(i);
}
//Scan main inventory + cursor
for(i = 22; i < 31; i++)
for(i = EmuConstants::GENERAL_BEGIN; i <= MainCursor; i++)
{
TryItemTick(i);
}
//Scan bags
for(i = 251; i < 340; i++)
for(i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++)
{
TryItemTick(i);
}
@ -7855,7 +7857,7 @@ void Client::TryItemTick(int slot)
if(zone->tick_items.count(iid) > 0)
{
if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot < 22) )
if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EmuConstants::EQUIPMENT_END) )
{
ItemInst* e_inst = (ItemInst*)inst;
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
@ -7863,9 +7865,9 @@ void Client::TryItemTick(int slot)
}
//Only look at augs in main inventory
if(slot > 21) { return; }
if(slot > EmuConstants::EQUIPMENT_END) { return; }
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst * a_inst = inst->GetAugment(x);
if(!a_inst) { continue; }
@ -7886,17 +7888,17 @@ void Client::TryItemTick(int slot)
void Client::ItemTimerCheck()
{
int i;
for(i = 0; i <= 21; i++)
for(i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++)
{
TryItemTimer(i);
}
for(i = 22; i < 31; i++)
for(i = EmuConstants::GENERAL_BAGS_BEGIN; i <= MainCursor; i++)
{
TryItemTimer(i);
}
for(i = 251; i < 340; i++)
for(i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++)
{
TryItemTimer(i);
}
@ -7918,11 +7920,11 @@ void Client::TryItemTimer(int slot)
++it_iter;
}
if(slot > 21) {
if(slot > EmuConstants::EQUIPMENT_END) {
return;
}
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst * a_inst = inst->GetAugment(x);
if(!a_inst) {

View File

@ -214,7 +214,7 @@ public:
//abstract virtual function implementations requird by base abstract class
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
ExtraAttackOptions *opts = nullptr);
virtual bool HasRaid() { return (GetRaid() ? true : false); }
virtual bool HasGroup() { return (GetGroup() ? true : false); }
@ -1043,9 +1043,9 @@ public:
void MarkSingleCompassLoc(float in_x, float in_y, float in_z, uint8 count=1);
void CalcItemScale();
bool CalcItemScale(uint32 slot_x, uint32 slot_y);
bool CalcItemScale(uint32 slot_x, uint32 slot_y); // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1
void DoItemEnterZone();
bool DoItemEnterZone(uint32 slot_x, uint32 slot_y);
bool DoItemEnterZone(uint32 slot_x, uint32 slot_y); // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1
void SummonAndRezzAllCorpses();
void SummonAllCorpses(float dest_x, float dest_y, float dest_z, float dest_heading);
void DepopAllCorpses();

View File

@ -449,7 +449,8 @@ uint32 Client::GetClassHPFactor() {
int16 Client::GetRawItemAC() {
int16 Total = 0;
for (int16 slot_id=0; slot_id<21; slot_id++) {
// this skips MainAmmo..add an '=' conditional if that slot is required (original behavior)
for (int16 slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id < EmuConstants::EQUIPMENT_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if (inst && inst->IsType(ItemClassCommon)) {
Total += inst->GetItem()->AC;
@ -873,9 +874,9 @@ int16 Client::CalcAC() {
// Shield AC bonus for HeroicSTR
if(itembonuses.HeroicSTR) {
bool equiped = CastToClient()->m_inv.GetItem(14);
bool equiped = CastToClient()->m_inv.GetItem(MainSecondary);
if(equiped) {
uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
uint8 shield = CastToClient()->m_inv.GetItem(MainSecondary)->GetItem()->ItemType;
if(shield == ItemTypeShield)
displayed += itembonuses.HeroicSTR/2;
}
@ -903,9 +904,9 @@ int16 Client::GetACMit() {
// Shield AC bonus for HeroicSTR
if(itembonuses.HeroicSTR) {
bool equiped = CastToClient()->m_inv.GetItem(14);
bool equiped = CastToClient()->m_inv.GetItem(MainSecondary);
if(equiped) {
uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
uint8 shield = CastToClient()->m_inv.GetItem(MainSecondary)->GetItem()->ItemType;
if(shield == ItemTypeShield)
mitigation += itembonuses.HeroicSTR/2;
}
@ -1127,7 +1128,7 @@ uint32 Client::CalcCurrentWeight() {
ItemInst* ins;
uint32 Total = 0;
int x;
for(x = 0; x <= 30; x++)
for(x = EmuConstants::EQUIPMENT_BEGIN; x <= MainCursor; x++) // include cursor or not?
{
TempItem = 0;
ins = GetInv().GetItem(x);
@ -1136,7 +1137,7 @@ uint32 Client::CalcCurrentWeight() {
if (TempItem)
Total += TempItem->Weight;
}
for (x = 251; x < 331; x++)
for (x = EmuConstants::GENERAL_BAGS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) // include cursor bags or not?
{
int TmpWeight = 0;
TempItem = 0;
@ -1147,9 +1148,11 @@ uint32 Client::CalcCurrentWeight() {
TmpWeight = TempItem->Weight;
if (TmpWeight > 0)
{
int bagslot = 22;
// this code indicates that weight redux bags can only be in the first general inventory slot to be effective...
// is this correct? or can we scan for the highest weight redux and use that? (need client verifications)
int bagslot = MainGeneral1;
int reduction = 0;
for (int m = 261; m < 331; m += 10)
for (int m = EmuConstants::GENERAL_BAGS_BEGIN + 10; m <= EmuConstants::GENERAL_BAGS_END; m += 10) // include cursor bags or not?
{
if (x >= m)
bagslot += 1;
@ -1172,10 +1175,9 @@ uint32 Client::CalcCurrentWeight() {
This is the ONLY instance I have seen where the client is hard coded to particular Item IDs to set a certain property for an item. It is very odd.
*/
// SoD client has no weight for coin
if (GetClientVersion() < EQClientSoD) {
// SoD+ client has no weight for coin
if (EQLimits::CoinHasWeight(ClientVersion))
Total += (m_pp.platinum + m_pp.gold + m_pp.silver + m_pp.copper) / 4;
}
float Packrat = (float)spellbonuses.Packrat + (float)aabonuses.Packrat + (float)itembonuses.Packrat;
if (Packrat > 0)
@ -1976,7 +1978,7 @@ int Client::GetRawACNoShield(int &shield_ac) const
{
ac -= inst->GetItem()->AC;
shield_ac = inst->GetItem()->AC;
for (uint8 i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++)
for (uint8 i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++)
{
if(inst->GetAugment(i))
{

View File

@ -386,6 +386,7 @@ void MapOpcodes() {
ConnectedOpcodes[OP_MercenaryTimerRequest] = &Client::Handle_OP_MercenaryTimerRequest;
ConnectedOpcodes[OP_OpenInventory] = &Client::Handle_OP_OpenInventory;
ConnectedOpcodes[OP_OpenContainer] = &Client::Handle_OP_OpenContainer;
ConnectedOpcodes[OP_ClientTimeStamp] = &Client::Handle_OP_ClientTimeStamp;
}
void ClearMappedOpcode(EmuOpcode op) {
@ -1629,7 +1630,7 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app)
Shielding_Struct* shield = (Shielding_Struct*)app->pBuffer;
shield_target = entity_list.GetMob(shield->target_id);
bool ack = false;
ItemInst* inst = GetInv().GetItem(14);
ItemInst* inst = GetInv().GetItem(MainSecondary);
if (!shield_target)
return;
if (inst)
@ -3259,7 +3260,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app)
MoveItem_Struct* mi = (MoveItem_Struct*)app->pBuffer;
if(spellend_timer.Enabled() && casting_spell_id && !IsBardSong(casting_spell_id))
{
if(mi->from_slot != mi->to_slot && (mi->from_slot < 30 || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot))
if(mi->from_slot != mi->to_slot && (mi->from_slot <= EmuConstants::GENERAL_END || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot))
{
char *detect = nullptr;
const ItemInst *itm_from = GetInv().GetItem(mi->from_slot);
@ -3280,8 +3281,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app)
// Illegal bagslot useage checks. Currently, user only receives a message if this check is triggered.
bool mi_hack = false;
if(mi->from_slot >= 251 && mi->from_slot <= 340) {
if(mi->from_slot > 330) { mi_hack = true; }
if(mi->from_slot >= EmuConstants::GENERAL_BAGS_BEGIN && mi->from_slot <= EmuConstants::CURSOR_BAG_END) {
if(mi->from_slot >= EmuConstants::CURSOR_BAG_BEGIN) { mi_hack = true; }
else {
int16 from_parent = m_inv.CalcSlotId(mi->from_slot);
if(!m_inv[from_parent]) { mi_hack = true; }
@ -3290,8 +3291,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app)
}
}
if(mi->to_slot >= 251 && mi->to_slot <= 340) {
if(mi->to_slot > 330) { mi_hack = true; }
if(mi->to_slot >= EmuConstants::GENERAL_BAGS_BEGIN && mi->to_slot <= EmuConstants::CURSOR_BAG_END) {
if(mi->to_slot >= EmuConstants::CURSOR_BAG_BEGIN) { mi_hack = true; }
else {
int16 to_parent = m_inv.CalcSlotId(mi->to_slot);
if(!m_inv[to_parent]) { mi_hack = true; }
@ -4519,7 +4520,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
}
return;
}
else if ((castspell->inventoryslot < 30) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // sanity check
else if ((castspell->inventoryslot <= EmuConstants::GENERAL_END) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // sanity check
{
const ItemInst* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field
//bool cancast = true;
@ -4584,7 +4585,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
}
else
{
Message(0, "Error: castspell->inventoryslot >= 30 (0x%04x)", castspell->inventoryslot);
Message(0, "Error: castspell->inventoryslot >= %i (0x%04x)", MainCursor, castspell->inventoryslot);
InterruptSpell(castspell->spell_id);
}
}
@ -4885,7 +4886,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
uint16 trade_count = 0;
// Item trade count for packet sizing
for(int16 slot_id=3000; slot_id<=3007; slot_id++) {
for(int16 slot_id = EmuConstants::TRADE_BEGIN; slot_id <= EmuConstants::TRADE_END; slot_id++) {
if(other->GetInv().GetItem(slot_id)) { trade_count += other->GetInv().GetItem(slot_id)->GetTotalItemCount(); }
if(m_inv[slot_id]) { trade_count += m_inv[slot_id]->GetTotalItemCount(); }
}
@ -4925,7 +4926,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
if(RuleB(QueryServ, PlayerLogHandins)) {
uint16 handin_count = 0;
for(int16 slot_id=3000; slot_id<=3003; slot_id++) {
for(int16 slot_id = EmuConstants::TRADE_BEGIN; slot_id <= EmuConstants::TRADE_NPC_END; slot_id++) {
if(m_inv[slot_id]) { handin_count += m_inv[slot_id]->GetTotalItemCount(); }
}
@ -6780,9 +6781,9 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) {
Mob* tmp = entity_list.GetMob(insr->TargetID);
const Item_Struct* item = nullptr;
for (int16 L = 0; L <= 20; L++) {
for (int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) {
const ItemInst* inst = GetInv().GetItem(L);
item = inst ? inst->GetItem() : nullptr;
item = inst ? inst->GetItem() : nullptr;
if(item) {
strcpy(insr->itemnames[L], item->Name);
@ -6791,14 +6792,15 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) {
else { insr->itemicons[L] = 0xFFFFFFFF; }
}
const ItemInst* inst = GetInv().GetItem(21);
const ItemInst* inst = GetInv().GetItem(MainAmmo);
item = inst ? inst->GetItem() : nullptr;
if(item) {
strcpy(insr->itemnames[22], item->Name);
insr->itemicons[22] = item->Icon;
// another one..I did these, didn't I!!?
strcpy(insr->itemnames[SoF::slots::MainAmmo], item->Name);
insr->itemicons[SoF::slots::MainAmmo] = item->Icon;
}
else { insr->itemicons[22] = 0xFFFFFFFF; }
else { insr->itemicons[SoF::slots::MainAmmo] = 0xFFFFFFFF; }
InspectMessage_Struct* newmessage = (InspectMessage_Struct*) insr->text;
InspectMessage_Struct& playermessage = this->GetInspectMessage();
@ -13866,3 +13868,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) {
// SideNote: Watching the slot translations, Unknown1 is showing '141' as well on certain item swaps.
// Manually looting a corpse results in a from '34' to '68' value for equipment items, '0' to '0' for inventory.
}
void Client::Handle_OP_ClientTimeStamp(const EQApplicationPacket *app) {
// handle as needed or ignore like we have been doing...
}

View File

@ -288,3 +288,4 @@
void Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app);
void Handle_OP_OpenInventory(const EQApplicationPacket *app);
void Handle_OP_OpenContainer(const EQApplicationPacket *app);
void Handle_OP_ClientTimeStamp(const EQApplicationPacket *app);

View File

@ -402,10 +402,10 @@ bool Client::Process() {
{
entity_list.AEAttack(this, 30);
} else {
Attack(auto_attack_target, 13); // Kaiyodo - added attacking hand to arguments
Attack(auto_attack_target, MainPrimary); // Kaiyodo - added attacking hand to arguments
}
ItemInst *wpn = GetInv().GetItem(MainPrimary);
TryWeaponProc(wpn, auto_attack_target, 13);
TryWeaponProc(wpn, auto_attack_target, MainPrimary);
bool tripleAttackSuccess = false;
if( auto_attack_target && CanThisClassDoubleAttack() ) {
@ -416,7 +416,7 @@ bool Client::Process() {
if(CheckAAEffect(aaEffectRampage)) {
entity_list.AEAttack(this, 30);
} else {
Attack(auto_attack_target, 13, false);
Attack(auto_attack_target, MainPrimary, false);
}
}
@ -426,13 +426,13 @@ bool Client::Process() {
&& CheckDoubleAttack(true))
{
tripleAttackSuccess = true;
Attack(auto_attack_target, 13, false);
Attack(auto_attack_target, MainPrimary, false);
}
//quad attack, does this belong here??
if(GetSpecialAbility(SPECATK_QUAD) && CheckDoubleAttack(true))
{
Attack(auto_attack_target, 13, false);
Attack(auto_attack_target, MainPrimary, false);
}
}
@ -444,8 +444,8 @@ bool Client::Process() {
if(MakeRandomInt(0, 99) < flurrychance)
{
Message_StringID(MT_NPCFlurry, YOU_FLURRY);
Attack(auto_attack_target, 13, false);
Attack(auto_attack_target, 13, false);
Attack(auto_attack_target, MainPrimary, false);
Attack(auto_attack_target, MainPrimary, false);
}
}
@ -460,7 +460,7 @@ bool Client::Process() {
{
if(MakeRandomInt(0, 99) < ExtraAttackChanceBonus)
{
Attack(auto_attack_target, 13, false);
Attack(auto_attack_target, MainPrimary, false);
}
}
}
@ -507,19 +507,19 @@ bool Client::Process() {
CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10);
if (random < DualWieldProbability){ // Max 78% of DW
if(CheckAAEffect(aaEffectRampage)) {
entity_list.AEAttack(this, 30, 14);
entity_list.AEAttack(this, 30, MainSecondary);
} else {
Attack(auto_attack_target, 14); // Single attack with offhand
Attack(auto_attack_target, MainSecondary); // Single attack with offhand
}
ItemInst *wpn = GetInv().GetItem(MainSecondary);
TryWeaponProc(wpn, auto_attack_target, 14);
TryWeaponProc(wpn, auto_attack_target, MainSecondary);
if( CanThisClassDoubleAttack() && CheckDoubleAttack()) {
if(CheckAAEffect(aaEffectRampage)) {
entity_list.AEAttack(this, 30, 14);
entity_list.AEAttack(this, 30, MainSecondary);
} else {
if(auto_attack_target && auto_attack_target->GetHP() > -10)
Attack(auto_attack_target, 14); // Single attack with offhand
Attack(auto_attack_target, MainSecondary); // Single attack with offhand
}
}
}
@ -816,12 +816,11 @@ void Client::OnDisconnect(bool hard_disconnect) {
//#ifdef ITEMCOMBINED
void Client::BulkSendInventoryItems() {
// For future reference: Only the parent item needs to be sent..the ItemInst already contains child ItemInst information
int16 slot_id = 0;
// LINKDEAD TRADE ITEMS
// Move trade slot items back into normal inventory..need them there now for the proceeding validity checks -U
for(slot_id = 3000; slot_id <= 3007; slot_id++) {
for(slot_id = EmuConstants::TRADE_BEGIN; slot_id <= EmuConstants::TRADE_END; slot_id++) {
ItemInst* inst = m_inv.PopItem(slot_id);
if(inst) {
bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false;
@ -867,7 +866,7 @@ void Client::BulkSendInventoryItems() {
std::map<uint16, std::string>::iterator itr;
//Inventory items
for(slot_id = 0; slot_id <= 30; slot_id++) {
for(slot_id = MAIN_BEGIN; slot_id < EmuConstants::MAP_POSSESSIONS_SIZE; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
std::string packet = inst->Serialize(slot_id);
@ -878,16 +877,16 @@ void Client::BulkSendInventoryItems() {
// Power Source
if(GetClientVersion() >= EQClientSoF) {
const ItemInst* inst = m_inv[9999];
const ItemInst* inst = m_inv[MainPowerSource];
if(inst) {
std::string packet = inst->Serialize(9999);
std::string packet = inst->Serialize(MainPowerSource);
ser_items[i++] = packet;
size += packet.length();
}
}
// Bank items
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
std::string packet = inst->Serialize(slot_id);
@ -897,7 +896,7 @@ void Client::BulkSendInventoryItems() {
}
// Shared Bank items
for(slot_id = 2500; slot_id <= 2501; slot_id++) {
for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
std::string packet = inst->Serialize(slot_id);
@ -928,14 +927,14 @@ void Client::BulkSendInventoryItems()
if(deletenorent){//client was offline for more than 30 minutes, delete no rent items
RemoveNoRent();
}
for (slot_id=0; slot_id<=30; slot_id++) {
for (slot_id=EmuConstants::POSSESSIONS_BEGIN; slot_id<=EmuConstants::POSSESSIONS_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if (inst){
SendItemPacket(slot_id, inst, ItemPacketCharInventory);
}
}
// Bank items
for (slot_id=2000; slot_id<=2015; slot_id++) {
for (slot_id=EmuConstants::BANK_BEGIN; slot_id<=EmuConstants::BANK_END; slot_id++) { // 2015...
const ItemInst* inst = m_inv[slot_id];
if (inst){
SendItemPacket(slot_id, inst, ItemPacketCharInventory);
@ -943,7 +942,7 @@ void Client::BulkSendInventoryItems()
}
// Shared Bank items
for (slot_id=2500; slot_id<=2501; slot_id++) {
for (slot_id=EmuConstants::SHARED_BANK_BEGIN; slot_id<=EmuConstants::SHARED_BANK_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if (inst){
SendItemPacket(slot_id, inst, ItemPacketCharInventory);
@ -953,7 +952,7 @@ void Client::BulkSendInventoryItems()
// LINKDEAD TRADE ITEMS
// If player went LD during a trade, they have items in the trade inventory
// slots. These items are now being put into their inventory (then queue up on cursor)
for (int16 trade_slot_id=3000; trade_slot_id<=3007; trade_slot_id++) {
for (int16 trade_slot_id=EmuConstants::TRADE_BEGIN; trade_slot_id<=EmuConstants::TRADE_END; trade_slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if (inst) {
int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size);

View File

@ -2704,14 +2704,14 @@ void command_texture(Client *c, const Seperator *sep)
// Player Races Wear Armor, so Wearchange is sent instead
int i;
if (!c->GetTarget())
for (i = 0; i < 7; i++)
for (i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_TINT_END; i++)
{
c->SendTextureWC(i, texture);
}
else if ((c->GetTarget()->GetRace() > 0 && c->GetTarget()->GetRace() <= 12) ||
c->GetTarget()->GetRace() == 128 || c->GetTarget()->GetRace() == 130 ||
c->GetTarget()->GetRace() == 330 || c->GetTarget()->GetRace() == 522) {
for (i = 0; i < 7; i++)
for (i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_TINT_END; i++)
{
c->GetTarget()->SendTextureWC(i, texture);
}
@ -2892,11 +2892,12 @@ void command_peekinv(Client *c, const Seperator *sep)
if (bAll || (strcasecmp(sep->arg[1], "worn")==0)) {
// Worn items
bFound = true;
for (int16 i=0; i<=21; i++) {
for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) {
const ItemInst* inst = client->GetInv().GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
{
// this kind of stuff needs to be pushed to the client translators
c->Message((item==0), "WornSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i,
((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID),
((item==0)?"null":item->Name), 0x12,
@ -2914,7 +2915,7 @@ void command_peekinv(Client *c, const Seperator *sep)
if (bAll || (strcasecmp(sep->arg[1], "inv")==0)) {
// Personal inventory items
bFound = true;
for (int16 i=22; i<=29; i++) {
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
const ItemInst* inst = client->GetInv().GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -2933,7 +2934,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if (inst && inst->IsType(ItemClassContainer)) {
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
const ItemInst* instbag = client->GetInv().GetItem(i, j);
item = (instbag) ? instbag->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -2957,9 +2958,9 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if(c->GetClientVersion() >= EQClientSoF)
{
const ItemInst* inst = client->GetInv().GetItem(9999);
const ItemInst* inst = client->GetInv().GetItem(MainPowerSource);
item = (inst) ? inst->GetItem() : nullptr;
c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", 9999,
c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", MainPowerSource,
((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID),
((item==0)?"null":item->Name), 0x12,
((item==0)?0:inst->GetCharges()));
@ -3006,7 +3007,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if (inst && inst->IsType(ItemClassContainer) && i==0) { // 'CSD 1' - only display contents of slot 30[0] container..higher ones don't exist
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
const ItemInst* instbag = client->GetInv().GetItem(MainCursor, j);
item = (instbag) ? instbag->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3034,7 +3035,7 @@ void command_peekinv(Client *c, const Seperator *sep)
if (bAll || (strcasecmp(sep->arg[1], "trib")==0)) {
// Active tribute effect items
bFound = true;
for (int16 i=TRIBUTE_SLOT_START; i<(TRIBUTE_SLOT_START + MAX_PLAYER_TRIBUTES); i++) {
for (int16 i = EmuConstants::TRIBUTE_BEGIN; i <= EmuConstants::TRIBUTE_END; i++) {
const ItemInst* inst = client->GetInv().GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3058,7 +3059,7 @@ void command_peekinv(Client *c, const Seperator *sep)
// Bank and shared bank items
bFound = true;
int16 i = 0;
for (i=2000; i<=2023; i++) {
for (i = EmuConstants::BANK_BEGIN; i <= EmuConstants::BANK_END; i++) {
const ItemInst* inst = client->GetInv().GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3077,7 +3078,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if (inst && inst->IsType(ItemClassContainer)) {
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
const ItemInst* instbag = client->GetInv().GetItem(i, j);
item = (instbag) ? instbag->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3099,7 +3100,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
}
}
for (i=2500; i<=2501; i++) {
for (i = EmuConstants::SHARED_BANK_BEGIN; i <= EmuConstants::SHARED_BANK_END; i++) {
const ItemInst* inst = client->GetInv().GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3118,7 +3119,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if (inst && inst->IsType(ItemClassContainer)) {
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
const ItemInst* instbag = client->GetInv().GetItem(i, j);
item = (instbag) ? instbag->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3144,7 +3145,7 @@ void command_peekinv(Client *c, const Seperator *sep)
if (bAll || (strcasecmp(sep->arg[1], "trade")==0)) {
// Items in trade window (current trader only, not the other trader)
bFound = true;
for (int16 i=3000; i<=3007; i++) {
for (int16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++) {
const ItemInst* inst = client->GetInv().GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3163,7 +3164,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if (inst && inst->IsType(ItemClassContainer)) {
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
const ItemInst* instbag = client->GetInv().GetItem(i, j);
item = (instbag) ? instbag->GetItem() : nullptr;
if (c->GetClientVersion() >= EQClientSoF)
@ -3532,7 +3533,7 @@ void command_listpetition(Client *c, const Seperator *sep)
void command_equipitem(Client *c, const Seperator *sep)
{
uint32 slot_id = atoi(sep->arg[1]);
if (sep->IsNumber(1) && (slot_id>=0) && (slot_id<=21)) {
if (sep->IsNumber(1) && ((slot_id >= EmuConstants::EQUIPMENT_BEGIN) && (slot_id <= EmuConstants::EQUIPMENT_END) || (slot_id == MainPowerSource))) {
const ItemInst* from_inst = c->GetInv().GetItem(MainCursor);
const ItemInst* to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack)
bool partialmove = false;
@ -3568,6 +3569,8 @@ void command_equipitem(Client *c, const Seperator *sep)
else if(c->SwapItem(mi)) {
c->FastQueuePacket(&outapp);
// if the below code is still needed..just send an an item trade packet to each slot..it should overwrite the client instance
// below code has proper logic, but client does not like to have cursor charges changed
// (we could delete the cursor item and resend, but issues would arise if there are queued items)
//if (partialmove) {
@ -7776,16 +7779,19 @@ void command_path(Client *c, const Seperator *sep)
}
void Client::Undye() {
for (int cur_slot = 0; cur_slot < 9 ; cur_slot++ ){
for (int cur_slot = EmuConstants::MATERIAL_BEGIN; cur_slot <= EmuConstants::MATERIAL_END; cur_slot++ ) {
uint8 slot2=SlotConvert(cur_slot);
ItemInst* inst = m_inv.GetItem(slot2);
if(inst != nullptr) {
inst->SetColor(inst->GetItem()->Color);
database.SaveInventory(CharacterID(), inst, slot2);
}
m_pp.item_tint[cur_slot].color = 0;
SendWearChange(cur_slot);
}
Save(0);
}
@ -11415,7 +11421,7 @@ void command_augmentitem(Client *c, const Seperator *sep)
return;
AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)];
in_augment->container_slot = 1000;
in_augment->container_slot = 1000; // <watch>
in_augment->unknown02[0] = 0;
in_augment->unknown02[1] = 0;
in_augment->augment_slot = -1;

View File

@ -364,12 +364,12 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
// worn + inventory + cursor
std::list<uint32> removed_list;
bool cursor = false;
for(i = 0; i <= 30; i++)
for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++)
{
if(i == 21 && client->GetClientVersion() >= EQClientSoF) {
item = client->GetInv().GetItem(9999);
if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) {
item = client->GetInv().GetItem(MainPowerSource);
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) {
std::list<uint32> slot_list = MoveItemToCorpse(client, item, 9999);
std::list<uint32> slot_list = MoveItemToCorpse(client, item, MainPowerSource);
removed_list.merge(slot_list);
}
@ -449,9 +449,9 @@ std::list<uint32> Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16
returnlist.push_back(equipslot);
// Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea.
if(item->IsType(ItemClassContainer) && ((equipslot >= 22 && equipslot <=30))) // Limit the bag check to inventory and cursor slots.
if(item->IsType(ItemClassContainer) && ((equipslot >= EmuConstants::GENERAL_BEGIN && equipslot <= MainCursor))) // Limit the bag check to inventory and cursor slots.
{
for(bagindex = 0; bagindex <= 9; bagindex++)
for(bagindex = SUB_BEGIN; bagindex <= EmuConstants::ITEM_CONTAINER_SIZE; bagindex++)
{
// For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1)
interior_slot = Inventory::CalcSlotId(equipslot, bagindex);
@ -685,7 +685,7 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct**
if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equipSlot))
{
int16 bagstart = Inventory::CalcSlotId(sitem->equipSlot, 0);
int16 bagstart = Inventory::CalcSlotId(sitem->equipSlot, SUB_BEGIN);
cur = itemlist.begin();
end = itemlist.end();
@ -750,7 +750,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data)
itemlist.erase(cur);
material = Inventory::CalcMaterialFromSlot(sitem->equipSlot);
if(material != 0xFF)
if(material != _MaterialInvalid)
SendWearChange(material);
safe_delete(sitem);
@ -983,7 +983,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
const Item_Struct* item = database.GetItem(pkitem);
ItemInst* inst = database.CreateItem(item, item->MaxCharges);
if(inst) {
client->SendItemPacket(22, inst, ItemPacketLoot);
client->SendItemPacket(EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot);
safe_delete(inst);
}
else { client->Message(13, "Could not find item number %i to send!!", GetPKItem()); }
@ -999,12 +999,8 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
end = itemlist.end();
uint8 containercount = 0;
int corpselootlimit;
if(client->GetClientVersion() >= EQClientRoF) { corpselootlimit = 34; }
else if(client->GetClientVersion() >= EQClientSoF) { corpselootlimit = 32; }
else if(client->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; }
else { corpselootlimit = 30; }
int corpselootlimit = EQLimits::InventoryMapSize(MapCorpse, client->GetClientVersion());
for(; cur != end; ++cur) {
ServerLootItem_Struct* item_data = *cur;
@ -1020,7 +1016,8 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(client && item) {
ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5);
if(inst) {
client->SendItemPacket(i + 22, inst, ItemPacketLoot); // 22 is the corpse inventory start offset for Ti(EMu)
// MainGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = MainGeneral1 + MainCursor
client->SendItemPacket(i + EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot);
safe_delete(inst);
}
@ -1114,9 +1111,9 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
if(GetPKItem()>1)
item = database.GetItem(GetPKItem());
else if(GetPKItem()==-1 || GetPKItem()==1)
item_data = GetItem(lootitem->slot_id - 22); //dont allow them to loot entire bags of items as pvp reward
item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN); //dont allow them to loot entire bags of items as pvp reward
else
item_data = GetItem(lootitem->slot_id - 22, bag_item_data);
item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN, bag_item_data);
if (GetPKItem()<=1 && item_data != 0)
{
@ -1145,7 +1142,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
if(inst->IsAugmented())
{
for (int i = 0; i<EmuConstants::ITEM_COMMON_SIZE; i++)
for (int i = AUG_BEGIN; i<EmuConstants::ITEM_COMMON_SIZE; i++)
{
ItemInst *itm = inst->GetAugment(i);
if(itm)
@ -1242,7 +1239,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
// remove bag contents too
if (item->ItemClass == ItemClassContainer && (GetPKItem()!=-1 || GetPKItem()!=1))
{
for (int i=0; i < 10; i++)
for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++)
{
if (bag_item_data[i])
{
@ -1331,17 +1328,13 @@ void Corpse::QueryLoot(Client* to) {
cur = itemlist.begin();
end = itemlist.end();
int corpselootlimit;
if (to->GetClientVersion() >= EQClientSoF) { corpselootlimit = 32; }
else if (to->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; }
else { corpselootlimit = 30; }
int corpselootlimit = EQLimits::InventoryMapSize(MapCorpse, to->GetClientVersion());
for(; cur != end; ++cur) {
ServerLootItem_Struct* sitem = *cur;
if (IsPlayerCorpse()) {
if (sitem->equipSlot >= 251 && sitem->equipSlot <= 340)
if (sitem->equipSlot >= EmuConstants::GENERAL_BAGS_BEGIN && sitem->equipSlot <= EmuConstants::CURSOR_BAG_END)
sitem->lootslot = 0xFFFF;
else
x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF;
@ -1979,14 +1972,14 @@ bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
uint32 Corpse::GetEquipment(uint8 material_slot) const {
int invslot;
if(material_slot > 8)
if(material_slot > EmuConstants::MATERIAL_END)
{
return 0;
return NO_ITEM;
}
invslot = Inventory::CalcSlotFromMaterial(material_slot);
if(invslot == -1)
return 0;
if(invslot == INVALID_INDEX) // GetWornItem() should be returning a NO_ITEM for any invalid index...
return NO_ITEM;
return GetWornItem(invslot);
}
@ -1994,13 +1987,13 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const {
uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
const Item_Struct *item;
if(material_slot > 8)
if(material_slot > EmuConstants::MATERIAL_END)
{
return 0;
}
item = database.GetItem(GetEquipment(material_slot));
if(item != 0)
if(item != NO_ITEM)
{
return item_tint[material_slot].rgb.use_tint ?
item_tint[material_slot].color :
@ -2062,6 +2055,17 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){
safe_delete_array(query);
}
/*
uint32 Corpse::ServerToCorpseSlot(int16 server_slot) {
// reserved
}
*/
/*
int16 Corpse::CorpseToServerSlot(uint32 corpse_slot) {
// reserved
}
*/
/*
void Corpse::CastRezz(uint16 spellid, Mob* Caster){
if(Rezzed()){

View File

@ -41,7 +41,7 @@ public:
//abstract virtual function implementations requird by base abstract class
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; }
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false,
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false,
ExtraAttackOptions *opts = nullptr) { return false; }
virtual bool HasRaid() { return false; }
virtual bool HasGroup() { return false; }
@ -111,6 +111,10 @@ public:
uint32 GetEquipmentColor(uint8 material_slot) const;
inline int GetRezzExp() { return rezzexp; }
// these are a temporary work-around until corpse inventory is removed from the database blob
//static uint32 ServerToCorpseSlot(int16 server_slot); // encode
//static int16 CorpseToServerSlot(uint32 corpse_slot); // decode
protected:
std::list<uint32> MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot);

View File

@ -305,7 +305,7 @@ public:
void QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app);
void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true);
void AEAttack(Mob *attacker, float dist, int Hand = 13, int count = 0, bool IsFromSpell = false);
void AEAttack(Mob *attacker, float dist, int Hand = MainPrimary, int count = 0, bool IsFromSpell = false);
void AETaunt(Client *caster, float range = 0);
void AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true, int16 resist_adjust = 0);
void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true);

View File

@ -301,7 +301,7 @@ void Client::GoFish()
Bait = m_inv.GetItem(bslot);
//if the bait isnt equipped, need to add its skill bonus
if(bslot >= IDX_INV && Bait->GetItem()->SkillModType == SkillFishing) {
if(bslot >= EmuConstants::GENERAL_BEGIN && Bait->GetItem()->SkillModType == SkillFishing) {
fishing_skill += Bait->GetItem()->SkillModValue;
}
@ -393,7 +393,7 @@ void Client::GoFish()
//and then swap out items in primary slot... too lazy to fix right now
if (MakeRandomInt(0, 49) == 1) {
Message_StringID(MT_Skills, FISHING_POLE_BROKE); //Your fishing pole broke!
DeleteItemInInventory(13,0,true);
DeleteItemInInventory(MainPrimary, 0, true);
}
if(CheckIncreaseSkill(SkillFishing, nullptr, 5))

View File

@ -545,7 +545,7 @@ int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOption
if(cur)
{
for(int i = 0; i < count; ++i) {
caster->Attack(cur, 13, false, false, false, opts);
caster->Attack(cur, MainPrimary, false, false, false, opts);
}
}
iter++;

View File

@ -44,7 +44,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
int i;
if(where_to_check & invWhereWorn) {
for (i=0; i<=21; i++) { // Equipped
for (i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -57,9 +57,8 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
}
// Power Source Slot
if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) {
cur = m_inv.GetItem(9999);
if (GetItemIDAt(MainPowerSource) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(MainPowerSource) != INVALID_ID)) {
cur = m_inv.GetItem(MainPowerSource);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
@ -67,25 +66,25 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
if (GetClientVersion() >= EQClientSoF)
DeleteItemInInventory(9999, 0, true);
DeleteItemInInventory(MainPowerSource, 0, true);
else
DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash
DeleteItemInInventory(MainPowerSource, 0, false); // Prevents Titanium crash
}
}
if(where_to_check & invWhereCursor) {
if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) {
cur = m_inv.GetItem(30);
if (GetItemIDAt(MainCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(MainCursor) != INVALID_ID)) {
cur = m_inv.GetItem(MainCursor);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(30, 0, true);
DeleteItemInInventory(MainCursor, 0, true);
}
for (i=331; i<=340; i++) { // cursor's containers
for (i = EmuConstants::CURSOR_BAG_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -100,7 +99,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
if(where_to_check & invWherePersonal) {
for (i=22; i<=29; i++) { // Equipped
for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -113,7 +112,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
}
for (i=251; i<=330; i++) { // Main inventory's containers
for (i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::GENERAL_BAGS_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -128,7 +127,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
if(where_to_check & invWhereBank) {
for (i=2000; i<=2023; i++) { // Bank slots
for (i = EmuConstants::BANK_BEGIN; i <= EmuConstants::BANK_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -141,7 +140,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
}
for (i=2031; i<=2270; i++) { // Bank's containers
for (i = EmuConstants::BANK_BAGS_BEGIN; i <= EmuConstants::BANK_BAGS_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -156,7 +155,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
if(where_to_check & invWhereSharedBank) {
for (i=2500; i<=2501; i++) { // Shared bank
for (i = EmuConstants::SHARED_BANK_BEGIN; i <= EmuConstants::SHARED_BANK_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -169,7 +168,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
}
}
for (i=2531; i<=2550; i++) { // Shared bank's containers
for (i = EmuConstants::SHARED_BANK_BAGS_BEGIN; i <= EmuConstants::SHARED_BANK_BAGS_END; i++) {
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
@ -254,7 +253,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
bool enforcerestr = RuleB(Inventory, EnforceAugmentRestriction);
bool enforceusable = RuleB(Inventory, EnforceAugmentUsability);
for (int iter = 0; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
for (int iter = AUG_BEGIN; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
const Item_Struct* augtest = database.GetItem(augments[iter]);
if(augtest == nullptr) {
@ -548,7 +547,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
}
// add any validated augments
for (int iter = 0; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
for (int iter = AUG_BEGIN; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
if(augments[iter])
inst->PutAugment(&database, iter, augments[iter]);
}
@ -586,7 +585,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(!IsDiscovered(item_id))
DiscoverItem(item_id);
for (int iter = 0; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
for (int iter = AUG_BEGIN; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
if(augments[iter] && !IsDiscovered(augments[iter]))
DiscoverItem(augments[iter]);
}
@ -728,7 +727,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
qsaudit->items[parent_offset].aug_5 = m_inv[slot_id]->GetAugmentItemID(5);
if(m_inv[slot_id]->IsType(ItemClassContainer)) {
for(uint8 bag_idx = 0; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) {
for(uint8 bag_idx = SUB_BEGIN; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) {
ItemInst* bagitem = m_inv[slot_id]->GetItem(bag_idx);
if(bagitem) {
@ -854,7 +853,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
{
int16 interior_slot;
// solar: our bag went into slot_id, now let's pack the contents in
for(int i = 0; i < 10; i++)
for(int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++)
{
if(bag_item_data[i] == nullptr)
continue;
@ -873,7 +872,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur
return false;
int16 i;
uint32 item_id = item->GetItem()->ID;
for (i = 22; i <= 29; i++)
for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++)
{
ItemInst* tmp_inst = m_inv.GetItem(i);
if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize){
@ -884,9 +883,9 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur
return true;
}
}
for (i = 22; i <= 29; i++)
for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++)
{
for (uint8 j = 0; j < 10; j++)
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++)
{
uint16 slotid = Inventory::CalcSlotId(i, j);
ItemInst* tmp_inst = m_inv.GetItem(slotid);
@ -910,10 +909,11 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
// #1: Try to auto equip
if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel<=level && !inst.GetItem()->Attuneable && inst.GetItem()->ItemType != ItemTypeAugmentation)
{
for (int16 i = 0; i < 9999; i++) // originally (i < 22)
// too messy as-is... <watch>
for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i < MainPowerSource; i++) // originally (i < 22)
{
if (i == 22) {
if(this->GetClientVersion() >= EQClientSoF) { i = 9999; } // added power source check for SoF+ clients
if (i == EmuConstants::GENERAL_BEGIN) {
if(this->GetClientVersion() >= EQClientSoF) { i = MainPowerSource; } // added power source check for SoF+ clients
else { break; }
}
@ -950,7 +950,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
//send worn to everyone...
PutLootInInventory(i, inst);
uint8 worn_slot_material = Inventory::CalcMaterialFromSlot(i);
if(worn_slot_material != 0xFF)
if(worn_slot_material != _MaterialInvalid)
{
SendWearChange(worn_slot_material);
}
@ -1225,17 +1225,17 @@ void Client::SendLootItemInPacket(const ItemInst* inst, int16 slot_id)
}
bool Client::IsValidSlot(uint32 slot) {
if ((slot == (uint32)INVALID_INDEX) || // Destroying/Dropping item
(slot >= MainCharm && slot <= MainCursor) || // Worn inventory, normal inventory, and cursor
(slot >= 251 && slot <= 340) || // Normal inventory bags and cursor bag
(slot >= 400 && slot <= 404) || // Tribute
(slot >= 2000 && slot <= 2023) || // Bank
(slot >= 2031 && slot <= 2270) || // Bank bags
(slot >= 2500 && slot <= 2501) || // Shared bank
(slot >= 2531 && slot <= 2550) || // Shared bank bags
(slot >= 3000 && slot <= 3007) || // Trade window
(slot >= 4000 && slot <= 4009) || // Tradeskill container
(slot == MainPowerSource)) // Power Source
if ((slot == (uint32)INVALID_INDEX) ||
(slot >= MAIN_BEGIN && slot < EmuConstants::MAP_POSSESSIONS_SIZE) ||
(slot >= EmuConstants::GENERAL_BAGS_BEGIN && slot <= EmuConstants::CURSOR_BAG_END) ||
(slot >= EmuConstants::TRIBUTE_BEGIN && slot <= EmuConstants::TRIBUTE_END) ||
(slot >= EmuConstants::BANK_BEGIN && slot <= EmuConstants::BANK_END) ||
(slot >= EmuConstants::BANK_BAGS_BEGIN && slot <= EmuConstants::BANK_BAGS_END) ||
(slot >= EmuConstants::SHARED_BANK_BEGIN && slot <= EmuConstants::SHARED_BANK_END) ||
(slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot <= EmuConstants::SHARED_BANK_BAGS_END) ||
(slot >= EmuConstants::TRADE_BEGIN && slot <= EmuConstants::TRADE_END) ||
(slot >= EmuConstants::WORLD_BEGIN && slot <= EmuConstants::WORLD_END) ||
(slot == MainPowerSource))
return true;
else
return false;
@ -1243,10 +1243,10 @@ bool Client::IsValidSlot(uint32 slot) {
bool Client::IsBankSlot(uint32 slot)
{
if ((slot >= 2000 && slot <= 2023) || // Bank
(slot >= 2031 && slot <= 2270) || // Bank bags
(slot >= 2500 && slot <= 2501) || // Shared bank
(slot >= 2531 && slot <= 2550)) // Shared bank bags
if ((slot >= EmuConstants::BANK_BEGIN && slot <= EmuConstants::BANK_END) ||
(slot >= EmuConstants::BANK_BAGS_BEGIN && slot <= EmuConstants::BANK_BAGS_END) ||
(slot >= EmuConstants::SHARED_BANK_BEGIN && slot <= EmuConstants::SHARED_BANK_END) ||
(slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot <= EmuConstants::SHARED_BANK_BAGS_END))
{
return true;
}
@ -1357,15 +1357,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
ItemInst* dstbag;
uint32 srcbagid =0;
uint32 dstbagid = 0;
if (src_slot_id>=250 && src_slot_id<330){
srcbag=m_inv.GetItem(((int)(src_slot_id/10))-3);
if(srcbag)
srcbagid=srcbag->GetItem()->ID;
//if (src_slot_id >= 250 && src_slot_id < 330) {
if (src_slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && src_slot_id <= EmuConstants::GENERAL_BAGS_END) {
srcbag = m_inv.GetItem(((int)(src_slot_id / 10)) - 3);
if (srcbag)
srcbagid = srcbag->GetItem()->ID;
}
if (dst_slot_id>=250 && dst_slot_id<330){
dstbag=m_inv.GetItem(((int)(dst_slot_id/10))-3);
if(dstbag)
dstbagid=dstbag->GetItem()->ID;
//if (dst_slot_id >= 250 && dst_slot_id < 330) {
if (dst_slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && dst_slot_id <= EmuConstants::GENERAL_BAGS_END) {
dstbag = m_inv.GetItem(((int)(dst_slot_id / 10)) - 3);
if (dstbag)
dstbagid = dstbag->GetItem()->ID;
}
if (srcitemid==17899 || srcbagid==17899 || dstitemid==17899 || dstbagid==17899){
this->Trader_EndTrader();
@ -1375,7 +1378,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Step 2: Validate item in from_slot
// After this, we can assume src_inst is a valid ptr
if (!src_inst && (src_slot_id<4000 || src_slot_id>4009)) {
if (!src_inst && (src_slot_id < EmuConstants::WORLD_BEGIN || src_slot_id > EmuConstants::WORLD_END)) {
if (dst_inst) {
// If there is no source item, but there is a destination item,
// move the slots around before deleting the invalid source slot item,
@ -1389,14 +1392,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return false;
}
//verify shared bank transactions in the database
if(src_inst && src_slot_id >= 2500 && src_slot_id <= 2550) {
if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) {
if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) {
LogFile->write(EQEMuLog::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name);
DeleteItemInInventory(dst_slot_id,0,true);
return(false);
}
if(src_slot_id >= 2500 && src_slot_id <= 2501 && src_inst->IsType(ItemClassContainer)){
for (uint8 idx=0; idx<10; idx++) {
if(src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_END && src_inst->IsType(ItemClassContainer)){
for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) {
const ItemInst* baginst = src_inst->GetItem(idx);
if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){
DeleteItemInInventory(Inventory::CalcSlotId(src_slot_id, idx),0,false);
@ -1404,14 +1407,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
}
}
if(dst_inst && dst_slot_id >= 2500 && dst_slot_id <= 2550) {
if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) {
if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) {
LogFile->write(EQEMuLog::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name);
DeleteItemInInventory(src_slot_id,0,true);
return(false);
}
if(dst_slot_id >= 2500 && dst_slot_id <= 2501 && dst_inst->IsType(ItemClassContainer)){
for (uint8 idx=0; idx<10; idx++) {
if(dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_END && dst_inst->IsType(ItemClassContainer)){
for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) {
const ItemInst* baginst = dst_inst->GetItem(idx);
if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){
DeleteItemInInventory(Inventory::CalcSlotId(dst_slot_id, idx),0,false);
@ -1423,8 +1426,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Check for No Drop Hacks
Mob* with = trade->With();
if (((with && with->IsClient() && dst_slot_id>=3000 && dst_slot_id<=3007) || // Trade
(dst_slot_id >= 2500 && dst_slot_id <= 2550)) // Shared Bank
if (((with && with->IsClient() && dst_slot_id >= EmuConstants::TRADE_BEGIN && dst_slot_id <= EmuConstants::TRADE_END) ||
(dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END))
&& GetInv().CheckNoDrop(src_slot_id)
&& RuleI(World, FVNoDropFlag) == 0 || RuleI(Character, MinStatusForNoDropExemptions) < Admin() && RuleI(World, FVNoDropFlag) == 2) {
DeleteItemInInventory(src_slot_id);
@ -1434,7 +1437,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Step 3: Check for interaction with World Container (tradeskills)
if(m_tradeskill_object != nullptr) {
if (src_slot_id>=4000 && src_slot_id<=4009) {
if (src_slot_id >= EmuConstants::WORLD_BEGIN && src_slot_id <= EmuConstants::WORLD_END) {
// Picking up item from world container
ItemInst* inst = m_tradeskill_object->PopItem(Inventory::CalcBagIdx(src_slot_id));
if (inst) {
@ -1446,7 +1449,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return true;
}
else if (dst_slot_id>=4000 && dst_slot_id<=4009) {
else if (dst_slot_id >= EmuConstants::WORLD_BEGIN && dst_slot_id <= EmuConstants::WORLD_END) {
// Putting item into world container, which may swap (or pile onto) with existing item
uint8 world_idx = Inventory::CalcBagIdx(dst_slot_id);
ItemInst* world_inst = m_tradeskill_object->PopItem(world_idx);
@ -1510,7 +1513,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
// Step 4: Check for entity trade
if (dst_slot_id>=3000 && dst_slot_id<=3007) {
if (dst_slot_id >= EmuConstants::TRADE_BEGIN && dst_slot_id <= EmuConstants::TRADE_END) {
if (src_slot_id != MainCursor) {
Kick();
return false;
@ -1597,12 +1600,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
else {
// Not dealing with charges - just do direct swap
if(src_inst && (dst_slot_id <= MainAmmo || dst_slot_id == MainPowerSource) && dst_slot_id >= MainCharm) {
if(src_inst && (dst_slot_id <= EmuConstants::EQUIPMENT_END || dst_slot_id == MainPowerSource) && dst_slot_id >= EmuConstants::EQUIPMENT_BEGIN) {
if (src_inst->GetItem()->Attuneable) {
src_inst->SetInstNoDrop(true);
}
if (src_inst->IsAugmented()) {
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
if (src_inst->GetAugment(i)) {
if (src_inst->GetAugment(i)->GetItem()->Attuneable) {
src_inst->GetAugment(i)->SetInstNoDrop(true);
@ -1615,7 +1618,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; }
mlog(INVENTORY__SLOTS, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
if(src_slot_id <= MainAmmo || src_slot_id == MainPowerSource) {
if(src_slot_id <= EmuConstants::EQUIPMENT_END || src_slot_id == MainPowerSource) {
if(src_inst) {
parse->EventItem(EVENT_UNEQUIP_ITEM, this, src_inst, nullptr, "", src_slot_id);
}
@ -1625,7 +1628,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
}
if(dst_slot_id <= MainAmmo || dst_slot_id == MainPowerSource) {
if(dst_slot_id <= EmuConstants::EQUIPMENT_END || dst_slot_id == MainPowerSource) {
if(dst_inst) {
parse->EventItem(EVENT_UNEQUIP_ITEM, this, dst_inst, nullptr, "", dst_slot_id);
}
@ -1637,7 +1640,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
int matslot = SlotConvert2(dst_slot_id);
if (dst_slot_id<22 && matslot != 0) {
if (dst_slot_id <= EmuConstants::EQUIPMENT_END && matslot != MaterialHead) { // think this is to allow the client to update with /showhelm
SendWearChange(matslot);
}
@ -1647,6 +1650,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id);
if (dst_slot_id == MainCursor) {
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
@ -1669,7 +1673,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
mlog(INVENTORY__ERROR, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
Message(15, "Inventory Desyncronization detected: Resending slot data...");
if((move_slots->from_slot >= MainCharm && move_slots->from_slot <= 340) || move_slots->from_slot == MainPowerSource) {
if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) {
int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot);
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
// This prevents the client from crashing when closing any 'phantom' bags -U
@ -1712,7 +1716,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
}
if((move_slots->to_slot >= MainCharm && move_slots->to_slot <= 340) || move_slots->to_slot == MainPowerSource) {
if((move_slots->to_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->to_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->to_slot == MainPowerSource) {
int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot);
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin'
@ -1793,7 +1797,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5);
if(from_inst->IsType(ItemClassContainer)) {
for(uint8 bag_idx = 0; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) {
for(uint8 bag_idx = SUB_BEGIN; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) {
const ItemInst* from_baginst = from_inst->GetItem(bag_idx);
if(from_baginst) {
@ -1826,7 +1830,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5);
if(to_inst->IsType(ItemClassContainer)) {
for(uint8 bag_idx = 0; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) {
for(uint8 bag_idx = SUB_BEGIN; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) {
const ItemInst* to_baginst = to_inst->GetItem(bag_idx);
if(to_baginst) {
@ -1855,7 +1859,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
void Client::DyeArmor(DyeStruct* dye){
int16 slot=0;
for(int i=0;i<7;i++){
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_TINT_END; i++) {
if(m_pp.item_tint[i].rgb.blue!=dye->dye[i].rgb.blue ||
m_pp.item_tint[i].rgb.red!=dye->dye[i].rgb.red ||
m_pp.item_tint[i].rgb.green != dye->dye[i].rgb.green){
@ -1893,7 +1897,7 @@ void Client::DyeArmor(DyeStruct* dye){
const Item_Struct* TempItem = 0;
ItemInst* ins;
int x;
for(x=0; x <= 30; x++)
for(x=EmuConstants::POSSESSIONS_BEGIN; x <= EmuConstants::POSSESSIONS_END; x++)
{
TempItem = 0;
ins = GetInv().GetItem(x);
@ -1915,7 +1919,7 @@ void Client::DyeArmor(DyeStruct* dye){
return true;
}
}
for(x=251; x < 331; x++)
for(x=EmuConstants::GENERAL_BAGS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++)
{
TempItem = 0;
ins = GetInv().GetItem(x);
@ -1945,10 +1949,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
ItemInst* ins;
int x;
int num = 0;
for(x=0; x < 331; x++)
for(x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++)
{
if (x == 31)
x = 251;
if (x == MainCursor + 1)
x = EmuConstants::GENERAL_BAGS_BEGIN;
TempItem = 0;
ins = GetInv().GetItem(x);
if (ins)
@ -1962,10 +1966,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
}
if (num < amt)
return false;
for(x=0; x < 331; x++)
for(x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) // should this be CURSOR_BAG_END?
{
if (x == 31)
x = 251;
if (x == MainCursor + 1)
x = EmuConstants::GENERAL_BAGS_BEGIN;
TempItem = 0;
ins = GetInv().GetItem(x);
if (ins)
@ -1994,7 +1998,7 @@ void Client::RemoveNoRent(bool client_update) {
int16 slot_id;
// personal
for(slot_id = 0; slot_id <= 30; slot_id++) {
for(slot_id = MAIN_BEGIN; slot_id < EmuConstants::MAP_POSSESSIONS_SIZE; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
@ -2003,14 +2007,14 @@ void Client::RemoveNoRent(bool client_update) {
}
// power source
const ItemInst* inst = m_inv[9999];
const ItemInst* inst = m_inv[MainPowerSource];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource);
DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
}
// containers
for(slot_id = 251; slot_id <= 340; slot_id++) {
for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
@ -2019,7 +2023,7 @@ void Client::RemoveNoRent(bool client_update) {
}
// bank
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
@ -2028,7 +2032,7 @@ void Client::RemoveNoRent(bool client_update) {
}
// bank containers
for(slot_id = 2031; slot_id <= 2270; slot_id++) {
for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
@ -2037,7 +2041,7 @@ void Client::RemoveNoRent(bool client_update) {
}
// shared bank
for(slot_id = 2500; slot_id <= 2501; slot_id++) {
for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
@ -2046,7 +2050,7 @@ void Client::RemoveNoRent(bool client_update) {
}
// shared bank containers
for(slot_id = 2531; slot_id <= 2550; slot_id++) {
for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
@ -2061,7 +2065,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
int16 slot_id;
// personal
for(slot_id = 0; slot_id <= 30; slot_id++) {
for(slot_id = MAIN_BEGIN; slot_id < EmuConstants::MAP_POSSESSIONS_SIZE; slot_id++) {
ItemInst* inst = m_inv.PopItem(slot_id);
if(inst) {
if(CheckLoreConflict(inst->GetItem())) {
@ -2076,20 +2080,20 @@ void Client::RemoveDuplicateLore(bool client_update) {
}
// power source
ItemInst* inst = m_inv.PopItem(9999);
ItemInst* inst = m_inv.PopItem(MainPowerSource);
if(inst) {
if(CheckLoreConflict(inst->GetItem())) {
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, 9999);
database.SaveInventory(character_id, nullptr, MainPowerSource);
}
else {
m_inv.PutItem(9999, *inst);
m_inv.PutItem(MainPowerSource, *inst);
}
safe_delete(inst);
}
// containers
for(slot_id = 251; slot_id <= 340; slot_id++) {
for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) {
ItemInst* inst = m_inv.PopItem(slot_id);
if(inst) {
if(CheckLoreConflict(inst->GetItem())) {
@ -2104,7 +2108,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
}
// bank
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) {
ItemInst* inst = m_inv.PopItem(slot_id);
if(inst) {
if(CheckLoreConflict(inst->GetItem())) {
@ -2119,7 +2123,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
}
// bank containers
for(slot_id = 2031; slot_id <= 2270; slot_id++) {
for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) {
ItemInst* inst = m_inv.PopItem(slot_id);
if(inst) {
if(CheckLoreConflict(inst->GetItem())) {
@ -2141,7 +2145,7 @@ void Client::MoveSlotNotAllowed(bool client_update) {
int16 slot_id;
// equipment
for(slot_id = 0; slot_id <= 21; slot_id++) {
for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) {
if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) {
ItemInst* inst = m_inv.PopItem(slot_id);
bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false;
@ -2154,7 +2158,7 @@ void Client::MoveSlotNotAllowed(bool client_update) {
}
// power source
slot_id = 9999;
slot_id = MainPowerSource;
if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) {
ItemInst* inst = m_inv.PopItem(slot_id);
bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false;
@ -2175,7 +2179,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const
int invslot;
const ItemInst *item;
if(material_slot > 8)
if(material_slot > EmuConstants::MATERIAL_END)
{
return 0;
}
@ -2215,7 +2219,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const
{
const Item_Struct *item;
if(material_slot > 8)
if(material_slot > EmuConstants::MATERIAL_END)
{
return 0;
}
@ -2374,7 +2378,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
m_inv.GetItem(MainCursor)->GetCharges() >= 1) // '> 0' the same, but this matches Inventory::_HasItem conditional check
slot = MainCursor;
else if (m_inv.GetItem(MainCursor)->GetItem()->ItemClass == 1) {
for(int16 CursorBagSlot = 331; CursorBagSlot <= 340; CursorBagSlot++) {
for(int16 CursorBagSlot = EmuConstants::CURSOR_BAG_BEGIN; CursorBagSlot <= EmuConstants::CURSOR_BAG_END; CursorBagSlot++) {
if (m_inv.GetItem(CursorBagSlot)) {
if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
m_inv.GetItem(CursorBagSlot)->GetCharges() >= 1) { // ditto
@ -2514,7 +2518,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
//
if(ItemToReturn->IsStackable()) {
for (int16 i=22; i<=30; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving.
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= MainCursor; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving.
ItemInst* InvItem = m_inv.GetItem(i);
@ -2541,12 +2545,12 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
//
if (InvItem && InvItem->IsType(ItemClassContainer)) {
int16 BaseSlotID = Inventory::CalcSlotId(i, 0);
int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN);
uint8 BagSize=InvItem->GetItem()->BagSlots;
uint8 BagSlot;
for (BagSlot=0; BagSlot<BagSize; BagSlot++) {
for (BagSlot = SUB_BEGIN; BagSlot < BagSize; BagSlot++) {
InvItem = m_inv.GetItem(BaseSlotID + BagSlot);
if (InvItem && (InvItem->GetItem()->ID == ItemID) &&
(InvItem->GetCharges() < InvItem->GetItem()->StackSize)) {
@ -2577,7 +2581,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
// We have tried stacking items, now just try and find an empty slot.
for (int16 i=22; i<=30; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor.
for (int16 i = EmuConstants::GENERAL_BEGIN; i <= MainCursor; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor.
ItemInst* InvItem = m_inv.GetItem(i);
@ -2596,11 +2600,11 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
}
if(InvItem->IsType(ItemClassContainer) && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), 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 = m_inv.GetItem(BaseSlotID + BagSlot);
@ -2669,4 +2673,3 @@ std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier)
}
return "";
}

View File

@ -1453,16 +1453,16 @@ luabind::scope lua_register_slot() {
luabind::value("General8", static_cast<int>(MainGeneral8)),
//luabind::value("General9", static_cast<int>(MainGeneral9)),
//luabind::value("General10", static_cast<int>(MainGeneral10)),
luabind::value("Cursor", static_cast<int>(MainCursor)),
//luabind::value("EquipmentBegin", static_cast<int>(EmuConstants::EQUIPMENT_BEGIN)),
//luabind::value("EquipmentEnd", static_cast<int>(EmuConstants::EQUIPMENT_END)),
luabind::value("PersonalBegin", static_cast<int>(EmuConstants::GENERAL_BEGIN)), // deprecated
luabind::value("GeneralBegin", static_cast<int>(EmuConstants::GENERAL_BEGIN)),
luabind::value("PersonalEnd", static_cast<int>(EmuConstants::GENERAL_END)), // deprecated
luabind::value("GeneralEnd", static_cast<int>(EmuConstants::GENERAL_END)),
luabind::value("Cursor", static_cast<int>(MainCursor)),
luabind::value("CursorEnd", 0xFFFE), // deprecated
luabind::value("Tradeskill", static_cast<int>(SLOT_TRADESKILL)), // deprecated
luabind::value("Augment", static_cast<int>(SLOT_AUGMENT)), // deprecated
luabind::value("Tradeskill", static_cast<int>(legacy::SLOT_TRADESKILL)), // deprecated
luabind::value("Augment", static_cast<int>(legacy::SLOT_AUGMENT)), // deprecated
luabind::value("Invalid", INVALID_INDEX)
];
}
@ -1483,6 +1483,7 @@ luabind::scope lua_register_material() {
luabind::value("Secondary", static_cast<int>(MaterialSecondary)),
luabind::value("Max", static_cast<int>(_MaterialCount)), // deprecated
luabind::value("Count", static_cast<int>(_MaterialCount)),
//luabind::value("TintCount", static_cast<int>(_MaterialCount - 2)),
luabind::value("Invalid", static_cast<int>(_MaterialInvalid))
];
}
@ -1497,7 +1498,8 @@ luabind::scope lua_register_client_version() {
luabind::value("SoF", static_cast<int>(EQClientSoF)),
luabind::value("SoD", static_cast<int>(EQClientSoD)),
luabind::value("Underfoot", static_cast<int>(EQClientUnderfoot)),
luabind::value("RoF", static_cast<int>(EQClientRoF))
luabind::value("RoF", static_cast<int>(EQClientRoF))//,
//luabind::value("RoF2", static_cast<int>(EQClientRoF2))
];
}

View File

@ -277,7 +277,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) {
//Power Source Slot
/*if (GetClientVersion() >= EQClientSoF)
{
const ItemInst* inst = m_inv[9999];
const ItemInst* inst = m_inv[MainPowerSource];
if(inst)
AddItemBonuses(inst, newbon);
}*/
@ -5136,13 +5136,13 @@ bool Merc::Spawn(Client *owner) {
//printf("Spawned Merc with ID %i\n", npc->GetID()); fflush(stdout);
/*
uint32 itemID = 0;
uint8 materialFromSlot = 0xFF;
for(int i=0; i<22; ++i) {
uint32 itemID = NO_ITEM;
uint8 materialFromSlot = _MaterialInvalid;
for(int i=EmuConstants::EQUIPMENT_BEGIN; i<=EmuConstants::EQUIPMENT_END; ++i) {
itemID = GetMercItemBySlot(i);
if(itemID != 0) {
if(itemID != NO_ITEM) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i);
if(materialFromSlot != 0xFF) {
if(materialFromSlot != _MaterialInvalid) {
this->SendWearChange(materialFromSlot);
}
}

View File

@ -131,11 +131,11 @@ public:
virtual void ThrowingAttack(Mob* other) { }
uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg);
// 13 = Primary (default), 14 = secondary
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false,
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false,
bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) = 0;
int MonkSpecialAttack(Mob* other, uint8 skill_used);
virtual void TryBackstab(Mob *other,int ReuseTime = 10);
void TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand = 13, int damage = 0);
void TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand = MainPrimary, int damage = 0);
virtual bool AvoidDamage(Mob* attacker, int32 &damage, bool CanRiposte = true);
virtual bool CheckHitChance(Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod = 0);
virtual void TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttackOptions *opts = nullptr);
@ -990,19 +990,19 @@ protected:
bool focused;
void CalcSpellBonuses(StatBonuses* newbon);
virtual void CalcBonuses();
void TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success = false, uint16 hand = 0, bool IsDefensive = false);
void TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success = false, uint16 hand = 0, bool IsDefensive = false); // hand = MainCharm?
bool PassLimitToSkill(uint16 spell_id, uint16 skill);
bool PassLimitClass(uint32 Classes_, uint16 Class_);
void TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand = 13);
void TryWeaponProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = 13);
void TrySpellProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = 13);
void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = 13);
void TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand = MainPrimary);
void TryWeaponProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = MainPrimary);
void TrySpellProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = MainPrimary);
void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = MainPrimary);
void ExecWeaponProc(const ItemInst* weapon, uint16 spell_id, Mob *on);
virtual float GetProcChances(float ProcBonus, uint16 hand = 13);
virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = 13, Mob *on = nullptr);
virtual float GetProcChances(float ProcBonus, uint16 hand = MainPrimary);
virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = MainPrimary, Mob *on = nullptr);
virtual float GetSpecialProcChances(uint16 hand);
virtual float GetAssassinateProcChances(uint16 ReuseTime);
virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0);
virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm?
uint16 GetWeaponSpeedbyHand(uint16 hand);
int GetWeaponDamage(Mob *against, const Item_Struct *weapon_item);
int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr);

View File

@ -104,7 +104,7 @@ public:
//abstract virtual function implementations requird by base abstract class
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false,
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false,
bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr);
virtual bool HasRaid() { return false; }
virtual bool HasGroup() { return false; }

View File

@ -2429,12 +2429,12 @@ int QuestManager::collectitems(uint32 item_id, bool remove)
int quantity = 0;
int slot_id;
for (slot_id = 22; slot_id <= 29; ++slot_id)
for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; ++slot_id)
{
quantity += collectitems_processSlot(slot_id, item_id, remove);
}
for (slot_id = 251; slot_id <= 330; ++slot_id)
for (slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::GENERAL_BAGS_END; ++slot_id)
{
quantity += collectitems_processSlot(slot_id, item_id, remove);
}

View File

@ -131,7 +131,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage,
min_damage += min_damage * GetMeleeMinDamageMod_SE(skill) / 100;
if(HitChance && !who->CheckHitChance(this, skill, 13))
if(HitChance && !who->CheckHitChance(this, skill, MainPrimary))
max_damage = 0;
else{
@ -570,7 +570,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) {
CastToClient()->CheckIncreaseSkill(SkillBackstab, other, 10);
}
else { //We do a single regular attack if we attack from the front without chaotic stab
Attack(other, 13);
Attack(other, MainPrimary);
}
}
@ -817,7 +817,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item
if (!CanDoSpecialAttack(other))
return;
if (!other->CheckHitChance(this, SkillArchery, 13,chance_mod)) {
if (!other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod)) {
mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName());
other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery);
} else {
@ -939,27 +939,27 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item
if (ReuseTime)
TrySkillProc(other, SkillArchery, ReuseTime);
else
TrySkillProc(other, SkillArchery, 0, true, 11);
TrySkillProc(other, SkillArchery, 0, true, MainRange);
}
}
//try proc on hits and misses
if((RangeWeapon != nullptr) && GetTarget() && other && !other->HasDied())
{
TryWeaponProc(RangeWeapon, other, 11);
TryWeaponProc(RangeWeapon, other, MainRange);
}
//Arrow procs because why not?
if((Ammo != NULL) && GetTarget() && other && !other->HasDied())
{
TryWeaponProc(Ammo, other, 11);
TryWeaponProc(Ammo, other, MainRange);
}
if (HasSkillProcs() && GetTarget() && other && !other->HasDied()){
if (ReuseTime)
TrySkillProc(other, SkillArchery, ReuseTime);
else
TrySkillProc(other, SkillArchery, 0, false, 11);
TrySkillProc(other, SkillArchery, 0, false, MainRange);
}
}
@ -1028,7 +1028,7 @@ void NPC::RangedAttack(Mob* other)
FaceTarget(other);
if (!other->CheckHitChance(this, skillinuse, 11, GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2)))
if (!other->CheckHitChance(this, skillinuse, MainRange, GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2)))
{
mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName());
other->Damage(this, 0, SPELL_UNKNOWN, skillinuse);
@ -1069,15 +1069,15 @@ void NPC::RangedAttack(Mob* other)
other->Damage(this, TotalDmg, SPELL_UNKNOWN, skillinuse);
if (TotalDmg > 0 && HasSkillProcSuccess() && GetTarget() && !other->HasDied())
TrySkillProc(other, skillinuse, 0, true, 11);
TrySkillProc(other, skillinuse, 0, true, MainRange);
}
//try proc on hits and misses
if(other && !other->HasDied())
TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, 11);
TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, MainRange);
if (HasSkillProcs() && other && !other->HasDied())
TrySkillProc(other, skillinuse, 0, false, 11);
TrySkillProc(other, skillinuse, 0, false, MainRange);
CommonBreakInvisible();
}
@ -1200,7 +1200,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite
if (!CanDoSpecialAttack(other))
return;
if (!other->CheckHitChance(this, SkillThrowing, 13, chance_mod)){
if (!other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){
mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName());
other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing);
} else {
@ -1251,18 +1251,18 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite
if (ReuseTime)
TrySkillProc(other, SkillThrowing, ReuseTime);
else
TrySkillProc(other, SkillThrowing, 0, true, 11);
TrySkillProc(other, SkillThrowing, 0, true, MainRange);
}
}
if((RangeWeapon != nullptr) && GetTarget() && other && (other->GetHP() > -10))
TryWeaponProc(RangeWeapon, other, 11);
TryWeaponProc(RangeWeapon, other, MainRange);
if (HasSkillProcs() && GetTarget() && other && !other->HasDied()){
if (ReuseTime)
TrySkillProc(other, SkillThrowing, ReuseTime);
else
TrySkillProc(other, SkillThrowing, 0, false, 11);
TrySkillProc(other, SkillThrowing, 0, false, MainRange);
}
}
@ -1987,7 +1987,7 @@ uint32 Mob::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) {
if(HeadShot_Dmg && HeadShot_Level && (defender->GetLevel() <= HeadShot_Level)){
float ProcChance = GetSpecialProcChances(11);
float ProcChance = GetSpecialProcChances(MainRange);
if(ProcChance > MakeRandomFloat(0,1))
return HeadShot_Dmg;
}
@ -2050,7 +2050,7 @@ uint32 Mob::TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 Reuse
float ProcChance = 0.0f;
if (skillInUse == SkillThrowing)
ProcChance = GetSpecialProcChances(11);
ProcChance = GetSpecialProcChances(MainRange);
else
ProcChance = GetAssassinateProcChances(ReuseTime);
@ -2099,7 +2099,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes
int damage = 0;
int32 hate = 0;
int Hand = 13;
int Hand = MainPrimary;
if (hate == 0 && weapon_damage > 1) hate = weapon_damage;
if(weapon_damage > 0){

View File

@ -1427,9 +1427,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
SendAppearancePacket(AT_Size, 6);
}
}
for(int x = 0; x < 7; x++){
for(int x = EmuConstants::MATERIAL_BEGIN; x <= EmuConstants::MATERIAL_TINT_END; x++)
SendWearChange(x);
}
if(caster && (caster->spellbonuses.IllusionPersistence || caster->aabonuses.IllusionPersistence
|| caster->itembonuses.IllusionPersistence))
buffs[buffslot].persistant_buff = 1;
@ -1451,9 +1452,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
caster->GetTarget()->GetTexture()
);
caster->SendAppearancePacket(AT_Size, caster->GetTarget()->GetSize());
for(int x = 0; x < 7; x++){
for(int x = EmuConstants::MATERIAL_BEGIN; x <= EmuConstants::MATERIAL_TINT_END; x++)
caster->SendWearChange(x);
}
}
}
@ -2200,7 +2201,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
snprintf(effect_desc, _EDLEN, "Rampage");
#endif
if(caster)
entity_list.AEAttack(caster, 30, 13, 0, true); // on live wars dont get a duration ramp, its a one shot deal
entity_list.AEAttack(caster, 30, MainPrimary, 0, true); // on live wars dont get a duration ramp, its a one shot deal
break;
}
@ -3724,7 +3725,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
else{
SendAppearancePacket(AT_Size, 6);
}
for(int x = 0; x < 7; x++){
for(int x = EmuConstants::MATERIAL_BEGIN; x <= EmuConstants::MATERIAL_TINT_END; x++){
SendWearChange(x);
}
break;
@ -5047,7 +5048,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
const Item_Struct* TempItem = 0;
for(int x=0; x<=21; x++)
for(int x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::EQUIPMENT_END; x++)
{
if (SympatheticProcList.size() > MAX_SYMPATHETIC)
continue;
@ -5070,7 +5071,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
}
}
for (int y = 0; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
for (int y = AUG_BEGIN; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
{
if (SympatheticProcList.size() > MAX_SYMPATHETIC)
continue;
@ -5192,7 +5193,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) {
int16 focus_max_real = 0;
//item focus
for(int x=0; x<=21; x++)
for(int x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::EQUIPMENT_END; x++)
{
TempItem = nullptr;
ItemInst* ins = GetInv().GetItem(x);
@ -5226,7 +5227,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) {
}
}
for (int y = 0; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
for (int y = AUG_BEGIN; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
{
ItemInst *aug = nullptr;
aug = ins->GetAugment(y);
@ -5264,7 +5265,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) {
}
//Tribute Focus
for(int x = TRIBUTE_SLOT_START; x < (TRIBUTE_SLOT_START + MAX_PLAYER_TRIBUTES); ++x)
for(int x = EmuConstants::TRIBUTE_BEGIN; x <= EmuConstants::TRIBUTE_END; ++x)
{
TempItem = nullptr;
ItemInst* ins = GetInv().GetItem(x);

View File

@ -1833,7 +1833,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
}
// check line of sight to target if it's a detrimental spell
if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional)
if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional)
{
mlog(SPELLS__CASTING, "Spell %d: cannot see target %s", spell_target->GetName());
Message_StringID(13,CANT_SEE_TARGET);

View File

@ -68,7 +68,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
// Verify that no more than two items are in container to guarantee no inadvertant wipes.
uint8 itemsFound = 0;
for (uint8 i=0; i<10; i++)
for (uint8 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; i++)
{
const ItemInst* inst = container->GetItem(i);
if (inst)
@ -212,7 +212,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
else
{
// Delete items in our inventory container...
for (uint8 i=0; i<10; i++)
for (uint8 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; i++)
{
const ItemInst* inst = container->GetItem(i);
if (inst)
@ -254,7 +254,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
uint32 some_id = 0;
bool worldcontainer=false;
if (in_combine->container_slot == SLOT_TRADESKILL) {
if (in_combine->container_slot == legacy::SLOT_TRADESKILL) {
if(!worldo) {
user->Message(13, "Error: Server is not aware of the tradeskill container you are attempting to use");
return;
@ -353,7 +353,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
safe_delete(outapp);
database.DeleteWorldContainer(worldo->m_id, zone->GetZoneID());
} else{
for (uint8 i=0; i<10; i++){
for (uint8 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; i++) {
const ItemInst* inst = container->GetItem(i);
if (inst) {
user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot,i),0,true);
@ -758,7 +758,7 @@ void Client::SendTradeskillDetails(uint32 recipe_id) {
uint32 *ffff_start = (uint32 *) startblock;
//fill in the FFFF's as if there were 0 items
for(r = 0; r < 10; r++) {
for(r = 0; r < 10; r++) { // world:item container size related?
*ffff_start = 0xFFFFFFFF;
ffff_start++;
}
@ -794,7 +794,7 @@ void Client::SendTradeskillDetails(uint32 recipe_id) {
icon = htonl(icon);
//if we get more than 10 items, just start skipping them...
for(k = 0; k < num && count < 10; k++) {
for(k = 0; k < num && count < 10; k++) { // world:item container size related?
itemptr = (uint32 *) cblock;
cblock += sizeof(uint32);
datalen += sizeof(uint32);
@ -1199,7 +1199,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
bool first = true;
uint8 i;
char *pos = buf2;
for (i=0; i<10; i++) {
for (i = 0; i < 10; i++) { // <watch> TODO: need to determine if this is bound to world/item container size
const ItemInst* inst = container->GetItem(i);
if (inst) {
const Item_Struct* item = GetItem(inst->GetItem()->ID);
@ -1334,7 +1334,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3
if (RunQuery(TSquery, MakeAnyLenString(&TSquery, "SELECT item_id, componentcount from tradeskill_recipe_entries where recipe_id=%i AND componentcount > 0", recipe_id), TSerrbuf, &TSresult)) {
while((TSrow = mysql_fetch_row(TSresult))!=nullptr) {
int ccnt = 0;
for(int x = 0; x < 10; x++){
for(int x = MAIN_BEGIN; x < EmuConstants::MAP_WORLD_SIZE; x++) {
const ItemInst* inst = container->GetItem(x);
if(inst){
const Item_Struct* item = GetItem(inst->GetItem()->ID);

View File

@ -146,13 +146,13 @@ void Trade::SendItemData(const ItemInst* inst, int16 dest_slot_id)
Client* with = mob->CastToClient();
Client* trader = owner->CastToClient();
if (with && with->IsClient()) {
with->SendItemPacket(dest_slot_id -IDX_TRADE,inst,ItemPacketTradeView);
with->SendItemPacket(dest_slot_id - EmuConstants::TRADE_BEGIN, inst, ItemPacketTradeView);
if (inst->GetItem()->ItemClass == 1) {
for (uint16 i=0; i<10; i++) {
for (uint16 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) {
uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i);
const ItemInst* bagitem = trader->GetInv().GetItem(bagslot_id);
if (bagitem) {
with->SendItemPacket(bagslot_id-IDX_TRADE,bagitem,ItemPacketTradeView);
with->SendItemPacket(bagslot_id - EmuConstants::TRADE_BEGIN, bagitem, ItemPacketTradeView);
}
}
}
@ -174,7 +174,7 @@ void Trade::LogTrade()
uint8 item_count = 0;
if (zone->tradevar != 0) {
for (uint16 i=3000; i<=3007; i++) {
for (uint16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++) {
if (trader->GetInv().GetItem(i))
item_count++;
}
@ -226,7 +226,7 @@ void Trade::LogTrade()
if (item_count > 0) {
strcat(logtext, "items {");
for (uint16 i=3000; i<=3007; i++) {
for (uint16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++) {
const ItemInst* inst = trader->GetInv().GetItem(i);
if (!comma)
@ -242,7 +242,7 @@ void Trade::LogTrade()
strcat(logtext, item_num);
if (inst->IsType(ItemClassContainer)) {
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
inst = trader->GetInv().GetItem(i, j);
if (inst) {
strcat(logtext, ",");
@ -278,7 +278,7 @@ void Trade::DumpTrade()
return;
Client* trader = owner->CastToClient();
for (uint16 i=3000; i<=3007; i++) {
for (uint16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++) {
const ItemInst* inst = trader->GetInv().GetItem(i);
if (inst) {
@ -287,7 +287,7 @@ void Trade::DumpTrade()
i, ((inst->IsType(ItemClassContainer)) ? "True" : "False"));
if (inst->IsType(ItemClassContainer)) {
for (uint8 j=0; j<10; j++) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
inst = trader->GetInv().GetItem(i, j);
if (inst) {
LogFile->write(EQEMuLog::Debug, "\tBagItem %i (Charges=%i, Slot=%i)",
@ -308,7 +308,7 @@ void Client::ResetTrade() {
ItemInst* ins;
int x;
AddMoneyToPP(trade->cp, trade->sp, trade->gp, trade->pp, true);
for(x=3000; x <= 3007; x++)
for(x = EmuConstants::TRADE_BEGIN; x <= EmuConstants::TRADE_END; x++)
{
TempItem = 0;
ins = GetInv().GetItem(x);
@ -355,7 +355,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
}
// Move each trade slot into free inventory slot
for(int16 i = 3000; i <= 3007; i++){
for(int16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++){
const ItemInst* inst = m_inv[i];
uint16 parent_offset = 0;
@ -385,7 +385,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
if(inst->IsType(ItemClassContainer)) {
// Pseudo-Slot ID's are generated based on how the db saves bag items...
for(uint8 j = 0; j < inst->GetItem()->BagSlots; j++) {
for(uint8 j = SUB_BEGIN; j < inst->GetItem()->BagSlots; j++) {
const ItemInst* baginst = inst->GetItem(j);
if(baginst == nullptr) { continue; }
@ -424,7 +424,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
qsaudit->items[parent_offset].to_slot = slot_id;
if(inst->IsType(ItemClassContainer)) {
for(uint8 bagslot_idx = 0; bagslot_idx < inst->GetItem()->BagSlots; bagslot_idx++) {
for(uint8 bagslot_idx = SUB_BEGIN; bagslot_idx < inst->GetItem()->BagSlots; bagslot_idx++) {
const ItemInst* bag_inst = inst->GetItem(bagslot_idx);
if(bag_inst == nullptr) { continue; }
@ -444,7 +444,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
qsaudit->items[parent_offset].to_slot = MainCursor;
if(inst->IsType(ItemClassContainer)) {
for(uint8 bagslot_idx = 0; bagslot_idx < inst->GetItem()->BagSlots; bagslot_idx++) {
for(uint8 bagslot_idx = SUB_BEGIN; bagslot_idx < inst->GetItem()->BagSlots; bagslot_idx++) {
const ItemInst* bag_inst = inst->GetItem(bagslot_idx);
if(bag_inst == nullptr) { continue; }
@ -468,7 +468,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
qsaudit->items[parent_offset].to_slot = MainCursor;
if(inst->IsType(ItemClassContainer)) {
for(uint8 bagslot_idx = 0; bagslot_idx < inst->GetItem()->BagSlots; bagslot_idx++) {
for(uint8 bagslot_idx = SUB_BEGIN; bagslot_idx < inst->GetItem()->BagSlots; bagslot_idx++) {
const ItemInst* bag_inst = inst->GetItem(bagslot_idx);
if(bag_inst == nullptr) { continue; }
@ -531,7 +531,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
}
if(QSPLH) { // This can be incoporated below when revisions are made -U
for(int16 slot_id = 3000; slot_id <= 3003; slot_id++) {
for(int16 slot_id = EmuConstants::TRADE_BEGIN; slot_id <= EmuConstants::TRADE_NPC_END; slot_id++) {
const ItemInst* trade_inst = m_inv[slot_id];
if(trade_inst) {
@ -547,7 +547,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
qsaudit->items[qsaudit->char_count++].aug_5 = trade_inst->GetAugmentItemID(5);
if(trade_inst->IsType(ItemClassContainer)) {
for(uint8 bag_idx = 0; bag_idx < trade_inst->GetItem()->BagSlots; bag_idx++) {
for(uint8 bag_idx = SUB_BEGIN; bag_idx < trade_inst->GetItem()->BagSlots; bag_idx++) {
const ItemInst* trade_baginst = trade_inst->GetItem(bag_idx);
if(trade_baginst) {
@ -576,10 +576,10 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
std::vector<void*> item_list;
uint32 items[4] = { 0 };
for(int i = 3000; i < 3004; ++i) {
for(int i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_NPC_END; ++i) {
ItemInst *inst = m_inv.GetItem(i);
if(inst) {
items[i - 3000] = inst->GetItem()->ID;
items[i - EmuConstants::TRADE_BEGIN] = inst->GetItem()->ID;
item_list.push_back(inst);
} else {
item_list.push_back(nullptr);
@ -592,7 +592,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
if(GetGM() || (item->NoDrop != 0 && inst->IsInstNoDrop() == false)) {
// pets need to look inside bags and try to equip items found there
if(item->ItemClass == ItemClassContainer && item->BagSlots > 0) {
for(int16 bslot=0; bslot < item->BagSlots; bslot++) {
for(int16 bslot = SUB_BEGIN; bslot < item->BagSlots; bslot++) {
const ItemInst* baginst = inst->GetItem(bslot);
if (baginst) {
const Item_Struct* bagitem = baginst->GetItem();
@ -646,8 +646,8 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
}
ItemInst *insts[4] = { 0 };
for(int i = 3000; i < 3004; ++i) {
insts[i - 3000] = m_inv.PopItem(i);
for(int i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_NPC_END; ++i) {
insts[i - EmuConstants::TRADE_BEGIN] = m_inv.PopItem(i);
database.SaveInventory(CharacterID(), nullptr, i);
}
@ -666,8 +666,7 @@ bool Client::CheckTradeLoreConflict(Client* other)
if (!other)
return true;
// Move each trade slot into free inventory slot
for (int16 i=3000; i<=3179; i++){
if(i == 3008) { i = 3100; }
for (int16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++){
const ItemInst* inst = m_inv[i];
if (inst && inst->GetItem()) {
@ -675,6 +674,16 @@ bool Client::CheckTradeLoreConflict(Client* other)
return true;
}
}
for (int16 i = EmuConstants::TRADE_BAGS_BEGIN; i <= EmuConstants::TRADE_BAGS_END; i++){
const ItemInst* inst = m_inv[i];
if (inst && inst->GetItem()) {
if (other->CheckLoreConflict(inst->GetItem()))
return true;
}
}
return false;
}
@ -873,7 +882,7 @@ void Client::SendSingleTraderItem(uint32 CharID, int SerialNumber) {
ItemInst* inst= database.LoadSingleTraderItem(CharID, SerialNumber);
if(inst) {
SendItemPacket(30, inst, ItemPacketMerchant);
SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?
safe_delete(inst);
}
@ -904,7 +913,7 @@ void Client::BulkSendTraderInventory(uint32 char_id) {
}
inst->SetPrice(TraderItems->ItemCost[i]);
SendItemPacket(30, inst, ItemPacketMerchant);
SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?
safe_delete(inst);
}
else
@ -920,11 +929,12 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){
ItemInst* item = nullptr;
uint16 SlotID = 0;
for(int i = 0; i < 8;i++){
item = this->GetInv().GetItem(22 + i);
for(int i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++){
item = this->GetInv().GetItem(i);
if(item && item->GetItem()->ID == 17899){ //Traders Satchel
for(int x = 0; x < 10; x++){
SlotID = (((22 + i + 3) * 10) + x + 1);
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++) {
// we already have the parent bag and a contents iterator..why not just iterate the bag!??
SlotID = Inventory::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID);
if(item) {
if(item->GetSerialNumber() == SerialNumber)
@ -950,11 +960,11 @@ GetItems_Struct* Client::GetTraderItems(){
uint8 ndx = 0;
for(int i = 0; i < 8; i++){
item = this->GetInv().GetItem(22 + i);
for(int i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
item = this->GetInv().GetItem(i);
if(item && item->GetItem()->ID == 17899){ //Traders Satchel
for(int x = 0; x < 10; x++){
SlotID = (((22 + i +3 ) *10) + x + 1);
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++) {
SlotID = Inventory::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID);
@ -974,11 +984,11 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){
const ItemInst* item= nullptr;
uint16 SlotID = 0;
for(int i = 0; i < 8;i++){
item = this->GetInv().GetItem(22+i);
for(int i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
item = this->GetInv().GetItem(i);
if(item && item->GetItem()->ID == 17899){ //Traders Satchel
for(int x = 0; x < 10; x++){
SlotID= (((22 + i + 3) * 10) + x + 1);
for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++){
SlotID = Inventory::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID);
@ -1713,7 +1723,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru
_log(TRADING__CLIENT, "Sending price update for %s, Serial No. %i with %i charges",
item->Name, gis->SerialNumber[i], gis->Charges[i]);
Customer->SendItemPacket(30, inst, ItemPacketMerchant);
Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?
}
}
@ -1789,7 +1799,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
_log(TRADING__CLIENT, "Sending price update for %s, Serial No. %i with %i charges",
item->Name, gis->SerialNumber[i], gis->Charges[i]);
Customer->SendItemPacket(30, inst, ItemPacketMerchant);
Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor??
}
safe_delete(inst);
}

View File

@ -66,7 +66,7 @@ void Client::ToggleTribute(bool enabled) {
int r;
uint32 cost = 0;
uint32 level = GetLevel();
for(r = 0; r < MAX_PLAYER_TRIBUTES; r++) {
for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) {
uint32 tid = m_pp.tributes[r].tribute;
if(tid == TRIBUTE_NONE)
continue;
@ -119,7 +119,7 @@ void Client::DoTributeUpdate() {
tis->tribute_master_id = tribute_master_id; //Dont know what this is for
int r;
for(r = 0; r < MAX_PLAYER_TRIBUTES; r++) {
for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) {
if(m_pp.tributes[r].tribute != TRIBUTE_NONE) {
tis->tributes[r] = m_pp.tributes[r].tribute;
tis->tiers[r] = m_pp.tributes[r].tier;
@ -134,24 +134,24 @@ void Client::DoTributeUpdate() {
if(m_pp.tribute_active) {
//send and equip tribute items...
for(r = 0; r < MAX_PLAYER_TRIBUTES; r++) {
for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) {
uint32 tid = m_pp.tributes[r].tribute;
if(tid == TRIBUTE_NONE) {
if(m_inv[TRIBUTE_SLOT_START+r])
DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false);
if(m_inv[EmuConstants::TRIBUTE_BEGIN + r])
DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false);
continue;
}
if(tribute_list.count(tid) != 1) {
if(m_inv[TRIBUTE_SLOT_START+r])
DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false);
if (m_inv[EmuConstants::TRIBUTE_BEGIN + r])
DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false);
continue;
}
//sanity check
if(m_pp.tributes[r].tier >= MAX_TRIBUTE_TIERS) {
if(m_inv[TRIBUTE_SLOT_START+r])
DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false);
if (m_inv[EmuConstants::TRIBUTE_BEGIN + r])
DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false);
m_pp.tributes[r].tier = 0;
continue;
}
@ -165,15 +165,15 @@ void Client::DoTributeUpdate() {
if(inst == nullptr)
continue;
PutItemInInventory(TRIBUTE_SLOT_START+r, *inst, false);
SendItemPacket(TRIBUTE_SLOT_START+r, inst, ItemPacketTributeItem);
PutItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, *inst, false);
SendItemPacket(EmuConstants::TRIBUTE_BEGIN + r, inst, ItemPacketTributeItem);
safe_delete(inst);
}
} else {
//unequip tribute items...
for(r = 0; r < MAX_PLAYER_TRIBUTES; r++) {
if(m_inv[TRIBUTE_SLOT_START+r])
DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false);
for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) {
if (m_inv[EmuConstants::TRIBUTE_BEGIN + r])
DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false);
}
}
CalcBonuses();
@ -192,7 +192,7 @@ void Client::SendTributeTimer() {
void Client::ChangeTributeSettings(TributeInfo_Struct *t) {
int r;
for(r = 0; r < MAX_PLAYER_TRIBUTES; r++) {
for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) {
m_pp.tributes[r].tribute = TRIBUTE_NONE;

View File

@ -518,7 +518,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container)
uint8 index = (uint8)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]);
@ -528,7 +528,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container)
ItemInst* inst = database.CreateItem(item_id, charges);
if (inst) {
if (inst->GetItem()->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(&database, i, aug[i]);
}
@ -564,13 +564,13 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It
//Delete all items from container
DeleteWorldContainer(parent_id,zone_id);
// Save all 10 items, if they exist
for (uint8 index=0; index<10; index++) {
for (uint8 index = SUB_BEGIN; index < EmuConstants::ITEM_CONTAINER_SIZE; index++) {
ItemInst* inst = container->GetItem(index);
if (inst) {
uint32 item_id = inst->GetItem()->ID;
uint32 augslot[5] = { 0, 0, 0, 0, 0 };
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
if (inst->IsType(ItemClassCommon)) {
for(int i=0;i<5;i++) {
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
ItemInst *auginst=inst->GetAugment(i);
augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0;
}
@ -978,7 +978,7 @@ bool ZoneDatabase::GetCharacterInfoForLogin_result(MYSQL_RES* result,
}
// Fix use_tint, previously it was set to 1 for a dyed slot, client wants it set to 0xFF
for(int i = 0; i<9; i++)
for(int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
if(pp->item_tint[i].rgb.use_tint == 1)
pp->item_tint[i].rgb.use_tint = 0xFF;
@ -1238,7 +1238,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
{
if ((at_row = mysql_fetch_row(at_result)))
{
for (i = 0; i < _MaterialCount; i++)
for (i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
{
tmpNPCType->armor_tint[i] = atoi(at_row[i * 3]) << 16;
tmpNPCType->armor_tint[i] |= atoi(at_row[i * 3 + 1]) << 8;
@ -1271,7 +1271,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
if (armor_tint_id == 0)
{
for (i = 1; i < _MaterialCount; i++)
for (i = MaterialChest; i <= EmuConstants::MATERIAL_END; i++)
{
tmpNPCType->armor_tint[i] = tmpNPCType->armor_tint[0];
}
@ -1551,7 +1551,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
{
if ((at_row = mysql_fetch_row(at_result)))
{
for (i = 0; i < _MaterialCount; i++)
for (i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
{
tmpNPCType->armor_tint[i] = atoi(at_row[i * 3]) << 16;
tmpNPCType->armor_tint[i] |= atoi(at_row[i * 3 + 1]) << 8;
@ -1584,7 +1584,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
if (armor_tint_id == 0)
{
for (i = 1; i < _MaterialCount; i++)
for (i = MaterialChest; i <= EmuConstants::MATERIAL_END; i++)
{
tmpNPCType->armor_tint[i] = tmpNPCType->armor_tint[0];
}
@ -2774,7 +2774,7 @@ void ZoneDatabase::SavePetInfo(Client *c) {
}
}
for (i = 0; i<EmuConstants::EQUIPMENT_SIZE; i++) {
for (i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) {
if(petinfo->Items[i]) {
database.RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO `character_pet_inventory` (`char_id`, `pet`, `slot`, `item_id`) values (%u, 0, %u, %u)",
@ -2798,7 +2798,7 @@ void ZoneDatabase::SavePetInfo(Client *c) {
}
safe_delete_array(query);
for (i = 0; i<EmuConstants::EQUIPMENT_SIZE; i++) {
for (i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) {
if(suspended->Items[i]) {
database.RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO `character_pet_inventory` (`char_id`, `pet`, `slot`, `item_id`) values (%u, 1, %u, %u)",
@ -2931,7 +2931,7 @@ void ZoneDatabase::LoadPetInfo(Client *c) {
continue;
int slot = atoi(row[1]);
if (slot < 0 || slot > EmuConstants::EQUIPMENT_SIZE) // if (slot == 22) { zone.TriggerRandomCrash(); }
if (slot < EmuConstants::EQUIPMENT_BEGIN || slot > EmuConstants::EQUIPMENT_END)
continue;
pi->Items[slot] = atoul(row[2]);