UNPKG

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.

1,387 lines (1,355 loc) 108 kB
import UnifyEmitter, { EventsObject } from 'unify-emitter'; import { z } from 'zod'; /** * @packet-id "2" * @description `InitializePlayer` is a packet that contains information about a player. * @member `isMyPlayer` indicates whether the player is yours. * @member `playerName` the name of the player. * @member `maxHealth` the maximum health that the player can have. * @member `playerID` is a unique identifier for the player (similar to initID). * @member `health` the current health of the player. * @member `initID` is a unique identifier for the player. * @member `skinID` the ID or index of the player's skin. * @member `scale` indicates the size of the player. * @member `angle` indicates the direction the player is facing. * @member `x` the player's position on the x-axis. * @member `y` the player's position on the y-axis. */ declare class InitializePlayer { readonly isMyPlayer: boolean; readonly playerName: string; readonly maxHealth: number; readonly playerID: number; readonly health: number; readonly initID: string; readonly skinID: number; readonly scale: number; readonly angle: number; readonly x: number; readonly y: number; static readonly PACKET_ID = "2"; static readonly PACKET_NAME = "InitializePlayer"; readonly PACKET_NAME = "InitializePlayer"; constructor(isMyPlayer: boolean, playerName: string, maxHealth: number, playerID: number, health: number, initID: string, skinID: number, scale: number, angle: number, x: number, y: number); static parse(data: unknown): InitializePlayer; } /** * @member `buildType` The type of object the player is currently holding. If it's -1, it means the player is not holding anything. * @member `hatType` Specifies the type of hat the player is wearing, such as a boost hat or soldier hat. * @member `weaponType` The type of weapon the player has, which can be used to obtain weapon data. * @member `isBestKiller` Indicates whether the player is the best killer, shown by a skull icon. * @member `isLeader` Indicates whether the player is the owner of a clan, shown by a crown icon. * @member `weaponVariant` Shows the level of the player's weapon (such as stone, gold, etc.). * @member `tailType` Describes the type of tail the player has, like wings. * @member `angle` Indicates the direction the player is facing. * @member `layer` Represents the layer of the player. * @member `x` The player's position on the x-axis. * @member `y` The player's position on the y-axis. * @member `teamID` The ID of the player's team. */ interface PlayerData { readonly weaponVariant: number; readonly isBestKiller: boolean; readonly teamID: string | null; readonly weaponType: number; readonly buildType: number; readonly tailType: number; readonly isLeader: boolean; readonly hatType: number; readonly layer: number; readonly angle: number; readonly playerID: number; readonly x: number; readonly y: number; } /** * @packet-id "33" * @description **UpdatePlayers** is a packet that holds information about the current status of players in the game. * @member `players` a list of PlayerData * @member `PlayerData.buildType` The type of object the player is currently holding. If it's -1, it means the player is not holding anything. * @member `PlayerData.hatType` Specifies the type of hat the player is wearing, such as a boost hat or soldier hat. * @member `PlayerData.weaponType` The type of weapon the player has, which can be used to obtain weapon data. * @member `PlayerData.isBestKiller` Indicates whether the player is the best killer, shown by a skull icon. * @member `PlayerData.isLeader` Indicates whether the player is the owner of a clan, shown by a crown icon. * @member `PlayerData.weaponVariant` Shows the level of the player's weapon (such as stone, gold, etc.). * @member `PlayerData.tailType` Describes the type of tail the player has, like wings. * @member `PlayerData.angle` Indicates the direction the player is facing. * @member `PlayerData.layer` Represents the layer of the player. * @member `PlayerData.x` The player's position on the x-axis. * @member `PlayerData.y` The player's position on the y-axis. * @member `PlayerData.teamID` The ID of the player's team. */ declare class UpdatePlayers { readonly players: PlayerData[]; static readonly PACKET_ID = "33"; static readonly PACKET_NAME = "UpdatePlayers"; readonly PACKET_NAME = "UpdatePlayers"; constructor(players: PlayerData[]); static parse(data: unknown): UpdatePlayers; } interface TeamMember$1 { readonly playerName: string; readonly playerID: number; } declare class Team { readonly title: string; readonly ownerID: number; membersList: TeamMember$1[]; constructor(title: string, ownerID: number); } /** * @member `ownerID` is a special code that identifies the object who owns the object. * If the code is `-1`, it means the object is owned by the game itself, such as trees or stones. * @member `scale` indicates how big the object is. * @member `type` specifies the type of object * @member `rotation` indicates the rotation value of the object. * @member `id` serves as a unique identifier for the object. * @member `x` represents the object's position on the x-axis. * @member `y` represents the object's position on the y-axis. * @member `dataIndex` is used to fetch its meta data. */ interface GameObjectData { readonly dataIndex: number | null; readonly type: number | null; readonly rotation: number; readonly ownerID: number; readonly scale: number; readonly id: number; readonly x: number; readonly y: number; } /** * @packet-id "6" * @description **SetObjectsData** is a packet that holds information about gameObjects. * @member `objects` is a list of GameObjectData * * @member `GameObjectData.ownerID` is a special code that identifies the object who owns the object. * If the code is `-1`, it means the object is owned by the game itself, such as trees or stones. * @member `GameObjectData.scale` indicates how big the object is. * @member `GameObjectData.type` specifies the type of object * @member `GameObjectData.rotation` indicates the rotation value of the object. * @member `GameObjectData.id` serves as a unique identifier for the object. * @member `GameObjectData.x` represents the object's position on the x-axis. * @member `GameObjectData.y` represents the object's position on the y-axis. * @member `GameObjectData.dataIndex` is used to fetch its meta data. */ declare class SetObjectsData { readonly objects: GameObjectData[]; static readonly PACKET_ID = "6"; static readonly PACKET_NAME = "SetObjectsData"; readonly PACKET_NAME = "SetObjectsData"; constructor(objects: GameObjectData[]); static parse(data: unknown): SetObjectsData; } declare const _default$6: Readonly<{ readonly age: -1; readonly group: 0; readonly name: "apple"; readonly desc: "restores 20 health when consumed"; readonly req: readonly [readonly ["food", 10]]; readonly scale: 22; readonly holdOffset: 15; readonly id: 0; } | { readonly age: 3; readonly group: 0; readonly name: "cookie"; readonly desc: "restores 40 health when consumed"; readonly req: readonly [readonly ["food", 15]]; readonly scale: 27; readonly holdOffset: 15; readonly id: 1; } | { readonly age: 7; readonly group: 0; readonly name: "cheese"; readonly desc: "restores 30 health and another 50 over 5 seconds"; readonly req: readonly [readonly ["food", 25]]; readonly scale: 27; readonly holdOffset: 15; readonly id: 2; } | { readonly age: -1; readonly group: 1; readonly name: "wood wall"; readonly desc: "provides protection for your village"; readonly req: readonly [readonly ["wood", 10]]; readonly projDmg: true; readonly health: 380; readonly scale: 50; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 3; } | { readonly age: 3; readonly group: 1; readonly name: "stone wall"; readonly desc: "provides improved protection for your village"; readonly req: readonly [readonly ["stone", 25]]; readonly health: 900; readonly scale: 50; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 4; } | { readonly age: 7; readonly pre: 4; readonly group: 1; readonly name: "castle wall"; readonly desc: "provides powerful protection for your village"; readonly req: readonly [readonly ["stone", 35]]; readonly health: 1500; readonly scale: 52; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 5; } | { readonly age: -1; readonly group: 2; readonly name: "spikes"; readonly desc: "damages enemies when they touch them"; readonly req: readonly [readonly ["wood", 20], readonly ["stone", 5]]; readonly health: 400; readonly dmg: 20; readonly scale: 49; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 6; } | { readonly age: 5; readonly group: 2; readonly name: "greater spikes"; readonly desc: "damages enemies when they touch them"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 10]]; readonly health: 500; readonly dmg: 35; readonly scale: 52; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 7; } | { readonly age: 9; readonly pre: 7; readonly group: 2; readonly name: "poison spikes"; readonly desc: "poisons enemies when they touch them"; readonly req: readonly [readonly ["wood", 35], readonly ["stone", 15]]; readonly health: 600; readonly dmg: 30; readonly pDmg: 5; readonly scale: 52; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 8; } | { readonly age: 9; readonly pre: 7; readonly group: 2; readonly name: "spinning spikes"; readonly desc: "damages enemies when they touch them"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 20]]; readonly health: 500; readonly dmg: 45; readonly turnSpeed: 0.003; readonly scale: 52; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 9; } | { readonly age: -1; readonly group: 3; readonly name: "windmill"; readonly desc: "generates gold over time"; readonly req: readonly [readonly ["wood", 50], readonly ["stone", 10]]; readonly health: 400; readonly pps: 1; readonly turnSpeed: 0.0016; readonly spritePadding: 25; readonly iconLineMulti: 12; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: 5; readonly id: 10; } | { readonly age: 5; readonly pre: 10; readonly group: 3; readonly name: "faster windmill"; readonly desc: "generates more gold over time"; readonly req: readonly [readonly ["wood", 60], readonly ["stone", 20]]; readonly health: 500; readonly pps: 1.5; readonly turnSpeed: 0.0025; readonly spritePadding: 25; readonly iconLineMulti: 12; readonly scale: 47; readonly holdOffset: 20; readonly placeOffset: 5; readonly id: 11; } | { readonly age: 8; readonly pre: 11; readonly group: 3; readonly name: "power mill"; readonly desc: "generates more gold over time"; readonly req: readonly [readonly ["wood", 100], readonly ["stone", 50]]; readonly health: 800; readonly pps: 2; readonly turnSpeed: 0.005; readonly spritePadding: 25; readonly iconLineMulti: 12; readonly scale: 47; readonly holdOffset: 20; readonly placeOffset: 5; readonly id: 12; } | { readonly age: 5; readonly group: 4; readonly type: 2; readonly name: "mine"; readonly desc: "allows you to mine stone"; readonly req: readonly [readonly ["wood", 20], readonly ["stone", 100]]; readonly iconLineMulti: 12; readonly scale: 65; readonly holdOffset: 20; readonly placeOffset: 0; readonly id: 13; } | { readonly age: 5; readonly group: 11; readonly type: 0; readonly name: "sapling"; readonly desc: "allows you to farm wood"; readonly req: readonly [readonly ["wood", 150], readonly ["wood", 30]]; readonly iconLineMulti: 12; readonly colDiv: 0.5; readonly scale: 110; readonly holdOffset: 50; readonly placeOffset: -15; readonly id: 14; } | { readonly age: 4; readonly group: 5; readonly name: "pit trap"; readonly desc: "pit that traps enemies if they walk over it"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 30]]; readonly trap: true; readonly ignoreCollision: true; readonly hideFromEnemy: true; readonly health: 500; readonly colDiv: 0.2; readonly scale: 50; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 15; } | { readonly age: 4; readonly group: 6; readonly name: "boost pad"; readonly desc: "provides boost when stepped on"; readonly req: readonly [readonly ["stone", 20], readonly ["wood", 5]]; readonly ignoreCollision: true; readonly boostSpeed: 1.5; readonly health: 150; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 16; } | { readonly age: 7; readonly group: 7; readonly doUpdate: true; readonly name: "turret"; readonly desc: "defensive structure that shoots at enemies"; readonly req: readonly [readonly ["wood", 200], readonly ["stone", 150]]; readonly health: 800; readonly projectile: 1; readonly shootRange: 700; readonly shootRate: 2200; readonly scale: 43; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 17; } | { readonly age: 7; readonly group: 8; readonly name: "platform"; readonly desc: "platform to shoot over walls and cross over water"; readonly req: readonly [readonly ["wood", 20]]; readonly ignoreCollision: true; readonly zIndex: 1; readonly health: 300; readonly scale: 43; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 18; } | { readonly age: 7; readonly group: 9; readonly name: "healing pad"; readonly desc: "standing on it will slowly heal you"; readonly req: readonly [readonly ["wood", 30], readonly ["food", 10]]; readonly ignoreCollision: true; readonly healCol: 15; readonly health: 400; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 19; } | { readonly age: 9; readonly group: 10; readonly name: "spawn pad"; readonly desc: "you will spawn here when you die but it will disappear"; readonly req: readonly [readonly ["wood", 100], readonly ["stone", 100]]; readonly health: 400; readonly ignoreCollision: true; readonly spawnPoint: true; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 20; } | { readonly age: 7; readonly group: 12; readonly name: "blocker"; readonly desc: "blocks building in radius"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 25]]; readonly ignoreCollision: true; readonly blocker: 300; readonly health: 400; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 21; } | { readonly age: 7; readonly group: 13; readonly name: "teleporter"; readonly desc: "teleports you to a random point on the map"; readonly req: readonly [readonly ["wood", 60], readonly ["stone", 60]]; readonly ignoreCollision: true; readonly teleport: true; readonly health: 200; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 22; }>[]; type GameObjectEvents = { auth: PlayerType; strike: { /** * specifies the direction in which the object is moved. */ forceDirection: number; }; shoot: { /** * the turret who does the shoot */ turret: ThisType<GameObject>; /** * indicates the current angle the turret is facing (in radian). */ direction: number; }; }; /** * @member `ownerID` is a special code that identifies the object who owns the object. * If the code is `-1`, it means the object is owned by the game itself, such as trees or stones. * @member `scale` indicates how big the object is. * @member `type` specifies the type of object * @member `rotation` indicates the rotation value of the object. * @member `id` serves as a unique identifier for the object. * @member `x` represents the object's position on the x-axis. * @member `y` represents the object's position on the y-axis. * @member `dataIndex` is used to fetch its meta data. */ declare class GameObject extends UnifyEmitter<GameObjectEvents> { #private; init(gameObjectData: GameObjectData): void; clear(): void; get identity(): (typeof _default$6)[number]["name"] | "tree" | "bush" | "rock" | "gold" | "cactus" | "unknown"; __auth(playerOrPlayers: PlayerType | PlayerType[]): boolean; get isInitialized(): boolean; get dataIndex(): number | null; get rotation(): number; get ownerID(): number; get owner(): PlayerType | null; get scale(): number; get type(): number | null; get data(): Readonly<{ readonly age: -1; readonly group: 0; readonly name: "apple"; readonly desc: "restores 20 health when consumed"; readonly req: readonly [readonly ["food", 10]]; readonly scale: 22; readonly holdOffset: 15; readonly id: 0; } | { readonly age: 3; readonly group: 0; readonly name: "cookie"; /** * specifies the direction in which the object is moved. */ readonly desc: "restores 40 health when consumed"; readonly req: readonly [readonly ["food", 15]]; readonly scale: 27; readonly holdOffset: 15; readonly id: 1; /** * the turret who does the shoot */ } | { readonly age: 7; readonly group: 0; readonly name: "cheese"; readonly desc: "restores 30 health and another 50 over 5 seconds"; readonly req: readonly [readonly ["food", 25]]; readonly scale: 27; readonly holdOffset: 15; readonly id: 2; } | { readonly age: -1; readonly group: 1; readonly name: "wood wall"; readonly desc: "provides protection for your village"; readonly req: readonly [readonly ["wood", 10]]; readonly projDmg: true; readonly health: 380; readonly scale: 50; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 3; } | { readonly age: 3; readonly group: 1; readonly name: "stone wall"; readonly desc: "provides improved protection for your village"; readonly req: readonly [readonly ["stone", 25]]; readonly health: 900; readonly scale: 50; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 4; } | { readonly age: 7; readonly pre: 4; readonly group: 1; readonly name: "castle wall"; readonly desc: "provides powerful protection for your village"; readonly req: readonly [readonly ["stone", 35]]; readonly health: 1500; readonly scale: 52; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 5; } | { readonly age: -1; readonly group: 2; readonly name: "spikes"; readonly desc: "damages enemies when they touch them"; readonly req: readonly [readonly ["wood", 20], readonly ["stone", 5]]; readonly health: 400; readonly dmg: 20; readonly scale: 49; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 6; } | { readonly age: 5; readonly group: 2; readonly name: "greater spikes"; readonly desc: "damages enemies when they touch them"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 10]]; readonly health: 500; readonly dmg: 35; readonly scale: 52; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 7; } | { readonly age: 9; readonly pre: 7; readonly group: 2; readonly name: "poison spikes"; readonly desc: "poisons enemies when they touch them"; readonly req: readonly [readonly ["wood", 35], readonly ["stone", 15]]; readonly health: 600; readonly dmg: 30; readonly pDmg: 5; readonly scale: 52; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 8; } | { readonly age: 9; readonly pre: 7; readonly group: 2; readonly name: "spinning spikes"; readonly desc: "damages enemies when they touch them"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 20]]; readonly health: 500; readonly dmg: 45; readonly turnSpeed: 0.003; readonly scale: 52; readonly spritePadding: -23; readonly holdOffset: 8; readonly placeOffset: -5; readonly id: 9; } | { readonly age: -1; readonly group: 3; readonly name: "windmill"; readonly desc: "generates gold over time"; readonly req: readonly [readonly ["wood", 50], readonly ["stone", 10]]; readonly health: 400; readonly pps: 1; readonly turnSpeed: 0.0016; readonly spritePadding: 25; readonly iconLineMulti: 12; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: 5; readonly id: 10; } | { readonly age: 5; readonly pre: 10; readonly group: 3; readonly name: "faster windmill"; readonly desc: "generates more gold over time"; readonly req: readonly [readonly ["wood", 60], readonly ["stone", 20]]; readonly health: 500; readonly pps: 1.5; readonly turnSpeed: 0.0025; readonly spritePadding: 25; readonly iconLineMulti: 12; readonly scale: 47; readonly holdOffset: 20; readonly placeOffset: 5; readonly id: 11; } | { readonly age: 8; readonly pre: 11; readonly group: 3; readonly name: "power mill"; readonly desc: "generates more gold over time"; readonly req: readonly [readonly ["wood", 100], readonly ["stone", 50]]; readonly health: 800; readonly pps: 2; readonly turnSpeed: 0.005; readonly spritePadding: 25; readonly iconLineMulti: 12; readonly scale: 47; readonly holdOffset: 20; readonly placeOffset: 5; readonly id: 12; } | { readonly age: 5; readonly group: 4; readonly type: 2; readonly name: "mine"; readonly desc: "allows you to mine stone"; readonly req: readonly [readonly ["wood", 20], readonly ["stone", 100]]; readonly iconLineMulti: 12; readonly scale: 65; readonly holdOffset: 20; readonly placeOffset: 0; readonly id: 13; } | { readonly age: 5; readonly group: 11; readonly type: 0; readonly name: "sapling"; readonly desc: "allows you to farm wood"; readonly req: readonly [readonly ["wood", 150], readonly ["wood", 30]]; readonly iconLineMulti: 12; readonly colDiv: 0.5; readonly scale: 110; readonly holdOffset: 50; readonly placeOffset: -15; readonly id: 14; } | { readonly age: 4; readonly group: 5; readonly name: "pit trap"; readonly desc: "pit that traps enemies if they walk over it"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 30]]; readonly trap: true; readonly ignoreCollision: true; readonly hideFromEnemy: true; readonly health: 500; readonly colDiv: 0.2; readonly scale: 50; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 15; } | { readonly age: 4; readonly group: 6; readonly name: "boost pad"; readonly desc: "provides boost when stepped on"; readonly req: readonly [readonly ["stone", 20], readonly ["wood", 5]]; readonly ignoreCollision: true; readonly boostSpeed: 1.5; readonly health: 150; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 16; } | { readonly age: 7; readonly group: 7; readonly doUpdate: true; readonly name: "turret"; readonly desc: "defensive structure that shoots at enemies"; readonly req: readonly [readonly ["wood", 200], readonly ["stone", 150]]; readonly health: 800; readonly projectile: 1; readonly shootRange: 700; readonly shootRate: 2200; readonly scale: 43; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 17; } | { readonly age: 7; readonly group: 8; readonly name: "platform"; readonly desc: "platform to shoot over walls and cross over water"; readonly req: readonly [readonly ["wood", 20]]; readonly ignoreCollision: true; readonly zIndex: 1; readonly health: 300; readonly scale: 43; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 18; } | { readonly age: 7; readonly group: 9; readonly name: "healing pad"; readonly desc: "standing on it will slowly heal you"; readonly req: readonly [readonly ["wood", 30], readonly ["food", 10]]; readonly ignoreCollision: true; readonly healCol: 15; readonly health: 400; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 19; } | { readonly age: 9; readonly group: 10; readonly name: "spawn pad"; readonly desc: "you will spawn here when you die but it will disappear"; readonly req: readonly [readonly ["wood", 100], readonly ["stone", 100]]; readonly health: 400; readonly ignoreCollision: true; readonly spawnPoint: true; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 20; } | { readonly age: 7; readonly group: 12; readonly name: "blocker"; readonly desc: "blocks building in radius"; readonly req: readonly [readonly ["wood", 30], readonly ["stone", 25]]; readonly ignoreCollision: true; readonly blocker: 300; readonly health: 400; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 21; } | { readonly age: 7; readonly group: 13; readonly name: "teleporter"; readonly desc: "teleports you to a random point on the map"; readonly req: readonly [readonly ["wood", 60], readonly ["stone", 60]]; readonly ignoreCollision: true; readonly teleport: true; readonly health: 200; readonly colDiv: 0.7; readonly scale: 45; readonly holdOffset: 20; readonly placeOffset: -5; readonly id: 22; }> | null; get id(): number; get x(): number; get y(): number; } interface PlayerEvents { move: { /** * The direction where the player is moving (in radians) */ direction: number; /** * The player instance */ player: ThisType<Player<PlayerEvents>>; /** * player position on y-axis */ y: number; /** * player position on x-axis */ x: number; }; rotate: { /** * The angle where the player is facing (in radians) */ angle: number; /** * The player instance */ player: ThisType<Player<PlayerEvents>>; }; punch: { /** * the punch direction (in radians) */ direction: number; /** * tells if the player successfully hit something */ didHit: boolean; /** * The player instance */ player: ThisType<Player<PlayerEvents>>; }; chat: { /** * the content of message the player sent */ message: string; /** * The player instance of who sent the message */ player: ThisType<Player<PlayerEvents>>; }; healthChange: { /** * a boolean value indicating whether the player is healing or taking damage. */ isHealing: boolean; /** * a positive number representing the magnitude of the health change. */ amount: number; /** * the player instance who initiated the health change. */ player: ThisType<Player<PlayerEvents>>; }; hatChange: { /** * The previous hat Id that the player was wearing. */ previous: number; /** * The current hat Id that the player is wearing. */ current: number; /** * The player instance who initiated the hat change. */ player: ThisType<Player<PlayerEvents>>; }; tailChange: { /** * The previous accessory Id that the player was wearing. */ previous: number; /** * The current accessory Id that the player is wearing. */ current: number; /** * the player instance who initiated the health change. */ player: ThisType<Player<PlayerEvents>>; }; place: GameObject; destroyed: null; update: ThisType<Player<PlayerEvents>>; } /** * @member `buildType` The type of object the player is currently holding. If it's -1, it means the player is not holding anything. * @member `hatType` Specifies the type of hat the player is wearing, such as a boost hat or soldier hat. * @member `weaponType` The type of weapon the player has, which can be used to obtain weapon data. * @member `isBestKiller` Indicates whether the player is the best killer, shown by a skull icon. * @member `isLeader` Indicates whether the player is the owner of a clan, shown by a crown icon. * @member `weaponVariant` Shows the level of the player's weapon (such as stone, gold, etc.). * @member `playerID` is a unique identifier for the player (similar to initID). * @member `tailType` Describes the type of tail the player has, like wings. * @member `maxHealth` the maximum health that the player can have. * @member `angle` indicates the direction the player is facing. * @member `isMyPlayer` indicates whether the player is yours. * @member `initID` is a unique identifier for the player. * @member `skinID` the ID or index of the player's skin. * @member `layer` Represents the layer of the player. * @member `health` the current health of the player. * @member `scale` indicates the size of the player. * @member `x` the player's position on the x-axis. * @member `y` the player's position on the y-axis. * @member `teamID` The ID of the player's team. * @member `playerName` the name of the player. * @member `isInitialized` tells where or not a player have basic information like `id`, `name`, `skinID`, ...etc */ type PlayerType = Player<PlayerEvents>; declare class Player<T extends PlayerEvents> extends UnifyEmitter<EventsObject<PlayerEvents, T>> { #private; initialize(initializePlayer: InitializePlayer): void; update(playerData: PlayerData): void; clear(): void; get weaponVariant(): number; get isInitialized(): boolean; get isBestKiller(): boolean; get tailType(): number; get hatType(): number; get weaponType(): number; get isMyPlayer(): boolean; get playerName(): string; get health(): number; get buildType(): number; get maxHealth(): number; get angle(): number; get isLeader(): boolean; get playerID(): number; get teamID(): string | null; get initID(): string; get skinID(): number; get layer(): number; get scale(): number; get x(): number; get y(): number; setHealth(health: number): void; getTeam(teams: Map<string, Team>): Team | null; } interface ObservedPacket { PACKET_ID: string; current: number; max: number; is(content: Uint8Array): boolean; } declare class AntiKick { observePackets: ObservedPacket[]; interval: NodeJS.Timeout; constructor(); destroy(): void; restart(): void; canSend(content: Uint8Array): boolean; static runObservePacket(observePacket: ObservedPacket): boolean; static resetObservePacket(observePacket: ObservedPacket): void; } /** * @member `playerID` is a unique identifier for the player (similar to initID). * @member `playerName` the name of the player. */ interface TeamMember { readonly playerName: string; readonly playerID: number; } /** * @packet-id "sa" * @description **UpdateTeamMembersList** is a packet that holds information about the current status of Team Members List in the game. * @member `members` is a list of TeamMember * * @member `TeamMember.playerID` is a unique identifier for the player (similar to initID). * @member `TeamMember.playerName` the name of the player. */ declare class UpdateTeamMembersList { readonly members: TeamMember[]; static readonly PACKET_ID = "sa"; static readonly PACKET_NAME = "UpdateTeamMembersList"; readonly PACKET_NAME = "UpdateTeamMembersList"; constructor(members: TeamMember[]); static parse(data: unknown): UpdateTeamMembersList; } /** * @member `score` indicates the player's gold score. * @member `name` indicates the player's name. * @member `id` a special code that uniquely identifies the player. */ interface LeaderBoardMember { readonly score: number; readonly name: string; readonly id: number; } /** * @packet-id "5" * @description **UpdateLeaderBoard** is a packet that holds information about the current status of LeaderBoard in the game. * @member `members` is a list of LeaderBoardMember * * @member `LeaderBoardMember.score` indicates the player's gold score. * @member `LeaderBoardMember.name` indicates the player's name. * @member `LeaderBoardMember.id` a special code that uniquely identifies the player. */ declare class UpdateLeaderBoard { readonly members: LeaderBoardMember[]; static readonly PACKET_ID = "5"; static readonly PACKET_NAME = "UpdateLeaderBoard"; readonly PACKET_NAME = "UpdateLeaderBoard"; constructor(members: LeaderBoardMember[]); static parse(data: unknown): UpdateLeaderBoard; } /** * @packet-id "4" * @description **PlayerDisconnect** informs you about the player who left the game. * @member `initID` serves as a unique identifier to identify the player who left the game. */ declare class PlayerDisconnect { readonly initID: string; static readonly PACKET_ID = "4"; static readonly PACKET_NAME = "PlayerDisconnect"; readonly PACKET_NAME = "PlayerDisconnect"; constructor(initID: string); static parse(data: unknown): PlayerDisconnect; } /** * @packet-id "an" * @description **TeamNotification** is an invitation you receive from a player asking you to join your clan. * (You can only receive this message if you own the clan you are in.) * @member `playerName` refers to the name of the player who asked to join. * @member `playerID` is a unique identifier for the player who asked to join. */ declare class TeamNotification { readonly playerID: number; readonly playerName: string; static readonly PACKET_ID = "an"; static readonly PACKET_NAME = "TeamNotification"; readonly PACKET_NAME = "TeamNotification"; constructor(playerID: number, playerName: string); static parse(data: unknown): TeamNotification; } /** * @member `ownerID` is a unique identifier for the player who created and owns the team. * @member `title` is the title of the team. */ interface TeamData { readonly ownerID: number; readonly title: string; } /** * @packet-id "id" * @description **InitializeTeams** is a signal carries the teams that already been created. * @member `teams` is a list of TeamData * * @member `TeamData.ownerID` is a unique identifier for the player who created and owns the team. * @member `TeamData.title` is the title of the team. */ declare class InitializeTeams { readonly teams: TeamData[]; static readonly PACKET_ID = "id"; static readonly PACKET_NAME = "InitializeTeams"; readonly PACKET_NAME = "InitializeTeams"; constructor(teams: TeamData[]); static parse(data: unknown): InitializeTeams; } /** * @packet-id "18" * @description **SpawnProjectile** is a signal that shows a projectile has been made. * @member `range` shows how far the projectile can go. * @member `speed` shows how fast the projectile moves. * @member `direction` shows the direction the projectile is going (in radians). * @member `originX` shows where the projectile starts on the x-axis. * @member `originY` shows where the projectile starts on the y-axis. * @member `fireDate` shows the time when the projectile was fired (in milliseconds). * @member `layer` shows the level the projectile is on (it won't be stopped by objects that is on lower levels). * @member `type` shows the type of projectile. that can be used to get projectile meta data. * @member `projectileID` unique identifier for the projectile. */ declare class SpawnProjectile { readonly range: number; readonly speed: number; readonly layer: number; readonly type: number; readonly direction: number; readonly projectileID: number; readonly originX: number; readonly originY: number; readonly fireDate: number; static readonly PACKET_ID = "18"; static readonly PACKET_NAME = "SpawnProjectile"; readonly PACKET_NAME = "SpawnProjectile"; constructor(range: number, speed: number, layer: number, type: number, direction: number, projectileID: number, originX: number, originY: number, fireDate: number); static parse(data: unknown): SpawnProjectile; } /** * @packet-id "us" * @description **UpdateItemStore** signal is used to handle the process of paying for and equipping items in the store. * * @member `method` Indicates whether the action is a "Purchased" or "Equipped". * @member `type` Specifies the type of item being updated, either "Accessory" or "Hat". * @member `itemID` A unique code that identifies the specific item that has been changed. */ declare class UpdateItemStore { readonly method: "Purchased" | "Equipped"; readonly type: "Accessory" | "Hat"; readonly itemID: number; static readonly PACKET_ID = "us"; static readonly PACKET_NAME = "UpdateItemStore"; readonly PACKET_NAME = "UpdateItemStore"; constructor(method: "Purchased" | "Equipped", type: "Accessory" | "Hat", itemID: number); static parse(data: unknown): UpdateItemStore; } /** * @packet-id "14" * @description **UpdateItemUsage** is used to update the **item usage**. * @member `itemID` serves as a unique identifier for placable items such as traps, spikes, and windmills. * @member `count` indicates the number of instances your player has placed for that particular item. */ declare class UpdateItemUsage { readonly itemID: number; readonly count: number; static readonly PACKET_ID = "14"; static readonly PACKET_NAME = "UpdateItemUsage"; readonly PACKET_NAME = "UpdateItemUsage"; constructor(itemID: number, count: number); static parse(data: unknown): UpdateItemUsage; } /** * @packet-id "1" * @description **InitializeGame** is a signal carries your player id. * @member `MyPlayerID` is the unique identifier for your player. */ declare class InitializeGame { readonly MyPlayerID: number; static readonly PACKET_ID = "1"; static readonly PACKET_NAME = "InitializeGame"; readonly PACKET_NAME = "InitializeGame"; constructor(MyPlayerID: number); static parse(data: unknown): InitializeGame; } /** * @packet-id "20" * @description **ShutdownNotice** is a message for your player that tells you the server is going to shut down. * @param `minutes` indicates the number of minutes left before the shutdown. * @param `seconds` indicates the number of seconds left before the shutdown. */ declare class ShutdownNotice { readonly minutes: number; readonly seconds: number; static readonly PACKET_ID = "20"; static readonly PACKET_NAME = "ShutdownNotice"; readonly PACKET_NAME = "ShutdownNotice"; constructor(minutes: number, seconds: number); static parse(data: unknown): ShutdownNotice; } /** * @packet-id "15" * @description **UpdateProgress** is a message that informs the player about their progress. * @member `currentAge?` refers to the player's current age. * @member `currentXP` refers to the player's current experience points (xp). * @member `progress?` indicates the player's progress as a percentage. * @member `maxXP?` represents the maximum amount of experience points required for the player to advance to the next age. */ declare class UpdateProgress { readonly currentAge: number | undefined; readonly currentXP: number; readonly maxXP: number | undefined; static readonly PACKET_ID = "15"; static readonly PACKET_NAME = "UpdateProgress"; readonly PACKET_NAME = "UpdateProgress"; constructor(currentAge: number | undefined, currentXP: number, maxXP: number | undefined); static parse(data: unknown): UpdateProgress; } type resourceType = z.infer<typeof resourceTypeSchema>; declare const resourceTypeSchema: z.ZodUnion<[z.ZodLiteral<"wood">, z.ZodLiteral<"food">, z.ZodLiteral<"stone">, z.ZodLiteral<"points">, z.ZodLiteral<"kills">]>; /** * @packet-id "9" * @description **UpdateResource** is a signal contains information about a new resource value. * @member `resourceType` indicates the type of resource being updated, such as food, wood, etc. * @member `resourceValue` represents the new value of that resource. */ declare class UpdateResource { readonly resourceType: resourceType; readonly resourceValue: number; static readonly PACKET_ID = "9"; static readonly PACKET_NAME = "UpdateResource"; readonly PACKET_NAME = "UpdateResource"; constructor(resourceType: resourceType, resourceValue: number); static parse(data: unknown): UpdateResource; } /** * @packet-id "16" * @description **UpdateUpgrades** provides information to the player about their upgrade abilities. * * @member {number} upgradeLevel - The upgrade level that the player can reach. * @member {number} currentUpgradeLevel - The current upgrade level of the player. * * @depth upgradeLevel is how many upgrades your player can do */ declare class UpdateUpgrades { readonly upgradeLevel: number; readonly currentUpgradeLevel: number; static readonly PACKET_ID = "16"; static readonly PACKET_NAME = "UpdateUpgrades"; readonly PACKET_NAME = "UpdateUpgrades"; constructor(upgradeLevel: number, currentUpgradeLevel: number); static parse(data: unknown): UpdateUpgrades; } /** * @packet-id "aa" * @description The purpose of **AnimateGameAI** is to let you know how to animate a GameAI (usually used for Mustafa's attack). * @member `gameAIID` is a unique identifier for the gameAI. */ declare class AnimateGameAI { readonly gameAIID: number; static readonly PACKET_ID = "aa"; static readonly PACKET_NAME = "AnimateGameAI"; readonly PACKET_NAME = "AnimateGameAI"; constructor(gameAIID: number); static parse(data: unknown): AnimateGameAI; } /** * @packet-id "13" * @description **RemoveObjects** tells the player which objects to clean * @member `ownerID` is a special code that identifies the player who owns the objects. * This is helpful for removing many objects at the same time. */ declare class RemoveObjects { readonly ownerID: number; static readonly PACKET_ID = "13"; static readonly PACKET_NAME = "RemoveObjects"; readonly PACKET_NAME = "RemoveObjects"; constructor(ownerID: number); static parse(data: unknown): RemoveObjects; } /** * @member `x` represents the point's position on the x-axis. * @member `y` represents the point's position on the y-axis. */ interface Point2D { readonly x: number; readonly y: number; } /** * @packet-id "mm" * @description **UpdateMiniMap** is a packet that holds information about the current status of mini map in the game. * @member `points` is a list of Point2D (each point is teammate position) * * @member `Point2D.x` represents the point's position on the x-axis. * @member `Point2D.y` represents the point's position on the y-axis. */ declare class UpdateMiniMap { readonly points: Point2D[]; static readonly PACKET_ID = "mm"; static readonly PACKET_NAME = "UpdateMiniMap"; readonly PACKET_NAME = "UpdateMiniMap"; constructor(points: Point2D[]); static parse(data: unknown): UpdateMiniMap; } /** * @packet-id "8" * @description **ObjectStrike** is a signal that indicates when a player has successfully hit an gameObject. * @member `forceDirection` specifies the direction in which the object is moved. * @member `objectID` is a unique identifier for the object who got hit. */ declare class ObjectStrike { readonly forceDirection: number; readonly objectID: number; static readonly PACKET_ID = "8"; static readonly PACKET_NAME = "ObjectStrike"; readonly PACKET_NAME = "ObjectStrike"; constructor(forceDirection: number, objectID: number); static parse(data: unknown): ObjectStrike; } /** * @packet-id "12" * @description **RemoveObject** instructs which object need to be removed. This usually means that the object has been **destroyed**. * @member `objectID` is a special number that helps identify the object that needs to be removed. */ declare class RemoveObject { readonly objectID: number; static readonly PACKET_ID = "12"; static readonly PACKET_NAME = "RemoveObject"; readonly PACKET_NAME = "RemoveObject"; constructor(objectID: number); static parse(data: unknown): RemoveObject; } /** * @member `uniqueName` If the AI is a cow or pig, this field will contain the name of the cow or pig. * Otherwise, it will be `null`. * @member `health` This field indicates the current health of the AI.. * @member `type` specifies the type of AI, which is used to fetch his meta data. * @member `rotation` indicates the rotation value of the AI. * @member `id` serves as a unique identifier for the AI. * @member `x` represents the player's position on the x-axis. * @member `y` represents the player's position on the y-axis. */ interface GameAIData { readonly uniqueName: string | null; readonly health: number; readonly type: number; readonly rotation: number; readonly id: number; readonly x: number; readonly y: number; } /** * @packet-id "a" * @description **UpdateGameAI** is a packet that holds information about the current status of gameAI in the game. * @member `data` a list of PlayerData * * @member `GameAIData.uniqueName` If the AI is a cow or pig, this field will contain the name of the cow or pig. * Otherwise, it will be `null`. * @member `GameAIData.health` This field indicates the current health of the AI.. * @member `GameAIData.type` specifies the type of AI, which is used to fetch his meta data. * @member `GameAIData.rotation` indicates the rotation value of the AI. * @member `GameAIData.id` serves as a unique identifier for the AI. * @member `GameAIData.x` represents the player's position on the x-axis. * @member `GameAIData.y` represents the player's position on the y-axis. */ declare class UpdateGameAI { readonly data: GameAIData[]; static readonly PACKET_ID = "a"; static readonly PACKET_NAME = "UpdateGameAI"; readonly PACKET_NAME = "UpdateGameAI"; constructor(data: GameAIData[]); static parse(data: unknown): UpdateGameAI; } /** * @packet-id "h" * @description **UpdateHealth** is a signal that contains information about a player's new health. * @member `playerID` is a special code that identifies the player whose health has changed. * @member `playerHealth` represents the player's updated health value. */ declare class UpdateHealth { readonly playerID: number; readonly playerHealth: number; static readonly PACKET_ID = "h"; static readonly PACKET_NAME = "UpdateHealth"; readonly PACKET_NAME = "UpdateHealth"; constructor(playerID: number, playerHealth: number); static parse(data: unknown): UpdateHealth; } /** * @packet-id "ch" * @description **ReceiveChat** is a signal that is received when someone nearby