Download
(2 Kb)
Download
Updated: 08-01-11 02:52 PM
Updated:08-01-11 02:52 PM
Created:11-28-10 02:46 PM
Downloads:2,843
Favorites:14
MD5:
oUF Vengeance
Version: 40200.5
by: Thalyra [More]
Supported oUF Version: 1.5.x

Description:
oUF Vengeance is a element plug-in made for the UnitFrame framework oUF.
It is required that you have this addon updated at all times to make everything work as it should.
You can download oUF by clicking here.

Features:
- Bar for Vengeance for Tanks
- Text on that bar

Note:
Read the documentation inside the lua file for usage.
You need to add this addon to your layout's toc metadata!

Credits:
Dridzt for Vengeance Status (Inspiration for oUF_Vengeance)
40200.5:
- fixed little error with full bar but zero vengeance + some minor tweaks

40200.4:
- fixed bad argument to string.match error

40200.3:
- some code improvements
feraldruid check simplified
getTooltipText simplified

40200.2:
- fixed an error appearing infight

40200.1:
- update for 4.2
- added the improvement mentioned in the comments

40100.2:
- Fixed bug with bar:OverrideText(value)

40100.1:
- ToC update

40000.6:
- fixed the dk issue

40000.5:
- some minor code improvements and changes
- fixed the vengeance calculation to 0.1 * base health + stamina

40000.4:
- finally fixed the login bug -.-

40000.3:
- fixed a bug where sometimes on login i got a full bar without any vengeance buff active (now it hides on login)

40000.2:
- fixed a bug regarding text

40000.1:
- Initial Release
Archived Files (9)
File Name
Version
Size
Author
Date
40200.4
2kB
Thalyra
07-17-11 09:55 AM
40200.3
2kB
Thalyra
07-08-11 08:21 AM
40200.2
2kB
Thalyra
06-29-11 10:23 AM
40200.1
2kB
Thalyra
06-28-11 11:27 AM
40100.2
2kB
Thalyra
05-24-11 09:54 AM
40100.1
2kB
Thalyra
04-30-11 07:43 AM
40000.6
2kB
Thalyra
02-18-11 02:23 PM
40000.5
2kB
Thalyra
02-11-11 07:32 AM
40000.4
2kB
Thalyra
12-05-10 07:45 AM


Post A Reply Comment Options
Unread 07-22-11, 09:32 AM  
Omaro
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 20
Uploads: 2
Originally posted by zork
[b]Ok I get it because bear and cat both have the same spec but only bear is tank...need to check the talent tree. Do cats have vengeance aswell?

If yes, how does it differ?

*edit*
Checked, imo the form condition could be removed, because the vengeance buff will fade in cat form anyway, so only index 2 is important and the buff will only be there in bear stance anyway.



Btw I'm still debugging. Sometimes the getTooltipText bugs out. So I changed the function. Could not produce any more errors until now:
ALERT, NO NUMBER FOUND
ALERT, NO NUMBER FOUND
ALERT, NO NUMBER FOUND
ALERT, NO NUMBER FOUND



After a while this error occures and the bar never comes up again.
/reload and everything is okay for a couple of fights and then the same error as before.

Tested on DK Tank.
Omaro is offline Report comment to moderator  
Reply With Quote
Unread 07-16-11, 02:36 PM  
Drehmini
A Defias Bandit

Forum posts: 3
File comments: 12
Uploads: 0
Updated to the latest version and now I get the following error :

