def __init__(self, *args, **kwargs): super(CreatorLootListForm, self).__init__(*args, **kwargs) # providers must be object_creators objects = models.world_objects.objects.filter( typeclass="CLASS_OBJECT_CREATOR") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['provider'] = forms.ChoiceField(choices=choices) # available objects are common objects, foods or equipments objects = models.common_objects.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] foods = models.foods.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in foods]) equipments = models.equipments.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in equipments]) self.fields['object'] = forms.ChoiceField(choices=choices) # depends on quest choices = [("", "---------")] objects = models.quests.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['quest'] = forms.ChoiceField(choices=choices, required=False) self.fields['quest'].label = u"Depends on quest" localize_form_fields(self)
def __init__(self, *args, **kwargs): super(WorldNPCsForm, self).__init__(*args, **kwargs) # NPC's typeclass objects = DATA_SETS.typeclasses.objects.filter(category="CATE_CHARACTER") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) # NPC's location areas = DATA_SETS.world_areas.objects.all() rooms = DATA_SETS.world_rooms.objects.all() choices = [] for area in areas: area_rooms = [(r.key, r.name + " (" + r.key + ")") for r in rooms if r.location == area.key] if area_rooms: choices.append((area.name, area_rooms)) self.fields['location'] = forms.ChoiceField(choices=choices) # NPC's model choices = [("", "---------")] objects = DATA_SETS.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 = DATA_SETS.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)
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) 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) choices = [("", "---------")] objects = CM.IMAGE_RESOURCES.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['background'] = forms.ChoiceField(choices=choices, required=False) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(CharacterLootListForm, self).__init__(*args, **kwargs) # providers can be world_npc or common_character choices = [("", "---------")] npcs = models.world_npcs.objects.all() choices.extend([(obj.key, obj.key) for obj in npcs]) characters = models.common_characters.objects.all() choices.extend([(obj.key, obj.key) for obj in characters]) self.fields['provider'] = forms.ChoiceField(choices=choices) # available objects are common objects, foods or equipments choices = [("", "---------")] objects = models.common_objects.objects.all() choices.extend([(obj.key, obj.key) for obj in objects]) foods = models.foods.objects.all() choices.extend([(obj.key, obj.key) for obj in foods]) equipments = models.equipments.objects.all() choices.extend([(obj.key, obj.key) for obj in equipments]) self.fields['object'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(CharacterLootListForm, self).__init__(*args, **kwargs) # providers can be world_npc or common_character npcs = CM.WORLD_NPCS.all_with_base() choices = [(obj["key"], obj["name"] + " (" + obj["key"] + ")") for obj in npcs] characters = CM.CHARACTERS.all_with_base() choices.extend([(obj["key"], obj["name"] + " (" + obj["key"] + ")") for obj in characters]) self.fields['provider'] = forms.ChoiceField(choices=choices) # available objects choices = get_all_pocketable_objects() self.fields['object'] = forms.ChoiceField(choices=choices) # depends on quest choices = [("", "---------")] objects = CM.QUESTS.all_with_base() choices.extend([(obj["key"], obj["name"] + " (" + obj["key"] + ")") for obj in objects]) self.fields['quest'] = forms.ChoiceField(choices=choices, required=False) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(ShopGoodsForm, self).__init__(*args, **kwargs) # all shops objects = CM.SHOPS.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['shop'] = forms.ChoiceField(choices=choices) # available objects choices = get_all_pocketable_objects() self.fields['object'] = forms.ChoiceField(choices=choices) # Goods typeclasses typeclasses = TYPECLASS_SET.get_group("SHOP_GOODS") choices = [(key, cls.typeclass_name + " (" + key + ")") for key, cls in typeclasses.items()] self.fields['typeclass'] = forms.ChoiceField(choices=choices) # available units are common objects objects = CM.COMMON_OBJECTS.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['unit'] = forms.ChoiceField(choices=choices) localize_form_fields(self)
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) 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) 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)
def __init__(self, *args, **kwargs): super(CommonCharacterForm, self).__init__(*args, **kwargs) objects = DATA_SETS.typeclasses.objects.filter( category="CATE_CHARACTER") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) # models choices = [("", "---------")] objects = DATA_SETS.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) choices = [("", "---------")] objects = DATA_SETS.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)
def __init__(self, *args, **kwargs): super(ShopGoodsForm, self).__init__(*args, **kwargs) # all shops objects = DATA_SETS.shops.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['shop'] = forms.ChoiceField(choices=choices) # available objects choices = get_all_pocketable_objects() self.fields['object'] = forms.ChoiceField(choices=choices) # Goods typeclasses objects = DATA_SETS.typeclasses.objects.filter( category="CATE_SHOP_GOODS") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) # available units are common objects objects = DATA_SETS.common_objects.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['unit'] = forms.ChoiceField(choices=choices) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(WorldRoomsForm, self).__init__(*args, **kwargs) objects = DATA_SETS.typeclasses.objects.filter(category="CATE_ROOM") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) choices = [("", "---------")] objects = DATA_SETS.world_areas.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['location'] = forms.ChoiceField(choices=choices) choices = [("", "---------")] objects = DATA_SETS.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) choices = [("", "---------")] objects = DATA_SETS.image_resources.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['background'] = forms.ChoiceField(choices=choices, required=False) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(CharacterLootListForm, self).__init__(*args, **kwargs) # providers can be world_npc or common_character npcs = DATA_SETS.world_npcs.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in npcs] characters = DATA_SETS.common_characters.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in characters]) self.fields['provider'] = forms.ChoiceField(choices=choices) # available objects choices = get_all_pocketable_objects() self.fields['object'] = forms.ChoiceField(choices=choices) # depends on quest choices = [("", "---------")] objects = DATA_SETS.quests.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['quest'] = forms.ChoiceField(choices=choices, required=False) localize_form_fields(self)
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) 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) EQUIPMENT_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(DialogueSentencesForm, self).__init__(*args, **kwargs) objects = DATA_SETS.dialogues.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['dialogue'] = forms.ChoiceField(choices=choices) # dialogue's icon choices = [("", "---------")] objects = DATA_SETS.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) choices = [("", "---------")] objects = DATA_SETS.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)
def __init__(self, *args, **kwargs): super(QuestRewardListForm, self).__init__(*args, **kwargs) # providers must be object_creators objects = models.quests.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['provider'] = forms.ChoiceField(choices=choices) # available objects are common objects, foods or equipments objects = models.common_objects.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] foods = models.foods.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in foods]) equipments = models.equipments.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in equipments]) self.fields['object'] = forms.ChoiceField(choices=choices) # depends on quest choices = [("", "---------")] objects = models.quests.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['quest'] = forms.ChoiceField(choices=choices) self.fields['quest'].label = u"Depends on quest"
def __init__(self, *args, **kwargs): super(DialogueRelationsForm, self).__init__(*args, **kwargs) objects = models.dialogues.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['dialogue'] = forms.ChoiceField(choices=choices) self.fields['next'] = forms.ChoiceField(choices=choices)
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)
def __init__(self, *args, **kwargs): super(EquipmentsForm, self).__init__(*args, **kwargs) objects = DATA_SETS.typeclasses.objects.filter(key="CLASS_EQUIPMENT") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) objects = DATA_SETS.equipment_positions.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['position'] = forms.ChoiceField(choices=choices) objects = DATA_SETS.equipment_types.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['type'] = forms.ChoiceField(choices=choices) choices = [("", "---------")] objects = DATA_SETS.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) EQUIPMENT_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(SkillsForm, self).__init__(*args, **kwargs) objects = DATA_SETS.typeclasses.objects.filter(category="CATE_SKILL") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) choices = [("", "---------")] objects = DATA_SETS.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) choices = [("", "---------")] objects = DATA_SETS.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)
def __init__(self, *args, **kwargs): super(DialogueRelationsForm, 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) self.fields['next_dlg'] = forms.ChoiceField(choices=choices) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(CareerEquipmentsForm, self).__init__(*args, **kwargs) objects = models.character_careers.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['career'] = forms.ChoiceField(choices=choices) objects = models.equipment_types.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['equipment'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(EventAttacksForm, self).__init__(*args, **kwargs) objects = models.event_data.objects.filter(type="EVENT_ATTACK") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['key'] = forms.ChoiceField(choices=choices) objects = models.common_characters.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['mob'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(EventDataForm, self).__init__(*args, **kwargs) objects = models.event_types.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['type'] = forms.ChoiceField(choices=choices) objects = models.event_trigger_types.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['trigger_type'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(WorldNPCsForm, self).__init__(*args, **kwargs) objects = models.typeclasses.objects.filter(category="CATE_CHARACTER") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) objects = models.world_rooms.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['location'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(QuestObjectivesForm, self).__init__(*args, **kwargs) objects = models.quests.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['quest'] = forms.ChoiceField(choices=choices) objects = models.quest_objective_types.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['type'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(EventDataForm, self).__init__(*args, **kwargs) choices = EVENT_ACTION_SET.choice_all() self.fields['action'] = forms.ChoiceField(choices=choices) choices = EVENT_TRIGGER_SET.choice_all() self.fields['trigger_type'] = forms.ChoiceField(choices=choices) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(WorldExitsForm, self).__init__(*args, **kwargs) if self.instance.key: rooms_list = world_rooms.objects.all() for room_obj in rooms_list: self.ROOMS_LIST_CHOICES.append((room_obj.key, room_obj.key)) self.fields['location'] = forms.ChoiceField( choices=self.ROOMS_LIST_CHOICES) self.fields['destination'] = forms.ChoiceField( choices=self.ROOMS_LIST_CHOICES)
def __init__(self, *args, **kwargs): super(DefaultSkillsForm, self).__init__(*args, **kwargs) # all character's models character_models = set([record.key for record in models.character_models.objects.all()]) choices = [(key, key) for key in character_models] self.fields['character'] = forms.ChoiceField(choices=choices) objects = models.skills.objects.all() choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['skill'] = forms.ChoiceField(choices=choices)
def __init__(self, *args, **kwargs): super(QuestObjectivesForm, self).__init__(*args, **kwargs) objects = CM.QUESTS.all_with_base() choices = [(obj["key"], obj["name"] + " (" + obj["key"] + ")") for obj in objects] self.fields['quest'] = forms.ChoiceField(choices=choices) choices = QUEST_OBJECTIVE_SET.choice_all() self.fields['type'] = forms.ChoiceField(choices=choices) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(ActionTurnInQuestForm, self).__init__(*args, **kwargs) objects = CM.EVENT_DATA.objects.filter(action="ACTION_TURN_IN_QUEST") choices = [(obj.key, obj.key + " (" + obj.key + ")") for obj in objects] self.fields['event_key'] = forms.ChoiceField(choices=choices) objects = CM.QUESTS.all_with_base() choices = [(obj["key"], obj["name"] + " (" + obj["key"] + ")") for obj in objects] self.fields['quest'] = forms.ChoiceField(choices=choices) localize_form_fields(self)
def __init__(self, *args, **kwargs): super(ActionCloseEventForm, self).__init__(*args, **kwargs) objects = CM.EVENT_DATA.objects.filter(action="ACTION_CLOSE_EVENT") choices = [(obj.key, obj.key + " (" + obj.key + ")") for obj in objects] self.fields['event_key'] = forms.ChoiceField(choices=choices) objects = CM.EVENT_DATA.objects.all() choices = [(obj.key, obj.key) for obj in objects] self.fields['event'] = forms.ChoiceField(choices=choices) localize_form_fields(self)