updates
This commit is contained in:
+35
-13
@@ -11,8 +11,15 @@
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> details api functions
|
||||
function _detalhes:GetPlugin (PAN) --plugin absolute name
|
||||
return _detalhes.SoloTables.NameTable [PAN] or _detalhes.RaidTables.NameTable [PAN] or _detalhes.ToolBar.NameTable [PAN] or _detalhes.StatusBar.NameTable [PAN]
|
||||
end
|
||||
|
||||
function _detalhes:GetPluginSavedTable (PluginAbsoluteName)
|
||||
return _detalhes.plugin_database [PluginAbsoluteName]
|
||||
end
|
||||
|
||||
function _detalhes:InstallPlugin (PluginType, PluginName, PluginIcon, PluginObject, PluginAbsoluteName, MinVersion)
|
||||
function _detalhes:InstallPlugin (PluginType, PluginName, PluginIcon, PluginObject, PluginAbsoluteName, MinVersion, Author, Version)
|
||||
|
||||
if (MinVersion and MinVersion > _detalhes.realversion) then
|
||||
print (PluginName, Loc ["STRING_TOOOLD"])
|
||||
@@ -39,8 +46,22 @@
|
||||
PluginObject.real_name = PluginAbsoluteName
|
||||
end
|
||||
|
||||
PluginObject.__name = PluginName
|
||||
PluginObject.__author = Author or "--------"
|
||||
PluginObject.__version = Version or "v1.0.0"
|
||||
PluginObject.__icon = PluginIcon or [[Interface\ICONS\Trade_Engineering]]
|
||||
PluginObject.real_name = PluginAbsoluteName
|
||||
|
||||
if (PluginType ~= "STATUSBAR") then
|
||||
local saved_table = _detalhes.plugin_database [PluginAbsoluteName]
|
||||
if (not saved_table) then
|
||||
saved_table = {enabled = true, author = Author or "--------"}
|
||||
_detalhes.plugin_database [PluginAbsoluteName] = saved_table
|
||||
end
|
||||
|
||||
PluginObject.__enabled = saved_table.enabled
|
||||
end
|
||||
|
||||
if (PluginType == "SOLO") then
|
||||
if (not PluginObject.Frame) then
|
||||
return _detalhes:NewError ("plugin doesn't have a Frame, please check case-sensitive member name: Frame")
|
||||
@@ -48,37 +69,32 @@
|
||||
|
||||
--> Install Plugin
|
||||
_detalhes.SoloTables.Plugins [#_detalhes.SoloTables.Plugins+1] = PluginObject
|
||||
_detalhes.SoloTables.Menu [#_detalhes.SoloTables.Menu+1] = {PluginName, PluginIcon}
|
||||
_detalhes.SoloTables.Menu [#_detalhes.SoloTables.Menu+1] = {PluginName, PluginIcon, PluginObject, PluginAbsoluteName}
|
||||
_detalhes.SoloTables.NameTable [PluginAbsoluteName] = PluginObject
|
||||
_detalhes:SendEvent ("INSTALL_OKEY", PluginObject)
|
||||
|
||||
_detalhes.PluginCount.SOLO = _detalhes.PluginCount.SOLO + 1
|
||||
|
||||
return true
|
||||
|
||||
|
||||
elseif (PluginType == "TANK") then
|
||||
|
||||
--> Install Plugin
|
||||
_detalhes.RaidTables.Plugins [#_detalhes.RaidTables.Plugins+1] = PluginObject
|
||||
_detalhes.RaidTables.Menu [#_detalhes.RaidTables.Menu+1] = {PluginName, PluginIcon}
|
||||
_detalhes.RaidTables.Menu [#_detalhes.RaidTables.Menu+1] = {PluginName, PluginIcon, PluginObject, PluginAbsoluteName}
|
||||
_detalhes.RaidTables.NameTable [PluginAbsoluteName] = PluginObject
|
||||
_detalhes:SendEvent ("INSTALL_OKEY", PluginObject)
|
||||
|
||||
_detalhes.PluginCount.RAID = _detalhes.PluginCount.RAID + 1
|
||||
|
||||
return true
|
||||
|
||||
elseif (PluginType == "TOOLBAR") then
|
||||
|
||||
--> Install Plugin
|
||||
_detalhes.ToolBar.Plugins [#_detalhes.ToolBar.Plugins+1] = PluginObject
|
||||
_detalhes.ToolBar.Menu [#_detalhes.ToolBar.Menu+1] = {PluginName, PluginIcon, PluginObject, PluginAbsoluteName}
|
||||
_detalhes.ToolBar.NameTable [PluginAbsoluteName] = PluginObject
|
||||
_detalhes:SendEvent ("INSTALL_OKEY", PluginObject)
|
||||
|
||||
_detalhes.PluginCount.TOOLBAR = _detalhes.PluginCount.TOOLBAR + 1
|
||||
|
||||
return true
|
||||
|
||||
elseif (PluginType == "STATUSBAR") then
|
||||
|
||||
--> Install Plugin
|
||||
@@ -88,10 +104,16 @@
|
||||
_detalhes:SendEvent ("INSTALL_OKEY", PluginObject)
|
||||
|
||||
_detalhes.PluginCount.STATUSBAR = _detalhes.PluginCount.STATUSBAR + 1
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if (PluginObject.__enabled) then
|
||||
_detalhes:SendEvent ("PLUGIN_ENABLED", PluginObject)
|
||||
else
|
||||
_detalhes:SendEvent ("PLUGIN_DISABLED", PluginObject)
|
||||
end
|
||||
|
||||
return true, saved_table
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -137,7 +159,7 @@
|
||||
function _detalhes:NewPluginObject (FrameName, PluginOptions, PluginType)
|
||||
|
||||
PluginOptions = PluginOptions or 0x0
|
||||
local NewPlugin = {__options = PluginOptions}
|
||||
local NewPlugin = {__options = PluginOptions, __enabled = true}
|
||||
|
||||
local Frame = CreateFrame ("Frame", FrameName, UIParent)
|
||||
Frame:RegisterEvent ("ADDON_LOADED")
|
||||
|
||||
Reference in New Issue
Block a user