mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Merge branch 'master' into shared_tasks
This commit is contained in:
+20
-3
@@ -2111,10 +2111,27 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
||||
}
|
||||
}
|
||||
|
||||
void Database::ClearInvSnapshots(bool use_rule)
|
||||
{
|
||||
int Database::CountInvSnapshots() {
|
||||
std::string query = StringFormat("SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b");
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return -1;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
int64 count = atoll(row[0]);
|
||||
if (count > 2147483647)
|
||||
return -2;
|
||||
if (count < 0)
|
||||
return -3;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void Database::ClearInvSnapshots(bool from_now) {
|
||||
uint32 del_time = time(nullptr);
|
||||
if (use_rule) { del_time -= RuleI(Character, InvSnapshotHistoryD) * 86400; }
|
||||
if (!from_now) { del_time -= RuleI(Character, InvSnapshotHistoryD) * 86400; }
|
||||
|
||||
std::string query = StringFormat("DELETE FROM inventory_snapshots WHERE time_index <= %lu", (unsigned long)del_time);
|
||||
QueryDatabase(query);
|
||||
|
||||
+2
-1
@@ -264,7 +264,8 @@ public:
|
||||
void SetLFP(uint32 CharID, bool LFP);
|
||||
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
|
||||
|
||||
void ClearInvSnapshots(bool use_rule = true);
|
||||
int CountInvSnapshots();
|
||||
void ClearInvSnapshots(bool from_now = false);
|
||||
|
||||
/* EQEmuLogSys */
|
||||
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||
|
||||
+18
-16
@@ -78,28 +78,30 @@ namespace EQEmu
|
||||
} // namespace invtype
|
||||
|
||||
namespace invslot {
|
||||
using namespace Titanium::invslot::enum_;
|
||||
|
||||
const int16 SLOT_POWER_SOURCE = 9999;
|
||||
using namespace RoF2::invslot::enum_;
|
||||
|
||||
using RoF2::invslot::SLOT_INVALID;
|
||||
using RoF2::invslot::SLOT_BEGIN;
|
||||
|
||||
using Titanium::invslot::POSSESSIONS_BEGIN;
|
||||
using Titanium::invslot::POSSESSIONS_END;
|
||||
using SoF::invslot::POSSESSIONS_COUNT;
|
||||
using Titanium::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
||||
|
||||
using Titanium::invslot::EQUIPMENT_BEGIN;
|
||||
using Titanium::invslot::EQUIPMENT_END;
|
||||
using Titanium::invslot::EQUIPMENT_COUNT;
|
||||
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
||||
|
||||
using Titanium::invslot::GENERAL_BEGIN;
|
||||
using Titanium::invslot::GENERAL_END;
|
||||
using Titanium::invslot::GENERAL_COUNT;
|
||||
using RoF2::invslot::POSSESSIONS_BEGIN;
|
||||
using RoF2::invslot::POSSESSIONS_END;
|
||||
using RoF2::invslot::POSSESSIONS_COUNT;
|
||||
|
||||
using Titanium::invslot::BONUS_BEGIN;
|
||||
using Titanium::invslot::BONUS_STAT_END;
|
||||
using Titanium::invslot::BONUS_SKILL_END;
|
||||
using RoF2::invslot::EQUIPMENT_BEGIN;
|
||||
using RoF2::invslot::EQUIPMENT_END;
|
||||
using RoF2::invslot::EQUIPMENT_COUNT;
|
||||
|
||||
using RoF2::invslot::GENERAL_BEGIN;
|
||||
using RoF2::invslot::GENERAL_END;
|
||||
using RoF2::invslot::GENERAL_COUNT;
|
||||
|
||||
using RoF2::invslot::BONUS_BEGIN;
|
||||
using RoF2::invslot::BONUS_STAT_END;
|
||||
using RoF2::invslot::BONUS_SKILL_END;
|
||||
|
||||
using Titanium::invslot::BANK_BEGIN;
|
||||
using SoF::invslot::BANK_END;
|
||||
@@ -145,7 +147,7 @@ namespace EQEmu
|
||||
const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT;
|
||||
const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1;
|
||||
|
||||
const int16 CURSOR_BAG_BEGIN = 331;
|
||||
const int16 CURSOR_BAG_BEGIN = 351;
|
||||
const int16 CURSOR_BAG_COUNT = SLOT_COUNT;
|
||||
const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1;
|
||||
|
||||
|
||||
@@ -523,18 +523,4 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
|
||||
|
||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace legacy {
|
||||
enum InventorySlot {
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001,
|
||||
//SLOT_INVALID = (int16)0xFFFF,
|
||||
};
|
||||
|
||||
} // namespace legacy
|
||||
|
||||
}
|
||||
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
|
||||
+2
-1
@@ -268,7 +268,8 @@ enum {
|
||||
commandBanPlayers = 100, //can set bans on players
|
||||
commandChangeDatarate = 201, //edit client's data rate
|
||||
commandZoneToCoords = 0, //can #zone with coords
|
||||
commandInterrogateInv = 100 //below this == only log on error state and self-only target dump
|
||||
commandInterrogateInv = 100, //below this == only log on error state and self-only target dump
|
||||
commandInvSnapshot = 150 //ability to clear/restore snapshots
|
||||
};
|
||||
|
||||
//default states for logging flag on NPCs and clients (having NPCs on by default is prolly a bad idea)
|
||||
|
||||
+241
-70
@@ -177,7 +177,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
|
||||
result = _GetItem(m_inv, slot_id);
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) ||
|
||||
(slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
(slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END)) {
|
||||
// Equippable slots (on body)
|
||||
result = _GetItem(m_worn, slot_id);
|
||||
}
|
||||
@@ -231,6 +231,25 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id, uint8 bagid
|
||||
// Put an item snto specified slot
|
||||
int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
||||
{
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
// Clean up item already in slot (if exists)
|
||||
DeleteItem(slot_id);
|
||||
|
||||
@@ -244,80 +263,139 @@ int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
||||
return _PutItem(slot_id, inst.Clone());
|
||||
}
|
||||
|
||||
int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance& inst)
|
||||
{
|
||||
int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance &inst) {
|
||||
m_cursor.push(inst.Clone());
|
||||
return invslot::slotCursor;
|
||||
}
|
||||
|
||||
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem()
|
||||
{
|
||||
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() {
|
||||
return m_cursor.peek_front();
|
||||
}
|
||||
|
||||
// Swap items in inventory
|
||||
bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailState& fail_state, uint16 race_id, uint8 class_id, uint16 deity_id, uint8 level)
|
||||
{
|
||||
bool EQEmu::InventoryProfile::SwapItem(
|
||||
int16 source_slot,
|
||||
int16 destination_slot,
|
||||
SwapItemFailState &fail_state,
|
||||
uint16 race_id,
|
||||
uint8 class_id,
|
||||
uint16 deity_id,
|
||||
uint8 level
|
||||
) {
|
||||
fail_state = swapInvalid;
|
||||
|
||||
// Temp holding areas for a and b
|
||||
ItemInstance* inst_a = GetItem(slot_a);
|
||||
ItemInstance* inst_b = GetItem(slot_b);
|
||||
|
||||
if (inst_a) {
|
||||
if (!inst_a->IsSlotAllowed(slot_b)) {
|
||||
if (source_slot <= EQEmu::invslot::POSSESSIONS_END && source_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64) 1 << source_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END) || slot_b == invslot::SLOT_POWER_SOURCE) {
|
||||
auto item_a = inst_a->GetItem();
|
||||
if (!item_a) {
|
||||
}
|
||||
else if (source_slot <= EQEmu::invbag::GENERAL_BAGS_END && source_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((source_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (source_slot <= EQEmu::invslot::BANK_END && source_slot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((source_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (source_slot <= EQEmu::invbag::BANK_BAGS_END && source_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (source_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (destination_slot <= EQEmu::invslot::POSSESSIONS_END && destination_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << destination_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (destination_slot <= EQEmu::invbag::GENERAL_BAGS_END && destination_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((destination_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (destination_slot <= EQEmu::invslot::BANK_END && destination_slot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((destination_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (destination_slot <= EQEmu::invbag::BANK_BAGS_END && destination_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (destination_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Temp holding areas for source and destination
|
||||
ItemInstance *source_item_instance = GetItem(source_slot);
|
||||
ItemInstance *destination_item_instance = GetItem(destination_slot);
|
||||
|
||||
if (source_item_instance) {
|
||||
if (!source_item_instance->IsSlotAllowed(destination_slot)) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((destination_slot >= invslot::EQUIPMENT_BEGIN && destination_slot <= invslot::EQUIPMENT_END)) {
|
||||
auto source_item = source_item_instance->GetItem();
|
||||
if (!source_item) {
|
||||
fail_state = swapNullData;
|
||||
return false;
|
||||
}
|
||||
if (race_id && class_id && !item_a->IsEquipable(race_id, class_id)) {
|
||||
if (race_id && class_id && !source_item->IsEquipable(race_id, class_id)) {
|
||||
fail_state = swapRaceClass;
|
||||
return false;
|
||||
}
|
||||
if (deity_id && item_a->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & item_a->Deity)) {
|
||||
if (deity_id && source_item->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & source_item->Deity)) {
|
||||
fail_state = swapDeity;
|
||||
return false;
|
||||
}
|
||||
if (level && item_a->ReqLevel && level < item_a->ReqLevel) {
|
||||
if (level && source_item->ReqLevel && level < source_item->ReqLevel) {
|
||||
fail_state = swapLevel;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inst_b) {
|
||||
if (!inst_b->IsSlotAllowed(slot_a)) {
|
||||
if (destination_item_instance) {
|
||||
if (!destination_item_instance->IsSlotAllowed(source_slot)) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END) || slot_a == invslot::SLOT_POWER_SOURCE) {
|
||||
auto item_b = inst_b->GetItem();
|
||||
if (!item_b) {
|
||||
if ((source_slot >= invslot::EQUIPMENT_BEGIN && source_slot <= invslot::EQUIPMENT_END)) {
|
||||
auto destination_item = destination_item_instance->GetItem();
|
||||
if (!destination_item) {
|
||||
fail_state = swapNullData;
|
||||
return false;
|
||||
}
|
||||
if (race_id && class_id && !item_b->IsEquipable(race_id, class_id)) {
|
||||
if (race_id && class_id && !destination_item->IsEquipable(race_id, class_id)) {
|
||||
fail_state = swapRaceClass;
|
||||
return false;
|
||||
}
|
||||
if (deity_id && item_b->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & item_b->Deity)) {
|
||||
if (deity_id && destination_item->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & destination_item->Deity)) {
|
||||
fail_state = swapDeity;
|
||||
return false;
|
||||
}
|
||||
if (level && item_b->ReqLevel && level < item_b->ReqLevel) {
|
||||
if (level && destination_item->ReqLevel && level < destination_item->ReqLevel) {
|
||||
fail_state = swapLevel;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_PutItem(slot_a, inst_b); // Assign b->a
|
||||
_PutItem(slot_b, inst_a); // Assign a->b
|
||||
_PutItem(source_slot, destination_item_instance); // Assign destination -> source
|
||||
_PutItem(destination_slot, source_item_instance); // Assign source -> destination
|
||||
|
||||
fail_state = swapPass;
|
||||
|
||||
@@ -325,10 +403,9 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
}
|
||||
|
||||
// Remove item from inventory (with memory delete)
|
||||
bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity)
|
||||
{
|
||||
bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
|
||||
// Pop item out of inventory map (or queue)
|
||||
ItemInstance* item_to_delete = PopItem(slot_id);
|
||||
ItemInstance *item_to_delete = PopItem(slot_id);
|
||||
|
||||
// Determine if object should be fully deleted, or
|
||||
// just a quantity of charges of the item can be deleted
|
||||
@@ -342,7 +419,7 @@ bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity)
|
||||
// the item is not stackable, and is not a charged item, or is expendable, delete it
|
||||
if (item_to_delete->IsStackable() ||
|
||||
(!item_to_delete->IsStackable() &&
|
||||
((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))
|
||||
((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))
|
||||
) {
|
||||
// Item can now be destroyed
|
||||
InventoryProfile::MarkDirty(item_to_delete);
|
||||
@@ -379,11 +456,11 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
|
||||
if (slot_id == invslot::slotCursor) {
|
||||
p = m_cursor.pop();
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
p = m_worn[slot_id];
|
||||
m_worn.erase(slot_id);
|
||||
}
|
||||
else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) {
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
p = m_inv[slot_id];
|
||||
m_inv.erase(slot_id);
|
||||
}
|
||||
@@ -420,6 +497,8 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
if (ItemToTry->Stackable) {
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
ItemInstance* InvItem = GetItem(i);
|
||||
|
||||
@@ -457,6 +536,8 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
}
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
ItemInstance* InvItem = GetItem(i);
|
||||
|
||||
@@ -483,7 +564,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
|
||||
uint8 BagSize = InvItem->GetItem()->BagSlots;
|
||||
|
||||
for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot<BagSize; BagSlot++) {
|
||||
for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot < BagSize; BagSlot++) {
|
||||
|
||||
InvItem = GetItem(BaseSlotID + BagSlot);
|
||||
|
||||
@@ -663,6 +744,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
|
||||
{
|
||||
// Check basic inventory
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
if (!GetItem(i))
|
||||
// Found available slot in personal inventory
|
||||
return i;
|
||||
@@ -670,6 +754,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
|
||||
|
||||
if (!for_bag) {
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* inst = GetItem(i);
|
||||
if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size)
|
||||
{
|
||||
@@ -720,6 +807,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 1: find room for bags (caller should really ask for slots for bags first to avoid sending them to cursor..and bag item loss)
|
||||
if (inst->IsClassBag()) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
if (!m_inv[free_slot])
|
||||
return free_slot;
|
||||
}
|
||||
@@ -730,6 +820,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 2: find partial room for stackables
|
||||
if (inst->IsStackable()) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -740,6 +833,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
}
|
||||
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -763,6 +859,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 3a: find room for container-specific items (ItemClassArrow)
|
||||
if (inst->GetItem()->ItemType == item::ItemTypeArrow) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeQuiver) || !main_inst->IsClassBag())
|
||||
@@ -779,6 +878,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 3b: find room for container-specific items (ItemClassSmallThrowing)
|
||||
if (inst->GetItem()->ItemType == item::ItemTypeSmallThrowing) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeBandolier) || !main_inst->IsClassBag())
|
||||
@@ -794,6 +896,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
|
||||
// step 4: just find an empty slot
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -801,6 +906,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
}
|
||||
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (main_inst && main_inst->IsClassBag()) {
|
||||
@@ -977,12 +1085,13 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c
|
||||
bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
{
|
||||
// there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range
|
||||
if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE)
|
||||
{
|
||||
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END)
|
||||
{
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
if (inventory::Lookup(m_mob_version)->AllowClickCastFromBag)
|
||||
return true;
|
||||
}
|
||||
@@ -992,8 +1101,16 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
|
||||
bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
|
||||
{
|
||||
if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE || (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END))
|
||||
// does this have the same criteria as 'SupportsClickCasting' above? (bag clicking per client)
|
||||
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1006,7 +1123,7 @@ bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
|
||||
(slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) ||
|
||||
(slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) ||
|
||||
(slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END)
|
||||
) {
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1054,13 +1171,19 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
|
||||
uint8 brightest_light_type = 0;
|
||||
|
||||
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
|
||||
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END) && iter->first != invslot::SLOT_POWER_SOURCE) { continue; }
|
||||
if (iter->first == invslot::slotAmmo) { continue; }
|
||||
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END))
|
||||
continue;
|
||||
|
||||
if (iter->first == invslot::slotAmmo)
|
||||
continue;
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
|
||||
if (lightsource::IsLevelGreater(item->Light, brightest_light_type))
|
||||
brightest_light_type = item->Light;
|
||||
@@ -1068,15 +1191,21 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
|
||||
|
||||
uint8 general_light_type = 0;
|
||||
for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) {
|
||||
if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END) { continue; }
|
||||
if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END)
|
||||
continue;
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
|
||||
if (!item->IsClassCommon()) { continue; }
|
||||
if (item->Light < 9 || item->Light > 13) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
|
||||
if (!item->IsClassCommon())
|
||||
continue;
|
||||
if (item->Light < 9 || item->Light > 13)
|
||||
continue;
|
||||
|
||||
if (lightsource::TypeToLevel(item->Light))
|
||||
general_light_type = item->Light;
|
||||
@@ -1136,7 +1265,7 @@ int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map<int16, I
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
void EQEmu::InventoryProfile::dumpItemCollection(const std::map<int16, ItemInstance*> &collection)
|
||||
@@ -1174,6 +1303,15 @@ void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16
|
||||
// Internal Method: Retrieves item within an inventory bucket
|
||||
EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const
|
||||
{
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
|
||||
return nullptr;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (slot_id - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto it = bucket.find(slot_id);
|
||||
if (it != bucket.end()) {
|
||||
return it->second;
|
||||
@@ -1205,21 +1343,27 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
|
||||
m_cursor.push_front(inst);
|
||||
result = slot_id;
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if (slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
if (slot_id - EQEmu::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) {
|
||||
m_shbank[slot_id] = inst;
|
||||
@@ -1254,6 +1398,15 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
|
||||
uint32 quantity_found = 0;
|
||||
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1265,7 +1418,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
|
||||
|
||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
||||
if (inst->GetAugmentItemID(index) == item_id && quantity <= 1)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
|
||||
if (!inst->IsClassBag()) { continue; }
|
||||
@@ -1282,7 +1435,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
|
||||
|
||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
||||
if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1313,7 +1466,7 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u
|
||||
|
||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
||||
if (inst->GetAugmentItemID(index) == item_id && quantity <= 1)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
|
||||
if (!inst->IsClassBag()) { continue; }
|
||||
@@ -1330,7 +1483,7 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u
|
||||
|
||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
||||
if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1347,6 +1500,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& buc
|
||||
uint32 quantity_found = 0;
|
||||
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1411,6 +1573,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u
|
||||
int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup)
|
||||
{
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1422,7 +1593,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*
|
||||
if (aug_inst == nullptr) { continue; }
|
||||
|
||||
if (aug_inst->GetItem()->LoreGroup == loregroup)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
|
||||
if (!inst->IsClassBag()) { continue; }
|
||||
@@ -1439,12 +1610,12 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*
|
||||
if (aug_inst == nullptr) { continue; }
|
||||
|
||||
if (aug_inst->GetItem()->LoreGroup == loregroup)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
// Internal Method: Checks an inventory queue type bucket for a particular item
|
||||
@@ -1462,7 +1633,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
|
||||
if (aug_inst == nullptr) { continue; }
|
||||
|
||||
if (aug_inst->GetItem()->LoreGroup == loregroup)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
|
||||
if (!inst->IsClassBag()) { continue; }
|
||||
@@ -1479,7 +1650,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
|
||||
if (aug_inst == nullptr) { continue; }
|
||||
|
||||
if (aug_inst->GetItem()->LoreGroup == loregroup)
|
||||
return legacy::SLOT_AUGMENT;
|
||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1487,5 +1658,5 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
|
||||
break;
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace EQEmu
|
||||
|
||||
// Swap items in inventory
|
||||
enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel };
|
||||
bool SwapItem(int16 slot_a, int16 slot_b, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
|
||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
|
||||
|
||||
// Remove item from inventory
|
||||
bool DeleteItem(int16 slot_id, uint8 quantity = 0);
|
||||
|
||||
@@ -110,9 +110,7 @@ bool EQEmu::InventorySlot::IsDeleteSlot() const
|
||||
|
||||
bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
|
||||
{
|
||||
/*if (slot_index < inventory::EquipmentBegin || slot_index > inventory::EquipmentEnd)
|
||||
return false;*/
|
||||
if ((slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END) && slot_index != invslot::SLOT_POWER_SOURCE)
|
||||
if (slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -120,8 +118,6 @@ bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
|
||||
|
||||
bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
|
||||
{
|
||||
/*if (slot_index < inventory::GeneralBegin || slot_index > inventory::GeneralEnd)
|
||||
return false;*/
|
||||
if (slot_index < invslot::GENERAL_BEGIN || slot_index > invslot::GENERAL_END)
|
||||
return false;
|
||||
|
||||
@@ -130,22 +126,18 @@ bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
|
||||
|
||||
bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
|
||||
{
|
||||
/*if (slot_index != inventory::slotCursor)
|
||||
return false;*/
|
||||
if (slot_index != invslot::slotCursor)
|
||||
return false;
|
||||
if (slot_index == invslot::slotCursor)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index)
|
||||
{
|
||||
/*if ((slot_index != inventory::slotRange) && (slot_index != inventory::slotPrimary) && (slot_index != inventory::slotSecondary))
|
||||
return false;*/
|
||||
if ((slot_index != invslot::slotRange) && (slot_index != invslot::slotPrimary) && (slot_index != invslot::slotSecondary))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
if (slot_index == invslot::slotPrimary || slot_index == invslot::slotSecondary || slot_index == invslot::slotRange)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
|
||||
|
||||
@@ -271,17 +271,10 @@ bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const
|
||||
if (!m_item)
|
||||
return false;
|
||||
|
||||
// another "shouldn't do" fix..will be fixed in future updates (requires code and database work)
|
||||
int16 use_slot = INVALID_INDEX;
|
||||
if (slot_id == invslot::SLOT_POWER_SOURCE) { use_slot = invslot::slotGeneral1; }
|
||||
if ((uint16)slot_id <= invslot::EQUIPMENT_END) { use_slot = slot_id; }
|
||||
if (slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END)
|
||||
return false;
|
||||
|
||||
if (use_slot != INVALID_INDEX) {
|
||||
if (m_item->Slots & (1 << use_slot))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ((m_item->Slots & (1 << slot_id)) != 0);
|
||||
}
|
||||
|
||||
bool EQEmu::ItemInstance::IsAugmentable() const
|
||||
@@ -298,20 +291,18 @@ bool EQEmu::ItemInstance::IsAugmentable() const
|
||||
}
|
||||
|
||||
bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
|
||||
// TODO: check to see if incoming 'aug_wear_slots' "switches" bit assignments like above...
|
||||
// (if wrong, would only affect MainAmmo and MainPowerSource augments)
|
||||
if (!m_item || !m_item->IsClassCommon())
|
||||
return false;
|
||||
|
||||
int index = invslot::EQUIPMENT_BEGIN;
|
||||
for (; index <= invslot::slotGeneral1; ++index) { // MainGeneral1 should be legacy::EQUIPMENT_END
|
||||
for (; index <= invslot::EQUIPMENT_END; ++index) {
|
||||
if (m_item->Slots & (1 << index)) {
|
||||
if (aug_wear_slots & (1 << index))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (index < 23) ? true : false;
|
||||
return (index <= EQEmu::invslot::EQUIPMENT_END);
|
||||
}
|
||||
|
||||
int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
|
||||
@@ -810,12 +801,10 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::Clone() const
|
||||
}
|
||||
|
||||
bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const {
|
||||
// 'SupportsContainers' and 'slot_id > 21' previously saw the reassigned PowerSource slot (9999 to 22) as valid
|
||||
if (!m_item) { return false; }
|
||||
else if (InventoryProfile::SupportsContainers(slot_id)) { return true; }
|
||||
else if (m_item->Slots & (1 << slot_id)) { return true; }
|
||||
else if (slot_id == invslot::SLOT_POWER_SOURCE && (m_item->Slots & (1 << 22))) { return true; } // got lazy... <watch>
|
||||
else if (slot_id != invslot::SLOT_POWER_SOURCE && slot_id > invslot::EQUIPMENT_END) { return true; }
|
||||
else if (slot_id > invslot::EQUIPMENT_END) { return true; } // why do we call 'InventoryProfile::SupportsContainers' with this here?
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
|
||||
+500
-296
File diff suppressed because it is too large
Load Diff
+475
-323
File diff suppressed because it is too large
Load Diff
+226
-93
@@ -46,18 +46,18 @@ namespace SoD
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline uint32 ServerToSoDSlot(uint32 ServerSlot);
|
||||
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot);
|
||||
static inline uint32 ServerToSoDSlot(uint32 server_slot);
|
||||
static inline uint32 ServerToSoDCorpseSlot(uint32 server_corpse_slot);
|
||||
|
||||
// client to server inventory location converters
|
||||
static inline uint32 SoDToServerSlot(uint32 sodSlot);
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot);
|
||||
static inline uint32 SoDToServerSlot(uint32 sod_slot);
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 sod_corpse_slot);
|
||||
|
||||
// server to client say link converter
|
||||
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink);
|
||||
static inline void ServerToSoDSayLink(std::string &sod_saylink, const std::string &server_saylink);
|
||||
|
||||
// client to server say link converter
|
||||
static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink);
|
||||
static inline void SoDToServerSayLink(std::string &server_saylink, const std::string &sod_saylink);
|
||||
|
||||
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot);
|
||||
@@ -400,7 +400,7 @@ namespace SoD
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoD::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -464,7 +464,12 @@ namespace SoD
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -1064,7 +1069,7 @@ namespace SoD
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoD::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -1125,6 +1130,8 @@ namespace SoD
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToSoDCorpseSlot(emu->slot_id);
|
||||
@@ -1286,6 +1293,8 @@ namespace SoD
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoDSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1524,7 +1533,7 @@ namespace SoD
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1533,7 +1542,7 @@ namespace SoD
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1545,13 +1554,13 @@ namespace SoD
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -3140,6 +3149,8 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = SoDToServerCorpseSlot(eq->slot_id);
|
||||
@@ -3153,7 +3164,7 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[SoD] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = SoDToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToServerSlot(eq->to_slot);
|
||||
@@ -3474,7 +3485,7 @@ namespace SoD
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -3737,94 +3748,216 @@ namespace SoD
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::slotGeneral8 && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::slotGeneral9)
|
||||
SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoDSlot(uint32 serverSlot)
|
||||
{
|
||||
uint32 SoDSlot = 0;
|
||||
uint32 SoDSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
SoDSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END)
|
||||
SoDSlot = serverSlot + 11;
|
||||
else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END)
|
||||
SoDSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END)
|
||||
SoDSlot = serverSlot + 1;
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
SoDSlot = invslot::slotPowerSource;
|
||||
else
|
||||
if (serverSlot <= EQEmu::invslot::slotGeneral8) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::CORPSE_END && serverSlot >= EQEmu::invslot::slotCursor) {
|
||||
SoDSlot = serverSlot - 2;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot + 11;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
SoDSlot = serverSlot - 9;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
SoDSlot = serverSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to SoD Slot %i", serverSlot, SoDSlot);
|
||||
|
||||
return SoDSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot)
|
||||
static inline uint32 ServerToSoDCorpseSlot(uint32 server_corpse_slot)
|
||||
{
|
||||
//uint32 SoDCorpse;
|
||||
return (serverCorpseSlot + 1);
|
||||
uint32 SoDSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (server_corpse_slot <= EQEmu::invslot::slotGeneral8 && server_corpse_slot >= EQEmu::invslot::slotGeneral1) {
|
||||
SoDSlot = server_corpse_slot;
|
||||
}
|
||||
|
||||
else if (server_corpse_slot <= EQEmu::invslot::CORPSE_END && server_corpse_slot >= EQEmu::invslot::slotCursor) {
|
||||
SoDSlot = server_corpse_slot - 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to SoD Corpse Slot %i", server_corpse_slot, SoDSlot);
|
||||
|
||||
return SoDSlot;
|
||||
}
|
||||
|
||||
static inline uint32 SoDToServerSlot(uint32 sodSlot)
|
||||
static inline uint32 SoDToServerSlot(uint32 sod_slot)
|
||||
{
|
||||
uint32 ServerSlot = 0;
|
||||
uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sodSlot >= invslot::slotAmmo && sodSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = sodSlot - 1;
|
||||
else if (sodSlot >= invbag::GENERAL_BAGS_BEGIN && sodSlot <= invbag::CURSOR_BAG_END)
|
||||
ServerSlot = sodSlot - 11;
|
||||
else if (sodSlot >= invbag::BANK_BAGS_BEGIN && sodSlot <= invbag::BANK_BAGS_END)
|
||||
ServerSlot = sodSlot - 1;
|
||||
else if (sodSlot >= invbag::SHARED_BANK_BAGS_BEGIN && sodSlot <= invbag::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = sodSlot - 1;
|
||||
else if (sodSlot == invslot::slotPowerSource)
|
||||
ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
else
|
||||
ServerSlot = sodSlot;
|
||||
return ServerSlot;
|
||||
if (sod_slot <= invslot::slotGeneral8) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::CORPSE_END && sod_slot >= invslot::slotCursor) {
|
||||
server_slot = sod_slot + 2;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invbag::GENERAL_BAGS_END && sod_slot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
server_slot = sod_slot - 11;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invbag::CURSOR_BAG_END && sod_slot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
server_slot = sod_slot + 9;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::TRIBUTE_END && sod_slot >= invslot::TRIBUTE_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::GUILD_TRIBUTE_END && sod_slot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot == invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::BANK_END && sod_slot >= invslot::BANK_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invbag::BANK_BAGS_END && sod_slot >= invbag::BANK_BAGS_BEGIN) {
|
||||
server_slot = sod_slot - 1;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::SHARED_BANK_END && sod_slot >= invslot::SHARED_BANK_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invbag::SHARED_BANK_BAGS_END && sod_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
server_slot = sod_slot - 1;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::TRADE_END && sod_slot >= invslot::TRADE_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invbag::TRADE_BAGS_END && sod_slot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
else if (sod_slot <= invslot::WORLD_END && sod_slot >= invslot::WORLD_BEGIN) {
|
||||
server_slot = sod_slot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoD Slot %i to Server Slot %i", sod_slot, server_slot);
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot)
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 sod_corpse_slot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return (sodCorpseSlot - 1);
|
||||
uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sod_corpse_slot <= invslot::slotGeneral8 && sod_corpse_slot >= invslot::slotGeneral1) {
|
||||
server_slot = sod_corpse_slot;
|
||||
}
|
||||
|
||||
else if (sod_corpse_slot <= invslot::CORPSE_END && sod_corpse_slot >= invslot::slotCursor) {
|
||||
server_slot = sod_corpse_slot + 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoD Corpse Slot %i to Server Corpse Slot %i", sod_corpse_slot, server_slot);
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
|
||||
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink)
|
||||
static inline void ServerToSoDSayLink(std::string &sod_saylink, const std::string &server_saylink)
|
||||
{
|
||||
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
sodSayLink = serverSayLink;
|
||||
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
|
||||
sod_saylink = server_saylink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
auto segments = SplitString(server_saylink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
|
||||
sodSayLink.append(segments[segment_iter]);
|
||||
sod_saylink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3834,37 +3967,37 @@ namespace SoD
|
||||
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
sodSayLink.push_back('\x12');
|
||||
sodSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
sodSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
sod_saylink.push_back('\x12');
|
||||
sod_saylink.append(segments[segment_iter].substr(0, 31));
|
||||
sod_saylink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
sodSayLink.push_back(segments[segment_iter][42]);
|
||||
sod_saylink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
sodSayLink.push_back('F');
|
||||
sod_saylink.push_back('F');
|
||||
|
||||
sodSayLink.append(segments[segment_iter].substr(43));
|
||||
sodSayLink.push_back('\x12');
|
||||
sod_saylink.append(segments[segment_iter].substr(43));
|
||||
sod_saylink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
sodSayLink.append(segments[segment_iter]);
|
||||
sod_saylink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink)
|
||||
static inline void SoDToServerSayLink(std::string &server_saylink, const std::string &sod_saylink)
|
||||
{
|
||||
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sodSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = sodSayLink;
|
||||
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sod_saylink.find('\x12') == std::string::npos)) {
|
||||
server_saylink = sod_saylink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(sodSayLink, '\x12');
|
||||
auto segments = SplitString(sod_saylink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
server_saylink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3874,16 +4007,16 @@ namespace SoD
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.append(segments[segment_iter].substr(36));
|
||||
serverSayLink.push_back('\x12');
|
||||
server_saylink.push_back('\x12');
|
||||
server_saylink.append(segments[segment_iter].substr(0, 31));
|
||||
server_saylink.append("00000");
|
||||
server_saylink.append(segments[segment_iter].substr(31, 5));
|
||||
server_saylink.push_back('0');
|
||||
server_saylink.append(segments[segment_iter].substr(36));
|
||||
server_saylink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
server_saylink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ namespace SoD
|
||||
const int16 SLOT_INVALID = IINVALID;
|
||||
const int16 SLOT_BEGIN = INULL;
|
||||
|
||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||
|
||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||
const int16 POSSESSIONS_END = slotCursor;
|
||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||
|
||||
+302
-168
@@ -46,21 +46,21 @@ namespace SoF
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline uint32 ServerToSoFSlot(uint32 serverSlot);
|
||||
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot);
|
||||
static inline uint32 ServerToSoFSlot(uint32 server_slot);
|
||||
static inline uint32 ServerToSoFCorpseSlot(uint32 server_corpse_slot);
|
||||
|
||||
// client to server inventory location converters
|
||||
static inline uint32 SoFToServerSlot(uint32 sofSlot);
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot);
|
||||
static inline uint32 SoFToServerSlot(uint32 sof_slot);
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 sof_corpse_slot);
|
||||
|
||||
// server to client say link converter
|
||||
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink);
|
||||
static inline void ServerToSoFSayLink(std::string &sof_saylink, const std::string &server_saylink);
|
||||
|
||||
// client to server say link converter
|
||||
static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink);
|
||||
static inline void SoFToServerSayLink(std::string &server_saylink, const std::string &sof_saylink);
|
||||
|
||||
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 item_location);
|
||||
|
||||
static inline int ServerToSoFBuffSlot(int index);
|
||||
static inline int SoFToServerBuffSlot(int index);
|
||||
@@ -103,8 +103,6 @@ namespace SoF
|
||||
signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry);
|
||||
into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy);
|
||||
|
||||
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name);
|
||||
}
|
||||
|
||||
@@ -382,7 +380,7 @@ namespace SoF
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoF::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -445,7 +443,12 @@ namespace SoF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -861,7 +864,7 @@ namespace SoF
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "SoF::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -922,6 +925,8 @@ namespace SoF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToSoFCorpseSlot(emu->slot_id);
|
||||
@@ -965,6 +970,8 @@ namespace SoF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1190,7 +1197,7 @@ namespace SoF
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1199,7 +1206,7 @@ namespace SoF
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1211,13 +1218,13 @@ namespace SoF
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -2548,6 +2555,8 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = SoFToServerCorpseSlot(eq->slot_id);
|
||||
@@ -2561,7 +2570,7 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[SoF] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = SoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToServerSlot(eq->to_slot);
|
||||
@@ -2867,7 +2876,7 @@ namespace SoF
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -3129,96 +3138,224 @@ namespace SoF
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::slotGeneral8 && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::slotGeneral9)
|
||||
SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoFSlot(uint32 serverSlot)
|
||||
static inline uint32 ServerToSoFSlot(uint32 server_slot)
|
||||
{
|
||||
uint32 SoFSlot = 0;
|
||||
uint32 sof_slot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
SoFSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END)
|
||||
SoFSlot = serverSlot + 11;
|
||||
else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END)
|
||||
SoFSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END)
|
||||
SoFSlot = serverSlot + 1;
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
SoFSlot = invslot::slotPowerSource;
|
||||
else
|
||||
SoFSlot = serverSlot;
|
||||
if (server_slot <= EQEmu::invslot::slotGeneral8) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::CORPSE_END && server_slot >= EQEmu::invslot::slotCursor) {
|
||||
sof_slot = server_slot - 2;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invbag::GENERAL_BAGS_8_END && server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
sof_slot = server_slot + 11;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
sof_slot = server_slot - 9;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::TRIBUTE_END && server_slot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::GUILD_TRIBUTE_END && server_slot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invbag::BANK_BAGS_END && server_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
sof_slot = server_slot + 1;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::SHARED_BANK_END && server_slot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invbag::SHARED_BANK_BAGS_END && server_slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
sof_slot = server_slot + 1;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::TRADE_END && server_slot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invbag::TRADE_BAGS_END && server_slot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
else if (server_slot <= EQEmu::invslot::WORLD_END && server_slot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
sof_slot = server_slot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to SoF Slot %i", server_slot, sof_slot);
|
||||
|
||||
return sof_slot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoFCorpseSlot(uint32 server_corpse_slot)
|
||||
{
|
||||
uint32 SoFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (server_corpse_slot <= EQEmu::invslot::slotGeneral8 && server_corpse_slot >= EQEmu::invslot::slotGeneral1) {
|
||||
SoFSlot = server_corpse_slot;
|
||||
}
|
||||
|
||||
else if (server_corpse_slot <= EQEmu::invslot::CORPSE_END && server_corpse_slot >= EQEmu::invslot::slotCursor) {
|
||||
SoFSlot = server_corpse_slot - 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail,
|
||||
Logs::Netcode,
|
||||
"Convert Server Corpse Slot %i to SoF Corpse Slot %i",
|
||||
server_corpse_slot,
|
||||
SoFSlot);
|
||||
|
||||
return SoFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot)
|
||||
static inline uint32 SoFToServerSlot(uint32 sof_slot)
|
||||
{
|
||||
//uint32 SoFCorpse;
|
||||
return (serverCorpseSlot + 1);
|
||||
uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sof_slot <= invslot::slotGeneral8) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::CORPSE_END && sof_slot >= invslot::slotCursor) {
|
||||
server_slot = sof_slot + 2;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invbag::GENERAL_BAGS_END && sof_slot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
server_slot = sof_slot - 11;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invbag::CURSOR_BAG_END && sof_slot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
server_slot = sof_slot + 9;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::TRIBUTE_END && sof_slot >= invslot::TRIBUTE_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::GUILD_TRIBUTE_END && sof_slot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot == invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::BANK_END && sof_slot >= invslot::BANK_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invbag::BANK_BAGS_END && sof_slot >= invbag::BANK_BAGS_BEGIN) {
|
||||
server_slot = sof_slot - 1;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::SHARED_BANK_END && sof_slot >= invslot::SHARED_BANK_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invbag::SHARED_BANK_BAGS_END && sof_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
server_slot = sof_slot - 1;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::TRADE_END && sof_slot >= invslot::TRADE_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invbag::TRADE_BAGS_END && sof_slot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
else if (sof_slot <= invslot::WORLD_END && sof_slot >= invslot::WORLD_BEGIN) {
|
||||
server_slot = sof_slot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert SoF Slot %i to Server Slot %i", sof_slot, server_slot);
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
|
||||
static inline uint32 SoFToServerSlot(uint32 sofSlot)
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 sof_corpse_slot)
|
||||
{
|
||||
uint32 ServerSlot = 0;
|
||||
uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (sofSlot >= invslot::slotAmmo && sofSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = sofSlot - 1;
|
||||
else if (sofSlot >= invbag::GENERAL_BAGS_BEGIN && sofSlot <= invbag::CURSOR_BAG_END)
|
||||
ServerSlot = sofSlot - 11;
|
||||
else if (sofSlot >= invbag::BANK_BAGS_BEGIN && sofSlot <= invbag::BANK_BAGS_END)
|
||||
ServerSlot = sofSlot - 1;
|
||||
else if (sofSlot >= invbag::SHARED_BANK_BAGS_BEGIN && sofSlot <= invbag::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = sofSlot - 1;
|
||||
else if (sofSlot == invslot::slotPowerSource)
|
||||
ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
else
|
||||
ServerSlot = sofSlot;
|
||||
if (sof_corpse_slot <= invslot::slotGeneral8 && sof_corpse_slot >= invslot::slotGeneral1) {
|
||||
server_slot = sof_corpse_slot;
|
||||
}
|
||||
|
||||
return ServerSlot;
|
||||
else if (sof_corpse_slot <= invslot::CORPSE_END && sof_corpse_slot >= invslot::slotCursor) {
|
||||
server_slot = sof_corpse_slot + 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail,
|
||||
Logs::Netcode,
|
||||
"Convert SoF Corpse Slot %i to Server Corpse Slot %i",
|
||||
sof_corpse_slot,
|
||||
server_slot);
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot)
|
||||
static inline void ServerToSoFSayLink(std::string &sof_saylink, const std::string &server_saylink)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return (sofCorpseSlot - 1);
|
||||
}
|
||||
|
||||
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
sofSayLink = serverSayLink;
|
||||
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
|
||||
sof_saylink = server_saylink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
auto segments = SplitString(server_saylink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
|
||||
sofSayLink.append(segments[segment_iter]);
|
||||
sof_saylink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3228,37 +3365,37 @@ namespace SoF
|
||||
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
sofSayLink.push_back('\x12');
|
||||
sofSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
sofSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
sof_saylink.push_back('\x12');
|
||||
sof_saylink.append(segments[segment_iter].substr(0, 31));
|
||||
sof_saylink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
sofSayLink.push_back(segments[segment_iter][42]);
|
||||
sof_saylink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
sofSayLink.push_back('F');
|
||||
sof_saylink.push_back('F');
|
||||
|
||||
sofSayLink.append(segments[segment_iter].substr(43));
|
||||
sofSayLink.push_back('\x12');
|
||||
sof_saylink.append(segments[segment_iter].substr(43));
|
||||
sof_saylink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
sofSayLink.append(segments[segment_iter]);
|
||||
sof_saylink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink)
|
||||
static inline void SoFToServerSayLink(std::string &server_saylink, const std::string &sof_saylink)
|
||||
{
|
||||
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sofSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = sofSayLink;
|
||||
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sof_saylink.find('\x12') == std::string::npos)) {
|
||||
server_saylink = sof_saylink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(sofSayLink, '\x12');
|
||||
auto segments = SplitString(sof_saylink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
server_saylink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3268,98 +3405,95 @@ namespace SoF
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.append(segments[segment_iter].substr(36));
|
||||
serverSayLink.push_back('\x12');
|
||||
server_saylink.push_back('\x12');
|
||||
server_saylink.append(segments[segment_iter].substr(0, 31));
|
||||
server_saylink.append("00000");
|
||||
server_saylink.append(segments[segment_iter].substr(31, 5));
|
||||
server_saylink.push_back('0');
|
||||
server_saylink.append(segments[segment_iter].substr(36));
|
||||
server_saylink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
server_saylink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot) {
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::PotionBelt;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::PotionBelt;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation)
|
||||
{
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 item_location) {
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Ability:
|
||||
return EQEmu::CastingSlot::Ability;
|
||||
// Tit uses 10 for item and discipline casting, but items have a valid location
|
||||
case CastingSlot::Item:
|
||||
if (itemlocation == INVALID_INDEX)
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Ability:
|
||||
return EQEmu::CastingSlot::Ability;
|
||||
// Tit uses 10 for item and discipline casting, but items have a valid location
|
||||
case CastingSlot::Item:
|
||||
if (item_location == INVALID_INDEX)
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
else
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::PotionBelt:
|
||||
return EQEmu::CastingSlot::PotionBelt;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
else
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::PotionBelt:
|
||||
return EQEmu::CastingSlot::PotionBelt;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int ServerToSoFBuffSlot(int index)
|
||||
{
|
||||
static inline int ServerToSoFBuffSlot(int index) {
|
||||
// we're a disc
|
||||
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
|
||||
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
|
||||
constants::LongBuffs + constants::ShortBuffs;
|
||||
constants::LongBuffs + constants::ShortBuffs;
|
||||
// we're a song
|
||||
if (index >= EQEmu::constants::LongBuffs)
|
||||
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
|
||||
@@ -3379,4 +3513,4 @@ namespace SoF
|
||||
// we're a normal buff
|
||||
return index; // as long as we guard against bad slots server side, we should be fine
|
||||
}
|
||||
} /*SoF*/
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ namespace SoF
|
||||
const int16 SLOT_INVALID = IINVALID;
|
||||
const int16 SLOT_BEGIN = INULL;
|
||||
|
||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||
|
||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||
const int16 POSSESSIONS_END = slotCursor;
|
||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||
|
||||
+314
-165
@@ -45,21 +45,21 @@ namespace Titanium
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline int16 ServerToTitaniumSlot(uint32 serverSlot);
|
||||
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot);
|
||||
static inline int16 ServerToTitaniumSlot(uint32 server_slot);
|
||||
static inline int16 ServerToTitaniumCorpseSlot(uint32 server_corpse_slot);
|
||||
|
||||
// client to server inventory location converters
|
||||
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot);
|
||||
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot);
|
||||
static inline uint32 TitaniumToServerSlot(int16 titanium_slot);
|
||||
static inline uint32 TitaniumToServerCorpseSlot(int16 titanium_corpse_slot);
|
||||
|
||||
// server to client say link converter
|
||||
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink);
|
||||
static inline void ServerToTitaniumSayLink(std::string &titanium_saylink, const std::string &server_saylink);
|
||||
|
||||
// client to server say link converter
|
||||
static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink);
|
||||
static inline void TitaniumToServerSayLink(std::string &server_saylink, const std::string &titanium_saylink);
|
||||
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 item_location);
|
||||
|
||||
static inline int ServerToTitaniumBuffSlot(int index);
|
||||
static inline int TitaniumToServerBuffSlot(int index);
|
||||
@@ -335,9 +335,9 @@ namespace Titanium
|
||||
EQEmu::OutBuffer::pos_type last_pos = ob.tellp();
|
||||
|
||||
for (int r = 0; r < itemcount; r++, eq++) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, ServerToTitaniumSlot(eq->slot_id), 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "Titanium::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -367,7 +367,12 @@ namespace Titanium
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -772,21 +777,15 @@ namespace Titanium
|
||||
OUT(TargetID);
|
||||
OUT(playerid);
|
||||
|
||||
int r;
|
||||
for (r = 0; r <= 20; r++) {
|
||||
strn0cpy(eq->itemnames[r], emu->itemnames[r], sizeof(eq->itemnames[r]));
|
||||
for (int i = EQEmu::invslot::slotCharm; i <= EQEmu::invslot::slotWaist; ++i) {
|
||||
strn0cpy(eq->itemnames[i], emu->itemnames[i], sizeof(eq->itemnames[i]));
|
||||
OUT(itemicons[i]);
|
||||
}
|
||||
|
||||
// move arrow item down to last element in titanium array
|
||||
strn0cpy(eq->itemnames[21], emu->itemnames[22], sizeof(eq->itemnames[21]));
|
||||
// move ammo down to last element in titanium array
|
||||
strn0cpy(eq->itemnames[invslot::slotAmmo], emu->itemnames[EQEmu::invslot::slotAmmo], sizeof(eq->itemnames[invslot::slotAmmo]));
|
||||
eq->itemicons[invslot::slotAmmo] = emu->itemicons[EQEmu::invslot::slotAmmo];
|
||||
|
||||
int k;
|
||||
for (k = 0; k <= 20; k++) {
|
||||
OUT(itemicons[k]);
|
||||
}
|
||||
|
||||
// move arrow icon down to last element in titanium array
|
||||
eq->itemicons[21] = emu->itemicons[22];
|
||||
strn0cpy(eq->text, emu->text, sizeof(eq->text));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -821,9 +820,9 @@ namespace Titanium
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, ServerToTitaniumSlot(int_struct->slot_id), 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "Titanium::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -874,6 +873,8 @@ namespace Titanium
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToTitaniumCorpseSlot(emu->slot_id);
|
||||
@@ -903,6 +904,8 @@ namespace Titanium
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToTitaniumSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToTitaniumSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1050,7 +1053,7 @@ namespace Titanium
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1059,7 +1062,7 @@ namespace Titanium
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1071,13 +1074,13 @@ namespace Titanium
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -1936,23 +1939,18 @@ namespace Titanium
|
||||
IN(TargetID);
|
||||
IN(playerid);
|
||||
|
||||
int r;
|
||||
for (r = 0; r <= 20; r++) {
|
||||
strn0cpy(emu->itemnames[r], eq->itemnames[r], sizeof(emu->itemnames[r]));
|
||||
for (int i = invslot::slotCharm; i <= invslot::slotWaist; ++i) {
|
||||
strn0cpy(emu->itemnames[i], eq->itemnames[i], sizeof(emu->itemnames[i]));
|
||||
IN(itemicons[i]);
|
||||
}
|
||||
|
||||
// move arrow item up to last element in server array
|
||||
strn0cpy(emu->itemnames[21], "", sizeof(emu->itemnames[21]));
|
||||
strn0cpy(emu->itemnames[22], eq->itemnames[21], sizeof(emu->itemnames[22]));
|
||||
// move ammo up to last element in server array
|
||||
strn0cpy(emu->itemnames[EQEmu::invslot::slotAmmo], eq->itemnames[invslot::slotAmmo], sizeof(emu->itemnames[EQEmu::invslot::slotAmmo]));
|
||||
emu->itemicons[EQEmu::invslot::slotAmmo] = eq->itemicons[invslot::slotAmmo];
|
||||
|
||||
int k;
|
||||
for (k = 0; k <= 20; k++) {
|
||||
IN(itemicons[k]);
|
||||
}
|
||||
|
||||
// move arrow icon up to last element in server array
|
||||
emu->itemicons[21] = 0xFFFFFFFF;
|
||||
emu->itemicons[22] = eq->itemicons[21];
|
||||
// nullify power source element in server array
|
||||
strn0cpy(emu->itemnames[EQEmu::invslot::slotPowerSource], "", sizeof(emu->itemnames[EQEmu::invslot::slotPowerSource]));
|
||||
emu->itemicons[EQEmu::invslot::slotPowerSource] = 0xFFFFFFFF;
|
||||
|
||||
strn0cpy(emu->text, eq->text, sizeof(emu->text));
|
||||
|
||||
@@ -2020,6 +2018,8 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = TitaniumToServerCorpseSlot(eq->slot_id);
|
||||
@@ -2033,7 +2033,7 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[Titanium] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = TitaniumToServerSlot(eq->from_slot);
|
||||
emu->to_slot = TitaniumToServerSlot(eq->to_slot);
|
||||
@@ -2225,13 +2225,16 @@ namespace Titanium
|
||||
}
|
||||
|
||||
// file scope helper methods
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const char* protection = "\\\\\\\\\\";
|
||||
const EQEmu::ItemData* item = inst->GetUnscaledItem();
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) {
|
||||
const char *protection = "\\\\\\\\\\";
|
||||
const EQEmu::ItemData *item = inst->GetUnscaledItem();
|
||||
|
||||
ob << StringFormat(
|
||||
"%.*s%s",
|
||||
(depth ? (depth - 1) : 0),
|
||||
protection,
|
||||
(depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
|
||||
|
||||
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
|
||||
|
||||
// Instance data
|
||||
ob << itoa((inst->IsStackable() ? inst->GetCharges() : 0)); // stack count
|
||||
ob << '|' << itoa(0); // unknown
|
||||
@@ -2239,9 +2242,11 @@ namespace Titanium
|
||||
ob << '|' << itoa(inst->GetPrice()); // merchant price
|
||||
ob << '|' << itoa((!inst->GetMerchantSlot() ? 1 : inst->GetMerchantCount())); // inst count/merchant count
|
||||
ob << '|' << itoa((inst->IsScaling() ? (inst->GetExp() / 100) : 0)); // inst experience
|
||||
ob << '|' << itoa((!inst->GetMerchantSlot() ? inst->GetSerialNumber() : inst->GetMerchantSlot())); // merchant serial number
|
||||
ob << '|' << itoa((!inst->GetMerchantSlot() ? inst->GetSerialNumber()
|
||||
: inst->GetMerchantSlot())); // merchant serial number
|
||||
ob << '|' << itoa(inst->GetRecastTimestamp()); // recast timestamp
|
||||
ob << '|' << itoa(((inst->IsStackable() ? ((inst->GetItem()->ItemType == EQEmu::item::ItemTypePotion) ? 1 : 0) : inst->GetCharges()))); // charge count
|
||||
ob << '|' << itoa(((inst->IsStackable() ? ((inst->GetItem()->ItemType == EQEmu::item::ItemTypePotion) ? 1 : 0)
|
||||
: inst->GetCharges()))); // charge count
|
||||
ob << '|' << itoa((inst->IsAttuned() ? 1 : 0)); // inst attuned
|
||||
ob << '|' << itoa(0); // unknown
|
||||
ob << '|';
|
||||
@@ -2259,7 +2264,7 @@ namespace Titanium
|
||||
ob << '|' << itoa(item->NoRent);
|
||||
ob << '|' << itoa(item->NoDrop);
|
||||
ob << '|' << itoa(item->Size);
|
||||
ob << '|' << itoa(item->Slots);
|
||||
ob << '|' << itoa(Catch22(SwapBits21And22(item->Slots)));
|
||||
ob << '|' << itoa(item->Price);
|
||||
ob << '|' << itoa(item->Icon);
|
||||
ob << '|' << "0";
|
||||
@@ -2449,62 +2454,208 @@ namespace Titanium
|
||||
for (int index = EQEmu::invbag::SLOT_BEGIN; index <= invbag::SLOT_END; ++index) {
|
||||
ob << '|';
|
||||
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance *sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
|
||||
SerializeItem(ob, sub, 0, (depth + 1));
|
||||
}
|
||||
|
||||
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For trailing quotes (and protection) if a subitem;
|
||||
ob << StringFormat(
|
||||
"%.*s%s",
|
||||
(depth ? (depth - 1) : 0),
|
||||
protection,
|
||||
(depth ? "\"" : "")); // For trailing quotes (and protection) if a subitem;
|
||||
|
||||
if (!depth)
|
||||
ob.write("\0", 1);
|
||||
}
|
||||
|
||||
static inline int16 ServerToTitaniumSlot(uint32 serverSlot)
|
||||
{
|
||||
//int16 TitaniumSlot;
|
||||
if (serverSlot == INVALID_INDEX)
|
||||
return INVALID_INDEX;
|
||||
static inline int16 ServerToTitaniumSlot(uint32 server_slot) {
|
||||
int16 titanium_slot = invslot::SLOT_INVALID;
|
||||
|
||||
return serverSlot; // deprecated
|
||||
if (server_slot <= EQEmu::invslot::slotWaist) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot == EQEmu::invslot::slotAmmo) {
|
||||
titanium_slot = server_slot - 1;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::slotGeneral8 && server_slot >= EQEmu::invslot::slotGeneral1) {
|
||||
titanium_slot = server_slot - 1;
|
||||
}
|
||||
else if (server_slot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) &&
|
||||
server_slot >= EQEmu::invslot::slotCursor) {
|
||||
titanium_slot = server_slot - 3;
|
||||
}
|
||||
else if (server_slot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
|
||||
titanium_slot = server_slot - 4;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invbag::GENERAL_BAGS_8_END &&
|
||||
server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
titanium_slot = server_slot - 20;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::TRIBUTE_END && server_slot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::GUILD_TRIBUTE_END &&
|
||||
server_slot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invbag::BANK_BAGS_16_END && server_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::SHARED_BANK_END && server_slot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invbag::SHARED_BANK_BAGS_END &&
|
||||
server_slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::TRADE_END && server_slot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invbag::TRADE_BAGS_END && server_slot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
else if (server_slot <= EQEmu::invslot::WORLD_END && server_slot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
titanium_slot = server_slot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to Titanium Slot %i", server_slot, titanium_slot);
|
||||
|
||||
return titanium_slot;
|
||||
}
|
||||
|
||||
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
//int16 TitaniumCorpse;
|
||||
return serverCorpseSlot;
|
||||
|
||||
static inline int16 ServerToTitaniumCorpseSlot(uint32 server_corpse_slot) {
|
||||
int16 titanium_slot = invslot::SLOT_INVALID;
|
||||
|
||||
if (server_corpse_slot <= EQEmu::invslot::slotGeneral8 && server_corpse_slot >= EQEmu::invslot::slotGeneral1) {
|
||||
titanium_slot = server_corpse_slot - 1;
|
||||
}
|
||||
|
||||
else if (server_corpse_slot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) &&
|
||||
server_corpse_slot >= EQEmu::invslot::slotCursor) {
|
||||
titanium_slot = server_corpse_slot - 3;
|
||||
}
|
||||
|
||||
else if (server_corpse_slot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
|
||||
titanium_slot = server_corpse_slot - 4;
|
||||
}
|
||||
|
||||
Log(Logs::Detail,
|
||||
Logs::Netcode,
|
||||
"Convert Server Corpse Slot %i to Titanium Corpse Slot %i",
|
||||
server_corpse_slot,
|
||||
titanium_slot);
|
||||
|
||||
return titanium_slot;
|
||||
}
|
||||
|
||||
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot)
|
||||
{
|
||||
//uint32 ServerSlot;
|
||||
if (titaniumSlot == INVALID_INDEX)
|
||||
return INVALID_INDEX;
|
||||
static inline uint32 TitaniumToServerSlot(int16 titanium_slot) {
|
||||
uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
return titaniumSlot; // deprecated
|
||||
if (titanium_slot <= invslot::slotWaist) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot == invslot::slotAmmo) {
|
||||
server_slot = titanium_slot + 1;
|
||||
}
|
||||
else if (titanium_slot <= invslot::slotGeneral8 && titanium_slot >= invslot::slotGeneral1) {
|
||||
server_slot = titanium_slot + 1;
|
||||
}
|
||||
else if (titanium_slot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) &&
|
||||
titanium_slot >= invslot::slotCursor) {
|
||||
server_slot = titanium_slot + 3;
|
||||
}
|
||||
else if (titanium_slot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
|
||||
server_slot = titanium_slot + 4;
|
||||
}
|
||||
else if (titanium_slot <= invbag::GENERAL_BAGS_END && titanium_slot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invbag::CURSOR_BAG_END && titanium_slot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
server_slot = titanium_slot + 20;
|
||||
}
|
||||
else if (titanium_slot <= invslot::TRIBUTE_END && titanium_slot >= invslot::TRIBUTE_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot == invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invslot::GUILD_TRIBUTE_END && titanium_slot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invslot::BANK_END && titanium_slot >= invslot::BANK_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invbag::BANK_BAGS_END && titanium_slot >= invbag::BANK_BAGS_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invslot::SHARED_BANK_END && titanium_slot >= invslot::SHARED_BANK_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invbag::SHARED_BANK_BAGS_END && titanium_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invslot::TRADE_END && titanium_slot >= invslot::TRADE_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invbag::TRADE_BAGS_END && titanium_slot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
else if (titanium_slot <= invslot::WORLD_END && titanium_slot >= invslot::WORLD_BEGIN) {
|
||||
server_slot = titanium_slot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Titanium Slot %i to Server Slot %i", titanium_slot, server_slot);
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
|
||||
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot)
|
||||
static inline uint32 TitaniumToServerCorpseSlot(int16 titanium_corpse_slot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return titaniumCorpseSlot;
|
||||
uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (titanium_corpse_slot <= invslot::slotGeneral8 && titanium_corpse_slot >= invslot::slotGeneral1) {
|
||||
server_slot = titanium_corpse_slot + 1;
|
||||
}
|
||||
|
||||
else if (titanium_corpse_slot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) && titanium_corpse_slot >= invslot::slotCursor) {
|
||||
server_slot = titanium_corpse_slot + 3;
|
||||
}
|
||||
|
||||
else if (titanium_corpse_slot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
|
||||
server_slot = titanium_corpse_slot + 4;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Titanium Corpse Slot %i to Server Corpse Slot %i", titanium_corpse_slot, server_slot);
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
|
||||
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink)
|
||||
static inline void ServerToTitaniumSayLink(std::string &titanium_saylink, const std::string &server_saylink)
|
||||
{
|
||||
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
titaniumSayLink = serverSayLink;
|
||||
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
|
||||
titanium_saylink = server_saylink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
auto segments = SplitString(server_saylink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
|
||||
titaniumSayLink.append(segments[segment_iter]);
|
||||
titanium_saylink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -2514,37 +2665,37 @@ namespace Titanium
|
||||
// 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45)
|
||||
// Diff: ^^^^^ ^ ^^^^^
|
||||
|
||||
titaniumSayLink.push_back('\x12');
|
||||
titaniumSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
titaniumSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
titanium_saylink.push_back('\x12');
|
||||
titanium_saylink.append(segments[segment_iter].substr(0, 31));
|
||||
titanium_saylink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
titaniumSayLink.push_back(segments[segment_iter][42]);
|
||||
titanium_saylink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
titaniumSayLink.push_back('F');
|
||||
titanium_saylink.push_back('F');
|
||||
|
||||
titaniumSayLink.append(segments[segment_iter].substr(48));
|
||||
titaniumSayLink.push_back('\x12');
|
||||
titanium_saylink.append(segments[segment_iter].substr(48));
|
||||
titanium_saylink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
titaniumSayLink.append(segments[segment_iter]);
|
||||
titanium_saylink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink)
|
||||
static inline void TitaniumToServerSayLink(std::string &server_saylink, const std::string &titanium_saylink)
|
||||
{
|
||||
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (titaniumSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = titaniumSayLink;
|
||||
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (titanium_saylink.find('\x12') == std::string::npos)) {
|
||||
server_saylink = titanium_saylink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(titaniumSayLink, '\x12');
|
||||
auto segments = SplitString(titanium_saylink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
server_saylink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -2554,91 +2705,89 @@ namespace Titanium
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^ ^^^^^
|
||||
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.push_back(segments[segment_iter][36]);
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(37));
|
||||
serverSayLink.push_back('\x12');
|
||||
server_saylink.push_back('\x12');
|
||||
server_saylink.append(segments[segment_iter].substr(0, 31));
|
||||
server_saylink.append("00000");
|
||||
server_saylink.append(segments[segment_iter].substr(31, 5));
|
||||
server_saylink.push_back('0');
|
||||
server_saylink.push_back(segments[segment_iter][36]);
|
||||
server_saylink.append("00000");
|
||||
server_saylink.append(segments[segment_iter].substr(37));
|
||||
server_saylink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
server_saylink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot) {
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::PotionBelt;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::PotionBelt;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation)
|
||||
{
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 item_location) {
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Ability:
|
||||
return EQEmu::CastingSlot::Ability;
|
||||
// Tit uses 10 for item and discipline casting, but items have a valid location
|
||||
case CastingSlot::Item:
|
||||
if (itemlocation == INVALID_INDEX)
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Ability:
|
||||
return EQEmu::CastingSlot::Ability;
|
||||
// Tit uses 10 for item and discipline casting, but items have a valid location
|
||||
case CastingSlot::Item:
|
||||
if (item_location == INVALID_INDEX)
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
else
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::PotionBelt:
|
||||
return EQEmu::CastingSlot::PotionBelt;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
else
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::PotionBelt:
|
||||
return EQEmu::CastingSlot::PotionBelt;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,8 @@ namespace Titanium
|
||||
const int16 SLOT_INVALID = IINVALID;
|
||||
const int16 SLOT_BEGIN = INULL;
|
||||
|
||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||
|
||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||
const int16 POSSESSIONS_END = slotCursor;
|
||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||
|
||||
+189
-58
@@ -520,7 +520,7 @@ namespace UF
|
||||
for (int index = 0; index < item_count; ++index, ++eq) {
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "UF::ENCODE(OP_CharInventory) Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -584,7 +584,12 @@ namespace UF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); }
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
|
||||
ENCODE(OP_DeleteItem)
|
||||
{
|
||||
@@ -1272,7 +1277,7 @@ namespace UF
|
||||
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
Log(Logs::General, Logs::Netcode, "UF::ENCODE(OP_ItemPacket) Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
return;
|
||||
}
|
||||
@@ -1345,6 +1350,8 @@ namespace UF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
eq->slot_id = ServerToUFCorpseSlot(emu->slot_id);
|
||||
@@ -1510,6 +1517,8 @@ namespace UF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToUFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToUFSlot(emu->to_slot);
|
||||
OUT(number_in_stack);
|
||||
@@ -1769,7 +1778,7 @@ namespace UF
|
||||
|
||||
// OUT(unknown06160[4]);
|
||||
|
||||
// Copy bandoliers where server and client indexes converge
|
||||
// Copy bandoliers where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
OUT_str(bandoliers[r].Name);
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1778,7 +1787,7 @@ namespace UF
|
||||
OUT_str(bandoliers[r].Items[k].Name);
|
||||
}
|
||||
}
|
||||
// Nullify bandoliers where server and client indexes diverge, with a client bias
|
||||
// Nullify bandoliers where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) {
|
||||
eq->bandoliers[r].Name[0] = '\0';
|
||||
for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true
|
||||
@@ -1790,13 +1799,13 @@ namespace UF
|
||||
|
||||
// OUT(unknown07444[5120]);
|
||||
|
||||
// Copy potion belt where server and client indexes converge
|
||||
// Copy potion belt where server and client indices converge
|
||||
for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) {
|
||||
OUT(potionbelt.Items[r].ID);
|
||||
OUT(potionbelt.Items[r].Icon);
|
||||
OUT_str(potionbelt.Items[r].Name);
|
||||
}
|
||||
// Nullify potion belt where server and client indexes diverge, with a client bias
|
||||
// Nullify potion belt where server and client indices diverge, with a client bias
|
||||
for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) {
|
||||
eq->potionbelt.Items[r].ID = 0;
|
||||
eq->potionbelt.Items[r].Icon = 0;
|
||||
@@ -3496,6 +3505,8 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
emu->slot_id = UFToServerCorpseSlot(eq->slot_id);
|
||||
@@ -3509,7 +3520,7 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[UF] Moved item from %u to %u", eq->from_slot, eq->to_slot);
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = UFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = UFToServerSlot(eq->to_slot);
|
||||
@@ -3810,7 +3821,7 @@ namespace UF
|
||||
ibs.nodrop = item->NoDrop;
|
||||
ibs.attune = item->Attuneable;
|
||||
ibs.size = item->Size;
|
||||
ibs.slots = SwapBits21And22(item->Slots);
|
||||
ibs.slots = item->Slots;
|
||||
ibs.price = item->Price;
|
||||
ibs.icon = item->Icon;
|
||||
ibs.unknown1 = 1;
|
||||
@@ -4096,81 +4107,201 @@ namespace UF
|
||||
|
||||
ob.write((const char*)&subitem_count, sizeof(uint32));
|
||||
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
// moved outside of loop since it is not modified within that scope
|
||||
int16 SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
|
||||
int SubSlotNumber = INVALID_INDEX;
|
||||
if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END)
|
||||
SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1);
|
||||
else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index);
|
||||
else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END)
|
||||
SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index);
|
||||
else
|
||||
SubSlotNumber = slot_id_in;
|
||||
if (slot_id_in <= EQEmu::invslot::slotGeneral8 && slot_id_in >= EQEmu::invslot::GENERAL_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::GENERAL_END && slot_id_in >= EQEmu::invslot::slotGeneral9)
|
||||
SubSlotNumber = EQEmu::invbag::SLOT_INVALID;
|
||||
else if (slot_id_in == EQEmu::invslot::slotCursor)
|
||||
SubSlotNumber = EQEmu::invbag::CURSOR_BAG_BEGIN;
|
||||
else if (slot_id_in <= EQEmu::invslot::BANK_END && slot_id_in >= EQEmu::invslot::BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else if (slot_id_in <= EQEmu::invslot::SHARED_BANK_END && slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN)
|
||||
SubSlotNumber = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT);
|
||||
else
|
||||
SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now
|
||||
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
if (SubSlotNumber != EQEmu::invbag::SLOT_INVALID) {
|
||||
for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
ob.write((const char*)&index, sizeof(uint32));
|
||||
|
||||
SerializeItem(ob, sub, SubSlotNumber, (depth + 1));
|
||||
++subitem_count;
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
if (subitem_count)
|
||||
ob.overwrite(count_pos, (const char*)&subitem_count, sizeof(uint32));
|
||||
}
|
||||
|
||||
static inline uint32 ServerToUFSlot(uint32 serverSlot)
|
||||
{
|
||||
uint32 UnderfootSlot = 0;
|
||||
uint32 UFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
UnderfootSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END)
|
||||
UnderfootSlot = serverSlot + 11;
|
||||
else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END)
|
||||
UnderfootSlot = serverSlot + 1;
|
||||
else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END)
|
||||
UnderfootSlot = serverSlot + 1;
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE)
|
||||
UnderfootSlot = invslot::slotPowerSource;
|
||||
else
|
||||
UnderfootSlot = serverSlot;
|
||||
if (serverSlot <= EQEmu::invslot::slotGeneral8) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
return UnderfootSlot;
|
||||
else if (serverSlot <= EQEmu::invslot::CORPSE_END && serverSlot >= EQEmu::invslot::slotCursor) {
|
||||
UFSlot = serverSlot - 2;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot + 11;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
|
||||
UFSlot = serverSlot - 9;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot + 1;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
|
||||
UFSlot = serverSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to UF Slot %i", serverSlot, UFSlot);
|
||||
|
||||
return UFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 ServerToUFCorpseSlot(uint32 serverCorpseSlot)
|
||||
{
|
||||
//uint32 UnderfootCorpse;
|
||||
return (serverCorpseSlot + 1);
|
||||
uint32 UFSlot = invslot::SLOT_INVALID;
|
||||
|
||||
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) {
|
||||
UFSlot = serverCorpseSlot;
|
||||
}
|
||||
|
||||
else if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::slotCursor) {
|
||||
UFSlot = serverCorpseSlot - 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to UF Corpse Slot %i", serverCorpseSlot, UFSlot);
|
||||
|
||||
return UFSlot;
|
||||
}
|
||||
|
||||
static inline uint32 UFToServerSlot(uint32 ufSlot)
|
||||
{
|
||||
uint32 ServerSlot = 0;
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (ufSlot >= invslot::slotAmmo && ufSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
|
||||
ServerSlot = ufSlot - 1;
|
||||
else if (ufSlot >= invbag::GENERAL_BAGS_BEGIN && ufSlot <= invbag::CURSOR_BAG_END)
|
||||
ServerSlot = ufSlot - 11;
|
||||
else if (ufSlot >= invbag::BANK_BAGS_BEGIN && ufSlot <= invbag::BANK_BAGS_END)
|
||||
ServerSlot = ufSlot - 1;
|
||||
else if (ufSlot >= invbag::SHARED_BANK_BAGS_BEGIN && ufSlot <= invbag::SHARED_BANK_BAGS_END)
|
||||
ServerSlot = ufSlot - 1;
|
||||
else if (ufSlot == invslot::slotPowerSource)
|
||||
ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE;
|
||||
else
|
||||
if (ufSlot <= invslot::slotGeneral8) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::CORPSE_END && ufSlot >= invslot::slotCursor) {
|
||||
ServerSlot = ufSlot + 2;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::GENERAL_BAGS_END && ufSlot >= invbag::GENERAL_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot - 11;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::CURSOR_BAG_END && ufSlot >= invbag::CURSOR_BAG_BEGIN) {
|
||||
ServerSlot = ufSlot + 9;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::TRIBUTE_END && ufSlot >= invslot::TRIBUTE_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::GUILD_TRIBUTE_END && ufSlot >= invslot::GUILD_TRIBUTE_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot == invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::BANK_END && ufSlot >= invslot::BANK_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::BANK_BAGS_END && ufSlot >= invbag::BANK_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot - 1;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::SHARED_BANK_END && ufSlot >= invslot::SHARED_BANK_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::SHARED_BANK_BAGS_END && ufSlot >= invbag::SHARED_BANK_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot - 1;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::TRADE_END && ufSlot >= invslot::TRADE_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invbag::TRADE_BAGS_END && ufSlot >= invbag::TRADE_BAGS_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
else if (ufSlot <= invslot::WORLD_END && ufSlot >= invslot::WORLD_BEGIN) {
|
||||
ServerSlot = ufSlot;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert UF Slot %i to Server Slot %i", ufSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline uint32 UFToServerCorpseSlot(uint32 ufCorpseSlot)
|
||||
{
|
||||
//uint32 ServerCorpse;
|
||||
return (ufCorpseSlot - 1);
|
||||
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
|
||||
|
||||
if (ufCorpseSlot <= invslot::slotGeneral8 && ufCorpseSlot >= invslot::slotGeneral1) {
|
||||
ServerSlot = ufCorpseSlot;
|
||||
}
|
||||
|
||||
else if (ufCorpseSlot <= invslot::CORPSE_END && ufCorpseSlot >= invslot::slotCursor) {
|
||||
ServerSlot = ufCorpseSlot + 2;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Convert UF Corpse Slot %i to Server Corpse Slot %i", ufCorpseSlot, ServerSlot);
|
||||
|
||||
return ServerSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToUFSayLink(std::string& ufSayLink, const std::string& serverSayLink)
|
||||
|
||||
@@ -150,6 +150,8 @@ namespace UF
|
||||
const int16 SLOT_INVALID = IINVALID;
|
||||
const int16 SLOT_BEGIN = INULL;
|
||||
|
||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||
|
||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||
const int16 POSSESSIONS_END = slotCursor;
|
||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||
|
||||
+2
-1
@@ -551,7 +551,8 @@ RULE_REAL(Aggro, TunnelVisionAggroMod, 0.75) //people not currently the top hate
|
||||
RULE_INT(Aggro, MaxScalingProcAggro, 400) // Set to -1 for no limit. Maxmimum amount of aggro that HP scaling SPA effect in a proc will add.
|
||||
RULE_INT(Aggro, IntAggroThreshold, 75) // Int <= this will aggro regardless of level difference.
|
||||
RULE_BOOL(Aggro, AllowTickPulling, false) // tick pulling is an exploit in an NPC's call for help fixed sometime in 2006 on live
|
||||
RULE_BOOL(Aggro, UseLevelAggro, true) // Level 18+ and Undead will aggro regardless of level difference. (this will disabled Rule:IntAggroThreshold if set to true)
|
||||
RULE_INT(Aggro, MinAggroLevel, 18) // For use with UseLevelAggro
|
||||
RULE_BOOL(Aggro, UseLevelAggro, true) // MinAggroLevel rule value+ and Undead will aggro regardless of level difference. (this will disabled Rule:IntAggroThreshold if set to true)
|
||||
RULE_INT(Aggro, ClientAggroCheckInterval, 6) // Interval in which clients actually check for aggro - in seconds
|
||||
RULE_REAL(Aggro, PetAttackRange, 40000.0) // max squared range /pet attack works at default is 200
|
||||
RULE_BOOL(Aggro, NPCAggroMaxDistanceEnabled, true) /* If enabled, NPC's will drop aggro beyond 600 units or what is defined at the zone level */
|
||||
|
||||
+48
-7
@@ -547,9 +547,12 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool
|
||||
return true;
|
||||
}
|
||||
|
||||
// Overloaded: Retrieve character inventory based on character id
|
||||
// Overloaded: Retrieve character inventory based on character id (zone entry)
|
||||
bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
{
|
||||
if (!char_id || !inv)
|
||||
return false;
|
||||
|
||||
// Retrieve character inventory
|
||||
std::string query =
|
||||
StringFormat("SELECT slotid, itemid, charges, color, augslot1, augslot2, augslot3, augslot4, augslot5, "
|
||||
@@ -566,8 +569,40 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
|
||||
auto timestamps = GetItemRecastTimestamps(char_id);
|
||||
|
||||
auto cv_conflict = false;
|
||||
auto pmask = inv->GetLookup()->PossessionsBitmask;
|
||||
auto bank_size = inv->GetLookup()->InventoryTypeSize[EQEmu::invtype::typeBank];
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
int16 slot_id = atoi(row[0]);
|
||||
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) { // Titanium thru UF check
|
||||
if ((((uint64)1 << slot_id) & pmask) == 0) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { // Titanium thru UF check
|
||||
auto parent_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << parent_slot) & pmask) == 0) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) { // Titanium check
|
||||
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= bank_size) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) { // Titanium check
|
||||
auto parent_index = ((slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if (parent_index < EQEmu::invslot::SLOT_BEGIN || parent_index >= bank_size) {
|
||||
cv_conflict = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 item_id = atoi(row[1]);
|
||||
uint16 charges = atoi(row[2]);
|
||||
uint32 color = atoul(row[3]);
|
||||
@@ -633,10 +668,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
inst->SetOrnamentationIDFile(ornament_idfile);
|
||||
inst->SetOrnamentHeroModel(item->HerosForgeModel);
|
||||
|
||||
if (instnodrop ||
|
||||
(((slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN && slot_id <= EQEmu::invslot::EQUIPMENT_END) ||
|
||||
slot_id == EQEmu::invslot::SLOT_POWER_SOURCE) &&
|
||||
inst->GetItem()->Attuneable))
|
||||
if (instnodrop || (inst->GetItem()->Attuneable && slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN && slot_id <= EQEmu::invslot::EQUIPMENT_END))
|
||||
inst->SetAttuned(true);
|
||||
|
||||
if (color > 0)
|
||||
@@ -684,13 +716,22 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
|
||||
char_id, item_id, slot_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_conflict) {
|
||||
char char_name[64] = "";
|
||||
GetCharName(char_id, char_name);
|
||||
Log(Logs::Moderate, Logs::Client_Login,
|
||||
"ClientVersion conflict during inventory load at zone entry for '%s' (charid: %u, inver: %s)",
|
||||
char_name, char_id, EQEmu::versions::MobVersionName(inv->InventoryVersion())
|
||||
);
|
||||
}
|
||||
|
||||
// Retrieve shared inventory
|
||||
return GetSharedBank(char_id, inv, true);
|
||||
}
|
||||
|
||||
// Overloaded: Retrieve character inventory based on account_id and character name
|
||||
bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv)
|
||||
// Overloaded: Retrieve character inventory based on account_id and character name (char select)
|
||||
bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv) // deprecated
|
||||
{
|
||||
// Retrieve character inventory
|
||||
std::string query =
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ class SharedDatabase : public Database
|
||||
int32 GetSharedPlatinum(uint32 account_id);
|
||||
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
||||
bool GetInventory(uint32 char_id, EQEmu::InventoryProfile* inv);
|
||||
bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv);
|
||||
bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv); // deprecated
|
||||
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
|
||||
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
|
||||
void ClearOldRecastTimestamps(uint32 char_id);
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@
|
||||
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9127
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9129
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9019
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9020
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user