Skip to content

Commit

Permalink
Option to change the transparency of the faction icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Krowi authored and Krowi committed Jan 10, 2025
1 parent b75cf9b commit 780fbd3
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 44 deletions.
17 changes: 9 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@
"TABARDSLOT",
"LFG_LIST_TITLE",
"TOY",
"PERKS_VENDOR_CATEGORY_TRANSMOG"
"PERKS_VENDOR_CATEGORY_TRANSMOG",
"TooltipBackdropTemplateMixin"
],
"Lua.diagnostics.disable": [
"deprecated",
Expand All @@ -554,13 +555,13 @@
"exclude":"**/{.git,.vscode,Changelogs,Descriptions}/**",
"deleteTargetOnDeploy": true
},
// {
// "source":"E:\\World of Warcraft Addon Development\\Krowi_AchievementFilter",
// "target":"F:\\World of Warcraft\\_classic_\\Interface\\AddOns\\Krowi_AchievementFilter",
// "include":"**/*.{lua,toc,blp,tga,xml,md}",
// "exclude":"**/{.git,.vscode,Changelogs,Descriptions}/**",
// "deleteTargetOnDeploy": true
// },
{
"source":"E:\\World of Warcraft Addon Development\\Krowi_AchievementFilter",
"target":"F:\\World of Warcraft\\_classic_\\Interface\\AddOns\\Krowi_AchievementFilter",
"include":"**/*.{lua,toc,blp,tga,xml,md}",
"exclude":"**/{.git,.vscode,Changelogs,Descriptions}/**",
"deleteTargetOnDeploy": true
},
// {
// "source":"E:\\World of Warcraft Addon Development\\Krowi_AchievementFilter",
// "target":"F:\\World of Warcraft\\_ptr_\\Interface\\AddOns\\Krowi_AchievementFilter",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## 81.2 - 2025-01-10
### Fixed
- Option to change the transparency of the faction icon

## 81.1 - 2025-01-10
### Fixed
- Resolved some loading order issues related to ElvUI and event reminders
Expand Down
13 changes: 10 additions & 3 deletions Gui/WindowFrames/AchievementButton/AchievementButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ function KrowiAF_AchievementButton_OnLoad(self)
self.Header:SetPoint("RIGHT", self.DateCompleted, "LEFT", -10, 0);
self.Header:SetJustifyH("LEFT");
end
if addon.Options.db.profile.Achievements.ShowAllianceFactionIcon or addon.Options.db.profile.Achievements.ShowHordeFactionIcon then
self.Faction = CreateFrame("Frame", nil, self, "KrowiAF_AchievementButtonFaction_Template");
end
_, self.FontHeight = self.Description:GetFont();
self.MaxDescriptionLinesCollapsed = min(max(1, floor(30 / (self.FontHeight - 0.001))), self.MaxDescriptionLinesCollapsed);
self.Description:SetHeight(10 * self.MaxDescriptionLinesCollapsed);
self.Description:SetPoint("RIGHT", self.Shield, "LEFT", -10, 0);
self.MinExpandedHeight = ACHIEVEMENTBUTTON_COLLAPSEDHEIGHT;
self:Collapse();

TooltipBackdropTemplateMixin.TooltipBackdropOnLoad(self);
end

function KrowiAF_AchievementButton_Small_OnLoad(self)
Expand Down Expand Up @@ -53,6 +52,8 @@ function KrowiAF_AchievementButton_Small_OnLoad(self)
self.Shield.Icon:SetPoint("TOPRIGHT", 0, 0);
self.Shield.Points:SetSize(48, 48);
self.Shield.Points:SetPoint("TOPRIGHT", -1, 2);
self.FactionIcon:SetSize(80, 40);
self.FactionIcon:SetPoint("TOPRIGHT", -30, -4);
self.Tracked:SetPoint("TOPLEFT", 9, -46);

self.MaxDescriptionLinesCollapsed = 1;
Expand All @@ -63,6 +64,8 @@ function KrowiAF_AchievementButton_Small_OnLoad(self)
if addon.Options.db.profile.RightClickMenu.ShowButtonOnAchievement then
AddRightClickMenuButton(self);
end

