mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-19 06:03:27 +02:00
Updaded modaldialog and bot (added anti push)
This commit is contained in:
@@ -34,6 +34,7 @@ Panels.AttackItem(attackTab)
|
||||
|
||||
Panels.AttackLeaderTarget(warTab)
|
||||
Panels.LimitFloor(warTab)
|
||||
Panels.AntiPush(warTab)
|
||||
|
||||
local waypoints = Panels.Waypoints(caveTab)
|
||||
local attacking = Panels.Attacking(caveTab)
|
||||
|
@@ -779,15 +779,18 @@ Panel
|
||||
|
||||
local getMonsterConfig = function(monster)
|
||||
local name = monster:getName():lower()
|
||||
local hasConfig = false
|
||||
hasConfig = hasConfig or (monsters[name] ~= nil)
|
||||
if isConfigPassingConditions(monster, monsters[name]) then
|
||||
return monsters[name]
|
||||
end
|
||||
for i=1, 5 do
|
||||
hasConfig = hasConfig or (monsters[name .. i] ~= nil)
|
||||
if isConfigPassingConditions(monster, monsters[name .. i]) then
|
||||
return monsters[name .. i]
|
||||
end
|
||||
end
|
||||
if isConfigPassingConditions(monster, monsters["*"]) then
|
||||
if not hasConfig and isConfigPassingConditions(monster, monsters["*"]) then
|
||||
return monsters["*"]
|
||||
end
|
||||
return nil
|
||||
@@ -1089,7 +1092,11 @@ Panel
|
||||
end
|
||||
end
|
||||
|
||||
target.ignoreByWaypoints = config.dontWalk
|
||||
if config.dontWalk then
|
||||
if goForLoot() then
|
||||
return
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
@@ -313,15 +313,15 @@ Panels.Eating = function(parent)
|
||||
widget:setOn(context.storage[panelName].enabled)
|
||||
end
|
||||
|
||||
if type(context.storage["autoEating" .. panelId]) ~= 'table' then
|
||||
context.storage["autoEating" .. panelId] = {3725, 0, 0, 0, 0}
|
||||
if type(context.storage[panelName].items) ~= 'table' then
|
||||
context.storage[panelName].items = {3725, 0, 0, 0, 0}
|
||||
end
|
||||
|
||||
for i=1,5 do
|
||||
ui.items:getChildByIndex(i).onItemChange = function(widget)
|
||||
context.storage["autoEating" .. panelId][i] = widget:getItemId()
|
||||
context.storage[panelName].items[i] = widget:getItemId()
|
||||
end
|
||||
ui.items:getChildByIndex(i):setItemId(context.storage["autoEating" .. panelId][i])
|
||||
ui.items:getChildByIndex(i):setItemId(context.storage[panelName].items[i])
|
||||
end
|
||||
|
||||
context.macro(15000, function()
|
||||
@@ -329,16 +329,15 @@ Panels.Eating = function(parent)
|
||||
return
|
||||
end
|
||||
local candidates = {}
|
||||
for i, item in pairs(context.storage["autoEating" .. panelId]) do
|
||||
for i, item in pairs(context.storage[panelName].items) do
|
||||
if item >= 100 then
|
||||
table.insert(candidates, item)
|
||||
end
|
||||
end
|
||||
if #candidates == 0 then
|
||||
return
|
||||
end
|
||||
context.usewith(candidates[math.random(1, #candidates)], context.player)
|
||||
end
|
||||
context.use(candidates[math.random(1, #candidates)])
|
||||
end)
|
||||
end
|
||||
Panels.ManaItem = Panels.Mana
|
||||
|
||||
|
@@ -63,3 +63,65 @@ Panels.LimitFloor = function(parent)
|
||||
switch:setOn(context.storage.limitFloor)
|
||||
end
|
||||
|
||||
Panels.AntiPush = function(parent)
|
||||
if not parent then
|
||||
parent = context.panel
|
||||
end
|
||||
|
||||
local panelName = "antiPushPanel"
|
||||
local ui = g_ui.createWidget("ItemsPanel", parent)
|
||||
ui:setId(panelName)
|
||||
|
||||
if not context.storage[panelName] then
|
||||
context.storage[panelName] = {}
|
||||
end
|
||||
|
||||
ui.title:setText("Anti push")
|
||||
ui.title:setOn(context.storage[panelName].enabled)
|
||||
ui.title.onClick = function(widget)
|
||||
context.storage[panelName].enabled = not context.storage[panelName].enabled
|
||||
widget:setOn(context.storage[panelName].enabled)
|
||||
end
|
||||
|
||||
if type(context.storage[panelName].items) ~= 'table' then
|
||||
context.storage[panelName].items = {3031, 3035, 0, 0, 0}
|
||||
end
|
||||
|
||||
for i=1,5 do
|
||||
ui.items:getChildByIndex(i).onItemChange = function(widget)
|
||||
context.storage[panelName].items[i] = widget:getItemId()
|
||||
end
|
||||
ui.items:getChildByIndex(i):setItemId(context.storage[panelName].items[i])
|
||||
end
|
||||
|
||||
context.macro(100, function()
|
||||
if not context.storage[panelName].enabled then
|
||||
return
|
||||
end
|
||||
local tile = g_map.getTile(context.player:getPosition())
|
||||
if not tile then
|
||||
return
|
||||
end
|
||||
local topItem = tile:getTopUseThing()
|
||||
if topItem and topItem:isStackable() then
|
||||
topItem = topItem:getId()
|
||||
else
|
||||
topItem = 0
|
||||
end
|
||||
local candidates = {}
|
||||
for i, item in pairs(context.storage[panelName].items) do
|
||||
if item >= 100 and item ~= topItem and context.findItem(item) then
|
||||
table.insert(candidates, item)
|
||||
end
|
||||
end
|
||||
if #candidates == 0 then
|
||||
return
|
||||
end
|
||||
if type(context.storage[panelName].lastItem) ~= 'number' or context.storage[panelName].lastItem > #candidates then
|
||||
context.storage[panelName].lastItem = 1
|
||||
end
|
||||
local item = context.findItem(candidates[context.storage[panelName].lastItem])
|
||||
g_game.move(item, context.player:getPosition(), 1)
|
||||
context.storage[panelName].lastItem = context.storage[panelName].lastItem + 1
|
||||
end)
|
||||
end
|
||||
|
@@ -578,7 +578,7 @@ Panel
|
||||
-- wait if attacking/following creature
|
||||
local attacking = g_game.getAttackingCreature()
|
||||
local following = g_game.getFollowingCreature()
|
||||
if (attacking and context.getCreatureById(attacking:getId())) or (following and context.getCreatureById(following:getId())) then
|
||||
if (attacking and context.getCreatureById(attacking:getId()) and not attacking.ignoreByWaypoints) or (following and context.getCreatureById(following:getId())) then
|
||||
executeNextMacroCall = false
|
||||
return
|
||||
end
|
||||
|
Reference in New Issue
Block a user