Skip to content
Snippets Groups Projects
Commit a080cb5e authored by DarkGod's avatar DarkGod
Browse files

debug can give gems

parent bc134593
No related branches found
No related tags found
No related merge requests found
......@@ -92,12 +92,7 @@ end
--- Adds an object to an inventory
-- @return false if the object could not be added otherwise true and the inventory index where it is now
function _M:addObject(inven_id, o)
local inven
if type(inven_id) == "number" then
inven = self.inven[inven_id]
else
inven = inven_id
end
local inven = self:getInven(inven_id)
-- No room ?
if #inven >= inven.max then return false end
......@@ -168,7 +163,7 @@ end
-- @param no_unstack if the item was a stack takes off the whole stack if true
-- @return the object removed or nil if no item existed and a boolean saying if there is no more objects
function _M:removeObject(inven, item, no_unstack)
if type(inven) == "number" then inven = self.inven[inven] end
local inven = self:getInven(inven)
if not inven[item] then return false, true end
......
......@@ -42,7 +42,7 @@ local colors_attacks = {
local function newGem(name, image, cost, rarity, color, min_level, max_level, tier, power, imbue, bomb)
-- Gems, randomly lootable
newEntity{ base = "BASE_GEM", define_as = "GEM_"..name:upper(),
newEntity{ base = "BASE_GEM", define_as = "GEM_"..name:gsub(" ", "_"):upper(),
name = name:lower(), subtype = color,
color = colors[color:upper()], image=image,
level_range = {min_level, max_level},
......
......@@ -133,6 +133,15 @@ function _M:use(item)
end
elseif act == "all-ingredients" then
game.party:giveAllIngredients(100)
-- Gems count too
for def, od in pairs(game.zone.object_list) do
if type(def) == "string" and not od.unique and od.rarity and def:find("^GEM_") then
local o = game.zone:finishEntity(game.level, "object", od)
o:identify(true)
game.player:addObject("INVEN", o)
game.player:sortInven()
end
end
else
self:triggerHook{"DebugMain:use", act=act}
end
......
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