Skip to content

Commit 2c5d850

Browse files
committed
fix: enforce hard cap across capacity calculations and correct HP stat casing in stamp parser
1 parent a3ac229 commit 2c5d850

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

parsers/misc.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
999999
{ name: '' }
10001000
];
10011001
if ('bOre' === type || 'bBar' === type || 'cOil' === type) {
1002-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Mining) * (1 + minCapStamps / 100) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1002+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Mining) * (1 + minCapStamps / 100) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10031003
breakdown = [
10041004
...breakdown,
10051005
{ title: 'Mining' },
@@ -1012,7 +1012,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10121012
]
10131013
}
10141014
else if ('dFish' === type) {
1015-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Fishing) * (1 + (25 * gemshop) / 100) * (1 + fishCapStamps / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1015+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Fishing) * (1 + (25 * gemshop) / 100) * (1 + fishCapStamps / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10161016
breakdown = [
10171017
...breakdown,
10181018
{ title: 'Fishing' },
@@ -1025,7 +1025,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10251025
]
10261026
}
10271027
else if ('dBugs' === type) {
1028-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Bugs) * (1 + (25 * gemshop) / 100) * (1 + catchCapStamps / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1028+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Bugs) * (1 + (25 * gemshop) / 100) * (1 + catchCapStamps / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10291029
breakdown = [
10301030
...breakdown,
10311031
{ title: 'Catching' },
@@ -1038,7 +1038,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10381038
]
10391039
}
10401040
else if ('bLog' === type || 'bLeaf' === type) {
1041-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Chopping) * (1 + chopCapStamps / 100) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1041+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Chopping) * (1 + chopCapStamps / 100) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10421042
breakdown = [
10431043
...breakdown,
10441044
{ title: 'Chopping' },
@@ -1051,7 +1051,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10511051
]
10521052
}
10531053
else if ('cFood' === type) {
1054-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Foods) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1054+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Foods) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10551055
breakdown = [
10561056
...breakdown,
10571057
{ title: 'Food' },
@@ -1063,7 +1063,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10631063
]
10641064
}
10651065
else if ('dCritters' === type) {
1066-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Critters) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1066+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Critters) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10671067
breakdown = [
10681068
...breakdown,
10691069
{ title: 'Critters' },
@@ -1075,7 +1075,7 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10751075
]
10761076
}
10771077
else if ('dSouls' === type) {
1078-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.Souls) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value);
1078+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.Souls) * (1 + (25 * gemshop) / 100) * (1 + (allCarryStamps + starSignBonus) / 100) * allCap?.value));
10791079
breakdown = [
10801080
...breakdown,
10811081
{ title: 'Souls' },
@@ -1086,13 +1086,16 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
10861086
{ value: starSignBonus, name: 'Star Sign' }
10871087
]
10881088
}
1089-
else if ('dCurrency' === type || 'dQuest' === type || 'dStatueStone' === type) {
1089+
else if ('dCurrency' === type || 'dQuest' === type) {
10901090
value = 9999999;
10911091
}
1092+
else if ('dStatueStone' === type) {
1093+
value = 999999999;
1094+
}
10921095
else if ('bCraft' === type) {
1093-
value = Math.floor((upgradeVaultBonus + character?.maxCarryCap?.bCraft)
1096+
value = Math.floor(Math.min(hardCap, (upgradeVaultBonus + character?.maxCarryCap?.bCraft)
10941097
* (1 + matCapStamps / 100) * (1 + (25 * gemshop) / 100)
1095-
* (1 + (allCarryStamps + starSignBonus) / 100) * (1 + talentBonus / 100) * allCap?.value);
1098+
* (1 + (allCarryStamps + starSignBonus) / 100) * (1 + talentBonus / 100) * allCap?.value));
10961099
breakdown = [
10971100
...breakdown,
10981101
{ title: 'Materials' },
@@ -1118,10 +1121,6 @@ export const getItemCapacity = (type = '', character, account, forceMaxCapacity)
11181121
value = 2;
11191122
}
11201123

1121-
if (Number.isFinite(value)) {
1122-
value = Math.floor(Math.min(hardCap, value));
1123-
}
1124-
11251124
return {
11261125
value,
11271126
breakdown

parsers/stamps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export const getStampBonus = (account, stampTree, stampName, character) => {
316316
}
317317

318318
let upgradeVaultMulti = 0;
319-
if (stamp?.stat === 'BaseDmg' || stamp?.stat === 'BaseHp' || stamp?.stat === 'BaseAcc' || stamp?.stat === 'BaseDef') {
319+
if (stamp?.stat === 'BaseDmg' || stamp?.stat === 'BaseHP' || stamp?.stat === 'BaseAcc' || stamp?.stat === 'BaseDef') {
320320
upgradeVaultMulti = getUpgradeVaultBonus(account?.upgradeVault?.upgrades, 16);
321321
}
322322
return (growth(stamp?.func, stamp?.level, stamp?.x1, stamp?.x2, false) ?? 0)

0 commit comments

Comments
 (0)