From 1ba6801bb240d1802d70a0069cb147f5761753c1 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 5 Oct 2018 07:54:42 -0400 Subject: [PATCH] Fix for UF and older clients' experiment combine failure --- common/emu_constants.h | 4 ++++ common/eq_constants.h | 14 -------------- common/inventory_profile.cpp | 16 ++++++++-------- common/patches/rof.cpp | 24 +++++++++++++++--------- common/patches/rof2.cpp | 24 +++++++++++++++--------- common/patches/sod.cpp | 8 ++++++++ common/patches/sod_limits.h | 2 ++ common/patches/sof.cpp | 10 +++++++++- common/patches/sof_limits.h | 2 ++ common/patches/titanium.cpp | 6 ++++++ common/patches/titanium_limits.h | 2 ++ common/patches/uf.cpp | 8 ++++++++ common/patches/uf_limits.h | 2 ++ zone/lua_general.cpp | 6 +++--- zone/tradeskills.cpp | 2 +- 15 files changed, 85 insertions(+), 45 deletions(-) diff --git a/common/emu_constants.h b/common/emu_constants.h index f2c0428e8..db49252a3 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -83,6 +83,10 @@ namespace EQEmu using RoF2::invslot::SLOT_INVALID; using RoF2::invslot::SLOT_BEGIN; + using Titanium::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; + + const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value) + using RoF2::invslot::POSSESSIONS_BEGIN; using RoF2::invslot::POSSESSIONS_END; using RoF2::invslot::POSSESSIONS_COUNT; diff --git a/common/eq_constants.h b/common/eq_constants.h index 9ccca95a0..d20bfdf4a 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -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*/ diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp index c0f3c25e8..47068a492 100644 --- a/common/inventory_profile.cpp +++ b/common/inventory_profile.cpp @@ -1418,7 +1418,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map& 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; } @@ -1435,7 +1435,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map& 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; } } } @@ -1466,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; } @@ -1483,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; } } @@ -1593,7 +1593,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::mapGetItem()->LoreGroup == loregroup) - return legacy::SLOT_AUGMENT; + return invslot::SLOT_AUGMENT_GENERIC_RETURN; } if (!inst->IsClassBag()) { continue; } @@ -1610,7 +1610,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::mapGetItem()->LoreGroup == loregroup) - return legacy::SLOT_AUGMENT; + return invslot::SLOT_AUGMENT_GENERIC_RETURN; } } } @@ -1633,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; } @@ -1650,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; } } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index f528435f9..cb8eddced 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5002,11 +5002,7 @@ namespace RoF DECODE_LENGTH_EXACT(structs::NewCombine_Struct); SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); - int16 slot_id = RoFToServerSlot(eq->container_slot); - if (slot_id == 4000) { - slot_id = EQEmu::legacy::SLOT_TRADESKILL; // 1000 - } - emu->container_slot = slot_id; + emu->container_slot = RoFToServerSlot(eq->container_slot); emu->guildtribute_slot = RoFToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented FINISH_DIRECT_DECODE(); @@ -5581,6 +5577,10 @@ namespace RoF RoFSlot.Slot = server_slot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN; } + else if (server_slot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) { + RoFSlot.Type = invtype::typeWorld; + } + else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) { RoFSlot.Type = invtype::typeBank; RoFSlot.Slot = server_slot - EQEmu::invslot::BANK_BEGIN; @@ -5781,9 +5781,12 @@ namespace RoF break; } case invtype::typeWorld: { - server_slot = EQEmu::invslot::WORLD_BEGIN; // evidently, [4,-1,-1,-1] is sent when world object is in experimental mode and combine is clicked if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::WORLD_SIZE) { - server_slot += rof_slot.Slot; + server_slot = EQEmu::invslot::WORLD_BEGIN + rof_slot.Slot; + } + + else if (rof_slot.Slot == invslot::SLOT_INVALID) { + server_slot = EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; } break; @@ -5950,9 +5953,12 @@ namespace RoF break; } case invtype::typeWorld: { - server_slot = EQEmu::invslot::WORLD_BEGIN; // evidently, [4,-1,-1,-1] is sent when world object is in experimental mode and combine is clicked if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::WORLD_SIZE) { - server_slot += rof_slot.Slot; + server_slot = EQEmu::invslot::WORLD_BEGIN + rof_slot.Slot; + } + + else if (rof_slot.Slot == invslot::SLOT_INVALID) { + server_slot = EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; } break; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index de1f139c3..d65ea4cba 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5299,11 +5299,7 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::NewCombine_Struct); SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); - int16 slot_id = RoF2ToServerSlot(eq->container_slot); - if (slot_id == 4000) { - slot_id = EQEmu::legacy::SLOT_TRADESKILL; // 1000 - } - emu->container_slot = slot_id; + emu->container_slot = RoF2ToServerSlot(eq->container_slot); emu->guildtribute_slot = RoF2ToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented FINISH_DIRECT_DECODE(); @@ -5887,6 +5883,10 @@ namespace RoF2 RoF2Slot.Slot = server_slot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN; } + else if (server_slot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) { + RoF2Slot.Type = invtype::typeWorld; + } + else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) { RoF2Slot.Type = invtype::typeBank; RoF2Slot.Slot = server_slot - EQEmu::invslot::BANK_BEGIN; @@ -6071,9 +6071,12 @@ namespace RoF2 break; } case invtype::typeWorld: { - server_slot = EQEmu::invslot::WORLD_BEGIN; // evidently, [4,-1,-1,-1] is sent when world object is in experimental mode and combine is clicked if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::WORLD_SIZE) { - server_slot += rof2_slot.Slot; + server_slot = EQEmu::invslot::WORLD_BEGIN + rof2_slot.Slot; + } + + else if (rof2_slot.Slot == invslot::SLOT_INVALID) { + server_slot = EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; } break; @@ -6222,9 +6225,12 @@ namespace RoF2 break; } case invtype::typeWorld: { - ServerSlot = EQEmu::invslot::WORLD_BEGIN; // evidently, [4,-1,-1,-1] is sent when world object is in experimental mode and combine is clicked if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::WORLD_SIZE) { - ServerSlot += rof2_slot.Slot; + ServerSlot = EQEmu::invslot::WORLD_BEGIN + rof2_slot.Slot; + } + + else if (rof2_slot.Slot == invslot::SLOT_INVALID) { + ServerSlot = EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; } break; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 4abf01ea3..112312afd 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3809,6 +3809,10 @@ namespace SoD 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; } @@ -3887,6 +3891,10 @@ namespace SoD 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; } diff --git a/common/patches/sod_limits.h b/common/patches/sod_limits.h index 555425cc1..82381355e 100644 --- a/common/patches/sod_limits.h +++ b/common/patches/sod_limits.h @@ -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; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 7497df94c..52af1244f 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -3199,6 +3199,10 @@ namespace SoF 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; } @@ -3281,6 +3285,10 @@ namespace SoF 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; } @@ -3505,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 } -} \ No newline at end of file +} diff --git a/common/patches/sof_limits.h b/common/patches/sof_limits.h index fdc688370..ab5a32807 100644 --- a/common/patches/sof_limits.h +++ b/common/patches/sof_limits.h @@ -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; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 85aea5a82..2a1345ad0 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -2504,6 +2504,9 @@ namespace Titanium 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; } @@ -2586,6 +2589,9 @@ namespace Titanium 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; } diff --git a/common/patches/titanium_limits.h b/common/patches/titanium_limits.h index cd69c21e1..33fb3bdc5 100644 --- a/common/patches/titanium_limits.h +++ b/common/patches/titanium_limits.h @@ -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; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index d2a50541f..b199197a2 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -4168,6 +4168,10 @@ namespace UF 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; } @@ -4246,6 +4250,10 @@ namespace UF ServerSlot = ufSlot; } + else if (ufSlot == invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) { + ServerSlot = ufSlot; + } + else if (ufSlot <= invslot::BANK_END && ufSlot >= invslot::BANK_BEGIN) { ServerSlot = ufSlot; } diff --git a/common/patches/uf_limits.h b/common/patches/uf_limits.h index 52924f94d..ef00b912e 100644 --- a/common/patches/uf_limits.h +++ b/common/patches/uf_limits.h @@ -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; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 3467673d8..65fe2c575 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1908,6 +1908,8 @@ luabind::scope lua_register_slot() { luabind::value("GeneralBagsEnd", static_cast(EQEmu::invbag::GENERAL_BAGS_END)), luabind::value("CursorBagBegin", static_cast(EQEmu::invbag::CURSOR_BAG_BEGIN)), luabind::value("CursorBagEnd", static_cast(EQEmu::invbag::CURSOR_BAG_END)), + luabind::value("Tradeskill", static_cast(EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE)), + luabind::value("Augment", static_cast(EQEmu::invslot::SLOT_AUGMENT_GENERIC_RETURN)), // will be revised out luabind::value("BankBegin", static_cast(EQEmu::invslot::BANK_BEGIN)), luabind::value("BankEnd", static_cast(EQEmu::invslot::BANK_END)), luabind::value("BankBagsBegin", static_cast(EQEmu::invbag::BANK_BAGS_BEGIN)), @@ -1929,9 +1931,7 @@ luabind::scope lua_register_slot() { luabind::value("Ring2", static_cast(EQEmu::invslot::slotFinger2)), // deprecated luabind::value("PersonalBegin", static_cast(EQEmu::invslot::GENERAL_BEGIN)), // deprecated luabind::value("PersonalEnd", static_cast(EQEmu::invslot::GENERAL_END)), // deprecated - luabind::value("CursorEnd", 0xFFFE), // deprecated - luabind::value("Tradeskill", static_cast(EQEmu::legacy::SLOT_TRADESKILL)), // deprecated - luabind::value("Augment", static_cast(EQEmu::legacy::SLOT_AUGMENT)) // deprecated + luabind::value("CursorEnd", 0xFFFE) // deprecated (not in use..and never valid vis-a-vis client behavior) ]; } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index a6e0dbd34..72cb51795 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -264,7 +264,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob uint32 some_id = 0; bool worldcontainer=false; - if (in_combine->container_slot == EQEmu::legacy::SLOT_TRADESKILL) { + if (in_combine->container_slot == EQEmu::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE) { if(!worldo) { user->Message(13, "Error: Server is not aware of the tradeskill container you are attempting to use"); return;