예제 #1
0
    def army_edition(self, army=None, special_message=''):
        if (army == None):
            army_id = self.request.matchdict.get('id', 0)
            army = Army.get_by_id(army_id)
        
        dice_list = [{'id': dice.id, 'name': dice.name, 'picture': dice.template.picture} for dice in army.components]

        template_list = []
        for race in Race.get_all():
            if race.break_by_color:
                for color in Element.get_all():
                    sub_race = []
                    for dice in race.dices:
                        if color in dice.elements:
                            sub_race.append(dice)
                    if sub_race != []:
                        template_list.append((color.name+' '+race.name, color.element_short_name+' '+race.tag, race.color, [{'id': dice.id, 'name': dice.name, 'picture': dice.picture} for dice in sub_race]))
            else:
                template_list.append((race.name, race.tag, race.color, [{'id': dice_template.id, 'name': dice_template.name, 'picture': dice_template.picture} for dice_template in race.dices]))

        return {'special_message': special_message, 'races': template_list, 'dices': dice_list, 'army_id': army.id}
    'VANISH': 'Vanish',
    'VOLLEY': 'Volley',

    'WAVE': 'Wave',
    'WAYFARE': 'Wayfare',
    'WEB': 'Web',
    'WILD_GROWTH': 'WildGrowth',
    'WITHER': 'Wither',

    #For non released stuff
    'NONE': 'Melee',
}

from business.element import Element
conversion_color = {
    'WATER': Element.get_by_id(3),
    'AIR': Element.get_by_id(1),
    'EARTH': Element.get_by_id(4),
    'FIRE': Element.get_by_id(2),
    'DEATH': Element.get_by_id(5),
    'IVORY': Element.get_by_id(6),
    'WHITE': Element.get_by_id(7)
}

from business.dice.dice_type import DiceType
conversion_unit_type = {
    1: DiceType.get_by_id(1),
    2: DiceType.get_by_id(2),
    3: DiceType.get_by_id(3),
    4: DiceType.get_by_id(4),
}