source: var.lua

Last change on this file was 131, checked in by drazed, 17 months ago

more trimming/scaling/font changes, base-font-size setting and my-capship support

File size: 8.7 KB
Line 
1targetless.var = {}
2targetless.var.timer = Timer()
3targetless.var.version = "1.7.18"
4targetless.var.state = false
5targetless.var.updatelock = false
6targetless.var.targetnum = 0
7targetless.var.lasttarget = nil
8targetless.var.lasttype = nil
9targetless.var.listpage = "target"
10targetless.var.faction = gkini.ReadString("targetless", "factiontype", "bar")
11targetless.var.noteoffset = 741937
12targetless.var.fontscale = gkini.ReadInt("targetless", "fontscale", 50)/100
13targetless.var.basefontsize = gkini.ReadInt("targetless", "basefontsize", 0)
14targetless.var.res = gkinterface.GetXResolution()
15
16-- calculate the trim size for this device/setting/etc, this is used to trim targetless
17-- ship/name values to fit at the given font/resolution setting
18function targetless.var.trimcalc()
19    targetless.var.trim = math.ceil((targetless.var.res/4 - 88)/4)/(targetless.var.fontscale+1)
20    targetless.var.trimore = math.ceil((gkinterface.GetXResolution()/4-30)/55)
21end
22targetless.var.trimcalc()
23
24-- calculate the font size for this device/setting/etc
25function targetless.var.fontcalc()
26    -- if set in config use that, otherwise default to 11/20 for pc/mobile respectively
27    if targetless.var.basefontsize > 0 then
28        targetless.var.font = targetless.var.basefontsize*(gkinterface.GetXResolution()/1000)*targetless.var.fontscale
29    elseif gkinterface.IsTouchModeEnabled() then
30        -- mobile devices have weird/reduced fonts, upscale them here
31        targetless.var.font = 20*(gkinterface.GetXResolution()/1000)*targetless.var.fontscale
32    else
33        targetless.var.font = 11*(gkinterface.GetXResolution()/1000)*targetless.var.fontscale
34    end
35end
36targetless.var.fontcalc()
37
38-- config settings
39targetless.var.refreshDelay = tonumber(gkini.ReadString("targetless", "refresh", "1000"))
40targetless.var.place = gkini.ReadString("targetless", "place", "right")
41targetless.var.sortBy = gkini.ReadString("targetless", "sort", "distance")
42targetless.var.oresort = gkini.ReadString("targetless", "oresort", "Heliocene")
43targetless.var.showRoid = gkini.ReadString("targetless", "roidtab", "ON")
44targetless.var.showtls = gkini.ReadString("targetless", "showtls", "ON")
45targetless.var.showself = gkini.ReadString("targetless", "showself", "ON")
46targetless.var.showselfcenter = gkini.ReadString("targetless", "showselfcenter", "OFF")
47targetless.var.showtargetcenter = gkini.ReadString("targetless", "showtargetcenter", "ON")
48targetless.var.listmax = tonumber(gkini.ReadString("targetless", "listmax", "10"))
49targetless.var.roidmax = tonumber(gkini.ReadString("targetless", "roidmax", "10"))
50targetless.var.roidrefresh = tonumber(gkini.ReadString("targetless", "roidrefresh", "3000"))
51targetless.var.selfframe = gkini.ReadString("targetless", "selfframe", "OFF")
52targetless.var.selfcapframe = gkini.ReadString("targetless", "selfcapframe", "OFF")
53targetless.var.pinframe = gkini.ReadString("targetless", "pinframe", "ON")
54targetless.var.listframe = gkini.ReadString("targetless", "listframe", "OFF")
55targetless.var.showore = gkini.ReadString("targetless", "showore", "ON")
56targetless.var.scanall = gkini.ReadString("targetless", "scanall", "ON")
57targetless.var.autopin = {}
58targetless.var.autopin.damage = gkini.ReadString("targetless", "pindamage", "ON")
59
60targetless.var.huddisplay = {}
61targetless.var.huddisplay.showpvp = gkini.ReadString("targetless", "showpvp", "ON")
62targetless.var.huddisplay.showpve = gkini.ReadString("targetless", "showpve", "ON")
63targetless.var.huddisplay.showcaps = gkini.ReadString("targetless", "showcaps", "ON")
64targetless.var.huddisplay.showbomb = gkini.ReadString("targetless", "showbomb", "ON")
65targetless.var.huddisplay.showships = gkini.ReadString("targetless", "showships", "ON")
66targetless.var.huddisplay.showore = gkini.ReadString("targetless", "showore", "ON")
67
68targetless.var.mycaps = {}
69
70-- layout format strings
71targetless.var.layout = {}
72
73targetless.var.layout.self = {
74    {
75        {"<tab>","<health>"},
76    },
77
78    {
79        {"<fill>","<lstand>"},
80    },
81    {
82        {"<tab>","<healthtext>","<name>","<fill>"},
83    },
84}
85
86targetless.var.layout.selfcenter = {
87    {
88        {"<healthtext>","<fill>","<lstand>"},
89    },
90}
91
92targetless.var.layout.center = {
93    {
94        {"<distance>","<fill>"},
95        {"<healthtext>","<fill>"},
96        {"<tab>","<fill>"},
97        {"<health>"},
98    },
99    {
100        {"<fill>","<istand>","<sstand>","<ustand>","<lstand>"},
101        {"<tab>","<fill>"},
102        {"<fill>","<pcship>"},
103        {"<name>","<fill>"},
104    },
105}
106
107-- this is the new format to be used by all ships
108-- ships can hide these values as needed, but layout if present is locked
109-- to what this container defines :(
110--
111-- TODO implement list cells, in progress
112targetless.var.layout.ship = {
113    {
114        {"<tab>","<health>"},
115
116        -- this row won't be present on npc's
117        {"<pcship>","<fill>","<istand>","<sstand>","<ustand>"},
118    },
119    {
120        {"<fill>","<distance>","<lstand>"},
121    },
122    {
123        -- name is set to ship for npc's, playername for pc's.
124        {"<tab>","<healthtext>","<name>","<fill>"},
125    },
126}
127
128
129targetless.var.layout.pc = {
130    {
131        {"<fill>","<istand>","<sstand>","<ustand>","<lstand>"},
132        {"<health>"},
133    },
134    {
135        {"<name>"},
136        {"<healthtext>","<pcship>","<fill>","<distance>"},
137    },
138}
139
140targetless.var.layout.npc = {
141    {
142        {"<health>"},
143    },
144    {
145        {"<fill>","<lstand>"},
146    },
147    {
148        {"<healthtext>","<npcship>","<fill>","<distance>"},
149    },
150}
151
152targetless.var.layout.cap = {
153    {
154        {"<health>"},
155        -- {"<turrets>"}
156    },
157    {
158        {"<fill>","<lstand>"},
159    },
160    {
161        {"<healthtext>","<capship>","<fill>","<distance>"},
162    },
163}
164
165targetless.var.layout.mycap = {
166    {
167        {"<tab>","<health>"},
168    },
169    {
170        {"<tab>","<healthtext>","<capship>","<fill>","<distance>"},
171    },
172}
173
174targetless.var.layout.roid = {
175    {
176        {"<tab>","<ore>","<fill>","<distance>"},
177    },
178}
179
180--targetless.var.layout.pc = gkini.ReadString("targetless", "pclayout",
181--    "[{<fill><istand><sstand><ustand><lstand>}{<health>}][{<name>}{<healthtext><pcship><fill><distance>}]")
182--targetless.var.layout.npc = gkini.ReadString("targetless", "npclayout",
183--    "[{<health>}][{<fill><lstand>}][{}{<healthtext><npcship><fill><distance>}]")
184--targetless.var.layout.cap = gkini.ReadString("targetless", "npclayout",
185--    "[{<health>}][{<fill><lstand>}][{}{<healthtext><npcship><fill><distance>}]")
186--targetless.var.layout.roid = gkini.ReadString("targetless", "roidlayout", "{<tab><note><fill><id>}{<tab><ore>}")
187
188
189-- factions enum
190targetless.var.factions = {}
191targetless.var.factions[12] = "Ineubis"
192targetless.var.factions[6] = "Valent"
193targetless.var.factions[99] = "Dev"
194targetless.var.factions[1] = "Itani"
195targetless.var.factions[3] = "Union"
196targetless.var.factions[7] = "Orion"
197targetless.var.factions[2] = "Serco"
198targetless.var.factions[8] = "Axia"
199targetless.var.factions[4] = "TPG"
200targetless.var.factions[9] = "Corvus"
201targetless.var.factions[0] = "Unaligned"
202targetless.var.factions[10] = "Tunguska"
203targetless.var.factions[5] = "BioCom"
204targetless.var.factions[11] = "Aeolus"
205targetless.var.factions[13] = "XangXi"
206
207targetless.var.orecolor = {}
208targetless.var.orecolor["Aq"] = "\127aec6d6Aq\127o"
209targetless.var.orecolor["Si"] = "\1279c8a5fSi\127o"
210targetless.var.orecolor["Ca"] = "\127749281Ca\127o"
211targetless.var.orecolor["Fe"] = "\127a4a39bFe\127o"
212targetless.var.orecolor["Is"] = "\12712d7e7Is\127o"
213targetless.var.orecolor["Va"] = "\127dda994Va\127o"
214targetless.var.orecolor["Xi"] = "\12716ef25Xi\127o"
215targetless.var.orecolor["La"] = "\127a320e5La\127o"
216targetless.var.orecolor["De"] = "\12713a2d9De\127o"
217targetless.var.orecolor["Py"] = "\127e38163Py\127o"
218targetless.var.orecolor["Ap"] = "\12725578dAp\127o"
219targetless.var.orecolor["Pe"] = "\127f9f825Pe\127o"
220targetless.var.orecolor["He"] = "\127d73d25He\127o"
221
222
223-- icons
224targetless.var.IMAGE_DIR = "plugins/targetless/images/"
225targetless.var.images = {}
226targetless.var.images.smile =
227{
228    iup.LoadImage("smile/POS.png"),
229    iup.LoadImage("smile/admire.png"),
230    iup.LoadImage("smile/respect.png"),
231    iup.LoadImage("smile/neutral.png"),
232    iup.LoadImage("smile/dislike.png"),
233    iup.LoadImage("smile/hate.png"),
234    iup.LoadImage("smile/KOS.png"),
235    iup.LoadImage("smile/health.png"),
236}
237targetless.var.images.wheel =
238{
239    iup.LoadImage("wheel/POS.png"),
240    iup.LoadImage("wheel/admire.png"),
241    iup.LoadImage("wheel/respect.png"),
242    iup.LoadImage("wheel/neutral.png"),
243    iup.LoadImage("wheel/dislike.png"),
244    iup.LoadImage("wheel/hate.png"),
245    iup.LoadImage("wheel/KOS.png"),
246    iup.LoadImage("wheel/health.png"),
247}
Note: See TracBrowser for help on using the repository browser.