commit 6f21f1c54c082d68324a8cd5f530cbdba8113949
parent 5458202ffc985803273c5e7206a9da8124d2b5f6
Author: anon <anon@example.com>
Date: Sat, 24 Oct 2026 07:34:09 +0000
Support authored Strength Boost crystal uploads
Diffstat:
7 files changed, 185 insertions(+), 15 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -434,6 +434,10 @@ checks are recorded in [treatment kits](docs/treatment-kit.md).
damage and death handling work without starting an unintended weapon attack.
- [ ] Apply one temporary stat buff. Check: the native effect appears, the stat
changes once, and expiration removes exactly that contribution.
+ Strength Boost's QL 7 crystal now uploads its program with verified MM/BM
+ requirements, duplicate rejection and native restart persistence. Its timed
+ effect is not enabled yet. Catalog and add/remove protocol findings are in
+ [temporary nano research](docs/nano-buffs.md).
- [ ] Enforce NCU capacity. Check: a buff fitting the available NCU succeeds and
one exceeding it is rejected without charging resources incorrectly.
- [ ] Replace or reject a conflicting buff. Check: one known nano-line pair
diff --git a/docs/nano-buffs.md b/docs/nano-buffs.md
@@ -0,0 +1,69 @@
+# Temporary nano research for 14.9.1
+
+The timed-buff milestones remain open. Strength Boost is the selected first
+case; its crystal can be learned through the existing native upload route.
+No timed stat effect or NCU allocation is enabled by learning it.
+
+## Authored effect
+
+Original resource `1040005:27169`, Strength Boost, has Modify 53045 with
+arguments `{16,12}`: one +12 Strength modifier. Raw duration stat 8 is 120000
+centiseconds (20 minutes), NCU cost 54 is 3, nano cost 407 is 45, execution
+294 is 220 centiseconds, recharge 210 is 60, and range 287 is 12 metres.
+The existing selected-client cost arithmetic would truncate 45 to 44;
+historical server debit policy remains subject to the limits documented in
+[nano damage](nano-damage.md).
+
+Crystal `1000020:27305` has QL 7, while the program has QL 3. Both require
+Biological Metamorphosis 128 at least 35 and Matter Metamorphosis 127 at
+least 41. Stat 122 is Sensory Improvement and is not required. The original
+registration strings at `10038a90`, `10038a5e` and `10038b58`, respectively,
+establish those skill names independently of later database labels.
+
+## Native delivery
+
+The inspected target is original `kkr.dll`, SHA-256
+`a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0`.
+Addresses below use its `10000000` base. These are static native contracts,
+not a captured historical server exchange.
+
+CharacterAction `5e477770`, action 177, uses the recipient as envelope actor
+and DWORD fields `{177,53019,programID,casterID,durationCs}`. Receiver
+`1006fa30 -> 10066010` adds the active record, executes its modifiers and
+increments used NCU 180. It applies to owner and observer representations;
+only the local recipient receives the effect icon. Do not also send an
+ApplySpells modifier stream for the same effect. Ordinary cast admission
+18 and completion 107 remain separate from this active-effect delivery.
+
+Action 65 removes a present record, its modifiers and NCU together through
+`10064ee0`. The native cancellation sender `100232a0` emits
+`{65,0,0,53019,programID}` and refuses hostile programs. Countdown reaching
+zero alone does not establish automatic stat removal in the inspected paths;
+the server needs an authoritative expiration operation.
+
+Native same-strain replacement compares NCU cost through `10066c80` and
+`10066d40`. Strength Boost and Augment Strength 26360 share strain 75 equal
+to 34 and cost 3 and 2 NCU. Reapplying Strength Boost removes its previous
+contribution before adding it again. Stat 413 is an effect resource in this
+path, not stacking priority.
+
+The active-program snapshot belongs to SimpleCharFullUpdate `271b3a6b`,
+reader `10082da0`, rather than FullCharacter `29304349`. It contains an
+encoded count and five DWORDs per record: program identity, start time and
+two duration fields. Snapshot activation applies effects and NCU. Replaying
+action 177 as well would double-apply them; initialization order needs an
+actual WASM check before either replay path is enabled.
+
+## Remaining checks
+
+Implement and test one authoritative cast/add/expire/cancel lifecycle, NCU
+admission, same-program refresh and the known same-strain pair. Verify owner,
+observer, reconnect, zoning and restart behavior without duplicate modifiers.
+Stat 464 duration scaling, exact offline timer policy, death cleanup,
+friendly eligibility and original server message ordering remain unresolved.
+Neither wall-clock expiry nor paused offline time is established by this
+static evidence.
+
+Full selected records, original skill resources, native registration bytes,
+69 complete REA records and the finding ledger are retained under
+`local/nano-buff-research/`. The owned native analysis session was closed.
diff --git a/docs/nano-learning.md b/docs/nano-learning.md
@@ -8,9 +8,19 @@ Winter's Bite uses the same upload route for Bureaucrat crystal 29625 and
program 29618. Its requirements and supported damage cast are documented in
[nano damage](nano-damage.md).
+QL 7 Nano Crystal (Strength Boost) 27305 uploads QL 3 program 27169. It
+requires effective Biological Metamorphosis 128 greater than 34 and Matter
+Metamorphosis 127 greater than 40, with no profession requirement. Both
+skills use ability weights `[0,0,0,80,0,20]`. Sensory Improvement is stat 122
+and is not a requirement. The original client's inspection window and skill
+registration strings independently confirm these labels. The upload action
+uses `{27305,27305,7,1,3,104,sourceSlot,50000,ownerID}`: the crystal's authored
+quality is distinct from its program's quality. Timed buff casting remains
+separate from learning; see [temporary nano research](nano-buffs.md).
+
## Requirements and character data
-The crystal's Use action requires effective Matter Creation 130 greater than 7,
+The Meta-Physicist crystal's Use action requires effective Matter Creation 130 greater than 7,
effective Time and Space 131 greater than 7, and VisualProfession 368 equal
to 12 (Meta-Physicist). The crystal has no pet-count requirement. That check
belongs to casting the learned program. No additional server upload timer is
@@ -138,3 +148,20 @@ thirty-slot inventory tests passed in 180.874 seconds. Their logs are retained
under `local/nano-learning-research/`. Restoring the previous converter offset
through a temporary Go overlay makes the learned-list regression fail at its
neighboring-list assertion, recorded in `old-layout-regression.log`.
+
+Strength Boost's native check used one fresh Soldier and two authored QL 7
+crystals. At effective Matter Metamorphosis 40, then Biological Metamorphosis
+34, the client rejected use without a network command or consumption. With
+both skills at 41/35, ordinary right-click use consumed exactly one crystal
+and added one Medical program entry. Sensory Improvement remained at its
+starting base 5. Native inspection showed the authored Bio Metamor 35 and
+Matt. Metam 41 requirements.
+
+The spare crystal sent a request that the server rejected without consumption.
+A full server restart restored exactly one program 27169 and the spare QL 7
+crystal. A second duplicate request after restart was also rejected. The wire
+contained one success, two rejections and one QL 7 template action. Read-only
+native probes and SQLite agreed. There were no page or adapter errors; the
+test client, character and spare item were cleaned up while preserving every
+other database row. Captures and assertions are retained in
+`local/strength-upload-smoke/verification.json`.
diff --git a/server/backpacks.go b/server/backpacks.go
@@ -80,10 +80,10 @@ func (server *server) handleOwnedItemUse(client *worldClient, body []byte) error
client.useSequence = sequence
if binary.BigEndian.Uint32(body[40:44]) == 104 {
index := slices.IndexFunc(player.inventory.Items, func(item ownedItem) bool {
- return item.Slot == binary.BigEndian.Uint32(body[44:48]) && (item.Template == 43552 || item.Template == 85366 || item.Template == 25812 || item.Template == 43330 || item.Template == 29625)
+ return item.Slot == binary.BigEndian.Uint32(body[44:48]) && (item.Template == 43552 || item.Template == 85366 || item.Template == 25812 || item.Template == 43330 || item.Template == 29625 || item.Template == 27305)
})
if index >= 0 {
- if player.inventory.Items[index].Template == 43330 || player.inventory.Items[index].Template == 29625 {
+ if player.inventory.Items[index].Template == 43330 || player.inventory.Items[index].Template == 29625 || player.inventory.Items[index].Template == 27305 {
return server.learnNano_locked(client, index, body)
}
if player.inventory.Items[index].Template == 85366 {
diff --git a/server/nano_learning.go b/server/nano_learning.go
@@ -9,16 +9,26 @@ func (server *server) learnNano_locked(client *worldClient, index int, body []by
player := server.characters[client.id]
item := player.inventory.Items[index]
stats := player.baseStats()
- program := uint32(43324)
- accepted := item.Type == 51005 && item.Quality == 1 && item.Slot >= 64 && item.Slot < 94 &&
- player.effectiveSkill(130, stats.NanoAiding.MatterCreation, [6]uint32{0, 0, 20, 80, 0, 0}) > 7
- if item.Template == 29625 {
+ var program uint32
+ accepted := item.Type == 51005 && item.Slot >= 64 && item.Slot < 94
+ switch item.Template {
+ case 29625:
program = 29618
- accepted = accepted && player.profession == 8 &&
+ accepted = accepted && item.Quality == 1 && player.profession == 8 &&
+ player.effectiveSkill(130, stats.NanoAiding.MatterCreation, [6]uint32{0, 0, 20, 80, 0, 0}) > 7 &&
player.effectiveSkill(129, stats.NanoAiding.PsychologicalModification, [6]uint32{0, 0, 0, 80, 20, 0}) > 8
- } else {
- accepted = accepted && player.profession == 12 &&
+ case 43330:
+ program = 43324
+ accepted = accepted && item.Quality == 1 && player.profession == 12 &&
+ player.effectiveSkill(130, stats.NanoAiding.MatterCreation, [6]uint32{0, 0, 20, 80, 0, 0}) > 7 &&
player.effectiveSkill(131, stats.NanoAiding.TimeAndSpace, [6]uint32{0, 20, 0, 80, 0, 0}) > 7
+ case 27305:
+ program = 27169
+ accepted = accepted && item.Quality == 7 &&
+ player.effectiveSkill(128, stats.NanoAiding.BiologicalMetamorphosis, [6]uint32{0, 0, 0, 80, 0, 20}) > 34 &&
+ player.effectiveSkill(127, stats.NanoAiding.MatterMetamorphosis, [6]uint32{0, 0, 0, 80, 0, 20}) > 40
+ default:
+ accepted = false
}
accepted = accepted && !slices.Contains(player.inventory.LearnedNanos, program)
if accepted {
@@ -47,7 +57,7 @@ func (server *server) learnNano_locked(client *worldClient, index int, body []by
// OnUse adds the learned entry before DeleteItem removes the empty proxy.
var action []byte
- for _, value := range []uint32{item.Template, item.Template, 1, 1, 3, 104, item.Slot, 50000, client.id} {
+ for _, value := range []uint32{item.Template, item.Template, item.Quality, 1, 3, 104, item.Slot, 50000, client.id} {
action = binary.BigEndian.AppendUint32(action, value)
}
if err := client.send(n3Packet(0x35505644, 50000, client.id, action)); err != nil {
diff --git a/server/nano_learning_test.go b/server/nano_learning_test.go
@@ -25,6 +25,65 @@ func newNanoLearningWorld(t *testing.T) (*server, *combatTestConn) {
return world, conn
}
+func TestStrengthBoostCrystalLearnsAtItsAuthoredQuality(t *testing.T) {
+ world, conn := newNanoLearningWorld(t)
+ player := world.characters[1]
+ player.profession = 1
+ player.stats.NanoAiding.BiologicalMetamorphosis = 33
+ player.stats.NanoAiding.MatterMetamorphosis = 39
+ player.inventory.Items = nil
+ if granted, err := world.grantItem_locked(player, 27305); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+
+ err := world.handleOwnedItemUse(world.clients[1], backpackUseRequest(1, 64, 1)[20:])
+ restored := newTestInventoryServer(t).characters[1]
+
+ if err != nil || !slices.Equal(restored.inventory.LearnedNanos, []uint32{27169}) || len(restored.inventory.Items) != 0 ||
+ len(conn.packets) != 3 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 1 ||
+ binary.BigEndian.Uint32(conn.packets[1][29:33]) != 27305 || binary.BigEndian.Uint32(conn.packets[1][37:41]) != 7 ||
+ binary.BigEndian.Uint32(conn.packets[2][41:45]) != 27305 {
+ t.Fatalf("Strength Boost crystal did not upload and persist exactly once: %v, %+v, %x", err, restored.inventory, conn.packets)
+ }
+}
+
+func TestStrengthBoostCrystalRejectsRequirementBoundariesAndDuplicate(t *testing.T) {
+ for _, scenario := range []string{"Biological Metamorphosis 34", "Matter Metamorphosis 40", "wrong quality", "already learned", "failed save"} {
+ t.Run(scenario, func(t *testing.T) {
+ world, conn := newNanoLearningWorld(t)
+ player := world.characters[1]
+ player.stats.NanoAiding.BiologicalMetamorphosis = 33
+ player.stats.NanoAiding.MatterMetamorphosis = 39
+ player.inventory.Items = nil
+ if granted, err := world.grantItem_locked(player, 27305); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ switch scenario {
+ case "Biological Metamorphosis 34":
+ player.stats.NanoAiding.BiologicalMetamorphosis = 32
+ case "Matter Metamorphosis 40":
+ player.stats.NanoAiding.MatterMetamorphosis = 38
+ case "wrong quality":
+ player.inventory.Items[0].Quality = 1
+ case "already learned":
+ player.inventory.LearnedNanos = []uint32{27169}
+ case "failed save":
+ failDatabaseWrites(t, world)
+ }
+ before := player.inventory
+
+ err := world.handleOwnedItemUse(world.clients[1], backpackUseRequest(1, 64, 1)[20:])
+
+ if (err != nil) != (scenario == "failed save") || !reflect.DeepEqual(player.inventory, before) || len(conn.packets) > 1 {
+ t.Fatalf("rejected Strength Boost upload changed state: %v, %+v", err, player.inventory)
+ }
+ if len(conn.packets) == 1 && binary.BigEndian.Uint32(conn.packets[0][29:33]) != 2 {
+ t.Fatal("rejected Strength Boost upload acknowledged consumption")
+ }
+ })
+ }
+}
+
func TestNanoCrystalLearnsAndConsumesOnceAcrossRestart(t *testing.T) {
world, conn := newNanoLearningWorld(t)
client := world.clients[1]
diff --git a/tools/data/extract_nano_learning.py b/tools/data/extract_nano_learning.py
@@ -12,19 +12,20 @@ def main():
assert (client / 'version.id').read_text().strip() == '14.9.1'
database = ao_database.Database(client)
- # Retain each supported startup crystal and the program it uploads.
+ # Retain each supported crystal and the program it uploads.
records = []
- for kind, identity in ((1000020, 43330), (1040005, 43324), (1000020, 29625), (1040005, 29618)):
+ for kind, identity in ((1000020, 43330), (1040005, 43324), (1000020, 29625), (1040005, 29618),
+ (1000020, 27305), (1040005, 27169)):
raw = database.read(kind, identity)
item = extract_items.parse_item(raw, kind, identity)
- assert item['quality'] == 1
records.append(dict(record=item, payload_sha256=hashlib.sha256(raw).hexdigest()))
+ assert [record['record']['quality'] for record in records] == [1, 1, 1, 1, 7, 3]
assert records[0]['record']['header_words'][0] == 51005
assert records[1]['record']['header_words'][0] == 51051
# Keep the supported nano skill and initiative ability weights.
weights = {}
- for stat in (129, 130, 131, 149):
+ for stat in (127, 128, 129, 130, 131, 149):
raw = database.read(1000204, stat)
weights[stat] = dict(weights=struct.unpack('<6i', raw), payload_hex=raw.hex(),
payload_sha256=hashlib.sha256(raw).hexdigest())