Skip to content
Snippets Groups Projects
Commit 9a54a3aa authored by dg's avatar dg
Browse files

The Demonic Orb of Many Ways is identified as such when discovering the trickery

git-svn-id: http://svn.net-core.org/repos/t-engine4@2091 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6489f397
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
......@@ -149,7 +149,7 @@
</tile>
<tile id="3">
<properties>
<property name="display" value="trollshaws"/>
<property name="display" value="trollmire"/>
</properties>
</tile>
<tile id="4">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment