Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VITE_DEV=YOUR_DEV_VALUE

VITE_PUBLIC_DEPLOY_TYPE="sepolia"
VITE_PUBLIC_NODE_URL="https://api.cartridge.gg/x/starknet/sepolia"
VITE_PUBLIC_TORII="https://api.cartridge.gg/x/toriibbtest/torii"
VITE_PUBLIC_TORII="https://api.cartridge.gg/x/bbv2/torii"
VITE_PUBLIC_MASTER_ADDRESS="0x04CDA1a7c67aC385Cd0a399D65c405E6539Cc3730c37Cc2C4a62b2F719CD1C0A"
VITE_PUBLIC_MASTER_PRIVATE_KEY="0x056ed1031da41a9746534ff13bfd6e86e2071635b3408e49698443f3758c862e"
VITE_PUBLIC_SLOT_ADDRESS="https://api.cartridge.gg/x/bytebeaststamagotchi/katana"
Expand Down
2 changes: 1 addition & 1 deletion client/dev-dist/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ define(['./workbox-20a2f87f'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.90s8ruuoado"
"revision": "0.uv6bn1a6tj"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
Expand Down
6 changes: 2 additions & 4 deletions client/src/components/SpawnBeast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,12 @@ const SpawnBeast: React.FC<SpawnBeastProps> = ({ className = '' }) => {

// Encontrar la bestia recién creada
newBeast = processedBeasts.find((beast: Beast) => beast.player === account!.address);
console.log(newBeast, 'newBeast');
await new Promise(resolve => setTimeout(resolve, 2000));
} while (!newBeast);

if (newBeast) {
setSpawnProgress({ progress: 90, message: 'Finalizing setup' });
const setCurrentTx = await client.player.setCurrentBeast(account!, newBeast.beast_id);
console.info('setCurrentTx', setCurrentTx);
await new Promise(resolve => setTimeout(resolve, 2000));
console.log(newBeast, 'newBeast inside');
setSpawnProgress({ progress: 100, message: 'Your beast is ready!' });
setTimeout(() => {
navigate('/play');
Expand Down
10 changes: 5 additions & 5 deletions client/src/components/Tamagotchi/Actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Actions = ({
}) => {

const actionButtons: { label: string, img: string | null, action: string, pictureKey: PictureKey, isRevive?: boolean }[] = [
{ label: beastStatus[2] == 1 ? "Sleep" : "Awake", img: beastStatus[2] == 1 ? Sleep : Awake, action: beastStatus[2] == 1 ? "sleep" : "awake", pictureKey: beastStatus[2] == 1 ? "sleepPicture" : "idlePicture" },
{ label: beastStatus[3] == 1 ? "Sleep" : "Awake", img: beastStatus[3] == 1 ? Sleep : Awake, action: beastStatus[3] == 1 ? "sleep" : "awake", pictureKey: beastStatus[3] == 1 ? "sleepPicture" : "idlePicture" },
{ label: "Clean", img: Clean, action: "clean", pictureKey: "cleanPicture" },
{ label: "Feed", img: Food, action: "feed", pictureKey: "eatPicture" },
{ label: "Play", img: Play, action: "play", pictureKey: "playPicture" },
Expand Down Expand Up @@ -109,10 +109,10 @@ const Actions = ({
isLoading ||
isActionDisabled ||
!beastStatus ||
beastStatus[1] == 0 ||
(action != 'sleep' && action != 'awake') && beastStatus[2] == 0 ||
(action == 'sleep' || action == 'awake') && beastStatus[4] == 100 ||
(action == 'clean') && beastStatus[6] == 100
beastStatus[2] == 0 ||
(action != 'sleep' && action != 'awake') && beastStatus[3] == 0 ||
(action == 'sleep' || action == 'awake') && beastStatus[5] == 100 ||
(action == 'clean') && beastStatus[7] == 100
}
>
{img && <img src={img} alt={label} />} {label}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Tamagotchi/Food/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Food = ({ handleAction, beast, account, client, beastStatus, showAnimation
<>
<div className={`food-carousel-container ${loading ? 'loading-aura' : ''}`}>
<div className='food-carousel'>
{!beastStatus || beastStatus[1] == 0 ? <></> :
{!beastStatus || beastStatus[2] == 0 ? <></> :
zfoods.map(({ name, img, count }: { name: any, img: any, count: any }) => (
<button
key={name}
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Tamagotchi/Status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Hunger from '../../../assets/img/icon-hunger.svg';
import './main.css';

const statusItems = [
{ value: (beastStatus: any) => beastStatus[4], pic: Energy, color: '#ECECDA', name: 'Energy' },
{ value: (beastStatus: any) => beastStatus[5], pic: Energy, color: '#ECECDA', name: 'Energy' },
{ value: (beastStatus: any) => beastStatus[6], pic: Hygienne, color: '#ECECDA', name: 'Hygienne' },
{ value: (beastStatus: any) => beastStatus[3], pic: Hunger, color: '#ECECDA', name: 'Hunger' },
{ value: (beastStatus: any) => beastStatus[5], pic: Happyness, color: '#ECECDA', name: 'Happyness' },
{ value: (beastStatus: any) => beastStatus[4], pic: Hunger, color: '#ECECDA', name: 'Hunger' },
{ value: (beastStatus: any) => beastStatus[6], pic: Happyness, color: '#ECECDA', name: 'Happyness' },
];

function Status({ beastStatus }: { beastStatus: any }) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Tamagotchi/Whispers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Whispers = ({ beast, expanded, beastStatus, botMessage, setBotMessage }: {
}

// Only set up the interval if we have a beast and it's not sleeping
if (beastStatus && beast && beastStatus[2] !== 0) {
if (beastStatus && beast && beastStatus[3] !== 0) {
// Send initial message
const firstMessage = generateMessage();
createWhisper(firstMessage);
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Tamagotchi/components/BeastDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const BeastDisplay = ({
}: BeastDisplayProps) => {
return (
<>
{status[1] === 0 && (
{status[2] === 0 && (
<button className="button mb-4" onClick={onNewEgg}>
Hatch a new Egg
<img src={Egg} className="new-egg" alt="beast" />
Expand All @@ -59,7 +59,7 @@ const BeastDisplay = ({
onClick={onCuddle}
style={{ cursor: 'pointer' }}
/>
{status[1] === 1 && <CleanlinessIndicator cleanlinessLevel={status[6]} />}
{status[2] === 1 && <CleanlinessIndicator cleanlinessLevel={status[7]} />}
</div>
)}
</div>
Expand All @@ -79,7 +79,7 @@ const BeastDisplay = ({
</div>
)}

{status[1] === 1 && status[2] === 1 && (
{status[2] === 1 && status[3] === 1 && (
<div className="chat-toggle" onClick={onChatToggle}>
<img src={chatIcon} alt="chat with tamagotchi" />
</div>
Expand Down
13 changes: 8 additions & 5 deletions client/src/components/Tamagotchi/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function Tamagotchi() {
const [botMessage, setBotMessage] = useState<Message>({ user: '', text: '' });
const [currentBeast, setCurrentBeast] = useState<any>({});

console.info('player', player)
console.info('currentBeast', currentBeast)

const {
currentImage,
isLoading,
Expand Down Expand Up @@ -63,10 +66,10 @@ function Tamagotchi() {

return {
age: currentBeast?.age || 0,
energy: status[4] || 0,
hunger: status[3] || 0,
happiness: status[5] || 0,
clean: status[6] || 0
energy: status[5] || 0,
hunger: status[4] || 0,
happiness: status[6] || 0,
clean: status[7] || 0
};
};

Expand All @@ -83,7 +86,7 @@ function Tamagotchi() {
}}>
<Status beastStatus={status} />
<div className="game">
{isLoading || status[1] === 0 || status[2] === 0 ? null : (
{isLoading || status[2] === 0 || status[3] === 0 ? null : (
<Whispers
botMessage={botMessage}
setBotMessage={setBotMessage}
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Tamagotchi/utils/fetchAge.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import hexToDecimalArray from './hexToDecimalArray';

const fetchAge = async (account: any): Promise<number[] | undefined> => {
console.info('account age', String(account?.address));
try {
const response = await account?.callContract({
contractAddress: "0x58971d723d0100ae8393550f9166c9dad9b79799a48fc31f0d9684ef556dda9",
contractAddress: "0x782425ff2132a84992b9e9e497c1305a7e48f6cf3928fd93b7e44ed8efea2ad",
entrypoint: "get_beast_age_with_address",
calldata: [String(account?.address)],
});
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Tamagotchi/utils/fetchStatus.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import hexToDecimalArray from './hexToDecimalArray';

const fetchStatus = async (account: any): Promise<number[] | undefined> => {
console.info('account status', String(account?.address));
try {
const response = await account?.callContract({
contractAddress: "0x58971d723d0100ae8393550f9166c9dad9b79799a48fc31f0d9684ef556dda9",
contractAddress: "0x782425ff2132a84992b9e9e497c1305a7e48f6cf3928fd93b7e44ed8efea2ad",
entrypoint: "get_timestamp_based_status_with_address",
calldata: [String(account?.address)],
});
Expand Down
8 changes: 4 additions & 4 deletions client/src/config/cartridgeConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { constants } from "starknet";
const { VITE_PUBLIC_DEPLOY_TYPE } = import.meta.env;
const { VITE_PUBLIC_SLOT_ADDRESS } = import.meta.env;

const CONTRACT_ADDRESS_ACHIEVEMENTS = '0x1005116a48c9a8f7a6c946091e64dc8ced37962dc2bbb74355868229307c20d'
const CONTRACT_ADDRESS_TAMAGOTCHI_SYSTEM = '0x58971d723d0100ae8393550f9166c9dad9b79799a48fc31f0d9684ef556dda9'
const CONTRACT_ADDRESS_PLAYER_SYSTEM = '0x6b7b30fcd29c41bca831b87db67e3c8af2abb374dc2fabbbf09f4744aa22988'
const CONTRACT_ADDRESS_ACHIEVEMENTS = '0x70061966613c3788149d4bed8c391403ee19bc23f02d9ff6a056cfb646820e2'
const CONTRACT_ADDRESS_TAMAGOTCHI_SYSTEM = '0x782425ff2132a84992b9e9e497c1305a7e48f6cf3928fd93b7e44ed8efea2ad'
const CONTRACT_ADDRESS_PLAYER_SYSTEM = '0x4c315f29212f78341dc80bc80cd0a04b4e5deafef9bd7528cb2fc7de7098fc8'

const policies: SessionPolicies = {
contracts: {
Expand Down Expand Up @@ -149,7 +149,7 @@ const options: ControllerOptions = {
colorMode,
preset: "bytebeasts-tamagotchi",
namespace: "tamagotchi",
slot: "toriibbtest"
slot: "bbv2"
};

const cartridgeConnector = new ControllerConnector(
Expand Down
2 changes: 1 addition & 1 deletion client/src/config/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import slot from "../../../dojo/manifest_dev.json";
import sepolia from "../../../dojo/manifest_sepolia.json";
import sepolia from "../dojo/manifest_dev.json";
import mainnet from "../../../dojo/manifest_mainnet.json"; // Ensure this points to the right file

// Define valid deploy types
Expand Down
Loading