Class representing the Core functionality consumed by User scripts. Usage: const { UniCore } = require("UniCore");

Hierarchy

  • UniCore

Properties

Methods

Client API

Debugging

Entity Helper Functions

Quest API

Script Hooks

Script helper functions

Web Requests

Properties

_currentGroundSkillsGiant: IFlyffEntity[]
_currentGroundSkillsPlayer: IFlyffEntity[]
_lastGottenSystemMessageIDs: Map<string, number> = ...
desiredWritingDelay: number = 0
isInGame: boolean
lastPenyaValue: number = 0
lastStartedFakeTyping: number = 0

Methods

  • Parameters

    • priority: number = 0

    Returns boolean

  • Returns any

  • Requires NPCShopWindow to be open. The user is responsible for checking that they have enough penya and inventory space to buy items.

    Parameters

    • npcTargetID: number

      The targetID of the npc.

    • itemGamePropID: number

      The gamePropID of the item you want to buy.

    • quantity: number

      The amount of items to buy. Ensure the quantity is not greater than the max item stack limit. ie: arrows = 1 to 9,999. If you try buying 10,000 arrows, the purchase won't go through.

    Returns boolean

    boolean

  • Parameters

    Returns boolean

  • Parameters

    Returns boolean

  • Must be in a level 10 normal party to use this function.

    Parameters

    • partyName: string

      max name length is 20. names must begin with letters. no special symbols. can contain numbers but not begin with numbers.

    Returns boolean

  • This function can be used to delete an item from your inventory.

    Parameters

    • inventorySlot: number

      The position of the item in inventory.

    • quantity: number

      amount of the item to delete.

    • itemID: number

      the item's ID

    Returns boolean

  • Brings the game client to the foreground and focuses the game to draw attention to what is happening ingame.

    Returns void

  • Get items on the ground which are in range

    Returns WorldDrop[]

  • Find the closest buffpang location on the current continent. Use this to find a travel destination to get buffs on characters below level 70.

    Returns false | IVector3

  • Find the closest trade npc location on the current continent. Use this to find a travel destination to sell items.

    Returns false | IVector3

  • Parameters

    Returns string

  • Returns number

  • Returns calculated distance between 2 points.

    Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number

    Returns number

  • Returns calculated distance between 2 points.

    Parameters

    Returns any

  • Get the value of a global script variable

    Parameters

    • key: string

    Returns any

  • Get items on the ground which are in range

    Returns WorldDrop[]

  • Parameters

    • itemID: number

    Returns string

  • Parameters

    • itemID: number

    Returns string

    the name of the item, or "" if itemID is not found in the database

  • Parameters

    • itemID: number

    Returns string

  • Parameters

    • categoryFilter: string
    • hotbarPage: number = -1

    Returns IHotbarSlot[]

  • Parameters

    • hotbarSlotIndex: number

    Returns string

  • Returns current time as microtime, represents a timestamp.

    Returns number

  • Parameters

    • Optional filter: ((arg) => boolean)
        • (arg): boolean
        • Parameters

          Returns boolean

    Returns Material[]

  • Returns a random point within a radius centered at the specified origin.

    Parameters

    • origin: {
          x: number;
          z: number;
      }
      • x: number
      • z: number
    • radius: number

    Returns {
        x: number;
        z: number;
    }

    • x: number
    • z: number
  • Parameters

    • messageIDS: string

    Returns number

  • Check if we are in game.

    Returns boolean

  • Parameters

    • skillID: number

    Returns boolean

  • Use this method to determine if a captcha challenge is currently active. When a captcha challenge is active, some actions in the game may not be permitted.

    Returns boolean

  • Returns boolean

  • Parameters

    • STR: number
    • STA: number
    • DEX: number
    • INT: number

    Returns boolean

  • Unsubscribe from an event

    Parameters

    • event: string

    Returns void

  • Subscribes to an event

    Parameters

    • event: "player-changed"
    • listener: ((player) => void)
        • (player): void
        • Parameters

          Returns void

    Returns void

  • Parameters

    • event: "tick"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • event: "tick-end"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • event: "chat-message"
    • listener: ((message, senderTargetID) => void)
        • (message, senderTargetID): void
        • Parameters

          • message: string
          • senderTargetID: number

          Returns void

    Returns void

  • Parameters

    • event: "chat-say-message"
    • listener: ((message, senderName) => void)
        • (message, senderName): void
        • Parameters

          • message: string
          • senderName: string

          Returns void

    Returns void

  • Parameters

    • event: "chat-whisper-message"
    • listener: ((message, senderName) => void)
        • (message, senderName): void
        • Parameters

          • message: string
          • senderName: string

          Returns void

    Returns void

  • Parameters

    • event: "chat-shout-message"
    • listener: ((message, senderName) => void)
        • (message, senderName): void
        • Parameters

          • message: string
          • senderName: string

          Returns void

    Returns void

  • Parameters

    • event: "system-message"
    • listener: ((messageIDS) => void)
        • (messageIDS): void
        • Parameters

          • messageIDS: string

          Returns void

    Returns void

  • Parameters

    • event: "disconnected"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • event: "player-changed"
    • listener: ((player) => void)
        • (player): void
        • Parameters

          Returns void

    Returns void

  • Parameters

    • event: "tick"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • event: "tick-end"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • event: "chat-message"
    • listener: ((message, senderTargetID) => void)
        • (message, senderTargetID): void
        • Parameters

          • message: string
          • senderTargetID: number

          Returns void

    Returns void

  • Parameters

    • event: "chat-say-message"
    • listener: ((message, senderName) => void)
        • (message, senderName): void
        • Parameters

          • message: string
          • senderName: string

          Returns void

    Returns void

  • Parameters

    • event: "chat-shout-message"
    • listener: ((message, senderName) => void)
        • (message, senderName): void
        • Parameters

          • message: string
          • senderName: string

          Returns void

    Returns void

  • Parameters

    • event: "system-message"
    • listener: ((messageIDS) => void)
        • (messageIDS): void
        • Parameters

          • messageIDS: string

          Returns void

    Returns void

  • Parameters

    • event: "disconnected"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns void

  • Pause current script. The script will stop running until the user enables it manually.

    Returns void

  • Helper function that determines if a position is inside of a polyline.

    Parameters

    Returns boolean

  • Returns void

  • Parameters

    • mobCount: number

    Returns boolean

  • Requires NPCShopWindow to be open.

    Parameters

    • inventorySlot: number
    • quantity: number

    Returns boolean

  • Send a notification to the user through UniBat discord bot. Note: This requires the user to have his licenseid linked up with the discord bot.

    Parameters

    • title: string
    • message: string

    Returns void

  • Parameters

    • message: string

    Returns boolean

  • Requires Mailbox window to be open.

    Parameters

    • mailboxNpcTargetID: number

      targetID of the mailbox npc.

    • receiverPlayerName: string

      name of the player you want to send mail to

    • penyaAmount: number = undefined

      The amount of penya to send. Set to 0 to not send any Penya.

    • invSlot: number = undefined

      the slot of the item you want to send. Set to undefined if you don't want to send any items.

    • quantity: number = undefined

      the amount of items to send. Set to undefined if you don't want to send any items.

    • msgSubject: string = undefined

      the subject of the mail message.

    • msgBody: string = undefined

      the body of the mail message.

    Returns boolean

    boolean

  • Parameters

    • targetID: number

    Returns boolean

  • Triggers a windows toast notification with the specified title and message to inform the user of something locally.

    Parameters

    • title: string
    • message: string

    Returns void

  • Set a cross script variable

    Parameters

    • key: string
    • value: any

    Returns any

  • Must be in an advanced party to use this function.

    Parameters

    • mode: "level" | "contribution"

      can be one of the following: "level" | "contribution".

    Returns boolean

  • Must be in a party to use this function.

    Parameters

    • mode: "individually" | "sequentially" | "mutually" | "randomly" | "killer"

      can be one of the following: "individually" | "sequentially" | "mutually" | "randomly" | "killer"

    Returns boolean

  • Must be in a party to use this function.

    Parameters

    • mode: "not_findable" | "leader_approval" | "join_freely"

      can be one of the following: "not_findable" | "leader_approval" | "join_freely"

    Returns boolean

  • Display a message beneath the player model.

    Parameters

    • message: string

      message to display

    • color: number = 0xFFFFFFFF

    Returns void

  • Returns elapsed time in milliseconds from startTime

    Parameters

    • startTime: number
    • Optional roundTo: number

      Number of digits after the decimal point

    Returns number

  • Returns elapsed time in seconds from startTime

    Parameters

    • startTime: number

    Returns number

  • Parameters

    • value: boolean

    Returns boolean

  • This function can be used to trigger the use of a regular item. (Blinkwings, Premium Items and co.)

    Parameters

    • inventorySlot: number

      The position of the item in inventory.

    • param: number

      Additional parameter passed with the usage of the item (for map selection blinkwings this is the selected index).

    Returns boolean

  • This function can be used to use upgrade items like Power Dice on specific items.

    Parameters

    • targetSlot: number

      The position of the target item in inventory.

    • scrollSlot: number

      The position of the upgrade item in inventory.

    Returns boolean

  • Reads from a file in the LogFiles directory, located in %appdata%/unibot-pro/LogFiles

    Parameters

    • filename: string

      the name of the file to read.

    Returns string

    the contents of the file, or null if the file does not exist or an error occurs.

  • Parameters

    • milliseconds: number

    Returns Promise<void>

  • Returns Promise<void>

  • Writes to a file to the LogFiles directory, located in %appdata%/unibot-pro/LogFiles

    Parameters

    • filename: string
    • contents: string
    • mode: "w" | "a" = "a"

      "w" to overwrite the file's contents. "a" to append contents in a new line to the file.

    Returns boolean

