Thread Tools Display Modes
12-04-11, 05:46 AM   #1
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Personal adjustment for ouf_hank?

Hey there,

as i am not really good in lua (sume tiny tweaks i am able to do but that's about it) i'm asking you here right now:

I want to change the focus frame from this to that:

Having right now:
http://www.abload.de/img/normalnqe8l.jpg

Wanted:
http://www.abload.de/img/editd07lb.jpg

I was searching in the hank.lua but it seems difficult to see which code to change to what cause focus seems to be handeled euqally to player frame etc.

So in textform: No absolute health/power and percentage right and name bigger.

Could anyone be able to help me please? (: That would be so great! If you are either on gorgonnash eu [H] or eredar [H] i could pay you with gold, if not i relay on your greatfullness (:

Hopefully someone could help me with that, thank you so much for your time, even reading this!

Greetings.
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-05-11, 04:28 AM   #2
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Check this mod I made, it "mirrors" the focus frame so one could put it on the left hand side of the screen. Just add

Code:
self.power:Hide()
self.power=nil
to the sharedStyle function inside the focus block, then HP/Power text should be hidden. Edit the self.name:SetPoint to position the name, adjust the size via SetFont.

Code:
oUF_Hank_hooks.ChangeFocus = {
sharedStyle = function(self, unit, isSingle)
	
	if (unit == "focustarget") then	
		self.name:ClearAllPoints()
		self.name:SetPoint("RIGHT")
	end


	if (unit == "focus") then	
		
		for i=1,4 do
			self.health[i]:ClearAllPoints()
		end
		
		self.health[4]:SetPoint("RIGHT")
		self.health[3]:SetPoint("RIGHT", self.health[4], "LEFT")
		self.health[2]:SetPoint("RIGHT", self.health[3], "LEFT")
		self.health[1]:SetPoint("RIGHT", self.health[2], "LEFT")
		
		self.power:ClearAllPoints()
		self.name:ClearAllPoints()
		self.RaidIcon:ClearAllPoints()
		
		self.name:SetPoint("BOTTOMRIGHT",  self.power, "TOPRIGHT")
		self.power:SetPoint("BOTTOMRIGHT", self.health[1], "BOTTOMLEFT")
		self.RaidIcon:SetPoint("RIGHT",self.name,"LEFT",-10,0)
		self.RaidIcon:SetPoint("TOP", self, "TOP", 0, -5)
		
		
		self.Buffs.initialAnchor = "RIGHT" 
		self.Buffs["growth-x"] = "LEFT"
		self.Debuffs.initialAnchor = "RIGHT"
		self.Debuffs["growth-x"] = "LEFT"
		
	end
end,

PostUpdateName = function(self)
	
	if self.unit ~= "focus" then return end
	
	if (self.name) then
		self.RaidIcon:ClearAllPoints()
		self.RaidIcon:SetPoint("TOP", self, "TOP", 0, -5)
		-- Reanchor raid icon to the largest string (either name or power)
		if self.name:GetWidth() >= self.power:GetWidth() then
			self.RaidIcon:SetPoint("RIGHT", self.name, "LEFT", -10, 0)
		else
			self.RaidIcon:SetPoint("RIGHT", self.power, "LEFT", -10, 0)
		end
	end

end,

UpdateHealth = function(self)

	if self.unit ~= "focus" then return end
	
	local h, hMax
	
	-- In vehicle
	h, hMax = UnitHealth(self.unit), UnitHealthMax(self.unit)


	local status = (not UnitIsConnected(self.unit) or nil) and "Off" or UnitIsGhost(self.unit) and "G" or UnitIsDead(self.unit) and "X"
	
	if not status then
		local hPerc = ("%d%%"):format(h / hMax * 100 + 0.5)
		local len = string.len(hPerc)
		
		for i = 1, 4 do
				if i > len then
					self.health[5 - i]:Hide()
					self.healthFill[5 - i]:Hide()
				else
					local digit = string.sub(hPerc , -i, -i)
					
					self.health[5 - i]:SetSize(oUF_Hank.digitTexCoords[digit][2], oUF_Hank.digitTexCoords["height"])
					self.health[5 - i]:SetTexCoord(oUF_Hank.digitTexCoords[digit][1] / oUF_Hank.digitTexCoords["texWidth"], (oUF_Hank.digitTexCoords[digit][1] + oUF_Hank.digitTexCoords[digit][2]) / oUF_Hank.digitTexCoords["texWidth"], 1 / oUF_Hank.digitTexCoords["texHeight"], (1 + oUF_Hank.digitTexCoords["height"]) / oUF_Hank.digitTexCoords["texHeight"])
					self.health[5 - i]:Show()
					self.healthFill[5 - i]:SetSize(oUF_Hank.digitTexCoords[digit][2], oUF_Hank.digitTexCoords["height"] * h / hMax)
					self.healthFill[5 - i]:SetTexCoord(oUF_Hank.digitTexCoords[digit][1] / oUF_Hank.digitTexCoords["texWidth"], (oUF_Hank.digitTexCoords[digit][1] + oUF_Hank.digitTexCoords[digit][2]) / oUF_Hank.digitTexCoords["texWidth"], (2 + 2 * oUF_Hank.digitTexCoords["height"] - oUF_Hank.digitTexCoords["height"] * h / hMax) / oUF_Hank.digitTexCoords["texHeight"], (2 + 2 * oUF_Hank.digitTexCoords["height"]) / oUF_Hank.digitTexCoords["texHeight"])
					self.healthFill[5 - i]:Show()
				end
			end
			
			
		
		self.power:ClearAllPoints()
		self.power:SetPoint("BOTTOMRIGHT", self.health[5-len], "BOTTOMLEFT", 0, 0)
	
	else
		
		self.power:ClearAllPoints()
		self.power:SetPoint("BOTTOMRIGHT", self.health[4], "BOTTOMLEFT", 0, 0)
		
	end
end,
}
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-05-11, 07:45 AM   #3
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Nvm i was totaly stupid I got it in but it's showing "weird and producing an error screen in a sec!

http://www.abload.de/img/wowscrnshot_120511_15k02d9.jpg

It really "mirrors" the frame but that makes it sort of unreadable :/ + that error

Code:
Message: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: attempt to index global 'oUF_Hank' (a nil value)
Time: 12/05/11 15:08:33
Count: 1
Stack: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: in function <...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:113>
[C]: in function `func'
Interface\AddOns\oUF\ouf.lua:153: in function <Interface\AddOns\oUF\ouf.lua:144>
(tail call): ?
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:83: in function <Interface\FrameXML\SecureStateDriver.lua:73>
Interface\FrameXML\SecureStateDriver.lua:137: in function <Interface\FrameXML\SecureStateDriver.lua:119>

Locals: self = oUF_focus {
 0 = <userdata>
 Debuffs = focus_Debuffs {
 }
 __tags = <table> {
 }
 UNIT_ENTERED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:164
 unit = "focus"
 SpellRange = <table> {
 }
 PLAYER_FOCUS_CHANGED = <function> defined @Interface\AddOns\oUF\ouf.lua:144
 UNIT_PET = <function> defined @Interface\AddOns\oUF\ouf.lua:164
 healthFill = <table> {
 }
 UNIT_MAXHEALTH = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:512
 __elements = <table> {
 }
 RAID_TARGET_UPDATE = <function> defined @Interface\AddOns\oUF\elements\ricons.lua:19
 UNIT_AURA = <function> defined @Interface\AddOns\oUF\elements\aura.lua:209
 power = <unnamed> {
 }
 HighlightAura = <unnamed> {
 }
 PLAYER_ENTERING_WORLD = <function> defined @Interface\AddOns\oUF\ouf.lua:144
 PLAYER_FLAGS_CHANGED = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:654
 RaidIcon = <unnamed> {
 }
 name = <unnamed> {
 }
 UNIT_HEALTH = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:504
 style = "Hankv3"
 menu = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:43
 health = <table> {
 }
 Buffs = focus_Buffs {
 }
 UNIT_EXITED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:164
 colors = <table> {
 }
}
h = 97218
hMax = 97218
status = nil
hPerc = "100%"
len = 4
(for index) = 1
(for limit) = 4
(for step) = 1
i = 1
digit = "%"
(*temporary) = <function> defined =[C]:-1
(*temporary) = <unnamed> {
 0 = <userdata>
}
(*temporary) = nil
(*temporary) = "%"
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'oUF_Hank' (a nil value)"
Code:
Message: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: attempt to index global 'oUF_Hank' (a nil value)
Time: 12/05/11 15:09:54
Count: 1
Stack: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: in function <...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:113>
[C]: in function `func'
Interface\AddOns\oUF\ouf.lua:153: in function <Interface\AddOns\oUF\ouf.lua:144>
(tail call): ?
[C]: in function `Show'
Interface\FrameXML\UIParent.lua:1562: in function `SetUIPanel'
Interface\FrameXML\UIParent.lua:1632: in function `HideUIPanel'
Interface\FrameXML\UIParent.lua:1342: in function <Interface\FrameXML\UIParent.lua:1334>
[C]: in function `SetAttribute'
Interface\FrameXML\UIParent.lua:2060: in function `HideUIPanel'
Interface\FrameXML\UIParent.lua:2026: in function `ToggleFrame'
[string "TOGGLEWORLDMAP"]:1: in function <[string "TOGGLEWORLDMAP"]:1>
[C]: in function `RunBinding'
Interface\FrameXML\WorldMapFrame.lua:262: in function <Interface\FrameXML\WorldMapFrame.lua:259>

Locals: self = oUF_focus {
 0 = <userdata>
 Debuffs = focus_Debuffs {
 }
 __tags = <table> {
 }
 UNIT_ENTERED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:164
 unit = "focus"
 SpellRange = <table> {
 }
 PLAYER_FOCUS_CHANGED = <function> defined @Interface\AddOns\oUF\ouf.lua:144
 UNIT_PET = <function> defined @Interface\AddOns\oUF\ouf.lua:164
 healthFill = <table> {
 }
 UNIT_MAXHEALTH = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:512
 __elements = <table> {
 }
 UNIT_AURA = <function> defined @Interface\AddOns\oUF\elements\aura.lua:209
 RAID_TARGET_UPDATE = <function> defined @Interface\AddOns\oUF\elements\ricons.lua:19
 power = <unnamed> {
 }
 HighlightAura = <unnamed> {
 }
 PLAYER_ENTERING_WORLD = <function> defined @Interface\AddOns\oUF\ouf.lua:144
 PLAYER_FLAGS_CHANGED = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:654
 RaidIcon = <unnamed> {
 }
 name = <unnamed> {
 }
 UNIT_HEALTH = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:504
 style = "Hankv3"
 menu = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:43
 health = <table> {
 }
 Buffs = focus_Buffs {
 }
 UNIT_EXITED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:164
 colors = <table> {
 }
}
h = 97218
hMax = 97218
status = nil
hPerc = "100%"
len = 4
(for index) = 1
(for limit) = 4
(for step) = 1
i = 1
digit = "%"
(*temporary) = <function> defined =[C]:-1
(*temporary) = <unnamed> {
 0 = <userdata>
}
(*temporary) = nil
(*temporary) = "%"
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'oUF_Hank' (a nil value)"
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 12-05-11 at 08:10 AM.
  Reply With Quote
12-05-11, 07:57 AM   #4
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Originally Posted by Syliha View Post
Thanks =)

I tried this one out and i think it should go to custom_modifications.lua?

I just copied and pasted it in and added the self.power:Hide(),self.power=nil above: "self.power:ClearAllPoints()"
That will of course error out, because you can't call ClearAllPoints() on nil. Leave it there, but comment out all other occurences of self.power (there are more below). Always enable lua errors when changing stuff, and get yourself Swatter or the like to get good info on the errors.
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-05-11, 03:23 PM   #5
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Not sure if you have seen it, but I have pasted in some errors.
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-05-11, 04:38 PM   #6
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
No, I didn't, I always check for new posts Yeah, you'll need to paste the following at the beginning of the file:

Code:
local oUF_Hank = {}
oUF_Hank.digitTexCoords = {
	["1"] = {1, 20},
	["2"] = {21, 31},
	["3"] = {53, 30},
	["4"] = {84, 33},
	["5"] = {118, 30},
	["6"] = {149, 31},
	["7"] = {181, 30},
	["8"] = {212, 31},
	["9"] = {244, 31},
	["0"] = {276, 31},
	["%"] = {308, 17},
	["X"] = {326, 31}, -- Dead
	["G"] = {358, 36}, -- Ghost
	["Off"] = {395, 23}, -- Offline
	["B"] = {419, 42}, -- Boss
	["height"] = 42,
	["texWidth"] = 512,
	["texHeight"] = 128
}
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Personal adjustment for ouf_hank?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off