mirror of
https://github.com/ethanrusz/scouter.git
synced 2025-04-20 14:06:32 -04:00
Compare commits
12 commits
31f68d3289
...
1fa40e729d
Author | SHA1 | Date | |
---|---|---|---|
1fa40e729d | |||
3eba2b644a | |||
b2c392e5c5 | |||
2bf585f449 | |||
94bfea56b7 | |||
0f9eadd610 | |||
d72d21a00f | |||
15a9be25cc | |||
c1121238d8 | |||
33a5988ef6 | |||
0e5b129d9e | |||
03fc4dd1e7 |
18 changed files with 252 additions and 114 deletions
|
@ -4,8 +4,6 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-registry:
|
update-registry:
|
||||||
|
@ -28,6 +26,4 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: git.beans.team/em/scouter:latest
|
||||||
git.beans.team/em/scouter:latest
|
|
||||||
git.beans.team/em/scouter:${{ github.sha }}
|
|
28
.github/workflows/build-release.yml
vendored
Normal file
28
.github/workflows/build-release.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
name: Build and Push Releases
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [ published ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-registry:
|
||||||
|
name: Update Registry Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to git.beans.team
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.beans.team
|
||||||
|
username: em
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and Push Image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: git.beans.team/em/scouter:${{ github.event.release.tag_name }}
|
|
@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y \
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY requirements.txt app.py ./
|
COPY requirements.txt app.py scouter.db ./
|
||||||
|
|
||||||
RUN pip3 install -r requirements.txt
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
|
9
app.py
9
app.py
|
@ -1,4 +1,5 @@
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
|
import database as db
|
||||||
|
|
||||||
|
|
||||||
class Moon:
|
class Moon:
|
||||||
|
@ -92,9 +93,11 @@ def main():
|
||||||
st.markdown("# :red[Lethal Company] Scouter")
|
st.markdown("# :red[Lethal Company] Scouter")
|
||||||
st.markdown(":rainbow[What does the scouter say about this moon's power level?]")
|
st.markdown(":rainbow[What does the scouter say about this moon's power level?]")
|
||||||
|
|
||||||
|
moon_strings = db.get_moon_list()
|
||||||
|
|
||||||
moon = st.selectbox(
|
moon = st.selectbox(
|
||||||
"Moon",
|
"Moon",
|
||||||
sorted(m.name for m in moons),
|
moon_strings,
|
||||||
placeholder="Moon! Pick a moon!",
|
placeholder="Moon! Pick a moon!",
|
||||||
help="Pick your current moon.",
|
help="Pick your current moon.",
|
||||||
)
|
)
|
||||||
|
@ -142,7 +145,7 @@ def main():
|
||||||
st.write(find_spawn_list(run.outside_power, outside_creatures))
|
st.write(find_spawn_list(run.outside_power, outside_creatures))
|
||||||
else:
|
else:
|
||||||
st.error(
|
st.error(
|
||||||
f"Power level exceedes maximum possible for {run.moon.name}."
|
f"Power level exceeds maximum possible for {run.moon.name}."
|
||||||
)
|
)
|
||||||
|
|
||||||
with right_column:
|
with right_column:
|
||||||
|
@ -181,7 +184,7 @@ def main():
|
||||||
st.write(find_spawn_list(run.inside_power, inside_creatures))
|
st.write(find_spawn_list(run.inside_power, inside_creatures))
|
||||||
else:
|
else:
|
||||||
st.error(
|
st.error(
|
||||||
f"Power level exceedes maximum possible for {run.moon.name}."
|
f"Power level exceeds maximum possible for {run.moon.name}."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
create table if not exists moon_tier
|
|
||||||
(
|
|
||||||
moon_tier_id int primary key,
|
|
||||||
tier_name text not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists risk_level
|
|
||||||
(
|
|
||||||
risk_level_id int primary key,
|
|
||||||
risk_level_name text not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists layout
|
|
||||||
(
|
|
||||||
layout_id int primary key,
|
|
||||||
layout_name text not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists weather
|
|
||||||
(
|
|
||||||
weather_id int primary key,
|
|
||||||
weather_name text not null,
|
|
||||||
effect text
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists moon
|
|
||||||
(
|
|
||||||
moon_id int primary key,
|
|
||||||
moon_name text not null,
|
|
||||||
risk_level_id int not null,
|
|
||||||
cost int not null,
|
|
||||||
default_layout_id int not null,
|
|
||||||
map_size_multiplier real not null,
|
|
||||||
min_scrap int not null,
|
|
||||||
max_scrap int not null,
|
|
||||||
outside_max_power int not null,
|
|
||||||
inside_max_power int not null,
|
|
||||||
moon_tier_id int not null,
|
|
||||||
foreign key (risk_level_id)
|
|
||||||
references risk_level (risk_level_id),
|
|
||||||
foreign key (default_layout_id)
|
|
||||||
references layout (layout_id),
|
|
||||||
foreign key (moon_tier_id)
|
|
||||||
references moon_tier (moon_tier_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists creature_type
|
|
||||||
(
|
|
||||||
creature_type_id int primary key,
|
|
||||||
type_name text not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists creature
|
|
||||||
(
|
|
||||||
creature_id int primary key,
|
|
||||||
creature_name text not null,
|
|
||||||
creature_nickname text,
|
|
||||||
health int,
|
|
||||||
power_level int not null,
|
|
||||||
max_spawn int not null,
|
|
||||||
stunnable int not null,
|
|
||||||
stun_multiplier real,
|
|
||||||
door_open_speed real,
|
|
||||||
hostile int not null,
|
|
||||||
creature_type_id int not null,
|
|
||||||
favorite_moon_id int not null,
|
|
||||||
foreign key (creature_type_id)
|
|
||||||
references creature_type (creature_type_id),
|
|
||||||
foreign key (favorite_moon_id)
|
|
||||||
references moon (moon_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists scrap
|
|
||||||
(
|
|
||||||
scrap_id int primary key,
|
|
||||||
scrap_name text not null,
|
|
||||||
min_value int not null,
|
|
||||||
max_value int not null,
|
|
||||||
weight int not null,
|
|
||||||
conductive int not null,
|
|
||||||
two_handed int not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists viable_weather
|
|
||||||
(
|
|
||||||
moon_id int not null,
|
|
||||||
weather_id int not null,
|
|
||||||
foreign key (moon_id)
|
|
||||||
references moon (moon_id),
|
|
||||||
foreign key (weather_id)
|
|
||||||
references weather (weather_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists spawn_chance
|
|
||||||
(
|
|
||||||
moon_id int not null,
|
|
||||||
creature_id int not null,
|
|
||||||
spawn_chance real not null,
|
|
||||||
foreign key (moon_id)
|
|
||||||
references moon (moon_id),
|
|
||||||
foreign key (creature_id)
|
|
||||||
references creature (creature_id)
|
|
||||||
);
|
|
104
database-scripts/create.sql
Normal file
104
database-scripts/create.sql
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
create table creature_type
|
||||||
|
(
|
||||||
|
creature_type_id int
|
||||||
|
primary key,
|
||||||
|
type_name text not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table layout
|
||||||
|
(
|
||||||
|
layout_id int
|
||||||
|
primary key,
|
||||||
|
layout_name text not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table moon_tier
|
||||||
|
(
|
||||||
|
moon_tier_id int
|
||||||
|
primary key,
|
||||||
|
tier_name text not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table risk_level
|
||||||
|
(
|
||||||
|
risk_level_id int
|
||||||
|
primary key,
|
||||||
|
risk_level_name text not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table moon
|
||||||
|
(
|
||||||
|
moon_id int
|
||||||
|
primary key,
|
||||||
|
moon_name text not null,
|
||||||
|
risk_level_id int not null
|
||||||
|
references risk_level,
|
||||||
|
cost int not null,
|
||||||
|
default_layout_id int not null
|
||||||
|
references layout,
|
||||||
|
map_size_multiplier real not null,
|
||||||
|
min_scrap int not null,
|
||||||
|
max_scrap int not null,
|
||||||
|
outside_max_power int not null,
|
||||||
|
inside_max_power int not null,
|
||||||
|
moon_tier_id int not null
|
||||||
|
references moon_tier
|
||||||
|
);
|
||||||
|
|
||||||
|
create table creature
|
||||||
|
(
|
||||||
|
creature_id int
|
||||||
|
primary key,
|
||||||
|
creature_name text not null,
|
||||||
|
creature_nickname text,
|
||||||
|
health int,
|
||||||
|
power_level int not null,
|
||||||
|
max_spawn int not null,
|
||||||
|
stunnable int not null,
|
||||||
|
stun_multiplier real,
|
||||||
|
door_open_speed real,
|
||||||
|
hostile int not null,
|
||||||
|
creature_type_id int not null
|
||||||
|
references creature_type,
|
||||||
|
favorite_moon_id int not null
|
||||||
|
references moon
|
||||||
|
);
|
||||||
|
|
||||||
|
create table scrap
|
||||||
|
(
|
||||||
|
scrap_id int
|
||||||
|
primary key,
|
||||||
|
scrap_name text not null,
|
||||||
|
min_value int not null,
|
||||||
|
max_value int not null,
|
||||||
|
weight int not null,
|
||||||
|
conductive int not null,
|
||||||
|
two_handed int not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table spawn_chance
|
||||||
|
(
|
||||||
|
moon_id int not null
|
||||||
|
references moon,
|
||||||
|
creature_id int not null
|
||||||
|
references creature,
|
||||||
|
spawn_chance real not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table weather
|
||||||
|
(
|
||||||
|
weather_id int
|
||||||
|
primary key,
|
||||||
|
weather_name text not null,
|
||||||
|
effect text
|
||||||
|
);
|
||||||
|
|
||||||
|
create table viable_weather
|
||||||
|
(
|
||||||
|
moon_id int not null
|
||||||
|
references moon,
|
||||||
|
weather_id int not null
|
||||||
|
references weather
|
||||||
|
);
|
||||||
|
|
||||||
|
|
20
database-scripts/creature.sql
Normal file
20
database-scripts/creature.sql
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
insert into main.creature (creature_id, creature_name, creature_nickname, health, power_level, max_spawn, stunnable, stun_multiplier, door_open_speed, hostile, creature_type_id, favorite_moon_id)
|
||||||
|
values (1, 'Snare Flea', 'Head Bug', 2, 1, 4, 1, 3, 4.35, 1, 2, 2),
|
||||||
|
(2, 'Bunker Spider', null, 5, 3, 1, 1, 1, 6.67, 1, 2, 1),
|
||||||
|
(3, 'Hoarding Bug', 'Yippee Bug', 2, 1, 8, 1, 0.5, 0.67, 1, 2, 2),
|
||||||
|
(4, 'Bracken', 'Flower Man', 3, 3, 1, 1, 0.25, 0.8, 1, 2, 3),
|
||||||
|
(5, 'Thumper', null, 4, 3, 4, 1, 1, 3.33, 1, 2, 4),
|
||||||
|
(6, 'Hygrodere', 'Goo', null, 1, 2, 1, 4, 0, 1, 2, 4),
|
||||||
|
(7, 'Ghost Girl', null, null, 2, 1, 0, null, 0.25, 1, 3, 6),
|
||||||
|
(8, 'Spore Lizard', null, null, 1, 2, 1, 0.6, 3.33, 1, 2, 1),
|
||||||
|
(9, 'Nutcracker', null, 5, 1, 10, 1, 0.5, 0.5, 1, 2, 6),
|
||||||
|
(10, 'Coil-Head', null, null, 1, 5, 1, 3.25, 16.67, 1, 2, 4),
|
||||||
|
(11, 'Jester', null, null, 3, 1, 1, 0.6, 2, 1, 2, 6),
|
||||||
|
(12, 'Masked', 'Mimic', 4, 1, 10, 1, 0.75, 0.25, 1, 3, 6),
|
||||||
|
(13, 'Eyeless Dog', null, 12, 2, 8, 1, 0.7, null, 1, 1, 8),
|
||||||
|
(14, 'Forest Keeper', 'Giant', null, 3, 3, 1, 1.2, null, 1, 1, 3),
|
||||||
|
(15, 'Earth Leviathan', 'Worm', null, 2, 3, 0, null, null, 1, 1, 2),
|
||||||
|
(16, 'Baboon Hawk', null, 6, 1, 15, 1, 0.4, null, 1, 1, 5),
|
||||||
|
(17, 'Circuit Bees', null, null, 1, 6, 0, null, null, 1, 1, 5),
|
||||||
|
(18, 'Manticoil', null, 2, 1, 16, 1, 1.1, null, 0, 1, 4),
|
||||||
|
(19, 'Roaming Locusts', null, null, 1, 16, 0, null, null, 0, 1, 1);
|
4
database-scripts/creature_type.sql
Normal file
4
database-scripts/creature_type.sql
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
insert into main.creature_type (creature_type_id, type_name)
|
||||||
|
values (1, 'Outside'),
|
||||||
|
(2, 'Inside'),
|
||||||
|
(3, 'Hybrid');
|
3
database-scripts/layout.sql
Normal file
3
database-scripts/layout.sql
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
insert into main.layout (layout_id, layout_name)
|
||||||
|
values (1, 'Factory'),
|
||||||
|
(2, 'Mansion');
|
9
database-scripts/moon.sql
Normal file
9
database-scripts/moon.sql
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
insert into main.moon (moon_id, moon_name, risk_level_id, cost, default_layout_id, map_size_multiplier, min_scrap, max_scrap, outside_max_power, inside_max_power, moon_tier_id)
|
||||||
|
values (1, '41-Experimentation', 4, 0, 1, 1, 0, 11, 8, 4, 1),
|
||||||
|
(2, '220-Assurance', 6, 0, 1, 1, 13, 16, 8, 6, 1),
|
||||||
|
(3, '56-Vow', 5, 0, 1, 1.15, 10, 12, 6, 7, 1),
|
||||||
|
(4, '21-Offense', 4, 0, 1, 1.25, 14, 17, 8, 12, 2),
|
||||||
|
(5, '61-March', 4, 0, 1, 2, 18, 25, 12, 14, 2),
|
||||||
|
(6, '85-Rend', 3, 550, 2, 1.2, 18, 25, 6, 10, 3),
|
||||||
|
(7, '7-Dine', 2, 600, 2, 1.3, 20, 27, 6, 15, 3),
|
||||||
|
(8, '8-Titan', 1, 700, 1, 2.35, 23, 37, 7, 18, 3);
|
4
database-scripts/moon_tier.sql
Normal file
4
database-scripts/moon_tier.sql
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
insert into main.moon_tier (moon_tier_id, tier_name)
|
||||||
|
values (1, 'Tier 1'),
|
||||||
|
(2, 'Tier 2'),
|
||||||
|
(3, 'Tier 3');
|
7
database-scripts/risk_level.sql
Normal file
7
database-scripts/risk_level.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
insert into main.risk_level (risk_level_id, risk_level_name)
|
||||||
|
values (1, 'S+'),
|
||||||
|
(2, 'S'),
|
||||||
|
(3, 'A'),
|
||||||
|
(4, 'B'),
|
||||||
|
(5, 'C'),
|
||||||
|
(6, 'D');
|
1
database-scripts/scrap.sql
Normal file
1
database-scripts/scrap.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
;
|
1
database-scripts/spawn_chance.sql
Normal file
1
database-scripts/spawn_chance.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
;
|
37
database-scripts/viable_weather.sql
Normal file
37
database-scripts/viable_weather.sql
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
insert into main.viable_weather (moon_id, weather_id)
|
||||||
|
values (1, 1),
|
||||||
|
(1, 2),
|
||||||
|
(1, 4),
|
||||||
|
(1, 5),
|
||||||
|
(1, 6),
|
||||||
|
(1, 3),
|
||||||
|
(2, 1),
|
||||||
|
(2, 2),
|
||||||
|
(2, 3),
|
||||||
|
(2, 5),
|
||||||
|
(2, 6),
|
||||||
|
(3, 1),
|
||||||
|
(3, 5),
|
||||||
|
(3, 3),
|
||||||
|
(3, 4),
|
||||||
|
(3, 6),
|
||||||
|
(4, 1),
|
||||||
|
(4, 2),
|
||||||
|
(4, 3),
|
||||||
|
(4, 6),
|
||||||
|
(4, 5),
|
||||||
|
(5, 1),
|
||||||
|
(5, 5),
|
||||||
|
(5, 3),
|
||||||
|
(5, 4),
|
||||||
|
(5, 6),
|
||||||
|
(6, 1),
|
||||||
|
(6, 3),
|
||||||
|
(6, 6),
|
||||||
|
(7, 1),
|
||||||
|
(7, 5),
|
||||||
|
(7, 6),
|
||||||
|
(8, 1),
|
||||||
|
(8, 3),
|
||||||
|
(8, 4),
|
||||||
|
(8, 6);
|
1
database/__init__.py
Normal file
1
database/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
from .database import *
|
23
database/database.py
Normal file
23
database/database.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import os
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
|
||||||
|
def get_connection() -> sqlite3.Connection:
|
||||||
|
if os.getenv("DATABASE_FILE"):
|
||||||
|
return sqlite3.connect(os.getenv("DATABASE_FILE"))
|
||||||
|
else:
|
||||||
|
return sqlite3.connect("./scouter.db")
|
||||||
|
|
||||||
|
|
||||||
|
def get_moon_list() -> list[str] | None:
|
||||||
|
with get_connection() as connection:
|
||||||
|
cursor = connection.cursor()
|
||||||
|
moons = cursor.execute(
|
||||||
|
"select moon_name from moon order by moon_id"
|
||||||
|
)
|
||||||
|
|
||||||
|
if moons:
|
||||||
|
moons = [moon[0] for moon in moons]
|
||||||
|
return moons
|
||||||
|
else:
|
||||||
|
return None
|
BIN
scouter.db
Normal file
BIN
scouter.db
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue