LandSandBoat / server

:sailboat: LandSandBoat - a server emulator for Final Fantasy XI
https://landsandboat.github.io/server/
GNU General Public License v3.0
294 stars 591 forks source link

Module idea: Print warnings before known problem CS's, in relation to FastCS etc. #646

Open zach2good opened 3 years ago

zach2good commented 3 years ago

I don't remember any exact examples, but the concept is easy.

Would look something like this:

-----------------------------------
-- Print warnings before CS's that have problems with FastCS etc.
-----------------------------------
require("modules/module_utils")
-----------------------------------
local m = Module:new("fastcs_warnings")
m:setEnabled(true)

local printWarning = function(player, npc, problemId)
    player:PrintToPlayer("NOTE: " .. npc:getName() .. " (" .. problemId .. ") : This CSID is marked as having problems with addons such as Config and FastCS. If you encounter problems, please retry without those addons enabled.")
end

local addWarning = function(zoneName, npcName, problemId)
    m:addOverride("xi.zones." .. zoneName .. ".npcs." .. npcName .. ".onTrigger" , function(player, npc)
        super(player, npc)

        -- Need a binding to get the event number a player is in, if they're in one
        local csid = player:getCurrentEventId()
        if csid == problemId then
            printWarning(player, npc, problemId)
        end
    end)
end

-- List of known NPCs with problem CSIDs
addWarning("Tavnazian_Safehold", "Despachiaire", 33)
addWarning("Tavnazian_Safehold", "Eliot", 44)
addWarning("Tavnazian_Safehold", "Ferchinne", 55)

return m

We need to let the super fire first, so we know what CS the player is in. Otherwise, we're just flying blind...

Could also add a localVar so the warning doesn't get spammed.

Additional Information (Steps to reproduce/Expected behavior) :

zach2good commented 3 years ago

Would be useful to start collecting information about which CSs are problems

RAIST5150 commented 3 years ago

Like this idea... just curious, does the framework have some built in alert function that could more less just be dropped into a script?

Thinking kinda like how they could do back in the day with Java? Mind you, surely not the annoying pop up that java put on your screen, but a similar construct?

Just wondering if there would be a way to streamline it. You guys have so much on the plate already without building a new alert system.

zach2good commented 3 years ago

Technically no, we don't have the ability to inject anything like that into the client from the server without modification. It's possible for us to use an unused packet ID to send things to the client, for custom addons in Windower/Ashita to pick up and display an alert with, but that's straying pretty far into custom territory

TeoTwawki commented 3 years ago

We can also just spoof a chat message using PrintToPlayer right before the call to start the cs event. SYSTEM_3 shows up as the yellow warning color SE uses and the default is the purple server wide system messages.

require("scripts/globals/msg")
player:PrintToPlayer("Warning text here", xi.msg.channel.SYSTEM_3, nil)

That nil argument is the speaker: don't need a speaker in this example, as system messages aren't spoken by a named entity.

(It's even possible to make a binding the checks the players version first, though that's not relevant when the issues are caused by addons or adjusting their frame rate limits and I will not be nice to anyone that tries to stuff a ton of conditional checks for client version everywhere.)

but that's straying pretty far into custom territory

Definitely. I think optimal outcome is someone rolls a 3rd party addon that checks your client state/addons/plugin loadout and what thing you are starting in game, and just turns those on/off for you - or at least displays a message so you know what you did.

TeoTwawki commented 3 years ago

As a module..I'd say localvar check to see that the warning has displayed before printing a warning via spoof, start event if it already has. just my thoughts if going there.

zach2good commented 3 years ago

Collecting problem CSs https://github.com/LandSandBoat/server/issues/686