Skip to content

Commit

Permalink
categories using api
Browse files Browse the repository at this point in the history
  • Loading branch information
Krowi authored and Krowi committed Nov 15, 2024
1 parent 082c554 commit 9fb71c0
Show file tree
Hide file tree
Showing 30 changed files with 22,880 additions and 14,109 deletions.
62 changes: 62 additions & 0 deletions Api/CategoryDataApi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,66 @@ KrowiAF.CategoryData = {};

function KrowiAF.AddCategoryData(id, name, canMerge)
addon.Data.Categories[id] = addon.Objects.Category:New(id, name, canMerge);
end

function KrowiAF.AddIfNewCategoryData(id, name, canMerge)
if addon.Data.Categories[id] then
return;
end
KrowiAF.AddCategoryData(id, name, canMerge);
end

local function AddToTab(id, tabName)
addon.Data.Categories[id]:SetTabName(tabName);
addon.Tabs[tabName].Categories = addon.Data.Categories[id].Children;
addon.Tabs[tabName].Category = addon.Data.Categories[id];
end

local function AddAchievements(categoryId, achievementIds)
for _, achievementId in next, achievementIds do
if addon.Data.Achievements[achievementId] then
addon.Data.Categories[categoryId]:AddAchievement(addon.Data.Achievements[achievementId]);
end
end
end

local ParseCategory;
local function ParseChild(category, index)
if addon.Util.IsTable(category[index]) and category[index].IsTab then
AddToTab(category[1], category[index].TabName);
return;
end

if addon.Util.IsTable(category[index]) and #category[index] > 2 and addon.Util.IsString(category[index][2]) then
ParseCategory(category[index], addon.Data.Categories[category[1]]);
return;
end

if addon.Util.IsTable(category[index]) and (#category[index] == 1 or addon.Util.IsNumber(category[index][2])) then
AddAchievements(category[1], category[index]);
return;
end
end

function ParseCategory(category, parent)
KrowiAF.AddIfNewCategoryData(category[1], category[2], addon.Util.IsBoolean(category[3]) and category[3] or nil);

if parent then
parent:AddCategory(addon.Data.Categories[category[1]]);
end

local index = addon.Util.IsBoolean(category[3]) and 4 or 3;

while category[index] do
ParseChild(category, index);
index = index + 1;
end
end

function KrowiAF.CreateCategories()
KrowiAF_CategoriesLoadTime = debugprofilestop()
for _, root in next, KrowiAF.CategoryData do
ParseCategory(root);
end
KrowiAF_CategoriesLoadTime = debugprofilestop() - KrowiAF_CategoriesLoadTime
end
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

## 79.0 - 2024-11-09
## 79.0 - 2024-11-15
### Added
- Guild achievements tab keybind
- WoW's 20th Anniversary achievement

### Changed
- Achievements (only the data, addin to catagories to do) are now moved to the new API system
- Achievements and Categories are now moved to the new API system
- Data loading time is reduced by 50%

### Cata Classic
Expand Down
9 changes: 7 additions & 2 deletions Changelogs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Added
- Transmog sets for The War Within raid and season 1
- Guild achievements tab keybind
- WoW's 20th Anniversary achievement

### Changed
- Transmog sets are now moved to the new API system
- Achievements and Categories are now moved to the new API system
- Data loading time is reduced by 50%

### Cata Classic
- Additional (promotional) achievements marked as unobtainable
10 changes: 8 additions & 2 deletions Changelogs/CurseForge.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<p><h3>Added</h3></p>
<ul>
<li>Transmog sets for The War Within raid and season 1</li>
<li>Guild achievements tab keybind</li>
<li>WoW's 20th Anniversary achievement</li>
</ul>
<p><h3>Changed</h3></p>
<ul>
<li>Transmog sets are now moved to the new API system</li>
<li>Achievements and Categories are now moved to the new API system</li>
<li>Data loading time is reduced by 50%</li>
</ul>
<p><h3>Cata Classic</h3></p>
<ul>
<li>Additional (promotional) achievements marked as unobtainable</li>
</ul>
9 changes: 7 additions & 2 deletions Changelogs/Wago.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Added
- Transmog sets for The War Within raid and season 1
- Guild achievements tab keybind
- WoW's 20th Anniversary achievement

### Changed
- Transmog sets are now moved to the new API system
- Achievements and Categories are now moved to the new API system
- Data loading time is reduced by 50%

### Cata Classic
- Additional (promotional) achievements marked as unobtainable
11 changes: 9 additions & 2 deletions Changelogs/WowInterface.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
[B]Added[/B]
[LIST]
[*]Transmog sets for The War Within raid and season 1
[*]Guild achievements tab keybind
[*]WoW's 20th Anniversary achievement
[/LIST]

[B]Changed[/B]
[LIST]
[*]Transmog sets are now moved to the new API system
[*]Achievements and Categories are now moved to the new API system
[*]Data loading time is reduced by 50%
[/LIST]

[B]Cata Classic[/B]
[LIST]
[*]Additional (promotional) achievements marked as unobtainable
[/LIST]
Loading

0 comments on commit 9fb71c0

Please sign in to comment.