From 80f1fd96527dc4e1429b202be6c804f0c150c899 Mon Sep 17 00:00:00 2001 From: tercio Date: Wed, 17 Dec 2014 02:09:45 -0200 Subject: [PATCH] - added new plugin: Raid Check. --- .pkgmeta | 3 +- boot.lua | 12 +- classes/classe_custom.lua | 24 ++ core/control.lua | 6 + functions/spells.lua | 1 + .../Details_RaidCheck/Details_RaidCheck.lua | 308 ++++++++++++++++++ .../Details_RaidCheck/Details_RaidCheck.toc | 10 + .../Libs/AceLocale-3.0/AceLocale-3.0.lua | 137 ++++++++ .../Libs/AceLocale-3.0/AceLocale-3.0.xml | 4 + .../Libs/LibStub/LibStub.lua | 51 +++ .../Libs/LibStub/LibStub.toc | 13 + .../Libs/LibStub/tests/test.lua | 41 +++ .../Libs/LibStub/tests/test2.lua | 27 ++ .../Libs/LibStub/tests/test3.lua | 14 + .../Libs/LibStub/tests/test4.lua | 41 +++ plugins/Details_RaidCheck/embeds.xml | 7 + plugins/Details_RaidCheck/icon.tga | Bin 0 -> 2541 bytes plugins/Details_RaidCheck/icon_red.tga | Bin 0 -> 2541 bytes plugins/Details_RaidCheck/icon_shadow.tga | Bin 0 -> 3768 bytes 19 files changed, 694 insertions(+), 5 deletions(-) create mode 100644 plugins/Details_RaidCheck/Details_RaidCheck.lua create mode 100644 plugins/Details_RaidCheck/Details_RaidCheck.toc create mode 100644 plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.lua create mode 100644 plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.xml create mode 100644 plugins/Details_RaidCheck/Libs/LibStub/LibStub.lua create mode 100644 plugins/Details_RaidCheck/Libs/LibStub/LibStub.toc create mode 100644 plugins/Details_RaidCheck/Libs/LibStub/tests/test.lua create mode 100644 plugins/Details_RaidCheck/Libs/LibStub/tests/test2.lua create mode 100644 plugins/Details_RaidCheck/Libs/LibStub/tests/test3.lua create mode 100644 plugins/Details_RaidCheck/Libs/LibStub/tests/test4.lua create mode 100644 plugins/Details_RaidCheck/embeds.xml create mode 100644 plugins/Details_RaidCheck/icon.tga create mode 100644 plugins/Details_RaidCheck/icon_red.tga create mode 100644 plugins/Details_RaidCheck/icon_shadow.tga diff --git a/.pkgmeta b/.pkgmeta index 492c2cb3..8729d16b 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -11,4 +11,5 @@ move-folders: Details/plugins/Details_RaidInfo-Highmaul: Details_RaidInfo-Highmaul Details/plugins/Details_DataStorage: Details_DataStorage Details/plugins/Details_DungeonInfo-Warlords: Details_DungeonInfo-Warlords - Details/plugins/Details_3DModelsPaths: Details_3DModelsPaths \ No newline at end of file + Details/plugins/Details_3DModelsPaths: Details_3DModelsPaths + Details/plugins/Details_RaidCheck: Details_RaidCheck \ No newline at end of file diff --git a/boot.lua b/boot.lua index f5ad71d0..c41968f6 100644 --- a/boot.lua +++ b/boot.lua @@ -1,10 +1,10 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> global name declaration - + _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 284 --it's 284 for release - _detalhes.userversion = "v3.6.0" + _detalhes.build_counter = 285 --it's 285 for release + _detalhes.userversion = "v3.6.1" _detalhes.realversion = 50 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" @@ -18,6 +18,10 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ +|cFFFFFF00v3.6.1 (|cFFFFCC00Dec 17, 2014|r|cFFFFFF00)|r:\n\n +|cFFFFFF00-|r Started coding the new plugin for check flasks, food, pre potion.\n\n +|cFFFFFF00-|r Death time seems to be bugged due to Combat elapsed time change.\n\n + |cFFFFFF00v3.6.0 (|cFFFFCC00Dec 16, 2014|r|cFFFFFF00)|r:\n\n |cFFFFFF00-|r Elapsed combat time now uses Float numbers instead of Integer, this might bug something, be aware of anomalies.\n This change makes fun things, now we can make Dps and Hps update really quick and also increase the accuracy with warcraftlogs.\n\n @@ -32,7 +36,7 @@ This change makes fun things, now we can make Dps and Hps update really quick an |cFFFFFF00-|r Clicking on report button when the report window is already open, make it close.\n\n --]] - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.6.0 (|cFFFFCC00Dec 16, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Elapsed combat time now uses Float numbers instead of Integer, this might bug something, be aware of anomalies.\nThis change makes fun things, now we can make Dps and Hps update really quick and also increase the accuracy with warcraftlogs.\n\n|cFFFFFF00v3.5.1 (|cFFFFCC00Dec 16, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed few accuracy on miss spells.\n\n|cFFFFFF00v3.5.0 (|cFFFFCC00Dec 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed tooltip for Auras and Voidzones, now shows sorted by damage and time.\n\n|cFFFFFF00-|r More fixes for Korgath encounter on Highmaul.\n\n|cFFFFFF00-|r Added slash commands: 'reset' 'config'.\n\n|cFFFFFF00-|r Spell bars on Player Details Window now is painted with the spell spellschool color.\n\n|cFFFFFF00-|r Multistrike doesn't count any more for spell's Minimal Damage.\n\n|cFFFFFF00-|r Resource display got an tooltip which shows what resource is and resource gained per minute.\n\n|cFFFFFF00-|r Clicking on report button when the report window is already open, make it close.\n\n|cFFFFFF00v3.4.7 (|cFFFFCC00Dec 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Advanced Death Logs plugin got updates on Endurance Player Value and few bug fixes.\n\n|cFFFFFF00-|r Max Window Amount options can new be set to 1, before the minimum was 3.\n\n|cFFFFFF00-|r Fixed a problem with friendly fire tooltip where sometimes it wasn't showing up.\n\n|cFFFFFF00-|r Fixed cooldowns tooltip which wasn't showing rounded numbers (49.99 instead of 50).\n\n|cFFFFFF00-|r Fixed Warrior's Shield Block which wasn't being count as a cooldown.\n\n|cFFFFFF00-|r Fixed a problem where sometimes when a hunter pull and reset the boss right after, was causing segments to merge.\n\n|cFFFFFF00v3.4.4 (|cFFFFCC00Dec 05, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed a issue with Ko'Ragh boss on Highmaul raid.\n\n|cFFFFFF00-|r Few changes on Bookmark panel.\n\n|cFFFFFF00v3.4.3 (|cFFFFCC00Dec 02, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Removed 'Simple Gray' skin.\n\n|cFFFFFF00-|r Addde new skin: 'Forced Square'.\n\n|cFFFFFF00-|r 'Default Skin' got renamed to 'WoW Interface'.\n\n|cFFFFFF00v3.4.2 (|cFFFFCC00Dec 01, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed a bug with menu desaturation where erase and close buttons stay colored after clicking on it.\n\n|cFFFFFF00-|r Fixed stretch where sometimes after release the window, all exceeded bars shows up and fade in again.\n\n|cFFFFFF00-|r Fixed a bug with the +- buttons on the window's scale option.\n\n|cFFFFFF00-|r Fixed the border for sub menus on mode menu.\n\n|cFFFFFF00v3.4.0 (|cFFFFCC00Nov 29, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed custom displays ignoring 'target' setted.\n\n|cFFFFFF00-|r Fixed plugins showing its icon even when auto hide menus is enabled.\n\n|cFFFFFF00-|r .Updates slash command 'worldboss' now it shows Draenor bosses.\n\n|cFFFFFF00v3.3.0 (|cFFFFCC00Nov 25, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added 3D models for the bars in the window. The options are at Appearance -> Rows: Advanced.\n\n|cFFFFFF00-|r Now when showing custom displays, clicking on a bar report what is shown on bar's tooltip.\n\n|cFFFFFF00-|r More fixes for dungeon bosses identification.\n\n|cFFFFFF00-|r Fixed a tooltip bug with Debuff Uptime and Aura & Voidzone displays.\n\n|cFFFFFF00-|r Fixed Player Details Window for friendly fire and damage taken.\n\n|cFFFFFF00-|r Fixed Molten Core Raid Finder version where all bosses was considered trash segments.\n\n|cFFFFFF00v3.2.4 (|cFFFFCC00Nov 19, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r More fixes for dungeon bosses recognition.\n\n|cFFFFFF00-|r Fixes for few errors during combat parser.\n\n|cFFFFFF00v3.2.3 (|cFFFFCC00Nov 18, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk's Stagger ability which was counting as damage done.\n\n|cFFFFFF00-|r Added WoD dungeon information, this fixes dungeon bosses being assigned as 'trash cleanup'.\n\n|cFFFFFF00-|r Added more information on API.txt document (is in Details! root folder).\n\n|cFFFFFF00v3.2.1 (|cFFFFCC00Nov 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Custom Displays updated to track WoD potions.\n\n|cFFFFFF00-|r Added Feedback panel at options panel.\n\n|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)." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.6.1 |cFF55FF55(beta)|r (|cFFFFCC00Dec 17, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Started coding the new plugin for check flasks, food, pre potion.\n\n|cFFFFFF00-|r Death time seems to be bugged due to Combat elapsed time change.\n\n|cFFFFFF00v3.6.0 |cFF55FF55(beta)|r (|cFFFFCC00Dec 16, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Elapsed combat time now uses Float numbers instead of Integer, this might bug something, be aware of anomalies.\nThis change makes fun things, now we can make Dps and Hps update really quick and also increase the accuracy with warcraftlogs.\n\n|cFFFFFF00v3.5.1 (|cFFFFCC00Dec 16, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed few accuracy on miss spells.\n\n|cFFFFFF00v3.5.0 (|cFFFFCC00Dec 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed tooltip for Auras and Voidzones, now shows sorted by damage and time.\n\n|cFFFFFF00-|r More fixes for Korgath encounter on Highmaul.\n\n|cFFFFFF00-|r Added slash commands: 'reset' 'config'.\n\n|cFFFFFF00-|r Spell bars on Player Details Window now is painted with the spell spellschool color.\n\n|cFFFFFF00-|r Multistrike doesn't count any more for spell's Minimal Damage.\n\n|cFFFFFF00-|r Resource display got an tooltip which shows what resource is and resource gained per minute.\n\n|cFFFFFF00-|r Clicking on report button when the report window is already open, make it close.\n\n|cFFFFFF00v3.4.7 (|cFFFFCC00Dec 11, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Advanced Death Logs plugin got updates on Endurance Player Value and few bug fixes.\n\n|cFFFFFF00-|r Max Window Amount options can new be set to 1, before the minimum was 3.\n\n|cFFFFFF00-|r Fixed a problem with friendly fire tooltip where sometimes it wasn't showing up.\n\n|cFFFFFF00-|r Fixed cooldowns tooltip which wasn't showing rounded numbers (49.99 instead of 50).\n\n|cFFFFFF00-|r Fixed Warrior's Shield Block which wasn't being count as a cooldown.\n\n|cFFFFFF00-|r Fixed a problem where sometimes when a hunter pull and reset the boss right after, was causing segments to merge.\n\n|cFFFFFF00v3.4.4 (|cFFFFCC00Dec 05, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed a issue with Ko'Ragh boss on Highmaul raid.\n\n|cFFFFFF00-|r Few changes on Bookmark panel.\n\n|cFFFFFF00v3.4.3 (|cFFFFCC00Dec 02, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Removed 'Simple Gray' skin.\n\n|cFFFFFF00-|r Addde new skin: 'Forced Square'.\n\n|cFFFFFF00-|r 'Default Skin' got renamed to 'WoW Interface'.\n\n|cFFFFFF00v3.4.2 (|cFFFFCC00Dec 01, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed a bug with menu desaturation where erase and close buttons stay colored after clicking on it.\n\n|cFFFFFF00-|r Fixed stretch where sometimes after release the window, all exceeded bars shows up and fade in again.\n\n|cFFFFFF00-|r Fixed a bug with the +- buttons on the window's scale option.\n\n|cFFFFFF00-|r Fixed the border for sub menus on mode menu.\n\n|cFFFFFF00v3.4.0 (|cFFFFCC00Nov 29, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed custom displays ignoring 'target' setted.\n\n|cFFFFFF00-|r Fixed plugins showing its icon even when auto hide menus is enabled.\n\n|cFFFFFF00-|r .Updates slash command 'worldboss' now it shows Draenor bosses.\n\n|cFFFFFF00v3.3.0 (|cFFFFCC00Nov 25, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added 3D models for the bars in the window. The options are at Appearance -> Rows: Advanced.\n\n|cFFFFFF00-|r Now when showing custom displays, clicking on a bar report what is shown on bar's tooltip.\n\n|cFFFFFF00-|r More fixes for dungeon bosses identification.\n\n|cFFFFFF00-|r Fixed a tooltip bug with Debuff Uptime and Aura & Voidzone displays.\n\n|cFFFFFF00-|r Fixed Player Details Window for friendly fire and damage taken.\n\n|cFFFFFF00-|r Fixed Molten Core Raid Finder version where all bosses was considered trash segments.\n\n|cFFFFFF00v3.2.4 (|cFFFFCC00Nov 19, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r More fixes for dungeon bosses recognition.\n\n|cFFFFFF00-|r Fixes for few errors during combat parser.\n\n|cFFFFFF00v3.2.3 (|cFFFFCC00Nov 18, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk's Stagger ability which was counting as damage done.\n\n|cFFFFFF00-|r Added WoD dungeon information, this fixes dungeon bosses being assigned as 'trash cleanup'.\n\n|cFFFFFF00-|r Added more information on API.txt document (is in Details! root folder).\n\n|cFFFFFF00v3.2.1 (|cFFFFCC00Nov 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Custom Displays updated to track WoD potions.\n\n|cFFFFFF00-|r Added Feedback panel at options panel.\n\n|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." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index 72c0602b..572db9e6 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -1103,6 +1103,21 @@ end end + --pure rage + local pure_rage_potion = buff_uptime_container [175821] --WoD + if (pure_rage_potion) then + local used = pure_rage_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + --potion of the mountains local mountains_potion = buff_uptime_container [156430] --WoD --local mountains_potion = buff_uptime_container [105698] --MoP @@ -1172,6 +1187,15 @@ GameCooltip:AddIcon (icon, 1, 1, 14, 14) end + --pure rage + local pure_rage_potion = buff_uptime_container [175821] --WoD + if (pure_rage_potion) then + local name, _, icon = GetSpellInfo (175821) --WoD + GameCooltip:AddLine (name, pure_rage_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + --virmen's bite local virmens_bite_potion = buff_uptime_container [156423] --WoD --local virmens_bite_potion = buff_uptime_container [105697] --MoP diff --git a/core/control.lua b/core/control.lua index 73e73919..48e54ef3 100644 --- a/core/control.lua +++ b/core/control.lua @@ -281,6 +281,8 @@ _detalhes.tabela_vigente.combat_id = n_combate --> grava o número deste combate na tabela atual -- setup combat id on new table + _detalhes.last_combat_pre_pot_used = nil + --> é o timer que ve se o jogador ta em combate ou não -- check if any party or raid members are in combat _detalhes.tabela_vigente.verifica_combate = _detalhes:ScheduleRepeatingTimer ("EstaEmCombate", 1) @@ -481,6 +483,10 @@ _detalhes.last_encounter2 = _detalhes.last_encounter _detalhes.last_encounter = _detalhes.tabela_vigente.is_boss.name + if (_detalhes.pre_pot_used) then + _detalhes.last_combat_pre_pot_used = table_deepcopy (_detalhes.pre_pot_used) + end + if (_detalhes.pre_pot_used and _detalhes.announce_prepots.enabled) then _detalhes:Msg (_detalhes.pre_pot_used or "") _detalhes.pre_pot_used = nil diff --git a/functions/spells.lua b/functions/spells.lua index f130b34b..2ac121b8 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -13,6 +13,7 @@ do [156430] = true, --draenic armor potion [156423] = true, --draenic agility potion [156428] = true, --draenic strength potion + [175821] = true, --draenic pure rage potion } _detalhes.SpecSpellList = { diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.lua b/plugins/Details_RaidCheck/Details_RaidCheck.lua new file mode 100644 index 00000000..eb9cb711 --- /dev/null +++ b/plugins/Details_RaidCheck/Details_RaidCheck.lua @@ -0,0 +1,308 @@ + +local _UnitAura = UnitAura + +local flask_list = { + [156064] = true, --Greater Draenic Agility Flask + [156070] = true, --Draenic Intellect Flask + [156071] = true, --Draenic Strength Flask + [156073] = true, --Draenic Agility Flask + [156077] = true, --Draenic Stamina Flask + [156079] = true, --Greater Draenic Intellect Flask + [156080] = true, --Greater Draenic Strength Flask + [156084] = true, --Greater Draenic Stamina Flask +} + +-- 175790, --shiftness potion (70% speed) +-- 175817, --living action potion (remove stun) +-- 156445, --rejuvenation potion (restore 70k hp) +-- 156436, --mana potion +-- 156432, --channeled mana potion + +local pre_potions_list = { + [156426] = true, --draenic intellect potion + [156430] = true, --draenic armor potion + [156423] = true, --draenic agility potion + [156428] = true, --draenic strength potion + [175821] = true, --draenic pure rage potion +} + +local food_list = { + [160600] = true, -- + [160724] = true, -- + [160726] = true, -- + [160793] = true, -- + [160832] = true, -- + [160839] = true, -- + [160883] = true, -- + [160889] = true, -- + [160893] = true, -- + [160897] = true, -- + [160900] = true, -- + [160902] = true, -- + [175218] = true, -- + [175219] = true, -- + [175220] = true, -- + [175222] = true, -- + [175223] = true, -- +} + + + +--> localization + local Loc = LibStub ("AceLocale-3.0"):GetLocale ("Details") +--> create the plugin object + local DetailsRaidCheck = _detalhes:NewPluginObject ("DetailsRaidCheck", DETAILSPLUGIN_ALWAYSENABLED) + tinsert (UISpecialFrames, "DetailsRaidCheck") + DetailsRaidCheck:SetPluginDescription (Loc ["STRING_RAIDCHECK_PLUGIN_DESC"]) + + + local CreatePluginFrames = function() + + DetailsRaidCheck.usedprepot_table = {} + DetailsRaidCheck.haveflask_table = {} + DetailsRaidCheck.havefood_table = {} + + DetailsRaidCheck.on_raid = false + DetailsRaidCheck.tracking_buffs = false + + local empty_table = {} + + function DetailsRaidCheck:OnDetailsEvent (event, ...) + + if (event == "ZONE_TYPE_CHANGED") then + + DetailsRaidCheck:CheckZone (...) + + elseif (event == "COMBAT_PLAYER_LEAVE") then + + if (DetailsRaidCheck.on_raid) then + + --> GET PRE POTION LIST + table.wipe (DetailsRaidCheck.usedprepot_table or empty_table) + DetailsRaidCheck.usedprepot_table = DetailsRaidCheck:FormatTable (DetailsRaidCheck.last_combat_pre_pot_used or "") + + DetailsRaidCheck:StartTrackBuffs() + end + + elseif (event == "COMBAT_PLAYER_ENTER") then + + if (DetailsRaidCheck.on_raid) then + + DetailsRaidCheck:StopTrackBuffs() + + end + + elseif (event == "DETAILS_STARTED") then + + DetailsRaidCheck:CheckZone() + + elseif (event == "PLUGIN_DISABLED") then + + DetailsRaidCheck.on_raid = false + DetailsRaidCheck.tracking_buffs = false + + DetailsRaidCheck:StopTrackBuffs() + --> HIDE ICON + + elseif (event == "PLUGIN_ENABLED") then + + DetailsRaidCheck:CheckZone() + + end + + end + + DetailsRaidCheck.ToolbarButton = _detalhes.ToolBar:NewPluginToolbarButton (DetailsRaidCheck.empty_function, [[Interface\AddOns\Details_RaidCheck\icon]], Loc ["STRING_RAIDCHECK_PLUGIN_NAME"], "", 16, 16, "RAIDCHECK_PLUGIN_BUTTON") + DetailsRaidCheck.ToolbarButton.shadow = true --> loads icon_shadow.tga when the instance is showing icons with shadows + DetailsRaidCheck:ShowToolbarIcon (DetailsRaidCheck.ToolbarButton, "star") + + local show_panel = CreateFrame ("frame", nil, UIParent) + show_panel:SetSize (400, 300) + show_panel:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16}) + show_panel:SetPoint ("bottom", DetailsRaidCheck.ToolbarButton, "top", 0, 10) + + local food_str = show_panel:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + food_str:SetPoint ("topleft", show_panel, "topleft", 15, -20) + + local flask_str = show_panel:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + flask_str:SetPoint ("topleft", show_panel, "topleft", 150, -20) + + local prepot_str = show_panel:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + prepot_str:SetPoint ("topleft", show_panel, "topleft", 285, -20) + + show_panel:Hide() + + --> overwrite the default scripts + DetailsRaidCheck.ToolbarButton:SetScript ("OnClick", function (self, button) + + end) + + local update_panel = function (self) + + local s, f = "No Food:\n\n", "No Flask:\n\n" + + for i = 1, GetNumGroupMembers(), 1 do + + local name = UnitName ("raid" .. i) + + if (not DetailsRaidCheck.havefood_table [name]) then + s = s .. name .. "\n" + end + + if (not DetailsRaidCheck.haveflask_table [name]) then + f = f .. name .. "\n" + end + + end + + food_str:SetText (s) + flask_str:SetText (f) + + end + + DetailsRaidCheck.ToolbarButton:SetScript ("OnEnter", function (self) + show_panel:Show() + show_panel:SetScript ("OnUpdate", update_panel) + end) + + DetailsRaidCheck.ToolbarButton:SetScript ("OnLeave", function (self) + show_panel:Hide() + show_panel:SetScript ("OnUpdate", nil) + end) + + function DetailsRaidCheck:CheckZone (...) + zone_type = select (1, ...) + + if (not zone_type) then + zone_type = select (2, GetInstanceInfo()) + end + + if (zone_type == "raid") then + + DetailsRaidCheck.on_raid = true + + if (not DetailsRaidCheck.in_combat) then + DetailsRaidCheck:StartTrackBuffs() + + end + else + DetailsRaidCheck.on_raid = false + + if (DetailsRaidCheck.tracking_buffs) then + DetailsRaidCheck:StopTrackBuffs() + + end + end + end + + function DetailsRaidCheck:BuffTrackTick() + + for player_name, have in pairs (DetailsRaidCheck.haveflask_table) do + DetailsRaidCheck.haveflask_table [player_name] = nil + end + for player_name, have in pairs (DetailsRaidCheck.havefood_table) do + DetailsRaidCheck.havefood_table [player_name] = nil + end + + for i = 1, GetNumGroupMembers(), 1 do + local name = UnitName ("raid" .. i) + for buffIndex = 1, 41 do + local bname, _, _, _, _, _, _, _, _, _, spellid = _UnitAura ("raid" .. i, buffIndex, nil, "HELPFUL") + + if (bname and flask_list [spellid]) then + DetailsRaidCheck.haveflask_table [name] = true + end + + if (bname and food_list [spellid]) then + DetailsRaidCheck.havefood_table [name] = true + end + end + end + + end + + function DetailsRaidCheck:FormatTable (t) + + for k, v in ipairs ({strsplit ( "|c", t )}) do + tinsert (DetailsRaidCheck.usedprepot_table, "|c" .. v) + end + + end + +-- DETAILS_PLUGIN_RAIDCHECK +-- /run vardump (DETAILS_PLUGIN_RAIDCHECK.havefood_table) +-- DETAILS_PLUGIN_RAIDCHECK.tracking_buffs +-- /run DETAILS_PLUGIN_RAIDCHECK:StartTrackBuffs() +-- /run DETAILS_PLUGIN_RAIDCHECK:StopTrackBuffs() + + function DetailsRaidCheck:StartTrackBuffs() + + if (not DetailsRaidCheck.tracking_buffs) then + DetailsRaidCheck.tracking_buffs = true + + table.wipe (DetailsRaidCheck.haveflask_table) + table.wipe (DetailsRaidCheck.havefood_table) + + if (DetailsRaidCheck.tracking_buffs_process) then + DetailsRaidCheck:CancelTimer (DetailsRaidCheck.tracking_buffs_process) + end + + DetailsRaidCheck.tracking_buffs_process = DetailsRaidCheck:ScheduleRepeatingTimer ("BuffTrackTick", 1) + end + + end + + function DetailsRaidCheck:StopTrackBuffs() + + if (DetailsRaidCheck.tracking_buffs) then + DetailsRaidCheck.tracking_buffs = false + + if (DetailsRaidCheck.tracking_buffs_process) then + DetailsRaidCheck:CancelTimer (DetailsRaidCheck.tracking_buffs_process) + end + else + if (DetailsRaidCheck.tracking_buffs_process) then + DetailsRaidCheck:CancelTimer (DetailsRaidCheck.tracking_buffs_process) + end + end + + end + + end + + function DetailsRaidCheck:OnEvent (_, event, ...) + + if (event == "ADDON_LOADED") then + local AddonName = select (1, ...) + if (AddonName == "Details_RaidCheck") then + + if (_G._detalhes) then + + --> create widgets + CreatePluginFrames() + + --> core version required + local MINIMAL_DETAILS_VERSION_REQUIRED = 20 + + local default_settings = { + pre_pot_healers = false, --do not report pre pot for healers + pre_pot_tanks = false, --do not report pre pot for tanks + show_icon = 5, --when show the icon + } + + --> install + local install, saveddata, is_enabled = _G._detalhes:InstallPlugin ("TOOLBAR", Loc ["STRING_RAIDCHECK_PLUGIN_NAME"], [[Interface\AddOns\Details_RaidCheck\icon]], DetailsRaidCheck, "DETAILS_PLUGIN_RAIDCHECK", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.0", default_settings) + if (type (install) == "table" and install.error) then + return print (install.error) + end + + --> register needed events + + _G._detalhes:RegisterEvent (DetailsRaidCheck, "COMBAT_PLAYER_LEAVE") + _G._detalhes:RegisterEvent (DetailsRaidCheck, "COMBAT_PLAYER_ENTER") + _G._detalhes:RegisterEvent (DetailsRaidCheck, "ZONE_TYPE_CHANGED") + + end + end + end + end \ No newline at end of file diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.toc b/plugins/Details_RaidCheck/Details_RaidCheck.toc new file mode 100644 index 00000000..e69c293d --- /dev/null +++ b/plugins/Details_RaidCheck/Details_RaidCheck.toc @@ -0,0 +1,10 @@ +## Interface: 60000 +## Title: Details Raid Check (plugin) +## Notes: Show a icon on Details title bar showing flask, food, pre-pots. +## RequiredDeps: Details + +#@no-lib-strip@ +embeds.xml +#@end-no-lib-strip@ + +Details_RaidCheck.lua \ No newline at end of file diff --git a/plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.lua b/plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.lua new file mode 100644 index 00000000..2ecc0cb8 --- /dev/null +++ b/plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.lua @@ -0,0 +1,137 @@ +--- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings. +-- @class file +-- @name AceLocale-3.0 +-- @release $Id: AceLocale-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $ +local MAJOR,MINOR = "AceLocale-3.0", 6 + +local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR) + +if not AceLocale then return end -- no upgrade needed + +-- Lua APIs +local assert, tostring, error = assert, tostring, error +local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget + +-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded +-- List them here for Mikk's FindGlobals script +-- GLOBALS: GAME_LOCALE, geterrorhandler + +local gameLocale = GetLocale() +if gameLocale == "enGB" then + gameLocale = "enUS" +end + +AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref +AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName" + +-- This metatable is used on all tables returned from GetLocale +local readmeta = { + __index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key + rawset(self, key, key) -- only need to see the warning once, really + geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'") + return key + end +} + +-- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys +local readmetasilent = { + __index = function(self, key) -- requesting totally unknown entries: return key + rawset(self, key, key) -- only need to invoke this function once + return key + end +} + +-- Remember the locale table being registered right now (it gets set by :NewLocale()) +-- NOTE: Do never try to register 2 locale tables at once and mix their definition. +local registering + +-- local assert false function +local assertfalse = function() assert(false) end + +-- This metatable proxy is used when registering nondefault locales +local writeproxy = setmetatable({}, { + __newindex = function(self, key, value) + rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string + end, + __index = assertfalse +}) + +-- This metatable proxy is used when registering the default locale. +-- It refuses to overwrite existing values +-- Reason 1: Allows loading locales in any order +-- Reason 2: If 2 modules have the same string, but only the first one to be +-- loaded has a translation for the current locale, the translation +-- doesn't get overwritten. +-- +local writedefaultproxy = setmetatable({}, { + __newindex = function(self, key, value) + if not rawget(registering, key) then + rawset(registering, key, value == true and key or value) + end + end, + __index = assertfalse +}) + +--- Register a new locale (or extend an existing one) for the specified application. +-- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players +-- game locale. +-- @paramsig application, locale[, isDefault[, silent]] +-- @param application Unique name of addon / module +-- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc. +-- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS) +-- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used). +-- @usage +-- -- enUS.lua +-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true) +-- L["string1"] = true +-- +-- -- deDE.lua +-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE") +-- if not L then return end +-- L["string1"] = "Zeichenkette1" +-- @return Locale Table to add localizations to, or nil if the current locale is not required. +function AceLocale:NewLocale(application, locale, isDefault, silent) + + -- GAME_LOCALE allows translators to test translations of addons without having that wow client installed + local gameLocale = GAME_LOCALE or gameLocale + + local app = AceLocale.apps[application] + + if silent and app and getmetatable(app) ~= readmetasilent then + geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered") + end + + if not app then + if silent=="raw" then + app = {} + else + app = setmetatable({}, silent and readmetasilent or readmeta) + end + AceLocale.apps[application] = app + AceLocale.appnames[app] = application + end + + if locale ~= gameLocale and not isDefault then + return -- nop, we don't need these translations + end + + registering = app -- remember globally for writeproxy and writedefaultproxy + + if isDefault then + return writedefaultproxy + end + + return writeproxy +end + +--- Returns localizations for the current locale (or default locale if translations are missing). +-- Errors if nothing is registered (spank developer, not just a missing translation) +-- @param application Unique name of addon / module +-- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional) +-- @return The locale table for the current language. +function AceLocale:GetLocale(application, silent) + if not silent and not AceLocale.apps[application] then + error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2) + end + return AceLocale.apps[application] +end diff --git a/plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.xml b/plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.xml new file mode 100644 index 00000000..d69dbb13 --- /dev/null +++ b/plugins/Details_RaidCheck/Libs/AceLocale-3.0/AceLocale-3.0.xml @@ -0,0 +1,4 @@ + +