mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 20:14:54 +02:00
Spell List: Small tweaks
Tweaks and formatting.
This commit is contained in:
@@ -136,7 +136,8 @@ function init()
|
||||
g_keyboard.bindKeyPress('Down', function() spellList:focusNextChild(KeyboardFocusReason) end, spelllistWindow)
|
||||
g_keyboard.bindKeyPress('Up', function() spellList:focusPreviousChild(KeyboardFocusReason) end, spelllistWindow)
|
||||
|
||||
for index, spell in ipairs(spellDisplayOrder) do
|
||||
for i = 1, #spellDisplayOrder do
|
||||
local spell = spellDisplayOrder[i]
|
||||
local info = SpellInfo[spell]
|
||||
local tmpLabel = g_ui.createWidget('SpellListLabel', spellList)
|
||||
tmpLabel:setId(spell)
|
||||
@@ -164,6 +165,11 @@ function terminate()
|
||||
disconnect(g_game, { onGameStart = setupOptions,
|
||||
onGameEnd = resetWindow })
|
||||
|
||||
disconnect(spellList, { onChildFocusChange = function(self, focusedChild)
|
||||
if focusedChild == nil then return end
|
||||
updateSpellInformation(focusedChild)
|
||||
end })
|
||||
|
||||
spelllistButton:destroy()
|
||||
spelllistButton = nil
|
||||
spelllistWindow:destroy()
|
||||
@@ -204,7 +210,8 @@ function terminate()
|
||||
end
|
||||
|
||||
function updateSpelllist()
|
||||
for index, spell in ipairs(spellDisplayOrder) do
|
||||
for i = 1, #spellDisplayOrder do
|
||||
local spell = spellDisplayOrder[i]
|
||||
local info = SpellInfo[spell]
|
||||
local tmpLabel = spellList:getChildById(spell)
|
||||
|
||||
@@ -236,7 +243,8 @@ function updateSpellInformation(widget)
|
||||
name = spell
|
||||
formula = info.words
|
||||
|
||||
for _, vocationId in ipairs(info.vocations) do
|
||||
for i = 1, #info.vocations do
|
||||
local vocationId = info.vocations[i]
|
||||
if vocationId <= 4 or not(table.find(info.vocations, (vocationId-4))) then
|
||||
vocation = vocation .. (vocation:len() == 0 and '' or ', ') .. VocationNames[vocationId]
|
||||
end
|
||||
|
Reference in New Issue
Block a user