My favorites | Sign in
Project Logo
             
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538

-----------------------------
-- configure textures here --
-----------------------------

local rb2_normal_texture = "Interface\\AddOns\\rTextures\\gloss";
local rb2_flash_texture = "Interface\\AddOns\\rTextures\\flash";
local rb2_hover_texture = "Interface\\AddOns\\rTextures\\hover";
local rb2_pushed_texture = "Interface\\AddOns\\rTextures\\pushed";
local rb2_checked_texture = "Interface\\AddOns\\rTextures\\checked";
local rb2_equipped_texture = "Interface\\AddOns\\rTextures\\gloss_green";

--make buttons use this alpha when out of range, out of mana etc. range 0-1.
local fade_alpha = 1;

-- scale, SCALE your buttons here. range 0-1, 0.7 = 70%
local myscale = 0.75*0.82

--button system for bar 1 and bar 2
-- 0 = 1x12 layout
-- 1 = 2x6 layout
local button_system = 1

-- hide shapeshift frame
-- 0 = not hidden
-- 1 = hidden
-- IMPORTANT, you will need my transparent textures to hide the background stuff
-- http://code.google.com/p/rothui/source/browse/#svn/trunk/Interface/ShapeshiftBar
local hide_shapeshift = 0

-- end config --

local a = CreateFrame("Frame", nil, UIParent)
local _G = getfenv(0)
local dummy = function() end

local check_combat = 0

UIPARENT_MANAGED_FRAME_POSITIONS["MultiBarRight"] = nil
UIPARENT_MANAGED_FRAME_POSITIONS["MultiBarLeft"] = nil
UIPARENT_MANAGED_FRAME_POSITIONS["MultiBarBottomLeft"] = nil
UIPARENT_MANAGED_FRAME_POSITIONS["MultiBarBottomRight"] = nil
UIPARENT_MANAGED_FRAME_POSITIONS["MainMenuBar"] = nil

a:RegisterEvent("PLAYER_ENTERING_WORLD")
a:RegisterEvent("PLAYER_LOGIN")
a:RegisterEvent("PLAYER_REGEN_ENABLED")
a:RegisterEvent("PLAYER_REGEN_DISABLED")



--to hide the right bar in combat and show it out of combat
--a:RegisterEvent("PLAYER_REGEN_ENABLED")
--a:RegisterEvent("PLAYER_REGEN_DISABLED")

a:SetScript("OnEvent", function (self,event,arg1)
if(event=="PLAYER_LOGIN") then
a:cre_actionbarframe1()
PetActionBarFrame:SetScale(myscale*1.4)
elseif(event=="PLAYER_ENTERING_WORLD") then
--TEST, will try this later
MainMenuBar:Hide()
elseif(event=="PLAYER_REGEN_ENABLED") then
check_combat = 0
ShowPetActionBar()
elseif(event=="PLAYER_REGEN_DISABLED") then
check_combat = 1
end

--to fade the right button bar ooc/ic
--need to test this later
--[[
if event == "PLAYER_REGEN_ENABLED" then
for i = 1, 12 do
_G["MultiBarRightButton"..i]:SetAlpha(1);
end
elseif event == "PLAYER_REGEN_DISABLED" then
for i = 1, 12 do
_G["MultiBarRightButton"..i]:SetAlpha(0);
end
end
]]--

end)

function a:cre_actionbarframe1()

RANGE_INDICATOR = "";

--creating a helper frame to hold the actionbuttons
local f = CreateFrame("Frame","rBars2_Button_Holder_Frame",UIParent)
f:SetWidth(498)
f:SetHeight(100)
--f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 4, right = 4, top = 4, bottom = 4 }});
f:SetPoint("BOTTOM",0,30)
f:Show()

-- hack to fix the bonusactionbar when hiding the mainmenubar
BonusActionBarFrame:SetParent(f)

-- since I am reanchoring all the buttons I can hide the MainMenuBar
MainMenuBar:Hide()
MainMenuBar.Show = dummy
VehicleMenuBar:Hide()
VehicleMenuBar.Show = dummy

