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

upgrade cehst code

parent 9a4e110e
No related branches found
No related tags found
No related merge requests found
...@@ -6461,7 +6461,7 @@ end ...@@ -6461,7 +6461,7 @@ end
function _M:transmoPricemod(o) if o.type == "gem" then return 0.40 else return 0.05 end end function _M:transmoPricemod(o) if o.type == "gem" then return 0.40 else return 0.05 end end
function _M:transmoFilter(o) if o:getPrice() <= 0 or o.quest then return false end return true end function _M:transmoFilter(o) if o:getPrice() <= 0 or o.quest then return false end return true end
function _M:transmoInven(inven, idx, o) function _M:transmoInven(inven, idx, o, transmo_source)
local price = 0 local price = 0
o:forAllStack(function(so) price = price + math.min(so:getPrice() * self:transmoPricemod(so), 25) end) -- handle stacked objects individually o:forAllStack(function(so) price = price + math.min(so:getPrice() * self:transmoPricemod(so), 25) end) -- handle stacked objects individually
price = math.floor(price * 100) / 100 -- Make sure we get at most 2 digit precision price = math.floor(price * 100) / 100 -- Make sure we get at most 2 digit precision
......
...@@ -405,9 +405,9 @@ Items in the chest will not encumber you.]], ...@@ -405,9 +405,9 @@ Items in the chest will not encumber you.]],
if not ret then return end if not ret then return end
for i = floor, 1, -1 do for i = floor, 1, -1 do
local o = game.level.map:getObject(who.x, who.y, i) local o = game.level.map:getObject(who.x, who.y, i)
if who:transmoFilter(o) then if who:transmoFilter(o, self) then
game.level.map:removeObject(who.x, who.y, i) game.level.map:removeObject(who.x, who.y, i)
who:transmoInven(nil, nil, o) who:transmoInven(nil, nil, o, self)
end end
end end
end) end)
...@@ -420,7 +420,7 @@ Items in the chest will not encumber you.]], ...@@ -420,7 +420,7 @@ Items in the chest will not encumber you.]],
for i = #inven, 1, -1 do for i = #inven, 1, -1 do
local o = inven[i] local o = inven[i]
if o.__transmo then if o.__transmo then
who:transmoInven(inven, i, o) who:transmoInven(inven, i, o, self)
end end
end end
end) 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