@@ -6,7 +6,55 @@ import DndFooter from './DndFooter';
66import dndWallpapers from '../../utils/dndWallpapers' ;
77import { parseWallpaperName } from '../../utils/dndUtils' ;
88import '../../styles/dnd-refactor.css' ;
9- import { GameController , Flame } from '@phosphor-icons/react' ;
9+ import { GameController , Flame , TreasureChest } from '@phosphor-icons/react' ;
10+ import { useToast } from '../../hooks/useToast' ;
11+
12+ const Lightning = ( ) => (
13+ < div className = "dnd-lightning-overlay" />
14+ ) ;
15+
16+ const LootDiscovery = ( ) => {
17+ const { addToast } = useToast ( ) ;
18+ const [ showLoot , setShowLoot ] = useState ( false ) ;
19+ const [ lootPos , setLootPos ] = useState ( { top : '50%' , left : '50%' } ) ;
20+
21+ useEffect ( ( ) => {
22+ const interval = setInterval ( ( ) => {
23+ // 50% chance every 15 seconds
24+ if ( Math . random ( ) > 0.5 ) {
25+ setLootPos ( {
26+ top : `${ 30 + Math . random ( ) * 40 } %` ,
27+ left : `${ 20 + Math . random ( ) * 60 } %` ,
28+ } ) ;
29+ setShowLoot ( true ) ;
30+ setTimeout ( ( ) => setShowLoot ( false ) , 8000 ) ; // Hide after 8s
31+ }
32+ } , 15000 ) ;
33+ return ( ) => clearInterval ( interval ) ;
34+ } , [ ] ) ;
35+
36+ if ( ! showLoot ) return null ;
37+
38+ return (
39+ < motion . div
40+ initial = { { opacity : 0 , scale : 0 } }
41+ animate = { { opacity : 1 , scale : 1 } }
42+ exit = { { opacity : 0 , scale : 0 } }
43+ onClick = { ( ) => {
44+ addToast ( {
45+ title : 'Loot Discovered!' ,
46+ message : 'You found an ancient relic in the archives.' ,
47+ type : 'gold' ,
48+ } ) ;
49+ setShowLoot ( false ) ;
50+ } }
51+ className = "fixed z-[150] dnd-loot-item text-dnd-gold"
52+ style = { { top : lootPos . top , left : lootPos . left } }
53+ >
54+ < TreasureChest size = { 32 } weight = "fill" />
55+ </ motion . div >
56+ ) ;
57+ } ;
1058
1159const FireplaceAudio = ( ) => {
1260 const [ isPlaying , setIsPlaying ] = useState ( false ) ;
@@ -184,7 +232,7 @@ const DiceRoller = () => {
184232 ) }
185233 < button
186234 onClick = { rollDice }
187- className = { `p-4 bg-dnd-crimson border-2 border-dnd-gold rounded-full text-dnd-gold shadow-2xl transition-all hover:scale-110 active:scale-95 ${ isRolling ? 'dnd-dice-action' : '' } ` }
235+ className = { `p-4 bg-dnd-crimson border-2 border-dnd-gold rounded-full text-white/50 shadow-2xl transition-all hover:scale-110 active:scale-95 ${ isRolling ? 'dnd-dice-action' : '' } ` }
188236 >
189237 < GameController size = { 32 } weight = "fill" />
190238 </ button >
@@ -205,6 +253,8 @@ const DndLayout = ({ children }) => {
205253 return (
206254 < div className = "dnd-theme-root min-h-screen flex flex-col relative overflow-x-hidden" >
207255 < ViewportFrame />
256+ < Lightning />
257+ < LootDiscovery />
208258 < FireplaceAudio />
209259 < FireOverlay />
210260 < Torchlight />
0 commit comments