UNPKG

farming-weight

Version:

Tools for calculating farming weight and fortune in Hypixel Skyblock

109 lines (108 loc) 3.81 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const VITEST_1 = require('vitest'); const WEIGHTCALC_1 = require('./weightcalc'); const CROPS_1 = require('../constants/crops'); const WEIGHT_1 = require('../constants/weight'); const PESTS_1 = require('../util/pests'); const CROPS = { [CROPS_1.Crop.Cactus]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Cactus] * 50, [CROPS_1.Crop.Carrot]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Carrot] * 10, [CROPS_1.Crop.CocoaBeans]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.CocoaBeans] * 10, [CROPS_1.Crop.Melon]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Melon] * 10, [CROPS_1.Crop.NetherWart]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.NetherWart] * 10, [CROPS_1.Crop.Potato]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Potato] * 10, [CROPS_1.Crop.Pumpkin]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Pumpkin] * 10, [CROPS_1.Crop.SugarCane]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.SugarCane] * 50, [CROPS_1.Crop.Wheat]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Wheat] * 10, }; const PESTS = { pest_fly_1: 150, pest_beetle_1: 86, }; (0, VITEST_1.test)('Basic weight calculation', () => { const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({ collection: CROPS, }); (0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(170); }); (0, VITEST_1.test)('Mushroom weight calculation', () => { const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({ collection: { ...CROPS, [CROPS_1.Crop.Mushroom]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Mushroom] * 13.74, }, }); (0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(180); }); (0, VITEST_1.test)('Pest debuff weight calculation', () => { const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({ collection: CROPS, pests: PESTS, }); const UNCOUNTED = (0, PESTS_1.uncountedCropsFromPests)(PESTS); const UNCOUNTED_WHEAT = UNCOUNTED[CROPS_1.Crop.Wheat] ?? 0; const UNCOUNTED_WART = UNCOUNTED[CROPS_1.Crop.NetherWart] ?? 0; (0, VITEST_1.expect)(WEIGHT.getWeightInfo().uncountedCrops[CROPS_1.Crop.Wheat]).toBeCloseTo(UNCOUNTED_WHEAT); (0, VITEST_1.expect)(WEIGHT.getWeightInfo().uncountedCrops[CROPS_1.Crop.NetherWart]).toBeCloseTo(UNCOUNTED_WART); const WEIGHT_EXPECTED = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({ collection: { ...CROPS, [CROPS_1.Crop.Wheat]: CROPS[CROPS_1.Crop.Wheat] - UNCOUNTED_WHEAT, [CROPS_1.Crop.NetherWart]: CROPS[CROPS_1.Crop.NetherWart] - UNCOUNTED_WART, }, }); (0, VITEST_1.expect)(WEIGHT.getWeightInfo().cropWeight).toBeCloseTo(WEIGHT_EXPECTED.getWeightInfo().cropWeight); }); (0, VITEST_1.test)('Full weight calculation', () => { const crops = { [CROPS_1.Crop.Cactus]: 1219395, [CROPS_1.Crop.Carrot]: 14238991, [CROPS_1.Crop.CocoaBeans]: 901826, [CROPS_1.Crop.Melon]: 5041491, [CROPS_1.Crop.Mushroom]: 9063168, [CROPS_1.Crop.NetherWart]: 897212645, [CROPS_1.Crop.Potato]: 171017100, [CROPS_1.Crop.Pumpkin]: 1496477, [CROPS_1.Crop.SugarCane]: 15509429, [CROPS_1.Crop.Wheat]: 21996256, }; const pests = { pest_fly_1: 222, pest_rat_1: 40, pest_mite_1: 43, pest_moth_1: 40, pest_slug_1: 34, pest_worm_1: 32, pest_beetle_1: 265, pest_locust_1: 41, pest_cricket_1: 36, pest_mosquito_1: 41, }; const MINIONS = [ 'WHEAT_11', 'CARROT_11', 'POTATO_12', 'PUMPKIN_12', 'MELON_12', 'MUSHROOM_12', 'COCOA_11', 'CACTUS_11', 'SUGAR_CANE_12', 'NETHER_WARTS_12', ]; const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({ collection: crops, pests: pests, farmingXp: 286958923.31966937, levelCapUpgrade: 10, anitaBonusFarmingFortuneLevel: 15, minions: MINIONS, }).setEarnedMedals({ diamond: 246, platinum: 75, gold: 99, }); (0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(5176.617); }); //# sourceMappingURL=weightcalc.test.js.map