Updated to OTCv8 3.1 rev 138

This commit is contained in:
OTCv8 2022-02-24 13:30:08 +00:00
parent 59e865bf82
commit af00528e49
16 changed files with 5 additions and 879 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -122,6 +122,4 @@ OptionPanel
OptionCheckBox
id: actionbarLock
!text: tr('Disable action bar hotkeys when chat mode is on')
$mobile:
visible: false
!text: tr('Disable action bar hotkeys when chat mode is on')

View File

@ -64,7 +64,7 @@ local defaultOptions = {
actionbarRight2 = false,
actionbarRight3 = false,
actionbarLock = true,
actionbarLock = false,
profile = 1
}

View File

@ -2,7 +2,7 @@ Module
name: client_profiles
description: Client profiles
author: Vithrax
discord: Vithrax#5814
website: discord_Vithrax#5814
autoload: true
reloadable: false
scripts: [ profiles ]

View File

@ -1,455 +0,0 @@
setDefaultTab("Main")
local panelName = "newHealer"
local ui = setupUI([[
Panel
height: 19
BotSwitch
id: title
anchors.top: parent.top
anchors.left: parent.left
text-align: center
width: 130
!text: tr('Friend Healer')
Button
id: edit
anchors.top: prev.top
anchors.left: prev.right
anchors.right: parent.right
margin-left: 3
height: 17
text: Setup
]])
ui:setId(panelName)
-- validate current settings
if not storage[panelName] or not storage[panelName].priorities then
storage[panelName] = nil
end
if not storage[panelName] then
storage[panelName] = {
enabled = false,
customPlayers = {},
vocations = {},
groups = {},
priorities = {
{name="Custom Spell", enabled=false, custom=true},
{name="Exura Gran Sio", enabled=true, strong = true},
{name="Exura Sio", enabled=true, normal = true},
{name="Exura Gran Mas Res", enabled=true, area = true},
{name="Health Item", enabled=true, health=true},
{name="Mana Item", enabled=true, mana=true}
},
settings = {
{type="HealItem", text="Mana Item ", value=268},
{type="HealScroll", text="Item Range: ", value=6},
{type="HealItem", text="Health Item ", value=3160},
{type="HealScroll", text="Mas Res Players: ", value=2},
{type="HealScroll", text="Heal Friend at: ", value=80},
{type="HealScroll", text="Use Gran Sio at: ", value=80},
{type="HealScroll", text="Min Player HP%: ", value=80},
{type="HealScroll", text="Min Player MP%: ", value=50},
},
conditions = {
knights = true,
paladins = true,
druids = false,
sorcerers = false,
party = true,
guild = false,
botserver = false,
friends = false
}
}
end
local config = storage[panelName]
local healerWindow = UI.createWindow('FriendHealer')
healerWindow:hide()
healerWindow:setId(panelName)
ui.title:setOn(config.enabled)
ui.title.onClick = function(widget)
config.enabled = not config.enabled
widget:setOn(config.enabled)
end
ui.edit.onClick = function()
healerWindow:show()
healerWindow:raise()
healerWindow:focus()
end
local conditions = healerWindow.conditions
local targetSettings = healerWindow.targetSettings
local customList = healerWindow.customList
local priority = healerWindow.priority
-- customList
-- create entries on the list
for name, health in pairs(config.customPlayers) do
local widget = UI.createWidget("HealerPlayerEntry", customList.playerList.list)
widget.remove.onClick = function()
config.customPlayers[name] = nil
widget:destroy()
end
widget:setText("["..health.."%] "..name)
end
customList.playerList.onDoubleClick = function()
customList.playerList:hide()
end
local function clearFields()
customList.addPanel.name:setText("friend name")
customList.addPanel.health:setText("1")
customList.playerList:show()
end
local function capitalFistLetter(str)
return (string.gsub(str, "^%l", string.upper))
end
customList.addPanel.add.onClick = function()
local name = ""
local words = string.split(customList.addPanel.name:getText(), " ")
local health = tonumber(customList.addPanel.health:getText())
for i, word in ipairs(words) do
name = name .. " " .. capitalFistLetter(word)
end
if not health then
clearFields()
return warn("[Friend Healer] Please enter health percent value!")
end
if name:len() == 0 or name:lower() == "friend name" then
clearFields()
return warn("[Friend Healer] Please enter friend name to be added!")
end
if config.customPlayers[name] or config.customPlayers[name:lower()] then
clearFields()
return warn("[Friend Healer] Player already added to custom list.")
else
config.customPlayers[name] = health
local widget = UI.createWidget("HealerPlayerEntry", customList.playerList.list)
widget.remove.onClick = function()
config.customPlayers[name] = nil
widget:destroy()
end
widget:setText("["..health.."%] "..name)
end
clearFields()
end
local function validate(widget, category)
local list = widget:getParent()
local label = list:getParent().title
-- 1 - priorities | 2 - vocation
category = category or 0
if category == 2 and not storage.extras.checkPlayer then
label:setColor("#d9321f")
label:setTooltip("! WARNING ! \nTurn on check players in extras to use this feature!")
return
else
label:setColor("#dfdfdf")
label:setTooltip("")
end
local checked = false
for i, child in ipairs(list:getChildren()) do
if category == 1 and child.enabled:isChecked() or child:isChecked() then
checked = true
end
end
if not checked then
label:setColor("#d9321f")
label:setTooltip("! WARNING ! \nNo category selected!")
else
label:setColor("#dfdfdf")
label:setTooltip("")
end
end
-- targetSettings
targetSettings.vocations.box.knights:setChecked(config.conditions.knights)
targetSettings.vocations.box.knights.onClick = function(widget)
config.conditions.knights = not config.conditions.knights
widget:setChecked(config.conditions.knights)
validate(widget, 2)
end
targetSettings.vocations.box.paladins:setChecked(config.conditions.paladins)
targetSettings.vocations.box.paladins.onClick = function(widget)
config.conditions.paladins = not config.conditions.paladins
widget:setChecked(config.conditions.paladins)
validate(widget, 2)
end
targetSettings.vocations.box.druids:setChecked(config.conditions.druids)
targetSettings.vocations.box.druids.onClick = function(widget)
config.conditions.druids = not config.conditions.druids
widget:setChecked(config.conditions.druids)
validate(widget, 2)
end
targetSettings.vocations.box.sorcerers:setChecked(config.conditions.sorcerers)
targetSettings.vocations.box.sorcerers.onClick = function(widget)
config.conditions.sorcerers = not config.conditions.sorcerers
widget:setChecked(config.conditions.sorcerers)
validate(widget, 2)
end
targetSettings.groups.box.friends:setChecked(config.conditions.friends)
targetSettings.groups.box.friends.onClick = function(widget)
config.conditions.friends = not config.conditions.friends
widget:setChecked(config.conditions.friends)
validate(widget)
end
targetSettings.groups.box.party:setChecked(config.conditions.party)
targetSettings.groups.box.party.onClick = function(widget)
config.conditions.party = not config.conditions.party
widget:setChecked(config.conditions.party)
validate(widget)
end
targetSettings.groups.box.guild:setChecked(config.conditions.guild)
targetSettings.groups.box.guild.onClick = function(widget)
config.conditions.guild = not config.conditions.guild
widget:setChecked(config.conditions.guild)
validate(widget)
end
targetSettings.groups.box.botserver:setChecked(config.conditions.botserver)
targetSettings.groups.box.botserver.onClick = function(widget)
config.conditions.botserver = not config.conditions.botserver
widget:setChecked(config.conditions.botserver)
validate(widget)
end
validate(targetSettings.vocations.box.knights)
validate(targetSettings.groups.box.friends)
validate(targetSettings.vocations.box.sorcerers, 2)
-- conditions
for i, setting in ipairs(config.settings) do
local widget = UI.createWidget(setting.type, conditions.box)
local text = setting.text
local val = setting.value
widget.text:setText(text)
if setting.type == "HealScroll" then
widget.text:setText(widget.text:getText()..val)
if not (text:find("Range") or text:find("Mas Res")) then
widget.text:setText(widget.text:getText().."%")
end
widget.scroll:setValue(val)
widget.scroll.onValueChange = function(scroll, value)
setting.value = value
widget.text:setText(text..value)
if not (text:find("Range") or text:find("Mas Res")) then
widget.text:setText(widget.text:getText().."%")
end
end
if text:find("Range") or text:find("Mas Res") then
widget.scroll:setMaximum(10)
end
else
widget.item:setItemId(val)
widget.item:setShowCount(false)
widget.item.onItemChange = function(widget)
setting.value = widget:getItemId()
end
end
end
-- priority and toggles
local function setCrementalButtons()
for i, child in ipairs(priority.list:getChildren()) do
if i == 1 then
child.increment:disable()
elseif i == 6 then
child.decrement:disable()
else
child.increment:enable()
child.decrement:enable()
end
end
end
for i, action in ipairs(config.priorities) do
local widget = UI.createWidget("PriorityEntry", priority.list)
widget:setText(action.name)
widget.increment.onClick = function()
local index = priority.list:getChildIndex(widget)
local table = config.priorities
priority.list:moveChildToIndex(widget, index-1)
table[index], table[index-1] = table[index-1], table[index]
setCrementalButtons()
end
widget.decrement.onClick = function()
local index = priority.list:getChildIndex(widget)
local table = config.priorities
priority.list:moveChildToIndex(widget, index+1)
table[index], table[index+1] = table[index+1], table[index]
setCrementalButtons()
end
widget.enabled:setChecked(action.enabled)
widget:setColor(action.enabled and "#98BF64" or "#dfdfdf")
widget.enabled.onClick = function()
action.enabled = not action.enabled
widget:setColor(action.enabled and "#98BF64" or "#dfdfdf")
widget.enabled:setChecked(action.enabled)
validate(widget, 1)
end
if action.custom then
widget.onDoubleClick = function()
local window = modules.client_textedit.show(widget, {title = "Custom Spell", description = "Enter below formula for a custom healing spell"})
schedule(50, function()
window:raise()
window:focus()
end)
end
widget.onTextChange = function(widget,text)
action.name = text
end
widget:setTooltip("Double click to set spell formula.")
end
if i == #config.priorities then
validate(widget, 1)
setCrementalButtons()
end
end
local lastItemUse = now
local function friendHealerAction(spec, targetsInRange)
local name = spec:getName()
local health = spec:getHealthPercent()
local mana = spec:getManaPercent()
local dist = distanceFromPlayer(spec:getPosition())
targetsInRange = targetsInRange or 0
local masResAmount = config.settings[4].value
local itemRange = config.settings[2].value
local healItem = config.settings[3].value
local manaItem = config.settings[1].value
local normalHeal = config.customPlayers[name] or config.settings[5].value
local strongHeal = config.customPlayers[name] and normalHeal/2 or config.settings[6].value
for i, action in ipairs(config.priorities) do
if action.enabled then
if action.area and masResAmount <= targetsInRange and canCast("exura gran mas res") then
return say("exura gran mas res")
end
if action.mana and findItem(manaItem) and mana <= normalHeal and dist <= itemRange and now - lastItemUse > 1000 then
lastItemUse = now
return useWith(manaItem, spec)
end
if action.health and findItem(healItem) and health <= normalHeal and dist <= itemRange and now - lastItemUse > 1000 then
lastItemUse = now
return useWith(healItem, spec)
end
if action.strong and health <= strongHeal and not modules.game_cooldown.isCooldownIconActive(101) then
return say('exura gran sio "'..name)
end
if (action.normal or action.custom) and health <= normalHeal and canCast('exura sio "'..name) then
return say('exura sio "'..name)
end
end
end
end
macro(100, function()
if not config.enabled then return end
if modules.game_cooldown.isGroupCooldownIconActive(2) then return end
local minHp = config.settings[7].value
local minMp = config.settings[8].value
-- first index will be heal target
local finalTable = {}
local inMasResRange = 0
-- check basic
if hppercent() <= minHp or manapercent() <= minMp then return end
-- get all spectators
local spectators = getSpectators()
-- clear table from irrelevant spectators
for i, spec in ipairs(getSpectators()) do
if spec:isLocalPlayer() or not spec:isPlayer() or not spec:canShoot() then
if not config.customPlayers[name] then
table.remove(spectators, table.find(spectators, spec))
end
else
local specText = spec:getText()
-- check players is enabled and spectator already verified
if storage.extras.checkPlayer and specText:len() > 0 then
if specText:find("EK") and not config.conditions.knights or
specText:find("RP") and not config.conditions.paladins or
specText:find("ED") and not config.conditions.druids or
specText:find("MS") and not config.conditions.sorcerers then
if not config.customPlayers[name] then
table.remove(spectators, table.find(spectators, spec))
end
end
end
local okParty = config.conditions.party and spec:isPartyMember()
local okFriend = config.conditions.friends and isFriend(spec)
local okGuild = config.conditions.guild and spec:getEmblem() == 1
local okBotServer = config.conditions.botserver and vBot.BotServerMembers[spec:getName()]
if not (okParty or okFriend or okGuild or okBotServer) then
if not config.customPlayers[name] then
table.remove(spectators, table.find(spectators, spec))
end
end
end
end
-- no targets, return
if #spectators == 0 then return end
for name, health in pairs(config.customPlayers) do
for i, spec in ipairs(spectators) do
local specHp = spec:getHealthPercent()
if spec:getName() == name and specHp <= health then
if distanceFromPlayer(spec:getPosition()) <= 2 then
inMasResRange = inMasResRange + 1
end
table.insert(finalTable, spec)
table.remove(spectators, i)
end
end
end
for i=1,#spectators do
local spec = spectators[i]
if distanceFromPlayer(spec:getPosition()) <= 3 then
inMasResRange = inMasResRange + 1
end
table.insert(finalTable, spec)
end
-- no targets, return
if #finalTable == 0 then return end
friendHealerAction(finalTable[1], inMasResRange)
end)