KrowiAF_AchievementButton_OnLoad(self);
end

function KrowiAF_AchievementButton_Normal_OnLoad(self)
Expand All @@ -73,6 +76,8 @@ function KrowiAF_AchievementButton_Normal_OnLoad(self)
if addon.Options.db.profile.RightClickMenu.ShowButtonOnAchievement then
AddRightClickMenuButton(self);
end

KrowiAF_AchievementButton_OnLoad(self);
end

function KrowiAF_AchievementButton_Light_OnLoad(self)
Expand All @@ -90,4 +95,6 @@ function KrowiAF_AchievementButton_Light_OnLoad(self)
self:SetScript("OnEvent", nil);

self.HeaderLeftAnchor = self.Icon;

KrowiAF_AchievementButton_Small_OnLoad(self);
end
26 changes: 10 additions & 16 deletions Gui/WindowFrames/AchievementButton/AchievementButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
<Color r="1.0" g="1.0" b="1.0"/>
</Font>

<Frame name="KrowiAF_AchievementButtonFaction_Template" enableMouse="false" virtual="true">
<Size x="42" y="40"/>
<Anchors>
<Anchor point="TOPRIGHT" relativeKey="$parent.Shield" relativePoint="TOPLEFT"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentIcon" parentKey="Icon" atlas="MountJournalIcons-Alliance" setAllPoints="true"/>
</Layer>
</Layers>
</Frame>

<EventButton name="KrowiAF_AchievementButton_Template" mixin="KrowiAF_AchievementButtonMixin" inherits="TooltipBorderBackdropTemplate" registerForClicks="LeftButtonUp, RightButtonUp" virtual="true">
<Layers>
<Layer level="BACKGROUND">
Expand Down Expand Up @@ -125,6 +113,12 @@
<Anchor point="TOP" relativeKey="$parent.RewardBackground" relativePoint="TOP" x="0" y="1"/>
</Anchors>
</FontString>
<Texture name="$parentFactionIcon" parentKey="FactionIcon" file="interface/glues/charactercreate/charactercreate" alpha="0.2" hidden="true">
<Size x="80" y="60"/>
<Anchors>
<Anchor point="TOPRIGHT" x="-55" y="-4"/>
</Anchors>
</Texture>
<FontString name="$parentDateCompleted" parentKey="DateCompleted" inherits="AchievementDateFont" text="5/16/08" justifyH="CENTER" hidden="true">
<Size x="64" y="14"/>
<Anchors>
Expand Down Expand Up @@ -162,7 +156,7 @@
</Layer>
</Layers>
<Scripts>
<OnLoad inherit="prepend" function="KrowiAF_AchievementButton_OnLoad"/>
<OnLoad function="KrowiAF_AchievementButton_OnLoad"/>
<OnEvent method="OnEvent"/>
<OnShow method="OnShow"/>
<OnHide method="OnHide"/>
Expand Down Expand Up @@ -317,20 +311,20 @@
<EventButton name="KrowiAF_AchievementButton_Small_Template" inherits="KrowiAF_AchievementButton_Template" virtual="true">
<Size x="434" y="42"/>
<Scripts>
<OnLoad inherit="append" function="KrowiAF_AchievementButton_Small_OnLoad"/>
<OnLoad function="KrowiAF_AchievementButton_Small_OnLoad"/>
</Scripts>
</EventButton>

<EventButton name="KrowiAF_AchievementButton_Normal_Template" inherits="KrowiAF_AchievementButton_Template" virtual="true">
<Size x="434" y="142"/>
<Scripts>
<OnLoad inherit="append" function="KrowiAF_AchievementButton_Normal_OnLoad"/>
<OnLoad function="KrowiAF_AchievementButton_Normal_OnLoad"/>
</Scripts>
</EventButton>

<EventButton name="KrowiAF_AchievementButton_Light_Template" mixin="KrowiAF_AchievementButtonLightMixin" inherits="KrowiAF_AchievementButton_Small_Template" virtual="true">
<Scripts>
<OnLoad inherit="append" function="KrowiAF_AchievementButton_Light_OnLoad"/>
<OnLoad function="KrowiAF_AchievementButton_Light_OnLoad"/>
<OnEnter method="OnEnter"/>
<OnLeave method="OnLeave"/>
<OnClick method="OnClick"/>
Expand Down
14 changes: 8 additions & 6 deletions Gui/WindowFrames/AchievementButton/AchievementButtonMixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -493,20 +493,22 @@ local function SetRewardText(self, rewardText)
end

local function SetFaction(self, achievement)
if not self.Faction then
if not achievement.Faction then
self.FactionIcon:Hide();
return;
end
self.FactionIcon:SetAlpha(addon.Options.db.profile.Achievements.FactionIconAlpha);
if achievement.Faction == KrowiAF.Enum.Faction.Alliance and addon.Options.db.profile.Achievements.ShowAllianceFactionIcon then
self.Faction.Icon:SetAtlas("MountJournalIcons-Alliance");
self.Faction:Show();
self.FactionIcon:SetTexCoord(0.65966796875, 0.74951171875, 0.150879, self.Compact and 0.19961 or 0.22412109375);
self.FactionIcon:Show();
return;
end
if achievement.Faction == KrowiAF.Enum.Faction.Horde and addon.Options.db.profile.Achievements.ShowHordeFactionIcon then
self.Faction.Icon:SetAtlas("MountJournalIcons-Horde");
self.Faction:Show();
self.FactionIcon:SetTexCoord(0.75048828125, 0.84033203125, 0.150879, self.Compact and 0.19961 or 0.22412109375);
self.FactionIcon:Show();
return;
end
self.Faction:Hide();
self.FactionIcon:Hide();
end

