--lua
--log ("clear", "mode noScript", "mode noLine")
WindowName = 'Lineage II' -- Window name for search, it's handy if use custom script for log to do auto attach for script
if workwindow() == 0 then
local handle = findwindow (WindowName)
if handle then
workwindow (handle[1][1])
else
log ('Process ID missing!')
alarm()
end_script()
end
end
local ffi = require("ffi")
local lib = ffi.load("getpix.dll")
ffi.cdef[[
__cdecl int getpix(int h, int x, int y);
]]
mobColorHP, xMobHP, yMobHP = 4277118, 20, 27 -- MOB Color , X, Y
-- to get correct color uncomment bellow and put only x. y cordinates
--local result = lib.getpix(workwindow(),xMobHP,yMobHP)
--log ('X '.. xMobHP..', Y '..yMobHP ..': color - '..result) -- Getting color
--end_script()
Path = [[D:\UO\farm\pic\]] -- path for limit/baff images
mob = {'F9', 'F10'} -- use next target shortcut
attack = {'F3', 'F4'} -- DPS skills shortcuts
delaySwitch = 5 --delay to cancel/switch target
-- default values
nMob, nAttack, detectHP = 1, 1, 0
timeTest, timeTarget = 0, 0
mobsize = #mob --Counting target macros
Attacksize = #attack -- Counting nuke count
function skey (key, time, image) -- key to send, delay for send, image
local arr, a = findimage (0, 0, 850, 600, {Path .. image}, workwindow()) -- edit area for search
if a == 100 then
send (key, time)
return true
end
return false
end
CLR = lib.getpix(workwindow(),xMobHP,yMobHP)
repeat
while CLR ~= mobColorHP do
CLR = lib.getpix(workwindow(),xMobHP,yMobHP)
send (mob [nMob], 5)
if nMob < mobsize then
nMob = nMob + 1
else
nMob = 1
end
end
nMob = 1 -- will start with first shortcut
-- examples to do buff/limits
if os.clock() > timeTest then
-- do smth on script launch and then each 60 seconds
timeTest = os.clock() + 60
end
skey('num_9', 400, 'iss\\pom.bmp') -- key, delay, image
if skey('num_5', 400, 'shared\\lavien.bmp') then
-- do smth if we used buff/limit with image
end
while CLR == mobColorHP do
CLR = lib.getpix(workwindow(),xMobHP,yMobHP)
send (attack [nAttack], 5)
if detectHP == 1 then -- HP check for drop target
if os.clock() > timeTarget then
detectHP = 0
send (mob [1], 250) -- can use send {esc} 250 , will remove current target, atm target next
end
else
timeTarget = os.clock() + delaySwitch
detectHP = 1
end
if nAttack < Attacksize then
nAttack = nAttack + 1
else
nAttack = 1
end
end
detectHP = 0
until false