def handle(self, *args, **options): LINGUISTICS_FORMATTERS = {key.value: linguistics_logic.ui_format(key.ui_text) for key in linguistics_keys.LEXICON_KEY.records if key.ui_text is not None} with open(game_settings.JS_CONSTNATS_FILE_LOCATION, 'w') as f: f.write(jinja2.render('game/js_constants.js', context={'actor_type': s11n.to_json({a.name: a.value for a in ACTOR_TYPE.records}), 'gender_to_text': s11n.to_json(dict(GENDER.select('value', 'text'))), 'gender_to_str': s11n.to_json(dict(GENDER.select('value', 'name'))), 'person_type_to_text': s11n.to_json(dict(PERSON_TYPE.select('value', 'text'))), 'race_to_text': s11n.to_json(dict(RACE.select('value', 'text'))), 'race_to_str': s11n.to_json(dict(RACE.select('value', 'name'))), 'game_state': s11n.to_json(dict(GAME_STATE.select('name', 'value'))), 'ARTIFACT_TYPE': artifacts_relations.ARTIFACT_TYPE, 'NO_EFFECT': artifacts_relations.ARTIFACT_EFFECT.NO_EFFECT, 'EFFECTS': EFFECTS, 'ARTIFACT_RARITY': artifacts_relations.RARITY, 'CARD_RARITY': cards_relations.RARITY, 'CARDS_EFFECTS': cards_effects.EFFECTS, 'ABILITY_TYPE': ABILITY_TYPE, 'SPRITES': SPRITES, 'CELL_SIZE': map_settings.CELL_SIZE, 'LINGUISTICS_FORMATTERS': LINGUISTICS_FORMATTERS }))
def deserialize(cls, data): obj = cls() obj.person_id = data['person_id'] obj.person_name = data['person_name'] obj.person_race = RACE(data['person_race']) obj.person_type = PERSON_TYPE(data['person_type']) obj.person_gender = GENDER(data['person_gender']) obj.place_id = data['place_id'] if 'old_place_name_forms' in data: obj.old_place_name_forms = utg_words.Word.deserialize(data['old_place_name_forms']) else: obj.old_place_name_forms = names.generator().get_fast_name('название утрачено') return obj
def handle(self, *args, **options): with open(game_settings.JS_CONSTNATS_FILE_LOCATION, 'w') as f: f.write( jinja2.render( 'game/js_constants.js', context={ 'actor_type': s11n.to_json( {a.name: a.value for a in ACTOR_TYPE.records}), 'gender_to_text': s11n.to_json(dict(GENDER.select('value', 'text'))), 'gender_to_str': s11n.to_json(dict(GENDER.select('value', 'name'))), 'person_type_to_text': s11n.to_json(dict(PERSON_TYPE.select('value', 'text'))), 'race_to_text': s11n.to_json(dict(RACE.select('value', 'text'))), 'race_to_str': s11n.to_json(dict(RACE.select('value', 'name'))), 'game_state': s11n.to_json(dict(GAME_STATE.select('name', 'value'))), 'ARTIFACT_TYPE': artifacts_relations.ARTIFACT_TYPE, 'NO_EFFECT': artifacts_relations.ARTIFACT_EFFECT.NO_EFFECT, 'EFFECTS': EFFECTS, 'ARTIFACT_RARITY': artifacts_relations.RARITY, 'CARD_RARITY': cards_relations.RARITY, 'CARDS_EFFECTS': cards_effects.EFFECTS, 'ABILITY_TYPE': ABILITY_TYPE, 'SPRITES': SPRITES, 'CELL_SIZE': map_settings.CELL_SIZE }).encode('utf-8'))
def handle(self, *args, **options): with open(game_settings.JS_CONSTNATS_FILE_LOCATION, 'w') as f: f.write(jinja2.render('game/js_constants.js', context={'actor_type': s11n.to_json({a.name: a.value for a in ACTOR_TYPE.records}), 'gender_to_text': s11n.to_json(dict(GENDER.select('value', 'text'))), 'gender_to_str': s11n.to_json(dict(GENDER.select('value', 'name'))), 'person_type_to_text': s11n.to_json(dict(PERSON_TYPE.select('value', 'text'))), 'race_to_text': s11n.to_json(dict(RACE.select('value', 'text'))), 'race_to_str': s11n.to_json(dict(RACE.select('value', 'name'))), 'game_state': s11n.to_json(dict(GAME_STATE.select('name', 'value'))), 'ARTIFACT_TYPE': artifacts_relations.ARTIFACT_TYPE, 'NO_EFFECT': artifacts_relations.ARTIFACT_EFFECT.NO_EFFECT, 'EFFECTS': EFFECTS, 'ARTIFACT_RARITY': artifacts_relations.RARITY, 'CARD_RARITY': cards_relations.RARITY, 'CARDS_EFFECTS': cards_effects.EFFECTS, 'ABILITY_TYPE': ABILITY_TYPE, 'SPRITES': SPRITES, 'CELL_SIZE': map_settings.CELL_SIZE }).encode('utf-8'))