Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super(WorldNPCsForm, self).__init__(*args, **kwargs)

        # NPC's typeclass
        typeclasses = TYPECLASS_SET.get_group("NON_PLAYER")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        # NPC's location
        rooms = CM.WORLD_ROOMS.objects.all()
        choices = [(r.key, r.name + " (" + r.key + ")") for r in rooms]
        self.fields['location'] = LocationField(choices=choices)

        # NPC's model
        choices = [("", "---------")]
        objects = CM.CHARACTER_MODELS.objects.all().values("key",
                                                           "name").distinct()
        choices.extend([(obj["key"], obj["name"] + " (" + obj["key"] + ")")
                        for obj in objects])
        self.fields['model'] = forms.ChoiceField(choices=choices,
                                                 required=False)

        # NPC's icon
        self.fields['icon'] = IconField(required=False)

        localize_form_fields(self)
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        super(ShopsForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("SHOP")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        self.fields['icon'] = IconField(required=False)

        localize_form_fields(self)
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        super(WorldObjectsForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("WORLD_OBJECT")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        rooms = CM.WORLD_ROOMS.objects.all()
        choices = [(r.key, r.name + " (" + r.key + ")") for r in rooms]
        self.fields['location'] = LocationField(choices=choices)

        self.fields['icon'] = IconField(required=False)

        localize_form_fields(self)
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        super(SkillBooksForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("SKILL_BOOK")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        # skills
        objects = CM.SKILLS.objects.all()
        choices = [(obj.key, obj.name + " (" + obj.key + ")")
                   for obj in objects]
        self.fields['skill'] = forms.ChoiceField(choices=choices)

        # icons
        self.fields['icon'] = IconField(required=False)

        localize_form_fields(self)
Exemplo n.º 5
0
    def __init__(self, *args, **kwargs):
        super(CommonCharacterForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("CHARACTER")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        # models
        choices = [("", "---------")]
        objects = CM.CHARACTER_MODELS.objects.all()
        model_keys = set([obj.key for obj in objects])
        choices.extend([(model_key, model_key) for model_key in model_keys])
        self.fields['model'] = forms.ChoiceField(choices=choices,
                                                 required=False)

        self.fields['icon'] = IconField(required=False)

        localize_form_fields(self)
Exemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        super(WorldRoomsForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("ROOM")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        choices = [("", "---------")]
        objects = CM.WORLD_AREAS.objects.all()
        choices.extend([(obj.key, obj.name + " (" + obj.key + ")")
                        for obj in objects])
        self.fields['location'] = forms.ChoiceField(choices=choices)

        self.fields['icon'] = IconField(required=False)

        self.fields['background'] = ImageField(required=False)

        localize_form_fields(self)
Exemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        super(SkillsForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("SKILL")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        self.fields['icon'] = IconField(required=False)

        choices = [("", "---------")]
        objects = CM.SKILL_TYPES.objects.all()
        choices.extend([(obj.key, obj.name + " (" + obj.key + ")")
                        for obj in objects])
        self.fields['main_type'] = forms.ChoiceField(choices=choices,
                                                     required=False)
        self.fields['sub_type'] = forms.ChoiceField(choices=choices,
                                                    required=False)

        localize_form_fields(self)
Exemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        super(DialogueSentencesForm, self).__init__(*args, **kwargs)

        objects = CM.DIALOGUES.objects.all()
        choices = [(obj.key, obj.name + " (" + obj.key + ")")
                   for obj in objects]
        self.fields['dialogue'] = forms.ChoiceField(choices=choices)

        # dialogue's icon
        self.fields['icon'] = IconField(required=False)

        choices = [("", "---------")]
        objects = CM.QUESTS.objects.all()
        choices.extend([(obj.key, obj.name + " (" + obj.key + ")")
                        for obj in objects])
        self.fields['provide_quest'] = forms.ChoiceField(choices=choices,
                                                         required=False)
        self.fields['complete_quest'] = forms.ChoiceField(choices=choices,
                                                          required=False)

        localize_form_fields(self)
Exemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        super(EquipmentsForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("EQUIPMENT")
        choices = [(key, cls.typeclass_name + " (" + key + ")")
                   for key, cls in typeclasses.items()]
        self.fields['typeclass'] = forms.ChoiceField(choices=choices)

        objects = CM.EQUIPMENT_POSITIONS.objects.all()
        choices = [(obj.key, obj.name + " (" + obj.key + ")")
                   for obj in objects]
        self.fields['position'] = forms.ChoiceField(choices=choices)

        objects = CM.EQUIPMENT_TYPES.objects.all()
        choices = [(obj.key, obj.name + " (" + obj.key + ")")
                   for obj in objects]
        self.fields['type'] = forms.ChoiceField(choices=choices)

        self.fields['icon'] = IconField(required=False)

        localize_form_fields(self)
        EQUIPMENT_ATTRIBUTES_INFO.set_form_fields(self)