Compare commits

..

No commits in common. "207491583051516bb0a63c6b34018a50cfb04599" and "ac43825c27c9be10e7ac5823b1df61156d2d41ce" have entirely different histories.

8 changed files with 14 additions and 89 deletions

View File

@ -2,12 +2,7 @@
# channel:
# id: "✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧"
# allowColorChanging: true
# - uri: wss://mppclone.com:8443
# channel:
# id: "test/fishing"
# allowColorChanging: true
- uri: wss://mppclone.com:8443
channel:
id: "keller room"
id: "test/fishing"
allowColorChanging: true

View File

@ -1,13 +0,0 @@
import Command from "@server/commands/Command";
export const info = new Command(
"info",
["info"],
"Get your own user ID",
"info",
"command.general.info",
async ({ id, command, args, prefix, part, user }) => {
return `🌊 Made by Hri7566 | Original created by Brandon Lockaby`;
},
false
);

View File

@ -23,8 +23,6 @@ import { tree } from "./fishing/tree";
import { pick } from "./fishing/pick";
import { fid } from "./util/fid";
import { chance } from "./util/chance";
import { info } from "./general/info";
import { burger } from "./util/burger";
// import { give } from "./inventory/give";
interface ICommandGroup {
@ -38,7 +36,7 @@ export const commandGroups: ICommandGroup[] = [];
const generalGroup: ICommandGroup = {
id: "general",
displayName: "General",
commands: [help, color, myid, info]
commands: [help, color, myid]
};
commandGroups.push(generalGroup);
@ -54,7 +52,7 @@ commandGroups.push(fishingGroup);
const inventoryGroup: ICommandGroup = {
id: "inventory",
displayName: "Inventory",
commands: [inventory, take, eat, sack, pokemon, yeet, burger /* give */]
commands: [inventory, take, eat, sack, pokemon, yeet /* give */]
};
commandGroups.push(inventoryGroup);

View File

@ -1,29 +0,0 @@
import { addBack } from "@server/backs";
import Command from "@server/commands/Command";
import { getInventory, updateInventory } from "@server/data/inventory";
import { addItem } from "@server/items";
export const burger = new Command(
"burger",
["burger"],
"Get a burger",
"burger",
"command.util.burger",
async ({ id, command, args, prefix, part, user }) => {
const burger = {
id: "burger",
name: "Burger",
objtype: "item",
emoji: "🍔"
};
const inv = await getInventory(user.inventoryId);
if (!inv) return "something has gone *terribly* wrong";
addItem(inv.items as unknown as IObject[], burger);
await updateInventory(inv);
return "you now have burger";
},
false
);

View File

@ -44,8 +44,7 @@ export async function tick() {
if (r < data.chance / 10) {
// After 60 minutes, reset chance
if (data.t > Date.now() + 60 * 60000)
await resetFishingChance(user.id);
if (data.t > 60 * 60000) await resetFishingChance(user.id);
stopFishing(
winner.id,
@ -67,13 +66,7 @@ export async function tick() {
addBack(winner.id, {
m: "sendchat",
channel: winner.channel,
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)" : ""
}`,
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)" : ""}`,
isDM: winner.isDM,
id: winner.userID
});
@ -164,7 +157,7 @@ export async function getFishingChance(userID: string) {
export async function resetFishingChance(userID: string) {
const key = `fishingChance~${userID}`;
// logger.debug("Resetting fishing chance for user " + userID);
logger.debug("Resetting fishing chance for user " + userID);
await kvSet(key, {
t: Date.now(),
chance: 1

View File

@ -7,12 +7,11 @@ import { Logger } from "@util/Logger";
import { loadConfig } from "@util/config";
import { addTickEvent, removeTickEvent } from "@util/tick";
export const locations = loadConfig<TAnyLocation[]>("config/locations.yml", [
export const locations = loadConfig<ILocation[]>("config/locations.yml", [
{
id: "pond",
name: "Pond",
nearby: ["lake", "river", "sea"],
canFish: true,
hasSand: true,
objects: []
},
@ -20,7 +19,6 @@ export const locations = loadConfig<TAnyLocation[]>("config/locations.yml", [
id: "lake",
name: "Lake",
nearby: ["pond", "river", "sea"],
canFish: true,
hasSand: false,
objects: []
},
@ -28,7 +26,6 @@ export const locations = loadConfig<TAnyLocation[]>("config/locations.yml", [
id: "river",
name: "River",
nearby: ["pond", "lake", "sea"],
canFish: true,
hasSand: false,
objects: []
},
@ -36,7 +33,6 @@ export const locations = loadConfig<TAnyLocation[]>("config/locations.yml", [
id: "sea",
name: "Sea",
nearby: ["pond", "lake", "river"],
canFish: true,
hasSand: true,
objects: []
}
@ -53,10 +49,9 @@ const logger = new Logger("Places");
export function populateSand() {
for (const loc of locations) {
if (!("hasSand" in loc)) continue;
if (!loc.hasSand) continue;
let existing = loc.objects.find((obj: ILocation) => obj.id == "sand");
let existing = loc.objects.find(obj => obj.id == "sand");
if (typeof existing !== "undefined") continue;
loc.objects.push(sand);

View File

@ -9,6 +9,9 @@ export const fish: IBehaviorDefinition = {
const fish = obj as IFish;
console.log(fish)
console.log(fish.rarity);
// 50%
if (r < 0.5) {
const color = new CosmicColor(
@ -34,7 +37,7 @@ export const fish: IBehaviorDefinition = {
return {
success: true,
shouldRemove: true
};
}
}
}
}

19
src/util/types.d.ts vendored
View File

@ -101,26 +101,9 @@ interface ILocation {
name: string;
nearby: string[];
objects: IObject[];
hasSand: boolean;
}
interface IFishingLocation extends ILocation {
canFish: true;
}
interface ISandyLocation extends ILocation {
hasSand: true;
}
interface IShopLocation extends ILocation {
isShop: true;
}
type TAnyLocation =
| ILocation
| IFishingLocation
| ISandyFishingLocation
| IShopLocation;
interface TFisher {
id: string;
userID: string;