Added the baseline for the Coach Mode feature
- Added the command '/details coach' to enabled coach mode, need to be raid leader and all members must have details up to date. - Fixed Tiny Threat not showing threat. - Fixed annoucement interrupt toggle enable was reseting on logon. - Added container_spells:GetOrCreateSpell(id, shouldCreate, token) - Added Details:GetRaidLeader(), return the RL name. - Framework update.
This commit is contained in:
@@ -28,6 +28,7 @@ API.lua
|
||||
functions\profiles.lua
|
||||
functions\hooks.lua
|
||||
functions\bossmods.lua
|
||||
functions\coach.lua
|
||||
functions\skins.lua
|
||||
functions\boss.lua
|
||||
functions\spells.lua
|
||||
|
||||
+21
-2
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local dversion = 214
|
||||
local dversion = 215
|
||||
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
@@ -609,7 +609,26 @@ function DF:TruncateText (fontString, maxWidth)
|
||||
if (string.len (text) <= 1) then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DF:CleanTruncateUTF8String(text)
|
||||
fontString:SetText (text)
|
||||
end
|
||||
|
||||
function DF:CleanTruncateUTF8String(text)
|
||||
if type(text) == "string" and text ~= "" then
|
||||
local b1 = (#text > 0) and strbyte(strsub(text, #text, #text)) or nil
|
||||
local b2 = (#text > 1) and strbyte(strsub(text, #text-1, #text)) or nil
|
||||
local b3 = (#text > 2) and strbyte(strsub(text, #text-2, #text)) or nil
|
||||
if b1 and b1 >= 194 and b1 <= 244 then
|
||||
text = strsub (text, 1, #text - 1)
|
||||
elseif b2 and b2 >= 224 and b2 <= 244 then
|
||||
text = strsub (text, 1, #text - 2)
|
||||
elseif b3 and b3 >= 240 and b3 <= 244 then
|
||||
text = strsub (text, 1, #text - 3)
|
||||
end
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
function DF:Msg (msg, ...)
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
_ = nil
|
||||
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0")
|
||||
|
||||
_detalhes.build_counter = 7938
|
||||
_detalhes.alpha_build_counter = 7938 --if this is higher than the regular counter, use it instead
|
||||
_detalhes.build_counter = 7950
|
||||
_detalhes.alpha_build_counter = 7950 --if this is higher than the regular counter, use it instead
|
||||
_detalhes.game_version = "v9.0.1"
|
||||
_detalhes.userversion = "v9.0.1." .. _detalhes.build_counter
|
||||
_detalhes.realversion = 143 --core version, this is used to check API version for scripts and plugins (see alias below)
|
||||
_detalhes.realversion = 144 --core version, this is used to check API version for scripts and plugins (see alias below)
|
||||
_detalhes.APIVersion = _detalhes.realversion --core version
|
||||
_detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" --simple stirng to show to players
|
||||
|
||||
@@ -28,8 +28,16 @@ do
|
||||
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" )
|
||||
|
||||
local news = {
|
||||
{"v9.0.1.7950.144", "November 3rd, 2020"},
|
||||
"Added the baseline for the Coach feature, for testing use '/details coach', all users in the raid must have details! up to date.",
|
||||
"Added container_spells:GetOrCreateSpell(id, shouldCreate, token).",
|
||||
"Added Details:GetRaidLeader(), return the RL name.",
|
||||
"Fixed Tiny Threat not showing threat.",
|
||||
"Fixed annoucement interrupt enable toggle checkbox was reseting on logon.",
|
||||
|
||||
{"v9.0.1.7938.142", "October 29th, 2020"},
|
||||
"Added option to select the icon buttons in the title bar.",
|
||||
|
||||
{"v9.0.1.7739.142", "August 18th, 2020"},
|
||||
"More development on the new plugin Cast Timeline.",
|
||||
"More development on Details! Scroll Damage.",
|
||||
@@ -333,7 +341,7 @@ do
|
||||
--> player detail skin
|
||||
_detalhes.playerdetailwindow_skins = {}
|
||||
|
||||
_detalhes.BitfieldSwapDebuffsIDs = {265646, 272407, 269691, 273401, 269131, 260900, 260926, 284995, 292826, 311367, 310567, 308996, 307832, 327414}
|
||||
_detalhes.BitfieldSwapDebuffsIDs = {265646, 272407, 269691, 273401, 269131, 260900, 260926, 284995, 292826, 311367, 310567, 308996, 307832, 327414, 337253}
|
||||
|
||||
--> auto run code
|
||||
_detalhes.RunCodeTypes = {
|
||||
|
||||
@@ -608,13 +608,13 @@ end
|
||||
|
||||
if (not self.iniciada) then
|
||||
self:RestauraJanela (self.meu_id, nil, true) --parece que esta chamando o ativar instance denovo... passei true no load_only vamos ver o resultado
|
||||
--tiny threat parou de funcionar depois de /reload depois dessa mudança, talvez tenha algo para carregar ainda
|
||||
self.iniciada = true
|
||||
else
|
||||
_detalhes.opened_windows = _detalhes.opened_windows+1
|
||||
end
|
||||
|
||||
self:ChangeSkin() --carrega a skin aqui que era antes feito dentro do restaura janela
|
||||
|
||||
_detalhes:TrocaTabela (self, nil, nil, nil, true)
|
||||
|
||||
if (self.hide_icon) then
|
||||
@@ -634,7 +634,7 @@ end
|
||||
|
||||
if (not temp) then
|
||||
if (self.modo == modo_raid) then
|
||||
_detalhes.RaidTables:EnableRaidMode (self)
|
||||
_detalhes.RaidTables:EnableRaidMode(self)
|
||||
|
||||
elseif (self.modo == modo_alone) then
|
||||
self:SoloMode (true)
|
||||
@@ -656,6 +656,14 @@ end
|
||||
if (not temp and not _detalhes.initializing) then
|
||||
_detalhes:SendEvent ("DETAILS_INSTANCE_OPEN", nil, self)
|
||||
end
|
||||
|
||||
if (self.modo == modo_raid) then
|
||||
_detalhes.RaidTables:EnableRaidMode(self)
|
||||
|
||||
elseif (self.modo == modo_alone) then
|
||||
self:SoloMode (true)
|
||||
end
|
||||
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
|
||||
local GetNumDeclensionSets = _G.GetNumDeclensionSets
|
||||
local DeclineName = _G.DeclineName
|
||||
|
||||
local GetLocale = _G.GetLocale
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
@@ -438,7 +437,7 @@
|
||||
--if the user client is in russian language
|
||||
--make an attempt to remove declensions from the character's name
|
||||
--this is equivalent to remove 's from the owner on enUS
|
||||
if (GetLocale() == "ruRU") then
|
||||
if (CONST_CLIENT_LANGUAGE == "ruRU") then
|
||||
if (find_name_declension (text1, playerName)) then
|
||||
return find_pet_found_owner (pName, serial, nome, flag, self)
|
||||
else
|
||||
@@ -462,7 +461,7 @@
|
||||
local pName = playerName
|
||||
playerName = playerName:gsub ("%-.*", "") --remove realm name
|
||||
|
||||
if (GetLocale() == "ruRU") then
|
||||
if (CONST_CLIENT_LANGUAGE == "ruRU") then
|
||||
if (find_name_declension (text2, playerName)) then
|
||||
return find_pet_found_owner (pName, serial, nome, flag, self)
|
||||
else
|
||||
|
||||
@@ -59,7 +59,11 @@ local _
|
||||
return pairs (self._ActorTable)
|
||||
end
|
||||
|
||||
function container_habilidades:PegaHabilidade (id, criar, token, cria_shadow)
|
||||
function container_habilidades:GetOrCreateSpell(id, shouldCreate, token)
|
||||
return self:PegaHabilidade (id, shouldCreate, token)
|
||||
end
|
||||
|
||||
function container_habilidades:PegaHabilidade (id, criar, token)
|
||||
|
||||
local esta_habilidade = self._ActorTable [id]
|
||||
|
||||
@@ -68,7 +72,7 @@ local _
|
||||
else
|
||||
if (criar) then
|
||||
|
||||
local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token)
|
||||
local novo_objeto = self.funcao_de_criacao (nil, id, nil, token)
|
||||
|
||||
self._ActorTable [id] = novo_objeto
|
||||
|
||||
|
||||
@@ -1758,6 +1758,8 @@ function Details.Database.StoreEncounter(combat)
|
||||
local mybest2 = mybest[1] or 0
|
||||
local myBestDps = mybest2 / onencounter.elapsed
|
||||
|
||||
--[12:18:37] Details!: error occurred on Details.Database.StoreEncounter(): Interface\AddOns\Details\core\gears.lua:1758: attempt to index local 'mybest' (a nil value)
|
||||
|
||||
if (mybest) then
|
||||
local d_one = 0
|
||||
if (myrole == "DAMAGER" or myrole == "TANK") then
|
||||
|
||||
+79
-19
@@ -22,9 +22,7 @@
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local CONST_REALM_SYNC_ENABLED = false
|
||||
|
||||
local CONST_DETAILS_PREFIX = "DTLS"
|
||||
DETAILS_PREFIX_NETWORK = "DTLS"
|
||||
|
||||
local CONST_HIGHFIVE_REQUEST = "HI"
|
||||
local CONST_HIGHFIVE_DATA = "HF"
|
||||
@@ -48,6 +46,8 @@
|
||||
local CONST_PVP_ENEMY = "PP"
|
||||
|
||||
local CONST_ROGUE_SR = "SR" --soul rip from akaari's soul (LEGION ONLY)
|
||||
|
||||
DETAILS_PREFIX_COACH = "CO" --coach feature
|
||||
|
||||
_detalhes.network.ids = {
|
||||
["HIGHFIVE_REQUEST"] = CONST_HIGHFIVE_REQUEST,
|
||||
@@ -69,6 +69,8 @@
|
||||
["MISSDATA_ROGUE_SOULRIP"] = CONST_ROGUE_SR, --soul rip from akaari's soul (LEGION ONLY)
|
||||
|
||||
["CLOUD_SHAREDATA"] = CONST_CLOUD_SHAREDATA,
|
||||
|
||||
["COACH_FEATURE"] = DETAILS_PREFIX_COACH, --ask the raid leader is the coach is enbaled
|
||||
}
|
||||
|
||||
local plugins_registred = {}
|
||||
@@ -204,7 +206,7 @@
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) sent 'okey' answer for a cloud parser request.")
|
||||
end
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (_detalhes.network.ids.CLOUD_FOUND, _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "WHISPER", player)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (_detalhes.network.ids.CLOUD_FOUND, _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "WHISPER", player)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -263,7 +265,7 @@
|
||||
_detalhes:Msg ("(debug) requesting data from the cloud.")
|
||||
end
|
||||
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARC, atributo, atributo_name, export), "WHISPER", _detalhes.host_of)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARC, atributo, atributo_name, export), "WHISPER", _detalhes.host_of)
|
||||
_table_wipe (temp)
|
||||
end
|
||||
end
|
||||
@@ -366,6 +368,62 @@
|
||||
|
||||
end
|
||||
|
||||
--"CIEA" Coach Is Enabled Ask (client > server)
|
||||
--"CIER" Coach Is Enabled Response (server > client)
|
||||
--"CCS" Coach Combat Start (client > server)
|
||||
function _detalhes.network.Coach(player, realm, core_version, msgType, data)
|
||||
if (not IsInRaid()) then
|
||||
return
|
||||
end
|
||||
|
||||
local sourcePlayer = Ambiguate(player .. "-" .. realm, "none")
|
||||
local playerName = UnitName("player")
|
||||
if (playerName == sourcePlayer) then
|
||||
return
|
||||
end
|
||||
|
||||
if (core_version ~= _detalhes.realversion) then
|
||||
if (core_version > _detalhes.realversion) then
|
||||
Details:Msg ("your Details! is out dated and cannot use Coach feature.")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
if (msgType == "CIEA") then --Coach Is Enabled Ask (regular player asked to raid leader)
|
||||
--check if the player that received the msg is the raid leader
|
||||
if (UnitIsGroupLeader("player")) then
|
||||
return
|
||||
end
|
||||
|
||||
--send the answer
|
||||
Details:SendCommMessage(DETAILS_PREFIX_NETWORK, Details:Serialize(DETAILS_PREFIX_COACH, playerName, GetRealmName(), Details.realversion, "CIER", Details.Coach.Server.IsEnabled()), "WHISPER", sourcePlayer)
|
||||
|
||||
elseif (msgType == "CIER") then --Coach Is Enabled Response (regular player received a raid leader response)
|
||||
local isEnabled = data
|
||||
Details.Coach.Client.CoachIsEnabled_Response(isEnabled, sourcePlayer)
|
||||
|
||||
elseif (msgType == "CCS") then --Coach Combat Start (raid assistant told the raid leader a combat started)
|
||||
Details.Coach.Server.CombatStarted()
|
||||
|
||||
elseif (msgType == "CCE") then --Coach Combat End (raid assistant told the raid leader a combat ended)
|
||||
Details.Coach.Server.CombatEnded()
|
||||
|
||||
elseif (msgType == "CS") then --Coach Start (raid leader notifying other members of the group)
|
||||
Details.Coach.Client.EnableCoach(sourcePlayer)
|
||||
|
||||
elseif (msgType == "CE") then --Coach End (raid leader notifying other members of the group)
|
||||
Details.Coach.Client.CoachEnd()
|
||||
|
||||
elseif (msgType == "CDT") then --Coach Data (a player in the raid sent to raid leader combat data)
|
||||
if (UnitIsGroupLeader("player")) then
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
--update the current combat with new information
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--guild sync R = someone pressed the sync button
|
||||
--guild sync L = list of fights IDs
|
||||
--guild sync G = requested a list of encounters
|
||||
@@ -397,7 +455,7 @@
|
||||
if (IDs and IDs [1]) then
|
||||
local from = UnitName ("player")
|
||||
local realm = GetRealmName()
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "L", IDs), "WHISPER", chr_name)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "L", IDs), "WHISPER", chr_name)
|
||||
end
|
||||
|
||||
_detalhes.LastGuildSyncDataTime1 = GetTime() + 60
|
||||
@@ -409,7 +467,7 @@
|
||||
if (MissingIDs and MissingIDs [1]) then
|
||||
local from = UnitName ("player")
|
||||
local realm = GetRealmName()
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "G", MissingIDs), "WHISPER", chr_name)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "G", MissingIDs), "WHISPER", chr_name)
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -429,7 +487,7 @@
|
||||
local from = UnitName ("player")
|
||||
local realm = GetRealmName()
|
||||
--todo: need to check if the target is still online
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "A", data), "WHISPER", task.Target)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "A", data), "WHISPER", task.Target)
|
||||
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) [RoS-EncounterSync] send-task sending data #" .. task.TickID .. ".")
|
||||
@@ -497,6 +555,8 @@
|
||||
[CONST_ROGUE_SR] = _detalhes.network.HandleMissData, --soul rip from akaari's soul (LEGION ONLY)
|
||||
|
||||
[CONST_PVP_ENEMY] = _detalhes.network.ReceivedEnemyPlayer,
|
||||
|
||||
[DETAILS_PREFIX_COACH] = _detalhes.network.Coach, --coach feature
|
||||
}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -630,12 +690,12 @@
|
||||
--> doesn't have realm at all, so we assume the actor is in same realm as player
|
||||
realm = _GetRealmName()
|
||||
end
|
||||
_detalhes:SendCommMessage(CONST_DETAILS_PREFIX, _detalhes:Serialize (type, player, realm, _detalhes.realversion, ...), "RAID")
|
||||
_detalhes:SendCommMessage(DETAILS_PREFIX_NETWORK, _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")
|
||||
_detalhes:SendCommMessage(DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -644,12 +704,12 @@
|
||||
local isInInstanceGroup = IsInRaid (LE_PARTY_CATEGORY_INSTANCE)
|
||||
|
||||
if (isInInstanceGroup) then
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) sent comm to INSTANCE raid group")
|
||||
end
|
||||
else
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) sent comm to LOCAL raid group")
|
||||
end
|
||||
@@ -661,12 +721,12 @@
|
||||
local isInInstanceGroup = IsInGroup (LE_PARTY_CATEGORY_INSTANCE)
|
||||
|
||||
if (isInInstanceGroup) then
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) sent comm to INSTANCE party group")
|
||||
end
|
||||
else
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "PARTY")
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "PARTY")
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) sent comm to LOCAL party group")
|
||||
end
|
||||
@@ -684,7 +744,7 @@
|
||||
|
||||
function _detalhes:SendGuildData (type, ...)
|
||||
if not IsInGuild() then return end --> fix from Tim@WoWInterface
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "GUILD")
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "GUILD")
|
||||
end
|
||||
|
||||
|
||||
@@ -712,16 +772,16 @@
|
||||
if (instancia.ativa) then
|
||||
local atributo = instancia.atributo
|
||||
if (atributo == 1 and not _detalhes:CaptureGet ("damage")) then
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
break
|
||||
elseif (atributo == 2 and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura"))) then
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
break
|
||||
elseif (atributo == 3 and not _detalhes:CaptureGet ("energy")) then
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
break
|
||||
elseif (atributo == 4 and not _detalhes:CaptureGet ("miscdata")) then
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -63,6 +63,18 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Details:GetRaidLeader()
|
||||
if (IsInRaid()) then
|
||||
for i = 1, GetNumGroupMembers() do
|
||||
local name, rank = GetRaidRosterInfo(i)
|
||||
if (rank == 2) then
|
||||
return name, "raid" .. i
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
function _detalhes:UnpackDeathTable (t)
|
||||
local deathevents = t[1]
|
||||
@@ -860,6 +872,9 @@ end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
elseif (Details.Coach.Server.IsEnabled()) then
|
||||
return true
|
||||
end
|
||||
|
||||
--> don't leave the combat if is in the argus encounter ~REMOVE on 8.0
|
||||
|
||||
@@ -5132,7 +5132,7 @@ do --raid tools
|
||||
|
||||
{--auto current segment
|
||||
type = "toggle",
|
||||
get = function() return currentInstance.auto_current end,
|
||||
get = function() return Details.announce_interrupts.enabled end,
|
||||
set = function (self, fixedparam, value)
|
||||
if (value) then
|
||||
_detalhes:EnableInterruptAnnouncer()
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
|
||||
local Details = _G.Details
|
||||
|
||||
--stop yellow warning on my editor
|
||||
local IsInRaid = _G.IsInRaid
|
||||
local UnitIsGroupLeader = _G.UnitIsGroupLeader
|
||||
local UnitIsGroupAssistant = _G.UnitIsGroupAssistant
|
||||
local UnitName = _G.UnitName
|
||||
local GetRealmName = _G.GetRealmName
|
||||
local GetTime = _G.GetTime
|
||||
local GetNumGroupMembers = _G.GetNumGroupMembers
|
||||
|
||||
--return if the player is inside a raid zone
|
||||
local isInRaidZone = function()
|
||||
return Details.zone_type == "raid"
|
||||
end
|
||||
|
||||
--create a namespace using capital letter 'C' for coach feature, the profile entry is lower character .coach
|
||||
Details.Coach = {
|
||||
Client = { --regular player
|
||||
enabled = false,
|
||||
coachName = "",
|
||||
},
|
||||
|
||||
Server = { --the raid leader
|
||||
enabled = false,
|
||||
lastCombatStartTime = 0,
|
||||
lastCombatEndTime = 0,
|
||||
},
|
||||
|
||||
isInRaidGroup = false,
|
||||
isInRaidZone = false,
|
||||
}
|
||||
|
||||
function Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CIEA"), "WHISPER", raidLeaderName)
|
||||
Details:Msg("asked the raid leader the coach status.")
|
||||
end
|
||||
|
||||
function Details.Coach.SendRLCombatStartNotify(raidLeaderName)
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CCS"), "WHISPER", raidLeaderName)
|
||||
Details:Msg("sent to raid leader a combat start notification.")
|
||||
end
|
||||
|
||||
function Details.Coach.SendRLCombatEndNotify(raidLeaderName)
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CCE"), "WHISPER", raidLeaderName)
|
||||
Details:Msg("sent to raid leader a combat end notification.")
|
||||
end
|
||||
|
||||
--the coach is no more a coach
|
||||
function Details.Coach.SendRaidCoachEndNotify()
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CE"), "RAID")
|
||||
Details:Msg("sent to raid a coach end notification.")
|
||||
end
|
||||
|
||||
--there's a new coach, notify players
|
||||
function Details.Coach.SendRaidCoachStartNotify()
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CS"), "RAID")
|
||||
Details:Msg("sent to raid a coach start notification.")
|
||||
end
|
||||
|
||||
--send data to raid leader
|
||||
function Details.Coach.Client.SendDataToRL()
|
||||
local data = Details.packFunctions.GetAllData()
|
||||
if (data and Details.Coach.Client.coachName) then
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CDT", data), "WHISPER", Details.Coach.Client.coachName)
|
||||
end
|
||||
end
|
||||
|
||||
--on details startup
|
||||
function Details.Coach.StartUp()
|
||||
|
||||
Details.Coach.isInRaidGroup = IsInRaid()
|
||||
Details.Coach.isInRaidZone = select(2, _G.GetInstanceInfo())
|
||||
|
||||
--server
|
||||
if (Details.coach.enabled) then --profile
|
||||
Details.Coach.Server.EnableCoach(true)
|
||||
|
||||
elseif (not Details.coach.enabled) then --profile
|
||||
if (IsInRaid()) then
|
||||
if (isInRaidZone()) then
|
||||
local raidLeaderName = Details:GetRaidLeader()
|
||||
if (raidLeaderName) then
|
||||
--client ask for the raid leader if the Coach is enabled, GetRaidLeader returns nil is the user isn't in raid
|
||||
Details:Msg("sent ask to raid leader, is coach?")
|
||||
Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local eventListener = Details:CreateEventListener()
|
||||
Details.Coach.Listener = eventListener
|
||||
|
||||
function eventListener.OnEnterGroup() --client
|
||||
--when entering a group, check if the player isn't the raid leader
|
||||
if (not UnitIsGroupLeader("player")) then
|
||||
if (IsInRaid()) then
|
||||
if (isInRaidZone()) then
|
||||
local raidLeaderName = Details:GetRaidLeader()
|
||||
if (raidLeaderName) then
|
||||
Details:Msg("sent ask to raid leader, is coach?")
|
||||
Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Details.Coach.isInRaidGroup = true
|
||||
end
|
||||
|
||||
function eventListener.OnLeaveGroup()
|
||||
--disable coach feature on server and client if the player leaves the group
|
||||
Details.Coach.Disable()
|
||||
Details.Coach.isInRaidGroup = false
|
||||
end
|
||||
|
||||
function eventListener.OnEnterCombat()
|
||||
--send a notify to raid leader telling a new combat has started
|
||||
if (Details.Coach.Client.IsEnabled()) then
|
||||
if (IsInRaid() and isInRaidZone()) then
|
||||
if (UnitIsGroupAssistant("player")) then
|
||||
local raidLeaderName = Details.Coach.Client.GetLeaderName()
|
||||
if (raidLeaderName) then
|
||||
Details:Msg("i'm a raid assistant, sent combat start notification to raid leader.")
|
||||
Details.Coach.SendRLCombatStartNotify(raidLeaderName)
|
||||
end
|
||||
end
|
||||
|
||||
--start a timer to send data to the raid leader
|
||||
if (Details.Coach.Client.UpdateTicker) then
|
||||
Details.Coach.Client.UpdateTicker:Cancel()
|
||||
end
|
||||
Details.Coach.Client.UpdateTicker = Details.Schedules.NewTicker(1.5, Details.Coach.Client.SendDataToRL)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function eventListener.OnLeaveCombat()
|
||||
--send a notify to raid leader telling the combat has finished
|
||||
if (Details.Coach.Client.IsEnabled()) then
|
||||
if (IsInRaid() and isInRaidZone()) then
|
||||
if (UnitIsGroupAssistant("player")) then
|
||||
local raidLeaderName = Details.Coach.Client.GetLeaderName()
|
||||
if (raidLeaderName) then
|
||||
Details:Msg("i'm a raid assistant, sent combat end notification to raid leader.")
|
||||
Details.Coach.SendRLCombatEndNotify(raidLeaderName)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Details.Schedules.Cancel(Details.Coach.Client.UpdateTicker)
|
||||
end
|
||||
end
|
||||
|
||||
function eventListener.OnZoneChanged()
|
||||
--if the raid leader entered in a raid, disable the coach
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
if (isInRaidZone()) then
|
||||
--the raid leader entered a raid instance
|
||||
Details.Coach.Disable()
|
||||
Details:Msg("Coach feature stopped: you entered in a raid instance.")
|
||||
end
|
||||
return
|
||||
else
|
||||
--check if the raid leader just left the raid to be a coach
|
||||
if (Details.Coach.IsEnabled()) then --profile coach feature is enabled
|
||||
if (UnitIsGroupLeader("player")) then --player is the raid leader
|
||||
if (not Details.Coach.Server.IsEnabled()) then --the coach feature isn't running
|
||||
Details.Coach.Server.EnableCoach()
|
||||
Details:Msg("Coach feature is now running, if this come as surprise, use '/details coach' to disable.")
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
--when entering a new zone, check if there's a coach
|
||||
if (not Details.Coach.isInRaidZone and isInRaidZone()) then
|
||||
if (not UnitIsGroupLeader("player")) then
|
||||
if (IsInRaid()) then
|
||||
if (not Details.Coach.Client.IsEnabled()) then
|
||||
local raidLeaderName = Details:GetRaidLeader()
|
||||
if (raidLeaderName) then
|
||||
Details:Msg("sent ask to raid leader, is coach?")
|
||||
Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--check if the player has left the raid zone
|
||||
if (Details.Coach.isInRaidZone and Details.Coach.Client.IsEnabled()) then
|
||||
if (not isInRaidZone()) then
|
||||
--player left the raid zone
|
||||
Details.Schedules.Cancel(Details.Coach.Client.UpdateTicker)
|
||||
Details.Coach.Disable()
|
||||
end
|
||||
end
|
||||
|
||||
Details.Coach.isInRaidZone = isInRaidZone()
|
||||
end
|
||||
|
||||
eventListener:RegisterEvent("GROUP_ONENTER", "OnEnterGroup")
|
||||
eventListener:RegisterEvent("GROUP_ONLEAVE", "OnLeaveGroup")
|
||||
eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", "OnEnterCombat")
|
||||
eventListener:RegisterEvent("COMBAT_PLAYER_LEAVE", "OnLeaveCombat")
|
||||
eventListener:RegisterEvent("ZONE_TYPE_CHANGED", "OnZoneChanged")
|
||||
end
|
||||
|
||||
--received an answer from server telling if the raidleader has the coach feature enabled
|
||||
--the request is made when the player enters a new group or reconnects
|
||||
function Details.Coach.Client.CoachIsEnabled_Response(isCoachEnabled, raidLeaderName)
|
||||
if (isCoachEnabled) then
|
||||
--raid leader confirmed the coach feature is enabled and running
|
||||
Details.Coach.Client.EnableCoach(raidLeaderName)
|
||||
end
|
||||
end
|
||||
|
||||
function Details.Coach.Disable()
|
||||
Details.coach.enabled = false --profile
|
||||
|
||||
--if the player is the raid leader and the coach feature is enabled
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
Details.Coach.SendRaidCoachEndNotify()
|
||||
end
|
||||
|
||||
Details.Coach.Server.enabled = false
|
||||
Details.Coach.Client.enabled = false
|
||||
Details.Coach.Client.coachName = nil
|
||||
|
||||
Details.Coach.EventFrame:UnregisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end
|
||||
|
||||
--the player used '/details coach' or it's Details! initialization
|
||||
function Details.Coach.Server.EnableCoach(fromStartup)
|
||||
if (not IsInRaid()) then
|
||||
Details:Msg("cannot enabled coach: not in raid.")
|
||||
Details.coach.enabled = false
|
||||
Details.Coach.Server.enabled = false
|
||||
return
|
||||
|
||||
elseif (not UnitIsGroupLeader("player")) then
|
||||
Details:Msg("cannot enabled coach: you aren't the raid leader.")
|
||||
Details.coach.enabled = false
|
||||
Details.Coach.Server.enabled = false
|
||||
return
|
||||
|
||||
elseif (isInRaidZone()) then
|
||||
Details:Msg("cannot enabled coach: you are inside a raid zone.")
|
||||
Details.coach.enabled = false
|
||||
Details.Coach.Server.enabled = false
|
||||
return
|
||||
end
|
||||
|
||||
Details.coach.enabled = true
|
||||
Details.Coach.Server.enabled = true
|
||||
|
||||
--notify players about the new coach
|
||||
Details.Coach.SendRaidCoachStartNotify()
|
||||
|
||||
--enable group roster to know if the server isn't raid leader any more
|
||||
Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
|
||||
if (fromStartup) then
|
||||
Details:Msg("coach feature enabled, welcome back captain!")
|
||||
end
|
||||
end
|
||||
|
||||
--the raid leader sent a coach end notify
|
||||
function Details.Coach.Client.CoachEnd()
|
||||
Details.Coach.Client.enabled = false
|
||||
Details.Coach.Client.coachName = nil
|
||||
Details.Coach.EventFrame:UnregisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end
|
||||
|
||||
--a player in the raid asked to be the coach of the group
|
||||
function Details.Coach.Client.EnableCoach(raidLeaderName)
|
||||
if (not IsInRaid()) then
|
||||
return
|
||||
|
||||
elseif (not UnitIsGroupLeader(raidLeaderName)) then
|
||||
return
|
||||
end
|
||||
|
||||
Details.Coach.Client.enabled = true
|
||||
Details.Coach.Client.coachName = raidLeaderName
|
||||
|
||||
--enable group roster to know if the raid leader has changed
|
||||
Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
|
||||
Details:Msg("there's a new coach: ", raidLeaderName)
|
||||
end
|
||||
|
||||
--raid leader received a notification that a new combat has started
|
||||
function Details.Coach.Server.CombatStarted()
|
||||
if (Details.Coach.Server.lastCombatStartTime > GetTime()) then
|
||||
return
|
||||
else
|
||||
Details.Coach.Server.lastCombatStartTime = GetTime() + 10
|
||||
end
|
||||
|
||||
--stop the combat if already in one
|
||||
if (Details.in_combat) then
|
||||
Details:EndCombat()
|
||||
end
|
||||
|
||||
--start a new combat
|
||||
Details:StartCombat()
|
||||
end
|
||||
|
||||
--raid leader received a notification that the current combat ended
|
||||
function Details.Coach.Server.CombatEnded()
|
||||
if (Details.Coach.Server.lastCombatEndTime > GetTime()) then
|
||||
return
|
||||
else
|
||||
Details.Coach.Server.lastCombatEndTime = GetTime() + 10
|
||||
end
|
||||
|
||||
Details:EndCombat()
|
||||
end
|
||||
|
||||
--profile
|
||||
function Details.Coach.IsEnabled()
|
||||
return Details.coach.enabled
|
||||
end
|
||||
--server
|
||||
function Details.Coach.Server.IsEnabled()
|
||||
return Details.Coach.Server.enabled
|
||||
end
|
||||
--client
|
||||
function Details.Coach.Client.IsEnabled()
|
||||
return Details.Coach.Client.enabled
|
||||
end
|
||||
function Details.Coach.Client.GetLeaderName()
|
||||
return Details.Coach.Client.coachName
|
||||
end
|
||||
|
||||
Details.Coach.EventFrame = _G.CreateFrame("frame")
|
||||
Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
Details.Coach.EventFrame:SetScript("OnEvent", function(event, ...)
|
||||
if (event == "GROUP_ROSTER_UPDATE") then
|
||||
--check who is raid leader to know if the leader is still the same
|
||||
if (Details.Coach.Client.IsEnabled()) then
|
||||
if (IsInRaid()) then
|
||||
for i = 1, GetNumGroupMembers() do
|
||||
if (UnitIsGroupLeader("raid" .. i)) then
|
||||
local unitName = UnitName("raid" .. i)
|
||||
if (_G.Ambiguate(unitName .. "-" .. GetRealmName(), "none") ~= Details.Coach.Client.coachName) then
|
||||
--the raid leader has changed, finish the coach feature on the client
|
||||
Details:Msg("raid leader has changed, coach feature has been disabled.")
|
||||
Details.Coach.Client.CoachEnd()
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--check if the player is the new raid leader
|
||||
if (UnitIsGroupLeader("player")) then
|
||||
if (Details.Coach.IsEnabled()) then
|
||||
if (not Details.Coach.Server.IsEnabled()) then
|
||||
if (IsInRaid()) then
|
||||
if (not isInRaidZone()) then
|
||||
Details:Msg("you're now the coach of the group.")
|
||||
--delay to set the new leader to give time for SendRaidCoachEndNotify()
|
||||
_G.C_Timer.After(3, Details.Coach.Server.EnableCoach)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
--player isn't the raid leader, check if the player is the coach and disable the feature
|
||||
if (Details.Coach.IsEnabled()) then
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
Details:Msg("you're not the raid leader, disabling the coach feature.")
|
||||
Details.Coach.Disable()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
+1025
-1
File diff suppressed because it is too large
Load Diff
@@ -1100,6 +1100,9 @@ _detalhes.default_profile = default_profile
|
||||
|
||||
-- aqui fica as propriedades do jogador que n�o ser�o armazenadas no profile
|
||||
local default_player_data = {
|
||||
coach = {
|
||||
enabled = false,
|
||||
},
|
||||
|
||||
--> force all fonts to have this outline
|
||||
force_font_outline = "",
|
||||
|
||||
@@ -1585,6 +1585,26 @@ Damage Update Status: @INSTANCEDAMAGESTATUS
|
||||
Details:Dump(exportedValues)
|
||||
end
|
||||
|
||||
elseif (msg == "coach") then
|
||||
if (not UnitIsGroupLeader("player")) then
|
||||
Details:Msg("you aren't the raid leader.")
|
||||
return
|
||||
end
|
||||
|
||||
Details.coach.enabled = not Details.coach.enabled
|
||||
|
||||
if (Details.coach.enabled) then
|
||||
Details:Msg("coach enabled, good luck!")
|
||||
Details:Msg("[raid leader] stay outside the raid.")
|
||||
Details:Msg("[assistants] at least one player inside the raid need to have assistant.")
|
||||
Details:Msg("[players] have an updated version of Details!.")
|
||||
Details.Coach.Server.EnableCoach()
|
||||
|
||||
else
|
||||
Details:Msg("coach disabled.")
|
||||
Details.DisableCoach()
|
||||
end
|
||||
|
||||
elseif (msg == "9") then
|
||||
print ("skin:", Details.skin)
|
||||
print ("current profile:", _detalhes:GetCurrentProfileName())
|
||||
|
||||
@@ -458,6 +458,9 @@ function Details:StartMeUp() --I'll never stop!
|
||||
C_Timer.After(2, reset_player_detail_window)
|
||||
end
|
||||
|
||||
--coach feature startup
|
||||
Details.Coach.StartUp()
|
||||
|
||||
--enforce to show 6 abilities on the tooltip
|
||||
--_detalhes.tooltip.tooltip_max_abilities = 6 freeeeeedooommmmm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user