mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-22 19:25:56 +00:00
Phase 7a: real population (players vs companions), hardware-aware companion sizes, RA bot spawn, Bots page card
Verified: fixture received 'botcmd spawnleveled 12' over RA from the UI and the counts moved; population query also read-only verified against the live server (33 companions online). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
981ee4d4d9
commit
9504e9133b
9 files changed
+351
-3
No files matched your search
@@ -85,6 +85,15 @@ impl Ra {
|
||||
}
|
||||
}
|
||||
|
||||
/// Ask the bot module to create `count` leveling bots (throttled by the module itself). Only a number is sent.
|
||||
pub fn spawn_bots(&mut self, count: u32) -> Result<String> {
|
||||
if !(1..=2000).contains(&count) {
|
||||
return Err(Error::Invalid("Choose between 1 and 2000 companions.".into()));
|
||||
}
|
||||
let out = self.command(&format!("botcmd spawnleveled {count}"))?;
|
||||
Ok(out.lines().last().unwrap_or("").to_string())
|
||||
}
|
||||
|
||||
/// Give `name` administrator rights on all realms (GM level 3).
|
||||
pub fn make_administrator(&mut self, name: &str) -> Result<()> {
|
||||
validate_account(name, "placeholder")?;
|
||||
@@ -150,6 +159,16 @@ mod tests {
|
||||
assert_eq!(h.join().unwrap(), ["local", "secretra", "account create Player1 hunter22"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spawn_bots_sends_only_a_bounded_number() {
|
||||
let (port, h) = fake_ra("Queued 50 bots");
|
||||
let mut ra = Ra::connect_to(port, "u", "p").unwrap();
|
||||
assert_eq!(ra.spawn_bots(50).unwrap(), "Queued 50 bots");
|
||||
assert!(ra.spawn_bots(0).is_err() && ra.spawn_bots(5000).is_err());
|
||||
drop(ra);
|
||||
assert_eq!(h.join().unwrap()[2], "botcmd spawnleveled 50");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duplicate_account_and_input_validation() {
|
||||
let (port, _h) = fake_ra("Account already exist.");
|
||||
|
||||
Reference in new issue
Block a user