I has some globals in the code but 95% is savedvariables. That could cause the problem too?
The reason for the globals because of the xml code based options.
Code:
-- Dropdown Menus
function PowaAuras.DropDownMenu_Initialize(owner)
local info;
local aura = PowaAuras.Auras[PowaAuras.CurrentAuraId];
local name = owner:GetName();
if (aura == nil) then
aura = PowaAuras:AuraFactory(PowaAuras.BuffTypes.Buff, 0);
end
if (name == "PowaStrataDropDown") then
UIDropDownMenu_SetWidth(owner, 125)
for i = 1, #PowaAuras.StrataList do
local info = UIDropDownMenu_CreateInfo();
info.text = PowaAuras.StrataList[i];
info.func = function(self)
local strata = PowaAuras.StrataList[i];
local AuraID = PowaAuras.CurrentAuraId;
if PowaAuras.CurrentAuraId > 120 then
PowaGlobalSet[AuraID]["strata"] = strata;
end
PowaSet[AuraID]["strata"] = strata
UIDropDownMenu_SetSelectedName(PowaStrataDropDown, strata);
PowaAuras:RedisplayAura(PowaAuras.CurrentAuraId);
end
UIDropDownMenu_AddButton(info);
end
elseif (name == "PowaTextureStrataDropDown") then
UIDropDownMenu_SetWidth(owner, 125)
for i = 1, #PowaAuras.TextureStrataList do
local info = UIDropDownMenu_CreateInfo();
info.text = PowaAuras.TextureStrataList[i];
info.func = function(self)
local texturestrata = PowaAuras.TextureStrataList[i];
local AuraID = PowaAuras.CurrentAuraId;
if PowaAuras.CurrentAuraId > 120 then
PowaGlobalSet[AuraID]["texturestrata"] = texturestrata;
end
PowaSet[AuraID]["texturestrata"] = texturestrata
UIDropDownMenu_SetSelectedName(PowaTextureStrataDropDown, texturestrata);
PowaAuras:RedisplayAura(PowaAuras.CurrentAuraId);
end
UIDropDownMenu_AddButton(info);
end
elseif (name == "PowaBlendModeDropDown") then
UIDropDownMenu_SetWidth(owner, 125)
for i = 1, #PowaAuras.BlendModeList do
local info = UIDropDownMenu_CreateInfo();
info.text = PowaAuras.BlendModeList[i];
info.func = function(self)
local blendmode = PowaAuras.BlendModeList[i];
local AuraID = PowaAuras.CurrentAuraId;
if PowaAuras.CurrentAuraId > 120 then
PowaGlobalSet[AuraID]["blendmode"] = blendmode;
end
PowaSet[AuraID]["blendmode"] = blendmode
UIDropDownMenu_SetSelectedName(PowaBlendModeDropDown, blendmode);
PowaAuras:RedisplayAura(PowaAuras.CurrentAuraId);
end
UIDropDownMenu_AddButton(info);
end
elseif (name == "PowaGradientStyleDropDown") then
UIDropDownMenu_SetWidth(owner, 120)
for i = 1, #PowaAuras.GradientStyleList do
local info = UIDropDownMenu_CreateInfo();
info.text = PowaAuras.GradientStyleList[i];
info.func = function(self)
local gradientstyle = PowaAuras.GradientStyleList[i];
local AuraID = PowaAuras.CurrentAuraId;
if PowaAuras.CurrentAuraId > 120 then
PowaGlobalSet[AuraID]["gradientstyle"] = gradientstyle;
end
PowaSet[AuraID]["gradientstyle"] = gradientstyle
UIDropDownMenu_SetSelectedName(PowaGradientStyleDropDown, gradientstyle);
PowaAuras:RedisplayAura(PowaAuras.CurrentAuraId);
end
UIDropDownMenu_AddButton(info);
end
elseif (name == "PowaDropDownBuffType") then
UIDropDownMenu_SetWidth(owner, 175)
PowaAuras:FillDropdownSorted(PowaAuras.Text.AuraType, {func = PowaAuras.DropDownMenu_OnClickBuffType, owner = owner});
UIDropDownMenu_SetSelectedValue(PowaDropDownBuffType, aura.bufftype);
elseif (name == "PowaDropDownPowerType") then
UIDropDownMenu_SetWidth(owner, 145)
info = {func = PowaAuras.DropDownMenu_OnClickPowerType, owner = owner};
for i, name in pairs(PowaAuras.Text.PowerType) do
info.text = name;
info.value = i;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedValue(PowaDropDownPowerType, aura.PowerType);
elseif (name == "PowaDropDownStance") then
UIDropDownMenu_SetWidth(owner, 145)
info = {func = PowaAuras.DropDownMenu_OnClickStance, owner = owner};
for k, v in pairs(PowaAuras.PowaStance) do
info.text = v;
info.value = k;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedValue(PowaDropDownStance, aura.stance);
elseif (name == "PowaDropDownGTFO") then
UIDropDownMenu_SetWidth(owner, 145)
info = {func = PowaAuras.DropDownMenu_OnClickGTFO, owner = owner};
for i = 0, #(PowaAuras.PowaGTFO) do
info.text = PowaAuras.PowaGTFO[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedValue(PowaDropDownGTFO, aura.GTFO);
elseif (name == "PowaDropDownAnimBegin") then
UIDropDownMenu_SetWidth(owner, 190)
info = {func = PowaAuras.DropDownMenu_OnClickBegin, owner = owner};
for i = 0, #PowaAuras.BeginAnimDisplay do
info.text = PowaAuras.BeginAnimDisplay[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedValue(PowaDropDownAnimBegin, aura.begin);
elseif (name == "PowaDropDownAnimEnd") then
UIDropDownMenu_SetWidth(owner, 190)
info = {func = PowaAuras.DropDownMenu_OnClickEnd, owner = owner};
local aura = PowaAuras.Auras[PowaAuras.CurrentAuraId];
if aura ~= nil then
if aura.UseOldAnimations == false then
for i = 0, #PowaAuras.EndAnimDisplay do
info.text = PowaAuras.EndAnimDisplay[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
else
for i = 0, #PowaAuras.EndAnimDisplay - 2 do
info.text = PowaAuras.EndAnimDisplay[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
end
UIDropDownMenu_SetSelectedValue(PowaDropDownAnimEnd, aura.finish);
else
for i = 0, #PowaAuras.EndAnimDisplay - 2 do
info.text = PowaAuras.EndAnimDisplay[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedID(PowaDropDownAnimEnd, 1);
end
elseif (name == "PowaDropDownAnim1") then
UIDropDownMenu_SetWidth(owner, 190)
local aura = PowaAuras.Auras[PowaAuras.CurrentAuraId];
if aura ~= nil then
if aura.UseOldAnimations == false then
for i = 1, #(PowaAuras.Anim) do
info = { };
info.text = PowaAuras.Anim[i];
info.value = i;
info.func = PowaAuras.DropDownMenu_OnClickAnim1;
UIDropDownMenu_AddButton(info);
end
else
for i = 1, #(PowaAuras.Anim) - 2 do
info = { };
info.text = PowaAuras.Anim[i];
info.value = i;
info.func = PowaAuras.DropDownMenu_OnClickAnim1;
UIDropDownMenu_AddButton(info);
end
end
UIDropDownMenu_SetSelectedValue(PowaDropDownAnim1, aura.anim1);
else
for i = 1, #(PowaAuras.Anim) - 2 do
info = { };
info.text = PowaAuras.Anim[i];
info.value = i;
info.func = PowaAuras.DropDownMenu_OnClickAnim1;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedID(PowaDropDownAnim1, 1);
end
elseif (name == "PowaDropDownAnim2") then
UIDropDownMenu_SetWidth(owner, 190)
local aura = PowaAuras.Auras[PowaAuras.CurrentAuraId];
if aura ~= nil then
if aura.UseOldAnimations == false then
for i = 0, #(PowaAuras.Anim) do
info = { };
info.text = PowaAuras.Anim[i];
info.value = i;
info.func = PowaAuras.DropDownMenu_OnClickAnim2;
UIDropDownMenu_AddButton(info);
end
else
for i = 0, #(PowaAuras.Anim) - 2 do
info = { };
info.text = PowaAuras.Anim[i];
info.value = i;
info.func = PowaAuras.DropDownMenu_OnClickAnim2;
UIDropDownMenu_AddButton(info);
end
end
UIDropDownMenu_SetSelectedValue(PowaDropDownAnim2, aura.anim2);
else
for i = 0, #(PowaAuras.Anim) - 2 do
info = { };
info.text = PowaAuras.Anim[i];
info.value = i;
info.func = PowaAuras.DropDownMenu_OnClickAnim2;
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_SetSelectedID(PowaDropDownAnim2, 1);
end
elseif (name == "PowaDropDownSound") then
UIDropDownMenu_SetWidth(owner, 210)
info = {func = PowaAuras.DropDownMenu_OnClickSound, owner = owner};
for i = 0, 29 do
if (PowaAuras.Sound[i]) then
info.text = PowaAuras.Sound[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
end
if (aura.sound < 30) then
UIDropDownMenu_SetSelectedValue(PowaDropDownSound, aura.sound);
else
UIDropDownMenu_SetSelectedValue(PowaDropDownSound, 0);
end
elseif (name == "PowaDropDownSound2") then
UIDropDownMenu_SetWidth(owner, 210)
info = {func = PowaAuras.DropDownMenu_OnClickSound, owner = owner};
for i = 30, #PowaAuras.Sound do
if (PowaAuras.Sound[i]) then
info.text = PowaAuras.Sound[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
end
if (aura.sound >= 30) then
UIDropDownMenu_SetSelectedValue(PowaDropDownSound2, aura.sound);
else
UIDropDownMenu_SetSelectedValue(PowaDropDownSound2, 30);
end
elseif (name == "PowaDropDownSoundEnd") then
UIDropDownMenu_SetWidth(owner, 210)
info = {func = PowaAuras.DropDownMenu_OnClickSoundEnd, owner = owner};
for i = 0, 29 do
if (PowaAuras.Sound[i]) then
info.text = PowaAuras.Sound[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
end
if (aura.soundend < 30) then
UIDropDownMenu_SetSelectedValue(PowaDropDownSoundEnd, aura.soundend);
else
UIDropDownMenu_SetSelectedValue(PowaDropDownSoundEnd, 0);
end
elseif (name == "PowaDropDownSound2End") then
UIDropDownMenu_SetWidth(owner, 210)
info = {func = PowaAuras.DropDownMenu_OnClickSoundEnd, owner = owner};
for i = 30, #PowaAuras.Sound do
if (PowaAuras.Sound[i]) then
info.text = PowaAuras.Sound[i];
info.value = i;
UIDropDownMenu_AddButton(info);
end
end
if (aura.soundend >= 30) then
UIDropDownMenu_SetSelectedValue(PowaDropDownSound2End, aura.soundend);
else
UIDropDownMenu_SetSelectedValue(PowaDropDownSound2End, 30);
end
elseif (name == "PowaBuffTimerRelative") then
UIDropDownMenu_SetWidth(owner, 190)
info = {func = PowaAuras.DropDownMenu_OnClickTimerRelative, owner = owner};
for _, v in pairs({"NONE", "TOPLEFT", "TOP", "TOPRIGHT", "RIGHT", "BOTTOMRIGHT", "BOTTOM", "BOTTOMLEFT", "LEFT", "CENTER"}) do
info.text = PowaAuras.Text.Relative[v];
info.value = v;
UIDropDownMenu_AddButton(info);
end
if (aura.Timer) then
UIDropDownMenu_SetSelectedValue(PowaBuffTimerRelative, aura.Timer.Relative);
end
elseif (name == "PowaBuffStacksRelative") then
UIDropDownMenu_SetWidth(owner, 190)
info = {func = PowaAuras.DropDownMenu_OnClickStacksRelative, owner = owner};
for _, v in pairs({"NONE", "TOPLEFT", "TOP", "TOPRIGHT", "RIGHT", "BOTTOMRIGHT", "BOTTOM", "BOTTOMLEFT", "LEFT", "TOPLEFT", "CENTER"}) do
info.text = PowaAuras.Text.Relative[v];
info.value = v;
UIDropDownMenu_AddButton(info);
end
if (aura.Stacks) then
UIDropDownMenu_SetSelectedValue(PowaBuffStacksRelative, aura.Stacks.Relative);
end
end
end
function PowaAuras:FillDropdownSorted(t, info)
local names = PowaAuras:CopyTable(t);
local values = PowaAuras:ReverseTable(names);
table.sort(names);
--for k,v in ipairs(names) do PowaAuras:Message(k, " ", v, " ", auraReverse[v]) end
for _, name in pairs(names) do
info.text = name;
info.value = values[name];
UIDropDownMenu_AddButton(info);
end
end