1-- @docclass
2g_tooltip = {}
3
4-- private variables
5local toolTipLabel
6local currentHoveredWidget
7-- private functions
8local function moveToolTip(first)
9 if first and (toolTipLabel:isVisible() or toolTipLabel:getOpacity() < 0.1) then
10
11 local pos = g_window.getMousePosition()
12 local windowSize = g_window.getSize()
13 local labelSize = toolTipLabel:getSize()
14
15 pos.x = pos.x + 1
16 pos.y = pos.y + 1
17
18 if windowSize.width - (pos.x + labelSize.width) < 10 then
19 pos.x = pos.x - labelSize.width - 3
20 else
21 pos.x = pos.x + 10
22 end
23
24 if windowSize.height - (pos.y + labelSize.height) < 10 then
25 pos.y = pos.y - labelSize.height - 3
26 else
27 pos.y = pos.y + 10
28 end
29
30 toolTipLabel:setPosition(pos)
31 end
32end
33local function onWidgetHoverChange(widget, hovered)
34 if hovered then
35 if widget.tooltip and not g_mouse.isPressed() then
36 g_tooltip.display(widget.tooltip)
37 currentHoveredWidget = widget
38 end
39 else
40 if widget == currentHoveredWidget then
41 g_tooltip.hide()
42 currentHoveredWidget = nil
43 end
44 end
45end
46
47local function onWidgetStyleApply(widget, styleName, styleNode)
48 if styleNode.tooltip then
49 widget.tooltip = styleNode.tooltip
50 end
51end
52
53-- public functions
54function mask_number(n)
55 local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
56 return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
57end
58function g_tooltip.init()
59 connect(UIWidget, { onStyleApply = onWidgetStyleApply,
60 onHoverChange = onWidgetHoverChange})
61
62 addEvent(function()
63 toolTipLabel = g_ui.createWidget('UILabel', rootWidget)
64 toolTipLabel:setId('toolTip')
65
66 Nome = g_ui.createWidget('UILabel', toolTipLabel)
67 Nome:setId('itemName')
68 Nome:addAnchor(AnchorTop, 'parent', AnchorTop)
69 Nome:addAnchor(AnchorLeft, 'parent', AnchorLeft)
70 Nome:setTextAlign(AlignCenter)
71 Nome:setMarginTop(4)
72 Nome:setMarginLeft(5)
73 Nome:setSize({width = 185, height = 20})
74
75 MinName = g_ui.createWidget('UILabel', toolTipLabel)
76 MinName:setId('MinLabel')
77 MinName:addAnchor(AnchorTop, 'itemName', AnchorBottom)
78 MinName:addAnchor(AnchorLeft, 'parent', AnchorLeft)
79 MinName:setFont('small-9px')
80 MinName:setTextAlign(AlignCenter)
81 MinName:setText('MINIMO')
82 MinName:setMarginTop(25)
83 MinName:setMarginLeft(08)
84 MinName:setSize({width = 55, height = 20})
85
86 MINIMO = g_ui.createWidget('UILabel', toolTipLabel)
87 MINIMO:setId('MinValue')
88 MINIMO:addAnchor(AnchorTop, 'MinLabel', AnchorBottom)
89 MINIMO:addAnchor(AnchorLeft, 'parent', AnchorLeft)
90 MINIMO:setFont('sans-bold-16px')
91 MINIMO:setTextAlign(AlignCenter)
92 MINIMO:setMarginTop(02)
93 MINIMO:setMarginLeft(08)
94 MINIMO:setSize({width = 55, height = 20})
95
96 iconType = g_ui.createWidget('UILabel', toolTipLabel)
97 iconType:setId('IconType')
98 iconType:addAnchor(AnchorTop, 'itemName', AnchorBottom)
99 iconType:addAnchor(AnchorLeft, 'MinValue', AnchorRight)
100 iconType:setImageSource("/images/game/states/ammo")
101 iconType:setMarginTop(38)
102 iconType:setMarginLeft(22)
103 iconType:setSize({width = 18, height = 18})
104
105 TypeDMG = g_ui.createWidget('UILabel', toolTipLabel)
106 TypeDMG:setId('TypeDMG')
107 TypeDMG:addAnchor(AnchorTop, 'IconType', AnchorBottom)
108 TypeDMG:addAnchor(AnchorLeft, 'MinValue', AnchorRight)
109 TypeDMG:setFont('small-9px')
110 TypeDMG:setTextAlign(AlignCenter)
111 TypeDMG:setText('100')
112 TypeDMG:setMarginTop(02)
113 TypeDMG:setMarginLeft(03)
114 TypeDMG:setSize({width = 55, height = 20})
115
116 MaxName = g_ui.createWidget('UILabel', toolTipLabel)
117 MaxName:setId('MaxLabel')
118 MaxName:addAnchor(AnchorTop, 'itemName', AnchorBottom)
119 MaxName:addAnchor(AnchorRight, 'parent', AnchorRight)
120 MaxName:setFont('small-9px')
121 MaxName:setTextAlign(AlignCenter)
122 MaxName:setText('MAXIMO')
123 MaxName:setMarginTop(25)
124 MaxName:setMarginRight(08)
125 MaxName:setSize({width = 55, height = 20})
126
127 MAXIMO = g_ui.createWidget('UILabel', toolTipLabel)
128 MAXIMO:setId('MaxValue')
129 MAXIMO:addAnchor(AnchorTop, 'MaxLabel', AnchorBottom)
130 MAXIMO:addAnchor(AnchorRight, 'parent', AnchorRight)
131 MAXIMO:setFont('sans-bold-16px')
132 MAXIMO:setTextAlign(AlignCenter)
133 MAXIMO:setMarginTop(02)
134 MAXIMO:setMarginRight(08)
135 MAXIMO:setSize({width = 55, height = 20})
136
137 DefName = g_ui.createWidget('UILabel', toolTipLabel)
138 DefName:setId('DefLabel')
139 DefName:addAnchor(AnchorTop, 'itemName', AnchorBottom)
140 DefName:addAnchor(AnchorLeft, 'parent', AnchorLeft)
141 DefName:setFont('small-9px')
142 DefName:setTextAlign(AlignCenter)
143 DefName:setText(tr('DEFESA'))
144 DefName:setMarginTop(30)
145 DefName:setMarginLeft(08)
146 DefName:setSize({width = 50, height = 20})
147
148 DEF = g_ui.createWidget('UILabel', toolTipLabel)
149 DEF:setId('DEFValue')
150 DEF:addAnchor(AnchorTop, 'DefLabel', AnchorBottom)
151 DEF:addAnchor(AnchorLeft, 'parent', AnchorLeft)
152 DEF:setFont('sans-bold-16px')
153 DEF:setTextAlign(AlignCenter)
154 DEF:setMarginLeft(08)
155 DEF:setSize({width = 50, height = 20})
156
157 CompDefName = g_ui.createWidget('UILabel', toolTipLabel)
158 CompDefName:setId('CompararDef')
159 CompDefName:addAnchor(AnchorTop, 'DefLabel', AnchorBottom)
160 CompDefName:addAnchor(AnchorLeft, 'DEFValue', AnchorRight)
161 CompDefName:setFont('small-9px')
162 CompDefName:setTextAlign(AlignCenter)
163 CompDefName:setText('-10')
164 CompDefName:setMarginTop(10)
165 CompDefName:setMarginLeft(-15)
166 CompDefName:setSize({width = 20, height = 20})
167
168 EsqName = g_ui.createWidget('UILabel', toolTipLabel)
169 EsqName:setId('EsqLabel')
170 EsqName:addAnchor(AnchorTop, 'itemName', AnchorBottom)
171 EsqName:addAnchor(AnchorLeft, 'DefLabel', AnchorRight)
172 EsqName:setFont('small-9px')
173 EsqName:setText(tr('ESQUIVA'))
174 EsqName:setTextAlign(AlignCenter)
175 EsqName:setMarginTop(30)
176 EsqName:setMarginLeft(10)
177 EsqName:setSize({width = 50, height = 20})
178
179 ESQ = g_ui.createWidget('UILabel', toolTipLabel)
180 ESQ:setId('ESQValue')
181 ESQ:addAnchor(AnchorTop, 'EsqLabel', AnchorBottom)
182 ESQ:addAnchor(AnchorLeft, 'DEFValue', AnchorRight)
183 ESQ:setFont('sans-bold-16px')
184 ESQ:setTextAlign(AlignCenter)
185 ESQ:setMarginLeft(10)
186 ESQ:setSize({width = 50, height = 20})
187
188 CompEsqName = g_ui.createWidget('UILabel', toolTipLabel)
189 CompEsqName:setId('CompararEsq')
190 CompEsqName:addAnchor(AnchorTop, 'EsqLabel', AnchorBottom)
191 CompEsqName:addAnchor(AnchorLeft, 'ESQValue', AnchorRight)
192 CompEsqName:setFont('small-9px')
193 CompEsqName:setTextAlign(AlignCenter)
194 CompEsqName:setText('-10')
195 CompEsqName:setMarginTop(10)
196 CompEsqName:setMarginLeft(-15)
197 CompEsqName:setSize({width = 20, height = 20})
198
199 MagName = g_ui.createWidget('UILabel', toolTipLabel)
200 MagName:setId('MagLabel')
201 MagName:addAnchor(AnchorTop, 'itemName', AnchorBottom)
202 MagName:addAnchor(AnchorLeft, 'EsqLabel', AnchorRight)
203 MagName:setFont('small-9px')
204 MagName:setTextAlign(AlignCenter)
205 MagName:setText(tr('MAGICO'))
206 MagName:setMarginTop(30)
207 MagName:setMarginLeft(10)
208 MagName:setSize({width = 50, height = 20})
209
210 MAG = g_ui.createWidget('UILabel', toolTipLabel)
211 MAG:setId('MAGValue')
212 MAG:addAnchor(AnchorTop, 'MagLabel', AnchorBottom)
213 MAG:addAnchor(AnchorLeft, 'ESQValue', AnchorRight)
214 MAG:setFont('sans-bold-16px')
215 MAG:setTextAlign(AlignCenter)
216 MAG:setMarginLeft(10)
217 MAG:setSize({width = 50, height = 20})
218
219 CompMagName = g_ui.createWidget('UILabel', toolTipLabel)
220 CompMagName:setId('CompararMag')
221 CompMagName:addAnchor(AnchorTop, 'MagLabel', AnchorBottom)
222 CompMagName:addAnchor(AnchorLeft, 'MAGValue', AnchorRight)
223 CompMagName:setFont('small-9px')
224 CompMagName:setTextAlign(AlignCenter)
225 CompMagName:setText('-10')
226 CompMagName:setMarginTop(10)
227 CompMagName:setMarginLeft(-15)
228 CompMagName:setSize({width = 20, height = 20})
229
230 Desc = g_ui.createWidget('UILabel', toolTipLabel)
231 Desc:setId('itemDesc')
232 Desc:addAnchor(AnchorTop, 'itemName', AnchorBottom)
233 Desc:addAnchor(AnchorLeft, 'parent', AnchorLeft)
234 Desc:addAnchor(AnchorRight, 'parent', AnchorRight)
235 Desc:setTextAlign(AlignLeft)
236 Desc:setFont('small-9px')
237 Desc:setTextWrap(true)
238 Desc:setMarginTop(30)
239 Desc:setMarginRight(15)
240 Desc:setMarginLeft(15)
241 Desc:setSize({width = 180, height = 55})
242
243 Star = g_ui.createWidget('UILabel', toolTipLabel)
244 Star:setId('itemStar')
245 Star:addAnchor(AnchorTop, 'itemDesc', AnchorBottom)
246 Star:addAnchor(AnchorLeft, 'parent', AnchorLeft)
247 Star:setImageSource("/images/custom/UI/star_0")
248 Star:setSize({width = 31, height = 10})
249 Star:setMarginTop(10)
250 Star:setMarginLeft(77)
251
252 SKILL01 = g_ui.createWidget('UILabel', toolTipLabel)
253 SKILL01:setId('SKILL01')
254 SKILL01:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
255 SKILL01:addAnchor(AnchorLeft, 'parent', AnchorLeft)
256 SKILL01:setImageSource("/images/custom/UI/insert_skill")
257 SKILL01:setMarginTop(50)
258 SKILL01:setMarginLeft(24)
259 SKILL01:setSize({width = 38, height = 38})
260
261 SKILL02 = g_ui.createWidget('UILabel', toolTipLabel)
262 SKILL02:setId('SKILL02')
263 SKILL02:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
264 SKILL02:addAnchor(AnchorLeft, 'SKILL01', AnchorRight)
265 SKILL02:setImageSource("/images/custom/UI/insert_skill")
266 SKILL02:setMarginTop(50)
267 SKILL02:setMarginLeft(13)
268 SKILL02:setSize({width = 38, height = 38})
269
270 SKILL03 = g_ui.createWidget('UILabel', toolTipLabel)
271 SKILL03:setId('SKILL03')
272 SKILL03:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
273 SKILL03:addAnchor(AnchorLeft, 'SKILL02', AnchorRight)
274 SKILL03:setImageSource("/images/custom/UI/insert_skill")
275 SKILL03:setMarginTop(50)
276 SKILL03:setMarginLeft(13)
277 SKILL03:setSize({width = 38, height = 38})
278
279 ATR1 = g_ui.createWidget('UILabel', toolTipLabel)
280 ATR1:setId('ATR1')
281 ATR1:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
282 ATR1:addAnchor(AnchorLeft, 'parent', AnchorLeft)
283 ATR1:setImageSource("/images/custom/Spells/atr_0")
284 ATR1:setSize({width = 32, height = 32})
285 ATR1:setMarginTop(39)
286 ATR1:setMarginLeft(15)
287
288 ATR1Name = g_ui.createWidget('UILabel', toolTipLabel)
289 ATR1Name:setId('ATR1Label')
290 ATR1Name:setTextAlign(AlignLeft)
291 ATR1Name:setFont('small-9px')
292 ATR1Name:setTextWrap(true)
293 ATR1Name:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
294 ATR1Name:addAnchor(AnchorLeft, 'ATR1', AnchorRight)
295 ATR1Name:setSize({width = 120, height = 30})
296 ATR1Name:setMarginTop(39)
297 ATR1Name:setMarginLeft(10)
298
299 ATR2 = g_ui.createWidget('UILabel', toolTipLabel)
300 ATR2:setId('ATR2')
301 ATR2:addAnchor(AnchorTop, 'ATR1', AnchorBottom)
302 ATR2:addAnchor(AnchorLeft, 'parent', AnchorLeft)
303 ATR2:setImageSource("/images/custom/Spells/atr_0")
304 ATR2:setSize({width = 32, height = 32})
305 ATR2:setMarginTop(05)
306 ATR2:setMarginLeft(15)
307
308 ATR2Name = g_ui.createWidget('UILabel', toolTipLabel)
309 ATR2Name:setId('ATR2Label')
310 ATR2Name:setTextAlign(AlignLeft)
311 ATR2Name:setFont('small-9px')
312 ATR2Name:setTextWrap(true)
313 ATR2Name:addAnchor(AnchorTop, 'ATR1Label', AnchorBottom)
314 ATR2Name:addAnchor(AnchorLeft, 'ATR2', AnchorRight)
315 ATR2Name:setSize({width = 120, height = 30})
316 ATR2Name:setMarginTop(7)
317 ATR2Name:setMarginLeft(10)
318
319 BonusExtra = g_ui.createWidget('UILabel', toolTipLabel)
320 BonusExtra:setId('BonusExtra')
321 BonusExtra:setTextAlign(AlignLeft)
322 BonusExtra:setFont('small-9px')
323 BonusExtra:setColor('green')
324 BonusExtra:setTextWrap(true)
325 BonusExtra:addAnchor(AnchorTop, 'ATR2Label', AnchorBottom)
326 BonusExtra:addAnchor(AnchorLeft, 'parent', AnchorLeft)
327 BonusExtra:setSize({width = 155, height = 50})
328 BonusExtra:setMarginTop(15)
329 BonusExtra:setMarginLeft(15)
330
331 Level = g_ui.createWidget('UILabel', toolTipLabel)
332 Level:setId('itemLevel')
333 Level:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
334 Level:addAnchor(AnchorLeft, 'parent', AnchorLeft)
335 Level:setBackgroundColor('#05AC5E')
336 Level:setFont('verdana-9px')
337 Level:setSize({width = 185, height = 15})
338 Level:setMarginTop(15)
339 Level:setMarginLeft(01)
340 Level:setTextAlign(AlignCenter)
341 Level:setText("NIVEL REQUERIDO: LV. 12")
342
343 Price = g_ui.createWidget('UILabel', toolTipLabel)
344 Price:setId('itemPrice')
345 Price:addAnchor(AnchorBottom, 'parent', AnchorBottom)
346 Price:addAnchor(AnchorLeft, 'parent', AnchorLeft)
347 Price:setSize({width = 80, height = 20})
348 Price:setMarginTop(5)
349 Price:setMarginLeft(25)
350 Price:setTextAlign(AlignLeft)
351
352 Lock = g_ui.createWidget('UILabel', toolTipLabel)
353 Lock:setId('itemLock')
354 Lock:setImageSource("/images/custom/UI/backpack_slot_lock")
355 Lock:addAnchor(AnchorBottom, 'parent', AnchorBottom)
356 Lock:addAnchor(AnchorLeft, 'parent', AnchorLeft)
357 Lock:setSize({width = 21, height = 21})
358 Lock:setMarginBottom(2)
359 Lock:setMarginLeft(02)
360 Lock:setTextAlign(AlignLeft)
361
362 Rary = g_ui.createWidget('UILabel', toolTipLabel)
363 Rary:setId('itemRary')
364 Rary:addAnchor(AnchorBottom, 'parent', AnchorBottom)
365 Rary:addAnchor(AnchorRight, 'parent', AnchorRight)
366 Rary:setSize({width = 80, height = 20})
367 Rary:setMarginBottom(1)
368 Rary:setMarginRight(10)
369 Rary:setTextAlign(AlignRight)
370
371 GIF = g_ui.createWidget('UILabel', toolTipLabel)
372 GIF:setId('skillGIF')
373 GIF:addAnchor(AnchorTop, 'parent', AnchorTop)
374 GIF:addAnchor(AnchorLeft, 'parent', AnchorLeft)
375 GIF:setImageSource("/images/custom/Spells/Animation/Skill_1")
376 GIF:setMarginTop(1)
377 GIF:setMarginLeft(1)
378 GIF:setSize({width = 183, height = 135})
379
380 ELEM = g_ui.createWidget('UILabel', toolTipLabel)
381 ELEM:setId('elemSkill')
382 ELEM:addAnchor(AnchorTop, 'parent', AnchorTop)
383 ELEM:addAnchor(AnchorLeft, 'parent', AnchorLeft)
384 ELEM:setImageSource("/images/game/states/burning")
385 ELEM:setMarginTop(3)
386 ELEM:setMarginLeft(3)
387 ELEM:setSize({width = 18, height = 18})
388
389 SkillName = g_ui.createWidget('UILabel', toolTipLabel)
390 SkillName:setId('SkillName')
391 SkillName:addAnchor(AnchorTop, 'skillGIF', AnchorBottom)
392 SkillName:addAnchor(AnchorLeft, 'parent', AnchorLeft)
393 SkillName:setColor('#E3BE17')
394 SkillName:setTextAlign(AlignCenter)
395 SkillName:setMarginTop(5)
396 SkillName:setMarginLeft(5)
397 SkillName:setSize({width = 180, height = 20})
398
399 SkillDMG = g_ui.createWidget('UILabel', toolTipLabel)
400 SkillDMG:setId('SkillDMG')
401 SkillDMG:setTextWrap(true)
402 SkillDMG:addAnchor(AnchorTop, 'SkillName', AnchorBottom)
403 SkillDMG:addAnchor(AnchorLeft, 'parent', AnchorLeft)
404 SkillDMG:setTextAlign(AlignCenter)
405 SkillDMG:setMarginTop(10)
406 SkillDMG:setMarginLeft(15)
407 SkillDMG:setSize({width = 160, height = 20})
408
409 SkillTarget = g_ui.createWidget('UILabel', toolTipLabel)
410 SkillTarget:setId('SkillTarget')
411 SkillTarget:addAnchor(AnchorTop, 'SkillDMG', AnchorBottom)
412 SkillTarget:addAnchor(AnchorLeft, 'parent', AnchorLeft)
413 SkillTarget:setTextAlign(AlignCenter)
414 SkillTarget:setMarginTop(-3)
415 SkillTarget:setMarginLeft(15)
416 SkillTarget:setSize({width = 160, height = 20})
417
418 SkillCooldown = g_ui.createWidget('UILabel', toolTipLabel)
419 SkillCooldown:setId('SkillCooldown')
420 SkillCooldown:addAnchor(AnchorTop, 'SkillTarget', AnchorBottom)
421 SkillCooldown:addAnchor(AnchorLeft, 'parent', AnchorLeft)
422 SkillCooldown:setTextAlign(AlignCenter)
423 SkillCooldown:setMarginTop(-3)
424 SkillCooldown:setMarginLeft(15)
425 SkillCooldown:setSize({width = 160, height = 20})
426
427 SkillHotkey = g_ui.createWidget('UILabel', toolTipLabel)
428 SkillHotkey:setId('SkillHotkey')
429 SkillHotkey:addAnchor(AnchorBottom, 'parent', AnchorBottom)
430 SkillHotkey:addAnchor(AnchorLeft, 'parent', AnchorLeft)
431 SkillHotkey:setTextAlign(AlignCenter)
432 SkillHotkey:setMarginBottom(3)
433 SkillHotkey:setMarginLeft(5)
434 SkillHotkey:setSize({width = 180, height = 20})
435
436 VipSaldo = g_ui.createWidget('UILabel', toolTipLabel)
437 VipSaldo:setId('VipSaldo')
438 VipSaldo:addAnchor(AnchorTop, 'parent', AnchorTop)
439 VipSaldo:addAnchor(AnchorLeft, 'parent', AnchorLeft)
440 VipSaldo:setTextAlign(AlignCenter)
441 VipSaldo:setMarginTop(10)
442 VipSaldo:setMarginLeft(35)
443 VipSaldo:setSize({width = 50, height = 20})
444
445 OnlineSaldo = g_ui.createWidget('UILabel', toolTipLabel)
446 OnlineSaldo:setId('OnlineSaldo')
447 OnlineSaldo:addAnchor(AnchorTop, 'VipSaldo', AnchorBottom)
448 OnlineSaldo:addAnchor(AnchorLeft, 'parent', AnchorLeft)
449 OnlineSaldo:setTextAlign(AlignCenter)
450 OnlineSaldo:setMarginTop(04)
451 OnlineSaldo:setMarginLeft(35)
452 OnlineSaldo:setSize({width = 50, height = 20})
453
454 PremiumType = g_ui.createWidget('UILabel', toolTipLabel)
455 PremiumType:setId('PremiumType')
456 PremiumType:addAnchor(AnchorTop, 'OnlineSaldo', AnchorBottom)
457 PremiumType:addAnchor(AnchorLeft, 'parent', AnchorLeft)
458 PremiumType:setTextAlign(AlignCenter)
459 PremiumType:setFont('small-9px')
460 PremiumType:setMarginTop(08)
461 PremiumType:setMarginLeft(07)
462 PremiumType:setSize({width = 90, height = 20})
463
464 toolTipLabel:hide()
465 end)
466
467end
468
469function g_tooltip.terminate()
470 disconnect(UIWidget, { onStyleApply = onWidgetStyleApply,
471 onHoverChange = onWidgetHoverChange })
472
473 currentHoveredWidget = nil
474 toolTipLabel:destroy()
475 toolTipLabel = nil
476
477 g_tooltip = nil
478end
479
480function g_tooltip.display(text)
481 if text == nil or text:len() == 0 then return end
482 if not toolTipLabel then return end
483 local t = string.explode(text, " ")
484
485 Nome:hide() Desc:hide() Price:hide() Star:hide() Level:hide()
486 DefName:hide() DEF:hide() EsqName:hide() ESQ:hide() MagName:hide()
487 MAG:hide() ATR1:hide() ATR1Name:hide() ATR2:hide() ATR2Name:hide()
488 MINIMO:hide() MinName:hide() MAXIMO:hide() MaxName:hide() iconType:hide()
489 TypeDMG:hide() SKILL01:hide() SKILL02:hide() SKILL03:hide() GIF:hide()
490 ELEM:hide() SkillName:hide() SkillDMG:hide() SkillTarget:hide() SkillCooldown:hide()
491 SkillHotkey:hide() Rary:hide() VipSaldo:hide() OnlineSaldo:hide() PremiumType:hide()
492 CompDefName:hide() CompEsqName:hide() CompMagName:hide() Lock:hide()
493 BonusExtra:hide()
494 Level:setText('')
495
496 MAG:setColor('white')
497 toolTipLabel:setText("")
498 toolTipLabel:setBackgroundColor('#111111cc')
499 toolTipLabel:setTextAlign(AlignCenter)
500 toolTipLabel:setImageSource("/images/custom/UI/none")
501
502 if string.find(text, "@JOIAS") then
503 local t = string.explode(text, " ")
504 local UID_01 = tonumber(t[02]) or 0
505 local UID_02 = tonumber(t[03]) or 0
506 local UID_03 = tonumber(t[04]) or 0
507 local UID_04 = tonumber(t[05]) or 0
508 local UID_05 = tonumber(t[06]) or 0
509 local UID_06 = tonumber(t[07]) or 0
510 local UID_07 = tonumber(t[08]) or 0
511 local UID_08 = tonumber(t[09]) or 0
512 local UID_09 = tonumber(t[10]) or 0
513 local UID_10 = tonumber(t[11]) or 0
514
515 local ChanceMode = {
516 [00] = "Baixa";
517 [01] = "Media";
518 [02] = "Alta";
519 [03] = "Muito Alta";
520 [04] = "Altissima";
521 }
522 toolTipLabel:resize(185, 179)
523 toolTipLabel:setImageSource("/images/custom/UI/itemInfo")
524 Nome:show()
525 if UID_05 > 0 then
526 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)).. " +" ..UID_05)
527 else
528 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)))
529 end
530 Nome:setColor(modules.game_database.getRaridade(01, UID_02))
531
532 Desc:show()
533 if UID_03 < 0 then UID_03 = 0 end
534 if UID_02 < 0 then UID_02 = 0 end
535 if UID_05 < 0 then UID_05 = 0 end
536 if UID_01 >= 1000 and UID_01 <= 1026 then
537 if UID_01 == 1009 then
538 Desc:setText(tr(modules.game_database.getItemInfo(UID_01, 8)))
539 else
540 local strTool = tr(modules.game_database.getItemInfo(UID_01, 8))
541 strTool = strTool.. "\n\nChance: "
542 strTool = strTool.. tr(ChanceMode[UID_02])
543 strTool = strTool.. " | " ..(UID_05 + (UID_03 * 10) + 5).. " "
544 strTool = strTool.. tr("seg")
545 strTool = strTool.. "."
546 Desc:setText(strTool)
547 end
548 else
549 Desc:setText(tr(modules.game_database.getItemInfo(UID_01, 8)))
550 end
551 Price:show()
552 Price:setText(modules.game_database.getItemInfo(UID_01, 9))
553 Rary:setColor(modules.game_database.getRaridade(01, UID_02))
554 Rary:setText(tr(modules.game_database.getRaridade(00, UID_02)))
555
556 Level:show()
557 Level:setSize({width = 185, height = 15})
558 Level:addAnchor(AnchorTop, 'itemStar', AnchorBottom)
559 Level:addAnchor(AnchorLeft, 'parent', AnchorRight)
560 Level:setMarginTop(15)
561 Level:setMarginLeft(1)
562
563 Star:show()
564 Star:addAnchor(AnchorTop, 'itemDesc', AnchorBottom)
565 Star:addAnchor(AnchorLeft, 'parent', AnchorLeft)
566 Star:setMarginTop(10)
567 Star:setMarginLeft(77)
568 if UID_03 > 0 then
569 Star:setImageSource("/images/custom/UI/star_" ..UID_03)
570 else
571 Star:setImageSource("/images/custom/UI/star_0")
572 end
573
574 if UID_09 > 0 then
575 Lock:show()
576 end
577
578 Rary:show()
579 toolTipLabel:show()
580 toolTipLabel:raise()
581 toolTipLabel:enable()
582
583
584 elseif string.find(text, "@KARD") then
585 local t = string.explode(text, "#")
586 local Class = tonumber(t[02])
587 local Pos = tonumber(t[03])
588 local RareItem = tonumber(t[04])
589 local Effectype = t[05]
590
591 toolTipLabel:resize(185, 179)
592 toolTipLabel:setImageSource("/images/custom/UI/itemInfo")
593 Nome:show()
594 Nome:setColor(modules.game_database.getRaridade(01, RareItem))
595 Nome:setText(modules.game_database.onKard(01, Class, Pos))
596 Desc:show()
597 Desc:setText(tr(modules.game_database.onKard(08, Class, Pos, 04)))
598 Level:setText(tr(Effectype))
599 Level:setSize({width = 185, height = 30})
600 Level:show()
601 Level:setBackgroundColor('#05AC5E')
602 Level:addAnchor(AnchorTop, 'parent', AnchorTop)
603 Level:addAnchor(AnchorLeft, 'parent', AnchorLeft)
604 Level:setMarginTop(155)
605 Level:setMarginLeft(-0,5)
606 Price:hide()
607 Rary:hide()
608
609 toolTipLabel:show()
610 toolTipLabel:raise()
611 toolTipLabel:enable()
612
613
614 elseif string.find(text, "@SKILL") then
615 local t = string.explode(text, " ")
616 local idSkill = tonumber(t[02])
617 local HotKey = t[03]
618 toolTipLabel:resize(185, 270)
619 toolTipLabel:setImageSource("/images/custom/UI/spell_tooltip")
620
621 Rary:hide()
622 Price:hide()
623 GIF:show()
624 GIF:setImageSource("/images/custom/Spells/Animation/Skill_" ..idSkill)
625 ELEM:show()
626 if modules.game_database.getSpellInfo(idSkill, 03) == "ICE" then
627 ELEM:setImageSource("/images/game/states/freezing")
628 elseif modules.game_database.getSpellInfo(idSkill, 03) == "FIRE" then
629 ELEM:setImageSource("/images/game/states/burning")
630 elseif modules.game_database.getSpellInfo(idSkill, 03) == "DEATH" then
631 ELEM:setImageSource("/images/game/states/cursed")
632 elseif modules.game_database.getSpellInfo(idSkill, 03) == "PHYSICAL" then
633 ELEM:setImageSource("/images/game/states/physical")
634 elseif modules.game_database.getSpellInfo(idSkill, 03) == "HOLY" then
635 ELEM:setImageSource("/images/game/states/dazzled")
636 elseif modules.game_database.getSpellInfo(idSkill, 03) == "EARTH" then
637 ELEM:setImageSource("/images/game/states/poisoned")
638 elseif modules.game_database.getSpellInfo(idSkill, 03) == "ENERGY" then
639 ELEM:setImageSource("/images/game/states/electrified")
640 elseif modules.game_database.getSpellInfo(idSkill, 03) == "SUPORTE" then
641 ELEM:setImageSource("/images/game/states/protection_zone")
642 end
643 SkillName:show()
644 SkillName:setText(modules.game_database.getSpellInfo(idSkill, 00))
645 SkillDMG:show()
646 if modules.game_database.getSpellInfo(idSkill, 03) == "SUPORTE" then
647 SkillDMG:setSize({width = 160, height = 150})
648 SkillDMG:setMarginTop(-40)
649 SkillDMG:setText(modules.game_database.getSpellInfo(idSkill, 06))
650 else
651 SkillDMG:setMarginTop(10)
652 SkillDMG:setSize({width = 160, height = 20})
653 SkillDMG:setText("Damage: " ..modules.game_database.getSpellInfo(idSkill, 04).. "%")
654 SkillTarget:show()
655 if modules.game_database.getSpellInfo(idSkill, 02) == 0 then
656 SkillTarget:setText("Target: false")
657 else
658 SkillTarget:setText("Target: true")
659 end
660 SkillCooldown:show()
661 SkillCooldown:setText("Cooldown: " ..modules.game_database.getSpellInfo(idSkill, 05).. " seg.")
662 end
663 SkillHotkey:show()
664 SkillHotkey:setText(HotKey)
665
666 if t[04] then
667 if tonumber(t[04]) > 0 then
668 Lock:show()
669 end
670 end
671
672 toolTipLabel:show()
673 toolTipLabel:raise()
674 toolTipLabel:enable()
675
676
677 elseif string.find(text, "@GUN") or string.find(text, "@INVGUN") then
678 local t = string.explode(text, " ")
679 local UID_01 = tonumber(t[02]) or 0
680 local UID_02 = tonumber(t[03]) or 0
681 local UID_03 = tonumber(t[04]) or 0
682 local UID_04 = tonumber(t[05]) or 0
683 local UID_05 = tonumber(t[06]) or 0
684 local UID_06 = tonumber(t[07]) or 0
685 local UID_07 = tonumber(t[08]) or 0
686 local UID_08 = tonumber(t[09]) or 0
687 local UID_09 = tonumber(t[10]) or 0
688 local UID_10 = tonumber(t[11]) or 0
689
690 toolTipLabel:resize(185, 320)
691 toolTipLabel:setImageSource("/images/custom/UI/equipInfo")
692 Nome:show()
693 Nome:setColor(modules.game_database.getRaridade(01, UID_02))
694 if UID_07 > 0 then
695 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)).. " +" ..UID_07)
696 else
697 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)))
698 end
699 local DanoMinimoValue = modules.game_database.onDamage(UID_01, UID_07, UID_03, "Min", UID_02)
700 local DanoMaximoValue = modules.game_database.onDamage(UID_01, UID_07, UID_03, "Max", UID_02)
701 MINIMO:show()
702 MINIMO:setText(DanoMinimoValue)
703 MAXIMO:show()
704 MAXIMO:setText(DanoMaximoValue)
705 SKILL01:show()
706 SKILL02:show()
707 SKILL03:show()
708
709 local Bullet = 0
710 if string.find(text, "@GUN") then
711 local AMMO = UID_09
712 Bullet = AMMO
713 elseif string.find(text, "@INVGUN") then
714 Bullet = modules.game_database.getInventory(04, 10)
715 end
716 if Bullet == nil or Bullet < 0 then Bullet = 0 end
717 if Bullet < 10 then
718 TypeDMG:setText('00' ..Bullet)
719 elseif Bullet >= 10 and Bullet <= 99 then
720 TypeDMG:setText('0' ..Bullet)
721 else
722 TypeDMG:setText(Bullet)
723 end
724
725 if Bullet < 01 then
726 TypeDMG:setColor('red')
727 TypeDMG:setText('EMPTY')
728 else
729 TypeDMG:setColor('white')
730 end
731 if UID_04 ~= nil then
732 if UID_04 > 0 then
733 SKILL01:setImageSource("/images/custom/Spells/skill_" ..UID_04)
734 SKILL01:setOpacity("1.0")
735 else
736 if UID_02 > 0 then
737 SKILL01:setImageSource("/images/custom/UI/insert_skill")
738 SKILL01:setOpacity("1.0")
739 else
740 SKILL01:setImageSource("/images/custom/UI/lock_skill")
741 SKILL01:setOpacity("0.4")
742 end
743 end
744 else
745 SKILL01:setImageSource("/images/custom/UI/insert_skill")
746 end
747 if UID_05 ~= nil then
748 if UID_05 > 0 then
749 SKILL02:setImageSource("/images/custom/Spells/skill_" ..UID_05)
750 SKILL02:setOpacity("1.0")
751 else
752 if UID_02 > 1 then
753 SKILL02:setImageSource("/images/custom/UI/insert_skill")
754 SKILL02:setOpacity("1.0")
755 else
756 SKILL02:setImageSource("/images/custom/UI/lock_skill")
757 SKILL02:setOpacity("0.4")
758 end
759 end
760 else
761 SKILL01:setImageSource("/images/custom/UI/insert_skill")
762 end
763 if UID_06 ~= nil then
764 if UID_06 > 0 then
765 SKILL03:setImageSource("/images/custom/Spells/skill_" ..UID_06)
766 SKILL03:setOpacity("1.0")
767 else
768 if UID_02 > 2 then
769 SKILL03:setImageSource("/images/custom/UI/insert_skill")
770 SKILL03:setOpacity("1.0")
771 else
772 SKILL03:setImageSource("/images/custom/UI/lock_skill")
773 SKILL03:setOpacity("0.4")
774 end
775 end
776 else
777 SKILL01:setImageSource("/images/custom/UI/insert_skill")
778 end
779
780 Star:show()
781 Star:addAnchor(AnchorTop, 'TypeDMG', AnchorBottom)
782 Star:addAnchor(AnchorLeft, 'MinLabel', AnchorRight)
783 Star:setMarginTop(02)
784 Star:setMarginLeft(15)
785 if UID_03 > 0 then
786 Star:setImageSource("/images/custom/UI/star_" ..UID_03)
787 else
788 Star:setImageSource("/images/custom/UI/star_0")
789 end
790
791 local localPlayer = g_game.getLocalPlayer()
792 local GUN_BASE_LEVEL = modules.game_database.getItemInfo(UID_01, 19)
793 local LEVEL_FOR_RARE = 05
794 local LEVEL_FOR_LEVEL = 04
795 if UID_02 < 0 then UID_02 = 00 end
796 if UID_07 < 0 then UID_07 = 00 end
797 if UID_03 < 0 then UID_03 = 00 end
798
799 REQUISITO_LEVEL = GUN_BASE_LEVEL + (UID_02 * LEVEL_FOR_RARE) + (UID_07 * LEVEL_FOR_LEVEL) + ((UID_03 * 10) * LEVEL_FOR_LEVEL)
800 if localPlayer:getLevel() >= REQUISITO_LEVEL then
801 Level:setBackgroundColor('#05AC5E')
802 else
803 Level:setBackgroundColor('#AC0505')
804 end
805 Level:setText(tr('NIVEL REQUERIDO: LV.').. ' ' ..REQUISITO_LEVEL)
806 Level:show()
807 Level:setSize({width = 185, height = 15})
808 Level:addAnchor(AnchorTop, 'SKILL02', AnchorBottom)
809 Level:addAnchor(AnchorLeft, 'parent', AnchorLeft)
810 Level:setMarginTop(83)
811 Level:setMarginLeft(-0,5)
812
813 Price:show()
814 Lock:hide()
815 Price:setText(modules.game_database.getItemInfo(UID_01, 9))
816 if UID_10 > 0 then
817 Lock:show()
818 Price:setText(modules.game_database.getItemInfo(UID_01, 9))
819 end
820
821 local StrBonus = ""
822 local DmgMin = 00
823 local DmgMax = 00
824 if UID_08 > 0 then
825 local BonusUM = modules.game_database.onBonusExtra(01, tostring(UID_08), 03)
826 if #BonusUM > 01 then
827 if modules.game_database.onBonusExtra(01, tostring(UID_08), 04) == 39 then
828 DmgMin = DmgMin + modules.game_database.onBonusExtra(01, tostring(UID_08), 02)
829 end
830 if modules.game_database.onBonusExtra(01, tostring(UID_08), 04) == 41 then
831 DmgMax = DmgMax + modules.game_database.onBonusExtra(01, tostring(UID_08), 02)
832 end
833 StrBonus = BonusUM
834
835 local BonusDois = modules.game_database.onBonusExtra(02, tostring(UID_08), 03)
836 if #BonusDois > 01 then
837 if modules.game_database.onBonusExtra(02, tostring(UID_08), 04) == 39 then
838 DmgMin = DmgMin + modules.game_database.onBonusExtra(02, tostring(UID_08), 02)
839 end
840 if modules.game_database.onBonusExtra(02, tostring(UID_08), 04) == 41 then
841 DmgMax = DmgMax + modules.game_database.onBonusExtra(02, tostring(UID_08), 02)
842 end
843 StrBonus = StrBonus.. "\n" ..BonusDois
844
845 local BonusTres = modules.game_database.onBonusExtra(03, tostring(UID_08), 03)
846 if #BonusTres > 01 then
847 if modules.game_database.onBonusExtra(03, tostring(UID_08), 04) == 39 then
848 DmgMin = DmgMin + modules.game_database.onBonusExtra(03, tostring(UID_08), 02)
849 end
850 if modules.game_database.onBonusExtra(03, tostring(UID_08), 04) == 41 then
851 DmgMax = DmgMax + modules.game_database.onBonusExtra(03, tostring(UID_08), 02)
852 end
853 StrBonus = StrBonus.. "\n" ..BonusTres
854 end
855 end
856 end
857 end
858
859 if DmgMin > 00 then
860 DanoMinimoValue = DanoMinimoValue + DmgMin
861 MINIMO:setColor('green')
862 MINIMO:setText(DanoMinimoValue)
863 else
864 MINIMO:setColor('white')
865 end
866 if DmgMax > 00 then
867 DanoMaximoValue = DanoMaximoValue + DmgMax
868 MAXIMO:setColor('green')
869 MAXIMO:setText(DanoMaximoValue)
870 else
871 MAXIMO:setColor('white')
872 end
873
874 if #StrBonus > 0 then
875 BonusExtra:setText(StrBonus)
876 BonusExtra:setMarginTop(05)
877 BonusExtra:show()
878 else
879 BonusExtra:hide()
880 end
881
882 local SlotItem = modules.game_database.getItemInfo(UID_01, 2)
883 local InventoryItemID = modules.game_database.getInventory(SlotItem, 1)
884 if InventoryItemID > 0 then
885 local INV_MIN = modules.game_database.onDamage(InventoryItemID, modules.game_database.getInventory(SlotItem, 7), modules.game_database.getInventory(SlotItem, 3), "Min", modules.game_database.getInventory(SlotItem, 2))
886 local BAG_MIN = DanoMinimoValue
887 local DIFE_MIN = BAG_MIN - INV_MIN
888 if DIFE_MIN < 0 then
889 CompDefName:setColor('#AC0505')
890 CompDefName:setText(DIFE_MIN)
891 CompDefName:show()
892 elseif DIFE_MIN > 0 then
893 CompDefName:setColor('#05AC5E')
894 CompDefName:setText("+" ..DIFE_MIN)
895 CompDefName:show()
896 end
897
898 local INV_MAX = modules.game_database.onDamage(InventoryItemID, modules.game_database.getInventory(SlotItem, 7), modules.game_database.getInventory(SlotItem, 3), "Max", modules.game_database.getInventory(SlotItem, 2))
899 local BAG_MAX = DanoMaximoValue
900 local DIFE_MAX = BAG_MAX - INV_MAX
901 if DIFE_MAX < 0 then
902 CompMagName:setColor('#AC0505')
903 CompMagName:setText(DIFE_MAX)
904 CompMagName:show()
905 elseif DIFE_MAX > 0 then
906 CompMagName:setColor('#05AC5E')
907 CompMagName:setText("+" ..DIFE_MAX)
908 CompMagName:show()
909 end
910 end
911 Rary:show()
912 iconType:show()
913 TypeDMG:show()
914 MinName:show()
915 MaxName:show()
916 Rary:setColor(modules.game_database.getRaridade(01, UID_02))
917 Rary:setText(tr(modules.game_database.getRaridade(00, UID_02)))
918
919 toolTipLabel:show()
920 toolTipLabel:raise()
921 toolTipLabel:enable()
922
923
924 elseif string.find(text, "@EQUIP") then
925 local t = string.explode(text, " ")
926 local UID_01 = tonumber(t[02]) or 0
927 local UID_02 = tonumber(t[03]) or 0
928 local UID_03 = tonumber(t[04]) or 0
929 local UID_04 = tonumber(t[05]) or 0
930 local UID_05 = tonumber(t[06]) or 0
931 local UID_06 = tonumber(t[07]) or 0
932 local UID_07 = tonumber(t[08]) or 0
933 local UID_08 = tonumber(t[09]) or 0
934 local UID_09 = tonumber(t[10]) or 0
935 local UID_10 = tonumber(t[11]) or 0
936 local ProtectElement = modules.game_database.getItemInfo(UID_01, 18)
937
938 toolTipLabel:resize(185, 320)
939 toolTipLabel:setImageSource("/images/custom/UI/equipInfo")
940 Nome:show()
941 Nome:setColor(modules.game_database.getRaridade(01, UID_02))
942 if UID_05 > 0 then
943 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)).. " +" ..UID_05)
944 else
945 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)))
946 end
947 Price:show()
948 Price:setText(modules.game_database.getItemInfo(UID_01, 9))
949 DEF:show()
950 DEF:setText(modules.game_database.onArmor(UID_01, UID_05, UID_03, "DEF", UID_02))
951 ESQ:show()
952 ESQ:setText(modules.game_database.onArmor(UID_01, UID_05, UID_03, "ESQ", UID_02))
953 MAG:show()
954
955 local ElemColor = {
956 ["FIRE"] = {COLOR = '#e64747'};
957 ["ICE"] = {COLOR = '#55d8f2'};
958 ["ENERGY"] = {COLOR = '#d555f2'};
959 ["DEATH"] = {COLOR = '#7d7c7d'};
960 ["EARTH"] = {COLOR = 'green'};
961 }
962 MagName:setText(ProtectElement)
963 MagName:setColor(ElemColor[ProtectElement].COLOR)
964 MAG:setColor(ElemColor[ProtectElement].COLOR)
965 MAG:setText(modules.game_database.onArmor(UID_01, UID_05, UID_03, "MAG", UID_02))
966 Rary:setColor(modules.game_database.getRaridade(01, UID_02))
967 Rary:setText(tr(modules.game_database.getRaridade(00, UID_02)))
968
969 local SlotItem = modules.game_database.getItemInfo(UID_01, 2)
970 local InventoryItemID = modules.game_database.getInventory(SlotItem, 1)
971 if InventoryItemID > 0 then
972 local INV_DEF = modules.game_database.onArmor(InventoryItemID, modules.game_database.getInventory(SlotItem, 5), modules.game_database.getInventory(SlotItem, 3), "DEF", modules.game_database.getInventory(SlotItem, 2))
973 local BAG_DEF = modules.game_database.onArmor(UID_01, UID_05, UID_03, "DEF", UID_02)
974 local DIFE_DEF = BAG_DEF - INV_DEF
975 if DIFE_DEF < 0 then
976 CompDefName:setColor('#AC0505')
977 CompDefName:setText(DIFE_DEF)
978 CompDefName:show()
979 elseif DIFE_DEF > 0 then
980 CompDefName:setColor('#05AC5E')
981 CompDefName:setText("+" ..DIFE_DEF)
982 CompDefName:show()
983 end
984
985 local INV_ESQ = modules.game_database.onArmor(InventoryItemID, modules.game_database.getInventory(SlotItem, 5), modules.game_database.getInventory(SlotItem, 3), "ESQ", modules.game_database.getInventory(SlotItem, 2))
986 local BAG_ESQ = modules.game_database.onArmor(UID_01, UID_05, UID_03, "ESQ", UID_02)
987 local DIFE_ESQ = BAG_ESQ - INV_ESQ
988 if DIFE_ESQ < 0 then
989 CompEsqName:setColor('#AC0505')
990 CompEsqName:setText(DIFE_ESQ)
991 CompEsqName:show()
992 elseif DIFE_ESQ > 0 then
993 CompEsqName:setColor('#05AC5E')
994 CompEsqName:setText("+" ..DIFE_ESQ)
995 CompEsqName:show()
996 end
997
998 local INV_MAG = modules.game_database.onArmor(InventoryItemID, modules.game_database.getInventory(SlotItem, 5), modules.game_database.getInventory(SlotItem, 3), "MAG", modules.game_database.getInventory(SlotItem, 2))
999 local BAG_MAG = modules.game_database.onArmor(UID_01, UID_05, UID_03, "MAG", UID_02)
1000 local DIFE_MAG = BAG_MAG - INV_MAG
1001 if DIFE_MAG < 0 then
1002 CompMagName:setColor('#AC0505')
1003 CompMagName:setText(DIFE_MAG)
1004 CompMagName:show()
1005 elseif DIFE_MAG > 0 then
1006 CompMagName:setColor('#05AC5E')
1007 CompMagName:setText("+" ..DIFE_MAG)
1008 CompMagName:show()
1009 end
1010 end
1011
1012 if UID_06 > 0 then
1013 local desc = modules.game_database.getAtrInfo(UID_06, 07)
1014 local text = modules.game_database.getAtrInfo(UID_06, 02)
1015 local percent = modules.game_database.getAtrInfo(UID_06, 01)
1016 local txtper = modules.game_database.getAtrInfo(UID_06, 08)
1017 ATR1:setImageSource("/images/custom/Spells/atr_" ..UID_06)
1018 ATR1Name:setText(tr(desc).. " (" ..tr(text).. " " ..percent.."" ..txtper..")")
1019 else
1020 ATR1:setImageSource("/images/custom/Spells/atr_0")
1021 ATR1Name:setText(tr("<vazio>"))
1022 end
1023 if UID_07 > 0 then
1024 local desc = modules.game_database.getAtrInfo(UID_07, 07)
1025 local text = modules.game_database.getAtrInfo(UID_07, 02)
1026 local percent = modules.game_database.getAtrInfo(UID_07, 01)
1027 local txtper = modules.game_database.getAtrInfo(UID_07, 08)
1028 ATR2:setImageSource("/images/custom/Spells/atr_" ..UID_07)
1029 ATR2Name:setText(tr(desc).. " (" ..tr(text).. " " ..percent.."" ..txtper..")")
1030 else
1031 ATR2:setImageSource("/images/custom/Spells/atr_0")
1032 ATR2Name:setText(tr("<vazio>"))
1033 end
1034
1035 local StrBonus = ""
1036 if UID_08 > 0 then
1037 local BonusUM = modules.game_database.onBonusExtra(01, tostring(UID_08), 03)
1038 if #BonusUM > 01 then
1039 StrBonus = BonusUM
1040
1041 local BonusDois = modules.game_database.onBonusExtra(02, tostring(UID_08), 03)
1042 if #BonusDois > 01 then
1043 StrBonus = StrBonus.. "\n" ..BonusDois
1044
1045 local BonusTres = modules.game_database.onBonusExtra(03, tostring(UID_08), 03)
1046 if #BonusTres > 01 then
1047 StrBonus = StrBonus.. "\n" ..BonusTres
1048 end
1049 end
1050 end
1051 end
1052 if #StrBonus > 0 then
1053 BonusExtra:setText(StrBonus)
1054 BonusExtra:setMarginTop(15)
1055 BonusExtra:show()
1056 else
1057 BonusExtra:hide()
1058 end
1059 Rary:show()
1060 Desc:hide()
1061 DefName:show()
1062 EsqName:show()
1063 MagName:show()
1064 ATR1:show()
1065 ATR1Name:show()
1066 ATR2:show()
1067 ATR2Name:show()
1068
1069 Star:show()
1070 Star:addAnchor(AnchorTop, 'ESQValue', AnchorBottom)
1071 Star:addAnchor(AnchorLeft, 'DEFValue', AnchorRight)
1072 Star:setMarginTop(10)
1073 Star:setMarginLeft(20)
1074 if UID_03 > 0 then
1075 Star:setImageSource("/images/custom/UI/star_" ..UID_03)
1076 else
1077 Star:setImageSource("/images/custom/UI/star_0")
1078 end
1079
1080 local localPlayer = g_game.getLocalPlayer()
1081 if UID_05 < 0 then UID_05 = 0 end
1082 if UID_03 < 0 then UID_03 = 0 end
1083 local itemRecLevel = (modules.game_database.getItemInfo(UID_01, 3) + UID_05 + (UID_03 * 10)) * 2
1084
1085 if localPlayer:getLevel() >= itemRecLevel then
1086 Level:setBackgroundColor('#05AC5E')
1087 else
1088 Level:setBackgroundColor('#AC0505')
1089 end
1090 Level:setText(tr('NIVEL REQUERIDO: LV.').. ' ' ..itemRecLevel)
1091 Level:show()
1092 Level:setSize({width = 185, height = 15})
1093 Level:addAnchor(AnchorTop, 'ATR2Label', AnchorBottom)
1094 Level:addAnchor(AnchorLeft, 'parent', AnchorLeft)
1095 Level:setMarginTop(67)
1096 Level:setMarginLeft(0)
1097 if UID_09 > 0 then
1098 Lock:show()
1099 end
1100
1101 toolTipLabel:show()
1102 toolTipLabel:raise()
1103 toolTipLabel:enable()
1104
1105
1106 elseif string.find(text, "@BAG") then
1107 local t = string.explode(text, " ")
1108 local UID_01 = tonumber(t[02]) or 0
1109 local UID_02 = tonumber(t[03]) or 0
1110 local UID_03 = tonumber(t[04]) or 0
1111 local UID_04 = tonumber(t[05]) or 0
1112 local UID_05 = tonumber(t[06]) or 0
1113 local UID_06 = tonumber(t[07]) or 0
1114 local UID_07 = tonumber(t[08]) or 0
1115 local UID_08 = tonumber(t[09]) or 0
1116 local UID_09 = tonumber(t[10]) or 0
1117 local UID_10 = tonumber(t[11]) or 0
1118
1119 toolTipLabel:resize(185, 179)
1120 toolTipLabel:setImageSource("/images/custom/UI/itemInfo")
1121 Nome:show()
1122 Nome:setColor(modules.game_database.getRaridade(01, UID_02))
1123 Nome:setText(tr(modules.game_database.getItemInfo(UID_01, 1)))
1124 Desc:show()
1125 Desc:setText(tr(modules.game_database.getItemInfo(UID_01, 8)))
1126 Price:show()
1127 if UID_04 ~= nil and UID_04 > 1 then
1128 Price:setText(mask_number(modules.game_database.getItemInfo(UID_01, 9)).. " (" ..mask_number((UID_04 * modules.game_database.getItemInfo(UID_01, 9))).. ")")
1129 else
1130 Price:setText(mask_number(modules.game_database.getItemInfo(UID_01, 9)))
1131 end
1132 Level:hide()
1133 Rary:setColor(modules.game_database.getRaridade(01, UID_02))
1134 Rary:setText(tr(modules.game_database.getRaridade(00, UID_02)))
1135
1136 Rary:show()
1137 Star:show()
1138 Star:addAnchor(AnchorTop, 'itemDesc', AnchorBottom)
1139 Star:addAnchor(AnchorLeft, 'parent', AnchorLeft)
1140 Star:setMarginTop(10)
1141 Star:setMarginLeft(77)
1142 if UID_03 > 0 then
1143 Star:setImageSource("/images/custom/UI/star_" ..UID_03)
1144 else
1145 Star:setImageSource("/images/custom/UI/star_0")
1146 end
1147 if UID_09 > 0 then
1148 Lock:show()
1149 end
1150
1151 toolTipLabel:show()
1152 toolTipLabel:raise()
1153 toolTipLabel:enable()
1154
1155
1156 else
1157 toolTipLabel:setText(text)
1158 toolTipLabel:resizeToText()
1159 toolTipLabel:resize(toolTipLabel:getWidth() + 4, toolTipLabel:getHeight() + 4)
1160 toolTipLabel:show()
1161 toolTipLabel:raise()
1162 toolTipLabel:enable()
1163 end
1164
1165 g_effects.fadeIn(toolTipLabel, 100)
1166 moveToolTip(true)
1167 connect(rootWidget, {
1168 onMouseMove = moveToolTip,
1169 })
1170end
1171
1172function g_tooltip.hide()
1173 g_effects.fadeOut(toolTipLabel, 100)
1174
1175 disconnect(rootWidget, {
1176 onMouseMove = moveToolTip,
1177 })
1178end
1179
1180
1181-- @docclass UIWidget @{
1182
1183-- UIWidget extensions
1184function UIWidget:setTooltip(text)
1185 self.tooltip = text
1186end
1187
1188function UIWidget:removeTooltip()
1189 self.tooltip = nil
1190end
1191
1192function UIWidget:getTooltip()
1193 return self.tooltip
1194end
1195
1196-- @}
1197
1198g_tooltip.init()
1199connect(g_app, { onTerminate = g_tooltip.terminate })
1200