Add note quota user flag
This commit is contained in:
parent
0ad1af0935
commit
9d84c5f81b
|
@ -16,6 +16,7 @@ import { Socket } from "../ws/Socket";
|
||||||
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
|
||||||
declare type UserFlags = Partial<{
|
declare type UserFlags = Partial<{
|
||||||
|
// Brandon flags
|
||||||
freeze_name: number;
|
freeze_name: number;
|
||||||
"no chat rate limit": number;
|
"no chat rate limit": number;
|
||||||
chat_curse_1: number;
|
chat_curse_1: number;
|
||||||
|
@ -24,6 +25,11 @@ declare type UserFlags = Partial<{
|
||||||
volume: number;
|
volume: number;
|
||||||
cant_chat: number;
|
cant_chat: number;
|
||||||
cansetcrowns: number;
|
cansetcrowns: number;
|
||||||
|
|
||||||
|
// new
|
||||||
|
"no note rate limit": number;
|
||||||
|
"no cursor rate limit": number;
|
||||||
|
"no userset rate limit": number;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
declare interface Tag {
|
declare interface Tag {
|
||||||
|
|
|
@ -38,7 +38,24 @@ export const n: ServerEventListener<"n"> = {
|
||||||
if ((crownsolo && socket.isOwner()) || !crownsolo) {
|
if ((crownsolo && socket.isOwner()) || !crownsolo) {
|
||||||
// Shiny hat exists and we have shiny hat
|
// Shiny hat exists and we have shiny hat
|
||||||
// or there is no shiny hat
|
// or there is no shiny hat
|
||||||
|
const flags = socket.getUserFlags();
|
||||||
|
let canPlay = false;
|
||||||
|
let shouldRateLimit = true;
|
||||||
|
|
||||||
|
// why is this so big
|
||||||
|
|
||||||
|
if (flags !== null && flags["no note rate limit"]) {
|
||||||
|
canPlay = true;
|
||||||
|
shouldRateLimit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldRateLimit) {
|
||||||
if (socket.noteQuota.spend(amount)) {
|
if (socket.noteQuota.spend(amount)) {
|
||||||
|
canPlay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canPlay) {
|
||||||
// make noise
|
// make noise
|
||||||
socket.playNotes(msg);
|
socket.playNotes(msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue