diff --git a/Cargo.lock b/Cargo.lock index 35218d9..6521bde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,7 +126,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -137,7 +137,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", "regex-automata 0.4.3", @@ -465,9 +465,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", "clap_derive", @@ -475,9 +475,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstream", "anstyle", @@ -503,7 +503,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -837,14 +837,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "humantime", "is-terminal", @@ -861,9 +861,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -983,7 +983,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1037,9 +1037,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", @@ -1417,7 +1417,7 @@ checksum = "9d8acb5ee668d55f0f2d19a320a3f9ef67a6999ad483e11135abcc2464ed18b6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1912,9 +1912,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "f95b9abcae896730d42b78e09c155ed4ddf82c07b4de772c64aee5b2d8b7c150" dependencies = [ "bytes", "fnv", @@ -2098,9 +2098,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown 0.14.2", @@ -2225,9 +2225,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -2254,9 +2254,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libgit2-sys" @@ -2270,6 +2270,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + [[package]] name = "libz-sys" version = "1.1.12" @@ -2290,9 +2301,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "lock_api" @@ -2715,7 +2726,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2769,9 +2780,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b559898e0b4931ed2d3b959ab0c2da4d99cc644c4b0b1a35b4d344027f474023" +checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" [[package]] name = "portpicker" @@ -2945,12 +2956,12 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall 0.2.16", + "libredox", "thiserror", ] @@ -3203,9 +3214,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64 0.21.5", ] @@ -3222,9 +3233,9 @@ dependencies = [ [[package]] name = "rustrict" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe3300a40b60e76a856237ad1fe2210da1f40686705a2211688bb5742109a63" +checksum = "1f77b9ca0900c188a43a4bae92778d6258dfea386d95198ba1b7696b7e834a82" dependencies = [ "arrayvec", "bitflags 1.3.2", @@ -3285,9 +3296,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] @@ -3304,20 +3315,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -3326,13 +3337,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3366,7 +3377,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_json", "time", @@ -3456,7 +3467,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3642,9 +3653,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" @@ -3725,9 +3736,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -3820,7 +3831,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3881,9 +3892,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -3910,13 +3921,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4007,7 +4018,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -4117,7 +4128,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4436,9 +4447,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4446,24 +4457,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -4473,9 +4484,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4483,22 +4494,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasm-streams" @@ -4530,9 +4541,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -4769,9 +4780,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.17" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] diff --git a/src/commands/lfg.rs b/src/commands/lfg.rs index cbf1c20..8a19b5a 100644 --- a/src/commands/lfg.rs +++ b/src/commands/lfg.rs @@ -1,3 +1,4 @@ +use std::time::Duration; // use crate::commands::lfg::Difficulty::Normal; use crate::commands::lfg::Map::*; @@ -65,12 +66,37 @@ pub(crate) async fn lfg( #[description = "optional extra message"] #[rename = "message"] note: Option, + ) -> Result<(), Error> { + { + let mut cooldown_tracker = ctx.command().cooldowns.lock().unwrap(); + let mut cooldown_durations = poise::CooldownConfig::default(); + cooldown_durations.user = Some(Duration::from_secs(600)); + + match cooldown_tracker.remaining_cooldown_2(ctx, &cooldown_durations) { + Some(remaining) => { + return Err(format!("Please wait {} seconds", remaining.as_secs()).into()) + } + None => cooldown_tracker.start_cooldown(ctx), + } + }; + + + + + + + + + + + + + let current = current_players.unwrap_or(1); let mut desired = desired_players.unwrap_or(4); - if current >= desired { - desired = 4 - } + if current >= desired { desired = 4 } + let map_name: &str = map.name(); let ping: Mention; match mode.unwrap_or(Casual) { Casual => match map { @@ -81,20 +107,23 @@ pub(crate) async fn lfg( Speedrun => ping = Role(RoleId(1005836989595144243)), Challenge => ping = Role(RoleId(1005836864680361994)), } + let diff_name: &str = if map != AlienArcadium { + difficulty.unwrap_or(Normal).name() + } else { + Normal.name() + }; + + let mut reply = format!( "{c}/{d} {e} {f} {b}", - //a = ctx.author().mention(), b = ping, c = current, d = desired, - e = map.name(), - f = if map != AlienArcadium { - difficulty.unwrap_or(Normal).name() - } else { - Normal.name() - } + e = map_name, + f = diff_name ); + if note.is_some() { let t = note.unwrap(); let regex = regex::Regex::new("(<@&?[0-9]*>)|(@everyone|@here)").unwrap(); @@ -105,6 +134,8 @@ pub(crate) async fn lfg( } } + + if let Err(why) = ctx .send(|m| { m.content(reply) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index aaf7aa8..5bd5535 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,4 +1,2 @@ pub(crate) mod lfg; -pub(crate) mod round; -pub(crate) mod zombies; pub(crate) mod xd; diff --git a/src/commands/round.rs b/src/commands/round.rs deleted file mode 100644 index c6dee02..0000000 --- a/src/commands/round.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::{Context, Error}; -use crate::commands::{ - lfg::{ - *, - Map::{*} - }, - zombies::rounds -}; -use crate::commands::zombies::rounds::get_round_string; - -#[poise::command(slash_command)] -pub(crate) async fn round( - ctx: Context<'_>, - map: Map, - - #[min = 1_u8] - #[max = 105_u8] - round: u8 -) -> Result<(), Error> { - - let t = get_round_string(map,round); - - ctx.say(t).await?; - Ok(()) -} diff --git a/src/commands/zombies/gear.rs b/src/commands/zombies/gear.rs deleted file mode 100644 index 225e765..0000000 --- a/src/commands/zombies/gear.rs +++ /dev/null @@ -1,147 +0,0 @@ -use crate::commands::zombies::gear::{ - Weapon::{*}, - WeaponMaterial::{Wood, Stone}, - ArmorPiece::{*}, - ArmorMaterial::{Chainmail, Leather}, -}; - -pub type Enchanted = bool; -pub type Armor = [ArmorPiece; 4]; -pub type Damage = u8; -pub type ArmorValue = u8; -pub type SkinId = u8; -pub type LeatherColor = u32; -#[derive(Debug)] -pub enum ArmorPiece { - None, - Helmet(ArmorValue, Enchanted, ArmorMaterial), - Head(ArmorValue, Enchanted, SkinId), - Chestplate(ArmorValue, Enchanted, ArmorMaterial), - Leggings(ArmorValue, Enchanted, ArmorMaterial), - Boots(ArmorValue, Enchanted, ArmorMaterial) -} - -impl ArmorPiece { - pub fn armor_value(&self) -> &ArmorValue { - match self { - ArmorPiece::None => &0, - Helmet(value, _, _) => value, - Head(value, _, _) => value, - Chestplate(value, _, _) => value, - Leggings(value, _, _) => value, - Boots(value, _, _) => value - } - } - pub fn is_enchanted(&self) -> &Enchanted { - match self { - ArmorPiece::None => &false, - Helmet(_, enchanted, _) => enchanted, - Head(_, enchanted, _) => enchanted, - Chestplate(_, enchanted, _) => enchanted, - Leggings(_, enchanted, _) => enchanted, - Boots(_, enchanted, _) => enchanted - } - } - pub fn info(&self) -> (&ArmorMaterial, &SkinId, &LeatherColor) { - match self { - None => (&ArmorMaterial::None,&0,&0), - Head(_, _, skin) => (&ArmorMaterial::None,skin,&0), - Helmet(_, _, material) => match material { - Leather(color) => (material,&0,&color), - _ => (material,&0,&0) - }, - Chestplate(_, _, material) => match material { - Leather(color) => (material,&0,&color), - _ => (material,&0,&0) - }, - Leggings(_, _, material) => match material { - Leather(color) => (material,&0,&color), - _ => (material,&0,&0) - }, - Boots(_, _, material) => match material { - Leather(color) => (material,&0,&color), - _ => (material,&0,&0) - }, - } - } -} - -#[derive(Debug)] -pub enum WeaponMaterial { - Wood, - Stone, - Gold, - Iron, - Diamond -} -#[derive(Debug)] -pub enum ArmorMaterial { - None, - Leather(LeatherColor), - Gold, - Chainmail, - Iron, - Diamond -} - -impl ArmorMaterial { - fn color(&self) -> LeatherColor { - match self { - ArmorMaterial::None => 0, - Leather(color) => color, - ArmorMaterial::Gold => 0, - Chainmail => 0, - ArmorMaterial::Iron => 0, - ArmorMaterial::Diamond => 0 - } - } -} - -#[derive(Debug)] -pub enum Weapon { - None, - Axe(Damage, Enchanted, WeaponMaterial), - Sword(Damage, Enchanted, WeaponMaterial), - - Other(Damage, Enchanted, *const str) -} - -impl Weapon { - pub fn damage(&self) -> &Damage { - match self { - Weapon::None => &0_u8, - Axe(damage, _, _) => damage, - Sword(damage, _, _) => damage, - Other(damage, _, _) => damage - } - } -} - - -//No Gear -pub const NO_HELMET: ArmorPiece = ArmorPiece::None; -pub const NO_CHESTPLATE: ArmorPiece = ArmorPiece::None; -pub const NO_LEGGINGS: ArmorPiece = ArmorPiece::None; -pub const NO_BOOTS: ArmorPiece = ArmorPiece::None; -pub const GOLDEN_CHESTPLATE: ArmorPiece = Chestplate(5,false,ArmorMaterial::Gold); -pub const GOLDEN_LEGGINGS: ArmorPiece = Leggings(3,false,ArmorMaterial::Gold); -pub const GOLDEN_BOOTS: ArmorPiece = Boots(1,false,ArmorMaterial::Gold); -pub const CHAIN_CHESTPLATE: ArmorPiece = Chestplate(5,false,Chainmail); -pub const CHAIN_LEGGINGS: ArmorPiece = Leggings(4,false,Chainmail); -pub const CHAIN_BOOTS: ArmorPiece = Boots(1, false, Chainmail); -pub const SLIME_HEAD: ArmorPiece = Head(0,false,0); -pub const WERE_HEAD: ArmorPiece = Head(0,false,1); -pub const LILY_HEAD: ArmorPiece = Head(0,false,2); - - -//Weapons -pub const NO_WEAPON: Weapon = Weapon::None; -pub const WOODEN_AXE: Weapon = Axe(3,false,Wood); -pub const STONE_AXE: Weapon = Axe(4,false,Stone); -pub const DIAMOND_AXE: Weapon = Axe(6,false,WeaponMaterial::Diamond); -pub const GOLD_SWORD: Weapon = Sword(4,false,WeaponMaterial::Gold); -pub const STONE_SWORD: Weapon = Sword(5,false,Stone); -pub const IRON_SWORD: Weapon = Sword(6,false,WeaponMaterial::Iron); -pub const DIAMOND_SWORD: Weapon = Sword(7,false,WeaponMaterial::Diamond); -pub const SLIME_BALL: Weapon = Other(0, true, "Slime Ball"); - diff --git a/src/commands/zombies/mod.rs b/src/commands/zombies/mod.rs deleted file mode 100644 index d6a125d..0000000 --- a/src/commands/zombies/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod gear; -pub(crate) mod rounds; -pub mod zombies; diff --git a/src/commands/zombies/rounds.rs b/src/commands/zombies/rounds.rs deleted file mode 100644 index d5ea79c..0000000 --- a/src/commands/zombies/rounds.rs +++ /dev/null @@ -1,411 +0,0 @@ -use std::fmt::format; -use crate::commands::lfg::Map; -use crate::commands::zombies::zombies::*; - -type Wave<'a> = Vec>; -pub(crate) type Round<'a> = Vec>; - -struct BadBlood; - -impl BadBlood { - fn round1<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_Z_1, - count: 4, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_Z_1, - count: 5, - } - ] - ] - } - fn round2<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_Z_1, - count: 4, - }, - Horde { - zombie: BB_SZ_1, - count: 1, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_Z_2, - count: 4, - }, - Horde { - zombie: BB_SZ_1, - count: 2, - } - ] - ] - } - fn round3<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_Z_2, - count: 4, - }, - Horde { - zombie: BB_SZ_1, - count: 3, - }, - Horde { - zombie: BB_S_1, - count: 2, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_Z_2, - count: 3, - }, - Horde { - zombie: BB_SZ_1, - count: 2, - }, - Horde { - zombie: BB_S_1, - count: 2, - } - ] - ] - } - fn round4<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_Z_3, - count: 4, - }, - Horde { - zombie: BB_SZ_1, - count: 2, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_Z_3, - count: 3, - }, - Horde { - zombie: BB_SZ_1, - count: 1, - }, - Horde { - zombie: BB_WI_1, - count: 2, - } - ], - //wave 3 - vec![ - Horde { - zombie: BB_Z_3, - count: 3, - }, - Horde { - zombie: BB_SZ_1, - count: 1, - }, - Horde { - zombie: BB_S_1, - count: 2, - } - ] - ] - } - fn round5<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_WO_1, - count: 3, - }, - Horde { - zombie: BB_WW_1, - count: 1, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_WO_1, - count: 3, - }, - Horde { - zombie: BB_WW_1, - count: 1, - } - ], - //wave 3 - vec![ - Horde { - zombie: BB_WO_1, - count: 2, - }, - Horde { - zombie: BB_WW_1, - count: 1, - }, - Horde { - zombie: BB_LILY, - count: 1, - }, - Horde { - zombie: BB_ELLIE, - count: 1, - } - ] - ] - } - fn round6<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_Z_4, - count: 4, - }, - Horde { - zombie: BB_WI_1, - count: 3, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_Z_4, - count: 3, - }, - Horde { - zombie: BB_WI_1, - count: 2, - } - ], - //wave 3 - vec![ - Horde { - zombie: BB_Z_4, - count: 3, - }, - Horde { - zombie: BB_WI_1, - count: 2, - }, - ] - ] - } - fn round7<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_S_1, - count: 3, - }, - Horde { - zombie: BB_WI_1, - count: 3, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_S_1, - count: 3, - }, - Horde { - zombie: BB_WI_1, - count: 3, - } - ], - //wave 3 - vec![ - Horde { - zombie: BB_S_1, - count: 3, - }, - Horde { - zombie: BB_WI_1, - count: 3, - }, - ] - ] - } - fn round8<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_Z_5, - count: 4, - }, - Horde { - zombie: BB_P_1, - count: 2, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_Z_5, - count: 4, - }, - Horde { - zombie: BB_P_1, - count: 2, - } - ], - //wave 3 - vec![ - Horde { - zombie: BB_Z_5, - count: 4, - }, - Horde { - zombie: BB_P_1, - count: 1, - }, - ] - ] - } - fn round9<'a>() -> Round<'a> { - vec![ - //wave 1 - vec![ - Horde { - zombie: BB_SZ_1, - count: 3, - }, - Horde { - zombie: BB_S_1, - count: 5, - } - ], - //wave 2 - vec![ - Horde { - zombie: BB_SZ_1, - count: 3, - }, - Horde { - zombie: BB_S_1, - count: 4, - } - ], - //wave 3 - vec![ - Horde { - zombie: BB_SZ_1, - count: 3, - }, - Horde { - zombie: BB_S_1, - count: 4, - }, - ] - ] - } - fn get_round<'b>(round: u8) -> Option> { - match round { - 1 => Some(Self::round1()), - 2 => Some(Self::round2()), - 3 => Some(Self::round3()), - 4 => Some(Self::round4()), - 5 => Some(Self::round5()), - 6 => Some(Self::round6()), - 7 => Some(Self::round7()), - 8 => Some(Self::round8()), - 9 => Some(Self::round9()), - _ => None - } - } -} - -pub(crate) fn get_round<'a>( - map: &Map, - round: u8, -) -> Option> { - match map { - Map::DeadEnd => BadBlood::get_round(round), - Map::BadBlood => BadBlood::get_round(round), - Map::AlienArcadium => BadBlood::get_round(round) - } -} - -pub(crate) fn get_round_string ( - map: Map, - r: u8) -> String { - let round = get_round(&map, r); - if round.is_some() { - let mut string = String::new(); - let mut wave_index:u8 = 0; - for wave in round.unwrap() { - wave_index += 1; - - string.push_str(format!("# Wave {}\n", wave_index).as_str()); - for horde in wave { - string.push_str(format!( - "### {}x {} {}\n", - horde.count, - horde.zombie.family(), - horde.zombie.tier - ).as_str()); - let mut armor_string = String::new(); - let armor = *horde.zombie.armor(); - let (x,y,z) = armor.get(0).unwrap(); - let (x,_,z) = armor.get(1).unwrap(); - let (x,_,z) = armor.get(2).unwrap(); - let (x,_,z) = armor.get(3).unwrap(); - armor_string.push_str(""); - - - string.push_str(format!( - "- Health: {}\n- Damage: {}\n- Armor: {} {:?}\n- Follow Range: {}\n- Speed: {}\n", - horde.zombie.health(), - horde.zombie.damage().1, - horde.zombie.armor_value(), - horde.zombie.armor(), - horde.zombie.follow_range(), - horde.zombie.speed, - ).as_str()); - } - } - string - } else { - String::from(format!("There is no Round {} on the Map {}", r, &map)) - } - -} - - - - - - - - - - - - - - diff --git a/src/commands/zombies/zombies.rs b/src/commands/zombies/zombies.rs deleted file mode 100644 index 5cec8d0..0000000 --- a/src/commands/zombies/zombies.rs +++ /dev/null @@ -1,368 +0,0 @@ -use crate::commands::zombies::gear::{ - *, - ArmorMaterial::*, - ArmorPiece::*, - Weapon::* -}; - -type ChildrenCount = u8; -type RespawningChildren = bool; -#[derive(Debug)] -pub struct Family<'a> { - name: &'a str, - damage: u8, - health: u16, - follow_range: u8, - base_armor: u8, -} -#[derive(Debug)] -pub struct Zombie<'a> { - family: &'a Family<'a>, - pub tier: u8, - - pub speed: f32, - armor: &'a Armor, - weapon: &'a Weapon, - children: Children<'a>, - damage_type: DamageType, -} -#[derive(Debug)] -pub enum Children<'a> { - None, - Single(&'a Horde<'a>, RespawningChildren), -} -#[derive(Debug)] -pub enum Ability { - Single(*const str), - Double(*const str, *const str), -} -#[derive(Debug)] -pub enum DamageType { - Melee, - Ranged, - Ability(Ability), - MeleeRanged, - MeleeAbility(Ability), - RangedAbility(Ability), -} -impl Zombie<'_> { - pub fn health(&self) -> u16 { - self.family.health - } - pub fn damage(&self) -> (&DamageType, Damage) { - (&self.damage_type, self.family.damage + self.weapon.damage()) - } - pub fn follow_range(&self) -> u8 { - self.family.follow_range - } - pub fn armor_value(&self) -> (ArmorValue) { - let mut armor = self.family.base_armor; - for piece in self.armor { - armor += piece.armor_value(); - } - (armor) - } - pub fn armor(&self) -> [(&ArmorMaterial, &SkinId, &LeatherColor);4] { - let mut t:[(&ArmorMaterial, &SkinId, &LeatherColor);4] = [(&ArmorMaterial::None, &0, &0);4]; - let mut index = 0; - for piece in self.armor { - t[index] = piece.info(); - index +=1; - } - t - } - pub fn speed(&self) -> f32 { - self.speed - } - pub fn family(&self) -> &str { - self.family.name - } -} - -#[derive(Debug)] -pub struct Horde<'a> { - pub zombie: Zombie<'a>, - pub count: u8, -} - -pub const BB_BASIC: Family = Family { - name: "basic", - damage: 3, - health: 22, - follow_range: 35, - base_armor: 2, -}; -pub const BB_SLIME_ZOMBIE: Family = Family { - name: "slime_zombie", - damage: 3, - health: 22, - follow_range: 35, - base_armor: 2, -}; -pub const BB_SLIME: Family = Family { - name: "slime", - damage: 0, - health: 4, - follow_range: 16, - base_armor: 2, -}; -pub const BB_WITCH: Family = Family { - name: "witch", - damage: 2, - health: 20, - follow_range: 16, - base_armor: 0, -}; -pub const BB_WOLF: Family = Family { - name: "wolf", - damage: 4, - health: 16, - follow_range: 16, - base_armor: 0, -}; -pub const BB_WEREWOLF: Family = Family { - name: "werewolf", - damage: 3, - health: 32, - follow_range: 35, - base_armor: 2, -}; -pub const BB_PIGMAN: Family = Family { - name: "pigman", - damage: 5, - health: 20, - follow_range: 35, - base_armor: 2, -}; - -pub const BB_Z_1: Zombie = Zombie { - family: &BB_BASIC, - tier: 1, - - speed: 0.25, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - NO_LEGGINGS, - NO_BOOTS, - ], - weapon: &NO_WEAPON, - children: Children::None, - damage_type: DamageType::Melee, -}; -pub const BB_Z_2: Zombie = Zombie { - family: &BB_BASIC, - tier: 2, - - speed: 0.25, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - Leggings(2,false,Leather(0x000000)), - NO_BOOTS, - ], - weapon: &NO_WEAPON, - children: Children::None, - damage_type: DamageType::Melee, -}; -pub const BB_Z_3: Zombie = Zombie { - family: &BB_BASIC, - tier: 3, - - speed: 0.25, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - Leggings(2,false,Leather(0x000000)), - NO_BOOTS, - ], - weapon: &WOODEN_AXE, - children: Children::None, - damage_type: DamageType::Melee, -}; -pub const BB_Z_4: Zombie = Zombie { - family: &BB_BASIC, - tier: 4, - - speed: 0.25, - armor: &[ - NO_HELMET, - Chestplate(3,false,Leather(0x000000)), - Leggings(2,false,Leather(0x000000)), - NO_BOOTS, - ], - weapon: &WOODEN_AXE, - children: Children::None, - damage_type: DamageType::Melee, -}; -pub const BB_Z_5: Zombie = Zombie { - family: &BB_BASIC, - tier: 5, - - speed: 0.25, - armor: &[ - NO_HELMET, - Chestplate(3,false,Leather(0x000000)), - Leggings(2,false,Leather(0x000000)), - Boots(1,false,Leather(0x000000)), - ], - weapon: &WOODEN_AXE, - children: Children::None, - damage_type: DamageType::Melee, -}; -pub const BB_Z_6: Zombie = Zombie { - family: &BB_BASIC, - tier: 6, - - speed: 0.26, - armor: &[ - NO_HELMET, - Chestplate(3,false,Leather(0x000000)), - Leggings(2,false,Leather(0x000000)), - Boots(1,false,Leather(0x000000)), - ], - weapon: &STONE_AXE, - children: Children::None, - damage_type: DamageType::Melee, -}; - -pub const BB_SZ_1: Zombie = Zombie { - family: &BB_SLIME_ZOMBIE, - tier: 1, - - speed: 0.3, - armor: &[ - SLIME_HEAD, - Chestplate(3,false,Leather(0x55FF55)), - Leggings(2,false,Leather(0x55FF55)), - Boots(1,false,Leather(0x55FF55)), - ], - weapon: &SLIME_BALL, - children: Children::None, - damage_type: DamageType::Melee, -}; - -pub const BB_S_1: Zombie = Zombie { - family: &BB_SLIME, - tier: 1, - - speed: 0.36, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - NO_LEGGINGS, - NO_BOOTS, - ], - weapon: &NO_WEAPON, - children: Children::None, - damage_type: DamageType::Melee, -}; - -pub const BB_WI_1: Zombie = Zombie { - family: &BB_WITCH, - tier: 1, - - speed: 0.25, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - NO_LEGGINGS, - NO_BOOTS, - ], - weapon: &NO_WEAPON, - children: Children::None, - damage_type: DamageType::Ability(Ability::Double("splash potion of Harming", "splash potion of Poison")), -}; - -pub const BB_WO_1: Zombie = Zombie { - family: &BB_WOLF, - tier: 1, - - speed: 0.36, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - NO_LEGGINGS, - NO_BOOTS, - ], - weapon: &NO_WEAPON, - children: Children::None, - damage_type: DamageType::Melee, -}; - -pub const BB_WW_1: Zombie = Zombie { - family: &BB_WEREWOLF, - tier: 1, - - speed: 0.3, - armor: &[ - WERE_HEAD, - Chestplate(3,false,Leather(0x555555)), - Leggings(2,false,Leather(0x555555)), - Boots(1,false,Leather(0x555555)), - ], - weapon: &STONE_SWORD, - children: Children::None, - damage_type: DamageType::Melee, -}; -pub const BB_P_1: Zombie = Zombie { -family: &BB_PIGMAN, - tier: 1, - - speed: 0.33, - armor: &[ - NO_HELMET, - GOLDEN_CHESTPLATE, - GOLDEN_LEGGINGS, - GOLDEN_BOOTS, - ], - weapon: &GOLD_SWORD, - children: Children::None, - damage_type: DamageType::Melee, -}; - - - -pub const BB_LILY: Zombie = Zombie { - family: &Family { - name: "bb_lore", - damage: 3, - health: 55, - follow_range: 35, - base_armor: 2, - }, - tier: 1, - speed: 0.3, - armor: &[ - LILY_HEAD, - CHAIN_CHESTPLATE, - CHAIN_LEGGINGS, - CHAIN_BOOTS - ], - weapon: &STONE_SWORD, - children: Children::Single(&Horde { - zombie: BB_ELLIE, - count: 1, - }, false), - damage_type: DamageType::Melee, -}; -pub const BB_ELLIE: Zombie = Zombie { - family: &Family { - name: "bb_lore", - damage: 4, - health: 30, - follow_range: 16, - base_armor: 0, - }, - tier: 0, - speed: 0.38, - armor: &[ - NO_HELMET, - NO_CHESTPLATE, - NO_LEGGINGS, - NO_BOOTS, - ], - weapon: &NO_WEAPON, - children: Children::None, - damage_type: DamageType::MeleeAbility(Ability::Single("poop")), -}; diff --git a/src/main.rs b/src/main.rs index 1c2576d..f2370e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,14 +30,11 @@ async fn poise( ) -> ShuttlePoise { let options = poise::FrameworkOptions { -/* -COMMANDS: -*/ commands: vec![ commands::lfg::lfg(), - commands::round::round(), commands::xd::xd(), ], + manual_cooldowns: true, prefix_options: poise::PrefixFrameworkOptions { prefix: Some("~".into()), ..Default::default()