diff --git a/game/engines/default/engine/interface/ActorInventory.lua b/game/engines/default/engine/interface/ActorInventory.lua index 1419569a4389c6ce2bae95ca6310fd05b675a87c..5a03360f4e375dada30adb31f0bd1ce0c01d68dd 100644 --- a/game/engines/default/engine/interface/ActorInventory.lua +++ b/game/engines/default/engine/interface/ActorInventory.lua @@ -437,6 +437,32 @@ function _M:findInAllInventories(name, getname) end end +--- Finds an object by property in an inventory +-- @param inven the inventory to look into +-- @param prop the property to look for +-- @param value the value to look for, can be a function +function _M:findInInventoryBy(inven, prop, value) + if type(value) == "function" then + for item, o in ipairs(inven) do + if value(o[prop]) then return o, item end + end + else + for item, o in ipairs(inven) do + if o[prop] == value then return o, item end + end + end +end + +--- Finds an object by property in all the actor's inventories +-- @param prop the property to look for +-- @param value the value to look for, can be a function +function _M:findInAllInventoriesBy(prop, value) + for inven_id, inven in pairs(self.inven) do + local o, item = self:findInInventoryBy(inven, prop, value) + if o and item then return o, item, inven_id end + end +end + --- Applies fct over all items -- @param inven the inventory to look into -- @param fct the function to be called. It will receive three parameters: inven, item, object diff --git a/game/modules/tome/data/general/objects/quest-artifacts.lua b/game/modules/tome/data/general/objects/quest-artifacts.lua index 16b52519ce2a473c8a04720fefff7b5911c49658..46584cfd0ed36fb1411f36699fbbe4279d10f9fc 100644 --- a/game/modules/tome/data/general/objects/quest-artifacts.lua +++ b/game/modules/tome/data/general/objects/quest-artifacts.lua @@ -123,6 +123,8 @@ If used near a portal it could probably activate it.]], message = "#VIOLET#The world twists sickeningly around you and you find yourself someplace unexpected! It felt nothing like your previous uses of the Orb of Many Ways. Tannen must have switched the Orb out for a fake!", on_use = function(self, who) who:setQuestStatus("east-portal", engine.Quest.COMPLETED, "tricked-demon") + local orb = who:findInAllInventoriesBy("define_as", "ORB_MANY_WAYS_DEMON") + if orb then orb.name = "Demonic Orb of Many Ways" end end, } else diff --git a/tiled-maps/eyal.tmx b/tiled-maps/eyal.tmx index 7b897b40dcc41974f907db12ba5eae74f9291773..df414bea1f3efd8acb98b98b4b38b398bd592539 100644 --- a/tiled-maps/eyal.tmx +++ b/tiled-maps/eyal.tmx @@ -149,7 +149,7 @@ </tile> <tile id="3"> <properties> - <property name="display" value="trollshaws"/> + <property name="display" value="trollmire"/> </properties> </tile> <tile id="4">