-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from MarcelKaemper/cDevOptimise
Merging cDevOptimise with master branch
- Loading branch information
Showing
13 changed files
with
138 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
public/javascripts/functions/console.js → ...vascripts/functions/console/consolecmd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const stdParameter = require('../public/javascripts/functions/stdParameter.js'); | ||
const stdCall = require('../public/javascripts/functions/stdCall.js'); | ||
const getUserInfo = require('../public/javascripts/functions/getUserInfo.js'); | ||
const getAllPlayers = require('../public/javascripts/functions/getAllPlayers.js'); | ||
const adminAreaHandler = require('../public/javascripts/functions/admin/adminHandler.js'); | ||
|
||
router.get('/', async(req, res, next) => { | ||
await stdCall(req); | ||
res.render('admin', stdParameter(req, 'Adminarea', { players: await getAllPlayers(req.session.uuid, "everyone"), user: await getUserInfo(req) })); | ||
}); | ||
|
||
router.post('/', async(req, res, next) => { | ||
if (req.body.confirm) { | ||
await adminAreaHandler(req.body.operation, req.body.user, req.body.additional); | ||
} | ||
res.redirect('/admin'); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const stdParameter = require('../public/javascripts/functions/stdParameter.js'); | ||
const stdCall = require('../public/javascripts/functions/stdCall.js'); | ||
const getUserInfo = require('../public/javascripts/functions/getUserInfo.js'); | ||
const transferMoney = require('../public/javascripts/functions/transferMoney.js'); | ||
const getAllPlayers = require('../public/javascripts/functions/getAllPlayers.js'); | ||
|
||
router.get('/', async(req, res, next) => { | ||
await stdCall(req); | ||
let players = await getAllPlayers(req.session.uuid, "everyoneButYou"); | ||
res.render('bank', stdParameter(req, 'Bank', { money: req.session.money, players: players, user: await getUserInfo(req) })); | ||
}); | ||
|
||
router.post('/', async(req, res, next) => { | ||
await stdCall(req); | ||
await transferMoney(req); | ||
res.redirect('/bank'); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const stdParameter = require('../public/javascripts/functions/stdParameter.js'); | ||
const stdCall = require('../public/javascripts/functions/stdCall.js'); | ||
const getUserInfo = require('../public/javascripts/functions/getUserInfo.js'); | ||
const consolecmd = require('../public/javascripts/functions/console/consolecmd.js'); | ||
|
||
router.get('/', async(req, res, next) => { | ||
await stdCall(req); | ||
res.render('console', stdParameter(req, 'Console', { message: req.session.command_log, user: await getUserInfo(req) })); | ||
}); | ||
|
||
router.post('/', async(req, res, next) => { | ||
await consolecmd(req, req.body.command); | ||
res.redirect('/console'); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const stdParameter = require('../public/javascripts/functions/stdParameter.js'); | ||
const stdCall = require('../public/javascripts/functions/stdCall.js'); | ||
const getUserInfo = require('../public/javascripts/functions/getUserInfo.js'); | ||
const loadInventory = require('../public/javascripts/functions/inventory/loadInventroy.js'); | ||
const getItemData = require('../public/javascripts/functions/inventory/getItemData.js'); | ||
|
||
router.get('/', async(req, res, next) => { | ||
await stdCall(req); | ||
var getinventory = await loadInventory(req.session.uuid); | ||
var inventory = await getItemData(getinventory); | ||
res.render('inventory', stdParameter(req, 'Inventory', { inventory: inventory, user: await getUserInfo(req) })); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const stdParameter = require('../public/javascripts/functions/stdParameter.js'); | ||
const stdCall = require('../public/javascripts/functions/stdCall.js'); | ||
const getUserInfo = require('../public/javascripts/functions/getUserInfo.js'); | ||
const listShop = require('../public/javascripts/functions/shop/listShop.js'); | ||
const buyShop = require('../public/javascripts/functions/shop/buyShop.js'); | ||
const sellShop = require('../public/javascripts/functions/shop/sellShop.js'); | ||
|
||
router.get('/', async(req, res, next) => { | ||
await stdCall(req); | ||
res.render('shop', stdParameter(req, 'Shop', { shoplist: await listShop(), message: req.query.error, user: await getUserInfo(req) })); | ||
}); | ||
|
||
router.post('/buyshop', async(req, res, next) => { | ||
var success = await buyShop(req); | ||
if (success) { | ||
res.redirect('/shop'); | ||
} else { | ||
res.redirect('/shop?error=buyFailed'); | ||
} | ||
}); | ||
|
||
router.post('/sellshop', async(req, res, next) => { | ||
await sellShop(req); | ||
res.redirect('/inventory'); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters