아래는 차단 담당자 지정하는 애드온 LUA 코드 입니다.
챗지피티로 만든건데 수정의 수정을 아무리 거듭해도
계속 출력이 제대로 안되고 있습니다
아래 코드 말고 단순히 딜러 3명을 찾아내서 지정하는것 까지는 되던데
차단 쿨타임에 따라 근딜, 정술(쿨타임짧음), 원딜, 암사조드악흑(쿨타임 너무김)
각각 쿨타임이 다르니 지정 우선순위를 두고 징표 배정을 하려하는데
아무래도 전문화를 구별하는 코드가 계속 잘못되는것 같습니다
어떻게하면 위 내용을 적용할수 있을지 한번 봐주시면 참으로 감사하겠습니다
이게 제대로 작동되면 글로벌의 희망인 탱커들에게 아주 큰 도움이 될거라 생각해요
더 나아가서는 CC기 담당도 지정하는데 도움이 될수도 있을것 같구요
SLASH_MARKASSIGN1 = "/징표"
SlashCmdList["MARKASSIGN"] = function()
local iconTexts = {"별", "동그라미", "다이아몬드"}
local specPriority = {
-- 1순위: 근접 딜러
["도적-암살"] = 1,
["도적-무법"] = 1,
["도적-잠행"] = 1,
["전사-무기"] = 1,
["전사-분노"] = 1,
["죽음의 기사-냉기"] = 1,
["죽음의 기사-부정"] = 1,
["악마사냥꾼-파멸"] = 1,
["주술사-고양"] = 1,
["수도사-풍운"] = 1,
["성기사-징벌"] = 1,
["사냥꾼-생존"] = 1,
["드루이드-야성"] = 1,
-- 2순위
["주술사-정기"] = 2,
-- 3순위
["마법사-비전"] = 3,
["마법사-화염"] = 3,
["마법사-냉기"] = 3,
["사냥꾼-사격"] = 3,
["사냥꾼-야수"] = 3,
["기원사-황폐"] = 3,
["기원사-증강"] = 3,
["흑마법사-고통"] = 3,
["흑마법사-파괴"] = 3,
-- 4순위
["흑마법사-악마"] = 4,
["사제-암흑"] = 4,
["드루이드-조화"] = 4,
}
local function GetSpecName(unit)
local specID = GetInspectSpecialization(unit)
if specID and specID ~= 0 then
local _, name = GetSpecializationInfoByID(specID)
return name
end
return nil
end
local function GetPriority(unit)
if not UnitExists(unit) or UnitIsDeadOrGhost(unit) then return nil end
local role = UnitGroupRolesAssigned(unit)
if role == "TANK" or role == "HEALER" then return nil end
local localizedClass, class = UnitClass(unit)
if not CanInspect(unit) then return nil end
NotifyInspect(unit)
local specID = GetInspectSpecialization(unit)
if specID and specID ~= 0 then
local _, specNameLocalized = GetSpecializationInfoByID(specID)
local key = localizedClass .. "-" .. specNameLocalized -- ex: "도적-무법"
return specPriority[key] or nil
end
return nil
end
local candidates = {}
local function addCandidate(unit)
local name = UnitName(unit)
local priority = GetPriority(unit)
if name and priority then
table.insert(candidates, {name = name, prio = priority})
end
end
addCandidate("player")
local prefix = IsInRaid() and "raid" or "party"
local maxMembers = IsInRaid() and GetNumGroupMembers() or GetNumSubgroupMembers()
for i = 1, maxMembers do
local unit = prefix .. i
if UnitExists(unit) and UnitName(unit) ~= UnitName("player") then
addCandidate(unit)
end
end
table.sort(candidates, function(a, b)
return a.prio < b.prio
end)
local ordered = {}
for i = 1, math.min(3, #candidates) do
table.insert(ordered, candidates[i].name)
end
local chatType = IsInRaid() and "RAID" or (IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY")
SendChatMessage("[징표 배정 - 딜러 3인]", chatType)
for i, name in ipairs(ordered) do
local icon = iconTexts[i] or "?"
SendChatMessage(name .. " → " .. icon .. " 차단", chatType)
end
end