From 606c9e6be05f51449c1e5c737707e722e23c68b1 Mon Sep 17 00:00:00 2001 From: none Date: Sun, 28 Jan 2024 12:48:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BD=D0=B0=D1=80=D0=BA=D0=BE=D1=82=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B8=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8=20=D0=B2=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.json | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++- update_db.py | 57 +++++++-------- 2 files changed, 220 insertions(+), 28 deletions(-) diff --git a/db.json b/db.json index ed332d2..1638a2d 100644 --- a/db.json +++ b/db.json @@ -1,6 +1,7 @@ { "Аммиак": [ 4, + "chemicals", [ "Водород", 3 @@ -12,6 +13,7 @@ ], "Диэтиламин": [ 2, + "chemicals", [ "Аммиак", 1 @@ -23,6 +25,7 @@ ], "Хлоральгидрат": [ 1, + "chemicals", [ "Хлор", 3 @@ -38,6 +41,7 @@ ], "Политриновая кислота": [ 3, + "chemicals", [ "Серная кислота", 1 @@ -53,6 +57,7 @@ ], "Фторсерная кислота": [ 4, + "chemicals", [ "Фтор", 1 @@ -72,6 +77,7 @@ ], "Серная кислота": [ 3, + "chemicals", [ "Водород", 1 @@ -87,6 +93,7 @@ ], "Нестабильный мутаген": [ 3, + "chemicals", [ "Радий", 1 @@ -102,6 +109,7 @@ ], "Токсин хартбрейкер": [ 2, + "medicine", [ "Дексалин плюс", 1 @@ -113,6 +121,7 @@ ], "Лексорин": [ 2, + "medicine", [ "Токсин хартбрейкер", 1 @@ -128,6 +137,7 @@ ], "Токсин майндбрейкер": [ 3, + "medicine", [ "Кремний", 1 @@ -143,6 +153,7 @@ ], "Пакс": [ 3, + "chemicals", [ "Токсин майндбрейкер", 1 @@ -158,6 +169,7 @@ ], "Тазинид": [ 1, + "chemicals", [ "[!] licoxide", 1 @@ -169,6 +181,7 @@ ], "Криптобиолин": [ 3, + "medicine", [ "Калий", 1 @@ -184,6 +197,7 @@ ], "Диловен": [ 3, + "medicine", [ "Кремний", 1 @@ -199,6 +213,7 @@ ], "Дифенгидрамин": [ 3, + "medicine", [ "Диэтиламин", 1 @@ -222,6 +237,7 @@ ], "Этилредоксразин": [ 3, + "medicine", [ "Кислород", 1 @@ -237,6 +253,7 @@ ], "Аритразин": [ 2, + "medicine", [ "Хироналин", 1 @@ -248,6 +265,7 @@ ], "Бикаридин": [ 2, + "medicine", [ "Инапровалин", 1 @@ -259,6 +277,7 @@ ], "Криоксадон": [ 3, + "medicine", [ "Дексалин", 1 @@ -274,6 +293,7 @@ ], "Доксарубиксадон": [ 2, + "medicine", [ "Криоксадон", 1 @@ -285,6 +305,7 @@ ], "Дермалин": [ 3, + "medicine", [ "Келотан", 1 @@ -300,6 +321,7 @@ ], "Дексалин": [ 3, + "medicine", [ "Кислород", 2 @@ -311,6 +333,7 @@ ], "Дексалин плюс": [ 3, + "medicine", [ "Дексалин", 1 @@ -326,6 +349,7 @@ ], "Эпинефрин": [ 4, + "medicine", [ "Фенол", 1 @@ -345,6 +369,7 @@ ], "Хироналин": [ 2, + "medicine", [ "Радий", 1 @@ -356,6 +381,7 @@ ], "Ипекак": [ 2, + "medicine", [ "Калий", 1 @@ -371,6 +397,7 @@ ], "Инапровалин": [ 3, + "medicine", [ "Кислород", 1 @@ -386,6 +413,7 @@ ], "Келотан": [ 2, + "medicine", [ "Кремний", 1 @@ -397,6 +425,7 @@ ], "Лепоразин": [ 2, + "medicine", [ "Медь", 1 @@ -412,6 +441,7 @@ ], "Фалангимин": [ 3, + "medicine", [ "Хироналин", 1 @@ -427,6 +457,7 @@ ], "Амбузол": [ 4, + "medicine", [ "Диловен", 1 @@ -442,6 +473,7 @@ ], "Амбузол плюс": [ 5, + "medicine", [ "Амбузол", 5 @@ -453,6 +485,7 @@ ], "Физраствор": [ 5, + "medicine", [ "Вода", 4 @@ -464,6 +497,7 @@ ], "Сидерлак": [ 2, + "medicine", [ "Алоэ", 1 @@ -475,6 +509,7 @@ ], "Синаптизин": [ 3, + "medicine", [ "Литий", 1 @@ -490,6 +525,7 @@ ], "Транексамовая кислота": [ 3, + "medicine", [ "Инапровалин", 1 @@ -505,6 +541,7 @@ ], "Трикордразин": [ 2, + "medicine", [ "Инапровалин", 1 @@ -516,6 +553,7 @@ ], "Липозин": [ 3, + "medicine", [ "Столовая соль", 1 @@ -531,6 +569,7 @@ ], "Ультраваскулин": [ 2, + "medicine", [ "Гистамин", 2 @@ -542,6 +581,7 @@ ], "Окулин": [ 4, + "medicine", [ "Столовая соль", 1 @@ -557,6 +597,7 @@ ], "Когнизин": [ 1, + "medicine", [ "Карпотоксин", 1 @@ -572,8 +613,9 @@ ], "Этилоксиэфедрин": [ 2, + "chemicals", [ - "[!] desoxyephedrine", + "Дезоксиэфедрин", 1 ], [ @@ -583,6 +625,7 @@ ], "Дифенилметиламин": [ 3, + "chemicals", [ "Этилоксиэфедрин", 1 @@ -598,6 +641,7 @@ ], "Сигинат": [ 4, + "medicine", [ "Карбонат натрия", 1 @@ -621,6 +665,7 @@ ], "Лацеринол": [ 2, + "medicine", [ "Бикаридин", 1 @@ -632,6 +677,7 @@ ], "Пунктураз": [ 2, + "medicine", [ "Бикаридин", 1 @@ -643,6 +689,7 @@ ], "Бруизин": [ 2, + "medicine", [ "Бикаридин", 1 @@ -658,6 +705,7 @@ ], "Пиразин": [ 3, + "medicine", [ "Лепоразин", 1 @@ -673,6 +721,7 @@ ], "Инсузин": [ 3, + "medicine", [ "Лепоразин", 1 @@ -692,6 +741,7 @@ ], "Некрозол": [ 2, + "medicine", [ "Кровь", 3 @@ -707,6 +757,7 @@ ], "Алоксадон": [ 4, + "medicine", [ "Криоксадон", 1 @@ -720,8 +771,137 @@ 2 ] ], + "Дезоксиэфедрин": [ + 4, + "chemicals", + [ + "Эфедрин", + 1 + ], + [ + "Углерод", + 1 + ], + [ + "Йод", + 1 + ], + [ + "Фосфор", + 1 + ] + ], + "Эфедрин": [ + 4, + "chemicals", + [ + "Масло", + 1 + ], + [ + "Водород", + 1 + ], + [ + "Сахар", + 1 + ], + [ + "Диэтиламин", + 1 + ] + ], + "Стимулятор": [ + 2, + "chemicals", + [ + "Эфедрин", + 1 + ], + [ + "Вестин", + 1 + ], + [ + "Кислород", + 2 + ] + ], + "Импедризин": [ + 1, + "medicine", + [ + "Ртуть", + 1 + ], + [ + "Кислород", + 1 + ], + [ + "Вода", + 1 + ] + ], + "Космические наркотики": [ + 3, + "medicine", + [ + "Ртуть", + 1 + ], + [ + "Сахар", + 1 + ], + [ + "Литий", + 1 + ] + ], + "Ноктюрин": [ + 1, + "chemicals", + [ + "Импедризин", + 2 + ], + [ + "Вестин", + 1 + ] + ], + "Токсин немоты": [ + 2, + "chemicals", + [ + "Уран", + 1 + ], + [ + "Вестин", + 2 + ], + [ + "[!] spaceglue", + 2 + ] + ], + "Норэпинефриновая кислота": [ + 2, + "chemicals", + [ + "Уран", + 1 + ], + [ + "Эпинефрин", + 1 + ] + ], "Ацетон": [ 2, + "chemicals", [ "Масло", 1 @@ -737,6 +917,7 @@ ], "Фенол": [ 2, + "chemicals", [ "Гидроксид", 1 @@ -748,6 +929,7 @@ ], "Уголь": [ 1, + "chemicals", [ "Углерод", 1 @@ -759,6 +941,7 @@ ], "Карбонат натрия": [ 4, + "chemicals", [ "Аммиак", 1 @@ -778,6 +961,7 @@ ], "Бензол": [ 1, + "chemicals", [ "Водород", 1 @@ -789,6 +973,7 @@ ], "Гидроксид": [ 2, + "chemicals", [ "Кислород", 1 @@ -800,6 +985,7 @@ ], "Гидроксид натрия": [ 2, + "chemicals", [ "Гидроксид", 1 @@ -811,6 +997,7 @@ ], "Силицид железа": [ 2, + "chemicals", [ "Железо", 1 @@ -822,6 +1009,7 @@ ], "Полиакрилат натрия": [ 4, + "chemicals", [ "Кислород", 2 @@ -837,6 +1025,7 @@ ], "Столовая соль": [ 2, + "chemicals", [ "Хлор", 1 diff --git a/update_db.py b/update_db.py index 6912317..dd05a2a 100644 --- a/update_db.py +++ b/update_db.py @@ -10,6 +10,7 @@ MEDICINE_R = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Re MEDICINE = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Recipes/Reactions/medicine.yml" MEDICINE_LOCALISATION = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Locale/ru-RU/reagents/meta/medicine.ftl" +NARCOTICS_R = "https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Reagents/narcotics.yml" CHEMICALS_R = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/chemicals.yml" CHEMICALS = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Recipes/Reactions/chemicals.yml" @@ -20,7 +21,7 @@ ELEMENTS_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/ ELEMENTS_LOCALISATION_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Locale/ru-RU/reagents/meta/elements.ftl" # токсины -TOXINS = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/toxins.yml" +TOXINS_R = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/toxins.yml" TOXINS_LOCALISATION_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Locale/ru-RU/reagents/meta/toxins.ftl" # локализация наркотиков/наркотических препаратов @@ -35,12 +36,13 @@ BIOLOGY_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/R BIOLOGY_LOCALISATION_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Locale/ru-RU/reagents/meta/biological.ftl" # ботаника -BOTANY = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/botany.yml" +BOTANY_R = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/botany.yml" BOTANY_LOCALISATION_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Locale/ru-RU/reagents/meta/botany.ftl" # все съедобное и питьевое -FOOD = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml" +#FOOD = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml" FOOD_R = "https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml" +FOOD_R_EX = "https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/dev/Resources/Prototypes/Reagents/Consumable/Food/food.yml" INGREDIENTS_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml" DRINKS_URL = "https://github.com/SerbiaStrong-220/space-station-14/raw/master/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml" @@ -93,30 +95,31 @@ class Reagent: #print(result) return result - +from db import * def load_localisation(): - data = {"elements": {}, "placeholders": {}} - elements_urls = [ELEMENTS_URL, REAGENTS_URL, TOXINS_URL, GASES_URL, FOOD_URL, DRINKS_URL, BIOLOGY_URL, - CONDIMENTS_URL, BOTANY_URL, ALCOHOL_URL, CHEMICALS_URL, INGREDIENTS_URL] - for url in elements_urls: - response = yaml.load(requests.get(url).content.decode("utf-8"), Loader=yaml.SafeLoader) - for i in response: - data["elements"][i["id"]] = {"name": i["name"], "desc": i["desc"]} + data = {"elements": {}, "placeholders": {}} + elements_urls = [ELEMENTS_URL, MEDICINE_R, TOXINS_R, GASES_URL, FOOD_R, FOOD_R_EX, DRINKS_URL, BIOLOGY_URL, + FOOD_R, BOTANY_R, ALCOHOL_URL, CHEMICALS_R, INGREDIENTS_URL, NARCOTICS_R] + for url in elements_urls: + response = yaml.load(requests.get(url).content.decode("utf-8"), Loader=yaml.SafeLoader) + for i in response: + data["elements"][i["id"]] = {"name": i["name"], "desc": i["desc"]} - localisation_urls = [MEDICINE_LOCALISATION, ELEMENTS_LOCALISATION_URL, TOXINS_LOCALISATION_URL, - GASES_LOCALISATION_URL, DRINKS_LOCALISATION_URL, FOOD_LOCALISATION_URL, - CONDIMENTS_LOCALISATION_URL, BIOLOGY_LOCALISATION_URL, NARCOTICS_LOCALISATION_URL, - BOTANY_LOCALISATION_URL, ALCOHOL_LOCALISATION_URL, CHEMICALS_LOCALISATION, - INGREDIENTS_LOCALISATION_URL] + localisation_urls = [MEDICINE_LOCALISATION, ELEMENTS_LOCALISATION_URL, TOXINS_LOCALISATION_URL, + GASES_LOCALISATION_URL, DRINKS_LOCALISATION_URL, FOOD_LOCALISATION_URL, + CONDIMENTS_LOCALISATION_URL, BIOLOGY_LOCALISATION_URL, NARCOTICS_LOCALISATION_URL, + BOTANY_LOCALISATION_URL, ALCOHOL_LOCALISATION_URL, CHEMICALS_LOCALISATION, + INGREDIENTS_LOCALISATION_URL] - for url in localisation_urls: - response = requests.get(url).content.decode("utf-8") - for entry in parse(response).body: - if isinstance(entry, ast.Message): - data["placeholders"][entry.id.name] = entry.value.elements[0].value + for url in localisation_urls: + response = requests.get(url).content.decode("utf-8") + for entry in parse(response).body: + if isinstance(entry, ast.Message): + data["placeholders"][entry.id.name] = entry.value.elements[0].value - with open("locale.json", mode="w", encoding="utf-8") as localisation_file: - json.dump(data, localisation_file, ensure_ascii=False, indent=2) + write_db(data, 'locale.json') +# with open("locale.json", mode="w", encoding="utf-8") as localisation_file: +# json.dump(data, localisation_file, ensure_ascii=False, indent=2) def localise(key: str) -> str: @@ -161,18 +164,18 @@ def load_recipes(url,name): content[item["id"]]["products"] = item["products"] content[item["id"]]["category"] = name -load_reagents(BOTANY, 'botany') -load_reagents(TOXINS, 'toxins') +load_reagents(BOTANY_R, 'botany') +load_reagents(TOXINS_R, 'toxins') load_reagents(MEDICINE_R, 'medicine') +load_reagents(NARCOTICS_R, 'narcotics') # Не загружается? load_reagents(CHEMICALS_R, 'chemicals') -#load_reagents(FOOD_R, 'food') load_reagents(FOOD_R, 'food') +load_reagents(FOOD_R_EX, 'food_ex') load_recipes(MEDICINE, 'medicine') load_recipes(CHEMICALS, 'chemicals') -load_recipes(CHEMICALS, 'chemicals') # TODO: Включать ли токсины без крафта? (некоторые имеют крафт) reagents = [Reagent(init_data=content[item]) for item in content if "reactants" in content[item]]