Beispiel #1
0
    def view(self, charname=None):
        if charname is None:
            redirect(url(controller='menu', action='index'))

        if not re.match(r'^[A-Za-z0-9_\'-]+$', charname):
            log.warn("Ignoring odd-looking character name '%s'" % charname)
            redirect(url(controller='menu', action='index'))

        c.character = Session.query(Character).filter(Character.name == charname).first()
        if c.character is None:
            c.character = Character(charname)
            Session.add(c.character)
            Session.commit()

        c.equipped = {}
        c.form = {'faction': c.character.faction.name,
                  'spec': c.character.spec.name,
                  'advclass': c.character.advclass.name,
                  'ready': c.character.ready or None,
                  }
        for e in c.character.equipped:
            c.equipped[e.position()] = e
            c.form['equip_%d' % e.position()] = str(e.gear_id)

        log.debug(c.form)

        c.gear = Session.query(Gear).order_by(Gear.rank).order_by(Gear.pvp.desc()).all()
        c.spec = Session.query(Spec).order_by(Spec.id).all()
        c.factions = Session.query(Faction).order_by(Faction.id).all()
        c.advclasses = Session.query(AdvClass).order_by(AdvClass.name).all()

        self._advise()

        return render('char.html')
Beispiel #2
0
    def view(self, faction):
        c.faction = Session.query(Faction).filter_by(name=faction).one()
        c.free_characters = Session.query(Character).filter_by(faction=c.faction, group=None).all()
        c.groups = Session.query(Group).filter_by(faction=c.faction).all()
        c.instances = Session.query(Instance).order_by(Instance.id.desc()).all()
        c.modes = Session.query(Mode).all()

        return render('plan.html')
Beispiel #3
0
    def faction(self, charname=None):
        if charname is None:
            return

        c.character = Session.query(Character).filter(Character.name == charname).first()
        if c.character is None:
            return

        c.character.faction = Session.query(Faction).filter_by(name=request.params['value']).one()
        Session.commit()
        
        self._advise()

        return render('advice.html')
Beispiel #4
0
    def equip(self, charname=None):
        if charname is None:
            return

        c.character = Session.query(Character).filter(Character.name == charname).first()
        if c.character is None:
            return

        position = int(request.params.get('slot', None))
        gear_id = int(request.params.get('gear', None))

        gear = Session.query(Gear).filter(Gear.id == gear_id).one()

        for e in c.character.equipped:
            if e.position() == position:
                e.gear = gear
                Session.commit()
                break

        self._advise()

        return render('advice.html')
Beispiel #5
0
 def index(self):
     c.chars = sorted(Session.query(Character).all(), key=lambda char: char.name.lower())
     
     return render('index.html')