Models
The classes world reads return — Player, Npc, Drop, Skill and the rest — with all of their fields.
On this page
Everything a script reads through bot.* is an instance of the classes described here. They are read-only: to change the world use commands.
Which bot property returns which class is listed in the “World reads” table. This page describes what those classes contain.
Contents
oid and idPositionedIdentifiedLiveEntityPlayerNpcCharPetDropSkillInventoryItemStoreItemBuffPetActionPartyMemberPartyPetPacketList helpersEnumsNumeric codesoid and id
oid(object id) — a specific instance: this mob, this item in your bag, this drop. Issued by the server, alive as long as the object is, carried in event fields.id(template id) — a type: a mob id, an item'sitemId, askillId. The same for every orc on the map.
Npc, Pet, Drop, Skill and PartyPet have both: mob.id is "orcs in general", mob.oid is "this particular orc". Commands accept either, see “id or oid”.
Positioned
The interface of everything that has a position: living entities, drops, party members.
| Field | Type | Description |
|---|---|---|
oid | Int | Object id. |
x | Int | X coordinate. |
y | Int | Y coordinate. |
z | Int | Height. |
distToSelf | Int | Distance to your own character, computed when the world was updated. 0 for user itself. |
Identified
The interface of everything that has a template id: Npc, Pet, Drop, Skill, PartyPet.
| Field | Type | Description |
|---|---|---|
id | Int | Template id (mob type, item itemId, skillId). |
LiveEntity
The common base of living entities: Player, Npc, Char, Pet. Implements Positioned.
| Field | Type | Description |
|---|---|---|
name | String | Name. |
heading | Int | Facing direction. |
hp | Int | Current HP. |
maxHp | Int | Maximum HP. |
mp | Int | Current MP. |
maxMp | Int | Maximum MP. |
dead | Boolean | Dead. |
running | Boolean | Running (as opposed to walking). |
sitting | Boolean | Sitting. |
inCombat | Boolean | In combat stance. |
invisible | Boolean | Invisible. |
attackerOid | Int | Object id of whoever this entity is hitting — the target of its latest attack or cast. 0 — unknown. The name is historical; this is what it holds. |
targetOid | Int | Object id of the selected target. 0 — no target. |
engagedOid | Int | Object id of the object the entity is closing in on to attack or cast. 0 — not closing in. |
engagedDist | Int | The distance at which the entity will stop while closing in on engagedOid. |
title | String | Title. |
karma | Int | Karma. |
pvp | Boolean | PvP-flagged. |
buffs | List<Buff> | Active buffs and effects. |
effectIds | List<Int> | Ids of the visual (abnormal) effects the server shows on the entity. |
| Property | Type | Description |
|---|---|---|
target | LiveEntity? | This entity's target, already resolved to an object. null — no target or the object isn't visible. |
hpPercent | Float | HP fraction from 0f to 1f. 0f if maxHp is unknown. |
mpPercent | Float | MP fraction from 0f to 1f. |
| Method | Returns | Description |
|---|---|---|
distTo(px: Int, py: Int, pz: Int) | Int | Distance to a point. |
distTo(other: Positioned) | Int | Distance to another object. |
inRange(other: Positioned, range: Int) | Boolean | Whether the object is at most range away. |
hasBuff(skillId: Int) | Boolean | Whether an active buff with that id is present. |
Player
Your own character — bot.user. Everything from LiveEntity plus:
| Field | Type | Description |
|---|---|---|
classId | Int | Current class. |
mainClass | Int | Main class. |
level | Int | Level. |
exp | Long | Experience. |
sp | Long | SP. |
expPercent | Double | Percentage of experience towards the next level. |
cp | Int | Current CP. |
maxCp | Int | Maximum CP. |
cpPercent | Float | CP fraction from 0f to 1f. |
castingSkillId | Int | Id of the skill being cast right now. 0 — not casting. |
castingTargetOid | Int | Object id of the current cast's target. |
castRemainMs | Long | Milliseconds left in the current cast. 0 — not casting. |
isCasting | Boolean | Casting right now. |
charges | Int | Charges (force). |
souls | Int | Souls. |
weightPenalty | Int | Overweight penalty level. 0 — none. |
weaponPenalty | Int | Penalty level for a weapon above your grade. |
armorPenalty | Int | Penalty level for armor above your grade. |
deathPenaltyLevel | Int | Death penalty level. |
canCrystallize | Boolean | The character is able to crystallize items. |
weaponEquipped | Boolean | A weapon is equipped. |
weight | Int | Current weight. |
maxWeight | Int | Weight limit. |
adena | Long | Adena. |
soulshotEnabled | Boolean | Automatic shots are on. |
fishing | Int | Fishing state. 0 — not fishing. |
runSpeed | Int | Run speed. |
walkSpeed | Int | Walk speed. |
skills | List<Skill> | All of the character's skills. |
inventory | List<InventoryItem> | The regular inventory. |
petItems | List<InventoryItem> | The pet's inventory. |
questItems | List<InventoryItem> | Quest items. |
| Method | Returns | Description |
|---|---|---|
skill(id: Int) | Skill? | The skill with that skillId, null if there is none. |
item(itemId: Int) | InventoryItem? | The first item of that type in the regular inventory, null if there is none. |
Npc
A mob or NPC from bot.npcs. Everything from LiveEntity and Identified plus:
| Field | Type | Description |
|---|---|---|
id | Int | Template id — the mob type. |
level | Int | Level. |
attackable | Boolean | Can be attacked at all (a mob rather than a peaceful NPC). |
sweepable | Boolean | The corpse can be swept. |
spoiled | Boolean | Spoil has landed. |
spoiledByMe | Boolean | Spoil was landed by me. |
spoiledByOther | Boolean | Spoil was landed by someone else. |
passive | Boolean | Passive: does not attack on its own. |
isPet | Boolean | This is someone else's pet or summon. |
petType | Int | Pet type, if isPet. |
ownerOid | Int | Object id of the owner, if this is a pet. 0 — no owner. |
owner | LiveEntity? | The owner, already resolved to an object. null — not a pet or the owner isn't visible. |
aggro | Boolean | The mob is aggressive towards my side: me, my pet or a member of my party. |
damageDealt | Long | Damage my own character has dealt to it. |
hitsDealt | Int | Hits my own character has landed on it. |
lastHitTime | Long | Time of my last hit on it. |
runSpeed | Int | Run speed. |
walkSpeed | Int | Walk speed. |
Char
Another player from bot.chars. Everything from LiveEntity plus:
| Field | Type | Description |
|---|---|---|
sex | Int | Sex code as sent by the protocol. |
race | Int | Race code, see numeric codes. |
classId | Int | Current class. |
mainClass | Int | Main class. |
relation | Int | Relation bitmask (party, clan, alliance, war) as sent by the server. |
clanId | Int | Clan id. 0 — no clan. |
clanCrestId | Int | Clan crest id. |
allyId | Int | Alliance id. 0 — no alliance. |
allyCrestId | Int | Alliance crest id. |
nameColor | Int | Name color as sent by the server. |
titleColor | Int | Title color as sent by the server. |
storeType | Int | Type of the open private store, see numeric codes. 0 — no store. |
noble | Boolean | Noblesse. |
hero | Boolean | Hero. |
enchantEffect | Int | Enchant glow level. |
cubicCount | Int | Number of cubics. |
premium | Boolean | Premium account. |
team | Int | Event team. 0 — no team. |
Pet
Your own pet or summon from bot.pets. Everything from LiveEntity and Identified plus:
| Field | Type | Description |
|---|---|---|
id | Int | Pet template id. |
petType | Int | Pet type. |
fed | Int | Current food. |
maxFed | Int | Maximum food. |
level | Int | Level. |
exp | Long | Experience. |
expPercent | Double | Percentage of experience towards the next level. |
sp | Long | SP. |
actions | List<PetAction> | Available pet actions. |
Drop
An item on the ground from bot.drops. Implements Positioned and Identified. It is not a living entity — it has no HP.
| Field | Type | Description |
|---|---|---|
oid | Int | Object id of the drop. |
id | Int | Item template id. |
itemId | Int | Same as id, under the familiar name. |
count | Long | Amount in the stack. |
stackable | Boolean | The item stacks. |
ownerOid | Int | Object id of whoever the drop is reserved for. 0 — nobody. |
isMine | Boolean | The drop is reserved for my side and I may pick it up. |
x, y, z | Int | Coordinates. |
distToSelf | Int | Distance to my character. |
Skill
A skill from bot.skills or user.skills. Implements Identified.
| Field | Type | Description |
|---|---|---|
id | Int | Skill id. |
level | Int | Level. |
level2 | Int | Additional level (sublevel or enchant) when the server sends one. |
passive | Boolean | Passive skill — cannot be cast. |
disabled | Boolean | Temporarily blocked. |
enchanted | Boolean | The skill is enchanted. |
reuseTime | Int | Full reuse time. |
cdMs | Long | Milliseconds of cooldown left. 0 — ready. |
onCooldown | Boolean | The cooldown is still running. |
ready | Boolean | Off cooldown, not passive and not blocked. Does not account for MP, reagents or other cast conditions. |
InventoryItem
An item from bot.inventory, user.petItems or user.questItems.
| Field | Type | Description |
|---|---|---|
oid | Int | Object id of this particular item. |
itemId | Int | Template id — the item type. |
count | Long | Amount. |
equipped | Boolean | Equipped. |
slot | Int | Item slot or category as sent by the server. |
bodyPart | Int | Body part the item is worn on. |
enchantLevel | Int | Enchant level. |
augmentId | Int | Augmentation id. 0 — none. |
remainTime | Int | Remaining lifetime for temporary items. |
itemType | Int | Item type by the server's classification. |
isNamed | Boolean | A named item. |
stackable | Boolean | The item stacks. |
StoreItem
One lot from bot.storeItems — the goods of the private store you last opened.
A snapshot taken when the store opened, not live prices: the server never says that someone else bought a lot out, so a list you keep around goes quietly stale.
| Field | Type | Description |
|---|---|---|
oid | Int | Object id of this particular item instance. |
itemId | Int | Template id — the item type. |
count | Long | How many are on sale. |
price | Long | What the seller asks per unit. |
basePrice | Long | The item's reference price, so price - basePrice is how far the offer sits from par. |
bodyPart | Int | Body part the item is worn on. 0 — not worn. |
Buff
An active buff or effect: entity.buffs, partyMember.effects, partyPet.effects.
| Field | Type | Description |
|---|---|---|
id | Int | Skill id. |
level | Int | Level. |
level2 | Int | Additional level when the server sends one. |
remainMs | Long | Milliseconds left. -1 — the buff has no timer. |
permanent | Boolean | The buff has no timer. Check this field instead of comparing remainMs. |
startTime | Long | Start time as sent by the server. |
reuseTime | Int | Skill reuse time when the server sends one. |
PetAction
An available pet action from pet.actions.
| Field | Type | Description |
|---|---|---|
id | Int | Action id. |
category | Int | Action category. |
PartyMember
A party member from bot.party. Implements Positioned. It is not a LiveEntity — the server sends less data about party members.
| Field | Type | Description |
|---|---|---|
oid | Int | Object id of the member. |
name | String | Name. |
classId | Int | Class. |
level | Int | Level. |
x, y, z | Int | Coordinates. |
distToSelf | Int | Distance to my character. |
hp | Int | Current HP. |
maxHp | Int | Maximum HP. |
mp | Int | Current MP. |
maxMp | Int | Maximum MP. |
cp | Int | Current CP. |
maxCp | Int | Maximum CP. |
hpPercent | Float | HP fraction from 0f to 1f. |
sex | Int | Sex code. |
race | Int | Race code, see numeric codes. |
pets | List<PartyPet> | The member's pets. |
effects | List<Buff> | Effects on the member. |
To get a party member as a full entity (with buffs, target and combat state), look them up in bot.chars by oid:
val member = bot.party.firstOrNull { it.name == "Healer" }
val asChar = member?.let { m -> bot.chars.byOid(m.oid) }PartyPet
A party member's pet from partyMember.pets. Implements Identified.
| Field | Type | Description |
|---|---|---|
id | Int | Pet template id. |
oid | Int | Pet object id. |
ownerOid | Int | Owner's object id. |
petType | Int | Pet type. |
name | String | Name. |
hp | Int | Current HP. |
maxHp | Int | Maximum HP. |
mp | Int | Current MP. |
maxMp | Int | Maximum MP. |
effects | List<Buff> | Effects on the pet. |
Packet
A raw game packet from bot.packetsIn / bot.packetsOut — see Raw traffic. Not a world entity: it has no oid and no position, it is just bytes off the wire.
| Field | Type | Description |
|---|---|---|
hex | String | The packet bytes as hex, upper case, no separators. |
bytes | ByteArray | The same bytes. Computed on first access. |
incoming | Boolean | true — from the server (packetsIn), false — from the client (packetsOut). |
opcode | Int | The first byte — the packet's opcode. |
subOpcode | Int | The extended packet's subcommand. -1 if the packet is not extended. |
size | Int | Body length in bytes. |
byteAt(index: Int) | Int | The byte at that position, or -1 past the end. |
The two directions only look alike. The same opcode byte means different things each way, and even the extended-packet marker differs — FE inbound, D0 outbound. That is why subOpcode consults incoming, and why comparing opcode against a list of opcodes only means something once you know the direction.
It follows that only an outgoing packet can be replayed through sendPacket — its body is exactly what that command takes. Sending back at the server what the server sent you is meaningless, and usually drops the connection.
List helpers
Extension functions for the lists bot.* returns.
| Helper | Applies to | Returns |
|---|---|---|
list.byOid(oid: Int) | Positioned lists | The first object with that object id, otherwise null. |
list.byId(id: Int) | Identified lists | The first object with that template id, otherwise null. |
list.allById(id: Int) | Identified lists | Every object with that template id. |
list.byName(name: String) | LiveEntity lists | The first entity with that name, otherwise null. |
list.nearest { … } | Positioned lists | The object nearest to my character that matches the condition. Without a condition, simply the nearest one. null — nothing matches. |
inventory.equippedCount(itemId: Int) | List<InventoryItem> | How many items of that type are equipped. |
val mob = bot.npcs.nearest { it.attackable && !it.dead && it.distToSelf <= 1200 }
val boss = bot.npcs.byId(29020)
val ally = bot.chars.byName("Healer")
val myPet = bot.pets.firstOrNull()Enums
LootMode
Loot distribution mode for inviteParty.
| Value | Code | Description |
|---|---|---|
FINDERS_KEEPERS | 0 | Whoever picks it up keeps it. |
RANDOM | 1 | Random among members. |
RANDOM_SPOIL | 2 | Random, spoil included. |
BY_TURN | 3 | In turn. |
BY_TURN_SPOIL | 4 | In turn, spoil included. |
RestartType
Respawn point for goHome.
| Value | Code | Description |
|---|---|---|
TOWN | 0 | Nearest town. |
CLAN_HALL | 1 | Clan hall. |
CASTLE | 2 | Castle. |
FORTRESS | 3 | Fortress. |
FLAG | 4 | Siege flag. |
Both enums expose a code: Int field holding the protocol value.
Numeric codes
Some fields are given as plain numbers, exactly as the server sends them.
Race — Char.race, PartyMember.race
| Code | Race | Code | Race |
|---|---|---|---|
0 | human | 4 | dwarf |
1 | elf | 5 | kamael |
2 | dark elf | 6 | ertheia |
3 | orc |
Store type — Char.storeType
| Code | Store |
|---|---|
0 | none |
1 | sell |
2 | package sell |
3 | buy |
5 | dwarven manufacture |
8 | general manufacture |
10 | sell setup |
11 | buy setup |
Chat channel codes are on the Commands page.