moomooio-client
Version:
MooMooIO-Client is a client-side wrapper API designed for the game MooMoo.io. This package aims to provide a simple yet powerful API for creating clones, mods, or plugins for MooMoo.io.
27 lines (21 loc) • 832 B
text/typescript
import { z } from "zod";
const schema = z.union([
z.tuple([z.array(z.number()), z.number()]),
z.tuple([z.array(z.number())]),
]);
/**
* @packet-id "17"
* @description The **UpdateItems** class represents a signal that provides information about a player's kit.
* @member `kit` - An array of item IDs.
* @member `isWeapon` - Indicates whether the kit belongs to weapons category or items category.
*/
export default class UpdateItems {
public static readonly PACKET_ID = "17";
public static readonly PACKET_NAME = "UpdateItems";
public readonly PACKET_NAME = "UpdateItems";
constructor(readonly kit: number[], readonly isWeapon: boolean) {}
static parse(data: unknown): UpdateItems {
const [kit, isWeapon] = schema.parse(data);
return new UpdateItems(kit, !!isWeapon);
}
}