Crate tentacli

source ·
Expand description

TentaCLI is embeddable, extendable console client for WoW 3.3.5a server.

You can use it directly by compiling with cargo build, or you can incorporate it as a library in your own application. TentaCLI accepts external broadcast channel (async_broadcast crate), so you can connect it with the rest of your application. Also you can implement own feature set and pass it to the run() method. See Feature trait and RunOptions.

What this client can do:

  • it can parse basic packet set, such as SMSG_MESSAGECHAT or SMSG_UPDATE_OBJECT
  • it allows you to login on any server, but you can enter the world only on servers without Warden anti-cheat
  • you can use autoselect options in config file to set default Realm/Character and avoid the step of selecting this data manually
  • if installed with ui feature (installed by default), it allows scrolling the packets history using keyboard and seeing the details for each packet
  • if installed with console feature, it will display only minimal output
  • if installed without any feature, client will output nothing (but you still can provide own output feature)

§Examples

use tokio::task::JoinHandle;

use tentacli::async_broadcast::{BroadcastSender, BroadcastReceiver};
use tentacli::{Client, RunOptions};
use tentacli_traits::Feature;
use tentacli_traits::types::HandlerOutput;

#[tokio::main]
async fn main() {
    pub struct MyFeature {
        _receiver: Option<BroadcastReceiver<HandlerOutput>>,
        _sender: Option<BroadcastSender<HandlerOutput>>,
    }

    impl Feature for MyFeature {
        fn new() -> Self where Self: Sized {
            Self {
                _receiver: None,
                _sender: None,
            }
        }

        fn set_broadcast_channel(
            &mut self,
            sender: BroadcastSender<HandlerOutput>,
            receiver: BroadcastReceiver<HandlerOutput>
        ) {
            self._sender = Some(sender);
            self._receiver = Some(receiver);
        }

        fn get_tasks(&mut self) -> Vec<JoinHandle<()>> {
            let mut receiver = self._receiver.as_mut().unwrap().clone();

            let handle_smth = || {
                tokio::spawn(async move {
                    loop {
                        if let Ok(output) = receiver.recv().await {
                            match output {
                                HandlerOutput::SuccessMessage(message, _) => {
                                    println!("{}", message);
                                }
                                _ => {}
                            }
                        }
                    }
                })
            };

            vec![handle_smth()]
        }
    }

    let options = RunOptions {
        external_features: vec![Box::new(MyFeature::new())],
        account: "account_name",
        config_path: "./dir/another_dir/ConfigFileName.yml",
        dotenv_path: "./path/to/.env"
    };

    // ... pass options to the client
    // Client::new().run(options).await.unwrap();
}

Modules§

Structs§