Code:
Message: Interface\AddOns\oUF_Vengeance\oUF_Vengeance.lua:64: bad argument #1 to 'match' (string expected, got nil)
Time: 07/16/11 16:31:17
Count: 28
Stack: [C]: in function `match'
Interface\AddOns\oUF_Vengeance\oUF_Vengeance.lua:64: in function <Interface\AddOns\oUF_Vengeance\oUF_Vengeance.lua:50>
(tail call): ?

Locals: (*temporary) = nil
(*temporary) = "%d+"
(*temporary) = "string expected, got nil"
Drehmini is offline Report comment to moderator  
Reply With Quote
Unread 07-03-11, 06:41 AM  
Thalyra
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 46
Uploads: 1
another thing i noticed with the tooltip text:

for me it's always i=12, where the value is found
this region is also called "VengeanceTooltipTextLeft2"

think this needs additional testing
Last edited by Thalyra : 07-03-11 at 09:08 AM.
Thalyra is offline Report comment to moderator  
Reply With Quote
Unread 07-01-11, 05:22 AM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1351
File comments: 3223
Uploads: 86
Ok I get it because bear and cat both have the same spec but only bear is tank...need to check the talent tree. Do cats have vengeance aswell?

If yes, how does it differ?

*edit*
Checked, imo the form condition could be removed, because the vengeance buff will fade in cat form anyway, so only index 2 is important and the buff will only be there in bear stance anyway.

Each time you take damage while in Bear Form, you gain 5% of the damage taken as attack power, up to a maximum of 10% of your health. Entering Cat Form will cancel this effect.
Btw I'm still debugging. Sometimes the getTooltipText bugs out. So I changed the function. Could not produce any more errors until now:
lua Code:
  1. ----------------------------------
  2. -- VARIABLES
  3. ----------------------------------
  4.  
  5. local _, ns = ...
  6. local oUF = oUF or ns.oUF
  7. local _, class = UnitClass("player")
  8. local vengeance = GetSpellInfo(93098)
  9. local tooltip = CreateFrame("GameTooltip", "VengeanceTooltip", UIParent, "GameTooltipTemplate")
  10. tooltip:SetOwner(UIParent, "ANCHOR_NONE")
  11.  
  12. ----------------------------------
  13. -- FUNCTIONS
  14. ----------------------------------
  15.  
  16. --get tooltip text func
  17. local function getTooltipText(...)
  18.   local text = ""
  19.   local count = select("#",...)
  20.   for i=1,count do
  21.     local rgn = select(i,...)
  22.     if rgn and rgn:GetObjectType() == "FontString" and rgn:GetText() then
  23.       text = text..rgn:GetText()
  24.       local val = tonumber(string.match(rgn:GetText(),"%d+"))
  25.       if val then
  26.         return val
  27.       end
  28.     end
  29.   end
  30.   print("ALERT, NO NUMBER FOUND: "..text)
  31.   return nil
  32. end
  33.  
  34. --check aura func
  35. local function checkAura(self, event, unit)
  36.   if not unit or (unit and unit ~= "player") then return end
  37.   local bar = self.Vengeance
  38.   bar:Hide() --hide bar by default
  39.   if not bar.isTank or not bar.max or bar.max == 0 then return end
  40.   local name = UnitBuff("player", vengeance)
  41.   if not name then return end
  42.   tooltip:ClearLines()
  43.   tooltip:SetUnitBuff("player", vengeance)
  44.   if not tooltip:GetRegions() then
  45.     print("ALERT, NO REGIONS FOUND")
  46.   end
  47.   local value = getTooltipText(tooltip:GetRegions()) or -1
  48.   if not bar.value then bar.value = 0 end
  49.   if value > 0 then
  50.     bar:Show() --show bar, all conditions are met
  51.     if value > bar.max then value = bar.max end
  52.     if value == bar.value then return end --no need to set already given values
  53.     bar:SetValue(value)
  54.     bar.value = value
  55.     if bar.Text then
  56.       if bar.OverrideText then
  57.         bar:OverrideText(value)
  58.       else
  59.         bar.Text:SetText(value)
  60.       end
  61.     end
  62.   end
  63. end
  64.  
  65. --check health func
  66. local function checkHealth(self,event)
  67.   local bar = self.Vengeance
  68.   if not bar.isTank then return end
  69.   bar.max = 0 --disable max health by default
  70.   local health = UnitHealthMax("player")
  71.   local _, stamina = UnitStat("player", 3)
  72.   if not health or not stamina then return end
  73.   bar.max = floor(0.1 * (health - 15 * stamina) + stamina)
  74.   bar:SetMinMaxValues(0, bar.max)
  75.   checkAura(self, event, "player") --aura check for player on health check, hand over self and event
  76. end
  77.  
  78. --check tank func
  79. local function checkTank(self,event)
  80.   local bar = self.Vengeance
  81.   bar.isTank = false  --by default no tank
  82.   bar:Hide()          --hide bar by default
  83.   local masteryIndex = GetPrimaryTalentTree()
  84.   if masteryIndex then
  85.     if class == "DRUID" and masteryIndex == 2 then
  86.       bar.isTank = true
  87.     elseif class == "DEATHKNIGHT" and masteryIndex == 1 then
  88.       bar.isTank = true
  89.     elseif class == "PALADIN" and masteryIndex == 2 then
  90.       bar.isTank = true
  91.     elseif class == "WARRIOR" and masteryIndex == 3 then
  92.       bar.isTank = true
  93.     end
  94.   end
  95.   checkHealth(self,event) --health check on tank check, hand over self and event
  96. end
  97.  
  98. --enable func
  99. local function Enable(self, unit)
  100.   local bar = self.Vengeance
  101.   if bar and unit == "player" then
  102.     self:RegisterEvent("UNIT_AURA", checkAura)
  103.     self:RegisterEvent("UNIT_MAXHEALTH", checkHealth)
  104.     self:RegisterEvent("UNIT_LEVEL", checkHealth)
  105.     self:RegisterEvent("PLAYER_REGEN_DISABLED", checkTank)
  106.     bar:Hide()
  107.     return true
  108.   end
  109. end
  110.  
  111. --disable func
  112. local function Disable(self)
  113.   local bar = self.Vengeance
  114.   if bar then
  115.     self:UnregisterEvent("UNIT_AURA", checkAura)
  116.     self:UnregisterEvent("UNIT_MAXHEALTH", checkHealth)
  117.     self:UnregisterEvent("UNIT_LEVEL", checkHealth)
  118.     self:UnregisterEvent("PLAYER_REGEN_DISABLED", checkTank)
  119.   end
  120. end
  121.  
  122. ----------------------------------
  123. -- ADD ELEMENT
  124. ----------------------------------
  125.  
  126. oUF:AddElement("Vengeance", nil, Enable, Disable)
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 07-01-11 at 05:31 AM.
zork is offline Report comment to moderator  
Reply With Quote
Unread 07-01-11, 04:43 AM  
Thalyra
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 46
Uploads: 1
Originally posted by zork
Not sure if you can make use of it but I used your code as a base and adjusted it a bit. I will post the full code you can check the changes.
quite nice, i will take these ideas and add them, but this code is needed because of druids:

Code:
if class == "DRUID" then
	self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", isTank)
end
Thalyra is offline Report comment to moderator  
Reply With Quote
Unread 06-30-11, 10:30 AM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1351
File comments: 3223
Uploads: 86
Not sure if you can make use of it but I used your code as a base and adjusted it a bit. I will post the full code you can check the changes.

The major change is that checkTank will call checkHealth which may call checkAura and additionally onEvent each function may be called aswell.
Conditions will halt functions if specific conditions are not met. I removed most of the else and worked with hidden state as default.
I changed the checkTank event because on loadup you will always have issues identifying the spec and such. This will fail because events do not get fired. (Once you enter the dungeon they will but if you login and start combat shortly after the bar will not show up).
Checking the tank status every combat start is no biggy.

----

Code updated above...
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 07-01-11 at 05:23 AM.
zork is offline Report comment to moderator  
Reply With Quote
Unread 06-29-11, 10:23 AM  
Thalyra
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 46
Uploads: 1
fixed with 40200.2
Thalyra is offline Report comment to moderator  
Reply With Quote
Unread 06-29-11, 08:47 AM  
jdblue82
A Kobold Labourer

Forum posts: 0
File comments: 9
Uploads: 0
Error with Latest Version

During combat, the following error keeps popping up...

Message: Interface\AddOns\oUF_Vengeance\oUF_Vengeance.lua:85: attempt to compare nil with number
Time: Wed Jun 29 09:44:53 2011
Count: 30
Stack: [C]: ?
Interface\AddOns\oUF_Vengeance\oUF_Vengeance.lua:85: in function `func'
Interface\AddOns\oUF\events.lua:18: in function <Interface\AddOns\oUF\events.lua:16>
(tail call): ?

