diff --git a/client/src/dojo/modelManager/__tests__/BattleManager.test.ts b/client/src/dojo/modelManager/__tests__/BattleManager.test.ts
index 56aed10c3..8dbe37957 100644
--- a/client/src/dojo/modelManager/__tests__/BattleManager.test.ts
+++ b/client/src/dojo/modelManager/__tests__/BattleManager.test.ts
@@ -66,14 +66,14 @@ import { describe, it } from "vitest";
// });
describe("getBattle", () => {
- it("should return a valid battle for a valid mock", () => {
- // const mockBattle = generateMockBatle(true);
- // vi.mocked(getComponentValue).mockReturnValueOnce(mockBattle);
- // const battleManager = new BattleManager(BATTLE_ENTITY_ID, mockDojoResult);
- // const battle = battleManager.getBattle();
- // expect(battle).toBeDefined();
- // expect(battle).toBe(mockBattle);
- });
+ it("should return a valid battle for a valid mock", () => {
+ // const mockBattle = generateMockBatle(true);
+ // vi.mocked(getComponentValue).mockReturnValueOnce(mockBattle);
+ // const battleManager = new BattleManager(BATTLE_ENTITY_ID, mockDojoResult);
+ // const battle = battleManager.getBattle();
+ // expect(battle).toBeDefined();
+ // expect(battle).toBe(mockBattle);
+ });
});
// describe("isBattle", () => {
diff --git a/client/src/hooks/helpers/useQuests.tsx b/client/src/hooks/helpers/useQuests.tsx
index 607b5f14e..083e418e0 100644
--- a/client/src/hooks/helpers/useQuests.tsx
+++ b/client/src/hooks/helpers/useQuests.tsx
@@ -63,9 +63,7 @@ export const useQuests = () => {
};
const useQuestDependencies = () => {
- const {
- setup,
- } = useDojo();
+ const { setup } = useDojo();
const structureEntityId = useUIStore((state) => state.structureEntityId);
@@ -203,10 +201,10 @@ export const useQuestClaimStatus = () => {
const questClaimStatus = useMemo(() => {
const entityBigInt = BigInt(structureEntityId || 0);
-
- const checkPrizesClaimed = (prizes: Prize[]) =>
- prizes.every((prize) =>
- getComponentValue(Quest, getEntityIdFromKeys([entityBigInt, BigInt(prize.id)]))?.completed
+
+ const checkPrizesClaimed = (prizes: Prize[]) =>
+ prizes.every(
+ (prize) => getComponentValue(Quest, getEntityIdFromKeys([entityBigInt, BigInt(prize.id)]))?.completed,
);
return Array.from(questDetails.keys()).reduce(
diff --git a/client/src/hooks/helpers/useResources.tsx b/client/src/hooks/helpers/useResources.tsx
index 7400d78b3..a2b70a229 100644
--- a/client/src/hooks/helpers/useResources.tsx
+++ b/client/src/hooks/helpers/useResources.tsx
@@ -1,15 +1,13 @@
import { configManager } from "@/dojo/setup";
import {
CapacityConfigCategory,
- ContractAddress,
ID,
- Position,
ResourcesIds,
resources,
- type Resource,
+ type Resource
} from "@bibliothecadao/eternum";
import { useComponentValue } from "@dojoengine/react";
-import { Has, HasValue, Not, getComponentValue, runQuery, type Entity } from "@dojoengine/recs";
+import { Has, HasValue, getComponentValue, runQuery, type Entity } from "@dojoengine/recs";
import { useEffect, useMemo, useState } from "react";
import { ResourceManager } from "../../dojo/modelManager/ResourceManager";
import { getEntityIdFromKeys } from "../../ui/utils/utils";
@@ -182,45 +180,3 @@ export const useResourceManager = (entityId: ID, resourceId: ResourcesIds) => {
return resourceManager;
};
-
-export function useOwnedEntitiesOnPosition() {
- const {
- account: { account },
- setup: {
- components: { Owner, Position, Movable, Bank, Army },
- },
- } = useDojo();
-
- const getOwnedEntitiesOnPosition = (address: ContractAddress, position: Position) => {
- const { x, y } = position;
-
- const entities = runQuery([
- HasValue(Owner, { address }),
- Not(Movable),
- Not(Army),
- // @note: safer to do like this rather than deconstruct because there's a chance entity_id is also there
- HasValue(Position, { x, y }),
- ]);
-
- return Array.from(entities)
- .map((entityId) => {
- const position = getComponentValue(Position, entityId);
- if (!position) return;
- return position?.entity_id;
- })
- .filter(Boolean) as ID[];
- };
-
- const getOwnedEntityOnPosition = (entityId: ID) => {
- const position = getComponentValue(Position, getEntityIdFromKeys([BigInt(entityId)]));
- const depositEntityIds = position
- ? getOwnedEntitiesOnPosition(ContractAddress(account.address), { x: Number(position.x), y: Number(position.y) })
- : [];
- return depositEntityIds[0];
- };
-
- return {
- getOwnedEntitiesOnPosition,
- getOwnedEntityOnPosition,
- };
-}
diff --git a/client/src/ui/components/hyperstructures/HyperstructurePanel.tsx b/client/src/ui/components/hyperstructures/HyperstructurePanel.tsx
index 31c6dc490..5543b14be 100644
--- a/client/src/ui/components/hyperstructures/HyperstructurePanel.tsx
+++ b/client/src/ui/components/hyperstructures/HyperstructurePanel.tsx
@@ -156,11 +156,12 @@ export const HyperstructurePanel = ({ entity }: any) => {
setNewContributions({});
setResetContributions(false);
}
-
};
const [selectedAccess, setSelectedAccess] = useState<"Public" | "Private" | "GuildOnly">(
- hyperstructure ? (DisplayedAccess[hyperstructure.access as keyof typeof DisplayedAccess] as "Public" | "Private" | "GuildOnly") : "Private"
+ hyperstructure
+ ? (DisplayedAccess[hyperstructure.access as keyof typeof DisplayedAccess] as "Public" | "Private" | "GuildOnly")
+ : "Private",
);
return (
@@ -207,21 +208,19 @@ export const HyperstructurePanel = ({ entity }: any) => {
-
{entity.name}
-
+
-
-
{account.address === entity.owner && (
-
{hyperstructure && entity.isOwner && isLoading !== Loading.SetPrivate ? (
- ) :
Loading...
}
-
-{account.address === entity.owner && (
-
- )}
+ ) : (
+
Loading...
+ )}
+
+ {account.address === entity.owner && (
+
+ )}
)}
diff --git a/client/src/ui/components/trading/ResourceArrivals.tsx b/client/src/ui/components/trading/ResourceArrivals.tsx
index 91bf20de1..eadbd8944 100644
--- a/client/src/ui/components/trading/ResourceArrivals.tsx
+++ b/client/src/ui/components/trading/ResourceArrivals.tsx
@@ -1,17 +1,9 @@
import { ArrivalInfo } from "@/hooks/helpers/use-resource-arrivals";
import { Headline } from "@/ui/elements/Headline";
import { HintModalButton } from "@/ui/elements/HintModalButton";
-import { ID, Resource } from "@bibliothecadao/eternum";
import { EntityArrival } from "../entities/Entity";
import { HintSection } from "../hints/HintModal";
-export type EntityReadyForDeposit = {
- carrierId: ID;
- senderEntityId: ID;
- recipientEntityId: ID;
- resources: Resource[];
-};
-
export const AllResourceArrivals = ({ arrivals, className }: { arrivals: ArrivalInfo[]; className?: string }) => {
return (
diff --git a/client/src/ui/components/worldmap/armies/ActionInfo.tsx b/client/src/ui/components/worldmap/armies/ActionInfo.tsx
index 119c2dada..6c879247d 100644
--- a/client/src/ui/components/worldmap/armies/ActionInfo.tsx
+++ b/client/src/ui/components/worldmap/armies/ActionInfo.tsx
@@ -13,82 +13,76 @@ import { getComponentValue } from "@dojoengine/recs";
import { getEntityIdFromKeys } from "@dojoengine/utils";
import { memo, useCallback, useMemo } from "react";
-const TooltipContent = memo(({
- isExplored,
- travelPath,
- costs,
- selectedEntityId,
- structureEntityId,
- getBalance
-}: {
- isExplored: boolean;
- travelPath: any;
- costs: { travelFoodCosts: any; exploreFoodCosts: any };
- selectedEntityId: string;
- structureEntityId: string;
- getBalance: any;
-}) => (
- <>
-
{isExplored ? "Travel" : "Explore"}
- {isExplored ? (
-
-
-
-
- ) : (
-
-
-
-
- )}
-
- {!isExplored && (
-
-
-
-
+{configManager.getExploreReward()} Random resource
+const TooltipContent = memo(
+ ({
+ isExplored,
+ travelPath,
+ costs,
+ selectedEntityId,
+ structureEntityId,
+ getBalance,
+ }: {
+ isExplored: boolean;
+ travelPath: any;
+ costs: { travelFoodCosts: any; exploreFoodCosts: any };
+ selectedEntityId: string;
+ structureEntityId: string;
+ getBalance: any;
+ }) => (
+ <>
+
{isExplored ? "Travel" : "Explore"}
+ {isExplored ? (
+
+
+
-
- )}
-
- Right-click to confirm
-
- >
-));
+ ) : (
+
+
+
+
+ )}
+
+ {!isExplored && (
+
+
+
+
+{configManager.getExploreReward()} Random resource
+
+
+ )}
+
Right-click to confirm
+ >
+ ),
+);
-TooltipContent.displayName = 'TooltipContent';
+TooltipContent.displayName = "TooltipContent";
export const ActionInfo = memo(() => {
- const hoveredHex = useUIStore(
- useCallback((state) => state.armyActions.hoveredHex, [])
- );
- const selectedEntityId = useUIStore(
- useCallback((state) => state.armyActions.selectedEntityId, [])
- );
- const structureEntityId = useUIStore(
- useCallback((state) => state.structureEntityId, [])
- );
-
+ const hoveredHex = useUIStore(useCallback((state) => state.armyActions.hoveredHex, []));
+ const selectedEntityId = useUIStore(useCallback((state) => state.armyActions.selectedEntityId, []));
+ const structureEntityId = useUIStore(useCallback((state) => state.structureEntityId, []));
+
const { getBalance } = useResourceBalance();
const {
setup: {
@@ -105,11 +99,13 @@ export const ActionInfo = memo(() => {
};
}
const army = getComponentValue(Army, getEntityIdFromKeys([BigInt(selectedEntityId)]));
- return army?.troops || {
- knight_count: 0n,
- paladin_count: 0n,
- crossbowman_count: 0n,
- };
+ return (
+ army?.troops || {
+ knight_count: 0n,
+ paladin_count: 0n,
+ crossbowman_count: 0n,
+ }
+ );
}, [selectedEntityId, Army]);
const travelPath = useMemo(() => {
@@ -120,26 +116,23 @@ export const ActionInfo = memo(() => {
}, [hoveredHex]);
const showTooltip = useMemo(() => {
- return travelPath !== undefined &&
- travelPath.path.length >= 2 &&
- selectedEntityId !== null;
+ return travelPath !== undefined && travelPath.path.length >= 2 && selectedEntityId !== null;
}, [travelPath, selectedEntityId]);
const isExplored = travelPath?.isExplored || false;
- const costs = useMemo(() => ({
- travelFoodCosts: computeTravelFoodCosts(selectedEntityTroops),
- exploreFoodCosts: computeExploreFoodCosts(selectedEntityTroops)
- }), [selectedEntityTroops]);
+ const costs = useMemo(
+ () => ({
+ travelFoodCosts: computeTravelFoodCosts(selectedEntityTroops),
+ exploreFoodCosts: computeExploreFoodCosts(selectedEntityTroops),
+ }),
+ [selectedEntityTroops],
+ );
if (!showTooltip) return null;
return (
-
+
{
);
});
-ActionInfo.displayName = 'ActionInfo';
\ No newline at end of file
+ActionInfo.displayName = "ActionInfo";
diff --git a/client/src/ui/layouts/World.tsx b/client/src/ui/layouts/World.tsx
index 8a8be432c..5b5bc256c 100644
--- a/client/src/ui/layouts/World.tsx
+++ b/client/src/ui/layouts/World.tsx
@@ -90,7 +90,7 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => {
// Setup hooks
useFetchBlockchainData();
useStructureEntityId();
-
+
return (
{
diff --git a/client/src/ui/modules/navigation/QuestMenu.tsx b/client/src/ui/modules/navigation/QuestMenu.tsx
index d3bee364c..a44707ecd 100644
--- a/client/src/ui/modules/navigation/QuestMenu.tsx
+++ b/client/src/ui/modules/navigation/QuestMenu.tsx
@@ -21,7 +21,6 @@ export const QuestsMenu = ({ unclaimedQuestsCount }: { unclaimedQuestsCount: num
useStartingTutorial();
const { quests } = useQuests();
-
const structureEntityId = useUIStore((state) => state.structureEntityId);
const setTooltip = useUIStore((state) => state.setTooltip);
@@ -98,69 +97,68 @@ export const QuestsMenu = ({ unclaimedQuestsCount }: { unclaimedQuestsCount: num
};
return (
-
-
-
-
-
+
+
+
+
-