Files
habitica/website/common/script/content/achievements.js
Kaitlin Hipkin 0817cf96e1 Achievement list renovation & Achievements API (#7904)
* pull apart achievements into different subcategories

* achievs previously hidden to others if unachieved are now always shown

* achievs previously always hidden if unachieved are now always shown

* pull apart ultimate gear achievs

* add achiev wrapper mixin

* add achiev mixin for simple counts

* add achiev mixin for singular/plural achievs

* add simpleAchiev mixin and support attributes

* always hide potentially unearnable achievs if unearned

* contributor achiev now uses string interpolation for readMore link

* transition to basic achiev grid layout

* fix npc achievement img bug introduced in c90f7e2

* move surveys and contributor achievs into special section so it is never empty

* double size of achievs in achievs grid

* achievs in grid are muted if unachieved (includes recompiled sprites)

* fix streak notification strings

* add counts to achievement badges for applicable achieved achievs

* list achievements by api

* fix achievement strings in new api

* unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges

* fix & cleanup achievements api

* extract generation of the achievements result to a class

* clean up achievement counter css using existing classes

* simplify exports of new achievementBuilder lib

* remove class logic from achievementBuilder lib

* move achievs to common, add rebirth achiev logic, misc fixes

* replace achievs jade logic with results of api call

* fix linting errors

* achievs lib now returns achievs object subdivided by type (basic/seasonal/special

* add tests for new achievs lib

* fix linting errors

* update controllers and views for updated achievs lib

* add indices to achievements to preserve intended order

* move achiev popovers to left

* rename achievs lib to achievements

* adjust positioning of achieve popovers now that stats and achievs pages
are separate

* fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs

* revert compiled sprites so they don't bog down the PR

* pull out achievs api integration tests

* parameterize ultimate gear achievements' text string

* break out static achievement data from user-specific data

* reorg content.achievements to add achiev data in related chunks

* cleanup, respond to feedback

* improve api documentation

* fix merge issues

* Helped Habit Grow --> Helped Habitica Grow

* achievement popovers are muted if the achiev is unearned

* fix singular achievement labels / achievement popover on click

* update apidoc for achievements (description, param-type, successExample, error-types)

* fix whitespace issues in members.js

* move html to a variable

* updated json example

* fix syntax after merge
2016-12-13 12:48:18 -06:00

189 lines
4.7 KiB
JavaScript

import { each } from 'lodash';
let achievementsData = {};
let worldQuestAchievs = {
dilatoryQuest: {
icon: 'achievement-dilatory',
titleKey: 'achievementDilatory',
textKey: 'achievementDilatoryText',
},
stressbeastQuest: {
icon: 'achievement-stoikalm',
titleKey: 'achievementStressbeast',
textKey: 'achievementStressbeastText',
},
burnoutQuest: {
icon: 'achievement-burnout',
titleKey: 'achievementBurnout',
textKey: 'achievementBurnoutText',
},
bewilderQuest: {
icon: 'achievement-bewilder',
titleKey: 'achievementBewilder',
textKey: 'achievementBewilderText',
},
};
Object.assign(achievementsData, worldQuestAchievs);
let seasonalSpellAchievs = {
snowball: {
icon: 'achievement-snowball',
titleKey: 'annoyingFriends',
textKey: 'annoyingFriendsText',
},
spookySparkles: {
icon: 'achievement-spookySparkles',
titleKey: 'alarmingFriends',
textKey: 'alarmingFriendsText',
},
shinySeed: {
icon: 'achievement-shinySeed',
titleKey: 'agriculturalFriends',
textKey: 'agriculturalFriendsText',
},
seafoam: {
icon: 'achievement-seafoam',
titleKey: 'aquaticFriends',
textKey: 'aquaticFriendsText',
},
};
Object.assign(achievementsData, seasonalSpellAchievs);
let masterAchievs = {
beastMaster: {
icon: 'achievement-rat',
titleKey: 'beastMasterName',
textKey: 'beastMasterText',
text2Key: 'beastMasterText2',
},
mountMaster: {
icon: 'achievement-wolf',
titleKey: 'mountMasterName',
textKey: 'mountMasterText',
text2Key: 'mountMasterText2',
},
triadBingo: {
icon: 'achievement-triadbingo',
titleKey: 'triadBingoName',
textKey: 'triadBingoText',
text2Key: 'triadBingoText2',
},
};
Object.assign(achievementsData, masterAchievs);
let basicAchievs = {
partyUp: {
icon: 'achievement-partyUp',
titleKey: 'partyUpName',
textKey: 'partyUpText',
},
partyOn: {
icon: 'achievement-partyOn',
titleKey: 'partyOnName',
textKey: 'partyOnText',
},
streak: {
icon: 'achievement-thermometer',
singularTitleKey: 'streakSingular',
singularTextKey: 'streakSingularText',
pluralTitleKey: 'streakName',
pluralTextKey: 'streakText',
},
perfect: {
icon: 'achievement-perfect',
singularTitleKey: 'perfectSingular',
singularTextKey: 'perfectSingularText',
pluralTitleKey: 'perfectName',
pluralTextKey: 'perfectText',
},
};
Object.assign(achievementsData, basicAchievs);
let specialAchievs = {
contributor: {
icon: 'achievement-boot',
titleKey: 'contribName',
textKey: 'contribText',
},
npc: {
icon: 'achievement-ultimate-warrior',
titleKey: 'npcAchievementName',
textKey: 'npcAchievementText',
},
kickstarter: {
icon: 'achievement-heart',
titleKey: 'kickstartName',
textKey: 'kickstartText',
},
veteran: {
icon: 'achievement-cake',
titleKey: 'veteran',
textKey: 'veteranText',
},
originalUser: {
icon: 'achievement-alpha',
titleKey: 'originalUser',
textKey: 'originalUserText',
},
habitSurveys: {
icon: 'achievement-tree',
singularTitleKey: 'helped',
singularTextKey: 'surveysSingle',
pluralTitleKey: 'helped',
pluralTextKey: 'surveysMultiple',
},
};
Object.assign(achievementsData, specialAchievs);
let holidayAchievs = {
habiticaDays: {
icon: 'achievement-habiticaDay',
singularTitleKey: 'habiticaDay',
singularTextKey: 'habiticaDaySingularText',
pluralTitleKey: 'habiticaDay',
pluralTextKey: 'habiticaDayPluralText',
},
habitBirthdays: {
icon: 'achievement-habitBirthday',
singularTitleKey: 'habitBirthday',
singularTextKey: 'habitBirthdayText',
pluralTitleKey: 'habitBirthday',
pluralTextKey: 'habitBirthdayPluralText',
},
costumeContests: {
icon: 'achievement-costumeContest',
singularTitleKey: 'costumeContest',
singularTextKey: 'costumeContestText',
pluralTitleKey: 'costumeContest',
pluralTextKey: 'costumeContestTextPlural',
},
};
Object.assign(achievementsData, holidayAchievs);
let ultimateGearAchievs = ['healer', 'rogue', 'warrior', 'mage'].reduce((achievs, type) => {
achievs[`${type}UltimateGear`] = {
icon: `achievement-ultimate-${type}`,
titleKey: 'ultimGearName',
textKey: 'ultimGearText',
};
return achievs;
}, {});
Object.assign(achievementsData, ultimateGearAchievs);
let cardAchievs = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday'].reduce((achievs, type) => {
achievs[`${type}Cards`] = {
icon: `achievement-${type}`,
titleKey: `${type}CardAchievementTitle`,
textKey: `${type}CardAchievementText`,
};
return achievs;
}, {});
Object.assign(achievementsData, cardAchievs);
each(achievementsData, (value, key) => {
value.key = key;
});
module.exports = achievementsData;