code wiki / _hdl_build / nx_swap.nx
nx_swap.nx
buildroot/runtime/_hdl_build/nx_swap.nx
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
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
| 16 | func sw_put(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 25 | func sw_split(buf: *u8, len: i64, out: *i64) -> i64 |
| 47 | func sw_list_append(prefix: *u8, key: *u8, token: *u8) -> i64 |
| 66 | func 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 |
| 67 | func sw_cfg(prefix: *u8, f: i64) -> i64 |
| 77 | func sw_add_species(prefix: *u8, sid: *u8, name: *u8, category: *u8, rarity: *u8) -> i64 |
| 85 | func sw_species_field(prefix: *u8, sid: *u8, f: i64, out: *u8) -> i64 |
| 94 | func 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 } |
| 95 | func 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 } |
| 96 | func sw_add_gardener(prefix: *u8, gid: *u8, name: *u8, area: *u8) -> i64 |
| 108 | func sw_g_field(prefix: *u8, gid: *u8, f: i64, out: *u8) -> i64 |
| 115 | func sw_xp(prefix: *u8, gid: *u8) -> i64 |
| 122 | func sw_add_xp(prefix: *u8, gid: *u8, amt: i64) -> i64 |
| 129 | func sw_level(prefix: *u8, gid: *u8) -> i64 |
| 136 | func 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 } |
| 137 | func 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 } |
| 138 | func sw_dex_has(prefix: *u8, gid: *u8, species: *u8) -> i64 called by 5: sw_dex_addsw_claim_offersw_set_completesw_set_progressmain calls 3: sys_mmapsw_dex_keyss_get |
| 145 | func sw_dex_count(prefix: *u8, gid: *u8) -> i64 |
| 152 | func sw_dex_add(prefix: *u8, gid: *u8, species: *u8) -> i64 called by 2: sw_post_offersw_claim_offer calls 7: sw_dex_hassys_mmapsw_dex_keysw_putsw_dex_countsw_dexn_key+1 |
| 164 | func 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 } |
| 165 | func 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 } |
| 167 | func sw_post_offer(prefix: *u8, oid: *u8, gid: *u8, species: *u8, form: *u8, qty: i64, area: *u8, note: *u8) -> i64 |
| 185 | func sw_offer_field(prefix: *u8, oid: *u8, f: i64, out: *u8) -> i64 called by 3: sw_find_offerssw_claim_offersw_render_board calls 4: sys_mmapsw_offer_keyss_getfd_field |
| 192 | func sw_offer_open(prefix: *u8, oid: *u8) -> i64 called by 4: sw_find_offerssw_claim_offersw_render_boardmain calls 4: sys_mmapsw_ostatus_keyss_getfd_streq |
| 199 | func sw_post_request(prefix: *u8, rid: *u8, gid: *u8, species: *u8, area: *u8) -> i64 |
| 211 | func sw_find_offers(prefix: *u8, species: *u8, area: *u8, outoids: *i64) -> i64 called by 3: lk_render_itemmainmain calls 6: sys_mmapss_getsw_splitsw_offer_fieldfd_streqsw_offer_open |
| 235 | func sw_claim_offer(prefix: *u8, oid: *u8, taker_gid: *u8) -> i64 |
| 252 | func sw_add_set(prefix: *u8, setid: *u8, record: *u8) -> i64 |
| 257 | func sw_set_complete(prefix: *u8, gid: *u8, setid: *u8) -> i64 called by 4: sw_award_badgemaincomplete_and_rewardmain calls 5: sys_mmapas_appendss_getfd_fieldsw_dex_has |
| 279 | func 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 } |
| 280 | func sw_has_badge(prefix: *u8, gid: *u8, setid: *u8) -> i64 |
| 288 | func sw_award_badge(prefix: *u8, gid: *u8, setid: *u8) -> i64 called by 2: maincomplete_and_reward calls 7: sw_set_completesw_has_badgesys_mmapsw_badge_keysw_putsw_add_xp+1 |
| 298 | func sw_set_progress(prefix: *u8, gid: *u8, setid: *u8, total_out: *i64) -> i64 |
| 324 | func sw_render_board(prefix: *u8, ads_prefix: *u8, area: *u8, gid: *u8, setid: *u8, out: *u8) -> i64 |