|
|
@ -16,6 +16,7 @@ currentViewMode = 0
|
|
|
|
smartWalkDirs = {}
|
|
|
|
smartWalkDirs = {}
|
|
|
|
smartWalkDir = nil
|
|
|
|
smartWalkDir = nil
|
|
|
|
walkFunction = nil
|
|
|
|
walkFunction = nil
|
|
|
|
|
|
|
|
hookedMenuOptions = {}
|
|
|
|
|
|
|
|
|
|
|
|
function init()
|
|
|
|
function init()
|
|
|
|
g_ui.importStyle('styles/countwindow')
|
|
|
|
g_ui.importStyle('styles/countwindow')
|
|
|
@ -104,6 +105,8 @@ function terminate()
|
|
|
|
save()
|
|
|
|
save()
|
|
|
|
hide()
|
|
|
|
hide()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hookedMenuOptions = {}
|
|
|
|
|
|
|
|
|
|
|
|
stopSmartWalk()
|
|
|
|
stopSmartWalk()
|
|
|
|
|
|
|
|
|
|
|
|
disconnect(g_game, {
|
|
|
|
disconnect(g_game, {
|
|
|
@ -409,6 +412,17 @@ function startTradeWith(thing)
|
|
|
|
g_mouse.pushCursor('target')
|
|
|
|
g_mouse.pushCursor('target')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addMenuHook(category, name, callback, condition, shortcut)
|
|
|
|
|
|
|
|
if not hookedMenuOptions[category] then
|
|
|
|
|
|
|
|
hookedMenuOptions[category] = {}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
hookedMenuOptions[category][name] = {
|
|
|
|
|
|
|
|
callback = callback,
|
|
|
|
|
|
|
|
condition = condition,
|
|
|
|
|
|
|
|
shortcut = shortcut
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
if not g_game.isOnline() then return end
|
|
|
|
if not g_game.isOnline() then return end
|
|
|
|
local menu = g_ui.createWidget('PopupMenu')
|
|
|
|
local menu = g_ui.createWidget('PopupMenu')
|
|
|
@ -440,7 +454,6 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
if useThing:isRotateable() then
|
|
|
|
if useThing:isRotateable() then
|
|
|
|
menu:addOption(tr('Rotate'), function() g_game.rotate(useThing) end)
|
|
|
|
menu:addOption(tr('Rotate'), function() g_game.rotate(useThing) end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if lookThing and not lookThing:isCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then
|
|
|
|
if lookThing and not lookThing:isCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then
|
|
|
@ -550,6 +563,16 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(creatureThing:getName()) end)
|
|
|
|
menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(creatureThing:getName()) end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- hooked menu options
|
|
|
|
|
|
|
|
for _,category in pairs(hookedMenuOptions) do
|
|
|
|
|
|
|
|
menu:addSeparator()
|
|
|
|
|
|
|
|
for name,opt in pairs(category) do
|
|
|
|
|
|
|
|
if opt.condition(menuPosition, lookThing, useThing, creatureThing) then
|
|
|
|
|
|
|
|
menu:addOption(name, opt.callback, opt.shortcut)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
menu:display(menuPosition)
|
|
|
|
menu:display(menuPosition)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|