add fishing

This commit is contained in:
Jill 2023-11-15 23:47:20 +03:00
parent 9eecec4894
commit a2a56f60f1
Signed by: oat
GPG Key ID: 33489AA58A955108
3 changed files with 143 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { pickRandom } from '../util';
import { DefaultItems, Item, Items, formatItems, formatItemsArray, getDefaultItem, getItemQuantity } from './items';
import { DefaultItems, Item, Items, formatItem, formatItems, formatItemsArray, getDefaultItem, getItemQuantity } from './items';
export interface CraftingStation {
key: string,
@ -65,7 +65,27 @@ export const craftingStations: CraftingStation[] = [
description: 'A place for you to work with tools, for simple things',
emoji: '🛠️',
requires: getDefaultItem(DefaultItems.WORKBENCH)
}
},
{
key: 'fishing',
name: 'Fishing',
verb: 'Fished up',
description: 'fish gaming wednesday',
emoji: '🎣',
requires: getDefaultItem(DefaultItems.FISHING_ROD),
formatRecipe: (inputs, requirements, outputs, disableBold = false) =>
`${formatItemsArray(inputs)} => ${outputs.map(i => formatItem(i.item, disableBold) + '?').join(' ')}`,
// weighted random
manipulateResults: (outputs) => {
const pool: Item[] = [];
for (const out of outputs) {
for (let i = 0; i < out.quantity; i++) {
pool.push(out.item);
}
}
return [{ item: pickRandom(pool), quantity: 1 }];
}
},
];
export async function canUseStation(user: string, station: CraftingStation) {

View File

@ -19,6 +19,13 @@ export enum DefaultItems {
LOG = 7,
AXE = 8,
BLOOD = 9,
BAIT = 10,
FISHING_ROD = 11,
CARP = 12,
PUFFERFISH = 13,
EXOTIC_FISH = 14,
SHOVEL = 15,
DIRT = 16,
}
export const defaultItems: DefaultItem[] = [
@ -102,6 +109,69 @@ export const defaultItems: DefaultItem[] = [
maxStack: 1024,
untradable: false
},
{
id: -10,
name: 'Bait',
description: 'I _guess_ you could eat this.',
emoji: '🪱',
type: 'consumable',
maxStack: 128,
untradable: false
},
{
id: -11,
name: 'Fishing Rod',
description: 'Give a man a fish, and he will eat for a day',
emoji: '🎣',
type: 'plain',
maxStack: 1,
untradable: false
},
{
id: -12,
name: 'Carp',
description: 'wow',
emoji: '🐟️',
type: 'plain',
maxStack: 16,
untradable: false
},
{
id: -13,
name: 'Pufferfish',
description: 'yummy!',
emoji: '🐡',
type: 'plain',
maxStack: 16,
untradable: false
},
{
id: -14,
name: 'Exotic Fish',
description: 'lucky!',
emoji: '🐠',
type: 'plain',
maxStack: 16,
untradable: false,
},
{
id: -15,
name: 'Shovel',
description: 'Did you know there\'s no shovel emoji',
emoji: '♠️',
type: 'plain',
maxStack: 1,
untradable: false,
},
{
id: -16,
name: 'Dirt',
description: 'https://media.discordapp.net/attachments/819472665291128873/1081454188325785650/ezgif-2-5ccc7dedf8.gif',
emoji: '🟫',
type: 'consumable',
maxStack: 64,
untradable: false,
},
];

View File

@ -91,7 +91,57 @@ export const defaultRecipes: DefaultRecipe[] = [
outputs: [
{ item: getDefaultItem(DefaultItems.BLOOD), quantity: 6 },
]
}
},
{
id: -8,
station: 'fishing',
inputs: [
{ item: getDefaultItem(DefaultItems.BAIT), quantity: 1 }
],
requirements: [],
outputs: [
{ item: getDefaultItem(DefaultItems.CARP), quantity: 12 },
{ item: getDefaultItem(DefaultItems.PUFFERFISH), quantity: 4 },
{ item: getDefaultItem(DefaultItems.EXOTIC_FISH), quantity: 1 },
]
},
{
id: -9,
station: 'workbench',
inputs: [
{ item: getDefaultItem(DefaultItems.TWIG), quantity: 2 },
{ item: getDefaultItem(DefaultItems.BAIT), quantity: 1 },
],
requirements: [],
outputs: [
{ item: getDefaultItem(DefaultItems.FISHING_ROD), quantity: 1 }
]
},
{
id: -10,
station: 'forage',
inputs: [],
requirements: [
{ item: getDefaultItem(DefaultItems.SHOVEL), quantity: 1 },
],
outputs: [
{ item: getDefaultItem(DefaultItems.BAIT), quantity: 3 },
{ item: getDefaultItem(DefaultItems.PEBBLE), quantity: 1 },
{ item: getDefaultItem(DefaultItems.DIRT), quantity: 1 },
],
},
{
id: -11,
station: 'workbench',
inputs: [
{ item: getDefaultItem(DefaultItems.PEBBLE), quantity: 3 },
{ item: getDefaultItem(DefaultItems.TWIG), quantity: 2 },
],
requirements: [],
outputs: [
{ item: getDefaultItem(DefaultItems.SHOVEL), quantity: 1 },
]
},
];
export function getDefaultRecipe(id: number): DefaultRecipe | undefined {