Locals:
jdblue82 is offline Report comment to moderator  
Reply With Quote
Unread 06-27-11, 01:36 PM  
Thalyra
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 46
Uploads: 1
oh, my bad

will update tomorrow for 4.2, then this will be added
Thalyra is offline Report comment to moderator  
Reply With Quote
Unread 06-26-11, 03:03 PM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1351
File comments: 3223
Uploads: 86
I embedded this into oUF_Diablo now and found sth that really had to be changed.

By default you do this
Code:
        local function valueChanged(self)
	  local bar = self.Vengeance
          --...
        end
But you really should change that to
Code:
        local function valueChanged(self,event,unit)
	  if unit and unit ~= "player" then return end
	  local bar = self.Vengeance
          --...
        end
UNIT_AURA is one of the most spammed events in raids. That can get messy really quick.
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 06-27-11 at 07:28 AM.
zork is offline Report comment to moderator  
Reply With Quote
Unread 06-19-11, 08:54 AM  
Drehmini
A Defias Bandit

Forum posts: 3
File comments: 12
Uploads: 0
So after installing ouF_Karma for quite a while, I've been intrigued as to why the vengeance bar disappears after switching specs multiple times (or randomly after a while).

It seems that
Code:
local value = tonumber(string.match(text,"%d+")) or 0
returns 0 and because the addon is not indexing properly. I have very limited knowledge of lua, so I can't really test it further.

