Sending trade request using "UICreatureButton"

Extending the possibilities of "UICreatureButton" widget.
Adding possibility sending trade request in battle list (game_battle module) and other modules who use widget "UICreatureButton".
This commit is contained in:
EgzoT 2017-10-22 23:21:02 +02:00 committed by GitHub
parent 8c731ac016
commit bc507fd98b
1 changed files with 5 additions and 0 deletions

View File

@ -386,6 +386,11 @@ function onTradeWith(clickedWidget, mousePosition)
if tile then if tile then
g_game.requestTrade(selectedThing, tile:getTopCreature()) g_game.requestTrade(selectedThing, tile:getTopCreature())
end end
elseif clickedWidget:getClassName() == 'UICreatureButton' then
local creature = clickedWidget:getCreature()
if creature then
g_game.requestTrade(selectedThing, creature)
end
end end
end end