I played around a bit with the frames and still have no final solution. Currently I use different desktops with different playerframes.
What I did so far:
I added the following code to my autoexec script:
Code:
RDX.RegisterFeature({
name = "Variable: Druid Mana (dmana)";
title = "Variable: Druid Mana (dmana)";
category = i18n("Variables: Unit Status");
IsPossible = function(state)
if not state:Slot("EmitPaintPreamble") then return nil; end
if state:Slot("Var_dmana") then return nil; end
return true;
end;
ExposeFeature = function(desc, state, errs)
state:AddSlot("Var_dmana");
state:AddSlot("FracVar_dmana");
return true;
end;
ApplyFeature = function(desc, state)
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) code:AppendCode([[
local maxmana = UnitPowerMax("player",0);
local actmana = UnitPower("player",0);
dmana = format("%.2f", (actmana/maxmana));
]]);
end);
local mux = state:GetContainingWindowState():GetSlotValue("Multiplexer");
local mask = mux:GetPaintMask("POWER");
mux:Event_UnitMask("UNIT_POWER", mask);
end;
UIFromDescriptor = VFL.Nil;
CreateDescriptor = function() return { feature = "Variable: Druid Mana (dmana)" }; end
});
I created an additional bar that shows this variable "dmana" under the regular powerbar. It works fine on my druid. I always have control over my manapool.
When I play another class that uses mana it works too. There is just a little difference in updating the two bars (powerbar and dmana-bar)
But when I play a class without mana it throws an error. That's why I asked about a way to switch unitframes.
Now I thought about scripting it the way that "dmana" only shows mana if unit player is a mana class and energy, rage or runic power if it's that kind of power.
Something like:
Code:
local maxmana = UnitPowerMax("player",0);
local actmana = UnitPower("player",0);
local maxpwr = UnitPowerMax("player");
local actpwr = UnitPower("player")
local isclass = UnitClass("player")
if isclass = druid then
dmana = format("%.2f", (actmana/maxmana));
else
dmana = format("%.2f", (actpwr/maxpwr));
end;
I am that bad in lua & scripting that I don't know how to correctly code that if/else part. Any help about that?
Thanks i.a.
netquick