Until now this repo was an export of a private tree, pushed as squashed snapshots. From here on it is the working tree itself, and the private repo is archived. The root holds AGENTS.md and the Rust and GitHub files only. Everything an agent needs to orient is in docs/: METHOD.md (the rules and how the project is built, 123 lines, project method only), MAP.md (generated from the code at every land) and CONTRIBUTING.md (what gets in and how a change is judged). One skill, `probe`, holds the procedure for running the client unattended against the local server. Brought over because the project needs it: reference/ (the 1.12 name catalogues 34 source files read; the export failed its own tests without them), the gate chain and the pool (scripts/), the hooks that enforce the install rule and the worktree rule, the full .gitignore, the `cargo play` alias, and the original wording of eleven source files the export had reworded. Left out: the decision records (archived with the private repo), the export tooling, the operator's Discord and triage loop, the lab-laptop scripts and the instruments nothing references, which live outside the repo now. What read the records is gone from the tooling: no corpus lint, no records index, no `reserve` verb, no number-collision check. Three hooks are gone: fmt-at-commit and the file-size nudge were redundant with the gates, and the assets/ui guard is now a test (`assets_ui_does_not_grow`) that fails for everyone, not only for a Claude Code session. The remaining pool hooks stand down on a machine without a pool. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
82 lines
3.4 KiB
Rust
82 lines
3.4 KiB
Rust
//! Diagnostic probe: stream object creates and print each unit's decoded
|
|
//! `UNIT_FIELD_FACTIONTEMPLATE` (+ level/display id as sanity anchors), to check the descriptor
|
|
//! decode against the server DB's `creature_template.faction`.
|
|
//!
|
|
//! Run: `cargo run -p benilla-protocol --example faction_probe -- probeN pprobeN [host]`
|
|
//! — the slot-keyed probe account (docs/METHOD.md "The local vmangos server"). The account is a
|
|
//! REQUIRED arg with no default: a default was once `one`, the director's account, where a
|
|
//! probe login kicks their live session (decision 0530).
|
|
|
|
use std::time::{Duration, Instant};
|
|
|
|
use anyhow::{Context, Result};
|
|
use benilla_protocol::{decode, EntityKind, SessionEvent, WorldSession, WORLD_PORT};
|
|
|
|
fn main() -> Result<()> {
|
|
let mut args = std::env::args().skip(1);
|
|
let user = args
|
|
.next()
|
|
.context("usage: faction_probe -- <probeN> <pprobeN> [host] (slot-keyed account)")?;
|
|
let pass = args
|
|
.next()
|
|
.context("usage: faction_probe -- <probeN> <pprobeN> [host] (slot-keyed account)")?;
|
|
let host = args.next().unwrap_or_else(|| "localhost".into());
|
|
|
|
let logon = benilla_protocol::logon(&host, &user, &pass)?;
|
|
let world_addr = logon
|
|
.realms
|
|
.first()
|
|
.map(|r| r.address.clone())
|
|
.unwrap_or_else(|| format!("{host}:{WORLD_PORT}"));
|
|
let mut session = WorldSession::connect(&world_addr, &user, logon.session_key)?;
|
|
let characters = session.char_enum()?;
|
|
let character = characters.first().context("no characters")?;
|
|
let self_guid = character.guid;
|
|
println!("logging in '{}' (guid {self_guid})", character.name);
|
|
session.player_login(self_guid)?;
|
|
session.set_active_mover(self_guid)?;
|
|
session.set_read_timeout(Some(Duration::from_secs(2)))?;
|
|
|
|
let deadline = Instant::now() + Duration::from_secs(8);
|
|
while Instant::now() < deadline {
|
|
let Ok(msg) = session.recv() else { continue };
|
|
for ev in decode(msg) {
|
|
match ev {
|
|
SessionEvent::ObjectCreate {
|
|
guid,
|
|
kind,
|
|
display_id,
|
|
fields,
|
|
..
|
|
} if matches!(kind, EntityKind::Unit | EntityKind::Player) => {
|
|
let me = if guid == self_guid { " (self)" } else { "" };
|
|
println!(
|
|
"{kind:?} guid={guid}{me} display={display_id:?} level={:?} faction_tpl={:?}",
|
|
fields.unit_level(),
|
|
fields.unit_faction_template(),
|
|
);
|
|
}
|
|
SessionEvent::ObjectValues { guid, fields } => {
|
|
if let Some(f) = fields.unit_faction_template() {
|
|
println!("Values guid={guid} faction_tpl={f}");
|
|
}
|
|
}
|
|
SessionEvent::Reputations { standings } => {
|
|
let set: Vec<(usize, u8, i32)> = standings
|
|
.iter()
|
|
.enumerate()
|
|
.filter(|(_, &(f, s))| f != 0 || s != 0)
|
|
.map(|(i, &(f, s))| (i, f, s))
|
|
.collect();
|
|
println!(
|
|
"Reputations: {} slots, non-zero (idx, flags, standing): {set:?}",
|
|
standings.len()
|
|
);
|
|
}
|
|
_ => {}
|
|
}
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|