local j
for j=1,12 do
a:dostuff("ActionButton", j, f)
a:setnewparent("ActionButton", j, f)
a:dostuff("BonusActionButton", j, f)
a:dostuff("MultiBarBottomRightButton", j, f)
a:dostuff("MultiBarBottomLeftButton", j, f)
a:dostuff("MultiBarLeftButton", j, f)
a:dostuff("MultiBarRightButton", j, f)
end

local k
for k=1,10 do
a:dopeticons("PetActionButton", k)
a:doshapeshift("ShapeshiftButton", k)
end

ActionButton1:ClearAllPoints()
ActionButton1:SetPoint("BOTTOMLEFT",f,"BOTTOMLEFT",0,0);

--need to do this since I reanchored the bonusactionbar to f
BonusActionBarTexture0:Hide()
BonusActionBarTexture1:Hide()

BonusActionButton1:ClearAllPoints()
BonusActionButton1:SetPoint("BOTTOMLEFT",f,"BOTTOMLEFT",0,0);

if button_system == 0 then

MultiBarBottomLeftButton1:ClearAllPoints()
MultiBarBottomLeftButton1:SetPoint("BOTTOMLEFT",ActionButton1,"TOPLEFT",0,5);

MultiBarBottomRightButton1:ClearAllPoints()
MultiBarBottomRightButton1:SetPoint("BOTTOMLEFT",MultiBarBottomLeftButton1,"TOPLEFT",0,15);

else

ActionButton7:ClearAllPoints()
ActionButton7:SetPoint("BOTTOMLEFT",ActionButton1,"TOPLEFT",0,5);

BonusActionButton7:ClearAllPoints()
BonusActionButton7:SetPoint("BOTTOMLEFT",BonusActionButton1,"TOPLEFT",0,5);

MultiBarBottomLeftButton1:ClearAllPoints()
MultiBarBottomLeftButton1:SetPoint("BOTTOMLEFT",ActionButton6,"BOTTOMRIGHT",5,0);

MultiBarBottomLeftButton7:ClearAllPoints()
MultiBarBottomLeftButton7:SetPoint("BOTTOMLEFT",MultiBarBottomLeftButton1,"TOPLEFT",0,5);

MultiBarBottomRightButton1:ClearAllPoints()
MultiBarBottomRightButton1:SetPoint("BOTTOMLEFT",ActionButton7,"TOPLEFT",0,15);

end

MultiBarRightButton1:ClearAllPoints()
MultiBarRightButton1:SetPoint("RIGHT",UIParent,"RIGHT",-30, 190)

MultiBarLeftButton1:ClearAllPoints()
MultiBarLeftButton1:SetPoint("TOPLEFT",MultiBarRightButton1,"TOPLEFT",-43, 0)

ShapeshiftButton1:ClearAllPoints()
ShapeshiftBarFrame:SetParent(f)
ShapeshiftButton1:SetPoint("BOTTOMLEFT",MultiBarBottomRightButton1,"TOPLEFT",5,15);
ShapeshiftButton1.SetPoint = dummy

-- hide the shapeshift
if hide_shapeshift == 1 then
ShapeshiftBarFrame:Hide()
ShapeshiftBarFrame.Show = dummy
end

PetActionButton1:ClearAllPoints()
PetActionBarFrame:SetParent(f)
PetActionButton1:SetPoint("BOTTOMLEFT",MultiBarBottomRightButton1,"TOPLEFT",5,15);

-- hmmm I don't know if this does anything since the PossesBar becomes the BonusActionBar upon possessing sth
PossessButton1:ClearAllPoints()
PossessBarFrame:SetParent(f)
PossessButton1:SetPoint("BOTTOMLEFT",MultiBarBottomRightButton1,"TOPLEFT",5,15);

MainMenuBar:SetScale(myscale)
f:SetScale(myscale)
BonusActionBarFrame:SetScale(1)
MultiBarBottomLeft:SetScale(myscale)
MultiBarBottomRight:SetScale(myscale)
MultiBarRight:SetScale(myscale)
MultiBarLeft:SetScale(myscale)
PetActionBarFrame:SetScale(myscale*1.09)

