This commit is contained in:
2025-01-09 23:44:35 +09:00
parent 10bf61247c
commit f94e9bf17d

View File

@@ -369,42 +369,34 @@ local function handle_input_interfaces()
there are no quality support currently.
so instead, using the stats projection value for higher quality.
]]
if v.quality.level > 1 and v.count >= 10 then
local batch_to_convert = math.floor(v.count / 10)
local count_projection = batch_to_convert * (7 + (v.quality.level * 3))
local count_deduct
local count_add
if v.quality.level == 1 then
count_deduct = v.count
count_add = v.count
elseif v.quality.level > 1 and v.count >= 10 then
count_deduct = math.floor(v.count / 10)
count_add = count_deduct * (7 + (v.quality.level * 3))
end
if count_deduct and count_add then
if config.allowed_items[name].modded then
if config.modded_auto_downgrade then
vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_projection * config.modded_items[name].multiplier)
vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_add * config.modded_items[name].multiplier)
else
vlayer.insert_item(name, count_projection)
vlayer.insert_item(name, count_add)
end
else
if vlayer_data.storage.power_items[name] then
vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count_projection
vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count_add
else
vlayer.insert_item(name, count_projection)
vlayer.insert_item(name, count_add)
end
end
inventory.remove{ name = name, count = batch_to_convert * 10, quality = v.quality }
elseif v.quality.level == 1 then
if config.allowed_items[name].modded then
if config.modded_auto_downgrade then
vlayer.insert_item(config.modded_items[name].base_game_equivalent, v.count * config.modded_items[name].multiplier)
else
vlayer.insert_item(name, v.count)
end
else
if vlayer_data.storage.power_items[name] then
vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + v.count
else
vlayer.insert_item(name, v.count)
end
end
inventory.remove{ name = name, count = v.count, quality = v.quality }
inventory.remove{ name = name, count = count_deduct, quality = v.quality }
end
end
end