mirror of
https://github.com/Justuser3310/ss14_chemistry_site.git
synced 2026-06-19 19:51:00 +00:00
Compare commits
41 Commits
2fa9b57ce3
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bda4452390 | |||
| 53d540c841 | |||
| 320a7204e3 | |||
| 0ef9fc1de9 | |||
| 5cce77aa10 | |||
| 0a98ef930b | |||
| 45ec9a1157 | |||
| 5deaa5823e | |||
| 170dc0517a | |||
| 63af9c4eaa | |||
| a54a1b3d61 | |||
| 3d6074260a | |||
| 32527fe39e | |||
| 22b2a0ec27 | |||
| eb13e945b9 | |||
| 0d3bd86b2c | |||
| 609c21245f | |||
| d7296528b2 | |||
| 398796e892 | |||
| 21a77c1372 | |||
| ad8819dbd7 | |||
| 0afa599408 | |||
| ed661f01f1 | |||
| bdc90b42d0 | |||
| fb9254844e | |||
| e5c7c65816 | |||
| 2ad1536f77 | |||
| 33ee933114 | |||
| 766549c649 | |||
| 55da6a92cf | |||
| d436f702e0 | |||
| 61fba86600 | |||
| bb182fed32 | |||
| f0aa026ed1 | |||
| ef87f56239 | |||
| 2592688a74 | |||
| a24ef738b4 | |||
| fda71ff7f3 | |||
| 9f09fd67f4 | |||
| 6b80c415ff | |||
| 5c6917e40e |
@@ -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 |
@@ -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 |
@@ -0,0 +1,67 @@
|
|||||||
|
from precalc__ import precalc__
|
||||||
|
from db import load
|
||||||
|
|
||||||
|
global expanded
|
||||||
|
def expand_recipe(recipe, recipes, main = False):
|
||||||
|
global expanded
|
||||||
|
if main:
|
||||||
|
expanded = {}
|
||||||
|
|
||||||
|
ok = False
|
||||||
|
part = 1 # Одна часть
|
||||||
|
while not ok:
|
||||||
|
ok = True
|
||||||
|
vol_in = 0 # Объём мин. рецепта (вход)
|
||||||
|
# Перебираем элементы
|
||||||
|
for el in recipe:
|
||||||
|
# Если составное
|
||||||
|
if el in recipes:
|
||||||
|
# Одна часть должна делиться без остатка!
|
||||||
|
if part % recipes[el].out != 0:
|
||||||
|
ok = False
|
||||||
|
part += 1
|
||||||
|
expanded = {}
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
vol_in += expand_recipe(recipes[el].comps, recipes)
|
||||||
|
else:
|
||||||
|
if el in expanded:
|
||||||
|
expanded[el] += recipe[el]*part
|
||||||
|
else:
|
||||||
|
expanded[el] = recipe[el]*part
|
||||||
|
|
||||||
|
vol_in += recipe[el]*part
|
||||||
|
|
||||||
|
if main:
|
||||||
|
return expanded, vol_in, part
|
||||||
|
else:
|
||||||
|
return vol_in
|
||||||
|
|
||||||
|
def calc(element, amount, recipes):
|
||||||
|
# Получаем характеристику элемента
|
||||||
|
recipe, vol_out = recipes[element].comps, recipes[element].out
|
||||||
|
# Расчитываем минимальный рецепт
|
||||||
|
expanded, vol_in, part = expand_recipe(recipe, recipes, True)
|
||||||
|
|
||||||
|
need = amount//vol_in
|
||||||
|
for i in expanded:
|
||||||
|
expanded[i] = expanded[i]*need
|
||||||
|
vol_in *= need
|
||||||
|
vol_out *= part*need
|
||||||
|
|
||||||
|
return expanded, vol_in, vol_out
|
||||||
|
|
||||||
|
def calc_all(recipes, amount):
|
||||||
|
precalc = {}
|
||||||
|
for el in recipes:
|
||||||
|
precalc[el] = precalc__(calc(el, amount, recipes))
|
||||||
|
return precalc
|
||||||
|
|
||||||
|
|
||||||
|
def precalc(element, amount):
|
||||||
|
try:
|
||||||
|
# Загружаем рецепты с нужным количеством
|
||||||
|
recipes = load(f'{amount}_calc.json', 'precalc')
|
||||||
|
except:
|
||||||
|
return 'Нету такого файла или вещества'
|
||||||
|
return recipes[element]
|
||||||
+35
-7
@@ -1,20 +1,48 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from reag__ import reag__
|
||||||
|
from precalc__ import precalc__
|
||||||
|
|
||||||
if not os.path.exists('db.json'):
|
if not os.path.exists('precalc.json'):
|
||||||
db = {}
|
db = {}
|
||||||
js = json.dumps(db, indent=2)
|
js = json.dumps(db, indent=2)
|
||||||
with open("db.json", "w") as outfile:
|
with open('precalc.json', 'w') as outfile:
|
||||||
outfile.write(js)
|
outfile.write(js)
|
||||||
print('Created new db.json')
|
print('Created new precalc.json')
|
||||||
|
if not os.path.exists('raw_db.json'):
|
||||||
|
db = {}
|
||||||
|
js = json.dumps(db, indent=2)
|
||||||
|
with open('raw_db.json', 'w') as outfile:
|
||||||
|
outfile.write(js)
|
||||||
|
print('Created new raw_db.json')
|
||||||
|
|
||||||
|
|
||||||
def read_db(file = 'db.json'):
|
def read_db(file):
|
||||||
with open(file, "r", encoding="utf-8") as openfile:
|
with open(file, 'r', encoding='utf-8') as openfile:
|
||||||
db = json.load(openfile)
|
db = json.load(openfile)
|
||||||
return db
|
return db
|
||||||
|
|
||||||
def write_db(db, file = 'db.json'):
|
def write_db(db, file):
|
||||||
js = json.dumps(db, indent=2, ensure_ascii=False)
|
js = json.dumps(db, indent=2, ensure_ascii=False)
|
||||||
with open(file, "w", encoding="utf-8") as outfile:
|
with open(file, 'w', encoding='utf-8') as outfile:
|
||||||
outfile.write(js)
|
outfile.write(js)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def save(db, file):
|
||||||
|
raw = {}
|
||||||
|
for el in db:
|
||||||
|
class_data = db[el].get_all()
|
||||||
|
raw[el] = class_data
|
||||||
|
write_db(raw, file)
|
||||||
|
|
||||||
|
def load(file, type = 'raw'):
|
||||||
|
raw = read_db(file)
|
||||||
|
db = {}
|
||||||
|
if type == 'raw':
|
||||||
|
for el in raw:
|
||||||
|
db[el] = reag__(raw[el][0], raw[el][1], raw[el][2])
|
||||||
|
elif type == 'precalc':
|
||||||
|
for el in raw:
|
||||||
|
db[el] = precalc__(raw[el])
|
||||||
|
return db
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="ru" data-bs-theme="dark">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>SS14Tools</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="./assets/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
.mx-10 {
|
||||||
|
margin-left: 10rem;
|
||||||
|
margin-right: 10rem;
|
||||||
|
}
|
||||||
|
.gxr-- {
|
||||||
|
margin-right: 18rem;
|
||||||
|
}
|
||||||
|
.gxl-- {
|
||||||
|
margin-left: 18rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<nav class="navbar bg-body-tertiary">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="#"><i class="bi bi-tools"></i> SS14Tools</a>
|
||||||
|
<div class="btn-group" role="group" aria-label="Простой пример">
|
||||||
|
<button type="button" class="btn btn-primary"><i class="bi bi-discord"></i></button>
|
||||||
|
<button type="button" class="btn btn-primary"><i class="bi bi-telegram"></i></button>
|
||||||
|
<button type="button" class="btn btn-primary"><i class="bi bi-github"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<center>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row py-5">
|
||||||
|
<div class="col-xl-9">
|
||||||
|
<select class="form-select" aria-label="Реакция">
|
||||||
|
<option selected><p class="gx-5">💊 Дермалин</p></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid col">
|
||||||
|
<div class="btn-group" role="group" aria-label="Базовая группа переключателей радио">
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="30" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="30">30</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="50" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="50">50</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="100" autocomplete="off" checked>
|
||||||
|
<label class="btn btn-outline-primary" for="100">100</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="300" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="300">300</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="1000" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="1000">1000</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" aria-current="page" href="#">Рецепт</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link disabled">Эффекты и дебафы</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Составляющее</th>
|
||||||
|
<th scope="col">Количество</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Кислород</td><td>100</td></tr>
|
||||||
|
<tr><td>Фосфор</td><td>100</td></tr>
|
||||||
|
<tr><td>Келотан</td><td>100</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</center>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
from requests import get
|
||||||
|
from yaml import load, SafeLoader
|
||||||
|
from reag__ import reag__
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
#### Локализация ####
|
||||||
|
|
||||||
|
def parse_ftl(el, prefix = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Locale/ru-RU/reagents/meta'):
|
||||||
|
if '.ftl' not in el:
|
||||||
|
el += '.ftl'
|
||||||
|
url = f'{prefix}/{el}'
|
||||||
|
raw = get(url).content.decode('utf-8')
|
||||||
|
locales = {}
|
||||||
|
for i in raw.splitlines():
|
||||||
|
if 'name' in i:
|
||||||
|
splitted = i.split()
|
||||||
|
name = splitted[0][13:]
|
||||||
|
locale = splitted[2]
|
||||||
|
locales[name] = locale
|
||||||
|
return locales
|
||||||
|
|
||||||
|
def load_locales(locales_url):
|
||||||
|
locales = {}
|
||||||
|
for el in tqdm(locales_url):
|
||||||
|
locales = locales | parse_ftl(el)
|
||||||
|
return locales
|
||||||
|
|
||||||
|
#### Рецепты ####
|
||||||
|
|
||||||
|
SafeLoader.add_multi_constructor('', lambda loader, tag_suffix, node: None)
|
||||||
|
|
||||||
|
def parse_yml(el, prefix = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions'):
|
||||||
|
if '.yml' not in el:
|
||||||
|
el += '.yml'
|
||||||
|
url = f'{prefix}/{el}'
|
||||||
|
yml = load(get(url).content.decode('utf-8'), Loader=SafeLoader)
|
||||||
|
return yml
|
||||||
|
|
||||||
|
def load_recipes(recipes_url, prefix = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions'):
|
||||||
|
recipes = {}
|
||||||
|
for el in tqdm(recipes_url):
|
||||||
|
yml = parse_yml(el, prefix)
|
||||||
|
for element in yml:
|
||||||
|
if 'products' not in element or 'reactants' not in element:
|
||||||
|
continue
|
||||||
|
product = element['id']
|
||||||
|
comps = {}
|
||||||
|
for elem in element['reactants']:
|
||||||
|
comps[elem] = element['reactants'][elem]['amount']
|
||||||
|
for id, value in element['products'].items():
|
||||||
|
out = value
|
||||||
|
recipes[product] = reag__(comps=comps, out=out, category=el)
|
||||||
|
return recipes
|
||||||
|
|
||||||
|
|
||||||
|
#### Локализируем ####
|
||||||
|
|
||||||
|
def localize(recipes, locale):
|
||||||
|
loc_recipes = {}
|
||||||
|
# Итерируем элементы
|
||||||
|
for element in recipes:
|
||||||
|
# Итерируем составные
|
||||||
|
el = recipes[element]
|
||||||
|
# Локализованные составные
|
||||||
|
loc_comps = {}
|
||||||
|
for comp in el.comps:
|
||||||
|
# Ищем перевод
|
||||||
|
if comp.lower() in locale:
|
||||||
|
loc = locale[comp.lower()].capitalize()
|
||||||
|
loc_comps[loc] = el.comps[comp]
|
||||||
|
else:
|
||||||
|
loc_comps[comp] = el.comps[comp]
|
||||||
|
# Заменяем на локализованное
|
||||||
|
el.comps = loc_comps
|
||||||
|
|
||||||
|
# Локализуем ключ
|
||||||
|
if element.lower() in locale:
|
||||||
|
loc = locale[element.lower()].capitalize()
|
||||||
|
loc_recipes[loc] = recipes[element]
|
||||||
|
else:
|
||||||
|
loc_recipes[element] = recipes[element]
|
||||||
|
|
||||||
|
return loc_recipes
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class precalc__:
|
||||||
|
def __init__(self, els):
|
||||||
|
self.recipe = els[0]
|
||||||
|
self.vol_in = els[1]
|
||||||
|
self.vol_out = els[2]
|
||||||
|
def get_all(self):
|
||||||
|
return [self.recipe, self.vol_in, self.vol_out]
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
class reag__:
|
||||||
|
def __init__(self, comps, out, category = '-'):
|
||||||
|
# {'инапровалин': 1, 'углерод': 1}
|
||||||
|
self.comps = comps
|
||||||
|
# 2
|
||||||
|
self.out = out
|
||||||
|
# medicine
|
||||||
|
self.category = category
|
||||||
|
def get_all(self):
|
||||||
|
return [self.comps, self.out, self.category]
|
||||||
|
|
||||||
@@ -1 +1 @@
|
|||||||
|
flask
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<mxfile host="app.diagrams.net" modified="2024-04-29T13:47:17.196Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0" etag="XnVek72uMfAQe9lHc6O7" version="24.2.8" type="device">
|
||||||
|
<diagram name="Page-1" id="jgGGHY6DT18EdGNQ9F9V">
|
||||||
|
<mxGraphModel dx="600" dy="322" 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="18loy90T9bJApvsHHXn6-5" value="" style="group" vertex="1" connectable="0" parent="1">
|
||||||
|
<mxGeometry x="307.5" y="330" width="245" height="110" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-1" value="<div>Рецепты: parse_yml(url)</div>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-5">
|
||||||
|
<mxGeometry x="10" width="220" height="20" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-2" value="<div>[ {'type': 'reaction', 'id': 'Dylovene', 'reactants': {'Silicon': {'amount': 1}, 'Nitrogen': {'amount': 1}, 'Potassium': {'amount': 1}}, 'products': {'Dylovene': 3}}, ...]</div>" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-5">
|
||||||
|
<mxGeometry y="20" width="245" height="90" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-10" value="" style="group" vertex="1" connectable="0" parent="1">
|
||||||
|
<mxGeometry x="345.5" y="495" width="170" height="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-8" value="load_recipe(recipes)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-10">
|
||||||
|
<mxGeometry x="20" width="130" height="20" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-9" value="{"Dylovene": reag__.*, ...}" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-10">
|
||||||
|
<mxGeometry y="20" width="170" height="50" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="18loy90T9bJApvsHHXn6-2" target="18loy90T9bJApvsHHXn6-8">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-15" value="<div align="left">reag__(<br>category = 'medicine', comps = {'silicon': 1, 'nitrogen': 1, 'potassium': 1}, <br>out = 3<br>)</div>" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;align=left;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="128" y="490" width="180" height="100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="18loy90T9bJApvsHHXn6-9" target="18loy90T9bJApvsHHXn6-15">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="18loy90T9bJApvsHHXn6-18" target="18loy90T9bJApvsHHXn6-19">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-19" value="<div align="left">reag__(<br>category = 'medicine', comps = {'кремний': 1, 'азот': 1, 'калий': 1}, <br>out = 3<br>)</div>" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;align=left;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="128" y="620" width="180" height="100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-21" value="" style="group" vertex="1" connectable="0" parent="1">
|
||||||
|
<mxGeometry x="340.5" y="625" width="180" height="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-17" value="<span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">localize</span></span></span>(recipes)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-21">
|
||||||
|
<mxGeometry x="17" width="147" height="20" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-18" value="{"Диловен": reag__.*, ...}" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-21">
|
||||||
|
<mxGeometry y="20" width="180" height="50" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-22" value="" style="group" vertex="1" connectable="0" parent="1">
|
||||||
|
<mxGeometry x="560.495" y="495" width="161.875" height="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-3" value="{'dylovene': 'диловен', ...}" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-22">
|
||||||
|
<mxGeometry y="20" width="161.875" height="50" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-4" value="Локализация: parse_ftl(url)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="18loy90T9bJApvsHHXn6-22">
|
||||||
|
<mxGeometry x="4.375" width="148.75" height="20" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-23" value="{'dylovene': 'диловен', ...}" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="576.43" y="647.5" width="130" height="45" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="18loy90T9bJApvsHHXn6-3" target="18loy90T9bJApvsHHXn6-23">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-25" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="18loy90T9bJApvsHHXn6-18" target="18loy90T9bJApvsHHXn6-23">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="18loy90T9bJApvsHHXn6-9" target="18loy90T9bJApvsHHXn6-17">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18loy90T9bJApvsHHXn6-28" value="parse.py" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="92.37" y="290" width="647.63" height="450" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
from flask import Flask, render_template, request
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def main():
|
||||||
|
return render_template("index.html")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(debug=False, port = 5001)
|
||||||
|
|
||||||
|
@app.route("/submit", methods=['POST'])
|
||||||
|
def calculate():
|
||||||
|
selectedval = request.form["getrecept"]
|
||||||
|
return f"{selectedval}"
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="ru" data-bs-theme="dark">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>SS14Tools</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="../assets/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
.mx-10 {
|
||||||
|
margin-left: 10rem;
|
||||||
|
margin-right: 10rem;
|
||||||
|
}
|
||||||
|
.gxr-- {
|
||||||
|
margin-right: 18rem;
|
||||||
|
}
|
||||||
|
.gxl-- {
|
||||||
|
margin-left: 18rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<nav class="navbar bg-body-tertiary">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="#"><i class="bi bi-tools"></i> SS14Tools</a>
|
||||||
|
<div class="btn-group" role="group" aria-label="Простой пример">
|
||||||
|
<button type="button" class="btn btn-primary"><i class="bi bi-discord"></i></button>
|
||||||
|
<button type="button" class="btn btn-primary"><i class="bi bi-telegram"></i></button>
|
||||||
|
<button type="button" class="btn btn-primary"><i class="bi bi-github"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<center>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row py-5">
|
||||||
|
<div class="col-xl-9">
|
||||||
|
<form action="/submit" method="post">
|
||||||
|
<select class="form-select" name="getrecept" aria-label="Реакция">
|
||||||
|
<option selected><p class="gx-5">Выберите (бля а что мы конкретно выбираем)</p></option>
|
||||||
|
<option value="1">Пример 1</option>
|
||||||
|
<option value="2">Пример 2</option>
|
||||||
|
<option value="3">Пример 3</option>
|
||||||
|
</select>
|
||||||
|
<input type="submit" value="Submit">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid col">
|
||||||
|
<div class="btn-group" role="group" aria-label="Базовая группа переключателей радио">
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="30" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="30">30</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="50" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="50">50</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="100" autocomplete="off" checked>
|
||||||
|
<label class="btn btn-outline-primary" for="100">100</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="300" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="300">300</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="1000" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="1000">1000</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</center>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
from parse import *
|
||||||
|
from calc import *
|
||||||
|
from db import *
|
||||||
|
|
||||||
|
print('''1. Обновить всё.
|
||||||
|
2. Пересчитать рецепты.
|
||||||
|
''')
|
||||||
|
inp = input(">> ")
|
||||||
|
print('\n')
|
||||||
|
|
||||||
|
vols = [30, 50, 100]
|
||||||
|
if inp == '1':
|
||||||
|
print('Парсим и обрабатываем данные...')
|
||||||
|
# Загружаем локализацию
|
||||||
|
locales_url = ['biological', 'botany', 'chemicals', 'cleaning', 'elements', 'fun',
|
||||||
|
'gases', 'medicine', 'narcotics', 'physical-desc', 'pyrotechnic', 'toxins',
|
||||||
|
'consumable/drink/alcohol', 'consumable/drink/drinks', 'consumable/drink/juice', 'consumable/drink/soda',
|
||||||
|
'consumable/food/condiments', 'consumable/food/food', 'consumable/food/ingredients']
|
||||||
|
locales = load_locales(locales_url)
|
||||||
|
|
||||||
|
# Загружаем сырые рецепты
|
||||||
|
recipes_url = ['biological', 'botany', 'chemicals', 'cleaning', 'drinks', 'food',
|
||||||
|
'fun', 'gas', 'medicine', 'pyrotechnic']
|
||||||
|
raw_recipes = load_recipes(recipes_url)
|
||||||
|
|
||||||
|
# Локализируем
|
||||||
|
recipes = localize(raw_recipes, locales)
|
||||||
|
|
||||||
|
save(recipes, 'raw_db.json')
|
||||||
|
print('Сохранены минимальные рецепты в raw_db.json')
|
||||||
|
print('Выполняем предрасчёты...')
|
||||||
|
|
||||||
|
for i in vols:
|
||||||
|
precalc = calc_all(recipes, i)
|
||||||
|
save(precalc, f'{i}_calc.json')
|
||||||
|
print(f'Данные сохранены в {i}_calc.json')
|
||||||
|
elif inp == '2':
|
||||||
|
print('Выполняем расчёты...')
|
||||||
|
recipes = load('raw_db.json')
|
||||||
|
for i in vols:
|
||||||
|
precalc = calc_all(recipes, i)
|
||||||
|
save(precalc, f'{i}_calc.json')
|
||||||
|
print(f'Данные сохранены в {i}_calc.json')
|
||||||
|
else:
|
||||||
|
exit()
|
||||||
|
|
||||||
|
print("ГОТОВО.")
|
||||||
Reference in New Issue
Block a user