commit 85f79b7979063e9d0842118edc4a016f7897c0a7
parent f5497773fb9686b8bcb0935cab125767bed07405
Author: anon <anon@example.com>
Date: Sun, 25 Oct 2026 21:16:59 +0000
Honor template-driven nano cost modifiers
Diffstat:
8 files changed, 645 insertions(+), 9 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -143,11 +143,17 @@ unverified mass/deletion/reclaim policies are in [backpacks](docs/backpacks.md).
implants with other unsupported effects still reject as whole items.
- [ ] Complete the remaining 7,008 implant contracts before admitting them.
Implement consumers for absorption226/227/228/229/230/231/233/234 and stats
- 277/318/381/383; establish each original rule before naming unknown
+ 277/381/383; establish each original rule before naming unknown
stats. Support conditional OnWear130263, Notum Splice204649's complete usable
effect, and the unclassified sections of six additional dungeon implants.
Do not grant partial effects. Complete records and rejected fixtures are in
`local/implant-catalog-research/`.
+- [ ] Admit and verify the 752 complete cost-modifier implant definitions now
+ covered by the shared stat318 consumer. Check all four authored qualities,
+ signed low-QL values, stacking, equip/remove, delayed revalidation, rollback,
+ native casting and cold restore. Keep the 64 cost implants with additional
+ unsupported277/381 effects rejected as whole items. Original records and
+ admission delta are in `local/nano-cost-research/catalog/`.
- [ ] Recover implant interpolation contracts and original endpoint pairing.
Check representative requirements, signed bonuses and native proxy templates
across ordinary and refined intermediate qualities. Authored endpoints are
@@ -162,6 +168,12 @@ unverified mass/deletion/reclaim policies are in [backpacks](docs/backpacks.md).
belts and memories now share this path instead of template-specific cases;
deck capacity and empty-deck belt removal checks remain enforced. See
[stat equipment](docs/stat-equipment.md).
+- [ ] Audit full contracts in the broad stat-equipment and weapon admission
+ predicates, including companion events outside OnWear. The stat318 census
+ finds admitted turret records203099/204586 with event26 effects and summoned
+ weapon contracts with additional events. OnWear accumulation must not imply
+ those other events are supported. Preserve all item properties and reject
+ incomplete contracts together; see `local/nano-cost-research/catalog/`.
- [ ] Resolve historical server handling of ItemType-1 equipment with only
authored action-6 criteria. The native predicate selects action 8 and does
not check the interface's action-6 Intelligence >12 criterion. Current
@@ -730,6 +742,14 @@ introduction and starting-item gameplay remain open below.
## Nanos and effects
+- [x] Verify generic NanoCostModifier318 consumption and nine complete ordinary
+ cost-reduction programs/crystals. Check signed tank/CPU/nano contributions,
+ exact affordability, zero-cost casts, modifier changes during execution,
+ atomic failures, native recipient/observer state and cold restore. See
+ [nano cost modifiers](docs/nano-cost.md).
+- [ ] Recover original server nano-cost caps and negative-cost policy, plus
+ original charging/refund timing. Native arithmetic has no minimum or breed
+ cap in the inspected chain; do not substitute later-version rules silently.
- [x] Learn one nano program. Check: consuming its crystal adds a persistent
native program entry and cannot learn or consume it twice accidentally.
The Doctor startup crystal now uploads Improved Healing with its exact
diff --git a/docs/nano-cost.md b/docs/nano-cost.md
@@ -0,0 +1,124 @@
+# Nano cost modifiers
+
+Casting uses the authored raw cost407 and the caster's effective signed
+NanoCostModifier318. The modifier starts at100 and adds worn-item and active
+program contributions. Positive tank-armor penalties and negative CPU/nano
+reductions use the same consumer; their percentages do not multiply separately.
+Armor overequipping uses the existing per-item signed penalty calculation.
+
+The expression retains the native operation order:
+
+```
+trunc(signedRaw407 * float32(100 + equipment318 + nano318) * float32(.01))
+```
+
+The products use the selected double-precision arithmetic. Replacing this with
+integer division or rounding changes boundaries: raw45 at100 costs44, at115
+costs51, at85 costs38, and at78 costs35. The float32 modifier conversion occurs
+before multiplication. The inspected original getter and eligibility expression
+have neither a one-point minimum nor a breed reduction cap. This does not prove
+that the unavailable original server had no separate validation or cap.
+
+Zero-cost casts still execute the ordinary action, effect, recharge and database
+transaction. A negative computed debit rejects admission; the reconstruction
+does not create resource points from negative costs. This is an explicit server
+policy, not a recovered native clamp. Raw cost metadata must still be positive
+under the ordinary whole-program predicate.
+Cost lookup follows learned-program, complete-contract and recipient validation;
+unknown network program IDs reject without dereferencing a missing template.
+
+Admission persists the computed reservation once. Completion consumes it, while
+cancellation refunds that saved amount, even if a cost modifier changes during
+execution. The original action117 recomputes a refund using current modifiers;
+the server instead sends action108 plus its authoritative balance, preserving
+the existing reservation/refund policy described in [nano damage](nano-damage.md).
+The original server's charge time and refund policy remain unverified.
+
+## Complete program contracts
+
+The shared Skill/Modify predicate admits nine complete programs and their nine
+ordinary crystals. Each contains only one unconditional selected-recipient
+Skill53012 effect for stat318, with one tick, zero interval and a zero third
+argument. They all share strain148 and use the existing NCU/replacement rules.
+
+| Program | Crystal | Modifier | NCU |
+| --- | --- | --- | --- |
+| Neuron-Notum Interface29307 | 29404 | -19 | 40 |
+| Notum Attunement95408 | 95426 | -12 | 19 |
+| Mocham's Neural Interface-Web95409 | 95425 | -24 | 49 |
+| Ease of Execution95410 | 95418 | -7 | 8 |
+| Coherent Notum Web95411 | 95428 | -15 | 28 |
+| Jobe Nano Libraries95413 | 95419 | -22 | 47 |
+| On-The-Fly Compression95414 | 95420 | -13 | 23 |
+| Run-Time Recompiler95416 | 95421 | -9 | 11 |
+| Izgimmer's Obfuscated Recompiler95417 | 95424 | -28 | 55 |
+
+Crystal and cast admission retain every strict skill and visual-profession
+criterion. MP and NT cost programs replace one another within the same strain.
+The three CrunchCom programs with range381 companions, hostile cost programs,
+profession-changing programs and mixed periodic contracts remain unsupported
+as whole programs. Stat318 implants also remain separate unfinished work.
+Ordinary buff admission is457 programs and455 crystals.
+
+## Evidence and verification
+
+The complete original resource audit reparsed989 records:937 stat318 producers
+and52 linked uploader records. Program/equipment profiles retain all companions,
+conditions, selectors, framing and metadata. The deterministic nine-program
+fixture is [nano-cost-nanos.json](../server/testdata/nano-cost-nanos.json), SHA-256
+`d6e2bddd2148b07c3531e2266dd8e50c7a63483128891ce1841c5e55ed21c1c9`.
+The source index SHA-256 is
+`46e5dc54af9358cc9bff05f4358e86af630e497bc677f361c133c88073b84d71`.
+Complete records, before/after predicates, hashes and limits are retained in
+`local/nano-cost-research/catalog/README.md`.
+
+Original KKR eligibility100646a0/10064839, refund10066b20 and raw-cost getter
+10098bd0 share retained Evidence
+`ev_b222a29a2449ed800e75228fac8a9ad597f8c73dce740b461b7fae780389796b`.
+The native ledger links35 records covering the defaults, additive getters,
+modifier removal, skill-weight boundary and full arithmetic. It retains the
+original KKR SHA-256
+`a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0` and
+the precise observation/inference limits in
+`local/nano-cost-research/native/README.md`.
+
+Automated tests cover the exact nine-program/crystal census, complete framing
+and criteria, upload/cast skill boundaries, exact affordability, signed worn
+contributions, removal/expiry during a reservation, cancellation, completion,
+restart refunds and SQLite error/ignored-write/commit rollback with retry.
+Synthetic complete-template arithmetic cases verify zero and negative debits;
+they are not additional claims about authored programs.
+
+Two actual GPU WASM clients verify the native stat318 values and durable
+reservations independently. Strength Boost reserves44 by default,35 with a
+Hardcore CPU Upgrade plus Ease of Execution,41 after adding the tank penalty,
+48 after removing the CPU, and51 after removing the cost nano. Movement
+cancellation refunds exactly35 and a later tick does not repeat the cast.
+Selected-recipient Ease installs on the intended player. Run-Time Recompiler
+replaces the MP buff on both clients without stacking; a weaker program is
+rejected without a charge. Both replicas reproduce the modifier removal.
+
+After a real server restart, both clients restore cost modifiers106/91 and
+exactly one strain148 effect per recipient. The worn tank, unequipped CPU and
+two belts retain their identities and slots. A subsequent Strength Boost
+reserves47 and completes normally. No client/worker errors were observed.
+Snapshots, wire data, database comparisons, GPU identity and executable
+assertions are retained under `local/nano-cost-smoke/`; `tmp_verify.py` records
+the checked facts and artifact hashes in `verification.json`.
+Owned clients were closed and the two fixture players and four remaining
+items removed. Every unrelated SQLite row remained unchanged through cleanup;
+foreign-key and integrity checks passed. The single shared preview remains
+available on its normal HTTPS8443 port.
+
+The full tracked-package run passed8,172 server checks and18 game-data checks
+(server1368.728 seconds); assets and the data exporter have no tests. After
+the final admission-order guard,390 focused casting/outcome/reservation checks
+passed in81.080 seconds, followed by300 checks across two race repetitions in
+153.656 seconds. Build and vet passed for all tracked packages. Unknown IDs0
+andffffffff reject without changing points, target health or pending casts.
+
+The broad `./...` discovery also attempted ignored local research directories
+and reported build errors there. The retained verification report separates
+those discovery failures from the completed, passing tracked-package suites,
+and identifies the final guard's focused rerun explicitly. Logs, source hashes
+and results are in `local/nano-cost-research/verification.json`.
diff --git a/docs/nano-damage.md b/docs/nano-damage.md
@@ -96,6 +96,9 @@ selecting 53-bit arithmetic. The selected WASM implementation also uses
double precision for this expression. A 24-bit x87 intermediate could round
the same product to 10. Startup is not proof of every original runtime
thread's later control word, especially after graphics-driver calls.
+The caster's worn and active signed stat318 contributions now feed this shared
+expression; see [nano cost modifiers](nano-cost.md) for complete program
+contracts, arithmetic boundaries and server policy limits.
The prototype reserves 9 points on admission and refunds that reservation
once on explicit cancellation, movement, lifecycle cancellation or an invalid
diff --git a/server/nano_buffs.go b/server/nano_buffs.go
@@ -122,7 +122,7 @@ func statBuffNano(program uint32) bool {
if value <= 0 {
return false
}
- case 382:
+ case 318, 382:
default:
if stat < 100 || stat > 168 || value <= 0 {
return false
diff --git a/server/nano_casting.go b/server/nano_casting.go
@@ -56,9 +56,10 @@ func nanoPointsPacket(player *character) []byte {
return n3Packet(0x2b333d6e, 50000, player.id, body)
}
-func nanoCost(program uint32) uint32 {
- // Native default cost modifier 318 is 100; retain the x87 float32 constant.
- return uint32(float64(nanoStat(program, 407)*100) * float64(float32(0.01)))
+func (player *character) nanoCost(program uint32) int32 {
+ // kkr.dll 10064839 stores signed stat 318 as float32 before the cost product.
+ modifier := float32(100 + player.equipmentBonus(318) + player.nanoBonus(318))
+ return int32(float64(int32(nanoStat(program, 407))) * float64(modifier) * float64(float32(0.01)))
}
func (player *character) nanoCastDelay(program uint32) time.Duration {
@@ -142,9 +143,14 @@ func (server *server) handleNanoCast(client *worldClient, body []byte) error {
target = player
}
accepted := targetType == 50000 && binary.BigEndian.Uint32(body[28:32]) == 53019 &&
- slices.Contains(player.inventory.LearnedNanos, program) && player.nanoRequirementsMet(program) && player.nano >= nanoCost(program) &&
+ slices.Contains(player.inventory.LearnedNanos, program) && player.nanoRequirementsMet(program) &&
!player.sitting && !player.driving() && client.forward == 0 && !client.strafing && !client.turning && client.equipment == nil &&
server.nanoTarget_locked(player, target, client, program, now)
+ var cost int32
+ if accepted {
+ cost = player.nanoCost(program)
+ accepted = cost >= 0 && player.nano >= uint32(cost)
+ }
if !accepted {
updates[client] = append(updates[client], characterActionPacket(player.id, [5]uint32{108}))
@@ -155,7 +161,7 @@ func (server *server) handleNanoCast(client *worldClient, body []byte) error {
// Reserve the cost once; the server releases the native effect gate at the deadline.
candidate := *player
- candidate.nanoReserved = nanoCost(program)
+ candidate.nanoReserved = uint32(cost)
candidate.nano -= candidate.nanoReserved
delay := player.nanoCastDelay(program)
weaponResumeAt := now.Add(max(0, delay))
diff --git a/server/nano_cost_test.go b/server/nano_cost_test.go
@@ -0,0 +1,468 @@
+package main
+
+import (
+ "ao/server/gamedata"
+ _ "embed"
+ "encoding/binary"
+ "encoding/json"
+ "fmt"
+ "reflect"
+ "slices"
+ "testing"
+ "time"
+)
+
+//go:embed testdata/nano-cost-nanos.json
+var nanoCostData []byte
+
+type nanoCostFixture struct {
+ combatNanoFixture
+ Getter [][2]uint32
+}
+
+func nanoCostFixtures(t *testing.T) []nanoCostFixture {
+ t.Helper()
+ var fixtures []nanoCostFixture
+ if err := json.Unmarshal(nanoCostData, &fixtures); err != nil {
+ t.Fatal(err)
+ }
+ return fixtures
+}
+
+func newNanoCostWorld(t *testing.T, fixture nanoCostFixture) (*server, *combatTestConn) {
+ t.Helper()
+ world, conn := newCombatNanoWorld(t, fixture.combatNanoFixture)
+ if fixture.NCU > 49 {
+ // The largest program and a follow-up Boost exceed the fixture's 52 NCU.
+ player := world.characters[1]
+ if granted, err := world.grantItem_locked(player, 204601); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ inventory := player.inventory
+ inventory.Items = slices.Clone(inventory.Items)
+ inventory.Items[len(inventory.Items)-1].Slot = 7
+ if err := world.saveInventory_locked(player, inventory); err != nil {
+ t.Fatal(err)
+ }
+ conn.packets = nil
+ }
+ return world, conn
+}
+
+func TestNanoCostCatalogMatchesCompleteOriginalContracts(t *testing.T) {
+ fixtures := nanoCostFixtures(t)
+ var programs, crystals []uint32
+ var expectedPrograms, expectedCrystals []uint32
+
+ for program := range gamedata.NanoTemplates {
+ if statBuffNano(program) && nanoProgramBonus(program, 318) != 0 {
+ programs = append(programs, program)
+ }
+ }
+ for crystal := range gamedata.ItemTemplates {
+ if slices.Contains(programs, nanoCrystalProgram(crystal)) {
+ crystals = append(crystals, crystal)
+ }
+ }
+ for _, fixture := range fixtures {
+ expectedPrograms = append(expectedPrograms, fixture.Program)
+ expectedCrystals = append(expectedCrystals, fixture.Crystal)
+ }
+ for _, values := range [][]uint32{programs, crystals, expectedPrograms, expectedCrystals} {
+ slices.Sort(values)
+ }
+
+ if len(programs) != 9 || len(crystals) != 9 || !slices.Equal(programs, expectedPrograms) || !slices.Equal(crystals, expectedCrystals) {
+ t.Fatal("cost admission differs from the independent whole-contract census", programs, crystals)
+ }
+ for _, fixture := range fixtures {
+ for _, field := range [][2]uint32{{0, fixture.Flags}, {30, fixture.Can}, {8, fixture.Duration}, {54, fixture.NCU}, {75, fixture.Strain},
+ {210, fixture.RechargeDelay}, {287, fixture.Range}, {294, fixture.AttackDelay}, {407, fixture.NanoCost}} {
+ if nanoStat(fixture.Program, field[0]) != field[1] {
+ t.Fatal("authored casting metadata changed", fixture.Program, field)
+ }
+ }
+ var actions []gamedata.ItemAction
+ var weights []gamedata.ItemEntry
+ var getter [][2]uint32
+ var modifiers [][2]int32
+ for _, section := range gamedata.NanoTemplates[fixture.Program].Sections {
+ if section.Actions != nil {
+ actions = append(actions, *section.Actions...)
+ }
+ if section.Entries != nil {
+ weights = append(weights, *section.Entries...)
+ }
+ if section.Stats != nil {
+ getter = append(getter, *section.Stats...)
+ }
+ if section.Functions != nil {
+ for _, function := range *section.Functions {
+ if function.ID != 53012 || function.Target != fixture.Target || function.HeaderWords != [2]uint32{0, 4} ||
+ function.ArgumentHeader != 9 || function.TickCount != 1 || function.TickInterval != 0 || len(function.Requirements) != 0 ||
+ len(function.Arguments) != 3 || function.Arguments[2].BytesHex == nil || *function.Arguments[2].BytesHex != "00000000" {
+ t.Fatal("complete original Skill effect changed", fixture.Program)
+ }
+ modifiers = append(modifiers, [2]int32{*function.Arguments[0].Integer, *function.Arguments[1].Integer})
+ }
+ }
+ }
+ if !slices.Equal(modifiers, fixture.Modifiers) || !reflect.DeepEqual(actions, fixture.Actions) ||
+ !reflect.DeepEqual(weights, fixture.Weights) || !slices.Equal(getter, fixture.Getter) {
+ t.Fatal("original effect or casting dictionaries changed", fixture.Program)
+ }
+ var crystalActions []gamedata.ItemAction
+ for _, section := range gamedata.ItemTemplates[fixture.Crystal].Sections {
+ if section.Actions != nil {
+ crystalActions = append(crystalActions, *section.Actions...)
+ }
+ }
+ if *gamedata.ItemTemplates[fixture.Crystal].Quality != fixture.Quality || !reflect.DeepEqual(crystalActions, fixture.CrystalActions) {
+ t.Fatal("original uploader quality or criteria changed", fixture.Crystal)
+ }
+ }
+}
+
+func TestNanoCostProgramsUploadCastRestoreAndRemoveTheirContribution(t *testing.T) {
+ for _, fixture := range nanoCostFixtures(t) {
+ t.Run(fmt.Sprint(fixture.Program), func(t *testing.T) {
+ world, _ := newNanoCostWorld(t, fixture)
+ player, client := world.characters[1], world.clients[1]
+ trained := player.baseStats()
+
+ if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 64, 1)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ completed := castTestBuff(t, world, 1, 1, fixture.Program)
+ cold := newTestInventoryServer(t).characters[1]
+
+ if player.nano != 50000-fixture.Debit || cold.nano != player.nano || player.nanoReserved != 0 ||
+ player.nanoBonus(318) != fixture.Modifiers[0][1] || cold.nanoBonus(318) != fixture.Modifiers[0][1] ||
+ player.usedNCU() != fixture.NCU || cold.usedNCU() != fixture.NCU || player.baseStats() != trained || cold.baseStats() != trained ||
+ !slices.Equal(cold.inventory.LearnedNanos, []uint32{fixture.Program}) || slices.ContainsFunc(cold.inventory.Items, func(item ownedItem) bool { return item.Template == fixture.Crystal }) ||
+ player.activeNanos[0].expiresAt.Sub(completed) != time.Duration(fixture.Duration)*10*time.Millisecond {
+ t.Fatal("complete cost program lost its upload, debit, duration or restored contribution", player.nano, cold.nano)
+ }
+ if err := world.handleNanoRemoval(client, characterActionPacket(1, [5]uint32{65, 0, 0, 53019, fixture.Program})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ cold = newTestInventoryServer(t).characters[1]
+ if player.nanoBonus(318) != 0 || cold.nanoBonus(318) != 0 || player.usedNCU() != 0 || cold.usedNCU() != 0 ||
+ len(player.activeNanos) != 0 || len(cold.activeNanos) != 0 {
+ t.Fatal("cost program cancellation retained a modifier or NCU")
+ }
+ })
+ }
+}
+
+func TestNanoCostAffordabilityUsesTheCompleteActiveProgram(t *testing.T) {
+ for _, fixture := range nanoCostFixtures(t) {
+ for _, enough := range []bool{false, true} {
+ t.Run(fmt.Sprintf("%d/%t", fixture.Program, enough), func(t *testing.T) {
+ world, conn := newNanoCostWorld(t, fixture)
+ player, client := world.characters[1], world.clients[1]
+ player.inventory.LearnedNanos = []uint32{fixture.Program, 27169}
+ castTestBuff(t, world, 1, 1, fixture.Program)
+ player.nanoRechargeUntil = time.Time{}
+ debit := map[uint32]uint32{29307: 36, 95408: 39, 95409: 34, 95410: 41, 95411: 38, 95413: 35, 95414: 39, 95416: 40, 95417: 32}[fixture.Program]
+ player.nano = debit
+ if !enough {
+ player.nano--
+ }
+ if err := world.saveNanoBalance_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ conn.packets = nil
+
+ err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, 1, 53019, 27169})[20:])
+ var nano, reserved uint32
+ if queryErr := world.db.QueryRow("SELECT nano,nano_reserved FROM characters WHERE id=1").Scan(&nano, &reserved); queryErr != nil {
+ t.Fatal(queryErr)
+ }
+
+ if err != nil {
+ t.Fatal(err)
+ }
+ if enough {
+ if client.nanoCast == nil || player.nano != 0 || nano != 0 || player.nanoReserved != debit || reserved != debit || len(conn.packets) != 2 {
+ t.Fatal("exactly affordable discounted cast did not reserve once", player.nano, player.nanoReserved)
+ }
+ } else if client.nanoCast != nil || player.nano != debit-1 || nano != debit-1 || player.nanoReserved != 0 || reserved != 0 ||
+ len(conn.packets) != 1 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 108 {
+ t.Fatal("unaffordable discounted cast changed resources or started", player.nano, player.nanoReserved, nano, reserved)
+ }
+ })
+ }
+ }
+}
+
+func TestNanoCostCombinesWornPenaltiesReductionsAndActivePrograms(t *testing.T) {
+ for _, fixture := range []struct {
+ name string
+ templates []uint32
+ buff bool
+ debit uint32
+ }{
+ {"default", nil, false, 44}, {"tank", []uint32{85480}, false, 51},
+ {"CPU", []uint32{95513}, false, 38}, {"opposing equipment", []uint32{85480, 95513}, false, 44},
+ {"tank and nano", []uint32{85480}, true, 48}, {"CPU and nano", []uint32{95513}, true, 35},
+ } {
+ t.Run(fixture.name, func(t *testing.T) {
+ world, _ := newCombatNanoWorld(t, combatNanoFixture{Profession: 12})
+ player, client := world.characters[1], world.clients[1]
+ player.stats.Abilities = characterAbilitiesStats{80, 80, 80, 80, 80, 80}
+ player.inventory.LearnedNanos = []uint32{95410, 27169}
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ // The original belt enables the CPU's authored fifth deck position.
+ for _, template := range append([]uint32{204601}, fixture.templates...) {
+ if granted, err := world.grantItem_locked(player, template); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ slot := map[uint32]uint32{204601: 7, 85480: 19, 95513: 13}[template]
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, slot)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ if client.equipment == nil {
+ t.Fatal("original cost equipment was rejected", template)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ }
+ if fixture.buff {
+ castTestBuff(t, world, 1, 1, 95410)
+ player.nanoRechargeUntil = time.Time{}
+ }
+ before := player.nano
+
+ castTestBuff(t, world, 1, 1, 27169)
+ cold := newTestInventoryServer(t).characters[1]
+
+ if player.nano != before-fixture.debit || cold.nano != player.nano || player.nanoReserved != 0 || cold.nanoReserved != 0 ||
+ player.effectiveAbility(16) != 92 || cold.effectiveAbility(16) != 92 {
+ t.Fatal("cast omitted a signed worn or active cost contribution", before, player.nano, cold.nano)
+ }
+ })
+ }
+}
+
+func TestNanoCostReservationSurvivesModifierChanges(t *testing.T) {
+ for _, operation := range []string{"remove and cancel", "expire and cancel", "remove and complete", "restart"} {
+ t.Run(operation, func(t *testing.T) {
+ world, _ := newCombatNanoWorld(t, combatNanoFixture{Profession: 12})
+ player, client := world.characters[1], world.clients[1]
+ player.inventory.LearnedNanos = []uint32{95410, 27169}
+ castTestBuff(t, world, 1, 1, 95410)
+ player.nanoRechargeUntil = time.Time{}
+ before := player.nano
+ if err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, 1, 53019, 27169})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ if client.nanoCast == nil || player.nanoReserved != 41 || player.nano != before-41 {
+ t.Fatal("discounted cast did not reserve its admission cost")
+ }
+ deadline := client.nanoCast.readyAt
+
+ if operation == "expire and cancel" {
+ player.activeNanos[0].expiresAt = deadline.Add(-time.Nanosecond)
+ world.advanceNanos(deadline.Add(-time.Nanosecond))
+ } else if operation != "restart" {
+ if err := world.handleNanoRemoval(client, characterActionPacket(1, [5]uint32{65, 0, 0, 53019, 95410})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if operation == "remove and complete" {
+ world.advanceNanos(deadline.Add(time.Nanosecond))
+ } else if operation != "restart" {
+ if err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{108})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ world.advanceNanos(deadline.Add(time.Hour))
+ }
+ cold := newTestInventoryServer(t).characters[1]
+ again := newTestInventoryServer(t).characters[1]
+
+ want := before
+ if operation == "remove and complete" {
+ want -= 41
+ }
+ if cold.nano != want || again.nano != want || cold.nanoReserved != 0 || again.nanoReserved != 0 ||
+ operation != "restart" && (player.nano != want || player.nanoReserved != 0 || client.nanoCast != nil) {
+ t.Fatal("modifier change recomputed, lost or duplicated an admitted charge/refund", before, player.nano, cold.nano)
+ }
+ if operation != "restart" && (player.nanoBonus(318) != 0 || cold.nanoBonus(318) != 0) {
+ t.Fatal("removed cost modifier remained active")
+ }
+ })
+ }
+}
+
+func TestNanoCostProgramsEnforceEachUploadAndCastRequirement(t *testing.T) {
+ for _, fixture := range nanoCostFixtures(t) {
+ for _, requirement := range fixture.Actions[0].Requirements {
+ if requirement.Operator != 2 && requirement.Stat != 368 {
+ continue
+ }
+ for _, passed := range []bool{false, true} {
+ t.Run(fmt.Sprintf("%d/%d/%t", fixture.Program, requirement.Stat, passed), func(t *testing.T) {
+ world, _ := newNanoCostWorld(t, fixture)
+ player, client := world.characters[1], world.clients[1]
+ player.stats.Abilities = characterAbilitiesStats{1, 1, 1, 1, 1, 1}
+ if requirement.Stat == 368 {
+ if !passed {
+ player.profession = 1
+ }
+ } else {
+ for _, field := range player.stats.trainingStats() {
+ if field.stat == uint32(requirement.Stat) {
+ *field.value = uint16(requirement.Value)
+ if passed {
+ *field.value++
+ }
+ }
+ }
+ }
+
+ if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 64, 1)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ learned := len(player.inventory.LearnedNanos) == 1
+ player.inventory.LearnedNanos = []uint32{fixture.Program}
+ err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, 1, 53019, fixture.Program})[20:])
+
+ if err != nil || learned != passed || (client.nanoCast != nil) != passed ||
+ !passed && (player.nano != 50000 || player.nanoReserved != 0) || len(player.activeNanos) != 0 {
+ t.Fatal("cost uploader or cast bypassed an authored strict skill/profession requirement", err)
+ }
+ })
+ }
+ }
+ }
+}
+
+func TestNanoCostZeroAndNegativeDebits(t *testing.T) {
+ for _, fixture := range []struct {
+ modifier int32
+ raw uint32
+ accepted bool
+ }{
+ {-7, 1, true}, {-100, 45, true}, {-120, 45, false},
+ } {
+ t.Run(fmt.Sprintf("%d/%d", fixture.modifier, fixture.raw), func(t *testing.T) {
+ // Exercise arithmetic boundaries with otherwise complete template contracts.
+ original, originalBoost := gamedata.NanoTemplates[95410], gamedata.NanoTemplates[27169]
+ definition, boost := *original, *originalBoost
+ definition.Sections = slices.Clone(original.Sections)
+ functions := slices.Clone(*definition.Sections[2].Functions)
+ functions[0].Arguments = slices.Clone(functions[0].Arguments)
+ functions[0].Arguments[1].Integer = new(fixture.modifier)
+ definition.Sections[2].Functions = &functions
+ boost.Stats = slices.Clone(originalBoost.Stats)
+ for index, stat := range boost.Stats {
+ if stat[0] == 407 {
+ boost.Stats[index][1] = fixture.raw
+ }
+ }
+ gamedata.NanoTemplates[95410], gamedata.NanoTemplates[27169] = &definition, &boost
+ t.Cleanup(func() { gamedata.NanoTemplates[95410], gamedata.NanoTemplates[27169] = original, originalBoost })
+ world, _ := newCombatNanoWorld(t, combatNanoFixture{Profession: 12})
+ player, client := world.characters[1], world.clients[1]
+ player.inventory.LearnedNanos = []uint32{95410, 27169}
+ castTestBuff(t, world, 1, 1, 95410)
+ player.nano, player.nanoRechargeUntil = 0, time.Time{}
+ if err := world.saveNanoBalance_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ strength := player.effectiveAbility(16)
+
+ err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, 1, 53019, 27169})[20:])
+ admitted := client.nanoCast != nil
+ if admitted {
+ world.advanceNanos(client.nanoCast.readyAt.Add(time.Nanosecond))
+ }
+ cold := newTestInventoryServer(t).characters[1]
+
+ if err != nil || admitted != fixture.accepted || player.nano != 0 || cold.nano != 0 ||
+ player.nanoReserved != 0 || cold.nanoReserved != 0 || (player.effectiveAbility(16) == strength+12) != fixture.accepted {
+ t.Fatal("zero cost was rejected or negative cost created points/effects", err, admitted, player.nano, cold.nano)
+ }
+ })
+ }
+}
+
+func TestNanoCostFailuresPublishNeitherChargeNorEffect(t *testing.T) {
+ for _, phase := range []string{"admission", "outcome"} {
+ for _, failure := range []string{"error", "ignore", "commit"} {
+ t.Run(phase+"/"+failure, func(t *testing.T) {
+ world, conn := newCombatNanoWorld(t, combatNanoFixture{Profession: 12})
+ player, client := world.characters[1], world.clients[1]
+ player.inventory.LearnedNanos = []uint32{95410, 27169}
+ castTestBuff(t, world, 1, 1, 95410)
+ player.nanoRechargeUntil = time.Time{}
+ before := player.nano
+ request := characterActionPacket(1, [5]uint32{19, 50000, 1, 53019, 27169})[20:]
+ if phase == "outcome" {
+ if err := world.handleNanoCast(client, request); err != nil || client.nanoCast == nil || player.nanoReserved != 41 {
+ t.Fatal("discounted cast did not reserve before outcome fault", err)
+ }
+ }
+ event, condition := "UPDATE OF nano_reserved ON characters", "NEW.nano_reserved!=0"
+ if phase == "outcome" {
+ event, condition = "INSERT ON active_nanos", "NEW.program_id=27169"
+ }
+ statement := "CREATE TRIGGER fail_cost BEFORE " + event + " WHEN " + condition + " BEGIN SELECT RAISE(FAIL,'test cost'); END"
+ if failure == "ignore" {
+ statement = "CREATE TRIGGER fail_cost BEFORE " + event + " WHEN " + condition + " BEGIN SELECT RAISE(IGNORE); END"
+ } else if failure == "commit" {
+ statement = "CREATE TABLE pending_cost (player_id INTEGER REFERENCES players(id) DEFERRABLE INITIALLY DEFERRED); CREATE TRIGGER fail_cost AFTER " + event + " WHEN " + condition + " BEGIN INSERT INTO pending_cost VALUES(999999); END"
+ }
+ if _, err := world.db.Exec(statement); err != nil {
+ t.Fatal(err)
+ }
+ conn.packets = nil
+
+ if phase == "admission" {
+ if err := world.handleNanoCast(client, request); err == nil {
+ t.Fatal("failed reservation returned success")
+ }
+ } else {
+ world.advanceNanos(client.nanoCast.readyAt.Add(time.Nanosecond))
+ }
+ cold := newTestInventoryServer(t).characters[1]
+
+ if player.nano != before || cold.nano != before || player.nanoReserved != 0 || cold.nanoReserved != 0 || client.nanoCast != nil ||
+ !player.nanoRechargeUntil.IsZero() || len(player.activeNanos) != 1 || len(cold.activeNanos) != 1 ||
+ player.nanoBonus(318) != -7 || player.nanoBonus(16) != 0 {
+ t.Fatal("failed discounted cast published partial resources, recharge or effects", player.nano, before)
+ }
+ if phase == "admission" && len(conn.packets) != 0 || phase == "outcome" &&
+ (len(conn.packets) != 2 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 108) {
+ t.Fatal("failed discounted cast published success", conn.packets)
+ }
+ if _, err := world.db.Exec("DROP TRIGGER fail_cost"); err != nil {
+ t.Fatal(err)
+ }
+ castTestBuff(t, world, 1, 1, 27169)
+ if player.nano != before-41 || player.nanoBonus(16) != 12 || len(player.activeNanos) != 2 {
+ t.Fatal("retry lost the cost contribution or repeated the charge")
+ }
+ })
+ }
+ }
+}
+
+func TestNanoCostUnknownProgramsRejectWithoutMutation(t *testing.T) {
+ for _, program := range []uint32{0, 0xffffffff} {
+ t.Run(fmt.Sprint(program), func(t *testing.T) {
+ world, conn := newNanoCastingWorld(t)
+ player, client := world.characters[1], world.clients[1]
+
+ err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, 1000000, 53019, program})[20:])
+
+ if err != nil || client.nanoCast != nil || player.nano != 30 || player.nanoReserved != 0 || world.characters[1000000].health != 100 ||
+ len(conn.packets) != 1 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 108 {
+ t.Fatal("unknown program changed resources, effects or cast state", program, err)
+ }
+ })
+ }
+}
diff --git a/server/stat_buff_catalog_test.go b/server/stat_buff_catalog_test.go
@@ -65,6 +65,10 @@ func TestStatBuffCatalogAdmitsOnlyCompleteOrdinaryContracts(t *testing.T) {
expectedPrograms = append(expectedPrograms, fixture.Program)
expectedCrystals = append(expectedCrystals, fixture.Crystal)
}
+ for _, fixture := range nanoCostFixtures(t) {
+ expectedPrograms = append(expectedPrograms, fixture.Program)
+ expectedCrystals = append(expectedCrystals, fixture.Crystal)
+ }
slices.Sort(expectedPrograms)
slices.Sort(expectedCrystals)
@@ -82,10 +86,10 @@ func TestStatBuffCatalogAdmitsOnlyCompleteOrdinaryContracts(t *testing.T) {
slices.Sort(crystals)
// Exact IDs come from the independent complete-original-record catalog audit.
- if len(programs) != 448 || !slices.Equal(programs, expectedPrograms) {
+ if len(programs) != 457 || !slices.Equal(programs, expectedPrograms) {
t.Fatal("buff admission differs from the complete effect/metadata audit", programs)
}
- if len(crystals) != 446 || !slices.Equal(crystals, expectedCrystals) {
+ if len(crystals) != 455 || !slices.Equal(crystals, expectedCrystals) {
t.Fatal("crystal admission differs from the complete upload audit", crystals)
}
}
diff --git a/server/testdata/nano-cost-nanos.json b/server/testdata/nano-cost-nanos.json
@@ -0,0 +1,11 @@
+[
+ {"program": 29307, "name": "Neuron-Notum Interface", "crystal": 29404, "quality": 129, "profession": 12, "modifiers": [[318, -19]], "ncu": 40, "duration": 540000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 301, "nano_cost": 302, "attack_delay": 323, "recharge_delay": 392, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 127, "value": 615, "operator": 2}, {"stat": 128, "value": 615, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 553, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 127, "value": 615, "operator": 2}, {"stat": 128, "value": 615, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 553, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 35], [128, 34], [129, 31]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -19}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [183, 16446], [79, 16303], [287, 20], [405, 2], [54, 40], [407, 302], [294, 323], [210, 392], [413, 1030], [419, 17200], [366, 49999], [361, 43420], [428, 46129], [8, 540000], [75, 148], [269, 900287342], [272, 3809316544], [270, 3290658829]], "crystal_stats": [[76, 0], [30, 41], [0, 2151678467], [298, 0], [88, 0], [54, 129], [74, 482019], [2, 100], [79, 42448], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 29307}]}]},
+ {"program": 95408, "name": "Notum Attunement", "crystal": 95426, "quality": 60, "profession": 12, "modifiers": [[318, -12]], "ncu": 19, "duration": 420000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 149, "nano_cost": 150, "attack_delay": 311, "recharge_delay": 345, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 127, "value": 283, "operator": 2}, {"stat": 128, "value": 283, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 251, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 127, "value": 283, "operator": 2}, {"stat": 128, "value": 283, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 251, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 34], [128, 35], [129, 31]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -12}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 19], [407, 150], [294, 311], [210, 345], [8, 420000], [413, 1030], [428, 46126], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900320893], [272, 3935145605], [270, 2755360885]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 60], [74, 57194], [2, 100], [79, 12256], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95408}]}]},
+ {"program": 95409, "name": "Mocham's Neural Interface-Web", "crystal": 95425, "quality": 159, "profession": 12, "modifiers": [[318, -24]], "ncu": 49, "duration": 720000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 374, "nano_cost": 375, "attack_delay": 331, "recharge_delay": 425, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 127, "value": 742, "operator": 2}, {"stat": 128, "value": 742, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 671, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 127, "value": 742, "operator": 2}, {"stat": 128, "value": 742, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 671, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 35], [128, 34], [129, 31]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -24}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 49], [407, 375], [294, 331], [210, 425], [8, 720000], [413, 1030], [428, 46145], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900648301], [272, 3800927494], [270, 2495313925]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 159], [74, 869573], [2, 100], [79, 42448], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95409}]}]},
+ {"program": 95410, "name": "Ease of Execution", "crystal": 95418, "quality": 24, "profession": 12, "modifiers": [[318, -7]], "ncu": 8, "duration": 420000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 61, "nano_cost": 62, "attack_delay": 304, "recharge_delay": 317, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 127, "value": 117, "operator": 2}, {"stat": 128, "value": 117, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 99, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 127, "value": 117, "operator": 2}, {"stat": 128, "value": 117, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 99, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 35], [128, 35], [129, 30]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -7}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 8], [407, 62], [294, 304], [210, 317], [8, 420000], [413, 1030], [428, 46107], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900320893], [272, 3935145605], [270, 2755360885]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 24], [74, 7777], [2, 100], [79, 12228], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95410}]}]},
+ {"program": 95411, "name": "Coherent Notum Web", "crystal": 95428, "quality": 90, "profession": 12, "modifiers": [[318, -15]], "ncu": 28, "duration": 540000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 218, "nano_cost": 219, "attack_delay": 316, "recharge_delay": 365, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 127, "value": 421, "operator": 2}, {"stat": 128, "value": 421, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 378, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 127, "value": 421, "operator": 2}, {"stat": 128, "value": 421, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 378, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 12, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 34], [128, 35], [129, 31]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -15}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 28], [407, 219], [294, 316], [210, 365], [8, 540000], [413, 1030], [428, 46126], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900287342], [272, 3809316544], [270, 3290658829]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 90], [74, 169782], [2, 100], [79, 12256], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95411}]}]},
+ {"program": 95413, "name": "Jobe Nano Libraries", "crystal": 95419, "quality": 152, "profession": 11, "modifiers": [[318, -22]], "ncu": 47, "duration": 420000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 373, "nano_cost": 374, "attack_delay": 328, "recharge_delay": 411, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 122, "value": 707, "operator": 2}, {"stat": 127, "value": 707, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 707, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 122, "value": 707, "operator": 2}, {"stat": 127, "value": 707, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 707, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 34], [129, 33], [122, 33]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -22}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 47], [407, 374], [294, 328], [210, 411], [8, 420000], [413, 1030], [428, 46145], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900287342], [272, 3333774743], [270, 3290658829]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 152], [74, 738182], [2, 100], [79, 42448], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95413}]}]},
+ {"program": 95414, "name": "On-The-Fly Compression", "crystal": 95420, "quality": 73, "profession": 11, "modifiers": [[318, -13]], "ncu": 23, "duration": 360000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 192, "nano_cost": 193, "attack_delay": 313, "recharge_delay": 353, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 122, "value": 349, "operator": 2}, {"stat": 127, "value": 349, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 349, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 122, "value": 349, "operator": 2}, {"stat": 127, "value": 349, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 349, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 34], [129, 33], [122, 33]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -13}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 23], [407, 193], [294, 313], [210, 353], [8, 360000], [413, 1030], [428, 46126], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900320893], [272, 3333774743], [270, 2495313925]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 73], [74, 94842], [2, 100], [79, 12256], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95414}]}]},
+ {"program": 95416, "name": "Run-Time Recompiler", "crystal": 95421, "quality": 33, "profession": 11, "modifiers": [[318, -9]], "ncu": 11, "duration": 360000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 90, "nano_cost": 91, "attack_delay": 306, "recharge_delay": 324, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 122, "value": 162, "operator": 2}, {"stat": 127, "value": 162, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 162, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 122, "value": 162, "operator": 2}, {"stat": 127, "value": 162, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 162, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 34], [129, 33], [122, 33]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -9}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 11], [407, 91], [294, 306], [210, 324], [8, 360000], [413, 1030], [428, 46107], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900320893], [272, 3333774743], [270, 2495313925]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 33], [74, 14233], [2, 100], [79, 12228], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95416}]}]},
+ {"program": 95417, "name": "Izgimmer's Obfuscated Recompiler", "crystal": 95424, "quality": 179, "profession": 11, "modifiers": [[318, -28]], "ncu": 55, "duration": 420000, "strain": 148, "flags": 65536, "can": 0, "target": 3, "debit": 446, "nano_cost": 447, "attack_delay": 337, "recharge_delay": 447, "range": 20, "actions": [{"type": 3, "requirements": [{"stat": 122, "value": 826, "operator": 2}, {"stat": 127, "value": 826, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 826, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "crystal_actions": [{"type": 3, "requirements": [{"stat": 122, "value": 826, "operator": 2}, {"stat": 127, "value": 826, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 129, "value": 826, "operator": 2}, {"stat": 0, "value": 0, "operator": 4}, {"stat": 368, "value": 11, "operator": 0}, {"stat": 0, "value": 0, "operator": 4}]}], "weights": [{"type": 12, "stats": [[127, 34], [129, 33], [122, 33]]}], "getter": [[12, 0]], "functions": [{"id": 53012, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 3, "argument_header": 9, "arguments": [{"integer": 318}, {"integer": -28}, {"bytes_hex": "00000000"}]}], "stats": [[76, 0], [30, 0], [0, 65536], [298, 0], [88, 0], [79, 16303], [183, 16446], [287, 20], [405, 2], [54, 55], [407, 447], [294, 337], [210, 447], [8, 420000], [413, 1030], [428, 46145], [366, 49999], [361, 43029], [419, 17700], [75, 148], [269, 900648301], [272, 3333774743], [270, 2755360885]], "crystal_stats": [[76, 0], [30, 41], [0, 4194819], [298, 0], [88, 0], [54, 179], [74, 1180958], [2, 100], [79, 42448], [12, 26160], [26, 1]], "crystal_functions": [{"id": 53019, "header_words": [0, 4], "requirements": [], "tick_count": 1, "tick_interval": 0, "target": 2, "argument_header": 9, "arguments": [{"integer": 95417}]}]}
+]