|
|
|
@ -25,7 +25,7 @@
@@ -25,7 +25,7 @@
|
|
|
|
|
|
|
|
|
|
_addon.author = 'atom0s'; |
|
|
|
|
_addon.name = 'recast'; |
|
|
|
|
_addon.version = '3.0.0'; |
|
|
|
|
_addon.version = '3.1.0'; |
|
|
|
|
|
|
|
|
|
require 'common' |
|
|
|
|
require 'ffxi.recast' |
|
|
|
@ -46,6 +46,7 @@ local default_config =
@@ -46,6 +46,7 @@ local default_config =
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
local recast_config = default_config; |
|
|
|
|
local SCHJP = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------------------------- |
|
|
|
|
-- func: color_recast_entry |
|
|
|
@ -61,6 +62,30 @@ local function color_recast_entry( s, t )
@@ -61,6 +62,30 @@ local function color_recast_entry( s, t )
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
-- func: naturalsum |
|
|
|
|
-- desc: Gets the sum of the natural numbers of 1 to n. (n(n+1))/2 |
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
local function naturalsum(n) |
|
|
|
|
local val = 0; |
|
|
|
|
for i = n, 0, -1 do |
|
|
|
|
val = val + i; |
|
|
|
|
end |
|
|
|
|
return val; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
-- func: sum |
|
|
|
|
-- desc: Gets the sum of a tables values. |
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
local function sum(t) |
|
|
|
|
local sum = 0; |
|
|
|
|
for k, v in pairs(t) do |
|
|
|
|
sum = sum + naturalsum(v); |
|
|
|
|
end |
|
|
|
|
return sum; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
|
-- func: load |
|
|
|
|
-- desc: Event called when the addon is being loaded. |
|
|
|
@ -120,10 +145,37 @@ ashita.register_event('render', function()
@@ -120,10 +145,37 @@ ashita.register_event('render', function()
|
|
|
|
|
-- Get the abilities name.. |
|
|
|
|
if (x == 0) then |
|
|
|
|
recastName = '(Job One Hour)'; |
|
|
|
|
else |
|
|
|
|
if (ability ~= nil) then |
|
|
|
|
recastName = ability.Name[0]; |
|
|
|
|
elseif (recastId == 231) then |
|
|
|
|
local SCHLevel = 0; |
|
|
|
|
if (AshitaCore:GetDataManager():GetPlayer():GetMainJob() == 20) then |
|
|
|
|
SCHLevel = AshitaCore:GetDataManager():GetPlayer():GetMainJobLevel(); |
|
|
|
|
else |
|
|
|
|
SCHLevel = AshitaCore:GetDataManager():GetPlayer():GetSubJobLevel(); |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
local Val = 48; |
|
|
|
|
if (SCHLevel < 30) then |
|
|
|
|
Val = 240; |
|
|
|
|
elseif (SCHLevel < 50) then |
|
|
|
|
Val = 120; |
|
|
|
|
elseif (SCHLevel < 70)then |
|
|
|
|
Val = 80; |
|
|
|
|
elseif (SCHLevel < 90) then |
|
|
|
|
Val = 60; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
local stratagems = 0; |
|
|
|
|
if (SCHLevel == 99) and (sum(SCHJP) >= 550) then |
|
|
|
|
Val = 33; |
|
|
|
|
stratagems = math.floor((165 - (recastTimer / 60)) / 33); |
|
|
|
|
else |
|
|
|
|
stratagems = math.floor((240 - (recastTimer / 60)) / Val); |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
recastName = 'Stratagems[' .. tostring(stratagems) .. ']'; |
|
|
|
|
recastTimer = math.fmod(recastTimer, (Val * 60)); |
|
|
|
|
elseif (ability ~= nil) then |
|
|
|
|
recastName = ability.Name[0]; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if (#recastName == 0) then |
|
|
|
@ -133,7 +185,7 @@ ashita.register_event('render', function()
@@ -133,7 +185,7 @@ ashita.register_event('render', function()
|
|
|
|
|
-- Add the recast to the table.. |
|
|
|
|
table.insert(e, color_recast_entry(string.format('%s : %s', ashita.ffxi.recast.format_timestamp(recastTimer), recastName), recastTimer)); |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Read the spell recasts.. |
|
|
|
|
for x = 1, 1024 do |
|
|
|
@ -161,3 +213,28 @@ ashita.register_event('render', function()
@@ -161,3 +213,28 @@ ashita.register_event('render', function()
|
|
|
|
|
-- Display the recast timers.. |
|
|
|
|
f:SetText(e:concat('\n')); |
|
|
|
|
end); |
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------------------------- |
|
|
|
|
-- func: incoming_packet |
|
|
|
|
-- desc: Event called when the addon is asked to handle an incoming packet. |
|
|
|
|
--------------------------------------------------------------------------------------------------- |
|
|
|
|
ashita.register_event('incoming_packet', function(id, size, data) |
|
|
|
|
-- Job Points Packet |
|
|
|
|
if (id == 0x008D) then |
|
|
|
|
local count = ((size - 1) / 4) - 1; |
|
|
|
|
for x = 0, count do |
|
|
|
|
if (bit.band(struct.unpack('H', data, 0x07 + (x * 4)), 0xFF03) > 0) then |
|
|
|
|
local entry = struct.unpack('H', data, 0x04 + 1 + (x * 4)); |
|
|
|
|
local job = math.floor(entry / 32); |
|
|
|
|
local index = entry - (job * 32); |
|
|
|
|
local value = bit.band(struct.unpack('B', data, 0x07 + 1 + (x * 4)), 0xFC) / 4; |
|
|
|
|
if (job == 20) then |
|
|
|
|
SCHJP[index + 1] = value; |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
return false; |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
end); |