def move_mobs(self): # move mobs for mob in Mob.objects.exclude(static=True).exclude(template=True): if random.randint(0, 10) == 0: # get a random available direction direction = mob.room.from_room.all().order_by('?')[0].direction execute_command(mob, direction)
def create(self, request): try: # get the player player = Player.objects.get(user=request.user, status='logged_in') # get the raw command raw_cmd = request.POST.get('command') # execute the command deltas = execute_command(player, raw_cmd) deltas.append('map') return Fetcher(request, player, cache=True).fetch(deltas) except Exception, e: print raw_cmd error = "Command Error: %s" % e pulse_log = logging.getLogger('StarkLogger') pulse_log.debug(error) print error raise