code wiki / _hdl_build / nx_swap.nx

nx_swap.nx

buildroot/runtime/_hdl_build/nx_swap.nx

20115 B389 linesdepth 5pulls 6 transitivereach 6 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_swap.nx -- LIB: the GAMIFIED COMMUNITY PLANT/HERB SWAP (operator: "a community swap that's like a gamified fun exchange like Pokemon GO but for gardening without the licensing and other issues but allows a person to ask and give say basil or rosemary instead of buying at a store"). Pokemon-GO-style FUN, but our OWN IP: the "collection" is REAL PLANTS (a garden-dex), the mechanics are ours (no third-party IP/licensing). A GIFT economy -- ask + give, NO money -- so you get basil/rosemary by swapping with neighbours instead of buying. Gamification: a garden DEX (species you grow/swapped), XP for giving + collecting, LEVELS, SETS + BADGES ("gotta grow 'em all"), rarity. Area-based local discovery (privacy-first: an AREA, not GPS). Ties to the seed-to-feed lineage (a swapped seed records origin=swapped). Sovereign seg-store (knowledge/store/swap-*, NO TSV), integer-only. Composes nx_ads for a sovereign in-board ad slot. license_tier: ORIGINAL

dependencies 4 imports · 3 importers

nx_ads.nx nx_food_science.nx nx_seg_store.nx nx_syscalls.nx nx_swap.nx nx_link.nx nx_swap_gate.nx nx_swap_reward_gate.nx

imports: nx_ads.nxnx_food_science.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_link.nxnx_swap_gate.nxnx_swap_reward_gate.nx

structs

none

consts

none

functions

16func sw_put(prefix: *u8, key: *u8, val: *u8) -> i64
25func sw_split(buf: *u8, len: i64, out: *i64) -> i64
47func sw_list_append(prefix: *u8, key: *u8, token: *u8) -> i64
66func sw_seed_config(prefix: *u8) -> i64 { return sw_put(prefix, "swap:xpconfig" as *u8, "10\t10\t25\t100\t50" as *u8) } // give,receive,newspecies,setcomplete,per_level
called by 4: mainmainmainmain calls 1: sw_put
67func sw_cfg(prefix: *u8, f: i64) -> i64
77func sw_add_species(prefix: *u8, sid: *u8, name: *u8, category: *u8, rarity: *u8) -> i64
85func sw_species_field(prefix: *u8, sid: *u8, f: i64, out: *u8) -> i64
94func sw_g_key(gid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:gardener:" as *u8); o = as_append(out, o, gid); out[o] = 0 as u8; return o }
called by 2: sw_add_gardenersw_g_field calls 1: as_append
95func sw_xp_key(gid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:xp:" as *u8); o = as_append(out, o, gid); out[o] = 0 as u8; return o }
96func sw_add_gardener(prefix: *u8, gid: *u8, name: *u8, area: *u8) -> i64
108func sw_g_field(prefix: *u8, gid: *u8, f: i64, out: *u8) -> i64
115func sw_xp(prefix: *u8, gid: *u8) -> i64
122func sw_add_xp(prefix: *u8, gid: *u8, amt: i64) -> i64
129func sw_level(prefix: *u8, gid: *u8) -> i64
called by 2: sw_render_boardmain calls 2: sw_cfgsw_xp
136func sw_dex_key(gid: *u8, species: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:dex:" as *u8); o = as_append(out, o, gid); out[o] = 58 as u8; o = o + 1; o = as_append(out, o, species); out[o] = 0 as u8; return o }
called by 2: sw_dex_hassw_dex_add calls 1: as_append
137func sw_dexn_key(gid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:dexn:" as *u8); o = as_append(out, o, gid); out[o] = 0 as u8; return o }
called by 2: sw_dex_countsw_dex_add calls 1: as_append
138func sw_dex_has(prefix: *u8, gid: *u8, species: *u8) -> i64
145func sw_dex_count(prefix: *u8, gid: *u8) -> i64
152func sw_dex_add(prefix: *u8, gid: *u8, species: *u8) -> i64
164func sw_offer_key(oid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:offer:" as *u8); o = as_append(out, o, oid); out[o] = 0 as u8; return o }
165func sw_ostatus_key(oid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:ostatus:" as *u8); o = as_append(out, o, oid); out[o] = 0 as u8; return o }
167func sw_post_offer(prefix: *u8, oid: *u8, gid: *u8, species: *u8, form: *u8, qty: i64, area: *u8, note: *u8) -> i64
185func sw_offer_field(prefix: *u8, oid: *u8, f: i64, out: *u8) -> i64
192func sw_offer_open(prefix: *u8, oid: *u8) -> i64
199func sw_post_request(prefix: *u8, rid: *u8, gid: *u8, species: *u8, area: *u8) -> i64
211func sw_find_offers(prefix: *u8, species: *u8, area: *u8, outoids: *i64) -> i64
235func sw_claim_offer(prefix: *u8, oid: *u8, taker_gid: *u8) -> i64
252func sw_add_set(prefix: *u8, setid: *u8, record: *u8) -> i64
called by 2: mainmain calls 3: sys_mmapas_appendsw_put
257func sw_set_complete(prefix: *u8, gid: *u8, setid: *u8) -> i64
279func sw_badge_key(gid: *u8, setid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "swap:badge:" as *u8); o = as_append(out, o, gid); out[o] = 58 as u8; o = o + 1; o = as_append(out, o, setid); out[o] = 0 as u8; return o }
280func sw_has_badge(prefix: *u8, gid: *u8, setid: *u8) -> i64
288func sw_award_badge(prefix: *u8, gid: *u8, setid: *u8) -> i64
298func sw_set_progress(prefix: *u8, gid: *u8, setid: *u8, total_out: *i64) -> i64
324func sw_render_board(prefix: *u8, ads_prefix: *u8, area: *u8, gid: *u8, setid: *u8, out: *u8) -> i64