mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Move potion and armoire into separate modules
This commit is contained in:
@@ -33,6 +33,7 @@ api.gear =
|
|||||||
Time Traveler Store, mystery sets need their items mapped in
|
Time Traveler Store, mystery sets need their items mapped in
|
||||||
###
|
###
|
||||||
_.each api.mystery, (v,k)-> v.items = _.where api.gear.flat, {mystery:k}
|
_.each api.mystery, (v,k)-> v.items = _.where api.gear.flat, {mystery:k}
|
||||||
|
|
||||||
api.timeTravelerStore = (owned) ->
|
api.timeTravelerStore = (owned) ->
|
||||||
ownedKeys = _.keys owned.toObject?() or owned # mongoose workaround
|
ownedKeys = _.keys owned.toObject?() or owned # mongoose workaround
|
||||||
_.reduce api.mystery, (m,v,k)->
|
_.reduce api.mystery, (m,v,k)->
|
||||||
@@ -46,23 +47,9 @@ api.timeTravelerStore = (owned) ->
|
|||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
###
|
###
|
||||||
|
|
||||||
api.potion =
|
api.potion = require('../../dist/scripts/content/health-potion')
|
||||||
type: 'potion',
|
|
||||||
text: t('potionText'),
|
|
||||||
notes: t('potionNotes'),
|
|
||||||
value: 25,
|
|
||||||
key: 'potion'
|
|
||||||
|
|
||||||
api.armoire =
|
api.armoire = require('../../dist/scripts/content/armoire')
|
||||||
type: 'armoire',
|
|
||||||
text: t('armoireText'),
|
|
||||||
notes: ((user, count)->
|
|
||||||
return t('armoireNotesEmpty')() if (user.flags.armoireEmpty)
|
|
||||||
return t('armoireNotesFull')() + count
|
|
||||||
),
|
|
||||||
value: 100,
|
|
||||||
key: 'armoire',
|
|
||||||
canOwn: ((u)-> _.contains(u.achievements.ultimateGearSets, true))
|
|
||||||
|
|
||||||
###
|
###
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
|
|||||||
20
common/script/src/content/armoire.js
Normal file
20
common/script/src/content/armoire.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import {contains} from 'lodash';
|
||||||
|
import {translator as t} from './helpers';
|
||||||
|
|
||||||
|
let armoire = {
|
||||||
|
type: 'armoire',
|
||||||
|
text: t('armoireText'),
|
||||||
|
notes: ((user, count) => {
|
||||||
|
if (user.flags.armoireEmpty) {
|
||||||
|
return t('armoireNotesEmpty')();
|
||||||
|
}
|
||||||
|
return t('armoireNotesFull')() + count;
|
||||||
|
}),
|
||||||
|
value: 100,
|
||||||
|
key: 'armoire',
|
||||||
|
canOwn: ((user) => {
|
||||||
|
return contains(user.achievements.ultimateGearSets, true);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
export default armoire;
|
||||||
11
common/script/src/content/health-potion.js
Normal file
11
common/script/src/content/health-potion.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import {translator as t} from './helpers';
|
||||||
|
|
||||||
|
let potion = {
|
||||||
|
type: 'potion',
|
||||||
|
text: t('potionText'),
|
||||||
|
notes: t('potionNotes'),
|
||||||
|
value: 25,
|
||||||
|
key: 'potion',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default potion;
|
||||||
Reference in New Issue
Block a user