34 lines
1.4 KiB
Lua
34 lines
1.4 KiB
Lua
-- Character list readiness on the character-select screen.
|
|
--
|
|
-- The original screen asks for a new character list every time it appears
|
|
-- (also after a logout), but Enter World only asked the engine whether a
|
|
-- selection exists. With a list from before the logout still in the engine,
|
|
-- Enter World could send that old selection before the new list arrived.
|
|
-- These helpers keep Enter World closed from the request until the answer:
|
|
-- Held(frame) true while the screen waits for its list
|
|
-- Received(frame, count) called from the original CHARACTER_LIST_UPDATE
|
|
-- branch; returns the new value of the waiting flag
|
|
-- A list that arrives while the screen is not shown does not open Enter World:
|
|
-- the screen asks again when it is shown. No event is ever synthesized here.
|
|
CharacterListReady = CharacterListReady or {};
|
|
|
|
local function Log(text)
|
|
if C_Log and C_Log.LogMessage then
|
|
C_Log.LogMessage(text);
|
|
end
|
|
end
|
|
|
|
function CharacterListReady.Held(frame, attempt)
|
|
local held = frame == nil or frame.waitingforCharacterList ~= false;
|
|
if held and attempt then
|
|
Log("GW_CHARSELECT_ENTER_HELD waiting_list=1");
|
|
end
|
|
return held;
|
|
end
|
|
|
|
function CharacterListReady.Received(frame, count)
|
|
local shown = frame ~= nil and frame:IsShown() and true or false;
|
|
Log(string.format("GW_CHARSELECT_LIST_UPDATE shown=%d count=%d", shown and 1 or 0, tonumber(count) or -1));
|
|
return not shown;
|
|
end
|