Thanks,
Drehmini
Drehmini is offline Report comment to moderator  
Reply With Quote
Unread 05-24-11, 11:34 AM  
Tabinou
A Deviate Faerie Dragon

Forum posts: 11
File comments: 5
Uploads: 0
Thanks, now it's working.
Tabinou is offline Report comment to moderator  
Reply With Quote
Unread 05-24-11, 09:49 AM  
Thalyra
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 46
Uploads: 1
not your error, it's a bug because of me -.-

fixed upload inc
Thalyra is offline Report comment to moderator  
Reply With Quote
Unread 05-22-11, 11:25 AM  
Tabinou
A Deviate Faerie Dragon

Forum posts: 11
File comments: 5
Uploads: 0
I've been trying to set up the custom text for vengeance.Now i've got no more hair on my head...

I want it to be something like current/max.
This is the code i've been using:

lua Code:
  1. -- Vengeance
  2.     if (IsAddOnLoaded("oUF_Vengeance")) then
  3.         self.Vengeance = CreateFrame("StatusBar", nil, self)
  4.         self.Vengeance.Text = self.Health:CreateFontString(nil, 'OVERLAY')
  5.         self.Vengeance.Text:SetFont(cfg.FontProto, 14, 'THINOUTLINE')
  6.         self.Vengeance.Text:SetShadowOffset(1, -1)
  7.         self.Vengeance.Text.frequentUpdates = cfg.UpdateFreq
  8.         self.Vengeance.Text:SetJustifyH('RIGHT')
  9.         self.Vengeance.Text:SetPoint('BOTTOMLEFT', self.Health, 'BOTTOMLEFT', 2, 3)
  10.         self.Vengeance.OverrideText = self.Health:CreateFontString(nil, 'OVERLAY')

and an override function like this in my "libs" file.

lua Code:
  1. -- Vengeance Text override
  2. function OverrideText(value)
  3.     local health = UnitHealthMax("player")
  4.     local stamina = UnitStat("player", 3)
  5.     local max = 0.1 * (health - 15 * stamina) + stamina
  6.    
  7.     self.Vengeance.Text:SetText("test")
  8. end

With some tests, I know he checks that I've been using an OverrideText. But I get a lua error, saying that he doesn't find my custom function.
What am I doing wrong ?
Tabinou is offline Report comment to moderator  
Reply With Quote
Unread 02-27-11, 11:30 AM  
Dajova
A Wyrmkin Dreamwalker
 
Dajova's Avatar
AddOn Author - Click to view AddOns

Forum posts: 58
File comments: 825
Uploads: 13
Tip: There are 2 spellids for vengeance.

Code:
local vengeance = GetSpellInfo(93098) or GetSpellInfo(76691)
__________________


Livestream | Twitter | Facebook | YouTube


Dajova is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: