Files
moonwell-client-core/crates/benilla-protocol/examples/faction_probe.rs
T
sindoring d1961e79fc Sync upstream through b2473e60 and retain ruRU (#8)
Integrate 182 upstream commits through b2473e60 while retaining MoonWell packaging, branding and the community ruRU pack.

Upstream replaces the C Lua/mlua host with benilla-lua/benilla-mlua and the native glue screens with stock GlueXML. The update also includes the new locale/DBC/name rules, cache and interaction handling, rendering, quest log and chat behavior, including the latest quest completion and timed-quest failure fixes. Fork adaptations use the new APIs: stock Wow.ini locales remain intact, while the ruRU overlay reads column zero and retains its ruRU authentication tag and Lua identity. Russian names keep their twelve-letter policy and Unicode roster matching; fonts, spell costs, race/class labels and translated options retain real-pack regression coverage.

Windows regression fixes keep the locale-default test valid under instrumented window overrides and the shader assertion independent of checkout line endings. The original C Lua 5.1 host, rebuilt from c0630f3d in an isolated directory, reproduces the complete Windows cos-sweep answer byte for byte; cos now uses platform-specific goldens.

Validation on Windows: scripts/gates.sh passed all automatic gates, including real-data and no-install workspace tests, reference tables, documentation, message catalog, render-pass lint, player clippy/tests and engine boots with and without data. MoonWell player clippy also passed with -D warnings. The committed tree exactly matches the full green stamp; five vendored Kira files retain the tested checkout's line endings, with normalized contents unchanged. All three actual ruRU pack regressions passed in both builds. Fifteen test archives were restored read-only from the published client and SHA-256 checked.

Each real-data/player rung skipped 31 tests because the optional addon corpus is absent (24 general, 7 Quiver). Live smoke was not run: no declared probe account; no player-account login or character creation was performed. Linux/macOS changes were not locally built.
2026-10-17 21:10:31 +03:00

84 lines
3.3 KiB
Rust

//! Diagnostic probe: prints each streamed unit's `UNIT_FIELD_FACTIONTEMPLATE`, with level and
//! display id, to check the descriptor decode against `creature_template.faction`.
//!
//! Run: `cargo run -p benilla-protocol --example faction_probe -- probeN <password> [host]`. The
//! account has no default, because a login kicks whoever is on the account.
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> <password> [host] (a probe account)")?;
let pass = args
.next()
.context("usage: faction_probe -- <probeN> <password> [host] (a probe account)")?;
let host = args.next().unwrap_or_else(|| "localhost".into());
let logon = benilla_protocol::logon(
&host,
&user,
&pass,
benilla_protocol::auth::LOCALE_TAG_EN_US,
)?;
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(())
}