function KrowiAF_AchievementButtonMixin:SetAchievementData(achievement, id, name, points, completed, month, day, year, description, flags, icon, rewardText, wasEarnedByMe)
Expand Down
2 changes: 1 addition & 1 deletion Krowi_AchievementFilter.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: Krowi's |cFF1D92C2Achievement Filter|r
## X-Prefix: KrowiAF
## X-Acronym: KAF
## Version: 81.1
## Version: 81.2-beta1
## Author: Krowi-Frostmane EU
## SavedVariables: KrowiAF_DebugTable, KrowiAF_Options, KrowiAF_SavedData, KrowiAF_Filters, KrowiAF_SearchOptions, KrowiAF_Achievements
## OptionalDeps: BetterWardrobe, ElvUI, GW2_UI, InstanceAchievementTracker
Expand Down
2 changes: 1 addition & 1 deletion Krowi_AchievementFilter_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: Krowi's |cFF1D92C2Achievement Filter|r
## X-Prefix: KrowiAF
## X-Acronym: KAF
## Version: 81.1
## Version: 81.2-beta1
## Author: Krowi-Frostmane EU
## SavedVariables: KrowiAF_DebugTable, KrowiAF_Options, KrowiAF_SavedData, KrowiAF_Filters, KrowiAF_SearchOptions, KrowiAF_Achievements
## Notes: Filters your achievements.
Expand Down
4 changes: 3 additions & 1 deletion Localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1149,4 +1149,6 @@ L["Zaqali Ruin Investigation: Next"] = true
L["Zaqali Ruin Investigation: Soon"] = true
L["Zaqali Ruin Investigation: Starting Soon"] = true
L["Zones"] = true
L["Zuldazar"] = true
L["Zuldazar"] = true
L["Faction Icon Transparency"] = true
L["Faction Icon Transparency Desc"] = "The transparency of the faction icon with 0 being fully transparent and 1 being fully opaque."
1 change: 1 addition & 0 deletions Options/Defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ addon.Options.Defaults = {
HideDateCompleted = false,
ShowAllianceFactionIcon = false,
ShowHordeFactionIcon = false,
FactionIconAlpha = 0.2,
Objectives = {
ForceTwoColumns = true,
ForceTwoColumnsThreshold = 20,
Expand Down
53 changes: 45 additions & 8 deletions Options/Layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,39 @@ local function MergeMergeSmallCategoriesThresholdSet(_, value)
KrowiAF_CategoriesFrame:Update(true);
end

local function ShowAllianceFactionIconSet(_, value)
addon.Options.db.profile.Achievements.ShowAllianceFactionIcon = value;
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

local function ShowHordeFactionIconSet(_, value)
addon.Options.db.profile.Achievements.ShowHordeFactionIcon = value;
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

local function FactionIconAlphaSet(_, value)
addon.Options.db.profile.Achievements.FactionIconAlpha = value;
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

local function ShowTemporarilyObtainableIconSet(_, value)
addon.Options.db.profile.Achievements.ShowTemporarilyObtainableIcon = value;
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:Update();
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

Expand All @@ -476,7 +503,7 @@ local function TemporarilyObtainableHeaderColorsSet(_, value)
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:Update();
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

Expand All @@ -485,7 +512,7 @@ local function ShowWarbandIconSet(_, value)
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:Update();
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

Expand All @@ -494,7 +521,7 @@ local function WarbandHeaderColorSet(_, value)
if not KrowiAF_AchievementsFrame then
return;
end
KrowiAF_SummaryFrame:Update();
KrowiAF_SummaryFrame:UpdateAchievementsOnNextShow();
KrowiAF_AchievementsFrame:ForceUpdate();
end

Expand Down Expand Up @@ -1073,17 +1100,27 @@ local achievementsOptions = {
ShowAllianceFactionIcon = {
order = OrderPP(), type = "toggle", width = AdjustedWidth(1.35),
name = addon.L["Show Faction Faction Icon"]:K_ReplaceVars(addon.L["Alliance"]),
desc = addon.L["Show Faction Faction Icon Desc"]:K_ReplaceVars(addon.L["Alliance"]):KAF_AddDefaultValueText("Achievements.ShowAllianceFactionIcon"):K_AddReloadRequired(),
desc = addon.L["Show Faction Faction Icon Desc"]:K_ReplaceVars(addon.L["Alliance"]):KAF_AddDefaultValueText("Achievements.ShowAllianceFactionIcon"),
get = function() return addon.Options.db.profile.Achievements.ShowAllianceFactionIcon; end,
set = function(_, value) addon.Options.db.profile.Achievements.ShowAllianceFactionIcon = value; end,
set = ShowAllianceFactionIconSet,
},
ShowHordeFactionIcon = {
order = OrderPP(), type = "toggle", width = AdjustedWidth(1.35),
name = addon.L["Show Faction Faction Icon"]:K_ReplaceVars(addon.L["Horde"]),
desc = addon.L["Show Faction Faction Icon Desc"]:K_ReplaceVars(addon.L["Horde"]):KAF_AddDefaultValueText("Achievements.ShowHordeFactionIcon"):K_AddReloadRequired(),
desc = addon.L["Show Faction Faction Icon Desc"]:K_ReplaceVars(addon.L["Horde"]):KAF_AddDefaultValueText("Achievements.ShowHordeFactionIcon"),
get = function() return addon.Options.db.profile.Achievements.ShowHordeFactionIcon; end,
set = function(_, value) addon.Options.db.profile.Achievements.ShowHordeFactionIcon = value; end,
set = ShowHordeFactionIconSet,
},
FactionIconAlpha = {
order = OrderPP(), type = "range", width = AdjustedWidth(1.35),
name = addon.L["Faction Icon Transparency"],
desc = addon.L["Faction Icon Transparency Desc"]:KAF_AddDefaultValueText("Achievements.FactionIconAlpha"),
min = 0, max = 1, step = 0.01,
get = function() return addon.Options.db.profile.Achievements.FactionIconAlpha; end,
set = FactionIconAlphaSet,
disabled = function() return not addon.Options.db.profile.Achievements.ShowAllianceFactionIcon and not addon.Options.db.profile.Achievements.ShowHordeFactionIcon; end
},
Blank1 = {order = OrderPP(), type = "description", width = AdjustedWidth(1.35), name = ""},
ShowTemporarilyObtainableIcon = {
order = OrderPP(), type = "toggle", width = AdjustedWidth(1.35),
name = addon.L["Show Temporarily obtainable Icon"]:K_ReplaceVars(addon.L["Temporarily obtainable"]),
Expand Down

0 comments on commit 780fbd3

Please sign in to comment.