end

-- some functions

-- hides the actionbuttons when a bonusactionbar is active (normaly the blizzard background texture would overlap it
-- but I use no background texture
local bonushooks = {};
local i;

bonushooks["onshow"] = BonusActionBarFrame:GetScript("OnShow");
bonushooks["onshide"] = BonusActionBarFrame:GetScript("OnHide");

BonusActionBarFrame:SetScript("OnShow", function(self,...)
if ( bonushooks["onshow"] ) then bonushooks["onshow"](self,...); end;
for i = 1, 12, 1 do
_G["ActionButton"..i]:SetAlpha(0);
end;
end);

BonusActionBarFrame:SetScript("OnHide", function(self,...)
if ( bonushooks["onhide"] ) then bonushooks["onhide"](self,...); end;
for i = 1, 12, 1 do
_G["ActionButton"..i]:SetAlpha(1);
end;
end);

-- rewrite the Blizzard ActionButton_Update function. I kept most of it the same but I changed the normaltexture to my gloss texture
ActionButton_Update = function(self)
-- Special case code for bonus bar buttons
-- Prevents the button from updating if the bonusbar is still in an animation transition
if ( self.isBonus and self.inTransition ) then
self.needsUpdate = true;
ActionButton_UpdateUsable(self);
return;
end

local name = self:GetName();

local action = self.action;
local icon = getglobal(name.."Icon");
local buttonCooldown = getglobal(name.."Cooldown");
local texture = GetActionTexture(action);

if ( HasAction(action) ) then
if ( not self.eventsRegistered ) then
self:RegisterEvent("ACTIONBAR_UPDATE_STATE");
self:RegisterEvent("ACTIONBAR_UPDATE_USABLE");
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN");
self:RegisterEvent("UPDATE_INVENTORY_ALERTS");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
self:RegisterEvent("TRADE_SKILL_SHOW");
self:RegisterEvent("TRADE_SKILL_CLOSE");
self:RegisterEvent("PLAYER_ENTER_COMBAT");
self:RegisterEvent("PLAYER_LEAVE_COMBAT");
self:RegisterEvent("START_AUTOREPEAT_SPELL");
self:RegisterEvent("STOP_AUTOREPEAT_SPELL");
self.eventsRegistered = true;
end

if ( not self:GetAttribute("statehidden") ) then
self:Show();
end
ActionButton_UpdateState(self);
ActionButton_UpdateUsable(self);
ActionButton_UpdateCooldown(self);
ActionButton_UpdateFlash(self);
else
if ( self.eventsRegistered ) then
self:UnregisterEvent("ACTIONBAR_UPDATE_STATE");
self:UnregisterEvent("ACTIONBAR_UPDATE_USABLE");
self:UnregisterEvent("ACTIONBAR_UPDATE_COOLDOWN");
self:UnregisterEvent("UPDATE_INVENTORY_ALERTS");
self:UnregisterEvent("PLAYER_TARGET_CHANGED");
self:UnregisterEvent("TRADE_SKILL_SHOW");
self:UnregisterEvent("TRADE_SKILL_CLOSE");
self:UnregisterEvent("PLAYER_ENTER_COMBAT");
self:UnregisterEvent("PLAYER_LEAVE_COMBAT");
self:UnregisterEvent("START_AUTOREPEAT_SPELL");
self:UnregisterEvent("STOP_AUTOREPEAT_SPELL");
self.eventsRegistered = nil;
end

if ( self:GetAttribute("showgrid") == 0 ) then
self:Hide();
else
buttonCooldown:Hide();
end
end

-- Update Macro Text
--[[
local macroName = getglobal(name.."Name");
if ( not IsConsumableAction(action) and not IsStackableAction(action) ) then
macroName:SetText(GetActionText(action));
else
macroName:SetText("");
end
]]--

-- Update icon and hotkey text
if ( texture ) then
icon:SetTexture(texture);
icon:Show();
self.rangeTimer = -1;
self:SetNormalTexture(rb2_normal_texture);
else
icon:Hide();
buttonCooldown:Hide();
self.rangeTimer = nil;
self:SetNormalTexture(rb2_normal_texture);
--[[
local hotkey = getglobal(name.."HotKey");
if ( hotkey:GetText() == RANGE_INDICATOR ) then
hotkey:Hide();
else
hotkey:SetVertexColor(0.6, 0.6, 0.6);
end
]]--
end
ActionButton_UpdateCount(self);

local border = getglobal(name.."Border");
border:Hide();

-- give equipped items a green border texture
--[[
if ( IsEquippedAction(action) ) then
self:SetNormalTexture(rb2_equipped_texture);
else
self:SetNormalTexture(rb2_normal_texture);
end
]]--

-- Update tooltip
if ( GameTooltip:GetOwner() == self ) then
ActionButton_SetTooltip(self);
end

self.feedback_action = action;
end

-- update usable to make funky colors
ActionButton_UpdateUsable = function (self)
if ( self:GetAttribute("showgrid") == 0 ) then
local name = self:GetName();
local icon = getglobal(name.."Icon");
local normalTexture = getglobal(name.."NormalTexture");
local isUsable, notEnoughMana = IsUsableAction(self.action);
local valid = IsActionInRange(self.action);
if ( valid == 0 ) then
--red
icon:SetVertexColor(1.0, 0.1, 0.1,fade_alpha);
normalTexture:SetAlpha(fade_alpha)
elseif ( isUsable ) then
--white
icon:SetVertexColor(1.0, 1.0, 1.0, 1);
normalTexture:SetAlpha(1)
elseif ( notEnoughMana ) then
--blue
icon:SetVertexColor(0.25, 0.25, 1.0,fade_alpha);
normalTexture:SetAlpha(fade_alpha)
else
--grey
icon:SetVertexColor(0.4, 0.4, 0.4,fade_alpha);
normalTexture:SetAlpha(fade_alpha)
end
else
local name = self:GetName();
local icon = getglobal(name.."Icon");
icon:SetVertexColor(1.0, 1.0, 1.0, 1);
end
end

-- had to rewrite this to call the ActionButton_UpdateUsable function, this finally makes it possible to
-- bring range and manacoloring together in one function

local totalElapsed = 0

ActionButton_OnUpdate = function (self, elapsed)

totalElapsed = totalElapsed + elapsed
if (totalElapsed < 0.1) then
return
else
--totalElapsed = totalElapsed*10 - floor(totalElapsed*10)
totalElapsed = 0
ActionButton_UpdateUsable(self);

end
--[[]]--

--[[
if ( ActionButton_IsFlashing(self) ) then
local flashtime = self.flashtime;
flashtime = flashtime - elapsed;
if ( flashtime <= 0 ) then
local overtime = -flashtime;
if ( overtime >= ATTACK_BUTTON_FLASH_TIME ) then
overtime = 0;
end
flashtime = ATTACK_BUTTON_FLASH_TIME - overtime;

local flashTexture = getglobal(self:GetName().."Flash");
if ( flashTexture:IsShown() ) then
flashTexture:Hide();
else
flashTexture:Show();
end
end
self.flashtime = flashtime;
end

local rangeTimer = self.rangeTimer;
if ( rangeTimer ) then
rangeTimer = rangeTimer - elapsed;
if ( rangeTimer <= 0 ) then
ActionButton_UpdateUsable(self);
rangeTimer = TOOLTIP_UPDATE_TIME;
end
self.rangeTimer = rangeTimer;
end
]]--




end

-- hack to fix the grid alpha. by default the NormalTexture gets 0.5 alpha when you move a button and it keeps this alpha
-- fixes this issue
ActionButton_ShowGrid = function (button)
button:SetAttribute("showgrid", button:GetAttribute("showgrid") + 1);
getglobal(button:GetName().."NormalTexture"):SetVertexColor(1.0, 1.0, 1.0, 1);
button:Show();
end

-- function to anchor the button to f
function a:setnewparent(name, i, frame)
local bu = _G[name..i]
bu:SetParent(frame);
end

-- gives the buttons nice new textures....bling bling
function a:dostuff(name, i, frame)

local bu = _G[name..i]
local ic = _G[name..i.."Icon"]
local co = _G[name..i.."Count"]
local bo = _G[name..i.."Border"]
local ho = _G[name..i.."HotKey"]
local cd = _G[name..i.."Cooldown"]
local na = _G[name..i.."Name"]
local fl = _G[name..i.."Flash"]
local nt = _G[name..i.."NormalTexture"]

ho:Hide()
na:Hide()

fl:SetTexture(rb2_flash_texture)
bu:SetHighlightTexture(rb2_hover_texture)
bu:SetPushedTexture(rb2_pushed_texture)
bu:SetCheckedTexture(rb2_checked_texture)

nt:SetHeight(36)
nt:SetWidth(36)
nt:SetPoint("Center", 0, 0);

ic:SetTexCoord(0.1,0.9,0.1,0.9)
ic:SetPoint("TOPLEFT", bu, "TOPLEFT", 2, -2)
ic:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -2, 2)


