Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new production #2629

Merged
merged 36 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
41cebe2
new production wip
credence0x Jan 7, 2025
c2051d5
new production wip
credence0x Jan 8, 2025
5da4983
production simplified
credence0x Jan 8, 2025
1530ccf
new production compiles
credence0x Jan 9, 2025
19319e8
Merge branch 'season-1' of https://github.com/BibliothecaDAO/eternum …
credence0x Jan 9, 2025
926f7a0
update production implementation
credence0x Jan 9, 2025
97a1474
scarb fmt
credence0x Jan 9, 2025
8356f8a
Merge branch 'season-1' of https://github.com/BibliothecaDAO/eternum …
credence0x Jan 10, 2025
9a54ec9
improve scripts
credence0x Jan 11, 2025
5ca7a56
update scripts
credence0x Jan 11, 2025
365dfca
improve scripts
credence0x Jan 11, 2025
3e63503
knip (#2635)
aymericdelab Jan 11, 2025
a6b0997
improve scripts
credence0x Jan 11, 2025
c14c48c
prettier (#2636)
aymericdelab Jan 11, 2025
2aff149
improve configuration
credence0x Jan 12, 2025
d003975
improve configuration
credence0x Jan 12, 2025
45bf055
Enh/clean assets (#2637)
bob0005 Jan 12, 2025
f8fbf2a
improve configuration
credence0x Jan 12, 2025
eafda7d
Fix naming conventions (#2638)
bob0005 Jan 13, 2025
8871810
update policies (#2639)
aymericdelab Jan 13, 2025
03760dc
improve scripts
credence0x Jan 14, 2025
2aaf8a9
improve config deploy flow based on env
credence0x Jan 14, 2025
f7182a1
improve config deploy flow based on env
credence0x Jan 14, 2025
e9dc9b3
improve config deploy flow based on env
credence0x Jan 14, 2025
7c873a2
fix indexing
credence0x Jan 14, 2025
536e6fe
fix indexing
credence0x Jan 14, 2025
eb667fe
add permisson revoke script
credence0x Jan 14, 2025
d2282fe
++Refactor use-armies and clean battles (#2640)
aymericdelab Jan 14, 2025
5dc4648
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
credence0x Jan 14, 2025
87b56fd
update
credence0x Jan 15, 2025
870744b
working client
credence0x Jan 15, 2025
2312410
working client
credence0x Jan 16, 2025
ed8708d
rename s0_eternum to s1_eternum
credence0x Jan 16, 2025
14a1b8e
update world address
credence0x Jan 16, 2025
39b189d
update env
credence0x Jan 16, 2025
c728562
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
credence0x Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: pnpm i

- name: Run Prettier
run: pnpm run prettier-check .
run: pnpm run format:check .
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
target
.snfoundry_cache
docs/dist
docs/dist
.DS_Store
**/.DS_Store
26 changes: 26 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"ignore": [
"eliza/**",

"**/*.js",
"**/vitest**",
"client/apps/game/src/setupTests.ts",

"client/sdk/packages/eternum/global.d.ts",

"**/**__test__**/**",
"**/**__tests__**/**",
"client/apps/game/src/setup-tests.ts",

"client/apps/landing/src/routeTree.gen.ts",
"client/apps/landing/src/components/ui/**",
"client/apps/landing/src/components/typography/**",
"client/apps/landing/src/hooks/gql/**",

"client/apps/game-docs/vocs.config.ts",
"client/apps/game-docs/docs/**",
"client/apps/game-docs/vocs.config.ts",

"client/apps/game/src/ui/modules/chat/**"
]
}
8 changes: 8 additions & 0 deletions client/.prettierignore → .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@

# ignore eliza folder
**/eliza

# ignore draco files
**/draco

# ignore generated files
**/gql
**/*.graphql
**/*.gen.ts
File renamed without changes.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ Please adhere to the following guidelines when writing code for the Eternum proj
- Ensure your code is compatible with the existing codebase and follows the project's coding conventions.
- Include tests to verify the functionality of your changes.

### Naming Conventions

| Entity Type | Naming Convention | Examples |
| ------------------ | ----------------- | ----------------------------------- |
| Files | kebab-case | `user-profile.tsx`, `api-utils.ts` |
| Components | PascalCase | `UserProfile`, `NavigationMenu` |
| Enums | PascalCase | `UserRole`, `PaymentStatus` |
| Types & Interfaces | PascalCase | `UserProfile`, `ApiResponse` |
| Functions | camelCase | `getUserData()`, `calculateTotal()` |
| Variables | camelCase | `userCount`, `totalPrice` |
| Constants | UPPER_SNAKE_CASE | `MAX_USERS`, `API_ENDPOINT` |

## Review Process

Once you submit a pull request, maintainers will review your changes and provide feedback. Your pull request may be
Expand Down
4 changes: 2 additions & 2 deletions bot/discord/src/actors/tick_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'a> TickSender<'a> {
Some(Felt::from_hex(TICK_ARMIES_ID).unwrap()),
],
pattern_matching: PatternMatching::FixedLen,
models: vec!["s0_eternum-TickConfig".to_string()],
models: vec!["s1_eternum-TickConfig".to_string()],
})),
limit: 1,
offset: 0,
Expand All @@ -61,7 +61,7 @@ impl<'a> TickSender<'a> {
let tick_interval_in_seconds = entity
.models
.iter()
.find(|model| model.name == "s0_eternum-TickConfig")
.find(|model| model.name == "s1_eternum-TickConfig")
.expect("Tick interval in seconds not found")
.children
.iter()
Expand Down
36 changes: 18 additions & 18 deletions bot/discord/src/actors/torii_client_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ use crate::{
};

const TORII_SUBSCRIPTION_MODELS: [&str; 9] = [
"s0_eternum-BattleClaimData",
"s0_eternum-BattleJoinData",
"s0_eternum-BattleLeaveData",
"s0_eternum-BattlePillageData",
"s0_eternum-BattleStartData",
"s0_eternum-SettleRealmData",
"s0_eternum-GameEnded",
"s0_eternum-HyperstructureFinished",
"s0_eternum-HyperstructureStarted",
"s1_eternum-BattleClaimData",
"s1_eternum-BattleJoinData",
"s1_eternum-BattleLeaveData",
"s1_eternum-BattlePillageData",
"s1_eternum-BattleStartData",
"s1_eternum-SettleRealmData",
"s1_eternum-GameEnded",
"s1_eternum-HyperstructureFinished",
"s1_eternum-HyperstructureStarted",
];

pub struct ToriiClientSubscriber {
Expand Down Expand Up @@ -125,64 +125,64 @@ impl ToriiClientSubscriber {
let felts = ty.serialize().unwrap();

let event = match model.name.as_str() {
"s0_eternum-BattleStartData" => {
"s1_eternum-BattleStartData" => {
let event = BattleStart::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.defender,
}
}
"s0_eternum-BattleJoinData" => {
"s1_eternum-BattleJoinData" => {
let event = BattleJoin::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.joiner,
}
}
"s0_eternum-BattleLeaveData" => {
"s1_eternum-BattleLeaveData" => {
let event = BattleLeave::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.leaver,
}
}
"s0_eternum-BattleClaimData" => {
"s1_eternum-BattleClaimData" => {
let event = BattleClaim::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.claimee_address,
}
}
"s0_eternum-BattlePillageData" => {
"s1_eternum-BattlePillageData" => {
let event = BattlePillage::cairo_deserialize(&felts, 0).unwrap();
let event_clone = event.clone();
Event {
event: Box::new(event_clone),
identifier: event.pillaged_structure_owner,
}
}
"s0_eternum-SettleRealmData" => {
"s1_eternum-SettleRealmData" => {
let event = SettleRealm::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.owner_address,
}
}
"s0_eternum-GameEnded" => {
"s1_eternum-GameEnded" => {
let event = GameEnded::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.winner_address,
}
}
"s0_eternum-HyperstructureFinished" => {
"s1_eternum-HyperstructureFinished" => {
let event = HyperstructureFinished::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
identifier: event.hyperstructure_owner_name,
}
}
"s0_eternum-HyperstructureStarted" => {
"s1_eternum-HyperstructureStarted" => {
let event = HyperstructureStarted::cairo_deserialize(&felts, 0).unwrap();
Event {
event: Box::new(event),
Expand Down
17 changes: 9 additions & 8 deletions bot/discord/src/eternum_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ pub enum ResourceIds {
#[strum(serialize = "Ethereal Silica")]
EtherealSilica = 21,
Dragonhide = 22,
Demonhide = 23,
#[strum(serialize = "Ancient Fragment")]
AncientFragment = 29,
Donkey = 249,
Knight = 250,
Crossbowman = 251,
Paladin = 252,
Lords = 253,
Wheat = 254,
Fish = 255,
AncientFragment = 24,
Donkey = 25,
Knight = 26,
Crossbowman = 27,
Paladin = 28,
Wheat = 29,
Fish = 30,
Lords = 31,
}

#[derive(FromPrimitive, Debug, Clone, Copy, strum_macros::Display)]
Expand Down
2 changes: 1 addition & 1 deletion bot/discord/src/events/battle_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::{duration_to_string, ToDiscordMessage, UNKNOWN_USER};

// abigen!(
// _unused,
// "../contracts/target/dev/s0_eternum_e_BattleStartData.contract_class.json",
// "../contracts/target/dev/s1_eternum_e_BattleStartData.contract_class.json",
// );
// TODO have a build.rs that can load the abis of the types we care about and writes them to a file
// Dojo world can load local world from manifests and retrieve the abi
Expand Down
42 changes: 0 additions & 42 deletions client/.knip.json

This file was deleted.

2 changes: 2 additions & 0 deletions client/apps/balancing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"build": "tsc -b && vite build",
"dev": "vite",
"lint": "eslint .",
"format": "npx prettier --write . --root=..",
"format:check": "npx prettier --check . --root=..",
"preview": "vite preview"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion client/apps/balancing/public/vite.svg

This file was deleted.

1 change: 0 additions & 1 deletion client/apps/balancing/src/assets/react.svg

This file was deleted.

26 changes: 13 additions & 13 deletions client/apps/balancing/src/components/modules/resource-table.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import {
BUILDING_COSTS_SCALED,
RESOURCE_BUILDING_COSTS,
RESOURCE_INPUTS_SCALED,
RESOURCE_OUTPUTS,
RESOURCE_RARITY,
RESOURCE_TIERS,
Resources,
WEIGHTS_GRAM,
BUILDING_COSTS_SCALED,
RESOURCE_BUILDING_COSTS,
RESOURCE_PRODUCTION_INPUT_RESOURCES_SCALED,
RESOURCE_PRODUCTION_OUTPUT_AMOUNTS,
RESOURCE_RARITY,
RESOURCE_TIERS,
Resources,
WEIGHTS_GRAM,
} from "@bibliothecadao/eternum";
import { Badge } from "../ui/badge";

Expand Down Expand Up @@ -46,16 +46,16 @@ export const ResourceTable = ({ resources }: { resources: Resources[] }) => {
const multiplier = RESOURCE_RARITY[resourceId as keyof typeof RESOURCE_RARITY] || 1; // Default multiplier is 1

return (
RESOURCE_INPUTS_SCALED[resourceId]?.map((input) => ({
RESOURCE_PRODUCTION_INPUT_RESOURCES_SCALED[resourceId]?.map((input) => ({
...input,
adjustedAmount: input.amount * multiplier,
})) || []
);
};
// Sum up how many times each resource is used as an input based on RESOURCE_INPUTS_SCALED and BUILDING_COSTS_SCALED
// Sum up how many times each resource is used as an input based on RESOURCE_PRODUCTION_INPUT_RESOURCES_SCALED and BUILDING_COSTS_SCALED
const resourceUsageCount = resources.reduce(
(acc, resource) => {
const inputUsageCount = Object.values(RESOURCE_INPUTS_SCALED).reduce((count, inputs) => {
const inputUsageCount = Object.values(RESOURCE_PRODUCTION_INPUT_RESOURCES_SCALED).reduce((count, inputs) => {
return count + inputs.filter((input: any) => input.resource === resource.id).length;
}, 0);
const buildingUsageCount = Object.values(BUILDING_COSTS_SCALED).reduce((count, costs) => {
Expand Down Expand Up @@ -125,7 +125,7 @@ export const ResourceTable = ({ resources }: { resources: Resources[] }) => {
<TableCell className="text-center">{getResourceTier(resource.id)}</TableCell>
<TableCell className="text-center">{getResourceWeight(resource.id)}</TableCell>
<TableCell className="rounded flex gap-2 justify-center">
{RESOURCE_INPUTS_SCALED[resource.id]?.map((input, idx) => (
{RESOURCE_PRODUCTION_INPUT_RESOURCES_SCALED[resource.id]?.map((input, idx) => (
<Badge className="border p-1" key={idx} style={{ borderColor: resourceColor(input.resource) }}>
<img src={getResourceImage(input.resource)} alt={resource.trait} className="w-6 h-6 mx-auto" /> x{" "}
{input.amount}
Expand All @@ -135,7 +135,7 @@ export const ResourceTable = ({ resources }: { resources: Resources[] }) => {
<TableCell className="text-center">
{sumAdjustedInputs(resource.id)} [{adjustedDemand[resource.id].toFixed(2)}]
</TableCell>
<TableCell className="text-center">{RESOURCE_OUTPUTS[resource.id]}</TableCell>
<TableCell className="text-center">{RESOURCE_PRODUCTION_OUTPUT_AMOUNTS[resource.id]}</TableCell>

<TableCell className="text-center">{resourceUsageCount[resource.id]}</TableCell>
<TableCell className="rounded flex gap-2 justify-center">
Expand Down
6 changes: 3 additions & 3 deletions client/apps/balancing/src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

Expand All @@ -20,10 +20,10 @@ const badgeVariants = cva(
},
);

export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, ...props }: BadgeProps) {
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
}

export { Badge, badgeVariants };
export { Badge };
2 changes: 1 addition & 1 deletion client/apps/balancing/src/components/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttribu
);
TableCaption.displayName = "TableCaption";

export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
Loading
Loading