-
Notifications
You must be signed in to change notification settings - Fork 28
/
init.lua
91 lines (76 loc) · 2.51 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
local helpers = require("solylib.helpers")
local unitxt = require("solylib.unitxt")
local libitems = require("solylib.items.items")
local cfg = require("Mags.configuration")
local _PlayerMyIndex = 0x00A9C4F4
local function DisplayMags()
local playerIndex = pso.read_u32(_PlayerMyIndex)
local itemList = libitems.GetItemList(playerIndex, false)
for index, item in ipairs(itemList) do
if item.type == 2 then
-- Index
local text = string.format("%2i", index)
helpers.imguiText(text, cfg.fontColor, false)
-- Name
text = string.format(" %s", item.name)
helpers.imguiText(text, cfg.fontColor, false)
-- Stats
text = string.format(" [%.2f/%.2f/%.2f/%.2f]",
item.mag.DFP,
item.mag.ATP,
item.mag.ATA,
item.mag.MST)
helpers.imguiText(text, cfg.fontColor, false)
-- PBs
text = string.format(" [%s|%s|%s]",
unitxt.GetPhotonBlastName(item.mag.pbLeft, true),
unitxt.GetPhotonBlastName(item.mag.pbCenter, true),
unitxt.GetPhotonBlastName(item.mag.pbRight, true))
helpers.imguiText(text, cfg.fontColor, false)
-- Feed timer
helpers.imguiText(" [", cfg.fontColor)
local feedtimerStr = string.format("%is", item.mag.timer)
local ftColor = 0
for i=1,table.getn(cfg.magFeedTimerColors),2 do
if ftColor == 0 then
if item.mag.timer < cfg.magFeedTimerColors[i] then
ftColor = i + 1
end
end
end
if item.mag.timer <= 0 then
helpers.imguiText(cfg.readyToBeFedString, cfg.magFeedTimerColors[ftColor])
else
helpers.imguiText(feedtimerStr, cfg.magFeedTimerColors[ftColor])
end
helpers.imguiText("]", cfg.fontColor, false)
helpers.imguiText("", cfg.fontColor, true)
end
end
end
local function present()
if cfg.enable == false then
return
end
imgui.Begin("Mags")
imgui.SetWindowFontScale(cfg.fontSize)
DisplayMags()
imgui.End()
end
local function init()
return
{
name = "Mags",
version = "1.0.0",
author = "Solybum",
description = "Mag list to know when to feed them",
present = present,
}
end
return
{
__addon =
{
init = init
}
}