end


function a:dopeticons(name, i)

local bu = _G[name..i]
local ic = _G[name..i.."Icon"]
local nt = _G[name..i.."NormalTexture2"]

ic:SetTexCoord(0.1,0.9,0.1,0.9)
bu:SetNormalTexture(rb2_normal_texture)
bu.SetNormalTexture = dummy
nt:SetPoint("TOPLEFT", bu, "TOPLEFT", -2, 2);
nt:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", 2, -2);
end

function a:doshapeshift(name, i)

local bu = _G[name..i]
local ic = _G[name..i.."Icon"]
local nt = _G[name..i.."NormalTexture"]
local fl = _G[name..i.."Flash"]

ic:SetTexCoord(0.1,0.9,0.1,0.9)
bu:SetNormalTexture(rb2_normal_texture)
bu.SetNormalTexture = dummy
nt:SetPoint("TOPLEFT", bu, "TOPLEFT", -2, 2)
nt:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", 2, -2)

fl:SetTexture(rb2_flash_texture)
bu:SetHighlightTexture(rb2_hover_texture)
bu:SetPushedTexture(rb2_pushed_texture)
--bu:SetCheckedTexture(rb2_pushed_texture)

end


-- trying to overtake the blizzard petbar
-- what a beast

PetActionBar_OnEvent = function (self, event, ...)
local arg1 = ...;

