From 93bfe5011c4c59ed1109227443f2f3bacbadec99 Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Tue, 17 Dec 2024 18:14:19 +1100 Subject: [PATCH 1/6] build --- .../src/ui/modules/navigation/LeftNavigationModule.tsx | 2 +- client/src/ui/modules/navigation/TopLeftNavigation.tsx | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/ui/modules/navigation/LeftNavigationModule.tsx b/client/src/ui/modules/navigation/LeftNavigationModule.tsx index 2d0710713..99ee80bf3 100644 --- a/client/src/ui/modules/navigation/LeftNavigationModule.tsx +++ b/client/src/ui/modules/navigation/LeftNavigationModule.tsx @@ -126,7 +126,7 @@ export const LeftNavigationModule = memo(() => { name: MenuEnum.construction, button: ( { return { timeLeftBeforeNextTick: timeLeft, progress: progressValue }; }, [nextBlockTimestamp]); + console.log(entityInfo.structureCategory); return (
{ className="storehouse-selector px-3 flex gap-2 justify-start items-center text-xxs md:text-sm" > - {IS_MOBILE ? ( -
{storehouses.quantity.toLocaleString()}
+ {entityInfo.structureCategory !== "Realm" ? ( +
) : (
{storehouses.capacityKg.toLocaleString()} kg
)} + {/* {IS_MOBILE ? ( +
{storehouses.quantity.toLocaleString()}
+ ) : ( +
{storehouses.capacityKg.toLocaleString()} kg
+ )} */}
)} From 9d2794d0f42fdf20dbad474f41bcf0fcbfad5408 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 17 Dec 2024 08:27:22 +0100 Subject: [PATCH 2/6] fix mine balance max cap --- client/src/ui/components/resources/EntityResourceTable.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/ui/components/resources/EntityResourceTable.tsx b/client/src/ui/components/resources/EntityResourceTable.tsx index 37a04668b..bba2e08fc 100644 --- a/client/src/ui/components/resources/EntityResourceTable.tsx +++ b/client/src/ui/components/resources/EntityResourceTable.tsx @@ -1,8 +1,9 @@ import { configManager } from "@/dojo/setup"; import { useDojo } from "@/hooks/context/DojoContext"; +import { useStructures } from "@/hooks/helpers/useStructures"; import useNextBlockTimestamp from "@/hooks/useNextBlockTimestamp"; import { getEntityIdFromKeys, gramToKg, multiplyByPrecision } from "@/ui/utils/utils"; -import { BuildingType, CapacityConfigCategory, ID, RESOURCE_TIERS } from "@bibliothecadao/eternum"; +import { BuildingType, CapacityConfigCategory, ID, RESOURCE_TIERS, StructureType } from "@bibliothecadao/eternum"; import { useComponentValue } from "@dojoengine/react"; import { useMemo } from "react"; import { ResourceChip } from "./ResourceChip"; @@ -18,7 +19,11 @@ export const EntityResourceTable = ({ entityId }: { entityId: ID | undefined }) getEntityIdFromKeys([BigInt(entityId || 0), BigInt(BuildingType.Storehouse)]), )?.value || 0; + const { getStructureByEntityId } = useStructures(); + const structure = getStructureByEntityId(entityId || 0); + const maxStorehouseCapacityKg = useMemo(() => { + if (structure?.category === StructureType[StructureType.FragmentMine]) return Infinity; const storehouseCapacityKg = gramToKg(configManager.getCapacityConfig(CapacityConfigCategory.Storehouse)); return multiplyByPrecision(quantity * storehouseCapacityKg + storehouseCapacityKg); }, [quantity, entityId]); From ea6a35231e0ef6321a9495fe3368c54f6e886ead Mon Sep 17 00:00:00 2001 From: Bob <80072466+bob0005@users.noreply.github.com> Date: Tue, 17 Dec 2024 08:50:19 +0100 Subject: [PATCH 3/6] Change to getComponentValue (#2549) --- client/src/ui/components/resources/EntityResourceTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/ui/components/resources/EntityResourceTable.tsx b/client/src/ui/components/resources/EntityResourceTable.tsx index bba2e08fc..702ca2892 100644 --- a/client/src/ui/components/resources/EntityResourceTable.tsx +++ b/client/src/ui/components/resources/EntityResourceTable.tsx @@ -7,6 +7,7 @@ import { BuildingType, CapacityConfigCategory, ID, RESOURCE_TIERS, StructureType import { useComponentValue } from "@dojoengine/react"; import { useMemo } from "react"; import { ResourceChip } from "./ResourceChip"; +import { getComponentValue } from "@dojoengine/recs"; export const EntityResourceTable = ({ entityId }: { entityId: ID | undefined }) => { const dojo = useDojo(); @@ -19,8 +20,7 @@ export const EntityResourceTable = ({ entityId }: { entityId: ID | undefined }) getEntityIdFromKeys([BigInt(entityId || 0), BigInt(BuildingType.Storehouse)]), )?.value || 0; - const { getStructureByEntityId } = useStructures(); - const structure = getStructureByEntityId(entityId || 0); + const structure = getComponentValue(dojo.setup.components.Structure, getEntityIdFromKeys([BigInt(entityId || 0)])); const maxStorehouseCapacityKg = useMemo(() => { if (structure?.category === StructureType[StructureType.FragmentMine]) return Infinity; From 423aa28b8ab1203990f532e30683e2227e6c0cf2 Mon Sep 17 00:00:00 2001 From: Credence Date: Tue, 17 Dec 2024 08:56:24 +0100 Subject: [PATCH 4/6] client: no storage limit for non realm --- client/src/ui/components/resources/EntityResourceTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/ui/components/resources/EntityResourceTable.tsx b/client/src/ui/components/resources/EntityResourceTable.tsx index 702ca2892..7407fbb65 100644 --- a/client/src/ui/components/resources/EntityResourceTable.tsx +++ b/client/src/ui/components/resources/EntityResourceTable.tsx @@ -23,7 +23,7 @@ export const EntityResourceTable = ({ entityId }: { entityId: ID | undefined }) const structure = getComponentValue(dojo.setup.components.Structure, getEntityIdFromKeys([BigInt(entityId || 0)])); const maxStorehouseCapacityKg = useMemo(() => { - if (structure?.category === StructureType[StructureType.FragmentMine]) return Infinity; + if (structure?.category !== StructureType[StructureType.Realm]) return Infinity; const storehouseCapacityKg = gramToKg(configManager.getCapacityConfig(CapacityConfigCategory.Storehouse)); return multiplyByPrecision(quantity * storehouseCapacityKg + storehouseCapacityKg); }, [quantity, entityId]); From 2d52d94a7fa2c8489604e8e461323d6c75efb899 Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Tue, 17 Dec 2024 19:25:03 +1100 Subject: [PATCH 5/6] combat --- client/src/dojo/setup.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/dojo/setup.ts b/client/src/dojo/setup.ts index 9e7b34e9e..0c1677cdf 100644 --- a/client/src/dojo/setup.ts +++ b/client/src/dojo/setup.ts @@ -184,10 +184,11 @@ export async function setup({ ...config }: DojoConfig) { models: [ "s0_eternum-GameEnded", "s0_eternum-HyperstructureFinished", - "s0_eternum-BattleStartData", + "s0_eternum-BattleClaimData", "s0_eternum-BattleJoinData", "s0_eternum-BattleLeaveData", "s0_eternum-BattlePillageData", + "s0_eternum-BattleStartData", "s0_eternum-AcceptOrder", "s0_eternum-SwapEvent", "s0_eternum-LiquidityEvent", From 7258c2a5a584093b0d2ffe7516142da55da9cfc4 Mon Sep 17 00:00:00 2001 From: Bob <80072466+bob0005@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:26:46 +0100 Subject: [PATCH 6/6] Fix/mine max balance (#2550) * Change to getComponentValue * Fix max balance * client: no storage limit for non realm --------- Co-authored-by: Credence --- client/src/dojo/modelManager/ResourceManager.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/dojo/modelManager/ResourceManager.ts b/client/src/dojo/modelManager/ResourceManager.ts index 6aabf6c44..113f5fe26 100644 --- a/client/src/dojo/modelManager/ResourceManager.ts +++ b/client/src/dojo/modelManager/ResourceManager.ts @@ -1,5 +1,5 @@ import { getEntityIdFromKeys, gramToKg, multiplyByPrecision } from "@/ui/utils/utils"; -import { BuildingType, CapacityConfigCategory, ResourcesIds, type ID } from "@bibliothecadao/eternum"; +import { BuildingType, CapacityConfigCategory, ResourcesIds, StructureType, type ID } from "@bibliothecadao/eternum"; import { getComponentValue } from "@dojoengine/recs"; import { configManager, type SetupResult } from "../setup"; @@ -91,6 +91,12 @@ export class ResourceManager { } public getStoreCapacity(): number { + const structure = getComponentValue( + this.setup.components.Structure, + getEntityIdFromKeys([BigInt(this.entityId || 0)]), + ); + if (structure?.category === StructureType[StructureType.FragmentMine]) return Infinity; + const storehouseCapacityKg = gramToKg(configManager.getCapacityConfig(CapacityConfigCategory.Storehouse)); const quantity = getComponentValue(