def put(self): permission = 'get_crystal' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) args = self.putparser.parse_args() amount = nexus.collect(args['amount']) return {'message': 'collected %d units crystal.'} % (amount), 200
def get(self): permission = 'crystal_status' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) return { 'message': 'remain %d units crystal.' } % (nexus.crestalRemain), 200
def get(self): permission = 'scout' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) return { 'message': "to defeat Amond, you'll need %d zealot!" % (nexus._amond) }, 200
def get(self): permission = 'get_status' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) return { 'message': 'you have %d pylon(s) provide %d population capacity' % ((nexus.zealot * 2 + nexus.populationCap) / 10, nexus.populationCap) }, 200
def put(self): permission = 'transport_zealot' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) args = self.putparser.parse_args() amount = nexus.transport(args['amount']) return { 'message': 'transport %d zealot warriors, En Taro Tassadar!' % amount }, 200
def put(self): permission = 'transport_pylon' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) args = self.putparser.parse_args() amount = nexus.transport(args['amount']) return { 'message': 'built %d pylons provide more %d population capacity' % (amount, amount * 10) }, 200
def post(self): permission = 'for_aiur' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) args = self.putparser.parse_args() message = None if args['for_aiur']: if nexus.forAiur(): message = 'Khassar de templari! Congratulations!' else: message = 'You failed.' else: message = "you'd better transport more zealot!" return {'message': message}, 200
def get(self): permission = 'get_status' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) return nexus.getStatus(session['role']), 200
def get(self): permission = 'get_status' abortIfSubjectUnauthenticated(session) checkPermission(session['role'], permission, role_permission) return {'message': 'you have %d zealot warriors' % nexus.zealot}, 200