mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 19:50:37 +00:00
Merge pull request #4690 from chimericdream/task-difficulty-context-classes
Add difficulty context class to task list items
This commit is contained in:
commit
0bd912be30
2 changed files with 19 additions and 5 deletions
11
common/dist/scripts/habitrpg-shared.js
vendored
11
common/dist/scripts/habitrpg-shared.js
vendored
|
|
@ -5189,7 +5189,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 = [];
|
||||
}
|
||||
|
|
@ -5208,7 +5208,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) {
|
||||
|
|
@ -5239,6 +5239,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 if (priority === 2) {
|
||||
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 if 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue