📄 ct_rameters.lua
字号:
-- CTRaidAssist - visual raid status bars
-- Raid Status class
CT_RARaidOverview = {
-- default values
typeClasses = {
[CT_RA_WARRIOR] = "WARRIOR",
[CT_RA_ROGUE] = "ROGUE",
[CT_RA_HUNTER] = "HUNTER",
[CT_RA_MAGE] = "MAGE",
[CT_RA_WARLOCK] = "WARLOCK",
[CT_RA_DRUID] = "DRUID",
[CT_RA_PRIEST] = "PRIEST",
[CT_RA_SHAMAN] = "SHAMAN",
[CT_RA_PALADIN] = "PALADIN",
};
-- initialize variables
maxBars = 20,
maxListLength = 20;
barSpacing = 17,
elapsed = 0,
updateTime = 1.0,
statusTable = {},
barSetup = {},
numRaidMembers = 0,
numPartyMembers = 0,
-- onLoad raid status frame
onLoad = function()
-- position the bars
local y = -3;
for i=1, CT_RARaidOverview.maxBars do
local bar = getglobal("CT_RARaidOverviewFrameBar" .. i);
local text = getglobal("CT_RARaidOverviewFrameText" .. i);
local tcount = getglobal("CT_RARaidOverviewFrameCount" .. i);
local status = getglobal("CT_RARaidOverviewFrameStatus" .. i);
bar:SetPoint("TOPLEFT", "CT_RARaidOverviewFrame", "TOPLEFT", 3, y);
text:SetPoint("TOPLEFT", "CT_RARaidOverviewFrameBar" .. i, "TOPLEFT", 3, 0);
tcount:SetPoint("TOPRIGHT", "CT_RARaidOverviewFrameBar" .. i, "TOPRIGHT", -3, 0);
status:SetPoint("TOPLEFT", "CT_RARaidOverviewFrameBar" .. i, "TOPRIGHT", 3, -1);
bar:SetID(i);
y = y - CT_RARaidOverview.barSpacing;
end
this:RegisterEvent("VARIABLES_LOADED");
end,
-- onEvent raid status frame
onEvent = function()
if ( event == "VARIABLES_LOADED" ) then
UIDropDownMenu_Initialize(CT_RARaidOverviewFrame_DropDown, CT_RARaidOverview.initializeMenuArray, "MENU");
if ( CT_RAMenu_Options["temp"]["StatusMeters"] ) then
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Background"] ) then
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Background"]["a"] ) then
CT_RARaidOverviewFrame:SetAlpha(CT_RAMenu_Options["temp"]["StatusMeters"]["Background"]["a"]);
end
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Background"]["s"] ) then
CT_RARaidOverviewFrame:SetScale(CT_RAMenu_Options["temp"]["StatusMeters"]["Background"]["s"]);
end
end
else
CT_RAMenu_Options["temp"]["StatusMeters"] = {
["Health Display"] = { },
["Mana Display"] = { },
["Health Combined"] = { },
["Mana Combined"] = { },
["Raid Health"] = { },
["Raid Mana"] = { },
["Background"] = {
["a"] = 0.7,
["s"] = 1.0
}
};
end
end
end,
-- onUpdate raid status frame
onUpdate = function()
CT_RARaidOverview.elapsed = CT_RARaidOverview.elapsed + arg1;
if ( CT_RARaidOverview.elapsed >= CT_RARaidOverview.updateTime ) then
CT_RARaidOverview.elapsed = 0;
CT_RARaidOverview.numRaidMembers = GetNumRaidMembers();
CT_RARaidOverview.numPartyMembers = GetNumPartyMembers();
if ( CT_RARaidOverviewFrame:IsVisible() ) then
CT_RARaidOverview.updateBars();
end
if ( CT_RARaidOverview.isShowStatus() and not CT_RARaidOverviewFrame:IsVisible() ) then
CT_RARaidOverviewFrame:Show();
elseif ( not CT_RARaidOverview.isShowStatus() and CT_RARaidOverviewFrame:IsVisible() ) then
CT_RARaidOverviewFrame:Hide();
end
end
end,
-- onEnter raid status bar frame
onEnter = function()
local id = this:GetID();
local name = this:GetName();
if (id < 1) or (not string.find(name, "^CT_RARaidOverviewFrameBar")) or CT_RARaidOverviewFrame_DropDown:IsVisible() then
return;
end
local cx, cy = this:GetCenter();
if (cx < (GetScreenWidth() / 2)) then
if (cy < (GetScreenHeight() / 2)) then
CT_RARaidOverviewTooltip:SetOwner(this, "ANCHOR_RIGHT");
else
CT_RARaidOverviewTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT");
end
else
if (cy < (GetScreenHeight() / 2)) then
CT_RARaidOverviewTooltip:SetOwner(this, "ANCHOR_LEFT");
else
CT_RARaidOverviewTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT");
end
end
if ( id < 99 ) then
if ( CT_RARaidOverview.barSetup[id] ~= nil ) then
if ( type(CT_RARaidOverview.barSetup[id]) == "table" ) then
for k, v in CT_RARaidOverview.barSetup[id] do
if ( k == "CH" and CT_RARaidOverview.typeClasses[v] ~= nil ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_HEALTH .. " " .. v);
if ( CT_RARaidOverview.statusTable[v]["healthMax"] > 0 ) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[v]];
for name, data in CT_RARaidOverview.statusTable[v]["players"] do
if ( data["healthMax"] > 0 ) then
local percent = floor(data["health"] / data["healthMax"] * 100);
CT_RARaidOverviewTooltip:AddDoubleLine(name,
data["health"] .. " / " .. data["healthMax"] .. " (" .. percent .. "%)", c.r, c.g, c.b, 1, 1, 1);
end
end
end
elseif ( k == "CM" ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_MANA .. " " .. v);
if ( CT_RARaidOverview.statusTable[v]["manaMax"] > 0 ) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[v]];
for name, data in CT_RARaidOverview.statusTable[v]["players"] do
if ( data["manaMax"] == nil ) then data["manaMax"] = 0; end
if ( data["manaMax"] > 0 ) then
local percent = floor(data["mana"] / data["manaMax"] * 100);
CT_RARaidOverviewTooltip:AddDoubleLine(name,
data["mana"] .. " / " .. data["manaMax"] .. " (" .. percent .. "%)", c.r, c.g, c.b, 1, 1, 1);
end
end
end
elseif ( k == "COH" and v ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_HEALTH .. " " .. CT_RA_RS_COMBINED);
for k2, v2 in v do
if ( CT_RARaidOverview.typeClasses[v2] ~= nil ) then
local data = CT_RARaidOverview.statusTable[v2];
if ( data["healthMax"] > 0 ) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[v2]];
local percent = floor(data["health"] / data["healthMax"] * 100);
CT_RARaidOverviewTooltip:AddDoubleLine(v2 .. " (" .. data["num"] .. ")",
data["health"] .. " / " .. data["healthMax"] .. " (" .. percent .. "%)", c.r, c.g, c.b, 1, 1, 1);
end
end
end
elseif ( k == "COM" and v ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_MANA .. " " .. CT_RA_RS_COMBINED);
for k2, v2 in v do
if ( CT_RARaidOverview.typeClasses[v2] ~= nil ) then
local data = CT_RARaidOverview.statusTable[v2];
if ( data["manaMax"] == nil ) then data["manaMax"] = 0; end
if ( data["manaMax"] > 0 ) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[v2]];
local percent = floor(data["mana"] / data["manaMax"] * 100);
CT_RARaidOverviewTooltip:AddDoubleLine(v2 .. " (" .. data["num"] .. ")",
data["mana"] .. " / " .. data["manaMax"] .. " (" .. percent .. "%)", c.r, c.g, c.b, 1, 1, 1);
end
end
end
end
end
else
if ( CT_RARaidOverview.barSetup[id] == "RH" ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_HEALTH .. " " .. CT_RA_RS_TOTAL);
for class, data in CT_RARaidOverview.statusTable do
if ( CT_RARaidOverview.typeClasses[class] ~= nil ) then
if ( data["healthMax"] > 0 ) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[class]];
local percent = floor(data["health"] / data["healthMax"] * 100);
CT_RARaidOverviewTooltip:AddDoubleLine(class .. " (" .. data["num"] .. ")",
data["health"] .. " / " .. data["healthMax"] .. " (" .. percent .. "%)", c.r, c.g, c.b, 1, 1, 1);
end
end
end
elseif ( CT_RARaidOverview.barSetup[id] == "RM" ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_MANA .. " " .. CT_RA_RS_TOTAL);
for class, data in CT_RARaidOverview.statusTable do
if ( CT_RARaidOverview.typeClasses[class] ~= nil ) then
if ( data["manaMax"] == nil ) then data["manaMax"] = 0; end
if ( data["manaMax"] > 0 ) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[class]];
local percent = floor(data["mana"] / data["manaMax"] * 100);
CT_RARaidOverviewTooltip:AddDoubleLine(class .. " (" .. data["num"] .. ")",
data["mana"] .. " / " .. data["manaMax"] .. " (" .. percent .. "%)", c.r, c.g, c.b, 1, 1, 1);
end
end
end
end
end
end
CT_RARaidOverviewTooltip:Show();
elseif ( id == 99 ) then
local showTooltip = false;
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_GENERAL_TOOLTIP_TITLE);
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Offline Count"] and CT_RARaidOverview.statusTable["Generic"]["isOffline"]["num"] > 0 ) then
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_OFFLINE_TEXT);
showTooltip = true;
for k, data in CT_RARaidOverview.statusTable["Generic"]["isOffline"]["players"] do
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[data["class"]]];
if ( not data["offlineTime"] ) then data["offlineTime"] = ""; end
CT_RARaidOverviewTooltip:AddDoubleLine( data["name"],
data["offlineTime"], c.r, c.g, c.b, 1, 1, 1);
end
end
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["PvP Count"] and CT_RARaidOverview.statusTable["Generic"]["isPvP"]["num"] > 0 ) then
if ( showTooltip ) then
CT_RARaidOverviewTooltip:AddLine("\n");
end
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_PVP_TEXT);
showTooltip = true;
for k, data in CT_RARaidOverview.statusTable["Generic"]["isPvP"]["players"] do
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[data["class"]]];
if ( not data["pvpName"] ) then data["pvpName"] = ""; end
CT_RARaidOverviewTooltip:AddDoubleLine( data["name"],
data["pvpName"], c.r, c.g, c.b, 1, 1, 1);
end
end
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Dead Count"] and CT_RARaidOverview.statusTable["Generic"]["isDead"]["num"] > 0 ) then
if ( showTooltip ) then
CT_RARaidOverviewTooltip:AddLine("\n");
end
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_DEAD_TEXT);
showTooltip = true;
local count = 0;
for k, data in CT_RARaidOverview.statusTable["Generic"]["isDead"]["players"] do
count = count + 1;
if ( count <= CT_RARaidOverview.maxListLength) then
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[data["class"]]];
local timeString = " " .. data["deadTime"];
if ( not data["deadTime"] ) then timeString = ""; end
if ( data["status"] == 1 ) then
timeString = "(" .. CT_RA_RS_DEAD_RELEASED .. ")" .. timeString;
end
CT_RARaidOverviewTooltip:AddDoubleLine( data["name"],
timeString, c.r, c.g, c.b, 1, 1, 1);
else
CT_RARaidOverviewTooltip:AddLine("[...]", 1, 1, 1);
break;
end
end
end
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["AFK Count"] and CT_RARaidOverview.statusTable["Generic"]["TYPE"] == "RAID" and CT_RARaidOverview.statusTable["Generic"]["isAfk"]["num"] > 0 ) then
if ( showTooltip ) then
CT_RARaidOverviewTooltip:AddLine("\n");
end
CT_RARaidOverviewTooltip:AddLine(CT_RA_RS_AFK_TEXT);
showTooltip = true;
for k, data in CT_RARaidOverview.statusTable["Generic"]["isAfk"]["players"] do
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[data["class"]]];
if ( not data["afkTime"] ) then data["afkTime"] = ""; end
CT_RARaidOverviewTooltip:AddDoubleLine( data["name"],
data["afkTime"], c.r, c.g, c.b, 1, 1, 1);
end
end
if ( not showTooltip ) then
CT_RARaidOverviewTooltip:AddLine("- " .. CT_RA_RS_ALLOK_TEXT .. " -", 1, 1, 1);
end
CT_RARaidOverviewTooltip:Show();
end
end,
-- onLeave raid status bar frame
onLeave = function()
local id = this:GetID();
local name = this:GetName();
if ( id < 1 ) or not string.find(name, "^CT_RARaidOverviewFrameBar") then
return;
end
CT_RARaidOverviewTooltip:Hide();
end,
-- onMouseDown raid status bar frame
onMouseDown = function()
if ( arg1 == "LeftButton" and not CT_RAMenu_Options["temp"]["StatusMeters"]["Lock"] ) then
CT_RARaidOverviewFrame:StartMoving();
elseif ( arg1 == "RightButton" ) then
if CT_RARaidOverviewTooltip:IsVisible() then
CT_RARaidOverviewTooltip:Hide();
end
local cx, cy = this:GetCenter();
if ( cx < (GetScreenWidth() / 2 ) ) then
if (cy < (GetScreenHeight() / 2)) then
UIDropDownMenu_SetAnchor(0, 0, CT_RARaidOverviewFrame_DropDown, "BOTTOMLEFT", this, "TOPRIGHT");
else
UIDropDownMenu_SetAnchor(0, 0, CT_RARaidOverviewFrame_DropDown, "TOPLEFT", this, "BOTTOMRIGHT");
end
else
if (cy < (GetScreenHeight() / 2)) then
UIDropDownMenu_SetAnchor(0, 0, CT_RARaidOverviewFrame_DropDown, "BOTTOMRIGHT", this, "TOPLEFT");
else
UIDropDownMenu_SetAnchor(0, 0, CT_RARaidOverviewFrame_DropDown, "TOPRIGHT", this, "BOTTOMLEFT");
end
end
ToggleDropDownMenu(1, nil, CT_RARaidOverviewFrame_DropDown);
end
end,
-- onMouseUp raid status bar frame
onMouseUp = function()
if ( arg1 == "LeftButton" ) then
CT_RARaidOverviewFrame:StopMovingOrSizing();
end
end,
addMember = function(id)
local name = UnitName(id);
local class = UnitClass(id);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -