mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
add difficulty context class to task list items
This commit is contained in:
11
common/dist/scripts/habitrpg-shared.js
vendored
11
common/dist/scripts/habitrpg-shared.js
vendored
@@ -5154,7 +5154,7 @@ Task classes given everything about the class
|
||||
*/
|
||||
|
||||
api.taskClasses = function(task, filters, dayStart, lastCron, showCompleted, main) {
|
||||
var classes, completed, enabled, filter, repeat, type, value, _ref;
|
||||
var classes, completed, enabled, filter, priority, repeat, type, value, _ref;
|
||||
if (filters == null) {
|
||||
filters = [];
|
||||
}
|
||||
@@ -5173,7 +5173,7 @@ api.taskClasses = function(task, filters, dayStart, lastCron, showCompleted, mai
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
type = task.type, completed = task.completed, value = task.value, repeat = task.repeat;
|
||||
type = task.type, completed = task.completed, value = task.value, repeat = task.repeat, priority = task.priority;
|
||||
if (main) {
|
||||
if (!task._editing) {
|
||||
for (filter in filters) {
|
||||
@@ -5204,6 +5204,13 @@ api.taskClasses = function(task, filters, dayStart, lastCron, showCompleted, mai
|
||||
classes += ' habit-narrow';
|
||||
}
|
||||
}
|
||||
if (priority === 1) {
|
||||
classes += ' difficulty-easy';
|
||||
} else if (priority === 1.5) {
|
||||
classes += ' difficulty-medium';
|
||||
} else {
|
||||
classes += ' difficulty-hard';
|
||||
}
|
||||
if (value < -20) {
|
||||
classes += ' color-worst';
|
||||
} else if (value < -10) {
|
||||
|
||||
@@ -250,7 +250,7 @@ Task classes given everything about the class
|
||||
###
|
||||
api.taskClasses = (task, filters=[], dayStart=0, lastCron=+new Date, showCompleted=false, main=false) ->
|
||||
return unless task
|
||||
{type, completed, value, repeat} = task
|
||||
{type, completed, value, repeat, priority} = task
|
||||
|
||||
# Filters
|
||||
if main # only show when on your own list
|
||||
@@ -277,6 +277,13 @@ api.taskClasses = (task, filters=[], dayStart=0, lastCron=+new Date, showComplet
|
||||
classes += ' habit-wide' if task.down and task.up
|
||||
classes += ' habit-narrow' if !task.down and !task.up
|
||||
|
||||
if priority == 1
|
||||
classes += ' difficulty-easy'
|
||||
else if priority == 1.5
|
||||
classes += ' difficulty-medium'
|
||||
else # priority == 2
|
||||
classes += ' difficulty-hard'
|
||||
|
||||
if value < -20
|
||||
classes += ' color-worst'
|
||||
else if value < -10
|
||||
@@ -771,7 +778,7 @@ api.wrap = (user, main=true) ->
|
||||
user.items.currentMount = ""
|
||||
user.items.currentPet = ""
|
||||
for animal of content.pets
|
||||
giveTriadBingo = false if user.items.pets[animal] == -1
|
||||
giveTriadBingo = false if user.items.pets[animal] == -1
|
||||
user.items.pets[animal] = 0
|
||||
user.items.mounts[animal] = null
|
||||
if not user.achievements.beastMasterCount
|
||||
@@ -1353,7 +1360,7 @@ api.wrap = (user, main=true) ->
|
||||
user.stats.gp = if stats.gp >= 0 then stats.gp else 0
|
||||
|
||||
tnl = api.tnl(user.stats.lvl)
|
||||
|
||||
|
||||
# level up & carry-over exp
|
||||
if stats.exp >= tnl
|
||||
#silent = true # push through the negative xp silently
|
||||
|
||||
Reference in New Issue
Block a user