mooball
    Preparing search index...

    Interface FakeEventTriggers

    These functions are intended to be used in host mode to create/control in-memory bot players that will run much more efficiently than standard networking bot players. They also work for normal player objects, and can be used to create some events belonging to a player that did not originate from that player. Most of these fake events also trigger an onOperationReceived call before being sent to clients.

    interface FakeEventTriggers {
        fakeAutoTeams(byId: number): void;
        fakeKickPlayer(
            playerId: number,
            reason: string | null,
            ban: boolean,
            byId: number,
        ): void;
        fakePlayerJoin(
            id: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
        ): void;
        fakePlayerLeave(
            id: number,
        ): {
            auth: string;
            avatar: string;
            conn: string;
            flag: string;
            id: number;
            name: string;
        };
        fakeSendPlayerChat(msg: string, byId: number): void;
        fakeSendPlayerInput(input: number, byId: number): void;
        fakeSetGamePaused(value: boolean, byId: number): void;
        fakeSetKickRateLimit(
            min: number,
            rate: number,
            burst: number,
            byId: number,
        ): void;
        fakeSetPlayerAdmin(playerId: number, value: boolean, byId: number): void;
        fakeSetPlayerAvatar(value: string, byId: number): void;
        fakeSetPlayerChatIndicator(value: boolean, byId: number): void;
        fakeSetPlayerSync(value: boolean, byId: number): void;
        fakeSetPlayerTeam(playerId: number, teamId: number, byId: number): void;
        fakeSetScoreLimit(value: number, byId: number): void;
        fakeSetStadium(value: IStadium, byId: number): void;
        fakeSetTeamColors(
            teamId: number,
            angle: number,
            colors: number[],
            byId: number,
        ): void;
        fakeSetTeamsLock(value: boolean, byId: number): void;
        fakeSetTimeLimit(value: number, byId: number): void;
        fakeStartGame(byId: number): void;
        fakeStopGame(byId: number): void;
    }
    Index

    Methods

    • Triggers a fake auto teams event that apparently originated from the player whose id is byId.

      Parameters

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake leave/kick/ban event for the player whose id is playerId that apparently originated from the player whose id is byId.

      Parameters

      • playerId: number

        Id of the player who will leave the room. (Or get kicked/banned from the room.)

      • reason: string | null

        The reason of kick/ban. If null, it is interpreted as he/she leaving by himself/herself, and the ban value is ignored in that case.

      • ban: boolean

        Whether the player is being banned or not.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake join room event; which in turn creates a new in-memory player object. If there was a player before with this id, old resources are automatically reassigned to this new player object, and that player will wake up.

      Parameters

      • id: number

        Id of the player. 0 <= id <= 65535

      • name: string

        Name of the player.

      • flag: string

        Country code of the player.

      • avatar: string

        Avatar of the player.

      • conn: string

        Connection string of the player.

      • auth: string

        Auth string of the player.

      Returns void

      void.

    • Triggers a fake leave room event. The player, although seemingly leaving the room, still watches the room, waiting for a new fake player join event. All parameters except id may be different in the new fakePlayerJoin call, which allows player's name, flag, avatar, conn and auth to change without the player entirely leaving the room.

      • Returns the player's properties so that you may pass them to fakePlayerJoin at a later time to re-insert that player.

      Parameters

      • id: number

        Id of the player leaving. id=0 will cause desync on clients. (Because there's a special check for this case in original clients.)

      Returns {
          auth: string;
          avatar: string;
          conn: string;
          flag: string;
          id: number;
          name: string;
      }

      An object that has the following strucure: { id: uint16, name: string, flag: string, avatar: string, conn: string, auth: string }.

    • Triggers a fake chat event that apparently originated from the player whose id is byId.

      Parameters

      • msg: string

        The chat message.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake input(keys) event that apparently originated from the player whose id is byId.

      Parameters

      • input: number

        New input value of the player. 0<=input<=31.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake game pause/resume event that apparently originated from the player whose id is byId. The game must be started first.

      Parameters

      • value: boolean

        value=true: pause, false: resume.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake kick rate limit change event that apparently originated from player(byId).

      Parameters

      • min: number

        The new min part of kick rate limit. min>=0.

      • rate: number

        The new rate part of kick rate limit. rate>=0.

      • burst: number

        The new burst part of kick rate limit. burst>=0.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake admin status change event for the player whose id is playerId that apparently originated from the player whose id is byId.

      Parameters

      • playerId: number

        Id of the player who will have his/her admin rights changed.

      • value: boolean

        Whether the player is desired to have admin rights or not.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake avatar change event that apparently originated from the player whose id is byId.

      Parameters

      • value: string

        The new avatar of the player.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake chat indicator change event that apparently originated from the player whose id is byId.

      Parameters

      • value: boolean

        The new chat indicator status of the player.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake player sync status change event that apparently originated from the player whose id is byId.

      Parameters

      • value: boolean

        The new synchronization status of the player.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake player team change event for the player whose id is playerId that apparently originated from the player whose id is byId.

      Parameters

      • playerId: number

        Id of the player whose team is being changed.

      • teamId: number

        Id of the desired team of the player. 0: specetator, 1: red, 2: blue.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake score limit change event that apparently originated from the player whose id is byId.

      Parameters

      • value: number

        The new score limit of the current room. The game must be stopped first. 0 means unlimited. 0<=value<=99.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake stadium change event that apparently originated from the player whose id is byId. The game must be stopped first.

      Parameters

      • value: IStadium

        The new stadium of the current room.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

    • Triggers a team color change event for the team whose id is teamId that apparently originated from the player whose id is byId.

      Parameters

      • teamId: number

        Id of the team whose colors are desired to change.

      • angle: number

        The angle of stripes for the inner colors. Should be between 0 and 180.

      • colors: number[]

        This array can contain minimum 2, maximum 4 numeric (0 <= integer <= 16777215) values. The first element is the text color and the rest are inner stripe colors.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake teams lock change event that apparently originated from the player whose id is byId.

      Parameters

      • value: boolean

        The new teams lock value of the current room.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake time limit change event that apparently originated from the player whose id is byId.

      Parameters

      • value: number

        The new time limit of the current room. The game must be stopped first. 0 means unlimited. 0<=value<=99.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake game start event that apparently originated from the player whose id is byId.

      Parameters

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake game stop event that apparently originated from the player whose id is byId. The game must be started first.

      Parameters

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.