Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        super(WorldExitsForm, self).__init__(*args, **kwargs)

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

        localize_form_fields(self)
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        super(WorldExitsForm, self).__init__(*args, **kwargs)

        typeclasses = TYPECLASS_SET.get_group("EXIT")
        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['destination'] = LocationField(choices=choices)

        localize_form_fields(self)
Esempio n. 3
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
        choices = [("", "---------")]
        objects = CM.ICON_RESOURCES.objects.all()
        choices.extend([(obj.key, obj.name + " (" + obj.key + ")")
                        for obj in objects])
        self.fields['icon'] = forms.ChoiceField(choices=choices,
                                                required=False)

        localize_form_fields(self)
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        super(WorldObjectsForm, self).__init__(*args, **kwargs)

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

        self.fields['icon'] = ImageField(image_type="icon", required=False)

        localize_form_fields(self)
Esempio n. 5
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'] = ImageField(image_type="icon", required=False)

        localize_form_fields(self)
Esempio n. 6
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)

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

        localize_form_fields(self)