- added '/details wipe' slash command.

This commit is contained in:
Tercio
2015-08-11 17:11:46 -03:00
parent fb6620c9e5
commit 48f0f2ec26
5 changed files with 131 additions and 11 deletions
+6 -6
View File
File diff suppressed because one or more lines are too long
+20 -1
View File
@@ -31,6 +31,8 @@
local CONST_ITEMLEVEL_DATA = "IL"
local CONST_WIPE_CALL = "WI"
local CONST_CLOUD_REQUEST = "CR"
local CONST_CLOUD_FOUND = "CF"
local CONST_CLOUD_DATARQ = "CD"
@@ -47,6 +49,7 @@
["CLOUD_DATARQ"] = CONST_CLOUD_DATARQ,
["CLOUD_DATARC"] = CONST_CLOUD_DATARC,
["CLOUD_EQUALIZE"] = CONST_CLOUD_EQUALIZE,
["WIPE_CALL"] = CONST_WIPE_CALL,
}
local plugins_registred = {}
@@ -244,6 +247,15 @@
end
end
function _detalhes.network.Wipe_Call (player, realm, core_version, ...)
local chr_name = Ambiguate (player .. "-" .. realm, "none")
if (UnitIsGroupLeader (chr_name)) then
if (UnitIsInMyGuild (chr_name)) then
_detalhes:CallWipe()
end
end
end
_detalhes.network.functions = {
[CONST_HIGHFIVE_REQUEST] = _detalhes.network.HighFive_Request,
[CONST_HIGHFIVE_DATA] = _detalhes.network.HighFive_DataReceived,
@@ -255,6 +267,7 @@
[CONST_CLOUD_DATARQ] = _detalhes.network.Cloud_DataRequest,
[CONST_CLOUD_DATARC] = _detalhes.network.Cloud_DataReceived,
[CONST_CLOUD_EQUALIZE] = _detalhes.network.Cloud_Equalize,
[CONST_WIPE_CALL] = _detalhes.network.Wipe_Call,
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -396,8 +409,14 @@
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, player, realm, _detalhes.realversion, ...), "RAID")
end
function _detalhes:SendHomeRaidData (type, ...)
if (IsInRaid (LE_PARTY_CATEGORY_HOME) and IsInInstance()) then
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
end
end
function _detalhes:SendRaidData (type, ...)
if (IsInGroup (LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
if (IsInRaid (LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
else
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
+100 -2
View File
@@ -146,6 +146,8 @@
-- /run local f=CreateFrame("frame");f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");f:SetScript("OnEvent", function(self, ...)print (...);end)
-- /run local f=CreateFrame("frame");f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");f:SetScript("OnEvent",function(self, ...) local a = select(6, ...);if (a=="<chr name>")then print (...) end end)
-- /run local f=CreateFrame("frame");f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");f:SetScript("OnEvent",function(self, ...) local a = select(3, ...);print (a);if (a=="SPELL_CAST_SUCCESS")then print (...) end end)
function parser:spell_dmg (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand, multistrike)
@@ -2714,6 +2716,7 @@
--serach key: ~capture
_detalhes.capture_types = {"damage", "heal", "energy", "miscdata", "aura", "spellcast"}
_detalhes.capture_schedules = {}
function _detalhes:CaptureIsAllEnabled()
for _, _thisType in _ipairs (_detalhes.capture_types) do
@@ -2747,6 +2750,10 @@
function _detalhes:CaptureSet (on_off, capture_type, real, time)
if (on_off == nil) then
on_off = _detalhes.capture_real [capture_type]
end
if (real) then
--> hard switch
_detalhes.capture_real [capture_type] = on_off
@@ -2755,16 +2762,35 @@
--> soft switch
_detalhes.capture_current [capture_type] = on_off
if (time) then
_detalhes:ScheduleTimer ("CaptureTimeout", time, capture_type)
local schedule_id = math.random (1, 10000000)
local new_schedule = _detalhes:ScheduleTimer ("CaptureTimeout", time, {capture_type, schedule_id})
tinsert (_detalhes.capture_schedules, {new_schedule, schedule_id})
end
end
_detalhes:CaptureRefresh()
end
function _detalhes:CaptureTimeout (capture_type)
function _detalhes:CancelAllCaptureSchedules()
for i = 1, #_detalhes.capture_schedules do
local schedule_table, schedule_id = unpack (_detalhes.capture_schedules[i])
_detalhes:CancelTimer (schedule_table)
end
_table_wipe (_detalhes.capture_schedules)
end
function _detalhes:CaptureTimeout (table)
local capture_type, schedule_id = unpack (table)
_detalhes.capture_current [capture_type] = _detalhes.capture_real [capture_type]
_detalhes:CaptureRefresh()
for index, table in ipairs (_detalhes.capture_schedules) do
local id = table [2]
if (schedule_id == id) then
tremove (_detalhes.capture_schedules, index)
break
end
end
end
function _detalhes:CaptureDisable (capture_type)
@@ -2971,6 +2997,61 @@
end
end
end
function _detalhes:CallWipe (from_slash)
if (_detalhes.wipe_called) then
if (from_slash) then
return _detalhes:Msg (Loc ["STRING_WIPE_ERROR1"])
else
return
end
elseif (not _detalhes.encounter_table.id) then
if (from_slash) then
return _detalhes:Msg (Loc ["STRING_WIPE_ERROR2"])
else
return
end
end
local eTable = _detalhes.encounter_table
--> finish the encounter
local successful_ended = _detalhes.parser_functions:ENCOUNTER_END (eTable.id, eTable.name, eTable.diff, eTable.size, 0)
if (successful_ended) then
--> we wiped
_detalhes.wipe_called = true
--> cancel the on going captures schedules
_detalhes:CancelAllCaptureSchedules()
--> disable it
_detalhes:CaptureSet (false, "damage", false)
_detalhes:CaptureSet (false, "energy", false)
_detalhes:CaptureSet (false, "aura", false)
_detalhes:CaptureSet (false, "energy", false)
_detalhes:CaptureSet (false, "spellcast", false)
if (from_slash) then
if (UnitIsGroupLeader ("player")) then
_detalhes:SendHomeRaidData ("WI")
end
end
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (lower_instance) then
lower_instance = _detalhes:GetInstance (lower_instance)
lower_instance:InstanceAlert (Loc ["STRING_WIPE_ALERT"], {[[Interface\CHARACTERFRAME\UI-StateIcon]], 18, 18, false, 0.5, 1, 0, 0.5}, 4)
end
else
if (from_slash) then
return _detalhes:Msg (Loc ["STRING_WIPE_ERROR3"])
else
return
end
end
end
-- PARSER
--serach key: ~parser ~events ~start ~inicio
@@ -3189,6 +3270,8 @@
end
_table_wipe (_detalhes.encounter_table)
return true
end
function _detalhes.parser_functions:UNIT_PET (...)
@@ -3290,6 +3373,21 @@
instancia:SetCombatAlpha (nil, nil, true)
end
end
if (_detalhes.wipe_called) then
_detalhes.wipe_called = nil
_detalhes:CaptureSet (nil, "damage", true)
_detalhes:CaptureSet (nil, "energy", true)
_detalhes:CaptureSet (nil, "aura", true)
_detalhes:CaptureSet (nil, "energy", true)
_detalhes:CaptureSet (nil, "spellcast", true)
_detalhes:CaptureSet (false, "damage", false, 10)
_detalhes:CaptureSet (false, "energy", false, 10)
_detalhes:CaptureSet (false, "aura", false, 10)
_detalhes:CaptureSet (false, "energy", false, 10)
_detalhes:CaptureSet (false, "spellcast", false, 10)
end
end
+1 -1
View File
@@ -720,7 +720,7 @@ function DetailsDropDownOnMouseDown (button)
end
end
if (object.myvaluelabel and currentIndex) then
if (object.myvaluelabel and currentIndex and scrollFrame.slider:IsShown()) then
object.scroll:SetValue (max ((currentIndex*20) - 80, 0))
else
object.scroll:SetValue (0)
+4 -1
View File
@@ -17,7 +17,10 @@ function SlashCmdList.DETAILS (msg, editbox)
local command, rest = msg:match("^(%S*)%s*(.-)$")
command = string.lower (command)
if (command == Loc ["STRING_SLASH_NEW"] or command == "new") then
if (command == Loc ["STRING_SLASH_WIPE"] or command == "wipe") then
_detalhes:CallWipe (true)
elseif (command == Loc ["STRING_SLASH_NEW"] or command == "new") then
_detalhes:CriarInstancia (nil, true)
elseif (command == Loc ["STRING_SLASH_HISTORY"] or command == "history") then