Compare commits
2 Commits
83f86214b5
...
ebbdb15f80
Author | SHA1 | Date |
---|---|---|
Hri7566 | ebbdb15f80 | |
Hri7566 | 363b00b949 |
19
package.json
19
package.json
|
@ -7,21 +7,22 @@
|
||||||
"start-bot": "bun src/mpp/index.ts"
|
"start-bot": "bun src/mpp/index.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "latest"
|
"@types/bun": "^1.1.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^5.9.1",
|
"@prisma/client": "^5.15.0",
|
||||||
"@trpc/client": "next",
|
"@trpc/client": "next",
|
||||||
"@trpc/server": "next",
|
"@trpc/server": "next",
|
||||||
"cli-markdown": "^3.2.2",
|
"@types/node": "^20.14.2",
|
||||||
"discord.js": "^14.14.1",
|
"cli-markdown": "^3.4.0",
|
||||||
"mpp-client-net": "^1.1.3",
|
"discord.js": "^14.15.3",
|
||||||
"prisma": "^5.9.1",
|
"mpp-client-net": "^1.2.0",
|
||||||
|
"prisma": "^5.15.0",
|
||||||
"trpc-bun-adapter": "^1.1.0",
|
"trpc-bun-adapter": "^1.1.0",
|
||||||
"yaml": "^2.3.4",
|
"yaml": "^2.4.5",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.23.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,9 @@ export const go = new Command(
|
||||||
inventory.location = nextLoc.id;
|
inventory.location = nextLoc.id;
|
||||||
await updateInventory(inventory);
|
await updateInventory(inventory);
|
||||||
|
|
||||||
if (getFishing(id, user.id)) {
|
let fisher;
|
||||||
stopFishing(id, user.id, false);
|
if (fisher = getFishing(id, user.id)) {
|
||||||
|
stopFishing(id, user.id, fisher.channel, false);
|
||||||
return `You ${prefix}${reel.aliases[0]}ed your LURE in and went to ${nextLoc.name}.`;
|
return `You ${prefix}${reel.aliases[0]}ed your LURE in and went to ${nextLoc.name}.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { yeet } from "./inventory/yeet";
|
||||||
import { tree } from "./fishing/tree";
|
import { tree } from "./fishing/tree";
|
||||||
import { pick } from "./fishing/pick";
|
import { pick } from "./fishing/pick";
|
||||||
import { fid } from "./util/fid";
|
import { fid } from "./util/fid";
|
||||||
|
import { chance } from "./util/chance";
|
||||||
// import { give } from "./inventory/give";
|
// import { give } from "./inventory/give";
|
||||||
|
|
||||||
interface ICommandGroup {
|
interface ICommandGroup {
|
||||||
|
@ -59,7 +60,7 @@ commandGroups.push(inventoryGroup);
|
||||||
const utilGroup: ICommandGroup = {
|
const utilGroup: ICommandGroup = {
|
||||||
id: "util",
|
id: "util",
|
||||||
displayName: "Utility",
|
displayName: "Utility",
|
||||||
commands: [data, setcolor, memory, autofish, pokedex, fid]
|
commands: [data, setcolor, memory, autofish, pokedex, fid, chance]
|
||||||
};
|
};
|
||||||
|
|
||||||
commandGroups.push(utilGroup);
|
commandGroups.push(utilGroup);
|
||||||
|
|
|
@ -108,18 +108,24 @@ export const eat = new Command(
|
||||||
|
|
||||||
if (foundObject.id == "sand") {
|
if (foundObject.id == "sand") {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.and)
|
if (res.and) {
|
||||||
return `Our friend ${part.name} ate of his/her ${foundObject.name} ${res.and}`;
|
return `Our friend ${part.name} ate of his/her ${foundObject.name} ${res.and}`;
|
||||||
} else {
|
} else {
|
||||||
return `Our friend ${part.name} ate of his/her ${foundObject.name}.`;
|
return `Our friend ${part.name} ate of his/her ${foundObject.name}.`;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return `Our friend ${part.name} ate of his/her ${foundObject.name}.`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.and)
|
if (res.and) {
|
||||||
return `Our friend ${part.name} ate his/her ${foundObject.name} ${res.and}`;
|
return `Our friend ${part.name} ate his/her ${foundObject.name} ${res.and}`;
|
||||||
} else {
|
} else {
|
||||||
return `Our friend ${part.name} ate his/her ${foundObject.name}.`;
|
return `Our friend ${part.name} ate his/her ${foundObject.name}.`;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return `Our friend ${part.name} ate his/her ${foundObject.name}.`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,7 +5,7 @@ import prisma from "@server/data/prisma";
|
||||||
|
|
||||||
export const inventory = new Command(
|
export const inventory = new Command(
|
||||||
"inventory",
|
"inventory",
|
||||||
["inventory", "inv", "i"],
|
["inventory", "inv", "items", "i"],
|
||||||
"Look at your inventory",
|
"Look at your inventory",
|
||||||
"inventory",
|
"inventory",
|
||||||
"command.inventory.inventory",
|
"command.inventory.inventory",
|
||||||
|
@ -37,12 +37,10 @@ export const inventory = new Command(
|
||||||
|
|
||||||
const items = inv.items as TInventoryItems;
|
const items = inv.items as TInventoryItems;
|
||||||
|
|
||||||
return `Contents of ${decidedUser.name}'s inventory: ${
|
return `Contents of ${decidedUser.name}'s inventory: ${items
|
||||||
items
|
|
||||||
.map(
|
.map(
|
||||||
(item: IItem) =>
|
(item: IItem) =>
|
||||||
`${item.emoji || "📦"}${item.name}${
|
`${item.emoji || "📦"}${item.name}${item.count ? ` (x${item.count})` : ""
|
||||||
item.count ? ` (x${item.count})` : ""
|
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
.join(", ") || "(none)"
|
.join(", ") || "(none)"
|
||||||
|
@ -53,12 +51,10 @@ export const inventory = new Command(
|
||||||
return `Apparently, you have no inventory. Not sure if that can be fixed, and I don't know how you got this message.`;
|
return `Apparently, you have no inventory. Not sure if that can be fixed, and I don't know how you got this message.`;
|
||||||
const items = inv.items as TInventoryItems;
|
const items = inv.items as TInventoryItems;
|
||||||
|
|
||||||
return `Contents of ${part.name}'s inventory: ${
|
return `Contents of ${part.name}'s inventory: ${items
|
||||||
items
|
|
||||||
.map(
|
.map(
|
||||||
(item: IItem) =>
|
(item: IItem) =>
|
||||||
`${item.emoji || "📦"}${item.name}${
|
`${item.emoji || "📦"}${item.name}${item.count ? ` (x${item.count})` : ""
|
||||||
item.count ? ` (x${item.count})` : ""
|
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
.join(", ") || "(none)"
|
.join(", ") || "(none)"
|
||||||
|
|
|
@ -12,15 +12,14 @@ export const autofish = new Command(
|
||||||
const fishing = getFishing(props.id, props.part.id);
|
const fishing = getFishing(props.id, props.part.id);
|
||||||
|
|
||||||
if (!fishing) {
|
if (!fishing) {
|
||||||
startFishing(props.id, props.part.id, true, true);
|
startFishing(props.id, props.part.id, props.channel, true, true);
|
||||||
return `Our friend ${props.user.name} casts LURE into a water with AUTOFISH enabled. (${props.prefix}${reel.aliases[0]} to disable)`;
|
return `Our friend ${props.user.name} casts LURE into a water with AUTOFISH enabled. (${props.prefix}${reel.aliases[0]} to disable)`;
|
||||||
} else {
|
} else {
|
||||||
return `Your lure is already in the water (since ${(
|
return `Your lure is already in the water (since ${(
|
||||||
(Date.now() - fishing.t) /
|
(Date.now() - fishing.t) /
|
||||||
1000 /
|
1000 /
|
||||||
60
|
60
|
||||||
).toFixed(2)} minutes ago).${
|
).toFixed(2)} minutes ago).${fishing.autofish
|
||||||
fishing.autofish
|
|
||||||
? ` (AUTOFISH is enabled)`
|
? ` (AUTOFISH is enabled)`
|
||||||
: ` (${props.prefix}${reel.aliases[0]} in first to start AUTOFISH)`
|
: ` (${props.prefix}${reel.aliases[0]} in first to start AUTOFISH)`
|
||||||
}`;
|
}`;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { addBack } from "@server/backs";
|
||||||
|
import Command from "@server/commands/Command";
|
||||||
|
import { getFishingChance } from "@server/fish/fishers";
|
||||||
|
|
||||||
|
export const chance = new Command(
|
||||||
|
"chance",
|
||||||
|
["chance"],
|
||||||
|
"Set own user color",
|
||||||
|
"chance",
|
||||||
|
"command.util.chance",
|
||||||
|
async ({ id, command, args, prefix, part, user }) => {
|
||||||
|
const chance = await getFishingChance(user.id);
|
||||||
|
return `Fishing chance: ${chance.chance} | Timestamp: ${chance.t}`;
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
|
@ -53,18 +53,20 @@ export async function tick() {
|
||||||
winner.autofish,
|
winner.autofish,
|
||||||
winner.autofish_t
|
winner.autofish_t
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Save to sack
|
||||||
const animal = randomFish(inventory.location);
|
const animal = randomFish(inventory.location);
|
||||||
addItem(inventory.fishSack as TFishSack, animal);
|
addItem(inventory.fishSack as TFishSack, animal);
|
||||||
await updateInventory(inventory);
|
await updateInventory(inventory);
|
||||||
|
|
||||||
const size = getSizeString(animal.size);
|
const size = getSizeString(animal.size);
|
||||||
|
const p = prefixes[0];
|
||||||
|
const emoji = animal.emoji || "🐟";
|
||||||
|
|
||||||
addBack(winner.id, {
|
addBack(winner.id, {
|
||||||
m: "sendchat",
|
m: "sendchat",
|
||||||
channel: winner.channel,
|
channel: winner.channel,
|
||||||
message: `Our good friend @${user.id} caught a ${size} ${
|
message: `Our good friend @${user.id} caught a ${size} ${emoji}${animal.name}! ready to ${p}eat or ${p}fish again${winner.autofish ? " (AUTOFISH is enabled)" : ""}`,
|
||||||
animal.emoji || "🐟"
|
|
||||||
}${animal.name}! ready to ${prefixes[0]}eat or ${
|
|
||||||
prefixes[0]
|
|
||||||
}fish again${winner.autofish ? " (AUTOFISH is enabled)" : ""}`,
|
|
||||||
isDM: winner.isDM,
|
isDM: winner.isDM,
|
||||||
id: winner.userID
|
id: winner.userID
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,15 @@ export const fish: IBehaviorDefinition = {
|
||||||
id: "fish",
|
id: "fish",
|
||||||
bhv: {
|
bhv: {
|
||||||
async eat(obj, props) {
|
async eat(obj, props) {
|
||||||
|
const r = Math.random();
|
||||||
|
|
||||||
|
const fish = obj as IFish;
|
||||||
|
|
||||||
|
console.log(fish)
|
||||||
|
console.log(fish.rarity);
|
||||||
|
|
||||||
|
// 50%
|
||||||
|
if (r < 0.5) {
|
||||||
const color = new CosmicColor(
|
const color = new CosmicColor(
|
||||||
Math.floor(Math.random() * 255),
|
Math.floor(Math.random() * 255),
|
||||||
Math.floor(Math.random() * 255),
|
Math.floor(Math.random() * 255),
|
||||||
|
@ -24,6 +33,12 @@ export const fish: IBehaviorDefinition = {
|
||||||
.getName()
|
.getName()
|
||||||
.toLowerCase()}.`
|
.toLowerCase()}.`
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
shouldRemove: true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Logger } from "@util/Logger";
|
import { Logger } from "@util/Logger";
|
||||||
import { createInterface, type ReadLine } from "readline";
|
import { createInterface } from "readline";
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
import gettRPC from "@util/api/trpc";
|
import gettRPC from "@util/api/trpc";
|
||||||
import { startAutorestart } from "@util/autorestart";
|
import { startAutorestart } from "@util/autorestart";
|
||||||
|
|
|
@ -6,14 +6,14 @@ import type { AppRouter } from "@server/api/trpc";
|
||||||
export function gettRPC(token: string) {
|
export function gettRPC(token: string) {
|
||||||
return createTRPCClient<AppRouter>({
|
return createTRPCClient<AppRouter>({
|
||||||
links: [
|
links: [
|
||||||
// httpBatchLink({
|
httpBatchLink({
|
||||||
// url: "http://localhost:3000",
|
url: "http://localhost:3000",
|
||||||
// headers() {
|
headers() {
|
||||||
// return {
|
return {
|
||||||
// Authorization: token
|
Authorization: token
|
||||||
// };
|
};
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
httpBatchLink({
|
httpBatchLink({
|
||||||
url: "https://fishing.hri7566.info/api",
|
url: "https://fishing.hri7566.info/api",
|
||||||
headers() {
|
headers() {
|
||||||
|
|
Loading…
Reference in New Issue