mirror of
https://github.com/Justuser3310/ss14_chemistry_site.git
synced 2025-02-08 09:07:38 +00:00
Compare commits
No commits in common. "2fa9b57ce3c20f7dd27f7e12081fdba48876cab3" and "c7987e6fd14f326985d14e11c43b1f998b361c6b" have entirely different histories.
2fa9b57ce3
...
c7987e6fd1
60
calc.py
60
calc.py
@ -1,10 +1,6 @@
|
||||
from db import *
|
||||
from math import floor
|
||||
|
||||
# DEBUG
|
||||
from icecream import ic
|
||||
ic.disable()
|
||||
|
||||
db = read_db()
|
||||
|
||||
# Составные
|
||||
@ -22,7 +18,7 @@ def sround(num, parts):
|
||||
good = False
|
||||
while not good:
|
||||
num = floor(num)
|
||||
ic(good, ' ', num)
|
||||
print(good, ' ', num)
|
||||
st = 1 ; good = True
|
||||
# Перебираем различное количество частей
|
||||
while st < parts:
|
||||
@ -101,14 +97,8 @@ def calc(el, amount, main = False):
|
||||
# Считаем 1 часть
|
||||
part = sround(amount/parts, parts)
|
||||
|
||||
# Динамический объём
|
||||
# Нужен когда у вещества вход 20 а выход 10
|
||||
#part_vol =
|
||||
|
||||
|
||||
# Перебираем составные и делаем рекурсию
|
||||
for i in comps:
|
||||
ic(i)
|
||||
if i[0] in db:
|
||||
lpart = calc(i[0], part*i[1])
|
||||
# Если наша часть больше чем составная
|
||||
@ -117,7 +107,6 @@ def calc(el, amount, main = False):
|
||||
# lpart - количество составного в итоге
|
||||
# 50/3, часть = 16, ИТОГ: 16*3=48 <
|
||||
|
||||
|
||||
if heat and not main:
|
||||
recipe = [['heat']] + recipe
|
||||
if heat and main:
|
||||
@ -135,14 +124,15 @@ def calc(el, amount, main = False):
|
||||
else:
|
||||
recipe.append([i[0], part*i[1]])
|
||||
|
||||
# Если нету плазмы и нагрева - соединяем вещества
|
||||
# ЕСЛИ ЕСТЬ БАГИ ВЕРОЯТНО ЭТО ТУТ
|
||||
# Если нету плазмы - соединяем вещества
|
||||
if main:
|
||||
if ll_find(recipe, 'Плазма') == None and ll_find(recipe, 'heat') == None:
|
||||
ic('START: ', recipe)
|
||||
if ll_find(recipe, 'Плазма') == None and not heat:
|
||||
print('START: ', recipe)
|
||||
new_recipe = []
|
||||
|
||||
#for i in recipe:
|
||||
while recipe != []:
|
||||
ic("ORIG:", recipe)
|
||||
print("ORIG:", recipe)
|
||||
el = recipe[0]
|
||||
new_recipe.append(el)
|
||||
del recipe[0]
|
||||
@ -152,33 +142,28 @@ def calc(el, amount, main = False):
|
||||
|
||||
# Если есть ещё такой элемент
|
||||
while ll_find(recipe, el[0]):
|
||||
# Если это отметка для нагрева
|
||||
if el[0] == 'heat':
|
||||
break
|
||||
same_id = ll_find(recipe, el[0])
|
||||
ic('OLD: ', new_recipe[id][1])
|
||||
print('OLD: ', new_recipe[id][1])
|
||||
new_recipe[id][1] += recipe[same_id][1]
|
||||
ic('NEW: ', new_recipe[id][1] + recipe[same_id][1])
|
||||
print('NEW: ', new_recipe[id][1] + recipe[same_id][1])
|
||||
# Удаляем этот элемент
|
||||
#recipe.pop( same_id )
|
||||
del recipe[same_id]
|
||||
|
||||
ic("NEW:", new_recipe)
|
||||
print("NEW:", new_recipe)
|
||||
|
||||
|
||||
recipe = new_recipe
|
||||
|
||||
|
||||
if main:
|
||||
ic(part)
|
||||
print('PART: ', part)
|
||||
return [recipe, out*part]
|
||||
else:
|
||||
ic(recipe)
|
||||
ic(el)
|
||||
ic('PART: ', part)
|
||||
# >>>>>>>>>>>>>>> Возможен баг <<<<<<<<<<<<
|
||||
#return part*parts
|
||||
# Возвращаем объём=часть*выход
|
||||
return part*out
|
||||
print(recipe)
|
||||
print(el)
|
||||
print('PART: ', part)
|
||||
return part*parts
|
||||
|
||||
#print( calc("Лексорин", 100, True))
|
||||
#print( calc("Бикаридин", 100, True))
|
||||
@ -187,16 +172,3 @@ def calc(el, amount, main = False):
|
||||
#print( calc("Криоксадон", 100, True) )
|
||||
#print( calc("Гидроксид", 100, True) )
|
||||
#print( calc("Пунктураз", 100, True) )
|
||||
|
||||
#print( calc("Эпинефрин", 100, True) )
|
||||
|
||||
#print( calc("Гидроксид", 100, True) )
|
||||
#print( calc("Ацетон", 50, True) )
|
||||
|
||||
#print( calc("Фенол", 50, True) )
|
||||
#print(calc("Бензол", 50, True))
|
||||
#OK print( calc("Гидроксид", 50, True) )
|
||||
|
||||
#print( calc("", 100, True) )
|
||||
#print( calc("", 100, True) )
|
||||
#print( calc("", 100, True) )
|
||||
|
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 18.90625 7 C 18.90625 7 12.539063 7.4375 8.375 10.78125 C 8.355469 10.789063 8.332031 10.800781 8.3125 10.8125 C 7.589844 11.480469 7.046875 12.515625 6.375 14 C 5.703125 15.484375 4.992188 17.394531 4.34375 19.53125 C 3.050781 23.808594 2 29.058594 2 34 C 1.996094 34.175781 2.039063 34.347656 2.125 34.5 C 3.585938 37.066406 6.273438 38.617188 8.78125 39.59375 C 11.289063 40.570313 13.605469 40.960938 14.78125 41 C 15.113281 41.011719 15.429688 40.859375 15.625 40.59375 L 18.0625 37.21875 C 20.027344 37.683594 22.332031 38 25 38 C 27.667969 38 29.972656 37.683594 31.9375 37.21875 L 34.375 40.59375 C 34.570313 40.859375 34.886719 41.011719 35.21875 41 C 36.394531 40.960938 38.710938 40.570313 41.21875 39.59375 C 43.726563 38.617188 46.414063 37.066406 47.875 34.5 C 47.960938 34.347656 48.003906 34.175781 48 34 C 48 29.058594 46.949219 23.808594 45.65625 19.53125 C 45.007813 17.394531 44.296875 15.484375 43.625 14 C 42.953125 12.515625 42.410156 11.480469 41.6875 10.8125 C 41.667969 10.800781 41.644531 10.789063 41.625 10.78125 C 37.460938 7.4375 31.09375 7 31.09375 7 C 31.019531 6.992188 30.949219 6.992188 30.875 7 C 30.527344 7.046875 30.234375 7.273438 30.09375 7.59375 C 30.09375 7.59375 29.753906 8.339844 29.53125 9.40625 C 27.582031 9.09375 25.941406 9 25 9 C 24.058594 9 22.417969 9.09375 20.46875 9.40625 C 20.246094 8.339844 19.90625 7.59375 19.90625 7.59375 C 19.734375 7.203125 19.332031 6.964844 18.90625 7 Z M 18.28125 9.15625 C 18.355469 9.359375 18.40625 9.550781 18.46875 9.78125 C 16.214844 10.304688 13.746094 11.160156 11.4375 12.59375 C 11.074219 12.746094 10.835938 13.097656 10.824219 13.492188 C 10.816406 13.882813 11.039063 14.246094 11.390625 14.417969 C 11.746094 14.585938 12.167969 14.535156 12.46875 14.28125 C 17.101563 11.410156 22.996094 11 25 11 C 27.003906 11 32.898438 11.410156 37.53125 14.28125 C 37.832031 14.535156 38.253906 14.585938 38.609375 14.417969 C 38.960938 14.246094 39.183594 13.882813 39.175781 13.492188 C 39.164063 13.097656 38.925781 12.746094 38.5625 12.59375 C 36.253906 11.160156 33.785156 10.304688 31.53125 9.78125 C 31.59375 9.550781 31.644531 9.359375 31.71875 9.15625 C 32.859375 9.296875 37.292969 9.894531 40.3125 12.28125 C 40.507813 12.460938 41.1875 13.460938 41.8125 14.84375 C 42.4375 16.226563 43.09375 18.027344 43.71875 20.09375 C 44.9375 24.125 45.921875 29.097656 45.96875 33.65625 C 44.832031 35.496094 42.699219 36.863281 40.5 37.71875 C 38.5 38.496094 36.632813 38.84375 35.65625 38.9375 L 33.96875 36.65625 C 34.828125 36.378906 35.601563 36.078125 36.28125 35.78125 C 38.804688 34.671875 40.15625 33.5 40.15625 33.5 C 40.570313 33.128906 40.605469 32.492188 40.234375 32.078125 C 39.863281 31.664063 39.226563 31.628906 38.8125 32 C 38.8125 32 37.765625 32.957031 35.46875 33.96875 C 34.625 34.339844 33.601563 34.707031 32.4375 35.03125 C 32.167969 35 31.898438 35.078125 31.6875 35.25 C 29.824219 35.703125 27.609375 36 25 36 C 22.371094 36 20.152344 35.675781 18.28125 35.21875 C 18.070313 35.078125 17.8125 35.019531 17.5625 35.0625 C 16.394531 34.738281 15.378906 34.339844 14.53125 33.96875 C 12.234375 32.957031 11.1875 32 11.1875 32 C 10.960938 31.789063 10.648438 31.699219 10.34375 31.75 C 9.957031 31.808594 9.636719 32.085938 9.53125 32.464844 C 9.421875 32.839844 9.546875 33.246094 9.84375 33.5 C 9.84375 33.5 11.195313 34.671875 13.71875 35.78125 C 14.398438 36.078125 15.171875 36.378906 16.03125 36.65625 L 14.34375 38.9375 C 13.367188 38.84375 11.5 38.496094 9.5 37.71875 C 7.300781 36.863281 5.167969 35.496094 4.03125 33.65625 C 4.078125 29.097656 5.0625 24.125 6.28125 20.09375 C 6.90625 18.027344 7.5625 16.226563 8.1875 14.84375 C 8.8125 13.460938 9.492188 12.460938 9.6875 12.28125 C 12.707031 9.894531 17.140625 9.296875 18.28125 9.15625 Z M 18.5 21 C 15.949219 21 14 23.316406 14 26 C 14 28.683594 15.949219 31 18.5 31 C 21.050781 31 23 28.683594 23 26 C 23 23.316406 21.050781 21 18.5 21 Z M 31.5 21 C 28.949219 21 27 23.316406 27 26 C 27 28.683594 28.949219 31 31.5 31 C 34.050781 31 36 28.683594 36 26 C 36 23.316406 34.050781 21 31.5 21 Z M 18.5 23 C 19.816406 23 21 24.265625 21 26 C 21 27.734375 19.816406 29 18.5 29 C 17.183594 29 16 27.734375 16 26 C 16 24.265625 17.183594 23 18.5 23 Z M 31.5 23 C 32.816406 23 34 24.265625 34 26 C 34 27.734375 32.816406 29 31.5 29 C 30.183594 29 29 27.734375 29 26 C 29 24.265625 30.183594 23 31.5 23 Z"/></svg>
|
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 149 KiB |
@ -1 +0,0 @@
|
||||
<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#fff"/></svg>
|
Before Width: | Height: | Size: 960 B |
@ -1 +0,0 @@
|
||||
<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>
|
Before Width: | Height: | Size: 963 B |
@ -1,152 +0,0 @@
|
||||
/* Общая характеристика */
|
||||
body {
|
||||
background-color: #242829;
|
||||
}
|
||||
|
||||
/* Заморочная настройка переключателей */
|
||||
.Select {
|
||||
background-color: rgb(27, 29, 30);
|
||||
color: #fff;
|
||||
font-family: 'Mulish', sans-serif;
|
||||
font-size: 2vh;
|
||||
}
|
||||
.Select-input > input {
|
||||
color: #fff;
|
||||
}
|
||||
.Select .Select-value {
|
||||
background-color: rgb(27, 29, 30);
|
||||
}
|
||||
.Select-control {
|
||||
background-color: rgb(25, 25, 25) !important;
|
||||
color: #fff;
|
||||
font-family: 'Mulish', sans-serif;
|
||||
font-size: 2vh;
|
||||
}
|
||||
.Select-menu-outer {
|
||||
background-color: rgb(27, 29, 30);
|
||||
color: #fff;
|
||||
border-radius: 10;
|
||||
}
|
||||
.has-value.Select--single>.Select-control .Select-value .Select-value-label, .has-value.is-pseudo-focused.Select--single>.Select-control .Select-value .Select-value-label{
|
||||
color: white;
|
||||
}
|
||||
|
||||
.Select-value {
|
||||
font-family: 'Mulish', sans-serif;
|
||||
font-size: 2vh;
|
||||
}
|
||||
.Select-placeholder {
|
||||
font-family: 'Mulish', sans-serif;
|
||||
font-size: 2vh;
|
||||
}
|
||||
|
||||
.Select-clear {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
|
||||
/* Верхняя панель */
|
||||
.panel {
|
||||
background-color: #161819;
|
||||
margin: -8px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.logo {
|
||||
padding: 10px;
|
||||
width: 4vh;0
|
||||
}
|
||||
.git_logo {
|
||||
width: 3.2vh;
|
||||
}
|
||||
.soc_logo {
|
||||
width: 3.2vh;
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
|
||||
.react_vol_out {
|
||||
padding-top: 10vh;
|
||||
width: 80vh;
|
||||
}
|
||||
|
||||
.react_vol {
|
||||
display: flex;
|
||||
flexDirection: row;
|
||||
}
|
||||
.vol {
|
||||
flex: 1;
|
||||
padding-left: 25px;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
/* Иконка + текст слева в панели */
|
||||
.img_text_panel {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Кнопки социалок */
|
||||
.soc_buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* Div для социалок */
|
||||
.socials {
|
||||
background-color: #2e4ebf;
|
||||
border-radius: 15px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding-left: 1%;
|
||||
padding-right: 4%;
|
||||
align-items: center;
|
||||
/* height: 60%; */
|
||||
height: 4vh;
|
||||
max-height: 35px;
|
||||
}
|
||||
/* Текст социалок */
|
||||
.soc_text {
|
||||
color: white;
|
||||
padding-left: 8%;
|
||||
font-size: 1.6vh;
|
||||
font-family: 'Mulish', sans-serif;
|
||||
}
|
||||
|
||||
.empty_box {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Отключить декорацию всего (сделано для убирания подчёркивания ссылок) */
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
/* Действия при разрешении телефона */
|
||||
@media (max-width: 900px) {
|
||||
|
||||
.empty_box {
|
||||
flex: 0;
|
||||
}
|
||||
.soc_buttons {
|
||||
justify-content: right;
|
||||
}
|
||||
|
||||
}
|
||||
/* Сверхузкие телефоны */
|
||||
@media (max-width: 400px) {
|
||||
.react_vol {
|
||||
flex-direction: column;
|
||||
}
|
||||
.vol {
|
||||
padding-top: 8px;
|
||||
}
|
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 44.376953 5.9863281 C 43.889905 6.0076957 43.415817 6.1432497 42.988281 6.3144531 C 42.565113 6.4845113 40.128883 7.5243408 36.53125 9.0625 C 32.933617 10.600659 28.256963 12.603668 23.621094 14.589844 C 14.349356 18.562196 5.2382813 22.470703 5.2382812 22.470703 L 5.3046875 22.445312 C 5.3046875 22.445312 4.7547875 22.629122 4.1972656 23.017578 C 3.9185047 23.211806 3.6186028 23.462555 3.3730469 23.828125 C 3.127491 24.193695 2.9479735 24.711788 3.015625 25.259766 C 3.2532479 27.184511 5.2480469 27.730469 5.2480469 27.730469 L 5.2558594 27.734375 L 14.158203 30.78125 C 14.385177 31.538434 16.858319 39.792923 17.402344 41.541016 C 17.702797 42.507484 17.984013 43.064995 18.277344 43.445312 C 18.424133 43.635633 18.577962 43.782915 18.748047 43.890625 C 18.815627 43.933415 18.8867 43.965525 18.957031 43.994141 C 18.958531 43.994806 18.959437 43.99348 18.960938 43.994141 C 18.969579 43.997952 18.977708 43.998295 18.986328 44.001953 L 18.962891 43.996094 C 18.979231 44.002694 18.995359 44.013801 19.011719 44.019531 C 19.043456 44.030655 19.062905 44.030268 19.103516 44.039062 C 20.123059 44.395042 20.966797 43.734375 20.966797 43.734375 L 21.001953 43.707031 L 26.470703 38.634766 L 35.345703 45.554688 L 35.457031 45.605469 C 37.010484 46.295216 38.415349 45.910403 39.193359 45.277344 C 39.97137 44.644284 40.277344 43.828125 40.277344 43.828125 L 40.310547 43.742188 L 46.832031 9.7519531 C 46.998903 8.9915162 47.022612 8.334202 46.865234 7.7402344 C 46.707857 7.1462668 46.325492 6.6299361 45.845703 6.34375 C 45.365914 6.0575639 44.864001 5.9649605 44.376953 5.9863281 z M 44.429688 8.0195312 C 44.627491 8.0103707 44.774102 8.032983 44.820312 8.0605469 C 44.866523 8.0881109 44.887272 8.0844829 44.931641 8.2519531 C 44.976011 8.419423 45.000036 8.7721605 44.878906 9.3242188 L 44.875 9.3359375 L 38.390625 43.128906 C 38.375275 43.162926 38.240151 43.475531 37.931641 43.726562 C 37.616914 43.982653 37.266874 44.182554 36.337891 43.792969 L 26.632812 36.224609 L 26.359375 36.009766 L 26.353516 36.015625 L 23.451172 33.837891 L 39.761719 14.648438 A 1.0001 1.0001 0 0 0 38.974609 13 A 1.0001 1.0001 0 0 0 38.445312 13.167969 L 14.84375 28.902344 L 5.9277344 25.849609 C 5.9277344 25.849609 5.0423771 25.356927 5 25.013672 C 4.99765 24.994652 4.9871961 25.011869 5.0332031 24.943359 C 5.0792101 24.874869 5.1948546 24.759225 5.3398438 24.658203 C 5.6298218 24.456159 5.9609375 24.333984 5.9609375 24.333984 L 5.9941406 24.322266 L 6.0273438 24.308594 C 6.0273438 24.308594 15.138894 20.399882 24.410156 16.427734 C 29.045787 14.44166 33.721617 12.440122 37.318359 10.902344 C 40.914175 9.3649615 43.512419 8.2583658 43.732422 8.1699219 C 43.982886 8.0696253 44.231884 8.0286918 44.429688 8.0195312 z M 33.613281 18.792969 L 21.244141 33.345703 L 21.238281 33.351562 A 1.0001 1.0001 0 0 0 21.183594 33.423828 A 1.0001 1.0001 0 0 0 21.128906 33.507812 A 1.0001 1.0001 0 0 0 20.998047 33.892578 A 1.0001 1.0001 0 0 0 20.998047 33.900391 L 19.386719 41.146484 C 19.35993 41.068197 19.341173 41.039555 19.3125 40.947266 L 19.3125 40.945312 C 18.800713 39.30085 16.467362 31.5161 16.144531 30.439453 L 33.613281 18.792969 z M 22.640625 35.730469 L 24.863281 37.398438 L 21.597656 40.425781 L 22.640625 35.730469 z"/></svg>
|
Before Width: | Height: | Size: 3.3 KiB |
@ -1,20 +0,0 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
if not os.path.exists('db.json'):
|
||||
db = {}
|
||||
js = json.dumps(db, indent=2)
|
||||
with open("db.json", "w") as outfile:
|
||||
outfile.write(js)
|
||||
print('Created new db.json')
|
||||
|
||||
|
||||
def read_db(file = 'db.json'):
|
||||
with open(file, "r", encoding="utf-8") as openfile:
|
||||
db = json.load(openfile)
|
||||
return db
|
||||
|
||||
def write_db(db, file = 'db.json'):
|
||||
js = json.dumps(db, indent=2, ensure_ascii=False)
|
||||
with open(file, "w", encoding="utf-8") as outfile:
|
||||
outfile.write(js)
|
@ -1 +0,0 @@
|
||||
|
@ -1,51 +0,0 @@
|
||||
<mxfile host="app.diagrams.net" modified="2024-04-01T16:29:26.277Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0" etag="2Je_fr_wu3mHw-hys32a" version="24.2.0" type="device">
|
||||
<diagram name="Page-1" id="Rpvc9EjizXgK4u0YfwZ1">
|
||||
<mxGraphModel dx="768" dy="414" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="9GxXwJ9rFdMoL2Du00uo-1" target="9GxXwJ9rFdMoL2Du00uo-5">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-1" value="Парсер" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="170" y="420" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-2" value="github.com/SerbiaStrong-220" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="370" y="415" width="250" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.07;entryY=0.4;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="9GxXwJ9rFdMoL2Du00uo-1" target="9GxXwJ9rFdMoL2Du00uo-2">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-4" value="Запрос данных" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="9GxXwJ9rFdMoL2Du00uo-3">
|
||||
<mxGeometry x="-0.1787" y="-1" relative="1" as="geometry">
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="9GxXwJ9rFdMoL2Du00uo-5" target="9GxXwJ9rFdMoL2Du00uo-7">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-5" value="recipes.json" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="175" y="340" width="90" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="9GxXwJ9rFdMoL2Du00uo-7" target="9GxXwJ9rFdMoL2Du00uo-11">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-7" value="calc.py" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="170" y="240" width="110" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-8" value="Получение рецептов и т.п." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry y="430" width="170" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-9" value="Составление рецепта вещества" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry y="250" width="170" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-11" value="site.py" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="390" y="242.5" width="100" height="45" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9GxXwJ9rFdMoL2Du00uo-13" value="Отображение самого рецепта в виде компонентов" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="490" y="250" width="220" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
3
site.py
3
site.py
@ -7,6 +7,7 @@ els = list(db.keys())
|
||||
from dash import Dash, dcc, html, Input, Output,callback
|
||||
app = Dash(__name__, title="SS14 Tools", update_title=None)
|
||||
|
||||
|
||||
#### ФОРМАТ СТРАНИЦЫ ####
|
||||
|
||||
app.index_string = '''
|
||||
@ -163,4 +164,4 @@ def update_output(reaction, amount):
|
||||
|
||||
if __name__ == '__main__':
|
||||
# app.run(debug=True)
|
||||
app.run(debug=False, port = 9000)
|
||||
app.run(debug=False)
|
||||
|
12
update_db.py
12
update_db.py
@ -71,7 +71,7 @@ class Reagent:
|
||||
self.__category = init_data.get("category")
|
||||
# raw значения которые обработаны
|
||||
|
||||
self.__heat: bool = init_data.get("heat")
|
||||
self.heat: bool = init_data.get("heat")
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -95,9 +95,6 @@ class Reagent:
|
||||
print(self.__category)
|
||||
result.append(self.__category)
|
||||
|
||||
# Добавляем нужен ли нагрев
|
||||
result.append(self.__heat)
|
||||
|
||||
if not self.__recipe:
|
||||
return None
|
||||
for item in self.__recipe:
|
||||
@ -174,12 +171,7 @@ def load_recipes(url,name):
|
||||
# print(item["id"])
|
||||
if item["id"] not in content:
|
||||
continue
|
||||
if "minTemp" in item:
|
||||
content[item["id"]]["heat"] = True
|
||||
else:
|
||||
content[item["id"]]["heat"] = False
|
||||
# if "minTemp" in item:
|
||||
# print(item["minTemp"])
|
||||
content[item["id"]]["heat"] = "minTemp" in item
|
||||
content[item["id"]]["reactants"] = {
|
||||
element: {"amount": item["reactants"][element]["amount"], "reagent": element in content} for element in
|
||||
item["reactants"]}
|
||||
|
Loading…
Reference in New Issue
Block a user