Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

game_data_catalog.gno

7.20 Kb · 191 lines
  1package game31
  2
  3// ── Claim-rate skill headroom factors (game29 caps, §5 of REPORT.md) ─────────
  4// When on-chain skillRanks are available these are computed from actual ranks.
  5// Until then we use fixed conservative headroom = client-side cap maximums.
  6// The effective rate for rarity r = base_rate[r] × skillHeadroom[r].
  7const (
  8	// dust: +4 yield cap, double drop and hardening -> sim max 1.70x of the 1.01 cap; 1.75 gives margin.
  9	skillDustHeadroom = uint64(175) // ×175/100
 10
 11	// Maximum damage multiplier: ≤ 2× → twice as many blocks per minute.
 12	skillDmgHeadroom = uint64(200) // ×200/100
 13
 14	// Maximum drop-rate bonus: +30% → 1.30×.
 15	skillDropHeadroom = uint64(130) // ×130/100
 16)
 17
 18// toolLifeSkillIds lists the on-chain skills that grant toolLifeBonus.
 19// Covers the Things branch (level 50) and the Nature-branch skills that also
 20// affect tool wear. Must stay in sync with catalog.ts SKILLS[*].toolLifeBonus.
 21var toolLifeSkillIds = []string{
 22	"tempered_grip",   // +10%/rank   (Things)
 23	"stone_sense",     // +0.5%/rank  (Nature)
 24	"master_craft",    // +15%/rank   (Things)
 25	"thorn_hide",      // +1%/rank    (Nature)
 26	"storm_surge",     // +1.5%/rank  (Nature)
 27	"workshop_lore",   // +15%/rank   (Things)
 28	"iron_discipline", // +20%/rank   (Things)
 29	"vault_keeper",    // +20%/rank   (Things)
 30	"precision_forge", // +25%/rank   (Things)
 31	"field_repair",    // +10%/rank   (Things)
 32	"deep_science",    // +25%/rank   (Things)
 33}
 34
 35// toolLifeSkillBonus maps each skill to its per-rank life bonus fraction × 1000.
 36// e.g. "tempered_grip" → 100 means +10.0% per rank (100/1000 = 0.10).
 37var toolLifeSkillBonus = map[string]uint64{
 38	"tempered_grip":   100, // +10%/rank
 39	"stone_sense":       5, // +0.5%/rank
 40	"master_craft":    150, // +15%/rank
 41	"thorn_hide":       10, // +1%/rank
 42	"storm_surge":      15, // +1.5%/rank
 43	"workshop_lore":   150, // +15%/rank
 44	"iron_discipline": 200, // +20%/rank
 45	"vault_keeper":    200, // +20%/rank
 46	"precision_forge": 250, // +25%/rank
 47	"field_repair":    100, // +10%/rank
 48	"deep_science":    250, // +25%/rank
 49}
 50
 51// ── Claim rate cap tables (REPORT.md §5) ─────────────────────────────────────
 52// claimBucketSecs: how many seconds of allowance the bucket can bank (1 hour).
 53const claimBucketSecs = int64(3600)
 54
 55// claimRatePerMin[toolId][rarity] = max coins/min of that rarity the caller may
 56// claim (before skill headroom). Indexed 0=dust..6=mythic.
 57var claimRatePerMin = map[string][7]uint64{
 58	"hands":        {12, 0, 0, 0, 0, 0, 0},
 59	"starter-twig": {16, 0, 0, 0, 0, 0, 0},
 60	"twig":         {23, 0, 0, 0, 0, 0, 0},
 61	"wood":         {32, 9, 0, 0, 0, 0, 0},
 62	"stone":        {69, 20, 6, 0, 0, 0, 0},
 63	"iron":         {184, 55, 15, 5, 0, 0, 0},
 64	"gold":         {422, 140, 40, 13, 4, 0, 0},
 65	"diamond":      {783, 333, 112, 36, 12, 3, 0},
 66	"cosmic":       {1406, 658, 296, 110, 36, 8, 2},
 67	"plasma":       {1422, 919, 393, 171, 59, 13, 4},
 68	"neutron":      {1449, 1207, 513, 263, 94, 22, 7},
 69	"quasar":       {1476, 1233, 654, 385, 147, 34, 10},
 70	"void":         {1503, 1255, 853, 489, 220, 55, 16},
 71	"genesis":      {1544, 1289, 1083, 610, 341, 90, 26},
 72	"omega":        {1598, 1334, 1124, 769, 516, 145, 42},
 73}
 74
 75// ── Vein caps (game29) ───────────────────────────────────────────────────────
 76// Every coin in coinRarity has a vein from deploy: its max is the default for
 77// its rarity unless the admin overrides it. No per-coin init writes needed.
 78// Defaults: ≈1 year of demand per core coin × 1.5 headroom (see REPORT §6).
 79var veinDefaultMax = [7]uint64{
 80	50000000, // r0 dust
 81	82000000, // r1 common
 82	25000000, // r2 uncommon
 83	25000000, // r3 rare
 84	20000000, // r4 epic
 85	25000000, // r5 legendary
 86	85000000, // r6 mythic
 87}
 88
 89// Per-coin default overrides (static: no deploy-time writes).
 90var veinCoinDefault = map[string]uint64{
 91	"grin": 102000000,
 92}
 93
 94// ── Achievement allowlist (game29) ───────────────────────────────────────────
 95// Static ids with FIXED rewards. Grind ids "g.<coin>.<need>" are valid for any
 96// allowlisted coin and need ∈ grindRungs. The client can never choose a reward.
 97type coinAmt struct {
 98	coin string
 99	amt  uint64
100}
101
102var achievementRewards = map[string][]coinAmt{
103	"ad_1":         {{"grin", 10}},
104	"ad_5":         {{"coffee", 6}},
105	"blocks_1":     {{"grin", 4}},
106	"blocks_10":    {{"seedling", 6}},
107	"blocks_25k":   {{"pick", 2}},
108	"blocks_50":    {{"seedling", 12}},
109	"blocks_500":   {{"log", 6}, {"rock", 10}},
110	"blocks_5k":    {{"gear", 4}},
111	"combo_12":     {{"grin", 12}},
112	"cosmic_own":   {{"moon", 4}},
113	"diamond_own":  {{"spark", 8}},
114	"dj":           {{"music", 6}},
115	"era_1":        {{"bolt", 3}},
116	"first-clash":  {{"rock", 10}},
117	"first_tap":    {{"grin", 8}},
118	"gem":          {{"spark", 6}},
119	"genesis_own":  {{"dragon", 1}},
120	"gold_own":     {{"pick", 3}},
121	"iron_own":     {{"gold-medal", 2}},
122	"miner-1":      {{"seedling", 10}},
123	"mythic":       {{"galaxy", 1}},
124	"neutron_own":  {{"dna", 2}},
125	"omega_own":    {{"lotus", 1}},
126	"pioneer":      {{"grin", 50}},
127	"plasma_own":   {{"bolt", 3}},
128	"quasar_own":   {{"comet", 2}},
129	"rarity_0":     {{"grin", 6}},
130	"rarity_1":     {{"seedling", 6}},
131	"rarity_2":     {{"rock", 5}},
132	"rarity_3":     {{"fire", 4}},
133	"rarity_4":     {{"spark", 6}},
134	"rarity_5":     {{"star", 2}},
135	"send":         {{"heart", 4}},
136	"shiny":        {{"spark", 6}},
137	"slot-roller":  {{"gold-medal", 1}},
138	"starter-twig": {{"grin", 20}},
139	"stone_own":    {{"gear", 4}},
140	"swap":         {{"up", 6}},
141	"twig_own":     {{"grin", 50}},
142	"unique_1":     {{"grin", 40}},
143	"unique_10":    {{"fire", 20}},
144	"unique_100":   {{"lotus", 3}, {"peacock", 2}},
145	"unique_15":    {{"rock", 24}},
146	"unique_25":    {{"clover", 12}},
147	"unique_3":     {{"seedling", 24}},
148	"unique_40":    {{"pizza", 16}},
149	"unique_5":     {{"leaves", 24}},
150	"unique_50":    {{"star", 10}},
151	"unique_60":    {{"bolt", 10}},
152	"unique_75":    {{"crown", 6}},
153	"unique_80":    {{"gem", 4}},
154	"unique_85":    {{"planet", 3}},
155	"unique_90":    {{"galaxy", 2}},
156	"unique_95":    {{"lotus", 2}},
157	"unique_99":    {{"unicorn", 2}},
158	"void_own":     {{"new-moon", 4}},
159	"wood_own":     {{"rock", 8}},
160}
161
162var grindRungs = []uint64{10, 100, 1000, 10000, 100000}
163
164func grindPay(need uint64) uint64 {
165	switch {
166	case need >= 100000:
167		return 480
168	case need >= 10000:
169		return 140
170	case need >= 1000:
171		return 56
172	case need >= 100:
173		return 20
174	}
175	return 10
176}
177
178// ── PvP / casino allowlists ──────────────────────────────────────────────────
179var pvpGames = map[string][]string{
180	"rps":          {"rock", "paper", "scissors"},
181	"coin_flip":    {"heads", "tails"},
182	"higher_lower": {"higher", "lower"},
183}
184
185const (
186	pvpTimeoutSec        = int64(600) // AFK window before ClaimPvpTimeout
187	pvpRakePct           = uint64(2)  // to admin balance
188	voucherMaxTTL        = int64(900) // vouchers must expire within 15 min
189	claimCooldownSec     = int64(60)  // min seconds between ClaimAndMint
190	claimInitialGraceSec = int64(300) // a new rarity bucket starts with 5 min of allowance
191)