-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
178 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ WQA.missionList = {} | |
WQA.itemList = {} | ||
WQA.links = {} | ||
WQA.Criterias = {} | ||
WQA.Rewards = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
---@class WQAchievements | ||
local WQA = WQAchievements | ||
|
||
---@enum CriteriaType | ||
local CriteriaType = { | ||
AreaPoi = "AREA_POI" | ||
} | ||
|
||
WQA.Criterias = { | ||
CriteriaType = CriteriaType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
---@class WQAchievements | ||
local WQA = WQAchievements | ||
local CriteriaType = WQA.Criterias.CriteriaType | ||
local RewardType = WQA.Rewards.RewardType | ||
|
||
---@param items { name: string, criteriaType: CriteriaType, criteria: AreaPoiCriteria[] }[] | ||
function WQA:AddMiscellaneous(items) | ||
for _, item in pairs(items) do | ||
if item.criteriaType == CriteriaType.AreaPoi then | ||
for _, criteria in pairs(item.criteria) do | ||
WQA.Criterias.AreaPoi:AddReward( | ||
criteria --[[@as AreaPoiCriteria]], | ||
RewardType.Miscellaneous, | ||
item.name) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
---@class WQAchievements | ||
local WQA = WQAchievements | ||
local RewardType = WQA.Rewards.RewardType | ||
|
||
|
||
---@param rewardType RewardType | ||
function WQA:AddReward(list, rewardType, reward, emissary) | ||
local l = list | ||
if emissary == true then | ||
l.isEmissary = true | ||
end | ||
if not l.reward then | ||
l.reward = {} | ||
end | ||
|
||
|
||
---@type table <RewardType, any> | ||
l = l.reward | ||
if rewardType == RewardType.Achievement then | ||
if not l.achievement then | ||
l.achievement = {} | ||
end | ||
|
||
for _, achievement in ipairs(l.achievement) do | ||
if achievement.id == reward then | ||
return | ||
end | ||
end | ||
|
||
l.achievement[#l.achievement + 1] = { id = reward } | ||
elseif rewardType == RewardType.Chance then | ||
if not l.chance then | ||
l.chance = {} | ||
end | ||
|
||
for _, v in pairs(l.chance) do | ||
if v.id == reward then | ||
return | ||
end | ||
end | ||
|
||
l.chance[#l.chance + 1] = { id = reward } | ||
elseif rewardType == RewardType.Custom then | ||
if not l.custom then | ||
l.custom = true | ||
end | ||
elseif rewardType == RewardType.Item then | ||
if not l.item then | ||
l.item = {} | ||
end | ||
for k, v in pairs(reward) do | ||
l.item[k] = v | ||
end | ||
elseif rewardType == RewardType.Reputation then | ||
if not l.reputation then | ||
l.reputation = {} | ||
end | ||
for k, v in pairs(reward) do | ||
l.reputation[k] = v | ||
end | ||
elseif rewardType == RewardType.Recipe then | ||
l.recipe = reward | ||
elseif rewardType == RewardType.CustomItem then | ||
l.customItem = reward | ||
elseif rewardType == RewardType.Currency then | ||
if not l.currency then | ||
l.currency = {} | ||
end | ||
for k, v in pairs(reward) do | ||
l.currency[k] = v | ||
end | ||
elseif rewardType == RewardType.ProfessionSkillup then | ||
l.professionSkillup = reward | ||
elseif rewardType == RewardType.Gold then | ||
l.gold = reward | ||
elseif rewardType == RewardType.AzeriteTrait then | ||
if not l.azeriteTraits then | ||
l.azeriteTraits = {} | ||
end | ||
for k, v in pairs(l.azeriteTraits) do | ||
if v.spellID == reward then | ||
return | ||
end | ||
end | ||
l.azeriteTraits[#l.azeriteTraits + 1] = { spellID = reward } | ||
elseif rewardType == RewardType.Miscellaneous then | ||
if not l[RewardType.Miscellaneous] then | ||
---@type { [string]: boolean } | ||
l[RewardType.Miscellaneous] = {} | ||
end | ||
|
||
table.insert(l[RewardType.Miscellaneous], reward) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
---@class WQAchievements | ||
local WQA = WQAchievements | ||
|
||
---@enum RewardType | ||
local RewardType = { | ||
Achievement = "ACHIEVEMENT", | ||
AzeriteTrait = "AZERITE_TRAIT", | ||
Chance = "CHANCE", | ||
Currency = "CURRENCY", | ||
Custom = "CUSTOM", | ||
CustomItem = "CUSTOM_ITEM", | ||
Gold = "GOLD", | ||
Item = "ITEM", | ||
Miscellaneous = "MISCELLANEOUS", | ||
ProfessionSkillup = "PROFESSION_SKILLUP", | ||
Recipe = "RECIPE", | ||
Reputation = "REPUTATION" | ||
} | ||
|
||
WQA.Rewards = { | ||
RewardType = RewardType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters