tibia-client/modules/game/thing.lua

69 lines
2.2 KiB
Lua
Raw Normal View History

2012-01-03 21:41:00 +01:00
-- public functions
2012-01-04 14:02:35 +01:00
function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
2012-01-03 21:41:00 +01:00
local menu = createWidget('PopupMenu')
2012-01-04 14:02:35 +01:00
if lookThing then
menu:addOption('Look', function() Game.look(lookThing) end)
end
2012-01-03 21:41:00 +01:00
-- Open or Use, depending if thing is a container
2012-01-04 14:02:35 +01:00
if useThing then
if useThing:isContainer() then
menu:addOption('Open', function() print('open') end)
else
2012-01-04 14:02:35 +01:00
if useThing:isMultiUse() then
menu:addOption('Use with ...', function() print('use with...') end)
else
2012-01-04 14:02:35 +01:00
menu:addOption('Use', function() Game.use(useThing) end)
end
end
2012-01-04 14:02:35 +01:00
if useThing:isRotateable() then
menu:addOption('Rotate', function() Game.rotate(useThing) end)
end
2012-01-04 14:02:35 +01:00
menu:addSeparator()
2012-01-04 14:02:35 +01:00
if not useThing:isNotMoveable() and useThing:isPickupable() then
menu:addOption('Trade with ...', function() print('trade with') end)
end
2012-01-04 14:02:35 +01:00
end
2012-01-04 14:02:35 +01:00
if creatureThing then
2012-01-03 21:41:00 +01:00
menu:addSeparator()
2012-01-04 14:02:35 +01:00
if creatureThing:asLocalPlayer() then
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
else
2012-01-05 15:24:38 +01:00
if Game.getAttackingCreature() ~= creatureThing then
menu:addOption('Attack', function() Game.attack(creatureThing) end)
else
menu:addOption('Stop Attack', function() Game.cancelAttack() end)
end
2012-01-05 15:24:38 +01:00
if Game.getFollowingCreature() ~= creatureThing then
menu:addOption('Follow', function() Game.follow(creatureThing) end)
else
menu:addOption('Stop Follow', function() Game.cancelFollow() end)
end
2012-01-04 14:02:35 +01:00
if creatureThing:asPlayer() then
menu:addSeparator()
2012-01-04 14:02:35 +01:00
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
2012-01-04 15:30:28 +01:00
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
2012-01-04 14:02:35 +01:00
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end)
2012-01-05 13:48:10 +01:00
menu:addOption('Invite to Party', function() Game.inviteToParty(creatureThing:getId()) end)
end
end
menu:addSeparator()
2012-01-05 13:48:10 +01:00
menu:addOption('Copy Name', function() g_window.setClipboardText(creatureThing:getName()) end)
2012-01-03 21:41:00 +01:00
end
menu:display(menuPosition)
end