fix(protocol): parse missing client events & warn on unknown event (#1804)

New Features:
- Added notifications for bounty tasks, weekly tasks, and spell unlocks.
- Added support for displaying these new event types in the game client.

Bug Fixes:
- Unknown event types are now safely ignored and logged instead of interrupting event processing.
This commit is contained in:
João Pedro M. C. Hluchan 2026-08-14 20:07:54 -03:00 committed by GitHub
parent 2aa279edc5
commit 67874d6694
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 2 deletions

View file

@ -42,7 +42,10 @@ local eventCategory = {
CLIENT_EVENT_TYPE_QUEST = 8,
CLIENT_EVENT_TYPE_COSMETIC = 9,
CLIENT_EVENT_TYPE_PROFICIENCY = 10,
CLIENT_EVENT_TYPE_LAST = 11
CLIENT_EVENT_TYPE_BOUNTY_TASK = 11,
CLIENT_EVENT_TYPE_WEEKLY_TASK = 12,
CLIENT_EVENT_TYPE_SPELL_UNLOCKED = 13,
CLIENT_EVENT_TYPE_LAST = 14
}
local eventType = {

View file

@ -998,6 +998,9 @@ namespace Otc
CLIENT_EVENT_TYPE_QUEST = 8,
CLIENT_EVENT_TYPE_COSMETIC = 9,
CLIENT_EVENT_TYPE_PROFICIENCY = 10,
CLIENT_EVENT_TYPE_BOUNTY_TASK = 11,
CLIENT_EVENT_TYPE_WEEKLY_TASK = 12,
CLIENT_EVENT_TYPE_SPELL_UNLOCKED = 13,
CLIENT_EVENT_TYPE_LAST
};

View file

@ -7141,8 +7141,24 @@ void ProtocolGame::parseClientEvent(const InputMessagePtr& msg)
g_lua.callGlobalField("g_game", "onClientEvent", type, itemId, message);
break;
}
case Otc::CLIENT_EVENT_TYPE_BOUNTY_TASK: {
const auto taskId = msg->getU16();
g_lua.callGlobalField("g_game", "onClientEvent", type, taskId);
break;
}
case Otc::CLIENT_EVENT_TYPE_WEEKLY_TASK: {
const auto raceId = msg->getU16();
g_lua.callGlobalField("g_game", "onClientEvent", type, raceId);
break;
}
case Otc::CLIENT_EVENT_TYPE_SPELL_UNLOCKED: {
const auto spellId = msg->getU32();
g_lua.callGlobalField("g_game", "onClientEvent", type, spellId);
break;
}
default:
throw stdext::exception("[ProtocolGame::parseClientEvent] Unknown event type {}", static_cast<uint8_t>(type));
g_logger.warning(std::format("[ProtocolGame::parseClientEvent] Unknown event type {}", static_cast<uint8_t>(type)));
break;
}
}