if not UnitAffectingCombat("player") and check_combat == 0 then

if ( event == "PET_BAR_UPDATE" or (event == "UNIT_PET" and arg1 == "player") ) then
PetActionBar_Update(self);
if ( PetHasActionBar() and UnitIsVisible("pet") ) then
ShowPetActionBar();
LockPetActionBar();
else
UnlockPetActionBar();
HidePetActionBar();
end
elseif ( event == "PLAYER_CONTROL_LOST" or event == "PLAYER_CONTROL_GAINED" or event == "PLAYER_FARSIGHT_FOCUS_CHANGED" ) then
PetActionBar_Update(self);
elseif ( (event == "UNIT_FLAGS") or (event == "UNIT_AURA") ) then
if ( arg1 == "pet" ) then
PetActionBar_Update(self);
end
elseif ( event =="PET_BAR_UPDATE_COOLDOWN" ) then
PetActionBar_UpdateCooldowns();
elseif ( event =="PET_BAR_SHOWGRID" ) then
PetActionBar_ShowGrid();
elseif ( event =="PET_BAR_HIDEGRID" ) then
PetActionBar_HideGrid();
elseif ( event =="PET_BAR_HIDE" ) then
HidePetActionBar();
end
end
end
Show details Hide details

Change log

r313 by erik.raetz on Nov 14, 2008   Diff
vehicle fix
Go to: 

Older revisions

r306 by erik.raetz on Oct 31, 2008   Diff
rothui 081031
r301 by erik.raetz on Oct 27, 2008   Diff
scaling
r282 by erik.raetz on Oct 23, 2008   Diff
petbars now WILL NOT try to spawn when
you are in combat and cast a pet then.

the petbar will return as soon as you
get OOC.
All revisions of this file

File info

Size: 17907 bytes, 538 lines
Hosted by Google Code