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

feat: update production #2670

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 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
48 changes: 33 additions & 15 deletions config/deployer/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
scaleResourceCostMinMax,
scaleResourceInputs,
scaleResourceOutputs,
scaleResourceProductionByLaborParams,
scaleResources,
TickIds,
TravelTypes,
Expand Down Expand Up @@ -190,30 +191,47 @@ export const setProductionConfig = async (config: Config) => {
config.config.resources.resourcePrecision,
);

const scaledResourceProductionByLaborParams = scaleResourceProductionByLaborParams(
config.config.resources.resourceProductionByLaborParams,
config.config.resources.resourcePrecision,
);

for (const resourceId of Object.keys(scaledResourceInputs) as unknown as ResourcesIds[]) {
const outputAmountPerLabor = scaledResourceOutputs[resourceId];
const resourceCostPerLabor = scaledResourceInputs[resourceId];
const outputAmountPerBuildingPerTick = scaledResourceOutputs[resourceId];
const predefinedResourceBurnCost = scaledResourceInputs[resourceId];
const resourceProductionByLaborParams = scaledResourceProductionByLaborParams[resourceId];
const calldata = {
amount: outputAmountPerLabor,
resource_type: resourceId,
cost: resourceCostPerLabor,
amount_per_building_per_tick: outputAmountPerBuildingPerTick,
predefined_resource_burn_cost: predefinedResourceBurnCost,
labor_burn_strategy: resourceProductionByLaborParams,
};

calldataArray.push(calldata);

console.log(
chalk.cyan(`
┌─ ${chalk.yellow(ResourcesIds[calldata.resource_type])}
│ ${chalk.gray(`${ResourcesIds[calldata.resource_type]} produced per labor:`)} ${chalk.white(`${inGameAmount(calldata.amount, config.config)} ${chalk.yellow(ResourcesIds[calldata.resource_type])}`)}
│ ${chalk.gray(`Cost of producing 1 ${ResourcesIds[calldata.resource_type]} labor:`)} ${
calldata.cost.length > 0
? calldata.cost
│ ${chalk.gray(`${ResourcesIds[calldata.resource_type]} produced per tick, per building:`)} ${chalk.white(`${inGameAmount(calldata.amount_per_building_per_tick, config.config)} ${chalk.yellow(ResourcesIds[calldata.resource_type])}`)}
│ ${chalk.gray(``)}
│ ${chalk.gray(`Using Labor Burn Production Strategy:`)}
│ ${chalk.gray(``)} ${calldata.labor_burn_strategy.resource_rarity === 0 ?
chalk.red("Cannot be produced with labor") : `
│ ${chalk.gray(`Resource Rarity:`)} ${chalk.white(` ${calldata.labor_burn_strategy.resource_rarity}`)}
│ ${chalk.gray(`Depreciation Rate:`)} ${chalk.white(` ${calldata.labor_burn_strategy.depreciation_percent_num / calldata.labor_burn_strategy.depreciation_percent_denom * 100}%`)}
│ ${chalk.gray(`Wheat Burn Per Labor:`)} ${chalk.white(inGameAmount(calldata.labor_burn_strategy.wheat_burn_per_labor, config.config))}
│ ${chalk.gray(`Fish Burn Per Labor:`)} ${chalk.white(inGameAmount(calldata.labor_burn_strategy.fish_burn_per_labor, config.config))}`}
│ ${chalk.gray(``)}
│ ${chalk.gray(`Using Multiple Resource Burn Production Strategy:`)}
│ ${calldata.predefined_resource_burn_cost.length > 0
? chalk.gray(` Cost of producing 1 ${ResourcesIds[calldata.resource_type]}:`) +
calldata.predefined_resource_burn_cost
.map(
(c) => `
│ ${chalk.white(`${inGameAmount(c.amount, config.config)} ${ResourcesIds[c.resource]}`)}`,
${chalk.white(`${inGameAmount(c.amount, config.config)} ${ResourcesIds[c.resource]}`)}`,
)
.join("")
: chalk.blue("Can't be produced with resources")
}
: ` ${chalk.blue("Can't be produced with multiple resources")}`}
└────────────────────────────────`),
);
}
Expand Down Expand Up @@ -358,14 +376,14 @@ export const setBuildingConfig = async (config: Config) => {

const calldataArray = [];
const buildingResourceProduced = config.config.buildings.buildingResourceProduced;
const buildingCosts = config.config.buildings.buildingCosts;
const scaledNonResourceBuildingCosts = scaleResourceInputs(buildingCosts, config.config.resources.resourcePrecision);
const buildingCosts = config.config.buildings.otherBuildingCosts;
const scaledOtherBuildingCosts = scaleResourceInputs(buildingCosts, config.config.resources.resourcePrecision);
const BUILDING_COST_DISPLAY_ROWS = 6;

// Non Resource Building Config
for (const buildingId of Object.keys(buildingResourceProduced) as unknown as BuildingType[]) {
if (scaledNonResourceBuildingCosts[buildingId].length !== 0) {
const costs = scaledNonResourceBuildingCosts[buildingId];
if (scaledOtherBuildingCosts[buildingId].length !== 0) {
const costs = scaledOtherBuildingCosts[buildingId];
const calldata = {
building_category: buildingId,
building_resource_type: buildingResourceProduced[buildingId] as ResourcesIds,
Expand Down
8 changes: 5 additions & 3 deletions config/environments/_shared_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
BUILDING_CAPACITY,
BUILDING_POPULATION,
BUILDING_RESOURCE_PRODUCED,
NON_RESOURCE_BUILDING_COSTS,
OTHER_BUILDING_COSTS,
RESOURCE_BUILDING_COSTS,
} from "./utils/building";
import {
Expand All @@ -26,6 +26,7 @@ import { QUEST_RESOURCES } from "./utils/quest";
import {
RESOURCE_PRODUCTION_INPUT_RESOURCES,
RESOURCE_PRODUCTION_OUTPUT_AMOUNTS,
RESOURCE_PRODUCTION_THROUGH_LABOR,
RESOURCES_WEIGHTS_GRAM,
} from "./utils/resource";
import { TROOPS_FOOD_CONSUMPTION, TROOPS_STAMINAS } from "./utils/troop";
Expand Down Expand Up @@ -156,9 +157,9 @@ export const EternumGlobalConfig: Config = {
startingResourcesInputProductionFactor: STARTING_RESOURCES_INPUT_PRODUCTION_FACTOR,
resourceInputs: RESOURCE_PRODUCTION_INPUT_RESOURCES,
resourceOutputs: RESOURCE_PRODUCTION_OUTPUT_AMOUNTS,
resourceProductionByLaborParams: RESOURCE_PRODUCTION_THROUGH_LABOR,
resourceWeightsGrams: RESOURCES_WEIGHTS_GRAM,
resourceRarity: RESOURCE_RARITY,
resourceBuildingCosts: RESOURCE_BUILDING_COSTS,
},
banks: {
name: BANK_NAME,
Expand Down Expand Up @@ -245,7 +246,8 @@ export const EternumGlobalConfig: Config = {
buildingCapacity: BUILDING_CAPACITY,
buildingPopulation: BUILDING_POPULATION,
buildingResourceProduced: BUILDING_RESOURCE_PRODUCED,
buildingCosts: NON_RESOURCE_BUILDING_COSTS,
otherBuildingCosts: OTHER_BUILDING_COSTS,
resourceBuildingCosts: RESOURCE_BUILDING_COSTS,
buildingFixedCostScalePercent: BUILDING_FIXED_COST_SCALE_PERCENT,
},
hyperstructures: {
Expand Down
Loading
Loading