📄 ct_ramenu.lua
字号:
function CT_RAMenu_Misc_ShowTooltip()
CT_RAMenu_Options["temp"]["HideTooltip"] = not this:GetChecked();
end
function CT_RAMenu_Misc_DisableQuery()
CT_RAMenu_Options["temp"]["DisableQuery"] = this:GetChecked();
end
function CT_RAMenu_Misc_ShowResMonitor()
CT_RAMenu_Options["temp"]["ShowMonitor"] = this:GetChecked();
if ( this:GetChecked() and GetNumRaidMembers() > 0 ) then
CT_RA_ResFrame:Show();
else
CT_RA_ResFrame:Hide();
end
end
function CT_RAMenu_Misc_HideButton()
CT_RAMenu_Options["temp"]["HideButton"] = this:GetChecked();
if ( this:GetChecked() ) then
CT_RASets_Button:Hide();
else
CT_RASets_Button:Show();
end
end
function CT_RAMenuGeneral_SortAlpha()
CT_RAMenu_Options["temp"]["SubSortByName"] = this:GetChecked();
CT_RA_UpdateRaidGroup(3);
CT_RAOptions_Update();
end
function CT_RAMenu_Misc_ColorLeader()
if ( CT_RAMenu_Options["temp"]["leaderColor"] ) then
CT_RAMenu_Options["temp"]["leaderColor"].enabled = this:GetChecked();
else
CT_RAMenu_Options["temp"]["leaderColor"] = {
r = 1, g = 1, b = 0, enabled = true
};
end
end
function CT_RAMenu_Misc_ColorLeader_ShowColorPicker(frame)
if ( not CT_RAMenu_Options["temp"]["leaderColor"] ) then
CT_RAMenu_Options["temp"]["leaderColor"] = {
r = 1, g = 1, b = 0, enabled = true
};
end
frame.r = CT_RAMenu_Options["temp"]["leaderColor"].r;
frame.g = CT_RAMenu_Options["temp"]["leaderColor"].g;
frame.b = CT_RAMenu_Options["temp"]["leaderColor"].b;
frame.swatchFunc = CT_RAMenu_Misc_ColorLeader_SetColor;
frame.cancelFunc = CT_RAMenu_Misc_ColorLeader_CancelColor;
UIDropDownMenuButton_OpenColorPicker(frame);
end
function CT_RAMenu_Misc_ColorLeader_SetColor()
local r, g, b = ColorPickerFrame:GetColorRGB();
CT_RAMenu_Options["temp"]["leaderColor"].r = r;
CT_RAMenu_Options["temp"]["leaderColor"].g = g;
CT_RAMenu_Options["temp"]["leaderColor"].b = b;
CT_RAMenuFrameMiscDisplayColorLeaderColorSwatchNormalTexture:SetVertexColor(CT_RAMenu_Options["temp"]["leaderColor"].r, CT_RAMenu_Options["temp"]["leaderColor"].g, CT_RAMenu_Options["temp"]["leaderColor"].b);
end
function CT_RAMenu_Misc_ColorLeader_CancelColor()
CT_RAMenu_Options["temp"]["leaderColor"].r = CT_RAMenuFrameMiscDisplayColorLeaderColorSwatch.r;
CT_RAMenu_Options["temp"]["leaderColor"].g = CT_RAMenuFrameMiscDisplayColorLeaderColorSwatch.g;
CT_RAMenu_Options["temp"]["leaderColor"].b = CT_RAMenuFrameMiscDisplayColorLeaderColorSwatch.b;
CT_RAMenuFrameMiscDisplayColorLeaderColorSwatchNormalTexture:SetVertexColor(CT_RAMenu_Options["temp"]["leaderColor"].r, CT_RAMenu_Options["temp"]["leaderColor"].g, CT_RAMenu_Options["temp"]["leaderColor"].b);
end
function CT_RAMenu_Misc_NotifyGroupChange()
CT_RAMenu_Options["temp"]["NotifyGroupChange"] = this:GetChecked();
if ( not this:GetChecked() ) then
CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:Disable();
CT_RAMenuFrameMiscNotificationsNotifyGroupChangeSound:SetTextColor(0.3, 0.3, 0.3);
else
CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:Enable();
CT_RAMenuFrameMiscNotificationsNotifyGroupChangeSound:SetTextColor(1, 1, 1);
end
end
function CT_RAMenu_Misc_NotifyGroupChangeSound()
CT_RAMenu_Options["temp"]["NotifyGroupChangeSound"] = this:GetChecked();
end
function CT_RA_UpdateResFrame()
local text = "";
local playerTarget, playerName = UnitName("target"), UnitName("player");
for key, val in CT_RA_Ressers do
if ( strlen(text) > 0 ) then
text = text .. "\n";
end
if ( val == playerTarget and key ~= playerName ) then
-- Color gold if we're targeting this player.
text = text .. "|c00FFD100" .. key .. ": " .. val .. "|r";
else
text = text .. key .. ": " .. val;
end
end
CT_RA_ResFrameText:SetText(text);
CT_RA_ResFrame:SetWidth(max(CT_RA_ResFrameText:GetWidth()+15, 175));
CT_RA_ResFrame:SetHeight(max(CT_RA_ResFrameText:GetHeight()+25, 50));
end
function CT_RAMenuHelp_LoadText()
local texts = {
"|c00FFFFFF显示队伍名字 -|r 打开/关闭每个队伍的标题头\n\n|c00FFFFFF锁定队伍位置 -|r 锁定所有团队助手窗口的位置\n\n|c00FFFFFF隐藏法力条 -|r 隐藏所有玩家的法力条\n\n|c00FFFFFF隐藏生命条 -|r 隐藏所有的生命条\n\n|c00FFFFFF隐藏怒气/能量条 -|r 隐藏所有玩家的怒气和能量条\n\n|c00FFFFFF生命类型 -|r 允许你以百分比形式显示玩家的生命,\n实际数字,损失的生命值,只以百分比显示主坦克目标的生命值,\n或者全部不显示。你也可以自定义\n\n|c00FFFFFF窗口背景色-|r 改变团队助手窗口的背景颜色,\n将滑杆拖到100%的位置\n令其变成透明\n\n|c00FFFFFF警告信息颜色-|r 设置使用/rs命令显示在你屏幕中间\n的的信息的颜色",
"|c00FFFFFF隐藏离线成员 -|r 允许你隐藏离线的\n成员,令他们不显示在团队助手面板中\n\n隐藏短期负面效果 -|r 允许你隐藏持续时间小于\n10秒的负面效果\n\n|c00FFFFFF隐藏边框 -|r 允许你隐藏每个团队助手面板的边框\n\n|c00FFFFFF分类显示 -|r 按照小队、职业或自定义的分类规则显示。按照职业\n显示可分类显示每个职业的玩家,按照自定义\n显示可自由定义哪个玩家显示在哪个组中",
"允许你在团队成员受到以上列出的负面\n效果影响时通过聊天频道收到通知,\n同时在团队成员失去一个增益效果时通过聊天频道通知你,\n这样你就可以重新施放该增益效果\n\n|c00FFFFFF请注意:|r 要快速清除队友的不利效果,或重新\n施放增益效果,请通过游戏中的按键设置\n菜单 (|c00FFFFFFEscape|r > |c00FFFFFF按键设置|r > |c00FFFFFF“团队助手”区|r)\n设置一键重新施放或清除效果",
"允许你缩放团队队伍和MT的窗口。",
CT_RAMENU_BUFFSDESCRIPT,
CT_RAMENU_BUFFSTOOLTIP,
CT_RAMENU_DEBUFFSTOOLTIP,
CT_RAMENU_ADDITIONALEMTOOLTIP,
"允许你改变所选设定的名字和细节。在下面三项中,你可以使用(|c00FFFFFF*|r)来作为通配符用以匹配0个或者多个字符。你也可以使用正则表达式,如果你知道如何用的话。",
"允许你改变按此设定将解除指定的负面效果的职业。"
};
this.text = texts[this:GetID()];
end
function CT_RAMenuHelp_SetTooltip()
local uiX, uiY = UIParent:GetCenter();
local thisX, thisY = this:GetCenter();
local anchor = "";
if ( thisY > uiY ) then
anchor = "BOTTOM";
else
anchor = "TOP";
end
if ( thisX < uiX ) then
if ( anchor == "TOP" ) then
anchor = "TOPLEFT";
else
anchor = "BOTTOMRIGHT";
end
else
if ( anchor == "TOP" ) then
anchor = "TOPRIGHT";
else
anchor = "BOTTOMLEFT";
end
end
GameTooltip:SetOwner(this, "ANCHOR_" .. anchor);
end
function CT_RAMenu_SaveWindowPositions()
CT_RAMenu_Options["temp"]["WindowPositions"] = { };
local left, top, uitop;
for i = 1, 8, 1 do
local frame = getglobal("CT_RAGroupDrag" .. i);
left, top, uitop = frame:GetLeft(), frame:GetTop(), UIParent:GetTop();
if ( left and top and uitop ) then
CT_RAMenu_Options["temp"]["WindowPositions"][frame:GetName()] = { left, top-uitop };
end
end
left, top, uitop = CT_RAMTGroupDrag:GetLeft(), CT_RAMTGroupDrag:GetTop(), UIParent:GetTop();
if ( left and top and uitop ) then
CT_RAMenu_Options["temp"]["WindowPositions"]["CT_RAMTGroupDrag"] = { left, top-uitop };
end
left, top, uitop = CT_RA_EmergencyFrameDrag:GetLeft(), CT_RA_EmergencyFrameDrag:GetTop(), UIParent:GetTop();
if ( left and top and uitop ) then
CT_RAMenu_Options["temp"]["WindowPositions"]["CT_RA_EmergencyFrameDrag"] = { left, top-uitop };
end
end
function CT_RAMenu_UpdateWindowPositions()
if ( CT_RAMenu_Options["temp"]["WindowPositions"] ) then
for k, v in CT_RAMenu_Options["temp"]["WindowPositions"] do
getglobal(k):ClearAllPoints();
getglobal(k):SetPoint("TOPLEFT" , "UIParent", "TOPLEFT", v[1], v[2]);
end
end
end
function CT_RAMenu_CopyTable(source)
local dest = { };
if ( type(source) == "table" ) then
for k, v in source do
dest[k] = CT_RAMenu_CopyTable(v);
end
return dest;
else
return source;
end
end
function CT_RAMenu_CopySet(copyFrom, copyTo)
CT_RAMenu_Options[copyTo] = nil;
CT_RAMenu_Options[copyTo] = CT_RAMenu_CopyTable(CT_RAMenu_Options[copyFrom]);
CT_RAMenu_UpdateOptionSets();
end
function CT_RAMenu_DeleteSet(name)
if ( name ~= "缺省" ) then
if ( CT_RAMenu_CurrSet == name ) then
CT_RAMenu_CurrSet = "缺省";
CT_RAMenu_Options["temp"] = CT_RAMenu_CopyTable(CT_RAMenu_Options[CT_RAMenu_CurrSet]);
end
CT_RAMenu_Options[name] = nil;
CT_RAMenu_UpdateOptionSets();
CT_RA_UpdateRaidGroup(0);
CT_RA_UpdateMTs();
CT_RAMenu_UpdateMenu();
CT_RAOptions_Update();
end
end
function CT_RAMenu_CompareTable(t1, t2)
if ( not t1 or not t2 ) then
return false;
else
if ( t1 == false ) then
t1 = nil;
end
if ( t2 == false ) then
t2 = nil;
end
if ( type(t1) ~= type(t2) ) then
return false;
elseif ( type(t1) ~= "table" ) then
return ( t1 == t2 );
end
end
for key, val in t1 do
if ( key ~= "unchanged" and val ~= false ) then
if ( type(val) ~= "table" ) then
if ( not t2[key] or ( t2[key] ~= val and t2[key] ~= false ) ) then
return false;
end
else
if ( not CT_RAMenu_CompareTable(val, t2[key]) ) then
return false;
end
end
end
end
for key, val in t2 do
if ( key ~= "unchanged" and val ~= false ) then
if ( type(val) ~= "table" ) then
if ( not t1[key] or ( t1[key] ~= val and t1[key] ~= false ) ) then
return false;
end
else
if ( not CT_RAMenu_CompareTable(val, t1[key]) ) then
return false;
end
end
end
end
return true;
end
function CT_RAMenu_ExistsSet(set)
for k, v in CT_RAMenu_Options do
if ( strlower(k) == strlower(set) ) then
return true;
end
end
return nil;
end
function CT_RAMenu_UpdateOptionSets()
local num = 0;
local postfix = "";
if ( not CT_RAMenu_CompareTable(CT_RAMenu_Options["temp"], CT_RAMenu_Options[CT_RAMenu_CurrSet]) ) then
postfix = "*";
CT_RAMenuFrameOptionSetsUndo:Enable();
CT_RAMenuFrameOptionSetsSave:Enable();
else
CT_RAMenuFrameOptionSetsUndo:Disable();
CT_RAMenuFrameOptionSetsSave:Disable();
end
CT_RAMenuFrameOptionSetsCurrentSet:SetText("当前设置:|c00FFFF00" .. CT_RAMenu_CurrSet .. "|r" .. postfix);
for k, v in CT_RAMenu_Options do
if ( k ~= "temp" ) then
num = num + 1;
local obj = getglobal("CT_RAMenuFrameOptionSetsSet" .. num);
getglobal(obj:GetName() .. "Name"):SetText(k);
obj.setName = k;
-- Make sure last line is hidden
if ( num == 8 ) then
getglobal(obj:GetName() .. "Line"):Hide();
else
getglobal(obj:GetName() .. "Line"):Show();
end
-- Disallow loading the current set
if ( k == CT_RAMenu_CurrSet ) then
getglobal(obj:GetName() .. "Load"):Disable();
getglobal(obj:GetName() .. "Name"):SetTextColor(1, 1, 1);
else
getglobal(obj:GetName() .. "Load"):Enable();
getglobal(obj:GetName() .. "Name"):SetTextColor(0.66, 0.66, 0.66);
end
-- Disallow deleting the default set
if ( k == "缺省" ) then
getglobal(obj:GetName() .. "Delete"):Disable();
else
getglobal(obj:GetName() .. "Delete"):Enable();
end
obj:Show();
end
end
for i = num+1, 8, 1 do
getglobal("CT_RAMenuFrameOptionSetsSet" .. i):Hide();
end
end
tinsert(UISpecialFrames, "CT_RA_PriorityFrame");
function CT_RAMenuFrameDebuff_Update()
local numEntries = getn(CT_RA_DebuffTemplates);
FauxScrollFrame_Update(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -