Skip to content

Commit

Permalink
3 Style current webapp (#6)
Browse files Browse the repository at this point in the history
* [#3]: Add pydocstyle to pre-commit checks

* [#3]: Move memory config files

* [#3]: Move image files into app assets

* [#3]: Edit images and add new images

* [#3]: Add yaml format to pre-commit

* [#3]: Fix total_gold offset

* [#3]: Add styles for categories and subcategories

* [#3]: Add folder argument to read_config

* [#3]: Refactor module name and add second arg to read_config

* [#3]: Refactor module name and add second arg to read_config

* [#3]: Add logger and read image paths and categories from yaml configs

* [#3]: Add image paths config file

* [#3]: Add categories and subcategories config file

* [#3]: Add subcategories and move categories to yaml config

* [#3]: Change checks per seconf to float

* [#3]: Rename module to parser and add read_config folder arg

* [#3]: Add callback to toggle categories and subcategories

* [#3]: Adjust outlier removal to selected column and change index of column selection to subcategories

* [#3]: Standardize names

* [#3]: Adjust total_gold offsets

* [#3]: Modify unit code to allow for arbitrary addresses from config file instead of hardcode addresses

* [#3]: Add check if value is impossibly high (overflow) to outlier detection

* [#3]: Rename num_not_working to not_working

* [#3]: Add images for snoozed_buildings, not_working, num_inns and num_bakery

* [#3]: Rename metalarmor to metal_armor and remove engineer due to false count

* [#3]: Add code to have background image in plot for future

* [#3]: Fix not_working column

* [#3]: Fix numpy mod only passing on first string character

* [#3]: Remove unnecessary transformation into column vector

* [#3]: Add lord names as legend entries.

* [#3]: Remove lord dropdown

* [#3]: Change lord_names return to dataframe and add teams column

* [#3]: Refactor graph callback to incrementally draw new data instead of redrawing the whole graph

* [#3]: Change game_store memory to not be session memory

* [#3]: Reset graph if column is switched and draw the patch from the last drawn element

* [#3]: Add map_setting addresses to Lord class

* [#3]: Add error code to error message

* [#3]: Add storage for map settings

* [#3]: Add dtypes for map dataframe

* [#3]: Return if num_lords is 0

* [#3]: Change column_store to last_tick_store

* [#3]: Add data callback for getting map data

* [#3]: Raise no update when no lords are present

* [#3]: Add plugin for compatibility between black and flake8

* [#3]: Refactor graph draw callbacks to redraw and interpolate datetimes over separate months
  • Loading branch information
joschrag authored Dec 27, 2024
1 parent 523c22f commit 02eb1bd
Show file tree
Hide file tree
Showing 111 changed files with 889 additions and 237 deletions.
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[flake8]
max-line-length = 119
max-line-length = 119
extend-select = B950
extend-ignore = E203,E501,E701
14 changes: 13 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@ repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.3
hooks:
- id: gitleaks
- id: gitleaks
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0 # pick a git hash / tag to point to
hooks:
- id: pydocstyle
# https://github.com/PyCQA/pydocstyle/blob/master/docs/snippets/cli.rst

args:
- --convention=google
- repo: https://github.com/google/yamlfmt
rev: v0.10.0
hooks:
- id: yamlfmt
144 changes: 144 additions & 0 deletions config_files/app/images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
popularity:
img_path: "popularity.png"
ale_coverage:
img_path: "Image644.png"
taxes:
img_path: "Image646.png"
economy:
img_path: "economy.png"
gold:
img_path: "Image646.png"
total_gold:
img_path: "Image730.png"
goods_sent:
img_path: "Image281.png"
goods_received:
img_path: "Image284.png"
wood:
img_path: "Image620.png"
stone:
img_path: "Image624.png"
iron:
img_path: "Image628.png"
pitch:
img_path: "Image632.png"
bows:
img_path: "Image650.png"
crossbows:
img_path: "Image652.png"
spears:
img_path: "Image654.png"
pikes:
img_path: "Image656.png"
maces:
img_path: "Image658.png"
swords:
img_path: "Image660.png"
leather_armor:
img_path: "Image662.png"
metal_armor:
img_path: "Image664.png"
food:
img_path: "Image131.png"
total_food:
img_path: "Image131.png"
apples:
img_path: "Image642.png"
cheese:
img_path: "Image638.png"
meat:
img_path: "Image640.png"
wheat:
img_path: "Image634.png"
flour:
img_path: "Image648.png"
bread:
img_path: "Image636.png"
hops:
img_path: "Image622.png"
ale:
img_path: "Image644.png"
buildings:
img_path: "contents07_town_buildings.png"
num_buildings:
img_path: "contents07_town_buildings.png"
num_eco_buildings:
img_path: "Image658.png"
num_farms:
img_path: "Image660.png"
num_iron_mines:
img_path: "ST05_Iron_Mine.png"
num_pitchrigs:
img_path: "ST06_Pitch_Digger.png"
num_quarries:
img_path: "ST20_Quarry.png"
snoozed:
img_path: "Image209.png"
not_working:
img_path: "Image200.png"
num_bakery:
img_path: "Image30.png"
num_inns:
img_path: "Image45.png"
military:
img_path: "Image570.png"
total_units:
img_path: "Image570.png"
melee:
img_path: "armys24.png"
ranged:
img_path: "armys1.png"
siege_engines:
img_path: "armys13.png"
e_archer:
img_path: "armys1.png"
spearman:
img_path: "armys2.png"
maceman:
img_path: "armys3.png"
crossbowman:
img_path: "armys4.png"
pikeman:
img_path: "armys5.png"
e_swordsman:
img_path: "armys6.png"
knight:
img_path: "armys7.png"
a_archer:
img_path: "armys19.png"
slave:
img_path: "armys20.png"
slinger:
img_path: "armys21.png"
assassin:
img_path: "armys22.png"
h_archer:
img_path: "armys23.png"
a_swordsman:
img_path: "armys24.png"
firethrower:
img_path: "armys25.png"
monk:
img_path: "armys9.png"
engineer:
img_path: "armys8.png"
ladderman:
img_path: "armys10.png"
tunneler:
img_path: "armys18.png"
catapult:
img_path: "armys16.png"
trebuchet:
img_path: "armys15.png"
siege_tower:
img_path: "armys13.png"
battering_ram:
img_path: "armys12.png"
shield:
img_path: "armys11.png"
fireballista:
img_path: "armys26.png"
mangonel:
img_path: "armys14.png"
tower_ballista:
img_path: "armys17.png"
73 changes: 73 additions & 0 deletions config_files/app/stat_categories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
popularity:
- popularity
- ale_coverage
- taxes
economy:
- gold
- total_gold
- goods_sent
- goods_received
- wood
- stone
- iron
- pitch
- bows
- crossbows
- spears
- pikes
- maces
- swords
- leather_armor
- metal_armor
food:
- total_food
- wheat
- bread
- cheese
- apples
- ale
- flour
- hops
buildings:
- num_buildings
- num_eco_buildings
- num_farms
- num_iron_mines
- num_pitchrigs
- num_quarries
- snoozed
- not_working
- num_inns
- num_bakery
military:
- total_units
- melee
- ranged
- siege_engines
- e_archer
- spearman
- maceman
- crossbowman
- pikeman
- e_swordsman
- knight
- a_archer
- slave
- slinger
- assassin
- h_archer
- a_swordsman
- firethrower
- monk
# - engineer

- ladderman
- tunneler
- catapult
- trebuchet
- siege_tower
- battering_ram
- shield
- fireballista
- mangonel
- tower_ballista
File renamed without changes.
File renamed without changes.
43 changes: 27 additions & 16 deletions memory/lord.yaml → config_files/memory/lord.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
map_offsets:
offset: 0x0
memory:
- address: 0x24b649c
stat_offsets:
- name: map_name
offset: 0x0
type: string
address: 0x24b649c
stat_offsets:
- name: map_name
offset: 0x0
type: string
- name: advantage_setting
offset: 0x1ab0
type: byte
- name: start_year
offset: 0x449c
type: int
- name: start_month
offset: 0x44a0
type: int
- name: end_year
offset: 0x44a4
type: int
- name: end_month
offset: 0x44a8
type: int
lord_basic_offsets:
offset: 0x1
memory:
Expand All @@ -28,22 +42,22 @@ lord_global_offsets:
- name: num_total_buildings
offset: 0x9dccc
type: int
- address: 0x24ba564
- address: 0x24ba560
stat_offsets:
- name: total_gold
offset: 0x0
offset: 0x4
type: int
- name: weighted_troops_killed
offset: 0x2dc
offset: 0x2d8
type: int
- name: weighted_buildings_destroyed
offset: 0x300
offset: 0x2FC
type: int
- name: goods_received
offset: 0x348
offset: 0x344
type: int
- name: goods_sent
offset: 0x36c
offset: 0x368
type: int
lord_name_offsets:
offset: 0x5a
Expand All @@ -61,7 +75,7 @@ lord_stat_offsets:
- name: housing
offset: 0x0
type: word
- name: units
- name: total_units
offset: 0x344
type: int
- name: siege_engines
Expand Down Expand Up @@ -153,9 +167,6 @@ lord_stat_offsets:
- name: num_inns
offset: 0x234
type: int
# - name: working_woodcutters
# offset: 0xa80
# type: int
- name: num_bakery
offset: 0xaf4
type: int
Expand Down
Loading

0 comments on commit 02eb1bd

Please sign in to comment.