Coach updates
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
local major = "LibRaidStatus-1.0"
|
||||
local CONST_LIB_VERSION = 9
|
||||
local CONST_LIB_VERSION = 10
|
||||
LIB_RAID_STATUS_CAN_LOAD = false
|
||||
|
||||
--declae the library within the LibStub
|
||||
|
||||
@@ -165,7 +165,7 @@ LIB_RAID_STATUS_COOLDOWNS_BY_SPEC = {
|
||||
[47585] = 2, --Dispersion
|
||||
[15286] = 4, --Vampiric Embrace
|
||||
[19236] = 5, --Desperate Prayer
|
||||
--[64044] = 5, --Psychic Horror
|
||||
[64044] = 5, --Psychic Horror
|
||||
[8122] = 5, --Psychic Scream
|
||||
[205369] = 5, --Mind Bomb
|
||||
},
|
||||
@@ -695,6 +695,7 @@ LIB_RAID_STATUS_COOLDOWNS_INFO = {
|
||||
[197721] = {cooldown = 90, duration = 8, talent = 22404, charges = 1, class = "DRUID", type = 4}, --Flourish (talent)
|
||||
[132469] = {cooldown = 30, duration = false, talent = false, charges = 1, class = "DRUID", type = 5}, --Typhoon
|
||||
[319454] = {cooldown = 300, duration = 45, talent = 18577, charges = 1, class = "DRUID", type = 5}, --Heart of the Wild (talent)
|
||||
[102793] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DRUID", type = 5}, --Ursol's Vortex
|
||||
|
||||
--> death knight
|
||||
[275699] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Apocalypse
|
||||
@@ -721,7 +722,6 @@ LIB_RAID_STATUS_COOLDOWNS_INFO = {
|
||||
[200166] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
|
||||
[198589] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Blur
|
||||
[196555] = {cooldown = 120, duration = 5, talent = 21865, charges = 1, class = "DEMONHUNTER", type = 2}, --Netherwalk (talent)
|
||||
[196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness
|
||||
[187827] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Metamorphosis
|
||||
[196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness
|
||||
[188501] = {cooldown = 30, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Spectral Sight
|
||||
@@ -770,6 +770,8 @@ LIB_RAID_STATUS_COOLDOWNS_INFO = {
|
||||
[193223] = {cooldown = 240, duration = 60, talent = 21979, charges = 1, class = "PRIEST", type = 1}, --Surrender to Madness (talent)
|
||||
[47585] = {cooldown = 120, duration = 6, talent = false, charges = 1, class = "PRIEST", type = 2}, --Dispersion
|
||||
[15286] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 4}, --Vampiric Embrace
|
||||
[64044] = {cooldown = 45, duration = 4, talent = 21752, charges = 1, class = "PRIEST", type = 5}, --Psychic Horror
|
||||
[205369] = {cooldown = 30, duration = 6, talent = 23375, charges = 1, class = "PRIEST", type = 5}, --Mind Bomb
|
||||
|
||||
--> rogue
|
||||
[79140] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Vendetta
|
||||
|
||||
+5
-16
@@ -405,13 +405,6 @@
|
||||
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 --Is Coach Enabled Ask (regular player asked to raid leader)
|
||||
Details.Coach.Server.CoachIsEnabled_Answer(sourcePlayer)
|
||||
|
||||
@@ -435,18 +428,14 @@
|
||||
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
|
||||
Details.packFunctions.DeployPackedCombatData(data)
|
||||
end
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
--update the current combat with new information
|
||||
Details.packFunctions.DeployPackedCombatData(data)
|
||||
end
|
||||
|
||||
elseif (msgType == "CDD") then --Coach Death (a player in the raid sent to raid leader his death log)
|
||||
if (UnitIsGroupLeader("player")) then
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
Details.Coach.Server.AddPlayerDeath(sourcePlayer, data)
|
||||
end
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
Details.Coach.Server.AddPlayerDeath(sourcePlayer, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+87
-142
@@ -3,7 +3,6 @@ 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
|
||||
@@ -22,7 +21,7 @@ Details.Coach = {
|
||||
coachName = "",
|
||||
},
|
||||
|
||||
Server = { --the raid leader
|
||||
Server = { --the coach
|
||||
enabled = false,
|
||||
lastCombatStartTime = 0,
|
||||
lastCombatEndTime = 0,
|
||||
@@ -32,24 +31,24 @@ Details.Coach = {
|
||||
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)
|
||||
function Details.Coach.AskRLForCoachStatus()
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CIEA"), "RAID")
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] asked the raid leader the coach status.")
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] asked the coach the coach status.")
|
||||
end
|
||||
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)
|
||||
function Details.Coach.SendRLCombatStartNotify(coachName)
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CCS"), "WHISPER", coachName)
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent to raid leader a combat start notification.")
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent to coach a combat start notification.")
|
||||
end
|
||||
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)
|
||||
function Details.Coach.SendRLCombatEndNotify(coachName)
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CCE"), "WHISPER", coachName)
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent to raid leader a combat end notification.")
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent to coach a combat end notification.")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,7 +68,7 @@ function Details.Coach.SendRaidCoachStartNotify()
|
||||
end
|
||||
end
|
||||
|
||||
--player send his death to the raid leader
|
||||
--player send his death to the coach
|
||||
function Details.Coach.SendDeathToRL(deathTable)
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CDD", deathTable), "RAID")
|
||||
if (_detalhes.debug) then
|
||||
@@ -77,7 +76,7 @@ function Details.Coach.SendDeathToRL(deathTable)
|
||||
end
|
||||
end
|
||||
|
||||
--send data to raid leader
|
||||
--send data to coach
|
||||
function Details.Coach.Client.SendDataToRL()
|
||||
if (_detalhes.debug) then
|
||||
print("Details Coach sending data to RL.")
|
||||
@@ -102,14 +101,11 @@ function Details.Coach.StartUp()
|
||||
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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent ask to raid leader, is coach?")
|
||||
end
|
||||
Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
--client ask in the raid if Coach is enabled
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent ask to coach, is coach?")
|
||||
end
|
||||
Details.Coach.AskRLForCoachStatus()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -118,17 +114,12 @@ function Details.Coach.StartUp()
|
||||
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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent ask to raid leader, is coach?")
|
||||
end
|
||||
Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
end
|
||||
--when entering a group, check is there's a coach
|
||||
if (IsInRaid()) then
|
||||
if (isInRaidZone()) then
|
||||
Details.Coach.AskRLForCoachStatus()
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent to raid, is there a coach?")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -143,20 +134,20 @@ function Details.Coach.StartUp()
|
||||
end
|
||||
|
||||
function eventListener.OnEnterCombat()
|
||||
--send a notify to raid leader telling a new combat has started
|
||||
--send a notify to coach 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
|
||||
local coachName = Details.coach.last_coach_name
|
||||
if (coachName) then
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] i'm a raid assistant, sent combat start notification to raid leader.")
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] i'm a raid assistant, sent combat start notification to coach.")
|
||||
end
|
||||
Details.Coach.SendRLCombatStartNotify(raidLeaderName)
|
||||
Details.Coach.SendRLCombatStartNotify(coachName)
|
||||
end
|
||||
end
|
||||
|
||||
--start a timer to send data to the raid leader
|
||||
--start a timer to send data to the coach
|
||||
if (Details.Coach.Client.UpdateTicker) then
|
||||
Details.Coach.Client.UpdateTicker:Cancel()
|
||||
end
|
||||
@@ -166,14 +157,14 @@ function Details.Coach.StartUp()
|
||||
end
|
||||
|
||||
function eventListener.OnLeaveCombat()
|
||||
--send a notify to raid leader telling the combat has finished
|
||||
--send a notify to coach 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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] i'm a raid assistant, sent combat end notification to raid leader.")
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] i'm a raid assistant, sent combat end notification to coach.")
|
||||
end
|
||||
Details.Coach.SendRLCombatEndNotify(raidLeaderName)
|
||||
end
|
||||
@@ -185,45 +176,27 @@ function Details.Coach.StartUp()
|
||||
end
|
||||
|
||||
function eventListener.OnZoneChanged()
|
||||
--if the raid leader entered in a raid, disable the coach
|
||||
--if the coach entered in a raid, disable the coach
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
if (isInRaidZone()) then
|
||||
--the raid leader entered a raid instance
|
||||
--the coach entered a raid instance
|
||||
Details.Coach.Disable()
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] Coach feature stopped: you entered in a raid instance.")
|
||||
end
|
||||
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()
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] Coach feature is now running, if this come as surprise, use '/details coach' to disable.")
|
||||
end
|
||||
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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent ask to raid leader, is coach?")
|
||||
end
|
||||
Details.Coach.AskRLForCoachStatus(raidLeaderName)
|
||||
return
|
||||
end
|
||||
if (IsInRaid()) then
|
||||
if (not Details.Coach.Client.IsEnabled()) then
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] sent in the raid, there's a coach?")
|
||||
end
|
||||
Details.Coach.AskRLForCoachStatus()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -253,30 +226,29 @@ 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)
|
||||
function Details.Coach.Client.CoachIsEnabled_Response(isCoachEnabled, coachName)
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] Raid Leader sent response about the status of Coach Mode:", isCoachEnabled, raidLeaderName)
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] Coach sent response about the status of Coach Mode:", isCoachEnabled, raidLeaderName)
|
||||
end
|
||||
|
||||
if (isCoachEnabled) then
|
||||
--raid leader confirmed the coach feature is enabled and running
|
||||
Details.Coach.Client.EnableCoach(raidLeaderName)
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] current coach:", raidLeaderName)
|
||||
--coach confirmed the coach feature is enabled and running
|
||||
Details.Coach.Client.EnableCoach(coachName)
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] current coach:", coachName)
|
||||
end
|
||||
end
|
||||
|
||||
function Details.Coach.Server.CoachIsEnabled_Answer(sourcePlayer)
|
||||
if (not UnitIsGroupLeader("player")) then
|
||||
return
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
--send the answer
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, sourcePlayer, GetRealmName(), Details.realversion, "CIER", Details.Coach.Server.IsEnabled()), "WHISPER", sourcePlayer)
|
||||
end
|
||||
--send the answer
|
||||
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, sourcePlayer, GetRealmName(), Details.realversion, "CIER", Details.Coach.Server.IsEnabled()), "WHISPER", sourcePlayer)
|
||||
end
|
||||
|
||||
function Details.Coach.Disable()
|
||||
Details.coach.enabled = false --profile
|
||||
|
||||
--if the player is the raid leader and the coach feature is enabled
|
||||
--if the player is the coach and the coach feature is enabled
|
||||
if (Details.Coach.Server.IsEnabled()) then
|
||||
Details.Coach.SendRaidCoachEndNotify()
|
||||
end
|
||||
@@ -284,6 +256,7 @@ function Details.Coach.Disable()
|
||||
Details.Coach.Server.enabled = false
|
||||
Details.Coach.Client.enabled = false
|
||||
Details.Coach.Client.coachName = nil
|
||||
Details.coach.last_coach_name = false
|
||||
|
||||
Details.Coach.EventFrame:UnregisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end
|
||||
@@ -296,14 +269,7 @@ function Details.Coach.Server.EnableCoach(fromStartup)
|
||||
end
|
||||
Details.coach.enabled = false
|
||||
Details.Coach.Server.enabled = false
|
||||
return
|
||||
|
||||
elseif (not UnitIsGroupLeader("player")) then
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] cannot enabled coach: you aren't the raid leader.")
|
||||
end
|
||||
Details.coach.enabled = false
|
||||
Details.Coach.Server.enabled = false
|
||||
Details.coach.last_coach_name = false
|
||||
return
|
||||
|
||||
elseif (isInRaidZone()) then
|
||||
@@ -312,16 +278,18 @@ function Details.Coach.Server.EnableCoach(fromStartup)
|
||||
end
|
||||
Details.coach.enabled = false
|
||||
Details.Coach.Server.enabled = false
|
||||
Details.coach.last_coach_name = false
|
||||
return
|
||||
end
|
||||
|
||||
Details.coach.enabled = true
|
||||
Details.Coach.Server.enabled = true
|
||||
Details.coach.last_coach_name = UnitName("player")
|
||||
|
||||
--notify players about the new coach
|
||||
Details.Coach.SendRaidCoachStartNotify()
|
||||
|
||||
--enable group roster to know if the server isn't raid leader any more
|
||||
--enable group roster to know if the server isn't coach any more
|
||||
Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
|
||||
if (fromStartup) then
|
||||
@@ -331,42 +299,38 @@ function Details.Coach.Server.EnableCoach(fromStartup)
|
||||
end
|
||||
end
|
||||
|
||||
--the raid leader sent a coach end notify
|
||||
--the coach sent a coach end notify
|
||||
function Details.Coach.Client.CoachEnd()
|
||||
Details.Coach.Client.enabled = false
|
||||
Details.Coach.Client.coachName = nil
|
||||
Details.coach.last_coach_name = false
|
||||
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)
|
||||
function Details.Coach.Client.EnableCoach(coachName)
|
||||
if (not IsInRaid()) then
|
||||
if (_detalhes.debug) then
|
||||
print("Details Coach can't enable coach on client: isn't in raid")
|
||||
end
|
||||
return
|
||||
|
||||
elseif (not UnitIsGroupLeader(raidLeaderName)) then
|
||||
if (_detalhes.debug) then
|
||||
print("Details Coach can't enable coach on client: the unit passed isn't the raid leader")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
Details.Coach.Client.enabled = true
|
||||
Details.Coach.Client.coachName = raidLeaderName
|
||||
Details.Coach.Client.coachName = coachName
|
||||
Details.coach.last_coach_name = coachName
|
||||
|
||||
--enable group roster to know if the raid leader has changed
|
||||
--enable group roster to know if the coach has changed
|
||||
Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] there's a new coach: ", raidLeaderName)
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] there's a new coach: ", coachName)
|
||||
end
|
||||
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] current coach:", raidLeaderName)
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] current coach:", coachName)
|
||||
end
|
||||
|
||||
--raid leader received a notification that a new combat has started
|
||||
--coach received a notification that a new combat has started
|
||||
function Details.Coach.Server.CombatStarted()
|
||||
if (Details.Coach.Server.lastCombatStartTime > GetTime()) then
|
||||
return
|
||||
@@ -383,7 +347,7 @@ function Details.Coach.Server.CombatStarted()
|
||||
Details:StartCombat()
|
||||
end
|
||||
|
||||
--raid leader received a notification that the current combat ended
|
||||
--coach received a notification that the current combat ended
|
||||
function Details.Coach.Server.CombatEnded()
|
||||
if (Details.Coach.Server.lastCombatEndTime > GetTime()) then
|
||||
return
|
||||
@@ -414,51 +378,20 @@ 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
|
||||
--check who is coach 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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] raid leader has changed, coach feature has been disabled.")
|
||||
end
|
||||
Details.Coach.Client.CoachEnd()
|
||||
local inRaid = UnitInRaid(Details.Coach.Client.coachName)
|
||||
if (not inRaid) then
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] coach isn't in the raid, coach feature has been disabled.")
|
||||
end
|
||||
break
|
||||
Details.Coach.Client.CoachEnd()
|
||||
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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] you're now the coach of the group.")
|
||||
end
|
||||
--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
|
||||
if (_detalhes.debug) then
|
||||
Details:Msg("[|cFFAAFFAADetails! Coach|r] you're not the raid leader, disabling the coach feature.")
|
||||
end
|
||||
Details.Coach.Disable()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -519,7 +452,7 @@ function Details.Coach.WelcomePanel()
|
||||
local isLeaderTexture = DetailsFramework:CreateImage(welcomePanel, [[Interface\GLUES\LOADINGSCREENS\DynamicElements]], imageSize, imageSize)
|
||||
isLeaderTexture:SetTexCoord(0, 0.5, 0, 0.5)
|
||||
isLeaderTexture:SetPoint("topleft", detailsLogo, "topleft", 0, -60)
|
||||
local isLeaderText = DetailsFramework:CreateLabel(welcomePanel, "In raid and You're the leader of the group.")
|
||||
local isLeaderText = DetailsFramework:CreateLabel(welcomePanel, "In raid and all members are in the same guild.")
|
||||
isLeaderText:SetPoint("left", isLeaderTexture, "right", 10, 0)
|
||||
|
||||
local isOutsideTexture = DetailsFramework:CreateImage(welcomePanel, [[Interface\GLUES\LOADINGSCREENS\DynamicElements]], imageSize, imageSize)
|
||||
@@ -558,8 +491,19 @@ function Details.Coach.WelcomePanel()
|
||||
|
||||
function welcomePanel.Update()
|
||||
local good = 0
|
||||
local numRaidMembers = GetNumGroupMembers()
|
||||
local playerName = UnitName("player")
|
||||
local sameGuildAmount = 0
|
||||
local guildName = GetGuildInfo("player")
|
||||
|
||||
if (IsInRaid() and UnitIsGroupLeader("player")) then
|
||||
for i = 1, numRaidMembers do
|
||||
local unitId = "raid" .. i
|
||||
if (guildName == GetGuildInfo(unitId)) then
|
||||
sameGuildAmount = sameGuildAmount + 1
|
||||
end
|
||||
end
|
||||
|
||||
if (IsInRaid() and numRaidMembers == sameGuildAmount) then
|
||||
isLeaderTexture:SetTexture([[Interface\COMMON\Indicator-Green]])
|
||||
isLeaderTexture:SetTexCoord(0, 1, 0, 1)
|
||||
good = good + 1
|
||||
@@ -578,8 +522,9 @@ function Details.Coach.WelcomePanel()
|
||||
end
|
||||
|
||||
local hasAssistant = false
|
||||
for i = 1, GetNumGroupMembers() do
|
||||
if (UnitIsGroupAssistant("raid" .. i) and UnitName("raid" .. i) ~= UnitName("player")) then
|
||||
for i = 1, numRaidMembers do
|
||||
local name, rank = GetRaidRosterInfo(i)
|
||||
if (rank > 0 and name ~= UnitName("player")) then
|
||||
hasAssistant = true
|
||||
break
|
||||
end
|
||||
@@ -595,9 +540,9 @@ function Details.Coach.WelcomePanel()
|
||||
end
|
||||
|
||||
local isInCorrectGroup = false
|
||||
for i = 1, GetNumGroupMembers() do
|
||||
for i = 1, numRaidMembers do
|
||||
local name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
|
||||
if (rank == 2) then
|
||||
if (name == playerName) then
|
||||
if (subgroup == 7 or subgroup == 8) then
|
||||
isInCorrectGroup = true
|
||||
break
|
||||
@@ -616,7 +561,7 @@ function Details.Coach.WelcomePanel()
|
||||
|
||||
local allUsersUpdated = false
|
||||
|
||||
local numRaidMembers = GetNumGroupMembers()
|
||||
local numRaidMembers = numRaidMembers
|
||||
local updatedUsers = 0
|
||||
local usersChecked = {}
|
||||
|
||||
|
||||
+3
-1
@@ -461,7 +461,9 @@ function Details.packFunctions.PackDamage(combatObject)
|
||||
local allPlayerNames = {}
|
||||
for i = 1, 20 do
|
||||
local unitName = UnitName("raid" .. i)
|
||||
if (unitName and not UnitIsGroupLeader("raid" .. i)) then
|
||||
local _, _, subgroup = GetRaidRosterInfo(i)
|
||||
|
||||
if (unitName and subgroup <= 4) then
|
||||
allPlayerNames[#allPlayerNames+1] = unitName
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1112,7 +1112,8 @@ _detalhes.default_profile = default_profile
|
||||
local default_player_data = {
|
||||
coach = {
|
||||
enabled = false,
|
||||
welcome_panel_pos = {}
|
||||
welcome_panel_pos = {},
|
||||
last_coach_name = false,
|
||||
},
|
||||
|
||||
--> force all fonts to have this outline
|
||||
|
||||
+4
-4
@@ -1495,10 +1495,10 @@ function SlashCmdList.DETAILS (msg, editbox)
|
||||
end
|
||||
|
||||
elseif (msg == "coach") then
|
||||
if (not UnitIsGroupLeader("player")) then
|
||||
Details:Msg("you aren't the raid leader.")
|
||||
return
|
||||
end
|
||||
--if (not UnitIsGroupLeader("player")) then
|
||||
-- Details:Msg("you aren't the raid leader.")
|
||||
-- return
|
||||
--end
|
||||
|
||||
if (not Details.coach.enabled) then
|
||||
Details.Coach.WelcomePanel()
|
||||
|
||||
Reference in New Issue
Block a user