Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/io/functions/iologindata_load_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,9 @@ void IOLoginDataLoad::loadPlayerInventoryItems(const std::shared_ptr<Player> &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<std::pair<uint8_t, std::shared_ptr<Container>>> openContainersList;
std::vector<std::shared_ptr<Item>> itemsToStartDecaying;

try {
Expand Down Expand Up @@ -576,12 +574,6 @@ void IOLoginDataLoad::loadPlayerInventoryItems(const std::shared_ptr<Player> &pl

const std::shared_ptr<Container> &itemContainer = item->getContainer();
if (itemContainer) {
if (!oldProtocol) {
auto cid = item->getAttribute<int64_t>(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)) {
Expand All @@ -603,17 +595,6 @@ void IOLoginDataLoad::loadPlayerInventoryItems(const std::shared_ptr<Player> &pl
item->startDecaying();
}

if (!oldProtocol) {
std::ranges::sort(openContainersList.begin(), openContainersList.end(), [](const std::pair<uint8_t, std::shared_ptr<Container>> &left, const std::pair<uint8_t, std::shared_ptr<Container>> &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());
}
Expand Down
7 changes: 4 additions & 3 deletions src/lua/functions/events/event_callback_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -101,12 +102,12 @@ int EventCallbackFunctions::luaEventCallbackRegister(lua_State* luaState) {
int EventCallbackFunctions::luaEventCallbackLoad(lua_State* luaState) {
const auto &callback = Lua::getUserdataShared<EventCallback>(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);
Expand Down
19 changes: 2 additions & 17 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7123,7 +7123,6 @@ void ProtocolGame::sendAddCreature(const std::shared_ptr<Creature> &creature, co

if (isLogin) {
sendMagicEffect(pos, CONST_ME_TELEPORT);
sendHotkeyPreset();
sendDisableLoginMusic();
}

Expand Down Expand Up @@ -7197,8 +7196,8 @@ void ProtocolGame::sendAddCreature(const std::shared_ptr<Creature> &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();
}
}
Expand Down Expand Up @@ -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<uint32_t>(vocation->getClientId());
writeToOutputBuffer(msg);
}
}

void ProtocolGame::sendTakeScreenshot(Screenshot_t screenshotType) {
if (screenshotType == SCREENSHOT_TYPE_NONE || oldProtocol) {
return;
Expand Down
1 change: 0 additions & 1 deletion src/server/network/protocol/protocolgame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading