📄 titandamagemeters.lua
字号:
-- Menu title TitanPanelRightClickMenu_AddTitle(TITAN_DAMAGEMETERS_MENU_TEXT); TitanPanelRightClickMenu_AddCommand("Reset Window Position",TITAN_DAMAGEMETERS_ID, "DamageMeters_ResetPos"); TitanPanelRightClickMenu_AddCommand("Clear List",TITAN_DAMAGEMETERS_ID, "DamageMeters_Clear"); -- A blank line in the menu TitanPanelRightClickMenu_AddSpacer(); -- Generic function to toggle icon TitanPanelRightClickMenu_AddToggleIcon(TITAN_DAMAGEMETERS_ID); -- Generic function to toggle label text TitanPanelRightClickMenu_AddToggleLabelText(TITAN_DAMAGEMETERS_ID); -- A blank line in the menu TitanPanelRightClickMenu_AddSpacer(); -- Value menu info = {}; info.text = "Values"; info.hasArrow = 1; UIDropDownMenu_AddButton(info); -- Rank menu info = {}; info.text = "Ranks"; info.hasArrow = 1; UIDropDownMenu_AddButton(info); -- Leaders menu info = {}; info.text = "Leaders"; info.hasArrow = 1; UIDropDownMenu_AddButton(info); -- A blank line in the menu TitanPanelRightClickMenu_AddSpacer(); -- Generic function to hide the plugin TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_DAMAGEMETERS_ID, TITAN_PANEL_MENU_FUNC_HIDE); end endend-- Setup Right Click Menu For Right Side Buttonfunction TitanPanelRightClickMenu_PrepareDamageMetersRightMenu() if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then if ( UIDROPDOWNMENU_MENU_LEVEL == 2 ) then if (UIDROPDOWNMENU_MENU_VALUE == "Values") then local quant; for quant = 1, DamageMeters_Quantity_MAX do info = {}; info.text = DamageMeters_GetQuantityString(quant, true); info.value = quant; info.func = TitanPanelDamageMeters_SetValueOption; info.checked = TitanPanelDamageMeters_IsValueShown(quant); info.keepShownOnClick = 1; UIDropDownMenu_AddButton(info,UIDROPDOWNMENU_MENU_LEVEL); end end if (UIDROPDOWNMENU_MENU_VALUE == "Ranks") then local quant; for quant = 1, DamageMeters_Quantity_MAX do info = {}; info.text = DamageMeters_GetQuantityString(quant, true); info.value = quant; info.func = TitanPanelDamageMeters_SetRankOption; info.checked = TitanPanelDamageMeters_IsRankShown(quant); info.keepShownOnClick = 1; UIDropDownMenu_AddButton(info,UIDROPDOWNMENU_MENU_LEVEL); end end if (UIDROPDOWNMENU_MENU_VALUE == "Leaders") then local quant; for quant = 1, DamageMeters_Quantity_MAX do info = {}; info.text = DamageMeters_GetQuantityString(quant, true); info.value = quant; info.func = TitanPanelDamageMeters_SetLeaderOption; info.checked = TitanPanelDamageMeters_IsLeaderShown(quant); info.keepShownOnClick = 1; UIDropDownMenu_AddButton(info,UIDROPDOWNMENU_MENU_LEVEL); end end else TitanPanelRightClickMenu_AddTitle(TITAN_DAMAGEMETERSRIGHT_MENU_TEXT); TitanPanelRightClickMenu_AddCommand("Reset Window Position",TITAN_DAMAGEMETERS_ID, "DamageMeters_ResetPos"); TitanPanelRightClickMenu_AddCommand("Clear List",TITAN_DAMAGEMETERS_ID, "DamageMeters_Clear"); -- A blank line in the menu TitanPanelRightClickMenu_AddSpacer(); -- Value menu info = {}; info.text = "Values"; info.hasArrow = 1; UIDropDownMenu_AddButton(info); -- Rank menu info = {}; info.text = "Ranks"; info.hasArrow = 1; UIDropDownMenu_AddButton(info); -- Leaders menu info = {}; info.text = "Leaders"; info.hasArrow = 1; UIDropDownMenu_AddButton(info); -- A blank line in the menu TitanPanelRightClickMenu_AddSpacer(); -- Generic function to hide the plugin TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_DAMAGEMETERSRIGHT_ID, TITAN_PANEL_MENU_FUNC_HIDE); end endend-- Gluefunction TitanDMPrintD(msg) DEFAULT_CHAT_FRAME:AddMessage(msg,0.50,0.50,1.00);endfunction IsDMLoaded() -- Renamed from GetStatus() to prevent possible conflicts with Titan Mod Support Project Core Functions local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo("DamageMeters") local _, _, _, titanEnabled, _, _, _ = GetAddOnInfo("Titan") -- Dand: Some mod called Bhaldie Infobar actually defines this function. :| -- Seems generally better to use the GetAddOnInfo function anyway. --if not TitanPanelButton_UpdateButton then -- If Titan is not running if not titanEnabled then -- If Titan is not running if not (enabled == 1) then -- If DamageMeters is not running TitanDMPrintD("DamageMeters: DamageMeters Not Loaded."); -- Print in the chat channel TitanDMPrintD("DamageMeters: Titan Not Loaded."); -- for both mods return 0; -- Return 0 else TitanDMPrintD("DamageMeters: Titan Not Loaded."); -- Otherwise just let us know that Titan is not running TitanDMPrintD("DamageMeters: Titan Plugin Not Available"); -- the plugin will not be available TitanDMPrintD("DamageMeters: DamageMeters Loaded OK."); -- but that DamageMeters loaded ok, return 1; -- and return 1 end elseif (enabled == 1) then -- Otherwise Titan is running, so check DamageMeters TitanDMPrintD("DamageMeters: Titan Loaded OK."); -- and if its running print in the chat channel TitanDMPrintD("DamageMeters: Titan Plugin Available"); -- for the plugin TitanDMPrintD("DamageMeters: DamageMeters Loaded OK."); -- and for both mods return 2; -- return 2 else -- otherwise Titan is running but DamageMeters is not TitanDMPrintD("DamageMeters: DamageMetersNot Loaded."); -- so let us know return 3; -- and return 3 endend-- Utility functionsfunction TitanPanelDamageMeters_SetValueOption() if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then shownValues = TitanGetVar(TITAN_DAMAGEMETERS_ID, "shownValues"); if (shownValues) then if (nil ~= shownValues[this.value]) then shownValues[this.value] = not shownValues[this.value]; else shownValues[this.value] = true; end end endendfunction TitanPanelDamageMeters_SetRankOption() if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then shownRanks = TitanGetVar(TITAN_DAMAGEMETERS_ID, "shownRanks"); if (shownRanks) then if (nil ~= shownRanks[this.value]) then shownRanks[this.value] = not shownRanks[this.value]; else shownRanks[this.value] = true; end end endendfunction TitanPanelDamageMeters_SetLeaderOption() if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then shownLeaders = TitanGetVar(TITAN_DAMAGEMETERS_ID, "shownLeaders"); if (shownLeaders) then if (nil ~= shownLeaders[this.value]) then shownLeaders[this.value] = not shownLeaders[this.value]; else shownLeaders[this.value] = true; end end endendfunction TitanPanelDamageMeters_IsValueShown(quant) if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then shownValues = TitanGetVar(TITAN_DAMAGEMETERS_ID, "shownValues"); if (shownValues) then if (shownValues[quant]) then return shownValues[quant]; end end return false; endendfunction TitanPanelDamageMeters_IsRankShown(quant) if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then shownRanks = TitanGetVar(TITAN_DAMAGEMETERS_ID, "shownRanks"); if (shownRanks) then if (shownRanks[quant]) then return shownRanks[quant]; end end return false; endendfunction TitanPanelDamageMeters_IsLeaderShown(quant) if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then shownLeaders = TitanGetVar(TITAN_DAMAGEMETERS_ID, "shownLeaders"); if (shownLeaders) then if (shownLeaders[quant]) then return shownLeaders[quant]; end end return false; endendfunction TitanPanelDamageMeters_GetValue(quantity) if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then return DamageMeters_GetQuantityValueString(quantity, UnitName("Player")); endendfunction TitanPanelDamageMeters_GetLeaderName(quant) if (TITAN_AND_DAMAGEMETERS_LOADED == 2) then for player, struct in pairs(DamageMeters_rankTables[DMT_ACTIVE]) do if (struct[quant] == 1) then return player; end end return "-"; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -