diff --git a/src/io/functions/iologindata_load_player.cpp b/src/io/functions/iologindata_load_player.cpp index 06bee954c02..370aeeaaa58 100644 --- a/src/io/functions/iologindata_load_player.cpp +++ b/src/io/functions/iologindata_load_player.cpp @@ -538,11 +538,9 @@ void IOLoginDataLoad::loadPlayerInventoryItems(const std::shared_ptr &pl return; } - bool oldProtocol = g_configManager().getBoolean(OLD_PROTOCOL) && player->getProtocolVersion() < 1200; auto query = fmt::format("SELECT pid, sid, itemtype, count, attributes FROM player_items WHERE player_id = {} ORDER BY sid DESC", player->getGUID()); ItemsMap inventoryItems; - std::vector>> openContainersList; std::vector> itemsToStartDecaying; try { @@ -576,12 +574,6 @@ void IOLoginDataLoad::loadPlayerInventoryItems(const std::shared_ptr &pl const std::shared_ptr &itemContainer = item->getContainer(); if (itemContainer) { - if (!oldProtocol) { - auto cid = item->getAttribute(ItemAttribute_t::OPENCONTAINER); - if (cid > 0) { - openContainersList.emplace_back(cid, itemContainer); - } - } for (const bool isLootContainer : { true, false }) { const auto checkAttribute = isLootContainer ? ItemAttribute_t::QUICKLOOTCONTAINER : ItemAttribute_t::OBTAINCONTAINER; if (item->hasAttribute(checkAttribute)) { @@ -603,17 +595,6 @@ void IOLoginDataLoad::loadPlayerInventoryItems(const std::shared_ptr &pl item->startDecaying(); } - if (!oldProtocol) { - std::ranges::sort(openContainersList.begin(), openContainersList.end(), [](const std::pair> &left, const std::pair> &right) { - return left.first < right.first; - }); - - for (auto &it : openContainersList) { - player->addContainer(it.first - 1, it.second); - player->onSendContainer(it.second); - } - } - } catch (const std::exception &e) { g_logger().error("[IOLoginDataLoad::loadPlayerInventoryItems] - Exception during inventory loading: {}", e.what()); } diff --git a/src/lua/functions/events/event_callback_functions.cpp b/src/lua/functions/events/event_callback_functions.cpp index 89146694e89..017aff48673 100644 --- a/src/lua/functions/events/event_callback_functions.cpp +++ b/src/lua/functions/events/event_callback_functions.cpp @@ -36,7 +36,7 @@ int EventCallbackFunctions::luaEventCallbackCreate(lua_State* luaState) { const auto &callbackName = Lua::getString(luaState, 2); if (callbackName.empty()) { Lua::reportErrorFunc("Invalid callback name"); - return 1; + return 0; } bool skipDuplicationCheck = Lua::getBoolean(luaState, 3, false); @@ -71,6 +71,7 @@ int EventCallbackFunctions::luaEventCallbackType(lua_State* luaState) { if (!found) { g_logger().error("[{}] No valid event name: {}", __func__, typeName); Lua::pushBoolean(luaState, false); + return 1; } Lua::pushBoolean(luaState, true); @@ -101,12 +102,12 @@ int EventCallbackFunctions::luaEventCallbackRegister(lua_State* luaState) { int EventCallbackFunctions::luaEventCallbackLoad(lua_State* luaState) { const auto &callback = Lua::getUserdataShared(luaState, 1, "EventCallback"); if (!callback) { - return 1; + return 0; } if (!callback->loadScriptId()) { Lua::reportErrorFunc("Cannot load callback"); - return 1; + return 0; } Lua::pushBoolean(luaState, true); diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index a2d933ef99f..096382032d2 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -7123,7 +7123,6 @@ void ProtocolGame::sendAddCreature(const std::shared_ptr &creature, co if (isLogin) { sendMagicEffect(pos, CONST_ME_TELEPORT); - sendHotkeyPreset(); sendDisableLoginMusic(); } @@ -7197,8 +7196,8 @@ void ProtocolGame::sendAddCreature(const std::shared_ptr &creature, co player->sendGameNews(); player->sendIcons(); - // We need to manually send the open containers on player login, on IOLoginData it won't work. - if (isLogin && oldProtocol) { + // Send open containers after login. + if (isLogin) { player->openPlayerContainers(); } } @@ -9796,20 +9795,6 @@ void ProtocolGame::sendDisableLoginMusic() { writeToOutputBuffer(msg); } -void ProtocolGame::sendHotkeyPreset() { - if (!player || oldProtocol) { - return; - } - - auto vocation = g_vocations().getVocation(player->getVocation()->getBaseId()); - if (vocation) { - NetworkMessage msg; - msg.addByte(0x9D); - msg.add(vocation->getClientId()); - writeToOutputBuffer(msg); - } -} - void ProtocolGame::sendTakeScreenshot(Screenshot_t screenshotType) { if (screenshotType == SCREENSHOT_TYPE_NONE || oldProtocol) { return; diff --git a/src/server/network/protocol/protocolgame.hpp b/src/server/network/protocol/protocolgame.hpp index b0d3e045e23..81f9e20102b 100644 --- a/src/server/network/protocol/protocolgame.hpp +++ b/src/server/network/protocol/protocolgame.hpp @@ -567,7 +567,6 @@ class ProtocolGame final : public Protocol { void sendSingleSoundEffect(const Position &pos, SoundEffect_t id, SourceEffect_t source); void sendDoubleSoundEffect(const Position &pos, SoundEffect_t mainSoundId, SourceEffect_t mainSource, SoundEffect_t secondarySoundId, SourceEffect_t secondarySource); - void sendHotkeyPreset(); void sendTakeScreenshot(Screenshot_t screenshotType); void sendDisableLoginMusic();