Skip to content

Commit

Permalink
[#240] feature(core; options dialog): added option to select instance…
Browse files Browse the repository at this point in the history
… types for dispellable auras

fix(options dialog): fixed exception if change aura tooltip type
fix(options dialog): fixed update auras if change aura tooltip type
build( ): install subversion before build
  • Loading branch information
casualshammy committed Oct 13, 2024
1 parent 2ab981e commit 083701d
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/packager-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
steps:
- name: Install Subversion
run: sudo apt-get -y update && sudo apt-get -y install subversion

- name: Checkout
uses: actions/checkout@v1

Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<strong>110002.9-release (2024/09/22)</strong>
<strong>110002.10-release (2024/10/13)</strong>
<ul>
<li>Localization update</li>
<li>Added option to select instance types for dispellable auras (https://github.com/casualshammy/NameplateAuras/issues/240)</li>
</ul>
<br>
<details>
<summary>Previous versions</summary>
<strong>110002.9-release (2024/09/22)</strong>
<ul>
<li>Localization update</li>
</ul>
<br>
<strong>110002.8-release (2024/09/02)</strong>
<ul>
<li>Localization update</li>
Expand Down
1 change: 1 addition & 0 deletions locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,6 @@ L["options:size-and-position:anchor-frame:nameplate"] = "The whole nameplate fra
L["options:size-and-position:anchor-frame:healthbar"] = "Healthbar";
L["options:size-and-position:anchor-point-to-nameplate"] = "Anchor point";
L["options:size-and-position:anchor-point-of-frame"] = "Anchor point of icons group";
L["options:apps:dispellable-spells:instance-types"] = "Set the instance types in which dispelable auras will be displayed";

--@end-debug@
19 changes: 11 additions & 8 deletions src/NameplateAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ local ATTACH_TYPE_NAMEPLATE, ATTACH_TYPE_HEALTHBAR, ATTACH_TYPE_TPTP = addonTabl
local Print, SpellTextureByID, SpellNameByID = addonTable.Print, addonTable.SpellTextureByID, addonTable.SpellNameByID;

local UpdateUnitAurasFull, UpdateUnitAurasIncremental;
-- /dump NAuras_Full, NAuras_Inc
do
NAuras_Full = 0;
NAuras_Inc = 0;
local p_updateAurasCurrentUnit = nil;

local function UpdateUnitAuras_HandleAura(_unitAuraInfo)
Expand All @@ -103,8 +100,6 @@ do
AuraUtil_ForEachAura(_unitId, "HARMFUL", nil, UpdateUnitAuras_HandleAura, true);

p_updateAurasCurrentUnit = nil;

NAuras_Full = NAuras_Full + 1;
end

function UpdateUnitAurasIncremental(_unitId, _unitGuid, _unitAuraUpdateInfo)
Expand All @@ -125,8 +120,6 @@ do
PlayerAurasPerGuid[_unitGuid][auraInstanceID] = nil;
end
end

NAuras_Inc = NAuras_Inc + 1;
end
end

Expand Down Expand Up @@ -184,6 +177,16 @@ do
Additions_ExplosiveOrbs = true,
ShowAuraTooltip = false,
Additions_DispellableSpells = false,
Additions_Dispel_InstanceTypes = {
[addonTable.INSTANCE_TYPE_NONE] = true,
[addonTable.INSTANCE_TYPE_UNKNOWN] = true,
[addonTable.INSTANCE_TYPE_PVP] = true,
[addonTable.INSTANCE_TYPE_PVP_BG_40PPL] = true,
[addonTable.INSTANCE_TYPE_ARENA] = true,
[addonTable.INSTANCE_TYPE_PARTY] = true,
[addonTable.INSTANCE_TYPE_RAID] = true,
[addonTable.INSTANCE_TYPE_SCENARIO] = true,
},
Additions_DispellableSpells_Blacklist = {},
DispelIconSizeWidth = 45,
DispelIconSizeHeight = 45,
Expand Down Expand Up @@ -1078,7 +1081,7 @@ do
};
tSize = tSize + 1;
end
if (iconGroup.Additions_DispellableSpells and not unitIsFriend and _auraData.isStealable) then
if (iconGroup.Additions_DispellableSpells and not unitIsFriend and _auraData.isStealable and iconGroup.Additions_Dispel_InstanceTypes[InstanceType]) then
if (iconGroup.Additions_DispellableSpells_Blacklist[auraName] == nil) then
AurasPerNameplate[frame][iconGroupIndex][tSize+1] = {
["duration"] = _auraData.duration,
Expand Down
17 changes: 17 additions & 0 deletions src/database.lua
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,23 @@ local migrations = {
igData.AttachToAddonFrame = nil;
end
end,
[32] = function()
local db = addonTable.db;
for _, igData in pairs(db.IconGroups) do
if (igData.Additions_Dispel_InstanceTypes == nil) then
igData.Additions_Dispel_InstanceTypes = {
[addonTable.INSTANCE_TYPE_NONE] = true,
[addonTable.INSTANCE_TYPE_UNKNOWN] = true,
[addonTable.INSTANCE_TYPE_PVP] = true,
[addonTable.INSTANCE_TYPE_PVP_BG_40PPL] = true,
[addonTable.INSTANCE_TYPE_ARENA] = true,
[addonTable.INSTANCE_TYPE_PARTY] = true,
[addonTable.INSTANCE_TYPE_RAID] = true,
[addonTable.INSTANCE_TYPE_SCENARIO] = true,
}
end
end
end,
};

local function FillInMissingEntriesIsSpells()
Expand Down
84 changes: 80 additions & 4 deletions src/options-dialog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ local function GUICategory_1(index)
checkboxAuraTooltip:SetOnClickHandler(function(this)
addonTable.db.IconGroups[CurrentIconGroup].ShowAuraTooltip = this:GetChecked();
for _, icon in pairs(addonTable.AllAuraIconFrames) do
addonTable.AllocateIcon_SetAuraTooltip(icon);
addonTable.AllocateIcon_SetAuraTooltip(icon, addonTable.db.IconGroups[CurrentIconGroup]);
end
GameTooltip:Hide();
if (addonTable.db.IconGroups[CurrentIconGroup].ShowAuraTooltip) then
Expand All @@ -394,7 +394,7 @@ local function GUICategory_1(index)
checkboxUseDefaultAuraTooltip:SetOnClickHandler(function(this)
addonTable.db.IconGroups[CurrentIconGroup].UseDefaultAuraTooltip = this:GetChecked();
for _, icon in pairs(addonTable.AllAuraIconFrames) do
addonTable.AllocateIcon_SetAuraTooltip(icon);
addonTable.AllocateIcon_SetAuraTooltip(icon, addonTable.db.IconGroups[CurrentIconGroup]);
end
GameTooltip:Hide();
end);
Expand Down Expand Up @@ -5040,6 +5040,7 @@ end
local function GUICategory_Dispel(index)
local checkBoxDispellableSpells, dispellableSpellsBlacklist, addButton, editboxAddSpell, dropdownGlowType, controlArea, sizeArea, sliderDispelIconSizeHeight, sliderDispelIconSizeWidth;
local dispellableSpellsBlacklistMenu = VGUI.CreateDropdownMenu();
local buttonInstanceTypes;

-- // checkBoxDispellableSpells
do
Expand All @@ -5049,13 +5050,17 @@ local function GUICategory_Dispel(index)
checkBoxDispellableSpells:SetOnClickHandler(function(this)
addonTable.db.IconGroups[CurrentIconGroup].Additions_DispellableSpells = this:GetChecked();
if (not addonTable.db.IconGroups[CurrentIconGroup].Additions_DispellableSpells) then
addonTable.UpdateAllNameplates(true);
controlArea:Hide();
else
controlArea:Show();
end
addonTable.UpdateAllNameplates();
end);
checkBoxDispellableSpells:HookScript("OnShow", function()
if (addonTable.db.IconGroups[CurrentIconGroup].Additions_DispellableSpells) then
controlArea:Show();
end
end);
checkBoxDispellableSpells:HookScript("OnShow", function() if (addonTable.db.IconGroups[CurrentIconGroup].Additions_DispellableSpells) then controlArea:Show(); end end);
checkBoxDispellableSpells:HookScript("OnHide", function() controlArea:Hide(); end);
checkBoxDispellableSpells:SetChecked(addonTable.db.IconGroups[CurrentIconGroup].Additions_DispellableSpells);
checkBoxDispellableSpells:SetParent(GUIFrame);
Expand Down Expand Up @@ -5364,6 +5369,77 @@ local function GUICategory_Dispel(index)
dispellableSpellsBlacklistMenu:SetPoint("TOPLEFT", dispellableSpellsBlacklist, "TOPRIGHT", 5, 0);
end

-- // buttonInstances
do
local zoneTypes = {
[addonTable.INSTANCE_TYPE_NONE] = L["instance-type:none"],
[addonTable.INSTANCE_TYPE_UNKNOWN] = L["instance-type:unknown"],
[addonTable.INSTANCE_TYPE_PVP] = L["instance-type:pvp"],
[addonTable.INSTANCE_TYPE_PVP_BG_40PPL] = L["instance-type:pvp_bg_40ppl"],
[addonTable.INSTANCE_TYPE_ARENA] = L["instance-type:arena"],
[addonTable.INSTANCE_TYPE_PARTY] = L["instance-type:party"],
[addonTable.INSTANCE_TYPE_RAID] = L["instance-type:raid"],
[addonTable.INSTANCE_TYPE_SCENARIO] = L["instance-type:scenario"],
};
local zoneIcons = {
[addonTable.INSTANCE_TYPE_NONE] = SpellTextureByID[6711],
[addonTable.INSTANCE_TYPE_UNKNOWN] = SpellTextureByID[175697],
[addonTable.INSTANCE_TYPE_PVP] = SpellTextureByID[232352],
[addonTable.INSTANCE_TYPE_PVP_BG_40PPL] = 132485,
[addonTable.INSTANCE_TYPE_ARENA] = SpellTextureByID[270697],
[addonTable.INSTANCE_TYPE_PARTY] = SpellTextureByID[77629],
[addonTable.INSTANCE_TYPE_RAID] = SpellTextureByID[3363],
[addonTable.INSTANCE_TYPE_SCENARIO] = SpellTextureByID[77628],
};

local dropdownInstanceTypes = VGUI.CreateDropdownMenu();
dropdownInstanceTypes:SetHeight(230);
buttonInstanceTypes = VGUI.CreateButton();
buttonInstanceTypes:SetParent(controlArea);
buttonInstanceTypes:SetText(L["options:apps:dispellable-spells:instance-types"]);

local function setEntries()
local entries = { };
for instanceType, instanceLocalizatedName in pairs(zoneTypes) do
table_insert(entries, {
["text"] = instanceLocalizatedName,
["icon"] = zoneIcons[instanceType],
["func"] = function(info)
local btn = dropdownInstanceTypes:GetButtonByText(info.text);
if (btn) then
info.disabled = not info.disabled;
btn:SetGray(info.disabled);
addonTable.db.IconGroups[CurrentIconGroup].Additions_Dispel_InstanceTypes[info.instanceType] = not info.disabled;
end
addonTable.UpdateAllNameplates();
end,
["disabled"] = not addonTable.db.IconGroups[CurrentIconGroup].Additions_Dispel_InstanceTypes[instanceType],
["dontCloseOnClick"] = true,
["instanceType"] = instanceType,
});
end
table_sort(entries, function(item1, item2) return item1.instanceType < item2.instanceType; end);
return entries;
end

buttonInstanceTypes:SetPoint("TOPLEFT", dispellableSpellsBlacklist, "BOTTOMLEFT", 0, -10);
buttonInstanceTypes:SetPoint("TOPRIGHT", dispellableSpellsBlacklist, "BOTTOMRIGHT", 0, -10);
buttonInstanceTypes:SetHeight(40);
buttonInstanceTypes:SetScript("OnClick", function(self)
if (dropdownInstanceTypes:IsVisible()) then
dropdownInstanceTypes:Hide();
else
dropdownInstanceTypes:SetList(setEntries());
dropdownInstanceTypes:SetParent(self);
dropdownInstanceTypes:ClearAllPoints();
dropdownInstanceTypes:SetPoint("TOP", self, "BOTTOM", 0, 0);
dropdownInstanceTypes:Show();
end
end);
buttonInstanceTypes:SetScript("OnHide", function() dropdownInstanceTypes:Hide() end);

end

end

local function GUICategory_IconGroups(_index)
Expand Down

0 comments on commit 083701d

Please sign in to comment.