create-dubhe 1.2.0-pre.98 → 2.0.0
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.
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/package.json +16 -16
- package/templates/101/sui-template/docker-compose.testnet.yml +73 -0
- package/templates/101/sui-template/packages/client/src/app/page.tsx +545 -41
- package/templates/101/sui-template/packages/client/src/app/providers.tsx +12 -4
- package/templates/101/sui-template/packages/contracts/Pub.localnet.toml +4 -4
- package/templates/101/sui-template/packages/contracts/counter.lock.json +20 -0
- package/templates/101/sui-template/packages/contracts/deployment.ts +8 -3
- package/templates/101/sui-template/packages/contracts/dubhe.config.json +59 -13
- package/templates/101/sui-template/packages/contracts/dubhe.config.ts +1 -4
- package/templates/101/sui-template/packages/contracts/metadata.json +1015 -68
- package/templates/101/sui-template/packages/contracts/package.json +7 -4
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +45 -31
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/error.move +8 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +30 -13
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/init_test.move +19 -14
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +198 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2withkey.move +90 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/value.move +30 -20
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/user_storage_init.move +26 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/scripts/deploy_hook.move +6 -11
- package/templates/101/sui-template/packages/contracts/src/counter/sources/systems/counter.move +23 -11
- package/templates/101/sui-template/packages/contracts/src/counter/sources/tests/counter.move +15 -14
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.lock +33 -30
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.toml +8 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +45 -31
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/error.move +170 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +16 -13
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +8 -14
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +1 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +1776 -137
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/data_key.move +1 -20
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/events.move +864 -25
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +15 -16
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +0 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +25 -17
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +2802 -343
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/address.move +173 -55
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/dapp_test.move +769 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/fee_test.move +2965 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/integration_test.move +303 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/listing_test.move +1422 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/scene_session_test.move +269 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/session_test.move +624 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/storage_test.move +700 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/typed_object_test.move +177 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/typed_scene_test.move +452 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move +160 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/math.move +4 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move +2 -2
- package/templates/contract/sui-template/dubhe.config.ts +0 -1
- package/templates/contract/sui-template/package.json +3 -3
- package/templates/contract/sui-template/src/dubhe/Move.lock +33 -30
- package/templates/contract/sui-template/src/dubhe/Move.toml +8 -3
- package/templates/contract/sui-template/src/dubhe/sources/codegen/dapp_key.move +45 -31
- package/templates/contract/sui-template/src/dubhe/sources/codegen/error.move +170 -0
- package/templates/contract/sui-template/src/dubhe/sources/codegen/genesis.move +16 -13
- package/templates/contract/sui-template/src/dubhe/sources/codegen/init_test.move +8 -14
- package/templates/contract/sui-template/src/dubhe/sources/core/account_key.move +1 -3
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_service.move +1776 -137
- package/templates/contract/sui-template/src/dubhe/sources/core/data_key.move +1 -20
- package/templates/contract/sui-template/src/dubhe/sources/core/events.move +864 -25
- package/templates/contract/sui-template/src/dubhe/sources/scripts/deploy_hook.move +15 -16
- package/templates/contract/sui-template/src/dubhe/sources/scripts/migrate.move +0 -3
- package/templates/contract/sui-template/src/dubhe/sources/systems/address_system.move +25 -17
- package/templates/contract/sui-template/src/dubhe/sources/systems/dapp_system.move +2802 -343
- package/templates/contract/sui-template/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/contract/sui-template/src/dubhe/sources/tests/address.move +173 -55
- package/templates/contract/sui-template/src/dubhe/sources/tests/dapp_test.move +769 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/fee_test.move +2965 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/integration_test.move +303 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/listing_test.move +1422 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/scene_session_test.move +269 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/session_test.move +624 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/storage_test.move +700 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/typed_object_test.move +177 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/typed_scene_test.move +452 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/user_storage_test.move +160 -0
- package/templates/contract/sui-template/src/dubhe/sources/utils/math.move +4 -3
- package/templates/contract/sui-template/src/dubhe/sources/utils/type_info.move +2 -2
- package/templates/contract/sui-template/src/template/Move.toml +12 -0
- package/templates/contract/sui-template/src/template/sources/codegen/dapp_key.move +47 -0
- package/templates/contract/sui-template/src/template/sources/codegen/genesis.move +34 -0
- package/templates/contract/sui-template/src/template/sources/codegen/init_test.move +23 -0
- package/templates/contract/sui-template/src/template/sources/codegen/user_storage_init.move +27 -0
- package/templates/contract/sui-template/src/template/sources/scripts/deploy_hook.move +13 -0
- package/templates/contract/sui-template/src/template/sources/scripts/migrate.move +7 -0
- package/templates/nextjs/sui-card-duel/.gitignore_ +51 -0
- package/templates/nextjs/sui-card-duel/README.md +213 -0
- package/templates/nextjs/sui-card-duel/docker-compose.yml +34 -0
- package/templates/nextjs/sui-card-duel/mprocs.yaml +17 -0
- package/templates/nextjs/sui-card-duel/package.json +43 -0
- package/templates/nextjs/sui-card-duel/packages/client/.gitignore_ +48 -0
- package/templates/nextjs/sui-card-duel/packages/client/.prettierignore +1 -0
- package/templates/nextjs/sui-card-duel/packages/client/.prettierrc.json +8 -0
- package/templates/nextjs/sui-card-duel/packages/client/eslint.config.mjs +22 -0
- package/templates/nextjs/sui-card-duel/packages/client/next.config.mjs +8 -0
- package/templates/nextjs/sui-card-duel/packages/client/package.json +47 -0
- package/templates/nextjs/sui-card-duel/packages/client/postcss.config.mjs +8 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/admin/ArenaPanel.tsx +307 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/admin/page.tsx +622 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/brawl/[id]/page.tsx +559 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/collection/page.tsx +202 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/components/CardView.tsx +66 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/components/GameShell.tsx +294 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/components/icons.tsx +101 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/duel/[id]/page.tsx +477 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/favicon.ico +0 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/globals.css +85 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/hooks/useGame.ts +313 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/layout.tsx +24 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/leaderboard/page.tsx +123 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/lib/game.ts +77 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/lib/scenes.ts +226 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/market/page.tsx +418 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/page.tsx +427 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/providers.tsx +69 -0
- package/templates/nextjs/sui-card-duel/packages/client/tailwind.config.ts +21 -0
- package/templates/nextjs/sui-card-duel/packages/client/tsconfig.json +30 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/.gitignore_ +51 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/.prettierignore +1 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/.prettierrc.json +8 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/Dockerfile +5 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/Pub.localnet.toml +13 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/card_duel.lock.json +66 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/docker-compose.yml +34 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/dubhe.config.ts +150 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/logs/combined.log +31383 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/package.json +49 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/config.ts +17 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-brawl.ts +270 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-duel.ts +272 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-lobby.ts +177 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-market.ts +219 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-session.ts +342 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/query-dapp-revenue.ts +95 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/seed.ts +92 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/withdraw-dapp-revenue.ts +56 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/Move.toml +15 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/dapp_key.move +46 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/enums/card_kind.move +47 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/enums/match_state.move +37 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/enums/rarity.move +37 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/error.move +126 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/genesis.move +33 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/init_test.move +23 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/objects/arena.move +137 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/permits/brawl_permit.move +125 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/permits/duel_permit.move +125 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/battle_state.move +255 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/card.move +282 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/deck.move +64 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/game_config.move +267 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/gold.move +205 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/profile.move +255 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/scenes/brawl.move +313 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/scenes/duel.move +313 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/scripts/deploy_hook.move +32 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/scripts/migrate.move +7 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/arena_system.move +57 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/brawl_system.move +559 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/card_system.move +146 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/duel_system.move +515 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/market_system.move +115 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/player_system.move +37 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/tests/brawl_tests.move +385 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/tests/duel_tests.move +656 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/tests/test_helpers.move +31 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/sui-indexer-schema.graphql +5973 -0
- package/templates/nextjs/sui-card-duel/pnpm-workspace.yaml +2 -0
- package/templates/nextjs/sui-farm/.gitignore_ +51 -0
- package/templates/nextjs/sui-farm/README.md +15 -0
- package/templates/nextjs/sui-farm/UPGRADE_NOTES.md +97 -0
- package/templates/nextjs/sui-farm/docker-compose.yml +34 -0
- package/templates/nextjs/sui-farm/mprocs.yaml +17 -0
- package/templates/nextjs/sui-farm/package.json +43 -0
- package/templates/nextjs/sui-farm/packages/client/.gitignore_ +48 -0
- package/templates/nextjs/sui-farm/packages/client/.prettierignore +1 -0
- package/templates/nextjs/sui-farm/packages/client/.prettierrc.json +8 -0
- package/templates/nextjs/sui-farm/packages/client/eslint.config.mjs +22 -0
- package/templates/nextjs/sui-farm/packages/client/next.config.mjs +8 -0
- package/templates/nextjs/sui-farm/packages/client/package.json +47 -0
- package/templates/nextjs/sui-farm/packages/client/postcss.config.mjs +8 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/admin/page.tsx +618 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/FarmLand.tsx +526 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/FarmPlotCard.tsx +215 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/PetAvatar.tsx +868 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/PetPanel.tsx +1360 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/PlantModal.tsx +147 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/ProxyCard.tsx +684 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/RanchLand.tsx +822 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/ResourceHUD.tsx +125 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/ShopPanel.tsx +232 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/icons/GameIcons.tsx +574 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/favicon.ico +0 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/globals.css +423 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/hooks/useWorldPermitId.ts +66 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/layout.tsx +23 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/leaderboard/page.tsx +185 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/lib/crops.ts +97 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/market/page.tsx +763 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/page.tsx +1173 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/providers.tsx +69 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/state/index.tsx +5 -0
- package/templates/nextjs/sui-farm/packages/client/tailwind.config.ts +25 -0
- package/templates/nextjs/sui-farm/packages/client/tsconfig.json +30 -0
- package/templates/nextjs/sui-farm/packages/contracts/.gitignore_ +51 -0
- package/templates/nextjs/sui-farm/packages/contracts/.prettierignore +1 -0
- package/templates/nextjs/sui-farm/packages/contracts/.prettierrc.json +8 -0
- package/templates/nextjs/sui-farm/packages/contracts/Dockerfile +5 -0
- package/templates/nextjs/sui-farm/packages/contracts/Pub.localnet.toml +13 -0
- package/templates/nextjs/sui-farm/packages/contracts/counter.lock.json +14 -0
- package/templates/nextjs/sui-farm/packages/contracts/docker-compose.yml +34 -0
- package/templates/nextjs/sui-farm/packages/contracts/dubhe.config.ts +178 -0
- package/templates/nextjs/sui-farm/packages/contracts/harvest.lock.json +120 -0
- package/templates/nextjs/sui-farm/packages/contracts/package.json +48 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/config.ts +17 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/query-dapp-revenue.ts +95 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/read-permit.ts +72 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/seed.ts +85 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/withdraw-dapp-revenue.ts +56 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/Move.toml +14 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/dapp_key.move +31 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/error.move +10 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/genesis.move +33 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/init_test.move +23 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/resources/counter1.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/resources/counter2.move +70 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/scripts/deploy_hook.move +8 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/scripts/migrate.move +8 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/systems/counter.move +13 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/tests/counter.move +28 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/Move.toml +14 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/dapp_key.move +46 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/crop_type.move +47 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/egg_type.move +42 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/pet_rarity.move +37 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/pet_species.move +52 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/error.move +110 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/genesis.move +33 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/init_test.move +23 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/permits/world.move +125 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/carrot.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/carrot_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/common_egg.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/corn.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/corn_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/crow_charges.move +162 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/crow_damage.move +207 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/farm_plot.move +261 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/gold.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet.move +467 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_config.move +372 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_hatch.move +162 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_slot_index.move +83 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_slots.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/profile.move +162 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pumpkin.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pumpkin_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/rare_egg.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/scarecrow.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/season_config.move +197 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/season_stats.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/seasonal_egg.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/shop_config.move +267 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/trophy.move +245 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/wheat.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/wheat_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/world_permit_id.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/scripts/deploy_hook.move +45 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/scripts/migrate.move +7 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/crow_system.move +96 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/farm_system.move +182 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/market_system.move +172 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/pet_system.move +495 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/season_system.move +70 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/shop_system.move +112 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/world_system.move +34 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/tests/farm_tests.move +1192 -0
- package/templates/nextjs/sui-farm/pnpm-workspace.yaml +2 -0
- package/templates/nextjs/sui-template/packages/client/src/app/components/ProxyCard.tsx +683 -0
- package/templates/nextjs/sui-template/packages/client/src/app/page.tsx +510 -5
- package/templates/nextjs/sui-template/packages/client/src/app/providers.tsx +13 -5
- package/templates/nextjs/sui-template/packages/contracts/Pub.localnet.toml +4 -4
- package/templates/nextjs/sui-template/packages/contracts/counter.lock.json +14 -0
- package/templates/nextjs/sui-template/packages/contracts/deployment.ts +8 -3
- package/templates/nextjs/sui-template/packages/contracts/dubhe.config.json +9 -9
- package/templates/nextjs/sui-template/packages/contracts/dubhe.config.ts +0 -4
- package/templates/nextjs/sui-template/packages/contracts/metadata.json +180 -124
- package/templates/nextjs/sui-template/packages/contracts/package.json +8 -4
- package/templates/nextjs/sui-template/packages/contracts/src/counter/Move.toml +4 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +45 -31
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/error.move +10 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +30 -13
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/init_test.move +19 -14
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter1.move +30 -20
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +35 -24
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/scripts/deploy_hook.move +6 -10
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/systems/counter.move +7 -20
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/tests/counter.move +14 -27
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.lock +33 -30
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.toml +8 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +45 -31
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/error.move +170 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +16 -13
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +8 -14
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +1 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +1776 -137
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/data_key.move +1 -20
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/events.move +864 -25
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +15 -16
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +0 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +25 -17
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +2802 -343
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/address.move +173 -55
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/dapp_test.move +769 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/fee_test.move +2965 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/integration_test.move +303 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/listing_test.move +1422 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/scene_session_test.move +269 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/session_test.move +624 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/storage_test.move +700 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/typed_object_test.move +177 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/typed_scene_test.move +452 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move +160 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/utils/math.move +4 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move +2 -2
- package/templates/101/sui-template/packages/contracts/src/counter/Move.lock +0 -41
- package/templates/101/sui-template/packages/contracts/src/counter/Published.toml +0 -9
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/errors.move +0 -12
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +0 -140
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -186
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -306
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -396
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -246
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +0 -29
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/session_system.move +0 -44
- package/templates/contract/sui-template/src/dubhe/sources/codegen/errors.move +0 -140
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -186
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -306
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -396
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -246
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_store.move +0 -29
- package/templates/contract/sui-template/src/dubhe/sources/systems/session_system.move +0 -44
- package/templates/nextjs/sui-template/packages/contracts/src/counter/Move.lock +0 -47
- package/templates/nextjs/sui-template/packages/contracts/src/counter/Published.toml +0 -9
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/errors.move +0 -12
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +0 -140
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -186
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -306
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -396
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -246
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +0 -29
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/session_system.move +0 -44
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { motion } from 'framer-motion';
|
|
5
|
+
import { CROP_NONE, growthProgress, formatDuration } from '../lib/crops';
|
|
6
|
+
import { CropStageIcon, IconSeedling } from './icons/GameIcons';
|
|
7
|
+
import { PlantModal } from './PlantModal';
|
|
8
|
+
|
|
9
|
+
// ─── Isometric geometry ───────────────────────────────────────────────────────
|
|
10
|
+
const TW = 110; // tile diamond width
|
|
11
|
+
const TH = 55; // tile diamond height (TW / 2)
|
|
12
|
+
const TD = 16; // soil depth thickness
|
|
13
|
+
|
|
14
|
+
const COLS = 3;
|
|
15
|
+
const ROWS = 4;
|
|
16
|
+
|
|
17
|
+
// ViewBox: fits 3×4 isometric grid
|
|
18
|
+
// x: [left vertex of (0,ROWS-1)] to [right vertex of (COLS-1,0)]
|
|
19
|
+
// x range: (0 - (ROWS-1)) * TW/2 = -165 to (COLS-1) * TW/2 + TW = 220
|
|
20
|
+
// y range: 0 to max bottom depth at (COLS-1, ROWS-1)
|
|
21
|
+
const VBX = -180,
|
|
22
|
+
VBY = -15,
|
|
23
|
+
VBW = 415,
|
|
24
|
+
VBH = 240;
|
|
25
|
+
const ASPECT = VBH / VBW;
|
|
26
|
+
|
|
27
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
28
|
+
interface PlotData {
|
|
29
|
+
plotId: number;
|
|
30
|
+
cropType: number;
|
|
31
|
+
count: bigint;
|
|
32
|
+
plantedAt: bigint;
|
|
33
|
+
harvestAt: bigint;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface FarmLandProps {
|
|
37
|
+
plots: (PlotData | null)[];
|
|
38
|
+
plotsOwned: number;
|
|
39
|
+
inventory: Record<number, bigint>;
|
|
40
|
+
now: number;
|
|
41
|
+
isLoading?: boolean;
|
|
42
|
+
onPlant: (plotId: number, cropType: number, count: number) => void;
|
|
43
|
+
onHarvest: (plotId: number) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type TileState =
|
|
47
|
+
| 'empty'
|
|
48
|
+
| 'growing'
|
|
49
|
+
| 'ready'
|
|
50
|
+
| 'locked'
|
|
51
|
+
| 'hover_empty'
|
|
52
|
+
| 'hover_growing'
|
|
53
|
+
| 'hover_ready';
|
|
54
|
+
|
|
55
|
+
// ─── Color palette per state ──────────────────────────────────────────────────
|
|
56
|
+
const SOIL: Record<TileState, { t: string; r: string; l: string; s: string }> = {
|
|
57
|
+
empty: { t: '#9B7040', r: '#5C3D1A', l: '#7A5230', s: '#7A5A30' },
|
|
58
|
+
growing: { t: '#875E2A', r: '#4A2E0E', l: '#63461E', s: '#634E28' },
|
|
59
|
+
ready: { t: '#6A8A35', r: '#385015', l: '#587025', s: '#88C840' },
|
|
60
|
+
// Wasteland: uneven wild grass — green top, dark earthy sides
|
|
61
|
+
locked: { t: '#4A7030', r: '#1E3A10', l: '#2E5018', s: '#3A5C24' },
|
|
62
|
+
hover_empty: { t: '#B88055', r: '#6E4D2A', l: '#8E6040', s: '#C8A96E' },
|
|
63
|
+
hover_growing: { t: '#9A7038', r: '#5A3818', l: '#7A5428', s: '#9A8040' },
|
|
64
|
+
hover_ready: { t: '#7EAA3A', r: '#406A1A', l: '#62922A', s: '#AADD50' }
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// ─── Grid: 3×4, all 12 tiles are game plots ───────────────────────────────────
|
|
68
|
+
// plotIndex layout (front = row ROWS-1, back = row 0):
|
|
69
|
+
// row 0 (back): plotIndex 9, 10, 11
|
|
70
|
+
// row 1: plotIndex 6, 7, 8
|
|
71
|
+
// row 2: plotIndex 3, 4, 5
|
|
72
|
+
// row 3 (front): plotIndex 0, 1, 2 ← initially unlocked (plotsOwned=3)
|
|
73
|
+
const GRID = (() => {
|
|
74
|
+
const tiles = [];
|
|
75
|
+
for (let row = 0; row < ROWS; row++) {
|
|
76
|
+
for (let col = 0; col < COLS; col++) {
|
|
77
|
+
const plotIndex = (ROWS - 1 - row) * COLS + col;
|
|
78
|
+
tiles.push({ col, row, plotIndex });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return tiles;
|
|
82
|
+
})();
|
|
83
|
+
|
|
84
|
+
// ─── Geometry helpers ─────────────────────────────────────────────────────────
|
|
85
|
+
function tileGeo(col: number, row: number) {
|
|
86
|
+
const px = ((col - row) * TW) / 2;
|
|
87
|
+
const py = ((col + row) * TH) / 2;
|
|
88
|
+
const pt = (x: number, y: number) => `${x},${y}`;
|
|
89
|
+
return {
|
|
90
|
+
top: [
|
|
91
|
+
pt(px + TW / 2, py),
|
|
92
|
+
pt(px + TW, py + TH / 2),
|
|
93
|
+
pt(px + TW / 2, py + TH),
|
|
94
|
+
pt(px, py + TH / 2)
|
|
95
|
+
].join(' '),
|
|
96
|
+
right: [
|
|
97
|
+
pt(px + TW, py + TH / 2),
|
|
98
|
+
pt(px + TW, py + TH / 2 + TD),
|
|
99
|
+
pt(px + TW / 2, py + TH + TD),
|
|
100
|
+
pt(px + TW / 2, py + TH)
|
|
101
|
+
].join(' '),
|
|
102
|
+
left: [
|
|
103
|
+
pt(px, py + TH / 2),
|
|
104
|
+
pt(px + TW / 2, py + TH),
|
|
105
|
+
pt(px + TW / 2, py + TH + TD),
|
|
106
|
+
pt(px, py + TH / 2 + TD)
|
|
107
|
+
].join(' '),
|
|
108
|
+
cx: px + TW / 2,
|
|
109
|
+
cy: py + TH / 2
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function toPercent(svgX: number, svgY: number) {
|
|
114
|
+
return {
|
|
115
|
+
left: `${((svgX - VBX) / VBW) * 100}%`,
|
|
116
|
+
top: `${((svgY - VBY) / VBH) * 100}%`
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ─── Component ────────────────────────────────────────────────────────────────
|
|
121
|
+
export function FarmLand({
|
|
122
|
+
plots,
|
|
123
|
+
plotsOwned,
|
|
124
|
+
inventory,
|
|
125
|
+
now,
|
|
126
|
+
isLoading,
|
|
127
|
+
onPlant,
|
|
128
|
+
onHarvest
|
|
129
|
+
}: FarmLandProps) {
|
|
130
|
+
const [hoveredKey, setHoveredKey] = useState<string | null>(null);
|
|
131
|
+
const [plantingPlotId, setPlantingPlotId] = useState<number | null>(null);
|
|
132
|
+
|
|
133
|
+
function basePlotState(plotIndex: number): TileState {
|
|
134
|
+
if (plotIndex >= plotsOwned) return 'locked';
|
|
135
|
+
const plot = plots[plotIndex];
|
|
136
|
+
if (!plot || plot.cropType === CROP_NONE) return 'empty';
|
|
137
|
+
const harvestAt = Number(plot.harvestAt);
|
|
138
|
+
if (now >= harvestAt && harvestAt > 0) return 'ready';
|
|
139
|
+
return 'growing';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function resolveState(plotIndex: number, key: string): TileState {
|
|
143
|
+
const bs = basePlotState(plotIndex);
|
|
144
|
+
if (hoveredKey !== key) return bs;
|
|
145
|
+
if (bs === 'empty') return 'hover_empty';
|
|
146
|
+
if (bs === 'ready') return 'hover_ready';
|
|
147
|
+
if (bs === 'growing') return 'hover_growing';
|
|
148
|
+
return bs;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const tiles = GRID.map((t) => {
|
|
152
|
+
const key = `${t.col}-${t.row}`;
|
|
153
|
+
const bs = basePlotState(t.plotIndex);
|
|
154
|
+
const cs = resolveState(t.plotIndex, key);
|
|
155
|
+
const interactive = !isLoading && bs !== 'locked';
|
|
156
|
+
return { ...t, key, bs, cs, interactive, g: tileGeo(t.col, t.row) };
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
function handleClick(tile: (typeof tiles)[number]) {
|
|
160
|
+
if (!tile.interactive) return;
|
|
161
|
+
if (tile.bs === 'ready') {
|
|
162
|
+
onHarvest(tile.plotIndex);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (tile.bs === 'empty') {
|
|
166
|
+
setPlantingPlotId(tile.plotIndex);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<>
|
|
172
|
+
<div
|
|
173
|
+
className="relative w-full rounded-2xl overflow-hidden select-none"
|
|
174
|
+
style={{ paddingBottom: `${ASPECT * 100}%` }}
|
|
175
|
+
>
|
|
176
|
+
{/* Grassy background */}
|
|
177
|
+
<div
|
|
178
|
+
className="absolute inset-0"
|
|
179
|
+
style={{
|
|
180
|
+
background: 'radial-gradient(ellipse at 50% 30%, #3D7A24 0%, #1C4A0C 60%, #0C2606 100%)'
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
<div
|
|
184
|
+
className="absolute inset-0 opacity-[0.10]"
|
|
185
|
+
style={{
|
|
186
|
+
backgroundImage: 'radial-gradient(circle, #7ADE40 0.5px, transparent 0.5px)',
|
|
187
|
+
backgroundSize: '14px 14px'
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
|
|
191
|
+
{/* SVG: isometric soil tiles */}
|
|
192
|
+
<svg
|
|
193
|
+
className="absolute inset-0 w-full h-full"
|
|
194
|
+
viewBox={`${VBX} ${VBY} ${VBW} ${VBH}`}
|
|
195
|
+
preserveAspectRatio="xMidYMid meet"
|
|
196
|
+
>
|
|
197
|
+
<defs>
|
|
198
|
+
<filter id="tile-hover-shadow">
|
|
199
|
+
<feDropShadow dx="0" dy="3" stdDeviation="3.5" floodColor="#000" floodOpacity="0.5" />
|
|
200
|
+
</filter>
|
|
201
|
+
{/* Furrow lines for tilled soil */}
|
|
202
|
+
<pattern
|
|
203
|
+
id="furrows"
|
|
204
|
+
x="0"
|
|
205
|
+
y="0"
|
|
206
|
+
width="14"
|
|
207
|
+
height="7"
|
|
208
|
+
patternUnits="userSpaceOnUse"
|
|
209
|
+
patternTransform="rotate(-28)"
|
|
210
|
+
>
|
|
211
|
+
<line x1="0" y1="3.5" x2="14" y2="3.5" stroke="rgba(0,0,0,0.10)" strokeWidth="1" />
|
|
212
|
+
</pattern>
|
|
213
|
+
{/* Rough grass dots for wild/locked land */}
|
|
214
|
+
<pattern
|
|
215
|
+
id="wildgrass"
|
|
216
|
+
x="0"
|
|
217
|
+
y="0"
|
|
218
|
+
width="12"
|
|
219
|
+
height="10"
|
|
220
|
+
patternUnits="userSpaceOnUse"
|
|
221
|
+
patternTransform="rotate(-20)"
|
|
222
|
+
>
|
|
223
|
+
<circle cx="3" cy="3" r="0.8" fill="rgba(120,200,60,0.22)" />
|
|
224
|
+
<circle cx="9" cy="7" r="0.6" fill="rgba(80,160,30,0.18)" />
|
|
225
|
+
<circle cx="6" cy="1" r="0.5" fill="rgba(100,180,50,0.15)" />
|
|
226
|
+
</pattern>
|
|
227
|
+
</defs>
|
|
228
|
+
|
|
229
|
+
{tiles.map(({ key, cs, bs, interactive, g, plotIndex }) => {
|
|
230
|
+
const c = SOIL[cs];
|
|
231
|
+
const isHov = hoveredKey === key;
|
|
232
|
+
return (
|
|
233
|
+
<g
|
|
234
|
+
key={key}
|
|
235
|
+
style={{ filter: isHov ? 'url(#tile-hover-shadow)' : undefined }}
|
|
236
|
+
className={interactive ? 'cursor-pointer' : 'cursor-default'}
|
|
237
|
+
onMouseEnter={() => interactive && setHoveredKey(key)}
|
|
238
|
+
onMouseLeave={() => setHoveredKey(null)}
|
|
239
|
+
onClick={() => handleClick(tiles.find((t) => t.key === key)!)}
|
|
240
|
+
>
|
|
241
|
+
<polygon points={g.top} fill={c.t} />
|
|
242
|
+
<polygon points={g.right} fill={c.r} />
|
|
243
|
+
<polygon points={g.left} fill={c.l} />
|
|
244
|
+
|
|
245
|
+
{/* Furrow texture on unlocked / tilled plots */}
|
|
246
|
+
{bs !== 'locked' && <polygon points={g.top} fill="url(#furrows)" />}
|
|
247
|
+
|
|
248
|
+
{/* Wild-grass texture on locked / wasteland plots */}
|
|
249
|
+
{bs === 'locked' && <polygon points={g.top} fill="url(#wildgrass)" />}
|
|
250
|
+
|
|
251
|
+
{/* Top face outline */}
|
|
252
|
+
<polygon
|
|
253
|
+
points={g.top}
|
|
254
|
+
fill="none"
|
|
255
|
+
stroke={c.s}
|
|
256
|
+
strokeWidth="0.7"
|
|
257
|
+
strokeLinejoin="round"
|
|
258
|
+
/>
|
|
259
|
+
|
|
260
|
+
{/* Ready harvest pulse ring */}
|
|
261
|
+
{bs === 'ready' && (
|
|
262
|
+
<polygon points={g.top} fill="none" stroke="#7CFC00" strokeWidth="1.8">
|
|
263
|
+
<animate
|
|
264
|
+
attributeName="stroke-opacity"
|
|
265
|
+
values="0.1;0.85;0.1"
|
|
266
|
+
dur="1.3s"
|
|
267
|
+
repeatCount="indefinite"
|
|
268
|
+
/>
|
|
269
|
+
<animate
|
|
270
|
+
attributeName="fill-opacity"
|
|
271
|
+
values="0;0.12;0"
|
|
272
|
+
dur="1.3s"
|
|
273
|
+
repeatCount="indefinite"
|
|
274
|
+
/>
|
|
275
|
+
</polygon>
|
|
276
|
+
)}
|
|
277
|
+
|
|
278
|
+
{/* Hover shimmer */}
|
|
279
|
+
{isHov && bs !== 'locked' && (
|
|
280
|
+
<polygon points={g.top} fill="rgba(255,255,255,0.06)" />
|
|
281
|
+
)}
|
|
282
|
+
</g>
|
|
283
|
+
);
|
|
284
|
+
})}
|
|
285
|
+
</svg>
|
|
286
|
+
|
|
287
|
+
{/* HTML overlay: crop icons + status */}
|
|
288
|
+
{tiles.map(({ key, bs, g, plotIndex }) => {
|
|
289
|
+
const isHov = hoveredKey === key;
|
|
290
|
+
const plot = plotIndex < plotsOwned ? plots[plotIndex] : null;
|
|
291
|
+
const cropType = plot?.cropType ?? CROP_NONE;
|
|
292
|
+
const harvestAt = Number(plot?.harvestAt ?? 0);
|
|
293
|
+
const plantedAt = Number(plot?.plantedAt ?? 0);
|
|
294
|
+
const seedCount = Number(plot?.count ?? 1);
|
|
295
|
+
const progress = cropType !== CROP_NONE ? growthProgress(plantedAt, harvestAt, now) : 0;
|
|
296
|
+
const timeLeft = cropType !== CROP_NONE ? Math.max(0, harvestAt - now) : 0;
|
|
297
|
+
|
|
298
|
+
// Growth stage: 0=seed 1=sprout 2=growing 3=ripe
|
|
299
|
+
const growStage = bs === 'ready' ? 3 : progress < 0.05 ? 0 : progress < 0.4 ? 1 : 2;
|
|
300
|
+
|
|
301
|
+
// How many icons to render (cap at 9 for a 3×3 max)
|
|
302
|
+
const visibleIcons = Math.min(seedCount, 9);
|
|
303
|
+
// Icon size shrinks as count grows
|
|
304
|
+
const iconSize = visibleIcons === 1 ? 30 : visibleIcons <= 4 ? 22 : 18;
|
|
305
|
+
// Grid columns: 1→1, 2-4→2, 5-9→3
|
|
306
|
+
const gridCols = visibleIcons === 1 ? 1 : visibleIcons <= 4 ? 2 : 3;
|
|
307
|
+
|
|
308
|
+
const { left, top } = toPercent(g.cx, g.cy);
|
|
309
|
+
|
|
310
|
+
return (
|
|
311
|
+
<div
|
|
312
|
+
key={`ov-${key}`}
|
|
313
|
+
className="absolute pointer-events-none"
|
|
314
|
+
style={{ left, top, transform: 'translate(-50%, -80%)', zIndex: 20 }}
|
|
315
|
+
>
|
|
316
|
+
{bs === 'locked' ? (
|
|
317
|
+
<div className="flex flex-col items-center gap-0.5 opacity-70">
|
|
318
|
+
{/* Grass tufts — three short SVG strokes to suggest wild weeds */}
|
|
319
|
+
<svg width="22" height="16" viewBox="0 0 22 16" fill="none">
|
|
320
|
+
<line
|
|
321
|
+
x1="5"
|
|
322
|
+
y1="14"
|
|
323
|
+
x2="4"
|
|
324
|
+
y2="6"
|
|
325
|
+
stroke="#6AAE30"
|
|
326
|
+
strokeWidth="1.4"
|
|
327
|
+
strokeLinecap="round"
|
|
328
|
+
/>
|
|
329
|
+
<line
|
|
330
|
+
x1="5"
|
|
331
|
+
y1="14"
|
|
332
|
+
x2="6"
|
|
333
|
+
y2="5"
|
|
334
|
+
stroke="#80C840"
|
|
335
|
+
strokeWidth="1.2"
|
|
336
|
+
strokeLinecap="round"
|
|
337
|
+
/>
|
|
338
|
+
<line
|
|
339
|
+
x1="11"
|
|
340
|
+
y1="15"
|
|
341
|
+
x2="10"
|
|
342
|
+
y2="5"
|
|
343
|
+
stroke="#72B832"
|
|
344
|
+
strokeWidth="1.4"
|
|
345
|
+
strokeLinecap="round"
|
|
346
|
+
/>
|
|
347
|
+
<line
|
|
348
|
+
x1="11"
|
|
349
|
+
y1="15"
|
|
350
|
+
x2="12"
|
|
351
|
+
y2="4"
|
|
352
|
+
stroke="#88D040"
|
|
353
|
+
strokeWidth="1.2"
|
|
354
|
+
strokeLinecap="round"
|
|
355
|
+
/>
|
|
356
|
+
<line
|
|
357
|
+
x1="17"
|
|
358
|
+
y1="14"
|
|
359
|
+
x2="16"
|
|
360
|
+
y2="7"
|
|
361
|
+
stroke="#6AAE30"
|
|
362
|
+
strokeWidth="1.4"
|
|
363
|
+
strokeLinecap="round"
|
|
364
|
+
/>
|
|
365
|
+
<line
|
|
366
|
+
x1="17"
|
|
367
|
+
y1="14"
|
|
368
|
+
x2="18"
|
|
369
|
+
y2="6"
|
|
370
|
+
stroke="#80C840"
|
|
371
|
+
strokeWidth="1.2"
|
|
372
|
+
strokeLinecap="round"
|
|
373
|
+
/>
|
|
374
|
+
</svg>
|
|
375
|
+
{isHov && (
|
|
376
|
+
<span
|
|
377
|
+
className="text-[7px] font-pixel text-[#A8D870]
|
|
378
|
+
bg-black/60 px-1.5 py-0.5 rounded whitespace-nowrap"
|
|
379
|
+
>
|
|
380
|
+
200g reclaim
|
|
381
|
+
</span>
|
|
382
|
+
)}
|
|
383
|
+
</div>
|
|
384
|
+
) : bs === 'empty' ? (
|
|
385
|
+
isHov ? (
|
|
386
|
+
<motion.div
|
|
387
|
+
initial={{ scale: 0.5, opacity: 0 }}
|
|
388
|
+
animate={{ scale: 1, opacity: 1 }}
|
|
389
|
+
transition={{ duration: 0.08 }}
|
|
390
|
+
className="flex flex-col items-center gap-0.5"
|
|
391
|
+
>
|
|
392
|
+
<div
|
|
393
|
+
className="w-8 h-8 rounded-full border-2 border-[#C8A96E]
|
|
394
|
+
bg-[#C8A96E]/20 flex items-center justify-center
|
|
395
|
+
text-[#C8A96E] text-2xl font-thin leading-none"
|
|
396
|
+
>
|
|
397
|
+
+
|
|
398
|
+
</div>
|
|
399
|
+
<span
|
|
400
|
+
className="text-[8px] font-pixel text-[#C8A96E]
|
|
401
|
+
bg-black/60 px-1.5 py-0.5 rounded whitespace-nowrap"
|
|
402
|
+
>
|
|
403
|
+
plant
|
|
404
|
+
</span>
|
|
405
|
+
</motion.div>
|
|
406
|
+
) : (
|
|
407
|
+
<div className="opacity-[0.15]">
|
|
408
|
+
<IconSeedling size={18} />
|
|
409
|
+
</div>
|
|
410
|
+
)
|
|
411
|
+
) : (
|
|
412
|
+
// ── Growing or ready: multi-icon grid ──
|
|
413
|
+
<div className="flex flex-col items-center gap-0.5">
|
|
414
|
+
{/* Crop icon grid */}
|
|
415
|
+
<motion.div
|
|
416
|
+
key={`crop-${plotIndex}-${cropType}-${growStage}`}
|
|
417
|
+
initial={{ scale: 0, y: 6 }}
|
|
418
|
+
animate={{ scale: 1, y: 0 }}
|
|
419
|
+
transition={{ type: 'spring', stiffness: 280, damping: 18 }}
|
|
420
|
+
style={{
|
|
421
|
+
display: 'grid',
|
|
422
|
+
gridTemplateColumns: `repeat(${gridCols}, ${iconSize}px)`,
|
|
423
|
+
gap: '1px'
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
{Array.from({ length: visibleIcons }).map((_, i) => (
|
|
427
|
+
<motion.div
|
|
428
|
+
key={i}
|
|
429
|
+
initial={{ scale: 0, opacity: 0 }}
|
|
430
|
+
animate={{ scale: 1, opacity: 1 }}
|
|
431
|
+
transition={{ delay: i * 0.04, type: 'spring', stiffness: 300 }}
|
|
432
|
+
>
|
|
433
|
+
<CropStageIcon cropType={cropType} stage={growStage} size={iconSize} />
|
|
434
|
+
</motion.div>
|
|
435
|
+
))}
|
|
436
|
+
</motion.div>
|
|
437
|
+
|
|
438
|
+
{/* Overflow count badge */}
|
|
439
|
+
{seedCount > 9 && (
|
|
440
|
+
<span className="text-[8px] font-pixel text-[#C8A96E] bg-black/60 px-1 rounded">
|
|
441
|
+
+{seedCount - 9}
|
|
442
|
+
</span>
|
|
443
|
+
)}
|
|
444
|
+
|
|
445
|
+
{bs === 'growing' && (
|
|
446
|
+
<div className="flex flex-col items-center gap-0.5 mt-0.5">
|
|
447
|
+
{/* Progress bar width scales with grid */}
|
|
448
|
+
<div
|
|
449
|
+
className="h-1.5 bg-black/50 rounded-full overflow-hidden"
|
|
450
|
+
style={{ width: `${gridCols * iconSize + (gridCols - 1)}px` }}
|
|
451
|
+
>
|
|
452
|
+
<div
|
|
453
|
+
className="h-full bg-[#DAA520] rounded-full transition-all duration-500"
|
|
454
|
+
style={{ width: `${Math.round(progress * 100)}%` }}
|
|
455
|
+
/>
|
|
456
|
+
</div>
|
|
457
|
+
{isHov && (
|
|
458
|
+
<motion.span
|
|
459
|
+
initial={{ opacity: 0 }}
|
|
460
|
+
animate={{ opacity: 1 }}
|
|
461
|
+
className="text-[8px] font-pixel text-[#B8A060]
|
|
462
|
+
bg-black/60 px-1.5 py-0.5 rounded whitespace-nowrap"
|
|
463
|
+
>
|
|
464
|
+
{formatDuration(timeLeft)}
|
|
465
|
+
</motion.span>
|
|
466
|
+
)}
|
|
467
|
+
</div>
|
|
468
|
+
)}
|
|
469
|
+
|
|
470
|
+
{bs === 'ready' && (
|
|
471
|
+
<motion.span
|
|
472
|
+
animate={{ opacity: [0.6, 1, 0.6], scale: [0.95, 1.05, 0.95] }}
|
|
473
|
+
transition={{ repeat: Infinity, duration: 1.1 }}
|
|
474
|
+
className="text-[8px] font-pixel text-[#CCFF66]
|
|
475
|
+
bg-black/60 px-1.5 py-0.5 rounded whitespace-nowrap"
|
|
476
|
+
>
|
|
477
|
+
harvest!
|
|
478
|
+
</motion.span>
|
|
479
|
+
)}
|
|
480
|
+
</div>
|
|
481
|
+
)}
|
|
482
|
+
</div>
|
|
483
|
+
);
|
|
484
|
+
})}
|
|
485
|
+
|
|
486
|
+
{/* Plot index badges on owned plots */}
|
|
487
|
+
{tiles
|
|
488
|
+
.filter((t) => t.plotIndex < plotsOwned)
|
|
489
|
+
.map(({ key, g, plotIndex }) => {
|
|
490
|
+
const { left, top } = toPercent(g.cx + TW * 0.26, g.cy - TH * 0.32);
|
|
491
|
+
return (
|
|
492
|
+
<div
|
|
493
|
+
key={`badge-${key}`}
|
|
494
|
+
className="absolute pointer-events-none text-[7px] font-pixel text-[#8B7040]/55"
|
|
495
|
+
style={{ left, top, transform: 'translate(-50%, -50%)' }}
|
|
496
|
+
>
|
|
497
|
+
{plotIndex + 1}
|
|
498
|
+
</div>
|
|
499
|
+
);
|
|
500
|
+
})}
|
|
501
|
+
|
|
502
|
+
{/* Farm title + hint */}
|
|
503
|
+
<div className="absolute top-2 left-3 pointer-events-none">
|
|
504
|
+
<p className="text-[9px] font-pixel text-[#6ABF3A]/70 tracking-widest uppercase">
|
|
505
|
+
Your Farm
|
|
506
|
+
</p>
|
|
507
|
+
</div>
|
|
508
|
+
<div className="absolute bottom-2 right-3 pointer-events-none">
|
|
509
|
+
<p className="text-[9px] font-pixel text-[#2A5A18]/55">
|
|
510
|
+
tap soil to plant · tap crop to harvest
|
|
511
|
+
</p>
|
|
512
|
+
</div>
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
<PlantModal
|
|
516
|
+
plotId={plantingPlotId}
|
|
517
|
+
inventory={inventory}
|
|
518
|
+
onPlant={(plotId, cropType, count) => {
|
|
519
|
+
onPlant(plotId, cropType, count);
|
|
520
|
+
setPlantingPlotId(null);
|
|
521
|
+
}}
|
|
522
|
+
onClose={() => setPlantingPlotId(null)}
|
|
523
|
+
/>
|
|
524
|
+
</>
|
|
525
|
+
);
|
|
526
|
+
}
|