From 1d12c7e5afa3f2c39c124fa2e95c633bff9a359e Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 14 Nov 2011 08:51:09 +0000 Subject: [PATCH] draging on the player doll will take the most likely action git-svn-id: http://svn.net-core.org/repos/t-engine4@4646 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engines/default/engine/ui/EquipDoll.lua | 12 ++++++++++-- .../tome/data/talents/gifts/summon-advanced.lua | 2 +- .../tome/data/zones/shertul-fortress/objects.lua | 9 ++++++++- game/modules/tome/dialogs/LevelupDialog.lua | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/game/engines/default/engine/ui/EquipDoll.lua b/game/engines/default/engine/ui/EquipDoll.lua index f74f33f29f..c318b140db 100644 --- a/game/engines/default/engine/ui/EquipDoll.lua +++ b/game/engines/default/engine/ui/EquipDoll.lua @@ -55,7 +55,15 @@ function _M:generate() self.inner_scroll = self:makeFrame("ui/tooltip/", self.w, self.h) self.mouse:registerZone(0, 0, self.w, self.h, function(button, x, y, xrel, yrel, bx, by, event) - self:mouseEvent(button, x, y, xrel, yrel, bx, by, event) + if self:mouseEvent(button, x, y, xrel, yrel, bx, by, event) then + -- nothing, already done + elseif button == "drag-end" and self.drag_enable then + local drag = game.mouse.dragged.payload + if drag.kind == "inventory" and drag.inven and self.actor:getInven(drag.inven) and not self.actor:getInven(drag.inven).worn then + self:actorWear(drag.inven, drag.item_idx, drag.object) + game.mouse:usedDrag() + end + end end) self.key:addBinds{ ACCEPT = function() if self.focus_ui then self.focus_ui.ui.key:triggerVirtual("ACCEPT") end end, @@ -114,7 +122,7 @@ function _M:mouseEvent(button, x, y, xrel, yrel, bx, by, event) -- Pass the event ui.ui.mouse:delegate(button, bx, by, xrel, yrel, bx, by, event) - return + return true end end self:no_focus() diff --git a/game/modules/tome/data/talents/gifts/summon-advanced.lua b/game/modules/tome/data/talents/gifts/summon-advanced.lua index 6308d09235..a863e1bf9d 100644 --- a/game/modules/tome/data/talents/gifts/summon-advanced.lua +++ b/game/modules/tome/data/talents/gifts/summon-advanced.lua @@ -118,6 +118,6 @@ newTalent{ - Stone Golem: Melee blows can deal a small area of effect damage - Turtle: Can force all foes in a radius into melee range - Spider: Can project an insidious poison at its foes, reducing their healing - This talent requires Master Summoner to be active to be used.]]) + This talent requires Master Summoner to be active to be used.]]):format(math.floor(self:getTalentLevel(t))) end, } diff --git a/game/modules/tome/data/zones/shertul-fortress/objects.lua b/game/modules/tome/data/zones/shertul-fortress/objects.lua index e51e75d77d..986ea6a590 100644 --- a/game/modules/tome/data/zones/shertul-fortress/objects.lua +++ b/game/modules/tome/data/zones/shertul-fortress/objects.lua @@ -42,7 +42,14 @@ Items in the chest will not encumber you.]], use_power = { name = "transmogrify all the items in your chest at once(also done automatically when you change level)", power = 0, use = function(self, who) local inven = who:getInven("INVEN") - require("engine.ui.Dialog"):yesnoPopup("Transmogrification Chest", "Transmogrify all "..#inven.." item(s) in your chest?", function(ret) + local nb = 0 + for i = #inven, 1, -1 do + local o = inven[i] + if o.__transmo then nb = nb + 1 end + end + if nb <= 0 then require("engine.ui.Dialog"):simplePopup("Transmogrification Chest", "You do not have any items to transmogrify in your chest.") return {id=true, used=true} end + + require("engine.ui.Dialog"):yesnoPopup("Transmogrification Chest", "Transmogrify all "..nb.." item(s) in your chest?", function(ret) if not ret then return end for i = #inven, 1, -1 do local o = inven[i] diff --git a/game/modules/tome/dialogs/LevelupDialog.lua b/game/modules/tome/dialogs/LevelupDialog.lua index c754896d8e..3dc5b13eb3 100644 --- a/game/modules/tome/dialogs/LevelupDialog.lua +++ b/game/modules/tome/dialogs/LevelupDialog.lua @@ -368,7 +368,9 @@ function _M:cancel() end self.actor.last_learnt_talents = self.actor_dup.last_learnt_talents ]] + local ax, ay = self.actor.x, self.actor.y self.actor:replaceWith(self.actor_dup) + self.actor.x, self.actor.y = ax, ay self.actor.changed = true self.actor:removeAllMOs() if game.level and self.actor.x then game.level.map:updateMap(self.actor.x, self.actor.y) end -- GitLab