0% found this document useful (0 votes)
85 views8 pages

Healing and Spell Macro Script

The document contains a script for a game that manages healing spells, items, and various macros for player actions. It includes functionalities for healing based on health and mana percentages, casting spells, following other players, and using items efficiently. Additionally, it provides a user interface for configuring settings related to these features.

Uploaded by

j.donato1993
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views8 pages

Healing and Spell Macro Script

The document contains a script for a game that manages healing spells, items, and various macros for player actions. It includes functionalities for healing based on health and mana percentages, casting spells, following other players, and using items efficiently. Additionally, it provides a user interface for configuring settings related to these features.

Uploaded by

j.donato1993
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- inicio do Script: SPells de cura

if type(storage.healing1) ~= "table" then


storage.healing1 = {on=false, title="HP%", text="exura", min=51, max=90}
end
if type(storage.healing2) ~= "table" then
storage.healing2 = {on=false, title="HP%", text="exura vita", min=0, max=50}
end

-- create 2 healing widgets


for _, healingInfo in ipairs({storage.healing1, storage.healing2}) do
local healingmacro = macro(20, function()
local hp = player:getHealthPercent()
if [Link] >= hp and hp >= [Link] then
say([Link])
end
end)
[Link]([Link])

[Link](healingInfo, function(widget, newParams)


healingInfo = newParams
[Link]([Link])
end)
end
-- Fim do Script: SPells de cura

-- Nome do Script: Itens de cura

addLabel("texto", "-> ITENS DE CURA <-"):setColor("#DFFF00")

if type(storage.hpitem1) ~= "table" then


storage.hpitem1 = {on=false, title="HP%", item=3160, min=0, max=90}
end
if type(storage.hpitem2) ~= "table" then
storage.hpitem2 = {on=false, title="HP%", item=3160, min=0, max=90}
end
if type(storage.manaitem1) ~= "table" then
storage.manaitem1 = {on=false, title="MP%", item=23373, min=0, max=50}
end
if type(storage.manaitem2) ~= "table" then
storage.manaitem2 = {on=false, title="MP%", item=238, min=0, max=60}
end

for i, healingInfo2 in ipairs({storage.hpitem1, storage.hpitem2, storage.manaitem1,


storage.manaitem2}) do
local healingmacro2 = macro(20, function()
local hp = i <= 2 and player:getHealthPercent() or [Link](100,
[Link](100 * (player:getMana() / player:getMaxMana())))
if [Link] >= hp and hp >= [Link] then
if TargetBot then
[Link]([Link], [Link], player)
-- sync spell with targetbot if available
else
local thing = g_things.getThingType([Link])
local subType = g_game.getClientVersion() >= 860 and 0 or 1
if thing and thing:isFluidContainer() then
subType = [Link]
end
g_game.useInventoryItemWith([Link], player, subType)
end
end
end)
[Link]([Link])

[Link](healingInfo2, function(widget, newParams)


healingInfo2 = newParams
[Link]([Link] and [Link] > 100)
end)
end

if g_game.getClientVersion() < 780 then


