├── .gitignore ├── Cargo.toml ├── README_cn.md ├── README.md ├── LICENSE ├── src ├── main.rs └── lib.rs └── .github └── workflows └── rust.yml /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | authors = ["poly000"] 3 | name = "ddlc_helper" 4 | version = "2.0.4" 5 | edition = "2018" 6 | license = "MIT" 7 | repository = "https://github.com/poly000/ddlc_helper" 8 | description = "DDLC word selecting helper, and a library of DDLC poem's words." 9 | 10 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 11 | 12 | [dependencies] 13 | phf = { version = "0.11.1", features = ["macros"] } 14 | 15 | [profile.release] 16 | lto = true 17 | panic = "abort" 18 | codegen-units = 1 19 | -------------------------------------------------------------------------------- /README_cn.md: -------------------------------------------------------------------------------- 1 | # ddlc_helper 2 | 3 | [![crates.io](https://img.shields.io/crates/v/ddlc_helper.svg)](https://crates.io/crates/ddlc_helper) 4 | 5 | DDLC_Helper 是心跳文学部(Plus)的选词工具。 6 | 7 | 可以在 [Github](https://github.com/poly000/ddlc_helper/releases) 上下载windows的构建。 8 | 9 | ## 编译 10 | 11 | ``` 12 | cargo build --release 13 | ``` 14 | 15 | ## 用法 16 | 17 | 0. 选择您喜欢的角色 (例如 纱世里(Sayori)) 18 | 1. 选词时,您需要将 DDLC 的语言设置为 __English__。 19 | 2. 使用OCR工具识别游戏中的单词(比如,ShareX)。 20 | 3. 将刚刚得到的单词输入到本工具。这些单词应该以 “空白” 分隔开。“空白” 可以是换行符,空格,制表符等等。 21 | 4. 选择本工具以 “Result:” 前缀输出的单词。 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ddlc_helper 2 | 3 | [![crates.io](https://img.shields.io/crates/v/ddlc_helper.svg)](https://crates.io/crates/ddlc_helper) 4 | 5 | [**中文文档**](https://github.com/poly000/ddlc_helper/blob/main/README_cn.md) 6 | 7 | DDLC_Helper is a tool to select words in DDLC( Plus). 8 | 9 | Releases for Windows are avaliable on [Github](https://github.com/poly000/ddlc_helper/releases) 10 | 11 | ## Build 12 | 13 | ``` 14 | cargo build --release 15 | ``` 16 | 17 | ## Usage 18 | 19 | 0. Select a charactor you like. (e.g. Sayori) 20 | 1. You should set language as __English__ in DDLC when selecting words. 21 | 2. Use OCR tool to recogonise words in the game. (e.g. ShareX) 22 | 3. Type the words we just got to this tool. (the words should be split in whitespaces like CRLF, Space, Tab, ...) 23 | 4. Select one of words ddlc_helper prints prefixed with "Result:". 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 poly000<1348292515@qq.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use ::ddlc_helper::NATSUKI_WORDS_SET; 2 | use ::ddlc_helper::SAYORI_WORDS_SET; 3 | use ::ddlc_helper::YURI_WORDS_SET; 4 | 5 | use std::io::stdin; 6 | 7 | #[derive(Copy, Clone)] 8 | enum Charactor { 9 | Sayori, 10 | Yuri, 11 | Natsuki, 12 | } 13 | 14 | fn main() -> Result<(), Box> { 15 | println!("Please select the charactor you like: (enter the number near names)"); 16 | println!("0 Sayori, 1 Yuri, 2 Natsuki\n"); 17 | 18 | let mut buf = String::new(); 19 | 20 | let charactor = { 21 | stdin().read_line(&mut buf)?; 22 | 23 | let num = buf.trim().parse::()?; 24 | 25 | match num { 26 | 0 => Charactor::Sayori, 27 | 1 => Charactor::Yuri, 28 | 2 => Charactor::Natsuki, 29 | _ => return Err("charactor code was out of bound!".into()), 30 | } 31 | }; 32 | 33 | buf.clear(); 34 | 35 | println!("Great! Now please input the words in a line."); 36 | 37 | loop { 38 | loop { 39 | stdin().read_line(&mut buf)?; 40 | 41 | if buf.lines().last().map(|i| i.trim()) == Some("") { 42 | break; 43 | } 44 | } 45 | 46 | let words_list = buf.split_whitespace(); 47 | let result = filter_words(words_list, charactor); 48 | 49 | print!("\nResult: "); 50 | for word in result { 51 | print!("{} ", word); 52 | } 53 | println!("\n"); 54 | 55 | buf.clear(); 56 | } 57 | } 58 | 59 | fn filter_words<'a>( 60 | words: impl Iterator, 61 | charactor: Charactor, 62 | ) -> impl Iterator { 63 | let words_set = match charactor { 64 | Charactor::Sayori => &SAYORI_WORDS_SET, 65 | Charactor::Yuri => &YURI_WORDS_SET, 66 | Charactor::Natsuki => &NATSUKI_WORDS_SET, 67 | }; 68 | 69 | words.filter(move |word| words_set.contains(&word.to_lowercase())) 70 | } 71 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | # Origin config by @Kilerd 2 | 3 | 4 | name: Build Canary Version 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | 10 | jobs: 11 | release: 12 | name: Release on ${{ matrix.platform }} 13 | runs-on: ${{ matrix.os }} 14 | strategy: 15 | matrix: 16 | platform: [macos-x86_64, linux_glibc-x86_64, linux_musl-x86_64, linux_musl-i686, windows-i686, windows-x86_64] 17 | include: 18 | 19 | - platform: macos-x86_64 20 | target: x86_64-apple-darwin 21 | os: macos-latest 22 | bin: ddlc_helper 23 | 24 | - platform: linux_glibc-x86_64 25 | target: x86_64-unknown-linux-gnu 26 | os: ubuntu-latest 27 | bin: ddlc_helper 28 | 29 | - platform: linux_musl-x86_64 30 | target: x86_64-unknown-linux-musl 31 | os: ubuntu-latest 32 | bin: ddlc_helper 33 | 34 | - platform: linux_musl-i686 35 | target: i686-unknown-linux-musl 36 | os: ubuntu-latest 37 | bin: ddlc_helper 38 | 39 | - platform: windows-i686 40 | target: i686-pc-windows-msvc 41 | os: windows-latest 42 | bin: ddlc_helper.exe 43 | 44 | - platform: windows-x86_64 45 | target: x86_64-pc-windows-msvc 46 | os: windows-latest 47 | bin: ddlc_helper.exe 48 | 49 | steps: 50 | - name: Install toolchain 51 | uses: actions-rs/toolchain@v1 52 | with: 53 | target: ${{ matrix.target }} 54 | toolchain: nightly 55 | override: true 56 | 57 | - name: Checkout code 58 | uses: actions/checkout@v1 59 | 60 | - name: Run code build 61 | uses: actions-rs/cargo@v1 62 | with: 63 | toolchain: nightly 64 | command: build 65 | args: --release --target ${{ matrix.target }} 66 | 67 | - name: Prepare assets 68 | shell: bash 69 | run: | 70 | mv target/${{ matrix.target }}/release/${{ matrix.bin }} . 71 | if [[ ${{ matrix.target }} != x86_64-apple-darwin ]] 72 | then strip ${{ matrix.bin }} 73 | fi 74 | 75 | tar -cvf ${{ matrix.target }}.tar ${{ matrix.bin }} 76 | 77 | - name: Declare some variables # https://stackoverflow.com/a/61699863 78 | id: vars 79 | shell: bash 80 | run: | 81 | echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" 82 | 83 | - name: Pre-Release 84 | uses: softprops/action-gh-release@v1 85 | with: 86 | files: ${{ matrix.target }}.tar 87 | tag_name: 2.0.3-${{ steps.vars.outputs.sha_short }} 88 | prerelease: true 89 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | #![doc = include_str!("../README_cn.md")] 3 | 4 | //! 5 | //! the words are from [DDLC wiki](https://ddlcwiki.net/wiki/Poem_game) 6 | 7 | use phf::{phf_set, Set}; 8 | 9 | pub static SAYORI_WORDS_SET: Set<&'static str> = phf_set! { 10 | "adventure", 11 | "alone", 12 | "amazing", 13 | "awesome", 14 | "beauty", 15 | "bed", 16 | "bliss", 17 | "broken", 18 | "calm", 19 | "charm", 20 | "cheer", 21 | "childhood", 22 | "clumsy", 23 | "color", 24 | "comfort", 25 | "cry", 26 | "dance", 27 | "dark", 28 | "daydream", 29 | "dazzle", 30 | "death", 31 | "defeat", 32 | "depression", 33 | "embrace", 34 | "empty", 35 | "excitement", 36 | "extraordinary", 37 | "family", 38 | "fear", 39 | "feather", 40 | "fireflies", 41 | "fireworks", 42 | "flower", 43 | "flying", 44 | "forgive", 45 | "friends", 46 | "fun", 47 | "grief", 48 | "happiness", 49 | "heart", 50 | "holiday", 51 | "hope", 52 | "hopeless", 53 | "hurt", 54 | "joy", 55 | "laugh", 56 | "lazy", 57 | "loud", 58 | "love", 59 | "lucky", 60 | "marriage", 61 | "memories", 62 | "misery", 63 | "misfortune", 64 | "music", 65 | "nature", 66 | "ocean", 67 | "pain", 68 | "party", 69 | "passion", 70 | "peaceful", 71 | "play", 72 | "prayer", 73 | "precious", 74 | "promise", 75 | "rainbow", 76 | "raincloud", 77 | "romance", 78 | "rose", 79 | "sadness", 80 | "scars", 81 | "shame", 82 | "silly", 83 | "sing", 84 | "smile", 85 | "sparkle", 86 | "special", 87 | "sunny", 88 | "sunset", 89 | "sweet", 90 | "tears", 91 | "together", 92 | "tragedy", 93 | "treasure", 94 | "unrequited", 95 | "vacation", 96 | "warm", 97 | "wonderful", 98 | }; 99 | 100 | pub static YURI_WORDS_SET: Set<&'static str> = phf_set! { 101 | "afterimage", 102 | "agonizing", 103 | "ambient", 104 | "analysis", 105 | "anxiety", 106 | "atone", 107 | "aura", 108 | "breathe", 109 | "cage", 110 | "captive", 111 | "climax", 112 | "contamination", 113 | "covet", 114 | "crimson", 115 | "desire", 116 | "despise", 117 | "destiny", 118 | "determination", 119 | "disarray", 120 | "disaster", 121 | "disoriented", 122 | "disown", 123 | "dream", 124 | "effulgent", 125 | "electricity", 126 | "entropy", 127 | "essence", 128 | "eternity", 129 | "existence", 130 | "explode", 131 | "extreme", 132 | "fester", 133 | "fickle", 134 | "flee", 135 | "frightening", 136 | "graveyard", 137 | "heavensent", 138 | "horror", 139 | "imagination", 140 | "incapable", 141 | "incongruent", 142 | "infallible", 143 | "inferno", 144 | "infinite", 145 | "insight", 146 | "intellectual", 147 | "journey", 148 | "judgment", 149 | "landscape", 150 | "lust", 151 | "massacre", 152 | "meager", 153 | "melancholy", 154 | "philosophy", 155 | "pleasure", 156 | "portrait", 157 | "question", 158 | "raindrops", 159 | "secretive", 160 | "sensation", 161 | "starscape", 162 | "suicide", 163 | "tenacious", 164 | "time", 165 | "uncanny", 166 | "uncontrollable", 167 | "unending", 168 | "universe", 169 | "unrestrained", 170 | "unstable", 171 | "variance", 172 | "vertigo", 173 | "vibrant", 174 | "vitality", 175 | "vivacious", 176 | "vivid", 177 | "whirlwind", 178 | "wrath", 179 | }; 180 | 181 | pub static NATSUKI_WORDS_SET: Set<&'static str> = phf_set! { 182 | "anger", 183 | "anime", 184 | "blanket", 185 | "boop", 186 | "bouncy", 187 | "bubbles", 188 | "bunny", 189 | "candy", 190 | "cheeks", 191 | "chocolate", 192 | "clouds", 193 | "cute", 194 | "doki", 195 | "email", 196 | "fantasy", 197 | "fluffy", 198 | "games", 199 | "giggle", 200 | "hair", 201 | "headphones", 202 | "heartbeat", 203 | "hop", 204 | "jump", 205 | "jumpy", 206 | "kawaii", 207 | "kiss", 208 | "kitty", 209 | "lipstick", 210 | "lollipop", 211 | "marshmallow", 212 | "melody", 213 | "milk", 214 | "mouse", 215 | "nibble", 216 | "nightgown", 217 | "papa", 218 | "parfait", 219 | "peace", 220 | "pink", 221 | "playground", 222 | "poof", 223 | "pout", 224 | "puppy", 225 | "pure", 226 | "ribbon", 227 | "shiny", 228 | "shopping", 229 | "skipping", 230 | "skirt", 231 | "socks", 232 | "spinning", 233 | "sticky", 234 | "strawberry", 235 | "sugar", 236 | "summer", 237 | "swimsuit", 238 | "twirl", 239 | "valentine", 240 | "vanilla", 241 | "waterfall", 242 | "whisper", 243 | "whistle", 244 | }; 245 | --------------------------------------------------------------------------------