Client API

  • Parameters

    • desiredX: number
    • desiredZ: number

    Returns void

  • Parameters

    Returns void

  • GameDataProvider provides access to clientside metadata of the game.

    Returns GameDataProvider

  • Returns boolean

  • Parameters

    • text: string

    Returns void

  • Parameters

    • keyCode: string
    • desiredX: number
    • desiredZ: number

    Returns void

Debugging

  • Draw a circle centered at a position (Point is world position) Note at the moment the circle is 2d not 3d

    Parameters

    Returns void

  • Draw a line from point A to point B (Points are world positions)

    Parameters

    Returns void

  • Output a message to script log. Use this to inform the user of decisions made by your script.

    Parameters

    • Rest ...args: any[]

    Returns void

Entity Helper Functions

  • A function that accepts a filter function and returns all movers based on the filter passed

    Parameters

    • Optional filter: ((arg) => boolean)
        • (arg): boolean
        • Parameters

          Returns boolean

    Returns UniMover[]

  • Returns a mover by ID

    Parameters

    • targetID: number

    Returns UniMover

  • Returns a mover by an arbitrary property and its value.

    Parameters

    Returns UniMover

  • A function that accepts a filter function and returns all movers based on the filter passed

    Parameters

    • Optional filter: ((arg) => boolean)
        • (arg): boolean
        • Parameters

          Returns boolean

    Returns UniMover[]

  • A function that accepts a filter function and returns all players based on the filter passed

    Parameters

    • Optional filter: ((arg) => boolean)
        • (arg): boolean
        • Parameters

          Returns boolean

    Returns UniMover[]

