diff --git a/public/index.html b/public/index.html
index aa8e9fa..40fefab 100644
--- a/public/index.html
+++ b/public/index.html
@@ -9,12 +9,12 @@
content="for Breath of the Wild"
/>
-
+
-
Hundo Duplication Simulator
+ IST Sim
diff --git a/src/assets/img/Apple.png b/src/assets/img/Apple.png
new file mode 100644
index 0000000..e6e9973
Binary files /dev/null and b/src/assets/img/Apple.png differ
diff --git a/src/assets/img/BigHeartyRadish.png b/src/assets/img/BigHeartyRadish.png
new file mode 100644
index 0000000..04e70de
Binary files /dev/null and b/src/assets/img/BigHeartyRadish.png differ
diff --git a/src/assets/img/EnduraFood.png b/src/assets/img/EnduraFood.png
new file mode 100644
index 0000000..f31229b
Binary files /dev/null and b/src/assets/img/EnduraFood.png differ
diff --git a/src/assets/img/EnduraShroom.png b/src/assets/img/EnduraShroom.png
new file mode 100644
index 0000000..499e386
Binary files /dev/null and b/src/assets/img/EnduraShroom.png differ
diff --git a/src/assets/img/Fairy.png b/src/assets/img/Fairy.png
new file mode 100644
index 0000000..b4ada1b
Binary files /dev/null and b/src/assets/img/Fairy.png differ
diff --git a/src/assets/img/HeartyRadish.png b/src/assets/img/HeartyRadish.png
new file mode 100644
index 0000000..254e45d
Binary files /dev/null and b/src/assets/img/HeartyRadish.png differ
diff --git a/src/assets/img/HylianShroom.png b/src/assets/img/HylianShroom.png
new file mode 100644
index 0000000..979c3b4
Binary files /dev/null and b/src/assets/img/HylianShroom.png differ
diff --git a/src/assets/img/SpicyPepper.png b/src/assets/img/SpicyPepper.png
new file mode 100644
index 0000000..e8b5d41
Binary files /dev/null and b/src/assets/img/SpicyPepper.png differ
diff --git a/src/assets/img/index.ts b/src/assets/img/index.ts
new file mode 100644
index 0000000..5e3b033
--- /dev/null
+++ b/src/assets/img/index.ts
@@ -0,0 +1,25 @@
+
+// Use webpack require context to import all images under image directory and create a map
+const r = require as any; // eslint-disable-line @typescript-eslint/no-explicit-any
+
+const images = ((requireContext)=>{
+ const imgMap: {[name: string]: string} = {};
+ requireContext.keys().forEach((k: string)=>{
+ if(k.startsWith("./") && k.endsWith(".png")){
+ const module = requireContext(k);
+ // Clean image path ./name.png => name
+
+ const name = k.substring(2, k.length - 4);
+ if(typeof module === "string"){
+ imgMap[name] = module;
+ }else if (typeof module === "object" && "default" in module){
+ imgMap[name] = module["default"];
+ }else{
+ console.error("Failed to load image: ", k);
+ }
+ }
+ });
+ return imgMap;
+})(r.context(".", false, /\.png$/));
+
+export default images as {readonly [name:string]:string};
diff --git a/src/core/Item.ts b/src/core/Item.ts
index 5d063a4..4793168 100644
--- a/src/core/Item.ts
+++ b/src/core/Item.ts
@@ -1,37 +1,4 @@
-import ImageSlate from "assets/img/Slate.png";
-import ImageGlider from "assets/img/Glider.png";
-import ImageSpiritOrb from "assets/img/SpiritOrb.png";
-import ImageLotus from "assets/img/Lotus.png";
-import ImageSilentPrincess from "assets/img/SilentPrincess.png";
-import ImageHoney from "assets/img/Honey.png";
-import ImageAcorn from "assets/img/Acorn.png";
-import ImageFaroshScale from "assets/img/FaroshScale.png";
-import ImageFaroshClaw from "assets/img/FaroshClaw.png";
-import ImageFaroshHorn from "assets/img/FaroshHorn.png";
-import ImageHeartyBass from "assets/img/HeartyBass.png";
-import ImageBeetle from "assets/img/Beetle.png";
-import ImageOpal from "assets/img/Opal.png";
-import ImageDiamond from "assets/img/Diamond.png";
-import ImageTail from "assets/img/Tail.png";
-import ImageSpring from "assets/img/Spring.png";
-import ImageShaft from "assets/img/Shaft.png";
-import ImageCore from "assets/img/Core.png";
-import ImageWood from "assets/img/Wood.png";
-import ImageSpeedFood from "assets/img/SpeedFood.png";
-import ImageAxe from "assets/img/Axe.png";
-import ImageBow from "assets/img/ForestDwellerBow.png";
-import ImageArrow from "assets/img/NormalArrow.png";
-import ImageFireArrow from "assets/img/FireArrow.png";
-import ImageIceArrow from "assets/img/IceArrow.png";
-import ImageShockArrow from "assets/img/ShockArrow.png";
-import ImageBombArrow from "assets/img/BombArrow.png";
-import ImageAncientArrow from "assets/img/AncientArrow.png";
-import ImageShield from "assets/img/PotLid.png";
-import ImageRushroom from "assets/img/Rushroom.png";
-import ImageScrew from "assets/img/Screw.png";
-import ImageHyruleBass from "assets/img/HyruleBass.png";
-import ImageLizalfosHorn from "assets/img/LizalfosHorn.png";
-import ImageLizalfosTalon from "assets/img/LizalfosTalon.png";
+import Images from "assets/img";
export enum ItemType {
Weapon = 0,
@@ -88,6 +55,7 @@ export enum Item {
LizalfosTalon = "LizalfosTalon",
SpeedFood = "SpeedFood",
+ EnduraFood = "EnduraFood",
Weapon = "Weapon",
Bow = "Bow",
NormalArrow = "NormalArrow",
@@ -96,20 +64,26 @@ export enum Item {
ShockArrow = "ShockArrow",
BombArrow = "BombArrow",
AncientArrow = "AncientArrow",
- Shield = "Shield"
+ Shield = "Shield",
+
+ Apple = "Apple",
+ HylianShroom = "HylianShroom",
+ SpicyPepper = "SpicyPepper",
+ EnduraShroom = "EnduraShroom",
+ HeartyRadish = "HeartyRadish",
+ BigHeartyRadish = "BigHeartyRadish",
+ Fairy = "Fairy",
}
type ItemData = {
item: Item,
image: string,
- id: number,
type: ItemType,
repeatable: boolean,
stackable: boolean,
sortOrder: number,
}
-const IdToData: {[id: number]: ItemData} = {};
const ItemToData: {[k in Item]?: ItemData} = {};
const TypeToCount = {
[ItemType.Weapon]: 0,
@@ -120,80 +94,90 @@ const TypeToCount = {
[ItemType.Key]: 0,
[ItemType.Meal]: 0,
};
-const register = (id: number, item: Item, type: ItemType, image: string, options?: Partial) => {
+const register = (_id: number, item: Item, type: ItemType, options?: Partial) => {
const sortOrder = TypeToCount[type];
TypeToCount[type]++;
const data: ItemData = {
item,
- image,
- id,
+ image: Images[`${item}`],
type,
repeatable: true,
stackable: true,
sortOrder,
...options||{}
};
- if(id in IdToData){
- console.error("Multiple items registered to the same id: "+id+", ("+item+")");
- }
- IdToData[id] = data;
+ // if(id in IdToData){
+ // console.error("Multiple items registered to the same id: "+id+", ("+item+")");
+ // }
+ //IdToData[id] = data;
ItemToData[item] = data;
};
-/* Do not change the ID once created. Otherwise you would break existing codes */
-register(0x00, Item.Slate, ItemType.Key, ImageSlate, {
+
+register(0x00, Item.Slate, ItemType.Key, {
repeatable: false,
stackable: false
});
-register(0x01, Item.Glider, ItemType.Key, ImageGlider, {
+register(0x01, Item.Glider, ItemType.Key, {
repeatable: false,
stackable: false
});
-register(0x02, Item.SpiritOrb, ItemType.Key, ImageSpiritOrb);
+register(0x02, Item.SpiritOrb, ItemType.Key);
+register(0, Item.Apple, ItemType.Material);
+register(0, Item.SpicyPepper, ItemType.Material);
+register(0x11, Item.Lotus, ItemType.Material);
+register(0, Item.EnduraShroom, ItemType.Material);
+register(0, Item.HylianShroom, ItemType.Material);
+register(0x20, Item.Rushroom, ItemType.Material);
+register(0, Item.BigHeartyRadish, ItemType.Material);
+register(0, Item.HeartyRadish, ItemType.Material);
+register(0x12, Item.SilentPrincess, ItemType.Material);
+register(0x13, Item.Honey, ItemType.Material);
+register(0x14, Item.Acorn, ItemType.Material);
+register(0x15, Item.FaroshScale, ItemType.Material);
+register(0x16, Item.FaroshClaw, ItemType.Material);
+register(0x17, Item.FaroshHorn, ItemType.Material);
+register(0x18, Item.HeartyBass, ItemType.Material);
+register(0x21, Item.HyruleBass, ItemType.Material);
+register(0, Item.Fairy, ItemType.Material);
+register(0x19, Item.Beetle, ItemType.Material);
+register(0x1a, Item.Opal, ItemType.Material);
+register(0x10, Item.Diamond, ItemType.Material);
+register(0x23, Item.LizalfosHorn, ItemType.Material);
+register(0x24, Item.LizalfosTalon, ItemType.Material);
+register(0x1b, Item.Tail, ItemType.Material);
+register(0x22, Item.Screw, ItemType.Material);
+register(0x1c, Item.Spring, ItemType.Material);
+register(0x1d, Item.Shaft, ItemType.Material);
+register(0x1e, Item.Core, ItemType.Material);
+register(0x1f, Item.Wood, ItemType.Material);
-register(0x11, Item.Lotus, ItemType.Material, ImageLotus);
-register(0x20, Item.Rushroom, ItemType.Material, ImageRushroom);
-register(0x12, Item.SilentPrincess, ItemType.Material, ImageSilentPrincess);
-register(0x13, Item.Honey, ItemType.Material, ImageHoney);
-register(0x14, Item.Acorn, ItemType.Material, ImageAcorn);
-register(0x15, Item.FaroshScale, ItemType.Material, ImageFaroshScale);
-register(0x16, Item.FaroshClaw, ItemType.Material, ImageFaroshClaw);
-register(0x17, Item.FaroshHorn, ItemType.Material, ImageFaroshHorn);
-register(0x18, Item.HeartyBass, ItemType.Material, ImageHeartyBass);
-register(0x21, Item.HyruleBass, ItemType.Material, ImageHyruleBass);
-register(0x19, Item.Beetle, ItemType.Material, ImageBeetle);
-register(0x1a, Item.Opal, ItemType.Material, ImageOpal);
-register(0x10, Item.Diamond, ItemType.Material, ImageDiamond);
-register(0x23, Item.LizalfosHorn, ItemType.Material, ImageLizalfosHorn);
-register(0x24, Item.LizalfosTalon, ItemType.Material, ImageLizalfosTalon);
-register(0x1b, Item.Tail, ItemType.Material, ImageTail);
-register(0x22, Item.Screw, ItemType.Material, ImageScrew);
-register(0x1c, Item.Spring, ItemType.Material, ImageSpring);
-register(0x1d, Item.Shaft, ItemType.Material, ImageShaft);
-register(0x1e, Item.Core, ItemType.Material, ImageCore);
-register(0x1f, Item.Wood, ItemType.Material, ImageWood);
-
-register(0x40, Item.SpeedFood, ItemType.Meal, ImageSpeedFood, {
+register(0x40, Item.SpeedFood, ItemType.Meal, {
+ stackable: false
+});
+register(0, Item.EnduraFood, ItemType.Meal, {
+ stackable: false
+});
+register(0x50, Item.Weapon, ItemType.Weapon, {
+ image: Images.Axe,
stackable: false
});
-register(0x50, Item.Weapon, ItemType.Weapon, ImageAxe, {
+register(0x60, Item.Bow, ItemType.Bow, {
+ image: Images.ForestDwellerBow,
+ stackable: false
+});
+register(0x70, Item.NormalArrow, ItemType.Arrow);
+register(0x71, Item.FireArrow, ItemType.Arrow);
+register(0x72, Item.IceArrow, ItemType.Arrow);
+register(0x73, Item.ShockArrow, ItemType.Arrow);
+register(0x74, Item.BombArrow, ItemType.Arrow);
+register(0x75, Item.AncientArrow, ItemType.Arrow);
+register(0x80, Item.Shield, ItemType.Shield, {
+ image: Images.PotLid,
stackable: false
});
-register(0x60, Item.Bow, ItemType.Bow, ImageBow, {
- stackable: false
-});
-register(0x70, Item.NormalArrow, ItemType.Arrow, ImageArrow);
-register(0x71, Item.FireArrow, ItemType.Arrow, ImageFireArrow);
-register(0x72, Item.IceArrow, ItemType.Arrow, ImageIceArrow);
-register(0x73, Item.ShockArrow, ItemType.Arrow, ImageShockArrow);
-register(0x74, Item.BombArrow, ItemType.Arrow, ImageBombArrow);
-register(0x75, Item.AncientArrow, ItemType.Arrow, ImageAncientArrow);
-register(0x80, Item.Shield, ItemType.Shield, ImageShield, {
- stackable: false
-});
-
-export const idToItemData = (id: number): ItemData => IdToData[id];
+//export const idToItemData = (id: number): ItemData => IdToData[id];
export const itemToItemData = (item: Item): ItemData => ItemToData[item] as ItemData;
export const itemToArrowType = (item: Item): string => {
if(itemToItemData(item).type === ItemType.Arrow){
diff --git a/src/core/Parser.ts b/src/core/Parser.ts
index 3d570eb..6059ef8 100644
--- a/src/core/Parser.ts
+++ b/src/core/Parser.ts
@@ -54,7 +54,7 @@ export const parseCommand = (cmdString: string): Command | undefined => {
return undefined;
}
// remove material
- if (tokens.length === 6 && (tokens[0] === "Remove" || tokens[0] === "Sell" || tokens[0] === "Drop") && tokens[3] === "From" && tokens[4] ==="Slot" ){
+ if (tokens.length === 6 && (tokens[0] === "Remove" || tokens[0] === "Sell" || tokens[0] === "Drop"|| tokens[0] === "Eat") && tokens[3] === "From" && tokens[4] ==="Slot" ){
const count = parseInt(tokens[1]);
const item = tokens[2];
const slot = parseInt(tokens[5]);
@@ -63,7 +63,7 @@ export const parseCommand = (cmdString: string): Command | undefined => {
}
return undefined;
}
- if (tokens.length === 3 && (tokens[0] === "Remove" || tokens[0] === "Sell" || tokens[0] === "Drop")){
+ if (tokens.length === 3 && (tokens[0] === "Remove" || tokens[0] === "Sell" || tokens[0] === "Drop"|| tokens[0] === "Eat")){
const count = parseInt(tokens[1]);
const item = tokens[2];
if(Number.isInteger(count) && item in Item){