This commit is contained in:
Evert Prants 2022-04-09 22:37:09 +03:00
parent 2c46201285
commit 627aea1cb0
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
1 changed files with 19 additions and 17 deletions

View File

@ -44,6 +44,25 @@ export class Game {
// end of
this.chat.registerSendFunction((message) => {
if (message.startsWith('!party')) {
const array = message.split(' ');
const name = array.slice(2).join(' ');
if (array[1] === 'join') {
this.party.push(name);
}
if (array[1] === 'leave') {
this.party.splice(this.party.indexOf(name), 1);
}
if (array[1] === 'clear') {
this.party.length = 0;
}
localStorage.setItem('party', this.party.join('|'));
}
this.socket.emit('chat-send', message);
});
@ -163,23 +182,6 @@ export class Game {
}
private experimentalPlayerCmd(message: string, sender: string) {
if (message.startsWith('!party')) {
const [cmd, task, name] = message.split(' ', 2);
if (task === 'join') {
this.party.push(name);
}
if (task === 'leave') {
this.party.splice(this.party.indexOf(name), 1);
}
if (task === 'clear') {
this.party.length = 0;
}
localStorage.setItem('party', this.party.join('|'));
}
if (!(sender === this.me.display_name || this.party.includes(sender))) {
return;
}