Skip to content

Commit

Permalink
UI (#18)
Browse files Browse the repository at this point in the history
* file created

* translation, moved tess init out of utils

* basic UI

* vid-formats, version

* pbar override first part

* bunch of stuff

* better placement

* normal-flow UI complete

* changed spec

* formatting

* version bump

* tl files

* linux build

* translation and language data

* fixed typos

* renamed translator

* renamed skill files to match tesseract data files

* implemented downlaod for all langs

* added translator to console mode

* loading and copying correction files

* changed skill corrections

* better logging, changed to add InvalidCharms

* autoexit

* improved console charm removal

* first pass done UI

* updated readme
  • Loading branch information
chpoit authored May 29, 2021
1 parent 8eaadf8 commit 6185aa8
Show file tree
Hide file tree
Showing 60 changed files with 5,434 additions and 391 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ converted.js
*.exe
*.zip
./*.png
!data/**/*.json


# Created by https://www.toptal.com/developers/gitignore/api/rust
Expand Down
60 changes: 57 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,24 @@
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Debug UI",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"args": []
},
{
"name": "Frame Extraction",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"args": [
"--skip-charms"
"--skip-charms",
"--console",
"--autoexit"
]
},
{
Expand All @@ -28,7 +38,49 @@
"program": "main.py",
"console": "integratedTerminal",
"args": [
"--skip-frames"
"--skip-frames",
"--console",
"--autoexit"
]
},
{
"name": "Debug UI (With parse errors)",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"args": [
"--skip-frames",
"-f",
"frames2"
]
},
{
"name": "Charm Extraction (With parse errors, Console)",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"args": [
"--skip-frames",
"--console",
"-f",
"frames2",
"--autoexit"
]
},
{
"name": "Charm Extraction (French)",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"args": [
"--skip-frames",
"--console",
"-l",
"French",
"--autoexit"
]
},
{
Expand All @@ -40,7 +92,9 @@
"args": [
"--skip-frames",
"--frames",
"debug-frames"
"debug-frames",
"--console",
"--autoexit"
]
}
]
Expand Down
80 changes: 58 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@ This repo contains code that will allow you to extract all of your charms in Mon

It's called Utsushi's charm because I thought it would be funny to make a complementary "Utsushi's Armor Search System", but ["this armor set searcher exists"](https://mhrise.wiki-db.com/sim/?hl=en). I might still try to port Athena's ASS for MHW to MHR, but for now this works for me.

# New Update (Updated May 28th)
- Now with a User Interface
- Support for [Multiple Game languages](#supported-game-language)

# Usage

## Requirements
- A computer (Windows)
- Linux and Mac might work too, you wont be able to run the EXE and will have to run from source in a terminal window. Refer to [Running from source](#Running-from-source)
- A USB cable to connect your switch to transfer files
- [The latest version of this](https://github.com/chpoit/utsushis-charm/releases/latest) downloaded to your computer (Utsushis-Charm_**vx_x**.zip)
- A [pre-release](https://github.com/chpoit/utsushis-charm/releases/tag/v1.5.0-alpha) with a User Interface is available
- Some knowledge of how to type things in the terminal
- [The latest version of this (Now with a User Interface)](https://github.com/chpoit/utsushis-charm/releases/latest) downloaded to your computer (Utsushis-Charm_**vx_x**.zip)
- You only need the executable. The inputs folder is only there for faster setup
- Being able to read

## Steps

0. Unequip all jewels. You will create "fake" charms otherwise.
- Item Box -> Manage Equipment -> Set Decorations -> Equipment Box -> Remove all (Press '-' on controller)
- Don't ask, this is way out of scope for something that takes you 30 seconds to do.
1. Download the release bundle and follow the Requirements section (Utsushis-Charm_**vx_x**.zip)
- You're free to delete `skill_corrections.csv` if you want. A new empty one will be recreated.
1. Download the release bundle and follow the [Requirements](##Requirements) section (Utsushis-Charm_**vx_x**.zip)
2. Record clips similar to the following of you going through your charms. Try placing the UI in front of something that is very "flat" in color and doesn't have NPCs walking in front.
- I can easily go through 2-3 pages of charms in 30 seconds.
- Use a stopwatch on your phone if you have trouble timing the 30 seconds. I saved a clip every ~25 seconds.
Expand All @@ -38,23 +40,47 @@ It's called Utsushi's charm because I thought it would be funny to make a comple
![Example Clip](./media/example_clip.gif)

3. Transfer the clips to your computer.
4. Put the files in the "inputs" directory. If it does not exist, create it at the same place you can find `utsushis-charm.exe`.
4. Put the files in the `inputs` directory. If it does not exist, create it at the same place you can find `utsushis-charm.exe`.
- It does not matter how many you have
- The `inputs` directory can be changed by clicking the button
- I haven't tried to see what would happen if there are clips that are not of the charm UI
-
5. Run the `utsushis-charm.exe` (Double-click)
6. A Terminal should pop up
- Wait a little bit, it need to do extract some data (~5-15s)
7. The first step of the program should take roughly 30 seconds to 1 minute per clip you have in the inputs folder
8. Once that step is done, the second phase starts, normally, it should be done without needing your attention
- The app will start
- Wait a little bit, it needs to extract some data (~5-15s)
6. Enter the options you want relative to where your files are and the game language
7. The program will run and do the following:
1. Find all unique frames
2. Extract Charms
3. Apply known automatic fixes to the charms
8. If there were errors in parsing, a new window will open
- Follow the instructions on screen and correct any invalid skill names.
- If a skill has to be corrected, a window with the skill should open, you might have to alt-tab to it, Windows likes to hide it.
9. The program is done running. Press Enter and exit.
- You might see some warnings about memory leaks, you don't have to worry about that, it's cleared upon closing the program.
10. Extra:
- If a skill/charm has to be corrected, a window will open and request your input.
- Pressing cancel skips the charm and moves to the next.
- Pressing empty removes the skill.
- Only valid skill names can be entered. Case Insensitive.
9. The program is done running.
- Normally, charms are automatically saved to the files listed in the console
- You can directly copy the charms to your clipboard by clicking the button.
11. Extra:
- Sometimes tesseract is absolutely unable to read text, those charms will be logged in `app.log` and you can add them manually.
- You can see a list of duplicate charms (if they exist) in the `charms.duplicate.txt`
- If no charm errored, or you don't care about those charms, you should be able to open the `charms.encoded.txt` file and copy the contents into the import box of [MHR-Wiki](https://mhrise.wiki-db.com/sim/?hl=en)

## Supported Game language:
- Confirmed:
- English
- French
- Theoretical:
- Japanese
- Italian
- German
- Spanish
- Russian
- Polish
- Korean
- Traditional Chinese
- Simplified Chinese

# FAQ
- Q: Can I use a capture card instead?
Expand All @@ -65,6 +91,13 @@ It's called Utsushi's charm because I thought it would be funny to make a comple
- 1080p adds extra processing due to a downscaling step to 720p (20-30% slower)
- I also tested using an Mclassic without any issues.

# Notes
- Version 1.5 is the last version that will officially support console mode, I may fix it from time to time if I need it for dev reasons, but I don't want to maintain a secondary workflow that will likely be used by nobody.

# Known issues
- Automatic skill corrections don't get updated in "UI" mode.


# Troubleshooting

If the program starts and closes without anything happening, open the `app.log` file and use this section to try and fix your issues
Expand Down Expand Up @@ -119,7 +152,7 @@ In all seriousness, the work is done in a few broad steps:

# Contribute

- If you ran everything and got new corrections in the [`skill_corrections.csv`](skill_corrections.csv) file, consider creating a pull request to add them for others.
- If you ran everything and had to correct some skills, you probably have new corrections in in your `Appdata/Local/utsushis-charm/skill_corrections.LANG.csv` or `~/utsushis-charm/skill_corrections.LANG.csv` file, consider creating a pull request to add them for others.
- If you feel like contributing anything, go ahead and submit a pull request I'll be happy to take a look and decide if it's something worth adding.
- Please use the default settings of `black` to format the python source code.

Expand Down Expand Up @@ -164,17 +197,17 @@ Normal instructions apply once the application starts.
- have python3 and tesseract installed via brew (or some other way)
- Virtual env on mac (optional): `virtualenv -p python3 env`
- Running:
- switch to the virtualenv `source env/bin/activate` (run at the root of the repository)
- set TESSDATA_PREFIX: `export TESSDATA_PREFIX=/usr/local/Cellar/tesseract/<version>/share/tessdata`
- install the project dependencies: `pip3 install .`
- run with `python3 main.py`
- Switch to the virtualenv `source env/bin/activate` (run at the root of the repository)
- Set TESSDATA_PREFIX: `export TESSDATA_PREFIX=/usr/local/Cellar/tesseract/<version>/share/tessdata`
- Install the project dependencies: `pip3 install .`
- Run with `python3 main.py`

## Linux
- Requirements
- You will need to install Google tesseract with your package manager of choice.
- You will need to install Google tesseract with your package manager of choice. Probably found under `tesseract-ocr`
- TkInter must be installed, probably found under `python3-tk`
- Running
- `python3 main.py`
-

## Windows
- Requirements
Expand All @@ -190,10 +223,13 @@ Normal instructions apply once the application starts.
If you run from source, or call the executable from the terminal you can make use of the following flags/arguments to achieve different functionality

- `-h` or ` --help`: Shows arguments
- `--thirdparty `: Shows 3rd party licenses
- `--thirdparty`: Shows 3rd party licenses
- `--console`: Runs the app in "console" mode
- `--autoexit`: Skips the "Press enter to exit" prompt in console mode
- `--skip-frames`: Skips the first frame extraction step. Useful if the second step crashed.
- ` --skip-charms`:`Skips the Tesseract-OCR step. Not sure why you would want that.
- `-i <INPUT_DIR>` or `--input <INPUT_DIR>`: Changes the Input directory for videos
- `-f <FRAME_DIR>` or `--frames <FRAME_DIR>`: Changes the Directory used to store temporary frames
- `-c <FILE_NAME>` or `--charm-json <FILE_NAME>`: Changes the name of the json formatted charms
- `-e <FILE_NAME>` or `--charm-encoded <FILE_NAME>`: Changes the name of the MHR-Wiki formatted charms
- `-l <FILE_NAME>` or `--language <FILE_NAME>`: Changes the default language for the recordings. Use the list in [Supported languages](#supported-game-language) to know what to enter.
111 changes: 111 additions & 0 deletions data/skills/corrections.chi_sim.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
不屈,不屈
会心击【属性】,会心击【属性】
体力回复量提升,体力回复量提升
体术,体术
佯动,佯动
冰属性攻击强化,冰属性攻击强化
冰耐性,冰耐性
减轻后坐力,减轻后坐力
减轻胆怯,减轻胆怯
击晕术,击晕术
刚刃打磨,刚刃打磨
利刃,利刃
剥取名人,剥取名人
剥取铁人,剥取铁人
力量解放,力量解放
匠,匠
吹笛名人,吹笛名人
回复速度,回复速度
回避性能,回避性能
回避距离提升,回避距离提升
地质学,地质学
墙面移动,墙面移动
夺取耐力,夺取耐力
属性异常状态的耐性,属性异常状态的耐性
幸运,幸运
广域化,广域化
弱点特效,弱点特效
弹丸节约,弹丸节约
弹道强化,弹道强化
强化持续,强化持续
心眼,心眼
快吃,快吃
怨恨,怨恨
抑制偏移,抑制偏移
拔刀术【力】,拔刀术【力】
拔刀术【技】,拔刀术【技】
挑战者,挑战者
捕获名人,捕获名人
攻击,攻击
攻击守势,攻击守势
散弹・扩散箭强化,散弹・扩散箭强化
无伤,无伤
昏厥耐性,昏厥耐性
最爱蘑菇,最爱蘑菇
植生学,植生学
死里逃生,死里逃生
毒属性强化,毒属性强化
毒耐性,毒耐性
水属性攻击强化,水属性攻击强化
水耐性,水耐性
泡沫之舞,泡沫之舞
泥雪耐性,泥雪耐性
滑走强化,滑走强化
满足感,满足感
火场怪力,火场怪力
火属性攻击强化,火属性攻击强化
火耐性,火耐性
炎鳞的恩惠,炎鳞的恩惠
炮弹装填,炮弹装填
炮术,炮术
炸弹客,炸弹客
爆破属性强化,爆破属性强化
爆破异常状态的耐性,爆破异常状态的耐性
特殊射击强化,特殊射击强化
看破,看破
睡眠属性强化,睡眠属性强化
睡眠耐性,睡眠耐性
砥石使用高速化,砥石使用高速化
破坏王,破坏王
精灵加护,精灵加护
精神抖擞,精神抖擞
纳刀术,纳刀术
翔虫使,翔虫使
耐力急速回复,耐力急速回复
耐震,耐震
耳塞,耳塞
装填扩充,装填扩充
装填速度,装填速度
解放弓的蓄力阶段,解放弓的蓄力阶段
贯穿弹・贯穿箭强化,贯穿弹・贯穿箭强化
超会心,超会心
跑者,跑者
跳跃铁人,跳跃铁人
达人艺,达人艺
逆袭,逆袭
通常弹・连射箭强化,通常弹・连射箭强化
速射强化,速射强化
道具使用强化,道具使用强化
钝器能手,钝器能手
钢壳的恩惠,钢壳的恩惠
防御,防御
防御强化,防御强化
防御性能,防御性能
集中,集中
雷属性攻击强化,雷属性攻击强化
雷纹一致,雷纹一致
雷耐性,雷耐性
霞皮的恩惠,霞皮的恩惠
风压耐性,风压耐性
风纹一致,风纹一致
风雷合一,风雷合一
飞身跃入,飞身跃入
饥饿耐性,饥饿耐性
骑乘名人,骑乘名人
高速变形,高速变形
鬼火缠,鬼火缠
麻痹属性强化,麻痹属性强化
麻痹耐性,麻痹耐性
龙属性攻击强化,龙属性攻击强化
龙气活性,龙气活性
龙耐性,龙耐性
Loading

0 comments on commit 6185aa8

Please sign in to comment.