react-native-monflowts 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/README.md +37 -3
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/java/com/monflowts/MonflowtsNavigationModule.kt +43 -0
  4. package/android/src/main/java/com/monflowts/MonflowtsPackage.kt +10 -1
  5. package/android/src/main/java/com/monflowts/MonflowtsStackView.kt +443 -0
  6. package/android/src/main/java/com/monflowts/MonflowtsStackViewManager.kt +70 -0
  7. package/ios/MonflowtsNavigationBridge.m +10 -0
  8. package/ios/MonflowtsNavigationModule.swift +28 -0
  9. package/ios/MonflowtsStackBridge.m +17 -0
  10. package/ios/MonflowtsStackUIView.swift +409 -0
  11. package/ios/MonflowtsStackViewManager.swift +14 -0
  12. package/lib/module/HubContent.js +259 -219
  13. package/lib/module/HubContent.js.map +1 -1
  14. package/lib/module/MonflowtsHub.js +42 -3
  15. package/lib/module/MonflowtsHub.js.map +1 -1
  16. package/lib/module/api/mutations.js +4 -0
  17. package/lib/module/api/mutations.js.map +1 -1
  18. package/lib/module/api/queries.js +9 -3
  19. package/lib/module/api/queries.js.map +1 -1
  20. package/lib/module/components/AbandonPolicyNotice.js +3 -2
  21. package/lib/module/components/AbandonPolicyNotice.js.map +1 -1
  22. package/lib/module/components/CoinFlyOverlay.js +27 -20
  23. package/lib/module/components/CoinFlyOverlay.js.map +1 -1
  24. package/lib/module/components/GameRulesModal.js +8 -6
  25. package/lib/module/components/GameRulesModal.js.map +1 -1
  26. package/lib/module/components/HypeCallout.js +5 -5
  27. package/lib/module/components/HypeCallout.js.map +1 -1
  28. package/lib/module/components/InsufficientFundsOverlay.js +2 -1
  29. package/lib/module/components/InsufficientFundsOverlay.js.map +1 -1
  30. package/lib/module/components/JackpotNearMiss.js +3 -2
  31. package/lib/module/components/JackpotNearMiss.js.map +1 -1
  32. package/lib/module/components/JackpotTeaser.js +2 -1
  33. package/lib/module/components/JackpotTeaser.js.map +1 -1
  34. package/lib/module/components/QuitConfirmModal.js +3 -2
  35. package/lib/module/components/QuitConfirmModal.js.map +1 -1
  36. package/lib/module/components/SessionTimer.js +3 -2
  37. package/lib/module/components/SessionTimer.js.map +1 -1
  38. package/lib/module/components/ShopArtView.js +105 -0
  39. package/lib/module/components/ShopArtView.js.map +1 -0
  40. package/lib/module/components/SideDemoTab.js +20 -2
  41. package/lib/module/components/SideDemoTab.js.map +1 -1
  42. package/lib/module/components/StakeInput.js +3 -2
  43. package/lib/module/components/StakeInput.js.map +1 -1
  44. package/lib/module/content.js.map +1 -1
  45. package/lib/module/hooks/useAvailableGames.js +7 -2
  46. package/lib/module/hooks/useAvailableGames.js.map +1 -1
  47. package/lib/module/hooks/useLeaderboard.js.map +1 -1
  48. package/lib/module/hooks/usePlayGame.js +11 -5
  49. package/lib/module/hooks/usePlayGame.js.map +1 -1
  50. package/lib/module/hooks/useRaffleDrawState.js +4 -1
  51. package/lib/module/hooks/useRaffleDrawState.js.map +1 -1
  52. package/lib/module/index.js +15 -0
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/navigation/NativeStackView.js +5 -0
  55. package/lib/module/navigation/NativeStackView.js.map +1 -0
  56. package/lib/module/navigation/Navigator.js +250 -0
  57. package/lib/module/navigation/Navigator.js.map +1 -0
  58. package/lib/module/navigation/engine.js +466 -0
  59. package/lib/module/navigation/engine.js.map +1 -0
  60. package/lib/module/navigation/hooks.js +29 -0
  61. package/lib/module/navigation/hooks.js.map +1 -0
  62. package/lib/module/navigation/index.js +7 -0
  63. package/lib/module/navigation/index.js.map +1 -0
  64. package/lib/module/navigation/routes.js +111 -0
  65. package/lib/module/navigation/routes.js.map +1 -0
  66. package/lib/module/theme.js +2 -2
  67. package/lib/module/theme.js.map +1 -1
  68. package/lib/module/utils/scale.js +35 -0
  69. package/lib/module/utils/scale.js.map +1 -0
  70. package/lib/module/views/DepositSelect.js +3 -2
  71. package/lib/module/views/DepositSelect.js.map +1 -1
  72. package/lib/module/views/DiceBattle.js +207 -125
  73. package/lib/module/views/DiceBattle.js.map +1 -1
  74. package/lib/module/views/DiceLobby.js +97 -30
  75. package/lib/module/views/DiceLobby.js.map +1 -1
  76. package/lib/module/views/FortuneWheel.js +417 -271
  77. package/lib/module/views/FortuneWheel.js.map +1 -1
  78. package/lib/module/views/Freefall.js +147 -88
  79. package/lib/module/views/Freefall.js.map +1 -1
  80. package/lib/module/views/History.js +3 -2
  81. package/lib/module/views/History.js.map +1 -1
  82. package/lib/module/views/Home.js +1026 -401
  83. package/lib/module/views/Home.js.map +1 -1
  84. package/lib/module/views/Jetstream.js +43 -19
  85. package/lib/module/views/Jetstream.js.map +1 -1
  86. package/lib/module/views/Leaderboard.js +98 -89
  87. package/lib/module/views/Leaderboard.js.map +1 -1
  88. package/lib/module/views/MillionaireHunter.js +743 -569
  89. package/lib/module/views/MillionaireHunter.js.map +1 -1
  90. package/lib/module/views/Minefield.js +40 -18
  91. package/lib/module/views/Minefield.js.map +1 -1
  92. package/lib/module/views/PaymentWebView.js +4 -3
  93. package/lib/module/views/PaymentWebView.js.map +1 -1
  94. package/lib/module/views/PlayerCard.js +3 -2
  95. package/lib/module/views/PlayerCard.js.map +1 -1
  96. package/lib/module/views/Profile.js +3 -2
  97. package/lib/module/views/Profile.js.map +1 -1
  98. package/lib/module/views/RaffleDraw.js +16 -6
  99. package/lib/module/views/RaffleDraw.js.map +1 -1
  100. package/lib/module/views/RevealWin.js +152 -25
  101. package/lib/module/views/RevealWin.js.map +1 -1
  102. package/lib/module/views/Splash.js +3 -2
  103. package/lib/module/views/Splash.js.map +1 -1
  104. package/lib/module/views/Success.js +5 -2
  105. package/lib/module/views/Success.js.map +1 -1
  106. package/lib/module/views/TicketShop.js +1067 -236
  107. package/lib/module/views/TicketShop.js.map +1 -1
  108. package/lib/module/views/TriviaLobby.js +43 -6
  109. package/lib/module/views/TriviaLobby.js.map +1 -1
  110. package/lib/module/views/TriviaMaster.js +23 -18
  111. package/lib/module/views/TriviaMaster.js.map +1 -1
  112. package/lib/module/views/Wallet.js +2 -1
  113. package/lib/module/views/Wallet.js.map +1 -1
  114. package/lib/module/views/WithdrawFlow.js +3 -2
  115. package/lib/module/views/WithdrawFlow.js.map +1 -1
  116. package/lib/module/views/diceDuel.js +44 -0
  117. package/lib/module/views/diceDuel.js.map +1 -0
  118. package/lib/module/views/freefallDrop.js +66 -0
  119. package/lib/module/views/freefallDrop.js.map +1 -0
  120. package/lib/module/views/homeLayout.js +47 -0
  121. package/lib/module/views/homeLayout.js.map +1 -0
  122. package/lib/module/views/launchFeatured.js +43 -0
  123. package/lib/module/views/launchFeatured.js.map +1 -0
  124. package/lib/module/views/leaderboardPhase.js +52 -0
  125. package/lib/module/views/leaderboardPhase.js.map +1 -0
  126. package/lib/module/views/lobbyKit.js +224 -0
  127. package/lib/module/views/lobbyKit.js.map +1 -0
  128. package/lib/module/views/raffleContent.js +11 -0
  129. package/lib/module/views/raffleContent.js.map +1 -0
  130. package/lib/module/views/rafflePhase.js +15 -0
  131. package/lib/module/views/rafflePhase.js.map +1 -0
  132. package/lib/module/views/revealWinHelpers.js +19 -0
  133. package/lib/module/views/revealWinHelpers.js.map +1 -1
  134. package/lib/module/views/shopArtMotion.js +25 -0
  135. package/lib/module/views/shopArtMotion.js.map +1 -0
  136. package/lib/module/views/ticketBundlePresets.js +15 -12
  137. package/lib/module/views/ticketBundlePresets.js.map +1 -1
  138. package/lib/module/views/ticketShopArt.js +391 -0
  139. package/lib/module/views/ticketShopArt.js.map +1 -0
  140. package/lib/module/views/treasureHunt.js +81 -0
  141. package/lib/module/views/treasureHunt.js.map +1 -0
  142. package/lib/module/views/wheelLayout.js +47 -0
  143. package/lib/module/views/wheelLayout.js.map +1 -0
  144. package/lib/typescript/src/HubContent.d.ts.map +1 -1
  145. package/lib/typescript/src/MonflowtsHub.d.ts.map +1 -1
  146. package/lib/typescript/src/api/gameTypes.d.ts +18 -2
  147. package/lib/typescript/src/api/gameTypes.d.ts.map +1 -1
  148. package/lib/typescript/src/api/mutations.d.ts.map +1 -1
  149. package/lib/typescript/src/api/queries.d.ts.map +1 -1
  150. package/lib/typescript/src/api/sdkTypes.d.ts +3 -0
  151. package/lib/typescript/src/api/sdkTypes.d.ts.map +1 -1
  152. package/lib/typescript/src/components/AbandonPolicyNotice.d.ts.map +1 -1
  153. package/lib/typescript/src/components/CoinFlyOverlay.d.ts.map +1 -1
  154. package/lib/typescript/src/components/GameRulesModal.d.ts +1 -0
  155. package/lib/typescript/src/components/GameRulesModal.d.ts.map +1 -1
  156. package/lib/typescript/src/components/HypeCallout.d.ts.map +1 -1
  157. package/lib/typescript/src/components/InsufficientFundsOverlay.d.ts.map +1 -1
  158. package/lib/typescript/src/components/JackpotNearMiss.d.ts.map +1 -1
  159. package/lib/typescript/src/components/JackpotTeaser.d.ts.map +1 -1
  160. package/lib/typescript/src/components/QuitConfirmModal.d.ts.map +1 -1
  161. package/lib/typescript/src/components/SessionTimer.d.ts.map +1 -1
  162. package/lib/typescript/src/components/ShopArtView.d.ts +11 -0
  163. package/lib/typescript/src/components/ShopArtView.d.ts.map +1 -0
  164. package/lib/typescript/src/components/SideDemoTab.d.ts +1 -0
  165. package/lib/typescript/src/components/SideDemoTab.d.ts.map +1 -1
  166. package/lib/typescript/src/components/StakeInput.d.ts.map +1 -1
  167. package/lib/typescript/src/content.d.ts +1 -0
  168. package/lib/typescript/src/content.d.ts.map +1 -1
  169. package/lib/typescript/src/hooks/useAvailableGames.d.ts +3 -0
  170. package/lib/typescript/src/hooks/useAvailableGames.d.ts.map +1 -1
  171. package/lib/typescript/src/hooks/useLeaderboard.d.ts +4 -0
  172. package/lib/typescript/src/hooks/useLeaderboard.d.ts.map +1 -1
  173. package/lib/typescript/src/hooks/usePlayGame.d.ts +1 -1
  174. package/lib/typescript/src/hooks/usePlayGame.d.ts.map +1 -1
  175. package/lib/typescript/src/hooks/useRaffleDrawState.d.ts.map +1 -1
  176. package/lib/typescript/src/index.d.ts +16 -0
  177. package/lib/typescript/src/index.d.ts.map +1 -1
  178. package/lib/typescript/src/navigation/NativeStackView.d.ts +41 -0
  179. package/lib/typescript/src/navigation/NativeStackView.d.ts.map +1 -0
  180. package/lib/typescript/src/navigation/Navigator.d.ts +13 -0
  181. package/lib/typescript/src/navigation/Navigator.d.ts.map +1 -0
  182. package/lib/typescript/src/navigation/engine.d.ts +69 -0
  183. package/lib/typescript/src/navigation/engine.d.ts.map +1 -0
  184. package/lib/typescript/src/navigation/hooks.d.ts +6 -0
  185. package/lib/typescript/src/navigation/hooks.d.ts.map +1 -0
  186. package/lib/typescript/src/navigation/index.d.ts +7 -0
  187. package/lib/typescript/src/navigation/index.d.ts.map +1 -0
  188. package/lib/typescript/src/navigation/routes.d.ts +80 -0
  189. package/lib/typescript/src/navigation/routes.d.ts.map +1 -0
  190. package/lib/typescript/src/types.d.ts +0 -9
  191. package/lib/typescript/src/types.d.ts.map +1 -1
  192. package/lib/typescript/src/utils/scale.d.ts +12 -0
  193. package/lib/typescript/src/utils/scale.d.ts.map +1 -0
  194. package/lib/typescript/src/views/DiceBattle.d.ts.map +1 -1
  195. package/lib/typescript/src/views/DiceLobby.d.ts.map +1 -1
  196. package/lib/typescript/src/views/FortuneWheel.d.ts.map +1 -1
  197. package/lib/typescript/src/views/Freefall.d.ts.map +1 -1
  198. package/lib/typescript/src/views/History.d.ts.map +1 -1
  199. package/lib/typescript/src/views/Home.d.ts +2 -2
  200. package/lib/typescript/src/views/Home.d.ts.map +1 -1
  201. package/lib/typescript/src/views/Jetstream.d.ts.map +1 -1
  202. package/lib/typescript/src/views/Leaderboard.d.ts.map +1 -1
  203. package/lib/typescript/src/views/MillionaireHunter.d.ts.map +1 -1
  204. package/lib/typescript/src/views/Minefield.d.ts.map +1 -1
  205. package/lib/typescript/src/views/PlayerCard.d.ts.map +1 -1
  206. package/lib/typescript/src/views/Profile.d.ts.map +1 -1
  207. package/lib/typescript/src/views/RaffleDraw.d.ts +2 -1
  208. package/lib/typescript/src/views/RaffleDraw.d.ts.map +1 -1
  209. package/lib/typescript/src/views/RevealWin.d.ts.map +1 -1
  210. package/lib/typescript/src/views/Splash.d.ts.map +1 -1
  211. package/lib/typescript/src/views/Success.d.ts.map +1 -1
  212. package/lib/typescript/src/views/TicketShop.d.ts +1 -0
  213. package/lib/typescript/src/views/TicketShop.d.ts.map +1 -1
  214. package/lib/typescript/src/views/TriviaLobby.d.ts.map +1 -1
  215. package/lib/typescript/src/views/TriviaMaster.d.ts.map +1 -1
  216. package/lib/typescript/src/views/Wallet.d.ts.map +1 -1
  217. package/lib/typescript/src/views/diceDuel.d.ts +22 -0
  218. package/lib/typescript/src/views/diceDuel.d.ts.map +1 -0
  219. package/lib/typescript/src/views/freefallDrop.d.ts +19 -0
  220. package/lib/typescript/src/views/freefallDrop.d.ts.map +1 -0
  221. package/lib/typescript/src/views/homeLayout.d.ts +15 -0
  222. package/lib/typescript/src/views/homeLayout.d.ts.map +1 -0
  223. package/lib/typescript/src/views/launchFeatured.d.ts +2 -0
  224. package/lib/typescript/src/views/launchFeatured.d.ts.map +1 -0
  225. package/lib/typescript/src/views/leaderboardPhase.d.ts +6 -0
  226. package/lib/typescript/src/views/leaderboardPhase.d.ts.map +1 -0
  227. package/lib/typescript/src/views/lobbyKit.d.ts +45 -0
  228. package/lib/typescript/src/views/lobbyKit.d.ts.map +1 -0
  229. package/lib/typescript/src/views/raffleContent.d.ts +3 -0
  230. package/lib/typescript/src/views/raffleContent.d.ts.map +1 -0
  231. package/lib/typescript/src/views/rafflePhase.d.ts +9 -0
  232. package/lib/typescript/src/views/rafflePhase.d.ts.map +1 -0
  233. package/lib/typescript/src/views/revealWinHelpers.d.ts +9 -0
  234. package/lib/typescript/src/views/revealWinHelpers.d.ts.map +1 -1
  235. package/lib/typescript/src/views/shopArtMotion.d.ts +13 -0
  236. package/lib/typescript/src/views/shopArtMotion.d.ts.map +1 -0
  237. package/lib/typescript/src/views/ticketBundlePresets.d.ts +3 -17
  238. package/lib/typescript/src/views/ticketBundlePresets.d.ts.map +1 -1
  239. package/lib/typescript/src/views/ticketShopArt.d.ts +27 -0
  240. package/lib/typescript/src/views/ticketShopArt.d.ts.map +1 -0
  241. package/lib/typescript/src/views/treasureHunt.d.ts +29 -0
  242. package/lib/typescript/src/views/treasureHunt.d.ts.map +1 -0
  243. package/lib/typescript/src/views/wheelLayout.d.ts +30 -0
  244. package/lib/typescript/src/views/wheelLayout.d.ts.map +1 -0
  245. package/package.json +1 -1
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  import React, { useState, useRef, useCallback, useEffect, useMemo } from 'react';
4
- import { View, Text, StyleSheet, Alert, Animated, KeyboardAvoidingView, Platform, ScrollView, BackHandler } from 'react-native';
4
+ import { View, Text, StyleSheet, Alert, Animated, KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
5
+ import { scaledStyles } from "../utils/scale.js";
5
6
  import { COLORS } from "../constants.js";
6
7
  import QuitConfirmModal from "../components/QuitConfirmModal.js";
7
8
  import SideDemoTab from "../components/SideDemoTab.js";
8
9
  import HypeCallout from "../components/HypeCallout.js";
9
10
  import { HYPE_PHRASES, pickPhrase } from "../effects/hypePhrases.js";
10
11
  import { sounds } from "../SoundManager.js";
12
+ import { useBackGuard } from "../navigation/hooks.js";
11
13
  import SvgIcon from "../Icons.js";
12
14
  import MonflowtsButton from "../components/MonflowtsButton.js";
13
15
  import MonflowtsPressable from "../components/MonflowtsPressable.js";
@@ -18,23 +20,23 @@ import AbandonPolicyNotice from "../components/AbandonPolicyNotice.js";
18
20
  import InsufficientFundsOverlay from "../components/InsufficientFundsOverlay.js";
19
21
  import StakeInput from "../components/StakeInput.js";
20
22
  import GameRulesModal from "../components/GameRulesModal.js";
21
- import JackpotNearMiss from "../components/JackpotNearMiss.js";
22
23
  import { confettiAnim, dustAnim } from "../effects/particleAnims.js";
23
24
  import { lottie } from "../assets/remote.js";
24
- import { computeGridGeometry } from "./gridGeometry.js";
25
+ import { hunterLayout, oddsLabel, paytableRows, quickPick, returnToPlayer, togglePick } from "./treasureHunt.js";
25
26
  import { usePlayGame, useInitPlay } from "../hooks/usePlayGame.js";
26
27
  import { useCurrency } from "../hooks/useCurrency.js";
27
28
  import { useResponsive } from "../hooks/useResponsive.js";
28
29
  import { useGameStore } from "../stores/gameStore.js";
29
30
  import { gameRules, randomMessageKey } from "../content.js";
30
31
  import { t, formatNumber, errorText } from "../i18n.js";
31
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
32
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
32
33
  const COIN_COUNT = 6;
33
34
  const COIN_FLY_DURATION = 600;
34
35
  const COIN_STAGGER = 80;
35
36
  const GRID_PADDING = 20;
36
37
  const GRID_GAP = 10;
37
- const GRID_MAX_CONTENT = 420;
38
+ const REVEAL_STAGGER = 650;
39
+ const RESULT_HOLD_MS = 1800;
38
40
  const MillionaireHunter = ({
39
41
  onBack,
40
42
  onWin,
@@ -45,29 +47,31 @@ const MillionaireHunter = ({
45
47
  }) => {
46
48
  const currency = useCurrency();
47
49
  const demoMode = useGameStore(s => s.demoMode);
50
+ const creditDemoBalance = useGameStore(s => s.creditDemoBalance);
48
51
  const {
49
- columnWidth
52
+ columnWidth,
53
+ height: windowHeight
50
54
  } = useResponsive();
51
- const gridContent = Math.min(columnWidth - GRID_PADDING * 2, GRID_MAX_CONTENT);
52
- // ── Core game state ──
55
+ const [box, setBox] = useState({
56
+ width: columnWidth,
57
+ height: windowHeight
58
+ });
53
59
  const [gameState, setGameState] = useState('LOBBY');
54
60
  const fallbackRules = gameRules('MILLIONAIRE_HUNTER');
55
- const maxPicks = game?.gameplayRules?.maxPicks ?? fallbackRules.maxPicks ?? 0;
56
- // Board size comes from the published config (total cells). The server validates every
57
- // pick as 0 ≤ pick < gridSize, so the rendered board MUST match gridSize — otherwise a
58
- // configured grid smaller than 9 would let the player tap cells the server rejects, and
59
- // a larger grid (the seeded 5×5 = 25) would hide most of the board. Falls back to the
60
- // engine's own default (9) when unconfigured.
61
+ const maxPicks = Math.max(1, game?.gameplayRules?.maxPicks ?? fallbackRules.maxPicks ?? 1);
61
62
  const gridSize = Math.max(1, game?.gameplayRules?.gridSize ?? fallbackRules.gridSize ?? 1);
63
+ const treasureCount = game?.gameplayRules?.treasureCount;
64
+ const hitMultipliers = game?.gameplayRules?.hitMultipliers;
65
+ const layout = useMemo(() => hunterLayout(box.width, box.height, gridSize), [box.width, box.height, gridSize]);
62
66
  const {
63
67
  cols: gridCols,
64
68
  cellSize: chestCellSize,
65
69
  gridWidth: gridPixelWidth
66
- } = useMemo(() => computeGridGeometry(gridSize, gridContent, GRID_GAP), [gridSize, gridContent]);
67
- const [picksRemaining, setPicksRemaining] = useState(maxPicks);
68
- const picksRef = useRef(maxPicks);
70
+ } = layout.geometry;
71
+ const [selectedPicks, setSelectedPicks] = useState([]);
69
72
  const [openedChests, setOpenedChests] = useState(new Map());
70
- const [currentPick, setCurrentPick] = useState(null);
73
+ const [revealedTreasure, setRevealedTreasure] = useState(new Set());
74
+ const [huntResult, setHuntResult] = useState(null);
71
75
  const [processingChests, setProcessingChests] = useState(new Set());
72
76
  const [totalWonThisRound, setTotalWonThisRound] = useState(0);
73
77
  const totalWonRef = useRef(0);
@@ -76,13 +80,9 @@ const MillionaireHunter = ({
76
80
  const [showFundsOverlay, setShowFundsOverlay] = useState(false);
77
81
  const [rulesVisible, setRulesVisible] = useState(false);
78
82
  const [lottieKey, setLottieKey] = useState(0);
79
-
80
- // Keep refs in sync with state
81
83
  useEffect(() => {
82
84
  displayBalanceRef.current = displayBalance;
83
85
  }, [displayBalance]);
84
-
85
- // Sync displayBalance from prop when in LOBBY or when balance prop changes (wallet refresh)
86
86
  const prevBalanceRef = useRef(balance);
87
87
  useEffect(() => {
88
88
  const balanceChanged = prevBalanceRef.current !== balance;
@@ -92,8 +92,6 @@ const MillionaireHunter = ({
92
92
  displayBalanceRef.current = balance;
93
93
  }
94
94
  }, [balance, gameState]);
95
-
96
- // Derive the actual play cost from game config (kobo → VG)
97
95
  const actualCostVG = useMemo(() => {
98
96
  if (!game?.playCost) return 0;
99
97
  if (game.playCost.type === 'BY_CHANNEL' && game.playCost.channelPricing?.length) {
@@ -102,21 +100,17 @@ const MillionaireHunter = ({
102
100
  }
103
101
  return Math.round((game.playCost.fixedAmountKobo ?? 0) / 100);
104
102
  }, [game?.playCost]);
105
-
106
- // Use stakeOptions from config if available; otherwise fixed cost (no selector)
107
103
  const hasStakeOptions = !!game?.gameplayRules?.stakeOptions?.length;
108
104
  const stakeOptions = (hasStakeOptions ? game.gameplayRules.stakeOptions : fallbackRules.stakeOptions ?? []).map(s => Math.round(s / 100));
109
- const [activeStake, setActiveStake] = useState(hasStakeOptions ? stakeOptions[Math.floor(stakeOptions.length / 2)] ?? 500 : actualCostVG || (stakeOptions[Math.floor(stakeOptions.length / 2)] ?? 500));
110
-
111
- // The effective cost sent to the server — if no stake options, use the actual config cost
105
+ const [activeStake, setActiveStake] = useState(hasStakeOptions ? stakeOptions[0] ?? 100 : actualCostVG || (stakeOptions[0] ?? 100));
112
106
  const effectiveCostVG = hasStakeOptions ? activeStake : actualCostVG || activeStake;
113
-
114
- // Multi-play session support
107
+ const paytable = useMemo(() => hitMultipliers?.length && treasureCount ? paytableRows(gridSize, treasureCount, hitMultipliers, effectiveCostVG) : [], [hitMultipliers, treasureCount, gridSize, effectiveCostVG]);
108
+ const rtpPercent = hitMultipliers?.length && treasureCount ? (returnToPlayer(gridSize, treasureCount, hitMultipliers) * 100).toFixed(1) : null;
115
109
  const stakeCountOptions = game?.gameplayRules?.stakeCountOptions ?? [];
116
110
  const hasStakeCount = stakeCountOptions.length > 1;
117
111
  const [selectedStakeCount, setSelectedStakeCount] = useState(stakeCountOptions[0] ?? 1);
118
112
  const isMultiHunt = selectedStakeCount > 1;
119
- const totalSessionCostVG = effectiveCostVG * maxPicks * selectedStakeCount;
113
+ const totalSessionCostVG = effectiveCostVG * selectedStakeCount;
120
114
  const [currentHunt, setCurrentHunt] = useState(1);
121
115
  const [sessionTotalWon, setSessionTotalWon] = useState(0);
122
116
  const sessionTotalWonRef = useRef(0);
@@ -125,27 +119,14 @@ const MillionaireHunter = ({
125
119
  const {
126
120
  play
127
121
  } = usePlayGame();
128
-
129
- // Two-phase play support
130
122
  const abandonPolicy = game?.gameplayRules?.abandonPolicy ?? null;
131
123
  const initPlay = useInitPlay(game?.gameCode ?? 'MILLIONAIRE_HUNTER', abandonPolicy);
132
-
133
- // Reset session + game state when demo mode toggles
134
124
  const prevDemoRef = useRef(demoMode);
135
125
  useEffect(() => {
136
126
  if (prevDemoRef.current !== demoMode) {
137
127
  prevDemoRef.current = demoMode;
138
128
  if (initPlay.enabled) initPlay.reset();
139
- // Reset round state and re-sync balance from prop
140
- resetAllAnims();
141
- setOpenedChests(new Map());
142
- setPicksRemaining(maxPicks);
143
- picksRef.current = maxPicks;
144
- setTotalWonThisRound(0);
145
- totalWonRef.current = 0;
146
- setCurrentPick(null);
147
- setProcessingChests(new Set());
148
- setFlyingCoins([]);
129
+ resetBoard();
149
130
  setGameState('LOBBY');
150
131
  setDisplayBalance(balance);
151
132
  displayBalanceRef.current = balance;
@@ -270,13 +251,12 @@ const MillionaireHunter = ({
270
251
  resultBadgeTranslateY.forEach(v => v.setValue(10));
271
252
  overlayOpacity.setValue(0);
272
253
  overlayScale.setValue(0.8);
273
- iconBounce.setValue(0);
274
254
  balancePulse.setValue(1);
275
255
  shuffleTranslateX.forEach(v => v.setValue(0));
276
256
  shuffleTranslateY.forEach(v => v.setValue(0));
277
257
  shuffleScale.forEach(v => v.setValue(1));
278
258
  shuffleRotate.forEach(v => v.setValue(0));
279
- }, [chestScaleAnims, chestGlowAnims, resultBadgeOpacity, resultBadgeTranslateY, overlayOpacity, overlayScale, iconBounce, balancePulse, shuffleTranslateX, shuffleTranslateY, shuffleScale, shuffleRotate]);
259
+ }, [chestScaleAnims, chestGlowAnims, resultBadgeOpacity, resultBadgeTranslateY, overlayOpacity, overlayScale, balancePulse, shuffleTranslateX, shuffleTranslateY, shuffleScale, shuffleRotate]);
280
260
 
281
261
  /**
282
262
  * Shell-game style shuffle:
@@ -445,6 +425,8 @@ const MillionaireHunter = ({
445
425
  });
446
426
  }, [shuffleTranslateX, shuffleTranslateY, shuffleScale, shuffleRotate, gridCols, chestCellSize]);
447
427
  const animateOverlayIn = useCallback(() => {
428
+ overlayOpacity.setValue(0);
429
+ overlayScale.setValue(0.8);
448
430
  Animated.parallel([Animated.timing(overlayOpacity, {
449
431
  toValue: 1,
450
432
  duration: 350,
@@ -543,6 +525,9 @@ const MillionaireHunter = ({
543
525
 
544
526
  // ── Inline chest result animation ──
545
527
  const animateChestResult = useCallback((index, isWin) => {
528
+ chestGlowAnims[index].setValue(0);
529
+ resultBadgeOpacity[index].setValue(0);
530
+ resultBadgeTranslateY[index].setValue(10);
546
531
  Animated.sequence([Animated.spring(chestScaleAnims[index], {
547
532
  toValue: 1.15,
548
533
  friction: 4,
@@ -571,181 +556,141 @@ const MillionaireHunter = ({
571
556
  useNativeDriver: true
572
557
  })]).start();
573
558
  }, [chestScaleAnims, chestGlowAnims, resultBadgeOpacity, resultBadgeTranslateY]);
574
-
575
- // ── Handle chest tap ──
576
- const handleOpenChest = useCallback(async index => {
577
- if (gameState !== 'LOBBY' && gameState !== 'PICKING' && gameState !== 'CHEST_ANIMATING') return;
578
- if (!game) return;
579
- if (openedChests.has(index)) return;
580
- if (processingChests.has(index)) return;
559
+ const resetBoard = useCallback(() => {
560
+ resetAllAnims();
561
+ setSelectedPicks([]);
562
+ setOpenedChests(new Map());
563
+ setRevealedTreasure(new Set());
564
+ setHuntResult(null);
565
+ setTotalWonThisRound(0);
566
+ totalWonRef.current = 0;
567
+ setProcessingChests(new Set());
568
+ setFlyingCoins([]);
569
+ }, [resetAllAnims]);
570
+ const isSelecting = gameState === 'LOBBY' || gameState === 'PICKING';
571
+ const handleChestPress = useCallback(index => {
572
+ if (!isSelecting) return;
573
+ sounds.playSelect();
574
+ setSelectedPicks(prev => togglePick(prev, index, maxPicks));
575
+ }, [isSelecting, maxPicks]);
576
+ const handleQuickPick = useCallback(() => {
577
+ if (!isSelecting) return;
578
+ sounds.playSelect();
579
+ setSelectedPicks(prev => quickPick(gridSize, prev, maxPicks));
580
+ }, [isSelecting, gridSize, maxPicks]);
581
+ const finishHunt = useCallback(amountWon => {
582
+ if (isMultiHunt && amountWon > 0) setSessionHuntWins(w => w + 1);
583
+ if (initPlay.enabled) initPlay.reset();
584
+ const canAffordNext = demoMode || displayBalanceRef.current >= effectiveCostVG;
585
+ if (isMultiHunt && currentHunt < selectedStakeCount && canAffordNext) {
586
+ onLose?.();
587
+ setTimeout(() => {
588
+ setCurrentHunt(h => h + 1);
589
+ resetBoard();
590
+ setGameState('SHUFFLING');
591
+ animateShuffle().then(() => {
592
+ setLottieKey(k => k + 1);
593
+ setGameState('PICKING');
594
+ });
595
+ }, 800);
596
+ return;
597
+ }
598
+ setSessionComplete(true);
599
+ setGameState('SUMMARY');
600
+ animateOverlayIn();
601
+ setLottieKey(k => k + 1);
602
+ }, [isMultiHunt, initPlay, demoMode, effectiveCostVG, currentHunt, selectedStakeCount, onLose, resetBoard, animateShuffle, animateOverlayIn]);
603
+ const handleOpenChests = useCallback(async () => {
604
+ if (!isSelecting || !game) return;
605
+ if (selectedPicks.length !== maxPicks) return;
581
606
  if (initPlay.enabled && initPlay.isExpired) return;
582
-
583
- // Balance check
584
607
  if (!demoMode && !initPlay.session && displayBalanceRef.current < effectiveCostVG) {
585
608
  setShowFundsOverlay(true);
586
609
  return;
587
610
  }
588
-
589
- // Check if all picks spent
590
- if (picksRef.current <= 0) return;
611
+ const picks = [...selectedPicks];
612
+ const resumeState = gameState;
591
613
  sounds.resume();
592
614
  sounds.playChestOpen();
593
- setCurrentPick(index);
594
615
  setGameState('CHEST_ANIMATING');
595
-
596
- // Mark chest as processing (pulsing indicator)
597
- setProcessingChests(prev => new Set(prev).add(index));
598
-
599
- // Optimistic balance debit
616
+ setProcessingChests(new Set(picks));
600
617
  setDisplayBalance(prev => prev - effectiveCostVG);
601
618
  displayBalanceRef.current -= effectiveCostVG;
602
-
603
- // Eagerly deduct picks so other taps respect the limit
604
- const newPicksRemaining = picksRef.current - 1;
605
- setPicksRemaining(newPicksRemaining);
606
- picksRef.current = newPicksRemaining;
607
-
608
- // Measure positions for coin animation
609
- chestRefs.current[index]?.measureInWindow?.((x, y, w, h) => {
610
- chestPositions.current[index] = {
611
- x: x + w / 2,
612
- y: y + h / 2
613
- };
614
- });
619
+ picks.forEach(measureChest);
615
620
  measureBalancePill();
616
621
  measureContainer();
617
-
618
- // ── Server call ──
619
622
  let serverResult = null;
620
623
  try {
621
624
  if (initPlay.enabled) {
622
625
  const activeSession = initPlay.session ?? (await initPlay.startSession(effectiveCostVG * 100));
623
626
  serverResult = await initPlay.completeSession({
624
- picks: [index]
627
+ picks
625
628
  }, activeSession);
626
629
  } else {
627
630
  serverResult = await play(game.gameCode, {
628
- picks: [index]
631
+ picks
629
632
  }, undefined, effectiveCostVG * 100);
630
633
  }
631
634
  } catch (e) {
632
635
  console.warn('[MillionaireHunter] play failed:', e?.message ?? e);
633
636
  setDisplayBalance(prev => prev + effectiveCostVG);
634
637
  displayBalanceRef.current += effectiveCostVG;
635
- picksRef.current += 1;
636
- setPicksRemaining(picksRef.current);
637
- setProcessingChests(prev => {
638
- const s = new Set(prev);
639
- s.delete(index);
640
- return s;
641
- });
638
+ setProcessingChests(new Set());
642
639
  const msg = (e?.message || '').toLowerCase();
643
640
  if (msg.includes('insufficient') || msg.includes('balance')) {
644
641
  setShowFundsOverlay(true);
645
642
  } else {
646
643
  Alert.alert(t('hunter.playErrorTitle'), errorText(e, 'hunter.playFailed'));
647
644
  }
648
- if (picksRef.current === maxPicks) setGameState('LOBBY');else setGameState('PICKING');
649
- setCurrentPick(null);
645
+ setGameState(resumeState);
650
646
  return;
651
647
  }
648
+ const result = serverResult?.gameResult ?? {};
649
+ const grid = Array.isArray(result.grid) ? result.grid : [];
650
+ const opened = Array.isArray(result.playerPicks) && result.playerPicks.length ? result.playerPicks : picks;
652
651
  const amountWon = (serverResult?.amountWonKobo ?? 0) / 100;
653
- const isWin = amountWon > 0;
654
-
655
- // Update state
656
- setOpenedChests(prev => {
657
- const m = new Map(prev);
658
- m.set(index, {
659
- won: isWin,
660
- amount: amountWon
661
- });
662
- return m;
663
- });
664
- totalWonRef.current += amountWon;
665
- setTotalWonThisRound(totalWonRef.current);
666
- sessionTotalWonRef.current += amountWon;
667
- setSessionTotalWon(sessionTotalWonRef.current);
668
-
669
- // Remove from processing
670
- setProcessingChests(prev => {
671
- const s = new Set(prev);
672
- s.delete(index);
673
- return s;
652
+ const hitCells = opened.filter(cell => grid[cell] === 'HIT');
653
+ opened.forEach((cell, i) => {
654
+ setTimeout(() => {
655
+ const hit = grid[cell] === 'HIT';
656
+ setOpenedChests(prev => new Map(prev).set(cell, {
657
+ won: hit
658
+ }));
659
+ setProcessingChests(prev => {
660
+ const s = new Set(prev);
661
+ s.delete(cell);
662
+ return s;
663
+ });
664
+ animateChestResult(cell, hit);
665
+ if (hit) sounds.playWinChime();
666
+ }, i * REVEAL_STAGGER);
674
667
  });
675
-
676
- // Show inline result immediately
677
- animateChestResult(index, isWin);
678
- if (isWin) {
679
- sounds.playWinChime();
680
- animateCoinFly(index, amountWon);
681
- hypeRef.current?.show(pickPhrase(amountWon >= 5000 ? HYPE_PHRASES.hunter.bigWin : HYPE_PHRASES.hunter.win), amountWon >= 5000 ? 'boost' : 'win');
682
- } else {
683
- sounds.playDrawSound();
684
- hypeRef.current?.show(pickPhrase(HYPE_PHRASES.hunter.loss), 'loss');
685
- }
686
-
687
- // Decide next state after a short delay for the result to register visually
688
- const delay = isWin ? 1200 : 600;
689
668
  setTimeout(() => {
690
- setCurrentPick(cur => cur === index ? null : cur);
691
- if (picksRef.current > 0) {
692
- // Check if player can afford next pick
693
- if (!demoMode && displayBalanceRef.current < effectiveCostVG) {
694
- if (isMultiHunt && totalWonRef.current > 0) setSessionHuntWins(w => w + 1);
695
- setSessionComplete(true);
696
- setGameState('SUMMARY');
697
- animateOverlayIn();
698
- setLottieKey(k => k + 1);
699
- return;
700
- }
701
- setGameState('PICKING');
702
- if (initPlay.enabled) initPlay.reset();
669
+ setRevealedTreasure(new Set(grid.flatMap((cell, i) => cell === 'TREASURE' ? [i] : [])));
670
+ setHuntResult({
671
+ hits: typeof result.hits === 'number' ? result.hits : hitCells.length,
672
+ picks: opened.length,
673
+ multiplier: typeof result.multiplier === 'number' ? result.multiplier : null,
674
+ nonce: typeof result.nonce === 'number' ? result.nonce : null,
675
+ serverSeedHash: typeof result.serverSeedHash === 'string' && result.serverSeedHash !== 'demo' ? result.serverSeedHash : null
676
+ });
677
+ totalWonRef.current = amountWon;
678
+ setTotalWonThisRound(amountWon);
679
+ sessionTotalWonRef.current += amountWon;
680
+ setSessionTotalWon(sessionTotalWonRef.current);
681
+ if (amountWon > 0) {
682
+ animateCoinFly(hitCells[hitCells.length - 1] ?? opened[0], amountWon);
683
+ const big = amountWon >= effectiveCostVG * 5;
684
+ hypeRef.current?.show(pickPhrase(big ? HYPE_PHRASES.hunter.bigWin : HYPE_PHRASES.hunter.win), big ? 'boost' : 'win');
703
685
  } else {
704
- // All picks used
705
- if (isMultiHunt && currentHunt < selectedStakeCount) {
706
- // Track hunt wins
707
- if (totalWonRef.current > 0) setSessionHuntWins(w => w + 1);
708
- onLose?.(); // Refresh wallet between hunts
709
- setTimeout(() => {
710
- setCurrentHunt(h => h + 1);
711
- resetAllAnims();
712
- setOpenedChests(new Map());
713
- setPicksRemaining(maxPicks);
714
- picksRef.current = maxPicks;
715
- setTotalWonThisRound(0);
716
- totalWonRef.current = 0;
717
- setCurrentPick(null);
718
- setProcessingChests(new Set());
719
- setFlyingCoins([]);
720
- setGameState('SHUFFLING');
721
- animateShuffle().then(() => {
722
- setLottieKey(k => k + 1);
723
- setGameState('PICKING');
724
- });
725
- }, 800);
726
- } else {
727
- // Last hunt or single → summary
728
- if (isMultiHunt && totalWonRef.current > 0) setSessionHuntWins(w => w + 1);
729
- setSessionComplete(true);
730
- setGameState('SUMMARY');
731
- animateOverlayIn();
732
- setLottieKey(k => k + 1);
733
- }
686
+ sounds.playDrawSound();
687
+ hypeRef.current?.show(pickPhrase(HYPE_PHRASES.hunter.loss), 'loss');
734
688
  }
735
- }, delay);
736
- }, [gameState, game, openedChests, processingChests, effectiveCostVG, play, maxPicks, initPlay, demoMode, animateChestResult, animateCoinFly, measureBalancePill, measureContainer, animateOverlayIn, isMultiHunt, currentHunt, selectedStakeCount, resetAllAnims, animateShuffle, onLose]);
737
-
738
- // ── Reset for new round ──
689
+ setTimeout(() => finishHunt(amountWon), RESULT_HOLD_MS);
690
+ }, opened.length * REVEAL_STAGGER + 200);
691
+ }, [isSelecting, game, selectedPicks, maxPicks, initPlay, demoMode, effectiveCostVG, gameState, play, measureChest, measureBalancePill, measureContainer, animateChestResult, animateCoinFly, finishHunt]);
739
692
  const resetGame = useCallback(() => {
740
- resetAllAnims();
741
- setOpenedChests(new Map());
742
- setPicksRemaining(maxPicks);
743
- picksRef.current = maxPicks;
744
- setTotalWonThisRound(0);
745
- totalWonRef.current = 0;
746
- setCurrentPick(null);
747
- setProcessingChests(new Set());
748
- setFlyingCoins([]);
693
+ resetBoard();
749
694
  setCurrentHunt(1);
750
695
  setSessionTotalWon(0);
751
696
  sessionTotalWonRef.current = 0;
@@ -756,7 +701,7 @@ const MillionaireHunter = ({
756
701
  setLottieKey(k => k + 1);
757
702
  setGameState('LOBBY');
758
703
  });
759
- }, [resetAllAnims, animateShuffle, maxPicks]);
704
+ }, [resetBoard, animateShuffle]);
760
705
  const handleCollect = useCallback(() => {
761
706
  const total = isMultiHunt ? sessionTotalWonRef.current : totalWonRef.current;
762
707
  if (total > 0) {
@@ -765,12 +710,20 @@ const MillionaireHunter = ({
765
710
  onBack();
766
711
  }
767
712
  }, [onWin, onBack, isMultiHunt]);
713
+ const creditDemoWinnings = useCallback(() => {
714
+ const total = isMultiHunt ? sessionTotalWonRef.current : totalWonRef.current;
715
+ if (demoMode && total > 0) creditDemoBalance(total);
716
+ }, [isMultiHunt, demoMode, creditDemoBalance]);
768
717
  const handlePlayAgain = useCallback(() => {
769
- onLose?.(); // refresh wallet
718
+ creditDemoWinnings();
719
+ onLose?.();
770
720
  resetGame();
771
- }, [onLose, resetGame]);
772
- const isActive = gameState === 'PICKING' || gameState === 'CHEST_ANIMATING';
773
- const hasProcessing = processingChests.size > 0;
721
+ }, [creditDemoWinnings, onLose, resetGame]);
722
+ const handleReturnToMenu = useCallback(() => {
723
+ creditDemoWinnings();
724
+ onBack();
725
+ }, [creditDemoWinnings, onBack]);
726
+ const isActive = gameState === 'CHEST_ANIMATING';
774
727
  const isSummary = gameState === 'SUMMARY';
775
728
  const gameLive = gameState !== 'LOBBY' && gameState !== 'SUMMARY';
776
729
  const [quitVisible, setQuitVisible] = useState(false);
@@ -781,408 +734,504 @@ const MillionaireHunter = ({
781
734
  }
782
735
  setQuitVisible(true);
783
736
  }, [gameLive, onBack]);
784
- useEffect(() => {
785
- const sub = BackHandler.addEventListener('hardwareBackPress', () => {
786
- handleBack();
787
- return true;
788
- });
789
- return () => sub.remove();
790
- }, [handleBack]);
737
+ useBackGuard(gameLive, handleBack);
791
738
  const isShuffling = gameState === 'SHUFFLING';
792
-
793
- // Pick a random summary message once when entering SUMMARY
794
739
  const displayWon = isMultiHunt ? sessionTotalWon : totalWonThisRound;
795
740
  const summaryMsg = useMemo(() => randomMessageKey(displayWon > 0 ? 'hunter.win' : 'hunter.loss'),
796
741
  // eslint-disable-next-line react-hooks/exhaustive-deps
797
742
  [isSummary]);
798
- return /*#__PURE__*/_jsx(KeyboardAvoidingView, {
799
- style: {
800
- flex: 1
801
- },
802
- behavior: Platform.OS === 'ios' ? 'padding' : undefined,
803
- children: /*#__PURE__*/_jsxs(View, {
804
- style: styles.container,
805
- ref: containerRef,
806
- onLayout: measureContainer,
807
- children: [/*#__PURE__*/_jsx(HypeCallout, {
808
- ref: hypeRef,
743
+ const onContainerLayout = useCallback(e => {
744
+ const {
745
+ width,
746
+ height
747
+ } = e.nativeEvent.layout;
748
+ setBox(prev => prev.width === width && prev.height === height ? prev : {
749
+ width,
750
+ height
751
+ });
752
+ measureContainer();
753
+ }, [measureContainer]);
754
+ const titleArea = /*#__PURE__*/_jsxs(View, {
755
+ style: styles.titleArea,
756
+ children: [/*#__PURE__*/_jsxs(View, {
757
+ style: styles.badgeRow,
758
+ children: [isMultiHunt && gameState !== 'LOBBY' && /*#__PURE__*/_jsx(View, {
759
+ style: styles.roundBadge,
760
+ children: /*#__PURE__*/_jsxs(Text, {
761
+ style: styles.roundText,
762
+ children: ["Hunt ", currentHunt, "/", selectedStakeCount]
763
+ })
764
+ }), /*#__PURE__*/_jsxs(View, {
765
+ style: styles.liveBadge,
766
+ children: [/*#__PURE__*/_jsx(View, {
767
+ style: styles.liveIndicator
768
+ }), /*#__PURE__*/_jsx(Text, {
769
+ style: styles.liveText,
770
+ children: demoMode ? t('hunter.demo') : t('hunter.live')
771
+ })]
772
+ })]
773
+ }), isActive ? /*#__PURE__*/_jsx(Text, {
774
+ style: styles.mainTitle,
775
+ children: t('hunter.opening')
776
+ }) : isSelecting ? /*#__PURE__*/_jsxs(_Fragment, {
777
+ children: [/*#__PURE__*/_jsx(Text, {
778
+ style: styles.mainTitle,
779
+ children: t('hunter.pickChests', {
780
+ count: maxPicks
781
+ })
782
+ }), /*#__PURE__*/_jsx(Text, {
783
+ style: styles.mainSubtitle,
784
+ children: treasureCount ? t('hunter.lobbyHint', {
785
+ treasures: treasureCount,
786
+ chests: gridSize
787
+ }) : t('hunter.chosen', {
788
+ chosen: selectedPicks.length,
789
+ total: maxPicks
790
+ })
791
+ })]
792
+ }) : null]
793
+ });
794
+ const notices = /*#__PURE__*/_jsxs(_Fragment, {
795
+ children: [/*#__PURE__*/_jsx(AbandonPolicyNotice, {
796
+ abandonPolicy: abandonPolicy
797
+ }), initPlay.enabled && initPlay.error && !initPlay.session && /*#__PURE__*/_jsxs(View, {
798
+ style: {
799
+ padding: 12,
800
+ backgroundColor: '#fef2f2',
801
+ borderRadius: 8,
802
+ margin: 8,
803
+ alignItems: 'center'
804
+ },
805
+ children: [/*#__PURE__*/_jsx(Text, {
809
806
  style: {
810
- top: 230
811
- }
812
- }), /*#__PURE__*/_jsx(SideDemoTab, {
813
- enabled: !!game?.demoConfig?.enabled
814
- }), /*#__PURE__*/_jsxs(ScrollView, {
815
- contentContainerStyle: {
816
- flexGrow: 1
807
+ color: '#b91c1c',
808
+ fontSize: 13,
809
+ marginBottom: 8,
810
+ textAlign: 'center'
817
811
  },
818
- keyboardShouldPersistTaps: "handled",
819
- bounces: false,
820
- children: [initPlay.enabled && initPlay.session && /*#__PURE__*/_jsx(SessionTimer, {
821
- secondsLeft: initPlay.secondsLeft,
822
- isExpired: initPlay.isExpired
823
- }), /*#__PURE__*/_jsxs(View, {
824
- style: styles.header,
825
- children: [/*#__PURE__*/_jsx(QuitConfirmModal, {
826
- visible: quitVisible,
827
- message: t('hunter.quitMessage'),
828
- onKeepPlaying: () => setQuitVisible(false),
829
- onQuit: () => {
830
- setQuitVisible(false);
831
- onBack();
832
- }
833
- }), /*#__PURE__*/_jsx(MonflowtsPressable, {
834
- style: styles.circleBtn,
835
- onPress: handleBack,
812
+ children: initPlay.error
813
+ }), /*#__PURE__*/_jsx(MonflowtsButton, {
814
+ title: t('hunter.retry'),
815
+ onPress: () => initPlay.reset()
816
+ })]
817
+ })]
818
+ });
819
+ const board = /*#__PURE__*/_jsx(View, {
820
+ style: styles.gridArea,
821
+ children: /*#__PURE__*/_jsx(View, {
822
+ style: [styles.grid, {
823
+ width: gridPixelWidth
824
+ }],
825
+ children: Array.from({
826
+ length: gridSize
827
+ }).map((_, i) => {
828
+ const isProcessing = processingChests.has(i);
829
+ const chestResult = openedChests.get(i);
830
+ const isOpened = !!chestResult;
831
+ const pickOrder = selectedPicks.indexOf(i);
832
+ const isSelected = pickOrder >= 0 && !isOpened && !isProcessing;
833
+ const wasTreasure = revealedTreasure.has(i);
834
+ const canTap = isSelecting && (isSelected || selectedPicks.length < maxPicks);
835
+ return /*#__PURE__*/_jsxs(Animated.View, {
836
+ ref: r => {
837
+ chestRefs.current[i] = r;
838
+ },
839
+ onLayout: () => measureChest(i),
840
+ style: [styles.chestCell, {
841
+ width: chestCellSize,
842
+ height: chestCellSize
843
+ }, {
844
+ transform: [{
845
+ scale: chestScaleAnims[i]
846
+ }, {
847
+ translateX: shuffleTranslateX[i]
848
+ }, {
849
+ translateY: shuffleTranslateY[i]
850
+ }, {
851
+ scale: shuffleScale[i]
852
+ }, {
853
+ rotate: shuffleRotate[i].interpolate({
854
+ inputRange: [-360, 360],
855
+ outputRange: ['-360deg', '360deg']
856
+ })
857
+ }]
858
+ }, isSelected && styles.chestCellSelected, isOpened && chestResult?.won && styles.chestCellWin, isOpened && !chestResult?.won && styles.chestCellLoss, wasTreasure && styles.chestCellMissedTreasure, isProcessing && styles.chestCellProcessing],
859
+ children: [/*#__PURE__*/_jsx(MonflowtsPressable, {
860
+ style: styles.chestTouchable,
861
+ onPress: () => handleChestPress(i),
862
+ activeOpacity: 0.8,
863
+ disabled: !canTap,
864
+ accessibilityRole: "button",
865
+ accessibilityState: {
866
+ selected: isSelected,
867
+ disabled: !canTap
868
+ },
869
+ children: /*#__PURE__*/_jsx(MonflowtsLottieView, {
870
+ sourceJson: chestOpenJson,
871
+ autoPlay: false,
872
+ loop: false,
873
+ speed: 1,
874
+ playing: (isProcessing || isOpened) && !isShuffling,
875
+ style: styles.chestLottie
876
+ }, `chest-${i}-${lottieKey}`)
877
+ }), /*#__PURE__*/_jsx(View, {
878
+ style: [styles.pickBadge, {
879
+ opacity: isSelected ? 1 : 0
880
+ }],
881
+ pointerEvents: "none",
836
882
  children: /*#__PURE__*/_jsx(Text, {
837
- style: styles.btnText,
838
- children: "\u2039"
883
+ style: styles.pickBadgeText,
884
+ children: isSelected ? pickOrder + 1 : ''
839
885
  })
840
886
  }), /*#__PURE__*/_jsx(View, {
841
- ref: balancePillRef,
842
- onLayout: measureBalancePill,
843
- children: /*#__PURE__*/_jsxs(Animated.View, {
844
- style: [styles.balancePill, {
845
- transform: [{
846
- scale: balancePulse
847
- }]
848
- }],
849
- children: [/*#__PURE__*/_jsx(View, {
850
- style: styles.diamondIcon,
851
- children: /*#__PURE__*/_jsx(SvgIcon, {
852
- name: "diamond",
853
- size: 14,
854
- color: COLORS.gold
855
- })
856
- }), /*#__PURE__*/_jsx(Text, {
857
- style: styles.balanceText,
858
- children: formatNumber(displayBalance)
859
- })]
887
+ style: [styles.treasureMarker, {
888
+ opacity: wasTreasure ? 0.85 : 0
889
+ }],
890
+ pointerEvents: "none",
891
+ children: /*#__PURE__*/_jsx(SvgIcon, {
892
+ name: "moneyBag",
893
+ size: Math.max(12, chestCellSize * 0.22),
894
+ color: COLORS.gold
860
895
  })
861
- }), /*#__PURE__*/_jsx(MonflowtsPressable, {
862
- style: styles.circleBtn,
863
- onPress: () => setRulesVisible(true),
896
+ }), /*#__PURE__*/_jsx(Animated.View, {
897
+ style: [styles.glowRing, styles.goldGlow, {
898
+ opacity: chestGlowAnims[i]
899
+ }],
900
+ pointerEvents: "none"
901
+ }), isOpened && !chestResult?.won && /*#__PURE__*/_jsx(View, {
902
+ style: styles.dustOverlay,
903
+ pointerEvents: "none",
904
+ children: /*#__PURE__*/_jsx(MonflowtsLottieView, {
905
+ sourceJson: dustJson,
906
+ autoPlay: true,
907
+ loop: false,
908
+ speed: 0.8,
909
+ style: {
910
+ width: '100%',
911
+ height: '100%'
912
+ }
913
+ })
914
+ }), /*#__PURE__*/_jsx(Animated.View, {
915
+ style: [styles.resultBadge, chestResult?.won ? styles.resultBadgeWin : styles.resultBadgeLoss, {
916
+ opacity: resultBadgeOpacity[i],
917
+ transform: [{
918
+ translateY: resultBadgeTranslateY[i]
919
+ }]
920
+ }],
921
+ pointerEvents: "none",
864
922
  children: /*#__PURE__*/_jsx(Text, {
865
- style: styles.btnText,
866
- children: "?"
923
+ style: [styles.resultBadgeText, chestResult?.won ? styles.resultBadgeTextWin : styles.resultBadgeTextLoss],
924
+ children: isOpened ? chestResult?.won ? t('hunter.treasure') : t('hunter.empty') : ''
867
925
  })
868
926
  })]
927
+ }, i);
928
+ })
929
+ })
930
+ });
931
+ const paytablePanel = isSelecting && paytable.length > 0 && /*#__PURE__*/_jsxs(View, {
932
+ style: styles.paytable,
933
+ children: [/*#__PURE__*/_jsx(Text, {
934
+ style: styles.footerLabel,
935
+ children: t('hunter.paytable')
936
+ }), paytable.map(row => /*#__PURE__*/_jsxs(View, {
937
+ style: styles.paytableRow,
938
+ children: [/*#__PURE__*/_jsx(Text, {
939
+ style: styles.paytableCell,
940
+ children: t('hunter.found', {
941
+ count: row.hits
942
+ })
943
+ }), /*#__PURE__*/_jsxs(Text, {
944
+ style: [styles.paytableCell, styles.paytableMultiplier],
945
+ children: [row.multiplier, "x"]
946
+ }), /*#__PURE__*/_jsx(Text, {
947
+ style: [styles.paytableCell, styles.paytableValue],
948
+ children: formatNumber(row.payout)
949
+ }), /*#__PURE__*/_jsx(Text, {
950
+ style: [styles.paytableCell, styles.paytableOdds],
951
+ children: t('hunter.oneIn', {
952
+ odds: oddsLabel(row.probability)
953
+ })
954
+ })]
955
+ }, row.hits)), rtpPercent && /*#__PURE__*/_jsx(Text, {
956
+ style: styles.paytableNote,
957
+ children: t('hunter.rtp', {
958
+ percent: rtpPercent
959
+ })
960
+ })]
961
+ });
962
+ const lobbyControls = gameState === 'LOBBY' && /*#__PURE__*/_jsxs(View, {
963
+ style: styles.footer,
964
+ children: [hasStakeOptions || !actualCostVG ? /*#__PURE__*/_jsxs(_Fragment, {
965
+ children: [/*#__PURE__*/_jsx(Text, {
966
+ style: styles.footerLabel,
967
+ children: t('hunter.stakePerHunt')
968
+ }), /*#__PURE__*/_jsx(MonflowtsChipGroup, {
969
+ options: stakeOptions,
970
+ selectedValue: activeStake,
971
+ onSelect: stake => {
972
+ sounds.playSelect();
973
+ setActiveStake(stake);
974
+ },
975
+ containerStyle: styles.stakeRow
976
+ }), !hasStakeOptions && /*#__PURE__*/_jsx(StakeInput, {
977
+ value: activeStake,
978
+ min: stakeOptions[0] ?? 100,
979
+ onConfirm: stake => setActiveStake(stake),
980
+ currency: currency
981
+ })]
982
+ }) : /*#__PURE__*/_jsx(Text, {
983
+ style: styles.footerLabel,
984
+ children: t('hunter.playFee', {
985
+ amount: formatNumber(effectiveCostVG),
986
+ currency
987
+ })
988
+ }), hasStakeCount && /*#__PURE__*/_jsxs(View, {
989
+ style: {
990
+ marginBottom: 16
991
+ },
992
+ children: [/*#__PURE__*/_jsx(Text, {
993
+ style: styles.footerLabel,
994
+ children: t('hunter.huntsPerSession')
995
+ }), /*#__PURE__*/_jsx(MonflowtsChipGroup, {
996
+ options: stakeCountOptions,
997
+ selectedValue: selectedStakeCount,
998
+ onSelect: count => {
999
+ sounds.playSelect();
1000
+ setSelectedStakeCount(count);
1001
+ },
1002
+ containerStyle: styles.stakeRow,
1003
+ getLabel: v => t('hunter.roundsShort', {
1004
+ count: v
1005
+ })
1006
+ }), isMultiHunt && /*#__PURE__*/_jsx(Text, {
1007
+ style: {
1008
+ color: COLORS.slateLight,
1009
+ fontSize: 11,
1010
+ textAlign: 'center',
1011
+ marginTop: 6
1012
+ },
1013
+ children: t('hunter.huntsSummary', {
1014
+ hunts: selectedStakeCount,
1015
+ picks: maxPicks
1016
+ })
1017
+ })]
1018
+ }), /*#__PURE__*/_jsxs(View, {
1019
+ style: styles.statsRow,
1020
+ children: [/*#__PURE__*/_jsxs(View, {
1021
+ style: styles.stat,
1022
+ children: [/*#__PURE__*/_jsx(Text, {
1023
+ style: styles.statLabel,
1024
+ children: t('hunter.costPerHunt')
869
1025
  }), /*#__PURE__*/_jsxs(View, {
870
- style: styles.titleArea,
871
- children: [/*#__PURE__*/_jsxs(View, {
872
- style: styles.badgeRow,
873
- children: [isMultiHunt && gameState !== 'LOBBY' && /*#__PURE__*/_jsx(View, {
874
- style: styles.roundBadge,
875
- children: /*#__PURE__*/_jsxs(Text, {
876
- style: styles.roundText,
877
- children: ["Hunt ", currentHunt, "/", selectedStakeCount]
878
- })
879
- }), /*#__PURE__*/_jsxs(View, {
880
- style: styles.liveBadge,
881
- children: [/*#__PURE__*/_jsx(View, {
882
- style: styles.liveIndicator
883
- }), /*#__PURE__*/_jsx(Text, {
884
- style: styles.liveText,
885
- children: demoMode ? t('hunter.demo') : t('hunter.live')
886
- })]
887
- })]
888
- }), isActive ? /*#__PURE__*/_jsxs(_Fragment, {
889
- children: [/*#__PURE__*/_jsx(Text, {
890
- style: styles.mainTitle,
891
- children: picksRemaining === 1 ? t('hunter.pickLeft_one', {
892
- count: picksRemaining
893
- }) : t('hunter.pickLeft_other', {
894
- count: picksRemaining
895
- })
896
- }), /*#__PURE__*/_jsx(Text, {
897
- style: styles.mainSubtitle,
898
- children: hasProcessing ? t('hunter.opening') : t('hunter.tapChest')
899
- })]
900
- }) : gameState === 'LOBBY' ? /*#__PURE__*/_jsxs(_Fragment, {
901
- children: [/*#__PURE__*/_jsx(Text, {
902
- style: styles.mainTitle,
903
- children: t('hunter.pickChest')
904
- }), /*#__PURE__*/_jsx(Text, {
905
- style: styles.mainSubtitle,
906
- children: t('hunter.lobbySubtitle', {
907
- count: maxPicks
908
- })
909
- })]
910
- }) : null]
911
- }), /*#__PURE__*/_jsx(AbandonPolicyNotice, {
912
- abandonPolicy: abandonPolicy
913
- }), initPlay.enabled && initPlay.error && !initPlay.session && /*#__PURE__*/_jsxs(View, {
914
1026
  style: {
915
- padding: 12,
916
- backgroundColor: '#fef2f2',
917
- borderRadius: 8,
918
- margin: 8,
1027
+ flexDirection: 'row',
919
1028
  alignItems: 'center'
920
1029
  },
921
- children: [/*#__PURE__*/_jsx(Text, {
922
- style: {
923
- color: '#b91c1c',
924
- fontSize: 13,
925
- marginBottom: 8,
926
- textAlign: 'center'
927
- },
928
- children: initPlay.error
929
- }), /*#__PURE__*/_jsx(MonflowtsButton, {
930
- title: t('hunter.retry'),
931
- onPress: () => initPlay.reset()
1030
+ children: [/*#__PURE__*/_jsx(SvgIcon, {
1031
+ name: "moneyBag",
1032
+ size: 16,
1033
+ color: COLORS.gold
1034
+ }), /*#__PURE__*/_jsx(Text, {
1035
+ style: [styles.statValue, {
1036
+ marginLeft: 4
1037
+ }],
1038
+ children: formatNumber(effectiveCostVG)
932
1039
  })]
933
- }), /*#__PURE__*/_jsx(View, {
934
- style: styles.gridArea,
935
- children: /*#__PURE__*/_jsx(View, {
936
- style: [styles.grid, {
937
- width: gridPixelWidth
1040
+ })]
1041
+ }), isMultiHunt && /*#__PURE__*/_jsxs(_Fragment, {
1042
+ children: [/*#__PURE__*/_jsx(View, {
1043
+ style: styles.divider
1044
+ }), /*#__PURE__*/_jsxs(View, {
1045
+ style: styles.stat,
1046
+ children: [/*#__PURE__*/_jsx(Text, {
1047
+ style: [styles.statLabel, {
1048
+ color: COLORS.primary
938
1049
  }],
939
- children: Array.from({
940
- length: gridSize
941
- }).map((_, i) => {
942
- const isProcessing = processingChests.has(i);
943
- const isCurrentlyOpening = isProcessing || currentPick === i && gameState === 'CHEST_ANIMATING';
944
- const chestResult = openedChests.get(i);
945
- const isOpened = !!chestResult;
946
- const canTap = (gameState === 'LOBBY' || gameState === 'PICKING' || gameState === 'CHEST_ANIMATING') && !isOpened && !isProcessing && picksRemaining > 0;
947
- return /*#__PURE__*/_jsxs(Animated.View, {
948
- ref: r => {
949
- chestRefs.current[i] = r;
950
- },
951
- onLayout: () => measureChest(i),
952
- style: [styles.chestCell, {
953
- width: chestCellSize,
954
- height: chestCellSize
955
- }, {
956
- transform: [{
957
- scale: chestScaleAnims[i]
958
- }, {
959
- translateX: shuffleTranslateX[i]
960
- }, {
961
- translateY: shuffleTranslateY[i]
962
- }, {
963
- scale: shuffleScale[i]
964
- }, {
965
- rotate: shuffleRotate[i].interpolate({
966
- inputRange: [-360, 360],
967
- outputRange: ['-360deg', '360deg']
968
- })
969
- }]
970
- }, isOpened && chestResult?.won && styles.chestCellWin, isOpened && !chestResult?.won && styles.chestCellLoss, isProcessing && styles.chestCellProcessing],
971
- children: [/*#__PURE__*/_jsx(MonflowtsPressable, {
972
- style: styles.chestTouchable,
973
- onPress: () => handleOpenChest(i),
974
- activeOpacity: 0.8,
975
- disabled: !canTap,
976
- children: /*#__PURE__*/_jsx(MonflowtsLottieView, {
977
- sourceJson: chestOpenJson,
978
- autoPlay: false,
979
- loop: false,
980
- speed: 1,
981
- playing: (isCurrentlyOpening || isOpened) && !isShuffling,
982
- style: styles.chestLottie
983
- }, `chest-${i}-${lottieKey}`)
984
- }), isOpened && chestResult?.won && /*#__PURE__*/_jsx(Animated.View, {
985
- style: [styles.glowRing, styles.goldGlow, {
986
- opacity: chestGlowAnims[i]
987
- }],
988
- pointerEvents: "none"
989
- }), isOpened && !chestResult?.won && /*#__PURE__*/_jsx(View, {
990
- style: styles.dustOverlay,
991
- pointerEvents: "none",
992
- children: /*#__PURE__*/_jsx(MonflowtsLottieView, {
993
- sourceJson: dustJson,
994
- autoPlay: true,
995
- loop: false,
996
- speed: 0.8,
997
- style: {
998
- width: '100%',
999
- height: '100%'
1000
- }
1001
- })
1002
- }), isOpened && /*#__PURE__*/_jsx(Animated.View, {
1003
- style: [styles.resultBadge, chestResult?.won ? styles.resultBadgeWin : styles.resultBadgeLoss, {
1004
- opacity: resultBadgeOpacity[i],
1005
- transform: [{
1006
- translateY: resultBadgeTranslateY[i]
1007
- }]
1008
- }],
1009
- pointerEvents: "none",
1010
- children: /*#__PURE__*/_jsx(Text, {
1011
- style: [styles.resultBadgeText, chestResult?.won ? styles.resultBadgeTextWin : styles.resultBadgeTextLoss],
1012
- children: chestResult?.won ? t('hunter.chestWin', {
1013
- amount: formatNumber(chestResult.amount)
1014
- }) : t('hunter.empty')
1015
- })
1016
- })]
1017
- }, i);
1050
+ children: t('hunter.totalHunts', {
1051
+ hunts: selectedStakeCount
1018
1052
  })
1019
- })
1020
- }), gameState === 'LOBBY' && /*#__PURE__*/_jsxs(View, {
1021
- style: styles.footer,
1022
- children: [hasStakeOptions || !actualCostVG ? /*#__PURE__*/_jsxs(_Fragment, {
1023
- children: [/*#__PURE__*/_jsx(Text, {
1024
- style: styles.footerLabel,
1025
- children: t('hunter.selectBet')
1026
- }), /*#__PURE__*/_jsx(MonflowtsChipGroup, {
1027
- options: stakeOptions,
1028
- selectedValue: activeStake,
1029
- onSelect: stake => {
1030
- sounds.playSelect();
1031
- setActiveStake(stake);
1032
- },
1033
- containerStyle: styles.stakeRow
1034
- }), /*#__PURE__*/_jsx(StakeInput, {
1035
- value: activeStake,
1036
- min: stakeOptions[0] ?? 100,
1037
- onConfirm: stake => setActiveStake(stake),
1038
- currency: currency
1039
- })]
1040
- }) : /*#__PURE__*/_jsx(Text, {
1041
- style: styles.footerLabel,
1042
- children: t('hunter.playFee', {
1043
- amount: formatNumber(effectiveCostVG),
1044
- currency
1045
- })
1046
- }), hasStakeCount && /*#__PURE__*/_jsxs(View, {
1053
+ }), /*#__PURE__*/_jsxs(View, {
1047
1054
  style: {
1048
- marginBottom: 16
1055
+ flexDirection: 'row',
1056
+ alignItems: 'center'
1049
1057
  },
1050
- children: [/*#__PURE__*/_jsx(Text, {
1051
- style: styles.footerLabel,
1052
- children: t('hunter.huntsPerSession')
1053
- }), /*#__PURE__*/_jsx(MonflowtsChipGroup, {
1054
- options: stakeCountOptions,
1055
- selectedValue: selectedStakeCount,
1056
- onSelect: count => {
1057
- sounds.playSelect();
1058
- setSelectedStakeCount(count);
1059
- },
1060
- containerStyle: styles.stakeRow,
1061
- getLabel: v => t('hunter.roundsShort', {
1062
- count: v
1063
- })
1064
- }), isMultiHunt && /*#__PURE__*/_jsx(Text, {
1065
- style: {
1066
- color: COLORS.slateLight,
1067
- fontSize: 11,
1068
- textAlign: 'center',
1069
- marginTop: 6
1070
- },
1071
- children: t('hunter.huntsSummary', {
1072
- hunts: selectedStakeCount,
1073
- picks: maxPicks
1074
- })
1075
- })]
1076
- }), /*#__PURE__*/_jsxs(View, {
1077
- style: styles.statsRow,
1078
- children: [/*#__PURE__*/_jsxs(View, {
1079
- style: styles.stat,
1080
- children: [/*#__PURE__*/_jsx(Text, {
1081
- style: styles.statLabel,
1082
- children: t('hunter.costPerChest')
1083
- }), /*#__PURE__*/_jsxs(View, {
1084
- style: {
1085
- flexDirection: 'row',
1086
- alignItems: 'center'
1087
- },
1088
- children: [/*#__PURE__*/_jsx(SvgIcon, {
1089
- name: "moneyBag",
1090
- size: 16,
1091
- color: COLORS.gold
1092
- }), /*#__PURE__*/_jsx(Text, {
1093
- style: [styles.statValue, {
1094
- marginLeft: 4
1095
- }],
1096
- children: effectiveCostVG
1097
- })]
1098
- })]
1099
- }), /*#__PURE__*/_jsx(View, {
1100
- style: styles.divider
1101
- }), /*#__PURE__*/_jsxs(View, {
1102
- style: styles.stat,
1103
- children: [/*#__PURE__*/_jsx(Text, {
1104
- style: [styles.statLabel, {
1105
- color: COLORS.primary
1106
- }],
1107
- children: isMultiHunt ? t('hunter.totalMulti', {
1108
- hunts: selectedStakeCount,
1109
- picks: maxPicks
1110
- }) : t('hunter.totalSingle', {
1111
- picks: maxPicks
1112
- })
1113
- }), /*#__PURE__*/_jsxs(View, {
1114
- style: {
1115
- flexDirection: 'row',
1116
- alignItems: 'center'
1117
- },
1118
- children: [/*#__PURE__*/_jsx(SvgIcon, {
1119
- name: "trophy",
1120
- size: 16,
1121
- color: COLORS.gold
1122
- }), /*#__PURE__*/_jsx(Text, {
1123
- style: [styles.statValue, {
1124
- marginLeft: 4
1125
- }],
1126
- children: isMultiHunt ? formatNumber(totalSessionCostVG) : formatNumber(effectiveCostVG * maxPicks)
1127
- })]
1128
- })]
1058
+ children: [/*#__PURE__*/_jsx(SvgIcon, {
1059
+ name: "trophy",
1060
+ size: 16,
1061
+ color: COLORS.gold
1062
+ }), /*#__PURE__*/_jsx(Text, {
1063
+ style: [styles.statValue, {
1064
+ marginLeft: 4
1065
+ }],
1066
+ children: formatNumber(totalSessionCostVG)
1129
1067
  })]
1130
1068
  })]
1131
- }), isActive && /*#__PURE__*/_jsxs(View, {
1132
- style: styles.activeFooter,
1133
- children: [/*#__PURE__*/_jsxs(View, {
1134
- style: styles.activeFooterRow,
1135
- children: [/*#__PURE__*/_jsx(Text, {
1136
- style: styles.activeFooterLabel,
1137
- children: isMultiHunt ? t('hunter.thisHunt') : t('hunter.wonSoFar')
1138
- }), /*#__PURE__*/_jsx(Text, {
1139
- style: [styles.activeFooterValue, totalWonThisRound > 0 && {
1069
+ })]
1070
+ })]
1071
+ })]
1072
+ });
1073
+ const activeInfo = (isActive || gameState === 'PICKING') && /*#__PURE__*/_jsxs(View, {
1074
+ style: styles.activeFooter,
1075
+ children: [/*#__PURE__*/_jsxs(View, {
1076
+ style: styles.activeFooterRow,
1077
+ children: [/*#__PURE__*/_jsx(Text, {
1078
+ style: styles.activeFooterLabel,
1079
+ children: isMultiHunt ? t('hunter.thisHunt') : t('hunter.wonSoFar')
1080
+ }), /*#__PURE__*/_jsx(Text, {
1081
+ style: [styles.activeFooterValue, totalWonThisRound > 0 && {
1082
+ color: COLORS.gold
1083
+ }],
1084
+ children: t('hunter.amountWithCurrency', {
1085
+ amount: totalWonThisRound > 0 ? `+${formatNumber(totalWonThisRound)}` : '0',
1086
+ currency
1087
+ })
1088
+ })]
1089
+ }), /*#__PURE__*/_jsx(View, {
1090
+ style: styles.activeFooterDivider
1091
+ }), isMultiHunt && /*#__PURE__*/_jsxs(_Fragment, {
1092
+ children: [/*#__PURE__*/_jsxs(View, {
1093
+ style: styles.activeFooterRow,
1094
+ children: [/*#__PURE__*/_jsx(Text, {
1095
+ style: styles.activeFooterLabel,
1096
+ children: t('hunter.session')
1097
+ }), /*#__PURE__*/_jsx(Text, {
1098
+ style: [styles.activeFooterValue, sessionTotalWon > 0 && {
1099
+ color: COLORS.gold
1100
+ }],
1101
+ children: t('hunter.amountWithCurrency', {
1102
+ amount: sessionTotalWon > 0 ? `+${formatNumber(sessionTotalWon)}` : '0',
1103
+ currency
1104
+ })
1105
+ })]
1106
+ }), /*#__PURE__*/_jsx(View, {
1107
+ style: styles.activeFooterDivider
1108
+ })]
1109
+ }), /*#__PURE__*/_jsxs(View, {
1110
+ style: styles.activeFooterRow,
1111
+ children: [/*#__PURE__*/_jsx(Text, {
1112
+ style: styles.activeFooterLabel,
1113
+ children: t('hunter.costPerHunt')
1114
+ }), /*#__PURE__*/_jsx(Text, {
1115
+ style: styles.activeFooterValue,
1116
+ children: t('hunter.amountWithCurrency', {
1117
+ amount: formatNumber(effectiveCostVG),
1118
+ currency
1119
+ })
1120
+ })]
1121
+ })]
1122
+ });
1123
+ const actionBar = /*#__PURE__*/_jsxs(View, {
1124
+ style: styles.actionBar,
1125
+ children: [/*#__PURE__*/_jsx(MonflowtsButton, {
1126
+ title: t('hunter.quickPick'),
1127
+ variant: "outline",
1128
+ onPress: handleQuickPick,
1129
+ disabled: !isSelecting,
1130
+ containerStyle: styles.actionSecondary
1131
+ }), /*#__PURE__*/_jsx(MonflowtsButton, {
1132
+ title: isActive ? t('hunter.opening') : `${t('hunter.openChests')} · ${formatNumber(effectiveCostVG)}`,
1133
+ onPress: handleOpenChests,
1134
+ disabled: !isSelecting || selectedPicks.length !== maxPicks,
1135
+ loading: isActive,
1136
+ pulse: isSelecting && selectedPicks.length === maxPicks,
1137
+ containerStyle: styles.actionPrimary
1138
+ })]
1139
+ });
1140
+ return /*#__PURE__*/_jsx(KeyboardAvoidingView, {
1141
+ style: {
1142
+ flex: 1
1143
+ },
1144
+ behavior: Platform.OS === 'ios' ? 'padding' : undefined,
1145
+ children: /*#__PURE__*/_jsxs(View, {
1146
+ style: styles.container,
1147
+ ref: containerRef,
1148
+ onLayout: onContainerLayout,
1149
+ children: [/*#__PURE__*/_jsx(HypeCallout, {
1150
+ ref: hypeRef,
1151
+ style: {
1152
+ top: layout.landscape ? 80 : 230
1153
+ }
1154
+ }), /*#__PURE__*/_jsx(SideDemoTab, {
1155
+ enabled: !!game?.demoConfig?.enabled
1156
+ }), initPlay.enabled && initPlay.session && /*#__PURE__*/_jsx(SessionTimer, {
1157
+ secondsLeft: initPlay.secondsLeft,
1158
+ isExpired: initPlay.isExpired
1159
+ }), /*#__PURE__*/_jsxs(View, {
1160
+ style: styles.header,
1161
+ children: [/*#__PURE__*/_jsx(QuitConfirmModal, {
1162
+ visible: quitVisible,
1163
+ message: t('hunter.quitMessage'),
1164
+ onKeepPlaying: () => setQuitVisible(false),
1165
+ onQuit: () => {
1166
+ setQuitVisible(false);
1167
+ onBack();
1168
+ }
1169
+ }), /*#__PURE__*/_jsx(MonflowtsPressable, {
1170
+ style: styles.circleBtn,
1171
+ onPress: handleBack,
1172
+ children: /*#__PURE__*/_jsx(Text, {
1173
+ style: styles.btnText,
1174
+ children: "\u2039"
1175
+ })
1176
+ }), /*#__PURE__*/_jsx(View, {
1177
+ ref: balancePillRef,
1178
+ onLayout: measureBalancePill,
1179
+ children: /*#__PURE__*/_jsxs(Animated.View, {
1180
+ style: [styles.balancePill, {
1181
+ transform: [{
1182
+ scale: balancePulse
1183
+ }]
1184
+ }],
1185
+ children: [/*#__PURE__*/_jsx(View, {
1186
+ style: styles.diamondIcon,
1187
+ children: /*#__PURE__*/_jsx(SvgIcon, {
1188
+ name: "diamond",
1189
+ size: 14,
1140
1190
  color: COLORS.gold
1141
- }],
1142
- children: t('hunter.amountWithCurrency', {
1143
- amount: totalWonThisRound > 0 ? `+${formatNumber(totalWonThisRound)}` : '0',
1144
- currency
1145
1191
  })
1146
- })]
1147
- }), /*#__PURE__*/_jsx(View, {
1148
- style: styles.activeFooterDivider
1149
- }), isMultiHunt && /*#__PURE__*/_jsxs(_Fragment, {
1150
- children: [/*#__PURE__*/_jsxs(View, {
1151
- style: styles.activeFooterRow,
1152
- children: [/*#__PURE__*/_jsx(Text, {
1153
- style: styles.activeFooterLabel,
1154
- children: t('hunter.session')
1155
- }), /*#__PURE__*/_jsx(Text, {
1156
- style: [styles.activeFooterValue, sessionTotalWon > 0 && {
1157
- color: COLORS.gold
1158
- }],
1159
- children: t('hunter.amountWithCurrency', {
1160
- amount: sessionTotalWon > 0 ? `+${formatNumber(sessionTotalWon)}` : '0',
1161
- currency
1162
- })
1163
- })]
1164
- }), /*#__PURE__*/_jsx(View, {
1165
- style: styles.activeFooterDivider
1166
- })]
1167
- }), /*#__PURE__*/_jsxs(View, {
1168
- style: styles.activeFooterRow,
1169
- children: [/*#__PURE__*/_jsx(Text, {
1170
- style: styles.activeFooterLabel,
1171
- children: t('hunter.costPerChest')
1172
1192
  }), /*#__PURE__*/_jsx(Text, {
1173
- style: styles.activeFooterValue,
1174
- children: t('hunter.amountWithCurrency', {
1175
- amount: effectiveCostVG,
1176
- currency
1177
- })
1193
+ style: styles.balanceText,
1194
+ children: formatNumber(displayBalance)
1178
1195
  })]
1179
- })]
1196
+ })
1197
+ }), /*#__PURE__*/_jsx(MonflowtsPressable, {
1198
+ style: styles.circleBtn,
1199
+ onPress: () => setRulesVisible(true),
1200
+ children: /*#__PURE__*/_jsx(Text, {
1201
+ style: styles.btnText,
1202
+ children: "?"
1203
+ })
1204
+ })]
1205
+ }), /*#__PURE__*/_jsxs(View, {
1206
+ style: [styles.body, layout.landscape && styles.bodyLandscape],
1207
+ children: [/*#__PURE__*/_jsxs(View, {
1208
+ style: layout.landscape ? [styles.boardPaneLandscape, {
1209
+ width: layout.boardWidth
1210
+ }] : undefined,
1211
+ children: [/*#__PURE__*/_jsx(View, {
1212
+ style: layout.landscape ? styles.hidden : undefined,
1213
+ children: titleArea
1214
+ }), board]
1215
+ }), /*#__PURE__*/_jsxs(View, {
1216
+ style: styles.sidePane,
1217
+ children: [/*#__PURE__*/_jsxs(ScrollView, {
1218
+ contentContainerStyle: layout.landscape ? styles.sideScroll : undefined,
1219
+ keyboardShouldPersistTaps: "handled",
1220
+ bounces: false,
1221
+ children: [/*#__PURE__*/_jsx(View, {
1222
+ style: layout.landscape ? undefined : styles.hidden,
1223
+ children: titleArea
1224
+ }), notices, paytablePanel, lobbyControls, activeInfo]
1225
+ }), actionBar]
1180
1226
  })]
1181
- }), isSummary && /*#__PURE__*/_jsxs(Animated.View, {
1227
+ }), /*#__PURE__*/_jsxs(Animated.View, {
1182
1228
  style: [styles.overlay, {
1183
1229
  opacity: overlayOpacity
1184
1230
  }],
1185
- children: [displayWon > 0 && /*#__PURE__*/_jsx(View, {
1231
+ pointerEvents: isSummary ? 'auto' : 'none',
1232
+ accessibilityElementsHidden: !isSummary,
1233
+ importantForAccessibility: isSummary ? 'auto' : 'no-hide-descendants',
1234
+ children: [isSummary && displayWon > 0 && /*#__PURE__*/_jsx(View, {
1186
1235
  style: styles.lottieOverlay,
1187
1236
  pointerEvents: "none",
1188
1237
  children: /*#__PURE__*/_jsx(MonflowtsLottieView, {
@@ -1233,12 +1282,15 @@ const MillionaireHunter = ({
1233
1282
  amount: formatNumber(displayWon),
1234
1283
  currency
1235
1284
  })
1285
+ }), !isMultiHunt && huntResult && huntResult.multiplier !== null && /*#__PURE__*/_jsx(Text, {
1286
+ style: styles.overlayDetail,
1287
+ children: t('hunter.result', {
1288
+ hits: huntResult.hits,
1289
+ picks: huntResult.picks,
1290
+ multiplier: huntResult.multiplier
1291
+ })
1236
1292
  }), isMultiHunt && /*#__PURE__*/_jsx(Text, {
1237
- style: {
1238
- color: COLORS.slateLight,
1239
- fontSize: 12,
1240
- marginBottom: 4
1241
- },
1293
+ style: styles.overlayDetail,
1242
1294
  children: t('hunter.huntsWon', {
1243
1295
  wins: sessionHuntWins,
1244
1296
  total: selectedStakeCount
@@ -1246,9 +1298,12 @@ const MillionaireHunter = ({
1246
1298
  }), /*#__PURE__*/_jsx(Text, {
1247
1299
  style: styles.overlaySubtitle,
1248
1300
  children: t(`${summaryMsg}.sub`)
1249
- }), /*#__PURE__*/_jsx(JackpotNearMiss, {
1250
- jackpotAmountKobo: game?.gameplayRules?.jackpotAmountKobo ?? 0,
1251
- currency: currency
1301
+ }), huntResult?.serverSeedHash && huntResult.nonce !== null && /*#__PURE__*/_jsx(Text, {
1302
+ style: styles.fairnessText,
1303
+ children: t('hunter.fairness', {
1304
+ nonce: huntResult.nonce,
1305
+ hash: huntResult.serverSeedHash.slice(0, 12)
1306
+ })
1252
1307
  }), /*#__PURE__*/_jsx(MonflowtsButton, {
1253
1308
  title: displayWon > 0 ? t('hunter.collectHuntAgain') : t('hunter.huntAgain'),
1254
1309
  icon: /*#__PURE__*/_jsx(SvgIcon, {
@@ -1270,7 +1325,7 @@ const MillionaireHunter = ({
1270
1325
  marginTop: 12
1271
1326
  }
1272
1327
  }), /*#__PURE__*/_jsx(MonflowtsPressable, {
1273
- onPress: onBack,
1328
+ onPress: handleReturnToMenu,
1274
1329
  style: {
1275
1330
  marginTop: 8
1276
1331
  },
@@ -1323,12 +1378,87 @@ const MillionaireHunter = ({
1323
1378
  })
1324
1379
  });
1325
1380
  };
1326
- const styles = StyleSheet.create({
1381
+ const styles = scaledStyles({
1327
1382
  container: {
1328
1383
  flex: 1,
1329
1384
  backgroundColor: COLORS.backgroundDark,
1330
1385
  paddingTop: 50
1331
1386
  },
1387
+ body: {
1388
+ flex: 1
1389
+ },
1390
+ bodyLandscape: {
1391
+ flexDirection: 'row'
1392
+ },
1393
+ boardPaneLandscape: {
1394
+ justifyContent: 'center',
1395
+ alignItems: 'center'
1396
+ },
1397
+ sidePane: {
1398
+ flex: 1
1399
+ },
1400
+ hidden: {
1401
+ display: 'none'
1402
+ },
1403
+ sideScroll: {
1404
+ flexGrow: 1,
1405
+ justifyContent: 'center',
1406
+ paddingRight: 28
1407
+ },
1408
+ actionBar: {
1409
+ flexDirection: 'row',
1410
+ gap: 10,
1411
+ paddingHorizontal: 20,
1412
+ paddingTop: 10,
1413
+ paddingBottom: 28,
1414
+ borderTopWidth: 1,
1415
+ borderTopColor: COLORS.white10,
1416
+ backgroundColor: COLORS.backgroundDark
1417
+ },
1418
+ actionSecondary: {
1419
+ flex: 2
1420
+ },
1421
+ actionPrimary: {
1422
+ flex: 3
1423
+ },
1424
+ paytable: {
1425
+ marginHorizontal: 20,
1426
+ marginBottom: 16,
1427
+ padding: 12,
1428
+ borderRadius: 14,
1429
+ backgroundColor: 'rgba(30, 41, 59, 0.5)',
1430
+ borderWidth: 1,
1431
+ borderColor: COLORS.white10,
1432
+ alignItems: 'center'
1433
+ },
1434
+ paytableRow: {
1435
+ flexDirection: 'row',
1436
+ alignSelf: 'stretch',
1437
+ paddingVertical: 4
1438
+ },
1439
+ paytableCell: {
1440
+ flex: 1,
1441
+ fontSize: 12,
1442
+ fontWeight: '700',
1443
+ color: COLORS.slateLight
1444
+ },
1445
+ paytableMultiplier: {
1446
+ color: COLORS.gold,
1447
+ textAlign: 'center'
1448
+ },
1449
+ paytableValue: {
1450
+ color: '#fff',
1451
+ textAlign: 'center'
1452
+ },
1453
+ paytableOdds: {
1454
+ textAlign: 'right'
1455
+ },
1456
+ paytableNote: {
1457
+ fontSize: 10,
1458
+ color: COLORS.slateDark,
1459
+ marginTop: 6,
1460
+ textAlign: 'center'
1461
+ },
1332
1462
  // ── Header ──
1333
1463
  header: {
1334
1464
  flexDirection: 'row',
@@ -1426,10 +1556,10 @@ const styles = StyleSheet.create({
1426
1556
  },
1427
1557
  // ── Grid ──
1428
1558
  gridArea: {
1429
- flex: 1,
1430
1559
  alignItems: 'center',
1431
1560
  justifyContent: 'center',
1432
- paddingHorizontal: GRID_PADDING
1561
+ paddingHorizontal: GRID_PADDING,
1562
+ paddingVertical: 8
1433
1563
  },
1434
1564
  grid: {
1435
1565
  flexDirection: 'row',
@@ -1444,6 +1574,38 @@ const styles = StyleSheet.create({
1444
1574
  alignItems: 'center',
1445
1575
  justifyContent: 'center'
1446
1576
  },
1577
+ chestCellSelected: {
1578
+ borderColor: COLORS.gold,
1579
+ borderWidth: 2,
1580
+ backgroundColor: 'rgba(234, 179, 8, 0.12)'
1581
+ },
1582
+ chestCellMissedTreasure: {
1583
+ borderColor: 'rgba(234, 179, 8, 0.35)',
1584
+ borderStyle: 'dashed'
1585
+ },
1586
+ pickBadge: {
1587
+ position: 'absolute',
1588
+ top: 4,
1589
+ right: 4,
1590
+ minWidth: 18,
1591
+ height: 18,
1592
+ borderRadius: 9,
1593
+ backgroundColor: COLORS.gold,
1594
+ alignItems: 'center',
1595
+ justifyContent: 'center',
1596
+ paddingHorizontal: 4
1597
+ },
1598
+ pickBadgeText: {
1599
+ fontSize: 11,
1600
+ fontWeight: '900',
1601
+ color: '#000'
1602
+ },
1603
+ treasureMarker: {
1604
+ position: 'absolute',
1605
+ top: 4,
1606
+ left: 4,
1607
+ opacity: 0.85
1608
+ },
1447
1609
  chestCellWin: {
1448
1610
  borderColor: 'rgba(234, 179, 8, 0.4)',
1449
1611
  backgroundColor: 'rgba(234, 179, 8, 0.08)'
@@ -1631,6 +1793,18 @@ const styles = StyleSheet.create({
1631
1793
  color: '#fff',
1632
1794
  marginBottom: 4
1633
1795
  },
1796
+ overlayDetail: {
1797
+ color: COLORS.slateLight,
1798
+ fontSize: 13,
1799
+ marginBottom: 6,
1800
+ textAlign: 'center'
1801
+ },
1802
+ fairnessText: {
1803
+ color: COLORS.slateDark,
1804
+ fontSize: 10,
1805
+ marginBottom: 16,
1806
+ textAlign: 'center'
1807
+ },
1634
1808
  overlaySubtitle: {
1635
1809
  fontSize: 14,
1636
1810
  color: 'rgba(255,255,255,0.6)',