Packr Utility on Coach mode and Vanguard massive update

This commit is contained in:
Tercio Jose
2021-06-22 17:00:09 -03:00
parent 8b2501309f
commit b596445ace
18 changed files with 2386 additions and 1127 deletions
+84
View File
@@ -0,0 +1,84 @@
local Details = _G._detalhes
local DF = _G.DetailsFramework
local _
--local AceComm = LibStub ("AceComm-3.0")
--local AceSerializer = LibStub ("AceSerializer-3.0")
local Loc = LibStub("AceLocale-3.0"):GetLocale("Details")
local CONST_MENU_X_POSITION = 10
local CONST_MENU_Y_POSITION = -40
local CONST_MENU_WIDTH = 160
local CONST_MENU_HEIGHT = 20
local CONST_INFOBOX_X_POSITION = 220
local CONST_EDITBUTTONS_X_POSITION = 560
local CONST_EDITBOX_Y_POSITION = -200
local CONST_EDITBOX_WIDTH = 900
local CONST_EDITBOX_HEIGHT = 370
local CONST_EDITBOX_BUTTON_WIDTH = 80
local CONST_EDITBOX_BUTTON_HEIGHT = 20
local CONST_BUTTON_TEMPLATE = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local CONST_TEXTENTRY_TEMPLATE = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
DF:InstallTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BUTTONS",
{
icon = {texture = [[Interface\BUTTONS\UI-GuildButton-PublicNote-Up]]},
width = 160,
},
"DETAILS_PLUGIN_BUTTON_TEMPLATE"
)
DF:InstallTemplate ("button", "DETAILS_CUSTOMDISPLAY_REGULAR_BUTTON",
{
width = 130,
},
"DETAILS_PLUGIN_BUTTON_TEMPLATE"
)
DF:InstallTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX", {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdropcolor = {.2, .2, .2, 0.6},
backdropbordercolor = {0, 0, 0, 1},
})
DF:InstallTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX_EXPANDED", {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdropcolor = {.2, .2, .2, 1},
backdropbordercolor = {0, 0, 0, 1},
})
DF:InstallTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX_BUTTON", {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdropcolor = {.2, .2, .2, 1},
backdropbordercolor = {0, 0, 0, 1},
})
DF:NewColor ("DETAILS_CUSTOMDISPLAY_ICON", .7, .6, .5, 1)
local CONST_CODETEXTENTRY_TEMPLATE = DF:GetTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX")
local CONST_CODETEXTENTRYEXPANDED_TEMPLATE = DF:GetTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX_EXPANDED")
local CONST_CODETEXTENTRYBUTTON_TEMPLATE = DF:GetTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX_BUTTON")
local CONST_CODETEXTENTRY_OPENCODEBUTTONS_TEMPLATE = DF:GetTemplate ("button", "DETAILS_CUSTOMDISPLAY_CODE_BUTTONS")
local CONST_REGULAR_BUTTON_TEMPLATE = DF:GetTemplate ("button", "DETAILS_CUSTOMDISPLAY_REGULAR_BUTTON")
--new script button
--search script box
--control buttons like import, export, delete, restore
--build the left menu, this menu has all scripts to edit
--build the script properties panel with name, icon, etc
--
+66 -15
View File
@@ -217,6 +217,20 @@ do
local sub_attribute = self.sub_attribute
local instance = all_switch.instance
--check if is a plugin button
if (self.isPlugin) then
if (_detalhes.RaidTables.NameTable[self.pluginName]) then
_detalhes.RaidTables:EnableRaidMode (instance, self.pluginName)
elseif (_detalhes.SoloTables.NameTable [self.pluginName]) then
_detalhes.SoloTables:EnableSoloMode (instance, self.pluginName)
else
_detalhes:Msg ("Plugin not found.")
end
all_switch:Hide()
return
end
if (instance.modo == _detalhes._detalhes_props["MODO_ALONE"] or instance.modo == _detalhes._detalhes_props["MODO_RAID"]) then
instance:AlteraModo (instance, 2)
end
@@ -415,11 +429,15 @@ do
end
--> update plugins
local script_index = 6
local script_index = _detalhes.atributos[0]+2
local button_index = 1
all_switch.x = all_switch.x + 130
all_switch.y = -28
for _, button in ipairs (all_switch.buttons[script_index]) do
button:Hide()
end
--build raid plugins list
local raidPlugins = _detalhes.RaidTables:GetAvailablePlugins()
if (#raidPlugins >= 0) then
@@ -427,8 +445,6 @@ do
--if a plugin has the member 'NoMenu', it won't be shown on menus to select plugins
if (ptable[3].__enabled and not ptable[3].NoMenu) then
--PluginName, PluginIcon, PluginObject, PluginAbsoluteName
--CoolTip:AddMenu (2, _detalhes.RaidTables.EnableRaidMode, instancia, ptable[4], true, ptable[1], ptable[2], true)
local button = all_switch.buttons [script_index] [button_index]
if (not button) then
button = create_all_switch_button(script_index, button_index, all_switch.x, all_switch.y)
@@ -436,6 +452,10 @@ do
all_switch.y = all_switch.y - 17
end
--set the button to select the plugin
button.isPlugin = true
button.pluginName = ptable[4]
button.text:SetText(ptable[1])
all_switch.check_text_size(button.text)
button.texture:SetTexture (ptable[2])
@@ -1055,9 +1075,27 @@ function _detalhes:FastSwitch (button, bookmark, bookmark_number, select_new)
end
if (bookmark.atributo == "plugin") then
--> is a plugin, check if is a raid or solo plugin
if (_detalhes.RaidTables.NameTable [bookmark.sub_atributo]) then
_detalhes.RaidTables:EnableRaidMode (_detalhes.switch.current_instancia, bookmark.sub_atributo)
local raidPlugins = _detalhes.RaidTables:GetAvailablePlugins()
local isAvailable = false
if (#raidPlugins >= 0) then
for i, ptable in ipairs (raidPlugins) do
--check if the plugin is available
if (ptable[4] == bookmark.sub_atributo) then
isAvailable = true
end
end
end
if (isAvailable) then
_detalhes.RaidTables:EnableRaidMode (_detalhes.switch.current_instancia, bookmark.sub_atributo)
else
Details:Msg("plugin already in use in another window. If you are wondering where, check the Orange Gear > Window Control.") --localize-me
end
elseif (_detalhes.SoloTables.NameTable [bookmark.sub_atributo]) then
_detalhes.SoloTables:EnableSoloMode (_detalhes.switch.current_instancia, bookmark.sub_atributo)
else
@@ -1145,6 +1183,7 @@ function _detalhes.switch:Update()
local name
local vcolor
local add
local textColor = "white"
if (options and options.sub_atributo) then
if (options.atributo == 5) then --> custom
@@ -1163,12 +1202,31 @@ function _detalhes.switch:Update()
end
elseif (options.atributo == "plugin") then --> plugin
local plugin = _detalhes:GetPlugin (options.sub_atributo)
if (plugin) then
local raidPlugins = _detalhes.RaidTables:GetAvailablePlugins()
local isAvailable = false
if (#raidPlugins >= 0) then
for i, ptable in ipairs (raidPlugins) do
--check if the plugin is available
if (ptable[4] == plugin.real_name) then
isAvailable = true
end
end
end
if (isAvailable) then
vcolor = vertex_color_default
else
vcolor = {.35, .35, .35, .35}
textColor = "gray"
end
icone = plugin.__icon
coords = default_coords
name = plugin.__name
vcolor = vertex_color_default
else
icone = [[Interface\AddOns\Details\images\icons]]
coords = add_coords
@@ -1208,6 +1266,7 @@ function _detalhes.switch:Update()
end
button.button2.texto:SetSize (width, height)
DetailsFramework:SetFontColor(button.button2.texto, textColor)
button.textureNormal:SetTexture (icone, true)
button.textureNormal:SetTexCoord (_unpack (coords))
@@ -1453,7 +1512,7 @@ end
local left_box_on_click = function (self, button)
if (button == "RightButton") then
--select another bookmark
_detalhes:FastSwitch (self, bookmark, self.bookmark_number, true)
_detalhes:FastSwitch (self, nil, self.bookmark_number, true)
else
--change the display
local bookmark = _detalhes.switch.table [self.bookmark_number]
@@ -1490,14 +1549,6 @@ local change_icon = function (self, icon1, icon2, icon3, icon4)
end
function _detalhes.switch:NewSwitchButton (frame, index, x, y, rightButton)
local paramTable = {
["instancia"] = _detalhes.switch.current_instancia,
["button"] = index,
["atributo"] = nil,
["sub_atributo"] = nil
}
--botao dentro da caixa
local button = CreateFrame ("button", "DetailsSwitchPanelButton_1_"..index, frame, "BackdropTemplate") --botao com o icone
button:SetSize (15, 24)
@@ -1577,4 +1628,4 @@ function _detalhes.switch:NewSwitchButton (frame, index, x, y, rightButton)
return button
end
--doa