Ikar BotHardShiftRoadmapContactGet
Models

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 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's itemId, a skillId. 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.

FieldTypeDescription
oidIntObject id.
xIntX coordinate.
yIntY coordinate.
zIntHeight.
distToSelfIntDistance 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.

FieldTypeDescription
idIntTemplate id (mob type, item itemId, skillId).

LiveEntity

The common base of living entities: Player, Npc, Char, Pet. Implements Positioned.

FieldTypeDescription
nameStringName.
headingIntFacing direction.
hpIntCurrent HP.
maxHpIntMaximum HP.
mpIntCurrent MP.
maxMpIntMaximum MP.
deadBooleanDead.
runningBooleanRunning (as opposed to walking).
sittingBooleanSitting.
inCombatBooleanIn combat stance.
invisibleBooleanInvisible.
attackerOidIntObject 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.
targetOidIntObject id of the selected target. 0 — no target.
engagedOidIntObject id of the object the entity is closing in on to attack or cast. 0 — not closing in.
engagedDistIntThe distance at which the entity will stop while closing in on engagedOid.
titleStringTitle.
karmaIntKarma.
pvpBooleanPvP-flagged.
buffsList<Buff>Active buffs and effects.
effectIdsList<Int>Ids of the visual (abnormal) effects the server shows on the entity.
PropertyTypeDescription
targetLiveEntity?This entity's target, already resolved to an object. null — no target or the object isn't visible.
hpPercentFloatHP fraction from 0f to 1f. 0f if maxHp is unknown.
mpPercentFloatMP fraction from 0f to 1f.
MethodReturnsDescription
distTo(px: Int, py: Int, pz: Int)IntDistance to a point.
distTo(other: Positioned)IntDistance to another object.
inRange(other: Positioned, range: Int)BooleanWhether the object is at most range away.
hasBuff(skillId: Int)BooleanWhether an active buff with that id is present.

Player

Your own character — bot.user. Everything from LiveEntity plus:

FieldTypeDescription
classIdIntCurrent class.
mainClassIntMain class.
levelIntLevel.
expLongExperience.
spLongSP.
expPercentDoublePercentage of experience towards the next level.
cpIntCurrent CP.
maxCpIntMaximum CP.
cpPercentFloatCP fraction from 0f to 1f.
castingSkillIdIntId of the skill being cast right now. 0 — not casting.
castingTargetOidIntObject id of the current cast's target.
castRemainMsLongMilliseconds left in the current cast. 0 — not casting.
isCastingBooleanCasting right now.
chargesIntCharges (force).
soulsIntSouls.
weightPenaltyIntOverweight penalty level. 0 — none.
weaponPenaltyIntPenalty level for a weapon above your grade.
armorPenaltyIntPenalty level for armor above your grade.
deathPenaltyLevelIntDeath penalty level.
canCrystallizeBooleanThe character is able to crystallize items.
weaponEquippedBooleanA weapon is equipped.
weightIntCurrent weight.
maxWeightIntWeight limit.
adenaLongAdena.
soulshotEnabledBooleanAutomatic shots are on.
fishingIntFishing state. 0 — not fishing.
runSpeedIntRun speed.
walkSpeedIntWalk speed.
skillsList<Skill>All of the character's skills.
inventoryList<InventoryItem>The regular inventory.
petItemsList<InventoryItem>The pet's inventory.
questItemsList<InventoryItem>Quest items.
MethodReturnsDescription
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:

FieldTypeDescription
idIntTemplate id — the mob type.
levelIntLevel.
attackableBooleanCan be attacked at all (a mob rather than a peaceful NPC).
sweepableBooleanThe corpse can be swept.
spoiledBooleanSpoil has landed.
spoiledByMeBooleanSpoil was landed by me.
spoiledByOtherBooleanSpoil was landed by someone else.
passiveBooleanPassive: does not attack on its own.
isPetBooleanThis is someone else's pet or summon.
petTypeIntPet type, if isPet.
ownerOidIntObject id of the owner, if this is a pet. 0 — no owner.
ownerLiveEntity?The owner, already resolved to an object. null — not a pet or the owner isn't visible.
aggroBooleanThe mob is aggressive towards my side: me, my pet or a member of my party.
damageDealtLongDamage my own character has dealt to it.
hitsDealtIntHits my own character has landed on it.
lastHitTimeLongTime of my last hit on it.
runSpeedIntRun speed.
walkSpeedIntWalk speed.

Char

Another player from bot.chars. Everything from LiveEntity plus:

FieldTypeDescription
sexIntSex code as sent by the protocol.
raceIntRace code, see numeric codes.
classIdIntCurrent class.
mainClassIntMain class.
relationIntRelation bitmask (party, clan, alliance, war) as sent by the server.
clanIdIntClan id. 0 — no clan.
clanCrestIdIntClan crest id.
allyIdIntAlliance id. 0 — no alliance.
allyCrestIdIntAlliance crest id.
nameColorIntName color as sent by the server.
titleColorIntTitle color as sent by the server.
storeTypeIntType of the open private store, see numeric codes. 0 — no store.
nobleBooleanNoblesse.
heroBooleanHero.
enchantEffectIntEnchant glow level.
cubicCountIntNumber of cubics.
premiumBooleanPremium account.
teamIntEvent team. 0 — no team.

Pet

Your own pet or summon from bot.pets. Everything from LiveEntity and Identified plus:

