Updated to OTCv8 3.1 rev 133

This commit is contained in:
OTCv8 2022-02-17 15:00:51 +00:00
parent db1d638018
commit 53bfa274bb
104 changed files with 1288 additions and 50 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
Module
name: client_profiles
description: Provides option to save client customizations into separate profiles
description: Client profiles
author: Vithrax
discord: Vithrax#5814
autoload: true

View File

@ -1 +0,0 @@
4.4,2e01326d0a

View File

@ -31,7 +31,7 @@ local luaFiles = {
"pushmax",
"combo",
"HealBot",
"new healer",
"new_healer",
"AttackBot", -- last of major modules
"ingame_editor",
"Dropper",
@ -50,7 +50,8 @@ local luaFiles = {
"depositer_config",
"npc_talk",
"xeno_menu",
"hold_target"
"hold_target",
"cavebot_control_panel"
}
for i, file in ipairs(luaFiles) do

View File

@ -4,11 +4,21 @@ CaveBot.Extensions.ClearTile.setup = function()
CaveBot.registerAction("ClearTile", "#00FFFF", function(value, retries)
local data = string.split(value, ",")
local pos = {x=tonumber(data[1]), y=tonumber(data[2]), z=tonumber(data[3])}
local doors
local doors = false
local stand = false
local pPos = player:getPosition()
if #data == 4 then
doors = true
for i, value in ipairs(data) do
value = value:lower():trim()
if value == "stand" then
stand = true
elseif value == "doors" then
doors = true
end
end
if not #pos == 3 then
warn("CaveBot[ClearTile]: invalid value. It should be position (x,y,z), is: " .. value)
return false
@ -32,8 +42,14 @@ CaveBot.Extensions.ClearTile.setup = function()
-- no items on tile and walkability means we are done
if tile:isWalkable() and tile:getTopUseThing():isNotMoveable() and not tile:hasCreature() and not doors then
print("CaveBot[ClearTile]: tile clear, proceeding")
return true
if stand then
if not CaveBot.MatchPosition(tPos, 0) then
CaveBot.GoTo(tPos, 0)
return "retry"
end
print("CaveBot[ClearTile]: tile clear, proceeding")
return true
end
end
if not CaveBot.MatchPosition(tPos, 3) then
@ -42,49 +58,64 @@ CaveBot.Extensions.ClearTile.setup = function()
end
if retries > 0 then
delay(1500)
delay(1100)
end
-- but if not then first check for creatures
-- monster
if tile:hasCreature() then
local c = tile:getCreatures()[1]
if c:isMonster() then
attack(c)
return "retry"
-- ok here we will find tile to push player, random
elseif c:isPlayer() then
local candidates = {}
for _, tile in ipairs(g_map.getTiles(posz())) do
if getDistanceBetween(c:getPosition(), tile:getPosition()) == 1 and tile:getPosition() ~= pPos and tile:isWalkable(false) then
table.insert(candidates, tile:getPosition())
end
end
if #candidates == 0 then
print("CaveBot[ClearTile]: can't find tile to push, cannot clear way, skipping")
return false
else
print("CaveBot[ClearTile]: pushing player... " .. c:getName() .. " out of the way")
local pos = candidates[math.random(1,#candidates)]
local tile = g_map.getTile(pos)
tile:setText("here")
schedule(500, function() tile:setText("") end)
g_game.move(c, pos)
return "retry"
end
end
end
for i, item in ipairs(tile:getItems()) do
if not item:isNotMoveable() then
-- moveable item
local item = tile:getTopMoveThing()
if item:isItem() then
if item and not item:isNotMoveable() then
print("CaveBot[ClearTile]: moving item... " .. item:getId().. " from tile")
g_game.move(item, pPos, item:getCount())
return "retry"
end
end
-- player
-- push creature
if tile:hasCreature() then
local c = tile:getCreatures()[1]
if c and c:isPlayer() then
local candidates = {}
for _, tile in ipairs(g_map.getTiles(posz())) do
local tPos = tile:getPosition()
if getDistanceBetween(c:getPosition(), tPos) == 1 and tPos ~= pPos and tile:isWalkable() then
table.insert(candidates, tPos)
end
end
if #candidates == 0 then
print("CaveBot[ClearTile]: can't find tile to push, cannot clear way, skipping")
return false
else
print("CaveBot[ClearTile]: pushing player... " .. c:getName() .. " out of the way")
local pos = candidates[math.random(1,#candidates)]
local tile = g_map.getTile(pos)
tile:setText("here")
schedule(500, function() tile:setText("") end)
g_game.move(c, pos, 1)
return "retry"
end
end
end
-- doors
if doors then
use(tile:getTopUseThing())
return "retry"
end
return "retry"
end)

View File

@ -448,10 +448,12 @@ inputPanel.addButton.onClick = function()
local name = inputPanel.name:getText()
local items = getItemsFromBox()
local unequip = {}
local hasUnequip = false
for i, child in pairs(inputPanel.unequipPanel:getChildren()) do
if child:isChecked() then
table.insert(unequip, true)
hasUnequip = true
else
table.insert(unequip, false)
end
@ -491,8 +493,8 @@ inputPanel.addButton.onClick = function()
end
end
if #items == 0 then
return warn("[vBot Equipper] Please add items.")
if #items == 0 and not hasUnequip then
return warn("[vBot Equipper] Please add items or select unequip slots.")
end
if #name == 0 then

View File

@ -0,0 +1,63 @@
setDefaultTab("Cave")
g_ui.loadUIFromString([[
CaveBotControlPanel < Panel
margin-top: 5
layout:
type: verticalBox
fit-children: true
HorizontalSeparator
Label
text-align: center
text: CaveBot Control Panel
font: verdana-11px-rounded
margin-top: 3
HorizontalSeparator
Panel
id: buttons
margin-top: 2
layout:
type: grid
cell-size: 86 20
cell-spacing: 1
flow: true
fit-children: true
HorizontalSeparator
margin-top: 3
]])
local panel = UI.createWidget("CaveBotControlPanel")
storage.caveBot = {
forceRefill = false,
backStop = false,
backTrainers = false,
backOffline = false
}
-- [[ B U T T O N S ]] --
local forceRefill = UI.Button("Force Refill", function(widget)
storage.caveBot.forceRefill = true
print("[CaveBot] Going back on refill on next supply check.")
end, panel.buttons)
local backStop = UI.Button("Back & Stop", function(widget)
storage.caveBot.backStop = true
print("[CaveBot] Going back to city on next supply check and turning off CaveBot on depositer action.")
end, panel.buttons)
local backTrainers = UI.Button("To Trainers", function(widget)
storage.caveBot.backTrainers = true
print("[CaveBot] Going back to city on next supply check and going to label 'toTrainers' on depositer action.")
end, panel.buttons)
local backOffline = UI.Button("Offline", function(widget)
storage.caveBot.backOffline = true
print("[CaveBot] Going back to city on next supply check and going to label 'toOfflineTraining' on depositer action.")
end, panel.buttons)

View File

@ -14,6 +14,14 @@ extrasWindow.closeButton.onClick = function(widget)
extrasWindow:hide()
end
extrasWindow.onGeometryChange = function(widget, old, new)
if old.height == 0 then return end
settings.height = new.height
end
extrasWindow:setHeight(settings.height or 360)
-- available options for dest param
local rightPanel = extrasWindow.content.right
local leftPanel = extrasWindow.content.left
@ -525,7 +533,9 @@ if true then
end
end
if settings.checkPlayer then
checkPlayers()
schedule(500, function()
checkPlayers()
end)
end
onPlayerPositionChange(function(x,y)

View File

@ -138,6 +138,16 @@ ExtrasWindow < MainWindow
anchors.bottom: closeButton.top
margin-bottom: 8
ResizeBorder
id: bottomResizeBorder
anchors.fill: separator
height: 3
minimum: 260
maximum: 600
margin-left: 3
margin-right: 3
background: #ffffff88
Button
id: closeButton
!text: tr('Close')

View File

@ -0,0 +1,159 @@
Container = {}
--- returns all open containers
-- @return table
function Container:getAll() return getContainers() end
--- gets first open container
-- @return userdata
function Container:getFirst() return getContainers()[1] end
--- gets last open container
-- @return userdata
function Container:getLast() return getContainers()[#getContainers()] end
-- returns open containers count
-- @return number
function Container:getOpenContainersCount() return #getContainers() end
--- returns given container item id
-- @param container is userdata
-- @return number
function Container:getItemId() end
--- closes all open container windows
-- @return void
function Container:closeAllContainers()
for i, container in ipairs(Container:getContainers()) do
container:close()
end
end
--- checks if container has any free slots
-- @param container is userdata
-- @return boolean
function Container:isFull(container)
return container:getCapacity() > #container:getItems()
end
--- returns free slots count in given container
-- @param container is userdata
-- @return number
function Container:getFreeSlots(container)
return #container:getItems() - container:getCapacity()
end
--- returns first free slot position
-- @param container is userdata
-- @return table
function Container:getFreeSlotPosition(container)
return container:getSlotPosition(container:getItems())
end
--- opens given container parent
-- @param container is userdata
-- @return void
function Container:openParent(container) g_game.openParent(container) end
--- finds open container object based on the id
-- @param itemId is number
-- @return userdata
function Container:getContainerByItemId(itemId)
for i, container in ipairs(getContainers()) do
local cId = container:getContainerItem():getId()
if cId == itemId then return container end
end
end
--- finds open container object based on the name
-- @param name is string
-- @return userdata
function Container:getContainerByName(name)
name = name:lower():trim()
for i, container in ipairs(getContainers()) do
local cName = container:getName():lower()
if cName == name then return container end
end
end
--- checks if given container is declared as loot container in TargetBot
-- @param container is userdata / integer / string
-- @returns boolean
function Container:isLootContainer(container)
local id
if type(container) == "number" then
id = container
elseif type(container) == "string" then
id = Container:getContainerByName(container)
id = id and id:getContainerItem():getId()
elseif type(container) == "userdata" then
id = container:getContainerItem():getId()
end
if not id then return false end
if table.find(vBot.lootConainers, id) then
return true
else
return false
end
end
--- returns the amount of open loot containers
-- @return amount
function Container:getOpenLootContainersCount()
local amount = 0
for i, container in ipairs(getContainers()) do
amount = Container:isLootContainer(container) and amount + 1 or amount
end
return amount
end
--- opens child container with the same id inside given one
-- @param container is userdata
-- @param newWindow is boolean
-- @return void
function Container:openChild(container, newWindow)
local parentId = container:getContaierItem():getId()
for i, item in ipairs(container:getItems()) do
local id = item:getId()
if id == parentId then
return g_game.open(item, newWindow and container or nil)
end
end
end
-- returns all items inside given container
-- @param container is userdata
-- @return table
function Container:getItems(container) return container:getItems() end
--- checks if given container helds item with given id
-- @param container is userdata
-- @param id is number
-- @return boolean
function Container:hasItem(container, id)
local isInsideContainer = false
for i, item in ipairs(container:getItems()) do
if item:getId() == id then
isInsideContainer = true
break
end
end
return isInsideContainer
end
function Container:reOpenAllContainers()
-- TODO, extract function from containers.lua
end

View File

@ -0,0 +1,100 @@
Player = {}
--- opens main backpack
-- @return void
function Player:openMain()
local back = getBack()
if back then g_game.open(back) end
end
--- opens purse/store inbox slot
-- @return void
function Player:openPurse()
local purse = getPurse()
if item then use(purse) end
end
--- player says certain phrase or sequence
-- @param text is string or table
-- @param npc is boolean
-- @return void
function Player:speak(text, npc, wait)
if type(text) == "string" then
if npc then
return NPC.say(text)
else
return say(text)
end
end
-- text is table, therefore sequence
local talkDelay = 0
local globalDelay = storage.extras.talkDelay
for i, string in ipairs(text) do
schedule(talkDelay, function()
if npc then
return NPC.say(string)
else
return say(string)
end
end)
talkDelay = talkDelay + globalDelay
end
if wait then delay( talkDelay + globalDelay ) end
end
function Player:getId()
return player:getId()
end
function Player:getName()
return player:getName()
end
function Player:getTarget()
return g_game.getAttackingCreature()
end
function Player:getTargetName()
return Player:getTarget():getName()
end
function Player:getTargetPosition()
return Player:getTarget():getPosition()
end
function Player:getDistanceFromTarget()
return getDistanceBetween(Player:getPosition(), Player:getTargetPosition())
end
function Player:getPosition()
return player:getPosition()
end
function Player:getLookDirection()
return player:getDirection()
end
function Player:getLookPosition(range)
local dir = Player:getLookDirection()
local pos = Player:getPosition()
local n = range or 1
if (dir == NORTH) then
pos.y = pos.y - n
elseif (dir == SOUTH) then
pos.y = pos.y + n
elseif (dir == WEST) then
pos.x = pos.x - n
elseif (dir == EAST) then
pos.x = pos.x + n
end
return pos
end

View File

@ -1,6 +1,5 @@
local version = "4.4"
local version = "4.41"
local currentVersion
local hashcode
local available = false
storage.checkVersion = storage.checkVersion or 0
@ -16,9 +15,7 @@ if os.time() > storage.checkVersion + (12 * 60 * 60) then
return
end
local t = string.split(data, ",")
currentVersion = t[1]:trim()
hashcode = t[2]:trim()
currentVersion = data
available = true
end)
@ -29,18 +26,15 @@ UI.Button("Official OTCv8 Discord!", function() g_platform.openUrl("https://disc
UI.Separator()
schedule(5000, function()
if not available then return end
if currentVersion ~= version then
UI.Separator()
local label = UI.Label("New vBot is available for download! v"..currentVersion)
label:setColor()
UI.Button("Get Hash Code", function()
g_window.setClipboardText(hashcode)
info("Hashcode copied to clipboard!")
end)
UI.Label("New vBot is available for download! v"..currentVersion)
UI.Button("Go to vBot GitHub Page", function() g_platform.openUrl("https://github.com/Vithrax/vBot") end)
UI.Separator()
end
end)

View File

@ -0,0 +1,455 @@
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

@ -0,0 +1,413 @@
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

@ -0,0 +1 @@
4.41

Some files were not shown because too many files have changed in this diff Show More