Old Copycat swap speed, mod try fail...
Avatar

I am trying to make an swap speed mod for copycat, but i wanted to remove the "new swap speed on auto reload" to not being OP;
problem is i coded in normal BLT in the old days, i tried to make some codes, didnt work, the tried to chat GPT for help, didnt work.
could somone help/ make this mod?

i was hopping i at least made an mod to make the old swap speed always on, the try to work upwards in removing the new swap...
but could not do nothing

Info
Avatar

tree.lua
--[[
Old Copycat Swap Speed (SkillTree Hook)
Autor: ChatGPT
Versão: 1.0
Função:
Insere o upgrade "mrwi_passive_swap_speed" apenas na specialization MRWI (Copycat).
Não altera perks de outras árvores.
]]

Hooks:PostHook(SkillTreeTweakData, "init", "OldCopycatSwapSpeed_SkillTree", function(self, tweak_data)

if not self or not self.specializations then
    return
end

local mrwi_index = nil

-- Tenta localizar a specialization MRWI dinamicamente
for i, spec in ipairs(self.specializations) do
    local name_id = tostring(spec.name_id or ""):lower()
    local desc_id = tostring(spec.desc_id or ""):lower()

    if name_id:find("mrwi") or desc_id:find("mrwi") or name_id:find("copycat") or desc_id:find("copycat") then
        mrwi_index = i
        break
    end
end

-- Se não achar por nome, tenta pelo conteúdo (procura upgrades que contenham "mrwi")
if not mrwi_index then
    for i, spec in ipairs(self.specializations) do
        for _, tier in ipairs(spec) do
            if type(tier) == "table" and tier.upgrades then
                for _, u in ipairs(tier.upgrades) do
                    local ustr = tostring(u):lower()
                    if ustr:find("mrwi") or ustr:find("copycat") then
                        mrwi_index = i
                        break
                    end
                end
            end
            if mrwi_index then break end
        end
        if mrwi_index then break end
    end
end

-- Aplica o upgrade na MRWI
if mrwi_index then
    local spec = self.specializations[mrwi_index]
    local added = false

    -- Procura onde inserir (geralmente no deck final)
    for _, tier in ipairs(spec) do
        if type(tier) == "table" and tier.upgrades then
            local found = false
            for _, u in ipairs(tier.upgrades) do
                if u == "mrwi_passive_swap_speed" then
                    found = true
                    break
                end
            end
            if not found then
                table.insert(tier.upgrades, "mrwi_passive_swap_speed")
                added = true
                break
            end
        end
    end

    -- Se não encontrou nenhum tier, cria um novo
    if not added then
        table.insert(spec, {
            cost = 0,
            icon_xy = {2, 6},
            name_id = "menu_mrwi_passive_swap_speed",
            desc_id = "menu_mrwi_passive_swap_speed_desc",
            upgrades = {"mrwi_passive_swap_speed"}
        })
    end

    log("[OldCopycatSwapSpeed] Injected upgrade into MRWI specialization at index " .. tostring(mrwi_index))
else
    log("[OldCopycatSwapSpeed] WARNING: MRWI specialization not found. Upgrade not injected.")
end

end)

10 330