commit 2fc98f24ed5ca2af09cc29b5b8036873cb11da4b
parent c3f9ca4d75a70f88d00362e9ed2d072fbe145234
Author: anon <anon@example.com>
Date: Tue, 10 Nov 2026 08:30:47 +0000
Extend best-effort NPC outfits across reviewed roles
Diffstat:
8 files changed, 251 insertions(+), 19 deletions(-)
diff --git a/docs/npc-appearances.md b/docs/npc-appearances.md
@@ -10,6 +10,8 @@ are `[attachment slot, mesh, texture override, layer]`. Texture categories are
hands, body, feet, arms and legs (0 through 4). Every entry carries a source
comment distinguishing original-post matches, cross-zone and cross-role inferences.
The population generator preserves these fields from the maintained YAMLs.
+Reviewed role defaults additionally supply 75 military visual lists when zones
+load; explicit per-post visuals and item outfits take precedence.
| Original population code | Assigned NPCs | Appearance |
| --- | ---: | --- |
@@ -17,6 +19,8 @@ The population generator preserves these fields from the maintained YAMLs.
| MALI | 52 | Solitus male lieutenant, Elite armor, helmet and plasma weapon |
| FECA | 8 | Opifex female captain, matching Elite uniform and weapon; female head and helmet |
| FELI | 15 | Solitus female lieutenant, matching Elite uniform and weapon; female head and helmet |
+| FECO / MACO | 25 / 21 | Corporals, best-effort captain uniform and weapon with body-specific heads and helmets |
+| FEEL / MAEL | 8 / 21 | Additional Elite Guards, best-effort Elite armor with body-specific heads and helmets |
| CSBI | 3 | Container supplier clothing and pistol |
| BQAU | 4 | Basic armor merchant clothing and pistol |
| BQPW | 3 | Basic nano merchant clothing and pistol |
@@ -85,7 +89,7 @@ the original translated consumers at runtime.
`TestRecoveredNPCVisualsSurviveReloadWithoutEquipment` checks the captain's
exact packet resources and unchanged gameplay state before and after cold
load. `TestRecoveredNPCVisualsHaveBoundedPopulationAssignments` checks the
-130 assignments and exclusions. `test_population_regeneration_preserves_recovered_visuals`
+205 visual assignments and exclusions. `test_population_regeneration_preserves_recovered_visuals`
checks that regenerating population data retains the YAML resources.
`TestBrowserNPCRecoveredAppearances` covers five representative profiles:
male and female captains and lieutenants, and a weapons dealer. It checks two
@@ -136,16 +140,62 @@ Run `go run ./tools/data/audit_npc_outfits` to audit explicit outfit coverage
independently of name/body confidence. It groups by code, body and appearance,
shows partially assigned profiles first, and gives an unassigned example for
each profile. It counts authored placements, not just currently loaded actors.
-After this fix, 157 of 6,232 human placements have explicit outfits. Absence of
-an assignment does not prove a base mesh has no clothing.
-
-The next bounded review candidates are 29 additional MAEL/FEEL Elite Guards
-and nine OFPO Food Providers: each shares a code and body with an already
-outfitted population. Guides also have 130 unassigned same-body placements
-(60 OTGD, 48 CLGD, 22 NEGD). Review those roles' existing provisional outfit
-and gameplay effects before expanding them; a shared body alone cannot assign
-an outfit to unrelated roles. Female Corporals have no dressed counterpart in
-the current data and need a separate uniform decision.
+After the female-officer fix, 157 of 6,232 human placements had assigned outfits.
+The best-effort role expansion below raises that to 419. Absence of an assignment
+does not prove a base mesh has no clothing.
+
+### Best-effort outfits across zones
+
+The Corporal report established the fallback policy: a plausible uniform from
+a related role is preferable to an undressed NPC when no distinct outfit is
+known. A bounded online search did not yield usable evidence for a separate
+Female Corporal outfit. Both corporal codes therefore borrow the captain's
+Elite textures and plasma weapon, using original body-specific heads and item
+22250 helmet variants. These are best-effort assignments, not historical claims.
+
+The audit also found exact-code, exact-body counterparts of already dressed
+NPCs. The following defaults in `server/gamedata/npc_outfits.go` now apply at
+every matching post, including posts added or regenerated later:
+
+| Population | Newly dressed placements | Basis |
+| --- | ---: | --- |
+| Female / Male Corporal (`FECO`, `MACO`) | 25 / 21 | Captain uniform; Solitus female/male helmet 20089/20106 and default head 40629/40687 |
+| Female / Atrox Elite Guard (`FEEL`, `MAEL`) | 8 / 21 | Trade guards' Elite armor; helmet 20089/20005 and default head 40629/40111 |
+| Food Provider (`OFPO`) | 9 | Same code and body as the two Trade providers; white uniform |
+| Omni / Neutral guides (`OTGD`, `NEGD`) | 60 / 22 | Same code and body as the training guides; white uniform |
+| Clan guides (`CLGD`) | 48 | Same code and body as the Clan training guide; rustic clothing |
+| Diversionist / Informer (`H320`, `H476`) | 3 / 29 | Same code and body as the dressed training opponents; rustic clothing |
+| Mercenary/resident populations (`H410`, `H660`) | 3 / 13 | Same code and body as the dressed training mercenaries; rustic clothing |
+
+The 262 additions are guarded by population code and MonsterData, rather than
+display name or body alone. Explicit outfits remain authoritative. The seven
+item-equipped Trade guards retain their armor bonuses; the 29 added guards
+use appearance-only armor and retain their existing combat behavior. They
+receive no weapon beyond their reference outfit. Corporals' visible guns add
+no weapon stats. Civilian garments have no armor bonuses or transferable item
+identities. No additional populations gain combat support or loot.
+
+`TestOfficerUniformsCoverBothSexesAtEveryPost`,
+`TestReviewedCivilianOutfitsCoverEveryPlacement` and
+`TestEliteGuardVisualsFillUnassignedPosts` check all reviewed codes and counts.
+Cold-load regressions verify exact military packet resources, civilian garment
+identities, unchanged combat eligibility and zero added civilian armor.
+`TestBrowserNPCBestEffortOutfits` covers female/male corporals, an Atrox Elite
+Guard, a Food Provider, a Clan guide and an Opifex Diversionist with two clients
+and reconnect at authored placements.
+All six browser fixtures passed; inspected captures are retained under
+`local/npc-appearances/20261110-002700/`. The complete game-data suite, focused
+outfit/reload regressions and `go vet ./server/... ./tools/data/audit_npc_outfits`
+also passed. The audit confirms all twelve reviewed codes now have complete
+outfit coverage.
+
+The remaining audit entries need another role review; many `Wandering
+Mercenary` names are low-confidence fallbacks for distinct original codes.
+The same label does not establish that all of them should share one outfit.
+Generic guards and named or dungeon NPCs also need faction/role checks before
+borrowing a uniform. Reopen historical outfit research when a capture or
+template supplies actual clothing/mesh resources; the absence of such evidence
+does not block a separately reviewed best-effort assignment.
## Provisional early-route outfits
diff --git a/server/browser_npc_outfits_test.go b/server/browser_npc_outfits_test.go
@@ -34,6 +34,14 @@ func TestBrowserNPCOutfits(t *testing.T) {
"952/district/2/group/0/authored_point", "952/district/3/group/1/authored_point", "954/district/4/group/3/spread_authored_point"})
}
+func TestBrowserNPCBestEffortOutfits(t *testing.T) {
+ testBrowserNPCAppearances(t, []string{
+ "705/district/0/fixed/10", "710/district/0/fixed/4",
+ "705/district/0/fixed/16", "705/district/0/fixed/1",
+ "3100/district/1/fixed/0", "716/district/7/group/1/authored_point",
+ })
+}
+
func TestBrowserNPCCreatureAppearances(t *testing.T) {
// One original placement per distinct creature body in the three training routes.
testBrowserNPCAppearances(t, []string{
diff --git a/server/gamedata/load.go b/server/gamedata/load.go
@@ -174,6 +174,7 @@ func init() {
panic(fmt.Errorf("gamedata %s: missing or duplicate NPC group id %q", name, group.ID))
}
NPCGroups[group.ID] = group
+ applyNPCOutfit(group)
if group.ShopTemplate != 0 && len(ShopStock[group.ShopTemplate]) == 0 {
panic(fmt.Errorf("gamedata %s: NPC %q has no shop stock for %d", name, group.ID, group.ShopTemplate))
}
diff --git a/server/gamedata/npc_outfits.go b/server/gamedata/npc_outfits.go
@@ -54,3 +54,51 @@ var NPCOutfits = map[string][]NPCOutfitItem{
"952/district/3/group/1/authored_point": npcRusticOutfit,
"954/district/4/group/3/spread_authored_point": npcRusticOutfit,
}
+
+// Same-code, same-body extensions of the reviewed civilian outfits above.
+// These clothes have no armor bonuses. See docs/npc-appearances.md.
+var npcCivilianOutfits = map[string]struct {
+ monster uint32
+ items []NPCOutfitItem
+}{
+ "OFPO": {26092, npcUniformOutfit},
+ "OTGD": {26076, npcUniformOutfit},
+ "NEGD": {26076, npcUniformOutfit},
+ "CLGD": {26076, npcRusticOutfit},
+ "H320": {26135, npcRusticOutfit},
+ "H476": {26076, npcRusticOutfit},
+ "H410": {26088, npcRusticOutfit},
+ "H660": {26088, npcRusticOutfit},
+}
+
+// Best-effort uniforms: corporals borrow captain equipment; Elite Guards borrow
+// the Trade guards' armor. Helmet variants come from original item 22250.
+var npcMilitaryVisuals = map[string]struct {
+ monster, helmet, weapon uint32
+}{
+ "FECO": {26090, 20089, 35566},
+ "MACO": {26088, 20106, 35566},
+ "FEEL": {26090, 20089, 0},
+ "MAEL": {26097, 20005, 0},
+}
+
+func applyNPCOutfit(group *NPCGroup) {
+ // Authored appearances and item outfits take precedence over role defaults.
+ if group.Visual.Head != 0 || len(group.Visual.Textures) != 0 || len(group.Visual.Meshes) != 0 || len(NPCOutfits[group.ID]) != 0 {
+ return
+ }
+ if outfit, ok := npcCivilianOutfits[group.TemplateCode]; ok && group.MonsterData == outfit.monster {
+ NPCOutfits[group.ID] = outfit.items
+ return
+ }
+
+ // Visible uniforms do not grant guards armor stats, weapons or combat support.
+ if visual, ok := npcMilitaryVisuals[group.TemplateCode]; ok && group.MonsterData == visual.monster {
+ group.Visual.Head = MonsterTemplates[group.MonsterData].Stats[64]
+ group.Visual.Textures = [][2]uint32{{0, 15806}, {1, 15809}, {2, 15807}, {3, 15808}, {4, 15805}}
+ group.Visual.Meshes = [][4]uint32{{0, visual.helmet, 0, 2}, {0, group.Visual.Head, 0, 4}}
+ if visual.weapon != 0 {
+ group.Visual.Meshes = append(group.Visual.Meshes, [4]uint32{1, visual.weapon, 0, 2})
+ }
+ }
+}
diff --git a/server/gamedata/npc_outfits_test.go b/server/gamedata/npc_outfits_test.go
@@ -0,0 +1,67 @@
+package gamedata
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestReviewedCivilianOutfitsCoverEveryPlacement(t *testing.T) {
+ uniform := []NPCOutfitItem{{82912, 21}, {82919, 23}, {82919, 25}, {82911, 27}, {82913, 30}}
+ rustic := []NPCOutfitItem{{82102, 21}, {82092, 23}, {82092, 25}, {82101, 27}, {82100, 30}}
+ profiles := map[string]struct {
+ monster uint32
+ items []NPCOutfitItem
+ }{
+ "OFPO": {26092, uniform}, "OTGD": {26076, uniform}, "NEGD": {26076, uniform},
+ "CLGD": {26076, rustic}, "H320": {26135, rustic}, "H476": {26076, rustic},
+ "H410": {26088, rustic}, "H660": {26088, rustic},
+ }
+
+ // Check the loaded population, including authored points with multiple actors.
+ counts := make(map[string]int)
+ for id, group := range NPCGroups {
+ profile, reviewed := profiles[group.TemplateCode]
+ if !reviewed {
+ continue
+ }
+ counts[group.TemplateCode] += len(group.Positions)
+ if group.MonsterData != profile.monster || !reflect.DeepEqual(NPCOutfits[id], profile.items) || group.Visual.Head != 0 {
+ t.Errorf("civilian %s (%s) lacks its reviewed outfit", id, group.TemplateCode)
+ }
+ }
+ if !reflect.DeepEqual(counts, map[string]int{"OFPO": 11, "OTGD": 61, "NEGD": 23, "CLGD": 49, "H320": 4, "H476": 30, "H410": 4, "H660": 14}) {
+ t.Fatal("reviewed civilian population changed", counts)
+ }
+}
+
+func TestEliteGuardVisualsFillUnassignedPosts(t *testing.T) {
+ counts := make(map[string]int)
+ for id, group := range NPCGroups {
+ if group.TemplateCode != "FEEL" && group.TemplateCode != "MAEL" {
+ continue
+ }
+ // Preserve the seven existing item outfits, including their armor bonuses.
+ if len(NPCOutfits[id]) != 0 {
+ counts["equipped"]++
+ if group.Visual.Head != 0 {
+ t.Fatal("visual fallback replaced an explicit item outfit", id)
+ }
+ continue
+ }
+ counts[group.TemplateCode]++
+ head, helmet := uint32(40629), uint32(20089)
+ if group.TemplateCode == "MAEL" {
+ head, helmet = 40111, 20005
+ }
+ want := NPCVisual{
+ Head: head, Textures: [][2]uint32{{0, 15806}, {1, 15809}, {2, 15807}, {3, 15808}, {4, 15805}},
+ Meshes: [][4]uint32{{0, helmet, 0, 2}, {0, head, 0, 4}},
+ }
+ if !reflect.DeepEqual(group.Visual, want) {
+ t.Errorf("elite guard %s lacks its body-specific armor: %+v", id, group.Visual)
+ }
+ }
+ if !reflect.DeepEqual(counts, map[string]int{"FEEL": 8, "MAEL": 21, "equipped": 7}) {
+ t.Fatal("elite guard population changed", counts)
+ }
+}
diff --git a/server/gamedata/npc_visuals_test.go b/server/gamedata/npc_visuals_test.go
@@ -13,6 +13,8 @@ func TestOfficerUniformsCoverBothSexesAtEveryPost(t *testing.T) {
"FECA": {26137, 40209, 20055},
"MALI": {26088, 40687, 20106},
"FELI": {26076, 40635, 20089},
+ "FECO": {26090, 40629, 20089},
+ "MACO": {26088, 40687, 20106},
}
counts := make(map[string]int)
@@ -32,7 +34,7 @@ func TestOfficerUniformsCoverBothSexesAtEveryPost(t *testing.T) {
t.Errorf("officer %s (%s) lacks its body-specific uniform: %+v", id, group.TemplateCode, group.Visual)
}
}
- if !reflect.DeepEqual(counts, map[string]int{"MACA": 35, "FECA": 8, "MALI": 52, "FELI": 15}) {
+ if !reflect.DeepEqual(counts, map[string]int{"MACA": 35, "FECA": 8, "MALI": 52, "FELI": 15, "FECO": 25, "MACO": 21}) {
t.Fatal("officer population changed", counts)
}
}
@@ -50,7 +52,8 @@ func TestRecoveredNPCVisualsHaveBoundedPopulationAssignments(t *testing.T) {
}
}
- if len(counts) != 10 || counts["MACA"] != 35 || counts["MALI"] != 52 || counts["FECA"] != 8 || counts["FELI"] != 15 || counts["CSBI"] != 3 ||
+ if len(counts) != 14 || counts["MACA"] != 35 || counts["MALI"] != 52 || counts["FECA"] != 8 || counts["FELI"] != 15 ||
+ counts["FECO"] != 25 || counts["MACO"] != 21 || counts["FEEL"] != 8 || counts["MAEL"] != 21 || counts["CSBI"] != 3 ||
counts["BQAU"] != 4 || counts["BQPW"] != 3 || counts["BQWR"] != 5 || counts["BTMV"] != 1 || counts["TAIL"] != 4 {
t.Fatal("appearance coverage differs from the original-post and population-code matches", counts)
}
diff --git a/server/npc_outfits_test.go b/server/npc_outfits_test.go
@@ -79,3 +79,49 @@ func TestNPCEliteOutfitSurvivesReload(t *testing.T) {
}
}
}
+
+func TestCivilianRoleOutfitsSurviveReloadWithoutCombat(t *testing.T) {
+ for _, test := range []struct {
+ definition string
+ head uint32
+ templates [5]uint32
+ }{
+ {"705/district/0/fixed/1", 40694, [5]uint32{82912, 82919, 82919, 82911, 82913}},
+ {"3100/district/1/fixed/0", 40635, [5]uint32{82102, 82092, 82092, 82101, 82100}},
+ {"716/district/7/group/1/authored_point", 40252, [5]uint32{82102, 82092, 82092, 82101, 82100}},
+ } {
+ t.Run(test.definition, func(t *testing.T) {
+ data := testNPCData()
+ data.Playfields[0].Districts[0].Groups[0] = *gamedata.NPCGroups[test.definition]
+ useNPCData(t, data)
+ world := newTestServer(t)
+
+ if err := world.flushWorld(); err != nil {
+ t.Fatal(err)
+ }
+ cold := newTestInventoryServer(t)
+
+ for _, current := range []*server{world, cold} {
+ npc := current.characters[1000000]
+ if len(npc.inventory.Items) != 5 || npc.headMesh != test.head || npc.combatProfile != nil || npc.attackableNPC() {
+ t.Fatal("civilian outfit or combat eligibility changed", npc.inventory.Items, npc.headMesh)
+ }
+ for index, slot := range []uint32{21, 23, 25, 27, 30} {
+ want := ownedItem{Type: 51022, Template: test.templates[index], Quality: 1, Slot: slot, Count: 1}
+ if npc.inventory.Items[index] != want {
+ t.Fatal("civilian garment changed", npc.inventory.Items[index])
+ }
+ }
+ for stat := uint32(90); stat <= 97; stat++ {
+ if npc.equipmentBonus(stat) != 0 {
+ t.Fatal("civilian clothing added armor", stat)
+ }
+ }
+ var items int
+ if err := current.db.QueryRow("SELECT count(*) FROM items").Scan(&items); err != nil || items != 0 {
+ t.Fatal("civilian outfit allocated transferable items", items, err)
+ }
+ }
+ })
+ }
+}
diff --git a/server/npc_visuals_test.go b/server/npc_visuals_test.go
@@ -11,10 +11,15 @@ func TestRecoveredNPCVisualsSurviveReloadWithoutEquipment(t *testing.T) {
for _, test := range []struct {
definition string
head, helmet uint32
+ weapon uint32
}{
- {"705/district/0/fixed/15", 40171, 20038},
- {"705/district/0/fixed/9", 40209, 20055},
- {"705/district/0/fixed/13", 40635, 20089},
+ {"705/district/0/fixed/15", 40171, 20038, 35566},
+ {"705/district/0/fixed/9", 40209, 20055, 35566},
+ {"705/district/0/fixed/13", 40635, 20089, 35566},
+ {"705/district/0/fixed/10", 40629, 20089, 35566},
+ {"710/district/0/fixed/4", 40687, 20106, 35566},
+ {"705/district/0/fixed/12", 40629, 20089, 0},
+ {"705/district/0/fixed/16", 40111, 20005, 0},
} {
t.Run(test.definition, func(t *testing.T) {
data := testNPCData()
@@ -38,7 +43,11 @@ func TestRecoveredNPCVisualsSurviveReloadWithoutEquipment(t *testing.T) {
t.Fatal("recovered human appearance lost humanoid NPC initialization or clothing")
}
// Original 14.9.1 clothing layers, mesh attachments and implicit attack row.
- reader := bytes.NewReader(packet[len(packet)-122:])
+ meshes := [][4]uint32{{0, test.helmet, 0, 2}, {0, test.head, 0, 4}}
+ if test.weapon != 0 {
+ meshes = append(meshes, [4]uint32{1, test.weapon, 0, 2})
+ }
+ reader := bytes.NewReader(packet[len(packet)-92-10*len(meshes):])
count, _ := reader.ReadByte()
if count != 5 {
t.Fatal("officer has no five-part armor texture list", count)
@@ -57,10 +66,10 @@ func TestRecoveredNPCVisualsSurviveReloadWithoutEquipment(t *testing.T) {
var meshCount uint32
binary.Read(reader, binary.BigEndian, &layers)
binary.Read(reader, binary.BigEndian, &meshCount)
- if layers != [2]byte{} || meshCount != 4036 {
+ if layers != [2]byte{} || meshCount != uint32(len(meshes)+1)*1009 {
t.Fatal("clothing layer and mesh list boundaries changed", layers, meshCount)
}
- for _, want := range [][4]uint32{{0, test.helmet, 0, 2}, {0, test.head, 0, 4}, {1, 35566, 0, 2}} {
+ for _, want := range meshes {
slot, _ := reader.ReadByte()
var row [2]uint32
binary.Read(reader, binary.BigEndian, &row)