mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
restore set outfit
This commit is contained in:
@@ -15,4 +15,5 @@ Module
|
||||
|
||||
onLoad: |
|
||||
require 'game'
|
||||
return true
|
||||
require 'thing'
|
||||
return true
|
||||
|
19
modules/game/thing.lua
Normal file
19
modules/game/thing.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
-- public functions
|
||||
function Thing:createMenu(menuPosition)
|
||||
local menu = createWidget('PopupMenu')
|
||||
menu:addOption('Look', function() Game.look(self) end)
|
||||
|
||||
-- Open or Use, depending if thing is a container
|
||||
if self:isContainer() then
|
||||
menu:addOption('Open', function() print('open') end)
|
||||
else
|
||||
menu:addOption('Use', function() print('use') end)
|
||||
end
|
||||
|
||||
if self:asLocalPlayer() then
|
||||
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
|
||||
end
|
||||
|
||||
menu:display(menuPosition)
|
||||
end
|
@@ -35,20 +35,7 @@ function Inventory.onInventoryItemMousePress(itemWidget, mousePos, mouseButton)
|
||||
local item = itemWidget:getItem()
|
||||
if not item then return end
|
||||
|
||||
local menu = createWidget('PopupMenu')
|
||||
|
||||
-- Look
|
||||
local itemId = item:getId()
|
||||
local slotId = tonumber(itemWidget:getId():sub(5))
|
||||
menu:addOption('Look', function() Game.lookAtInventory(itemId, slotId) end)
|
||||
|
||||
-- Open or Use, depending if thing is a container
|
||||
if item:isContainer() then
|
||||
menu:addOption('Open', function() print('open') end)
|
||||
else
|
||||
menu:addOption('Use', function() print('use') end)
|
||||
end
|
||||
menu:display(mousePos)
|
||||
item:createMenu(mousePos)
|
||||
end
|
||||
|
||||
connect(Game, { onLogin = Inventory.create,
|
||||
|
Reference in New Issue
Block a user