mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
add debug buttons back in, including +10 gems (@sabrecat)
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
moment = require 'moment'
|
||||
algos = require 'habitrpg-shared/script/algos'
|
||||
|
||||
module.exports.app = (appExports, model) ->
|
||||
user = model.at('_user')
|
||||
|
||||
appExports.emulateNextDay = ->
|
||||
yesterday = +moment().subtract('days', 1).toDate()
|
||||
user.set 'lastCron', yesterday
|
||||
window.location.reload()
|
||||
|
||||
appExports.emulateTenDays = ->
|
||||
yesterday = +moment().subtract('days', 10).toDate()
|
||||
user.set 'lastCron', yesterday
|
||||
window.location.reload()
|
||||
|
||||
appExports.cheat = ->
|
||||
user.incr 'stats.exp', algos.tnl(user.get('stats.lvl'))
|
||||
user.incr 'stats.gp', 1000
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http',
|
||||
function($scope, $rootScope, User, $http) {
|
||||
habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Notification', 'API_URL',
|
||||
function($scope, $rootScope, User, $http, Notification, API_URL) {
|
||||
|
||||
/**
|
||||
External Scripts
|
||||
@@ -39,6 +39,26 @@ habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http',
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug functions. Note that the server route for gems is only available if process.env.DEBUG=true
|
||||
*/
|
||||
$scope.addMissedDay = function(){
|
||||
var dayBefore = moment(User.user.lastCron).subtract('days', 1).toDate();
|
||||
User.set({lastCron: dayBefore});
|
||||
Notification.text('-1 day, remember to refresh');
|
||||
}
|
||||
$scope.addTenGems = function(){
|
||||
console.log(API_URL);
|
||||
$http.post(API_URL + '/api/v1/user/addTenGems').success(function(){
|
||||
User.log({});
|
||||
})
|
||||
}
|
||||
$scope.addLevelsAndGold = function(){
|
||||
User.setMultiple({
|
||||
'stats.exp': User.user.stats.exp + 10000,
|
||||
'stats.gp': User.user.stats.gp + 10000
|
||||
});
|
||||
}
|
||||
}])
|
||||
@@ -452,6 +452,14 @@ api.unlock = function(req, res) {
|
||||
------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
api.addTenGems = function(req, res) {
|
||||
var user = res.locals.user;
|
||||
user.balance += 2.5;
|
||||
user.save(function(err){
|
||||
if (err) return res.json(500,{err:err});
|
||||
res.send(204);
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
Setup Stripe response when posting payment
|
||||
|
||||
@@ -38,6 +38,9 @@ router.post('/user/task', auth.auth, cron, user.createTask);
|
||||
router.put('/user/task/:id/sort', auth.auth, cron, verifyTaskExists, user.sortTask);
|
||||
router.post('/user/clear-completed', auth.auth, cron, user.clearCompleted);
|
||||
router.post('/user/task/:id/unlink', auth.auth, challenges.unlink); // removing cron since they may want to remove task first
|
||||
if (process.env.NODE_ENV == 'development') {
|
||||
router.post('/user/addTenGems', auth.auth, user.addTenGems);
|
||||
}
|
||||
|
||||
/* Items*/
|
||||
router.post('/user/buy/:type', auth.auth, cron, user.buy);
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<!--
|
||||
This is a static template file, so it doesn't have an associated app.
|
||||
It is rendered by the server via a staticPages renderer.
|
||||
|
||||
Since static pages don't include the Derby client library, they can't have
|
||||
bound variables that automatically update. However, they do support initial
|
||||
template tag rendering from a context object and/or model.
|
||||
-->
|
||||
|
||||
<Title:>
|
||||
Not found
|
||||
|
||||
<Body:>
|
||||
<h1>404</h1>
|
||||
<p>Sorry, we can't find anything at <b>{{url}}</b>.
|
||||
<p>Try heading back to the <a href="/">home page</a>.
|
||||
@@ -65,15 +65,13 @@ footer.footer(ng-controller='FooterCtrl')
|
||||
td
|
||||
a.addthis_button_google_plusone(g:plusone:size='medium')
|
||||
else
|
||||
h4 Cheat
|
||||
h4 Debug
|
||||
ul.unstyled
|
||||
li
|
||||
button.btn(x-bind='click:emulateNextDay') Emulate Next Day
|
||||
a.btn(ng-click='addMissedDay()') +1 Missed Day
|
||||
li
|
||||
button.btn(x-bind='click:emulateTenDays') Emulate 10 Days
|
||||
a.btn(ng-click='addTenGems()') +10 Gems
|
||||
li
|
||||
button.btn(x-bind='click:cheat') Insta Level
|
||||
li
|
||||
button.btn(x-bind='click:reset') Reset Level
|
||||
a.btn(ng-click='addLevelsAndGold()') +Exp +GP
|
||||
|
||||
div(ng-init='deferredScripts()')
|
||||
|
||||
Reference in New Issue
Block a user