diff --git a/crates/benilla-app/src/ui_unit.rs b/crates/benilla-app/src/ui_unit.rs index ca9a1971..1734b066 100644 --- a/crates/benilla-app/src/ui_unit.rs +++ b/crates/benilla-app/src/ui_unit.rs @@ -542,13 +542,14 @@ pub(crate) fn race_faction_group(race: u8) -> Option<&'static str> { /// never the live template: `ChrRaces.dbc` field 2 to `FactionTemplate.dbc` field 3's group mask, /// `& 4` Horde, else `& 2` Alliance, so a template-35 GM keeps his rank title. Read by /// `GetPVPRankInfo` (`0x51a9af`, `0x51a9c8`), `UnitPVPName` (`0x5efe60`) and the scoreboard -/// (`0x4aa200`). A frozen copy of the shipped nine rows; race 9 (Goblin) answers Alliance. +/// (`0x4aa200`). A frozen copy of TurtleWoW's ten rows; race 9 (Goblin, template 1609, mask 5) +/// answers Horde and race 10 (Blood Elf, 1610, mask 3) Alliance. pub(crate) fn race_pvp_team(race: u8) -> i8 { match race { // Group mask 3, Player|Alliance: `& 4` clear, `& 2` set. - 1 | 3 | 4 | 7 | 9 => 1, + 1 | 3 | 4 | 7 | 10 => 1, // Group mask 5, Player|Horde: `& 4` set, tested first. - 2 | 5 | 6 | 8 => 0, + 2 | 5 | 6 | 8 | 9 => 0, // No `ChrRaces` row: the engine's bounds-failure `-1`, which names no GlobalString. _ => -1, } @@ -1714,14 +1715,18 @@ mod tests { let data = benilla_formats::wow_data_or_skip!(); let mut chain = benilla_formats::open_chain(&data).expect("open chain"); let want = benilla_formats::load_race_pvp_teams(&mut chain).expect("ChrRaces walk"); - // 1.12 ships nine rows; a truncated map would pass by asserting nothing. - assert_eq!(want.len(), 9, "ChrRaces.dbc row count"); + // TurtleWoW ships ten rows (its Goblin 9 and Blood Elf 10 added to the stock eight); a + // truncated map would pass by asserting nothing. + assert_eq!(want.len(), 10, "ChrRaces.dbc row count"); for (&race, &team) in &want { assert_eq!(race_pvp_team(race), team, "race {race}"); } assert!(want.values().any(|&t| t == 0), "some race is Horde"); assert!(want.values().any(|&t| t == 1), "some race is Alliance"); - for race in [0u8, 10, 255] { + // A custom race's team is the DBC's, not a guess: Goblin is Horde, Blood Elf Alliance. + assert_eq!(want.get(&9), Some(&0), "Goblin, Horde"); + assert_eq!(want.get(&10), Some(&1), "Blood Elf, Alliance"); + for race in [0u8, 11, 255] { assert!(!want.contains_key(&race)); assert_eq!(race_pvp_team(race), -1, "race {race} has no ChrRaces row"); }