From cf3219f43683de2210281f4d7ab03c8cab1a6c1a Mon Sep 17 00:00:00 2001 From: tercio Date: Tue, 11 Nov 2014 19:49:24 -0200 Subject: [PATCH] v3 Release Candidate. --- .pkgmeta | 3 +- API.txt | 178 +++ Details.toc | 1 - boot.lua | 14 +- classes/classe_combate.lua | 37 +- classes/classe_custom.lua | 9 +- classes/classe_damage.lua | 783 ++++----- classes/classe_damage_habilidade.lua | 104 +- classes/classe_energy.lua | 1105 +++++++------ classes/classe_energy_habilidade.lua | 77 +- classes/classe_heal.lua | 456 ++---- classes/classe_heal_habilidade.lua | 84 +- classes/classe_instancia.lua | 4 + classes/classe_others.lua | 1408 +++++++---------- classes/classe_others_habilidade.lua | 136 +- classes/container_combatentes.lua | 19 +- classes/container_habilidades.lua | 22 - classes/custom_damage_done.lua | 213 ++- classes/custom_healing_done.lua | 196 ++- core/control.lua | 43 +- core/gears.lua | 120 ++ core/meta.lua | 207 +-- core/network.lua | 140 +- core/parser.lua | 723 +++------ core/plugins_statusbar.lua | 4 +- core/util.lua | 22 - core/windows.lua | 4 +- functions/attributes.lua | 13 +- functions/classes.lua | 4 +- functions/playerclass.lua | 8 +- functions/slash.lua | 59 +- gumps/janela_info.lua | 174 +- images/atributos_icones_energyze.tga | Bin 15957 -> 19585 bytes locales/Details-deDE.lua | 4 + .../Details_DataStorage.lua | 14 + .../Details_DataStorage.toc | 9 + .../Details_DpsTuning/Details_DpsTuning.lua | 2 +- .../Details_EncounterDetails.lua | 106 +- .../Details_EncounterDetails/images/icon.tga | Bin 905 -> 1837 bytes .../ThroneOfThunder.lua | 2 +- startup.lua | 85 +- 41 files changed, 2835 insertions(+), 3757 deletions(-) create mode 100644 API.txt create mode 100644 locales/Details-deDE.lua create mode 100644 plugins/Details_DataStorage/Details_DataStorage.lua create mode 100644 plugins/Details_DataStorage/Details_DataStorage.toc diff --git a/.pkgmeta b/.pkgmeta index fea78045..98884d12 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -12,4 +12,5 @@ move-folders: Details/plugins/Details_Vanguard: Details_Vanguard Details/plugins/Details_YouAreNotPrepared: Details_YouAreNotPrepared Details/plugins/Details_RaidInfo-BlackrockFoundry: Details_RaidInfo-BlackrockFoundry - Details/plugins/Details_RaidInfo-Highmaul: Details_RaidInfo-Highmaul \ No newline at end of file + Details/plugins/Details_RaidInfo-Highmaul: Details_RaidInfo-Highmaul + Details/plugins/Details_DataStorage: Details_DataStorage \ No newline at end of file diff --git a/API.txt b/API.txt new file mode 100644 index 00000000..61740e17 --- /dev/null +++ b/API.txt @@ -0,0 +1,178 @@ +This is a short api document for Details! API, describing attributes, combat, container, actor. +It still is incomplete, we are writing. + +Attributes: +======================================= + +All these keys are globals. + +DETAILS_ATTRIBUTE_DAMAGE = 1 +DETAILS_SUBATTRIBUTE_DAMAGEDONE = 1 +DETAILS_SUBATTRIBUTE_DPS = 2 +DETAILS_SUBATTRIBUTE_DAMAGETAKEN = 3 +DETAILS_SUBATTRIBUTE_FRIENDLYFIRE = 4 +DETAILS_SUBATTRIBUTE_FRAGS = 5 +DETAILS_SUBATTRIBUTE_ENEMIES = 6 +DETAILS_SUBATTRIBUTE_VOIDZONES = 7 + +DETAILS_ATTRIBUTE_HEAL = 2 +DETAILS_SUBATTRIBUTE_HEALDONE = 1 +DETAILS_SUBATTRIBUTE_HPS = 2 +DETAILS_SUBATTRIBUTE_OVERHEAL = 3 +DETAILS_SUBATTRIBUTE_HEALTAKEN = 4 +DETAILS_SUBATTRIBUTE_HEALENEMY = 5 +DETAILS_SUBATTRIBUTE_HEALPREVENTED = 6 + +DETAILS_ATTRIBUTE_ENERGY = 3 +DETAILS_SUBATTRIBUTE_REGENMANA = 1 +DETAILS_SUBATTRIBUTE_REGENRAGE = 2 +DETAILS_SUBATTRIBUTE_REGENENERGY = 3 +DETAILS_SUBATTRIBUTE_REGENRUNE = 4 + +DETAILS_ATTRIBUTE_MISC = 4 +DETAILS_SUBATTRIBUTE_CCBREAK = 1 +DETAILS_SUBATTRIBUTE_RESS = 2 +DETAILS_SUBATTRIBUTE_INTERRUPT = 3 +DETAILS_SUBATTRIBUTE_DISPELL = 4 +DETAILS_SUBATTRIBUTE_DEATH = 5 +DETAILS_SUBATTRIBUTE_DCOOLDOWN = 6 +DETAILS_SUBATTRIBUTE_BUFFUPTIME = 7 +DETAILS_SUBATTRIBUTE_DEBUFFUPTIME = 8 + +Combat Object: +======================================= + +Combat Objects holds the containers for each main attribute. + +actor = combat ( attribute, character_name ) +returns actor object + +container = combat:GetContainer (attribute) + +chartData = combat:GetTimeData ( chart_data_name ) +returns the table containing the data for create a chart. + +startDate, endDate = combat:GetDate() +returns the start and end date as %H:%M:%S. + +isTrash = combat:IsTrash() +returns true if the combat is a trash segment. + +encounterDiff = combat:GetDifficulty() +returns the difficulty number of the raid encounter. + +bossInfo = combat:GetBossInfo() +returns the table containing informations about the boss encounter. + +deaths = combat:GetDeaths() +returns a numeric table containing the deaths. + +combatNumber = combat:GetCombatNumber() +returns the unique ID number for the combat. + +combatName = combat:GetCombatName ( try_to_find ) +returns the segment name, e.g. "Trainning Dummy", if try_to_find is true, it searches the combat for a enemy name. + +characterList = combat:GetActorList ( attribute ) +returns a numeric table with all actors of the specific attribute. + +time = combat:GetCombatTime() +returns the length of the combat, if the combat is in progress, returns the elapsed time. + +DETAILS_TOTALS_ONLYGROUP = true + +total = combat:GetTotal ( attribute, subAttribute [, onlyGroup] ) +returns the total of the requested attribute. + + +Container Object: +======================================= + +A container is used to store actors, each combat have four containers, one for each attribute. + +amount = container:GetAmount (actorName [, key = "total"]) +returns the amount of the requested member key, is key is not passed, "total" is used. + +total = container:GetTotal (key = "total") +returns the total amount of all actors inside the container, if key is omitted, "total" is used. + +total = container:GetTotalOnRaid (key = "total", combat) +similar to GetTotal, but only counts the total of raid members. + +ipairs_list = container:ListActors() +returns a iterated table of actors inside the container. +Usage: for index, actor in container:ListActors() do + + +Actor Object: +======================================= + +Holds all total keys, spells and targets of a character. + +name = actor:Name() +returns the actor's name. + +displayName = actor:GetDisplayName() +returns the name shown on the player bar, can soffer modifications from realm name removed, nicknames, etc. + +name = actor:GetOnlyName() +returns only the actor name, remove realm or owner names. + +class = actor:Class() +returns the actor class. + +activity = actor:Tempo() +returns the activity time for the actor. + +isGroupMember = actor:IsGroupPlayer() +return true if the actor is a player and member of the raid group. + +isPlayer = actor:IsPlayer() +return true if the actor is a player. + +IsneutralOrEnemy = actor:IsNeutralOrEnemy() +return true if the actor is a neutral of an enemy. + +isEnemy = actor:IsEnemy() +return true if the actor is a enemy. + +list = actor:GetSpellList() +returns a hash table with spellid, spelltable. + +spell = actor:GetSpell (spellid) +returns a spell table of requested spell id. + +r, g, b = actor:GetBarColor() +returns the color which the player bar will be painted on the window, it respects owner, arena team, enemy, monster. + +r, g, b = _detalhes:GetClassColor() +returns the class color. + +icon, left, right, top, bottom = actor:GetClassIcon() +returns the icon texture path and the texture's texcoords. + +Damage Actor Keys: + +total = total of damage done. +total_without_pet = without pet. +damage_taken = total of damage taken. +last_dps = cache of the last calculed dps, it's best take actor.total / actor:Tempo() +last_event = when the last event for this actor occured. +start_time = time when this actor started to apply damage. +end_time = time when the actor stopped with damage. +friendlyfire_total = amount of friendlyfire. + +targets = hash table of targets: targetName, amount. +damage_from = hash table of actors which applied damage to this actor: aggresorName, true. +pets = numeric table of GUIDs of pets summoned by this actor. +friendlyfire = hash table of friendly fire targets: targetName, table {total = 0, spells = hash table: spellId, amount} +spells = hash table with spells used to apply damage: spellId, spellTable. + + + + + + + + + diff --git a/Details.toc b/Details.toc index d6263491..4d6f26a5 100644 --- a/Details.toc +++ b/Details.toc @@ -84,7 +84,6 @@ classes\classe_target.lua classes\classe_custom.lua classes\custom_damage_done.lua classes\custom_healing_done.lua -classes\custom_damage_taken.lua core\control.lua diff --git a/boot.lua b/boot.lua index c9b14233..4edea2d9 100644 --- a/boot.lua +++ b/boot.lua @@ -3,14 +3,16 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 160 --it's 160 for release - _detalhes.userversion = "v2.2.5" - _detalhes.realversion = 36 + _detalhes.build_counter = 212 --it's 212 for release + _detalhes.userversion = "v3.2.0" + _detalhes.realversion = 46 _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialization stuff +-- remover print do power types differente. + do local _detalhes = _G._detalhes @@ -18,12 +20,10 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v2.2.5 (|cFFFFCC00Oct 31, 2014|r|cFFFFFF00)|r:\n\n -|cFFFFFF00-|r Fixed combat initialization when the player start casting a Dot spell.\n\n -|cFFFFFF00-|r Added new custom display: Damage Taken By Spell.\n\n + --]] - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v2.2.5 (|cFFFFCC00Oct 31, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed combat initialization when the player start casting a Dot spell.\n\n|cFFFFFF00-|r Added new custom display: Damage Taken By Spell.\n\n|cFFFFFF00v2.2.4 (|cFFFFCC00Oct 29, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed problem with memory clean up time out after combat.\n\n|cFFFFFF00-|r Fixed a window group problem where sometimes during logon it breaks the addon.\n\n|cFFFFFF00v2.2.3 (|cFFFFCC00Oct 26, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the healing done problem with Priest's Spirit of Redemption.\n\n|cFFFFFF00-|r Fixed avoidance by absorb when the hit missed was a multistrike hit.\n\n|cFFFFFF00-|r Fixed a script time out problem when erasing data while in combat.\n\n|cFFFFFF00-|r Fixed bug with interrupt tooltip when the player have a pet.\n\n|cFFFFFF00v2.2.1 (|cFFFFCC00Oct 22, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the gap between the button and its menu which sometimes traveling the mouse between them was activating tooltips from window's bars.\n\n|cFFFFFF00-|r Fixed an annoying menu blink when the window was near the right side of the screen.\n\n|cFFFFFF00-|r Fixed the stretch grab which was over other windows even with the 'stretch always on top' option disabled.\n\n|cFFFFFF00-|r Few fixes on healing done from absorbs.\n\n|cFFFFFF00v2.1.6 (|cFFFFCC00Oct 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed death's tooltip which wasn't respecting tooltip's configuration set on options panel.\n\n|cFFFFFF00-|r Now when the window is close to the top of the screen, menus will anchor on bottom side of the menu icons.\n\n|cFFFFFF00-|r Added micro displays options on Window Settings bracket.\n\n|cFFFFFF00-|r Fixed the problem with bar's custom texts.\n\n|cFFFFFF00-|r Lua functions inside custom texts, Chart Data scripts and Custom Displays scripts are now protected calls and won't break the addon functionality if an error occurs. Unfortunately we still doesn't have a documentation for Details! API.\n\n|cFFFFFF00-|r Fixed an incomum bug with tank avoidance tables.\n\n|cFFFFFF00-|r Tiny Threat: added option to use class colors instead of green-to-red colors.\n\n|cFFFFFF00-|r Added option to enable shadows on toolbar's buttons.\n\n|cFFFFFF00-|r Added option to set the specing between each button on toolbar.\n\n|cFFFFFF00-|r Finally we merged the left and right menus into only one with 6 icons.\n\n|cFFFFFF00-|r Removed window button and added a new option bracket to manage windows under Mode Menu.\n\n|cFFFFFF00-|r Few changes on 'Default Skin', 'Minimalistic', 'Simple Gray' and 'ElvUI Frame Style BW' (need reaply).\n\n|cFFFFFF00- Important:|r If the menus is out of the position, just reaply the skin.\n\nv2.0.15 (|cFFFFCC00Oct 15, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed tooltips where sometimes it wans't showing at all.\n\n|cFFFFFF00-|r Fixed the healing done amount on Malkorok encounter.\n\nv2.0.14 (|cFFFFCC00Oct 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added pre-potion recognition for WoD pots.\n\n|cFFFFFF00-|r Added spell list for Blackrock Foundry encounters.\n\n|cFFFFFF00-|r Added mouse wheel scroll speed option.\n\n|cFFFFFF00-|r Added support for healing multistrike and damage multistrike.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r When the windows is locked, trying to move the window through toolbar will stretch it instead.\n\n|cFFFFFF00-|r Renamed overheal for shields, now its called 'shield wasted'.\n\n|cFFFFFF00-|r Fine tuning on healing done, should have high accuracy now.\n\n|cFFFFFF00-|r Encounter Details plugin now supports Highmaul and Blackrock Foundry.\n\n|cFFFFFF00-|r New class cooldowns and spells recognition.\n\n|cFFFFFF00-|r Fixed few bugs on comparison panel and avoidance panel.\n\n|cFFFFFF00-|r Fixed encounter recognition, now it should show the encounter name over segments menu.\n\n|cFFFFFF00-|r Fixed Graphic part of Encounter Details Plugin, now he draws more accurately.\n\n|cFFFFFF00v1.29.3 (|cFFFFCC00Oct 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an addon crash bug when clicking directly on the sword button.\n\n|cFFFFFF00-|r Removed Flat Skin, added new skin: Serenity.\n\n|cFFFFFF00-|r Fixed many issues with bar animations.\n\n|cFFFFFF00-|r Fixed combat encounter start if the player already is in combat when the boss is pulled.\n\n|cFFFFFF00-|r Fixed wheel scroll when sometimes it move very slow or doesn't move the bars at all.\n\n|cFFFFFF00-|r Added option 'Always Show Me' which when enabled and you aren't at the top ranked players shown in the window, it forces to show you in the last bar.\n\n|cFFFFFF00-|r Added option 'First Hit' which when enabled show who did the first struck in the combat (normally is who pulled the boss).\n\n|cFFFFFF00-|r Added a panel to change class colors.\n\n|cFFFFFF00v1.28.3 (|cFFFFCC00Oct 04, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added support for plugin descriptions on options panel.\n\n|cFFFFFF00-|r Added scale option.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r Added option to use the same profile on all characters without asking.\n\n|cFFFFFF00-|r Added a shortcut color button on main panel on Options Panel.\n\n|cFFFFFF00-|r Added auto erase/ask to erase options.\n\n|cFFFFFF00-|r Bars now highlight when hover over.\n\n|cFFFFFF00-|r Fixed problem with drag the window when the toolbar is on the bottom side.\n\n|cFFFFFF00v1.27.0 (|cFFFFCC00Set 27, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Minimalistic skin is now the old minimalistic v2.\n\n|cFFFFFF00-|r Minimalistic v2 got a new texture, little more darker.\n\n|cFFFFFF00-|r Few tweaks to make more easy making groups of windows.\n\n|cFFFFFF00-|r Bookmark now accepts more than two columns.\n\n|cFFFFFF00v1.26.3 (|cFFFFCC00Set 18, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Changed the way to set the broker text to be more customizable.\n\n|cFFFFFF00-|r Fixed the problem with custom display report.\n\n|cFFFFFF00-|r Added tutorial and a config panel for bookmarks.\n\n|cFFFFFF00-|r Added option for choose the format type of data broker's text.\n\n|cFFFFFF00-|r Changed few icons on damage done tooltip.\n\n|cFFFFFF00-|r Fixed the class color on texts for healing attribute.\n\n|cFFFFFF00-|r Added options for change the tooltip border's size, color and texture.\n\n|cFFFFFF00-|r Added buttons for test interrupt and cooldown announcers under raid tools section.\n\n|cFFFFFF00v1.25.1 (|cFFFFCC00Set 09, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added buttons to edit the total and percentage code for custom displays.\n\n|cFFFFFF00-|r Fixed a problem while report custom displays.\n\n|cFFFFFF00-|r Added Acitivity Time for Damage + Healing, tooltip show the activity separately.\n\n|cFFFFFF00-|r Major changes on Encounter Details Plugin making more easy to use.\n\n|cFFFFFF00-|r Removed Spell Details Plugin.\n\n|cFFFFFF00-|r Added new plugin for Solo Mode: Dps Tuning.\n\n|cFFFFFF00v1.24.5 (|cFFFFCC00Ago 31, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Raid Tools bracket on Options Panel.\n\n|cFFFFFF00-|r Added interrupt, cooldown and death announcers (raid tools).\n\n|cFFFFFF00-|r Added pre potion recognition, showing after the encounter on the chat only for you (raid tools).\n\n|cFFFFFF00-|r Added a Boss Emotes tab for Encounter Details plugin |cFF999999(thanks Bloodforce-Azralon)|r.\n\n|cFFFFFF00-|r Rework on Activity Time, now it is tuned to closely match warcraftlogs |cFF999999(thanks www.warcraftlogs.com)|r.\n\n|cFFFFFF00-|r Added two new customs: Damage Activity Time and Healing Activity Time." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.2.0 (|cFFFFCC00Nov 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Major changes on the way Details! store information, these changes saves up to 40% memory and 4% cpu usage.\n\n|cFFFFFF00-|r Fixed problem with pet's healing messing with the owner activity time.\n\n|cFFFFFF00-|r Added Energy -> Resources.\n\n|cFFFFFF00-|r Fixed combat initialization when the player start casting a Dot spell.\n\n|cFFFFFF00-|r Added new custom display: Damage Taken By Spell.\n\n|cFFFFFF00v2.2.3 (|cFFFFCC00Oct 26, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the healing done problem with Priest's Spirit of Redemption.\n\n|cFFFFFF00-|r Fixed avoidance by absorb when the hit missed was a multistrike hit.\n\n|cFFFFFF00-|r Fixed a script time out problem when erasing data while in combat.\n\n|cFFFFFF00-|r Fixed bug with interrupt tooltip when the player have a pet.\n\n|cFFFFFF00v2.2.1 (|cFFFFCC00Oct 22, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the gap between the button and its menu which sometimes traveling the mouse between them was activating tooltips from window's bars.\n\n|cFFFFFF00-|r Fixed an annoying menu blink when the window was near the right side of the screen.\n\n|cFFFFFF00-|r Fixed the stretch grab which was over other windows even with the 'stretch always on top' option disabled.\n\n|cFFFFFF00-|r Few fixes on healing done from absorbs.\n\n|cFFFFFF00v2.1.6 (|cFFFFCC00Oct 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed death's tooltip which wasn't respecting tooltip's configuration set on options panel.\n\n|cFFFFFF00-|r Now when the window is close to the top of the screen, menus will anchor on bottom side of the menu icons.\n\n|cFFFFFF00-|r Added micro displays options on Window Settings bracket.\n\n|cFFFFFF00-|r Fixed the problem with bar's custom texts.\n\n|cFFFFFF00-|r Lua functions inside custom texts, Chart Data scripts and Custom Displays scripts are now protected calls and won't break the addon functionality if an error occurs. Unfortunately we still doesn't have a documentation for Details! API.\n\n|cFFFFFF00-|r Fixed an incomum bug with tank avoidance tables.\n\n|cFFFFFF00-|r Tiny Threat: added option to use class colors instead of green-to-red colors.\n\n|cFFFFFF00-|r Added option to enable shadows on toolbar's buttons.\n\n|cFFFFFF00-|r Added option to set the specing between each button on toolbar.\n\n|cFFFFFF00-|r Finally we merged the left and right menus into only one with 6 icons.\n\n|cFFFFFF00-|r Removed window button and added a new option bracket to manage windows under Mode Menu.\n\n|cFFFFFF00-|r Few changes on 'Default Skin', 'Minimalistic', 'Simple Gray' and 'ElvUI Frame Style BW' (need reaply).\n\n|cFFFFFF00- Important:|r If the menus is out of the position, just reaply the skin.\n\nv2.0.15 (|cFFFFCC00Oct 15, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed tooltips where sometimes it wans't showing at all.\n\n|cFFFFFF00-|r Fixed the healing done amount on Malkorok encounter.\n\nv2.0.14 (|cFFFFCC00Oct 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added pre-potion recognition for WoD pots.\n\n|cFFFFFF00-|r Added spell list for Blackrock Foundry encounters.\n\n|cFFFFFF00-|r Added mouse wheel scroll speed option.\n\n|cFFFFFF00-|r Added support for healing multistrike and damage multistrike.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r When the windows is locked, trying to move the window through toolbar will stretch it instead.\n\n|cFFFFFF00-|r Renamed overheal for shields, now its called 'shield wasted'.\n\n|cFFFFFF00-|r Fine tuning on healing done, should have high accuracy now.\n\n|cFFFFFF00-|r Encounter Details plugin now supports Highmaul and Blackrock Foundry.\n\n|cFFFFFF00-|r New class cooldowns and spells recognition.\n\n|cFFFFFF00-|r Fixed few bugs on comparison panel and avoidance panel.\n\n|cFFFFFF00-|r Fixed encounter recognition, now it should show the encounter name over segments menu.\n\n|cFFFFFF00-|r Fixed Graphic part of Encounter Details Plugin, now he draws more accurately.\n\n|cFFFFFF00v1.29.3 (|cFFFFCC00Oct 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an addon crash bug when clicking directly on the sword button.\n\n|cFFFFFF00-|r Removed Flat Skin, added new skin: Serenity.\n\n|cFFFFFF00-|r Fixed many issues with bar animations.\n\n|cFFFFFF00-|r Fixed combat encounter start if the player already is in combat when the boss is pulled.\n\n|cFFFFFF00-|r Fixed wheel scroll when sometimes it move very slow or doesn't move the bars at all.\n\n|cFFFFFF00-|r Added option 'Always Show Me' which when enabled and you aren't at the top ranked players shown in the window, it forces to show you in the last bar.\n\n|cFFFFFF00-|r Added option 'First Hit' which when enabled show who did the first struck in the combat (normally is who pulled the boss).\n\n|cFFFFFF00-|r Added a panel to change class colors.\n\n|cFFFFFF00v1.28.3 (|cFFFFCC00Oct 04, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added support for plugin descriptions on options panel.\n\n|cFFFFFF00-|r Added scale option.\n\n|cFFFFFF00-|r Added a Change Log button on Options Panel.\n\n|cFFFFFF00-|r Added option to use the same profile on all characters without asking.\n\n|cFFFFFF00-|r Added a shortcut color button on main panel on Options Panel.\n\n|cFFFFFF00-|r Added auto erase/ask to erase options.\n\n|cFFFFFF00-|r Bars now highlight when hover over.\n\n|cFFFFFF00-|r Fixed problem with drag the window when the toolbar is on the bottom side.\n\n|cFFFFFF00v1.27.0 (|cFFFFCC00Set 27, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Minimalistic skin is now the old minimalistic v2." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " diff --git a/classes/classe_combate.lua b/classes/classe_combate.lua index 33e695ab..457182f1 100644 --- a/classes/classe_combate.lua +++ b/classes/classe_combate.lua @@ -55,11 +55,15 @@ return self.TimeData [name] end + function combate:GetContainer (attribute) + return self [attribute] + end + function combate:IsTrash() return _rawget (self, "is_trash") end - function combate:GetDifficult() + function combate:GetDifficulty() return self.is_boss and self.is_boss.diff end @@ -111,6 +115,8 @@ end --return the total of a specific attribute + local power_table = {0, 1, 3, 6} + function combate:GetTotal (attribute, subAttribute, onlyGroup) if (attribute == 1 or attribute == 2) then if (onlyGroup) then @@ -119,7 +125,17 @@ return self.totals [attribute] end - elseif (attribute == 3 or attribute == 4) then + elseif (attribute == 3) then + if (subAttribute == 5) then --> resources + return self.totals.resources or 0 + end + if (onlyGroup) then + return self.totals_grupo [attribute] [power_table [subAttribute]] + else + return self.totals [attribute] [power_table [subAttribute]] + end + + elseif (attribute == 4) then local subName = _detalhes:GetInternalSubAttributeName (attribute, subAttribute) if (onlyGroup) then return self.totals_grupo [attribute] [subName] @@ -127,6 +143,7 @@ return self.totals [attribute] [subName] end end + return 0 end @@ -217,10 +234,10 @@ 0, --> dano 0, --> cura {--> e_energy - mana = 0, --> mana - e_rage = 0, --> rage - e_energy = 0, --> energy (rogues cat) - runepower = 0 --> runepower (dk) + [0] = 0, --> mana + [1] = 0, --> rage + [3] = 0, --> energy (rogues cat) + [6] = 0 --> runepower (dk) }, {--> misc cc_break = 0, --> armazena quantas quebras de CC @@ -243,10 +260,10 @@ 0, --> dano 0, --> cura {--> e_energy - mana = 0, --> mana - e_rage = 0, --> rage - e_energy = 0, --> energy (rogues cat) - runepower = 0 --> runepower (dk) + [0] = 0, --> mana + [1] = 0, --> rage + [3] = 0, --> energy (rogues cat) + [6] = 0 --> runepower (dk) }, {--> misc cc_break = 0, --> armazena quantas quebras de CC diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index 90597887..1ca90c44 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -1003,7 +1003,6 @@ TooltipMaximizedMethod = _detalhes.tooltip.maximize_method atributo_custom:UpdateDamageDoneBracket() atributo_custom:UpdateHealingDoneBracket() - atributo_custom:UpdateDamageTakenBracket() end function _detalhes:AddDefaultCustomDisplays() @@ -1036,7 +1035,7 @@ local found_potion = false --get the spell debuff uptime container - local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spell_tables and player.debuff_uptime_spell_tables._ActorTable + local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spells and player.debuff_uptime_spells._ActorTable if (debuff_uptime_container) then --potion of focus (can't use as pre-potion, so, its amount is always 1 --local focus_potion = debuff_uptime_container [156432] --WoD @@ -1053,7 +1052,7 @@ end --get the spell buff uptime container - local buff_uptime_container = player.buff_uptime and player.buff_uptime_spell_tables and player.buff_uptime_spell_tables._ActorTable + local buff_uptime_container = player.buff_uptime and player.buff_uptime_spells and player.buff_uptime_spells._ActorTable if (buff_uptime_container) then --potion of the jade serpent @@ -1135,7 +1134,7 @@ local player, combat, instance = ... --get the debuff container for potion of focus - local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spell_tables and player.debuff_uptime_spell_tables._ActorTable + local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spells and player.debuff_uptime_spells._ActorTable if (debuff_uptime_container) then --local focus_potion = debuff_uptime_container [156432] --WoD local focus_potion = debuff_uptime_container [105701] --MoP @@ -1149,7 +1148,7 @@ end --get the buff container for all the others potions - local buff_uptime_container = player.buff_uptime and player.buff_uptime_spell_tables and player.buff_uptime_spell_tables._ActorTable + local buff_uptime_container = player.buff_uptime and player.buff_uptime_spells and player.buff_uptime_spells._ActorTable if (buff_uptime_container) then --potion of the jade serpent --local jade_serpent_potion = buff_uptime_container [156426] --WoD diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index 21d37a15..c703811f 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -81,6 +81,12 @@ return t end + function atributo_damage:CreateFFTable (target_name) + local new_table = {total = 0, spells = {}} + self.friendlyfire [target_name] = new_table + return new_table + end + --[[exported]] function _detalhes:CreateActorAvoidanceTable (no_overall) if (no_overall) then local t = {["ALL"] = 0, ["DODGE"] = 0, ["PARRY"] = 0, ["HITS"] = 0, ["ABSORB"] = 0, --quantas vezes foi dodge, parry, quandos hits tomou, quantos absorbs teve @@ -166,7 +172,7 @@ --[[ exported]] function _detalhes:GetSpellList() return self.spells._ActorTable - end + end -- enemies (sort function) local sortEnemies = function (t1, t2) @@ -298,23 +304,14 @@ pets = {}, friendlyfire_total = 0, - friendlyfire = container_combatentes:NovoContainer (container_friendlyfire), + friendlyfire = {}, - targets = container_combatentes:NovoContainer (container_damage_target), - spell_tables = container_habilidades:NovoContainer (container_damage) + targets = {}, + spells = container_habilidades:NovoContainer (container_damage) } _setmetatable (_new_damageActor, atributo_damage) - if (link) then - --_new_damageActor.last_events_table = _detalhes:CreateActorLastEventTable() - --_new_damageActor.last_events_table.original = true - - _new_damageActor.targets.shadow = link.targets - _new_damageActor.spell_tables.shadow = link.spell_tables - _new_damageActor.friendlyfire.shadow = link.friendlyfire - end - return _new_damageActor end @@ -371,12 +368,9 @@ local damager_actor = damage_container._ActorTable [damage_container._NameIndexTable [ aggressor ]] if (damager_actor and not damager_actor.owner) then --> checagem por causa do total e do garbage collector que não limpa os names que deram dano - - local targets = damager_actor.targets - - local specific_target = targets._ActorTable [targets._NameIndexTable [ name ]] --> é ele mesmo - if (specific_target) then - damage_taken_table [#damage_taken_table+1] = {aggressor, specific_target.total, damager_actor.classe} + local target_amount = damager_actor.targets [name] + if (target_amount) then + damage_taken_table [#damage_taken_table+1] = {aggressor, target_amount, damager_actor.classe} end end end @@ -559,7 +553,7 @@ local alvos if (damage_actor) then - habilidade = damage_actor.spell_tables._ActorTable [actor.damage_spellid] + habilidade = damage_actor.spells._ActorTable [actor.damage_spellid] end if (habilidade) then @@ -570,10 +564,9 @@ for _, alvo in _ipairs (container) do if (alvos) then - local damage_alvo = alvos._NameIndexTable [alvo.nome] + local damage_alvo = alvos [alvo.nome] if (damage_alvo) then - damage_alvo = alvos._ActorTable [damage_alvo] - alvo.damage = damage_alvo.total + alvo.damage = damage_alvo else alvo.damage = 0 end @@ -865,14 +858,14 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex local index = twin_damage_actor twin_damage_actor = showing._ActorTable [twin_damage_actor] - local spell = twin_damage_actor.spell_tables._ActorTable [actor.damage_spellid] + local spell = twin_damage_actor.spells._ActorTable [actor.damage_spellid] if (spell) then --> fix spell, sometimes there is two spells with the same name, one is the cast and other is the debuff if (spell.total == 0 and not actor.damage_spellid_fixed) then local curname = _GetSpellInfo (actor.damage_spellid) - for spellid, spelltable in _pairs (twin_damage_actor.spell_tables._ActorTable) do + for spellid, spelltable in _pairs (twin_damage_actor.spells._ActorTable) do if (spelltable.total > spell.total) then local name = _GetSpellInfo (spellid) if (name == curname) then @@ -891,7 +884,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex --> fix spell, if the spellid passed for debuff uptime is actully the spell id of a ability and not if the aura it self actor.damage_spellid_fixed = true local found = false - for spellid, spelltable in _pairs (twin_damage_actor.spell_tables._ActorTable) do + for spellid, spelltable in _pairs (twin_damage_actor.spells._ActorTable) do local name = _GetSpellInfo (spellid) if (actor.damage_twin:find (name)) then actor.damage = spelltable.total @@ -954,14 +947,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex else - if (instancia.atributo == 5) then --> custom - --> faz o sort da categoria e retorna o amount corrigido - amount = _detalhes:ContainerSort (conteudo, amount, keyName) - - --> grava o total - instancia.top = conteudo[1][keyName] - - elseif (keyName == "enemies") then + if (keyName == "enemies") then amount, total = _detalhes:ContainerSortEnemies (conteudo, amount, "total") --keyName = "enemies" @@ -1230,23 +1216,12 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex end end end - + end if (use_animations) then instancia:fazer_animacoes() end - - if (instancia.atributo == 5) then --> custom - --> zerar o .custom dos Actors - for index, player in _ipairs (conteudo) do - if (player.custom > 0) then - player.custom = 0 - else - break - end - end - end --> beta, hidar barras não usadas durante um refresh forçado if (forcar) then @@ -1258,41 +1233,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex end return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --> retorna a tabela que precisa ganhar o refresh - -end - -function atributo_damage:Custom (_customName, _combat, sub_atributo, spell, alvo) - --> vai ter só o que a spell causou em alguém - --print (spell) - --print (self.nome) - --print (self.spell_tables._ActorTable) - --if (self.nome == "Ditador") then - --for spellid, tabela in pairs (self.spell_tables._ActorTable) do - --print (spellid) - --end - local _Skill = self.spell_tables._ActorTable [tonumber (spell)] - --print (_Skill) - if (_Skill) then - local spellName = _GetSpellInfo (tonumber (spell)) - --print (spell) - --print (spellName) - - local SkillTargets = _Skill.targets._ActorTable - - for _, TargetActor in _ipairs (SkillTargets) do - --print (TargetActor.nome) - local TargetActorSelf = _combat (class_type, TargetActor.nome) - if (TargetActorSelf) then - --print (TargetActor.total) - TargetActorSelf.custom = TargetActor.total + TargetActorSelf.custom - --print (TargetActorSelf.custom) - _combat.totals [_customName] = _combat.totals [_customName] + TargetActor.total - --print (self.nome .. " " ..TargetActor.total) - end - end - end - --end end function _detalhes:FastRefreshWindow (instancia) @@ -1365,76 +1306,72 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, end -- >>>>>>>>>>>>>>> texto da direita - if (instancia.atributo == 5) then --> custom - esta_barra.texto_direita:SetText (_detalhes:ToK (self.custom) .." (" .. porcentagem .. "%)") --seta o texto da direita - esta_porcentagem = _math_floor ((self.custom/instancia.top) * 100) --> determina qual o tamanho da barra - else + + if (sub_atributo == 1) then --> mostrando damage done - if (sub_atributo == 1) then --> mostrando damage done - - dps = _math_floor (dps) - local formated_damage = SelectedToKFunction (_, damage_total) - local formated_dps = SelectedToKFunction (_, dps) + dps = _math_floor (dps) + local formated_damage = SelectedToKFunction (_, damage_total) + local formated_dps = SelectedToKFunction (_, dps) + --esta_barra.ps_text = formated_dps - if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self)) - else - esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita - end - esta_porcentagem = _math_floor ((damage_total/instancia.top) * 100) --> determina qual o tamanho da barra - - elseif (sub_atributo == 2) then --> mostrando dps - - dps = _math_floor (dps) - local formated_damage = SelectedToKFunction (_, damage_total) - local formated_dps = SelectedToKFunction (_, dps) - - if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_dps, formated_damage, porcentagem, self)) - else - esta_barra.texto_direita:SetText (formated_dps .. " (" .. formated_damage .. ", " .. porcentagem .. "%)") --seta o texto da direita - end - esta_porcentagem = _math_floor ((dps/instancia.top) * 100) --> determina qual o tamanho da barra - - elseif (sub_atributo == 3) then --> mostrando damage taken - - local dtps = self.damage_taken / combat_time - - local formated_damage_taken = SelectedToKFunction (_, self.damage_taken) - local formated_dtps = SelectedToKFunction (_, dtps) - - if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage_taken, formated_dtps, porcentagem, self)) - else - esta_barra.texto_direita:SetText (formated_damage_taken .." (" .. formated_dtps .. ", " .. porcentagem .. "%)") --seta o texto da direita -- - end - esta_porcentagem = _math_floor ((self.damage_taken/instancia.top) * 100) --> determina qual o tamanho da barra - - elseif (sub_atributo == 4) then --> mostrando friendly fire - - local formated_friendly_fire = SelectedToKFunction (_, self.friendlyfire_total) - - if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_friendly_fire, "", porcentagem, self)) - else - esta_barra.texto_direita:SetText (formated_friendly_fire .. " (" .. porcentagem .. "%)") --seta o texto da direita -- - end - esta_porcentagem = _math_floor ((self.friendlyfire_total/instancia.top) * 100) --> determina qual o tamanho da barra - - elseif (sub_atributo == 6) then --> mostrando enemies - - dps = _math_floor (dps) - local formated_damage = SelectedToKFunction (_, damage_total) - local formated_dps = SelectedToKFunction (_, dps) - - if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self)) - else - esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita - end - esta_porcentagem = _math_floor ((damage_total/instancia.top) * 100) --> determina qual o tamanho da barra - + if (UsingCustomRightText) then + esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self)) + else + esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita end + esta_porcentagem = _math_floor ((damage_total/instancia.top) * 100) --> determina qual o tamanho da barra + + elseif (sub_atributo == 2) then --> mostrando dps + + dps = _math_floor (dps) + local formated_damage = SelectedToKFunction (_, damage_total) + local formated_dps = SelectedToKFunction (_, dps) + + if (UsingCustomRightText) then + esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_dps, formated_damage, porcentagem, self)) + else + esta_barra.texto_direita:SetText (formated_dps .. " (" .. formated_damage .. ", " .. porcentagem .. "%)") --seta o texto da direita + end + esta_porcentagem = _math_floor ((dps/instancia.top) * 100) --> determina qual o tamanho da barra + + elseif (sub_atributo == 3) then --> mostrando damage taken + + local dtps = self.damage_taken / combat_time + + local formated_damage_taken = SelectedToKFunction (_, self.damage_taken) + local formated_dtps = SelectedToKFunction (_, dtps) + + if (UsingCustomRightText) then + esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage_taken, formated_dtps, porcentagem, self)) + else + esta_barra.texto_direita:SetText (formated_damage_taken .." (" .. formated_dtps .. ", " .. porcentagem .. "%)") --seta o texto da direita -- + end + esta_porcentagem = _math_floor ((self.damage_taken/instancia.top) * 100) --> determina qual o tamanho da barra + + elseif (sub_atributo == 4) then --> mostrando friendly fire + + local formated_friendly_fire = SelectedToKFunction (_, self.friendlyfire_total) + + if (UsingCustomRightText) then + esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_friendly_fire, "", porcentagem, self)) + else + esta_barra.texto_direita:SetText (formated_friendly_fire .. " (" .. porcentagem .. "%)") --seta o texto da direita -- + end + esta_porcentagem = _math_floor ((self.friendlyfire_total/instancia.top) * 100) --> determina qual o tamanho da barra + + elseif (sub_atributo == 6) then --> mostrando enemies + + dps = _math_floor (dps) + local formated_damage = SelectedToKFunction (_, damage_total) + local formated_dps = SelectedToKFunction (_, dps) + + if (UsingCustomRightText) then + esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self)) + else + esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita + end + esta_porcentagem = _math_floor ((damage_total/instancia.top) * 100) --> determina qual o tamanho da barra + end if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip @@ -1694,7 +1631,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) if (ActorDamage == 0) then ActorDamage = 0.00000001 end - local ActorSkillsContainer = self.spell_tables._ActorTable + local ActorSkillsContainer = self.spells._ActorTable local ActorSkillsSortTable = {} --get time type @@ -1715,12 +1652,11 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) --> TOP INIMIGOS --get variables - local ActorTargetsContainer = self.targets._ActorTable local ActorTargetsSortTable = {} --add and sort - for _, _target in _ipairs (ActorTargetsContainer) do - ActorTargetsSortTable [#ActorTargetsSortTable+1] = {_target.nome, _target.total} + for target_name, amount in _pairs (self.targets) do + ActorTargetsSortTable [#ActorTargetsSortTable+1] = {target_name, amount} end _table_sort (ActorTargetsSortTable, _detalhes.Sort2) @@ -1819,7 +1755,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) local my_self = instancia.showing[class_type]:PegarCombatente (nil, nome) if (my_self) then local meu_total = my_self.total_without_pet - local tabela = my_self.spell_tables._ActorTable + local tabela = my_self.spells._ActorTable local meus_danos = {} --totais [nome] = my_self.total_without_pet @@ -1839,9 +1775,9 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) danos [nome] = meus_danos local meus_inimigos = {} - tabela = my_self.targets._ActorTable - for _, tabela in _ipairs (tabela) do - _table_insert (meus_inimigos, {tabela.nome, tabela.total, tabela.total/meu_total*100}) + tabela = my_self.targets + for target_name, amount in _pairs (tabela) do + _table_insert (meus_inimigos, {target_name, amount, amount/meu_total*100}) end _table_sort (meus_inimigos,_detalhes.Sort2) alvos [nome] = meus_inimigos @@ -1933,14 +1869,14 @@ function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra, keydown) local este_agressor = showing._ActorTable[showing._NameIndexTable[nome]] if (este_agressor) then --> checagem por causa do total e do garbage collector que não limpa os nomes que deram dano local alvos = este_agressor.targets - local este_alvo = alvos._ActorTable[alvos._NameIndexTable[self.nome]] + local este_alvo = alvos [self.nome] if (este_alvo) then - meus_agressores [#meus_agressores+1] = {nome, este_alvo.total, este_agressor.classe} + meus_agressores [#meus_agressores+1] = {nome, este_alvo, este_agressor.classe} end end end - _table_sort (meus_agressores, function (a, b) return a[2] > b[2] end) + _table_sort (meus_agressores, _detalhes.Sort2) local max = #meus_agressores if (max > 6) then @@ -2020,22 +1956,20 @@ function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra, keydown r, g, b = unpack (_detalhes.class_colors [self.classe]) end - local FriendlyFire = self.friendlyfire --> container de jogadores + local FriendlyFire = self.friendlyfire local FriendlyFireTotal = self.friendlyfire_total + local combat = instancia:GetShowingCombat() local tabela_do_combate = instancia.showing - local showing = tabela_do_combate [class_type] --> o que esta sendo mostrado -> [1] - dano [2] - cura --> pega o container com ._NameIndexTable ._ActorTable + local showing = tabela_do_combate [class_type] local DamagedPlayers = {} local Skills = {} - for nome, index in _pairs (FriendlyFire._NameIndexTable) do - local TargetActor = FriendlyFire._ActorTable [index] - DamagedPlayers [#DamagedPlayers+1] = {nome, TargetActor.total, TargetActor.classe} - - local SkillTable = TargetActor.spell_tables --> container das habilidades - for spellid, tabela in _pairs (SkillTable._ActorTable) do - Skills [#Skills+1] = {spellid, tabela.total, tabela.counter} + for target_name, ff_table in _pairs (FriendlyFire) do + DamagedPlayers [#DamagedPlayers+1] = {target_name, ff_table.total, combat (1, target_name).classe} + for spellid, amount in _pairs (ff_table.spells) do + Skills [#Skills+1] = {spellid, amount} end end @@ -2100,7 +2034,7 @@ function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra, keydown for i = 1, _math_min (max_abilities2, #Skills) do local nome, _, icone = _GetSpellInfo (Skills[i][1]) - GameCooltip:AddLine (nome.." (x".. Skills[i][3].."): ", FormatTooltipNumber (_, Skills[i][2]).." (".._cstr("%.1f", Skills[i][2]/FriendlyFireTotal*100).."%)") + GameCooltip:AddLine (nome .. ": ", FormatTooltipNumber (_, Skills[i][2]).." (".._cstr("%.1f", Skills[i][2]/FriendlyFireTotal*100).."%)") GameCooltip:AddIcon (icone, nil, nil, 14, 14) _detalhes:AddTooltipBackgroundStatusbar() end @@ -2143,33 +2077,22 @@ end ------ Friendly Fire function atributo_damage:MontaInfoFriendlyFire() - -- ESQUERDA -> JOGADORES ATINGIDOS - jogadores que o player atingiu com o fogo amigo - -- DIREITA -> MAGIAS USADAS - magias que o jogador usou para causar dano no amigo - -- ALVOS -> overall de todas as magias, total de dano que elas causaram - - local FriendlyFireTotal = self.friendlyfire_total --> total de fogo amigo dado por este jogador - local conteudo = self.friendlyfire._ActorTable --> _ipairs[] com os nomes dos jogadores em que este jogador deu dano - + local instancia = info.instancia + local combat = instancia:GetShowingCombat() local barras = info.barras1 local barras2 = info.barras2 local barras3 = info.barras3 - local instancia = info.instancia + local FriendlyFireTotal = self.friendlyfire_total local DamagedPlayers = {} local Skills = {} - for nome, index in _pairs (self.friendlyfire._NameIndexTable) do --> da foreach em cada spellid do container - local TargetActor = conteudo [index] - local TargetActorDamage = TargetActor.total - _table_insert (DamagedPlayers, {nome, TargetActorDamage, TargetActorDamage/FriendlyFireTotal*100, TargetActor.classe}) + for target_name, ff_table in _pairs (self.friendlyfire) do + _table_insert (DamagedPlayers, {target_name, ff_table.total, ff_table.total / FriendlyFireTotal * 100, combat (1, target_name).classe}) - for spellid, habilidade in _pairs (TargetActor.spell_tables._ActorTable) do - if (not Skills [spellid]) then - Skills [spellid] = habilidade.total - else - Skills [spellid] = Skills [spellid] + habilidade.total - end + for spellid, amount in _pairs (ff_table.spells) do + Skills [spellid] = (Skills [spellid] or 0) + amount end end @@ -2296,9 +2219,9 @@ function atributo_damage:MontaInfoDamageTaken() este_agressor = showing._ActorTable[showing._NameIndexTable[nome]] if (este_agressor) then local alvos = este_agressor.targets - local este_alvo = alvos._ActorTable[alvos._NameIndexTable[self.nome]] + local este_alvo = alvos [self.nome] if (este_alvo) then - meus_agressores [#meus_agressores+1] = {nome, este_alvo.total, este_alvo.total/damage_taken*100, este_agressor.classe} + meus_agressores [#meus_agressores+1] = {nome, este_alvo, este_alvo/damage_taken*100, este_agressor.classe} end end end @@ -2403,7 +2326,7 @@ function atributo_damage:MontaInfoDamageDone() local ActorTotalDamage = self.total local ActorSkillsSortTable = {} - local ActorSkillsContainer = self.spell_tables._ActorTable + local ActorSkillsContainer = self.spells._ActorTable --get time type local meu_tempo @@ -2425,7 +2348,7 @@ function atributo_damage:MontaInfoDamageDone() for _, PetName in _ipairs (ActorPets) do local PetActor = instancia.showing (class_type, PetName) if (PetActor) then - local PetSkillsContainer = PetActor.spell_tables._ActorTable + local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in _pairs (PetSkillsContainer) do --> da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo (_spellid) _table_insert (ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor}) @@ -2473,10 +2396,9 @@ function atributo_damage:MontaInfoDamageDone() for nome, _ in _pairs (agressores) do este_agressor = showing._ActorTable[showing._NameIndexTable[nome]] if (este_agressor) then - local alvos = este_agressor.targets - local este_alvo = alvos._ActorTable[alvos._NameIndexTable[self.nome]] + local este_alvo = este_agressor.targets [self.nome] if (este_alvo) then - meus_agressores [#meus_agressores+1] = {nome, este_alvo.total, este_alvo.total/damage_taken*100, este_agressor.classe} + meus_agressores [#meus_agressores+1] = {nome, este_alvo, este_alvo/damage_taken*100, este_agressor.classe} end end end @@ -2545,13 +2467,13 @@ function atributo_damage:MontaInfoDamageDone() local meus_inimigos = {} --> my target container - conteudo = self.targets._ActorTable - for _, tabela in _ipairs (conteudo) do - _table_insert (meus_inimigos, {tabela.nome, tabela.total, tabela.total/total*100}) + conteudo = self.targets + for target_name, amount in _pairs (conteudo) do + _table_insert (meus_inimigos, {target_name, amount, amount/total*100}) end --> sort - _table_sort (meus_inimigos, function(a, b) return a[2] > b[2] end ) + _table_sort (meus_inimigos, _detalhes.Sort2) local amt_alvos = #meus_inimigos if (amt_alvos < 1) then @@ -2620,24 +2542,22 @@ function atributo_damage:MontaDetalhesFriendlyFire (nome, barra) local tabela_do_combate = info.instancia.showing local showing = tabela_do_combate [class_type] --> o que esta sendo mostrado -> [1] - dano [2] - cura --> pega o container com ._NameIndexTable ._ActorTable - --> será apresentada as magias que deram dano no jogador alvo - local friendlyfire = self.friendlyfire - local total = friendlyfire._ActorTable [friendlyfire._NameIndexTable[nome]].total - local conteudo = friendlyfire._ActorTable [friendlyfire._NameIndexTable[nome]].spell_tables._ActorTable --> assumindo que nome é o nome do Alvo que tomou dano // bastaria pegar a tabela de habilidades dele - + local ff_table = self.friendlyfire [nome] --> assumindo que nome é o nome do Alvo que tomou dano // bastaria pegar a tabela de habilidades dele + if (not ff_table) then + return + end + local total = ff_table.total + local minhas_magias = {} - for spellid, tabela in _pairs (conteudo) do --> da foreach em cada spellid do container + for spellid, amount in _pairs (ff_table.spells) do --> da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo (spellid) - _table_insert (minhas_magias, {spellid, tabela.total, tabela.total/total*100, nome, icone}) + _table_insert (minhas_magias, {spellid, amount, amount / total * 100, nome, icone}) end - _table_sort (minhas_magias, function(a, b) return a[2] > b[2] end) - - --local amt = #minhas_magias - --gump:JI_AtualizaContainerBarras (amt) + _table_sort (minhas_magias, _detalhes.Sort2) local max_ = minhas_magias[1] and minhas_magias[1][2] or 0 --> dano que a primeiro magia vez @@ -2681,21 +2601,21 @@ function atributo_damage:MontaDetalhesEnemy (spellid, barra) local container = info.instancia.showing[1] local barras = info.barras3 local instancia = info.instancia - local spell = self.spell_tables:PegaHabilidade (spellid) + local spell = self.spells:PegaHabilidade (spellid) - local targets = spell.targets._ActorTable + local targets = spell.targets local target_pool = {} - for _, target in _ipairs (targets) do + for target_name, amount in _pairs (targets) do local classe - local this_actor = info.instancia.showing (1, target.nome) + local this_actor = info.instancia.showing (1, target_name) if (this_actor) then classe = this_actor.classe or "UNKNOW" else classe = "UNKNOW" end - target_pool [#target_pool+1] = {target.nome, target.total, classe} + target_pool [#target_pool+1] = {target_name, amount, classe} end _table_sort (target_pool, _detalhes.Sort2) @@ -2759,33 +2679,26 @@ function atributo_damage:MontaDetalhesDamageTaken (nome, barra) local este_agressor = showing._ActorTable[showing._NameIndexTable[nome]] if (not este_agressor ) then - --print ("EROO este agressor eh NIL") return end - local conteudo = este_agressor.spell_tables._ActorTable --> _pairs[] com os IDs das magias + local conteudo = este_agressor.spells._ActorTable --> _pairs[] com os IDs das magias local actor = info.jogador.nome - local total = este_agressor.targets._ActorTable [este_agressor.targets._NameIndexTable [actor]].total + local total = este_agressor.targets [actor] or 0 local minhas_magias = {} for spellid, tabela in _pairs (conteudo) do --> da foreach em cada spellid do container - - --> preciso pegar os alvos que esta magia atingiu - local alvos = tabela.targets - local index = alvos._NameIndexTable[actor] - - if (index) then --> esta magia deu dano no actor - local este_alvo = alvos._ActorTable[index] --> pega a classe_target + local este_alvo = tabela.targets [actor] + if (este_alvo) then --> esta magia deu dano no actor local spell_nome, rank, icone = _GetSpellInfo (spellid) - _table_insert (minhas_magias, {spellid, este_alvo.total, este_alvo.total/total*100, spell_nome, icone}) + _table_insert (minhas_magias, {spellid, este_alvo, este_alvo/total*100, spell_nome, icone}) end - end - _table_sort (minhas_magias, function(a, b) return a[2] > b[2] end) + _table_sort (minhas_magias, _detalhes.Sort2) --local amt = #minhas_magias --gump:JI_AtualizaContainerBarras (amt) @@ -2804,10 +2717,10 @@ function atributo_damage:MontaDetalhesDamageTaken (nome, barra) if (index == 1) then barra.textura:SetValue (100) else - barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido... + barra.textura:SetValue (tabela[2]/max_*100) end - barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda + barra.texto_esquerdo:SetText (index .. "." .. tabela[4]) --seta o texto da esqueda _detalhes:name_space_info (barra) barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita @@ -2837,9 +2750,9 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) local esta_magia if (barra.other_actor) then - esta_magia = barra.other_actor.spell_tables._ActorTable [spellid] + esta_magia = barra.other_actor.spells._ActorTable [spellid] else - esta_magia = self.spell_tables._ActorTable [spellid] + esta_magia = self.spells._ActorTable [spellid] end if (not esta_magia) then @@ -2880,10 +2793,6 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) this_dps = Loc ["STRING_DPS"] .. ": " .. Loc ["STRING_SEE_BELOW"] end - --local offhand = esta_magia.off_amt - --local mainhand = esta_magia.main_amt - --local offstring = Loc ["STRING_OFFHAND_HITS"] .. ": " .. _math_floor () _detalhes:comma_value (esta_magia.o_dmg/offhand) - gump:SetaDetalheInfoTexto ( index, 100, Loc ["STRING_GERAL"], Loc ["STRING_DAMAGE"]..": ".._detalhes:ToK (esta_magia.total), @@ -2991,21 +2900,6 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) t4[8] = esta_magia.m_amt .. " / " .. _cstr ("%.1f", esta_magia.m_amt/total_hits*100) .. "%" end - --> Erros de Ataque --habilidade.missType -- {"ABSORB", "BLOCK", "DEFLECT", "DODGE", "EVADE", "IMMUNE", "MISS", "PARRY", "REFLECT", "RESIST"} - --[[ - if (erros > 0) then - local porcentagem_erros = erros/total_hits*100 - data[#data+1] = { - erros, - {["p"] = porcentagem_erros, ["c"] = {0.5, 0.1, 0.1}}, - Loc ["STRING_FAIL_ATTACKS"], - Loc ["STRING_MISS"]..": "..miss, - - "", - erros.." / ".._cstr("%.1f", porcentagem_erros).."%" - } - end - --]] _table_sort (data, _detalhes.Sort1) @@ -3022,28 +2916,28 @@ end function atributo_damage:MontaTooltipDamageTaken (esta_barra, index) local aggressor = info.instancia.showing [1]:PegarCombatente (_, esta_barra.nome_inimigo) - local container = aggressor.spell_tables._ActorTable + local container = aggressor.spells._ActorTable local habilidades = {} local total = 0 for spellid, spell in _pairs (container) do - for _, actor in _ipairs (spell.targets._ActorTable) do - if (actor.nome == self.nome) then + for target_name, amount in _pairs (spell.targets) do + if (target_name == self.nome) then total = total + actor.total - habilidades [#habilidades+1] = {spellid, actor.total, actor.nome} + habilidades [#habilidades+1] = {spellid, amount} end end end - table.sort (habilidades, function (a, b) return a[2] > b[2] end) + _table_sort (habilidades, _detalhes.Sort2) GameTooltip:AddLine (index..". "..esta_barra.nome_inimigo) GameTooltip:AddLine (Loc ["STRING_DAMAGE_TAKEN_FROM2"]..":") GameTooltip:AddLine (" ") for index, tabela in _ipairs (habilidades) do - local nome, rank, icone = _GetSpellInfo (tabela[1]) + local nome, _, icone = _GetSpellInfo (tabela[1]) if (index < 8) then GameTooltip:AddDoubleLine (index..". |T"..icone..":0|t "..nome, _detalhes:comma_value (tabela[2]).." (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) --GameTooltip:AddTexture (icone) @@ -3057,43 +2951,67 @@ function atributo_damage:MontaTooltipDamageTaken (esta_barra, index) end +local targets_tooltips_table = {} + function atributo_damage:MontaTooltipAlvos (esta_barra, index, instancia) local inimigo = esta_barra.nome_inimigo - local container = self.spell_tables._ActorTable - local habilidades = {} + local habilidades = targets_tooltips_table + + for i = 1, #habilidades do + local t = habilidades [i] + t[1], t[2], t[3] = "", 0, "" --name, total, icon + end + local total = self.total - for spellid, tabela in _pairs (container) do - local alvos = tabela.targets._ActorTable - for _, tabela in _ipairs (alvos) do - if (tabela.nome == inimigo) then + local i = 1 + + for spellid, spell in _pairs (self.spells._ActorTable) do + for target_name, amount in _pairs (spell.targets) do + if (target_name == inimigo) then local nome, _, icone = _GetSpellInfo (spellid) - habilidades [#habilidades+1] = {nome, tabela.total, icone} + + local t = habilidades [i] + if (not t) then + habilidades [i] = {} + t = habilidades [i] + end + t[1], t[2], t[3] = nome, amount, icone + i = i + 1 end end end - + --> add pets - local ActorPets = self.pets - for _, PetName in _ipairs (ActorPets) do + for _, PetName in _ipairs (self.pets) do local PetActor = instancia.showing (class_type, PetName) if (PetActor) then - local PetSkillsContainer = PetActor.spell_tables._ActorTable + local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in _pairs (PetSkillsContainer) do - local alvos = _skill.targets._ActorTable - for _, tabela in _ipairs (alvos) do - if (tabela.nome == inimigo) then + + local alvos = _skill.targets + for target_name, amount in _pairs (alvos) do + if (target_name == inimigo) then + + local t = habilidades [i] + if (not t) then + habilidades [i] = {} + t = habilidades [i] + end + local nome, _, icone = _GetSpellInfo (_spellid) - habilidades [#habilidades+1] = {nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", tabela.total, icone} + t[1], t[2], t[3] = nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", amount, icone + + i = i + 1 end end end end end - - table.sort (habilidades, function (a, b) return a[2] > b[2] end) - + + _table_sort (habilidades, _detalhes.Sort2) + --get time type local meu_tempo if (_detalhes.time_type == 1 or not self.grupo) then @@ -3113,9 +3031,13 @@ function atributo_damage:MontaTooltipAlvos (esta_barra, index, instancia) GameTooltip:AddLine (Loc ["STRING_DAMAGE_FROM"] .. ":") GameTooltip:AddLine (" ") end - + for index, tabela in _ipairs (habilidades) do + if (tabela [2] < 1) then + break + end + if (index < 8) then if (is_dps) then GameTooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t "..tabela[1], _detalhes:comma_value ( _math_floor (tabela[2] / meu_tempo) ).." (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) @@ -3132,7 +3054,6 @@ function atributo_damage:MontaTooltipAlvos (esta_barra, index, instancia) end return true - --GameTooltip:AddDoubleLine (meus_danos[i][4][1]..": ", meus_danos[i][2].." (".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1) end @@ -3218,45 +3139,35 @@ end _detalhes.refresh:r_atributo_damage (actor, shadow) --> copia o container de alvos (captura de dados) - for index, alvo in _ipairs (actor.targets._ActorTable) do + for target_name, amount in _pairs (actor.targets) do --> cria e soma o valor do total - local alvo_shadow = shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow.targets) + if (not shadow.targets [target_name]) then + shadow.targets [target_name] = 0 + end end --> copia o container de habilidades (captura de dados) - for spellid, habilidade in _pairs (actor.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (actor.spells._ActorTable) do --> cria e soma o valor - local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) + local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, nil, true) --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do + for target_name, amount in _pairs (habilidade.targets) do --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo da habilidade - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) + if (not habilidade_shadow.targets [target_name]) then + habilidade_shadow.targets [target_name] = 0 + end end - - --> refresh na habilidade - _detalhes.refresh:r_habilidade_dano (habilidade, shadow.spell_tables) + end --> copia o container de friendly fire (captura de dados) - for index, friendlyFire in _ipairs (actor.friendlyfire._ActorTable) do + for target_name, ff_table in _pairs (actor.friendlyfire) do --> cria ou pega a shadow - local friendlyFire_shadow = shadow.friendlyfire:PegarCombatente (nil, friendlyFire.nome, nil, true) - --> refresh na tabela e no container de habilidades - _setmetatable (friendlyFire, _detalhes) - friendlyFire.shadow = friendlyFire_shadow - - for spellid, habilidade in _pairs (friendlyFire.spell_tables._ActorTable) do - --> cria ou pega a habilidade no container de habilidade - local habilidade_shadow = friendlyFire_shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) - --> refresh na habilidade - _detalhes.refresh:r_habilidade_dano (habilidade, friendlyFire_shadow.spell_tables) + local friendlyFire_shadow = shadow.friendlyfire [target_name] or shadow:CreateFFTable (target_name) + --> some as spells + for spellid, amount in _pairs (ff_table.spells) do + friendlyFire_shadow.spells [spellid] = 0 end - --> refresh na meta e indexes - _detalhes.refresh:r_container_habilidades (friendlyFire.spell_tables, friendlyFire_shadow.spell_tables) end return shadow @@ -3307,29 +3218,17 @@ end end --> copia o container de alvos (captura de dados) - for index, alvo in _ipairs (actor.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - --> refresh no alvo - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow.targets) - end + for target_name, amount in _pairs (actor.targets) do + shadow.targets [target_name] = (shadow.targets [target_name] or 0) + amount end --> copia o container de habilidades (captura de dados) - for spellid, habilidade in _pairs (actor.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (actor.spells._ActorTable) do --> cria e soma o valor - local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) + local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, nil, true) --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - --> refresh no alvo da habilidade - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) - end + for target_name, amount in _pairs (habilidade.targets) do + habilidade_shadow.targets [target_name] = (habilidade_shadow.targets [target_name] or 0) + amount end --> soma todos os demais valores for key, value in _pairs (habilidade) do @@ -3342,99 +3241,27 @@ end end end end - - --> refresh na habilidade - if (not no_refresh) then - _detalhes.refresh:r_habilidade_dano (habilidade, shadow.spell_tables) - end end --> copia o container de friendly fire (captura de dados) - for index, friendlyFire in _ipairs (actor.friendlyfire._ActorTable) do + for target_name, ff_table in _pairs (actor.friendlyfire) do --> cria ou pega a shadow - local friendlyFire_shadow = shadow.friendlyfire:PegarCombatente (nil, friendlyFire.nome, nil, true) - --> refresh na tabela e no container de habilidades - _setmetatable (friendlyFire, _detalhes) - friendlyFire.shadow = friendlyFire_shadow + local friendlyFire_shadow = shadow.friendlyfire [target_name] or shadow:CreateFFTable (target_name) --> soma o total - friendlyFire_shadow.total = friendlyFire_shadow.total + friendlyFire.total - - for spellid, habilidade in _pairs (friendlyFire.spell_tables._ActorTable) do - --> cria ou pega a habilidade no container de habilidade - local habilidade_shadow = friendlyFire_shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) - --> soma os valores - habilidade_shadow.counter = habilidade_shadow.counter + habilidade.counter - habilidade_shadow.total = habilidade_shadow.total + habilidade.total - --> refresh na habilidade - if (not no_refresh) then - _detalhes.refresh:r_habilidade_dano (habilidade, friendlyFire_shadow.spell_tables) - end - end - --> refresh na meta e indexes - if (not no_refresh) then - _detalhes.refresh:r_container_habilidades (friendlyFire.spell_tables, friendlyFire_shadow.spell_tables) + friendlyFire_shadow.total = friendlyFire_shadow.total + ff_table.total + --> some as spells + for spellid, amount in _pairs (ff_table.spells) do + friendlyFire_shadow.spells [spellid] = (friendlyFire_shadow.spells [spellid] or 0) + amount end end return shadow end -function atributo_damage:FF_funcao_de_criacao (_, _, link) - local tabela = _setmetatable ({}, _detalhes) --> mudei de _detalhes para atributo_damage - tabela.total = 0 - tabela.spell_tables = container_habilidades:NovoContainer (container_damage) - if (link) then - tabela.spell_tables.shadow = link.spell_tables - end - return tabela -end - function atributo_damage:ColetarLixo (lastevent) return _detalhes:ColetarLixo (class_type, lastevent) end -function _detalhes.refresh:r_atributo_damage (este_jogador, shadow) - - --> restaura metas do ator - _setmetatable (este_jogador, _detalhes.atributo_damage) - este_jogador.__index = _detalhes.atributo_damage - --> atribui a shadow a ele - este_jogador.shadow = shadow - --> restaura as metas dos container de alvos, habilidades e ff - _detalhes.refresh:r_container_combatentes (este_jogador.targets, shadow.targets) - _detalhes.refresh:r_container_combatentes (este_jogador.friendlyfire, shadow.friendlyfire) - _detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, shadow.spell_tables) -end - -function _detalhes.clear:c_atributo_damage (este_jogador) - --este_jogador.__index = {} - este_jogador.__index = nil - este_jogador.shadow = nil - este_jogador.links = nil - este_jogador.minha_barra = nil - - _detalhes.clear:c_container_combatentes (este_jogador.targets) - _detalhes.clear:c_container_habilidades (este_jogador.spell_tables) - _detalhes.clear:c_atributo_damage_FF (este_jogador.friendlyfire) -end - -function _detalhes.clear:c_atributo_damage_FF (container) - _detalhes.clear:c_container_combatentes (container) - - for _, _tabela in _ipairs (container._ActorTable) do - _tabela.__index = {} - _tabela.shadow = nil - - local habilidades = _tabela.spell_tables - _detalhes.clear:c_container_habilidades (habilidades) - - for _, habilidade in _pairs (habilidades._ActorTable) do - _detalhes.clear:c_habilidade_dano (habilidade) - --pode parar aqui, o container de alvos não é usado no friendly fire - end - end -end - atributo_damage.__add = function (tabela1, tabela2) --> tempo decorrido @@ -3456,21 +3283,17 @@ atributo_damage.__add = function (tabela1, tabela2) end --> soma os containers de alvos - for index, alvo in _ipairs (tabela2.targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma o valor - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.targets) do + tabela1.targets [target_name] = (tabela1.targets [target_name] or 0) + amount end --> soma o container de habilidades - for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spell_tables:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) + local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets = (habilidade_tabela1.targets [target_name] or 0) + amount end --> soma os valores da habilidade for key, value in _pairs (habilidade) do @@ -3486,16 +3309,15 @@ atributo_damage.__add = function (tabela1, tabela2) end --> soma o container de friendly fire - for index, friendlyFire in _ipairs (tabela2.friendlyfire._ActorTable) do + for target_name, ff_table in _pairs (tabela2.friendlyfire) do --> pega o ator ff no ator principal - local friendlyFire_tabela1 = tabela1.friendlyfire:PegarCombatente (nil, friendlyFire.nome, nil, true) + local friendlyFire_tabela1 = tabela1.friendlyfire [target_name] or tabela1:CreateFFTable (target_name) --> soma o total - friendlyFire_tabela1.total = friendlyFire_tabela1.total + friendlyFire.total + friendlyFire_tabela1.total = friendlyFire_tabela1.total + ff_table.total + --> soma as habilidades - for spellid, habilidade in _pairs (friendlyFire.spell_tables._ActorTable) do - local habilidade_tabela1 = friendlyFire_tabela1.spell_tables:PegaHabilidade (spellid, true, nil, false) - habilidade_tabela1.counter = habilidade_tabela1.counter + habilidade.counter - habilidade_tabela1.total = habilidade_tabela1.total + habilidade.total + for spellid, amount in _pairs (ff_table.spells) do + friendlyFire_tabela1.spells [spellid] = (friendlyFire_tabela1.spells [spellid] or 0) + amount end end @@ -3518,21 +3340,23 @@ atributo_damage.__sub = function (tabela1, tabela2) tabela1.friendlyfire_total = tabela1.friendlyfire_total - tabela2.friendlyfire_total --> reduz os containers de alvos - for index, alvo in _ipairs (tabela2.targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> subtrai o valor - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.targets) do + local alvo_tabela1 = tabela1.targets [target_name] + if (alvo_tabela1) then + tabela1.targets [target_name] = tabela1.targets [target_name] - amount + end end --> reduz o container de habilidades - for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spell_tables:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) + local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets._ActorTable) do + local alvo_tabela1 = habilidade_tabela1.targets [target_name] + if (alvo_tabela1) then + habilidade_tabela1.targets [target_name] = habilidade_tabela1.targets [target_name] - amount + end end --> subtrai os valores da habilidade for key, value in _pairs (habilidade) do @@ -3548,98 +3372,37 @@ atributo_damage.__sub = function (tabela1, tabela2) end --> reduz o container de friendly fire - for index, friendlyFire in _ipairs (tabela2.friendlyfire._ActorTable) do + for target_name, ff_table in _pairs (tabela2.friendlyfire) do --> pega o ator ff no ator principal - local friendlyFire_tabela1 = tabela1.friendlyfire:PegarCombatente (nil, friendlyFire.nome, nil, true) - --> soma o total - friendlyFire_tabela1.total = friendlyFire_tabela1.total - friendlyFire.total - --> soma as habilidades - for spellid, habilidade in _pairs (friendlyFire.spell_tables._ActorTable) do - local habilidade_tabela1 = friendlyFire_tabela1.spell_tables:PegaHabilidade (spellid, true, nil, false) - habilidade_tabela1.counter = habilidade_tabela1.counter - habilidade.counter - habilidade_tabela1.total = habilidade_tabela1.total - habilidade.total + local friendlyFire_tabela1 = tabela1.friendlyfire [target_name] + if (friendlyFire_tabela1) then + friendlyFire_tabela1.total = friendlyFire_tabela1.total - ff_table.total + for spellid, amount in _pairs (ff_table.spells) do + if (friendlyFire_tabela1.spells [spellid]) then + friendlyFire_tabela1.spells [spellid] = friendlyFire_tabela1.spells [spellid] - amount + end + end end end return tabela1 end - --local cor = self.cor - - --esta_barra.statusbar:SetStatusBarColor (cor[1], cor[2], cor[3], cor[4]) - - --print (cor[1], cor[2], cor[3]) - --esta_barra.textura:SetVertexColor (cor[1], cor[2], cor[3], cor[4]) - - --local grayscale = (cor[1] + cor[2] + cor[3]) / 3.0 -- lightness - - -- local grayscale = (_math_max (cor[1], cor[2], cor[3]) + _math_min (cor[1], cor[2], cor[3])) / 2 -- average - -- local grayscale = cor[1]*0.21 + cor[2]*0.71 + cor[3]*0.07 - --(max(R, G, B) + min(R, G, B)) / 2 +function _detalhes.refresh:r_atributo_damage (este_jogador, shadow) + --> restaura metas do ator + _setmetatable (este_jogador, _detalhes.atributo_damage) + este_jogador.__index = _detalhes.atributo_damage + --> atribui a shadow a ele + este_jogador.shadow = shadow + --> restaura as metas dos containers + _detalhes.refresh:r_container_habilidades (este_jogador.spells, shadow.spells) +end - --[[ - if (_type (spellid) == "string") then - - local _barra = info.grupos_detalhes [1] - - if (not _barra.pet) then - _barra.bg.PetIcon = _barra.bg:CreateTexture (nil, "overlay") - - --_barra.bg.PetIcon:SetTexture ("Interface\\ICONS\\Ability_Druid_SkinTeeth") - _barra.bg.PetIcon:SetTexture ("Interface\\AddOns\\Details\\images\\classes") - _barra.bg.PetIcon:SetTexCoord (0.25, 0.49609375, 0.75, 1) +function _detalhes.clear:c_atributo_damage (este_jogador) + este_jogador.__index = nil + este_jogador.shadow = nil + este_jogador.links = nil + este_jogador.minha_barra = nil - _barra.bg.PetIcon:SetPoint ("left", _barra.bg, "left", 2, 2) - _barra.bg.PetIcon:SetWidth (40) - _barra.bg.PetIcon:SetHeight (40) - gump:NewLabel (_barra.bg, _barra.bg, nil, "PetText", Loc ["STRING_ISA_PET"], "GameFontHighlightLeft") - _barra.bg.PetText:SetPoint ("topleft", _barra.bg.PetIcon, "topright", 10, -2) - gump:NewLabel (_barra.bg, _barra.bg, nil, "PetDps", "", "GameFontHighlightSmall") - _barra.bg.PetDps:SetPoint ("left", _barra.bg.PetIcon, "right", 10, 2) - _barra.bg.PetDps:SetPoint ("top", _barra.bg.PetText, "bottom", 0, -5) - _barra.pet = true - end - - _barra.IsPet = true - _barra.bg:SetValue (100) - gump:Fade (_barra.bg.overlay, "OUT") - _barra.bg:SetStatusBarColor (1, 1, 1) - _barra.bg_end:SetPoint ("LEFT", _barra.bg, "LEFT", (_barra.bg:GetValue()*2.19)-6, 0) - _barra.bg.PetIcon:SetVertexColor (_unpack (_detalhes.class_colors [self.classe])) - _barra.bg:Show() - _barra.bg.PetIcon:Show() - _barra.bg.PetText:Show() - _barra.bg.PetDps:Show() - - local PetActor = info.instancia.showing (info.instancia.atributo, spellid) - - if (PetActor) then - local OwnerActor = PetActor.ownerName - if (OwnerActor) then --> nor necessary - OwnerActor = info.instancia.showing (info.instancia.atributo, OwnerActor) - if (OwnerActor) then - local meu_tempo = OwnerActor:Tempo() - local normal_dmg = PetActor.total - local T = (meu_tempo*normal_dmg)/PetActor.total - _barra.bg.PetDps:SetText ("Dps: " .. _cstr("%.1f", normal_dmg/T)) - end - end - - end - - for i = 2, 5 do - gump:HidaDetalheInfo (i) - end - - local ThisBox = _detalhes.janela_info.grupos_detalhes [1] - ThisBox.nome:Hide() - ThisBox.dano:Hide() - ThisBox.dano_porcento:Hide() - ThisBox.dano_media:Hide() - ThisBox.dano_dps:Hide() - ThisBox.nome2:Hide() - - return - end ---]] - \ No newline at end of file + _detalhes.clear:c_container_habilidades (este_jogador.spells) +end diff --git a/classes/classe_damage_habilidade.lua b/classes/classe_damage_habilidade.lua index 3a0ecc54..d1d4a1a9 100644 --- a/classes/classe_damage_habilidade.lua +++ b/classes/classe_damage_habilidade.lua @@ -5,7 +5,6 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> local pointers - local _setmetatable = setmetatable--lua local local _ipairs = ipairs--lua local local _pairs = pairs--lua local local _UnitAura = UnitAura--api local @@ -68,15 +67,9 @@ a_amt = 0, a_dmg = 0, - targets = container_combatentes:NovoContainer (container_damage_target) + targets = {} } - _setmetatable (_newDamageSpell, habilidade_dano) - - if (link) then - _newDamageSpell.targets.shadow = link.targets - end - if (token == "SPELL_PERIODIC_DAMAGE") then _detalhes:SpellIsDot (id) end @@ -86,29 +79,16 @@ function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType) self.counter = self.counter + 1 - - local miss = self [missType] or 0 - miss = miss + 1 - self [missType] = miss + self [missType] = (self [missType] or 0) + 1 - self.targets:PegarCombatente (serial, nome, flags, true) --apenas criar o alvo para a abilidade - end - - function habilidade_dano:AddFF (amount) - self.counter = self.counter + 1 - self.total = self.total + amount + self.targets [nome] = self.targets [nome] or 0 end function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token, multistrike, isoffhand) self.counter = self.counter + 1 - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end + self.targets [nome] = (self.targets [nome] or 0) + amount if (multistrike) then self.m_amt = self.m_amt + 1 @@ -140,7 +120,6 @@ end self.total = self.total + amount - alvo.total = alvo.total + amount if (glacing) then self.g_dmg = self.g_dmg+amount --> amount é o total de dano @@ -223,81 +202,6 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> core - function _detalhes.refresh:r_habilidade_dano (habilidade, shadow) --recebeu o container shadow - _setmetatable (habilidade, habilidade_dano) - habilidade.__index = habilidade_dano - habilidade.shadow = shadow._ActorTable [habilidade.id] - _detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets) - end - - function _detalhes.clear:c_habilidade_dano (habilidade) - --habilidade.__index = {} - habilidade.__index = nil - habilidade.shadow = nil - - _detalhes.clear:c_container_combatentes (habilidade.targets) - end - - habilidade_dano.__add = function (tabela1, tabela2) - tabela1.total = tabela1.total + tabela2.total - tabela1.counter = tabela1.counter + tabela2.counter - tabela1.successful_casted = tabela1.successful_casted + tabela2.successful_casted - - tabela1.n_min = tabela1.n_min + tabela2.n_min - tabela1.n_max = tabela1.n_max + tabela2.n_max - tabela1.n_amt = tabela1.n_amt + tabela2.n_amt - tabela1.n_dmg = tabela1.n_dmg + tabela2.n_dmg - - tabela1.c_min = tabela1.c_min + tabela2.c_min - tabela1.c_max = tabela1.c_max + tabela2.c_max - tabela1.c_amt = tabela1.c_amt + tabela2.c_amt - tabela1.c_dmg = tabela1.c_dmg + tabela2.c_dmg - - tabela1.g_amt = tabela1.g_amt + tabela2.g_amt - tabela1.g_dmg = tabela1.g_dmg + tabela2.g_dmg - - tabela1.r_amt = tabela1.r_amt + tabela2.r_amt - tabela1.r_dmg = tabela1.r_dmg + tabela2.r_dmg - - tabela1.b_amt = tabela1.b_amt + tabela2.b_amt - tabela1.b_dmg = tabela1.b_dmg + tabela2.b_dmg - - tabela1.a_amt = tabela1.a_amt + tabela2.a_amt - tabela1.a_dmg = tabela1.a_dmg + tabela2.a_dmg - - return tabela1 - end - - habilidade_dano.__sub = function (tabela1, tabela2) - tabela1.total = tabela1.total - tabela2.total - tabela1.counter = tabela1.counter - tabela2.counter - tabela1.successful_casted = tabela1.successful_casted - tabela2.successful_casted - - tabela1.n_min = tabela1.n_min - tabela2.n_min - tabela1.n_max = tabela1.n_max - tabela2.n_max - tabela1.n_amt = tabela1.n_amt - tabela2.n_amt - tabela1.n_dmg = tabela1.n_dmg - tabela2.n_dmg - - tabela1.c_min = tabela1.c_min - tabela2.c_min - tabela1.c_max = tabela1.c_max - tabela2.c_max - tabela1.c_amt = tabela1.c_amt - tabela2.c_amt - tabela1.c_dmg = tabela1.c_dmg - tabela2.c_dmg - - tabela1.g_amt = tabela1.g_amt - tabela2.g_amt - tabela1.g_dmg = tabela1.g_dmg - tabela2.g_dmg - - tabela1.r_amt = tabela1.r_amt - tabela2.r_amt - tabela1.r_dmg = tabela1.r_dmg - tabela2.r_dmg - - tabela1.b_amt = tabela1.b_amt - tabela2.b_amt - tabela1.b_dmg = tabela1.b_dmg - tabela2.b_dmg - - tabela1.a_amt = tabela1.a_amt - tabela2.a_amt - tabela1.a_dmg = tabela1.a_dmg - tabela2.a_dmg - - return tabela1 - end - function _detalhes:UpdateDamageAbilityGears() _recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs end diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index 79c5b3d2..74ef1a8f 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -1,8 +1,3 @@ ---[[ Esta classe irá abrigar todo a e_energy ganha de uma habilidade -Parents: - addon -> combate atual -> e_energy-> container de jogadores -> esta classe - -]] --lua locals local _cstr = string.format @@ -40,11 +35,7 @@ local container_pets = _detalhes.container_pets local atributo_energy = _detalhes.atributo_energy local habilidade_energy = _detalhes.habilidade_energy ---local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS -local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS -local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS ---local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE --local modo_ALONE = _detalhes.modos.alone local modo_GROUP = _detalhes.modos.group @@ -55,10 +46,6 @@ local class_type = _detalhes.atributos.e_energy local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END -local div_abre = _detalhes.divisores.abre -local div_fecha = _detalhes.divisores.fecha -local div_lugar = _detalhes.divisores.colocacao - local ToKFunctions = _detalhes.ToKFunctions local SelectedToKFunction = ToKFunctions [1] local UsingCustomLeftText = false @@ -70,6 +57,7 @@ local TooltipMaximizedMethod = 1 local headerColor = "yellow" local key_overlay = {1, 1, 1, .1} local key_overlay_press = {1, 1, 1, .2} +local actor_class_color_r, actor_class_color_g, actor_class_color_b local info = _detalhes.janela_info local keyName @@ -84,56 +72,32 @@ function atributo_energy:NovaTabela (serial, nome, link) local _new_energyActor = { last_event = 0, - tipo = class_type, --> atributo 3 = e_energy - - mana = alphabetical, - e_rage = alphabetical, - e_energy = alphabetical, - runepower = alphabetical, - focus = alphabetical, - holypower = alphabetical, + tipo = class_type, - mana_r = alphabetical, - e_rage_r = alphabetical, - e_energy_r = alphabetical, - runepower_r = alphabetical, - focus_r = alphabetical, - holypower_r = alphabetical, - - mana_from = {}, - e_rage_from = {}, - e_energy_from = {}, - runepower_from = {}, - focus_from = {}, - holypower_from = {}, - - last_value = nil, --> ultimo valor que este jogador teve, salvo quando a barra dele é atualizada + total = alphabetical, + received = alphabetical, + resource = alphabetical, + + last_value = nil, pets = {}, - - --container armazenará os seriais dos alvos que o player aplicou dano - targets = container_combatentes:NovoContainer (container_energy_target), - - --container armazenará os IDs das habilidades usadas por este jogador - spell_tables = container_habilidades:NovoContainer (container_energy), + targets = {}, + spells = container_habilidades:NovoContainer (container_energy), } _setmetatable (_new_energyActor, atributo_energy) - if (link) then - _new_energyActor.targets.shadow = link.targets - _new_energyActor.spell_tables.shadow = link.spell_tables - end - return _new_energyActor end -function _detalhes.SortGroupEnergy (container, keyName2) +--> resources sort + +function _detalhes.SortGroupResource (container, keyName2) keyName = keyName2 - return _table_sort (container, _detalhes.SortKeyGroupEnergy) + return _table_sort (container, _detalhes.SortKeyGroupResources) end -function _detalhes.SortKeyGroupEnergy (table1, table2) +function _detalhes.SortKeyGroupResources (table1, table2) if (table1.grupo and table2.grupo) then return table1 [keyName] > table2 [keyName] elseif (table1.grupo and not table2.grupo) then @@ -145,13 +109,13 @@ function _detalhes.SortKeyGroupEnergy (table1, table2) end end -function _detalhes.SortKeySimpleEnergy (table1, table2) +function _detalhes.SortKeySimpleResources (table1, table2) return table1 [keyName] > table2 [keyName] end -function _detalhes:ContainerSortEnergy (container, amount, keyName2) +function _detalhes:ContainerSortResources (container, amount, keyName2) keyName = keyName2 - _table_sort (container, _detalhes.SortKeySimpleEnergy) + _table_sort (container, _detalhes.SortKeySimpleResources) if (amount) then for i = amount, 1, -1 do --> de trás pra frente @@ -166,114 +130,294 @@ function _detalhes:ContainerSortEnergy (container, amount, keyName2) end end +--> power types sort + +local power_table = {0, 1, 3, 6} +local power_type + +local sort_energy = function (t1, t2) + if (t1.powertype == power_type and t2.powertype == power_type) then + return t1.received > t2.received + elseif (t1.powertype == power_type) then + return true + elseif (t2.powertype == power_type) then + return false + else + return t1.received > t2.received + end +end + +local sort_energy_group = function (t1, t2) + if (t1.grupo and t2.grupo) then + if (t1.powertype == power_type and t2.powertype == power_type) then + return t1.received > t2.received + elseif (t1.powertype == power_type) then + return true + elseif (t2.powertype == power_type) then + return false + else + return t1.received > t2.received + end + else + if (t1.grupo) then + return true + elseif (t2.grupo) then + return false + else + return t1.received > t2.received + end + end +end + +--> resource refresh + +local function RefreshBarraResources (tabela, barra, instancia) + tabela:AtualizarResources (tabela.minha_barra, barra.colocacao, instancia) +end + +function atributo_energy:AtualizarResources (qual_barra, colocacao, instancia) + + local esta_barra = instancia.barras [qual_barra] + + if (not esta_barra) then + print ("DEBUG: problema com "..qual_barra.." "..lugar) + return + end + + self._refresh_window = RefreshBarraResources + + local tabela_anterior = esta_barra.minha_tabela + esta_barra.minha_tabela = self + self.minha_barra = qual_barra + esta_barra.colocacao = colocacao + + local total = instancia.showing.totals.resources + + local combat_time = instancia.showing:GetCombatTime() + local rps = _math_floor (self.resource / combat_time) + + local formated_resource = SelectedToKFunction (_, self.resource) + --local formated_rps = SelectedToKFunction (_, rps) + local formated_rps = _cstr ("%.2f", self.resource / combat_time) + + local porcentagem + + if (instancia.row_info.percent_type == 1) then + porcentagem = _cstr ("%.1f", self.resource / total * 100) + elseif (instancia.row_info.percent_type == 2) then + porcentagem = _cstr ("%.1f", self.resource / instancia.top * 100) + end + + if (UsingCustomRightText) then + esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_resource, formated_rps, porcentagem, self)) + else + esta_barra.texto_direita:SetText (formated_resource .. " (" .. formated_rps .. ", " .. porcentagem .. "%)") + end + + esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. self.nome) + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) + + esta_barra.statusbar:SetValue (100) + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + gump:Fade (esta_barra, "out") + end + + actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + + if (self.classe == "UNKNOW") then + esta_barra.icone_classe:SetTexture ([[Interface\AddOns\Details\images\classes_plus]]) + esta_barra.icone_classe:SetTexCoord (0.50390625, 0.62890625, 0, 0.125) + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "UNGROUPPLAYER") then + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + else + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + end + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "PET") then + esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file) + esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) + esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + + else + esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file) + esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + end + + if (instancia.row_info.textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_info.textR_class_colors) then + esta_barra.texto_direita:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + +end + +--> refresh function + function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, exportar) - local showing = tabela_do_combate [class_type] --> o que esta sendo mostrado -> [1] - dano [2] - cura --> pega o container com ._NameIndexTable ._ActorTable + local showing = tabela_do_combate [class_type] if (#showing._ActorTable < 1) then --> não há barras para mostrar return _detalhes:EsconderBarrasNaoUsadas (instancia, showing) end - local total = 0 --> total iniciado como ZERO + local total = 0 instancia.top = 0 - local sub_atributo = instancia.sub_atributo --> o que esta sendo mostrado nesta instância + local sub_atributo = instancia.sub_atributo local conteudo = showing._ActorTable local amount = #conteudo local modo = instancia.modo + if (sub_atributo == 5) then + --> showing resources + + keyName = "resource" + + if (modo == modo_ALL) then + amount = _detalhes:ContainerSortResources (conteudo, amount, "resource") + instancia.top = conteudo[1].resource + + for index, player in _ipairs (conteudo) do + if (player.resource >= 1) then + total = total + player.resource + else + break + end + end + + elseif (modo == modo_GROUP) then + _table_sort (conteudo, _detalhes.SortKeyGroupResources) + + for index, player in _ipairs (conteudo) do + if (player.grupo) then --> é um player e esta em grupo + if (player.resource < 1) then --> dano menor que 1, interromper o loop + amount = index - 1 + break + end + + total = total + player.resource + else + amount = index-1 + break + end + end + + instancia.top = conteudo [1].resource + end + + showing:remapear() + + if (exportar) then + return total, keyName, instancia.top, amount + end + + if (total < 1) then + instancia:EsconderScrollBar() + return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) + end + + tabela_do_combate.totals.resources = total + + instancia:AtualizarScrollBar (amount) + + local qual_barra = 1 + local barras_container = instancia.barras + + for i = instancia.barraS[1], instancia.barraS[2], 1 do + conteudo[i]:AtualizarResources (qual_barra, i, instancia) + qual_barra = qual_barra+1 + end + + --> beta, hidar barras não usadas durante um refresh forçado + if (forcar) then + if (instancia.modo == 2) then --> group + for i = qual_barra, instancia.rows_fit_in_window do + gump:Fade (instancia.barras [i], "in", 0.3) + end + end + end + + return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) + + end + + power_type = power_table [sub_atributo] + + keyName = "received" + if (exportar) then if (_type (exportar) == "boolean") then - if (sub_atributo == 1) then --> MANA RECUPERADA - keyName = "mana" - elseif (sub_atributo == 2) then --> e_rage GANHA - keyName = "e_rage" - elseif (sub_atributo == 3) then --> ENERGIA GANHA - keyName = "e_energy" - elseif (sub_atributo == 4) then --> RUNEPOWER GANHO - keyName = "runepower" - end + keyName = "received" else keyName = exportar.key modo = exportar.modo end - - elseif (instancia.atributo == 5) then --> custom - keyName = "custom" - total = tabela_do_combate.totals [instancia.customName] - else - if (sub_atributo == 1) then --> MANA RECUPERADA - keyName = "mana" - elseif (sub_atributo == 2) then --> e_rage GANHA - keyName = "e_rage" - elseif (sub_atributo == 3) then --> ENERGIA GANHA - keyName = "e_energy" - elseif (sub_atributo == 4) then --> RUNEPOWER GANHO - keyName = "runepower" - else - --> not sure why this is happening - return - end + keyName = "received" end - if (instancia.atributo == 5) then --> custom - --> faz o sort da categoria e retorna o amount corrigido - amount = _detalhes:ContainerSortEnergy (conteudo, amount, keyName) - - --> grava o total - instancia.top = conteudo[1][keyName] + if (modo == modo_ALL) then - elseif (modo == modo_ALL) then --> mostrando ALL - - --> faz o sort da categoria - _table_sort (conteudo, function (a, b) return a[keyName] > b[keyName] end) + _table_sort (conteudo, sort_energy) - --> não mostrar resultados com zero - for i = amount, 1, -1 do --> de trás pra frente - if (conteudo[i][keyName] < 1) then + for i = amount, 1, -1 do + if (conteudo[i].received < 1) then + amount = amount-1 + elseif (conteudo[i].powertype ~= power_type) then amount = amount-1 else break end end - total = tabela_do_combate.totals [class_type] [keyName] --> pega o total de dano já aplicado + + total = tabela_do_combate.totals [class_type] [power_type] + instancia.top = conteudo[1].received - instancia.top = conteudo[1] [keyName] + elseif (modo == modo_GROUP) then - elseif (modo == modo_GROUP) then --> mostrando GROUP - - --print ("energy", keyName) - - _table_sort (conteudo, function (a, b) - if (a.grupo and b.grupo) then - return a[keyName] > b[keyName] - elseif (a.grupo and not b.grupo) then - return true - elseif (not a.grupo and b.grupo) then - return false - else - return a[keyName] > b[keyName] - end - end) + _table_sort (conteudo, sort_energy_group) for index, player in _ipairs (conteudo) do - if (player.grupo) then --> é um player e esta em grupo - if (player[keyName] < 1) then --> dano menor que 1, interromper o loop + if (player.grupo) then + if (player.received < 1) then + amount = index - 1 + break + elseif (player.powertype ~= power_type) then amount = index - 1 break - elseif (index == 1) then --> esse IF aqui, precisa mesmo ser aqui? não daria pra pega-lo com uma chave [1] nad grupo == true? - instancia.top = conteudo[1][keyName] end - total = total + player[keyName] + total = total + player.received else amount = index-1 break end end + instancia.top = conteudo[1].received + end showing:remapear() @@ -447,18 +591,6 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex instancia:fazer_animacoes() end - if (instancia.atributo == 5) then --> custom - --> zerar o .custom dos Actors - for index, player in _ipairs (conteudo) do - if (player.custom > 0) then - player.custom = 0 - else - break - end - end - end - - --> beta, hidar barras não usadas durante um refresh forçado if (forcar) then if (instancia.modo == 2) then --> group for i = qual_barra, instancia.rows_fit_in_window do @@ -471,22 +603,6 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex end -function atributo_energy:Custom (_customName, _combat, sub_atributo, spell, alvo) - local _Skill = self.spell_tables._ActorTable [tonumber (spell)] - if (_Skill) then - local spellName = _GetSpellInfo (tonumber (spell)) - local SkillTargets = _Skill.targets._ActorTable - - for _, TargetActor in _ipairs (SkillTargets) do - local TargetActorSelf = _combat (class_type, TargetActor.nome) - TargetActorSelf.custom = TargetActor.total + TargetActorSelf.custom - _combat.totals [_customName] = _combat.totals [_customName] + TargetActor.total - end - end -end - -local actor_class_color_r, actor_class_color_g, actor_class_color_b - function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations) local esta_barra = instancia.barras[qual_barra] --> pega a referência da barra na janela @@ -716,110 +832,84 @@ end --------------------------------------------- // TOOLTIPS // --------------------------------------------- function atributo_energy:KeyNames (sub_atributo) - if (sub_atributo == 1) then --> MANA RECUPERADA - return "mana", "mana_from" - elseif (sub_atributo == 2) then --> e_rage GANHA - return "e_rage", "e_rage_from" - elseif (sub_atributo == 3) then --> ENERGIA GANHA - return "e_energy", "e_energy_from" - elseif (sub_atributo == 4) then --> RUNEPOWER GANHO - return "runepower", "runepower_from" - end + return "total" end -function atributo_energy:Fontes_e_Habilidades (recebido_from, showing, keyName, habilidade_alvo) - - local habilidades = {} - local fontes = {} - local spells_alvo = {} - local max = 0 - - for nome, _ in _pairs (recebido_from) do - local esta_fonte = showing._ActorTable [showing._NameIndexTable [nome]] - if (esta_fonte) then - - local alvos = esta_fonte.targets - local _habilidades = esta_fonte.spell_tables - - local este_alvo = alvos._ActorTable [alvos._NameIndexTable[self.nome]] - if (este_alvo) then - fontes [#fontes+1] = {nome, este_alvo [keyName], esta_fonte.classe} --> mostra QUEM deu regen, a QUANTIDADE e a CLASSE - --print (nome, este_alvo [keyName], esta_fonte.classe) - end - - for spellid, habilidade in _pairs (_habilidades._ActorTable) do - local alvos = habilidade.targets - local este_alvo = alvos._ActorTable [alvos._NameIndexTable[self.nome]] - if (este_alvo) then - if (not habilidades [spellid]) then - habilidades [spellid] = 0 --> mostra A SPELL e a quantidade que ela deu regen - end - habilidades [spellid] = habilidades [spellid] + este_alvo [keyName] - if (habilidades [spellid] > max) then - max = habilidades [spellid] - end - if (habilidade_alvo and habilidade_alvo == spellid) then - spells_alvo [#spells_alvo + 1] = {nome, este_alvo [keyName], esta_fonte.classe} - elseif (habilidade_alvo == true) then - --print (nome, nome, este_alvo [keyName], spellid) - spells_alvo [#spells_alvo + 1] = {nome, este_alvo [keyName], spellid} - end - end - end - end - end - - local sorted_table = {} - for spellid, amt in _pairs (habilidades) do - local nome, _, icone = _GetSpellInfo (spellid) - sorted_table [#sorted_table+1] = {spellid, amt, amt/max*100, nome, icone} - end - _table_sort (sorted_table, function (a, b) return a[2] > b[2] end) - - _table_sort (fontes, function (a, b) return a[2] > b[2] end) - - if (habilidade_alvo) then - _table_sort (spells_alvo, function (a, b) return a[2] > b[2] end) - end - - return fontes, sorted_table, spells_alvo -end - - ---------> TOOLTIPS BIFURCAÇÃO function atributo_energy:ToolTip (instancia, numero, barra, keydown) - --> seria possivel aqui colocar o icone da classe dele? - --GameCooltip:AddLine (barra.colocacao..". "..self.nome) if (instancia.sub_atributo <= 4) then return self:ToolTipRegenRecebido (instancia, numero, barra, keydown) end end + --> tooltip locals local r, g, b local barAlha = .6 +local energy_tooltips_table = {} +local energy_tooltips_hash = {} + +local reset_tooltips_table = function() + for i = 1, #energy_tooltips_table do + local t = energy_tooltips_table [i] + t[1], t[2], t[3] = "", 0, "" + end + + for k, v in _pairs (energy_tooltips_hash) do + energy_tooltips_hash [k] = nil + end +end + function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown) + reset_tooltips_table() + local owner = self.owner if (owner and owner.classe) then r, g, b = unpack (_detalhes.class_colors [owner.classe]) else r, g, b = unpack (_detalhes.class_colors [self.classe]) - end + end + local powertype = self.powertype local tabela_do_combate = instancia.showing - local showing = tabela_do_combate [class_type] + local container = tabela_do_combate [class_type] + local total_regenerado = self.received + local name = self.nome - local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo) + --> spells: + local i = 1 - local total_regenerado = self [keyName] - local recebido_from = self [keyName_from] + for index, actor in _ipairs (container._ActorTable) do + if (actor.powertype == powertype) then + + for spellid, spell in _pairs (actor.spells._ActorTable) do + local on_self = spell.targets [name] + if (on_self) then + local already_tracked = energy_tooltips_hash [spellid] + if (already_tracked) then + local t = energy_tooltips_table [already_tracked] + t[2] = t[2] + on_self + else + local t = energy_tooltips_table [i] + if (not t) then + energy_tooltips_table [i] = {} + t = energy_tooltips_table [i] + end + t[1], t[2], t[3] = spellid, on_self, "" + energy_tooltips_hash [spellid] = i + i = i + 1 + end + end + end + + end + end - local fontes, habilidades = self:Fontes_e_Habilidades (recebido_from, showing, keyName) - ------------------------------------------------------------------ + i = i - 1 + _table_sort (energy_tooltips_table, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #habilidades) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, i) GameCooltip:AddIcon ([[Interface\HELPFRAME\ReportLagIcon-Spells]], 1, 1, 14, 14, 0.21875, 0.78125, 0.21875, 0.78125) local ismaximized = false @@ -832,7 +922,7 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) end - local max = #habilidades + local max = i if (max > 3) then max = 3 end @@ -841,16 +931,47 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown max = 99 end - for i = 1, math.min (#habilidades, max) do - local nome_magia, _, icone_magia = _GetSpellInfo (habilidades[i][1]) - GameCooltip:AddLine (nome_magia..": ", FormatTooltipNumber (_, habilidades[i][2]).." (".._cstr("%.1f", (habilidades[i][2]/total_regenerado) * 100).."%)") + for o = 1, math.min (i, max) do + + local spell = energy_tooltips_table [o] + + if (spell [2] < 1) then + break + end + + local nome_magia, _, icone_magia = _GetSpellInfo (spell [1]) + GameCooltip:AddLine (nome_magia..": ", FormatTooltipNumber (_, spell [2]).." (".._cstr("%.1f", (spell [2]/total_regenerado) * 100).."%)") GameCooltip:AddIcon (icone_magia) _detalhes:AddTooltipBackgroundStatusbar() + end ------------------------------------------------------------------ + --> players + + reset_tooltips_table() + i = 1 - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PLAYERS"], headerColor, r, g, b, #fontes) + for index, actor in _ipairs (container._ActorTable) do + if (actor.powertype == powertype) then + + local on_self = actor.targets [name] + if (on_self) then + local t = energy_tooltips_table [i] + if (not t) then + energy_tooltips_table [i] = {} + t = energy_tooltips_table [i] + end + t[1], t[2], t[3] = actor.nome, on_self, actor.classe + i = i + 1 + end + + end + end + + i = i - 1 + _table_sort (energy_tooltips_table, _detalhes.Sort2) + + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PLAYERS"], headerColor, r, g, b, i) GameCooltip:AddIcon ([[Interface\HELPFRAME\HelpIcon-HotIssues]], 1, 1, 14, 14, 0.21875, 0.78125, 0.21875, 0.78125) local ismaximized = false @@ -863,7 +984,7 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) end - max = #fontes + max = i if (max > 3) then max = 3 end @@ -872,11 +993,18 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown max = 99 end - for i = 1, math.min (#fontes, max) do - GameCooltip:AddLine (fontes[i][1]..": ", FormatTooltipNumber (_, fontes[i][2]).." (".._cstr("%.1f", (fontes[i][2]/total_regenerado) * 100).."%)") + for o = 1, math.min (i, max) do + + local source = energy_tooltips_table [o] + + if (source [2] < 1) then + break + end + + GameCooltip:AddLine (source [1]..": ", FormatTooltipNumber (_, source [2]).." (".._cstr("%.1f", (source [2] / total_regenerado) * 100).."%)") _detalhes:AddTooltipBackgroundStatusbar() - local classe = fontes[i][3] + local classe = source [3] if (not classe) then classe = "UNKNOW" end @@ -895,7 +1023,7 @@ end ---------> DETALHES BIFURCAÇÃO function atributo_energy:MontaInfo() - if (info.sub_atributo <= 4) then --> damage done & dps + if (info.sub_atributo <= 4) then return self:MontaInfoRegenRecebido() end end @@ -909,48 +1037,84 @@ end function atributo_energy:MontaInfoRegenRecebido() + reset_tooltips_table() + local barras = info.barras1 local barras2 = info.barras2 local barras3 = info.barras3 local instancia = info.instancia - local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo) - local tabela_do_combate = instancia.showing - local showing = tabela_do_combate [class_type] + local container = tabela_do_combate [class_type] - local total_regenerado = self [keyName] - local recebido_from = self [keyName_from] + local total_regenerado = self.received + local my_name = self.nome + local powertype = self.powertype - if (not recebido_from) then - return + --> spells: + local i = 1 + + for index, actor in _ipairs (container._ActorTable) do + if (actor.powertype == powertype) then + + for spellid, spell in _pairs (actor.spells._ActorTable) do + local on_self = spell.targets [my_name] + + if (on_self) then + local already_tracked = energy_tooltips_hash [spellid] + if (already_tracked) then + local t = energy_tooltips_table [already_tracked] + t[2] = t[2] + on_self + else + local t = energy_tooltips_table [i] + if (not t) then + energy_tooltips_table [i] = {} + t = energy_tooltips_table [i] + end + t[1], t[2], t[3] = spellid, on_self, "" + energy_tooltips_hash [spellid] = i + i = i + 1 + end + end + end + + end end - local fontes, habilidades = self:Fontes_e_Habilidades (recebido_from, showing, keyName) + i = i - 1 + _table_sort (energy_tooltips_table, _detalhes.Sort2) - local amt = #habilidades - if (amt < 1) then --> caso houve apenas friendly fire + local amt = i + + if (amt < 1) then return true end gump:JI_AtualizaContainerBarras (amt) - local max_ = habilidades [1][2] + local max_ = energy_tooltips_table [1][2] - for index, tabela in _ipairs (habilidades) do + for index, tabela in _ipairs (energy_tooltips_table) do + + if (tabela [2] < 1) then + break + end local barra = barras [index] if (not barra) then barra = gump:CriaNovaBarraInfo1 (instancia, index) barra.textura:SetStatusBarColor (1, 1, 1, 1) - barra.on_focus = false end self:FocusLock (barra, tabela[1]) - self:UpdadeInfoBar (barra, index, tabela[1], tabela[4], tabela[2], _detalhes:comma_value (tabela[2]), max_, tabela[3], tabela[5], true) + + local spellname, _, spellicon = _GetSpellInfo (tabela [1]) + local percent = tabela [2] / total_regenerado * 100 + + self:UpdadeInfoBar (barra, index, tabela[1], spellname, tabela[2], _detalhes:comma_value (tabela[2]), max_, percent, spellicon, true) barra.minha_tabela = self barra.show = tabela[1] @@ -962,14 +1126,42 @@ function atributo_energy:MontaInfoRegenRecebido() end + --> players: - local amt_fontes = #fontes + reset_tooltips_table() + i = 1 + + for index, actor in _ipairs (container._ActorTable) do + if (actor.powertype == powertype) then + + local on_self = actor.targets [my_name] + if (on_self) then + local t = energy_tooltips_table [i] + if (not t) then + energy_tooltips_table [i] = {} + t = energy_tooltips_table [i] + end + t[1], t[2], t[3] = actor.nome, on_self, actor.classe + i = i + 1 + end + + end + end + + i = i - 1 + _table_sort (energy_tooltips_table, _detalhes.Sort2) + + local amt_fontes = i gump:JI_AtualizaContainerAlvos (amt_fontes) - local max_fontes = fontes[1][2] + local max_fontes = energy_tooltips_table[1][2] local barra - for index, tabela in _ipairs (fontes) do + for index, tabela in _ipairs (energy_tooltips_table) do + + if (tabela [2] < 1) then + break + end barra = info.barras2 [index] @@ -984,8 +1176,8 @@ function atributo_energy:MontaInfoRegenRecebido() barra.textura:SetValue (tabela[2]/max_fontes*100) end - barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda - barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2]/total_regenerado * 100) .. instancia.divisores.fecha) --seta o texto da direita + barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) + barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .. " (" .. _cstr("%.1f", tabela[2]/total_regenerado * 100) .. ")") if (barra.mouse_over) then --> atualizar o tooltip if (barra.isAlvo) then @@ -998,8 +1190,10 @@ function atributo_energy:MontaInfoRegenRecebido() end end - barra.minha_tabela = self --> grava o jogador na tabela - barra.nome_inimigo = tabela [1] --> salva o nome do inimigo na barra --> isso é necessário? + barra.minha_tabela = self + + --print ("nome_inimigo = ", tabela [1]) + barra.nome_inimigo = tabela [1] barra:Show() end @@ -1007,45 +1201,79 @@ function atributo_energy:MontaInfoRegenRecebido() end function atributo_energy:MontaDetalhesRegenRecebido (nome, barra) + for _, barra in _ipairs (info.barras3) do barra:Hide() end + reset_tooltips_table() + local barras = info.barras3 local instancia = info.instancia local tabela_do_combate = info.instancia.showing - local showing = tabela_do_combate [class_type] + local container = tabela_do_combate [class_type] - local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo) - local recebido_from = self [keyName_from] - local total_regenerado = self [keyName] + local total_regenerado = self.received - local _, _, from = self:Fontes_e_Habilidades (recebido_from, showing, keyName, nome) + local spellid = nome + local who_name = self.nome - if (not from [1] or not from [1][2]) then + --> who is regenerating with the spell -> nome + + --> spells: + local i = 1 + + for index, actor in _ipairs (container._ActorTable) do + if (actor.powertype == powertype) then + local spell = actor.spells._ActorTable [spellid] + if (spell) then + local on_self = spell.targets [who_name] + if (on_self) then + local t = energy_tooltips_table [i] + if (not t) then + energy_tooltips_table [i] = {} + t = energy_tooltips_table [i] + end + t[1], t[2], t[3] = actor.nome, on_self, actor.classe + i = i + 1 + end + end + end + end + + i = i - 1 + + if (i < 1) then return end - local max_ = from [1][2] + _table_sort (energy_tooltips_table, _detalhes.Sort2) + + local max_ = energy_tooltips_table [1][2] local barra for index, tabela in _ipairs (from) do + + if (tabela [2] < 1) then + break + end + barra = barras [index] if (not barra) then --> se a barra não existir, criar ela então barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --> isso aqui é a parte da seleção e desceleção + barra.textura:SetStatusBarColor (1, 1, 1, 1) end if (index == 1) then barra.textura:SetValue (100) else - barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido... + barra.textura:SetValue (tabela[2] / max_ * 100) end - barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda - barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2] /total_regenerado *100) .."%".. instancia.divisores.fecha) --seta o texto da direita + barra.texto_esquerdo:SetText (index .. "." .. tabela [1]) + barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." (" .. _cstr("%.1f", tabela[2] / total_regenerado * 100) .."%)") barra.textura:SetStatusBarColor (_unpack (_detalhes.class_colors [tabela[3]])) barra.icone:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") @@ -1061,27 +1289,55 @@ function atributo_energy:MontaDetalhesRegenRecebido (nome, barra) end function atributo_energy:MontaTooltipAlvos (esta_barra, index) + local instancia = info.instancia local tabela_do_combate = instancia.showing - local showing = tabela_do_combate [class_type] + local container = tabela_do_combate [class_type] - local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo) + local total_regenerado = self.received + local my_name = self.nome - local total_regenerado = self [keyName] - local recebido_from = self [keyName_from] + reset_tooltips_table() - local _, _, spells_alvo = self:Fontes_e_Habilidades (recebido_from, showing, keyName, true) - ------------------------------------------------------------------ - GameTooltip:AddLine (Loc ["STRING_SPELLS"]..":") - for _, tabela in _ipairs (spells_alvo) do - if (tabela[1] == esta_barra.nome_inimigo) then - local nome_magia, _, icone_magia = _GetSpellInfo (tabela[3]) - GameTooltip:AddDoubleLine (nome_magia..": ", _detalhes:comma_value (tabela[2]).." (".._cstr("%.1f", (tabela[2]/total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1) + -- actor nome + + local actor = container._ActorTable [container._NameIndexTable [esta_barra.nome_inimigo]] + + --print ("Mouse Over", actor, esta_barra.nome_inimigo, self.tipo) + + if (actor) then + --> spells: + local i = 1 + + for spellid, spell in _pairs (actor.spells._ActorTable) do + local on_self = spell.targets [my_name] + if (on_self) then + local t = energy_tooltips_table [i] + if (not t) then + energy_tooltips_table [i] = {} + t = energy_tooltips_table [i] + end + t[1], t[2], t[3] = spellid, on_self, "" + i = i + 1 + end + end + + i = i - 1 + _table_sort (energy_tooltips_table, _detalhes.Sort2) + + --print (i, #energy_tooltips_table) + + for index, spell in _ipairs (energy_tooltips_table) do + if (spell [2] < 1) then + break + end + + local spellname, _, spellicon = _GetSpellInfo (spell [1]) + GameTooltip:AddDoubleLine (spellname .. ": ", _detalhes:comma_value (spell [2]) .. " (" .. _cstr ("%.1f", (spell [2] / total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1) GameTooltip:AddTexture (icone_magia) end end - + return true end @@ -1104,29 +1360,23 @@ end --> subtract total from a combat table function atributo_energy:subtract_total (combat_table) - combat_table.totals [class_type].mana = combat_table.totals [class_type].mana - self.mana - combat_table.totals [class_type].e_rage = combat_table.totals [class_type].e_rage - self.e_rage - combat_table.totals [class_type].e_energy = combat_table.totals [class_type].e_energy - self.e_energy - combat_table.totals [class_type].runepower = combat_table.totals [class_type].runepower - self.runepower - - if (self.grupo) then - combat_table.totals_grupo [class_type].mana = combat_table.totals_grupo [class_type].mana - self.mana - combat_table.totals_grupo [class_type].e_rage = combat_table.totals_grupo [class_type].e_rage - self.e_rage - combat_table.totals_grupo [class_type].e_energy = combat_table.totals_grupo [class_type].e_energy - self.e_energy - combat_table.totals_grupo [class_type].runepower = combat_table.totals_grupo [class_type].runepower - self.runepower + --print ("reduce total:", combat_table.totals [class_type] [self.powertype], self.total, self.powertype, self.nome) + if (self.powertype and combat_table.totals [class_type] [self.powertype]) then + combat_table.totals [class_type] [self.powertype] = combat_table.totals [class_type] [self.powertype] - self.total + if (self.grupo) then + combat_table.totals_grupo [class_type] [self.powertype] = combat_table.totals_grupo [class_type] [self.powertype] - self.total + end end + end function atributo_energy:add_total (combat_table) - combat_table.totals [class_type].mana = combat_table.totals [class_type].mana + self.mana - combat_table.totals [class_type].e_rage = combat_table.totals [class_type].e_rage + self.e_rage - combat_table.totals [class_type].e_energy = combat_table.totals [class_type].e_energy + self.e_energy - combat_table.totals [class_type].runepower = combat_table.totals [class_type].runepower + self.runepower - - if (self.grupo) then - combat_table.totals_grupo [class_type].mana = combat_table.totals_grupo [class_type].mana + self.mana - combat_table.totals_grupo [class_type].e_rage = combat_table.totals_grupo [class_type].e_rage + self.e_rage - combat_table.totals_grupo [class_type].e_energy = combat_table.totals_grupo [class_type].e_energy + self.e_energy - combat_table.totals_grupo [class_type].runepower = combat_table.totals_grupo [class_type].runepower + self.runepower + --print ("add total:", combat_table.totals [class_type] [self.powertype], self.total) + if (self.powertype and combat_table.totals [class_type] [self.powertype]) then + combat_table.totals [class_type] [self.powertype] = combat_table.totals [class_type] [self.powertype] + self.total + + if (self.grupo) then + combat_table.totals_grupo [class_type] [self.powertype] = combat_table.totals_grupo [class_type] [self.powertype] + self.total + end end end @@ -1146,29 +1396,20 @@ end --> restaura a meta e indexes ao ator _detalhes.refresh:r_atributo_energy (actor, shadow) + shadow.powertype = actor.powertype - --> copia o container de alvos (captura de dados) - for index, alvo in _ipairs (actor.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow.targets) + --> targets + for target_name, amount in _pairs (actor.targets) do + shadow.targets [target_name] = 0 end - --> copia o container de habilidades (captura de dados) - for spellid, habilidade in _pairs (actor.spell_tables._ActorTable) do - --> cria e soma o valor - local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) - --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo da habilidade - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) + --> spells + for spellid, habilidade in _pairs (actor.spells._ActorTable) do + local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, "SPELL_ENERGY", false) + --> spell targets + for target_name, amount in _pairs (habilidade.targets) do + habilidade_shadow.targets [target_name] = 0 end - - --> refresh na meta e indexes - _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow.spell_tables) end return shadow @@ -1192,73 +1433,40 @@ end end --> total das energias (captura de dados) - shadow.mana = shadow.mana + actor.mana - shadow.e_rage = shadow.e_rage + actor.e_rage - shadow.e_energy = shadow.e_energy + actor.e_energy - shadow.runepower = shadow.runepower + actor.runepower - shadow.focus = shadow.focus + actor.focus - shadow.holypower = shadow.holypower + actor.holypower + shadow.total = shadow.total + actor.total + shadow.received = shadow.received + actor.received - shadow.mana_r = shadow.mana_r + actor.mana_r - shadow.e_rage_r = shadow.e_rage_r + actor.e_rage_r - shadow.e_energy_r = shadow.e_energy_r + actor.e_energy_r - shadow.runepower_r = shadow.runepower_r + actor.runepower_r - shadow.focus_r = shadow.focus_r + actor.focus_r - shadow.holypower_r = shadow.holypower_r + actor.holypower_r + if (not actor.powertype) then + print ("actor without powertype", actor.nome, actor.powertype) + end + shadow.powertype = actor.powertype + --> total no combate overall (captura de dados) - _detalhes.tabela_overall.totals[3].mana = _detalhes.tabela_overall.totals[3].mana + actor.mana - _detalhes.tabela_overall.totals[3].e_rage = _detalhes.tabela_overall.totals[3].e_rage + actor.e_rage - _detalhes.tabela_overall.totals[3].e_energy = _detalhes.tabela_overall.totals[3].e_energy + actor.e_energy - _detalhes.tabela_overall.totals[3].runepower = _detalhes.tabela_overall.totals[3].runepower + actor.runepower + _detalhes.tabela_overall.totals[3] [actor.powertype] = _detalhes.tabela_overall.totals[3] [actor.powertype] + actor.total if (actor.grupo) then - _detalhes.tabela_overall.totals_grupo[3]["mana"] = _detalhes.tabela_overall.totals_grupo[3]["mana"] + actor.mana - _detalhes.tabela_overall.totals_grupo[3]["e_rage"] = _detalhes.tabela_overall.totals_grupo[3]["e_rage"] + actor.e_rage - _detalhes.tabela_overall.totals_grupo[3]["e_energy"] = _detalhes.tabela_overall.totals_grupo[3]["e_energy"] + actor.e_energy - _detalhes.tabela_overall.totals_grupo[3]["runepower"] = _detalhes.tabela_overall.totals_grupo[3]["runepower"] + actor.runepower + _detalhes.tabela_overall.totals_grupo[3][actor.powertype] = _detalhes.tabela_overall.totals_grupo[3][actor.powertype] + actor.total end - --> copia o container de alvos (captura de dados) - for index, alvo in _ipairs (actor.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - --> refresh no alvo - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow.targets) - end + --> targets + for target_name, amount in _pairs (actor.targets) do + shadow.targets [target_name] = (shadow.targets [target_name] or 0) + amount end - --> copia o container de habilidades (captura de dados) - for spellid, habilidade in _pairs (actor.spell_tables._ActorTable) do - --> cria e soma o valor - local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) - --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - --> refresh no alvo da habilidade - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) - end - end - --> soma todos os demais valores - for key, value in _pairs (habilidade) do - if (_type (value) == "number") then - if (key ~= "id") then - if (not habilidade_shadow [key]) then - habilidade_shadow [key] = 0 - end - habilidade_shadow [key] = habilidade_shadow [key] + value - end - end - end - --> refresh na meta e indexes - if (not no_refresh) then - _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow.spell_tables) + --> spells + for spellid, habilidade in _pairs (actor.spells._ActorTable) do + + local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, "SPELL_ENERGY", false) + + habilidade_shadow.total = habilidade_shadow.total + habilidade.total + habilidade_shadow.counter = habilidade_shadow.counter + habilidade.counter + + --> spell targets + for target_name, amount in _pairs (habilidade.targets) do + habilidade_shadow.targets [target_name] = (habilidade_shadow.targets [target_name] or 0) + amount end + end return shadow @@ -1272,122 +1480,89 @@ function _detalhes.refresh:r_atributo_energy (este_jogador, shadow) _setmetatable (este_jogador, _detalhes.atributo_energy) este_jogador.__index = _detalhes.atributo_energy - if (shadow ~= -1) then - este_jogador.shadow = shadow - _detalhes.refresh:r_container_combatentes (este_jogador.targets, shadow.targets) - _detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, shadow.spell_tables) - else - _detalhes.refresh:r_container_combatentes (este_jogador.targets, -1) - _detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, -1) - end + este_jogador.shadow = shadow + + _detalhes.refresh:r_container_habilidades (este_jogador.spells, shadow.spells) + + if (not shadow.powertype) then + shadow.powertype = este_jogador.powertype + end end function _detalhes.clear:c_atributo_energy (este_jogador) - --este_jogador.__index = {} este_jogador.__index = nil este_jogador.shadow = nil este_jogador.links = nil este_jogador.minha_barra = nil - _detalhes.clear:c_container_combatentes (este_jogador.targets) - _detalhes.clear:c_container_habilidades (este_jogador.spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.spells) end atributo_energy.__add = function (tabela1, tabela2) - --> soma os totais das energias - tabela1.mana = tabela1.mana + tabela2.mana - tabela1.e_rage = tabela1.e_rage + tabela2.e_rage - tabela1.e_energy = tabela1.e_energy + tabela2.e_energy - tabela1.runepower = tabela1.runepower + tabela2.runepower - tabela1.focus = tabela1.focus + tabela2.focus - tabela1.holypower = tabela1.holypower + tabela2.holypower - - tabela1.mana_r = tabela1.mana_r + tabela2.mana_r - tabela1.e_rage_r = tabela1.e_rage_r + tabela2.e_rage_r - tabela1.e_energy_r = tabela1.e_energy_r + tabela2.e_energy_r - tabela1.runepower_r = tabela1.runepower_r + tabela2.runepower_r - tabela1.focus_r = tabela1.focus_r + tabela2.focus_r - tabela1.holypower_r = tabela1.holypower_r + tabela2.holypower_r + if (not tabela1.powertype) then + tabela1.powertype = tabela2.powertype + end - --> soma os containers de alvos - for index, alvo in _ipairs (tabela2.targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma o valor - alvo_tabela1.total = alvo_tabela1.total + alvo.total + --> total and received + tabela1.total = tabela1.total + tabela2.total + tabela1.received = tabela1.received + tabela2.received + + --> targets + for target_name, amount in _pairs (tabela2.targets) do + tabela1.targets [target_name] = (tabela1.targets [target_name] or 0) + amount end - --> soma o container de habilidades - for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do - --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spell_tables:PegaHabilidade (spellid, true, "SPELL_ENERGY", false) - --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + --> spells + for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do + + local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_ENERGY", false) + + habilidade_tabela1.total = habilidade_tabela1.total + habilidade.total + habilidade_tabela1.counter = habilidade_tabela1.counter + habilidade.counter + + --> spell targets + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end - --> soma os valores da habilidade - for key, value in _pairs (habilidade) do - if (_type (value) == "number") then - if (key ~= "id") then - if (not habilidade_tabela1 [key]) then - habilidade_tabela1 [key] = 0 - end - habilidade_tabela1 [key] = habilidade_tabela1 [key] + value - end - end - end - end + + end return tabela1 end atributo_energy.__sub = function (tabela1, tabela2) - --> soma os totais das energias - tabela1.mana = tabela1.mana - tabela2.mana - tabela1.e_rage = tabela1.e_rage - tabela2.e_rage - tabela1.e_energy = tabela1.e_energy - tabela2.e_energy - tabela1.runepower = tabela1.runepower - tabela2.runepower - tabela1.focus = tabela1.focus - tabela2.focus - tabela1.holypower = tabela1.holypower - tabela2.holypower - - tabela1.mana_r = tabela1.mana_r - tabela2.mana_r - tabela1.e_rage_r = tabela1.e_rage_r - tabela2.e_rage_r - tabela1.e_energy_r = tabela1.e_energy_r - tabela2.e_energy_r - tabela1.runepower_r = tabela1.runepower_r - tabela2.runepower_r - tabela1.focus_r = tabela1.focus_r - tabela2.focus_r - tabela1.holypower_r = tabela1.holypower_r - tabela2.holypower_r + if (not tabela1.powertype) then + tabela1.powertype = tabela2.powertype + end - --> soma os containers de alvos - for index, alvo in _ipairs (tabela2.targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma o valor - alvo_tabela1.total = alvo_tabela1.total - alvo.total + --> total and received + tabela1.total = tabela1.total - tabela2.total + tabela1.received = tabela1.received - tabela2.received + + --> targets + for target_name, amount in _pairs (tabela2.targets) do + if (tabela1.targets [target_name]) then + tabela1.targets [target_name] = tabela1.targets [target_name] - amount + end end - --> soma o container de habilidades - for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do - --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spell_tables:PegaHabilidade (spellid, true, "SPELL_ENERGY", false) - --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total - end - --> soma os valores da habilidade - for key, value in _pairs (habilidade) do - if (_type (value) == "number") then - if (key ~= "id") then - if (not habilidade_tabela1 [key]) then - habilidade_tabela1 [key] = 0 - end - habilidade_tabela1 [key] = habilidade_tabela1 [key] - value - end + --> spells + for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do + + local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_ENERGY", false) + + habilidade_tabela1.total = habilidade_tabela1.total - habilidade.total + habilidade_tabela1.counter = habilidade_tabela1.counter - habilidade.counter + + --> spell targets + for target_name, amount in _pairs (habilidade.targets) do + if (habilidade_tabela1.targets [target_name]) then + habilidade_tabela1.targets [target_name] = habilidade_tabela1.targets [target_name] - amount end end + end return tabela1 diff --git a/classes/classe_energy_habilidade.lua b/classes/classe_energy_habilidade.lua index ce577258..d6df7cce 100644 --- a/classes/classe_energy_habilidade.lua +++ b/classes/classe_energy_habilidade.lua @@ -25,88 +25,19 @@ function habilidade_energy:NovaTabela (id, link, token) local _newEnergySpell = { - id = id, counter = 0, - - mana = 0, - e_rage = 0, - e_energy = 0, - runepower = 0, - - targets = container_combatentes:NovoContainer (container_energy_target) + total = 0, + targets = {} } - _setmetatable (_newEnergySpell, habilidade_energy) - - if (link) then - _newEnergySpell.targets.shadow = link.targets - end - return _newEnergySpell end function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype) self.counter = self.counter + 1 - - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end - - if (powertype == 0) then --> MANA - self.mana = self.mana + amount - alvo.mana = alvo.mana + amount - - elseif (powertype == 1) then --> e_rage - self.e_rage = self.e_rage + amount - alvo.e_rage = alvo.e_rage + amount - - elseif (powertype == 3) then --> ENERGIA - self.e_energy = self.e_energy + amount - alvo.e_energy = alvo.e_energy + amount - - elseif (powertype == 6) then --> RUNEPOWER - self.runepower = self.runepower + amount - alvo.runepower = alvo.runepower + amount - end + self.total = self.total + amount + self.targets [nome] = (self.targets [nome] or 0) + amount end - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> core - - function _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow) --recebeu o container shadow - _setmetatable (habilidade, habilidade_energy) - habilidade.__index = habilidade_energy - - if (shadow ~= -1) then - habilidade.shadow = shadow._ActorTable[habilidade.id] - _detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets) - else - _detalhes.refresh:r_container_combatentes (habilidade.targets, -1) - end - end - - function _detalhes.clear:c_habilidade_e_energy (habilidade) - --habilidade.__index = {} - habilidade.__index = {} - habilidade.shadow = nil - - _detalhes.clear:c_container_combatentes (habilidade.targets) - end - - habilidade_energy.__sub = function (tabela1, tabela2) - - tabela1.mana = tabela1.mana - tabela2.mana - tabela1.e_rage = tabela1.e_rage - tabela2.e_rage - tabela1.e_energy = tabela1.e_energy - tabela2.e_energy - tabela1.runepower = tabela1.runepower - tabela2.runepower - - tabela1.counter = tabela1.counter - tabela2.counter - - return tabela1 - end diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 31ae2d2c..9a98d2dc 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -105,21 +105,22 @@ function atributo_heal:NovaTabela (serial, nome, link) heal_enemy_amt = 0, --container armazenará os IDs das habilidades usadas por este jogador - spell_tables = container_habilidades:NovoContainer (container_heal), - + spells = container_habilidades:NovoContainer (container_heal), --container armazenará os seriais dos alvos que o player aplicou dano - targets = container_combatentes:NovoContainer (container_heal_target) + targets = {}, + targets_overheal = {}, + targets_absorbs = {} } _setmetatable (_new_healActor, atributo_heal) - if (link) then --> se não for a shadow + --if (link) then --> se não for a shadow --_new_healActor.last_events_table = _detalhes:CreateActorLastEventTable() --_new_healActor.last_events_table.original = true - _new_healActor.targets.shadow = link.targets - _new_healActor.spell_tables.shadow = link.spell_tables - end + --_new_healActor.targets.shadow = link.targets + --_new_healActor.spells.shadow = link.spells + --end return _new_healActor end @@ -546,22 +547,6 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo end -function atributo_heal:Custom (_customName, _combat, sub_atributo, spell, alvo) - local _Skill = self.spell_tables._ActorTable [tonumber (spell)] - if (_Skill) then - local spellName = _GetSpellInfo (tonumber (spell)) - local SkillTargets = _Skill.targets._ActorTable - - for _, TargetActor in _ipairs (SkillTargets) do - local TargetActorSelf = _combat (class_type, TargetActor.nome) - if (TargetActorSelf) then - TargetActorSelf.custom = TargetActor.total + TargetActorSelf.custom - _combat.totals [_customName] = _combat.totals [_customName] + TargetActor.total - end - end - end -end - local actor_class_color_r, actor_class_color_g, actor_class_color_b --function atributo_heal:AtualizaBarra (instancia, qual_barra, lugar, total, sub_atributo, forcar) @@ -987,9 +972,9 @@ function atributo_heal:ToolTip_HealingTaken (instancia, numero, barra, keydown) local este_curador = showing._ActorTable[showing._NameIndexTable[nome]] if (este_curador) then --> checagem por causa do total e do garbage collector que não limpa os nomes que deram dano local alvos = este_curador.targets - local este_alvo = alvos._ActorTable[alvos._NameIndexTable[self.nome]] - if (este_alvo and este_alvo.total > 0) then - meus_curadores [#meus_curadores+1] = {nome, este_alvo.total, este_curador.classe} + local este_alvo = alvos [self.nome] + if (este_alvo and este_alvo > 0) then + meus_curadores [#meus_curadores+1] = {nome, este_alvo, este_curador.classe} end end end @@ -1051,7 +1036,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) local ActorHealingTable = {} local ActorHealingTargets = {} - local ActorSkillsContainer = self.spell_tables._ActorTable + local ActorSkillsContainer = self.spells._ActorTable local actor_key, skill_key = "total", "total" if (instancia.sub_atributo == 3) then @@ -1078,10 +1063,10 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) _table_sort (ActorHealingTable, _detalhes.Sort2) --> TOP Curados - ActorSkillsContainer = self.targets._ActorTable - for _, TargetTable in _ipairs (ActorSkillsContainer) do - if (TargetTable.total > 0) then - _table_insert (ActorHealingTargets, {TargetTable.nome, TargetTable.total, TargetTable.total/ActorTotal*100}) + ActorSkillsContainer = self.targets + for target_name, amount in _pairs (ActorSkillsContainer) do + if (amount > 0) then + _table_insert (ActorHealingTargets, {target_name, amount, amount / ActorTotal * 100}) end end _table_sort (ActorHealingTargets, _detalhes.Sort2) @@ -1203,7 +1188,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) if (my_self) then local meu_total = my_self.total_without_pet - local tabela = my_self.spell_tables._ActorTable + local tabela = my_self.spells._ActorTable local meus_danos = {} local meu_tempo @@ -1222,9 +1207,9 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) danos [nome] = meus_danos local meus_inimigos = {} - tabela = my_self.targets._ActorTable - for _, tabela in _ipairs (tabela) do - _table_insert (meus_inimigos, {tabela.nome, tabela.total, tabela.total/meu_total*100}) + tabela = my_self.targets + for target_name, amount in _pairs (tabela) do + _table_insert (meus_inimigos, {target_name, amount, amount / meu_total * 100}) end _table_sort (meus_inimigos,_detalhes.Sort2) alvos [nome] = meus_inimigos @@ -1349,9 +1334,9 @@ function atributo_heal:MontaInfoHealTaken() este_curandeiro = showing._ActorTable[showing._NameIndexTable[nome]] if (este_curandeiro) then local alvos = este_curandeiro.targets - local este_alvo = alvos._ActorTable[alvos._NameIndexTable[self.nome]] + local este_alvo = alvos [self.nome] if (este_alvo) then - meus_curandeiros [#meus_curandeiros+1] = {nome, este_alvo.total, este_alvo.total/healing_taken*100, este_curandeiro.classe} + meus_curandeiros [#meus_curandeiros+1] = {nome, este_alvo, este_alvo/healing_taken*100, este_curandeiro.classe} end end end @@ -1362,7 +1347,7 @@ function atributo_heal:MontaInfoHealTaken() return true end - _table_sort (meus_curandeiros, function (a, b) return a[2] > b[2] end) + _table_sort (meus_curandeiros, _detalhes.Sort2) gump:JI_AtualizaContainerBarras (amt) @@ -1387,62 +1372,6 @@ function atributo_heal:MontaInfoHealTaken() self:UpdadeInfoBar (barra, index, tabela[1], tabela[1], tabela[2], _detalhes:comma_value (tabela[2]), max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small", true, texCoords) end - --[[ - for index, tabela in _ipairs (meus_curandeiros) do - - local barra = barras [index] - - if (not barra) then - barra = gump:CriaNovaBarraInfo1 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) - - barra.on_focus = false - end - - if (not info.mostrando_mouse_over) then - if (tabela[1] == self.detalhes) then --> tabela [1] = NOME = NOME que esta na caixa da direita - if (not barra.on_focus) then --> se a barra não tiver no foco - barra.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) - barra.on_focus = true - if (not info.mostrando) then - info.mostrando = barra - end - end - else - if (barra.on_focus) then - barra.textura:SetStatusBarColor (1, 1, 1, 1) --> volta a cor antiga - barra:SetAlpha (.9) --> volta a alfa antiga - barra.on_focus = false - end - end - end - - if (index == 1) then - barra.textura:SetValue (100) - else - barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido... - end - - barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda - barra.texto_direita:SetText (tabela[2] .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita - - local classe = tabela[4] - if (not classe) then - classe = "monster" - end - - barra.icone:SetTexture ("Interface\\AddOns\\Details\\images\\"..classe:lower().."_small") - - barra.minha_tabela = self - barra.show = tabela[1] - barra:Show() - - if (self.detalhes and self.detalhes == barra.show) then - self:MontaDetalhes (self.detalhes, barra) - end - - end - --]] end function atributo_heal:MontaInfoOverHealing() @@ -1450,7 +1379,7 @@ function atributo_heal:MontaInfoOverHealing() local instancia = info.instancia local total = self.totalover - local tabela = self.spell_tables._ActorTable + local tabela = self.spells._ActorTable local minhas_curas = {} local barras = info.barras1 @@ -1459,7 +1388,7 @@ function atributo_heal:MontaInfoOverHealing() _table_insert (minhas_curas, {spellid, tabela.overheal, tabela.overheal/total*100, nome, icone}) end - _table_sort (minhas_curas, function(a, b) return a[2] > b[2] end) + _table_sort (minhas_curas, _detalhes.Sort2) local amt = #minhas_curas gump:JI_AtualizaContainerBarras (amt) @@ -1516,17 +1445,17 @@ function atributo_heal:MontaInfoOverHealing() --> TOP OVERHEALED local jogadores_overhealed = {} - tabela = self.targets._ActorTable + tabela = self.targets_overheal local heal_container = instancia.showing[2] - for _, tabela in _ipairs (tabela) do + for target_name, amount in _pairs (tabela) do local classe = "UNKNOW" local actor_object = heal_container._ActorTable [heal_container._NameIndexTable [tabela.nome]] if (actor_object) then classe = actor_object.classe end - _table_insert (jogadores_overhealed, {tabela.nome, tabela.overheal, tabela.overheal/total*100, classe}) + _table_insert (jogadores_overhealed, {target_name, amount, amount/total*100, classe}) end - _table_sort (jogadores_overhealed, function(a, b) return a[2] > b[2] end ) + _table_sort (jogadores_overhealed, _detalhes.Sort2) local amt_alvos = #jogadores_overhealed gump:JI_AtualizaContainerAlvos (amt_alvos) @@ -1563,14 +1492,8 @@ function atributo_heal:MontaInfoOverHealing() barra.minha_tabela = self barra.nome_inimigo = tabela [1] - - -- no lugar do spell id colocar o que? - --barra.spellid = tabela[5] + barra:Show() - - --if (self.detalhes and self.detalhes == barra.spellid) then - -- self:MontaDetalhes (self.detalhes, barra) - --end end end @@ -1580,7 +1503,7 @@ function atributo_heal:MontaInfoHealingDone() local instancia = info.instancia local total = self.total - local tabela = self.spell_tables._ActorTable + local tabela = self.spells._ActorTable local minhas_curas = {} local barras = info.barras1 @@ -1604,12 +1527,11 @@ function atributo_heal:MontaInfoHealingDone() for _, PetName in _ipairs (ActorPets) do local PetActor = instancia.showing (class_type, PetName) if (PetActor) then - local PetSkillsContainer = PetActor.spell_tables._ActorTable + local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in _pairs (PetSkillsContainer) do --> da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo (_spellid) _table_insert (minhas_curas, {_spellid, _skill.total, _skill.total/total*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor}) end - --_table_insert (ActorSkillsSortTable, {PetName, PetActor.total, PetActor.total/ActorTotalDamage*100, PetName:gsub ((" <.*"), ""), "Interface\\AddOns\\Details\\images\\classes_small"}) end end @@ -1652,11 +1574,11 @@ function atributo_heal:MontaInfoHealingDone() --> TOP CURADOS local meus_inimigos = {} - tabela = self.targets._ActorTable - for _, tabela in _ipairs (tabela) do - _table_insert (meus_inimigos, {tabela.nome, tabela.total, tabela.total/total*100}) + tabela = self.targets + for target_name, amount in _pairs (tabela) do + _table_insert (meus_inimigos, {target_name, amount, amount / total*100}) end - _table_sort (meus_inimigos, function(a, b) return a[2] > b[2] end ) + _table_sort (meus_inimigos, _detalhes.Sort2) local amt_alvos = #meus_inimigos gump:JI_AtualizaContainerAlvos (amt_alvos) @@ -1686,50 +1608,39 @@ function atributo_heal:MontaInfoHealingDone() barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .. _cstr ("%.1f", tabela[3]) .. instancia.divisores.fecha) --seta o texto da direita end - -- o que mostrar no local do ícone? - --barra.icone:SetTexture (tabela[4][3]) - barra.minha_tabela = self barra.nome_inimigo = tabela [1] -- no lugar do spell id colocar o que? barra.spellid = tabela[5] barra:Show() - - --if (self.detalhes and self.detalhes == barra.spellid) then - -- self:MontaDetalhes (self.detalhes, barra) - --end end end function atributo_heal:MontaTooltipAlvos (esta_barra, index, instancia) - -- eu ja sei quem é o alvo a mostrar os detalhes - -- dar foreach no container de habilidades -- pegar os alvos da habilidade -- e ver se dentro do container tem o meu alvo. - + local inimigo = esta_barra.nome_inimigo - local container = self.spell_tables._ActorTable + local container = self.spells._ActorTable local habilidades = {} local total local sub_atributo = info.instancia.sub_atributo + local targets_key = "" + if (sub_atributo == 3) then --> overheal total = self.totalover + targets_key = "_overheal" else total = self.total end --> add spells for spellid, tabela in _pairs (container) do - local alvos = tabela.targets._ActorTable - for _, tabela in _ipairs (alvos) do - if (tabela.nome == inimigo) then + for target_name, amount in _pairs (tabela ["targets" .. targets_key]) do + if (target_name == inimigo) then local nome, _, icone = _GetSpellInfo (spellid) - if (sub_atributo == 3) then --> overheal - habilidades [#habilidades+1] = {nome, tabela.overheal, icone} - else - habilidades [#habilidades+1] = {nome, tabela.total, icone} - end + habilidades [#habilidades+1] = {nome, amount, icone} end end end @@ -1739,24 +1650,21 @@ function atributo_heal:MontaTooltipAlvos (esta_barra, index, instancia) for _, PetName in _ipairs (ActorPets) do local PetActor = instancia.showing (class_type, PetName) if (PetActor) then - local PetSkillsContainer = PetActor.spell_tables._ActorTable + local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in _pairs (PetSkillsContainer) do - local alvos = _skill.targets._ActorTable - for _, tabela in _ipairs (alvos) do - if (tabela.nome == inimigo) then + + for target_name, amount in _pairs (_skill ["targets" .. targets_key]) do + if (target_name == inimigo) then local nome, _, icone = _GetSpellInfo (_spellid) - if (sub_atributo == 3) then --> overheal - habilidades [#habilidades+1] = {nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", tabela.overheal, icone} - else - habilidades [#habilidades+1] = {nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", tabela.total, icone} - end + habilidades [#habilidades+1] = {nome, amount, icone} end end + end end end - _table_sort (habilidades, function (a, b) return a[2] > b[2] end) + _table_sort (habilidades, _detalhes.Sort2) --get time type local meu_tempo @@ -1796,7 +1704,6 @@ function atributo_heal:MontaTooltipAlvos (esta_barra, index, instancia) end return true - --GameTooltip:AddDoubleLine (minhas_curas[i][4][1]..": ", minhas_curas[i][2].." (".._cstr ("%.1f", minhas_curas[i][3]).."%)", 1, 1, 1, 1, 1, 1) end @@ -1822,32 +1729,22 @@ function atributo_heal:MontaDetalhesHealingTaken (nome, barra) local showing = tabela_do_combate [class_type] --> o que esta sendo mostrado -> [1] - dano [2] - cura --> pega o container com ._NameIndexTable ._ActorTable local este_curandeiro = showing._ActorTable[showing._NameIndexTable[nome]] - local conteudo = este_curandeiro.spell_tables._ActorTable --> _pairs[] com os IDs das magias + local conteudo = este_curandeiro.spells._ActorTable --> _pairs[] com os IDs das magias local actor = info.jogador.nome - local total = este_curandeiro.targets._ActorTable [este_curandeiro.targets._NameIndexTable [actor]].total + local total = este_curandeiro.targets [actor] local minhas_magias = {} for spellid, tabela in _pairs (conteudo) do --> da foreach em cada spellid do container - - --> preciso pegar os alvos que esta magia atingiu - local alvos = tabela.targets - local index = alvos._NameIndexTable[actor] - - if (index) then --> esta magia deu dano no actor - local este_alvo = alvos._ActorTable[index] --> pega a classe_target - local spell_nome, rank, icone = _GetSpellInfo (spellid) - _table_insert (minhas_magias, {spellid, este_alvo.total, este_alvo.total/total*100, spell_nome, icone}) + if (tabela.targets [actor]) then + local spell_nome, _, icone = _GetSpellInfo (spellid) + _table_insert (minhas_magias, {spellid, tabela.targets [actor], tabela.targets [actor] / total*100, spell_nome, icone}) end - end - _table_sort (minhas_magias, function(a, b) return a[2] > b[2] end) - - --local amt = #minhas_magias - --gump:JI_AtualizaContainerBarras (amt) + _table_sort (minhas_magias, _detalhes.Sort2) local max_ = minhas_magias[1] and minhas_magias[1][2] or 0 --> dano que a primeiro magia vez @@ -1892,9 +1789,9 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) local esta_magia if (barra.other_actor) then - esta_magia = barra.other_actor.spell_tables._ActorTable [spellid] + esta_magia = barra.other_actor.spells._ActorTable [spellid] else - esta_magia = self.spell_tables._ActorTable [spellid] + esta_magia = self.spells._ActorTable [spellid] end if (not esta_magia) then @@ -2048,27 +1945,6 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) _table_sort (data, _detalhes.Sort1) - - --[[ - local absorbed = esta_magia.absorbed - if (absorbed > 0) then - - local porcentagem_absorbed = absorbed/esta_magia.total*100 - data[#data+1] = t3 - - absorbed_table.p = porcentagem_absorbed - - t3[1] = absorbed - t3[2] = absorbed_table - t3[3] = Loc ["STRING_HEAL_ABSORBED"] - t3[4] = "" - t3[5] = "" - t3[6] = "" - t3[7] = "" - t3[8] = absorbed .. " / " .. _cstr ("%.1f", porcentagem_absorbed).."%" - - end - --]] for i = #data+1, 3 do --> para o overheal aparecer na ultima barra data[i] = nil @@ -2109,10 +1985,6 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) end end - --for i = #data+2, 5 do - -- gump:HidaDetalheInfo (i) - --end - end --controla se o dps do jogador esta travado ou destravado @@ -2188,27 +2060,38 @@ end _detalhes.refresh:r_atributo_heal (actor, shadow) --> copia o container de alvos (captura de dados) - for index, alvo in _ipairs (actor.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow.targets) + for target_name, amount in _pairs (actor.targets) do + shadow.targets [target_name] = 0 + end + for target_name, amount in _pairs (actor.targets_overheal) do + shadow.targets_overheal [target_name] = 0 + end + for target_name, amount in _pairs (actor.targets_absorbs) do + shadow.targets_absorbs [target_name] = 0 end --> copia o container de habilidades (captura de dados) - for spellid, habilidade in _pairs (actor.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (actor.spells._ActorTable) do --> cria e soma o valor - local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) + local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, nil, true) --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo da habilidade - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) - end - --> refresh na habilidade - _detalhes.refresh:r_habilidade_cura (habilidade, shadow.spell_tables) + for target_name, amount in _pairs (habilidade.targets) do + if (not habilidade_shadow.targets [target_name]) then + habilidade_shadow.targets [target_name] = 0 + end + end + for target_name, amount in _pairs (habilidade.targets_overheal) do + if (not habilidade_shadow.targets_overheal [target_name]) then + habilidade_shadow.targets_overheal [target_name] = 0 + end + end + for target_name, amount in _pairs (habilidade.targets_absorbs) do + if (not habilidade_shadow.targets_absorbs [target_name]) then + habilidade_shadow.targets_absorbs [target_name] = 0 + end + end + end return shadow @@ -2274,34 +2157,32 @@ end end --> copia o container de alvos (captura de dados) - for index, alvo in _ipairs (actor.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - alvo_shadow.overheal = alvo_shadow.overheal + alvo.overheal - alvo_shadow.absorbed = alvo_shadow.absorbed + alvo.absorbed - --> refresh no alvo - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow.targets) - end + for target_name, amount in _pairs (actor.targets) do + shadow.targets [target_name] = (shadow.targets [target_name] or 0) + amount + end + for target_name, amount in _pairs (actor.targets_overheal) do + shadow.targets_overheal [target_name] = (shadow.targets_overheal [target_name] or 0) + amount + end + for target_name, amount in _pairs (actor.targets_absorbs) do + shadow.targets_absorbs [target_name] = (shadow.targets_absorbs [target_name] or 0) + amount end --> copia o container de habilidades (captura de dados) - for spellid, habilidade in _pairs (actor.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (actor.spells._ActorTable) do --> cria e soma o valor - local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true) + local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, nil, true) + --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - alvo_shadow.overheal = alvo_shadow.overheal + alvo.overheal - alvo_shadow.absorbed = alvo_shadow.absorbed + alvo.absorbed - --> refresh no alvo da habilidade - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) - end + for target_name, amount in _pairs (habilidade.targets) do + habilidade_shadow.targets [target_name] = (habilidade_shadow.targets [target_name] or 0) + amount end + for target_name, amount in _pairs (habilidade.targets_overheal) do + habilidade_shadow.targets_overheal [target_name] = (habilidade_shadow.targets_overheal [target_name] or 0) + amount + end + for target_name, amount in _pairs (habilidade.targets_absorbs) do + habilidade_shadow.targets_absorbs [target_name] = (habilidade_shadow.targets_absorbs [target_name] or 0) + amount + end + --> soma todos os demais valores for key, value in _pairs (habilidade) do if (_type (value) == "number") then @@ -2313,11 +2194,7 @@ end end end end - - --> refresh na habilidade - if (not no_refresh) then - _detalhes.refresh:r_habilidade_cura (habilidade, shadow.spell_tables) - end + end return shadow @@ -2327,31 +2204,6 @@ function atributo_heal:ColetarLixo (lastevent) return _detalhes:ColetarLixo (class_type, lastevent) end -function _detalhes.refresh:r_atributo_heal (este_jogador, shadow) - _setmetatable (este_jogador, atributo_heal) - este_jogador.__index = atributo_heal - - if (shadow ~= -1) then - este_jogador.shadow = shadow - _detalhes.refresh:r_container_combatentes (este_jogador.targets, shadow.targets) - _detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, shadow.spell_tables) - else - _detalhes.refresh:r_container_combatentes (este_jogador.targets, -1) - _detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, -1) - end -end - -function _detalhes.clear:c_atributo_heal (este_jogador) - --este_jogador.__index = {} - este_jogador.__index = nil - este_jogador.shadow = nil - este_jogador.links = nil - este_jogador.minha_barra = nil - - _detalhes.clear:c_container_combatentes (este_jogador.targets) - _detalhes.clear:c_container_habilidades (este_jogador.spell_tables) -end - atributo_heal.__add = function (tabela1, tabela2) --> tempo decorrido @@ -2387,25 +2239,29 @@ atributo_heal.__add = function (tabela1, tabela2) end --> somar o container de alvos - for index, alvo in _ipairs (tabela2.targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma os valores - alvo_tabela1.total = alvo_tabela1.total + alvo.total - alvo_tabela1.overheal = alvo_tabela1.overheal + alvo.overheal - alvo_tabela1.absorbed = alvo_tabela1.absorbed + alvo.absorbed + for target_name, amount in _pairs (tabela2.targets) do + tabela1.targets [target_name] = (tabela1.targets [target_name] or 0) + amount + end + for target_name, amount in _pairs (tabela2.targets_overheal) do + tabela1.targets_overheal [target_name] = (tabela1.targets_overheal [target_name] or 0) + amount + end + for target_name, amount in _pairs (tabela2.targets_absorbs) do + tabela1.targets_absorbs [target_name] = (tabela1.targets_absorbs [target_name] or 0) + amount end --> soma o container de habilidades - for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spell_tables:PegaHabilidade (spellid, true, "SPELL_HEAL", false) + local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_HEAL", false) --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total - alvo_tabela1.overheal = alvo_tabela1.overheal + alvo.overheal - alvo_tabela1.absorbed = alvo_tabela1.absorbed + alvo.absorbed + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets = (habilidade_tabela1.targets [target_name] or 0) + amount + end + for target_name, amount in _pairs (habilidade.targets_overheal) do + habilidade_tabela1.targets_overheal = (habilidade_tabela1.targets_overheal [target_name] or 0) + amount + end + for target_name, amount in _pairs (habilidade.targets_absorbs) do + habilidade_tabela1.targets_absorbs = (habilidade_tabela1.targets_absorbs [target_name] or 0) + amount end --> soma os valores da habilidade for key, value in _pairs (habilidade) do @@ -2453,26 +2309,43 @@ atributo_heal.__sub = function (tabela1, tabela2) end --> reduz o container de alvos - for index, alvo in _ipairs (tabela2.targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma os valores - alvo_tabela1.total = alvo_tabela1.total - alvo.total - alvo_tabela1.overheal = alvo_tabela1.overheal - alvo.overheal - alvo_tabela1.absorbed = alvo_tabela1.absorbed - alvo.absorbed + for target_name, amount in _pairs (tabela2.targets) do + if (tabela1.targets [target_name]) then + tabela1.targets [target_name] = tabela1.targets [target_name] - amount + end + end + for target_name, amount in _pairs (tabela2.targets_overheal) do + if (tabela1.targets_overheal [target_name]) then + tabela1.targets_overheal [target_name] = tabela1.targets_overheal [target_name] - amount + end + end + for target_name, amount in _pairs (tabela2.targets_absorbs) do + if (tabela1.targets_absorbs [target_name]) then + tabela1.targets_absorbs [target_name] = tabela1.targets_absorbs [target_name] - amount + end end --> reduz o container de habilidades - for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do + for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spell_tables:PegaHabilidade (spellid, true, "SPELL_HEAL", false) - --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total - alvo_tabela1.overheal = alvo_tabela1.overheal - alvo.overheal - alvo_tabela1.absorbed = alvo_tabela1.absorbed - alvo.absorbed + local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_HEAL", false) + --> alvos + for target_name, amount in _pairs (habilidade.targets) do + if (habilidade_tabela1.targets [target_name]) then + habilidade_tabela1.targets [target_name] = habilidade_tabela1.targets [target_name] - amount + end end + for target_name, amount in _pairs (habilidade.targets_overheal) do + if (habilidade_tabela1.targets_overheal [target_name]) then + habilidade_tabela1.targets_overheal [target_name] = habilidade_tabela1.targets_overheal [target_name] - amount + end + end + for target_name, amount in _pairs (habilidade.targets_absorbs) do + if (habilidade_tabela1.targets_absorbs [target_name]) then + habilidade_tabela1.targets_absorbs [target_name] = habilidade_tabela1.targets_absorbs [target_name] - amount + end + end + --> soma os valores da habilidade for key, value in _pairs (habilidade) do if (_type (value) == "number") then @@ -2488,3 +2361,20 @@ atributo_heal.__sub = function (tabela1, tabela2) return tabela1 end + +function _detalhes.refresh:r_atributo_heal (este_jogador, shadow) + _setmetatable (este_jogador, atributo_heal) + este_jogador.__index = atributo_heal + + este_jogador.shadow = shadow + _detalhes.refresh:r_container_habilidades (este_jogador.spells, shadow.spells) +end + +function _detalhes.clear:c_atributo_heal (este_jogador) + este_jogador.__index = nil + este_jogador.shadow = nil + este_jogador.links = nil + este_jogador.minha_barra = nil + + _detalhes.clear:c_container_habilidades (este_jogador.spells) +end diff --git a/classes/classe_heal_habilidade.lua b/classes/classe_heal_habilidade.lua index cfad7f0f..13ff05a1 100644 --- a/classes/classe_heal_habilidade.lua +++ b/classes/classe_heal_habilidade.lua @@ -2,11 +2,6 @@ local _detalhes = _G._detalhes local _ - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> local pointers - - local _setmetatable = setmetatable --lua local ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> constants @@ -23,11 +18,15 @@ function habilidade_cura:NovaTabela (id, link) local _newHealSpell = { - + + id = id, + counter = 0, + + --> totals total = 0, totalabsorb = 0, - counter = 0, - id = id, + absorbed = 0, + overheal = 0, --> multistrike m_amt = 0, @@ -46,18 +45,12 @@ c_amt = 0, c_curado = 0, - absorbed = 0, - overheal = 0, - - targets = container_combatentes:NovoContainer (container_heal_target) + --> targets containers + targets = {}, + targets_overheal = {}, + targets_absorbs = {} } - _setmetatable (_newHealSpell, habilidade_cura) - - if (link) then - _newHealSpell.targets.shadow = link.targets - end - return _newHealSpell end @@ -65,12 +58,7 @@ self.counter = self.counter + 1 - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end + self.targets [nome] = (self.targets [nome] or 0) + amount if (multistrike) then self.m_amt = self.m_amt + 1 @@ -80,21 +68,20 @@ if (absorbed and absorbed > 0) then self.absorbed = self.absorbed + absorbed - alvo.absorbed = alvo.absorbed + absorbed end if (overhealing and overhealing > 0) then self.overheal = self.overheal + overhealing - alvo.overheal = alvo.overheal + overhealing + self.targets_overheal [nome] = (self.targets_overheal [nome] or 0) + amount end if (amount and amount > 0) then self.total = self.total + amount - alvo.total = alvo.total + amount if (is_shield) then self.totalabsorb = self.totalabsorb + amount + self.targets_absorbs [nome] = (self.targets_absorbs [nome] or 0) + amount end if (critical) then @@ -120,46 +107,3 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> core - - function _detalhes.refresh:r_habilidade_cura (habilidade, shadow) - _setmetatable (habilidade, habilidade_cura) - habilidade.__index = habilidade_cura - - if (shadow ~= -1) then - habilidade.shadow = shadow._ActorTable[habilidade.id] - _detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets) - else - _detalhes.refresh:r_container_combatentes (habilidade.targets, -1) - end - end - - function _detalhes.clear:c_habilidade_cura (habilidade) - --habilidade.__index = {} - habilidade.__index = nil - habilidade.shadow = nil - - _detalhes.clear:c_container_combatentes (habilidade.targets) - end - - habilidade_cura.__sub = function (tabela1, tabela2) - tabela1.total = tabela1.total - tabela2.total - tabela1.totalabsorb = tabela1.totalabsorb - tabela2.totalabsorb - tabela1.counter = tabela1.counter - tabela2.counter - - tabela1.n_min = tabela1.n_min - tabela2.n_min - tabela1.n_max = tabela1.n_max - tabela2.n_max - tabela1.n_amt = tabela1.n_amt - tabela2.n_amt - tabela1.n_curado = tabela1.n_curado - tabela2.n_curado - - tabela1.c_min = tabela1.c_min - tabela2.c_min - tabela1.c_max = tabela1.c_max - tabela2.c_max - tabela1.c_amt = tabela1.c_amt - tabela2.c_amt - tabela1.c_curado = tabela1.c_curado - tabela2.c_curado - - tabela1.absorbed = tabela1.absorbed - tabela2.absorbed - tabela1.overheal = tabela1.overheal - tabela2.overheal - - return tabela1 - end diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 61f90c2d..79e5f36d 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -198,6 +198,10 @@ function _detalhes:IsNormalMode() end end +function _detalhes:GetShowingCombat() + return self.showing +end + function _detalhes:GetCustomObject() return _detalhes.custom [self.sub_atributo] end diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 88b71e4e..e76e2123 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -157,6 +157,14 @@ function atributo_misc:NovaTabela (serial, nome, link) return _new_miscActor end +function atributo_misc:CreateBuffTargetObject() + return { + uptime = 0, + actived = false, + activedamt = 0, + } +end + function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown) local eventos = morte [1] @@ -552,7 +560,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo --estra mostrando ALL então posso seguir o padrão correto? primeiro, atualiza a scroll bar... instancia:AtualizarScrollBar (total) - --depois faz a atualização normal dele através dos iterators + --depois faz a atualização normal dele através dos_ iterators local qual_barra = 1 local barras_container = instancia.barras local percentage_type = instancia.row_info.percent_type @@ -656,7 +664,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo --estra mostrando ALL então posso seguir o padrão correto? primeiro, atualiza a scroll bar... instancia:AtualizarScrollBar (amount) - --depois faz a atualização normal dele através dos iterators + --depois faz a atualização normal dele através dos_ iterators local qual_barra = 1 local barras_container = instancia.barras local percentage_type = instancia.row_info.percent_type @@ -688,7 +696,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end if (instancia.atributo == 5) then --> custom - --> zerar o .custom dos Actors + --> zerar o .custom dos_ Actors for index, player in _ipairs (conteudo) do if (player.custom > 0) then player.custom = 0 @@ -711,28 +719,10 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end ---self = esta classe de dano - -function atributo_misc:Custom (_customName, _combat, sub_atributo, spell, alvo) - local _Skill = self.spell_tables._ActorTable [tonumber (spell)] - if (_Skill) then - local spellName = _GetSpellInfo (tonumber (spell)) - local SkillTargets = _Skill.targets._ActorTable - - for _, TargetActor in _ipairs (SkillTargets) do - local TargetActorSelf = _combat (class_type, TargetActor.nome) - TargetActorSelf.custom = TargetActor.total + TargetActorSelf.custom - _combat.totals [_customName] = _combat.totals [_customName] + TargetActor.total - end - end -end - local actor_class_color_r, actor_class_color_g, actor_class_color_b function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, is_dead, percentage_type, use_animations) - --print (self.ress) - local esta_barra = instancia.barras[qual_barra] --> pega a referência da barra na janela if (not esta_barra) then @@ -1006,7 +996,7 @@ function atributo_misc:ToolTipCC (instancia, numero, barra) end local meu_total = self ["cc_break"] - local habilidades = self.cc_break_spell_tables._ActorTable + local habilidades = self.cc_break_spells._ActorTable --> habilidade usada para tirar o CC @@ -1061,7 +1051,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) end local meu_total = self ["dispell"] - local habilidades = self.dispell_spell_tables._ActorTable + local habilidades = self.dispell_spells._ActorTable --> habilidade usada para dispelar local meus_dispells = {} @@ -1110,8 +1100,8 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) end local alvos_dispelados = {} - for _, TargetTable in _ipairs (self.dispell_targets._ActorTable) do - alvos_dispelados [#alvos_dispelados + 1] = {TargetTable.nome, TargetTable.total, TargetTable.total/meu_total*100} + for target_name, amount in _ipairs (self.dispell_targets) do + alvos_dispelados [#alvos_dispelados + 1] = {target_name, amount, amount / meu_total * 100} end _table_sort (alvos_dispelados, _detalhes.Sort2) @@ -1206,7 +1196,7 @@ function _detalhes:CloseEnemyDebuffsUptime() for _, actor in _ipairs (misc_container) do if (actor.boss_debuff) then - for index, target in _ipairs (actor.debuff_uptime_targets._ActorTable) do + for target_name, target in _ipairs (actor.debuff_uptime_targets) do if (target.actived and target.actived_at) then target.uptime = target.uptime + _detalhes._tempo - target.actived_at actor.debuff_uptime = actor.debuff_uptime + _detalhes._tempo - target.actived_at @@ -1228,7 +1218,7 @@ function _detalhes:CatchRaidDebuffUptime (in_or_out) -- "DEBUFF_UPTIME_IN" for _, actor in _ipairs (misc_container) do if (actor.debuff_uptime) then - for spellid, spell in _pairs (actor.debuff_uptime_spell_tables._ActorTable) do + for spellid, spell in _pairs (actor.debuff_uptime_spells._ActorTable) do if (spell.actived and spell.actived_at) then spell.uptime = spell.uptime + _detalhes._tempo - spell.actived_at actor.debuff_uptime = actor.debuff_uptime + _detalhes._tempo - spell.actived_at @@ -1479,7 +1469,7 @@ function atributo_misc:ToolTipDebuffUptime (instancia, numero, barra) end local meu_total = self ["debuff_uptime"] - local minha_tabela = self.debuff_uptime_spell_tables._ActorTable + local minha_tabela = self.debuff_uptime_spells._ActorTable --> habilidade usada para interromper local debuffs_usados = {} @@ -1536,7 +1526,7 @@ function atributo_misc:ToolTipBuffUptime (instancia, numero, barra) end local meu_total = self ["buff_uptime"] - local minha_tabela = self.buff_uptime_spell_tables._ActorTable + local minha_tabela = self.buff_uptime_spells._ActorTable --> habilidade usada para interromper local buffs_usados = {} @@ -1593,7 +1583,7 @@ function atributo_misc:ToolTipDefensiveCooldowns (instancia, numero, barra) end local meu_total = self ["cooldowns_defensive"] - local minha_tabela = self.cooldowns_defensive_spell_tables._ActorTable + local minha_tabela = self.cooldowns_defensive_spells._ActorTable --> habilidade usada para interromper local cooldowns_usados = {} @@ -1620,11 +1610,11 @@ function atributo_misc:ToolTipDefensiveCooldowns (instancia, numero, barra) end --> quem foi que o cara reviveu - local meus_alvos = self.cooldowns_defensive_targets._ActorTable + local meus_alvos = self.cooldowns_defensive_targets local alvos = {} - for _, _tabela in _ipairs (meus_alvos) do - alvos [#alvos+1] = {_tabela.nome, _tabela.total} + for target_name, amount in _pairs (meus_alvos) do + alvos [#alvos+1] = {target_name, amount} end _table_sort (alvos, _detalhes.Sort2) @@ -1669,7 +1659,7 @@ function atributo_misc:ToolTipRess (instancia, numero, barra) end local meu_total = self ["ress"] - local minha_tabela = self.ress_spell_tables._ActorTable + local minha_tabela = self.ress_spells._ActorTable --> habilidade usada para interromper local meus_ress = {} @@ -1696,11 +1686,11 @@ function atributo_misc:ToolTipRess (instancia, numero, barra) end --> quem foi que o cara reviveu - local meus_alvos = self.ress_targets._ActorTable + local meus_alvos = self.ress_targets local alvos = {} - for _, _tabela in _ipairs (meus_alvos) do - alvos [#alvos+1] = {_tabela.nome, _tabela.total} + for target_name, amount in _pairs (meus_alvos) do + alvos [#alvos+1] = {target_name, amount} end _table_sort (alvos, _detalhes.Sort2) @@ -1745,7 +1735,7 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) end local meu_total = self ["interrupt"] - local minha_tabela = self.interrupt_spell_tables._ActorTable + local minha_tabela = self.interrupt_spells._ActorTable --> habilidade usada para interromper local meus_interrupts = {} @@ -1871,7 +1861,7 @@ end function atributo_misc:MontaInfoInterrupt() local meu_total = self ["interrupt"] - local minha_tabela = self.interrupt_spell_tables._ActorTable + local minha_tabela = self.interrupt_spells._ActorTable local barras = info.barras1 local instancia = info.instancia @@ -1889,7 +1879,7 @@ function atributo_misc:MontaInfoInterrupt() for _, PetName in _ipairs (ActorPets) do local PetActor = instancia.showing (class_type, PetName) if (PetActor and PetActor.interrupt and PetActor.interrupt > 0) then - local PetSkillsContainer = PetActor.interrupt_spell_tables._ActorTable + local PetSkillsContainer = PetActor.interrupt_spells._ActorTable for _spellid, _skill in _pairs (PetSkillsContainer) do --> da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo (_spellid) _table_insert (meus_interrupts, {_spellid, _skill.counter, _skill.counter/meu_total*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor}) @@ -1951,19 +1941,15 @@ function atributo_misc:MontaInfoInterrupt() barra.show = tabela[1] --> grava o spellid na barra barra:Show() --> mostra a barra - -- jogador . detalhes ?? if (self.detalhes and self.detalhes == barra.show) then self:MontaDetalhes (self.detalhes, barra) --> poderia deixar isso pro final e montar uma tail call?? end end - - - - --[ + --> Alvos do interrupt local meus_alvos = {} - for _, tabela in _pairs (self.interrupt_targets._ActorTable) do - meus_alvos [#meus_alvos+1] = {tabela.nome, tabela.total} + for target_name, amount in _pairs (self.interrupt_targets) do + meus_alvos [#meus_alvos+1] = {target_name, amount} end _table_sort (meus_alvos, _detalhes.Sort2) @@ -2005,22 +1991,11 @@ function atributo_misc:MontaInfoInterrupt() end end - --gump:TextoBarraOnInfo2 (index, , ) - -- o que mostrar no local do ícone? - --barra.icone:SetTexture (tabela[4][3]) - barra.minha_tabela = self --> grava o jogador na tabela barra.nome_inimigo = tabela [1] --> salva o nome do inimigo na barra --> isso é necessário? - - -- no lugar do spell id colocar o que? - --barra.spellid = tabela[5] + barra:Show() - - --if (self.detalhes and self.detalhes == barra.spellid) then - -- self:MontaDetalhes (self.detalhes, barra) - --end end - --]] end @@ -2032,7 +2007,7 @@ function atributo_misc:MontaDetalhesInterrupt (spellid, barra) barra:Hide() end - local esta_magia = self.interrupt_spell_tables._ActorTable [spellid] + local esta_magia = self.interrupt_spells._ActorTable [spellid] if (not esta_magia) then return end @@ -2098,7 +2073,7 @@ function atributo_misc:MontaTooltipAlvos (esta_barra, index) local container if (info.instancia.sub_atributo == 3) then --interrupt - container = self.interrupt_spell_tables._ActorTable + container = self.interrupt_spells._ActorTable end local habilidades = {} @@ -2106,16 +2081,16 @@ function atributo_misc:MontaTooltipAlvos (esta_barra, index) for spellid, tabela in _pairs (container) do --> tabela = classe_damage_habilidade - local alvos = tabela.targets._ActorTable - for _, tabela in _ipairs (alvos) do + local alvos = tabela.targets + for target_name, amount in _ipairs (alvos) do --> tabela = classe_target - if (tabela.nome == inimigo) then - habilidades [#habilidades+1] = {spellid, tabela.total} + if (target_name == inimigo) then + habilidades [#habilidades+1] = {spellid, amount} end end end - table.sort (habilidades, function (a, b) return a[2] > b[2] end) + table.sort (habilidades, _detalhes.Sort2) GameTooltip:AddLine (index..". "..inimigo) GameTooltip:AddLine (Loc ["STRING_SPELL_INTERRUPTED"] .. ":") @@ -2125,28 +2100,20 @@ function atributo_misc:MontaTooltipAlvos (esta_barra, index) local nome, rank, icone = _GetSpellInfo (tabela[1]) if (index < 8) then GameTooltip:AddDoubleLine (index..". |T"..icone..":0|t "..nome, tabela[2].." (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) - --GameTooltip:AddTexture (icone) else GameTooltip:AddDoubleLine (index..". "..nome, tabela[2].." (".._cstr("%.1f", tabela[2]/total*100).."%)", .65, .65, .65, .65, .65, .65) end end return true - --GameTooltip:AddDoubleLine (meus_danos[i][4][1]..": ", meus_danos[i][2].." (".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1) end - ---if (esta_magia.counter == esta_magia.c_amt) then --> só teve critico --- gump:SetaDetalheInfoTexto (1, nil, nil, nil, nil, nil, "DPS: "..crit_dps) ---end - --controla se o dps do jogador esta travado ou destravado function atributo_misc:Iniciar (iniciar) return false --retorna se o dps esta aberto ou fechado para este jogador end - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> core functions @@ -2182,623 +2149,458 @@ end end end end - - --> restaura e liga o ator com a sua shadow durante a inicialização + +local refresh_alvos = function (container1, container2) + for target_name, amount in _pairs (container2) do + container1 [target_name] = container1 [target_name] or 0 + end +end +local refresh_habilidades = function (container1, container2) + for spellid, habilidade in _pairs (container2._ActorTable) do + local habilidade_shadow = container1:PegaHabilidade (spellid, true, nil, true) + refresh_alvos (habilidade_shadow.targets , habilidade.targets) + end +end + +function atributo_misc:r_onlyrefresh_shadow (actor) + + local overall_misc = _detalhes.tabela_overall [4] + local shadow = overall_misc._ActorTable [overall_misc._NameIndexTable [actor.nome]] + + if (not actor.nome) then + actor.nome = "unknown" + end - function atributo_misc:r_onlyrefresh_shadow (actor) + if (not shadow) then + shadow = overall_misc:PegarCombatente (actor.serial, actor.nome, actor.flag_original, true) + shadow.classe = actor.classe + shadow.grupo = actor.grupo + end + + _detalhes.refresh:r_atributo_misc (actor, shadow) + + --> cooldowns + if (actor.cooldowns_defensive) then + refresh_alvos (shadow.cooldowns_defensive_targets, actor.cooldowns_defensive_targets) + refresh_habilidades (shadow.cooldowns_defensive_spells, actor.cooldowns_defensive_spells) + end - --> criar uma shadow desse ator se ainda não tiver uma - local overall_misc = _detalhes.tabela_overall [4] - local shadow = overall_misc._ActorTable [overall_misc._NameIndexTable [actor.nome]] + --> buff uptime + if (actor.buff_uptime) then + refresh_alvos (shadow.buff_uptime_targets, actor.buff_uptime_targets) + refresh_habilidades (shadow.buff_uptime_spells, actor.buff_uptime_spells) + end + + --> debuff uptime + if (actor.debuff_uptime) then + refresh_habilidades (shadow.debuff_uptime_spells, actor.debuff_uptime_spells) + if (actor.boss_debuff) then + -- + else + refresh_alvos (shadow.debuff_uptime_targets, actor.debuff_uptime_targets) + end - if (not actor.nome) then - actor.nome = "unknown" - end - - if (not shadow) then - shadow = overall_misc:PegarCombatente (actor.serial, actor.nome, actor.flag_original, true) - shadow.classe = actor.classe - shadow.grupo = actor.grupo - end - - --> aplica a meta e indexes - _detalhes.refresh:r_atributo_misc (actor, shadow) - - --> somar os alvos do ator - local somar_alvos = function (container) - for index, alvo in _ipairs (actor [container]._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = shadow [container]:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow [container]) - end - end - --> somar as habilidades do ator - local somar_habilidades = function (container, shadow) - for spellid, habilidade in _pairs (actor [container]._ActorTable) do - --> cria e soma o valor - local habilidade_shadow = shadow [container]:PegaHabilidade (spellid, true, nil, true) - --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - --> refresh no alvo da habilidade - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) - end - --> refresh na habilidade - _detalhes.refresh:r_habilidade_misc (habilidade, shadow [container]) - end - end - - --> cooldowns - if (actor.cooldowns_defensive) then - --> copia o container de alvos (captura de dados) - somar_alvos ("cooldowns_defensive_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("cooldowns_defensive_spell_tables", shadow) - end - - --> buff uptime - if (actor.buff_uptime) then - --> copia o container de alvos (captura de dados) - somar_alvos ("buff_uptime_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("buff_uptime_spell_tables", shadow) - end - - --> debuff uptime - if (actor.debuff_uptime) then - --> copia o container de alvos (captura de dados) - somar_alvos ("debuff_uptime_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("debuff_uptime_spell_tables", shadow) - end - - --> interrupt - if (actor.interrupt) then - --> copia o container de alvos (captura de dados) - somar_alvos ("interrupt_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("interrupt_spell_tables", shadow) - --> copia o que cada habilidade interrompeu - for spellid, habilidade in _pairs (actor.interrupt_spell_tables._ActorTable) do - --> pega o actor da shadow - local habilidade_shadow = shadow.interrupt_spell_tables:PegaHabilidade (spellid, true, nil, true) - --> copia as habilidades interrompidas - habilidade_shadow.interrompeu_oque = habilidade_shadow.interrompeu_oque or {} - end - end - - --> ress - if (actor.ress) then - --> copia o container de alvos (captura de dados) - somar_alvos ("ress_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("ress_spell_tables", shadow) - end - - --> dispell - if (actor.dispell) then - --> copia o container de alvos (captura de dados) - somar_alvos ("dispell_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("dispell_spell_tables", shadow) - --> copia o que cada habilidade dispelou - for spellid, habilidade in _pairs (actor.dispell_spell_tables._ActorTable) do - --> pega o actor da shadow - local habilidade_shadow = shadow.dispell_spell_tables:PegaHabilidade (spellid, true, nil, true) - --> copia as habilidades dispeladas - habilidade_shadow.dispell_oque = habilidade_shadow.dispell_oque or {} - end - end - --> cc break - if (actor.cc_break) then - --> copia o container de alvos (captura de dados) - somar_alvos ("cc_break_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("cc_break_spell_tables", shadow) - --> copia o que cada habilidade quebrou - for spellid, habilidade in _pairs (actor.cc_break_spell_tables._ActorTable) do - --> pega o actor da shadow - local habilidade_shadow = shadow.cc_break_spell_tables:PegaHabilidade (spellid, true, nil, true) - --> copia as habilidades quebradas - habilidade_shadow.cc_break_oque = habilidade_shadow.cc_break_oque or {} - end - end - - return shadow + end + --> interrupt + if (actor.interrupt) then + refresh_alvos (shadow.interrupt_targets, actor.interrupt_targets) + refresh_habilidades (shadow.interrupt_spells, actor.interrupt_spells) + for spellid, habilidade in _pairs (actor.interrupt_spells._ActorTable) do + local habilidade_shadow = shadow.interrupt_spells:PegaHabilidade (spellid, true, nil, true) + habilidade_shadow.interrompeu_oque = habilidade_shadow.interrompeu_oque or {} + end + end + + --> ress + if (actor.ress) then + refresh_alvos (shadow.ress_targets, actor.ress_targets) + refresh_habilidades (shadow.ress_spells, actor.ress_spells) + end + + --> dispell + if (actor.dispell) then + refresh_alvos (shadow.dispell_targets, actor.dispell_targets) + refresh_habilidades (shadow.dispell_spells, actor.dispell_spells) + for spellid, habilidade in _pairs (actor.dispell_spells._ActorTable) do + local habilidade_shadow = shadow.dispell_spells:PegaHabilidade (spellid, true, nil, true) + habilidade_shadow.dispell_oque = habilidade_shadow.dispell_oque or {} + end + end + + --> cc break + if (actor.cc_break) then + refresh_alvos (shadow.cc_break_targets, actor.cc_break_targets) + refresh_habilidades (shadow.cc_break_spells, actor.cc_break_spells) + for spellid, habilidade in _pairs (actor.cc_break_spells._ActorTable) do + local habilidade_shadow = shadow.cc_break_spells:PegaHabilidade (spellid, true, nil, true) + habilidade_shadow.cc_break_oque = habilidade_shadow.cc_break_oque or {} + end + end + + return shadow + +end + +local somar_keys = function (habilidade, habilidade_tabela1) + for key, value in _pairs (habilidade) do + if (_type (value) == "number") then + if (key ~= "id" and key ~= "spellschool") then + habilidade_tabela1 [key] = (habilidade_tabela1 [key] or 0) + value + end + end + end +end +local somar_alvos = function (container1, container2) + for target_name, amount in _pairs (container2) do + container1 [target_name] = (container1 [target_name] or 0) + amount + end +end +local somar_habilidades = function (container1, container2) + for spellid, habilidade in _pairs (container2._ActorTable) do + local habilidade_tabela1 = container1:PegaHabilidade (spellid, true, nil, false) + somar_alvos (habilidade.targets, habilidade_tabela1.targets) + somar_keys (habilidade, habilidade_tabela1) + end +end + +function atributo_misc:r_connect_shadow (actor, no_refresh) + + --> criar uma shadow desse ator se ainda não tiver uma + local overall_misc = _detalhes.tabela_overall [4] + local shadow = overall_misc._ActorTable [overall_misc._NameIndexTable [actor.nome]] + + if (not actor.nome) then + actor.nome = "unknown" + end + + if (not shadow) then + shadow = overall_misc:PegarCombatente (actor.serial, actor.nome, actor.flag_original, true) + shadow.classe = actor.classe + shadow.grupo = actor.grupo + end + + --> aplica a meta e indexes + if (not no_refresh) then + _detalhes.refresh:r_atributo_misc (actor, shadow) + end + + if (actor.cooldowns_defensive) then + if (not shadow.cooldowns_defensive_targets) then + shadow.cooldowns_defensive = _detalhes:GetOrderNumber (actor.nome) + shadow.cooldowns_defensive_targets = {} + shadow.cooldowns_defensive_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) end - function atributo_misc:r_connect_shadow (actor, no_refresh) - - --> criar uma shadow desse ator se ainda não tiver uma - local overall_misc = _detalhes.tabela_overall [4] - local shadow = overall_misc._ActorTable [overall_misc._NameIndexTable [actor.nome]] - - if (not actor.nome) then - actor.nome = "unknown" - end - - if (not shadow) then - shadow = overall_misc:PegarCombatente (actor.serial, actor.nome, actor.flag_original, true) - shadow.classe = actor.classe - shadow.grupo = actor.grupo - end - - --> aplica a meta e indexes - if (not no_refresh) then - _detalhes.refresh:r_atributo_misc (actor, shadow) - end - - --> somar as keys das habilidades - local somar_keys = function (habilidade, habilidade_shadow) - for key, value in _pairs (habilidade) do - if (_type (value) == "number") then - if (key ~= "id") then - if (not habilidade_shadow [key]) then - habilidade_shadow [key] = 0 - end - habilidade_shadow [key] = habilidade_shadow [key] + value - end - end - end - end - --> somar os alvos do ator - local somar_alvos = function (container) - for index, alvo in _ipairs (actor [container]._ActorTable) do - --> cria e soma o valor do total - --if (shadow [container]) then -- index ?? a nil value - local alvo_shadow = shadow [container]:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - if (alvo.uptime) then --> boss debuff - alvo_shadow.uptime = alvo_shadow.uptime + alvo.uptime - alvo_shadow.activedamt = alvo_shadow.activedamt + alvo.activedamt - end - --end - --> refresh no alvo - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, shadow [container]) - end - - end - end - --> somar as habilidades do ator - local somar_habilidades = function (container, shadow) - for spellid, habilidade in _pairs (actor [container]._ActorTable) do - --> cria e soma o valor - local habilidade_shadow = shadow [container]:PegaHabilidade (spellid, true, nil, true) - --> refresh e soma os valores dos alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - --> cria e soma o valor do total - local alvo_shadow = habilidade_shadow.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_shadow.total = alvo_shadow.total + alvo.total - --> refresh no alvo da habilidade - if (not no_refresh) then - _detalhes.refresh:r_alvo_da_habilidade (alvo, habilidade_shadow.targets) - end - end - --> soma todos os demais valores - somar_keys (habilidade, habilidade_shadow) - --> refresh na habilidade - if (not no_refresh) then - _detalhes.refresh:r_habilidade_misc (habilidade, shadow [container]) - end - end - end - - --> cooldowns - if (actor.cooldowns_defensive) then - - --> verifica se tem o container - if (not shadow.cooldowns_defensive_targets) then - shadow.cooldowns_defensive = 0 - shadow.cooldowns_defensive_targets = container_combatentes:NovoContainer (container_damage_target) - shadow.cooldowns_defensive_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) - end - - --> soma o total (captura de dados) - shadow.cooldowns_defensive = shadow.cooldowns_defensive + actor.cooldowns_defensive - --> total no combate overall (captura de dados) - _detalhes.tabela_overall.totals[4].cooldowns_defensive = _detalhes.tabela_overall.totals[4].cooldowns_defensive + actor.cooldowns_defensive - if (actor.grupo) then - _detalhes.tabela_overall.totals_grupo[4].cooldowns_defensive = _detalhes.tabela_overall.totals_grupo[4].cooldowns_defensive + actor.cooldowns_defensive - end - --> copia o container de alvos (captura de dados) - somar_alvos ("cooldowns_defensive_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("cooldowns_defensive_spell_tables", shadow) - end - - --> buff uptime - if (actor.buff_uptime) then - - --> verifica se tem o container - if (not shadow.buff_uptime_spell_targets) then - shadow.buff_uptime = 0 - shadow.buff_uptime_spell_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.buff_uptime_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - end - - --> soma o total (captura de dados) - shadow.buff_uptime = shadow.buff_uptime + actor.buff_uptime - --> copia o container de alvos (captura de dados) - somar_alvos ("buff_uptime_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("buff_uptime_spell_tables", shadow) - end - - --> debuff uptime - if (actor.debuff_uptime) then - - --> verifica se tem o container - if (not shadow.debuff_uptime_targets) then - shadow.debuff_uptime = 0 - if (actor.boss_debuff) then - shadow.debuff_uptime_targets = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS) - shadow.boss_debuff = true - shadow.damage_twin = actor.damage_twin - shadow.spellschool = actor.spellschool - shadow.damage_spellid = actor.damage_spellid - shadow.debuff_uptime = 0 - else - shadow.debuff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) - end - shadow.debuff_uptime_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) - end - - --> soma o total (captura de dados) - shadow.debuff_uptime = shadow.debuff_uptime + actor.debuff_uptime - --> copia o container de alvos (captura de dados) - somar_alvos ("debuff_uptime_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("debuff_uptime_spell_tables", shadow) - end - - --> interrupt - if (actor.interrupt) then - - --verifica se tem o container - if (not shadow.interrupt_targets) then - shadow.interrupt = 0 - shadow.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.interrupt_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - shadow.interrompeu_oque = {} - end - - --> soma o total (captura de dados) - shadow.interrupt = shadow.interrupt + actor.interrupt - --> total no combate overall (captura de dados) - _detalhes.tabela_overall.totals[4].interrupt = _detalhes.tabela_overall.totals[4].interrupt + actor.interrupt - if (actor.grupo) then - _detalhes.tabela_overall.totals_grupo[4].interrupt = _detalhes.tabela_overall.totals_grupo[4].interrupt + actor.interrupt - end - --> copia o container de alvos (captura de dados) - somar_alvos ("interrupt_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("interrupt_spell_tables", shadow) - --> copia o que cada habilidade interrompeu - for spellid, habilidade in _pairs (actor.interrupt_spell_tables._ActorTable) do - --> pega o actor da shadow - local habilidade_shadow = shadow.interrupt_spell_tables:PegaHabilidade (spellid, true, nil, true) - --> copia as habilidades interrompidas - habilidade_shadow.interrompeu_oque = habilidade_shadow.interrompeu_oque or {} - for _spellid, amount in _pairs (habilidade.interrompeu_oque) do - if (habilidade_shadow.interrompeu_oque [_spellid]) then - habilidade_shadow.interrompeu_oque [_spellid] = habilidade_shadow.interrompeu_oque [_spellid] + amount - else - habilidade_shadow.interrompeu_oque [_spellid] = amount - end - end - end - --> copia o que ator interrompeu - for spellid, amount in _pairs (actor.interrompeu_oque) do - if (not shadow.interrompeu_oque [spellid]) then - shadow.interrompeu_oque [spellid] = 0 - end - shadow.interrompeu_oque [spellid] = shadow.interrompeu_oque [spellid] + amount - end - end - - --> ress - if (actor.ress) then - - --> verifica se tem o container - if (not shadow.ress_targets) then - shadow.ress = 0 - shadow.ress_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.ress_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - end - - --> soma o total (captura de dados) - shadow.ress = shadow.ress + actor.ress - --> total no combate overall (captura de dados) - _detalhes.tabela_overall.totals[4].ress = _detalhes.tabela_overall.totals[4].ress + actor.ress - if (actor.grupo) then - _detalhes.tabela_overall.totals_grupo[4].ress = _detalhes.tabela_overall.totals_grupo[4].ress + actor.ress - end - --> copia o container de alvos (captura de dados) - somar_alvos ("ress_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("ress_spell_tables", shadow) - end - - --> dispell - if (actor.dispell) then - - --> verifica se tem o container - if (not shadow.dispell_targets) then - shadow.dispell = 0 - shadow.dispell_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.dispell_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - shadow.dispell_oque = {} - end - - --> soma o total (captura de dados) - shadow.dispell = shadow.dispell + actor.dispell - --> total no combate overall (captura de dados) - _detalhes.tabela_overall.totals[4].dispell = _detalhes.tabela_overall.totals[4].dispell + actor.dispell - if (actor.grupo) then - _detalhes.tabela_overall.totals_grupo[4].dispell = _detalhes.tabela_overall.totals_grupo[4].dispell + actor.dispell - end - --> copia o container de alvos (captura de dados) - somar_alvos ("dispell_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("dispell_spell_tables", shadow) - --> copia o que cada habilidade dispelou - for spellid, habilidade in _pairs (actor.dispell_spell_tables._ActorTable) do - --> pega o actor da shadow - local habilidade_shadow = shadow.dispell_spell_tables:PegaHabilidade (spellid, true, nil, true) - --> copia as habilidades dispeladas - habilidade_shadow.dispell_oque = habilidade_shadow.dispell_oque or {} - for _spellid, amount in _pairs (habilidade.dispell_oque) do - if (habilidade_shadow.dispell_oque [_spellid]) then - habilidade_shadow.dispell_oque [_spellid] = habilidade_shadow.dispell_oque [_spellid] + amount - else - habilidade_shadow.dispell_oque [_spellid] = amount - end - end - end - --> copia o que ator dispelou - for spellid, amount in _pairs (actor.dispell_oque) do - if (not shadow.dispell_oque [spellid]) then - shadow.dispell_oque [spellid] = 0 - end - shadow.dispell_oque [spellid] = shadow.dispell_oque [spellid] + amount - end - - end - --> cc break - if (actor.cc_break) then - - --> verifica se tem o container - if (not shadow.cc_break) then - shadow.cc_break = 0 - shadow.cc_break_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.cc_break_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - shadow.cc_break_oque = {} - end - - --> soma o total (captura de dados) - shadow.cc_break = shadow.cc_break + actor.cc_break - --> total no combate overall (captura de dados) - _detalhes.tabela_overall.totals[4].cc_break = _detalhes.tabela_overall.totals[4].cc_break + actor.cc_break - if (actor.grupo) then - _detalhes.tabela_overall.totals_grupo[4].cc_break = _detalhes.tabela_overall.totals_grupo[4].cc_break + actor.cc_break - end - --> copia o container de alvos (captura de dados) - somar_alvos ("cc_break_targets", shadow) - --> copia o container de habilidades (captura de dados) - somar_habilidades ("cc_break_spell_tables", shadow) - --> copia o que cada habilidade quebrou - for spellid, habilidade in _pairs (actor.cc_break_spell_tables._ActorTable) do - --> pega o actor da shadow - local habilidade_shadow = shadow.cc_break_spell_tables:PegaHabilidade (spellid, true, nil, true) - --> copia as habilidades quebradas - habilidade_shadow.cc_break_oque = habilidade_shadow.cc_break_oque or {} - for _spellid, amount in _pairs (habilidade.cc_break_oque) do - if (habilidade_shadow.cc_break_oque [_spellid]) then - habilidade_shadow.cc_break_oque [_spellid] = habilidade_shadow.cc_break_oque [_spellid] + amount - else - habilidade_shadow.cc_break_oque [_spellid] = amount - end - end - end - --> copia o que ator quebrou - for spellid, amount in _pairs (actor.cc_break_oque) do - if (not shadow.cc_break_oque [spellid]) then - shadow.cc_break_oque [spellid] = 0 - end - shadow.cc_break_oque [spellid] = shadow.cc_break_oque [spellid] + amount - end - end - - return shadow - + shadow.cooldowns_defensive = shadow.cooldowns_defensive + actor.cooldowns_defensive + _detalhes.tabela_overall.totals[4].cooldowns_defensive = _detalhes.tabela_overall.totals[4].cooldowns_defensive + actor.cooldowns_defensive + if (actor.grupo) then + _detalhes.tabela_overall.totals_grupo[4].cooldowns_defensive = _detalhes.tabela_overall.totals_grupo[4].cooldowns_defensive + actor.cooldowns_defensive end + + somar_alvos (shadow.cooldowns_defensive_targets, actor.cooldowns_defensive_targets) + somar_habilidades (shadow.cooldowns_defensive_spells, actor.cooldowns_defensive_spells) + end + + if (actor.buff_uptime) then + if (not shadow.buff_uptime_spell_targets) then + shadow.buff_uptime = 0 + shadow.buff_uptime_spell_targets = {} + shadow.buff_uptime_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + + shadow.buff_uptime = shadow.buff_uptime + actor.buff_uptime + somar_alvos (shadow.buff_uptime_targets, actor.buff_uptime_targets) + somar_habilidades (shadow.buff_uptime_spells, actor.buff_uptime_spells) + end + + + if (actor.debuff_uptime) then + if (not shadow.debuff_uptime_targets) then + shadow.debuff_uptime = 0 + if (actor.boss_debuff) then + shadow.debuff_uptime_targets = {} + shadow.boss_debuff = true + shadow.damage_twin = actor.damage_twin + shadow.spellschool = actor.spellschool + shadow.damage_spellid = actor.damage_spellid + shadow.debuff_uptime = 0 + else + shadow.debuff_uptime_targets = {} + end + shadow.debuff_uptime_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + + shadow.debuff_uptime = shadow.debuff_uptime + actor.debuff_uptime + + for target_name, amount in _pairs (actor.debuff_uptime_targets) do + if (_type (amount) == "table") then --> boss debuff + local t = shadow.debuff_uptime_targets [target_name] + if (not t) then + shadow.debuff_uptime_targets [target_name] = atributo_misc:CreateBuffTargetObject() + t = shadow.debuff_uptime_targets [target_name] + end + t.uptime = t.uptime + amount.uptime + t.activedamt = t.activedamt + amount.activedamt + else + shadow.debuff_uptime_targets [target_name] = (shadow.debuff_uptime_targets [target_name] or 0) + amount + end + end + + somar_habilidades (shadow.debuff_uptime_spells, actor.debuff_uptime_spells) + end + + --> interrupt + if (actor.interrupt) then + if (not shadow.interrupt_targets) then + shadow.interrupt = 0 + shadow.interrupt_targets = {} + shadow.interrupt_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper + shadow.interrompeu_oque = {} + end + + shadow.interrupt = shadow.interrupt + actor.interrupt + _detalhes.tabela_overall.totals[4].interrupt = _detalhes.tabela_overall.totals[4].interrupt + actor.interrupt + if (actor.grupo) then + _detalhes.tabela_overall.totals_grupo[4].interrupt = _detalhes.tabela_overall.totals_grupo[4].interrupt + actor.interrupt + end + + somar_alvos (shadow.interrupt_targets, actor.interrupt_targets) + somar_habilidades (shadow.interrupt_spells, actor.interrupt_spells) + + for spellid, habilidade in _pairs (actor.interrupt_spells._ActorTable) do + local habilidade_shadow = shadow.interrupt_spells:PegaHabilidade (spellid, true, nil, true) + + habilidade_shadow.interrompeu_oque = habilidade_shadow.interrompeu_oque or {} + + for _spellid, amount in _pairs (habilidade.interrompeu_oque) do + habilidade_shadow.interrompeu_oque [_spellid] = (habilidade_shadow.interrompeu_oque [_spellid] or 0) + amount + end + end + for spellid, amount in _pairs (actor.interrompeu_oque) do + shadow.interrompeu_oque [spellid] = (shadow.interrompeu_oque [spellid] or 0) + amount + end + end + + --> ress + if (actor.ress) then + if (not shadow.ress_targets) then + shadow.ress = 0 + shadow.ress_targets = {} + shadow.ress_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + + shadow.ress = shadow.ress + actor.ress + _detalhes.tabela_overall.totals[4].ress = _detalhes.tabela_overall.totals[4].ress + actor.ress + if (actor.grupo) then + _detalhes.tabela_overall.totals_grupo[4].ress = _detalhes.tabela_overall.totals_grupo[4].ress + actor.ress + end + + somar_alvos (shadow.ress_targets, actor.ress_targets) + somar_habilidades (shadow.ress_spells, actor.ress_spells) + end + + --> dispell + if (actor.dispell) then + if (not shadow.dispell_targets) then + shadow.dispell = 0 + shadow.dispell_targets = {} + shadow.dispell_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + shadow.dispell_oque = {} + end + + shadow.dispell = shadow.dispell + actor.dispell + _detalhes.tabela_overall.totals[4].dispell = _detalhes.tabela_overall.totals[4].dispell + actor.dispell + if (actor.grupo) then + _detalhes.tabela_overall.totals_grupo[4].dispell = _detalhes.tabela_overall.totals_grupo[4].dispell + actor.dispell + end + + somar_alvos (shadow.dispell_targets, actor.dispell_targets) + somar_habilidades (shadow.dispell_spells, actor.dispell_spells) + + for spellid, habilidade in _pairs (actor.dispell_spells._ActorTable) do + local habilidade_shadow = shadow.dispell_spells:PegaHabilidade (spellid, true, nil, true) + habilidade_shadow.dispell_oque = habilidade_shadow.dispell_oque or {} + for _spellid, amount in _pairs (habilidade.dispell_oque) do + habilidade_shadow.dispell_oque [_spellid] = (habilidade_shadow.dispell_oque [_spellid] or 0) + amount + end + end + + for spellid, amount in _pairs (actor.dispell_oque) do + shadow.dispell_oque [spellid] = (shadow.dispell_oque [spellid] or 0) + amount + end + end + + if (actor.cc_break) then + if (not shadow.cc_break) then + shadow.cc_break = 0 + shadow.cc_break_targets = {} + shadow.cc_break_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper + shadow.cc_break_oque = {} + end + + shadow.cc_break = shadow.cc_break + actor.cc_break + _detalhes.tabela_overall.totals[4].cc_break = _detalhes.tabela_overall.totals[4].cc_break + actor.cc_break + if (actor.grupo) then + _detalhes.tabela_overall.totals_grupo[4].cc_break = _detalhes.tabela_overall.totals_grupo[4].cc_break + actor.cc_break + end + + somar_alvos (shadow.cc_break_targets, actor.cc_break_targets) + somar_habilidades (shadow.cc_break_spells, actor.cc_break_spells) + + for spellid, habilidade in _pairs (actor.cc_break_spells._ActorTable) do + local habilidade_shadow = shadow.cc_break_spells:PegaHabilidade (spellid, true, nil, true) + habilidade_shadow.cc_break_oque = habilidade_shadow.cc_break_oque or {} + for _spellid, amount in _pairs (habilidade.cc_break_oque) do + habilidade_shadow.cc_break_oque [_spellid] = (habilidade_shadow.cc_break_oque [_spellid] or 0) + amount + end + end + for spellid, amount in _pairs (actor.cc_break_oque) do + shadow.cc_break_oque [spellid] = (shadow.cc_break_oque [spellid] or 0) + amount + end + end + + return shadow + +end function atributo_misc:ColetarLixo (lastevent) return _detalhes:ColetarLixo (class_type, lastevent) end - function _detalhes.refresh:r_atributo_misc (este_jogador, shadow) _setmetatable (este_jogador, _detalhes.atributo_misc) este_jogador.__index = _detalhes.atributo_misc - este_jogador.shadow = shadow --> refresh interrupts if (este_jogador.interrupt_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.interrupt_targets) then - shadow.interrupt = 0 - shadow.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.interrupt_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - shadow.interrompeu_oque = {} - end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.interrupt_targets, shadow.interrupt_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.interrupt_spell_tables, shadow.interrupt_spell_tables) + if (not shadow.interrupt_targets) then + shadow.interrupt = 0 + shadow.interrupt_targets = {} + shadow.interrupt_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + shadow.interrompeu_oque = {} + end + _detalhes.refresh:r_container_habilidades (este_jogador.interrupt_spells, shadow.interrupt_spells) end --> refresh buff uptime if (este_jogador.buff_uptime_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.buff_uptime_spell_targets) then - shadow.buff_uptime = 0 - shadow.buff_uptime_spell_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.buff_uptime_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.buff_uptime_targets, shadow.buff_uptime_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.buff_uptime_spell_tables, shadow.buff_uptime_spell_tables) + if (not shadow.buff_uptime_spell_targets) then + shadow.buff_uptime = 0 + shadow.buff_uptime_spell_targets = {} + shadow.buff_uptime_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + _detalhes.refresh:r_container_habilidades (este_jogador.buff_uptime_spells, shadow.buff_uptime_spells) end --> refresh buff uptime if (este_jogador.debuff_uptime_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.debuff_uptime_targets) then + if (not shadow.debuff_uptime_targets) then + shadow.debuff_uptime = 0 + if (este_jogador.boss_debuff) then + shadow.debuff_uptime_targets = {} + shadow.boss_debuff = true + shadow.damage_twin = este_jogador.damage_twin + shadow.spellschool = este_jogador.spellschool + shadow.damage_spellid = este_jogador.damage_spellid shadow.debuff_uptime = 0 - if (este_jogador.boss_debuff) then - shadow.debuff_uptime_targets = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS) - shadow.boss_debuff = true - shadow.damage_twin = este_jogador.damage_twin - shadow.spellschool = este_jogador.spellschool - shadow.damage_spellid = este_jogador.damage_spellid - shadow.debuff_uptime = 0 - else - shadow.debuff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) - end - shadow.debuff_uptime_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + else + shadow.debuff_uptime_targets = {} end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.debuff_uptime_targets, shadow.debuff_uptime_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.debuff_uptime_spell_tables, shadow.debuff_uptime_spell_tables) + shadow.debuff_uptime_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + _detalhes.refresh:r_container_habilidades (este_jogador.debuff_uptime_spells, shadow.debuff_uptime_spells) end --> refresh cooldowns defensive if (este_jogador.cooldowns_defensive_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.cooldowns_defensive_targets) then - shadow.cooldowns_defensive = 0 - shadow.cooldowns_defensive_targets = container_combatentes:NovoContainer (container_damage_target) - shadow.cooldowns_defensive_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) - end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.cooldowns_defensive_targets, shadow.cooldowns_defensive_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.cooldowns_defensive_spell_tables, shadow.cooldowns_defensive_spell_tables) + if (not shadow.cooldowns_defensive_targets) then + shadow.cooldowns_defensive = 0 + shadow.cooldowns_defensive_targets = {} + shadow.cooldowns_defensive_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + _detalhes.refresh:r_container_habilidades (este_jogador.cooldowns_defensive_spells, shadow.cooldowns_defensive_spells) end --> refresh ressers if (este_jogador.ress_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.ress_targets) then - shadow.ress = 0 - shadow.ress_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.ress_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.ress_targets, shadow.ress_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.ress_spell_tables, shadow.ress_spell_tables) + if (not shadow.ress_targets) then + shadow.ress = 0 + shadow.ress_targets = {} + shadow.ress_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + end + _detalhes.refresh:r_container_habilidades (este_jogador.ress_spells, shadow.ress_spells) end --> refresh dispells if (este_jogador.dispell_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.dispell_targets) then - shadow.dispell = 0 - shadow.dispell_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.dispell_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - shadow.dispell_oque = {} - end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.dispell_targets, shadow.dispell_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.dispell_spell_tables, shadow.dispell_spell_tables) + if (not shadow.dispell_targets) then + shadow.dispell = 0 + shadow.dispell_targets = {} + shadow.dispell_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper + shadow.dispell_oque = {} + end + _detalhes.refresh:r_container_habilidades (este_jogador.dispell_spells, shadow.dispell_spells) end --> refresh cc_breaks if (este_jogador.cc_break_targets) then - --> constrói os containers na shadow se não existir - if (not shadow.cc_break) then - shadow.cc_break = 0 - shadow.cc_break_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - shadow.cc_break_spell_tables = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) --> cria o container das habilidades usadas para interromper - shadow.cc_break_oque = {} - end - --> recupera metas e indexes - _detalhes.refresh:r_container_combatentes (este_jogador.cc_break_targets, shadow.cc_break_targets) - _detalhes.refresh:r_container_habilidades (este_jogador.cc_break_spell_tables, shadow.cc_break_spell_tables) + if (not shadow.cc_break) then + shadow.cc_break = 0 + shadow.cc_break_targets = {} + shadow.cc_break_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS) + shadow.cc_break_oque = {} + end + _detalhes.refresh:r_container_habilidades (este_jogador.cc_break_spells, shadow.cc_break_spells) end - end function _detalhes.clear:c_atributo_misc (este_jogador) - --este_jogador.__index = {} este_jogador.__index = nil este_jogador.shadow = nil este_jogador.links = nil este_jogador.minha_barra = nil if (este_jogador.interrupt_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.interrupt_targets) - _detalhes.clear:c_container_habilidades (este_jogador.interrupt_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.interrupt_spells) end if (este_jogador.cooldowns_defensive_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.cooldowns_defensive_targets) - _detalhes.clear:c_container_habilidades (este_jogador.cooldowns_defensive_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.cooldowns_defensive_spells) end if (este_jogador.buff_uptime_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.buff_uptime_targets) - _detalhes.clear:c_container_habilidades (este_jogador.buff_uptime_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.buff_uptime_spells) end if (este_jogador.debuff_uptime_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.debuff_uptime_targets) - _detalhes.clear:c_container_habilidades (este_jogador.debuff_uptime_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.debuff_uptime_spells) end if (este_jogador.ress_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.ress_targets) - _detalhes.clear:c_container_habilidades (este_jogador.ress_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.ress_spells) end if (este_jogador.cc_break_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.cc_break_targets) - _detalhes.clear:c_container_habilidades (este_jogador.cc_break_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.cc_break_spells) end if (este_jogador.dispell_targets) then - _detalhes.clear:c_container_combatentes (este_jogador.dispell_targets) - _detalhes.clear:c_container_habilidades (este_jogador.dispell_spell_tables) + _detalhes.clear:c_container_habilidades (este_jogador.dispell_spells) end end atributo_misc.__add = function (tabela1, tabela2) - local somar_keys = function (habilidade, habilidade_tabela1) - for key, value in _pairs (habilidade) do - if (_type (value) == "number") then - if (key ~= "id") then - if (not habilidade_tabela1 [key]) then - habilidade_tabela1 [key] = 0 - end - habilidade_tabela1 [key] = habilidade_tabela1 [key] + value - end - end - end - end - if (tabela2.interrupt) then if (not tabela1.interrupt) then tabela1.interrupt = 0 - tabela1.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) - tabela1.interrupt_spell_tables = container_habilidades:NovoContainer (container_misc) + tabela1.interrupt_targets = {} + tabela1.interrupt_spells = container_habilidades:NovoContainer (container_misc) tabela1.interrompeu_oque = {} end @@ -2806,211 +2608,179 @@ atributo_misc.__add = function (tabela1, tabela2) tabela1.interrupt = tabela1.interrupt + tabela2.interrupt --> soma o interrompeu o que for spellid, amount in _pairs (tabela2.interrompeu_oque) do - if (not tabela1.interrompeu_oque [spellid]) then - tabela1.interrompeu_oque [spellid] = 0 - end - tabela1.interrompeu_oque [spellid] = tabela1.interrompeu_oque [spellid] + amount + tabela1.interrompeu_oque [spellid] = (tabela1.interrompeu_oque [spellid] or 0) + amount end --> soma os containers de alvos - for index, alvo in _ipairs (tabela2.interrupt_targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.interrupt_targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma o valor - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.interrupt_targets) do + tabela1.interrupt_targets [target_name] = (tabela1.interrupt_targets [target_name] or 0) + amount end --> soma o container de habilidades - for spellid, habilidade in _pairs (tabela2.interrupt_spell_tables._ActorTable) do - --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.interrupt_spell_tables:PegaHabilidade (spellid, true, nil, false) - --> soma o que essa habilidade interrompeu + for spellid, habilidade in _pairs (tabela2.interrupt_spells._ActorTable) do + local habilidade_tabela1 = tabela1.interrupt_spells:PegaHabilidade (spellid, true, nil, false) + habilidade_tabela1.interrompeu_oque = habilidade_tabela1.interrompeu_oque or {} for _spellid, amount in _pairs (habilidade.interrompeu_oque) do - if (habilidade_tabela1.interrompeu_oque [_spellid]) then - habilidade_tabela1.interrompeu_oque [_spellid] = habilidade_tabela1.interrompeu_oque [_spellid] + amount - else - habilidade_tabela1.interrompeu_oque [_spellid] = amount - end + habilidade_tabela1.interrompeu_oque [_spellid] = (habilidade_tabela1.interrompeu_oque [_spellid] or 0) + amount end - --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) - end + end end if (tabela2.buff_uptime) then - if (not tabela1.buff_uptime) then tabela1.buff_uptime = 0 - tabela1.buff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - tabela1.buff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas + tabela1.buff_uptime_targets = {} + tabela1.buff_uptime_spells = container_habilidades:NovoContainer (container_misc) end tabela1.buff_uptime = tabela1.buff_uptime + tabela2.buff_uptime - for index, alvo in _ipairs (tabela2.buff_uptime_targets._ActorTable) do - local alvo_tabela1 = tabela1.buff_uptime_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.buff_uptime_targets) do + tabela1.buff_uptime_targets [target_name] = (tabela1.buff_uptime_targets [target_name] or 0) + amount end - for spellid, habilidade in _pairs (tabela2.buff_uptime_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.buff_uptime_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.buff_uptime_spells._ActorTable) do + local habilidade_tabela1 = tabela1.buff_uptime_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) - end - + end end if (tabela2.debuff_uptime) then - if (not tabela1.debuff_uptime) then - if (tabela2.boss_debuff) then - tabela1.debuff_uptime_targets = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS) + tabela1.debuff_uptime_targets = {} tabela1.boss_debuff = true tabela1.damage_twin = tabela2.damage_twin tabela1.spellschool = tabela2.spellschool tabela1.damage_spellid = tabela2.damage_spellid else - tabela1.debuff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) + tabela1.debuff_uptime_targets = {} end tabela1.debuff_uptime = 0 - tabela1.debuff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) + tabela1.debuff_uptime_spells = container_habilidades:NovoContainer (container_misc) end - + tabela1.debuff_uptime = tabela1.debuff_uptime + tabela2.debuff_uptime - for index, alvo in _ipairs (tabela2.debuff_uptime_targets._ActorTable) do - local alvo_tabela1 = tabela1.debuff_uptime_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total - if (alvo.uptime) then --> boss debuff - alvo_tabela1.uptime = alvo_tabela1.uptime + alvo.uptime - alvo_tabela1.activedamt = alvo_tabela1.activedamt + alvo.activedamt + for target_name, amount in _pairs (tabela2.debuff_uptime_targets) do + if (_type (amount) == "table") then --> boss debuff + local t = tabela1.debuff_uptime_targets [target_name] + if (not t) then + tabela1.debuff_uptime_targets [target_name] = atributo_misc:CreateBuffTargetObject() + t = tabela1.debuff_uptime_targets [target_name] + end + t.uptime = t.uptime + amount.uptime + t.activedamt = t.activedamt + amount.activedamt + else + tabela1.debuff_uptime_targets [target_name] = (tabela1.debuff_uptime_targets [target_name] or 0) + amount end end - for spellid, habilidade in _pairs (tabela2.debuff_uptime_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.debuff_uptime_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.debuff_uptime_spells._ActorTable) do + local habilidade_tabela1 = tabela1.debuff_uptime_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) end - end if (tabela2.cooldowns_defensive) then - if (not tabela1.cooldowns_defensive) then tabela1.cooldowns_defensive = 0 - tabela1.cooldowns_defensive_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - tabela1.cooldowns_defensive_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas + tabela1.cooldowns_defensive_targets = {} + tabela1.cooldowns_defensive_spells = container_habilidades:NovoContainer (container_misc) end tabela1.cooldowns_defensive = tabela1.cooldowns_defensive + tabela2.cooldowns_defensive - for index, alvo in _ipairs (tabela2.cooldowns_defensive_targets._ActorTable) do - local alvo_tabela1 = tabela1.cooldowns_defensive_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.cooldowns_defensive_targets) do + tabela1.cooldowns_defensive_targets [target_name] = (tabela1.cooldowns_defensive_targets [target_name] or 0) + amount end - for spellid, habilidade in _pairs (tabela2.cooldowns_defensive_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.cooldowns_defensive_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.cooldowns_defensive_spells._ActorTable) do + local habilidade_tabela1 = tabela1.cooldowns_defensive_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) end - end if (tabela2.ress) then - if (not tabela1.ress) then tabela1.ress = 0 - tabela1.ress_targets = container_combatentes:NovoContainer (container_damage_target) - tabela1.ress_spell_tables = container_habilidades:NovoContainer (container_misc) + tabela1.ress_targets = {} + tabela1.ress_spells = container_habilidades:NovoContainer (container_misc) end tabela1.ress = tabela1.ress + tabela2.ress - for index, alvo in _ipairs (tabela2.ress_targets._ActorTable) do - local alvo_tabela1 = tabela1.ress_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.ress_targets) do + tabela1.ress_targets [target_name] = (tabela1.ress_targets [target_name] or 0) + amount end - for spellid, habilidade in _pairs (tabela2.ress_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.ress_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.ress_spells._ActorTable) do + local habilidade_tabela1 = tabela1.ress_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) - end - + end end if (tabela2.dispell) then if (not tabela1.dispell) then tabela1.dispell = 0 - tabela1.dispell_targets = container_combatentes:NovoContainer (container_damage_target) - tabela1.dispell_spell_tables = container_habilidades:NovoContainer (container_misc) + tabela1.dispell_targets = {} + tabela1.dispell_spells = container_habilidades:NovoContainer (container_misc) tabela1.dispell_oque = {} end tabela1.dispell = tabela1.dispell + tabela2.dispell - for index, alvo in _ipairs (tabela2.dispell_targets._ActorTable) do - local alvo_tabela1 = tabela1.dispell_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.dispell_targets) do + tabela1.dispell_targets [target_name] = (tabela1.dispell_targets [target_name] or 0) + amount end - for spellid, habilidade in _pairs (tabela2.dispell_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.dispell_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.dispell_spells._ActorTable) do + local habilidade_tabela1 = tabela1.dispell_spells:PegaHabilidade (spellid, true, nil, false) habilidade_tabela1.dispell_oque = habilidade_tabela1.dispell_oque or {} for _spellid, amount in _pairs (habilidade.dispell_oque) do - if (habilidade_tabela1.dispell_oque [_spellid]) then - habilidade_tabela1.dispell_oque [_spellid] = habilidade_tabela1.dispell_oque [_spellid] + amount - else - habilidade_tabela1.dispell_oque [_spellid] = amount - end + habilidade_tabela1.dispell_oque [_spellid] = (habilidade_tabela1.dispell_oque [_spellid] or 0) + amount end - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) end for spellid, amount in _pairs (tabela2.dispell_oque) do - if (not tabela1.dispell_oque [spellid]) then - tabela1.dispell_oque [spellid] = 0 - end - tabela1.dispell_oque [spellid] = tabela1.dispell_oque [spellid] + amount + tabela1.dispell_oque [spellid] = (tabela1.dispell_oque [spellid] or 0) + amount end end @@ -3019,272 +2789,216 @@ atributo_misc.__add = function (tabela1, tabela2) if (not tabela1.cc_break) then tabela1.cc_break = 0 - tabela1.cc_break_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - tabela1.cc_break_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper + tabela1.cc_break_targets = {} + tabela1.cc_break_spells = container_habilidades:NovoContainer (container_misc) tabela1.cc_break_oque = {} end tabela1.cc_break = tabela1.cc_break + tabela2.cc_break - for index, alvo in _ipairs (tabela2.cc_break_targets._ActorTable) do - local alvo_tabela1 = tabela1.cc_break_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (tabela2.cc_break_targets) do + tabela1.cc_break_targets [target_name] = (tabela1.cc_break_targets [target_name] or 0) + amount end - for spellid, habilidade in _pairs (tabela2.cc_break_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.cc_break_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.cc_break_spells._ActorTable) do + local habilidade_tabela1 = tabela1.cc_break_spells:PegaHabilidade (spellid, true, nil, false) habilidade_tabela1.cc_break_oque = habilidade_tabela1.cc_break_oque or {} for _spellid, amount in _pairs (habilidade.cc_break_oque) do - if (habilidade_tabela1.cc_break_oque [_spellid]) then - habilidade_tabela1.cc_break_oque [_spellid] = habilidade_tabela1.cc_break_oque [_spellid] + amount - else - habilidade_tabela1.cc_break_oque [_spellid] = amount - end + habilidade_tabela1.cc_break_oque [_spellid] = (habilidade_tabela1.cc_break_oque [_spellid] or 0) + amount end - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total + alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount end somar_keys (habilidade, habilidade_tabela1) end - for spellid, amount in _pairs (tabela2.cc_break_oque) do - if (not tabela1.cc_break_oque [spellid]) then - tabela1.cc_break_oque [spellid] = 0 - end - tabela1.cc_break_oque [spellid] = tabela1.cc_break_oque [spellid] + amount + for spellid, amount in _pairs (tabela2.cc_break_oque) do + tabela1.cc_break_oque [spellid] = (tabela1.cc_break_oque [spellid] or 0) + amount end end return tabela1 end -atributo_misc.__sub = function (tabela1, tabela2) - - local subtrair_keys = function (habilidade, habilidade_tabela1) - for key, value in _pairs (habilidade) do - if (_type (value) == "number") then - if (key ~= "id") then - if (not habilidade_tabela1 [key]) then - habilidade_tabela1 [key] = 0 - end - habilidade_tabela1 [key] = habilidade_tabela1 [key] - value - end +local subtrair_keys = function (habilidade, habilidade_tabela1) + for key, value in _pairs (habilidade) do + if (_type (value) == "number") then + if (key ~= "id" and key ~= "spellschool") then + habilidade_tabela1 [key] = (habilidade_tabela1 [key] or 0) - value end end end +end + +atributo_misc.__sub = function (tabela1, tabela2) if (tabela2.interrupt) then - --> total de interrupts tabela1.interrupt = tabela1.interrupt - tabela2.interrupt --> soma o interrompeu o que for spellid, amount in _pairs (tabela2.interrompeu_oque) do - if (not tabela1.interrompeu_oque [spellid]) then - tabela1.interrompeu_oque [spellid] = 0 - end - tabela1.interrompeu_oque [spellid] = tabela1.interrompeu_oque [spellid] - amount + tabela1.interrompeu_oque [spellid] = (tabela1.interrompeu_oque [spellid] or 0) - amount end --> soma os containers de alvos - for index, alvo in _ipairs (tabela2.interrupt_targets._ActorTable) do - --> pega o alvo no ator - local alvo_tabela1 = tabela1.interrupt_targets:PegarCombatente (nil, alvo.nome, nil, true) - --> soma o valor - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.interrupt_targets) do + tabela1.interrupt_targets [target_name] = (tabela1.interrupt_targets [target_name] or 0) - amount end --> soma o container de habilidades - for spellid, habilidade in _pairs (tabela2.interrupt_spell_tables._ActorTable) do - --> pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.interrupt_spell_tables:PegaHabilidade (spellid, true, nil, false) - --> soma o que essa habilidade interrompeu + for spellid, habilidade in _pairs (tabela2.interrupt_spells._ActorTable) do + local habilidade_tabela1 = tabela1.interrupt_spells:PegaHabilidade (spellid, true, nil, false) + habilidade_tabela1.interrompeu_oque = habilidade_tabela1.interrompeu_oque or {} for _spellid, amount in _pairs (habilidade.interrompeu_oque) do - if (habilidade_tabela1.interrompeu_oque [_spellid]) then - habilidade_tabela1.interrompeu_oque [_spellid] = habilidade_tabela1.interrompeu_oque [_spellid] - amount - else - habilidade_tabela1.interrompeu_oque [_spellid] = amount - end + habilidade_tabela1.interrompeu_oque [_spellid] = (habilidade_tabela1.interrompeu_oque [_spellid] or 0) - amount end - --> soma os alvos - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) - end - + end end - if (tabela2.buff_uptime) then - + if (tabela2.buff_uptime) then tabela1.buff_uptime = tabela1.buff_uptime - tabela2.buff_uptime - for index, alvo in _ipairs (tabela2.buff_uptime_targets._ActorTable) do - local alvo_tabela1 = tabela1.buff_uptime_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.buff_uptime_targets) do + tabela1.buff_uptime_targets [target_name] = (tabela1.buff_uptime_targets [target_name] or 0) - amount end - for spellid, habilidade in _pairs (tabela2.buff_uptime_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.buff_uptime_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.buff_uptime_spells._ActorTable) do + local habilidade_tabela1 = tabela1.buff_uptime_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) - end - + end end - if (tabela2.debuff_uptime) then - + if (tabela2.debuff_uptime) then tabela1.debuff_uptime = tabela1.debuff_uptime - tabela2.debuff_uptime - for index, alvo in _ipairs (tabela2.debuff_uptime_targets._ActorTable) do - local alvo_tabela1 = tabela1.debuff_uptime_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total - if (alvo.uptime) then --> boss debuff - alvo_tabela1.uptime = alvo_tabela1.uptime - alvo.uptime - alvo_tabela1.activedamt = alvo_tabela1.activedamt - alvo.activedamt + for target_name, amount in _pairs (tabela2.debuff_uptime_targets) do + if (_type (amount) == "table") then --> boss debuff + local t = tabela1.debuff_uptime_targets [target_name] + if (not t) then + tabela1.debuff_uptime_targets [target_name] = atributo_misc:CreateBuffTargetObject() + t = tabela1.debuff_uptime_targets [target_name] + end + t.uptime = t.uptime - amount.uptime + t.activedamt = t.activedamt - amount.activedamt + else + tabela2.debuff_uptime_targets [target_name] = (tabela2.debuff_uptime_targets [target_name] or 0) - amount end end - for spellid, habilidade in _pairs (tabela2.debuff_uptime_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.debuff_uptime_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.debuff_uptime_spells._ActorTable) do + local habilidade_tabela1 = tabela1.debuff_uptime_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) end - end - if (tabela2.cooldowns_defensive) then - + if (tabela2.cooldowns_defensive) then tabela1.cooldowns_defensive = tabela1.cooldowns_defensive - tabela2.cooldowns_defensive - for index, alvo in _ipairs (tabela2.cooldowns_defensive_targets._ActorTable) do - local alvo_tabela1 = tabela1.cooldowns_defensive_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.cooldowns_defensive_targets) do + tabela1.cooldowns_defensive_targets [target_name] = (tabela1.cooldowns_defensive_targets [target_name] or 0) - amount end - for spellid, habilidade in _pairs (tabela2.cooldowns_defensive_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.cooldowns_defensive_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.cooldowns_defensive_spells._ActorTable) do + local habilidade_tabela1 = tabela1.cooldowns_defensive_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) - end - + end end if (tabela2.ress) then - tabela1.ress = tabela1.ress - tabela2.ress - for index, alvo in _ipairs (tabela2.ress_targets._ActorTable) do - local alvo_tabela1 = tabela1.ress_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.ress_targets) do + tabela1.ress_targets [target_name] = (tabela1.ress_targets [target_name] or 0) - amount end - for spellid, habilidade in _pairs (tabela2.ress_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.ress_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.ress_spells._ActorTable) do + local habilidade_tabela1 = tabela1.ress_spells:PegaHabilidade (spellid, true, nil, false) - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) - end - + end end if (tabela2.dispell) then - tabela1.dispell = tabela1.dispell - tabela2.dispell - for index, alvo in _ipairs (tabela2.dispell_targets._ActorTable) do - local alvo_tabela1 = tabela1.dispell_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.dispell_targets) do + tabela1.dispell_targets [target_name] = (tabela1.dispell_targets [target_name] or 0) - amount end - for spellid, habilidade in _pairs (tabela2.dispell_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.dispell_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.dispell_spells._ActorTable) do + local habilidade_tabela1 = tabela1.dispell_spells:PegaHabilidade (spellid, true, nil, false) habilidade_tabela1.dispell_oque = habilidade_tabela1.dispell_oque or {} for _spellid, amount in _pairs (habilidade.dispell_oque) do - if (habilidade_tabela1.dispell_oque [_spellid]) then - habilidade_tabela1.dispell_oque [_spellid] = habilidade_tabela1.dispell_oque [_spellid] - amount - else - habilidade_tabela1.dispell_oque [_spellid] = amount - end + habilidade_tabela1.dispell_oque [_spellid] = (habilidade_tabela1.dispell_oque [_spellid] or 0) - amount end - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) end for spellid, amount in _pairs (tabela2.dispell_oque) do - if (not tabela1.dispell_oque [spellid]) then - tabela1.dispell_oque [spellid] = 0 - end - tabela1.dispell_oque [spellid] = tabela1.dispell_oque [spellid] - amount + tabela1.dispell_oque [spellid] = (tabela1.dispell_oque [spellid] or 0) - amount end - end if (tabela2.cc_break) then tabela1.cc_break = tabela1.cc_break - tabela2.cc_break - for index, alvo in _ipairs (tabela2.cc_break_targets._ActorTable) do - local alvo_tabela1 = tabela1.cc_break_targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (tabela2.cc_break_targets) do + tabela1.cc_break_targets [target_name] = (tabela1.cc_break_targets [target_name] or 0) - amount end - for spellid, habilidade in _pairs (tabela2.cc_break_spell_tables._ActorTable) do - local habilidade_tabela1 = tabela1.cc_break_spell_tables:PegaHabilidade (spellid, true, nil, false) + for spellid, habilidade in _pairs (tabela2.cc_break_spells._ActorTable) do + local habilidade_tabela1 = tabela1.cc_break_spells:PegaHabilidade (spellid, true, nil, false) habilidade_tabela1.cc_break_oque = habilidade_tabela1.cc_break_oque or {} for _spellid, amount in _pairs (habilidade.cc_break_oque) do - if (habilidade_tabela1.cc_break_oque [_spellid]) then - habilidade_tabela1.cc_break_oque [_spellid] = habilidade_tabela1.cc_break_oque [_spellid] - amount - else - habilidade_tabela1.cc_break_oque [_spellid] = amount - end + habilidade_tabela1.cc_break_oque [_spellid] = (habilidade_tabela1.cc_break_oque [_spellid] or 0) - amount end - for index, alvo in _ipairs (habilidade.targets._ActorTable) do - local alvo_tabela1 = habilidade_tabela1.targets:PegarCombatente (nil, alvo.nome, nil, true) - alvo_tabela1.total = alvo_tabela1.total - alvo.total + for target_name, amount in _pairs (habilidade.targets) do + habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount end subtrair_keys (habilidade, habilidade_tabela1) end - for spellid, amount in _pairs (tabela2.cc_break_oque) do - if (not tabela1.cc_break_oque [spellid]) then - tabela1.cc_break_oque [spellid] = 0 - end - tabela1.cc_break_oque [spellid] = tabela1.cc_break_oque [spellid] - amount + for spellid, amount in _pairs (tabela2.cc_break_oque) do + tabela1.cc_break_oque [spellid] = (tabela1.cc_break_oque [spellid] or 0) - amount end end diff --git a/classes/classe_others_habilidade.lua b/classes/classe_others_habilidade.lua index ad0a4f7a..8bcd7268 100644 --- a/classes/classe_others_habilidade.lua +++ b/classes/classe_others_habilidade.lua @@ -26,7 +26,7 @@ local _newMiscSpell = { id = id, counter = 0, - targets = container_combatentes:NovoContainer (container_misc_target) + targets = {} } if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then @@ -40,12 +40,6 @@ elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then _newMiscSpell.cc_break_oque = {} end - - _setmetatable (_newMiscSpell, habilidade_misc) - - if (link) then - _newMiscSpell.targets.shadow = link.targets - end return _newMiscSpell end @@ -56,15 +50,8 @@ if (spellName == "COOLDOWN") then self.counter = self.counter + 1 - - --> alvo - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end - alvo.total = alvo.total + 1 + --> target + self.targets [nome] = (self.targets [nome] or 0) + 1 elseif (spellName == "BUFF_UPTIME_REFRESH") then if (self.actived_at and self.actived) then @@ -122,45 +109,23 @@ elseif (token == "SPELL_INTERRUPT") then self.counter = self.counter + 1 - - if (not self.interrompeu_oque [spellID]) then --> interrompeu_oque a NIL value + + if (not self.interrompeu_oque [spellID]) then self.interrompeu_oque [spellID] = 1 else self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1 end - --alvo - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end - alvo.total = alvo.total + 1 + --> target + self.targets [nome] = (self.targets [nome] or 0) + 1 elseif (token == "SPELL_RESURRECT") then - if (not self.ress) then - self.ress = 1 - else - self.ress = self.ress + 1 - end - - --alvo - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end - alvo.total = alvo.total + 1 - + self.ress = (self.ress or 0) + 1 + --> target + self.targets [nome] = (self.targets [nome] or 0) + 1 elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then - if (not self.dispell) then - self.dispell = 1 - else - self.dispell = self.dispell + 1 - end + self.dispell = (self.dispell or 0) + 1 if (not self.dispell_oque [spellID]) then self.dispell_oque [spellID] = 1 @@ -168,23 +133,11 @@ self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1 end - --alvo - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end - alvo.total = alvo.total + 1 - + --> target + self.targets [nome] = (self.targets [nome] or 0) + 1 elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then - - if (not self.cc_break) then - self.cc_break = 1 - else - self.cc_break = self.cc_break + 1 - end + self.cc_break = (self.cc_break or 0) + 1 if (not self.cc_break_oque [spellID]) then self.cc_break_oque [spellID] = 1 @@ -192,65 +145,8 @@ self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1 end - --alvo - local alvo = self.targets._NameIndexTable [nome] - if (not alvo) then - alvo = self.targets:PegarCombatente (serial, nome, flag, true) - else - alvo = self.targets._ActorTable [alvo] - end - alvo.total = alvo.total + 1 + --> target + self.targets [nome] = (self.targets [nome] or 0) + 1 end end - ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---> core - - function _detalhes.refresh:r_habilidade_misc (habilidade, shadow) --recebeu o container shadow - _setmetatable (habilidade, habilidade_misc) - habilidade.__index = habilidade_misc - - if (shadow ~= -1) then - habilidade.shadow = shadow._ActorTable[habilidade.id] - _detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets) - else - _detalhes.refresh:r_container_combatentes (habilidade.targets, -1) - end - end - - function _detalhes.clear:c_habilidade_misc (habilidade) - --habilidade.__index = {} - habilidade.__index = nil - habilidade.shadow = nil - - _detalhes.clear:c_container_combatentes (habilidade.targets) - end - - habilidade_misc.__sub = function (tabela1, tabela2) - - --interrupts & cooldowns - tabela1.counter = tabela1.counter - tabela2.counter - - --buff uptime ou debuff uptime - if (tabela1.uptime and tabela2.uptime) then - tabela1.uptime = tabela1.uptime - tabela2.uptime - end - - --ressesrs - if (tabela1.ress and tabela2.ress) then - tabela1.ress = tabela1.ress - tabela2.ress - end - - --dispells - if (tabela1.dispell and tabela2.dispell) then - tabela1.dispell = tabela1.dispell - tabela2.dispell - end - - --cc_breaks - if (tabela1.cc_break and tabela2.cc_break) then - tabela1.cc_break = tabela1.cc_break - tabela2.cc_break - end - - return tabela1 - end diff --git a/classes/container_combatentes.lua b/classes/container_combatentes.lua index 64071ab6..b891caad 100644 --- a/classes/container_combatentes.lua +++ b/classes/container_combatentes.lua @@ -294,7 +294,7 @@ end end - local novo_objeto = self.funcao_de_criacao (_, serial, nome, shadow_objeto) --> shadow_objeto passa para o classe_damage gravar no .targets e .spell_tables, mas não grava nele mesmo + local novo_objeto = self.funcao_de_criacao (_, serial, nome, shadow_objeto) --> shadow_objeto passa para o classe_damage gravar no .targets e .spells, mas não grava nele mesmo novo_objeto.nome = nome -- tipo do container @@ -311,7 +311,6 @@ if (shadow_objeto) then novo_objeto.shadow = shadow_objeto - novo_objeto:CriaLink (shadow_objeto) --> criando o link if (novo_objeto.grupo and _detalhes.in_combat) then _detalhes.cache_damage_group [#_detalhes.cache_damage_group+1] = novo_objeto end @@ -343,7 +342,6 @@ if (shadow_objeto) then novo_objeto.shadow = shadow_objeto - novo_objeto:CriaLink (shadow_objeto) --> criando o link if (novo_objeto.grupo and _detalhes.in_combat) then _detalhes.cache_healing_group [#_detalhes.cache_healing_group+1] = novo_objeto end @@ -372,7 +370,6 @@ if (shadow_objeto) then novo_objeto.shadow = shadow_objeto - novo_objeto:CriaLink (shadow_objeto) --> criando o link end if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player @@ -399,7 +396,6 @@ if (shadow_objeto) then novo_objeto.shadow = shadow_objeto - novo_objeto:CriaLink (shadow_objeto) --> criando o link end if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player @@ -414,17 +410,7 @@ end elseif (self.tipo == container_damage_target) then --> CONTAINER ALVO DO DAMAGE - if (shadow_objeto) then - novo_objeto.shadow = shadow_objeto - end - elseif (self.tipo == container_heal_target) then --> CONTAINER ALVOS DO HEALING - novo_objeto.overheal = 0 - novo_objeto.absorbed = 0 - if (shadow_objeto) then - novo_objeto.shadow = shadow_objeto - end - elseif (self.tipo == container_energy_target) then --> CONTAINER ALVOS DO ENERGY novo_objeto.mana = 0 @@ -489,9 +475,6 @@ elseif (tipo == container_heal) then return atributo_heal.NovaTabela - elseif (tipo == container_friendlyfire) then - return atributo_damage.FF_funcao_de_criacao - elseif (tipo == container_enemydebufftarget_target) then return alvo_da_habilidade.NovaTabela diff --git a/classes/container_habilidades.lua b/classes/container_habilidades.lua index 11d32286..1f85ea98 100644 --- a/classes/container_habilidades.lua +++ b/classes/container_habilidades.lua @@ -57,29 +57,7 @@ local _ else if (criar) then - if (cria_shadow) then - local novo_objeto = self.funcao_de_criacao (nil, id, nil, "") - self._ActorTable [id] = novo_objeto - return novo_objeto - end - - local shadow = self.shadow - local shadow_objeto = nil - - if (shadow) then - --> apenas verifica se ele existe ou não - shadow_objeto = shadow:PegaHabilidade (id) - --> se não existir, cria-lo - if (not shadow_objeto) then - shadow_objeto = shadow:PegaHabilidade (id, true, token) - end - end - local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token) - - if (shadow_objeto) then - novo_objeto.shadow = shadow_objeto - end self._ActorTable [id] = novo_objeto diff --git a/classes/custom_damage_done.lua b/classes/custom_damage_done.lua index c9ea7656..d82f7e91 100644 --- a/classes/custom_damage_done.lua +++ b/classes/custom_damage_done.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> attributes functions for customs ---> DAMAGE DONE +--> DAMAGEDONE --> customized display script @@ -49,9 +49,59 @@ TooltipMaximizedMethod = _detalhes.tooltip.maximize_method end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> damage done tooltip + local temp_table = {} + local target_func = function (main_table) + local i = 1 + for name, amount in _pairs (main_table) do + local t = temp_table [i] + if (not t) then + t = {"", 0} + temp_table [i] = t + end + + t[1] = name + t[2] = amount + + i = i + 1 + end + end + + local spells_used_func = function (main_table, target) + local i = 1 + for spellid, spell_table in _pairs (main_table) do + local target_amount = spell_table.targets [target] + if (target_amount) then + local t = temp_table [i] + if (not t) then + t = {"", 0} + temp_table [i] = t + end + + t[1] = spellid + t[2] = target_amount + + i = i + 1 + end + end + end + + local function SortOrder (main_table, func, ...) + for i = 1, #temp_table do + temp_table [i][1] = "" + temp_table [i][2] = 0 + end + + func (main_table, ...) + + _table_sort (temp_table, _detalhes.Sort2) + + return temp_table + end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> damagedone tooltip + function atributo_custom:damagedoneTooltip (actor, target, spellid, combat, instance) if (spellid) then @@ -64,12 +114,11 @@ for name, _ in _pairs (this_actor.damage_from) do local aggressor = combat (1, name) if (aggressor) then - local spell = aggressor.spell_tables._ActorTable [spellid] + local spell = aggressor.spells._ActorTable [spellid] if (spell) then - local on_me = spell.targets._NameIndexTable [targetname] + local on_me = spell.targets [targetname] if (on_me) then - on_me = spell.targets._ActorTable [on_me] - GameCooltip:AddLine (aggressor.nome, FormatTooltipNumber (_, on_me.total)) + GameCooltip:AddLine (aggressor.nome, FormatTooltipNumber (_, on_me)) end end end @@ -90,52 +139,56 @@ elseif (target) then if (target == "[all]") then - actor.targets:SortByKey ("total") - for _, target_object in _ipairs (actor.targets._ActorTable) do - GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + SortOrder (actor.targets, target_func) + + for i = 1, #temp_table do + local t = temp_table [i] + if (t[2] < 1) then + break + end + + GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2])) _detalhes:AddTooltipBackgroundStatusbar() GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14) end elseif (target == "[raid]") then local roster = combat.raid_roster - actor.targets:SortByKey ("total") - for _, target_object in _ipairs (actor.targets._ActorTable) do - if (roster [target_object.nome]) then - GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + + SortOrder (actor.targets, target_func) + + for i = 1, #temp_table do + local t = temp_table [i] + + if (t[2] < 1) then + break + end + + if (roster [t[1]]) then + GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2])) end end elseif (target == "[player]") then - local targetactor = actor.targets._NameIndexTable [_detalhes.playername] - if (targetactor) then - targetactor = actor.targets._ActorTable [targetactor] - GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, targetactor.total)) + local target_amount = actor.targets [_detalhes.playername] + if (target_amount) then + GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, target_amount)) end else - local spells_used = {} + SortOrder (actor.spells._ActorTable, spells_used_func, target) + + for i = 1, #temp_table do - for spellid, spelltable in _pairs (actor.spell_tables._ActorTable) do - local this_target = spelltable.targets._NameIndexTable [target] - if (this_target) then - this_target = spelltable.targets._ActorTable [this_target] - _table_insert (spells_used, {spellid, this_target.total}) + local t = temp_table [i] + + if (t[2] < 1) then + break end - end - - _table_sort (spells_used, _detalhes.Sort2) - - for index, spell in _ipairs (spells_used) do - local name, _, icon = _GetSpellInfo (spell [1]) - GameCooltip:AddLine (name, FormatTooltipNumber (_, spell [2])) + + local name, _, icon = _GetSpellInfo (t[1]) + GameCooltip:AddLine (name, FormatTooltipNumber (_, t[2])) GameCooltip:AddIcon (icon, 1, 1, 14, 14) end - - --local targetactor = actor.targets._NameIndexTable [target] - --if (targetactor) then - -- targetactor = actor.targets._ActorTable [targetactor] - -- GameCooltip:AddLine (target, FormatTooltipNumber (_, targetactor.total)) - --end end else @@ -144,22 +197,25 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---> damage done search +--> damagedone search function atributo_custom:damagedone (actor, source, target, spellid, combat, instance_container) - if (spellid) then --> spell is always damage done - local spell = actor.spell_tables._ActorTable [spellid] + if (spellid) then --> spell is always damagedone + local spell = actor.spells._ActorTable [spellid] if (spell) then if (target) then if (target == "[all]") then - for _, targetactor in _ipairs (spell.targets._ActorTable) do + for target_name, amount in _pairs (spell.targets) do --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + + --> we need to pass a object here in order to get name and class, so we just get the main damage actor from the combat + instance_container:AddValue (combat (1, target_name), amount, true) + -- + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [target_name]) then + atributo_custom._TargetActorsProcessed [target_name] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end @@ -167,14 +223,14 @@ elseif (target == "[raid]") then local roster = combat.raid_roster - for _, targetactor in _ipairs (spell.targets._ActorTable) do - if (roster [targetactor.nome]) then + for target_name, amount in _pairs (spell.targets) do + if (roster [target_name]) then --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + instance_container:AddValue (combat (1, target_name), amount, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [target_name]) then + atributo_custom._TargetActorsProcessed [target_name] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end @@ -182,30 +238,28 @@ return 0, true elseif (target == "[player]") then - local targetactor = spell.targets._NameIndexTable [_detalhes.playername] - if (targetactor) then - targetactor = spell.targets._ActorTable [targetactor] + local target_amount = spell.targets [_detalhes.playername] + if (target_amount) then --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + instance_container:AddValue (combat (1, _detalhes.playername), target_amount, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [_detalhes.playername]) then + atributo_custom._TargetActorsProcessed [_detalhes.playername] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end return 0, true else - local targetactor = actor.targets._NameIndexTable [target] - if (targetactor) then - targetactor = spell.targets._ActorTable [targetactor] + local target_amount = actor.targets [target] + if (target_amount) then --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + instance_container:AddValue (combat (1, target), target_amount, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [target]) then + atributo_custom._TargetActorsProcessed [target] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end @@ -221,26 +275,27 @@ elseif (target) then if (target == "[all]") then - return actor.targets:GetTotal() + local total = 0 + for target_name, amount in _pairs (actor.targets) do + total = total + amount + end + return total elseif (target == "[raid]") then - return actor.targets:GetTotalOnRaid (nil, combat) + local total = 0 + for target_name, amount in _pairs (actor.targets) do + if (combat.raid_roster [target_name]) then + total = total + amount + end + end + return total elseif (target == "[player]") then - local targetactor = actor.targets._NameIndexTable [_detalhes.playername] - if (targetactor) then - return actor.targets._ActorTable [targetactor].total - else - return 0 - end + return actor.targets [_detalhes.playername] or 0 else - local targetactor = actor.targets._NameIndexTable [target] - if (targetactor) then - return actor.targets._ActorTable [targetactor].total - else - return 0 - end + return actor.targets [targetactor] or 0 + end else return actor.total or 0 diff --git a/classes/custom_healing_done.lua b/classes/custom_healing_done.lua index 3282fc11..383bb6f6 100644 --- a/classes/custom_healing_done.lua +++ b/classes/custom_healing_done.lua @@ -49,9 +49,60 @@ TooltipMaximizedMethod = _detalhes.tooltip.maximize_method end + local temp_table = {} + + local target_func = function (main_table) + local i = 1 + for name, amount in _pairs (main_table) do + local t = temp_table [i] + if (not t) then + t = {"", 0} + temp_table [i] = t + end + + t[1] = name + t[2] = amount + + i = i + 1 + end + end + + local spells_used_func = function (main_table, target) + local i = 1 + for spellid, spell_table in _pairs (main_table) do + local target_amount = spell_table.targets [target] + if (target_amount) then + local t = temp_table [i] + if (not t) then + t = {"", 0} + temp_table [i] = t + end + + t[1] = spellid + t[2] = target_amount + + i = i + 1 + end + end + end + + local function SortOrder (main_table, func, ...) + for i = 1, #temp_table do + temp_table [i][1] = "" + temp_table [i][2] = 0 + end + + func (main_table, ...) + + _table_sort (temp_table, _detalhes.Sort2) + + return temp_table + end + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> healing done tooltip + function atributo_custom:healdoneTooltip (actor, target, spellid, combat, instance) if (spellid) then @@ -64,12 +115,11 @@ for name, _ in _pairs (this_actor.healing_from) do local healer = combat (2, name) if (healer) then - local spell = healer.spell_tables._ActorTable [spellid] + local spell = healer.spells._ActorTable [spellid] if (spell) then - local on_me = spell.targets._NameIndexTable [targetname] + local on_me = spell.targets [targetname] if (on_me) then - on_me = spell.targets._ActorTable [on_me] - GameCooltip:AddLine (healer.nome, FormatTooltipNumber (_, on_me.total)) + GameCooltip:AddLine (healer.nome, FormatTooltipNumber (_, on_me)) end end end @@ -90,38 +140,61 @@ elseif (target) then if (target == "[all]") then - actor.targets:SortByKey ("total") - for _, target_object in _ipairs (actor.targets._ActorTable) do - GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + SortOrder (actor.targets, target_func) + + for i = 1, #temp_table do + local t = temp_table [i] + if (t[2] < 1) then + break + end + + GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2])) _detalhes:AddTooltipBackgroundStatusbar() GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14) end elseif (target == "[raid]") then local roster = combat.raid_roster - actor.targets:SortByKey ("total") - for _, target_object in _ipairs (actor.targets._ActorTable) do - if (roster [target_object.nome]) then - GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + + SortOrder (actor.targets, target_func) + + for i = 1, #temp_table do + local t = temp_table [i] + + if (t[2] < 1) then + break + end + + if (roster [t[1]]) then + GameCooltip:AddLine (t[1], FormatTooltipNumber (_, t[2])) end end elseif (target == "[player]") then - local targetactor = actor.targets._NameIndexTable [_detalhes.playername] - if (targetactor) then - targetactor = actor.targets._ActorTable [targetactor] - GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, targetactor.total)) + local target_amount = actor.targets [_detalhes.playername] + if (target_amount) then + GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, target_amount)) end + else - local targetactor = actor.targets._NameIndexTable [target] - if (targetactor) then - targetactor = actor.targets._ActorTable [targetactor] - GameCooltip:AddLine (target, FormatTooltipNumber (_, targetactor.total)) + SortOrder (actor.spells._ActorTable, spells_used_func, target) + + for i = 1, #temp_table do + + local t = temp_table [i] + + if (t[2] < 1) then + break + end + + local name, _, icon = _GetSpellInfo (t[1]) + GameCooltip:AddLine (name, FormatTooltipNumber (_, t[2])) + GameCooltip:AddIcon (icon, 1, 1, 14, 14) end end else - actor:ToolTip_DamageDone (instance) + actor:ToolTip_HealingDone (instance) end end @@ -131,18 +204,21 @@ function atributo_custom:healdone (actor, source, target, spellid, combat, instance_container) if (spellid) then --> spell is always healing done - local spell = actor.spell_tables._ActorTable [spellid] - local melee = actor.spell_tables._ActorTable [1] + local spell = actor.spells._ActorTable [spellid] + local melee = actor.spells._ActorTable [1] if (spell) then if (target) then if (target == "[all]") then - for _, targetactor in _ipairs (spell.targets._ActorTable) do + for target_name, amount in _pairs (spell.targets) do --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + + --> we need to pass a object here in order to get name and class, so we just get the main heal actor from the combat + instance_container:AddValue (combat (1, target_name), amount, true) + -- + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [target_name]) then + atributo_custom._TargetActorsProcessed [target_name] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end @@ -150,14 +226,14 @@ elseif (target == "[raid]") then local roster = combat.raid_roster - for _, targetactor in _ipairs (spell.targets._ActorTable) do - if (roster [targetactor.nome]) then + for target_name, amount in _pairs (spell.targets) do + if (roster [target_name]) then --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + instance_container:AddValue (combat (1, target_name), amount, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [target_name]) then + atributo_custom._TargetActorsProcessed [target_name] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end @@ -165,30 +241,28 @@ return 0, true elseif (target == "[player]") then - local targetactor = spell.targets._NameIndexTable [_detalhes.playername] - if (targetactor) then - targetactor = spell.targets._ActorTable [targetactor] + local target_amount = spell.targets [_detalhes.playername] + if (target_amount) then --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + instance_container:AddValue (combat (1, _detalhes.playername), target_amount, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [_detalhes.playername]) then + atributo_custom._TargetActorsProcessed [_detalhes.playername] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end return 0, true else - local targetactor = actor.targets._NameIndexTable [target] - if (targetactor) then - targetactor = spell.targets._ActorTable [targetactor] + local target_amount = actor.targets [target] + if (target_amount) then --> add amount - instance_container:AddValue (targetactor, targetactor.total, true) - atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + instance_container:AddValue (combat (1, target), target_amount, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + target_amount --> add to processed container - if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then - atributo_custom._TargetActorsProcessed [targetactor.nome] = true + if (not atributo_custom._TargetActorsProcessed [target]) then + atributo_custom._TargetActorsProcessed [target] = true atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 end end @@ -204,26 +278,26 @@ elseif (target) then if (target == "[all]") then - return actor.targets:GetTotal() + local total = 0 + for target_name, amount in _pairs (actor.targets) do + total = total + amount + end + return total elseif (target == "[raid]") then - return actor.targets:GetTotalOnRaid (nil, combat) + local total = 0 + for target_name, amount in _pairs (actor.targets) do + if (combat.raid_roster [target_name]) then + total = total + amount + end + end + return total elseif (target == "[player]") then - local targetactor = actor.targets._NameIndexTable [_detalhes.playername] - if (targetactor) then - return actor.targets._ActorTable [targetactor].total - else - return 0 - end + return actor.targets [_detalhes.playername] or 0 else - local targetactor = actor.targets._NameIndexTable [target] - if (targetactor) then - return actor.targets._ActorTable [targetactor].total - else - return 0 - end + return actor.targets [targetactor] or 0 end else return actor.total or 0 diff --git a/core/control.lua b/core/control.lua index dd1a0949..83127c11 100644 --- a/core/control.lua +++ b/core/control.lua @@ -59,7 +59,7 @@ for _, actor in _ipairs (_detalhes.tabela_vigente[class_type_dano]._ActorTable) do if (not actor.grupo and not actor.owner and not actor.nome:find ("[*]") and _bit_band (actor.flag_original, 0x00000060) ~= 0) then --> 0x20+0x40 neutral + enemy reaction - for name, _ in _pairs (actor.targets._NameIndexTable) do + for name, _ in _pairs (actor.targets) do if (name == _detalhes.playername) then return actor.nome else @@ -76,8 +76,8 @@ for _, actor in _ipairs (_detalhes.tabela_vigente[class_type_dano]._ActorTable) do if (actor.grupo and not actor.owner) then - for index, target in _ipairs (actor.targets._ActorTable) do - return target.nome + for target_name, _ in _pairs (actor.targets) do + return target_name end end @@ -88,7 +88,7 @@ -- try get the current encounter name during the encounter - local boss_found = function (index, name, zone, mapid, diff) + local boss_found = function (index, name, zone, mapid, diff, encounterid) local boss_table = { index = index, name = name, @@ -98,6 +98,7 @@ diff = diff, diff_string = select (4, GetInstanceInfo()), ej_instance_id = EJ_GetCurrentInstance(), + id = encounterid, } _detalhes.tabela_vigente.is_boss = boss_table @@ -156,7 +157,7 @@ if (_detalhes.encounter_table.name) then local encounter_table = _detalhes.encounter_table - return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff) + return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) end for index = 1, 5, 1 do @@ -192,7 +193,7 @@ if (_detalhes.encounter_table.name) then local encounter_table = _detalhes.encounter_table - return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff) + return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) end local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = _GetInstanceInfo() @@ -210,7 +211,9 @@ BossIndex = BossIds [serial] if (BossIndex) then Actor.boss = true - Actor.shadow.boss = true + if (Actor.shadow) then + Actor.shadow.boss = true + end return boss_found (BossIndex, _detalhes:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID) end end @@ -357,18 +360,6 @@ _detalhes:CatchRaidDebuffUptime ("DEBUFF_UPTIME_OUT") _detalhes:CloseEnemyDebuffsUptime() - --> ugly fix for warlocks soul link, need to rewrite friendly fire code. - for index, actor in pairs (_detalhes.tabela_vigente[1]._ActorTable) do - if (actor.classe == "WARLOCK") then - local soullink = actor.spell_tables._ActorTable [108446] - if (soullink) then - actor.total = actor.total - soullink.total - actor.total_without_pet = actor.total_without_pet - soullink.total - soullink.total = 0 - end - end - end - --> pega a zona do jogador e vê se foi uma luta contra um Boss -- identifica se a luta foi com um boss if (not _detalhes.tabela_vigente.is_boss) then @@ -451,6 +442,14 @@ if (bossKilled) then _detalhes.tabela_vigente.is_boss.killed = true + + --> add to storage + if (not InCombatLockdown() and not UnitAffectingCombat ("player")) then + pcall (_detalhes.StoreEncounter) + else + _detalhes.schedule_store_boss_encounter = true + end + end --if (_detalhes:GetBossDetails (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index) or ) then @@ -888,14 +887,14 @@ for _, actor in _ipairs (container._ActorTable) do if (actor.grupo) then if (class_type == 1 or class_type == 2) then - for _, target_actor in _ipairs (actor.targets._ActorTable) do - local target_object = container._ActorTable [container._NameIndexTable [target_actor.nome]] + for target_name, amount in _pairs (actor.targets) do + local target_object = container._ActorTable [container._NameIndexTable [target_name]] if (target_object) then target_object.fight_component = true if (target_object.shadow) then target_object.shadow.fight_component = true end - fight_component (energy_container, misc_container, target_actor.nome) + fight_component (energy_container, misc_container, target_name) end end if (class_type == 1) then diff --git a/core/gears.lua b/core/gears.lua index fe61a8bd..c96bcf92 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -1,6 +1,9 @@ local _detalhes = _G._detalhes local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) +local UnitName = UnitName +local select = select +local floor = floor local GetNumGroupMembers = GetNumGroupMembers @@ -203,3 +206,120 @@ function _detalhes:DoBackgroundTasks() end _detalhes.background_tasks_loop = _detalhes:ScheduleRepeatingTimer ("DoBackgroundTasks", 120) + +local store_instances = { + [1205] = true, --Blackrock Foundry + [1228] = true, --Highmaul + [1136] = true, --SoO +} + +function _detalhes:StoreEncounter (combat) + + combat = combat or _detalhes.tabela_vigente + + if (not combat) then + return + end + + local name, type, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo() + + if (not store_instances [mapID]) then + return + end + + --> check if is a mythic encounter + local diff = combat:GetDifficulty() + if (difficulty ~= 16) then + --if (diff ~= 16 and false) then --> debug + return + end + + local boss_info = combat:GetBossInfo() + local encounter_id = boss_info and boss_info.id + if (not encounter_id) then + return + end + + --> check the guild name + local match = 0 + local guildName = select (1, GetGuildInfo ("player")) + local raid_size = GetNumGroupMembers() or 0 + + if (guildName) then + for i = 1, raid_size do + local gName = select (1, GetGuildInfo ("raid" .. i)) or "" + if (gName == guildName) then + match = match + 1 + end + end + + if (match < raid_size * 0.75) then + return + end + else + return + end + + --> check if the storage is already loaded + if (not IsAddOnLoaded ("Details_DataStorage")) then + local loaded, reason = LoadAddOn ("Details_DataStorage") + if (not loaded) then + return + end + end + + --> get the storage table + local db = DetailsDataStorage + + if (not db and _detalhes.CreateStorageDB) then + db = _detalhes:CreateStorageDB() + if (not db) then + return + end + end + + local raid_database = db.RAID_STORAGE + + if (not raid_database) then + db.RAID_STORAGE = {} + raid_database = db.RAID_STORAGE + end + + --> encounter_database: numeric table with combats + local encounter_database = raid_database [encounter_id] + + if (not encounter_database) then + raid_database [encounter_id] = {} + encounter_database = raid_database [encounter_id] + end + + --> get raid members data + local this_combat_data = { + damage = {}, + heal = {}, + date = date ("%H:%M %d/%m/%y"), + time = time(), + elapsed = combat:GetCombatTime(), + guild = guildName, + } + + for i = 1, raid_size do + local player_name, player_realm = UnitName ("raid" .. i) + if (player_realm and player_realm ~= "") then + player_name = player_name .. "-" .. player_realm + end + + local damage_actor = combat (1, player_name) + if (damage_actor) then + this_combat_data.damage [player_name] = floor (damage_actor.total) + end + + local heal_actor = combat (2, player_name) + if (heal_actor) then + this_combat_data.heal [player_name] = floor (heal_actor.total) + end + end + + tinsert (encounter_database, this_combat_data) + +end \ No newline at end of file diff --git a/core/meta.lua b/core/meta.lua index da6d63cc..78981cd1 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -1,8 +1,3 @@ ---File Revision: 1 ---Last Modification: 27/07/2013 --- Change Log: - -- 27/07/2013: Finished alpha version. - ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local _detalhes = _G._detalhes @@ -146,8 +141,6 @@ end end - --shadow:FazLinkagem (esta_classe) - end end @@ -266,16 +259,9 @@ local owner_actor = _combate (class_type, owner.nome) if (owner_actor) then if (owner.grupo or owner.boss or owner.boss_fight_component) then - --if (class_type == 1) then - -- print ("SAVE", _iter.data.nome, "| owner:",_iter.data.owner.nome, tabela_index) - --end can_erase = false end end - else - --if (class_type == 1) then - -- print ("DELETANDO", _iter.data.nome, tabela_index) - --end end end @@ -289,17 +275,13 @@ if (myself.grupo) then _combate.totals_grupo [myself.tipo] = _combate.totals_grupo [myself.tipo] - myself.total end + elseif (myself.tipo == class_type_e_energy) then - _combate.totals [myself.tipo] ["mana"] = _combate.totals [myself.tipo] ["mana"] - myself.mana - _combate.totals [myself.tipo] ["e_rage"] = _combate.totals [myself.tipo] ["e_rage"] - myself.e_rage - _combate.totals [myself.tipo] ["e_energy"] = _combate.totals [myself.tipo] ["e_energy"] - myself.e_energy - _combate.totals [myself.tipo] ["runepower"] = _combate.totals [myself.tipo] ["runepower"] - myself.runepower + _combate.totals [myself.tipo] [myself.powertype] = _combate.totals [myself.tipo] [myself.powertype] - myself.total if (myself.grupo) then - _combate.totals_grupo [myself.tipo] ["mana"] = _combate.totals_grupo [myself.tipo] ["mana"] - myself.mana - _combate.totals_grupo [myself.tipo] ["e_rage"] = _combate.totals_grupo [myself.tipo] ["e_rage"] - myself.e_rage - _combate.totals_grupo [myself.tipo] ["e_energy"] = _combate.totals_grupo [myself.tipo] ["e_energy"] - myself.e_energy - _combate.totals_grupo [myself.tipo] ["runepower"] = _combate.totals_grupo [myself.tipo] ["runepower"] - myself.runepower + _combate.totals_grupo [myself.tipo] [myself.powertype] = _combate.totals_grupo [myself.tipo] [myself.powertype] - myself.total end + elseif (myself.tipo == class_type_misc) then if (myself.cc_break) then _combate.totals [myself.tipo] ["cc_break"] = _combate.totals [myself.tipo] ["cc_break"] - myself.cc_break @@ -357,8 +339,7 @@ end for _, esta_classe in _ipairs (conteudo) do - - --> limpa o displayName, não precisa salvar + esta_classe.displayName = nil esta_classe.owner = nil @@ -370,138 +351,6 @@ _detalhes.clear:c_atributo_energy (esta_classe) elseif (class_type == class_type_misc) then _detalhes.clear:c_atributo_misc (esta_classe) - - if (esta_classe.interrupt) then - for _, _alvo in _ipairs (esta_classe.interrupt_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - - if (esta_classe.buff_uptime) then - for _, _alvo in _ipairs (esta_classe.buff_uptime_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - - if (esta_classe.debuff_uptime) then - for _, _alvo in _ipairs (esta_classe.debuff_uptime_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - - if (esta_classe.cooldowns_defensive) then - for _, _alvo in _ipairs (esta_classe.cooldowns_defensive_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - - if (esta_classe.ress) then - for _, _alvo in _ipairs (esta_classe.ress_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - - if (esta_classe.dispell) then - for _, _alvo in _ipairs (esta_classe.dispell_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - - if (esta_classe.cc_break) then - for _, _alvo in _ipairs (esta_classe.cc_break_targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (class_type ~= class_type_misc) then - for _, _alvo in _ipairs (esta_classe.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - - for _, habilidade in _pairs (esta_classe.spell_tables._ActorTable) do - if (class_type == class_type_dano) then - _detalhes.clear:c_habilidade_dano (habilidade) - elseif (class_type == class_type_cura) then - _detalhes.clear:c_habilidade_cura (habilidade) - elseif (class_type == class_type_e_energy) then - _detalhes.clear:c_habilidade_e_energy (habilidade) - end - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - else - if (esta_classe.interrupt) then - for _, habilidade in _pairs (esta_classe.interrupt_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (esta_classe.buff_uptime) then - for _, habilidade in _pairs (esta_classe.buff_uptime_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (esta_classe.debuff_uptime) then - for _, habilidade in _pairs (esta_classe.debuff_uptime_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (esta_classe.cooldowns_defensive) then - for _, habilidade in _pairs (esta_classe.cooldowns_defensive_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (esta_classe.ress) then - for _, habilidade in _pairs (esta_classe.ress_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (esta_classe.dispell) then - for _, habilidade in _pairs (esta_classe.dispell_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end - - if (esta_classe.cc_break) then - for _, habilidade in _pairs (esta_classe.cc_break_spell_tables._ActorTable) do - _detalhes.clear:c_habilidade_misc (habilidade) - - for _, _alvo in ipairs (habilidade.targets._ActorTable) do - _detalhes.clear:c_alvo_da_habilidade (_alvo) - end - end - end end end @@ -757,21 +606,6 @@ if (not _actor.owner) then --> pet _actor:subtract_total (_combate) end - - --> fix para a weak table - --[[ - local shadow = _actor.shadow - local _it = {index = 1, link = shadow.links [1]} - while (_it.link) do - if (_it.link == _actor) then - _table_remove (shadow.links, _it.index) - _it.link = shadow.links [_it.index] - else - _it.index = _it.index+1 - _it.link = shadow.links [_it.index] - end - end - --]] _iter.cleaned = _iter.cleaned+1 @@ -831,32 +665,13 @@ local _actor = _iter.data - --[[ - local meus_links = _rawget (_actor, "links") - local can_garbage = true - local new_weak_table = _setmetatable ({}, _detalhes.weaktable) --> precisa da nova weak table para remover os NILS da tabela antiga - - if (meus_links) then - for _, ref in _pairs (meus_links) do --> trocando pairs por _ipairs - if (ref) then - can_garbage = false - new_weak_table [#new_weak_table+1] = ref - end - end - _table_wipe (meus_links) - end - --]] - local can_garbage = false if (not _actor.grupo and not _actor.owner and not _actor.boss_fight_component and not _actor.fight_component) then can_garbage = true end - --if (can_garbage or not meus_links) then --> não há referências a este objeto if (can_garbage) then --> não há referências a este objeto - - --print ("garbaged:", _actor.nome) - + if (not _actor.owner) then --> pet _actor:subtract_total (_overall_combat) end @@ -864,20 +679,10 @@ --> apaga a referência deste jogador na tabela overall _iter.cleaned = _iter.cleaned+1 - --if (_detalhes.debug) then - -- if (#_actor.links > 0) then - -- _detalhes:Msg ("(debug) " .. _actor.nome, " has been garbaged but have links: ", #_actor.links) - -- end - --end - - if (_actor.tipo == 1 or _actor.tipo == 2) then - _actor:DesregistrarNaTimeMachine() - end _table_remove (conteudo, _iter.index) _iter.data = conteudo [_iter.index] else - --_actor.links = new_weak_table _iter.index = _iter.index + 1 _iter.data = conteudo [_iter.index] end diff --git a/core/network.lua b/core/network.lua index 0f5fceaa..7ba67033 100644 --- a/core/network.lua +++ b/core/network.lua @@ -257,17 +257,21 @@ --> register comm function _detalhes:CommReceived (_, data, _, source) + local prefix, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (data)) if (_detalhes.debug) then _detalhes:Msg ("(debug) network received:", prefix, "length:",string.len (data)) end + --print ("comm received", prefix, _detalhes.network.functions [prefix]) + local func = _detalhes.network.functions [prefix] if (func) then func (player, realm, dversion, arg6, arg7, arg8, arg9) else func = plugins_registred [prefix] + --print ("plugin comm?", func, player, realm, dversion, arg6, arg7, arg8, arg9) if (func) then func (player, realm, dversion, arg6, arg7, arg8, arg9) else @@ -311,6 +315,7 @@ end end + --[ function _detalhes.parser_functions:CHAT_MSG_CHANNEL (...) local message, _, _, _, _, _, _, _, channelName = ... if (channelName == "Details") then @@ -327,6 +332,7 @@ end end + --]] function _detalhes:SendPluginCommMessage (prefix, channel, ...) @@ -355,9 +361,11 @@ elseif (channel == "Details") then local id = _detalhes:GetChannelId (channel) if (id) then + if (not _detalhes.listener:IsEventRegistered ("CHAT_MSG_CHANNEL")) then + _detalhes.listener:RegisterEvent ("CHAT_MSG_CHANNEL") + end SendChatMessage (prefix .. "_" .. _detalhes:Serialize (self.__version, ...), "CHANNEL", nil, id) end - else _detalhes:SendCommMessage (prefix, _detalhes:Serialize (self.__version, ...), channel) end @@ -463,12 +471,50 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> sharer + local city_zones = { + ["ShattrathCity"] = true, + ["Dalaran"] = true, + + ["AshranHordeFactionHub"] = true, + ["AshranAllianceFactionHub"] = true, + + ["Orgrimmar"] = true, + ["Undercity"] = true, + ["ThunderBluff"] = true, + ["SilvermoonCity"] = true, + + ["StormwindCity"] = true, + ["Darnassus"] = true, + ["Ironforge"] = true, + ["TheExodar"] = true, + } + + local sub_zones = { + ["ShrineofTwoMoons"] = true, + ["ShrineofSevenStars"] = true, + } + + function _detalhes:IsInCity() + SetMapToCurrentZone() + local mapFileName, _, _, _, microDungeonMapName = GetMapInfo() + + if (city_zones [mapFileName]) then + return true + elseif (microDungeonMapName and type (microDungeonMapName) == "string" and sub_zones [microDungeonMapName]) then + return true + end + end + --> entrar no canal após logar no servidor function _detalhes:EnterChatChannel() if (not _detalhes.realm_sync) then return end + if (not _detalhes:IsInCity()) then + return + end + if (_detalhes.schedule_chat_leave) then _detalhes:CancelTimer (_detalhes.schedule_chat_leave) _detalhes.schedule_chat_leave = nil @@ -477,10 +523,6 @@ local realm = GetRealmName() realm = realm or "" - - --if (realm ~= "Azralon") then - -- return - --end --> room name local room_name = "Details" @@ -497,7 +539,6 @@ end --> enter - --print ("entrando no canal") JoinChannelByName (room_name) _detalhes.is_connected = true end @@ -516,10 +557,6 @@ local realm = GetRealmName() realm = realm or "" - --if (realm ~= "Azralon") then - -- return - --end - --> room name local room_name = "Details" local is_in = false @@ -533,7 +570,6 @@ end if (is_in) then - --print ("saindo do canal") LeaveChannelByName (room_name) end @@ -542,80 +578,40 @@ _detalhes.listener:UnregisterEvent ("CHAT_MSG_CHANNEL") end - --> sair do canal quando estiver em grupo - local event_handler = {Enabled = true, __enabled = true, teste = " teste"} - function event_handler:ZONE_TYPE_CHANGED (zone_type) - if (not _detalhes.realm_sync) then - return - end - - if (zone_type == "none") then - if (not _detalhes:InGroup()) then - if (_detalhes.schedule_chat_leave) then - _detalhes:CancelTimer (_detalhes.schedule_chat_leave) - end - if (not _detalhes.schedule_chat_enter) then - _detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 2) - end - end - else - if (_detalhes:InGroup()) then - if (_detalhes.schedule_chat_enter) then - _detalhes:CancelTimer (_detalhes.schedule_chat_enter) - end - if (not _detalhes.schedule_chat_leave) then - _detalhes.schedule_chat_leave = _detalhes:ScheduleTimer ("LeaveChatChannel", 2) - end - end - end - end - - function event_handler:GROUP_ONENTER() - if (not _detalhes.realm_sync) then - return - end - - if (_detalhes.zone_type ~= "none") then + function _detalhes:DoZoneCheck() + local in_city = _detalhes:IsInCity() + if (not in_city) then if (_detalhes.schedule_chat_enter) then _detalhes:CancelTimer (_detalhes.schedule_chat_enter) end if (not _detalhes.schedule_chat_leave) then - _detalhes.schedule_chat_leave = _detalhes:ScheduleTimer ("LeaveChatChannel", 2) + _detalhes.schedule_chat_leave = _detalhes:ScheduleTimer ("LeaveChatChannel", 5) + end + else + if (in_city) then + if (_detalhes.schedule_chat_leave) then + _detalhes:CancelTimer (_detalhes.schedule_chat_leave) + end + if (not _detalhes.schedule_chat_enter) then + _detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 5) + end end end end - function _detalhes:CheckChatOnLeaveGroup() + function _detalhes:CheckChatOnZoneChange() if (not _detalhes.realm_sync) then return end - - _detalhes.schedule_group_onleave_check = nil - if (_detalhes.zone_type == "none") then - if (_detalhes.schedule_chat_leave) then - _detalhes:CancelTimer (_detalhes.schedule_chat_leave) - end - if (not _detalhes.schedule_chat_enter) then - _detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 2) - end - end + _detalhes:ScheduleTimer ("DoZoneCheck", 2) end - function event_handler:GROUP_ONLEAVE() - if (not _detalhes.realm_sync) then - return - end - - if (_detalhes.schedule_group_onleave_check) then - _detalhes:CancelTimer (_detalhes.schedule_group_onleave_check) - _detalhes.schedule_group_onleave_check = nil - end - _detalhes.schedule_group_onleave_check = _detalhes:ScheduleTimer ("CheckChatOnLeaveGroup", 5) - end - - _detalhes:RegisterEvent (event_handler, "GROUP_ONENTER", "GROUP_ONENTER") - _detalhes:RegisterEvent (event_handler, "GROUP_ONLEAVE", "GROUP_ONLEAVE") - _detalhes:RegisterEvent (event_handler, "ZONE_TYPE_CHANGED", "ZONE_TYPE_CHANGED") function _detalhes:IsConnected() + if (not _detalhes.is_connected) then + local id = _detalhes:GetChannelId ("Details") + if (id) then + _detalhes.is_connected = true + end + end return _detalhes.is_connected end \ No newline at end of file diff --git a/core/parser.lua b/core/parser.lua index 2b790e12..816c445d 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -49,8 +49,12 @@ local container_habilidades = _detalhes.container_habilidades --details local local spell_damage_func = _detalhes.habilidade_dano.Add --details local + local spell_damageMiss_func = _detalhes.habilidade_dano.AddMiss --details local + local spell_damageFF_func = _detalhes.habilidade_dano.AddFF --details local + local spell_heal_func = _detalhes.habilidade_cura.Add --details local local spell_energy_func = _detalhes.habilidade_e_energy.Add --details local + local spell_misc_func = _detalhes.habilidade_misc.Add --details local --> current combat and overall pointers local _current_combat = _detalhes.tabela_vigente or {} --> placeholder table @@ -87,7 +91,6 @@ local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS - local container_enemydebufftarget_target = _detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS local OBJECT_TYPE_PLAYER = 0x00000400 local OBJECT_TYPE_PETS = 0x00003000 @@ -119,9 +122,6 @@ local _hook_battleress_container = _detalhes.hooks ["HOOK_BATTLERESS"] local _hook_interrupt_container = _detalhes.hooks ["HOOK_INTERRUPT"] - local _hook_buffs = false --[[REMOVED]] - local _hook_buffs_container = _detalhes.hooks ["HOOK_BUFF"] --[[REMOVED]] - ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> internal functions @@ -143,27 +143,13 @@ ------------------------------------------------------------------------------------------------ --> early checks and fixes - --[[ - if (who_name == "Quinel") then - if (isoffhand) then - print (spellname, isoffhand, "off hand") - end - if (multistrike) then - print (spellname, multistrike, "multistrike") - end - end - --]] - --if (spellid ~= 1) then - -- print (who_name, alvo_name, alvo_flags, spellname, amount) - --end - - if (who_serial == "0x0000000000000000") then + if (who_serial == "") then if (who_flags and _bit_band (who_flags, OBJECT_TYPE_PETS) ~= 0) then --> é um pet - --> pets must have an serial + --> pets must have a serial return end - who_serial = nil + --who_serial = nil end if (not alvo_name) then @@ -179,6 +165,10 @@ --if (npcId == 76933) then -- return --end + --using pattern, calling API is too slow here + if (alvo_serial:match ("^Creature:0:%d+:%d+:%d+:76933:%w+$")) then + return + end ------------------------------------------------------------------------------------------------ --> check if need start an combat @@ -435,24 +425,14 @@ t.n = i end - --> faz a adução do friendly fire + --> faz a adição do friendly fire este_jogador.friendlyfire_total = este_jogador.friendlyfire_total + amount - local amigo = este_jogador.friendlyfire._NameIndexTable [alvo_name] - if (not amigo) then - amigo = este_jogador.friendlyfire:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - amigo = este_jogador.friendlyfire._ActorTable [amigo] - end + local friend = este_jogador.friendlyfire [alvo_name] or este_jogador:CreateFFTable (alvo_name) - amigo.total = amigo.total + amount + friend.total = friend.total + amount + friend.spells [spellid] = (friend.spells [spellid] or 0) + amount - local spell = amigo.spell_tables._ActorTable [spellid] - if (not spell) then - spell = amigo.spell_tables:PegaHabilidade (spellid, true, token) - end - - return spell:AddFF (amount) --adiciona a classe da habilidade, a classe da habilidade se encarrega de adicionar aos alvos dela else _current_total [1] = _current_total [1]+amount @@ -466,14 +446,8 @@ meu_dono.total = meu_dono.total + amount --> e adiciona o dano ao pet --> add owner targets - local owner_target = meu_dono.targets._NameIndexTable [alvo_name] - if (not owner_target) then - owner_target = meu_dono.targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --retorna o objeto classe_target -> ALVO_DA_HABILIDADE:NovaTabela() - else - owner_target = meu_dono.targets._ActorTable [owner_target] - end - owner_target.total = owner_target.total + amount - + meu_dono.targets [alvo_name] = (meu_dono.targets [alvo_name] or 0) + amount + meu_dono.last_event = _tempo end @@ -484,24 +458,19 @@ este_jogador.total_without_pet = este_jogador.total_without_pet + amount --> actor targets - local este_alvo = este_jogador.targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --retorna o objeto classe_target -> ALVO_DA_HABILIDADE:NovaTabela() - else - este_alvo = este_jogador.targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + amount - + este_jogador.targets [alvo_name] = (este_jogador.targets [alvo_name] or 0) + amount + --> actor spells table - local spell = este_jogador.spell_tables._ActorTable [spellid] + local spell = este_jogador.spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.spells:PegaHabilidade (spellid, true, token) spell.spellschool = school end return spell_damage_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, resisted, blocked, absorbed, critical, glacing, token, multistrike, isoffhand) end + --function parser:swingmissed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, missType, isOffHand, amountMissed) function parser:swingmissed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, missType, isOffHand, multistrike, amountMissed) --, isOffHand, multistrike, amountMissed, arg1 return parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, 1, "Corpo-a-Corpo", 00000001, missType, isOffHand, multistrike, amountMissed) --, isOffHand, multistrike, amountMissed, arg1 end @@ -511,9 +480,7 @@ end function parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, missType, isOffHand, multistrike, amountMissed, arg1) - --print (spellname, spelltype, missType, isOffHand, amountMissed, arg1, arg2) - - + ------------------------------------------------------------------------------------------------ --> early checks and fixes @@ -523,6 +490,7 @@ ------------------------------------------------------------------------------------------------ --> get actors + --print ("MISS", "|", missType, "|", isOffHand, "|", multistrike, "|", amountMissed, "|", arg1) --> 'misser' local este_jogador = damage_cache [who_name] @@ -582,11 +550,12 @@ --> amount add --> actor spells table - local spell = este_jogador.spell_tables._ActorTable [spellid] + local spell = este_jogador.spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.spells:PegaHabilidade (spellid, true, token) end - return spell:AddMiss (alvo_serial, alvo_name, alvo_flags, who_name, missType) + return spell_damageMiss_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, missType) + --return spell:AddMiss (alvo_serial, alvo_name, alvo_flags, who_name, missType) end ----------------------------------------------------------------------------------------------------------------------------------------- @@ -630,9 +599,9 @@ } local ignored_shields = { - [142862] = true, --Ancient Barrier Malkorok - [114556] = true, --Purgatory (DK) - [115069] = true, -- Stance of the Sturdy Ox + [142862] = true, -- Ancient Barrier (Malkorok) + [114556] = true, -- Purgatory (DK) + [115069] = true, -- Stance of the Sturdy Ox (Monk) [20711] = true, -- Spirit of Redemption (Priest) } @@ -679,12 +648,12 @@ return end - --> check nil serial against pets - if (who_serial == "0x0000000000000000") then + --> check invalid serial against pets + if (who_serial == "") then if (who_flags and _bit_band (who_flags, OBJECT_TYPE_PETS) ~= 0) then --> é um pet return end - who_serial = nil + --who_serial = nil end --> no name, use spellname @@ -789,7 +758,7 @@ este_jogador:Iniciar (true) --inicia o hps do jogador - if (meu_dono and not meu_dono.dps_started) then + if (meu_dono and not meu_dono.iniciar_hps) then meu_dono:Iniciar (true) if (meu_dono.end_time) then meu_dono.end_time = nil @@ -809,48 +778,35 @@ --> add amount --> actor target - local este_alvo = este_jogador.targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.targets._ActorTable [este_alvo] - end - + if (cura_efetiva > 0) then --> combat total _current_total [2] = _current_total [2] + cura_efetiva - + + --> actor healing amount + este_jogador.total = este_jogador.total + cura_efetiva + este_jogador.total_without_pet = este_jogador.total_without_pet + cura_efetiva + --> healing taken jogador_alvo.healing_taken = jogador_alvo.healing_taken + cura_efetiva --> adiciona o dano tomado if (not jogador_alvo.healing_from [who_name]) then --> adiciona a pool de dano tomado de quem jogador_alvo.healing_from [who_name] = true end - - --> actor healing amount - este_jogador.total = este_jogador.total + cura_efetiva - + if (is_shield) then este_jogador.totalabsorb = este_jogador.totalabsorb + cura_efetiva + este_jogador.targets_absorbs [alvo_name] = (este_jogador.targets_absorbs [alvo_name] or 0) + cura_efetiva end - este_jogador.total_without_pet = este_jogador.total_without_pet + cura_efetiva - --> pet if (meu_dono) then meu_dono.total = meu_dono.total + cura_efetiva --> heal do pet - - local owner_target = meu_dono.targets._NameIndexTable [alvo_name] - if (not owner_target) then - owner_target = meu_dono.targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --retorna o objeto classe_target -> ALVO_DA_HABILIDADE:NovaTabela() - else - owner_target = meu_dono.targets._ActorTable [owner_target] - end - owner_target.total = owner_target.total + amount + meu_dono.targets [alvo_name] = (meu_dono.targets [alvo_name] or 0) + amount end --> target amount - este_alvo.total = este_alvo.total + cura_efetiva + este_jogador.targets [alvo_name] = (este_jogador.targets [alvo_name] or 0) + amount end if (meu_dono) then @@ -859,16 +815,17 @@ if (overhealing > 0) then este_jogador.totalover = este_jogador.totalover + overhealing - este_alvo.overheal = este_alvo.overheal + overhealing + este_jogador.targets_overheal [alvo_name] = (este_jogador.targets_overheal [alvo_name] or 0) + overhealing + if (meu_dono) then meu_dono.totalover = meu_dono.totalover + overhealing end end --> actor spells table - local spell = este_jogador.spell_tables._ActorTable [spellid] + local spell = este_jogador.spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.spells:PegaHabilidade (spellid, true, token) if (is_shield) then spell.is_shield = true end @@ -1312,22 +1269,8 @@ este_jogador.spellschool = spellschool este_jogador.damage_spellid = spellid este_jogador.debuff_uptime = 0 - este_jogador.debuff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.debuff_uptime_targets = container_combatentes:NovoContainer (container_enemydebufftarget_target) - - if (not este_jogador.shadow.debuff_uptime_targets) then - este_jogador.shadow.boss_debuff = true - este_jogador.shadow.damage_twin = who_name - este_jogador.shadow.spellschool = spellschool - este_jogador.shadow.damage_spellid = spellid - este_jogador.shadow.debuff_uptime = 0 - este_jogador.shadow.debuff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.shadow.debuff_uptime_targets = container_combatentes:NovoContainer (container_enemydebufftarget_target) - end - - este_jogador.debuff_uptime_targets.shadow = este_jogador.shadow.debuff_uptime_targets - este_jogador.debuff_uptime_spell_tables.shadow = este_jogador.shadow.debuff_uptime_spell_tables - + este_jogador.debuff_uptime_spells = container_habilidades:NovoContainer (container_misc) + este_jogador.debuff_uptime_targets = {} end ------------------------------------------------------------------------------------------------ @@ -1337,11 +1280,10 @@ este_jogador.last_event = _tempo --> actor target - local este_alvo = este_jogador.debuff_uptime_targets._NameIndexTable [alvo_name] + local este_alvo = este_jogador.debuff_uptime_targets [alvo_name] if (not este_alvo) then - este_alvo = este_jogador.debuff_uptime_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.debuff_uptime_targets._ActorTable [este_alvo] + este_alvo = _detalhes.atributo_misc:CreateBuffTargetObject() + este_jogador.debuff_uptime_targets [alvo_name] = este_alvo end if (in_out == "DEBUFF_UPTIME_IN") then @@ -1398,17 +1340,8 @@ if (not este_jogador.debuff_uptime) then este_jogador.debuff_uptime = 0 - este_jogador.debuff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.debuff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) - - if (not este_jogador.shadow.debuff_uptime_targets) then - este_jogador.shadow.debuff_uptime = 0 - este_jogador.shadow.debuff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.shadow.debuff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) - end - - este_jogador.debuff_uptime_targets.shadow = este_jogador.shadow.debuff_uptime_targets - este_jogador.debuff_uptime_spell_tables.shadow = este_jogador.shadow.debuff_uptime_spell_tables + este_jogador.debuff_uptime_spells = container_habilidades:NovoContainer (container_misc) + este_jogador.debuff_uptime_targets = {} end ------------------------------------------------------------------------------------------------ @@ -1418,11 +1351,11 @@ este_jogador.last_event = _tempo --> actor spells table - local spell = este_jogador.debuff_uptime_spell_tables._ActorTable [spellid] + local spell = este_jogador.debuff_uptime_spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.debuff_uptime_spell_tables:PegaHabilidade (spellid, true, "DEBUFF_UPTIME") + spell = este_jogador.debuff_uptime_spells:PegaHabilidade (spellid, true, "DEBUFF_UPTIME") end - return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, este_jogador, "BUFF_OR_DEBUFF", in_out) + return spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, este_jogador, "BUFF_OR_DEBUFF", in_out) end @@ -1446,29 +1379,10 @@ if (not este_jogador.buff_uptime) then este_jogador.buff_uptime = 0 - este_jogador.buff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.buff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) - - if (not este_jogador.shadow.buff_uptime_targets) then - este_jogador.shadow.buff_uptime = 0 - este_jogador.shadow.buff_uptime_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.shadow.buff_uptime_targets = container_combatentes:NovoContainer (container_damage_target) - end - - este_jogador.buff_uptime_targets.shadow = este_jogador.shadow.buff_uptime_targets - este_jogador.buff_uptime_spell_tables.shadow = este_jogador.shadow.buff_uptime_spell_tables + este_jogador.buff_uptime_spells = container_habilidades:NovoContainer (container_misc) + este_jogador.buff_uptime_targets = {} end - ------------------------------------------------------------------------------------------------ - --> hook - - if (_hook_buffs) then - --> send event to registred functions - for _, func in _ipairs (_hook_buffs_container) do - func (nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, in_out) - end - end - ------------------------------------------------------------------------------------------------ --> add amount @@ -1476,11 +1390,11 @@ este_jogador.last_event = _tempo --> actor spells table - local spell = este_jogador.buff_uptime_spell_tables._ActorTable [spellid] + local spell = este_jogador.buff_uptime_spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.buff_uptime_spell_tables:PegaHabilidade (spellid, true, "BUFF_UPTIME") + spell = este_jogador.buff_uptime_spells:PegaHabilidade (spellid, true, "BUFF_UPTIME") end - return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, este_jogador, "BUFF_OR_DEBUFF", in_out) + return spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, este_jogador, "BUFF_OR_DEBUFF", in_out) end @@ -1488,6 +1402,34 @@ --> ENERGY serach key: ~energy | ----------------------------------------------------------------------------------------------------------------------------------------- + local energy_types = { + [SPELL_POWER_MANA] = true, + [SPELL_POWER_RAGE] = true, + [SPELL_POWER_ENERGY] = true, + [SPELL_POWER_RUNIC_POWER] = true, + } + + local resource_types = { + [SPELL_POWER_DEMONIC_FURY] = true, --warlock demonology + [SPELL_POWER_BURNING_EMBERS] = true, --warlock destruction + [SPELL_POWER_SHADOW_ORBS] = true, --shadow priest + [SPELL_POWER_CHI] = true, --monk + [SPELL_POWER_HOLY_POWER] = true, --paladins + [SPELL_POWER_ECLIPSE] = true, --balance druids + [SPELL_POWER_SOUL_SHARDS] = true, --warlock affliction + [4] = true, --combo points + } + + local resource_power_type = { + [4] = 3, --cat druids and rogues uses energy + [SPELL_POWER_SOUL_SHARDS] = 0, --warlock uses mana + [SPELL_POWER_ECLIPSE] = 0, --moonkin uses mana + [SPELL_POWER_HOLY_POWER] = 0, --paladins uses mana + [SPELL_POWER_SHADOW_ORBS] = 0, --shadow preist uses mana + [SPELL_POWER_DEMONIC_FURY] = 0, --warlock uses mana + [SPELL_POWER_BURNING_EMBERS] = 0, --warlock uses mana + } + function parser:energize (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, amount, powertype, p6, p7) ------------------------------------------------------------------------------------------------ @@ -1500,33 +1442,19 @@ end ------------------------------------------------------------------------------------------------ - --> get regen key name - - local key_regenDone - local key_regenFrom - local key_regenType - - if (powertype == 0) then --> MANA - key_regenDone = "mana_r" - key_regenFrom = "mana_from" - key_regenType = "mana" - elseif (powertype == 1) then --> RAGE - key_regenDone = "e_rage_r" - key_regenFrom = "e_rage_from" - key_regenType = "e_rage" - elseif (powertype == 3) then --> ENERGY - key_regenDone = "e_energy_r" - key_regenFrom = "e_energy_from" - key_regenType = "e_energy" - elseif (powertype == 6) then --> RUNEPOWER - key_regenDone = "runepower_r" - key_regenFrom = "runepower_from" - key_regenType = "runepower" - else - --> not tracking this regen type + --> check if is energy or resource + + --> get resource type + local is_resource, resource_amount = resource_power_type [powertype], amount + + --> check if is valid + if (not energy_types [powertype] and not is_resource) then return + elseif (is_resource) then + powertype = is_resource + amount = 0 end - + _current_energy_container.need_refresh = true ------------------------------------------------------------------------------------------------ @@ -1536,6 +1464,10 @@ local este_jogador, meu_dono = energy_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_energy_container:PegarCombatente (who_serial, who_name, who_flags, true) + este_jogador.powertype = powertype + if (meu_dono) then + meu_dono.powertype = powertype + end if (not meu_dono) then --> se não for um pet, adicionar no cache energy_cache [who_name] = este_jogador end @@ -1545,56 +1477,61 @@ local jogador_alvo, alvo_dono = energy_cache [alvo_name] if (not jogador_alvo) then jogador_alvo, alvo_dono, alvo_name = _current_energy_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) + jogador_alvo.powertype = powertype + if (alvo_dono) then + alvo_dono.powertype = powertype + end if (not alvo_dono) then energy_cache [alvo_name] = jogador_alvo end end - --> actor targets - local este_alvo = este_jogador.targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --retorna o objeto classe_target -> ALVO_DA_HABILIDADE:NovaTabela() - else - este_alvo = este_jogador.targets._ActorTable [este_alvo] + if (jogador_alvo.powertype ~= este_jogador.powertype) then + print ("error: different power types: who -> ", este_jogador.powertype, " target -> ", jogador_alvo.powertype) + return end este_jogador.last_event = _tempo - + ------------------------------------------------------------------------------------------------ --> amount add + + if (not is_resource) then - --> combat total - _current_total [3] [key_regenType] = _current_total [3] [key_regenType] + amount + --> add to targets + este_jogador.targets [alvo_name] = (este_jogador.targets [alvo_name] or 0) + amount - if (este_jogador.grupo) then - _current_gtotal [3] [key_regenType] = _current_gtotal [3] [key_regenType] + amount - end + --> add to combat total + _current_total [3] [powertype] = _current_total [3] [powertype] + amount + + if (este_jogador.grupo) then + _current_gtotal [3] [powertype] = _current_gtotal [3] [powertype] + amount + end - --> regen produced amount - este_jogador [key_regenType] = este_jogador [key_regenType] + amount - este_alvo [key_regenType] = este_alvo [key_regenType] + amount + --> regen produced amount + este_jogador.total = este_jogador.total + amount + + --> target regenerated amount + jogador_alvo.received = jogador_alvo.received + amount - --> target regenerated amount - jogador_alvo [key_regenDone] = jogador_alvo [key_regenDone] + amount - - --> regen from - if (not jogador_alvo [key_regenFrom] [who_name]) then - jogador_alvo [key_regenFrom] [who_name] = true - end - - --> owner - if (meu_dono) then - meu_dono [key_regenType] = meu_dono [key_regenType] + amount --> e adiciona o dano ao pet - end + --> owner + if (meu_dono) then + meu_dono.total = meu_dono.total + amount + end - --> actor spells table - local spell = este_jogador.spell_tables._ActorTable [spellid] - if (not spell) then - spell = este_jogador.spell_tables:PegaHabilidade (spellid, true, token) - end + --> actor spells table + local spell = este_jogador.spells._ActorTable [spellid] + if (not spell) then + spell = este_jogador.spells:PegaHabilidade (spellid, true, token) + end - --return spell:Add (alvo_serial, alvo_name, alvo_flags, amount, who_name, powertype) - return spell_energy_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, powertype) + --return spell:Add (alvo_serial, alvo_name, alvo_flags, amount, who_name, powertype) + return spell_energy_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, powertype) + + else + --> is a resource + este_jogador.resource = este_jogador.resource + resource_amount + end end @@ -1624,21 +1561,11 @@ ------------------------------------------------------------------------------------------------ --> build containers on the fly - if (not este_jogador.cooldowns_defensive) then este_jogador.cooldowns_defensive = _detalhes:GetOrderNumber (who_name) - este_jogador.cooldowns_defensive_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.cooldowns_defensive_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades - - if (not este_jogador.shadow.cooldowns_defensive_targets) then - este_jogador.shadow.cooldowns_defensive = _detalhes:GetOrderNumber (who_name) - este_jogador.shadow.cooldowns_defensive_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.shadow.cooldowns_defensive_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas - end - - este_jogador.cooldowns_defensive_targets.shadow = este_jogador.shadow.cooldowns_defensive_targets - este_jogador.cooldowns_defensive_spell_tables.shadow = este_jogador.shadow.cooldowns_defensive_spell_tables - end + este_jogador.cooldowns_defensive_targets = {} + este_jogador.cooldowns_defensive_spells = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades + end ------------------------------------------------------------------------------------------------ --> add amount @@ -1696,18 +1623,12 @@ este_jogador.last_event = _tempo --> actor targets - local este_alvo = este_jogador.cooldowns_defensive_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.cooldowns_defensive_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.cooldowns_defensive_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 + este_jogador.cooldowns_defensive_targets [alvo_name] = (este_jogador.cooldowns_defensive_targets [alvo_name] or 0) + 1 --> actor spells table - local spell = este_jogador.cooldowns_defensive_spell_tables._ActorTable [spellid] + local spell = este_jogador.cooldowns_defensive_spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.cooldowns_defensive_spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.cooldowns_defensive_spells:PegaHabilidade (spellid, true, token) end if (_hook_cooldowns) then @@ -1717,8 +1638,7 @@ end end - return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token, "BUFF_OR_DEBUFF", "COOLDOWN") - + return spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, token, "BUFF_OR_DEBUFF", "COOLDOWN") end @@ -1753,19 +1673,9 @@ if (not este_jogador.interrupt) then este_jogador.interrupt = _detalhes:GetOrderNumber (who_name) - este_jogador.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.interrupt_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper + este_jogador.interrupt_targets = {} + este_jogador.interrupt_spells = container_habilidades:NovoContainer (container_misc) este_jogador.interrompeu_oque = {} - - if (not este_jogador.shadow.interrupt_targets) then - este_jogador.shadow.interrupt = _detalhes:GetOrderNumber (who_name) - este_jogador.shadow.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.shadow.interrupt_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper - este_jogador.shadow.interrompeu_oque = {} - end - - este_jogador.interrupt_targets.shadow = este_jogador.shadow.interrupt_targets - este_jogador.interrupt_spell_tables.shadow = este_jogador.shadow.interrupt_spell_tables end ------------------------------------------------------------------------------------------------ @@ -1783,72 +1693,41 @@ --> update last event este_jogador.last_event = _tempo - --shadow.last_event = _tempo - + --> spells interrupted - if (not este_jogador.interrompeu_oque [extraSpellID]) then - este_jogador.interrompeu_oque [extraSpellID] = 1 - else - este_jogador.interrompeu_oque [extraSpellID] = este_jogador.interrompeu_oque [extraSpellID] + 1 - end - + este_jogador.interrompeu_oque [extraSpellID] = (este_jogador.interrompeu_oque [extraSpellID] or 0) + 1 + --> actor targets - local este_alvo = este_jogador.interrupt_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.interrupt_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.interrupt_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 + este_jogador.interrupt_targets [alvo_name] = (este_jogador.interrupt_targets [alvo_name] or 0) + 1 --> actor spells table - local spell = este_jogador.interrupt_spell_tables._ActorTable [spellid] + local spell = este_jogador.interrupt_spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.interrupt_spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.interrupt_spells:PegaHabilidade (spellid, true, token) end - spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token, extraSpellID, extraSpellName) + spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, token, extraSpellID, extraSpellName) --> verifica se tem dono e adiciona o interrupt para o dono if (meu_dono) then if (not meu_dono.interrupt) then - meu_dono.interrupt = 0 - meu_dono.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - meu_dono.interrupt_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper + meu_dono.interrupt = _detalhes:GetOrderNumber (who_name) + meu_dono.interrupt_targets = {} + meu_dono.interrupt_spells = container_habilidades:NovoContainer (container_misc) meu_dono.interrompeu_oque = {} - - if (not meu_dono.shadow.interrupt_targets) then - meu_dono.shadow.interrupt = 0 - meu_dono.shadow.interrupt_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - meu_dono.shadow.interrupt_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper - meu_dono.shadow.interrompeu_oque = {} - end - - meu_dono.interrupt_targets.shadow = meu_dono.shadow.interrupt_targets - meu_dono.interrupt_spell_tables.shadow = meu_dono.shadow.interrupt_spell_tables end -- adiciona ao total meu_dono.interrupt = meu_dono.interrupt + 1 -- adiciona aos alvos - local este_alvo = meu_dono.interrupt_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = meu_dono.interrupt_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = meu_dono.interrupt_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 + meu_dono.interrupt_targets [alvo_name] = (meu_dono.interrupt_targets [alvo_name] or 0) + 1 -- update last event meu_dono.last_event = _tempo -- spells interrupted - if (not meu_dono.interrompeu_oque [extraSpellID]) then - meu_dono.interrompeu_oque [extraSpellID] = 1 - else - meu_dono.interrompeu_oque [extraSpellID] = meu_dono.interrompeu_oque [extraSpellID] + 1 - end + meu_dono.interrompeu_oque [extraSpellID] = (meu_dono.interrompeu_oque [extraSpellID] or 0) + 1 --> pet interrupt if (_hook_interrupt) then @@ -1870,8 +1749,6 @@ --> search key: ~spellcast ~castspell ~cast function parser:spellcast (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype) - --print (token, time, "WHO:",who_serial, who_name, who_flags, "TARGET:",alvo_serial, alvo_name, alvo_flags, "SPELL:",spellid, spellname, spelltype) - ------------------------------------------------------------------------------------------------ --> record cooldowns cast which can't track with buff applyed. @@ -1892,7 +1769,7 @@ return end else - --> successful casts (not interrupted) + --> enemy successful casts (not interrupted) if (_bit_band (who_flags, 0x00000040) ~= 0 and who_name) then --> byte 2 = 4 (enemy) --> damager local este_jogador = damage_cache [who_name] @@ -1900,82 +1777,17 @@ este_jogador = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true) end --> actor spells table - local spell = este_jogador.spell_tables._ActorTable [spellid] + local spell = este_jogador.spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.spells:PegaHabilidade (spellid, true, token) end spell.successful_casted = spell.successful_casted + 1 - --print ("cast success", who_name, spellname) end return end - - - -- para aqui -- - ------------------------------------------------------------------------------------------------ - --> record how many times the spell has been casted successfully - - if (not who_name) then - who_name = "[*] ".. spellname - end - - if (not alvo_name) then - alvo_name = "[*] ".. spellid - end - - _current_misc_container.need_refresh = true - - ------------------------------------------------------------------------------------------------ - --> get actors - - --> main actor - - local este_jogador, meu_dono = misc_cache [who_name] - if (not este_jogador) then --> pode ser um desconhecido ou um pet - este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - if (not meu_dono) then --> se não for um pet, adicionar no cache - misc_cache [who_name] = este_jogador - end - end - local shadow = este_jogador.shadow - - ------------------------------------------------------------------------------------------------ - --> build containers on the fly - - if (not este_jogador.spellcast) then - --> constrói aqui a tabela dele - este_jogador.spellcast = 0 - este_jogador.spellcast_spell_tables = container_habilidades:NovoContainer (container_misc) - - if (not este_jogador.shadow.spellcast_targets) then - este_jogador.shadow.spellcast = 0 - este_jogador.shadow.spellcast_spell_tables = container_habilidades:NovoContainer (container_misc) - end - - este_jogador.spellcast_targets.shadow = este_jogador.shadow.spellcast_targets - este_jogador.spellcast_spell_tables.shadow = este_jogador.shadow.spellcast_spell_tables - end - - ------------------------------------------------------------------------------------------------ - --> add amount - - --> last event update - este_jogador.last_event = _tempo - - --> actor dispell amount - este_jogador.spellcast = este_jogador.spellcast + 1 - shadow.spellcast = shadow.spellcast + 1 - - --> actor spells table - local spell = este_jogador.spellcast_spell_tables._ActorTable [spellid] - if (not spell) then - spell = este_jogador.spellcast_spell_tables:PegaHabilidade (spellid, true, token) - end - - return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token) end - + --serach key: ~dispell function parser:dispell (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool, auraType) @@ -1993,14 +1805,7 @@ _current_misc_container.need_refresh = true ------------------------------------------------------------------------------------------------ - --> get actors - - --> main actor - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - --]] - --[ + --> get actors] local este_jogador, meu_dono = misc_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -2008,7 +1813,6 @@ misc_cache [who_name] = este_jogador end end - --]] ------------------------------------------------------------------------------------------------ --> build containers on the fly @@ -2016,19 +1820,9 @@ if (not este_jogador.dispell) then --> constrói aqui a tabela dele este_jogador.dispell = _detalhes:GetOrderNumber (who_name) - este_jogador.dispell_targets = container_combatentes:NovoContainer (container_damage_target) - este_jogador.dispell_spell_tables = container_habilidades:NovoContainer (container_misc) + este_jogador.dispell_targets = {} + este_jogador.dispell_spells = container_habilidades:NovoContainer (container_misc) este_jogador.dispell_oque = {} - - if (not este_jogador.shadow.dispell_targets) then - este_jogador.shadow.dispell = _detalhes:GetOrderNumber (who_name) - este_jogador.shadow.dispell_targets = container_combatentes:NovoContainer (container_damage_target) - este_jogador.shadow.dispell_spell_tables = container_habilidades:NovoContainer (container_misc) - este_jogador.shadow.dispell_oque = {} - end - - este_jogador.dispell_targets.shadow = este_jogador.shadow.dispell_targets - este_jogador.dispell_spell_tables.shadow = este_jogador.shadow.dispell_spell_tables end ------------------------------------------------------------------------------------------------ @@ -2036,7 +1830,6 @@ --> last event update este_jogador.last_event = _tempo - --shadow.last_event = _tempo --> total dispells in combat _current_total [4].dispell = _current_total [4].dispell + 1 @@ -2050,73 +1843,38 @@ --> dispell what if (extraSpellID) then - if (not este_jogador.dispell_oque [extraSpellID]) then - este_jogador.dispell_oque [extraSpellID] = 1 - else - este_jogador.dispell_oque [extraSpellID] = este_jogador.dispell_oque [extraSpellID] + 1 - end + este_jogador.dispell_oque [extraSpellID] = (este_jogador.dispell_oque [extraSpellID] or 0) + 1 end --> actor targets - local este_alvo = este_jogador.dispell_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.dispell_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.dispell_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 + este_jogador.dispell_targets [alvo_name] = (este_jogador.dispell_targets [alvo_name] or 0) + 1 --> actor spells table - local spell = este_jogador.dispell_spell_tables._ActorTable [spellid] + local spell = este_jogador.dispell_spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.dispell_spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.dispell_spells:PegaHabilidade (spellid, true, token) end - spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token, extraSpellID, extraSpellName) + spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, token, extraSpellID, extraSpellName) --> verifica se tem dono e adiciona o interrupt para o dono if (meu_dono) then - if (not meu_dono.dispell) then - --> constrói aqui a tabela dele - meu_dono.dispell = 0 - meu_dono.dispell_targets = container_combatentes:NovoContainer (container_damage_target) - meu_dono.dispell_spell_tables = container_habilidades:NovoContainer (container_misc) + meu_dono.dispell = _detalhes:GetOrderNumber (who_name) + meu_dono.dispell_targets = {} + meu_dono.dispell_spells = container_habilidades:NovoContainer (container_misc) meu_dono.dispell_oque = {} - - if (not meu_dono.shadow.dispell_targets) then - meu_dono.shadow.dispell = 0 - meu_dono.shadow.dispell_targets = container_combatentes:NovoContainer (container_damage_target) - meu_dono.shadow.dispell_spell_tables = container_habilidades:NovoContainer (container_misc) - meu_dono.shadow.dispell_oque = {} - end - - meu_dono.dispell_targets.shadow = meu_dono.shadow.dispell_targets - meu_dono.dispell_spell_tables.shadow = meu_dono.shadow.dispell_spell_tables end - -- adiciona ao total meu_dono.dispell = meu_dono.dispell + 1 - - -- adiciona aos alvos - local este_alvo = meu_dono.dispell_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = meu_dono.dispell_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = meu_dono.dispell_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 - - -- update last event + + meu_dono.dispell_targets [alvo_name] = (meu_dono.dispell_targets [alvo_name] or 0) + 1 + meu_dono.last_event = _tempo - - -- spells interrupted - if (not meu_dono.dispell_oque [extraSpellID]) then - meu_dono.dispell_oque [extraSpellID] = 1 - else - meu_dono.dispell_oque [extraSpellID] = meu_dono.dispell_oque [extraSpellID] + 1 + + if (extraSpellID) then + meu_dono.dispell_oque [extraSpellID] = (meu_dono.dispell_oque [extraSpellID] or 0) + 1 end - end - + end end --serach key: ~ress @@ -2147,19 +1905,9 @@ --> build containers on the fly if (not este_jogador.ress) then - --> constrói aqui a tabela dele este_jogador.ress = _detalhes:GetOrderNumber (who_name) - este_jogador.ress_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.ress_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper - - if (not este_jogador.shadow.ress_targets) then - este_jogador.shadow.ress = _detalhes:GetOrderNumber (who_name) - este_jogador.shadow.ress_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.shadow.ress_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper - end - - este_jogador.ress_targets.shadow = este_jogador.shadow.ress_targets - este_jogador.ress_spell_tables.shadow = este_jogador.shadow.ress_spell_tables + este_jogador.ress_targets = {} + este_jogador.ress_spells = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper end ------------------------------------------------------------------------------------------------ @@ -2216,20 +1964,14 @@ end --> actor targets - local este_alvo = este_jogador.ress_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.ress_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.ress_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 + este_jogador.ress_targets [alvo_name] = (este_jogador.ress_targets [alvo_name] or 0) + 1 --> actor spells table - local spell = este_jogador.ress_spell_tables._ActorTable [spellid] + local spell = este_jogador.ress_spells._ActorTable [spellid] if (not spell) then - spell = este_jogador.ress_spell_tables:PegaHabilidade (spellid, true, token) + spell = este_jogador.ress_spells:PegaHabilidade (spellid, true, token) end - return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token, extraSpellID, extraSpellName) + return spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, token, extraSpellID, extraSpellName) end --serach key: ~cc @@ -2254,12 +1996,6 @@ ------------------------------------------------------------------------------------------------ --> get actors - --> main actor - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - --]] - --[ local este_jogador, meu_dono = misc_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -2267,7 +2003,6 @@ misc_cache [who_name] = este_jogador end end - --]] ------------------------------------------------------------------------------------------------ --> build containers on the fly @@ -2275,19 +2010,9 @@ if (not este_jogador.cc_break) then --> constrói aqui a tabela dele este_jogador.cc_break = _detalhes:GetOrderNumber (who_name) - este_jogador.cc_break_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.cc_break_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper + este_jogador.cc_break_targets = {} + este_jogador.cc_break_spells = container_habilidades:NovoContainer (container_misc) este_jogador.cc_break_oque = {} - - if (not este_jogador.shadow.cc_break) then - este_jogador.shadow.cc_break = _detalhes:GetOrderNumber (who_name) - este_jogador.shadow.cc_break_targets = container_combatentes:NovoContainer (container_damage_target) --> pode ser um container de alvo de dano, pois irá usar apenas o .total - este_jogador.shadow.cc_break_spell_tables = container_habilidades:NovoContainer (container_misc) --> cria o container das habilidades usadas para interromper - este_jogador.shadow.cc_break_oque = {} - end - - este_jogador.cc_break_targets.shadow = este_jogador.shadow.cc_break_targets - este_jogador.cc_break_spell_tables.shadow = este_jogador.shadow.cc_break_spell_tables end ------------------------------------------------------------------------------------------------ @@ -2295,47 +2020,34 @@ --> update last event este_jogador.last_event = _tempo - --shadow.last_event = _tempo - + --> combat cc break total _current_total [4].cc_break = _current_total [4].cc_break + 1 if (este_jogador.grupo) then _current_combat.totals_grupo[4].cc_break = _current_combat.totals_grupo[4].cc_break+1 end - + --> add amount este_jogador.cc_break = este_jogador.cc_break + 1 - + --> broke what - if (not este_jogador.cc_break_oque [spellid]) then - este_jogador.cc_break_oque [spellid] = 1 - else - este_jogador.cc_break_oque [spellid] = este_jogador.cc_break_oque [spellid] + 1 - end - + este_jogador.cc_break_oque [spellid] = (este_jogador.cc_break_oque [spellid] or 0) + 1 + --> actor targets - local este_alvo = este_jogador.cc_break_targets._NameIndexTable [alvo_name] - if (not este_alvo) then - este_alvo = este_jogador.cc_break_targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - else - este_alvo = este_jogador.cc_break_targets._ActorTable [este_alvo] - end - este_alvo.total = este_alvo.total + 1 + este_jogador.cc_break_targets [alvo_name] = (este_jogador.cc_break_targets [alvo_name] or 0) + 1 --> actor spells table - local spell = este_jogador.cc_break_spell_tables._ActorTable [extraSpellID] + local spell = este_jogador.cc_break_spells._ActorTable [extraSpellID] if (not spell) then - spell = este_jogador.cc_break_spell_tables:PegaHabilidade (extraSpellID, true, token) + spell = este_jogador.cc_break_spells:PegaHabilidade (extraSpellID, true, token) end - return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token, spellid, spellname) + return spell_misc_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, token, spellid, spellname) end --serach key: ~dead ~death ~morte function parser:dead (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags) - --> not yet well cleaned, need more improvements - ------------------------------------------------------------------------------------------------ --> early checks and fixes @@ -2374,11 +2086,7 @@ --> must be in combat _in_combat ) then - - --> true dead was a attempt to get the last hit because parser sometimes send the dead token before send the hit wich really killed the actor - --> but unfortunately seems parser not send at all any damage after actor dead - --_detalhes:ScheduleTimer ("TrueDead", 1, {time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags}) - + _current_misc_container.need_refresh = true --> combat totals @@ -2394,7 +2102,6 @@ end end - --> monta a estrutura da morte pegando a tabela de dano e a tabela de cura --> objeto da morte local esta_morte = {} @@ -2472,9 +2179,6 @@ --> reseta a pool last_events_cache [alvo_name] = nil - --dano.last_events_table = _detalhes:CreateActorLastEventTable() - --cura.last_events_table = _detalhes:CreateActorLastEventTable() - end end end @@ -2702,6 +2406,8 @@ _detalhes.last_zone_type = zoneType end + _detalhes:CheckChatOnZoneChange (zoneType) + _detalhes.zone_type = zoneType _detalhes.zone_id = zoneMapID _detalhes.zone_name = zoneName @@ -2938,6 +2644,11 @@ _detalhes.historico:adicionar_overall (_detalhes.tabela_vigente) end + if (_detalhes.schedule_store_boss_encounter) then + pcall (_detalhes.StoreEncounter) + _detalhes.schedule_store_boss_encounter = nil + end + if (_detalhes.schedule_hard_garbage_collect) then if (_detalhes.debug) then _detalhes:Msg ("(debug) found schedule collectgarbage().") @@ -3359,12 +3070,6 @@ This workaround will consume a huge amount of Cpu (any addon which counts damage _hook_interrupt = false end - if (_detalhes.hooks ["HOOK_BUFF"].enabled) then --[[REMOVED]] - _hook_buffs = true - else - _hook_buffs = false - end - return _detalhes:ClearParserCache() end diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index 2bcac68b..302bece1 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -665,18 +665,18 @@ do --> showing is the combat table which is current shown on instance if (child.instance.showing) then + --GetCombatTime() return the time length of combat local combatTime = child.instance.showing:GetCombatTime() if (combatTime < 1) then return child.text:SetText ("0") end + --GetTotal (attribute, sub attribute, onlyGroup) return the total of requested attribute local total = child.instance.showing:GetTotal (child.instance.atributo, child.instance.sub_atributo, true) local dps = _math_floor (total / combatTime) - --print (total, combatTime, dps) - local textStyle = child.options.textStyle if (textStyle == 1) then child.text:SetText (_detalhes:ToK (dps)) diff --git a/core/util.lua b/core/util.lua index dc313480..76471f8a 100644 --- a/core/util.lua +++ b/core/util.lua @@ -373,28 +373,6 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> internal functions - local LastDamage = 0 - local LastDamageRecord = 0 - - --> record raid/party/player damage every second - function _detalhes:LogDps() - - LastDamageRecord = LastDamageRecord + 1 - - if (LastDamageRecord > 1) then - LastDamageRecord = 0 - - local NowDamage = (_detalhes.tabela_vigente.totals_grupo[1] - LastDamage) /2 - - _table_insert (_detalhes.tabela_vigente.DpsGraphic, NowDamage) - if (NowDamage > _detalhes.tabela_vigente.DpsGraphic.max) then - _detalhes.tabela_vigente.DpsGraphic.max = NowDamage - end - - LastDamage = _detalhes.tabela_vigente.totals_grupo[1] - end - end - --> is in combat yet? function _detalhes:EstaEmCombate() diff --git a/core/windows.lua b/core/windows.lua index 719ce510..51319f0c 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -2201,8 +2201,8 @@ elseif (robot.nome == "Mr. President") then rawset (_detalhes.spellcache, 56488, {"Nuke", 56488, [[Interface\ICONS\inv_gizmo_supersappercharge]]}) - robot.spell_tables:PegaHabilidade (56488, true, "SPELL_DAMAGE") - robot.spell_tables._ActorTable [56488].total = robot.total + robot.spells:PegaHabilidade (56488, true, "SPELL_DAMAGE") + robot.spells._ActorTable [56488].total = robot.total end local robot = current_combat[2]:PegarCombatente (0x0000000000000, actors_name [math.random (1, #actors_name)], 0x114, true) diff --git a/functions/attributes.lua b/functions/attributes.lua index be01a427..90eec933 100644 --- a/functions/attributes.lua +++ b/functions/attributes.lua @@ -30,6 +30,7 @@ do --[[global]] DETAILS_SUBATTRIBUTE_REGENRAGE = 2 --[[global]] DETAILS_SUBATTRIBUTE_REGENENERGY = 3 --[[global]] DETAILS_SUBATTRIBUTE_REGENRUNE = 4 + --[[global]] DETAILS_SUBATTRIBUTE_RESOURCES = 5 --[[global]] DETAILS_ATTRIBUTE_MISC = 4 @@ -62,6 +63,7 @@ do "energy", --rage gained "energy", --energy generated "energy", --runic power generated + "energy", --resources "miscdata", --cc breaks "miscdata", --ress @@ -89,7 +91,7 @@ do --[[ ENERGY ]] e_energy = 3,--> identifier - [3] = 4, --> sub attributes + [3] = 5, --> sub attributes --[[ MISC ]] misc = 4, --> identifier @@ -176,19 +178,22 @@ do rage_ganha = 2, -- id 1 energy_ganha = 3, --id 3 rune_ganha = 4, --id 6 + resources = 5, -- lista = { --[[ String Names ]] Loc ["STRING_ATTRIBUTE_ENERGY_MANA"], Loc ["STRING_ATTRIBUTE_ENERGY_RAGE"], Loc ["STRING_ATTRIBUTE_ENERGY_ENERGY"], - Loc ["STRING_ATTRIBUTE_ENERGY_RUNEPOWER"] + Loc ["STRING_ATTRIBUTE_ENERGY_RUNEPOWER"], + Loc ["STRING_ATTRIBUTE_ENERGY_RESOURCES"], }, icones = { {"Interface\\AddOns\\Details\\images\\atributos_icones_energyze", {0, .125, 0, 1}}, {"Interface\\AddOns\\Details\\images\\atributos_icones_energyze", {.125, .25, 0, 1}}, {"Interface\\AddOns\\Details\\images\\atributos_icones_energyze", {.25, .375, 0, 1}}, - {"Interface\\AddOns\\Details\\images\\atributos_icones_energyze", {.375, .5, 0, 1}} + {"Interface\\AddOns\\Details\\images\\atributos_icones_energyze", {.375, .5, 0, 1}}, + {"Interface\\AddOns\\Details\\images\\atributos_icones_energyze", {.5, .625, 0, 1}}, }, - internal = {"mana", "e_rage", "e_energy", "runepower"} + internal = {"mana", "e_rage", "e_energy", "runepower", "resource"} }, { diff --git a/functions/classes.lua b/functions/classes.lua index 69a2fa86..b326a3b0 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -119,9 +119,9 @@ do return self.classe or actor.classe end function _detalhes:GetActorSpells() - return self.spell_tables._ActorTable + return self.spells._ActorTable end function _detalhes:GetSpell (spellid) - return self.spell_tables._ActorTable [spellid] + return self.spells._ActorTable [spellid] end end diff --git a/functions/playerclass.lua b/functions/playerclass.lua index c1451408..f651145a 100644 --- a/functions/playerclass.lua +++ b/functions/playerclass.lua @@ -79,8 +79,8 @@ do return false end - if (Actor.spell_tables) then --> correcao pros containers misc, precisa pegar os diferentes tipos de containers de lá - for spellid, _ in _pairs (Actor.spell_tables._ActorTable) do + if (Actor.spells) then --> correcao pros containers misc, precisa pegar os diferentes tipos de containers de lá + for spellid, _ in _pairs (Actor.spells._ActorTable) do local class = _detalhes.ClassSpellList [spellid] if (class) then Actor.classe = class @@ -92,7 +92,7 @@ do container.shadow.need_refresh = true end - if (Actor.minha_barra) then + if (Actor.minha_barra and type (Actor.minha_barra) == "table") then Actor.minha_barra.minha_tabela = nil end @@ -114,7 +114,7 @@ do container.shadow.need_refresh = true end - if (Actor.minha_barra) then + if (Actor.minha_barra and type (Actor.minha_barra) == "table") then Actor.minha_barra.minha_tabela = nil end diff --git a/functions/slash.lua b/functions/slash.lua index e3ae26ba..6bdf9de3 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -91,6 +91,14 @@ function SlashCmdList.DETAILS (msg, editbox) _detalhes:CheckChatOnLeaveGroup() end + elseif (msg == "load") then + + print (DetailsDataStorage) + + local loaded, reason = LoadAddOn ("Details_DataStorage") + print (loaded, reason, DetailsDataStorage) + + elseif (msg == "owner2") then local tip = CreateFrame('GameTooltip', 'GuardianOwnerTooltip', nil, 'GameTooltipTemplate') @@ -149,21 +157,21 @@ function SlashCmdList.DETAILS (msg, editbox) end if (cima) then - local frostbolt = self.spell_tables:PegaHabilidade (116, true, "SPELL_DAMAGE") - local frostfirebolt = self.spell_tables:PegaHabilidade (44614, true, "SPELL_DAMAGE") - local icelance = self.spell_tables:PegaHabilidade (30455, true, "SPELL_DAMAGE") + local frostbolt = self.spells:PegaHabilidade (116, true, "SPELL_DAMAGE") + local frostfirebolt = self.spells:PegaHabilidade (44614, true, "SPELL_DAMAGE") + local icelance = self.spells:PegaHabilidade (30455, true, "SPELL_DAMAGE") - self.spell_tables._ActorTable [116].total = 50000 - self.spell_tables._ActorTable [44614].total = 25000 - self.spell_tables._ActorTable [30455].total = 25000 + self.spells._ActorTable [116].total = 50000 + self.spells._ActorTable [44614].total = 25000 + self.spells._ActorTable [30455].total = 25000 else - local frostbolt = self.spell_tables:PegaHabilidade (84721, true, "SPELL_DAMAGE") - local frostfirebolt = self.spell_tables:PegaHabilidade (113092, true, "SPELL_DAMAGE") - local icelance = self.spell_tables:PegaHabilidade (122, true, "SPELL_DAMAGE") + local frostbolt = self.spells:PegaHabilidade (84721, true, "SPELL_DAMAGE") + local frostfirebolt = self.spells:PegaHabilidade (113092, true, "SPELL_DAMAGE") + local icelance = self.spells:PegaHabilidade (122, true, "SPELL_DAMAGE") - self.spell_tables._ActorTable [84721].total = 50000 - self.spell_tables._ActorTable [113092].total = 25000 - self.spell_tables._ActorTable [122].total = 25000 + self.spells._ActorTable [84721].total = 50000 + self.spells._ActorTable [113092].total = 25000 + self.spells._ActorTable [122].total = 25000 end combat.start_time = time()-30 @@ -483,8 +491,8 @@ function SlashCmdList.DETAILS (msg, editbox) return end - if (playerActor and playerActor.buff_uptime_spell_tables and playerActor.buff_uptime_spell_tables._ActorTable) then - for spellid, spellTable in pairs (playerActor.buff_uptime_spell_tables._ActorTable) do + if (playerActor and playerActor.buff_uptime_spells and playerActor.buff_uptime_spells._ActorTable) then + for spellid, spellTable in pairs (playerActor.buff_uptime_spells._ActorTable) do local spellname = GetSpellInfo (spellid) if (spellname) then print (spellid, spellname, spellTable.uptime) @@ -502,13 +510,26 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (msg == "comm") then - if (IsInRaid()) then - for i = 1, GetNumGroupMembers() do - local nname, server = UnitName ("raid"..i) - print (nname, server) - --nname = nname.."-"..server + local test_plugin = TESTPLUGIN + if (not test_plugin) then + local p = _detalhes:NewPluginObject ("DetailsTestPlugin", nil, "STATUSBAR") + _detalhes:InstallPlugin ("STATUSBAR", "Plugin Test", [[Interface\COMMON\StreamCircle]], p, "TESTPLUGIN", 1, "Details!", "v1.0") + test_plugin = TESTPLUGIN + + function test_plugin:ReceiveAA (a, b, c, d, e, f, g) + print ("working 1", a, b, c, d, e, f, g) end + + function test_plugin:ReceiveAB (a, b, c, d, e, f, g) + print ("working 2", a, b, c, d, e, f, g) + end + + test_plugin:RegisterPluginComm ("PTAA", "ReceiveAA") + test_plugin:RegisterPluginComm ("PTAB", "ReceiveAB") end + + test_plugin:SendPluginCommMessage ("PTAA", nil, "teste 1", "teste 2", "teste3") + elseif (msg == "teste") then diff --git a/gumps/janela_info.lua b/gumps/janela_info.lua index ce49246d..45d01f12 100644 --- a/gumps/janela_info.lua +++ b/gumps/janela_info.lua @@ -776,53 +776,15 @@ function gump:CriaJanelaInfo() este_gump.classe_iconePlus:SetHeight (64) este_gump.classe_iconePlus:SetDrawLayer ("BACKGROUND", 2) - --> cria as 4 partes do fundo da janela - --> top left este_gump.bg1 = este_gump:CreateTexture (nil, "BORDER") este_gump.bg1:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 0, 0) - --este_gump.bg1:SetWidth (512) - --este_gump.bg1:SetHeight (256) este_gump.bg1:SetDrawLayer ("BORDER", 1) function _detalhes:SetPlayerDetailsWindowTexture (texture) este_gump.bg1:SetTexture (texture) end _detalhes:SetPlayerDetailsWindowTexture ("Interface\\AddOns\\Details\\images\\info_window_background") - - este_gump.bg1_sec_texture = este_gump:CreateTexture (nil, "BORDER") - este_gump.bg1_sec_texture:SetDrawLayer ("BORDER", 2) - --este_gump.bg1_sec_texture:SetPoint ("topleft", este_gump.bg1, "topleft", 356, -86) - este_gump.bg1_sec_texture:SetPoint ("topleft", este_gump.bg1, "topleft", 348, -86) - este_gump.bg1_sec_texture:SetHeight (262) - este_gump.bg1_sec_texture:SetWidth (264) - - --> bottom left - este_gump.bg3 = este_gump:CreateTexture (nil, "BORDER") - --este_gump.bg3:SetPoint ("BOTTOMLEFT", este_gump, "BOTTOMLEFT", 0, 0) - este_gump.bg3:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 0, -256) - este_gump.bg3:SetWidth (512) - este_gump.bg3:SetHeight (128) - este_gump.bg3:SetTexture ("Interface\\AddOns\\Details\\images\\info_bg_part3") - este_gump.bg3:Hide() - - --> top right - este_gump.bg2 = este_gump:CreateTexture (nil, "BORDER") - este_gump.bg2:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 512, 0) - este_gump.bg2:SetWidth (128) - este_gump.bg2:SetHeight (128) - este_gump.bg2:SetTexture ("Interface\\AddOns\\Details\\images\\info_bg_part2") - este_gump.bg2:Hide() - - --> bottom right - este_gump.bg4 = este_gump:CreateTexture (nil, "BORDER") - --este_gump.bg4:SetPoint ("BOTTOMRIGHT", este_gump, "BOTTOMRIGHT", 0, 0) - --este_gump.bg4:SetPoint ("BOTTOMLEFT", este_gump, "BOTTOMLEFT", 512, 0) - este_gump.bg4:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 512, -128) - este_gump.bg4:SetWidth (128) - este_gump.bg4:SetHeight (256) - este_gump.bg4:SetTexture ("Interface\\AddOns\\Details\\images\\info_bg_part4") - este_gump.bg4:Hide() --> botão de fechar este_gump.fechar = _CreateFrame ("Button", nil, este_gump, "UIPanelCloseButton") @@ -845,19 +807,6 @@ function gump:CriaJanelaInfo() este_gump.no_targets.text:SetTextColor (1, 1, 1, .4) este_gump.no_targets:Hide() - function este_gump:ToFront() - if (_detalhes.bosswindow) then - if (_detalhes.bosswindow:GetFrameLevel() > este_gump:GetFrameLevel()) then - este_gump:SetFrameLevel (este_gump:GetFrameLevel()+3) - _detalhes.bosswindow:SetFrameLevel (_detalhes.bosswindow:GetFrameLevel()-3) - end - end - end - - este_gump.grab = gump:NewDetailsButton (este_gump, este_gump, _, este_gump.ToFront, nil, nil, 590, 73, "", "", "", "", {OnGrab = "PassClick"}, "DetailsJanelaInfoGrab") - este_gump.grab:SetPoint ("topleft",este_gump, "topleft") - este_gump.grab:SetFrameLevel (este_gump:GetFrameLevel()+1) - --> titulo gump:NewLabel (este_gump, este_gump, nil, "titulo", Loc ["STRING_PLAYER_DETAILS"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) este_gump.titulo:SetPoint ("center", este_gump, "center") @@ -1395,19 +1344,17 @@ function gump:CriaJanelaInfo() tab.selfhealingpersecond:SetText ("0 (0%)") else local last_actor_heal = last_combat (2, player.nome) - local este_alvo = actor_heal.targets._NameIndexTable [player.nome] + local este_alvo = actor_heal.targets [player.nome] if (este_alvo) then - este_alvo = actor_heal.targets._ActorTable [este_alvo] - local heal_total = este_alvo.total + local heal_total = este_alvo tab.selfhealing:SetText (_detalhes:ToK2 (heal_total)) if (last_actor_heal) then - local este_alvo = last_actor_heal.targets._NameIndexTable [player.nome] + local este_alvo = last_actor_heal.targets [player.nome] if (este_alvo) then - - este_alvo = actor_heal.targets._ActorTable [este_alvo] + local heal = este_alvo - local last_heal = este_alvo.total / last_combat:GetCombatTime() + local last_heal = heal / last_combat:GetCombatTime() local ps, diff = getpercent (heal_total, last_heal, elapsed_time, true) tab.selfhealingpersecond:SetText (_detalhes:comma_value (_math_floor (ps)) .. " (" .. diff .. ")") @@ -1432,7 +1379,7 @@ function gump:CriaJanelaInfo() for actorName, _ in pairs (heal_from) do local thisActor = combat (2, actorName) local targets = thisActor.targets --> targets is a container with target classes - local amount = targets:GetAmount (player.nome, "total") + local amount = targets [player.nome] or 0 myReceivedHeal [#myReceivedHeal+1] = {actorName, amount, thisActor.classe} end @@ -1459,7 +1406,7 @@ function gump:CriaJanelaInfo() local last_actor = last_combat (2, myReceivedHeal [i][1]) if (last_actor) then local targets = last_actor.targets - local amount = targets:GetAmount (player.nome, "total") + local amount = targets [player.nome] or 0 if (amount) then local last_heal = amount @@ -1491,14 +1438,14 @@ function gump:CriaJanelaInfo() local misc_player = combat (4, player.nome) if (misc_player) then - if (misc_player.cooldowns_defensive_spell_tables) then - local minha_tabela = misc_player.cooldowns_defensive_spell_tables._ActorTable + if (misc_player.cooldowns_defensive_spells) then + local minha_tabela = misc_player.cooldowns_defensive_spells._ActorTable local cooldowns_usados = {} for _spellid, _tabela in pairs (minha_tabela) do cooldowns_usados [#cooldowns_usados+1] = {_spellid, _tabela.counter} end - table.sort (cooldowns_usados, function (t1, t2) return t1[2] > t2[2] end) + table.sort (cooldowns_usados, _detalhes.Sort2) if (#cooldowns_usados > 1) then for i = 1, #cooldowns_usados do @@ -1521,8 +1468,8 @@ function gump:CriaJanelaInfo() --> buffs uptime if (index_used < 11) then - if (misc_player.buff_uptime_spell_tables) then - local minha_tabela = misc_player.buff_uptime_spell_tables._ActorTable + if (misc_player.buff_uptime_spells) then + local minha_tabela = misc_player.buff_uptime_spells._ActorTable local encounter_time = combat:GetCombatTime() @@ -1634,12 +1581,12 @@ function gump:CriaJanelaInfo() local player_2_target_pool local player_2_top if (player_2) then - local player_2_target = player_2.targets._ActorTable + local player_2_target = player_2.targets player_2_target_pool = {} - for index, target in _ipairs (player_2_target) do - player_2_target_pool [#player_2_target_pool+1] = {target.nome, target.total} + for target_name, amount in _pairs (player_2_target) do + player_2_target_pool [#player_2_target_pool+1] = {target_name, amount} end - table.sort (player_2_target_pool, function (t1, t2) return t1[2] > t2[2] end) + table.sort (player_2_target_pool, _detalhes.Sort2) if (player_2_target_pool [1]) then player_2_top = player_2_target_pool [1] [2] else @@ -1653,12 +1600,12 @@ function gump:CriaJanelaInfo() local player_3_target_pool local player_3_top if (player_3) then - local player_3_target = player_3.targets._ActorTable + local player_3_target = player_3.targets player_3_target_pool = {} - for index, target in _ipairs (player_3_target) do - player_3_target_pool [#player_3_target_pool+1] = {target.nome, target.total} + for target_name, amount in _pairs (player_3_target) do + player_3_target_pool [#player_3_target_pool+1] = {target_name, amount} end - table.sort (player_3_target_pool, function (t1, t2) return t1[2] > t2[2] end) + table.sort (player_3_target_pool, _detalhes.Sort2) if (player_3_target_pool [1]) then player_3_top = player_3_target_pool [1] [2] else @@ -1845,10 +1792,10 @@ function gump:CriaJanelaInfo() --primeiro preenche a nossa barra local spells_sorted = {} - for spellid, spelltable in _pairs (player.spell_tables._ActorTable) do + for spellid, spelltable in _pairs (player.spells._ActorTable) do spells_sorted [#spells_sorted+1] = {spelltable, spelltable.total} end - table.sort (spells_sorted, function (t1, t2) return t1[2] > t2[2] end) + table.sort (spells_sorted, _detalhes.Sort2) self.player = player:Name() @@ -1861,10 +1808,10 @@ function gump:CriaJanelaInfo() frame2.player = other_players [1]:Name() local player_2_total = other_players [1].total_without_pet local player_2_spells_sorted = {} - for spellid, spelltable in _pairs (other_players [1].spell_tables._ActorTable) do + for spellid, spelltable in _pairs (other_players [1].spells._ActorTable) do player_2_spells_sorted [#player_2_spells_sorted+1] = {spelltable, spelltable.total} end - table.sort (player_2_spells_sorted, function (t1, t2) return t1[2] > t2[2] end) + table.sort (player_2_spells_sorted, _detalhes.Sort2) local player_2_top = player_2_spells_sorted [1] [2] local player_2_spell_info = {} for index, spelltable in _ipairs (player_2_spells_sorted) do @@ -1879,10 +1826,10 @@ function gump:CriaJanelaInfo() local player_3_top if (other_players [2]) then - for spellid, spelltable in _pairs (other_players [2].spell_tables._ActorTable) do + for spellid, spelltable in _pairs (other_players [2].spells._ActorTable) do player_3_spells_sorted [#player_3_spells_sorted+1] = {spelltable, spelltable.total} end - table.sort (player_3_spells_sorted, function (t1, t2) return t1[2] > t2[2] end) + table.sort (player_3_spells_sorted, _detalhes.Sort2) player_3_top = player_3_spells_sorted [1] [2] for index, spelltable in _ipairs (player_3_spells_sorted) do player_3_spell_info [spelltable[1].id] = index @@ -1911,7 +1858,7 @@ function gump:CriaJanelaInfo() --seta no segundo box local player_2 = other_players [1] - local spell = player_2.spell_tables._ActorTable [spellid] + local spell = player_2.spells._ActorTable [spellid] local bar_2 = frame2.bars [i] -- ~compare @@ -1967,7 +1914,7 @@ function gump:CriaJanelaInfo() if (player_3_total) then local player_3 = other_players [2] - local spell = player_3.spell_tables._ActorTable [spellid] + local spell = player_3.spells._ActorTable [spellid] if (spell) then bar_3 [1]:SetTexture (icon) @@ -2058,12 +2005,12 @@ function gump:CriaJanelaInfo() local refresh_target_box = function (self) --player 1 targets - local my_targets = self.tab.player.targets._ActorTable + local my_targets = self.tab.player.targets local target_pool = {} - for index, target in _ipairs (my_targets) do - target_pool [#target_pool+1] = {target.nome, target.total} + for target_name, amount in _pairs (my_targets) do + target_pool [#target_pool+1] = {target_name, amount} end - table.sort (target_pool, function (t1, t2) return t1[2] > t2[2] end) + table.sort (target_pool, _detalhes.Sort2) FauxScrollFrame_Update (self, math.max (#target_pool, 5), 4, 14) @@ -2121,10 +2068,10 @@ function gump:CriaJanelaInfo() -- player 1 local player_1_skills = {} - for spellid, spell in _pairs (player_1.spell_tables._ActorTable) do - for index, target in _ipairs (spell.targets._ActorTable) do - if (target.nome == target_name) then - player_1_skills [#player_1_skills+1] = {spellid, target.total} + for spellid, spell in _pairs (player_1.spells._ActorTable) do + for name, amount in _pairs (spell.targets) do + if (name == target_name) then + player_1_skills [#player_1_skills+1] = {spellid, amount} end end end @@ -2135,10 +2082,10 @@ function gump:CriaJanelaInfo() local player_2_skills = {} local player_2_top if (player_2) then - for spellid, spell in _pairs (player_2.spell_tables._ActorTable) do - for index, target in _ipairs (spell.targets._ActorTable) do - if (target.nome == target_name) then - player_2_skills [#player_2_skills+1] = {spellid, target.total} + for spellid, spell in _pairs (player_2.spells._ActorTable) do + for name, amount in _pairs (spell.targets) do + if (name == target_name) then + player_2_skills [#player_2_skills+1] = {spellid, amount} end end end @@ -2150,10 +2097,10 @@ function gump:CriaJanelaInfo() local player_3_skills = {} local player_3_top if (player_3) then - for spellid, spell in _pairs (player_3.spell_tables._ActorTable) do - for index, target in _ipairs (spell.targets._ActorTable) do - if (target.nome == target_name) then - player_3_skills [#player_3_skills+1] = {spellid, target.total} + for spellid, spell in _pairs (player_3.spells._ActorTable) do + for name, amount in _pairs (spell.targets) do + if (name == target_name) then + player_3_skills [#player_3_skills+1] = {spellid, amount} end end end @@ -2354,7 +2301,7 @@ function gump:CriaJanelaInfo() frame1.tooltip.crit_label2:SetText (critical .. "%") if (player1_misc) then - local spell = player1_misc.debuff_uptime_spell_tables and player1_misc.debuff_uptime_spell_tables._ActorTable and player1_misc.debuff_uptime_spell_tables._ActorTable [spellid] + local spell = player1_misc.debuff_uptime_spells and player1_misc.debuff_uptime_spells._ActorTable and player1_misc.debuff_uptime_spells._ActorTable [spellid] if (spell) then local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60) player1_uptime = spell.uptime @@ -2429,7 +2376,7 @@ function gump:CriaJanelaInfo() end if (player2_misc) then - local spell = player2_misc.debuff_uptime_spell_tables and player2_misc.debuff_uptime_spell_tables._ActorTable and player2_misc.debuff_uptime_spell_tables._ActorTable [spellid] + local spell = player2_misc.debuff_uptime_spells and player2_misc.debuff_uptime_spells._ActorTable and player2_misc.debuff_uptime_spells._ActorTable [spellid] if (spell and spell.uptime) then local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60) @@ -2524,7 +2471,7 @@ function gump:CriaJanelaInfo() end if (player3_misc) then - local spell = player3_misc.debuff_uptime_spell_tables and player3_misc.debuff_uptime_spell_tables._ActorTable and player3_misc.debuff_uptime_spell_tables._ActorTable [spellid] + local spell = player3_misc.debuff_uptime_spells and player3_misc.debuff_uptime_spells._ActorTable and player3_misc.debuff_uptime_spells._ActorTable [spellid] if (spell and spell.uptime) then local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60) @@ -2894,7 +2841,7 @@ function gump:CriaJanelaInfo() local my_spells = {} local my_spells_total = 0 --> build my spell list - for spellid, _ in _pairs (playerObject.spell_tables._ActorTable) do + for spellid, _ in _pairs (playerObject.spells._ActorTable) do my_spells [spellid] = true my_spells_total = my_spells_total + 1 end @@ -2907,7 +2854,7 @@ function gump:CriaJanelaInfo() if (actor.classe == class and actor ~= playerObject) then local same_spells = 0 - for spellid, _ in _pairs (actor.spell_tables._ActorTable) do + for spellid, _ in _pairs (actor.spells._ActorTable) do if (my_spells [spellid]) then same_spells = same_spells + 1 end @@ -3505,13 +3452,28 @@ local target_on_enter = function (self) if (barra.show and type (barra.show) == "number") then local actor = barra.other_actor or info.jogador - local spell = actor.spell_tables:PegaHabilidade (barra.show) + local spell = actor.spells:PegaHabilidade (barra.show) if (spell) then - local ActorTargetsContainer = spell.targets._ActorTable + local ActorTargetsSortTable = {} + local ActorTargetsContainer + + local attribute, sub_attribute = info.instancia:GetDisplay() + if (attribute == 1 or attribute == 3) then + ActorTargetsContainer = spell.targets + else + if (sub_attribute == 3) then --overheal + ActorTargetsContainer = spell.targets_overheal + elseif (sub_attribute == 6) then --absorbs + ActorTargetsContainer = spell.targets_absorbs + else + ActorTargetsContainer = spell.targets + end + end + --add and sort - for _, _target in _ipairs (ActorTargetsContainer) do - ActorTargetsSortTable [#ActorTargetsSortTable+1] = {_target.nome, _target [info.target_member] or _target.total or 0} + for target_name, amount in _pairs (ActorTargetsContainer) do + ActorTargetsSortTable [#ActorTargetsSortTable+1] = {target_name, amount or 0} end table.sort (ActorTargetsSortTable, _detalhes.Sort2) diff --git a/images/atributos_icones_energyze.tga b/images/atributos_icones_energyze.tga index 7695cf46881d44d5fe4ef45a8533ac5b3c46cec9..92fc9127be489cf083cb92427211ca07aa23392b 100644 GIT binary patch delta 4655 zcmZXYcX$)$9mnt0-TU52NM3kh2r-z3X-#Wb*0jKED9Zt-f#SwcQVL0$0>+YMdEFpLylSC+(UOJj&Opdea5CYoXdw|VIVKBk(k8Tj$XADLTpt>E9; zZj=^$k1Jnhw>z2SAw#5pNy|t?(Gnl!)ca+;A;1a7a$at#j*(kxM=31zZiRVcp4`|l zQ^=?_5kvJah`w?N(UrmSCGv;}+G12iSB-3L37&w^$Y32Q_9Mn&vol$ChqSd)ikI+6 zQfXNoU9ybhO_eGkvv#P$)|8=iZC$AH>?%{acef9+?`o81Zdt`!n&%KxV-_~n{(=}P z6Ns)&`nV4BGZ;YFN{8Ze$S3iuJa^#%C)!9WHd#Z_J=W=3enS{*^V~Mc} zFalHoK%fQy2Fccvsu7WY_~8MAB{PKnElfvfR4`jXRk7J^jMM3s{`5!>2`L^_kr91~ zK+KgxiG8Dm_p~mOPitEfHSch1;*ztk4_$rvTI$*xVr=f)w+2l;agCoEdXr2$ybI@a zzKES$r(sLOXp&JGOLQev9W=1nVy285DDX3&D~gMt4Kioh7>CnE6&a8viMkTe`3W(W zC*Z7F1D@Ergv{DoFDyEGNLBFHcZaU|^pnv|UyGwReY%EdH_|%4703MPo~U~Et~ln{JyG6uPh{7ACSrg1Cb#_j zC2r2KPA+@bGdQzR1KJD*v+>kylA+)Q_Wj@i|6m|q_C{SoQ$l}?jz|8fDn#5KH{;65 ziP)18f#dmDkVhbfvLtM&Hegq95j$&NEt`Mp9d_+UHx--u#k80HB@V6sMhvJ{+!f^l z00~{+iG2IFB3^U-2A6yC3^%c(4BMI~6H`qZ%oN4z{G60!q#zpc5aKtqH>L;q=f)zX z!)a$Mb~~gH07wG2#Y7*7BgTrcIJ0&#=Wh8uJ8S=T+0xf9p%*?9vG=Apq~LLo9nF*RYQ1P0BlvvmQz<5!1y7wGcJt$ zze-}G9ho-9Xt769O>#tql4xQmABjyHY&fg&Y0k5~oSl0xBwO~@4O!u*J+kMoi?V5- zNdOdtDncQcIiiSQU|(-9m;26bHs|0)&c3}JTQ=sAjH+=&Um6Q~;QxXkCfFLk7p)4} z5?sh%kisfmHV3lUJP>+b8K7{Gj8q`wP-3hxU`yj%&aq`JH)Zc0ZsCcKxMk=2WY6Ce z@e)y#=YA%R+5C-|{Kvau=81cv;>EinW4R{c+-?!iK6gh}a3Rc2>AK3P1*9dyK&yRFhBVdQOLd~@lY;dL4+@+>7K;Jn6HTPf-7Ne{>eL>ZTn8n z+VWRy+PIBmY{(`0@-e^_1M$Uy8!M&!Ghn%3ZE^#8CX_M+xbhQak7c`U$YiHnUU1%$ zLDb&ZRIkO>mS1x2Jzh5F=wWv1;VZJWm%{7|*L#KRt0G=}OVTPp#X^*fQU!2suPB$V z3iq&%J-0bSqn|T29>W>+hoCt84wy{fN07&8cJ|Yv_rH3Tr!=77h6WD>uHUAhksham z$+SBW(fBZAbrqO@C^m1@*_XReeE8suUbd60^a{#3T115o3z0cye$fq_r&4t{}P22 zUrFzSD1{u;@%#)^T-`y2!2S^)jP1Jsu^o4o+p|zH_?;~lc1oA{2c1J z;SFd>=;81g$ls_@sGT+|qs`2s8BqrN5I|`NKByAr7fbv6Mr%GgUwKFSofUHRJFSw5f!f5DEQecBxtgW0$^bN(ty!)&$`BaZE z=b|K;BoWn2qLhfdcO^1@O}Iyud##t~Td#5B%l`yql~`S|l&FDB<4=PXqJWI$6KF{R zIQYN>zW@IFfgC<}WD_a~-5I$Mq|++R9*31NTCKD}Loj5#+KXWd0j7#2nm{ViR%Q}? zeF1OW*2!BAT^B5`iNc%@#o=w=ih;3jKqLw)z7zv7EnkZ&0T6|CpLa(uxZJ~=cV8yj zhC@VCRYo*`rz!QooMXY6q0RBhVGO3(3GkpZ{0VQ~s3x>7)ISRFnk)&^C%UYRDT`Vb zYNXl=Lux5F2~k@TPjujv`q~-9*j&My+b`o;??SG6UsP3nA;xtA6TAy6`bFKoe~W3w zJz~O>=f$}BXM2T(7rF)KzB7DAu!Gmvl@MKJJ~VDqz&0A9E>0n8Uy_nf_u+^x>zTm) z`}ZRXhUP!$22(Hl4WbXd^s>*o#o@9;Ut`}i5J zUInzjkckIgBF^2loHe)%n`&|(hfjb$I|0lp@Ua?Sq~Ck+V4%Ye6^y%w{4S@BF@O=F z4=iRLhZowmLw8xOBF5?zY^qZe)26A|()v7SZF>!Sj*29^OC0pVrLeI0^6i8Z|DcF{ zPeau;RU0|&{ukaggg}Id<^a)$;_HirD_X)qb(I-qhc}Fm9yUOb}oq~|w%9)!( z*wOw9cDC)u_SS8jy?G;N3$DeM`gzz;sRdVqHVz^|30aGtNknMNnb2BwG(wAlRhoXv zMdO#6P+vL-y6Pb~vmqVY#~GZvZ4Ec^rGsqtq4!wV%ja2Z`&m5g*cE==$31x2TetBu zXTv!EOjyXj-bW_C(nm74ze#lUHAGkaG}do;5*zFCz_S)&L&a0rP@a#CRZDP2)pYP( zJ!l4nz^C96&D$WX;uyfmd&eKuIWq0o8Tpewk zb^D8)wY31dcKnV^-@l(MJbr;ZdGb2zKG2INpX}uqe())Ab)JB-QG^XOkOwPF;ObNu z9r#lQj4bFAYybrA?|Xu%y@}xd3J}c4(u^AstV9n@SlV}Iw?91nn^DJI8Dp6YXq90H zkY1osH&nzCQ~l%E8q{E0iwirp%*OVu3vuS=1=zeP2MVecTQ_-#t7S3H*q_iwZ{V^IwsD>#9oXGfgRR?_Vq=2|=!OAZ4CEmt z0H`2yMF)T?hUL}kReX%P2vQVugwQ5O*h)>1GFlgD3l=>&7iD=o5SsKvq45zo1t=mJ z1H?1HslZSX4`VQdR4g>0Di}(*jsok)Lsyap;$&h|(=2RhS&B2aEW??tPhnG|n`G3C zhItYo1Hp-1I+N1m#Ysg*T?ENBc|C-tmp%^wcajbp1BEnHZ}B2DBB-$b%K!56>=j)H z_A+B8Opxjn$jpK>V5x}&8$+W9hZa8_gytA{_5iM_gctY=>_k_V2;z(+`s(q}8)_gA zs)?a07094|lqn&&1R&(#|FQt!F|-iED1?NiUe7R4s~$<_wOSE8G5B-VbN)Bpc$LxV zH1Kc&j<)Lch)*v>Bz+y+2iLG2I+ILFEc6N`Na;ljRg7+xRx>Fp70ba52EkB**Qo|`x)Rt_fQ5H(VmjzKo}O6Y)CW&epk_wVMd9KRncemwLeW8$Bh{aroD4q}GJN`4 z80+8~22@#CQF;&1yTA|VCzwxqC`0!-u;W5R9R}8tIu^++r8Eyw5=t%IQTE@JB>~`N S{@ewVa;MIlIy*SSA^#6L1rBZi delta 995 zcmZvbOGs2v7{|YFwDHjlrcK8ghh*}B5601Ps(IbFcV-wLIrymQy)e^4L1_y77#8;hx3!`~A=P&d0qMZsEJphxZV- z)BBhzyqw8oV3jQyqsyWrR@3R638Lw7u-WZkKI;Y@&t1d{+PCFmi6qJ3bU9(%jQ?4S zcUZlMyXd*R^9}%66hV|_o}bBoj*JLm6g0JkCv$~uW-`xaCPhgAMNxTPV1LPy7!m}K z6@@2g<;>_W#qv!Iug5gzJmwy5sMHl11oo~^oK9EFW2@0q=|OU(-s;n3352Yf)4x@d z*lS#?Zbw3!3K~^00?ko@-{VA$Y5b~T#*L=@&5Sp7*D-CJtWPt;zcmz7A`ld!{2nQ< zX?*fBV=BC(Bc?_-7{-F{2a<`RS_T%9&zr)Mf^}(patd9vB>fgmBbmy!*yPcWut9qpDu7y49Ls}oP zF{tF42Mw!V$&0C>Wzpw>Kq$l;OB!qc=E0`^L+Nf1be(4-u~9@9{T4q$W(Ks=GY{@U zT|)zJEF>a`<mPJhd*Di_5NwZ0YIhjqOi%Cp-5w Lq~po do revisions +end + diff --git a/plugins/Details_DataStorage/Details_DataStorage.toc b/plugins/Details_DataStorage/Details_DataStorage.toc new file mode 100644 index 00000000..cb43a2fa --- /dev/null +++ b/plugins/Details_DataStorage/Details_DataStorage.toc @@ -0,0 +1,9 @@ +## Interface: 60000 +## Title: Details Storage +## Notes: Stores information for Details! +## DefaultState: Enabled +## LoadOnDemand: 1 +## Dependencies: Details +## SavedVariables: DetailsDataStorage + +Details_DataStorage.lua \ No newline at end of file diff --git a/plugins/Details_DpsTuning/Details_DpsTuning.lua b/plugins/Details_DpsTuning/Details_DpsTuning.lua index 36210de0..4ff1cbcc 100644 --- a/plugins/Details_DpsTuning/Details_DpsTuning.lua +++ b/plugins/Details_DpsTuning/Details_DpsTuning.lua @@ -755,7 +755,7 @@ local function CreatePluginFrames() if (misc) then local debuff_uptime = misc.debuff_uptime if (debuff_uptime) then - local this_spell = misc.debuff_uptime_spell_tables._ActorTable [capsule.spellid] + local this_spell = misc.debuff_uptime_spells._ActorTable [capsule.spellid] if (this_spell) then GameCooltip:AddLine ("") local uptime = this_spell.uptime diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua index 58578c1a..a2d125f9 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua @@ -38,6 +38,8 @@ local class_type_misc = _detalhes.atributos.misc --> misc --> main combat object local _combat_object +local sort_by_name = function (t1, t2) return t1.nome < t2.nome end + local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS EncounterDetails.name = "Encounter Details" @@ -289,9 +291,9 @@ local function CreatePluginFrames (data) return true end - --> create the button to show on toolbar [1] function OnClick [2] texture [3] tooltip [4] width or 14 [5] height or 14 [6] frame name or nil - --EncounterDetails.ToolbarButton = _detalhes.ToolBar:NewPluginToolbarButton (EncounterDetails.OpenWindow, "Interface\\Scenarios\\ScenarioIcon-Boss", Loc ["STRING_PLUGIN_NAME"], Loc ["STRING_TOOLTIP"], 12, 12, "ENCOUNTERDETAILS_BUTTON") --"Interface\\COMMON\\help-i" EncounterDetails.ToolbarButton = _detalhes.ToolBar:NewPluginToolbarButton (EncounterDetails.OpenWindow, "Interface\\AddOns\\Details_EncounterDetails\\images\\icon", Loc ["STRING_PLUGIN_NAME"], Loc ["STRING_TOOLTIP"], 16, 16, "ENCOUNTERDETAILS_BUTTON") --"Interface\\COMMON\\help-i" + EncounterDetails.ToolbarButton.shadow = true --> loads icon_shadow.tga when the instance is showing icons with shadows + --> setpoint anchors mod if needed EncounterDetails.ToolbarButton.y = 0.5 EncounterDetails.ToolbarButton.x = 0 @@ -321,6 +323,18 @@ local shift_monitor = function (self) end end +local sort_damage_from = function (a, b) + if (a[3] ~= "PET" and b[3] ~= "PET") then + return a[2] > b[2] + elseif (a[3] == "PET" and b[3] ~= "PET") then + return false + elseif (a[3] ~= "PET" and b[3] == "PET") then + return true + else + return a[2] > b[2] + end +end + --> custom tooltip for dead details --------------------------------------------------------------------------------------------------------- local function KillInfo (deathTable, row) @@ -442,7 +456,7 @@ local function DispellInfo (dispell, barra) tabela_jogadores [#tabela_jogadores + 1] = {nome, tabela [1], tabela [2]} end - _table_sort (tabela_jogadores, function (a, b) return a[2] > b[2] end) + _table_sort (tabela_jogadores, _detalhes.Sort2) _GameTooltip:ClearLines() _GameTooltip:AddLine (barra.texto_esquerdo:GetText()) @@ -468,7 +482,7 @@ local function KickBy (magia, barra) tabela_jogadores [#tabela_jogadores + 1] = {nome, tabela [1], tabela [2]} end - _table_sort (tabela_jogadores, function (a, b) return a[2] > b[2] end) + _table_sort (tabela_jogadores, _detalhes.Sort2) _GameTooltip:ClearLines() _GameTooltip:AddLine (barra.texto_esquerdo:GetText()) @@ -493,7 +507,7 @@ local function EnemySkills (habilidade, barra) tabela_jogadores [#tabela_jogadores + 1] = {nome, tabela[1], tabela[2]} end - _table_sort (tabela_jogadores, function (a, b) return a[2] > b[2] end) + _table_sort (tabela_jogadores, _detalhes.Sort2) _GameTooltip:ClearLines() _GameTooltip:AddLine (barra.texto_esquerdo:GetText()) @@ -523,21 +537,20 @@ local function DamageTakenDetails (jogador, barra) local este_agressor = showing._ActorTable[showing._NameIndexTable[nome]] if (este_agressor) then --> checagem por causa do total e do garbage collector que não limpa os nomes que deram dano - local habilidades = este_agressor.spell_tables._ActorTable + local habilidades = este_agressor.spells._ActorTable for id, habilidade in _pairs (habilidades) do --print ("oi - " .. este_agressor.nome) local alvos = habilidade.targets - for index, alvo in _ipairs (alvos._ActorTable) do - --print ("hello -> "..alvo.nome) - if (alvo.nome == jogador.nome) then - meus_agressores [#meus_agressores+1] = {id, alvo.total, este_agressor.nome} + for target_name, amount in _pairs (alvos) do + if (target_name == jogador.nome) then + meus_agressores [#meus_agressores+1] = {id, amount, este_agressor.nome} end end end end end - _table_sort (meus_agressores, function (a, b) return a[2] > b[2] end) + _table_sort (meus_agressores, _detalhes.Sort2) _GameTooltip:ClearLines() _GameTooltip:AddLine (barra.texto_esquerdo:GetText()) @@ -952,7 +965,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) _bit_band (jogador.flag_original, 0x00000400) == 0 ) then - local habilidades = jogador.spell_tables._ActorTable + local habilidades = jogador.spells._ActorTable for id, habilidade in _pairs (habilidades) do --if (habilidades_poll [id]) then @@ -975,15 +988,15 @@ function EncounterDetails:OpenAndRefresh (_, segment) --> pega os alvos e adiciona ao [2] local alvos = habilidade.targets - for index, jogador in _ipairs (alvos._ActorTable) do + for target_name, amount in _pairs (alvos) do --> ele tem o nome do jogador, vamos ver se este alvo é realmente um jogador verificando na tabela do combate - local tabela_dano_do_jogador = DamageContainer._ActorTable [DamageContainer._NameIndexTable [jogador.nome]] + local tabela_dano_do_jogador = DamageContainer._ActorTable [DamageContainer._NameIndexTable [target_name]] if (tabela_dano_do_jogador and tabela_dano_do_jogador.grupo) then - if (not esta_habilidade[2] [jogador.nome]) then - esta_habilidade[2] [jogador.nome] = {0, tabela_dano_do_jogador.classe} + if (not esta_habilidade[2] [target_name]) then + esta_habilidade[2] [target_name] = {0, tabela_dano_do_jogador.classe} end - esta_habilidade[2] [jogador.nome] [1] = esta_habilidade[2] [jogador.nome] [1] + jogador.total + esta_habilidade[2] [target_name] [1] = esta_habilidade[2] [target_name] [1] + amount end end --end @@ -991,7 +1004,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) elseif (have_pool) then --> check if the spell id is in the spell poll. - local habilidades = jogador.spell_tables._ActorTable + local habilidades = jogador.spells._ActorTable for id, habilidade in _pairs (habilidades) do if (habilidades_poll [id]) then @@ -1014,15 +1027,15 @@ function EncounterDetails:OpenAndRefresh (_, segment) --> pega os alvos e adiciona ao [2] local alvos = habilidade.targets - for index, jogador in _ipairs (alvos._ActorTable) do + for target_name, amount in _pairs (alvos) do --> ele tem o nome do jogador, vamos ver se este alvo é realmente um jogador verificando na tabela do combate - local tabela_dano_do_jogador = DamageContainer._ActorTable [DamageContainer._NameIndexTable [jogador.nome]] + local tabela_dano_do_jogador = DamageContainer._ActorTable [DamageContainer._NameIndexTable [target_name]] if (tabela_dano_do_jogador and tabela_dano_do_jogador.grupo) then - if (not esta_habilidade[2] [jogador.nome]) then - esta_habilidade[2] [jogador.nome] = {0, tabela_dano_do_jogador.classe} + if (not esta_habilidade[2] [target_name]) then + esta_habilidade[2] [target_name] = {0, tabela_dano_do_jogador.classe} end - esta_habilidade[2] [jogador.nome] [1] = esta_habilidade[2] [jogador.nome] [1] + jogador.total + esta_habilidade[2] [target_name] [1] = esta_habilidade[2] [target_name] [1] + amount end end end @@ -1139,46 +1152,35 @@ function EncounterDetails:OpenAndRefresh (_, segment) tabela.total = jogador.total --> em quem ele deu dano - for _, alvo in _ipairs (jogador.targets._ActorTable) do - --local este_jogador = DamageContainer._ActorTable [DamageContainer._NameIndexTable [alvo.nome]] - local este_jogador = _combat_object (1, alvo.nome) + for target_name, amount in _pairs (jogador.targets) do + local este_jogador = _combat_object (1, target_name) if (este_jogador) then if (este_jogador.classe ~= "PET" and este_jogador.classe ~= "UNGROUPPLAYER" and este_jogador.classe ~= "UNKNOW") then - tabela.dano_em [#tabela.dano_em +1] = {alvo.nome, alvo.total, este_jogador.classe} - tabela.dano_em_total = tabela.dano_em_total + alvo.total + tabela.dano_em [#tabela.dano_em +1] = {target_name, amount, este_jogador.classe} + tabela.dano_em_total = tabela.dano_em_total + amount end else --print ("actor not found: " ..alvo.nome ) end end - _table_sort (tabela.dano_em, function(a, b) return a[2] > b[2] end) + _table_sort (tabela.dano_em, _detalhes.Sort2) --> quem deu dano nele for agressor, _ in _pairs (jogador.damage_from) do --local este_jogador = DamageContainer._ActorTable [DamageContainer._NameIndexTable [agressor]] local este_jogador = _combat_object (1, agressor) if (este_jogador and este_jogador:IsPlayer()) then - for _, alvo in _ipairs (este_jogador.targets._ActorTable) do - if (alvo.nome == nome) then - tabela.damage_from [#tabela.damage_from+1] = {agressor, alvo.total, este_jogador.classe} - tabela.damage_from_total = tabela.damage_from_total + alvo.total + for target_name, amount in _pairs (este_jogador.targets) do + if (target_name == nome) then + tabela.damage_from [#tabela.damage_from+1] = {agressor, amount, este_jogador.classe} + tabela.damage_from_total = tabela.damage_from_total + amount end end end end - _table_sort (tabela.damage_from, - function (a, b) - if (a[3] ~= "PET" and b[3] ~= "PET") then - return a[2] > b[2] - elseif (a[3] == "PET" and b[3] ~= "PET") then - return false - elseif (a[3] ~= "PET" and b[3] == "PET") then - return true - else - return a[2] > b[2] - end - end) + _table_sort (tabela.damage_from, sort_damage_from) + tinsert (adds, tabela) end @@ -1254,7 +1256,9 @@ function EncounterDetails:OpenAndRefresh (_, segment) local index = 1 quantidade = 0 - table.sort (adds, function (t1, t2) return t1.nome < t2.nome end) + + + table.sort (adds, sort_by_name) for index, esta_tabela in _ipairs (adds) do @@ -1395,7 +1399,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) for spellid, tabela in _pairs (habilidades_interrompidas) do tabela_em_ordem [#tabela_em_ordem+1] = tabela end - _table_sort (tabela_em_ordem, function (a, b) return a[2] > b[2] end) + _table_sort (tabela_em_ordem, _detalhes.Sort2) index = 1 @@ -1417,8 +1421,8 @@ function EncounterDetails:OpenAndRefresh (_, segment) local successful = 0 --> pegar quantas vezes a magia passou com sucesso. for _, enemy_actor in _ipairs (DamageContainer._ActorTable) do - if (enemy_actor.spell_tables._ActorTable [spellid]) then - local spell = enemy_actor.spell_tables._ActorTable [spellid] + if (enemy_actor.spells._ActorTable [spellid]) then + local spell = enemy_actor.spells._ActorTable [spellid] successful = spell.successful_casted end end @@ -1509,7 +1513,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) for spellid, tabela in _pairs (habilidades_dispeladas) do tabela_em_ordem [#tabela_em_ordem+1] = tabela end - _table_sort (tabela_em_ordem, function (a, b) return a[2] > b[2] end) + _table_sort (tabela_em_ordem, _detalhes.Sort2) index = 1 @@ -1568,7 +1572,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) quantidade = 0 - -- boss_info.spell_tables_info o erro de lua do boss é a habilidade dele que não foi declarada ainda + -- boss_info.spells_info o erro de lua do boss é a habilidade dele que não foi declarada ainda local mortes = _combat_object.last_events_tables local habilidades_info = boss_info and boss_info.spell_mechanics or {} --barra.extra pega esse cara aqui --> então esse erro é das habilidades que não tao diff --git a/plugins/Details_EncounterDetails/images/icon.tga b/plugins/Details_EncounterDetails/images/icon.tga index 8033b089e844d87c76fee94d6d2b4abf0ff7ab0c..b799bd3278dcc1ce32781fac12b0f8c1a5d85b62 100644 GIT binary patch literal 1837 zcmZXV2~ZPP7{`}0;Ya{EyoF+w;ijMzE4C=$7!escENVqGsftyKcpzX}5JiwnL_{D7 z5y=4M5W*n_P{D92BKfijgoqU7km@+L(@v+;nfBXsG&d%9^%RwfT7C%&@gCo6NT)w{@^Du!x3?p$7A+(# ztS#kBZEY2XblMbxYz?j{#=5$?gpQ6*q>HE5o1pLrNXp2B(x2)e;ampnK5!6LIyufD zlZ&>+)KJ7ls-&WHOt2Ul&)oql=>g85Oe8 zT0fKWqg+uZ80L&SCQRnDr1T6~YgezVwY!(BY-*ivkaWzq_x6pR&(0b_W)j(66gvaU zf44!!7^0FFE?RPr6&xbp|9zZ7P+K=$P+B&(JDM%s|7}drxl37FE5+i$j{boc$P6R< z3O$wok16LIje8=fz9p{~HCab{z@a7Ti|e&@^_2o0@NHzj6ci?Oe2C$s|sBp21-JPQ^JnyA&WZiR>)4g_;;m zVPJEC_j=zexh4FO&09lcMhvqFGYhllr&72hoY*74J%3?jfu-f#T5lgUGEdfgvHm4` z%CvW4hE08x--b;AYn)TF-B)6)}KTif*6SX(ODhhh}c;W1ft+darEEQQqUd`M2a0Ckcs zV8RwR0;$@QabG->Z6t+A`c*4A#++s9{Wov-g?NLZ*!RNqL#i&wyoJq|X@ zmO@Ni9Q2T5P*_$5$iSMlYXLog-cgk5gGgM$E`EWV2YJHsmu;Q*Ul*4N=dueftB;-H zl9zcx_#rbJ9NawN3cm!3MU{|UbOVq9WC1;ZUL|J02a$9W<4+sg+k5}`=kMtv0soii z!`#`U2_54)v|Q3ZBoS_Ria}Ic4d-%%;Nf!}=#~Q55qTU6d8L3J8G2QiG4(;D0gXma zOi7C!86SUmGAVh=XOm!(W+7I(cwPfSe;1rdxdwGjjbLQXhsAb$uyw2gLU$wV<8VNx zR*$1sf*B6lNOOD+Iy#0-$Gz;+&4*$W$Cj;@ju|ssz~%E2d`{sIpL7+P?$pAT;9{^| z%!5@PjbLCL1W^ar5XDJ&ie9nyZBud7!uip`#Y^hXVv(y{BNV0<+riEu8cw7X!d1Qi z`ejm>{c8fE4wmB(q2S~Z00FEm;Na{vf!^C6$5D~3%k5W^!C_%z@yT2zuS!Vv$sfV^ z+%zh;|#HBqi{_{ zoq78!IWhkVQVaMuf!5sB3xe8KkjfRHn4gB*-CcmB3?0wVDba>e_hrIhGPC$1(F3tW zLgM>UmesAJkpp=NFI} z8uoQpdUmc-P*DxXleo}6I0S8d1DZJTy)H<z)gG>*ym1qyr+D&xz^oZ4t zPQ+(kUXgJpPpcD>Q^;arg{-o%MRo)?OE&wkde82Cn^qx1v6?}%F@!MG*Eb**SXdFJ vMy3Q!pGM&P2qPmS&A;YLrTxxn&nPE#goj21?qr3rLbkg`Zf0!@bR+%+?7Onp literal 905 zcmY*X%}*0S6yI)Xcj=0NpcF!ca>1JDAK<}@Vkp~aV_PD`k0{0f2~-jrgi6z*v_LI- zkm!YjC^5zZ5G=N(Y_}gkX@Fp2#1K6hFOZNB?B{NYZ$`y9$?v_H%=`W3&3lg^6vW?E zL=+L#^b>UKMS4KT+_1Jn=H%f0A~Pdh>_yx1BzTKl`^eutyf(m zuCLBv=l0Ox(2m35*m63Yn_YLi#wePi{-@BOBJb?%+~C4j-w!FAw zx7jzUYN`q_#SW1K10az1wavxD)B_d$G$$=fy}YB(OTqPoAF=0m1|8%O6IA@jjhLQ-}^6f;ga4 zlarHfTfZ$a;GRjJW5-h9GXsM&DL@t=fJDk{HfKPhiIP$>OfSS1iiN7v-qt=l@oqvS z=)nYF7byWV2}z`il-@M>z46!MS)0u^fs&9A65=otfNqebC8Z@Gz20h?601)<&45pS z{Jgp!SqklY`ENqK&YJ=3_4M|9QP-*&_yOu9JdF*!Ur|v}IN}~j+owG1A{}2_%z6Fq zb5Qpj7xL%AOMK2B`joWvSym9Al#st?ghG50R&jAL16|pTE(Jx7_ldw35!((%%<~02 zLU=Kl9eq9;)9dxe;e9z`{;8l$CMz@;47cCBeI>-=VKEe)7l0=OIBzBt<+A?3Eb{5* zrsf8QW)$#u$v--3JvtV++^%tyb$n$(jIYMTmGyXXc`cUUBYXm?)1gwS@R;DX;n6`w z$OACOMq`KT@$ja}WXf4AmW twisted fate adds spell + local TwistedFate = actor.spells:GetSpell (137972) --> twisted fate adds spell if (TwistedFate) then if (not actor.lastTwistedFate) then actor.lastTwistedFate = 0 diff --git a/startup.lua b/startup.lua index 2660fcd1..48b9ddfe 100644 --- a/startup.lua +++ b/startup.lua @@ -3,7 +3,6 @@ if ( -- version 1.21.0 not _G._detalhes.atributo_custom.damagedoneTooltip or - not _G._detalhes.atributo_custom.damagetakenTooltip or not _G._detalhes.atributo_custom.healdoneTooltip ) then @@ -313,13 +312,10 @@ function _G._detalhes:Start() _detalhes:FillUserCustomSpells() _detalhes:AddDefaultCustomDisplays() - if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 31 and enable_reset_warning) then - for index, custom in ipairs (_detalhes.custom) do - if (custom.name == Loc ["STRING_CUSTOM_POT_DEFAULT"]) then - -- only on 14/11/2014 - --_detalhes.atributo_custom:RemoveCustom (index) - break - end + --> Reset for the new structure + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 43 and enable_reset_warning) then + for i = 1, #_detalhes.custom do + _detalhes.atributo_custom:RemoveCustom (i) end _detalhes:AddDefaultCustomDisplays() end @@ -436,7 +432,7 @@ function _G._detalhes:Start() --> get in the realm chat channel if (not _detalhes.schedule_chat_enter and not _detalhes.schedule_chat_leave) then - _detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 30) + _detalhes:ScheduleTimer ("CheckChatOnZoneChange", 60) end --> open profiler @@ -495,70 +491,25 @@ function _G._detalhes:Start() real_time_frame:SetScript ("OnUpdate", function (self, elapsed) if (_detalhes.in_combat and instance.atributo == 1 and instance.sub_atributo == 1) then for i = 1, instance:GetNumRows() do - local row = instance:GetRow (index) - if (row:IsShown()) then + local row = instance:GetRow (i) + if (row and row:IsShown()) then + local actor = row.minha_tabela - local right_text = row.texto_direita + if (actor) then + local dps_text = row.ps_text + if (dps_text) then + local new_dps = math.floor (actor.total / actor:Tempo()) + local formated_dps = _detalhes.ToKFunctions [_detalhes.ps_abbreviation] (_, new_dps) + + row.texto_direita:SetText (row.texto_direita:GetText():gsub (dps_text, formated_dps)) + row.ps_text = formated_dps + end + end end end end end) --]] - --WOD Spell Test - --[[ - - local f = CreateFrame ("frame") - f:SetSize (400, 600) - f:SetPoint ("center", UIParent) - - local invalid_spells = {} - local amt = 0 - - --for spellid, class in pairs (_detalhes.ClassSpellList) do - --for spellid, class in pairs (_detalhes.CrowdControlSpells) do - --for spellid, class in pairs (_detalhes.AbsorbSpells) do - --for spellid, class in pairs (_detalhes.DefensiveCooldownSpellsNoBuff) do - --for spellid, class in pairs (_detalhes.DefensiveCooldownSpells) do - --for spellid, class in pairs (_detalhes.HarmfulSpells) do - --for spellid, class in pairs (_detalhes.MiscClassSpells) do - --for spellid, class in pairs (_detalhes.DualSideSpells) do - --for spellid, class in pairs (_detalhes.AttackCooldownSpells) do - - - for spellid, class in pairs (_detalhes.HelpfulSpells) do - - local name = GetSpellInfo (spellid) - - if (not name) then - invalid_spells [spellid] = class - amt = amt + 1 - - local edit = _detalhes.gump:NewTextEntry (f, f, "box"..amt, nil, 150, 12) - edit:SetPoint ("topleft", f, "topleft", 10, amt*13*-1) - edit:SetText (spellid) - edit:SetHook ("OnEditFocusGained", function() - edit:HighlightText() - end) - end - - end - - print ("Spells Invalid:", amt) - --]] - - --[[ - local parser = CreateFrame ("frame") - parser:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") - parser:SetScript ("OnEvent", function (self, evento, time, token, ...) - - if (token == "SPELL_AURA_APPLIED") then - - print (...) - - end - - end) - --]] end