- Added real time compile error while writing a custom script.
- Added protection on compiling a custom script to show in the window, an error text should be printed to chat window. - Added events: COMM_EVENT_RECEIVED and COMM_EVENT_SENT. - When options panel is not in the screen, the script will attempt to fix the position. - While doing a sync on guild statistics, more information about the download is shown.
This commit is contained in:
+16
-2
@@ -127,7 +127,7 @@
|
||||
if (_detalhes.host_by) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if (realm ~= _GetRealmName()) then
|
||||
player = player .."-"..realm
|
||||
end
|
||||
@@ -403,15 +403,20 @@
|
||||
_detalhes:Msg ("(debug) network received:", prefix, "length:",string.len (data))
|
||||
end
|
||||
|
||||
--event
|
||||
_detalhes:SendEvent ("COMM_EVENT_RECEIVED", nil, string.len (data), prefix, player, realm, dversion, arg6, arg7, arg8, arg9)
|
||||
|
||||
--print ("comm received", prefix, _detalhes.network.functions [prefix])
|
||||
|
||||
local func = _detalhes.network.functions [prefix]
|
||||
if (func) then
|
||||
--todo: this call should be safe
|
||||
func (player, realm, dversion, arg6, arg7, arg8, arg9)
|
||||
else
|
||||
func = plugins_registred [prefix]
|
||||
--print ("plugin comm?", func, player, realm, dversion, arg6, arg7, arg8, arg9)
|
||||
if (func) then
|
||||
--todo: this call should be safe
|
||||
func (player, realm, dversion, arg6, arg7, arg8, arg9)
|
||||
else
|
||||
if (_detalhes.debug) then
|
||||
@@ -420,9 +425,18 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
_detalhes:RegisterComm ("DTLS", "CommReceived")
|
||||
|
||||
--> hook the send comm message so we can trigger events when sending data
|
||||
--> this adds overhead, but easily catches all outgoing comm messages
|
||||
hooksecurefunc (Details, "SendCommMessage", function (context, addonPrefix, serializedData, channel)
|
||||
--unpack data
|
||||
local prefix, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (serializedData))
|
||||
--send the event
|
||||
_detalhes:SendEvent ("COMM_EVENT_SENT", nil, string.len (serializedData), prefix, player, realm, dversion, arg6, arg7, arg8, arg9)
|
||||
end)
|
||||
|
||||
function _detalhes:RegisterPluginComm (prefix, func)
|
||||
assert (type (prefix) == "string" and string.len (prefix) >= 2 and string.len (prefix) <= 4, "RegisterPluginComm expects a string with 2-4 characters on #1 argument.")
|
||||
assert (type (func) == "function" or (type (func) == "string" and type (self [func]) == "function"), "RegisterPluginComm expects a function or function name on #2 argument.")
|
||||
|
||||
+12
-2
@@ -483,7 +483,8 @@
|
||||
bigdogRow:SetHeight (20)
|
||||
bigdogRow:SetColorTexture (.5, .5, .5, .1)
|
||||
bigdogRow:Hide()
|
||||
|
||||
|
||||
--
|
||||
--> plugins menu title bar
|
||||
local titlebar_plugins = CreateFrame ("frame", nil, menuBackground)
|
||||
titlebar_plugins:SetPoint ("topleft", menuBackground, "topleft", 2, -3)
|
||||
@@ -510,7 +511,16 @@
|
||||
|
||||
--> scripts
|
||||
f:SetScript ("OnShow", function()
|
||||
|
||||
--check if the window isn't out of screen
|
||||
C_Timer.After (1, function()
|
||||
local right = f:GetRight()
|
||||
if (right and right > GetScreenWidth() + 500) then
|
||||
f:ClearAllPoints()
|
||||
f:SetPoint ("center", UIParent, "center", 0, 0)
|
||||
LibWindow.SavePosition (f)
|
||||
_detalhes:Msg ("detected options panel out of screen, position has reset")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
f:SetScript ("OnHide", function()
|
||||
|
||||
+50
-1
@@ -25,6 +25,9 @@
|
||||
|
||||
local end_window_spacement = 0
|
||||
|
||||
--prefix used on sync statistics
|
||||
local CONST_GUILD_SYNC = "GS"
|
||||
|
||||
--> settings
|
||||
|
||||
local animation_speed = 33
|
||||
@@ -1170,7 +1173,7 @@
|
||||
|
||||
|
||||
|
||||
--> raid history window ~history
|
||||
--> raid history window ~history ~statistics
|
||||
|
||||
function _detalhes:InitializeRaidHistoryWindow()
|
||||
local DetailsRaidHistoryWindow = CreateFrame ("frame", "DetailsRaidHistoryWindow", UIParent)
|
||||
@@ -1351,6 +1354,13 @@
|
||||
GuildRankCheckBox:SetAsCheckBox()
|
||||
|
||||
local guild_sync = function()
|
||||
|
||||
f.RequestedAmount = 0
|
||||
f.DownloadedAmount = 0
|
||||
f.EstimateSize = 0
|
||||
f.DownloadedSize = 0
|
||||
f.SyncStartTime = time()
|
||||
|
||||
_detalhes.storage:DBGuildSync()
|
||||
f.GuildSyncButton:Disable()
|
||||
|
||||
@@ -1408,6 +1418,45 @@
|
||||
GuildSyncButton:SetPoint ("topright", f, "topright", -20, -34)
|
||||
GuildSyncButton:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4)
|
||||
|
||||
--> listen to comm events
|
||||
local eventListener = _detalhes:CreateEventListener()
|
||||
|
||||
function eventListener:OnCommReceived (event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, data)
|
||||
if (prefix == CONST_GUILD_SYNC) then
|
||||
--received a list of encounter IDs
|
||||
if (guildSyncID == "L") then
|
||||
|
||||
--received one encounter table
|
||||
elseif (guildSyncID == "A") then
|
||||
f.DownloadedAmount = f.DownloadedAmount + 1
|
||||
|
||||
--size = 1 byte per characters in the string
|
||||
f.EstimateSize = length * f.RequestedAmount > f.EstimateSize and length * f.RequestedAmount or f.RequestedAmount
|
||||
f.DownloadedSize = f.DownloadedSize + length
|
||||
local downloadSpeed = f.DownloadedSize / (time() - f.SyncStartTime)
|
||||
|
||||
f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format ("%.2f", downloadSpeed/1024) .. "Kbps]")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function eventListener:OnCommSent (event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, missingIDs, arg8, arg9)
|
||||
if (prefix == CONST_GUILD_SYNC) then
|
||||
--requested a list of encounters
|
||||
if (guildSyncID == "R") then
|
||||
|
||||
|
||||
--requested to download a selected list of encounter tables
|
||||
elseif (guildSyncID == "G") then
|
||||
f.RequestedAmount = f.RequestedAmount + #missingIDs
|
||||
f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. "]")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
eventListener:RegisterEvent ("COMM_EVENT_RECEIVED", "OnCommReceived")
|
||||
eventListener:RegisterEvent ("COMM_EVENT_SENT", "OnCommSent")
|
||||
|
||||
function f.BuildReport()
|
||||
if (f.LatestResourceTable) then
|
||||
local reportFunc = function (IsCurrent, IsReverse, AmtLines)
|
||||
|
||||
Reference in New Issue
Block a user