add support for all shrines material
|
@ -9,12 +9,12 @@
|
|||
content="for Breath of the Wild"
|
||||
/>
|
||||
<meta property="og:site_name" content="itntpiston.app"/>
|
||||
<meta property="og:title" content="Hundo Duplication Simulator">
|
||||
<meta property="og:title" content="Inventory Slot Transfer Simulator">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="https://dupl.itntpiston.app/#/">
|
||||
<meta property="og:description" content="for Breath of the Wild">
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<title>Hundo Duplication Simulator</title>
|
||||
<title>IST Sim</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
|
BIN
src/assets/img/Apple.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
src/assets/img/BigHeartyRadish.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/img/EnduraFood.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
src/assets/img/EnduraShroom.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
src/assets/img/Fairy.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
src/assets/img/HeartyRadish.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
src/assets/img/HylianShroom.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/img/SpicyPepper.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
25
src/assets/img/index.ts
Normal file
|
@ -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};
|
156
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<ItemData>) => {
|
||||
const register = (_id: number, item: Item, type: ItemType, options?: Partial<ItemData>) => {
|
||||
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){
|
||||
|
|
|
@ -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){
|
||||
|
|