fix: check addItems quantity for Drones & EmailItems
This commit is contained in:
parent
aacd089123
commit
46df5ce8f0
@ -381,7 +381,7 @@ export const addItem = async (
|
|||||||
} else if (ExportResources[typeName].productCategory == "KubrowPetEggs") {
|
} else if (ExportResources[typeName].productCategory == "KubrowPetEggs") {
|
||||||
const changes: IKubrowPetEggClient[] = [];
|
const changes: IKubrowPetEggClient[] = [];
|
||||||
if (quantity < 0 || quantity > 100) {
|
if (quantity < 0 || quantity > 100) {
|
||||||
throw new Error(`unexpected acquisition quantity of KubrowPetEggs: ${quantity}`);
|
throw new Error(`unexpected acquisition quantity of KubrowPetEggs: got ${quantity}, expected 0..100`);
|
||||||
}
|
}
|
||||||
for (let i = 0; i != quantity; ++i) {
|
for (let i = 0; i != quantity; ++i) {
|
||||||
const egg: IKubrowPetEggDatabase = {
|
const egg: IKubrowPetEggDatabase = {
|
||||||
@ -548,9 +548,18 @@ export const addItem = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeName in ExportDrones) {
|
if (typeName in ExportDrones) {
|
||||||
return addDrone(inventory, typeName);
|
// Can only get 1 at a time from crafting, but for convenience's sake, allow up 100 to via the WebUI.
|
||||||
|
if (quantity < 0 || quantity > 100) {
|
||||||
|
throw new Error(`unexpected acquisition quantity of Drones: got ${quantity}, expected 0..100`);
|
||||||
|
}
|
||||||
|
for (let i = 0; i != quantity; ++i) {
|
||||||
|
return addDrone(inventory, typeName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeName in ExportEmailItems) {
|
if (typeName in ExportEmailItems) {
|
||||||
|
if (quantity != 1) {
|
||||||
|
throw new Error(`unexpected acquisition quantity of EmailItems: got ${quantity}, expected 0`);
|
||||||
|
}
|
||||||
return await addEmailItem(inventory, typeName);
|
return await addEmailItem(inventory, typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user