AshitaXI / Ashita

Issue tracker and wiki for the Ashita project.
https://ashitaxi.com/
6 stars 1 forks source link

[BUG] Addon development: strange e.mode in text_in event #18

Closed Syllendel closed 2 years ago

Syllendel commented 2 years ago

Ashita Version (Type /ashita in-game to get this.) v4.0.0.4

FFXI Version (Type /version in-game to get this.) 30211225_1

Windows Version (ie. Start > About Your PC) Windows 10 Enterprise LTSC version 1809 build 17763.2452

Describe The Bug Some messages appear with weird e.mode instead of the expected one. I've seen this happen after loading a zone or loading/unloading/reloading any addon or plugin. This last several seconds before going back to normal until the next zone/loading/etc... When this happens, the messages are still correctly displayed by the game (proper chat window and color).

Steps To Reproduce Add the following in an addon:

ashita.events.register('text_in', 'text_in_callback1', function (e)
      if (e.injected) then
            return
      end
      -- tested with a simple print(e.mode) and the issue occurs too
      e.message_modified = "Mode " .. e.mode .. ": " .. e.message
end);

Then change zone or unload or load or reload an addon or plugin.

Screenshots All Play-On-line Games Screenshot 2022 01 13 - 19 13 31 73

Additional Information All Play-On-line Games Screenshot 2022 01 13 - 19 00 31 26

All Play-On-line Games Screenshot 2022 01 13 - 19 18 38 99

All Play-On-line Games Screenshot 2022 01 13 - 19 19 09 50

All Play-On-line Games Screenshot 2022 01 13 - 19 00 54 35

All Play-On-line Games Screenshot 2022 01 13 - 19 10 53 63

Syllendel commented 2 years ago

Tested again without any other mod/plugin loaded (Restarted the game with an empty default.txt then manually loaded the 'addons' plugin and my addon to display the e.mode). Issue still occurs.

atom0s commented 2 years ago

This is expected behavior, Ashita returns the full true mode id as it is in the client since it can hold other useful information. To pull the id itself you can use:

    -- Obtain the chat mode..
    local mid = bit.band(e.mode_modified,  0x000000FF); -- Or use e.mode if you need the absolute original.