⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ct_rameters.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 3 页
字号:
						text:Show();
						tcount:Show();
						status:Show();
					else
						barCount = barCount - 1;
					end
				end

				-- Combined player mana
				if ( CT_RAMenu_Options["temp"]["StatusMeters"]["Mana Combined"] ) then
					local mana = 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]["COM"] = {};
					for k, v in CT_RAMenu_Options["temp"]["StatusMeters"]["Mana Combined"] do
						if ( v and CT_RARaidOverview.statusTable[k] and barCount < CT_RARaidOverview.maxBars and CT_RARaidOverview.statusTable[k]["manaMax"] > 0 ) then
							entryCount = entryCount + 1;
							
							local manaRawC = CT_RARaidOverview.statusTable[k]["mana"] / CT_RARaidOverview.statusTable[k]["manaMax"];
							if ( entryCount <= 1 ) then
								mana = floor(manaRawC * 100);
							else
								mana = floor((mana + floor(manaRawC * 100)) / 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]["COM"], 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(mana);
						bar:SetStatusBarColor(0, 0, 1.0);
						if ( playerCount <= 2 ) then
							text:SetText(playerStringLong);
						else
							text:SetText(playerString);
						end
						tcount:SetText("(" .. playerCount .. ")");
						status:SetText(mana .. "%");

						bar:Show();
						text:Show();
						tcount:Show();
						status:Show();
					else
						barCount = barCount - 1;
					end
				end

				CT_RARaidOverviewFrame:SetHeight(CT_RARaidOverview.barSpacing * barCount + 5);
			end

			-- clear other bars
			local start = barCount + 1;
			if ( barCount <= 0 ) then
				local bar = getglobal("CT_RARaidOverviewFrameBar1");
				local text = getglobal("CT_RARaidOverviewFrameText1");
				local tcount = getglobal("CT_RARaidOverviewFrameCount1");
				local status = getglobal("CT_RARaidOverviewFrameStatus1");

				bar:SetValue(0);
				text:SetText(CT_RA_RS_NOTRACK);
				tcount:SetText("");
				status:SetText("");

				bar:Show();
				text:Show();
				tcount:Hide();
				status:Hide();

				start = 2;
				CT_RARaidOverviewFrame:SetHeight(CT_RARaidOverview.barSpacing + 5);
			end
			if ( start <= CT_RARaidOverview.maxBars ) then
				for i=start, 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:SetValue(0);
					text:SetText("");
					tcount:SetText("");
					status:SetText("");

					bar:Hide();
					text:Hide();
					tcount:Hide();
					status:Hide();
				end
			end
		end
	end,

	initializeMenuArray = function()
		local info;
		if ( UIDROPDOWNMENU_MENU_LEVEL == 2 ) then
			local subTitle = "";
			if ( UIDROPDOWNMENU_MENU_VALUE == "Health Display" or UIDROPDOWNMENU_MENU_VALUE == "Health Combined" ) then
				subTitle = CT_RA_RS_HEALTH;
			elseif ( UIDROPDOWNMENU_MENU_VALUE == "Mana Display" or UIDROPDOWNMENU_MENU_VALUE == "Mana Combined" ) then
				subTitle = CT_RA_RS_MANA;
			else
				subTitle = UIDROPDOWNMENU_MENU_VALUE;
			end

			info = {};
			info.text = "- " .. subTitle .. " -";
			info.justifyH = "CENTER";
			info.isTitle = 1;
			info.notCheckable = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			
			local nonManaUsers = {
				[CT_RA_ROGUE] = 1,
				[CT_RA_WARRIOR] = 1
			};
			for k, v in CT_RA_ClassPositions do
				if ( UIDROPDOWNMENU_MENU_VALUE == "Health Display" or UIDROPDOWNMENU_MENU_VALUE == "Health Combined" or not nonManaUsers[k] ) then
					if ( ( k ~= CT_RA_SHAMAN or ( UnitFactionGroup("player") and UnitFactionGroup("player") == "Horde" ) ) and ( k ~= CT_RA_PALADIN or ( UnitFactionGroup("player") and UnitFactionGroup("player") == "Alliance" ) ) ) then
						info = { };
						info.text = k;
						info.value = { UIDROPDOWNMENU_MENU_VALUE, k };
						info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"][UIDROPDOWNMENU_MENU_VALUE] and CT_RAMenu_Options["temp"]["StatusMeters"][UIDROPDOWNMENU_MENU_VALUE][k] );
						info.keepShownOnClick = 1;
						info.func = CT_RARaidOverview.menuOptions;
						UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
					end
				end
			end
			return;
		end
		info = {};
		info.text = "- " .. CT_RA_RS_TITLE .. " -";
		info.justifyH = "CENTER";
		info.isTitle = 1;
		info.notCheckable = 1;
		UIDropDownMenu_AddButton(info);

		info = {};
		info.text = CT_RA_RS_HEALTH .. " " .. CT_RA_RS_TOTAL;
		info.value = "Raid Health";
		info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["Raid Health"] );
		info.keepShownOnClick = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_MANA .. " " .. CT_RA_RS_TOTAL;
		info.value = "Raid Mana";
		info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["Raid Mana"] );
		info.keepShownOnClick = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);

		info = {};
		info.text = CT_RA_RS_HEALTH .. " " .. CT_RA_RS_COMBINED;
		info.value = "Health Combined";
		info.hasArrow = 1;
		info.notCheckable = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_MANA .. " " .. CT_RA_RS_COMBINED;
		info.value = "Mana Combined";
		info.hasArrow = 1;
		info.notCheckable = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_HEALTH .. " " .. CT_RA_RS_PER_CLASS;
		info.value = "Health Display";
		info.hasArrow = 1;
		info.notCheckable = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_MANA .. " " .. CT_RA_RS_PER_CLASS;
		info.value = "Mana Display";
		info.hasArrow = 1;
		info.notCheckable = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.disabled = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_AFK;
		info.value = "AFK Count";
		info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["AFK Count"] );
		info.keepShownOnClick = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_DEAD;
		info.value = "Dead Count";
		info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["Dead Count"] );
		info.keepShownOnClick = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = CT_RA_RS_OFFLINE;
		info.value = "Offline Count";
		info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["Offline Count"] );
		info.keepShownOnClick = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);

		info = {};
		info.text = CT_RA_RS_PVP;
		info.value = "PvP Count";
		info.checked = ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["PvP Count"] );
		info.keepShownOnClick = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.disabled = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		if ( CT_RAMenu_Options["temp"]["StatusMeters"] and CT_RAMenu_Options["temp"]["StatusMeters"]["Lock"] ) then
			info.text = CT_RA_RS_MENU_UNLOCK;
		else
			info.text = CT_RA_RS_MENU_LOCK;
		end
		info.value = "LockMeter";
		info.notCheckable = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);
		
		info = { };
		info.text = CT_RA_RS_MENU_OPACITY;
		info.value = "Opacity";
		info.func = CT_RARaidOverview.menuOptions;
		info.notCheckable = 1;
		UIDropDownMenu_AddButton(info);
		
		info = {};
		info.text = "|c00FF8080" .. CT_RA_RS_MENU_HIDE .. "|r";
		info.value = "Hide";
		info.notCheckable = 1;
		info.func = CT_RARaidOverview.menuOptions;
		UIDropDownMenu_AddButton(info);
	end,

	menuOptions = function()
		-- Create the table if we haven't already
		if ( not CT_RAMenu_Options["temp"]["StatusMeters"]  ) then
			CT_RAMenu_Options["temp"]["StatusMeters"] = {
				["Health Display"] = { },
				["Mana Display"] = { },
				["Raid Health"] = true,
				["Raid Mana"] = true,
				["Dead Count"] = true,
				["Offline Count"] = true,
				["PvP Count"] = false,
				["Background"] = {
					["a"] = 0.7
				}
			};
		end
		if ( this.value == "LockMeter" ) then
			CT_RAMenu_Options["temp"]["StatusMeters"]["Lock"] = not CT_RAMenu_Options["temp"]["StatusMeters"]["Lock"];
			return;
		elseif ( this.value == "Hide" ) then
			CT_RAMenuFrameGeneralMiscShowMetersCB:SetChecked(false);
			CT_RAMenu_Options["temp"]["StatusMeters"]["Show"] = nil;
			CT_RARaidOverviewFrame:Hide();
			return;
		elseif ( this.value == "Opacity" ) then
			if ( not OpacityFrame:IsVisible() ) then
				CT_RARaidOverview.menuOpacityShow();
			else
				OpacityFrame:Hide();
			end
		end
		
		if ( type(this.value) == "table" ) then
			-- We have either HP or Mana Display/Totals/Combined
			if ( CT_RAMenu_Options["temp"]["StatusMeters"][this.value[1]] == nil ) then CT_RAMenu_Options["temp"]["StatusMeters"][this.value[1]] = { }; end
			CT_RAMenu_Options["temp"]["StatusMeters"][this.value[1]][this.value[2]] = not CT_RAMenu_Options["temp"]["StatusMeters"][this.value[1]][this.value[2]];
		else
			-- Just AFK Count/Dead Count
			CT_RAMenu_Options["temp"]["StatusMeters"][this.value] = not CT_RAMenu_Options["temp"]["StatusMeters"][this.value];
		end
		CT_RARaidOverview.updateBars();
	end,

	menuOpacityShow = function()
		OpacityFrame:ClearAllPoints();
		OpacityFrame:SetPoint("CENTER", "UIParent", "CENTER", 0, 0);
		OpacityFrameSlider:SetValue(CT_RAMenu_Options["temp"]["StatusMeters"]["Background"]["a"]);
		OpacityFrame.opacityFunc = CT_RARaidOverview.menuOpacitySet;
		OpacityFrame.saveOpacityFunc = CT_RARaidOverview.menuOpacitySave;
		OpacityFrame:Show();
	end,

	menuOpacitySet = function()
		local alpha = 1 - OpacityFrameSlider:GetValue();			
		if ( alpha < 0.2 ) then
			alpha = 0.2;
		end
			
		CT_RARaidOverviewFrame:SetAlpha(alpha);
	end,

	menuOpacitySave = function()
		local alpha = 1 - OpacityFrameSlider:GetValue();			
		if ( alpha < 0.2 ) then
			alpha = 0.2;
		end

		CT_RAMenu_Options["temp"]["StatusMeters"]["Background"]["a"] = alpha;
	end,

	isShowStatus = function()
		if ( ( CT_RARaidOverview.numRaidMembers > 0 or CT_RARaidOverview.numPartyMembers > 0 ) and CT_RAMenu_Options["temp"]["StatusMeters"]["Show"] ) then
			return true;
		elseif ( ( CT_RARaidOverview.numRaidMembers <= 0 and CT_RARaidOverview.numPartyMembers <= 0 ) or not CT_RAMenu_Options["temp"]["StatusMeters"]["Show"] ) then
			return false;
		end
	end,
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -