mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
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:
parent
2aa279edc5
commit
67874d6694
3 changed files with 24 additions and 2 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue