From e1c6d2a0b787b93f73b96891d9065c93a8065833 Mon Sep 17 00:00:00 2001 From: sindoring Date: Sat, 18 Jul 2026 16:59:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=D0=B3=D1=80=D0=BE=D0=B2=D1=8B=D1=85=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua_scripts/moonwell_game_mode_sync.lua | 93 ++----------------------- 1 file changed, 7 insertions(+), 86 deletions(-) diff --git a/lua_scripts/moonwell_game_mode_sync.lua b/lua_scripts/moonwell_game_mode_sync.lua index 315385e..3e8ce0f 100644 --- a/lua_scripts/moonwell_game_mode_sync.lua +++ b/lua_scripts/moonwell_game_mode_sync.lua @@ -1,86 +1,7 @@ -local AIO = AIO or require("AIO") - -local ADDON_NAME = "MoonWellClient" -local HANDLER_NAME = "Init" -local GAME_MODE_NORMAL = 0 -local GAME_MODE_TRAITOR = 1 -local PLAYER_EVENT_ON_LOGIN = 3 -local AIO_INIT_SEND_DELAY_MS = 1000 - -local MoonWellAIO = rawget(_G, "MoonWellAIO") or {} -_G.MoonWellAIO = MoonWellAIO -local PendingSyncEvents = {} - -local function GetPlayerGameMode(player) - if not player then - return GAME_MODE_NORMAL - end - - local query = CharDBQuery( - "SELECT game_mode FROM mod_gamemodes_characters WHERE guid = " .. player:GetGUIDLow() .. " LIMIT 1" - ) - - if not query or query:IsNull(0) then - return GAME_MODE_NORMAL - end - - local gameMode = query:GetUInt8(0) - if gameMode == GAME_MODE_TRAITOR then - return GAME_MODE_TRAITOR - end - - return GAME_MODE_NORMAL -end - -function MoonWellAIO.GetPlayerGameMode(player) - return GetPlayerGameMode(player) -end - -function MoonWellAIO.SendPlayerGameMode(player) - if not player then - return GAME_MODE_NORMAL - end - - local gameMode = GetPlayerGameMode(player) - AIO.Handle(player, ADDON_NAME, HANDLER_NAME, gameMode) - return gameMode -end - -local function CancelPendingSync(playerGuidLow) - local eventId = PendingSyncEvents[playerGuidLow] - if eventId then - RemoveEventById(eventId) - PendingSyncEvents[playerGuidLow] = nil - end -end - -function MoonWellAIO.SchedulePlayerGameMode(player, delayMs) - if not player then - return - end - - local playerGuidLow = player:GetGUIDLow() - local playerGuid = player:GetGUID() - - CancelPendingSync(playerGuidLow) - - PendingSyncEvents[playerGuidLow] = CreateLuaEvent(function() - PendingSyncEvents[playerGuidLow] = nil - - local onlinePlayer = GetPlayerByGUID(playerGuid) - if onlinePlayer then - MoonWellAIO.SendPlayerGameMode(onlinePlayer) - end - end, delayMs or AIO_INIT_SEND_DELAY_MS, 1) -end - --- Do not append MoonWellClient blocks directly into the AIO init packet: --- the client addon may register its handlers slightly later than AIO itself. -AIO.AddOnInit(function(msg, player) - MoonWellAIO.SchedulePlayerGameMode(player, AIO_INIT_SEND_DELAY_MS) - return msg -end) - -RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, function(_, player) - MoonWellAIO.SchedulePlayerGameMode(player, AIO_INIT_SEND_DELAY_MS) -end) +-- Game-mode UI synchronization is client-native since MoonWellClient 2.0. +-- +-- The authoritative mode still comes from the server in SMSG_CHAR_ENUM as +-- CHARACTER_FLAG_UNK31 (0x40000000). WarcraftXL retains that bit while WoW +-- switches from GlueXML to the in-world FrameXML Lua state. Keeping this file +-- as a no-op avoids stale deployment scripts failing on a missing path while +-- removing the timing-sensitive AIO login event completely.