Quest API

  • Accepts a quest. Must have the NPC's Dialog window open for it to work.

    Parameters

    • npcTargetID: number

      The targetID of the NPC.

    • questID: number

      The quest ID. Turn on QuestLogger to see questIDs printed to the console when you accept a new quest.

    Returns boolean

  • Completes a quest. Must have the NPC's Dialog window open for it to work.

    Parameters

    • npcTargetID: number

      The targetID of the NPC.

    • questID: number

      The quest ID. Turn on QuestLogger to see questIDs printed to the console when you accept a new quest.

    Returns boolean

  • Aborts a quest.

    Parameters

    • questID: number

      The quest ID. Turn on QuestLogger to see questIDs printed to the console when you accept a new quest.

    Returns boolean

Script Hooks

  • Parameters

    • hook: string
    • callback: Function
    • Rest ...args: any[]

    Returns any

  • This function can be used to register a hook listener that will be called when the original hook code is executed. You can either use the callback to execute code before the hooked code runs or return a value to prevent execution of the original hook code.

    Parameters

    • hook: string

      Name of the hook to listen for.

    • callback: Function

      Hook callback function, return a value to prevent execution of the original hook code overwriting its return value.

    Returns void

  • Parameters

    • hook: "MeleeBot_IsReadyToFight"

      Triggers when MeleeBot decides if it should remain in IDLE state or not. Use this hook to prevent the bot from entering combat again allowing you to do custom actions.

    • callback: (() => boolean)

      Return nothing to fallback to normal behaviour. Return true to allow the bot to leave IDLE state, false to remain in IDLE state.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_IsDesireableTarget"

      Triggers when MeleeBot decides if it wants to fight against a potential target.

    • callback: ((potentialTarget) => boolean)

      Return nothing to fallback to normal behaviour. Return true to treat the target as desireable, false to treat it as not desireable.

        • (potentialTarget): boolean
        • Parameters

          Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_IsDesireableLoot"

      Triggers when MeleeBot decides if it wants collect a specific world drop.

    • callback: ((potentialLoot) => boolean)

      Return nothing to fallback to normal behaviour. Return true to treat the world drop as desireable, false to treat it as not desireable.

        • (potentialLoot): boolean
        • Parameters

          Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateIdle"

      Triggers when MeleeBot executes the state IDLE

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateDeath"

      Triggers when MeleeBot executes the state DEATH

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateKite"

      Triggers when MeleeBot executes the state KITE

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateFlee"

      Triggers when MeleeBot executes the state FLEE

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateAutoPangbuff"

      Triggers when MeleeBot executes the state AUTO_PANGBUFF

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateQuickSell"

      Triggers when MeleeBot executes the state QUICK_SELL

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateNavigateToLevelarea"

      Triggers when MeleeBot executes the state NAVIGATE_TO_LEVELAREA

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StatePickupLoot"

      Triggers when MeleeBot executes the state PICKUP_LOOT

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_StateKeepProtecteesAround"

      Triggers when MeleeBot executes the state KEEP_PROTECTEES_AROUND

    • callback: (() => boolean)

      Return true to completely skip the existing state behaviour, return nothing or undefined to continue with the existing state behaviour.

        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • hook: "MeleeBot_OverrideState"

      Triggers when MeleeBot decides which state to execute.

    • callback: ((chosenState) => string)

      Return "IDLE" to force MeleeBot to wait while your script is doing something else, dont return anything or return undefined to resume normal behaviour.

        • (chosenState): string
        • Parameters

          • chosenState: string

          Returns string

    Returns void

  • Parameters

    • hook: "MeleeBot_CurrentLevelArea "

      Triggers when MeleeBot picks a LevelArea.

    • callback: (() => {
          location: {
              x: number;
              z: number;
          };
          maxDistance: number;
          minLevel: number;
          mobsWhiteList: string[];
      })

      Return a LevelArea to override it. Return "undefined" to resume default behavior. Example: UniCore.OnHook("MeleeBot_CurrentLevelArea ", () => { if (yourCustomCondition) return { minLevel: 1, mobsWhiteList: ["Small Burudeng"], location: { x: 6755, z: 3564 }, maxDistance: 45 }; else return undefined; })

        • (): {
              location: {
                  x: number;
                  z: number;
              };
              maxDistance: number;
              minLevel: number;
              mobsWhiteList: string[];
          }
        • Returns {
              location: {
                  x: number;
                  z: number;
              };
              maxDistance: number;
              minLevel: number;
              mobsWhiteList: string[];
          }

          • location: {
                x: number;
                z: number;
            }
            • x: number
            • z: number
          • maxDistance: number
          • minLevel: number
          • mobsWhiteList: string[]

    Returns void

Script helper functions

  • Parameters

    • moversToConsider: UniMover[]
    • areaRestriction: {
          center: IVector3;
          radius: number;
      } = undefined

    Returns IVector3

  • Parameters

    Returns number

  • Parameters

    • identifier: string
    • timeoutMS: number
    • action: (() => void)
        • (): void
        • Returns void

    Returns boolean

Web Requests

  • Performs a GET request to the specified URL.

    Parameters

    • url: string

    Returns Promise<any>

  • Performs a POST request to the specified URL.

    Parameters

    • url: string
    • data: any

    Returns Promise<any>

Generated using TypeDoc