Thread: rmod Layouts
View Single Post
Old 03/18/08, 6:29 AM   #68 (permalink)
zork
Don Flamenco
 
zork's Avatar
 
Dwarf Warrior
 
Eredar (EU)
Check: http://wdnaddons.com/

This is the source for Blizzard FrameXML Code - online.

Its a great help if you want to know what the Blizzard UI does.

You can rewrite Blizzard functions and replace stuff with your own version. This can be done really easily.

I show you how to do it:

Open: http://wdnaddons.com/0408049/FrameXML/ActionButton.lua

Find the function UpdateUsable
  
  function ActionButton_UpdateUsable()
    local icon = getglobal(this:GetName().."Icon");
    local normalTexture = getglobal(this:GetName().."NormalTexture");
    local isUsable, notEnoughMana = IsUsableAction(this.action);
    if ( isUsable ) then
      icon:SetVertexColor(1.0, 1.0, 1.0);
      normalTexture:SetVertexColor(1.0, 1.0, 1.0);
    elseif ( notEnoughMana ) then
      icon:SetVertexColor(0.5, 0.5, 1.0);
      normalTexture:SetVertexColor(0.5, 0.5, 1.0);
    else
      icon:SetVertexColor(0.4, 0.4, 0.4);
      normalTexture:SetVertexColor(1.0, 1.0, 1.0);
    end
  end
Now you can rewrite this function in your addon.

Like this:
  
  ActionButton_UpdateUsable = function()
    local icon = getglobal(this:GetName().."Icon");
    local normalTexture = getglobal(this:GetName().."NormalTexture");
    if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) 
    then
      icon:SetVertexColor(1,0,0);
      normalTexture:SetVertexColor(1,1,1);
    else
      local isUsable, notEnoughMana = IsUsableAction(ActionButton_GetPagedID(this));
      if ( notEnoughMana ) then
        icon:SetVertexColor(0,0,1);
        normalTexture:SetVertexColor(1,1,1);
      elseif ( isUsable ) then
        icon:SetVertexColor(1, 1, 1);
        normalTexture:SetVertexColor(1,1,1);
      else
        icon:SetVertexColor(0.3,0.3,0.3);
        normalTexture:SetVertexColor(1,1,1);
      end
    end
  end
The most important line is marked red. "ActionButton_UpdateUsable" now uses the new function.

You can do this with every Blizzard function you want to change.

 
User is offline.
Reply With Quote