teeeest
This commit is contained in:
parent
2c46201285
commit
627aea1cb0
@ -44,6 +44,25 @@ export class Game {
|
|||||||
// end of
|
// end of
|
||||||
|
|
||||||
this.chat.registerSendFunction((message) => {
|
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);
|
this.socket.emit('chat-send', message);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -163,23 +182,6 @@ export class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private experimentalPlayerCmd(message: string, sender: string) {
|
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))) {
|
if (!(sender === this.me.display_name || this.party.includes(sender))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user