FieldTypeDescription
idIntPet template id.
petTypeIntPet type.
fedIntCurrent food.
maxFedIntMaximum food.
levelIntLevel.
expLongExperience.
expPercentDoublePercentage of experience towards the next level.
spLongSP.
actionsList<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.

FieldTypeDescription
oidIntObject id of the drop.
idIntItem template id.
itemIdIntSame as id, under the familiar name.
countLongAmount in the stack.
stackableBooleanThe item stacks.
ownerOidIntObject id of whoever the drop is reserved for. 0 — nobody.
isMineBooleanThe drop is reserved for my side and I may pick it up.
x, y, zIntCoordinates.
distToSelfIntDistance to my character.

Skill

A skill from bot.skills or user.skills. Implements Identified.

FieldTypeDescription
idIntSkill id.
levelIntLevel.
level2IntAdditional level (sublevel or enchant) when the server sends one.
passiveBooleanPassive skill — cannot be cast.
disabledBooleanTemporarily blocked.
enchantedBooleanThe skill is enchanted.
reuseTimeIntFull reuse time.
cdMsLongMilliseconds of cooldown left. 0 — ready.
onCooldownBooleanThe cooldown is still running.
readyBooleanOff 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.

FieldTypeDescription
oidIntObject id of this particular item.
itemIdIntTemplate id — the item type.
countLongAmount.
equippedBooleanEquipped.
slotIntItem slot or category as sent by the server.
bodyPartIntBody part the item is worn on.
enchantLevelIntEnchant level.
augmentIdIntAugmentation id. 0 — none.
remainTimeIntRemaining lifetime for temporary items.
itemTypeIntItem type by the server's classification.
isNamedBooleanA named item.
stackableBooleanThe 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.

FieldTypeDescription
oidIntObject id of this particular item instance.
itemIdIntTemplate id — the item type.
countLongHow many are on sale.
priceLongWhat the seller asks per unit.
basePriceLongThe item's reference price, so price - basePrice is how far the offer sits from par.
bodyPartIntBody part the item is worn on. 0 — not worn.

Buff

An active buff or effect: entity.buffs, partyMember.effects, partyPet.effects.

FieldTypeDescription
idIntSkill id.
levelIntLevel.
level2IntAdditional level when the server sends one.
remainMsLongMilliseconds left. -1 — the buff has no timer.
permanentBooleanThe buff has no timer. Check this field instead of comparing remainMs.
startTimeLongStart time as sent by the server.
reuseTimeIntSkill reuse time when the server sends one.

PetAction

An available pet action from pet.actions.

FieldTypeDescription
idIntAction id.
categoryIntAction category.

PartyMember

A party member from bot.party. Implements Positioned. It is not a LiveEntity — the server sends less data about party members.

FieldTypeDescription
oidIntObject id of the member.
nameStringName.
classIdIntClass.
levelIntLevel.
x, y, zIntCoordinates.
distToSelfIntDistance to my character.
hpIntCurrent HP.
maxHpIntMaximum HP.
mpIntCurrent MP.
maxMpIntMaximum MP.
cpIntCurrent CP.
maxCpIntMaximum CP.
hpPercentFloatHP fraction from 0f to 1f.
sexIntSex code.
raceIntRace code, see numeric codes.
petsList<PartyPet>The member's pets.
effectsList<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:

Kotlin
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.

FieldTypeDescription
idIntPet template id.
oidIntPet object id.
ownerOidIntOwner's object id.
petTypeIntPet type.
nameStringName.
hpIntCurrent HP.
maxHpIntMaximum HP.
mpIntCurrent MP.
maxMpIntMaximum MP.
effectsList<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.

FieldTypeDescription
hexStringThe packet bytes as hex, upper case, no separators.
bytesByteArrayThe same bytes. Computed on first access.
incomingBooleantrue — from the server (packetsIn), false — from the client (packetsOut).
opcodeIntThe first byte — the packet's opcode.
subOpcodeIntThe extended packet's subcommand. -1 if the packet is not extended.
sizeIntBody length in bytes.
byteAt(index: Int)IntThe 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.

HelperApplies toReturns
list.byOid(oid: Int)Positioned listsThe first object with that object id, otherwise null.
list.byId(id: Int)Identified listsThe first object with that template id, otherwise null.
list.allById(id: Int)Identified listsEvery object with that template id.
list.byName(name: String)LiveEntity listsThe first entity with that name, otherwise null.
list.nearest { … }Positioned listsThe 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.
Kotlin
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.

ValueCodeDescription
FINDERS_KEEPERS0Whoever picks it up keeps it.
RANDOM1Random among members.
RANDOM_SPOIL2Random, spoil included.
BY_TURN3In turn.
BY_TURN_SPOIL4In turn, spoil included.

RestartType

Respawn point for goHome.

ValueCodeDescription
TOWN0Nearest town.
CLAN_HALL1Clan hall.
CASTLE2Castle.
FORTRESS3Fortress.
FLAG4Siege 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.

RaceChar.race, PartyMember.race

CodeRaceCodeRace
0human4dwarf
1elf5kamael
2dark elf6ertheia
3orc

Store typeChar.storeType

CodeStore
0none
1sell
2package sell
3buy
5dwarven manufacture
8general manufacture
10sell setup
11buy setup

Chat channel codes are on the Commands page.