취미/게임

와우(wow) 리치왕의 분노 (3.3.5) 자동 수리 및 잡템 판매 애드온

soulowner 2025. 8. 11. 06:49
반응형

압축을 푸신 후 AutoSellJunk 폴더를
wow\interface\AddOns\ 폴더 안에 폴더를 이동하세요.

AutoSellJunk.zip
0.00MB

 

1. 잡템 판매.
2. 길드 지원금으로 수리.
3. 길드 지원금이 부족할 경우, 개인 사비로 수리.

 

AutoSellJunk.toc

## Interface: 30305
## Title: AutoSellJunk
## Notes: 자동으로 수리 및 잡탬 판매
## Author: Soulowner
## Version: 1.2
AutoSellJunk.lua

 

AutoSellJunk.lua

-- 애드온 설정값
local options = {
    sellgrays = true,   -- 회색 아이템 자동 판매 여부
    autorepair = true,  -- 장비 자동 수리 여부
}

-- 프레임 생성 및 이벤트 등록
local f = CreateFrame("Frame")
f:RegisterEvent("MERCHANT_SHOW") -- 상점 창이 열릴 때 이벤트 발생

-- 이벤트 발생 시 실행되는 함수
f:SetScript("OnEvent", function()
    -- 🧹 회색 아이템 자동 판매
    if options.sellgrays then
        local total = 0 -- 총 판매 금액 저장 변수

        -- 가방(0~4번) 순회
        for bag = 0, 4 do
            for slot = 1, GetContainerNumSlots(bag) do
                local itemLink = GetContainerItemLink(bag, slot)
                if itemLink then
                    local quality = select(3, GetItemInfo(itemLink)) -- 아이템 품질
                    if quality == 0 then -- 회색 아이템일 경우
                        local itemCount = select(2, GetContainerItemInfo(bag, slot)) or 1
                        local itemPrice = select(11, GetItemInfo(itemLink)) or 0
                        local sellPrice = itemPrice * itemCount

                        UseContainerItem(bag, slot) -- 아이템 사용 → 상인에게 판매
                        PickupMerchantItem()        -- 안정성 위해 포함
                        total = total + sellPrice   -- 총 금액 누적
                    end
                end
            end
        end

        -- 판매 금액이 있을 경우 채팅창에 출력
        if total > 0 then
            local gold = math.floor(total / 10000)
            local silver = math.floor((total % 10000) / 100)
            local copper = total % 100
            DEFAULT_CHAT_FRAME:AddMessage("|cffFFFF00AutoSellJunk:|r 잡템을 판매하여 |cffFFD700"..gold.."골드 "..silver.."실버 "..copper.."코퍼|r를 얻었습니다.", 1, 1, 1)
        end
    end

    -- 🔧 자동 수리 기능 (Shift 키가 눌려있지 않을 때만 실행)
    if not IsShiftKeyDown() and options.autorepair then
        if CanMerchantRepair() then
            local cost, canRepair = GetRepairAllCost() -- 수리 비용과 가능 여부

            if cost > 0 then
                local gold = math.floor(cost / 10000)
                local silver = math.floor((cost % 10000) / 100)
                local copper = cost % 100

                local repaired = false -- 수리 성공 여부 추적

                -- 길드 자금으로 수리 시도
                if IsInGuild() and CanGuildBankRepair() then
                    RepairAllItems(1) -- 길드 자금으로 수리

                    -- 수리 성공 여부 확인 (수리 후 비용이 0이면 성공)
                    local newCost = GetRepairAllCost()
                    if newCost == 0 then
                        DEFAULT_CHAT_FRAME:AddMessage("|cffFFFF00AutoSellJunk:|r 길드 자금으로 장비를 수리했습니다. 비용: |cffFFD700"..gold.."골드 "..silver.."실버 "..copper.."코퍼|r.", 1, 1, 1)
                        repaired = true
                    end
                end

                -- 길드 자금 수리 실패 시 개인 자금으로 수리 시도
                if not repaired and canRepair then
                    RepairAllItems() -- 개인 자금으로 수리
                    DEFAULT_CHAT_FRAME:AddMessage("|cffFFFF00AutoSellJunk:|r 개인 자금으로 장비를 수리했습니다. 비용: |cffFFD700"..gold.."골드 "..silver.."실버 "..copper.."코퍼|r.", 1, 1, 1)
                    repaired = true
                end

                -- 둘 다 실패한 경우
                if not repaired then
                    DEFAULT_CHAT_FRAME:AddMessage("|cffFFFF00AutoSellJunk:|r 장비를 수리할 돈이 부족합니다.", 1, 0, 0)
                end
            end
        end
    end
end)

 

반응형