commit 8892023643d260d501d351330d0d699d4875cc5d
parent 486871f1c3d6fd38a3dd4c687d7f5650d1f300cc
Author: anon <anon@example.com>
Date: Sun, 25 Oct 2026 10:26:25 +0000
Support NCU Hacker Interface equipment across its quality range
Diffstat:
6 files changed, 253 insertions(+), 12 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -993,14 +993,24 @@ and unresolved indoor lifecycle are explicit in [flight](docs/vehicles.md#yalmah
[inventory combinations](docs/tradeskills.md).
- [ ] Support the NCU Hacker Interface's original manual level upgrades.
Recover FINC/53130 behavior, level/QL selection, upgrade cash costs and
- intermediate modifiers. Verify use while carried/worn, wrong profession,
+ result delivery. Verify use while carried/worn, wrong profession,
maximum QL, repeated requests, SQL rollback and native reconnect without
losing the crafted item. Do not turn its flavor-text failure probability
into a destruction rule without behavioral evidence.
- The fresh AddTemplate result emitted no Use request on the observed right
- click; after cold reconnect its actual instance did send Use and received
- the current unsupported-action rejection. Recover this input/delivery
- difference before claiming the upgrade flow works for newly crafted items.
+ A follow-up hardware run could not reproduce the earlier fresh-result
+ no-request observation: fresh proxy, same-pointer wear/removal, away/back
+ and reconnect all sent Use and received the unsupported-action rejection,
+ preserving items/cash. No null-ID delivery workaround is justified by that
+ evidence. Keep fresh-result Use in the upgrade regressions; the earlier
+ missing request remains unexplained. See [inventory combinations](docs/tradeskills.md).
+- [x] Support NCU Hacker Interface equipment at QL1..200. Use original
+ endpoints158416/158417 and shared interpolation for all six nano skills and
+ the Fixer/level wear requirement. Keep source Interface161699 separate.
+ Endpoint, rounding, rejection, rollback and restart tests cover both stored
+ template IDs. Two hardware WASM clients verified seven qualities, complete
+ removal, native level/profession rejection and an alternate-endpoint cold
+ recovery without duplicate modifiers. This does not implement the manual
+ upgrade operation.
- [ ] Add one implant-building recipe. Check: the chosen cluster/implant pair
produces the evidenced requirements, bonuses and QL result.
diff --git a/docs/tradeskills.md b/docs/tradeskills.md
@@ -25,8 +25,8 @@ profession check on creation. The implemented combine checks the evidenced skill
requirements without adding that unproven restriction.
Creation XP is unimplemented because its amount, including whether it is zero,
-remains unproven. Manual leveling, intermediate-QL modifiers, cash costs and any
-other NCU upgrade behavior are separate unfinished work. Supporting this recipe
+remains unproven. Manual leveling, cash costs and other NCU upgrade behavior
+are separate unfinished work. Supporting this recipe
does not establish generic tradeskill XP, variable QL/bumping, reusable tools,
container/equipped combinations or the complete historical recipe set.
@@ -90,5 +90,50 @@ equipment path. Native runtime evidence is retained in `local/tradeskill-smoke/`
Both clients verified those modifiers. After cold recovery the same persistent
result and unrelated items remain; neither ingredient returns. An exploratory
upgrade click on the fresh result emitted no Use request, while the cold-restored
-instance sent Use and received failure2. Upgrading remains unsupported, and the
-fresh/cold input difference needs separate investigation.
+instance sent Use and received failure2. The follow-up hardware run in
+`local/fresh-item-use-smoke/` could not reproduce the missing request: fresh
+template proxy, same-pointer wear/removal, away/back and reconnect all sent Use
+and received failure2 without changing items or cash. The original screenshot's
+stale `Free` tooltip and later preview exit are leads, not established causes.
+Retained native guards in `local/fresh-item-use-research/` establish no rejection
+of the proxy's null ID or row flag0x20. This bounded result does not justify a
+delivery workaround; upgrading remains unsupported.
+
+## NCU equipment qualities
+
+The NCU Hacker Interface supports wearing at every QL1..200 through the shared
+item interpolation path. The exact original records158416/158417 have aligned
+action/function lists; their six nano-skill amounts run from1 to60, and Action8
+requires Fixer with level greater than QL minus1. Numeric values use the existing
+original `kkr.dll`100eff20 rounding rule. Both stored endpoint IDs normalize to
+the same low/high pair; exact QL1/200 packets use only their matching endpoint.
+The source Nano Programming Interface161699 is a separate item and does not gain
+this range. Catalog and native evidence are retained in
+`local/tradeskill-research/catalog/ncu-quality-audit.json` and
+`ncu-quality-findings.txt`.
+
+| QL | Each of six nano-skill bonuses | Minimum level |
+| --- | --- | --- |
+|1|1|1|
+|2|1|2|
+|3|2|3|
+|50|16|50|
+|100|30|100|
+|101|31|101|
+|199|60|199|
+|200|60|200|
+
+The six stats are122,127,128,129,130,131. Tests cover both stored endpoints,
+wear/removal, owner/observer packets, cold snapshots, level/profession/slot
+rejection, changed requirements during the equipment delay, SQL failure and
+control-panel QL bounds. Equipment quality support does not advance item QL on
+Use or establish the upgrade's cash/deletion policy.
+
+Two hardware WASM clients verified QL2,3,50,100,101,199,200, including identical
+owner/observer modifiers and complete removal. Native attempts below the level
+requirement and with the wrong profession preserved the item. A stored158417
+record at QL101 retained its persistent identity and exactly +31 after a process
+restart; removal cleared both clients again. The owner initializes its effect
+from the restored character, while the observer receives one explicit wear
+message. Exact packet tuples, native/SQLite snapshots, negative cases and
+fixture-only cleanup evidence are in `local/ncu-quality-smoke/`.
diff --git a/server/item_pages.go b/server/item_pages.go
@@ -289,8 +289,8 @@ func (server *server) editItem(w http.ResponseWriter, r *http.Request) {
}
definition := gamedata.ItemTemplates[record.Template]
item := ownedItem{Type: record.Type, Template: record.Template, Quality: record.Quality}
- if err != nil || definition == nil || definition.Quality == nil || record.Type != definition.HeaderWords[0] || record.Quality != *definition.Quality && !item.isMetaplast() && !item.isBackpackOfSurvival() {
- http.Error(w, "Invalid item properties; use the catalog type and authored quality, Metaplast QL 1 through 200, or Backpack of Survival QL 50 through 150", http.StatusBadRequest)
+ if err != nil || definition == nil || definition.Quality == nil || record.Type != definition.HeaderWords[0] || record.Quality != *definition.Quality && !item.isMetaplast() && !item.isBackpackOfSurvival() && !item.isNCUHackerInterface() {
+ http.Error(w, "Invalid item properties; use the catalog type and authored quality, Metaplast or NCU Hacker Interface QL 1 through 200, or Backpack of Survival QL 50 through 150", http.StatusBadRequest)
return
}
server.updateMutex.Lock()
diff --git a/server/item_quality.go b/server/item_quality.go
@@ -29,12 +29,18 @@ func (item ownedItem) isBackpackOfSurvival() bool {
return item.Type == 51017 && (item.Template == 206730 || item.Template == 206731) && item.Quality >= 50 && item.Quality <= 150
}
+func (item ownedItem) isNCUHackerInterface() bool {
+ return item.Type == 51022 && (item.Template == 158416 || item.Template == 158417) && item.Quality >= 1 && item.Quality <= 200
+}
+
func (item ownedItem) templateIDs() (uint32, uint32) {
var low, high uint32
if item.isMetaplast() {
low, high = metaplastTemplates(item.Template)
} else if item.isBackpackOfSurvival() {
low, high = 206730, 206731
+ } else if item.isNCUHackerInterface() {
+ low, high = 158416, 158417
} else {
return item.Template, item.Template
}
diff --git a/server/ncu_hacker_interface_test.go b/server/ncu_hacker_interface_test.go
@@ -0,0 +1,180 @@
+package main
+
+import (
+ "bytes"
+ "encoding/binary"
+ "fmt"
+ "net/url"
+ "testing"
+)
+
+func TestNCUHackerInterfaceQualityWearRemoveAndRestart(t *testing.T) {
+ for _, template := range []uint32{158416, 158417} {
+ for _, scenario := range []struct {
+ quality uint32
+ bonus int32
+ low uint32
+ high uint32
+ }{
+ {1, 1, 158416, 158416}, {2, 1, 158416, 158417},
+ {3, 2, 158416, 158417}, {50, 16, 158416, 158417},
+ {100, 30, 158416, 158417}, {101, 31, 158416, 158417},
+ {199, 60, 158416, 158417}, {200, 60, 158417, 158417},
+ } {
+ t.Run(fmt.Sprintf("%d/QL%d", template, scenario.quality), func(t *testing.T) {
+ world, owner := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.level, player.profession = uint16(scenario.quality), 4
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ player.inventory.Items[0] = ownedItem{ID: 1, Type: 51022, Template: template, Quality: scenario.quality, Slot: 64, Count: 1}
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ observer := &combatTestConn{}
+ world.characters[2] = &character{id: 2, playfield: player.playfield, health: 100}
+ world.clients[2] = &worldClient{id: 2, conn: observer, target: true, ready: true}
+
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 15)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("HUD2 wear rejected", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ worn := newTestInventoryServer(t).characters[1]
+ snapshot := targetPacket(fullCharacterPacket(worn))
+
+ expected := ownedItem{ID: 1, Type: 51022, Template: template, Quality: scenario.quality, Slot: 15, Count: 1}
+ if worn.inventory.Items[0] != expected || len(owner.packets) != 2 || len(observer.packets) != 1 ||
+ !bytes.Equal(owner.packets[1][16:], observer.packets[0][16:]) {
+ t.Fatal("wear changed identity, quality or observer replication")
+ }
+ for _, stat := range []uint32{122, 127, 128, 129, 130, 131} {
+ if worn.equipmentBonus(stat) != scenario.bonus || player.equipmentBonus(stat) != scenario.bonus {
+ t.Fatalf("stat%d: got %d, want %d", stat, worn.equipmentBonus(stat), scenario.bonus)
+ }
+ }
+ var action, entry []byte
+ for _, value := range []uint32{scenario.low, scenario.high, scenario.quality, 1, 6, 101, 15, 0, 0} {
+ action = binary.BigEndian.AppendUint32(action, value)
+ }
+ for _, value := range []uint32{1, scenario.low, scenario.high, scenario.quality, 0} {
+ entry = binary.BigEndian.AppendUint32(entry, value)
+ }
+ if !bytes.Equal(owner.packets[1][29:65], action) || !bytes.Contains(snapshot, entry) || len(equippedItemPackets(worn)) != 1 {
+ t.Fatal("wear or cold snapshot lost the original endpoint pair")
+ }
+
+ if err := world.handleInventory(client, itemMovePacket(1, 15, 111)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("HUD2 removal rejected", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ removed := newTestInventoryServer(t).characters[1]
+
+ expected.Slot = 64
+ if removed.inventory.Items[0] != expected || len(owner.packets) != 4 || len(observer.packets) != 2 {
+ t.Fatal("removal changed ownership or replication")
+ }
+ for _, stat := range []uint32{122, 127, 128, 129, 130, 131} {
+ if removed.equipmentBonus(stat) != 0 || player.equipmentBonus(stat) != 0 {
+ t.Fatal("removal retained a nano-skill modifier")
+ }
+ }
+ })
+ }
+ }
+}
+
+func TestNCUHackerInterfaceWearRejectionPreservesItems(t *testing.T) {
+ for _, scenario := range []string{"low level", "wrong profession", "wrong slot", "quality zero", "quality 201", "source interface", "wrong type", "changed level", "failed save"} {
+ t.Run(scenario, func(t *testing.T) {
+ world, owner := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.level, player.profession = 50, 4
+ player.inventory.Items[0] = ownedItem{ID: 1, Type: 51022, Template: 158416, Quality: 50, Slot: 64, Count: 1}
+ destination := uint32(15)
+ switch scenario {
+ case "low level":
+ player.level = 49
+ case "wrong profession":
+ player.profession = 1
+ case "wrong slot":
+ destination = 1
+ case "quality zero":
+ player.inventory.Items[0].Quality = 0
+ case "quality 201":
+ player.inventory.Items[0].Quality = 201
+ case "source interface":
+ player.inventory.Items[0].Template = 161699
+ case "wrong type":
+ player.inventory.Items[0].Type = 51005
+ }
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ before, err := readTestItemStore(world)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if scenario == "failed save" {
+ if _, err := world.db.Exec("CREATE TRIGGER fail_ncu_wear BEFORE INSERT ON item_locations BEGIN SELECT RAISE(ABORT, 'move failure'); END"); err != nil {
+ t.Fatal(err)
+ }
+ }
+
+ err = world.handleInventory(client, inventoryMovePacket(1, 64, destination)[20:])
+ if (scenario == "changed level" || scenario == "failed save") && client.equipment == nil {
+ t.Fatal("valid wear did not reach the delayed completion")
+ }
+ if scenario == "changed level" {
+ player.level = 49
+ }
+ if client.equipment != nil {
+ world.advanceEquipment(client.equipment.readyAt)
+ }
+ after, readErr := readTestItemStore(world)
+
+ if err != nil || readErr != nil || !bytes.Equal(before, after) || client.equipment != nil || player.inventory.Items[0].Slot != 64 {
+ t.Fatal("rejected wear changed item state", err, readErr)
+ }
+ for _, packet := range owner.packets {
+ if binary.BigEndian.Uint32(packet[16:20]) == 0x35505644 {
+ t.Fatal("rejected wear published native effects")
+ }
+ }
+ })
+ }
+}
+
+func TestControlNCUHackerInterfaceQualityBounds(t *testing.T) {
+ for _, scenario := range []struct {
+ template, quality uint32
+ status int
+ }{
+ {158416, 1, 303}, {158416, 50, 303}, {158416, 200, 303},
+ {158417, 1, 303}, {158417, 101, 303}, {158417, 200, 303},
+ {158416, 0, 400}, {158416, 201, 400}, {158417, 0, 400}, {158417, 201, 400},
+ {161699, 50, 400},
+ } {
+ t.Run(fmt.Sprintf("%d/QL%d", scenario.template, scenario.quality), func(t *testing.T) {
+ useNPCData(t, testNPCData())
+ world := newTestServer(t)
+ postControlForm(world, "/control/items", url.Values{"template": {fmt.Sprint(scenario.template)}})
+ before, _ := readTestItemStore(world)
+ data := fmt.Sprintf("type: 51022\ntemplate: %d\nquality: %d\ncount: 1\n", scenario.template, scenario.quality)
+
+ response := postControlForm(world, "/control/items/1", url.Values{"data": {data}})
+ after, err := readTestItemStore(world)
+
+ if response.Code != scenario.status || err != nil {
+ t.Fatal(response.Code, response.Body.String(), err)
+ }
+ if scenario.status == 400 {
+ if !bytes.Equal(before, after) {
+ t.Fatal("rejected QL changed durable data")
+ }
+ } else if newTestInventoryServer(t).items[1].Quality != scenario.quality {
+ t.Fatal("supported QL did not survive restart")
+ }
+ })
+ }
+}
diff --git a/server/stat_equipment.go b/server/stat_equipment.go
@@ -6,7 +6,7 @@ func (item ownedItem) isStatEquipment() bool {
definition := gamedata.ItemTemplates[item.Template]
if item.Type != 51022 || definition == nil || definition.HeaderWords[0] != item.Type ||
(itemStat(definition, 76) != 1 && itemStat(definition, 76) != 2) || itemStat(definition, 30)&4 == 0 ||
- !item.isMetaplast() && item.Quality != *definition.Quality {
+ !item.isMetaplast() && !item.isNCUHackerInterface() && item.Quality != *definition.Quality {
return false
}