View File

@ -1,413 +0,0 @@
CategoryCheckBox < CheckBox
font: verdana-11px-rounded
margin-top: 3
$checked:
color: #98BF64
HealScroll < Panel
ToolTipLabel
id: text
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text-align: center
text: test
HorizontalScrollBar
id: scroll
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 3
minimum: 0
maximum: 100
step: 1
HealItem < Panel
BotItem
id: item
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
size: 34 34
ToolTipLabel
id: text
anchors.fill: parent
anchors.left: prev.right
margin-left: 8
text-wrap: true
text-align: left
ToolTipLabel < UIWidget
font: verdana-11px-rounded
color: #dfdfdf
height: 14
text-align: center
HealerPlayerEntry < Label
background-color: alpha
text-offset: 5 1
focusable: true
height: 16
font: verdana-11px-rounded
text-align: left
$focus:
background-color: #00000055
Button
id: remove
anchors.right: parent.right
margin-right: 2
anchors.verticalCenter: parent.verticalCenter
size: 15 15
margin-right: 15
text: X
tooltip: Remove player from the list
PriorityEntry < ToolTipLabel
background-color: alpha
text-offset: 18 1
focusable: true
height: 16
font: verdana-11px-rounded
text-align: left
$focus:
background-color: #00000055
CheckBox
id: enabled
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
size: 15 15
margin-top: 2
margin-left: 3
Button
id: increment
anchors.right: parent.right
margin-right: 2
anchors.verticalCenter: parent.verticalCenter
size: 14 14
text: +
tooltip: Increase Priority
Button
id: decrement
anchors.right: prev.left
margin-right: 2
anchors.verticalCenter: parent.verticalCenter
size: 14 14
text: -
tooltip: Decrease Priority
TargetSettings < Panel
size: 280 125
padding: 3
image-source: /images/ui/window
image-border: 6
Label
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
font: verdana-11px-rounded
text: Heal Target Settings
Groups
id: groups
anchors.top: prev.bottom
margin-top: 8
anchors.left: parent.left
margin-left: 9
Vocations
id: vocations
anchors.left: prev.right
margin-left: 5
anchors.verticalCenter: prev.verticalCenter
Groups < FlatPanel
size: 150 90
padding: 3
padding-top: 5
ToolTipLabel
id: title
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: Groups
tooltip: Players added in custom list will always be in scope
HorizontalSeparator
anchors.top: prev.bottom
margin-top: 2
anchors.left: parent.left
anchors.right: parent.right
Panel
id: box
anchors.top: prev.bottom
margin-top: 2
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
padding: 2
layout:
type: verticalBox
CategoryCheckBox
id: friends
text: Friends
CategoryCheckBox
id: party
text: Party Members
CategoryCheckBox
id: guild
text: Guild Members
CategoryCheckBox
id: botserver
text: BotServer Members
Vocations < FlatPanel
size: 100 90
padding: 3
padding-top: 5
ToolTipLabel
id: title
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
font: verdana-11px-rounded
text: Vocations
HorizontalSeparator
anchors.top: prev.bottom
margin-top: 2
anchors.left: parent.left
anchors.right: parent.right
Panel
id: box
anchors.top: prev.bottom
margin-top: 2
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
padding: 2
layout:
type: verticalBox
CategoryCheckBox
id: knights
text: Knights
CategoryCheckBox
id: paladins
text: Paladins
CategoryCheckBox
id: druids
text: Druids
CategoryCheckBox
id: sorcerers
text: Sorcerers
Priority < Panel
size: 190 123
padding: 6
padding-top: 3
image-source: /images/ui/window
image-border: 6
ToolTipLabel
id: title
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
font: verdana-11px-rounded
text: Priority & Toggles
TextList
id: list
anchors.top: prev.bottom
margin-top: 3
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
fit-children: true
padding-top: 1
AddPlayer < FlatPanel
padding: 5
Label
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
font: verdana-11px-rounded
text: Add Player to Custom List
text-align: center
text-wrap: true
HorizontalSeparator
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 2
SpinBox
id: health
anchors.left: parent.left
anchors.top: prev.bottom
margin-top: 20
width: 50
minimum: 1
maximum: 99
step: 1
focusable: true
text-align: center
Label
anchors.verticalCenter: prev.verticalCenter
anchors.left: prev.right
margin-left: 3
font: verdana-11px-rounded
text: %HP - heal if below
TextEdit
id: name
anchors.top: health.bottom
margin-top: 5
anchors.left: health.left
anchors.right: parent.right
font: verdana-11px-rounded
text-align: center
text: friend name
Button
id: add
anchors.left: health.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
font: verdana-11px-rounded
text: Add Player
PlayerList < Panel
TextList
id: list
anchors.fill: parent
fit-children: true
padding-top: 2
vertical-scrollbar: listScrollBar
VerticalScrollBar
id: listScrollBar
anchors.top: list.top
anchors.bottom: list.bottom
anchors.right: list.right
step: 14
pixels-scroll: true
CustomList < Panel
size: 190 172
padding: 6
padding-top: 3
image-source: /images/ui/window
image-border: 6
ToolTipLabel
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
font: verdana-11px-rounded
text: Custom Player List
tooltip: Double click on the list below to add new player.
AddPlayer
id: addPanel
anchors.top: prev.bottom
margin-top: 3
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
PlayerList
id: playerList
anchors.fill: prev
Conditions < Panel
size: 280 170
padding: 3
image-source: /images/ui/window
image-border: 6
Label
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
font: verdana-11px-rounded
text: Player Conditions
Panel
id: box
anchors.fill: parent
margin-top: 16
padding: 5
padding-top: 3
layout:
type: grid
cell-size: 128 31
cell-spacing: 5
num-columns: 2
FriendHealer < MainWindow
!text: tr('Friend Healer')
size: 512 390
padding-top: 30
@onEscape: self:hide()
Conditions
id: conditions
anchors.top: parent.top
anchors.right: parent.right
TargetSettings
id: targetSettings
anchors.top: prev.bottom
margin-top: 10
anchors.left: prev.left
Priority
id: priority
anchors.top: parent.top
anchors.left: parent.left
CustomList
id: customList
anchors.top: priority.bottom
margin-top: 10
anchors.left: priority.left
HorizontalSeparator
id: separator
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: closeButton.top
margin-bottom: 8
Button
id: closeButton
!text: tr('Close')
font: cipsoftFont
anchors.right: parent.right
anchors.bottom: parent.bottom
size: 45 21
@onClick: self:getParent():hide()

View File

@ -105,8 +105,6 @@ local experienceTooltip = 'You have %d%% to advance to level %d.'
local settings = {}
function init()
-- unfortunately won't work for mobile
if g_app.isMobile() then return end
connect(LocalPlayer, {
onHealthChange = onHealthChange,
@ -127,8 +125,6 @@ function init()
end
function terminate()
-- unfortunately won't work for mobile
if g_app.isMobile() then return end
disconnect(LocalPlayer, {
onHealthChange = onHealthChange,
@ -145,7 +141,7 @@ end
function setupTopBar()
local topPanel = modules.game_interface.getTopBar()
topBar = topBar or g_ui.loadUI('topbar', topPanel)
topBar = topBar or g_ui.loadUI('TopBar', topPanel)
topBar = topBar or g_ui.createWidget('TopBar', topPanel)
manaBar = topBar.stats.mana

View File

@ -2,7 +2,7 @@ Module
name: game_topbar
description: Customizable Top Bar from Cipsoft's Tibia 12 Client
author: Vithrax
discord: Vithrax#5814
website: discord_Vithrax#5814
sandboxed: true
autoload: true
scripts: [ topbar ]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.