Start economy stuff
This commit is contained in:
parent
aef1e208a4
commit
8296e6942f
|
@ -3,4 +3,5 @@ desiredUser:
|
|||
color: "#1d0054"
|
||||
agents:
|
||||
wss://mppclone.com:
|
||||
- id: "✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧"
|
||||
# - id: "✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧"
|
||||
- id: "wizardposting"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import { Item, StackableItem } from "../../../economy/Item";
|
||||
import { Command } from "../../Command";
|
||||
import { CommandHandler } from "../../CommandHandler";
|
||||
|
||||
export const inventory = new Command(
|
||||
"inventory",
|
||||
["inventory", "inv"],
|
||||
"get bozo's inventory",
|
||||
"inventory",
|
||||
(msg, agent) => {
|
||||
const items = msg.inventory.items as unknown as Item[];
|
||||
const list = items
|
||||
.map(
|
||||
i =>
|
||||
`${i.name}${
|
||||
(i as StackableItem).count
|
||||
? " " + (i as StackableItem).count
|
||||
: ""
|
||||
}`
|
||||
)
|
||||
.join(" | ");
|
||||
|
||||
return `Items: ${list ? list : "(none)"}`;
|
||||
}
|
||||
);
|
|
@ -0,0 +1,17 @@
|
|||
import { MPPAgent } from "../../../services/mpp";
|
||||
import { Command } from "../../Command";
|
||||
|
||||
export const cursor = new Command(
|
||||
"cursor",
|
||||
["cursor"],
|
||||
"set the cursor bozo",
|
||||
"cursor",
|
||||
(msg, agent) => {
|
||||
if (!(agent as MPPAgent).client.isConnected) return;
|
||||
if (!msg.argv[1]) return "Specify a mode.";
|
||||
|
||||
const cursor = (agent as MPPAgent).cursor;
|
||||
cursor.props.currentAnimation = msg.argv[1];
|
||||
},
|
||||
false
|
||||
);
|
|
@ -6,13 +6,19 @@ import { id } from "./commands/utility/id";
|
|||
import { msg } from "./commands/utility/msg";
|
||||
import { math } from "./commands/utility/math";
|
||||
import { memory } from "./commands/utility/memory";
|
||||
import { cursor } from "./commands/utility/cursor";
|
||||
import { inventory } from "./commands/economy/inventory";
|
||||
|
||||
export function loadCommands() {
|
||||
const general = new CommandGroup("general", "⭐ General");
|
||||
general.addCommands([help, about]);
|
||||
CommandHandler.addCommandGroup(general);
|
||||
|
||||
const economy = new CommandGroup("economy", "💸 Economy");
|
||||
economy.addCommands([inventory]);
|
||||
CommandHandler.addCommandGroup(economy);
|
||||
|
||||
const utility = new CommandGroup("utility", "🔨 Utility");
|
||||
utility.addCommands([math, memory, id, msg]);
|
||||
utility.addCommands([math, memory, id, msg, cursor]);
|
||||
CommandHandler.addCommandGroup(utility);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
export interface Item {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface StackableItem extends Item {
|
||||
count: number;
|
||||
}
|
|
@ -25,7 +25,7 @@ export class Cursor {
|
|||
public updateInterval: NodeJS.Timeout;
|
||||
|
||||
public props: CursorProps = {
|
||||
currentAnimation: "lemniscate",
|
||||
currentAnimation: "test2",
|
||||
position: {
|
||||
x: 50,
|
||||
y: 50
|
||||
|
@ -35,8 +35,8 @@ export class Cursor {
|
|||
y: 0
|
||||
},
|
||||
velocity: {
|
||||
x: 0,
|
||||
y: 0
|
||||
x: 2 / 5,
|
||||
y: 2 / 7
|
||||
},
|
||||
acceleration: {
|
||||
x: 0,
|
||||
|
@ -112,6 +112,7 @@ export class Cursor {
|
|||
this.props.position.x >= 105
|
||||
) {
|
||||
this.props.position.x = 50;
|
||||
this.props.velocity.x = 0;
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -119,6 +120,64 @@ export class Cursor {
|
|||
this.props.position.y >= 105
|
||||
) {
|
||||
this.props.position.y = 50;
|
||||
this.props.velocity.y = 0;
|
||||
}
|
||||
|
||||
this.props.ot = Date.now();
|
||||
break;
|
||||
case "bounce2":
|
||||
this.props.oldPosition.x = this.props.position.x;
|
||||
this.props.oldPosition.y = this.props.position.y;
|
||||
this.props.t = Date.now();
|
||||
this.props.dt = (this.props.t - this.props.ot) / 1000;
|
||||
|
||||
this.props.acceleration.x = Math.random() * 100 - 50;
|
||||
|
||||
if (this.props.position.y < 75) {
|
||||
this.props.acceleration.y =
|
||||
Math.random() * 100 - 50 - this.props.gravity;
|
||||
} else {
|
||||
this.props.acceleration.y = -(Math.random() * 50);
|
||||
}
|
||||
|
||||
this.props.velocity.x +=
|
||||
this.props.acceleration.x * this.props.dt;
|
||||
this.props.velocity.y +=
|
||||
this.props.acceleration.y * this.props.dt;
|
||||
|
||||
this.props.position.x +=
|
||||
this.props.velocity.x * this.props.dt;
|
||||
this.props.position.y +=
|
||||
this.props.velocity.y * this.props.dt;
|
||||
|
||||
if (
|
||||
this.props.position.x >= 100 ||
|
||||
this.props.position.x <= 0
|
||||
) {
|
||||
this.props.velocity.x = -this.props.velocity.x;
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.position.y >= 100 ||
|
||||
this.props.position.y <= 0
|
||||
) {
|
||||
this.props.velocity.y = -this.props.velocity.y;
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.position.x <= -5 ||
|
||||
this.props.position.x >= 105
|
||||
) {
|
||||
this.props.position.x = 50;
|
||||
this.props.velocity.x = 0;
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.position.y <= -5 ||
|
||||
this.props.position.y >= 105
|
||||
) {
|
||||
this.props.position.y = 50;
|
||||
this.props.velocity.y = 0;
|
||||
}
|
||||
|
||||
this.props.ot = Date.now();
|
||||
|
@ -156,6 +215,7 @@ export class Cursor {
|
|||
this.props.position.x >= 105
|
||||
) {
|
||||
this.props.position.x = 50;
|
||||
this.props.velocity.x = 0;
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -163,6 +223,7 @@ export class Cursor {
|
|||
this.props.position.y >= 105
|
||||
) {
|
||||
this.props.position.y = 50;
|
||||
this.props.velocity.y = 0;
|
||||
}
|
||||
|
||||
this.props.ot = Date.now();
|
||||
|
@ -181,6 +242,59 @@ export class Cursor {
|
|||
10 +
|
||||
50;
|
||||
|
||||
break;
|
||||
case "test":
|
||||
if (!this.props.angles[0]) this.props.angles[0] = 0;
|
||||
|
||||
this.props.angles[0] += 2;
|
||||
if (this.props.angles[0] > 360) this.props.angles[0] = 0;
|
||||
|
||||
this.props.position.x =
|
||||
Math.cos(this.props.angles[0] * (Math.PI / 180)) * 10 +
|
||||
50;
|
||||
this.props.position.y =
|
||||
Math.sin(this.props.angles[0] * (Math.PI / 180) * 2) *
|
||||
10 +
|
||||
50;
|
||||
|
||||
break;
|
||||
case "test2":
|
||||
this.props.oldPosition.x = this.props.position.x;
|
||||
this.props.oldPosition.y = this.props.position.y;
|
||||
this.props.t = Date.now();
|
||||
this.props.dt = (this.props.t - this.props.ot) / 1000;
|
||||
|
||||
if (this.props.velocity.x > 10)
|
||||
this.props.velocity.x = 2 / 5;
|
||||
if (this.props.velocity.x < -10)
|
||||
this.props.velocity.x = -(2 / 5);
|
||||
if (this.props.velocity.y > 10)
|
||||
this.props.velocity.y = 2 / 7;
|
||||
if (this.props.velocity.y < -10)
|
||||
this.props.velocity.y = -(2 / 7);
|
||||
|
||||
this.props.position.x +=
|
||||
this.props.velocity.x * this.props.dt * 10;
|
||||
this.props.position.y +=
|
||||
this.props.velocity.y * this.props.dt * 10;
|
||||
|
||||
if (
|
||||
this.props.position.x >= 100 ||
|
||||
this.props.position.x <= 0
|
||||
) {
|
||||
this.props.velocity.x = -this.props.velocity.x;
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.position.y >= 100 ||
|
||||
this.props.position.y <= 0
|
||||
) {
|
||||
this.props.velocity.y = -this.props.velocity.y;
|
||||
console.log(this.props.velocity, "setting!!!");
|
||||
}
|
||||
|
||||
this.props.ot = Date.now();
|
||||
|
||||
break;
|
||||
}
|
||||
}, 1000 / 60);
|
||||
|
|
Loading…
Reference in New Issue