Browse Source

added login/player name detection

master
matix 5 years ago
parent
commit
1faddc2012
  1. 24
      recast.lua

24
recast.lua

@ -47,7 +47,7 @@ local default_config = @@ -47,7 +47,7 @@ local default_config =
};
local recast_config = default_config;
local SCHJP = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
local logged = false;
---------------------------------------------------------------------------------------------------
-- func: color_recast_entry
-- desc: Colors a recast entry based on the time left to use it..
@ -91,8 +91,12 @@ end @@ -91,8 +91,12 @@ end
-- desc: Event called when the addon is being loaded.
----------------------------------------------------------------------------------------------------
ashita.register_event('load', function()
-- Attempt to load the fps configuration..
recast_config = ashita.settings.load_merged(_addon.path .. 'settings/' .. AshitaCore:GetDataManager():GetParty():GetMemberName(0) .. '.settings.json', recast_config);
-- Attempt to load the configuration..
local party = AshitaCore:GetDataManager():GetParty();
if (party:GetMemberServerId(0) ~= false) then
logged = true;
recast_config = ashita.settings.load_merged(_addon.path .. 'settings/' .. party:GetMemberName(0) .. '.settings.json', recast_config);
end
-- Create our font object..
local f = AshitaCore:GetFontManager():Create('__recast_addon');
@ -235,6 +239,18 @@ ashita.register_event('incoming_packet', function(id, size, data) @@ -235,6 +239,18 @@ ashita.register_event('incoming_packet', function(id, size, data)
end
return false;
end
-- on login/logoff from atom0s @ https://forums.ashitaxi.com/viewtopic.php?f=17&t=240
if (id == 0x000A) then
if (logged == false) then
logged = true;
recast_config = ashita.settings.load_merged(_addon.path .. 'settings/' .. struct.unpack('s', data, 0x84 + 1) .. '.settings.json', recast_config);
end
end
if (id == 0x000B) then
local flag = struct.unpack('b', data, 0x04 + 1);
if (flag) then
logged = false;
end
end
return false;
end);
Loading…
Cancel
Save