1
0
Fork 0

tested arrow corruption

This commit is contained in:
iTNTPiston 2022-06-23 10:47:00 -07:00
parent dbcb7aef8d
commit bbd1e12952
18 changed files with 697 additions and 854 deletions

View file

@ -1,19 +1,16 @@
import { Command, CommandNothing } from "core/Command";
import { Inventory } from "core/Inventory";
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import "./App.css";
import { CommandItem } from "./components/CommandItem";
import { DisplayPane } from "surfaces/DisplayPane";
import { Item } from "core/Item";
import { saveAs } from "data/FileSaver";
import { parseCommand } from "core/Parser";
import { ItemList } from "components/ItemList";
import { TitledList } from "components/TitledList";
import { createSimulationState, SimulationState } from "core/SimulationState";
import { ReferencePage } from "surfaces/ReferencePage";
import { GameData } from "core/GameData";
const getDefaultCommands = (): Command[]=>{
const encoded = localStorage.getItem("HDS.CurrentCommandsText");
@ -28,10 +25,9 @@ const getDefaultCommands = (): Command[]=>{
parseCommand("Reload"),
parseCommand("Save"),
parseCommand("Reload"),
] as Command[];;
] as Command[];
};
export const App: React.FC = () => {
const [page, setPageInState] = useState<string>("#simulation");
const [overlaySave, setOverlaySave] = useState<boolean>(false);
@ -120,12 +116,12 @@ export const App: React.FC = () => {
height: 40
}}>
<button onClick={()=>{
setPage("#simulation")
setPage("#simulation");
}}>Simulation</button>
<button onClick={()=>{
setPage("#reference")
setPage("#reference");
}}>Reference</button>
<button>Options</button>
<button disabled>Options</button>
</div>
<div id="SidePane" style={{
@ -159,7 +155,7 @@ export const App: React.FC = () => {
}
{
Object.entries(simulationStates[displayIndex].getNamedSaves()).map(([name, _gamedata])=>(
Object.entries(simulationStates[displayIndex].getNamedSaves()).map(([name, _gamedata])=>
<CommandItem
onClick={()=>{
setSelectedSaveName(name);
@ -169,7 +165,7 @@ export const App: React.FC = () => {
>
{name}
</CommandItem>
))
)
}
</ol>
}
@ -259,26 +255,32 @@ export const App: React.FC = () => {
backgroundColor: "#262626"
} }>
{
(displayIndex >= 0 && displayIndex < commands.length) ?
displayIndex >= 0 && displayIndex < commands.length ?
<TitledList title="Save Data">
{
selectedSaveName === "" && !!simulationStates[displayIndex].getManualSave() &&
<ItemList slots={(simulationStates[displayIndex].getManualSave() as GameData).getDisplayedSlots()}/>
(()=>{
if (selectedSaveName === ""){
const manualSave = simulationStates[displayIndex].getManualSave();
if(manualSave){
return <ItemList slots={manualSave.getDisplayedSlots()}/>;
}
{
selectedSaveName !== "" && !!simulationStates[displayIndex].getNamedSaves()[selectedSaveName] &&
<ItemList slots={(simulationStates[displayIndex].getNamedSaves()[selectedSaveName] as GameData).getDisplayedSlots()}/>
}else if(selectedSaveName){
const namedSaves = simulationStates[displayIndex].getNamedSaves();
if(selectedSaveName in namedSaves){
const save = namedSaves[selectedSaveName];
return <ItemList slots={save.getDisplayedSlots()}/>;
}
}
return null;
})()
}
</TitledList>
:
<TitledList title="Select an instruction on the left to view it">
</TitledList>
}
</div>
<div style={{
minHeight: "calc( 70vh - 40px )",
@ -309,36 +311,6 @@ export const App: React.FC = () => {
}
</div>
{/* <div id="SavePane" style={{
height: "200px"
}}>
</div>
<div id="InstructionPane" style={{
}}> */}
{/* <div id="CommandList" style={{
width: "300px",
height: "calc( 60vh - 5px )",
overflowY: "auto",
border: "1px solid black",
boxSizing: "content-box"
} }>
</div> */}
{/* </div> */}
{
contextMenuShowing && <div style={{
position: "absolute",
@ -411,45 +383,6 @@ export const App: React.FC = () => {
const text = lines.join("\n");
saveAs(text, "dupe.txt");
}}>Export</CommandItem>
<CommandItem onClick={()=>{
alert(`Available Commands:
Initialize X Item1 Y Item2 Z Item3 ...
Break X Slots - add X broken slots
Save
Reload
Sort Key/Material - sort key items or material
Get/Add/Cook/Pickup X ITEM
Remove/Drop/Sell X ITEM From Slot Y
Remove/Sell/Eat MEAL From Slot X
Limitations:
Inventory corruption is not implemented yet
`);
alert(`Available Items:
Slate
Glider
SpiritOrb
SpeedFood
Lotus
SilentPrincess
Honey
Acorn
FaroshScale
FaroshClaw
FaroshHorn
HeartyBass
Beetle
Opal
Diamond
Tail
Spring
Shaft
Core
Wood
Weapon
`);
}}>Reference</CommandItem>
</>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -11,7 +11,7 @@ type CommandItemProps = PropsWithChildren<{
export const CommandItem: React.FC<CommandItemProps> = ({isSelected, isContextSelected, comment,children, onClick, onContextMenu}) => {
if(comment){
return <div className={clsx("CommandItem", isSelected && "CommandItemSelected", isContextSelected&& "CommandItemContextSelected",comment && "CommandItemComment")}>{children}</div>
return <div className={clsx("CommandItem", isSelected && "CommandItemSelected", isContextSelected&& "CommandItemContextSelected",comment && "CommandItemComment")}>{children}</div>;
}
return <li
className={clsx("CommandItem", isSelected && "CommandItemSelected", isContextSelected&& "CommandItemContextSelected",comment && "CommandItemComment")}

View file

@ -2,7 +2,6 @@ import clsx from "clsx";
import { DisplayableSlot } from "core/DisplayableInventory";
import Background from "assets/Background.png";
type ItemSlotProps = {
slot: DisplayableSlot
};

View file

@ -1,4 +1,4 @@
import { PropsWithChildren } from "react"
import { PropsWithChildren } from "react";
type TitledListProps = PropsWithChildren<{
title: string
@ -22,4 +22,4 @@ export const TitledList: React.FC<TitledListProps> = ({title, children}) => {
</div>
</>
);
}
};

View file

@ -1,5 +1,5 @@
import { Inventory } from "./Inventory";
import { Item, ItemStack, itemToArrowType } from "./Item";
import { Item, ItemStack } from "./Item";
import { SimulationState } from "./SimulationState";
export interface Command {
@ -70,7 +70,6 @@ export class CommandReload implements Command {
}
}
export class CommandUse implements Command {
private name: string;
constructor(name: string){
@ -215,7 +214,7 @@ const joinItemStackString = (initial: string, stacks: ItemStack[]): string => {
parts.push(item);
});
return parts.join(" ");
}
};
export class CommandDaP implements Command {
private count: number;
@ -273,7 +272,7 @@ export class CommandUnequip implements Command {
}
export class CommandShootArrow implements Command {
private count: number
private count: number;
constructor(count: number){
this.count = count;
}
@ -286,39 +285,28 @@ export class CommandShootArrow implements Command {
}
}
export class CommandCloseGame implements Command {
public execute(state: SimulationState): void {
state.closeGame();
}
public getDisplayString(): string {
return "Close Game";
}
}
// export class CommandEquipArrow implements Command {
// private item: Item;
// private slot: number;
// private noSlot: boolean;
// constructor(item: Item, slot: number, noSlot: boolean){
// this.item = item;
// this.slot = slot;
// this.noSlot = noSlot;
// }
export class CommandSync implements Command {
private actionString: string;
constructor(actionString: string){
this.actionString = actionString;
}
// public execute(inv: Inventory): void {
// inv.equipEquipmentOrArrow(this.item, this.slot);
// }
// public getDisplayString(): string {
// const slotString = this.noSlot ? "" : ` In Slot ${this.slot+1}`;
// return `Equip ${itemToArrowType(this.item)} Arrow${slotString}`;
// }
// }
// export class CommandCloseGame implements Command {
// public execute(inv: Inventory): void {
// inv.closeGame();
// }
// public getDisplayString(): string {
// return "Close Game";
// }
// }
public execute(state: SimulationState): void {
state.syncGameDataWithPouch();
}
public getDisplayString(): string {
return this.actionString;
}
}
export class CommandComment implements Command {
private name: string;
@ -333,38 +321,38 @@ export class CommandComment implements Command {
}
}
// export class CommandSortKey implements Command {
// static Op = 0x5;
// // public fromBuffer(_buf: Buffer): number {
// // return 0;
// // }
// // public toBuffer(): Buffer {
// // const buf: Buffer = Buffer.alloc(1);
// // buf.writeInt8(CommandSortKey.Op);
// // return buf;
// // }
// public execute(inv: Inventory): void {
// inv.sortKey();
// }
// public getDisplayString(): string {
// return "Sort Key";
// }
// }
export class CommandSortKey implements Command {
static Op = 0x5;
// public fromBuffer(_buf: Buffer): number {
// return 0;
// }
// public toBuffer(): Buffer {
// const buf: Buffer = Buffer.alloc(1);
// buf.writeInt8(CommandSortKey.Op);
// return buf;
// }
public execute(_state: SimulationState): void {
// wip
}
public getDisplayString(): string {
return "Sort Key";
}
}
// export class CommandSortMaterial implements Command {
// static Op = 0x6;
// // public fromBuffer(_buf: Buffer): number {
// // return 0;
// // }
// // public toBuffer(): Buffer {
// // const buf: Buffer = Buffer.alloc(1);
// // buf.writeInt8(CommandSortMaterial.Op);
// // return buf;
// // }
// public execute(inv: Inventory): void {
// inv.sortMaterial();
// }
// public getDisplayString(): string {
// return "Sort Material";
// }
// }
export class CommandSortMaterial implements Command {
static Op = 0x6;
// public fromBuffer(_buf: Buffer): number {
// return 0;
// }
// public toBuffer(): Buffer {
// const buf: Buffer = Buffer.alloc(1);
// buf.writeInt8(CommandSortMaterial.Op);
// return buf;
// }
public execute(_state: SimulationState): void {
// wip
}
public getDisplayString(): string {
return "Sort Material";
}
}

View file

@ -1,4 +1,4 @@
import { Item, ItemStack, itemToItemData, ItemType } from "./Item"
import { ItemStack, itemToItemData, ItemType } from "./Item";
export type DisplayableSlot = {
image: string,
@ -16,9 +16,10 @@ export const itemStackToDisplayableSlot = ({item, count, equipped}: ItemStack, i
const data = itemToItemData(item);
return {
image: data.image,
displayCount: data.stackable && (data.type === ItemType.Arrow || count > 0),
// for unstackable items (meal/key items) display count if count > 1, even if it's unstackable
displayCount: data.stackable ? data.type === ItemType.Arrow || count > 0 : count > 1,
count,
isEquipped: equipped,
isBrokenSlot
}
}
};
};

View file

@ -1,5 +1,4 @@
import { DisplayableInventory, DisplayableSlot, itemStackToDisplayableSlot } from "./DisplayableInventory";
import { Item, itemToItemData } from "./Item";
import { Slots } from "./Slots";
import { VisibleInventory } from "./VisibleInventory";

View file

@ -1,5 +1,5 @@
import { Item, ItemStack, itemToItemData, ItemType, ItemTypes } from "./Item";
import { Slots } from "./Slots";
// import { Item, ItemStack, itemToItemData, ItemType, ItemTypes } from "./Item";
// import { Slots } from "./Slots";
export class Inventory {
// private slots: Slots = new Slots([]);

View file

@ -76,6 +76,7 @@ export enum Item {
Fairy = "Fairy",
MasterSword = "MasterSword",
ZoraArmor = "ZoraArmor",
}
type ItemData = {
@ -167,7 +168,7 @@ register(0x50, Item.Weapon, ItemType.Weapon, {
});
register(0, Item.MasterSword, ItemType.Weapon, {
stackable: false,
})
});
register(0x60, Item.Bow, ItemType.Bow, {
image: Images.ForestDwellerBow,
@ -184,6 +185,10 @@ register(0x80, Item.Shield, ItemType.Shield, {
stackable: false
});
register(9, Item.ZoraArmor, ItemType.Armor, {
stackable: false
});
//export const idToItemData = (id: number): ItemData => IdToData[id];
export const itemToItemData = (item: Item): ItemData => ItemToData[item] as ItemData;
export const itemToArrowType = (item: Item): string => {
@ -193,3 +198,5 @@ export const itemToArrowType = (item: Item): string => {
}
return "";
};
export const getAllItems = (): string[] => Object.keys(ItemToData);

View file

@ -4,6 +4,7 @@ import {
CommandAddMultiple,
CommandAddWithoutCount,
CommandBreakSlots,
CommandCloseGame,
CommandComment,
CommandDaP,
CommandEquip,
@ -16,6 +17,9 @@ import {
CommandSave,
CommandSaveAs,
CommandShootArrow,
CommandSortKey,
CommandSortMaterial,
CommandSync,
CommandUnequip,
CommandUse
} from "./Command";
@ -176,50 +180,29 @@ export const parseCommand = (cmdString: string): Command | undefined => {
return undefined;
}
// if(tokens.length===2 && tokens[0] === "Sort" && tokens[1] === "Key"){
// return new CommandSortKey();
// }
// if(tokens.length===2 && tokens[0] === "Sort" && tokens[1] === "Material"){
// return new CommandSortMaterial();
// }
// if(tokens.length===2 && tokens[0] === "Close" && tokens[1] === "Game"){
// return new CommandCloseGame();
// }
// return undefined;
// }
// // remove material
// // Equip Arrow
// if (tokens.length === 6 && tokens[0] === "Equip" && tokens[2] === "Arrow" && tokens[3] === "In" && tokens[4] ==="Slot" ){
// const item = tokens[1]+"Arrow";
// const slot = parseInt(tokens[5]);
// if( Number.isInteger(slot) && item in Item){
// return new CommandEquipArrow(Item[item as keyof typeof Item], slot-1, false);
// }
// return undefined;
// }
// if (tokens.length === 3 && tokens[0] === "Equip" && tokens[2] === "Arrow" ){
// const item = tokens[1]+"Arrow";
// if(item in Item){
// return new CommandEquipArrow(Item[item as keyof typeof Item], 0, true);
// }
// return undefined;
// }
if(tokens.length===2 && tokens[0] === "Sort" && tokens[1] === "Key"){
return new CommandSortKey();
}
if(tokens.length===2 && tokens[0] === "Sort" && tokens[1] === "Material"){
return new CommandSortMaterial();
}
if(tokens.length===2 && tokens[0] === "Close" && tokens[1] === "Game"){
return new CommandCloseGame();
}
if(tokens.length===2 && tokens[0] === "Sync" && tokens[1] === "GameData"){
return new CommandSync("Sync GameData");
}
return undefined;
};
const isAddVerb = (token: string): boolean => {
return token === "Get" || token === "Cook" || token === "Add" || token === "Pickup"
}
return token === "Get" || token === "Cook" || token === "Add" || token === "Pickup";
};
const isRemoveVerb = (token: string): boolean => {
return token === "Remove" || token === "Sell" || token === "Eat" || token === "Drop"
}
return token === "Remove" || token === "Sell" || token === "Eat" || token === "Drop";
};
const parseItemStacks = (tokens: string[], from: number): ItemStack[] | undefined => {
if((tokens.length-from)%2 !== 0){
@ -242,4 +225,4 @@ const parseItemStacks = (tokens: string[], from: number): ItemStack[] | undefine
}
}
return stacks;
}
};

View file

@ -11,7 +11,7 @@ export const createSimulationState = (): SimulationState => {
{},
new VisibleInventory(new Slots([]), 0)
);
}
};
/*
* The state of simulation, including game data, visible inventory, and all save slots
*/
@ -21,7 +21,7 @@ export class SimulationState {
private namedSaves: {[name: string]: GameData} = {};
private pouch: VisibleInventory;
private nextReloadName?: string;
private isOnEventide: boolean = false;
private isOnEventide = false;
constructor(gameData: GameData, manualSave: GameData | null, namedSaves: {[name: string]: GameData}, pouch: VisibleInventory){
this.gameData = gameData;
@ -120,6 +120,12 @@ export class SimulationState {
// does not sync
}
public closeGame() {
this.pouch = new VisibleInventory(new Slots([]), 0);
this.gameData = new GameData(new Slots([]));
this.isOnEventide = false;
}
public syncGameDataWithPouch() {
if(!this.isOnEventide){
this.gameData.syncWith(this.pouch);
@ -150,15 +156,10 @@ export class SimulationState {
// return this.gameData;
// }
}
// Shoot X Arrow, x can be ommited and default to 1
// Close Game
// Close Inventory, same as Resync GameData
// Enter Eventide / Leave Eventide
// Sort Key (In Tab X) - need more research on which tab is sorted. (might not be possible to select which tab to sort)

View file

@ -1,8 +1,6 @@
import { count } from "console";
import { stableSort } from "data/mergeSort";
import { Item, ItemStack, itemToItemData, ItemType } from "./Item";
/*
* This is the data model common to GameData and VisibleInventory
*/
@ -43,21 +41,7 @@ export class Slots {
public clearFirst(count: number) {
this.internalSlots.splice(0, count);
}
// public get(i: number): ItemStack{
// return this.internalSlots[i];
// }
// public getByType(type: ItemType): Slots {
// return new Slots(this.internalSlots.filter(s=>itemToItemData(s.item).type===type));
// }
// public getBeforeType(type: ItemType): Slots {
// return new Slots(this.internalSlots.filter(s=>itemToItemData(s.item).type<type));
// }
// public getAfterType(type: ItemType): Slots {
// return new Slots(this.internalSlots.filter(s=>itemToItemData(s.item).type>type));
// }
// public addSlotsToEnd(slots: Slots) {
// slots.internalSlots.forEach(s=>this.addStack(s));
// }
public addStackDirectly(stack: ItemStack): number {
const data = itemToItemData(stack.item);
if(data.stackable){
@ -73,18 +57,6 @@ export class Slots {
this.internalSlots.push({...stack});
this.sortItemType(mCount);
}
// public addStackCopy(stack: ItemStack) {
// this.addStack({...stack});
// }
// public sort() {
// this.internalSlots.sort((a,b)=>{
// return itemToItemData(a.item).sortOrder - itemToItemData(b.item).sortOrder;
// });
// }
// public removeFromEnd(count: number): Slots {
// const end = this.internalSlots.splice(-count, count);
// return new Slots(end);
// }
// remove item(s) start from slot
// return number of slots removed
@ -179,10 +151,9 @@ export class Slots {
}
if(reloading){
for(let i=0;i<count;i++){
this.addSlot({item,count:1,equipped: equippedDuringReload}, mCount+i+1);
this.addSlot({item,count,equipped: equippedDuringReload}, mCount+1);
return 1;
}
}else{
if(data.type===ItemType.Weapon || data.type===ItemType.Bow || data.type===ItemType.Shield){
//Check equip
const shouldEquipNew = this.internalSlots.filter(s=>{
@ -199,14 +170,10 @@ export class Slots {
this.addSlot({item,count:1,equipped: false}, mCount+i+1);
}
}
}
return count;
}
// this is for both equipments and arrows
public equip(item: Item, slot: number) {
let s = 0;
@ -260,7 +227,8 @@ export class Slots {
return;
}
const thisData = itemToItemData(this.internalSlots[slot].item);
if(thisData.stackable){
// Currently only supports corrupting arrows, material, meal and key items as durability values are not simulated on equipments
if(thisData.type >= ItemType.Material || thisData.stackable){
this.internalSlots[slot].count = durability;
}
}
@ -268,20 +236,22 @@ export class Slots {
// shoot count arrows. return the slot that was updated, or -1
public shootArrow(count: number): number {
// first find equipped arrow, search entire inventory
// this is the last equipped arrow before armor
let i=0;
let equippedArrow: Item | undefined = undefined;
for(;i<this.internalSlots.length;i++){
if(this.internalSlots[i].equipped){
const data = itemToItemData(this.internalSlots[i].item);
if(data.type === ItemType.Arrow){
if(data.type > ItemType.Shield){
break;
}
if(this.internalSlots[i].equipped && data.type === ItemType.Arrow){
equippedArrow = data.item;
}
}
if(i>=this.internalSlots.length){
//can't find equipped arrow
return -1;
}
const equippedArrow = this.internalSlots[i].item;
// now find the first slot of that arrow and update
for(let j=0;j<this.internalSlots.length;j++){
if(this.internalSlots[j].item === equippedArrow){
@ -293,34 +263,5 @@ export class Slots {
return -1;
}
// // Difference between shoot and remove:
// // 1. can only be from first (leftmost) slot
// // 2. empty slots not removed
// public shoot(item: Item, count: number) {
// for(let i = 0; i<this.internalSlots.length;i++){
// if(this.internalSlots[i].item === item){
// this.internalSlots[i].count-=count;
// }
// }
// }
// public sortArrows() {
// const after = this.removeFromEnd(this.getAfterType(ItemType.Arrow).length);
// const arrows = this.removeFromEnd(this.getByType(ItemType.Arrow).length);
// arrows.sort();
// this.addSlotsToEnd(arrows);
// this.addSlotsToEnd(after);
// }
// public getFirstEquippedSlotIndex(type: ItemType): number {
// for(let i = 0; i<this.internalSlots.length;i++){
// if(this.internalSlots[i].equipped){
// const data = itemToItemData(this.internalSlots[i].item);
// if(data.type === type){
// return i;
// }
// }
// }
// return -1;
// }
}

View file

@ -9,7 +9,7 @@ import { Slots } from "./Slots";
export class VisibleInventory implements DisplayableInventory{
private slots: Slots = new Slots([]);
/* Implementation of mCount in botw */
private count: number = 0;
private count = 0;
constructor(slots: Slots, count: number){
this.slots = slots;
this.count = count;
@ -83,7 +83,7 @@ export class VisibleInventory implements DisplayableInventory{
foundShield = true;
}
}
})
});
}
public shootArrow(count: number, gameData: GameData) {

View file

@ -2,13 +2,13 @@
export const stableSort = <T>(array: T[], cmp: (a:T, b:T) => number): void => {
const stabilizedThis: [T, number][] = array.map((el, index) => [el, index]);
const stableCmp = (a: [T, number], b: [T, number]) => {
let order = cmp(a[0], b[0]);
if (order != 0) return order;
const order = cmp(a[0], b[0]);
if (order != 0) {return order;}
return a[1] - b[1];
}
};
stabilizedThis.sort(stableCmp);
for (let i=0; i<array.length; i++) {
array[i] = stabilizedThis[i][0];
}
}
};

View file

@ -1,16 +1,14 @@
import clsx from "clsx";
import { ItemList, ItemListProps } from "components/ItemList";
import { DoubleItemSlot } from "components/ItemSlot";
import { TitledList } from "components/TitledList";
import { Command } from "core/Command";
import { ItemStack, itemToItemData } from "core/Item";
import { parseCommand } from "core/Parser";
import { SimulationState } from "core/SimulationState";
import { Slots } from "core/Slots";
import Background from "assets/Background.png";
import InGameBackground from "assets/InGame.png";
import React, { useEffect, useState } from "react";
import { ItemList } from "components/ItemList";
type DisplayPaneProps = {
command: string,
@ -20,23 +18,6 @@ type DisplayPaneProps = {
editCommand: (c: Command)=>void
}
// export const stacksToItemListProps = (slots: Slots, numBroken: number, isSave: boolean): ItemListProps => {
// return {
// items: stacksToItemProps(slots.getSlotsRef()),
// numBroken,
// isSave,
// };
// };
// export const stacksToItemProps = (stacks: ItemStack[]): ItemListItemProps[] => {
// return stacks.map(stackToItemProps);
// };
// export const stackToItemProps = ({item, count, equipped}: ItemStack): ItemListItemProps => {
// const data = itemToItemData(item);
// return {image: data.image, count: data.stackable ? count : 0, isEquipped:equipped};
// };
export const DisplayPane: React.FC<DisplayPaneProps> = ({command,editCommand,displayIndex,simulationState, overlaySave})=>{
const [commandString, setCommandString] = useState<string>("");
const [hasError, setHasError] = useState<boolean>(false);
@ -106,14 +87,13 @@ export const DisplayPane: React.FC<DisplayPaneProps> = ({command,editCommand,dis
const doubleSlots: JSX.Element[] = [];
const gameDataSlots = simulationState.displayableGameData.getDisplayedSlots();
const inventorySlots = simulationState.displayablePouch.getDisplayedSlots();
console.log(inventorySlots);
for(let i=0;i<gameDataSlots.length && i<inventorySlots.length;i++){
doubleSlots.push(<DoubleItemSlot key={i}
first={{slot: gameDataSlots[i]}}
second={{slot: inventorySlots[i]}}
/>);
}
if(inventorySlots.length>gameDataSlots.length){
if(gameDataSlots.length>inventorySlots.length){
for(let i=inventorySlots.length;i<gameDataSlots.length;i++){
doubleSlots.push(<DoubleItemSlot key={i+inventorySlots.length}
first={{slot: gameDataSlots[i]}}
@ -131,8 +111,6 @@ export const DisplayPane: React.FC<DisplayPaneProps> = ({command,editCommand,dis
}
</TitledList>
</div>
:<>
@ -165,11 +143,9 @@ export const DisplayPane: React.FC<DisplayPaneProps> = ({command,editCommand,dis
<ItemList slots={simulationState.displayablePouch.getDisplayedSlots()}/>
</TitledList>
</div>
</>}
</div>
</div>;
};

View file

@ -1,15 +1,17 @@
import { ItemList } from "components/ItemList";
import { TitledList } from "components/TitledList";
import { getAllItems } from "core/Item";
import React from "react";
export const ReferencePage: React.FC = React.memo(()=>{
return (
<div style={{height: "100%", width: "100%", color: "white"}}>
<TitledList title="Reference">
<div style={{padding: 10}}>
<h2>Items</h2>
{
getAllItems().map(item=><h4 className="Reference">{item}</h4>)
}
<h2>Commands</h2>
<h3 className="Reference">Initialize X item1 Y item2 Z item3 ...</h3>
<h4 className="Reference">Used for initializing inventory before simulation</h4>
@ -160,10 +162,23 @@ export const ReferencePage: React.FC = React.memo(()=>{
</p>
<p className="Reference Example">Example 1: Unequip Shield</p>
<p className="Reference Example">Example 2: Unequip Shield In Slot 5</p>
</div>
<h3 className="Reference">Close Game</h3>
<h4 className="Reference">Simulates closing the game and restarting</h4>
<p className="Reference">
When closing the game, Visible Inventory and Game Data are erased
</p>
<p className="Reference Example">Example: Close Game</p>
<h3 className="Reference">Sort Key/Material</h3>
<h4 className="Reference">Simulates press Y to sort tab</h4>
<p className="Reference Example">
This command is currently broken
</p>
</div>
</TitledList>
</div>
)
);
});