use super::net::cheats::{Decoded, response};
use crate::net::cheats::{CheatsOptions, ClientCheats};
use crate::net::incoming::Verdict;
use crate::players::UserId;
use std::ffi::{CStr, c_int};
pub const fn cheats() -> ClientCheats {
ClientCheats::new(CheatsOptions::DEFAULT)
}
pub fn confirm(cheats: &mut ClientCheats, user_id: UserId, cookie: c_int) -> Verdict {
cheats.on_response(user_id, &response(cookie, 0, c"1"))
}
pub fn spoof(cookie: c_int, commands: &[&CStr]) -> Vec<Decoded> {
let mut messages = vec![Decoded::SetConVar(vec![(c"sv_cheats".into(), c"1".into())])];
messages.extend(
commands
.iter()
.map(|&command| Decoded::StringCmd(command.into())),
);
messages.push(Decoded::Query(cookie, c"sv_cheats".into()));
messages
}