Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local status = 2
- local wait_time = 0
- local get_available_item = function()
- local list = {}
- local backend_items = Managers.backend:get_interface("items")
- local all_items = backend_items:get_all_backend_items()
- for backend_id, item in pairs(all_items) do
- local power_level = item.power_level or 0
- local rarity = item.rarity or ""
- local career_equipped = backend_items:equipped_by(backend_id)
- if career_equipped and #career_equipped < 1 then
- if power_level > 5 then
- if rarity == "plentiful" or rarity == "common" or rarity == "rare" or rarity == "exotic" then
- list[#list + 1] = backend_id
- end
- end
- end
- if #list == 9 then
- return list
- end
- end
- return list
- end
- local salvage_next_item = function()
- local list = get_available_item()
- if #list > 0 then
- -- Salvage item
- Managers.state.crafting:craft(list)
- -- Debug
- EchoConsole("Salvage " .. tostring(#list) .. " items")
- return true
- else
- Mods.exec("loadfile", "chest_gen")
- end
- return false
- end
- Mods.hook.set("", "BackendInterfaceCraftingPlayfab.craft_request_cb", function(func, self, id, result)
- func(self, id, result)
- status = 2
- end)
- Mods.hook.set("", "MatchmakingManager.update", function(func, self, dt, t)
- safe_pcall(function()
- if status == 0 then
- if salvage_next_item() then
- status = 1
- end
- elseif status == 2 then
- wait_time = t
- status = 3
- elseif status == 3 then
- if wait_time + 1 < t then
- status = 0
- end
- end
- end)
- return func(self, dt, t)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement