Class: UniCore
The UniCore
class is an abstract class that serves as the core interface for interacting with the UniBot API.
It provides various methods for logging, sending notifications, controlling the script execution, and interacting with the game world.
Methods
BuyItem()
static
BuyItem(npcTargetID
,itemGamePropID
,quantity
):boolean
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
ChangeChannel()
static
ChangeChannel(ch
):boolean
Parameters
• ch: number
the index of the channel. 0 = channel1, 1 = channel2, 2 = channel3
Returns
boolean
CircleLineIntersection()
static
CircleLineIntersection(p1
,p2
,circleCenter
,circleRadius
):boolean
Parameters
• p1: IVector3
• p2: IVector3
• circleCenter: IVector3
• circleRadius: number
Returns
boolean
CirclePointIntersection()
static
CirclePointIntersection(point
,circleCenter
,circleRadius
):boolean
Parameters
• point: IVector3
• circleCenter: IVector3
• circleRadius: number
Returns
boolean
CreateAdvancedParty()
static
CreateAdvancedParty(partyName
):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
DeleteItem()
static
DeleteItem(inventorySlot
,quantity
,itemID
):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
EnterPauseMode()
static
EnterPauseMode(seconds
):void
Stops botting for x seconds. Note that this will disconnect you from the game. Pass -1 to pause indefnitely.
Parameters
• seconds: number
Returns
void
FocusClient()
static
FocusClient():void
Returns
void
GetAllPickups()
static
GetAllPickups():WorldDrop
[]
Get items on the ground which are in range
Returns
WorldDrop
[]
GetCamera()
static
GetCamera():IFlyffCamera
Returns
IFlyffCamera
GetClosestBuffPangLocation()
static
GetClosestBuffPangLocation():false
|IVector3
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
GetClosestNPCShopLocation()
static
GetClosestNPCShopLocation(shopPlace
?):false
|IVector3
Find the closest trade npc location on the current continent. Use this to find a travel destination to sell items.
optional arg: shopPlace (ie: "foodstore", "magicstore"). Undefined by default.
Parameters
• shopPlace?: "lodelight"
| "dungeon"
| "lodestar"
| "flyingstation"
| "weaponstore"
| "armorstore"
| "foodstore"
| "magicstore"
| "generalstore"
| "publicoffice"
| "questoffice"
| "shieldstore"
| "warpzone"
| "instance"
Returns
false
| IVector3
GetContinentForPosition()
static
GetContinentForPosition(position
,worldName
?):string
Parameters
• position: IVector3
• worldName?: string
Returns
string
GetCurrentChannel()
static
GetCurrentChannel():number
Returns
number
GetCurrentGiantGroundSkills()
static
GetCurrentGiantGroundSkills():IFlyffEntity
[]
Returns
GetCurrentHotbarPage()
static
GetCurrentHotbarPage():number
Returns
number
Deprecated
Use UniGameUI.Find(Hotbar).GetCurrentPage()
instead.
GetCurrentHotbarSetup()
static
GetCurrentHotbarSetup(unsafe
?):IHotbarSlot
[]
Gets all hotbar slots on the current hotbar page.
Parameters
• unsafe?: boolean
reads the live hotbar instead of the cached copy
Returns
IHotbarSlot
[]
GetCurrentPlayer()
static
GetCurrentPlayer():UniPlayer
Returns Current Player
Returns
GetCurrentPlayerGroundSkills()
static
GetCurrentPlayerGroundSkills():IFlyffEntity
[]
Returns
GetCurrentServerName()
static
GetCurrentServerName():string
Returns
string
GetDistance()
static
GetDistance(x1
,y1
,z1
,x2
,y2
,z2
):number
Returns calculated distance between 2 points.
Parameters
• x1: number
• y1: number
• z1: number
• x2: number
• y2: number
• z2: number
Returns
number
GetDistanceV3()
static
GetDistanceV3(v1
,v2
,ignoreHeight
?):any
Returns calculated distance between 2 points.
Parameters
• v1: IVector3
• v2: IVector3
• ignoreHeight?: boolean
Returns
any
GetHotbarSlotIndexForKeyCode()
static
GetHotbarSlotIndexForKeyCode(desiredKeyCode
):number
Parameters
• desiredKeyCode: string
Returns
number
GetInRangePickups()
static
GetInRangePickups():WorldDrop
[]
Get items on the ground which are in range
Returns
WorldDrop
[]
GetItemCategory()
static
GetItemCategory(itemID
):string
Parameters
• itemID: number
Returns
string
GetItemName()
static
GetItemName(itemID
):string
Parameters
• itemID: number
Returns
string
the name of the item, or undefined if itemID is not found in the database
GetItemRarity()
static
GetItemRarity(itemID
):string
Parameters
• itemID: number
Returns
string
GetItemsInHotbar()
static
GetItemsInHotbar(categoryFilter
,hotbarPage
?):IHotbarSlot
[]
Parameters
• categoryFilter: string
• hotbarPage?: number
Returns
IHotbarSlot
[]
GetKeyCodeForHotbarIndex()
static
GetKeyCodeForHotbarIndex(hotbarSlotIndex
):string
Parameters
• hotbarSlotIndex: number
Returns
string
GetMicrotime()
static
GetMicrotime():number
Returns current time as microtime, represents a timestamp.
Returns
number
GetNearbyMaterials()
static
GetNearbyMaterials(filter
?):Material
[]
Parameters
• filter?
Returns
Material
[]
GetParty()
static
GetParty():PartyInfo
Returns
GetPotionCooldowns()
static
GetPotionCooldowns():IConsumableCooldowns
Returns
IConsumableCooldowns
GetRandomPointWithinRadius()
static
GetRandomPointWithinRadius(origin
,radius
):IVector2
Returns a random point within a radius centered at the specified origin.
Parameters
• origin: IVector2
• radius: number
Returns
IVector2
GetScriptConfig()
static
GetScriptConfig():ScriptConfig
Returns
GetSkillsInHotbar()
static
GetSkillsInHotbar():IHotbarSlot
[]
Returns
IHotbarSlot
[]
HasLastGottenSystemMessageAt()
static
HasLastGottenSystemMessageAt(messageIDS
):number
Parameters
• messageIDS: string
Returns
number
IsDisconnected()
static
IsDisconnected():boolean
Check if we are in game.
Returns
boolean
IsScreenshotMode()
static
IsScreenshotMode():boolean
Returns
boolean
IsSkillTargetAOE()
static
IsSkillTargetAOE(skillID
):boolean
Parameters
• skillID: number
Returns
boolean
IsSolvingCaptcha()
static
IsSolvingCaptcha():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
LeaveParty()
static
LeaveParty():boolean
Returns
boolean
LevelUpStat()
static
LevelUpStat(STR
,STA
,DEX
,INT
):boolean
Parameters
• STR: number
• STA: number
• DEX: number
• INT: number
Returns
boolean
Log()
static
Log(...args
):void
This function can be used to output a message to the console, maps to console.log internally.
Parameters
• ...args: any
[]
Returns
void
LookAt()
static
LookAt(targetPos
,resetVerticalRotation
?):void
rotates the camera horizontally to line up with the target position.
Parameters
• targetPos: IVector3
| "NORTH"
| "SOUTH"
| "EAST"
| "WEST"
| "RANDOM"
either an IVector3 or a cardinal direction ('NORTH' | 'SOUTH' | 'EAST' | 'WEST' | 'RANDOM').
• resetVerticalRotation?: boolean
Zooms out and rotates the camera slightly downwards for a better view. Setting this to false will leave zoom and vertical rotation untouched.
Returns
void
Off()
static
Off(event
):void
Unsubscribe from an event
Parameters
• event: string
Returns
void
Once()
static
Once(event
,listener
):void
UniCore.On
enables listening and reacting to core events that get thrown during
the processing of the bot runtime.
Parameters
• event: string
• listener: Function
Returns
void
OpenExchangeEgg()
static
OpenExchangeEgg(slot
):boolean
Parameters
• slot: number
Returns
boolean
PauseScript()
static
PauseScript():void
Pause current script. The script will stop running until the user enables it manually.
Returns
void
PointInsidePolygon()
static
PointInsidePolygon(point
,vs
):boolean
Helper function that determines if a position is inside of a polyline.
Parameters
• point: IVector3
• vs: IVector3
[]
Returns
boolean
readFromFile()
static
readFromFile(filename
):string
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.
ReloadExpLock()
static
ReloadExpLock(mobCount
):boolean
Parameters
• mobCount: number
Returns
boolean
SellItem()
static
SellItem(inventorySlot
,quantity
):boolean
Requires NPCShopWindow to be open.
Parameters
• inventorySlot: number
• quantity: number
Returns
boolean
SendDiscordNotification()
static
SendDiscordNotification(title
,message
):void
Parameters
• title: string
• message: string
Returns
void
SendGeneralChatMessage()
static
SendGeneralChatMessage(message
):boolean
Parameters
• message: string
Returns
boolean
SendMail()
static
SendMail(mailboxNpcTargetID
,receiverPlayerName
,penyaAmount
?,invSlot
?,quantity
?,msgSubject
?,msgBody
?):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
The amount of penya to send. Set to 0 to not send any Penya.
• invSlot?: number
the slot of the item you want to send. Set to undefined if you don't want to send any items.
• quantity?: number
the amount of items to send. Set to undefined if you don't want to send any items.
• msgSubject?: string
the subject of the mail message.
• msgBody?: string
the body of the mail message.
Returns
boolean
boolean
SendPartyInvite()
static
SendPartyInvite(targetID
):boolean
Parameters
• targetID: number
Returns
boolean
SendToastNotification()
static
SendToastNotification(title
,message
):void
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
SetPartyExpMode()
static
SetPartyExpMode(mode
):boolean
Must be in an advanced party to use this function.
Parameters
• mode: "level"
| "contribution"
can be one of the following: "level" | "contribution".
Returns
boolean
SetPartyLootMode()
static
SetPartyLootMode(mode
):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
SetPartySearchMode()
static
SetPartySearchMode(mode
):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
SetPlayerIntent()
static
SetPlayerIntent(message
,color
?):void
Display a message beneath the player model.
Parameters
• message: string
message to display
• color?: number
Returns
void
TimeSinceInMilliseconds()
static
TimeSinceInMilliseconds(startTime
,roundTo
?):number
Returns elapsed time in milliseconds from startTime
Parameters
• startTime: number
• roundTo?: number
Number of digits after the decimal point
Returns
number
TimeSinceInSeconds()
static
TimeSinceInSeconds(startTime
):number
Returns elapsed time in seconds from startTime
Parameters
• startTime: number
Returns
number
ToggleExpLock()
static
ToggleExpLock(value
):boolean
Parameters
• value: boolean
Returns
boolean
Trigger()
static
Trigger(event
, ...args
):void
Parameters
• event: string
• ...args: any
[]
Returns
void
UpgradeExchangeEgg()
static
UpgradeExchangeEgg(slot
):boolean
Parameters
• slot: number
Returns
boolean
UseItem()
static
UseItem(inventorySlot
,param
):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
UseScroll()
static
UseScroll(targetSlot
,scrollSlot
):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
VendorItemBlacklistCheck()
static
VendorItemBlacklistCheck(itemID
):boolean
Tells you if the item is blacklisted from being sold to vendors.
To blacklist an item from being sold to vendors, use the vendor-blacklist-check
hook.
Parameters
• itemID: number
Returns
boolean
writeToFile()
static
writeToFile(filename
,contents
,mode
?):boolean
Writes to a file to the LogFiles directory, located in %appdata%/unibot-pro/LogFiles
Parameters
• filename: string
• contents: string
• mode?: "w"
| "a"
"w" to overwrite the file's contents. "a" to append contents in a new line to the file.
Returns
boolean
API Events
On()
On(event, listener)
static
On(event
,listener
):void
The UniCore player-shop-contents
event is triggered when the contents of
the currently opened PlayerShopWindow get updated.
Parameters
• event: string
• listener: Function
Returns
void
On(event, listener)
static
On(event
,listener
):void
Parameters
• event: "tick"
• listener
Returns
void
On(event, listener)
static
On(event
,listener
):void
Parameters
• event: "vendor-blacklist-check"
• listener
Returns
void
Client API
ClickGroundPos()
static
ClickGroundPos(desiredX
,desiredZ
):void
Parameters
• desiredX: number
• desiredZ: number
Returns
void
CollectMaterial()
static
CollectMaterial(drop
):void
Parameters
• drop: Material
Returns
void
CollectWorldDrop()
static
CollectWorldDrop(drop
):void
Parameters
• drop: WorldDrop
Returns
void
FindMotionInHotbar()
static
FindMotionInHotbar(motionID
):IHotbarSlot
Parameters
• motionID: number
Returns
IHotbarSlot
GetGameDataProvider()
static
GetGameDataProvider():GameDataProvider
GameDataProvider provides access to clientside metadata of the game.
Returns
IsTextInputMode()
static
IsTextInputMode():boolean
Returns
boolean
SetFocusedTextInputValue()
static
SetFocusedTextInputValue(text
):void
Parameters
• text: string
Returns
void
UseBlinkpool()
static
UseBlinkpool(keyCode
,desiredX
,desiredZ
):void
Parameters
• keyCode: string
• desiredX: number
• desiredZ: number
Returns
void
Debugging
DrawCircle()
static
DrawCircle(args
):void
Draw a circle centered at a position (Point is world position) Note at the moment the circle is 2d not 3d
Parameters
• args: DrawCircle
Returns
void
DrawLine()
static
DrawLine(args
):void
Draw a line from point A to point B (Points are world positions)
Parameters
• args: DrawLine
Returns
void
Entity Helper Functions
GetMonstersAround()
static
GetMonstersAround(filter
?):UniMover
[]
A function that accepts a filter function and returns all movers based on the filter passed
Parameters
• filter?
Returns
UniMover
[]
GetMoverById()
static
GetMoverById<T
>(targetID
):T
Returns a mover by ID
Type Parameters
• T extends UniHuman
| UniMover
Parameters
• targetID: number
Returns
T
GetMoverByProperty()
static
GetMoverByProperty<T
>(property
,value
):T
Returns a mover by an arbitrary property and its value.
Type Parameters
• T extends UniHuman
| UniMover
Parameters
• property: "name"
| keyof IFlyffEntity | "targetID"
| "targeting"
| "attacking"
| "following"
| "HP"
| "isDead"
| "isRedMob"
| "animationState"
| "actionState"
| "flyingState"
| "buffs"
| "premiumItems"
| "premiumItems2"
| "movingTowards"
| "isMasquerpet"
| "isNPC"
| "g"
• value: any
Returns
T
GetMoversAround()
static
GetMoversAround(filter
?):UniMover
[]
A function that accepts a filter function and returns all movers based on the filter passed
Parameters
• filter?
Returns
UniMover
[]
GetPlayersAround()
static
GetPlayersAround(filter
?):UniHuman
[]
A function that accepts a filter function and returns all players based on the filter passed
Parameters
• filter?
Returns
UniHuman
[]
Quest API
AcceptQuest()
static
AcceptQuest(npcTargetID
,questID
):boolean
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
CompleteQuest()
static
CompleteQuest(npcTargetID
,questID
):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
ForfeitQuest()
static
ForfeitQuest(questID
):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
CreateHook()
static
CreateHook(hook
,callback
, ...args
):any
Parameters
• hook: string
• callback: Function
• ...args: any
[]
Returns
any
OnHook()
static
OnHook(hook
,callback
):void
Parameters
• hook: string
• callback: Function
Returns
void
Script helper functions
LimitActionFrequency()
static
LimitActionFrequency(identifier
,timeoutMS
,action
):boolean
Parameters
• identifier: string
• timeoutMS: number
• action
Returns
boolean
NormalizeVector()
static
NormalizeVector(input
):IVector3
Parameters
• input: IVector3
Returns
IVector3
VecAdd()
static
VecAdd(a
,b
):IVector3
Parameters
• a: IVector3
• b: IVector3
Returns
IVector3
VecMul()
static
VecMul(input
,multiplier
):IVector3
Parameters
• input: IVector3
• multiplier: number
Returns
IVector3
Web Requests
PerformHTTPGet()
static
PerformHTTPGet(url
):Promise
<any
>
Performs a GET request to the specified URL.
Parameters
• url: string
Returns
Promise
<any
>
PerformHTTPPost()
static
PerformHTTPPost(url
,data
):Promise
<any
>
Performs a POST request to the specified URL.
Parameters
• url: string
• data: any
Returns
Promise
<any
>