You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1965 lines
68 KiB

3 years ago
4 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local _detalhes = _G._detalhes
3 years ago
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
4 years ago
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local _tempo = time()
local _
local addonName, Details222 = ...
3 years ago
4 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--local pointers
4 years ago
local _math_max = math.max --lua local
local ipairs = ipairs --lua local
local pairs = pairs --lua local
3 years ago
local wipe = table.wipe --lua local
local bitBand = bit.band --lua local
local GetInstanceInfo = GetInstanceInfo --wow api local
local UnitExists = UnitExists --wow api local
local UnitGUID = UnitGUID --wow api local
local GetTime = GetTime
local IsAltKeyDown = IsAltKeyDown
local IsShiftKeyDown = IsShiftKeyDown
local IsControlKeyDown = IsControlKeyDown
4 years ago
local atributo_damage = Details.atributo_damage --details local
local atributo_heal = Details.atributo_heal --details local
local atributo_energy = Details.atributo_energy --details local
local atributo_misc = Details.atributo_misc --details local
local atributo_custom = Details.atributo_custom --details local
local info = Details.playerDetailWindow --details local
3 years ago
4 years ago
local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned
3 years ago
4 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--constants
4 years ago
local modo_GROUP = Details.modos.group
local modo_ALL = Details.modos.all
local class_type_dano = Details.atributos.dano
local OBJECT_TYPE_PETS = 0x00003000
3 years ago
4 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--details api functions
4 years ago
3 years ago
--try to find the opponent of last fight, can be called during a fight as well
4 years ago
function Details:FindEnemy()
3 years ago
local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
local in_instance = IsInInstance() --garrison returns party as instance type.
4 years ago
if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
if (InstanceType == "party") then
if (Details:GetBossNames (Details.zone_id)) then
return Loc ["STRING_SEGMENT_TRASH"]
end
else
return Loc ["STRING_SEGMENT_TRASH"]
end
end
3 years ago
for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do
if (not actor.grupo and not actor.owner and not actor.nome:find("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction
for name, _ in pairs(actor.targets) do
4 years ago
if (name == Details.playername) then
return actor.nome
else
local _target_actor = Details.tabela_vigente (class_type_dano, name)
3 years ago
if (_target_actor and _target_actor.grupo) then
4 years ago
return actor.nome
end
end
end
end
3 years ago
4 years ago
end
3 years ago
for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do
4 years ago
if (actor.grupo and not actor.owner) then
3 years ago
for target_name, _ in pairs(actor.targets) do
4 years ago
return target_name
end
end
3 years ago
4 years ago
end
3 years ago
4 years ago
return Loc ["STRING_UNKNOW"]
end
3 years ago
4 years ago
-- try get the current encounter name during the encounter
3 years ago
local boss_found_not_registered = function(t, ZoneName, ZoneMapID, DifficultyID)
4 years ago
local boss_table = {
index = 0,
name = t[1],
encounter = t[1],
zone = ZoneName,
mapid = ZoneMapID,
diff = DifficultyID,
3 years ago
diff_string = select(4, GetInstanceInfo()),
4 years ago
ej_instance_id = t[5],
id = t[2],
bossimage = t[4],
}
3 years ago
4 years ago
Details.tabela_vigente.is_boss = boss_table
end
3 years ago
local boss_found = function(index, name, zone, mapid, diff, encounterid)
4 years ago
local mapID = C_Map.GetBestMapForUnit ("player")
local ejid
if (mapID) then
ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID)
end
3 years ago
4 years ago
if (not mapID) then
3 years ago
--print("Details! exeption handled: zone has no map")
4 years ago
return
end
3 years ago
4 years ago
if (ejid == 0) then
ejid = Details:GetInstanceEJID()
end
3 years ago
4 years ago
local boss_table = {
index = index,
name = name,
encounter = name,
zone = zone,
mapid = mapid,
diff = diff,
3 years ago
diff_string = select(4, GetInstanceInfo()),
4 years ago
ej_instance_id = ejid,
id = encounterid,
}
3 years ago
4 years ago
if (not Details:IsRaidRegistered (mapid) and Details.zone_type == "raid") then
local boss_list = Details:GetCurrentDungeonBossListFromEJ()
if (boss_list) then
local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
if (ActorsContainer) then
3 years ago
for index, Actor in ipairs(ActorsContainer) do
4 years ago
if (not Actor.grupo) then
if (boss_list [Actor.nome]) then
Actor.boss = true
boss_table.bossimage = boss_list [Actor.nome][4]
break
end
end
end
end
end
end
Details.tabela_vigente.is_boss = boss_table
3 years ago
4 years ago
if (Details.in_combat and not Details.leaving_combat) then
3 years ago
--catch boss function if any
4 years ago
local bossFunction, bossFunctionType = Details:GetBossFunction (ZoneMapID, BossIndex)
if (bossFunction) then
3 years ago
if (bitBand(bossFunctionType, 0x1) ~= 0) then --realtime
4 years ago
Details.bossFunction = bossFunction
3 years ago
Details.tabela_vigente.bossFunction = Details:ScheduleTimer("bossFunction", 1)
4 years ago
end
end
3 years ago
4 years ago
if (Details.zone_type ~= "raid") then
local endType, endData = Details:GetEncounterEnd (ZoneMapID, BossIndex)
if (endType and endData) then
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) setting boss end type to:", endType)
4 years ago
end
3 years ago
4 years ago
Details.encounter_end_table.type = endType
Details.encounter_end_table.killed = {}
Details.encounter_end_table.data = {}
3 years ago
if (type(endData) == "table") then
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) boss type is table:", endType)
4 years ago
end
if (endType == 1 or endType == 2) then
3 years ago
for _, npcID in ipairs(endData) do
4 years ago
Details.encounter_end_table.data [npcID] = false
end
end
else
if (endType == 1 or endType == 2) then
Details.encounter_end_table.data [endData] = false
end
end
end
end
end
3 years ago
--we the boss was found during the combat table creation, we must postpone the event trigger
4 years ago
if (not Details.tabela_vigente.IsBeingCreated) then
3 years ago
Details:SendEvent("COMBAT_BOSS_FOUND", nil, index, name)
4 years ago
Details:CheckFor_SuppressedWindowsOnEncounterFound()
end
3 years ago
4 years ago
return boss_table
end
3 years ago
4 years ago
function Details:ReadBossFrames()
3 years ago
4 years ago
if (Details.tabela_vigente.is_boss) then
return --no need to check
end
3 years ago
4 years ago
if (Details.encounter_table.name) then
local encounter_table = Details.encounter_table
return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
end
3 years ago
for index = 1, 5, 1 do
if (UnitExists("boss"..index)) then
local guid = UnitGUID("boss"..index)
4 years ago
if (guid) then
local serial = Details:GetNpcIdFromGuid (guid)
if (serial) then
3 years ago
local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
4 years ago
local BossIds = Details:GetBossIds (ZoneMapID)
if (BossIds) then
local BossIndex = BossIds [serial]
3 years ago
if (BossIndex) then
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) boss found:",Details:GetBossName (ZoneMapID, BossIndex))
4 years ago
end
3 years ago
4 years ago
return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
end
end
end
end
end
end
3 years ago
end
4 years ago
--try to get the encounter name after the encounter (can be called during the combat as well)
function Details:FindBoss (noJournalSearch)
if (Details.encounter_table.name) then
local encounter_table = Details.encounter_table
return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
end
3 years ago
local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
4 years ago
local BossIds = Details:GetBossIds (ZoneMapID)
3 years ago
4 years ago
if (BossIds) then
local BossIndex = nil
local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
3 years ago
4 years ago
if (ActorsContainer) then
3 years ago
for index, Actor in ipairs(ActorsContainer) do
4 years ago
if (not Actor.grupo) then
local serial = Details:GetNpcIdFromGuid (Actor.serial)
if (serial) then
BossIndex = BossIds [serial]
if (BossIndex) then
Actor.boss = true
return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
end
end
end
end
end
end
3 years ago
noJournalSearch = true --disabling the scan on encounter journal
4 years ago
if (not noJournalSearch) then
3 years ago
local in_instance = IsInInstance() --garrison returns party as instance type.
4 years ago
if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
local boss_list = Details:GetCurrentDungeonBossListFromEJ()
if (boss_list) then
local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
if (ActorsContainer) then
3 years ago
for index, Actor in ipairs(ActorsContainer) do
4 years ago
if (not Actor.grupo) then
if (boss_list [Actor.nome]) then
Actor.boss = true
return boss_found_not_registered (boss_list [Actor.nome], ZoneName, ZoneMapID, DifficultyID)
end
end
end
end
end
end
end
return false
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--internal functions
4 years ago
-- Details.statistics = {container_calls = 0, container_pet_calls = 0, container_unknow_pet = 0, damage_calls = 0, heal_calls = 0, absorbs_calls = 0, energy_calls = 0, pets_summons = 0}
function Details:StartCombat(...)
return Details:EntrarEmCombate (...)
end
-- ~start ~inicio ~novo �ovo
function Details:EntrarEmCombate (...)
if (Details.debug) then
3 years ago
Details:Msg("(debug) |cFFFFFF00started a new combat|r|cFFFF7700", Details.encounter_table and Details.encounter_table.name or "")
4 years ago
--local from = debugstack (2, 1, 0)
3 years ago
--print(from)
4 years ago
end
3 years ago
if (not Details.tabela_historico.tabelas[1]) then
4 years ago
Details.tabela_overall = Details.combate:NovaTabela()
3 years ago
Details:InstanciaCallFunction(Details.ResetaGump, nil, -1) --reseta scrollbar, iterators, rodap�, etc
Details:InstanciaCallFunction(Details.InstanciaFadeBarras, -1) --esconde todas as barras
Details:InstanciaCallFunction(Details.AtualizaSegmentos) --atualiza o showing
4 years ago
end
3 years ago
--re-lock nos tempos da tabela passada -- lock again last table times
4 years ago
Details.tabela_vigente:TravarTempos()
3 years ago
4 years ago
local n_combate = Details:NumeroCombate (1) --aumenta o contador de combates -- combat number up
3 years ago
--cria a nova tabela de combates -- create new table
4 years ago
local ultimo_combate = Details.tabela_vigente
Details.tabela_vigente = Details.combate:NovaTabela (true, Details.tabela_overall, n_combate, ...) --cria uma nova tabela de combate
3 years ago
--flag this combat as being created
4 years ago
Details.tabela_vigente.IsBeingCreated = true
3 years ago
4 years ago
Details.tabela_vigente.previous_combat = ultimo_combate
3 years ago
4 years ago
Details.tabela_vigente:seta_data (Details._detalhes_props.DATA_TYPE_START) --seta na tabela do combate a data do inicio do combate -- setup time data
Details.in_combat = true --sinaliza ao addon que h� um combate em andamento -- in combat flag up
3 years ago
Details.tabela_vigente.combat_id = n_combate --grava o n�mero deste combate na tabela atual -- setup combat id on new table
4 years ago
Details.last_combat_pre_pot_used = nil
3 years ago
4 years ago
Details:FlagCurrentCombat()
3 years ago
--� o timer que ve se o jogador ta em combate ou n�o -- check if any party or raid members are in combat
Details.tabela_vigente.verifica_combate = Details:ScheduleRepeatingTimer ("EstaEmCombate", 1)
4 years ago
Details:ClearCCPetsBlackList()
3 years ago
wipe(Details.encounter_end_table)
wipe(Details.pets_ignored)
wipe(Details.pets_no_owner)
4 years ago
Details.container_pets:BuscarPets()
3 years ago
wipe(Details.cache_damage_group)
wipe(Details.cache_healing_group)
4 years ago
Details:UpdateParserGears()
3 years ago
--get all buff already applied before the combat start
4 years ago
Details:CatchRaidBuffUptime ("BUFF_UPTIME_IN")
Details:CatchRaidDebuffUptime ("DEBUFF_UPTIME_IN")
Details:UptadeRaidMembersCache()
3 years ago
Details222.TimeCapture.StartCombatTimer(Details.tabela_vigente)
3 years ago
--we already have boss information? build .is_boss table
4 years ago
if (Details.encounter_table.id and Details.encounter_table ["start"] >= GetTime() - 3 and not Details.encounter_table ["end"]) then
local encounter_table = Details.encounter_table
3 years ago
--boss_found will trigger "COMBAT_BOSS_FOUND" event, but at this point of the combat creation is safe to send it
4 years ago
boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
else
3 years ago
--if we don't have this infor right now, lets check in few seconds dop
if (Details.EncounterInformation [Details.zone_id]) then
Details:ScheduleTimer("ReadBossFrames", 1)
Details:ScheduleTimer("ReadBossFrames", 30)
end
end
--if the window is showing current segment, switch it for the new combat
--also if the window has auto current, jump to current segment
Details:InstanciaCallFunction(Details.TrocaSegmentoAtual, Details.tabela_vigente.is_boss and true)
--clear hosts and make the cloud capture stuff
4 years ago
Details.host_of = nil
3 years ago
Details.host_by = nil
4 years ago
if (Details.in_group and Details.cloud_capture) then
if (Details:IsInInstance() or Details.debug) then
if (not Details:CaptureIsAllEnabled()) then
Details:ScheduleSendCloudRequest()
--if (Details.debug) then
3 years ago
-- Details:Msg("(debug) requesting a cloud server.")
4 years ago
--end
end
else
--if (Details.debug) then
3 years ago
-- Details:Msg("(debug) isn't inside a registred instance", Details:IsInInstance())
4 years ago
--end
end
else
--if (Details.debug) then
3 years ago
-- Details:Msg("(debug) isn't in group or cloud is turned off", Details.in_group, Details.cloud_capture)
4 years ago
--end
end
3 years ago
--hide / alpha / switch in combat
for index, instancia in ipairs(Details.tabela_instancias) do
4 years ago
if (instancia.ativa) then
instancia:CheckSwitchOnCombatStart (true)
end
end
3 years ago
Details:InstanceCall(Details.CheckPsUpdate)
--combat creation is completed, remove the flag
4 years ago
Details.tabela_vigente.IsBeingCreated = nil
3 years ago
Details:SendEvent("COMBAT_PLAYER_ENTER", nil, Details.tabela_vigente, Details.encounter_table and Details.encounter_table.id)
4 years ago
if (Details.tabela_vigente.is_boss) then
3 years ago
--the encounter was found through encounter_start event
Details:SendEvent("COMBAT_BOSS_FOUND", nil, Details.tabela_vigente.is_boss.index, Details.tabela_vigente.is_boss.name)
4 years ago
end
3 years ago
4 years ago
Details:CheckSwitchToCurrent()
Details:CheckForTextTimeCounter (true)
3 years ago
--stop bar testing if any
4 years ago
Details:StopTestBarUpdate()
end
3 years ago
4 years ago
function Details:DelayedSyncAlert()
local lower_instance = Details:GetLowerInstanceNumber()
if (lower_instance) then
3 years ago
lower_instance = Details:GetInstance(lower_instance)
4 years ago
if (lower_instance) then
if (not lower_instance:HaveInstanceAlert()) then
lower_instance:InstanceAlert (Loc ["STRING_EQUILIZING"], {[[Interface\COMMON\StreamCircle]], 22, 22, true}, 5, {function() end})
end
end
end
end
3 years ago
4 years ago
function Details:ScheduleSyncPlayerActorData()
if ((IsInGroup() or IsInRaid()) and (Details.zone_type == "party" or Details.zone_type == "raid")) then
3 years ago
--do not sync if in battleground or arena
4 years ago
Details:SendCharacterData()
end
end
3 years ago
4 years ago
function Details:EndCombat()
return Details:SairDoCombate()
end
3 years ago
4 years ago
-- ~end ~leave
function Details:SairDoCombate (bossKilled, from_encounter_end)
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) |cFFFFFF00ended a combat|r|cFFFF7700", Details.encounter_table and Details.encounter_table.name or "")
4 years ago
end
3 years ago
--in case of something somehow someway call to close the same combat a second time.
4 years ago
if (Details.tabela_vigente == Details.last_closed_combat) then
return
end
Details.last_closed_combat = Details.tabela_vigente
3 years ago
4 years ago
--if (Details.statistics) then
3 years ago
-- for k, v in pairs(Details.statistics) do
-- print(k, v)
4 years ago
-- end
--end
3 years ago
4 years ago
Details.leaving_combat = true
Details.last_combat_time = _tempo
3 years ago
4 years ago
Details:CatchRaidBuffUptime ("BUFF_UPTIME_OUT")
Details:CatchRaidDebuffUptime ("DEBUFF_UPTIME_OUT")
Details:CloseEnemyDebuffsUptime()
3 years ago
Details222.TimeCapture.StopCombat()
3 years ago
--check if this isn't a boss and try to find a boss in the segment
if (not Details.tabela_vigente.is_boss) then
--if this is a mythic+ dungeon, do not scan for encounter journal boss names in the actor list
4 years ago
Details:FindBoss()
3 years ago
--still didn't find the boss
4 years ago
if (not Details.tabela_vigente.is_boss) then
3 years ago
local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
4 years ago
local findboss = Details:GetRaidBossFindFunction (ZoneMapID)
if (findboss) then
local BossIndex = findboss()
if (BossIndex) then
boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
end
end
end
end
3 years ago
4 years ago
if (Details.tabela_vigente.bossFunction) then
3 years ago
Details:CancelTimer(Details.tabela_vigente.bossFunction)
4 years ago
Details.tabela_vigente.bossFunction = nil
end
3 years ago
--finaliza a checagem se esta ou n�o no combate -- finish combat check
if (Details.tabela_vigente.verifica_combate) then
Details:CancelTimer(Details.tabela_vigente.verifica_combate)
4 years ago
Details.tabela_vigente.verifica_combate = nil
end
3 years ago
--lock timers
Details.tabela_vigente:TravarTempos()
--get waste shields
4 years ago
if (Details.close_shields) then
Details:CloseShields (Details.tabela_vigente)
end
3 years ago
--salva hora, minuto, segundo do fim da luta
Details.tabela_vigente:seta_data (Details._detalhes_props.DATA_TYPE_END)
4 years ago
Details.tabela_vigente:seta_tempo_decorrido()
3 years ago
--drop last events table to garbage collector
4 years ago
Details.tabela_vigente.player_last_events = {}
3 years ago
--flag instance type
local _, InstanceType = GetInstanceInfo()
4 years ago
Details.tabela_vigente.instance_type = InstanceType
3 years ago
if (not Details.tabela_vigente.is_boss and from_encounter_end and type(from_encounter_end) == "table") then
local encounterID, encounterName, difficultyID, raidSize, endStatus = unpack(from_encounter_end)
4 years ago
if (encounterID) then
local ZoneName, InstanceType, DifficultyID, DifficultyName, _, _, _, ZoneMapID = GetInstanceInfo()
3 years ago
4 years ago
local mapID = C_Map.GetBestMapForUnit ("player")
3 years ago
4 years ago
if (not mapID) then
mapID = 0
end
3 years ago
4 years ago
local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID)
3 years ago
4 years ago
if (ejid == 0) then
ejid = Details:GetInstanceEJID()
end
local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId (ZoneMapID, encounterID)
Details.tabela_vigente.is_boss = {
index = boss_index or 0,
name = encounterName,
encounter = encounterName,
zone = ZoneName,
mapid = ZoneMapID,
diff = DifficultyID,
diff_string = DifficultyName,
ej_instance_id = ejid or 0,
id = encounterID,
}
end
3 years ago
end
--tag as a mythic dungeon segment, can be any type of segment, this tag also avoid the segment to be tagged as trash
4 years ago
local mythicLevel = C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo()
if (mythicLevel and mythicLevel >= 2) then
Details.tabela_vigente.is_mythic_dungeon_segment = true
Details.tabela_vigente.is_mythic_dungeon_run_id = Details.mythic_dungeon_id
end
3 years ago
--send item level after a combat if is in raid or party group
C_Timer.After(1, Details.ScheduleSyncPlayerActorData)
4 years ago
--if this segment isn't a boss fight
if (not Details.tabela_vigente.is_boss) then
if (Details.tabela_vigente.is_pvp or Details.tabela_vigente.is_arena) then
Details:FlagActorsOnPvPCombat()
end
3 years ago
4 years ago
if (Details.tabela_vigente.is_arena) then
Details.tabela_vigente.enemy = "[" .. ARENA .. "] " .. Details.tabela_vigente.is_arena.name
end
3 years ago
local in_instance = IsInInstance() --garrison returns party as instance type.
4 years ago
if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
if (InstanceType == "party") then
if (Details.tabela_vigente.is_mythic_dungeon_segment) then --setted just above
--is inside a mythic+ dungeon and this is not a boss segment, so tag it as a dungeon mythic+ trash segment
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
Details.tabela_vigente.is_mythic_dungeon_trash = {
ZoneName = zoneName,
MapID = instanceMapID,
Level = Details.MythicPlus.Level,
EJID = Details.MythicPlus.ejID,
}
else
3 years ago
--tag the combat as trash clean up
4 years ago
Details.tabela_vigente.is_trash = true
end
else
Details.tabela_vigente.is_trash = true
end
else
if (not in_instance) then
if (Details.world_combat_is_trash) then
Details.tabela_vigente.is_temporary = true
end
end
end
3 years ago
4 years ago
if (not Details.tabela_vigente.enemy) then
local enemy = Details:FindEnemy()
3 years ago
4 years ago
if (enemy and Details.debug) then
3 years ago
Details:Msg("(debug) enemy found", enemy)
4 years ago
end
3 years ago
4 years ago
Details.tabela_vigente.enemy = enemy
end
3 years ago
4 years ago
if (Details.debug) then
3 years ago
-- Details:Msg("(debug) forcing equalize actors behavior.")
4 years ago
-- Details:EqualizeActorsSchedule (Details.host_of)
end
3 years ago
--verifica memoria
4 years ago
Details:FlagActorsOnCommonFight() --fight_component
--Details:CheckMemoryAfterCombat() -- 7.2.5 is doing some weird errors even out of combat
else
3 years ago
4 years ago
--this segment is a boss fight
3 years ago
if (not InCombatLockdown() and not UnitAffectingCombat("player")) then
4 years ago
else
--Details.schedule_flag_boss_components = true
end
3 years ago
4 years ago
--calling here without checking for combat since the does not ran too long for scripts
Details:FlagActorsOnBossFight()
3 years ago
4 years ago
local boss_id = Details.encounter_table.id
if (bossKilled) then
Details.tabela_vigente.is_boss.killed = true
3 years ago
--add to storage
if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then
local successful, errortext = pcall(Details.Database.StoreEncounter)
4 years ago
if (not successful) then
3 years ago
Details:Msg("error occurred on Details.Database.StoreEncounter():", errortext)
4 years ago
end
else
Details.schedule_store_boss_encounter = true
end
3 years ago
Details:SendEvent("COMBAT_BOSS_DEFEATED", nil, Details.tabela_vigente)
4 years ago
Details:CheckFor_TrashSuppressionOnEncounterEnd()
else
3 years ago
Details:SendEvent("COMBAT_BOSS_WIPE", nil, Details.tabela_vigente)
4 years ago
3 years ago
--add to storage
if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then
local successful, errortext = pcall(Details.Database.StoreWipe)
4 years ago
if (not successful) then
3 years ago
Details:Msg("error occurred on Details.Database.StoreWipe():", errortext)
4 years ago
end
else
Details.schedule_store_boss_encounter_wipe = true
end
3 years ago
4 years ago
end
--if (Details:GetBossDetails (Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index) or ) then
3 years ago
4 years ago
Details.tabela_vigente.is_boss.index = Details.tabela_vigente.is_boss.index or 1
3 years ago
4 years ago
Details.tabela_vigente.enemy = Details.tabela_vigente.is_boss.encounter
if (Details.tabela_vigente.instance_type == "raid") then
3 years ago
4 years ago
Details.last_encounter2 = Details.last_encounter
Details.last_encounter = Details.tabela_vigente.is_boss.name
if (Details.pre_pot_used) then
3 years ago
Details.last_combat_pre_pot_used = Details.CopyTable(Details.pre_pot_used)
4 years ago
end
3 years ago
4 years ago
if (Details.pre_pot_used and Details.announce_prepots.enabled) then
3 years ago
Details:Msg(Details.pre_pot_used or "")
4 years ago
Details.pre_pot_used = nil
end
end
if (from_encounter_end) then
if (Details.encounter_table.start) then
Details.tabela_vigente:SetStartTime (Details.encounter_table.start)
end
Details.tabela_vigente:SetEndTime (Details.encounter_table ["end"] or GetTime())
end
3 years ago
--encounter boss function
4 years ago
local bossFunction, bossFunctionType = Details:GetBossFunction (Details.tabela_vigente.is_boss.mapid or 0, Details.tabela_vigente.is_boss.index or 0)
if (bossFunction) then
3 years ago
if (bitBand(bossFunctionType, 0x2) ~= 0) then --end of combat
4 years ago
if (not Details.logoff_saving_data) then
3 years ago
local successful, errortext = pcall(bossFunction, Details.tabela_vigente)
4 years ago
if (not successful) then
3 years ago
Details:Msg("error occurred on Encounter Boss Function:", errortext)
4 years ago
end
end
end
end
3 years ago
4 years ago
if (Details.tabela_vigente.instance_type == "raid") then
3 years ago
--schedule captures off
4 years ago
Details:CaptureSet (false, "damage", false, 15)
Details:CaptureSet (false, "energy", false, 15)
Details:CaptureSet (false, "aura", false, 15)
Details:CaptureSet (false, "energy", false, 15)
Details:CaptureSet (false, "spellcast", false, 15)
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) freezing parser for 15 seconds.")
4 years ago
end
end
3 years ago
--schedule sync
4 years ago
Details:EqualizeActorsSchedule (Details.host_of)
if (Details:GetEncounterEqualize (Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index)) then
3 years ago
Details:ScheduleTimer("DelayedSyncAlert", 3)
4 years ago
end
3 years ago
4 years ago
--else
-- if (Details.debug) then
-- Details:EqualizeActorsSchedule (Details.host_of)
-- end
--end
end
if (Details.solo) then
3 years ago
--debuffs need a checkup, not well functional right now
4 years ago
Details.CloseSoloDebuffs()
end
3 years ago
4 years ago
local tempo_do_combate = Details.tabela_vigente:GetCombatTime()
local invalid_combat
3 years ago
4 years ago
local zoneName, zoneType = GetInstanceInfo()
if (not Details.tabela_vigente.discard_segment and (zoneType == "none" or tempo_do_combate >= Details.minimum_combat_time or not Details.tabela_historico.tabelas[1])) then
Details.tabela_historico:adicionar (Details.tabela_vigente) --move a tabela atual para dentro do hist�rico
--8.0.1 miss data isn't required at the moment, spells like akari's soul has been removed from the game
--Details:CanSendMissData()
3 years ago
4 years ago
if (Details.tabela_vigente.is_boss) then
if (IsInRaid()) then
local cleuID = Details.tabela_vigente.is_boss.id
local diff = Details.tabela_vigente.is_boss.diff
if (cleuID and diff == 16) then -- 16 mythic
local raidData = Details.raid_data
3 years ago
4 years ago
--get or build mythic raid data table
local mythicRaidData = raidData.mythic_raid_data
if (not mythicRaidData) then
mythicRaidData = {}
raidData.mythic_raid_data = mythicRaidData
end
3 years ago
4 years ago
--get or build a table for this cleuID
mythicRaidData [cleuID] = mythicRaidData [cleuID] or {wipes = 0, kills = 0, best_try = 1, longest = 0, try_history = {}}
local cleuIDData = mythicRaidData [cleuID]
3 years ago
4 years ago
--store encounter data for plugins and weakauras
if (Details.tabela_vigente:GetCombatTime() > cleuIDData.longest) then
cleuIDData.longest = Details.tabela_vigente:GetCombatTime()
end
3 years ago
4 years ago
if (Details.tabela_vigente.is_boss.killed) then
cleuIDData.kills = cleuIDData.kills + 1
cleuIDData.best_try = 0
3 years ago
tinsert(cleuIDData.try_history, {0, Details.tabela_vigente:GetCombatTime()})
--print("KILL", "best try", cleuIDData.best_try, "amt kills", cleuIDData.kills, "wipes", cleuIDData.wipes, "longest", cleuIDData.longest)
4 years ago
else
cleuIDData.wipes = cleuIDData.wipes + 1
if (Details.boss1_health_percent and Details.boss1_health_percent < cleuIDData.best_try) then
cleuIDData.best_try = Details.boss1_health_percent
3 years ago
tinsert(cleuIDData.try_history, {Details.boss1_health_percent, Details.tabela_vigente:GetCombatTime()})
4 years ago
end
3 years ago
--print("WIPE", "best try", cleuIDData.best_try, "amt kills", cleuIDData.kills, "wipes", cleuIDData.wipes, "longest", cleuIDData.longest)
4 years ago
end
end
end
--
end
3 years ago
4 years ago
--the combat is valid, see if the user is sharing data with somebody
if (Details.shareData) then
local zipData = Details:CompressData (Details.tabela_vigente, "comm")
if (zipData) then
3 years ago
print("has zip data")
4 years ago
end
end
3 years ago
4 years ago
else
invalid_combat = Details.tabela_vigente
3 years ago
--tutorial about the combat time < then 'minimum_combat_time'
local hasSeenTutorial = Details:GetTutorialCVar("MIN_COMBAT_TIME")
4 years ago
if (not hasSeenTutorial) then
local lower_instance = Details:GetLowerInstanceNumber()
if (lower_instance) then
3 years ago
lower_instance = Details:GetInstance(lower_instance)
4 years ago
if (lower_instance) then
3 years ago
lower_instance:InstanceAlert ("combat ignored: less than 5 seconds.", {[[Interface\BUTTONS\UI-GROUPLOOT-PASS-DOWN]], 18, 18, false, 0, 1, 0, 1}, 20, {function() Details:Msg("combat ignored: elapsed time less than 5 seconds."); Details:Msg("add '|cFFFFFF00Details.minimum_combat_time = 2;|r' on Auto Run Code to change the minimum time.") end})
4 years ago
Details:SetTutorialCVar ("MIN_COMBAT_TIME", true)
end
end
end
3 years ago
4 years ago
--in case of a forced discard segment, just check a second time if we have a previous combat.
if (not Details.tabela_historico.tabelas[1]) then
Details.tabela_vigente = Details.tabela_vigente
else
3 years ago
Details.tabela_vigente = Details.tabela_historico.tabelas[1] --pega a tabela do ultimo combate
4 years ago
end
if (Details.tabela_vigente:GetStartTime() == 0) then
--Details.tabela_vigente.start_time = Details._tempo
3 years ago
Details.tabela_vigente:SetStartTime (GetTime())
4 years ago
--Details.tabela_vigente.end_time = Details._tempo
3 years ago
Details.tabela_vigente:SetEndTime (GetTime())
4 years ago
end
3 years ago
4 years ago
Details.tabela_vigente.resincked = true
3 years ago
--tabela foi descartada, precisa atualizar os baseframes // precisa atualizer todos ou apenas o overall?
Details:InstanciaCallFunction(Details.AtualizarJanela)
4 years ago
if (Details.solo) then
local esta_instancia = Details.tabela_instancias[Details.solo]
3 years ago
if (Details.SoloTables.CombatID == Details:NumeroCombate()) then --significa que o solo mode validou o combate, como matar um bixo muito low level com uma s� porrada
if (Details.SoloTables.CombatIDLast and Details.SoloTables.CombatIDLast ~= 0) then --volta os dados da luta anterior
4 years ago
Details.SoloTables.CombatID = Details.SoloTables.CombatIDLast
3 years ago
4 years ago
else
if (Details.RefreshSolo) then
Details:RefreshSolo()
end
Details.SoloTables.CombatID = nil
end
end
end
3 years ago
4 years ago
Details:NumeroCombate (-1)
end
3 years ago
4 years ago
Details.host_of = nil
Details.host_by = nil
3 years ago
4 years ago
if (Details.cloud_process) then
3 years ago
Details:CancelTimer(Details.cloud_process)
4 years ago
end
3 years ago
4 years ago
Details.in_combat = false
Details.leaving_combat = false
3 years ago
4 years ago
Details:OnCombatPhaseChanged()
3 years ago
wipe(Details.tabela_vigente.PhaseData.damage_section)
wipe(Details.tabela_vigente.PhaseData.heal_section)
wipe(Details.cache_damage_group)
wipe(Details.cache_healing_group)
4 years ago
Details:UpdateParserGears()
3 years ago
--hide / alpha in combat
for index, instancia in ipairs(Details.tabela_instancias) do
4 years ago
if (instancia.ativa) then
if (instancia.auto_switch_to_old) then
instancia:CheckSwitchOnCombatEnd()
end
end
end
3 years ago
4 years ago
Details.pre_pot_used = nil
3 years ago
--do not wipe the encounter table if is in the argus encounter ~REMOVE on 8.0
4 years ago
if (Details.encounter_table and Details.encounter_table.id ~= 2092) then
3 years ago
wipe(Details.encounter_table)
4 years ago
else
if (Details.debug) then
3 years ago
Details:Msg("(debug) in argus encounter, cannot wipe the encounter table.")
4 years ago
end
end
3 years ago
Details:InstanceCall(Details.CheckPsUpdate)
4 years ago
if (invalid_combat) then
3 years ago
Details:SendEvent("COMBAT_INVALID")
Details:SendEvent("COMBAT_PLAYER_LEAVE", nil, invalid_combat)
4 years ago
else
3 years ago
Details:SendEvent("COMBAT_PLAYER_LEAVE", nil, Details.tabela_vigente)
4 years ago
end
3 years ago
4 years ago
Details:CheckForTextTimeCounter()
Details.StoreSpells()
Details:RunScheduledEventsAfterCombat()
end
function Details:GetPlayersInArena()
local aliados = GetNumGroupMembers() -- LE_PARTY_CATEGORY_HOME
for i = 1, aliados-1 do
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("party" .. i) or "DAMAGER"
if (role ~= "NONE" and UnitExists("party" .. i)) then
3 years ago
local name = GetUnitName("party" .. i, true)
4 years ago
Details.arena_table [name] = {role = role}
end
end
3 years ago
4 years ago
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") or "DAMAGER"
if (role ~= "NONE") then
3 years ago
local name = GetUnitName("player", true)
4 years ago
Details.arena_table [name] = {role = role}
end
--enemies
local enemiesAmount = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
table.wipe(_detalhes.arena_enemies)
for i = 1, enemiesAmount do
local enemyName = _G.GetUnitName("arena" .. i, true)
if (enemyName) then
_detalhes.arena_enemies[enemyName] = "arena" .. i
end
end
end
--attempt to get the arena unitId for an actor
function Details:GuessArenaEnemyUnitId(unitName)
for i = 1, 5 do
local unitId = "arena" .. i
local enemyName = _G.GetUnitName(unitId, true)
if (enemyName == unitName) then
_detalhes.arena_enemies[enemyName] = unitId
return unitId
end
end
end
4 years ago
local string_arena_enemyteam_damage = [[
3 years ago
local combat = Details:GetCombat("current")
4 years ago
local total = 0
3 years ago
4 years ago
for _, actor in combat[1]:ListActors() do
if (actor.arena_enemy) then
total = total + actor.total
end
end
3 years ago
4 years ago
return total
]]
3 years ago
4 years ago
local string_arena_myteam_damage = [[
3 years ago
local combat = Details:GetCombat("current")
4 years ago
local total = 0
3 years ago
4 years ago
for _, actor in combat[1]:ListActors() do
if (actor.arena_ally) then
total = total + actor.total
end
end
3 years ago
4 years ago
return total
]]
3 years ago
4 years ago
local string_arena_enemyteam_heal = [[
3 years ago
local combat = Details:GetCombat("current")
4 years ago
local total = 0
3 years ago
4 years ago
for _, actor in combat[2]:ListActors() do
if (actor.arena_enemy) then
total = total + actor.total
end
end
3 years ago
4 years ago
return total
]]
local string_arena_myteam_heal = [[
3 years ago
local combat = Details:GetCombat("current")
4 years ago
local total = 0
3 years ago
4 years ago
for _, actor in combat[2]:ListActors() do
if (actor.arena_ally) then
total = total + actor.total
end
end
3 years ago
4 years ago
return total
]]
3 years ago
4 years ago
function Details:CreateArenaSegment()
Details:GetPlayersInArena()
3 years ago
4 years ago
Details.arena_begun = true
Details.start_arena = nil
3 years ago
4 years ago
if (Details.in_combat) then
Details:SairDoCombate()
end
3 years ago
--registra os gr�ficos
4 years ago
Details:TimeDataRegister ("Your Team Damage", string_arena_myteam_damage, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
Details:TimeDataRegister ("Enemy Team Damage", string_arena_enemyteam_damage, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
3 years ago
4 years ago
Details:TimeDataRegister ("Your Team Healing", string_arena_myteam_heal, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
Details:TimeDataRegister ("Enemy Team Healing", string_arena_enemyteam_heal, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
3 years ago
Details.lastArenaStartTime = GetTime()
--inicia um novo combate
4 years ago
Details:EntrarEmCombate()
3 years ago
--sinaliza que esse combate � arena
4 years ago
Details.tabela_vigente.arena = true
Details.tabela_vigente.is_arena = {name = Details.zone_name, zone = Details.zone_name, mapid = Details.zone_id}
Details:SendEvent("COMBAT_ARENA_START")
end
3 years ago
--return the GetTime() of the current or latest arena match
function Details:GetArenaStartTime()
return Details.lastArenaStartTime
end
function Details:GetBattlegroundStartTime()
return Details.lastBattlegroundStartTime
end
4 years ago
function Details:StartArenaSegment(...)
if (Details.debug) then
Details:Msg("(debug) starting a new arena segment.")
end
local _, timeSeconds = select(1, ...)
if (Details.start_arena) then
Details:CancelTimer(Details.start_arena, true)
end
Details.start_arena = Details:ScheduleTimer("CreateArenaSegment", timeSeconds)
Details:GetPlayersInArena()
3 years ago
--CHAT_MSG_BG_SYSTEM_NEUTRAL - "The Arena battle has begun!""
4 years ago
end
function Details:EnteredInArena()
if (Details.debug) then
3 years ago
Details:Msg("(debug) the player EnteredInArena().")
4 years ago
end
3 years ago
4 years ago
Details.arena_begun = false
Details:GetPlayersInArena()
end
3 years ago
4 years ago
function Details:LeftArena()
if (Details.debug) then
3 years ago
Details:Msg("(debug) player LeftArena().")
4 years ago
end
3 years ago
4 years ago
Details.is_in_arena = false
Details.arena_begun = false
3 years ago
4 years ago
if (Details.start_arena) then
3 years ago
Details:CancelTimer(Details.start_arena, true)
4 years ago
end
3 years ago
4 years ago
Details:TimeDataUnregister ("Your Team Damage")
Details:TimeDataUnregister ("Enemy Team Damage")
3 years ago
4 years ago
Details:TimeDataUnregister ("Your Team Healing")
Details:TimeDataUnregister ("Enemy Team Healing")
3 years ago
Details:SendEvent("COMBAT_ARENA_END")
4 years ago
end
3 years ago
4 years ago
local validSpells = {
[220893] = {class = "ROGUE", spec = 261, maxPercent = 0.075, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
--[11366] = {class = "MAGE", spec = 63, maxPercent = 0.9, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
}
3 years ago
4 years ago
function Details:CanSendMissData()
if (not IsInRaid() and not IsInGroup()) then
return
end
3 years ago
local _, playerClass = UnitClass("player")
4 years ago
local specIndex = DetailsFramework.GetSpecialization()
local playerSpecID
if (specIndex) then
3 years ago
playerSpecID = DetailsFramework.GetSpecializationInfo(specIndex)
4 years ago
end
if (playerSpecID and playerClass) then
3 years ago
for spellID, t in pairs(validSpells) do
4 years ago
if (playerClass == t.class and playerSpecID == t.spec) then
Details:SendMissData (spellID, t.container, Details.network.ids [t.commID])
end
end
end
return false
end
3 years ago
4 years ago
function Details:SendMissData (spellID, containerType, commID)
local combat = Details.tabela_vigente
if (combat) then
local damageActor = combat (containerType, Details.playername)
if (damageActor) then
local spell = damageActor.spells:GetSpell (spellID)
if (spell) then
local data = {
[1] = containerType,
[2] = spellID,
[3] = spell.total,
[4] = spell.counter
}
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) sending miss data packet:", spellID, containerType, commID)
4 years ago
end
3 years ago
4 years ago
Details:SendRaidOrPartyData (commID, data)
end
end
end
end
3 years ago
4 years ago
function Details.HandleMissData (playerName, data)
local combat = Details.tabela_vigente
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) miss data received from:", playerName, "spellID:", data [2], data [3], data [4])
4 years ago
end
3 years ago
4 years ago
if (combat) then
local containerType = data[1]
3 years ago
if (type(containerType) ~= "number" or containerType < 1 or containerType > 4) then
4 years ago
return
end
local damageActor = combat (containerType, playerName)
if (damageActor) then
local spellID = data[2] --a spellID has been passed?
3 years ago
if (not spellID or type(spellID) ~= "number") then
4 years ago
return
end
local validateSpell = validSpells [spellID]
if (not validateSpell) then --is a valid spell?
return
end
--does the target player fit in the spell requirement on OUR end?
local class, spec, maxPercent = validateSpell.class, validateSpell.spec, validateSpell.maxPercent
if (class ~= damageActor.classe or spec ~= damageActor.spec) then
return
end
local total, counter = data[3], data[4]
3 years ago
if (type(total) ~= "number" or type(counter) ~= "number") then
4 years ago
return
end
if (total > (damageActor.total * maxPercent)) then
return
end
local spellObject = damageActor.spells:PegaHabilidade (spellID, true)
if (spellObject) then
if (spellObject.total < total and total > 0 and damageActor.nome ~= Details.playername) then
local difference = total - spellObject.total
if (difference > 0) then
spellObject.total = total
spellObject.counter = counter
damageActor.total = damageActor.total + difference
3 years ago
4 years ago
combat [containerType].need_refresh = true
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) miss data successful added from:", playerName, data [2], "difference:", difference)
4 years ago
end
end
end
end
end
end
end
3 years ago
4 years ago
function Details:MakeEqualizeOnActor (player, realm, receivedActor)
3 years ago
if (true) then --disabled for testing
4 years ago
return
end
3 years ago
local combat = Details:GetCombat("current")
local damage, heal, energy, misc = Details:GetAllActors("current", player)
4 years ago
if (not damage and not heal and not energy and not misc) then
3 years ago
--try adding server name
damage, heal, energy, misc = Details:GetAllActors("current", player.."-"..realm)
4 years ago
if (not damage and not heal and not energy and not misc) then
3 years ago
--not found any actor object, so we need to create
4 years ago
local actorName
3 years ago
4 years ago
if (realm ~= GetRealmName()) then
actorName = player.."-"..realm
else
actorName = player
end
3 years ago
4 years ago
local guid = Details:FindGUIDFromName (player)
3 years ago
4 years ago
-- 0x512 normal party
-- 0x514 normal raid
3 years ago
4 years ago
if (guid) then
damage = combat [1]:PegarCombatente (guid, actorName, 0x514, true)
heal = combat [2]:PegarCombatente (guid, actorName, 0x514, true)
energy = combat [3]:PegarCombatente (guid, actorName, 0x514, true)
misc = combat [4]:PegarCombatente (guid, actorName, 0x514, true)
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) equalize received actor:", actorName, damage, heal)
4 years ago
end
else
if (Details.debug) then
3 years ago
Details:Msg("(debug) equalize couldn't get guid for player ",player)
4 years ago
end
end
end
end
3 years ago
4 years ago
combat[1].need_refresh = true
combat[2].need_refresh = true
combat[3].need_refresh = true
combat[4].need_refresh = true
3 years ago
4 years ago
if (damage) then
if (damage.total < receivedActor [1][1]) then
if (Details.debug) then
3 years ago
Details:Msg(player .. " damage before: " .. damage.total .. " damage received: " .. receivedActor [1][1])
4 years ago
end
damage.total = receivedActor [1][1]
end
if (damage.damage_taken < receivedActor [1][2]) then
damage.damage_taken = receivedActor [1][2]
end
if (damage.friendlyfire_total < receivedActor [1][3]) then
damage.friendlyfire_total = receivedActor [1][3]
end
end
3 years ago
4 years ago
if (heal) then
if (heal.total < receivedActor [2][1]) then
heal.total = receivedActor [2][1]
end
if (heal.totalover < receivedActor [2][2]) then
heal.totalover = receivedActor [2][2]
end
if (heal.healing_taken < receivedActor [2][3]) then
heal.healing_taken = receivedActor [2][3]
end
end
3 years ago
4 years ago
if (energy) then
if (energy.mana and (receivedActor [3][1] > 0 and energy.mana < receivedActor [3][1])) then
energy.mana = receivedActor [3][1]
end
if (energy.e_rage and (receivedActor [3][2] > 0 and energy.e_rage < receivedActor [3][2])) then
energy.e_rage = receivedActor [3][2]
end
if (energy.e_energy and (receivedActor [3][3] > 0 and energy.e_energy < receivedActor [3][3])) then
energy.e_energy = receivedActor [3][3]
end
if (energy.runepower and (receivedActor [3][4] > 0 and energy.runepower < receivedActor [3][4])) then
energy.runepower = receivedActor [3][4]
end
end
3 years ago
4 years ago
if (misc) then
if (misc.interrupt and (receivedActor [4][1] > 0 and misc.interrupt < receivedActor [4][1])) then
misc.interrupt = receivedActor [4][1]
end
if (misc.dispell and (receivedActor [4][2] > 0 and misc.dispell < receivedActor [4][2])) then
misc.dispell = receivedActor [4][2]
end
end
end
3 years ago
4 years ago
function Details:EqualizePets()
3 years ago
--check for pets without owner
for _, actor in ipairs(Details.tabela_vigente[1]._ActorTable) do
--have flag and the flag tell us he is a pet
if (actor.flag_original and bit.band(actor.flag_original, OBJECT_TYPE_PETS) ~= 0) then
--do not have owner and he isn't on owner container
4 years ago
if (not actor.owner and not Details.tabela_pets.pets [actor.serial]) then
Details:SendPetOwnerRequest (actor.serial, actor.nome)
end
end
end
end
3 years ago
4 years ago
function Details:EqualizeActorsSchedule (host_of)
3 years ago
--store pets sent through 'needpetowner'
4 years ago
Details.sent_pets = Details.sent_pets or {n = time()}
if (Details.sent_pets.n+20 < time()) then
3 years ago
wipe(Details.sent_pets)
4 years ago
Details.sent_pets.n = time()
end
3 years ago
--pet equilize disabled on details 1.4.0
--Details:ScheduleTimer("EqualizePets", 1+math.random())
--do not equilize if there is any disabled capture
4 years ago
--if (Details:CaptureIsAllEnabled()) then
3 years ago
Details:ScheduleTimer("EqualizeActors", 2+math.random()+math.random() , host_of)
4 years ago
--end
end
3 years ago
4 years ago
function Details:EqualizeActors (host_of)
3 years ago
--Disabling the sync. Since WoD combatlog are sent between player on phased zones during encounters.
if (not host_of or true) then --full disabled for testing
4 years ago
return
end
3 years ago
4 years ago
if (Details.debug) then
3 years ago
Details:Msg("(debug) sending equilize actor data")
4 years ago
end
3 years ago
4 years ago
local damage, heal, energy, misc
3 years ago
4 years ago
if (host_of) then
3 years ago
damage, heal, energy, misc = Details:GetAllActors("current", host_of)
4 years ago
else
3 years ago
damage, heal, energy, misc = Details:GetAllActors("current", Details.playername)
4 years ago
end
3 years ago
4 years ago
if (damage) then
damage = {damage.total or 0, damage.damage_taken or 0, damage.friendlyfire_total or 0}
else
damage = {0, 0, 0}
end
3 years ago
4 years ago
if (heal) then
heal = {heal.total or 0, heal.totalover or 0, heal.healing_taken or 0}
else
heal = {0, 0, 0}
end
3 years ago
4 years ago
if (energy) then
energy = {energy.mana or 0, energy.e_rage or 0, energy.e_energy or 0, energy.runepower or 0}
else
energy = {0, 0, 0, 0}
end
3 years ago
4 years ago
if (misc) then
misc = {misc.interrupt or 0, misc.dispell or 0}
else
misc = {0, 0}
end
3 years ago
4 years ago
local data = {damage, heal, energy, misc}
3 years ago
--envia os dados do proprio host pra ele antes
4 years ago
if (host_of) then
Details:SendRaidDataAs (Details.network.ids.CLOUD_EQUALIZE, host_of, nil, data)
Details:EqualizeActors()
else
Details:SendRaidData (Details.network.ids.CLOUD_EQUALIZE, data)
end
3 years ago
4 years ago
end
3 years ago
4 years ago
function Details:FlagActorsOnPvPCombat()
3 years ago
for class_type, container in ipairs(Details.tabela_vigente) do
for _, actor in ipairs(container._ActorTable) do
4 years ago
actor.pvp_component = true
end
end
end
3 years ago
4 years ago
function Details:FlagActorsOnBossFight()
3 years ago
for class_type, container in ipairs(Details.tabela_vigente) do
for _, actor in ipairs(container._ActorTable) do
4 years ago
actor.boss_fight_component = true
end
end
end
3 years ago
local fight_component = function(energy_container, misc_container, name)
4 years ago
local on_energy = energy_container._ActorTable [energy_container._NameIndexTable [name]]
if (on_energy) then
on_energy.fight_component = true
end
local on_misc = misc_container._ActorTable [misc_container._NameIndexTable [name]]
if (on_misc) then
on_misc.fight_component = true
end
end
3 years ago
4 years ago
function Details:FlagActorsOnCommonFight()
3 years ago
4 years ago
local damage_container = Details.tabela_vigente [1]
local healing_container = Details.tabela_vigente [2]
local energy_container = Details.tabela_vigente [3]
local misc_container = Details.tabela_vigente [4]
3 years ago
4 years ago
local mythicDungeonRun = Details.tabela_vigente.is_mythic_dungeon_segment
3 years ago
for class_type, container in ipairs({damage_container, healing_container}) do
for _, actor in ipairs(container._ActorTable) do
4 years ago
if (mythicDungeonRun) then
actor.fight_component = true
end
3 years ago
4 years ago
if (actor.grupo) then
if (class_type == 1 or class_type == 2) then
3 years ago
for target_name, amount in pairs(actor.targets) do
4 years ago
local target_object = container._ActorTable [container._NameIndexTable [target_name]]
if (target_object) then
target_object.fight_component = true
fight_component (energy_container, misc_container, target_name)
end
end
if (class_type == 1) then
3 years ago
for damager_actor, _ in pairs(actor.damage_from) do
4 years ago
local target_object = container._ActorTable [container._NameIndexTable [damager_actor]]
if (target_object) then
target_object.fight_component = true
fight_component (energy_container, misc_container, damager_actor)
end
end
elseif (class_type == 2) then
3 years ago
for healer_actor, _ in pairs(actor.healing_from) do
4 years ago
local target_object = container._ActorTable [container._NameIndexTable [healer_actor]]
if (target_object) then
target_object.fight_component = true
fight_component (energy_container, misc_container, healer_actor)
end
end
end
end
end
end
3 years ago
4 years ago
end
end
function Details:AtualizarJanela (instancia, _segmento)
3 years ago
if (_segmento) then --apenas atualizar janelas que estejam mostrando o segmento solicitado
4 years ago
if (_segmento == instancia.segmento) then
3 years ago
instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true)
4 years ago
end
else
if (instancia.modo == modo_GROUP or instancia.modo == modo_ALL) then
3 years ago
instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true)
4 years ago
end
end
end
function Details:PostponeInstanceToCurrent (instance)
if (
3 years ago
not instance.last_interaction or
4 years ago
(
(instance.ativa) and
3 years ago
(instance.last_interaction+3 < _tempo) and
(not DetailsReportWindow or not DetailsReportWindow:IsShown()) and
4 years ago
(not Details.playerDetailWindow:IsShown())
)
) then
instance._postponing_current = nil
if (instance.segmento == 0) then
return Details:TrocaSegmentoAtual (instance)
else
return
end
end
if (instance.is_interacting and instance.last_interaction < _tempo) then
instance.last_interaction = _tempo
end
3 years ago
instance._postponing_current = Details:ScheduleTimer("PostponeInstanceToCurrent", 1, instance)
4 years ago
end
3 years ago
4 years ago
function Details:TrocaSegmentoAtual (instancia, is_encounter)
if (instancia.segmento == 0 and instancia.baseframe and instancia.ativa) then
3 years ago
4 years ago
if (not is_encounter) then
if (instancia.is_interacting) then
if (not instancia.last_interaction or instancia.last_interaction < _tempo) then
instancia.last_interaction = _tempo or time()
end
end
3 years ago
4 years ago
if ((instancia.last_interaction and (instancia.last_interaction+3 > Details._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (Details.playerDetailWindow:IsShown())) then
3 years ago
--postpone
instancia._postponing_current = Details:ScheduleTimer("PostponeInstanceToCurrent", 1, instancia)
4 years ago
return
end
end
3 years ago
--print("==> Changing the Segment now! - control.lua 1220")
4 years ago
instancia.last_interaction = _tempo - 4 --pode setar, completou o ciclo
instancia._postponing_current = nil
instancia.showing = Details.tabela_vigente
instancia:ResetaGump()
3 years ago
Details.FadeHandler.Fader(instancia, "in", nil, "barras")
4 years ago
end
end
3 years ago
4 years ago
function Details:SetTrashSuppression (n)
3 years ago
assert(type(n) == "number", "SetTrashSuppression expects a number on index 1.")
4 years ago
if (n < 0) then
n = 0
end
Details.instances_suppress_trash = n
end
function Details:CheckFor_SuppressedWindowsOnEncounterFound()
for _, instance in Details:ListInstances() do
if (instance.ativa and instance.baseframe and (not instance.last_interaction or instance.last_interaction > _tempo) and instance.segmento == 0) then
Details:TrocaSegmentoAtual (instance, true)
end
end
end
function Details:CheckFor_EnabledTrashSuppression()
if (Details.HasTrashSuppression and Details.HasTrashSuppression > _tempo) then
self.last_interaction = Details.HasTrashSuppression
end
end
function Details:SetTrashSuppressionAfterEncounter()
3 years ago
Details:InstanceCall("CheckFor_EnabledTrashSuppression")
4 years ago
end
function Details:CheckFor_TrashSuppressionOnEncounterEnd()
if (Details.instances_suppress_trash > 0) then
Details.HasTrashSuppression = _tempo + Details.instances_suppress_trash
3 years ago
--delaying in 3 seconds for other stuff like auto open windows after combat.
Details:ScheduleTimer("SetTrashSuppressionAfterEncounter", 3)
4 years ago
end
end
3 years ago
--internal GetCombatId() version
4 years ago
function Details:NumeroCombate (flag)
if (flag == 0) then
Details.combat_id = 0
elseif (flag) then
Details.combat_id = Details.combat_id + flag
end
return Details.combat_id
end
3 years ago
--tooltip fork / search key: ~tooltip
4 years ago
local avatarPoint = {"bottomleft", "topleft", -3, -4}
local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}}
local textPoint = {"left", "right", -11, -5}
local avatarTexCoord = {0, 1, 0, 1}
local backgroundColor = {0, 0, 0, 0.6}
local avatarTextColor = {1, 1, 1, 1}
3 years ago
4 years ago
function Details:AddTooltipReportLineText()
GameCooltip:AddLine (Loc ["STRING_CLICK_REPORT_LINE1"], Loc ["STRING_CLICK_REPORT_LINE2"])
GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.8)
end
3 years ago
4 years ago
function Details:AddTooltipBackgroundStatusbar (side, value, useSpark)
Details.tooltip.background [4] = 0.8
Details.tooltip.icon_size.W = Details.tooltip.line_height
Details.tooltip.icon_size.H = Details.tooltip.line_height
3 years ago
--[[spark options
["SparkTexture"] = true,
["SparkHeightOffset"] = true,
["SparkWidthOffset"] = true,
["SparkHeight"] = true,
["SparkWidth"] = true,
["SparkAlpha"] = true,
["SparkColor"] = true,
["SparkPositionXOffset"] = true,
["SparkPositionYOffset"] = true,
--]]
useSpark = true
--GameCooltip:SetOption("SparkHeightOffset", 6)
GameCooltip:SetOption("SparkTexture", [[Interface\Buttons\WHITE8X8]])
GameCooltip:SetOption("SparkWidth", 1)
GameCooltip:SetOption("SparkHeight", 20)
GameCooltip:SetOption("SparkColor", Details.tooltip.divisor_color)
GameCooltip:SetOption("SparkAlpha", 0.15)
GameCooltip:SetOption("SparkPositionXOffset", 5)
--GameCooltip:SetOption("SparkAlpha", 0.3)
--GameCooltip:SetOption("SparkPositionXOffset", -2)
4 years ago
value = value or 100
3 years ago
4 years ago
if (not side) then
local r, g, b, a = unpack(Details.tooltip.bar_color)
local rBG, gBG, bBG, aBG = unpack(Details.tooltip.background)
GameCooltip:AddStatusBar (value, 1, r, g, b, a, useSpark, {value = 100, color = {rBG, gBG, bBG, aBG}, texture = [[Interface\AddOns\Details\images\bar_serenity]]})
3 years ago
4 years ago
else
GameCooltip:AddStatusBar (value, 2, unpack(Details.tooltip.bar_color))
4 years ago
end
end
3 years ago
4 years ago
function Details:AddTooltipHeaderStatusbar (r, g, b, a)
3 years ago
local r, g, b, a, statusbarGlow, backgroundBar = unpack(Details.tooltip.header_statusbar)
4 years ago
GameCooltip:AddStatusBar (100, 1, r, g, b, a, statusbarGlow, backgroundBar, "Skyline")
end
3 years ago
4 years ago
-- /run local a,b=Details.tooltip.header_statusbar,0.3;a[1]=b;a[2]=b;a[3]=b;a[4]=0.8;
3 years ago
4 years ago
function Details:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B, separator)
if (separator and separator == true) then
GameCooltip:AddLine ("", "", nil, nil, 1, 1, 1, 1, 8)
3 years ago
4 years ago
return
end
if (Details.tooltip.show_amount) then
GameCooltip:AddLine (headerText, "x" .. amount .. "", nil, headerColor, 1, 1, 1, .4, Details.tooltip.fontsize_title)
else
GameCooltip:AddLine (headerText, nil, nil, headerColor, nil, Details.tooltip.fontsize_title)
end
if (iconTexture) then
GameCooltip:AddIcon (iconTexture, 1, 1, 14, 14, L or 0, R or 1, T or 0, B or 1)
end
end
3 years ago
4 years ago
local bgColor, borderColor = {0, 0, 0, 0.8}, {0, 0, 0, 0} --{0.37, 0.37, 0.37, .75}, {.30, .30, .30, .3}
3 years ago
4 years ago
function Details:FormatCooltipForSpells()
local GameCooltip = GameCooltip
GameCooltip:Reset()
GameCooltip:SetType ("tooltip")
GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_background_dark_withline]])
3 years ago
GameCooltip:SetOption("TextSize", Details.tooltip.fontsize)
GameCooltip:SetOption("TextFont", Details.tooltip.fontface)
GameCooltip:SetOption("TextColor", Details.tooltip.fontcolor)
GameCooltip:SetOption("TextColorRight", Details.tooltip.fontcolor_right)
GameCooltip:SetOption("TextShadow", Details.tooltip.fontshadow and "OUTLINE")
GameCooltip:SetOption("LeftBorderSize", -5)
GameCooltip:SetOption("RightBorderSize", 5)
GameCooltip:SetOption("RightTextMargin", 0)
GameCooltip:SetOption("VerticalOffset", 9)
GameCooltip:SetOption("AlignAsBlizzTooltip", true)
GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -8)
GameCooltip:SetOption("LineHeightSizeOffset", 4)
GameCooltip:SetOption("VerticalPadding", -4)
GameCooltip:SetBackdrop(1, Details.cooltip_preset2_backdrop, bgColor, borderColor)
4 years ago
end
function Details:BuildInstanceBarTooltip (frame)
local GameCooltip = GameCooltip
Details:FormatCooltipForSpells()
3 years ago
GameCooltip:SetOption("MinWidth", _math_max (230, self.baseframe:GetWidth()*0.98))
4 years ago
local myPoint = Details.tooltip.anchor_point
local anchorPoint = Details.tooltip.anchor_relative
local x_Offset = Details.tooltip.anchor_offset[1]
local y_Offset = Details.tooltip.anchor_offset[2]
3 years ago
4 years ago
if (Details.tooltip.anchored_to == 1) then
3 years ago
4 years ago
GameCooltip:SetHost (frame, myPoint, anchorPoint, x_Offset, y_Offset)
else
GameCooltip:SetHost (DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset)
end
end
3 years ago
function Details:MontaTooltip(frame, whichRowLine, keydown)
4 years ago
self:BuildInstanceBarTooltip (frame)
3 years ago
4 years ago
local GameCooltip = GameCooltip
3 years ago
local esta_barra = self.barras [whichRowLine] --barra que o mouse passou em cima e ir� mostrar o tooltip
local objeto = esta_barra.minha_tabela --pega a referencia da tabela --retorna a classe_damage ou classe_heal
if (not objeto) then --a barra n�o possui um objeto
4 years ago
return false
end
--verifica por tooltips especiais:
3 years ago
if (objeto.dead) then --� uma barra de dead
return Details:ToolTipDead (self, objeto, esta_barra, keydown) --inst�ncia, [morte], barra
4 years ago
elseif (objeto.byspell) then
return Details:ToolTipBySpell (self, objeto, esta_barra, keydown)
elseif (objeto.frags) then
return Details:ToolTipFrags (self, objeto, esta_barra, keydown)
elseif (objeto.boss_debuff) then
return Details:ToolTipVoidZones (self, objeto, esta_barra, keydown)
end
3 years ago
local t = objeto:ToolTip (self, whichRowLine, esta_barra, keydown) --inst�ncia, n� barra, objeto barra, keydown
4 years ago
if (t) then
3 years ago
4 years ago
if (objeto.serial and objeto.serial ~= "") then
local avatar = NickTag:GetNicknameTable (objeto.serial, true)
if (avatar and not Details.ignore_nicktag) then
if (avatar [2] and avatar [4] and avatar [1]) then
3 years ago
GameCooltip:SetBannerImage (1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path
GameCooltip:SetBannerImage (2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --background
GameCooltip:SetBannerText (1, (not Details.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname
4 years ago
end
else
3 years ago
--if (Details.remove_realm_from_name and objeto.displayName:find("%*")) then
-- GameCooltip:SetBannerImage (1, [[Interface\AddOns\Details\images\background]], 20, 30, avatarPoint, avatarTexCoord, {0, 0, 0, 0}) --overlay [2] avatar path
-- GameCooltip:SetBannerImage (2, [[Interface\PetBattles\Weather-BurntEarth]], 160, 30, {{"bottomleft", "topleft", 0, -5}, {"bottomright", "topright", 0, -5}}, {0.12, 0.88, 1, 0}, {0, 0, 0, 0.1}) --overlay [2] avatar path {0, 0, 0, 0}
-- GameCooltip:SetBannerText (1, objeto.nome, {"left", "left", 11, -8}, {1, 1, 1, 0.7}, 10, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname
4 years ago
--end
end
end
GameCooltip:ShowCooltip()
end
end
3 years ago
4 years ago
function Details.gump:UpdateTooltip (whichRowLine, esta_barra, instancia)
3 years ago
if (IsShiftKeyDown()) then
return instancia:MontaTooltip(esta_barra, whichRowLine, "shift")
elseif (IsControlKeyDown()) then
return instancia:MontaTooltip(esta_barra, whichRowLine, "ctrl")
elseif (IsAltKeyDown()) then
return instancia:MontaTooltip(esta_barra, whichRowLine, "alt")
4 years ago
else
3 years ago
return instancia:MontaTooltip(esta_barra, whichRowLine)
4 years ago
end
end
3 years ago
4 years ago
function Details:EndRefresh (instancia, total, combatTable, showing)
Details:EsconderBarrasNaoUsadas (instancia, showing)
end
3 years ago
4 years ago
function Details:EsconderBarrasNaoUsadas (instancia, showing)
3 years ago
--primeira atualiza��o ap�s uma mudan�a de segmento -- verifica se h� mais barras sendo mostradas do que o necess�rio
4 years ago
--------------------
if (instancia.v_barras) then
3 years ago
--print("mostrando", instancia.rows_showing, instancia.rows_created)
4 years ago
for barra_numero = instancia.rows_showing+1, instancia.rows_created do
3 years ago
Details.FadeHandler.Fader(instancia.barras[barra_numero], "in")
4 years ago
end
instancia.v_barras = false
3 years ago
4 years ago
if (instancia.rows_showing == 0 and instancia:GetSegment() == -1) then -- -1 overall data
if (not instancia:IsShowingOverallDataWarning()) then
3 years ago
local tutorial = Details:GetTutorialCVar("OVERALLDATA_WARNING1") or 0
if ((type(tutorial) == "number") and (tutorial < 60)) then
4 years ago
Details:SetTutorialCVar ("OVERALLDATA_WARNING1", tutorial + 1)
instancia:ShowOverallDataWarning (true)
end
end
else
if (instancia:IsShowingOverallDataWarning()) then
instancia:ShowOverallDataWarning (false)
end
end
end
return showing
end
3 years ago
--call update functions
4 years ago
function Details:RefreshAllMainWindows (forcar)
local combatTable = self.showing
--the the segment does not have a valid combat, freeze the window
if (not combatTable) then
if (not self.freezed) then
return self:Freeze()
end
return
end
local need_refresh = combatTable[self.atributo].need_refresh
if (not need_refresh and not forcar) then
3 years ago
return --n�o precisa de refresh
4 years ago
--else
--combatTable[self.atributo].need_refresh = false
end
3 years ago
if (self.atributo == 1) then --damage
4 years ago
return atributo_damage:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
3 years ago
elseif (self.atributo == 2) then --heal
4 years ago
return atributo_heal:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
3 years ago
elseif (self.atributo == 3) then --energy
4 years ago
return atributo_energy:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
3 years ago
elseif (self.atributo == 4) then --outros
4 years ago
return atributo_misc:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
3 years ago
elseif (self.atributo == 5) then --ocustom
4 years ago
return atributo_custom:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
end
end
function Details:ForceRefresh()
self:RefreshMainWindow(true)
end
3 years ago
4 years ago
function Details:RefreshMainWindow(instance, forceRefresh)
if (not instance or type(instance) == "boolean") then
forceRefresh = instance
instance = self
end
3 years ago
4 years ago
if (not forceRefresh) then
Details.LastUpdateTick = Details._tempo
end
3 years ago
4 years ago
if (instance == -1) then
--update
for index, instance in ipairs(Details.tabela_instancias) do
if (instance.ativa) then
if (instance.modo == modo_GROUP or instance.modo == modo_ALL) then
instance:RefreshAllMainWindows(forceRefresh)
--print("all instances got updates")
end
end
end
3 years ago
4 years ago
--flag windows as no need update next tick
for index, instance in ipairs(Details.tabela_instancias) do
if (instance.ativa and instance.showing) then
if (instance.modo == modo_GROUP or instance.modo == modo_ALL) then
if (instance.atributo <= 4) then
instance.showing [instance.atributo].need_refresh = false
end
end
end
end
if (not forceRefresh) then --update player details window if opened
if (info.ativo) then
--print("info.jogador:MontaInfo()")
return info.jogador:MontaInfo()
end
end
3 years ago
4 years ago
return
3 years ago
4 years ago
else
if (not instance.ativa) then
--print("instance not actived", instance.RefreshMainWindow, 1+nil)
return
end
end
3 years ago
4 years ago
if (instance.modo == modo_ALL or instance.modo == modo_GROUP) then
--print("updating all instances...")
return instance:RefreshAllMainWindows (forceRefresh)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--core
4 years ago
function Details:AutoEraseConfirm()
4 years ago
4 years ago
local panel = _G.DetailsEraseDataConfirmation
if (not panel) then
4 years ago
panel = CreateFrame("frame", "DetailsEraseDataConfirmation", UIParent, "BackdropTemplate")
panel:SetSize(400, 85)
panel:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
4 years ago
edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize = 12})
4 years ago
panel:SetPoint("center", UIParent)
panel:SetBackdropColor(0, 0, 0, 0.4)
DetailsFramework:ApplyStandardBackdrop(panel)
3 years ago
panel:SetScript("OnMouseDown", function(self, button)
4 years ago
if (button == "RightButton") then
panel:Hide()
end
end)
4 years ago
--[=[
create 3 options
- overall data only
- current data only
- both
--=]=]
3 years ago
local text = Details.gump:CreateLabel(panel, Loc ["STRING_OPTIONS_CONFIRM_ERASE"], nil, nil, "GameFontNormal")
text:SetPoint("center", panel, "center")
text:SetPoint("top", panel, "top", 0, -10)
4 years ago
3 years ago
local no = Details.gump:CreateButton(panel, function() panel:Hide() end, 90, 20, Loc ["STRING_NO"])
no:SetPoint("bottomleft", panel, "bottomleft", 30, 10)
4 years ago
no:InstallCustomTexture (nil, nil, nil, nil, true)
4 years ago
3 years ago
local yes = Details.gump:CreateButton(panel, function() panel:Hide(); Details.tabela_historico:resetar() end, 90, 20, Loc ["STRING_YES"])
yes:SetPoint("bottomright", panel, "bottomright", -30, 10)
4 years ago
yes:InstallCustomTexture (nil, nil, nil, nil, true)
end
4 years ago
4 years ago
panel:Show()
end
function Details:CheckForAutoErase (mapid)
if (Details.last_instance_id ~= mapid) then
Details.tabela_historico:resetar_overall()
3 years ago
4 years ago
if (Details.segments_auto_erase == 2) then
--ask
3 years ago
Details:ScheduleTimer("AutoEraseConfirm", 1)
4 years ago
elseif (Details.segments_auto_erase == 3) then
--erase
Details.tabela_historico:resetar()
end
else
if (_tempo > Details.last_instance_time + 21600) then --6 hours
if (Details.segments_auto_erase == 2) then
--ask
3 years ago
Details:ScheduleTimer("AutoEraseConfirm", 1)
4 years ago
elseif (Details.segments_auto_erase == 3) then
--erase
Details.tabela_historico:resetar()
end
end
end
3 years ago
4 years ago
Details.last_instance_id = mapid
Details.last_instance_time = _tempo
--Details.last_instance_time = 0 --debug
end
function Details:UpdateControl()
_tempo = Details._tempo
3 years ago
end
4 years ago