Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.58 KB | None | 0 0
  1. -- combat class object
  2.  
  3. local _detalhes = _G._detalhes
  4. local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
  5. local _
  6.  
  7. --[[global]] DETAILS_TOTALS_ONLYGROUP = true
  8.  
  9. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  10. --> local pointers
  11.  
  12. local _setmetatable = setmetatable -- lua local
  13. local _ipairs = ipairs -- lua local
  14. local _pairs = pairs -- lua local
  15. local _bit_band = bit.band -- lua local
  16. local _date = date -- lua local
  17. local _table_remove = table.remove -- lua local
  18. local _rawget = rawget
  19. local _math_max = math.max
  20. local _math_floor = math.floor
  21. local _GetTime = GetTime
  22.  
  23. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  24. --> constants
  25.  
  26. local combate = _detalhes.combate
  27. local container_combatentes = _detalhes.container_combatentes
  28. local class_type_dano = _detalhes.atributos.dano
  29. local class_type_cura = _detalhes.atributos.cura
  30. local class_type_e_energy = _detalhes.atributos.e_energy
  31. local class_type_misc = _detalhes.atributos.misc
  32.  
  33. local REACTION_HOSTILE = 0x00000040
  34. local CONTROL_PLAYER = 0x00000100
  35.  
  36. --local _tempo = time()
  37. local _tempo = _GetTime()
  38.  
  39. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  40. --> api functions
  41.  
  42. --combat (container type, actor name)
  43. _detalhes.call_combate = function (self, class_type, name)
  44. local container = self[class_type]
  45. local index_mapa = container._NameIndexTable [name]
  46. local actor = container._ActorTable [index_mapa]
  47. return actor
  48. end
  49. combate.__call = _detalhes.call_combate
  50.  
  51. --get the start date and end date
  52. function combate:GetDate()
  53. return self.data_inicio, self.data_fim
  54. end
  55.  
  56. --set the combat date
  57. function combate:SetDate (started, ended)
  58. if (started and type (started) == "string") then
  59. self.data_inicio = started
  60. end
  61. if (ended and type (ended) == "string") then
  62. self.data_fim = ended
  63. end
  64. end
  65.  
  66. --return data for charts
  67. function combate:GetTimeData (name)
  68. return self.TimeData [name]
  69. end
  70.  
  71. function combate:GetContainer (attribute)
  72. return self [attribute]
  73. end
  74.  
  75. function combate:GetRoster()
  76. return self.raid_roster
  77. end
  78.  
  79. function combate:InstanceType()
  80. return _rawget (self, "instance_type")
  81. end
  82.  
  83. function combate:IsTrash()
  84. return _rawget (self, "is_trash")
  85. end
  86.  
  87. function combate:GetDifficulty()
  88. return self.is_boss and self.is_boss.diff
  89. end
  90.  
  91. function combate:GetBossInfo()
  92. return self.is_boss
  93. end
  94.  
  95. function combate:GetPhases()
  96. return self.PhaseData
  97. end
  98.  
  99. function combate:GetPvPInfo()
  100. return self.is_pvp
  101. end
  102.  
  103. function combate:GetMythicDungeonInfo()
  104. return self.is_mythic_dungeon
  105. end
  106.  
  107. function combate:GetMythicDungeonTrashInfo()
  108. return self.is_mythic_dungeon_trash
  109. end
  110.  
  111. function combate:IsMythicDungeon()
  112. local is_segment = self.is_mythic_dungeon_segment
  113. local run_id = self.is_mythic_dungeon_run_id
  114. return is_segment, run_id
  115. end
  116.  
  117. function combate:IsMythicDungeonOverall()
  118. return self.is_mythic_dungeon and self.is_mythic_dungeon.OverallSegment
  119. end
  120.  
  121. function combate:GetArenaInfo()
  122. return self.is_arena
  123. end
  124.  
  125. function combate:GetDeaths()
  126. return self.last_events_tables
  127. end
  128.  
  129. function combate:GetCombatId()
  130. return self.combat_id
  131. end
  132.  
  133. function combate:GetCombatNumber()
  134. return self.combat_counter
  135. end
  136.  
  137. function combate:GetAlteranatePower()
  138. return self.alternate_power
  139. end
  140.  
  141. --return the name of the encounter or enemy
  142. function combate:GetCombatName (try_find)
  143. if (self.is_pvp) then
  144. return self.is_pvp.name
  145.  
  146. elseif (self.is_boss) then
  147. return self.is_boss.encounter
  148.  
  149. elseif (self.is_mythic_dungeon_trash) then
  150. return self.is_mythic_dungeon_trash.ZoneName .. " (" .. Loc ["STRING_SEGMENTS_LIST_TRASH"] .. ")"
  151.  
  152. elseif (_rawget (self, "is_trash")) then
  153. return Loc ["STRING_SEGMENT_TRASH"]
  154.  
  155. else
  156. if (self.enemy) then
  157. return self.enemy
  158. end
  159. if (try_find) then
  160. return _detalhes:FindEnemy()
  161. end
  162. end
  163. return Loc ["STRING_UNKNOW"]
  164. end
  165.  
  166. --[[global]] DETAILS_SEGMENTID_OVERALL = -1
  167. --[[global]] DETAILS_SEGMENTID_CURRENT = 0
  168.  
  169. --enum segments type
  170. --[[global]] DETAILS_SEGMENTTYPE_GENERIC = 0
  171.  
  172. --[[global]] DETAILS_SEGMENTTYPE_OVERALL = 1
  173.  
  174. --[[global]] DETAILS_SEGMENTTYPE_DUNGEON_TRASH = 5
  175. --[[global]] DETAILS_SEGMENTTYPE_DUNGEON_BOSS = 6
  176.  
  177. --[[global]] DETAILS_SEGMENTTYPE_RAID_TRASH = 7
  178. --[[global]] DETAILS_SEGMENTTYPE_RAID_BOSS = 8
  179.  
  180. --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_GENERIC = 10
  181. --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH = 11
  182. --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL = 12
  183. --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL = 13
  184. --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS = 14
  185.  
  186. --[[global]] DETAILS_SEGMENTTYPE_PVP_ARENA = 20
  187. --[[global]] DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND = 21
  188.  
  189. function combate:GetCombatType()
  190. --> mythic dungeon
  191. local isMythicDungeon = is_mythic_dungeon_segment
  192. if (isMythicDungeon) then
  193. local isMythicDungeonTrash = self.is_mythic_dungeon_trash
  194. if (isMythicDungeonTrash) then
  195. return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH
  196. else
  197. local isMythicDungeonOverall = self.is_mythic_dungeon and self.is_mythic_dungeon.OverallSegment
  198. local isMythicDungeonTrashOverall = self.is_mythic_dungeon and self.is_mythic_dungeon.TrashOverallSegment
  199. if (isMythicDungeonOverall) then
  200. return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL
  201. elseif (isMythicDungeonTrashOverall) then
  202. return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL
  203. end
  204.  
  205. local bossEncounter = self.is_boss
  206. if (bossEncounter) then
  207. return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS
  208. end
  209.  
  210. return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_GENERIC
  211. end
  212. end
  213.  
  214. --> arena
  215. local arenaInfo = self.is_arena
  216. if (arenaInfo) then
  217. return DETAILS_SEGMENTTYPE_PVP_ARENA
  218. end
  219.  
  220. --> battleground
  221. local battlegroundInfo = self.is_pvp
  222. if (battlegroundInfo) then
  223. return DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND
  224. end
  225.  
  226. --> dungeon or raid
  227. local instanceType = self.instance_type
  228.  
  229. if (instanceType == "party") then
  230. local bossEncounter = self.is_boss
  231. if (bossEncounter) then
  232. return DETAILS_SEGMENTTYPE_DUNGEON_BOSS
  233. else
  234. return DETAILS_SEGMENTTYPE_DUNGEON_TRASH
  235. end
  236.  
  237. elseif (instanceType == "raid") then
  238. local bossEncounter = self.is_boss
  239. if (bossEncounter) then
  240. return DETAILS_SEGMENTTYPE_RAID_BOSS
  241. else
  242. return DETAILS_SEGMENTTYPE_RAID_TRASH
  243. end
  244. end
  245.  
  246. --> overall data
  247. if (self == _detalhes.tabela_overall) then
  248. return DETAILS_SEGMENTTYPE_OVERALL
  249. end
  250.  
  251. return DETAILS_SEGMENTTYPE_GENERIC
  252. end
  253.  
  254. --return a numeric table with all actors on the specific containter
  255. function combate:GetActorList (container)
  256. return self [container]._ActorTable
  257. end
  258.  
  259. function combate:GetActor (container, name)
  260. local index = self [container] and self [container]._NameIndexTable [name]
  261. if (index) then
  262. return self [container]._ActorTable [index]
  263. end
  264. return nil
  265. end
  266.  
  267. --return the combat time in seconds
  268. function combate:GetFormatedCombatTime()
  269. local time = self:GetCombatTime()
  270. local m, s = _math_floor (time/60), _math_floor (time%60)
  271. return m, s
  272. end
  273.  
  274. function combate:GetCombatTime()
  275. if (self.end_time) then
  276. return _math_max (self.end_time - self.start_time, 0.1)
  277. elseif (self.start_time and _detalhes.in_combat and self ~= _detalhes.tabela_overall) then
  278. return _math_max (_GetTime() - self.start_time, 0.1)
  279. else
  280. return 0.1
  281. end
  282. end
  283.  
  284. function combate:GetStartTime()
  285. return self.start_time
  286. end
  287. function combate:SetStartTime (t)
  288. self.start_time = t
  289. end
  290.  
  291. function combate:GetEndTime()
  292. return self.end_time
  293. end
  294. function combate:SetEndTime (t)
  295. self.end_time = t
  296. end
  297.  
  298. --return the total of a specific attribute
  299. local power_table = {0, 1, 3, 6, 0, "alternatepower"}
  300.  
  301. function combate:GetTotal (attribute, subAttribute, onlyGroup)
  302. if (attribute == 1 or attribute == 2) then
  303. if (onlyGroup) then
  304. return self.totals_grupo [attribute]
  305. else
  306. return self.totals [attribute]
  307. end
  308.  
  309. elseif (attribute == 3) then
  310. if (subAttribute == 5) then --> resources
  311. return self.totals.resources or 0
  312. end
  313. if (onlyGroup) then
  314. return self.totals_grupo [attribute] [power_table [subAttribute]]
  315. else
  316. return self.totals [attribute] [power_table [subAttribute]]
  317. end
  318.  
  319. elseif (attribute == 4) then
  320. local subName = _detalhes:GetInternalSubAttributeName (attribute, subAttribute)
  321. if (onlyGroup) then
  322. return self.totals_grupo [attribute] [subName]
  323. else
  324. return self.totals [attribute] [subName]
  325. end
  326. end
  327.  
  328. return 0
  329. end
  330.  
  331. function combate:CreateAlternatePowerTable (actorName)
  332. local t = {last = 0, total = 0}
  333. self.alternate_power [actorName] = t
  334. return t
  335. end
  336.  
  337. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  338. --> internals
  339.  
  340. function combate:CreateNewCombatTable()
  341. return combate:NovaTabela()
  342. end
  343.  
  344. --class constructor
  345. function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
  346.  
  347. local esta_tabela = {true, true, true, true, true}
  348.  
  349. esta_tabela [1] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> Damage
  350. esta_tabela [2] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_HEAL_CLASS, esta_tabela, combatId) --> Healing
  351. esta_tabela [3] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENERGY_CLASS, esta_tabela, combatId) --> Energies
  352. esta_tabela [4] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS, esta_tabela, combatId) --> Misc
  353. esta_tabela [5] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> place holder for customs
  354.  
  355. _setmetatable (esta_tabela, combate)
  356.  
  357. _detalhes.combat_counter = _detalhes.combat_counter + 1
  358. esta_tabela.combat_counter = _detalhes.combat_counter
  359.  
  360. --> try discover if is a pvp combat
  361. local who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags = ...
  362. if (who_serial) then --> aqui ir� identificar o boss ou o oponente
  363. if (alvo_name and _bit_band (alvo_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo alvo
  364. esta_tabela.contra = alvo_name
  365. if (_bit_band (alvo_flags, CONTROL_PLAYER) ~= 0) then
  366. esta_tabela.pvp = true --> o alvo � da fac��o oposta ou foi dado mind control
  367. end
  368. elseif (who_name and _bit_band (who_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo who caso o mob � quem deu o primeiro hit
  369. esta_tabela.contra = who_name
  370. if (_bit_band (who_flags, CONTROL_PLAYER) ~= 0) then
  371. esta_tabela.pvp = true --> o who � da fac��o oposta ou foi dado mind control
  372. end
  373. else
  374. esta_tabela.pvp = true --> se ambos s�o friendly, seria isso um PVP entre jogadores da mesma fac��o?
  375. end
  376. end
  377.  
  378. --> start/end time (duration)
  379. esta_tabela.data_fim = 0
  380. esta_tabela.data_inicio = 0
  381. esta_tabela.tempo_start = _tempo
  382.  
  383. --> record deaths
  384. esta_tabela.last_events_tables = {}
  385.  
  386. --> last events from players
  387. esta_tabela.player_last_events = {}
  388.  
  389. --> players in the raid
  390. esta_tabela.raid_roster = {}
  391.  
  392. --> frags
  393. esta_tabela.frags = {}
  394. esta_tabela.frags_need_refresh = false
  395.  
  396. --> alternate power
  397. esta_tabela.alternate_power = {}
  398.  
  399. --> time data container
  400. esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
  401. esta_tabela.PhaseData = {{1, 1}, damage = {}, heal = {}, damage_section = {}, heal_section = {}} --[1] phase number [2] phase started
  402.  
  403. --> for external plugin usage, these tables are guaranteed to be saved with the combat
  404. esta_tabela.spells_cast_timeline = {}
  405. esta_tabela.aura_timeline = {}
  406. esta_tabela.cleu_timeline = {}
  407.  
  408. --> cleu events
  409. esta_tabela.cleu_events = {
  410. n = 1 --event counter
  411. }
  412.  
  413. --> Skill cache (not used)
  414. esta_tabela.CombatSkillCache = {}
  415.  
  416. -- a tabela sem o tempo de inicio � a tabela descartavel do inicio do addon
  417. if (iniciada) then
  418. --esta_tabela.start_time = _tempo
  419. esta_tabela.start_time = _GetTime()
  420. esta_tabela.end_time = nil
  421. else
  422. esta_tabela.start_time = 0
  423. esta_tabela.end_time = nil
  424. end
  425.  
  426. -- o container ir� armazenar as classes de dano -- cria um novo container de indexes de seriais de jogadores --par�metro 1 classe armazenada no container, par�metro 2 = flag da classe
  427. esta_tabela[1].need_refresh = true
  428. esta_tabela[2].need_refresh = true
  429. esta_tabela[3].need_refresh = true
  430. esta_tabela[4].need_refresh = true
  431. esta_tabela[5].need_refresh = true
  432.  
  433. if (_tabela_overall) then --> link � a tabela de combate do overall
  434. esta_tabela[1].shadow = _tabela_overall[1]
  435. esta_tabela[2].shadow = _tabela_overall[2]
  436. esta_tabela[3].shadow = _tabela_overall[3]
  437. esta_tabela[4].shadow = _tabela_overall[4]
  438. end
  439.  
  440. esta_tabela.totals = {
  441. 0, --> dano
  442. 0, --> cura
  443. {--> e_energy
  444. [0] = 0, --> mana
  445. [1] = 0, --> rage
  446. [3] = 0, --> energy (rogues cat)
  447. [6] = 0, --> runepower (dk)
  448. alternatepower = 0,
  449. },
  450. {--> misc
  451. cc_break = 0, --> armazena quantas quebras de CC
  452. ress = 0, --> armazena quantos pessoas ele reviveu
  453. interrupt = 0, --> armazena quantos interrupt a pessoa deu
  454. dispell = 0, --> armazena quantos dispell esta pessoa recebeu
  455. dead = 0, --> armazena quantas vezes essa pessia morreu
  456. cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
  457. buff_uptime = 0, --> armazena quantos cooldowns a raid usou
  458. debuff_uptime = 0 --> armazena quantos cooldowns a raid usou
  459. },
  460.  
  461. --> avoid using this values bellow, they aren't updated by the parser, only on demand by a user interaction.
  462. voidzone_damage = 0,
  463. frags_total = 0,
  464. --> end
  465. }
  466.  
  467. esta_tabela.totals_grupo = {
  468. 0, --> dano
  469. 0, --> cura
  470. {--> e_energy
  471. [0] = 0, --> mana
  472. [1] = 0, --> rage
  473. [3] = 0, --> energy (rogues cat)
  474. [6] = 0, --> runepower (dk)
  475. alternatepower = 0,
  476. },
  477. {--> misc
  478. cc_break = 0, --> armazena quantas quebras de CC
  479. ress = 0, --> armazena quantos pessoas ele reviveu
  480. interrupt = 0, --> armazena quantos interrupt a pessoa deu
  481. dispell = 0, --> armazena quantos dispell esta pessoa recebeu
  482. dead = 0, --> armazena quantas vezes essa oessia morreu
  483. cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
  484. buff_uptime = 0,
  485. debuff_uptime = 0
  486. }
  487. }
  488.  
  489. return esta_tabela
  490. end
  491.  
  492. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  493. --> core
  494.  
  495. function combate:CreateLastEventsTable (player_name)
  496. local t = {}
  497. for i = 1, _detalhes.deadlog_events do
  498. t [i] = {}
  499. end
  500. t.n = 1
  501. self.player_last_events [player_name] = t
  502. return t
  503. end
  504.  
  505. --trava o tempo dos jogadores ap�s o t�rmino do combate.
  506. function combate:TravarTempos()
  507. if (self [1]) then
  508. for _, jogador in _ipairs (self [1]._ActorTable) do --> damage
  509. if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
  510. jogador:TerminarTempo()
  511. jogador:Iniciar (false) --trava o dps do jogador
  512. else
  513. if (jogador.start_time == 0) then
  514. jogador.start_time = _tempo
  515. end
  516. if (not jogador.end_time) then
  517. jogador.end_time = _tempo
  518. end
  519. end
  520. end
  521. end
  522. if (self [2]) then
  523. for _, jogador in _ipairs (self [2]._ActorTable) do --> healing
  524. if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
  525. jogador:TerminarTempo()
  526. jogador:Iniciar (false) --trava o dps do jogador
  527. else
  528. if (jogador.start_time == 0) then
  529. jogador.start_time = _tempo
  530. end
  531. if (not jogador.end_time) then
  532. jogador.end_time = _tempo
  533. end
  534. end
  535. end
  536. end
  537. end
  538.  
  539. function combate:seta_data (tipo)
  540. if (tipo == _detalhes._detalhes_props.DATA_TYPE_START) then
  541. self.data_inicio = _date ("%H:%M:%S")
  542. elseif (tipo == _detalhes._detalhes_props.DATA_TYPE_END) then
  543. self.data_fim = _date ("%H:%M:%S")
  544. end
  545. end
  546.  
  547. function combate:seta_tempo_decorrido()
  548. --self.end_time = _tempo
  549. self.end_time = _GetTime()
  550. end
  551.  
  552. function _detalhes.refresh:r_combate (tabela_combate, shadow)
  553. _setmetatable (tabela_combate, _detalhes.combate)
  554. tabela_combate.__index = _detalhes.combate
  555. tabela_combate.shadow = shadow
  556. end
  557.  
  558. function _detalhes.clear:c_combate (tabela_combate)
  559. --tabela_combate.__index = {}
  560. tabela_combate.__index = nil
  561. tabela_combate.__call = {}
  562. tabela_combate._combat_table = nil
  563. tabela_combate.shadow = nil
  564. end
  565.  
  566. combate.__sub = function (combate1, combate2)
  567.  
  568. if (combate1 ~= _detalhes.tabela_overall) then
  569. return
  570. end
  571.  
  572. --> sub dano
  573. for index, actor_T2 in _ipairs (combate2[1]._ActorTable) do
  574. local actor_T1 = combate1[1]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
  575. actor_T1 = actor_T1 - actor_T2
  576. actor_T2:subtract_total (combate1)
  577. end
  578. combate1 [1].need_refresh = true
  579.  
  580. --> sub heal
  581. for index, actor_T2 in _ipairs (combate2[2]._ActorTable) do
  582. local actor_T1 = combate1[2]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
  583. actor_T1 = actor_T1 - actor_T2
  584. actor_T2:subtract_total (combate1)
  585. end
  586. combate1 [2].need_refresh = true
  587.  
  588. --> sub energy
  589. for index, actor_T2 in _ipairs (combate2[3]._ActorTable) do
  590. local actor_T1 = combate1[3]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
  591. actor_T1 = actor_T1 - actor_T2
  592. actor_T2:subtract_total (combate1)
  593. end
  594. combate1 [3].need_refresh = true
  595.  
  596. --> sub misc
  597. for index, actor_T2 in _ipairs (combate2[4]._ActorTable) do
  598. local actor_T1 = combate1[4]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
  599. actor_T1 = actor_T1 - actor_T2
  600. actor_T2:subtract_total (combate1)
  601. end
  602. combate1 [4].need_refresh = true
  603.  
  604. --> reduz o tempo
  605. combate1.start_time = combate1.start_time + combate2:GetCombatTime()
  606.  
  607. --> apaga as mortes da luta diminuida
  608. local amt_mortes = #combate2.last_events_tables --> quantas mortes teve nessa luta
  609. if (amt_mortes > 0) then
  610. for i = #combate1.last_events_tables, #combate1.last_events_tables-amt_mortes, -1 do
  611. _table_remove (combate1.last_events_tables, #combate1.last_events_tables)
  612. end
  613. end
  614.  
  615. --> frags
  616. for fragName, fragAmount in pairs (combate2.frags) do
  617. if (fragAmount) then
  618. if (combate1.frags [fragName]) then
  619. combate1.frags [fragName] = combate1.frags [fragName] - fragAmount
  620. else
  621. combate1.frags [fragName] = fragAmount
  622. end
  623. end
  624. end
  625. combate1.frags_need_refresh = true
  626.  
  627. --> alternate power
  628. local overallPowerTable = combate1.alternate_power
  629. for actorName, powerTable in pairs (combate2.alternate_power) do
  630. local power = overallPowerTable [actorName]
  631. if (power) then
  632. power.total = power.total - powerTable.total
  633. end
  634. combate2.alternate_power [actorName].last = 0
  635. end
  636.  
  637. return combate1
  638.  
  639. end
  640.  
  641. combate.__add = function (combate1, combate2)
  642.  
  643. local all_containers = {combate2 [class_type_dano]._ActorTable, combate2 [class_type_cura]._ActorTable, combate2 [class_type_e_energy]._ActorTable, combate2 [class_type_misc]._ActorTable}
  644. local custom_combat
  645. if (combate1 ~= _detalhes.tabela_overall) then
  646. custom_combat = combate1
  647. end
  648.  
  649. for class_type, actor_container in ipairs (all_containers) do
  650. for _, actor in ipairs (actor_container) do
  651. local shadow
  652.  
  653. if (class_type == class_type_dano) then
  654. shadow = _detalhes.atributo_damage:r_connect_shadow (actor, true, custom_combat)
  655. elseif (class_type == class_type_cura) then
  656. shadow = _detalhes.atributo_heal:r_connect_shadow (actor, true, custom_combat)
  657. elseif (class_type == class_type_e_energy) then
  658. shadow = _detalhes.atributo_energy:r_connect_shadow (actor, true, custom_combat)
  659. elseif (class_type == class_type_misc) then
  660. shadow = _detalhes.atributo_misc:r_connect_shadow (actor, true, custom_combat)
  661. end
  662.  
  663. shadow.boss_fight_component = actor.boss_fight_component or shadow.boss_fight_component
  664. shadow.fight_component = actor.fight_component or shadow.fight_component
  665. shadow.grupo = actor.grupo or shadow.grupo
  666. end
  667. end
  668.  
  669. --> alternate power
  670. local overallPowerTable = combate1.alternate_power
  671. for actorName, powerTable in pairs (combate2.alternate_power) do
  672. local power = overallPowerTable [actorName]
  673. if (not power) then
  674. power = combate1:CreateAlternatePowerTable (actorName)
  675. end
  676. power.total = power.total + powerTable.total
  677. combate2.alternate_power [actorName].last = 0
  678. end
  679.  
  680. return combate1
  681. end
  682.  
  683. function _detalhes:UpdateCombat()
  684. _tempo = _detalhes._tempo
  685. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement