@@ -11,8 +11,23 @@ import { useRole } from "@/hooks/useRole";
1111import { ChatPanel } from "@/components/ChatPanel" ;
1212import { QuizBoardPandoraLottoOverlay } from "@/components/QuizBoardPandoraLottoOverlay" ;
1313import { DonationsTable } from "@/components/DonationsTable" ;
14+ import { getAdeptsCommandSocket } from "@/lib/adeptsCommandSocket" ;
1415import { getQuizNavSocket } from "@/hooks/quizNavSocket" ;
1516
17+ /** Вопрос 400 = индекс 3. Бонус дед-слеша: тема «Маунты» по названию или любой dedFly в каталоге. */
18+ function shouldEmitDedFlyDonationBonus (
19+ themeName : string | undefined ,
20+ questionIndex : number ,
21+ splashVariant : string | undefined ,
22+ ) : boolean {
23+ if ( questionIndex !== 3 ) return false ;
24+ if ( splashVariant === "dedFly" ) return true ;
25+ const n = String ( themeName ?? "" )
26+ . trim ( )
27+ . toLowerCase ( ) ;
28+ return n . includes ( "маунт" ) || n . includes ( "mount" ) ;
29+ }
30+
1631function resolveUrl ( url : string ) : string {
1732 if ( ! url ) return url ;
1833 if ( url . startsWith ( "http" ) || url . startsWith ( "//" ) ) return url ;
@@ -218,7 +233,26 @@ export default function Home({ boardId }: { boardId: AdeptsBoardId }) {
218233 allowRaccoonSplashSeatPass = { openCard . splashSeatPassUsed !== true }
219234 splashDismissed = { openCard . splashDismissed === true }
220235 splashDedFlyExitStarted = { openCard . splashDedFlyExitStarted === true }
221- onDedFlyExitStart = { ( ) => patchActiveQuizCard ( { splashDedFlyExitStarted : true } ) }
236+ onDedFlyExitStart = { ( ) => {
237+ patchActiveQuizCard ( { splashDedFlyExitStarted : true } ) ;
238+ if ( ! isHost || ! openCard ) return ;
239+ const qMeta = state . questions [ openCard . themeIndex ] ?. [ openCard . questionIndex ] ;
240+ if (
241+ shouldEmitDedFlyDonationBonus (
242+ state . themes [ openCard . themeIndex ] ,
243+ openCard . questionIndex ,
244+ qMeta ?. splashVariant ,
245+ )
246+ ) {
247+ queueMicrotask ( ( ) => {
248+ getAdeptsCommandSocket ( ) . emit ( "command" , {
249+ type : "hostMounts400DedDonationBonus" ,
250+ themeIndex : openCard . themeIndex ,
251+ questionIndex : openCard . questionIndex ,
252+ } ) ;
253+ } ) ;
254+ }
255+ } }
222256 canFinalizeDedFlySplashDismiss = { isHost }
223257 canDismissRaccoonSplash = { canDismissSplash }
224258 onDismissSplash = { ( ) =>
0 commit comments