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(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(EquipmentsForm, self).__init__(*args, **kwargs) 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) localize_form_fields(self) EQUIPMENT_ATTRIBUTES_INFO.set_form_fields(self)
def at_server_start(): """ This is called every time the server starts up, regardless of how it was shut down. """ # reset settings from muddery.utils.game_settings import GAME_SETTINGS GAME_SETTINGS.reset() # reload local strings from muddery.utils.localized_strings_handler import LOCALIZED_STRINGS_HANDLER LOCALIZED_STRINGS_HANDLER.reload() # reload attributes from muddery.utils.attributes_info_handler import CHARACTER_ATTRIBUTES_INFO CHARACTER_ATTRIBUTES_INFO.reload() from muddery.utils.attributes_info_handler import EQUIPMENT_ATTRIBUTES_INFO EQUIPMENT_ATTRIBUTES_INFO.reload() from muddery.utils.attributes_info_handler import FOOD_ATTRIBUTES_INFO FOOD_ATTRIBUTES_INFO.reload() # reset default locations from muddery.utils import builder builder.reset_default_locations() # clear dialogues from muddery.utils.dialogue_handler import DIALOGUE_HANDLER DIALOGUE_HANDLER.clear() # reload equipment types from muddery.utils.equip_type_handler import EQUIP_TYPE_HANDLER EQUIP_TYPE_HANDLER.reload() # localize model fields from muddery.utils.localiztion_handler import localize_model_fields localize_model_fields() # set character attribute field names CHARACTER_ATTRIBUTES_INFO.set_model_fields() EQUIPMENT_ATTRIBUTES_INFO.set_model_fields() FOOD_ATTRIBUTES_INFO.set_model_fields() # load condition descriptions from muddery.utils.desc_handler import DESC_HANDLER DESC_HANDLER.reload() # load honours from muddery.dao.honours_mapper import HONOURS_MAPPER HONOURS_MAPPER.reload()
def at_server_start(): """ This is called every time the server starts up, regardless of how it was shut down. """ # reset settings GAME_SETTINGS.reset() # reload keys OBJECT_KEY_HANDLER.reload() # reload attributes CHARACTER_ATTRIBUTES_INFO.reload() EQUIPMENT_ATTRIBUTES_INFO.reload() FOOD_ATTRIBUTES_INFO.reload() # reset default locations builder.reset_default_locations() # clear dialogues DIALOGUE_HANDLER.clear() # clear quest dependencies QUEST_DEP_HANDLER.clear() # reload equipment types EQUIP_TYPE_HANDLER.reload() # reload local strings LOCALIZED_STRINGS_HANDLER.reload() # localize model fields localize_model_fields() # set character attribute field names CHARACTER_ATTRIBUTES_INFO.set_model_fields() EQUIPMENT_ATTRIBUTES_INFO.set_model_fields() FOOD_ATTRIBUTES_INFO.set_model_fields() # load condition descriptions DESC_HANDLER.reload() # load honours HONOURS_MAPPER.reload()