📄 ct_rameters.lua
字号:
CT_RARaidOverview.statusTable["Generic"]["total"] = CT_RARaidOverview.statusTable["Generic"]["total"] + 1;
if ( UnitIsConnected(id) ) then
local powerType = UnitPowerType(id); -- -1=Health, 0=Mana, 1=Rage, 2=Focus, 3=Energy, 4=Happiness
local isDead = UnitIsDead(id);
local isGhost = UnitIsGhost(id);
local isAfk = ( CT_RA_Stats[name] and CT_RA_Stats[name]["AFK"] );
local isPvP = ( UnitIsPVP(id) or UnitIsPVPFreeForAll(id) );
local health, maxHealth = UnitHealth(id), UnitHealthMax(id);
local mana, maxMana = UnitMana(id), UnitManaMax(id);
-- override variables in case (why ever) important requests got nil
if ( powerType == nil ) then powerType = -2; end
if ( health == nil ) then health = 0; end
if ( maxHealth == nil ) then maxHealth = 0; end
if ( mana == nil ) then mana = 0; end
if ( maxMana == nil ) then maxMana = 0; end
CT_RARaidOverview.statusTable["Generic"]["health"] = CT_RARaidOverview.statusTable["Generic"]["health"] + health;
CT_RARaidOverview.statusTable["Generic"]["healthMax"] = CT_RARaidOverview.statusTable["Generic"]["healthMax"] + maxHealth;
if ( powerType == 0 ) then
CT_RARaidOverview.statusTable["Generic"]["mana"] = CT_RARaidOverview.statusTable["Generic"]["mana"] + mana;
CT_RARaidOverview.statusTable["Generic"]["manaMax"] = CT_RARaidOverview.statusTable["Generic"]["manaMax"] + maxMana;
end
if ( isDead or isGhost ) then
local dgStatus = 0;
if ( isGhost ) then dgStatus = 1; end
local deadTime = CT_RA_RS_NA_TEXT;
if ( CT_RA_Stats[name] and CT_RA_Stats[name]["Dead"] ) then
deadTime = CT_RA_FormatTime(CT_RA_Stats[name]["Dead"]);
end
CT_RARaidOverview.statusTable["Generic"]["isDead"]["num"] = CT_RARaidOverview.statusTable["Generic"]["isDead"]["num"] + 1;
tinsert(CT_RARaidOverview.statusTable["Generic"]["isDead"]["players"], {["name"] = name, ["class"] = class, ["status"] = dgStatus, ["deadTime"] = deadTime} );
end
if ( isAfk ) then
local afkTime = CT_RA_RS_NA_TEXT;
if ( type( CT_RA_Stats[name]["AFK"][1]) == "string" ) then
afkTime = CT_RA_Stats[name]["AFK"][1];
else
afkTime = CT_RA_FormatTime(CT_RA_Stats[name]["AFK"][2]);
end
CT_RARaidOverview.statusTable["Generic"]["isAfk"]["num"] = CT_RARaidOverview.statusTable["Generic"]["isAfk"]["num"] + 1;
tinsert(CT_RARaidOverview.statusTable["Generic"]["isAfk"]["players"], {["name"] = name, ["class"] = class, ["afkTime"] = afkTime});
end
if ( isPvP ) then
local pvpName = UnitPVPName(id);
CT_RARaidOverview.statusTable["Generic"]["isPvP"]["num"] = CT_RARaidOverview.statusTable["Generic"]["isPvP"]["num"] + 1;
tinsert(CT_RARaidOverview.statusTable["Generic"]["isPvP"]["players"], {["name"] = name, ["class"] = class, ["pvpName"] = pvpName});
end
if ( class and CT_RARaidOverview.statusTable[class] ) then
CT_RARaidOverview.statusTable[class]["num"] = CT_RARaidOverview.statusTable[class]["num"] + 1;
CT_RARaidOverview.statusTable[class]["players"][name] = {};
CT_RARaidOverview.statusTable[class]["players"][name]["health"] = health;
CT_RARaidOverview.statusTable[class]["players"][name]["healthMax"] = maxHealth;
CT_RARaidOverview.statusTable[class]["health"] = CT_RARaidOverview.statusTable[class]["health"] + health;
CT_RARaidOverview.statusTable[class]["healthMax"] = CT_RARaidOverview.statusTable[class]["healthMax"] + maxHealth;
if ( powerType == 0 ) then
CT_RARaidOverview.statusTable[class]["players"][name]["mana"] = mana;
CT_RARaidOverview.statusTable[class]["players"][name]["manaMax"] = maxMana;
CT_RARaidOverview.statusTable[class]["mana"] = CT_RARaidOverview.statusTable[class]["mana"] + mana;
CT_RARaidOverview.statusTable[class]["manaMax"] = CT_RARaidOverview.statusTable[class]["manaMax"] + maxMana;
end
end
else
local offlineTime = CT_RA_RS_NA_TEXT;
if ( CT_RA_Stats[name] and CT_RA_Stats[name]["Offline"] ) then
offlineTime = CT_RA_FormatTime(CT_RA_Stats[name]["Offline"]);
end
CT_RARaidOverview.statusTable["Generic"]["isOffline"]["num"] = CT_RARaidOverview.statusTable["Generic"]["isOffline"]["num"] + 1;
tinsert(CT_RARaidOverview.statusTable["Generic"]["isOffline"]["players"], {["name"] = name, ["class"] = class, ["offlineTime"] = offlineTime});
end
end,
updateBars = function()
if ( not CT_RAMenu_Options["temp"]["StatusMeters"] or not CT_RARaidOverviewFrame:IsVisible() ) then
if ( CT_RARaidOverviewFrame:IsVisible() ) then
CT_RARaidOverviewFrame:Hide();
end
CT_RARaidOverview.statusTable = {};
return;
end
if ( not CT_RARaidOverviewFrame:IsVisible() ) then
CT_RARaidOverviewFrame:Show();
end
CT_RARaidOverview.statusTable = {
["Generic"] = {
["type"] = "",
["isDead"] = { ["num"] = 0, ["players"] = {} },
["isAfk"] = { ["num"] = 0, ["players"] = {} },
["isOffline"] = { ["num"] = 0, ["players"] = {} },
["isPvP"] = { ["num"] = 0, ["players"] = {} },
["total"] = 0,
["health"] = 0,
["healthMax"] = 0,
["mana"] = 0,
["manaMax"] = 0,
},
[CT_RA_WARRIOR] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_DRUID] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_MAGE] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_WARLOCK] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_ROGUE] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_HUNTER] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_PRIEST] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_PALADIN] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
[CT_RA_SHAMAN] = { ["health"] = 0, ["healthMax"] = 0, ["mana"] = 0, ["manaMax"] = 0, ["num"] = 0, ["players"] = {} },
};
if ( CT_RARaidOverviewFrame:IsVisible() ) then
local barCount = 0;
if ( CT_RARaidOverview.numRaidMembers > 0 ) then
CT_RARaidOverview.statusTable["Generic"]["TYPE"] = "RAID";
for i=1, CT_RARaidOverview.numRaidMembers do
CT_RARaidOverview.addMember("raid" .. i);
end
elseif ( CT_RARaidOverview.numPartyMembers > 0 ) then
CT_RARaidOverview.statusTable["Generic"]["TYPE"] = "PARTY";
CT_RARaidOverview.addMember("player");
for i=1, CT_RARaidOverview.numPartyMembers do
CT_RARaidOverview.addMember("party" .. i);
end
end
if ( CT_RARaidOverview.statusTable["Generic"]["total"] > 0 ) then
local bar = nil;
local text = nil;
local tcount = nil;
local status = nil;
-- Update header text
if ( CT_RARaidOverview.statusTable["Generic"]["TYPE"] == "RAID" ) then
CT_RARaidOverviewFrameHeader:SetText(CT_RA_RS_RAID_TITLE);
elseif ( CT_RARaidOverview.statusTable["Generic"]["TYPE"] == "PARTY" ) then
CT_RARaidOverviewFrameHeader:SetText(CT_RA_RS_GROUP_TITLE);
else
CT_RARaidOverviewFrameHeader:SetText("N/A");
end
-- Total player count
local countString = CT_RARaidOverview.statusTable["Generic"]["total"] .. " " .. CT_RA_RS_PLAYER_TEXT;
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Offline Count"] and CT_RARaidOverview.statusTable["Generic"]["isOffline"]["num"] > 0 ) then
countString = countString .. " (" .. CT_RARaidOverview.statusTable["Generic"]["isOffline"]["num"] .. " " .. CT_RA_RS_OFFLINE_TEXT .. ")";
end
CT_RARaidOverviewFrameTextPlayer:SetText(countString);
CT_RARaidOverviewFrameTextPlayer:Show();
-- Dead count
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Dead Count"] ) then
CT_RARaidOverviewFrameTextDead:SetText(CT_RA_RS_DEAD_TEXT .. ": " .. CT_RARaidOverview.statusTable["Generic"]["isDead"]["num"]);
CT_RARaidOverviewFrameTextDead:Show();
else
CT_RARaidOverviewFrameTextDead:SetText("");
CT_RARaidOverviewFrameTextDead:Hide();
end
-- PvP count
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["PvP Count"] and CT_RARaidOverview.statusTable["Generic"]["isPvP"]["num"] > 0 ) then
CT_RARaidOverviewFrameTextPvP:SetText(CT_RA_RS_PVP_TEXT .. ": " .. CT_RARaidOverview.statusTable["Generic"]["isPvP"]["num"]);
CT_RARaidOverviewFrameTextPvP:Show();
else
CT_RARaidOverviewFrameTextPvP:SetText("");
CT_RARaidOverviewFrameTextPvP:Hide();
end
-- Afk count
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["AFK Count"] and CT_RARaidOverview.statusTable["Generic"]["TYPE"] == "RAID" ) then
CT_RARaidOverviewFrameTextAfk:SetText(CT_RARaidOverview.statusTable["Generic"]["isAfk"]["num"] .. " :" .. CT_RA_RS_AFK_TEXT);
CT_RARaidOverviewFrameTextAfk:Show();
else
CT_RARaidOverviewFrameTextAfk:SetText("");
CT_RARaidOverviewFrameTextAfk:Hide();
end
-- Raid health
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Raid Health"] ) then
barCount = barCount + 1;
CT_RARaidOverview.barSetup[barCount] = {};
CT_RARaidOverview.barSetup[barCount] = "RH";
bar = getglobal("CT_RARaidOverviewFrameBar" .. barCount);
text = getglobal("CT_RARaidOverviewFrameText" .. barCount);
tcount = getglobal("CT_RARaidOverviewFrameCount" .. barCount);
status = getglobal("CT_RARaidOverviewFrameStatus" .. barCount);
local healthRaw = 0;
local health = 0;
if ( CT_RARaidOverview.statusTable["Generic"]["healthMax"] > 0 ) then
healthRaw = CT_RARaidOverview.statusTable["Generic"]["health"] / CT_RARaidOverview.statusTable["Generic"]["healthMax"];
health = floor(healthRaw * 100);
end
bar:SetMinMaxValues(0, 100);
bar:SetValue(health);
bar:SetStatusBarColor(1.0 - healthRaw, healthRaw, 0);
text:SetText(CT_RA_RS_TOTAL);
tcount:SetText("");
status:SetText(health .. "%");
bar:Show();
text:Show();
tcount:Hide();
status:Show();
end
-- Raid mana
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Raid Mana"] and CT_RARaidOverview.statusTable["Generic"]["manaMax"] > 0 ) then
barCount = barCount + 1;
CT_RARaidOverview.barSetup[barCount] = {};
CT_RARaidOverview.barSetup[barCount] = "RM";
bar = getglobal("CT_RARaidOverviewFrameBar" .. barCount);
text = getglobal("CT_RARaidOverviewFrameText" .. barCount);
tcount = getglobal("CT_RARaidOverviewFrameCount" .. barCount);
status = getglobal("CT_RARaidOverviewFrameStatus" .. barCount);
local mana = floor(CT_RARaidOverview.statusTable["Generic"]["mana"] / CT_RARaidOverview.statusTable["Generic"]["manaMax"] * 100);
bar:SetMinMaxValues(0, 100);
bar:SetValue(mana);
bar:SetStatusBarColor(0, 0, 1.0);
text:SetText(CT_RA_RS_TOTAL);
tcount:SetText("");
status:SetText(mana .. "%");
bar:Show();
text:Show();
tcount:Hide();
status:Show();
end
-- Player health
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Health Display"] ) then
for k, v in CT_RAMenu_Options["temp"]["StatusMeters"]["Health Display"] do
if ( v and CT_RARaidOverview.statusTable[k] and barCount < CT_RARaidOverview.maxBars and CT_RARaidOverview.statusTable[k]["healthMax"] > 0 ) then
barCount = barCount + 1;
CT_RARaidOverview.barSetup[barCount] = {};
CT_RARaidOverview.barSetup[barCount]["CH"] = k;
bar = getglobal("CT_RARaidOverviewFrameBar" .. barCount);
text = getglobal("CT_RARaidOverviewFrameText" .. barCount);
tcount = getglobal("CT_RARaidOverviewFrameCount" .. barCount);
status = getglobal("CT_RARaidOverviewFrameStatus" .. barCount);
local healthRaw = CT_RARaidOverview.statusTable[k]["health"] / CT_RARaidOverview.statusTable[k]["healthMax"];
local health = floor(healthRaw * 100);
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[k]];
bar:SetMinMaxValues(0, 100);
bar:SetValue(health);
bar:SetStatusBarColor(1.0 - healthRaw, healthRaw, 0);
text:SetText(k);
text:SetTextColor(c.r, c.g, c.b);
tcount:SetText("(" .. CT_RARaidOverview.statusTable[k]["num"] .. ")");
tcount:SetTextColor(c.r, c.g, c.b);
status:SetText(health .. "%");
bar:Show();
text:Show();
tcount:Show();
status:Show();
end
end
end
-- Player mana
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Mana Display"]) then
for k, v in CT_RAMenu_Options["temp"]["StatusMeters"]["Mana Display"] do
if ( v and CT_RARaidOverview.statusTable[k] and barCount < CT_RARaidOverview.maxBars and CT_RARaidOverview.statusTable[k]["manaMax"] > 0 ) then
barCount = barCount + 1;
CT_RARaidOverview.barSetup[barCount] = {};
CT_RARaidOverview.barSetup[barCount]["CM"] = k;
bar = getglobal("CT_RARaidOverviewFrameBar" .. barCount);
text = getglobal("CT_RARaidOverviewFrameText" .. barCount);
tcount = getglobal("CT_RARaidOverviewFrameCount" .. barCount);
status = getglobal("CT_RARaidOverviewFrameStatus" .. barCount);
local mana = floor(CT_RARaidOverview.statusTable[k]["mana"] / CT_RARaidOverview.statusTable[k]["manaMax"] * 100);
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[k]];
bar:SetMinMaxValues(0, 100);
bar:SetValue(mana);
bar:SetStatusBarColor(0, 0, 1.0);
text:SetText(k);
text:SetTextColor(c.r, c.g, c.b);
tcount:SetText("(" .. CT_RARaidOverview.statusTable[k]["num"] .. ")");
tcount:SetTextColor(c.r, c.g, c.b);
status:SetText(mana .. "%");
bar:Show();
text:Show();
tcount:Show();
status:Show();
end
end
end
-- Combined player health
if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Health Combined"] ) then
local health = 0;
local healthRaw = 0;
local playerCount = 0;
local playerString = "";
local playerStringLong = "";
local playerFirst = true;
local entryCount = 0;
barCount = barCount + 1;
CT_RARaidOverview.barSetup[barCount] = {};
CT_RARaidOverview.barSetup[barCount]["COH"] = {};
for k, v in CT_RAMenu_Options["temp"]["StatusMeters"]["Health Combined"] do
if ( v and CT_RARaidOverview.statusTable[k] and barCount < CT_RARaidOverview.maxBars and CT_RARaidOverview.statusTable[k]["healthMax"] > 0 ) then
entryCount = entryCount + 1;
local healthRawC = CT_RARaidOverview.statusTable[k]["health"] / CT_RARaidOverview.statusTable[k]["healthMax"];
if ( entryCount <= 1 ) then
health = floor(healthRawC * 100);
healthRaw = healthRawC;
else
health = floor((health + floor(healthRawC * 100)) / 2);
healthRaw = (healthRaw + healthRawC) / 2;
end
playerCount = playerCount + CT_RARaidOverview.statusTable[k]["num"];
local c = RAID_CLASS_COLORS[CT_RARaidOverview.typeClasses[k]];
if ( playerFirst ) then
playerFirst = false;
else
playerString = playerString .. ", ";
playerStringLong = playerStringLong .. ", ";
end
playerString = playerString .. "|c00" .. string.format("%.2x",c.r * 255) .. string.format("%.2x",c.g * 255) .. string.format("%.2x",c.b * 255) .. string.sub(k, 1, 3) .. "|r";
playerStringLong = playerStringLong .. "|c00" .. string.format("%.2x",c.r * 255) .. string.format("%.2x",c.g * 255) .. string.format("%.2x",c.b * 255) .. k .. "|r";
tinsert(CT_RARaidOverview.barSetup[barCount]["COH"], k);
end
end
if ( playerCount > 0 ) then
bar = getglobal("CT_RARaidOverviewFrameBar" .. barCount);
text = getglobal("CT_RARaidOverviewFrameText" .. barCount);
tcount = getglobal("CT_RARaidOverviewFrameCount" .. barCount);
status = getglobal("CT_RARaidOverviewFrameStatus" .. barCount);
bar:SetMinMaxValues(0, 100);
bar:SetValue(health);
bar:SetStatusBarColor(1.0 - healthRaw, healthRaw, 0);
if ( playerCount <= 2 ) then
text:SetText(playerStringLong);
else
text:SetText(playerString);
end
tcount:SetText("(" .. playerCount .. ")");
status:SetText(health .. "%");
bar:Show();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -