Updated to OTCv8 3.0 rev 80

This commit is contained in:
OTCv8 2021-05-19 18:52:49 +00:00
parent 6c1d9f194f
commit 5e90b45dce
11 changed files with 88 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

After

Width:  |  Height:  |  Size: 376 KiB

View File

@ -29,16 +29,16 @@ function init()
bottomPanel:moveChildToIndex(actionPanel1, 1)
actionPanel2 = g_ui.loadUI('actionbar', bottomPanel)
bottomPanel:moveChildToIndex(actionPanel2, 1)
actionConfig = g_configs.create("/actionbar.otml")
connect(g_game, {
onGameStart = online,
onGameEnd = offline,
onSpellGroupCooldown = onSpellGroupCooldown,
onSpellCooldown = onSpellCooldown
})
if g_game.isOnline() then
online()
end
@ -156,7 +156,27 @@ function setupAction(action)
if type(config.hotkey) == 'string' and config.hotkey:len() > 0 then
local gameRootPanel = modules.game_interface.getRootPanel()
g_keyboard.bindKeyPress(config.hotkey, action.callback, gameRootPanel)
action.hotkeyLabel:setText(config.hotkey)
local text = config.hotkey
-- formatting similar to cip Tibia 12
local values = {
{"Shift", "S"},
{"Ctrl", "C"},
{"+", ""},
{"PageUp", "PgUp"},
{"PageDown", "PgDown"},
{"Enter", "Return"},
{"Insert", "Ins"},
{"Delete", "Del"},
{"Escape", "Esc"}
}
for i, v in pairs(values) do
text = text:gsub(v[1], v[2])
end
if text:len() > 6 then
text = text:sub(text:len()-3,text:len())
text = "..."..text
end
action.hotkeyLabel:setText(text)
else
action.hotkeyLabel:setText("")
end
@ -283,7 +303,8 @@ function actionOnMouseRelease(action, mousePosition, mouseButton)
end
end
assignWindow.addButton.onClick = function()
updateAction(action, {hotkey=tostring(assignWindow.comboPreview.keyCombo)})
local text = tostring(assignWindow.comboPreview.keyCombo)
updateAction(action, {hotkey=text})
assignWindow:destroy()
end
hotkeyAssignWindow = assignWindow
@ -319,7 +340,7 @@ function onSpellGroupCooldown(groupId, duration)
for index, panel in ipairs({actionPanel1, actionPanel2}) do
for i, child in ipairs(panel.tabBar:getChildren()) do
if child.spell and child.spell.group then
for group, duration in pairs(child.spell.group) do
for group, dur in pairs(child.spell.group) do
if groupId == group then
startCooldown(child, duration)
end
@ -343,10 +364,20 @@ function updateCooldown(action)
local timeleft = action.cooldownTill - g_clock.millis()
if timeleft <= 30 then
action.cooldown:setPercent(100)
action.cooldownEvent = nil
action.cooldownEvent = nil
action.cooldown:setText("")
return
end
local duration = action.cooldownTill - action.cooldownStart
local formattedText
if timeleft > 60000 then
formattedText = math.floor(timeleft / 60000) .. "m"
else
formattedText = timeleft/1000
formattedText = math.floor(formattedText * 10) / 10
formattedText = math.floor(formattedText) .. "." .. math.floor(formattedText * 10) % 10
end
action.cooldown:setText(formattedText)
action.cooldown:setPercent(100 - math.floor(100 * timeleft / duration))
action.cooldownEvent = scheduleEvent(function() updateCooldown(action) end, 30)
end

View File

@ -37,13 +37,14 @@ ActionButton < Panel
Label
id: hotkeyLabel
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
margin: 2 3 3 3
text-auto-resize: true
text-wrap: false
phantom: true
font: small-9px
color: yellow
font: cipsoftFont
color: white
background: #292A2A
UIProgressRect
id: cooldown
@ -53,6 +54,8 @@ ActionButton < Panel
phantom: true
anchors.fill: parent
margin: 1 1 1 1
font: verdana-11px-rounded
color: white
Panel
id: actionBar

View File

@ -167,6 +167,13 @@ function onContainerOpen(container, previousContainer)
containerWindow:setContentMinimumHeight(cellSize.height)
containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())
if container:hasPages() then
local height = containerWindow.miniwindowScrollBar:getMarginTop() + containerWindow.pagePanel:getHeight()+17
if containerWindow:getHeight() < height then
containerWindow:setHeight(height)
end
end
if not previousContainer then
local filledLines = math.max(math.ceil(container:getItemsCount() / layout:getNumColumns()), 1)
containerWindow:setContentHeight(filledLines*cellSize.height)

View File

@ -185,6 +185,7 @@ function onSpellCooldown(iconId, duration)
else
progressRect:setPercent(0)
end
local spell, profile, spellName = Spells.getSpellByIcon(iconId)
progressRect:setTooltip(spellName)
local updateFunc = function()

View File

@ -140,7 +140,22 @@ SpellInfo = {
['Avalanche'] = {id = 115, words = 'adori mas frigo', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'avalanche', mana = 530, level = 30, soul = 3, group = {[3] = 2000}, vocations = {2, 6}},
['Stone Shower'] = {id = 116, words = 'adori mas tera', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'stoneshower', mana = 430, level = 28, soul = 3, group = {[3] = 2000}, vocations = {2, 6}},
['Thunderstorm'] = {id = 117, words = 'adori mas vis', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'thunderstorm', mana = 430, level = 28, soul = 3, group = {[3] = 2000}, vocations = {1, 5}},
['Holy Missile'] = {id = 130, words = 'adori san', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'holymissile', mana = 350, level = 27, soul = 3, group = {[3] = 2000}, vocations = {3, 7}}
['Holy Missile'] = {id = 130, words = 'adori san', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'holymissile', mana = 350, level = 27, soul = 3, group = {[3] = 2000}, vocations = {3, 7}},
-- newest tibia spells
['Summon Paladin Familiar'] = {id = 171, words = 'utevo gran res sac', exhaustion = 1800000,premium = true, type = 'Instant', icon = 'summonpaladinfamiliar', mana = 2000, level = 200,soul = 0, group = {[3] = 2000}, vocations = {3, 7}},
['Summon Knight Familiar'] = {id = 170, words = 'utevo gran res eq', exhaustion = 1800000,premium = true, type = 'Instant', icon = 'summonknightfamiliar', mana = 1000, level = 200,soul = 0, group = {[3] = 2000}, vocations = {3, 7}},
['Summon Druid Familiar'] = {id = 172, words = 'utevo gran res dru', exhaustion = 1800000,premium = true, type = 'Instant', icon = 'summondruidfamiliar', mana = 3000, level = 200,soul = 0, group = {[3] = 2000}, vocations = {3, 7}},
['Summon Sorcerer Familiar'] = {id = 173, words = 'utevo gran res eq', exhaustion = 1800000,premium = true, type = 'Instant', icon = 'summonsorcererfamiliar', mana = 3000, level = 200,soul = 0, group = {[3] = 2000}, vocations = {3, 7}},
['Chivalrous Challenge'] = {id = 101, words = "exeta amp res", exhaustion = 2000, premium = true, type = 'Instant', icon = 'chivalrouschallange', mana = 80, level = 150,soul = 0, group = {[3] = 2000}, vocations = {8}},
['Fair Wound Cleansing'] = {id = 102, words = 'exura med ico', exhaustion = 1000, premium = true, type = 'Instant', icon = 'fairwoundcleansing', mana = 90, level = 300,soul = 0, group = {[2] = 1000}, vocations = {8}},
['Conjure Wand of Darkness'] = {id = 92, words = 'exevo gran mort', exhaustion = 1800000,premium = true, type = 'Conjure', icon = 'conjurewandofdarkness', mana = 250, level = 41, soul = 0, group = {[3] = 2000}, vocations = {1, 5}},
['Expose Weakness'] = {id = 106, words = 'exori moe', exhaustion = 12000, premium = true, type = 'Instant', icon = 'exposeweakness', mana = 400, level = 275,soul = 0, group = {[5] = 12000, [3] = 2000}, vocations = {1, 5}},
['Sap Strenght'] = {id = 105, words = 'exori kor', exhaustion = 12000, premium = true, type = 'Instant', icon = 'sapstrenght', mana = 300, level = 175,soul = 0, group = {[5] = 12000, [3] = 2000}, vocations = {1, 5}},
['Great Fire Wave'] = {id = 100, words = 'exevo gran flam hur', exhaustion = 4000, premium = true, type = 'Instant', icon = 'greatfirewave', mana = 120, level = 38, soul = 0, group = {[1] = 2000}, vocations = {1, 5}},
['Restoration'] = {id = 103, words = "exura max vita", exhaustion = 6000, premium = true, type = 'Instant', icon = 'restoration', mana = 260, level = 300,soul = 0, group = {[2] = 1000}, vocations = {1, 2, 5, 6}},
["Nature's Embrace"] = {id = 101, words = 'exura gran sio', exhaustion = 60000, premium = true, type = 'Instant', icon = 'naturesembrace', mana = 400, level = 300,soul = 0, group = {[2] = 1000}, vocations = {2, 6}},
['Divine Dazzle'] = {id = 101, words = 'exana amp res', exhaustion = 16000, premium = true, type = 'Instant', icon = 'divinedazzle', mana = 80, level = 250,soul = 0, group = {[3] = 2000}, vocations = {3, 7}},
}--[[,
['Sample'] = {
@ -153,8 +168,23 @@ SpellInfo = {
}
-- ['const_name'] = {client_id, TFS_id}
-- Conversion from TFS icon id to the id used by client (icons.png order)
-- Conversion from TFS icon id to the id used by client (icons.png order)
SpellIcons = {
-- new tibia spells, server owners - you will probably need to adjust TFS_id
['summonsorcererfamiliar'] = {130, 173},
['summondruidfamiliar'] = {129, 172},
['summonpaladinfamiliar'] = {127, 171},
['summonknightfamiliar'] = {128, 170},
['exposeweakness'] = {134, 106},
['sapstrenght'] = {135, 105},
['restoration'] = {137, 103},
['fairwoundcleansing'] = {132, 102},
['chivalrouschallange'] = {131, 101},
["naturesembrace"] = {138, 101},
['divinedazzle'] = {139, 101},
['greatfirewave'] = {136, 100},
['conjurewandofdarkness'] = {133, 92},
-- old spells
['intenserecovery'] = {16, 160},
['recovery'] = {15, 159},
['intensewoundcleansing'] = {4, 158},
@ -291,7 +321,7 @@ SpellIcons = {
['intensehealingrune'] = {74, 4},
['ultimatehealing'] = {1, 3},
['intensehealing'] = {7, 2},
['lighthealing'] = {6, 1}
['lighthealing'] = {6, 1},
}
VocationNames = {
@ -309,7 +339,8 @@ SpellGroups = {
[1] = 'Attack',
[2] = 'Healing',
[3] = 'Support',
[4] = 'Special'
[4] = 'Special',
[5] = 'Cripple'
}
Spells = {}
@ -438,4 +469,4 @@ function Spells.getImageClip(id, profile)
.. ((math.ceil(id/12)-1)*SpelllistSettings[profile].iconSize.height) .. ' '
.. SpelllistSettings[profile].iconSize.width .. ' '
.. SpelllistSettings[profile].iconSize.height
end
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.