[Link]("In old tibia potions & runes work only when you have backpack with
them opened")
end

-- Nome do Script: Icon Utamo

addIcon("Utamo", {item={id=3548, count=1}, text="Utamo"}, macro(100, function(m)


if not hasManaShield() then
say("Utamo Vita")
end
end))

-- Nome do Script: Macro de Ring

[Link]("E-RING", toolsTab):setColor("yellow")
[Link]()

function fastring(parent)
if not parent then
parent = panel
end

local panelName = "E-RING"


local ui = setupUI([[
Panel
height: 65

BotItem
id: item
[Link]: [Link]
[Link]: [Link]

BotSwitch
id: title
[Link]: [Link]
[Link]: [Link]
[Link]: [Link]
text-align: center
margin-left: 2
margin-top: 0

BotLabel
id: friendHp
[Link]: [Link]
[Link]: [Link]
[Link]: [Link]
text-align: center

HorizontalScrollBar
id: minFriendHp
[Link]: [Link]
[Link]: [Link]
[Link]: [Link]
margin-right: 2
margin-top: 2
minimum: 1
maximum: 100
step: 1

HorizontalScrollBar
id: maxFriendHp
[Link]: [Link]
[Link]: [Link]
[Link]: [Link]
margin-left: 2
minimum: 1
maximum: 100
step: 1
]], parent)
ui:setId(panelName)

[Link]:setText("Energy Ring")

if not storage[panelName] then


storage[panelName] = {
minFriendHp = 90,
maxFriendHp = 91,
item = 50488,
enabled = true
}
end

[Link]:setOn(storage[panelName].enabled)
[Link] = function(widget)
storage[panelName].enabled = not storage[panelName].enabled
widget:setOn(storage[panelName].enabled)
end

[Link] = function(widget)
storage[panelName].item = widget:getItemId()
end
[Link]:setItemId(storage[panelName].item)

local updateFriendHpText = function()


[Link]:setText("" .. storage[panelName].minFriendHp .. "% <= hp >= " ..
storage[panelName].maxFriendHp .. "%")
end
[Link] = function(scroll, value)
storage[panelName].minFriendHp = value
updateFriendHpText()
end
[Link] = function(scroll, value)
storage[panelName].maxFriendHp = value
updateFriendHpText()
end
[Link]:setValue(storage[panelName].minFriendHp)
[Link]:setValue(storage[panelName].maxFriendHp)

-- Ícone de ativação funcional


local fastRingIcon = addIcon("FastRing", {item={id=3051, count=1}, text="E-
RING"}, function(icon, isOn)
storage[panelName].enabled = isOn
[Link]:setOn(isOn)
end)

-- Ajusta o tamanho do ícone


fastRingIcon:setWidth(100)

-- Macro que verifica ativação


macro(10, function()
if not storage[panelName].enabled then return end
if hppercent() <= storage[panelName].minFriendHp then
moveToSlot(findItem(3051), SlotFinger)
elseif hppercent() >= storage[panelName].maxFriendHp then
moveToSlot(storage[panelName].item, SlotFinger)
end
end, toolsTab)
end

fastring(toolsTab)
addSeparator("sep", toolsTab)

-- Fim do Script: Macro de Ring

-- Nome do Script: Haste Spell

[Link]()
[Link]("Haste Spell")
[Link]([Link] or "utani hur", function(widget, newText)
[Link] = newText
end)
macro(500, "haste", function()
if (isParalyzed() or not hasHaste()) and not target() then
say([Link])
end
end)
-- Fim do Script: Haste Spell

-- Nome do Script: Follow

addLabel("Label", "Follow Name")


addTextEdit("TxtEdit", [Link] or "name", function(widget, text)
[Link] = text
end)
--------------------------
local lastPos = nil
macro(200, "Follow", function()
local leader = getCreatureByName([Link])
local target = g_game.getAttackingCreature()
if leader then
if target and lastPos then
return player:autoWalk(lastPos)
end
if not g_game.getFollowingCreature() then
return g_game.follow(leader)
end
elseif lastPos then
player:autoWalk(lastPos)
end
end)

onCreaturePositionChange(function(creature, newPos, oldPos)


local leader = getCreatureByName([Link])
if leader ~= creature or not newPos then return end
lastPos = newPos
end)

-- Fim do Script: follow

-- Nome do Script: Safe Spells Macro

local storage = storage or {} -- Inicializa o storage caso esteja vazio


local spellText1 = storage.spellText1 or "exevo mas san" -- Primeira magia
local spellText2 = storage.spellText2 or "exori con" -- Segunda magia

-- Ícone com um item fixo para ativação do macro


local i_safeSpells = nil
i_safeSpells = addIcon("safeSpellsIcon", {item={id=3071, count=1}, text="Safe
Spells"}, macro(1000, function(m)
local target = g_game.getAttackingCreature()
if not target then return end

if isSafe(8) and getDistanceBetween(pos(), target:getPosition()) <= 4 then


say(spellText1) -- Solta a primeira magia quando o alvo está próximo e seguro
else
say(spellText2) -- Solta a segunda magia quando o alvo está distante ou em
condições diferentes
end
end))

-- Ajusta a largura do ícone para melhor exibição


i_safeSpells:setWidth(100)

-- Interface de Configuração
local l_fullSpell = [Link]("SAFE SPELLS")
l_fullSpell:setColor("yellow")
[Link]("Spell UE")
[Link](spellText1, function(widget, text)
spellText1 = text ~= "" and text or "exevo mas san"
storage.spellText1 = spellText1
end)
[Link]("Spell Target")
[Link](spellText2, function(widget, text)
spellText2 = text ~= "" and text or "exori con"
storage.spellText2 = spellText2
end)

[Link]()

local config = {
spell = "Exori Gauge",
onlyAttacking = true
}

local i_utitoTempo = addIcon("utitoTempoIcon", {item={id=3296, count=1},


text="Utito"}, macro(100, function(m)
if not hasPartyBuff() and not isInPz() and manapercent() > 15 and (not
[Link] or g_game.isAttacking()) then
say([Link])
delay(1000)
end
end))

i_utitoTempo:setWidth(60) -- Controla largura do texto "Utito Tempo"

local config = {
spell = "Dore Gauge",
onlyAttacking = true
}

local i_utitoTempoSan = addIcon("tempoSanIcon", {item={id=8023, count=1},


text="UtitoSan"}, macro(100, function(m)
if not hasPartyBuff() and not isInPz() and manapercent() > 15 and (not
[Link] or g_game.isAttacking()) then
say([Link])
delay(1000)
end
end))

i_utitoTempoSan:setWidth(60) -- Controla largura do texto "Tempo San"

-- Nome do Script: Full Spell Macro

local storage = storage or {} -- Inicializa o storage caso esteja vazio


local fullSpell = [Link] or "exevo gran mas flam" -- Magia padrão

-- Ícone com um item fixo para ativação do macro


local i_fullSpell = nil
i_fullSpell = addIcon("fullSpellIcon", {item={id=8078, count=1}, text="Full
Spell"}, macro(1000, function(m)
say(fullSpell) -- Executa a magia automaticamente
end))

-- Ajusta a largura do ícone para melhor exibição


i_fullSpell:setWidth(100)

-- Interface de Configuração
local l_fullSpell = [Link]("FULL Spell")
l_fullSpell:setColor("yellow") -- Define a cor do texto como amarelo
[Link](fullSpell, function(widget, text)
fullSpell = text ~= "" and text or "exevo gran mas flam"
[Link] = fullSpell
end)

[Link]()

macro(200, "Manatrain", function()


if (hppercent() > 50) then
say([Link])
end
end)
addTextEdit("ManatrainText", [Link] or "Utevo Mana",
function(widget, text)
[Link] = text
end)

addIcon("CaveBotIcon", {item={id=9196, count=1}, text="CaveBot"}, macro(200,


function(m)
[Link]()
schedule(200, function()
if [Link]() then
[Link]()
end
end)
end))

addIcon("TargetBotIcon", {item={id=12247, count=1}, text="Tgt-Bot"}, macro(200,


function(m)
[Link]()
schedule(200, function()
if [Link]() then
[Link]()
end
end)
end))

local runeIcons = {
{
iconItemId = 3155, name = "SDMAX", rune = 3155, MobDistance = 8, PVPSafe =
false, MinMobs = 1, MinManaPerecent = 0, MinMobHP = 100,
},
{
iconItemId = 3165, name = "P-MAX", rune = 3165, MobDistance = 8, PVPSafe =
false, MinMobs = 2, MinManaPerecent = 0, MinMobHP = 100,
},
{
iconItemId = 3161, name = "AVA", rune = 3161, MobDistance = 4, PVPSafe =
true, MinMobs = 2, MinManaPerecent = 0, MinMobHP = 100,
},
{
iconItemId = 3191, name = "GFB", rune = 3191, MobDistance = 4, PVPSafe =
true, MinMobs = 2, MinManaPerecent = 0, MinMobHP = 100,
},
}
function distanceFromPlayer(coords)
if not coords then return false end
return getDistanceBetween(pos(), coords)
end

function getMonstersInRange(pos, range)


if not pos or not range then return false end
local monsters = 0
for i, spec in pairs(getSpectators()) do
if spec:isMonster() and
(g_game.getClientVersion() < 960 or spec:getType() < 3) and
getDistanceBetween(pos, spec:getPosition()) < range then
monsters = monsters + 1
end
end
return monsters
end

for _, iconData in ipairs(runeIcons) do


local iconId = [Link]
local name = [Link]
local rune = [Link]
local MobDistance = [Link]
local PVPSafe = [Link]
local MinMobs = [Link] or 0
local minMPPercent = [Link]
local MinMobHP = [Link]

addIcon("runeIcon"..name, {item={id=iconId, count=1}, text=name}, macro(200,


function(m)
local target = g_game.getAttackingCreature()
if target then
if manapercent() < minMPPercent then return end
if target:getHealthPercent() > MinMobHP then return end
if PVPSafe and not isSafe(8) then return end
local targetPos = target:getPosition()
if distanceFromPlayer(targetPos) > MobDistance then return end
if getMonstersInRange(pos(), 8) < MinMobs then return end
useWith(rune, target)
delay(500)
end
end))
end

You might also like