Table Of Contents

Previous topic

core Package

Next topic

protocols Package

This Page

game Package

chat Module

class game.chat.Channel(name, id, public=False)

Bases: object

addInvite(player)
addMember(player)
addMessage(player, text, type)
canJoin(player)
getLocalMessage(messageId)
getMessage(messageId)
isMember(player)
removeInvites(player)
removeMember(player)
game.chat.delChannel(channelId)
game.chat.getChannel(id)
game.chat.getChannels(player)
game.chat.getChannelsWithPlayer(player)
game.chat.getMessage(self, messageId)
game.chat.openChannel(channelName, id=None, public=True)
game.chat.openInstanceChannel(channelName, id)

creature Module

class game.creature.Creature(data, position, cid=None)

Bases: game.creature_talking.CreatureTalking, game.creature_movement.CreatureMovement, game.creature_attacks.CreatureAttacks

static actionDecor(f)

Decorator used by external actions

actionIds()
actionLock(*argc, **kwargs)
canSee(position, radius=(8, 6))
canTarget(position, radius=(8, 6), allowGroundChange=False)
cancelTarget()
cancelWalk(d=None)
castSpell(spell, strength=None, target=None)
changeMountStatus(mounted)
clientId()
condition(condition, stackbehavior=1, maxLength=0)
cooldownGroup(group, cooldown)
cooldownIcon(icon, cooldown)
cooldownSpell(icon, group, cooldown, groupCooldown=None)
description()
despawn()
distanceStepsTo(position)
follow(target)

if self.targetMode == 2 and self.target == target: self.targetMode = 0 self.target = None return

generateClientID()
getCondition(conditionType, subtype='')
getEmblem(craeture)
getGlobal(field, default=None)
getGlobalObject(field, default=None)
getHideHealth()
getPartyShield(creature)
getShield(craeture)
getSkull(creature=None)
getVar(name)
hasCondition(conditionType, subtype='')
hideHealth(do=True)
inRange(position, x, y, z=0)
isAttackable(by)
isItem()
isMonster()
isNPC()
isPlayer()
isPushable(by)
isSummon()
isSummonFor(creature)
kickFromHouse()
l(message)
lc(context, message)
lcp(context, singular, plural, n)
loseAllConditions()
loseCondition(conditionType, subtype='')
lp(singular, plural, n)
magicEffect(type, pos=None)
modifyHealth(health, spawn=False)
multiCondition(*argc, **kwargs)
name()
notPossible()
onDeath()
onSpawn()
party()

Returns a dummy party for creatures (aga None).

positionInDirection(direction)
privRename(player, name)
refresh()
refreshConditions(streamX=None)
refreshLight()
refreshOutfit()
refreshSkills(streamX=None)
refreshStatus(streamX=None)
register(event, func, **kwargs)
registerAll(event, func, **kwargs)
remove(entriesToo=True)

Remove this creature from the map, stop the brain and so on

removeGlobal(field)
removeGlobalObject(field)
rename(name)
setEmblem(emblem)
setGlobal(field, value)
setGlobalObject(field, value)
setHealth(health)
setInstance(instanceId=None)
setLight(level=0, color=0)
setOutfit(looktype, lookhead=0, lookbody=0, looklegs=0, lookfeet=0, addon=0)
setPartyShield(shield)
setShield(shield)
setSkull(skull, creature=None, _time=0)
setSolid(solid)
setSolidFor(player, solid)
setSpeed(speed)
setVar(name, value=None)
shoot(fromPos, toPos, type)
square(creature, color=27)
stopAction()
summon(monsterName, position)
thingId()
toggleHideHealth()
toggleRaiseMessages()
toggleWalkable()
use(thing, index=None)
verifySkulls()
walkable(state=True)

engine Module

A collection of functions that almost every other component requires

game.engine.Return(ret)

Used in exec protocolfunctions to end the function, and give a return value.

exception game.engine.ReturnValueExit(value='')

Bases: exceptions.Exception

A special exception used by game.engine.Return()

game.engine.action(forced=False, delay=0)

Action decorator.

Parameters:
  • forced (bool.) – Supress any other action.
  • delay (float (seconds).) – Delay the start this action.
game.engine.autoWalkCreature(creature, *args, **argw)

Autowalk the creature using the walk patterns. This binds the action slot.

Parameters:
game.engine.autoWalkCreatureTo(creature, to, skipFields=0, diagonal=True, callback=None)

Autowalk the creature using the walk patterns. This binds the action slot.

Parameters:
  • creature (game.creature.Creature.) – The creature to autowalk of type game.creature.Creature or any subclass of it.
  • to (list or tuple.) – Destination position.
  • skipFields (int.) – Don’t walk the last steps to the destination. Useful if you intend to walk close to a target.
  • diagonal (bool.) – Allow diagonal walking?
  • callback (function.) – Call this function when the creature reach it’s destination.
game.engine.broadcast(message, type='MSG_GAMEMASTER_BROADCAST', sendfrom='SYSTEM', level=0)

Broadcasts a message to every player

game.engine.calculateWalkPattern(creature, fromPos, to, skipFields=None, diagonal=True)

Calculate the route from fromPos to to.

Parameters:
  • fromPos (list or tuple.) – Start position.
  • to (list or tuple.) – Destination position.
  • skipFields (int or None.) – Don’t walk the last steps to the destination. Useful if you intend to walk close to a target.
  • diagonal (bool.) – Allow diagonal walking?
game.engine.checkLightLevel()

Check if the lightlevel have changed and send updates to the players.

game.engine.executeCode(*args, **kwargs)

Used by execute protocol to run a piece of code

game.engine.explainPacket(packet)

Explains the packet structure in hex

Parameters:packet (subclass of core.packet.TibiaPacket.) – Packet to explain.
game.engine.fastPickler(obj)

Just a allias for pickle.dumps with protocol 2

game.engine.getCreatureByCreatureId(cid)

Returns the creature with this id.

game.engine.getCreatures(pos, radius=(8, 6), ignore=())

Gives you the creatures in the area.

Parameters:
  • pos (list or tuple.) – Position of the center point.
  • radius (list or tuple.) – Radius from center point to check for creatures.
  • ignore (list, tuple or set.) – known creatures to ignore in the set.
Return type:

set of game.creature.Creature compatible objects

game.engine.getHouseByPos(pos)

Return the House object on this position

game.engine.getLightLevel()

Get the light level relevant to the time of the day.

Return type:int.
game.engine.getPlayer(playerName)

Returns the player with name playerName, this function only works for already loaded players.

game.engine.getPlayerIDByName(*args, **kwargs)

Returns the playerID based on the name.

Return type:int or None.
game.engine.getPlayers(pos, radius=(8, 6), ignore=())

Gives you the players in the area.

Parameters:
  • pos (list or tuple.) – Position of the center point.
  • radius (list or tuple.) – Radius from center point to check for players.
  • ignore (list, tuple or set.) – known players to ignore in the set.
Return type:

set of game.player.Player compatible objects

game.engine.getSpectators(pos, radius=(8, 6), ignore=())

Gives you the spectators (service.gameserver.GameProtocol) in the area.

Parameters:
  • pos (list or tuple.) – Position of the center point.
  • radius (list or tuple.) – Radius from center point to check for players.
  • ignore (list, tuple or set.) – known spectators to ignore in the set.
Return type:

set of service.gameserver.GameProtocol

game.engine.getTibiaTime()

Return the Time inside the game.

Return type:tuple (hours, minutes, seconds).
game.engine.handleAutoWalking(creature, callback=None, level=0)

This handles the actual step by step walking of the autowalker functions. Rarely called directly.

game.engine.hasSpectators(pos, radius=(8, 6), ignore=())

Returns True if anyone can see the position, otherwise False.

game.engine.loadPlayer(*args, **kwargs)

Load player with name playerName, return result.

game.engine.loadPlayerById(*args, **kwargs)

Load a player with id playerId. Return result.

game.engine.loopDecorator(time)

Loop function decorator.

Parameters:time (float (seconds).) – Run the function every time seconds.
game.engine.looper(function, time)

Looper decorator

game.engine.magicEffect(pos, type)

Send a magic effect type on this position.

game.engine.mail(toPlayer, package, message='', town=0, ignoreLimits=True)

Make a parcel, letter, if package is not already a parcel or letter. And send it.

game.engine.moveItem(player, fromPosition, toPosition, count=0)

Move item (or count number of items) from fromPosition to toPosition (may be Position in inventory of player, or a StackPosition).

game.engine.placeInDepot(*args, **kwargs)

Place items into the depotId of player with a name. This can be used even if the player is offline.

Parameters:
  • name (str.) – Player name.
  • depotId (int or str.) – DepotID to place items into.
  • items (Either one object of type game.item.Item, or a list of objects.) – Either one Item or a list of items to place into the depot.
Return type:

bool.

Returns:

True on success, False otherwise.

game.engine.placeItem(item, position)

Place a item to a position

Parameters:
  • item (Object of type game.item.Item.) – The item to place.
  • position (list or tuple.) – The position to place the item on.
Return type:

int.

Returns:

Stack position of item.

game.engine.positionInDirection(nposition, direction, amount=1)

Gives the position in a direction

Parameters:
  • nposition (list.) – Current position.
  • direction (int (range 0-7).) – The direction.
  • amount (int.) – Amount of steps in that direction.
Return type:

list.

Returns:

New position.

game.engine.relocate(fromPos, toPos)

Remove all movable items on fromPos tile, to toPos tile.

game.engine.saveAll(force=False)

Save everything, players, houses, global storage etc.

game.engine.summonCreature(name, position, master=None)

Summons a monster with name on position, set master to master.

game.engine.teleportItem(item, fromPos, toPos)

“teleport” a item from fromPos to toPos

Parameters:
Return type:

int()

Returns:

New stack position

game.engine.townIdToName(id)

Returns the name of a down based on the id.

Return type:str or None.
game.engine.townNameToId(name)

Return the townID based on town name.

Return type:int or None.
game.engine.townPosition(id)

Returns the position of a town passed by id

Return type:list
game.engine.transformItem(item, transformTo)

Transform item to a new Id.

Parameters:
  • item (Object of type game.item.Item.) – The item you want to transform.
  • transformTo (int or None.) – New itemID. Leave to 0 or None to delete the item.
game.engine.updateTile(pos, tile)

Send the update to a tile to all who can see the position. Note that this function does NOT replace the known tile in :mod:`game.map`’s knownMap array.

Parameters:
  • pos (list or tuple.) – Position of tile.
  • tile (Tile of type game.map.Tile.) – The tile that replace the currently known tile at the position.

enum Module

game.enum.LIGHTCOLOR_DEFAULT = 206

Default, orange light.

game.enum.LIGHTCOLOR_NONE = 0

Dark light.

game.enum.LIGHTCOLOR_WHITE = 215

White light.

game.enum.LIGHTLEVEL_FULL = 27

Full light within a area.

game.enum.LIGHTLEVEL_NONE = 0

No light.

game.enum.LIGHTLEVEL_TORCH = 7

Light with a touch.

game.enum.LIGHTLEVEL_WORLD = 255

Light over the entier world.

game.enum.MAGIC_LEVEL = 7

For skill callback

game.enum.SKILL_AXE = 3

Skill ID for axes.

game.enum.SKILL_CLUB = 1

Skill ID for clubs.

game.enum.SKILL_DISTANCE = 4

Skill ID for distance weapons.

game.enum.SKILL_FISH = 6

Skill ID for fishing.

game.enum.SKILL_FIST = 0

Skill ID for fisting.

game.enum.SKILL_SHIELD = 5

Skill ID for shielding.

game.enum.SKILL_SWORD = 2

Skill ID for swords.

game.enum.SLOT_AMMO = 9

Inventory slot for the ammonition.

game.enum.SLOT_ARMOR = 3

Inventory slot for the armor.

game.enum.SLOT_BACKPACK = 2

Inventory slot for the backpack.

game.enum.SLOT_FEET = 7

Inventory slot for feets.

game.enum.SLOT_HEAD = 0

Inventory slot for the head.

game.enum.SLOT_LEFT = 4

Inventory slot for the right hand.

game.enum.SLOT_LEGS = 6

Inventory slot for legs.

game.enum.SLOT_NECKLACE = 1

Inventory slot for the necklace.

game.enum.SLOT_RIGHT = 5

Inventory slot for the left hand.

game.enum.SLOT_RING = 8

Inventory slot for the rings.

errors Module

exception game.errors.BaseError(value='')

Bases: exceptions.Exception

exception game.errors.Cheat(value='')

Bases: game.errors.BaseError

exception game.errors.ImpossibleMove(value='')

Bases: game.errors.BaseError

exception game.errors.MsgCancel(value='')

Bases: game.errors.BaseError

exception game.errors.MsgCantUseObjectThatFast(value='')

Bases: game.errors.BaseError

exception game.errors.MsgNotPossible(value='')

Bases: game.errors.BaseError

exception game.errors.MsgUnmarkedPlayer(value='')

Bases: game.errors.BaseError

exception game.errors.PositionNegative(value='')

Bases: game.errors.BaseError

exception game.errors.PositionOutOfRange(value='')

Bases: game.errors.BaseError

exception game.errors.RuneDoesNotExist(value='')

Bases: game.errors.SpellDoesNotExist

exception game.errors.SolidTile(value='')

Bases: game.errors.BaseError

exception game.errors.SpellDefinition(value='')

Bases: game.errors.BaseError

exception game.errors.SpellDoesNotExist(value='')

Bases: game.errors.BaseError

item Module

class game.item.Item(itemId, count=1, actions=None, **kwargs)

Bases: object

actionIds()
addAction(name)
attributes = {'hangable': 65536, 'blockpath': 4, 'hasheight': 8, 'stackable': 128, 'ontop': 8192, 'rotatable': 32768, 'blockprojectile': 2, 'readable': 16384, 'clientcharges': 4194304, 'allowdistread': 1048576, 'animation': 16777216, 'pickable': 32, 'usable': 16, 'fcs': 2048, 'vertical': 131072, 'fcw': 4096, 'movable': 64, 'fcd': 256, 'fce': 1024, '_unused': 2097152, 'horizontal': 262144, 'fcn': 512, 'lookthrough': 8388608, 'cannotdecay': 524288, 'solid': 1}
cid
cleanParams()
containerWeight()
copy()
decay(to=None, duration=None, callback=None)
decayNow()
description(player=None)
findSlot(item)
formatName(player=None)
getRecursive(items=None)
getRecursiveWithBag(items=None)
getThing(pos)
getsub()
hasAction(name)
isItem()
isMonster()
isNPC()
isPlayer()
modify(mod)
move(newPosition)
place(position, creature=None)
placeItem(item)
placeItemRecursive(item)
rawName()
reduceCount(count)
refresh(position=None)
register(event, func, **kwargs)
registerAll(event, func, **kwargs)
remove(position=None)
removeAction(name)
removeItem(item)
setPosition(position, creature=None)
size()
slots()
stopDecay()
thingId()
transform(toId, position=None)
type
useCharge()
verifyPosition()
game.item.attribute(itemId, attr)
game.item.cid(sid)
game.item.idByName(name)
game.item.loadItems()
game.item.sid(cid)

map Module

class game.map.HouseTile(ground, items=None, flags=0)

Bases: game.map.Tile

houseId
position
class game.map.Tile(ground, items=None, flags=0)

Bases: object

bottomItems()

Returns a list or tuple with bottom items.

copy()

Returns a copy of this tile. Used internally for unstacking.

creatures()

Returns an iterator over all creatures on this tile.

findClientItem(cid, stackpos=None)

(DON’T USE THIS)

findItem(itemId)

returns the first item with id equal to itemId

findStackpos(thing)

Returns the stackposition of that thing on this tile.

flags
getBottomItemCount()

Return the number of non-ontop items (game.item.Item) (minus the ground) on this tile.

getCreatureCount()

Returns the number of creatures on this tile.

getFlags()

Return the tile flags

getItemCount()

Returns the number of items (game.item.Item) (minus the ground) on this tile.

getItems()

Returns an iterator over all items on this tile.

getThing(stackpos)

Returns the thing on this stack position.

getTopItemCount()

Return the number of ontop items (game.item.Item) (minus the ground) on this tile.

ground
hasCreatures()

Returns True if the tile holds any creatures (game.creature.Creature).

placeCreature(creature)

Place a Creature (subclass of game.creature.Creature) on the tile.

placeItem(item)

Place an Item (game.item.Item) on the tile. This automatically deals with ontop etc.

placeItemEnd(item)

Place an idea at the end of the item stack. This function should NOT usually be used with ontop items.

removeCreature(creature)

Remove a Creature (subclass of (game.creature.Creature) on the tile.

removeItem(item)

Remove the item (game.item.Item) from the tile.

removeItemWithId(itemId)

Remove items with id equal itemId on this tile.

setFlag(flag)

Set a flag on the tile

setThing(stackpos, item)

Set the item (can be either a creature or a item) to this stack position. stackpos is one less due to ground.

things
topCreature()

Returns the top (first) creature (subclass of game.creature.Creature) on the tile.

topItems()

Returns an iterator over top items (including the ground).

unsetFlag(flag)

Unset a flag on the tile

game.map.attributeIds = ('actions', 'count', 'solid', 'blockprojectile', 'blockpath', 'usable', 'pickable', 'movable', 'stackable', 'ontop', 'hangable', 'rotatable', 'animation', 'doorId', 'depotId', 'text', 'written', 'writtenBy', 'description', 'teledest')

<uint8>floor_level floorLevel < 60

<loop>

<uint16>itemId <uint8>attributeCount / other

itemId >= 100:
every attributeCount (
See attribute format

)

itemId == 50:
<int32> Tile flags
itemId == 51:
<uint32> houseId
itemId == 0:
skip attributeCount fields
{
; -> go to next tile | -> skip the remaining y tiles (if itemId = 0, and attrNr, skip attrNr x tiles) ! -> skip the remaining x and y tiles , -> more items

}

floorLevel == 60:

<uint16>center X <uint16>center Y <uint8>center Z <uint8> Radius from center creature might walk <uint8> count (

<uint8> type (61 for Monster, 62 for NPC) <uint8> nameLength <string> Name

<int8> X from center <int8> Y from center

<uint16> spawntime in seconds

}

)

Attribute format:

{

<uint8>attributeId <char>attributeType {

attributeType == i (
<int32>value

) attributeType == s (

<uint16>valueLength <string with length valueLength>value

) attributeType == T attributeType == F

attributeType == l (
<uint8>listItems <repeat this block for listItems times> -> value

)

}

}

game.map.creature_unpack()

S.unpack(str) -> (v1, v2, ...)

Return tuple containing values unpacked according to this Struct’s format. Requires len(str) == self.size. See struct.__doc__ for more on format strings.

game.map.getHouseId(pos)

Returns the houseId on this position, or False if none

game.map.getTile(pos)

Returns the Tile on this position.

game.map.getTileConst(x, y, z, instanceId)

Return the tile on this (unpacked) position.

game.map.l_unpack()

S.unpack(str) -> (v1, v2, ...)

Return tuple containing values unpacked according to this Struct’s format. Requires len(str) == self.size. See struct.__doc__ for more on format strings.

game.map.load(sectorX, sectorY, instanceId, sectorSum)

Load sectorX.sectorY.sec. Returns True/False

game.map.loadSectorMap(code, instanceId, baseX, baseY)

Parse the code (sector data) starting at baseX,baseY. Returns the sector.

game.map.loadTiles(x, y, instanceId, sectorSum)

Load the sector witch holds this x,y position. Returns the result.

game.map.long_unpack()

S.unpack(str) -> (v1, v2, ...)

Return tuple containing values unpacked according to this Struct’s format. Requires len(str) == self.size. See struct.__doc__ for more on format strings.

game.map.newInstance(base=None)

Returns a new instanceId

game.map.placeCreature(creature, pos)

Place a creature on this position.

game.map.removeCreature(creature, pos)

Remove the creature on this position.

game.map.setTile(pos, tile)

Set the tile on this position.

game.map.spawn_unpack()

S.unpack(str) -> (v1, v2, ...)

Return tuple containing values unpacked according to this Struct’s format. Requires len(str) == self.size. See struct.__doc__ for more on format strings.

game.map.unload(sectorX, sectorY, instanceId)

Unload sectorX.sectorY, loaded into instanceId

monster Module

class game.monster.Monster(base, position, cid=None)

Bases: game.creature.Creature

actionIds()
damageToBlock(dmg, type)
defaultSpeed()
description()
generateClientID()
isAttackable(by)
isMonster()
isPushable(by)
isSummon()
isSummonFor(creature)
onDeath()
setMaster(creature)
setRespawn(state)
targetCheck(targets=None)
turnOffBrain()
verifyMove(tile)

This function verify if the tile is walkable in a regular state (pathfinder etc) This function handle things like PZ.

class game.monster.MonsterBase(data, brain)

Bases: object

bloodType(color='blood')
defaultSpawnTime(spawnTime)
loot(*argc)
maxSummons(max)
prepare()
regCorpseAction(action)
regDistance(maxDamage, shooteffect, check=<function gen at 0x501eb90>, interval=2)
regMelee(maxDamage, check=<function <lambda> at 0x501eaa0>, interval=2, condition=None, conditionChance=0, conditionType=2)
regSelfSpell(spellName, min, max, interval=2, check=<function gen at 0x501ed70>, length=None)
regTargetSpell(spellName, min, max, interval=2, check=<function gen at 0x501ec80>, range=7, length=None)
setAddons(addon)
setBehavior(summonable=0, hostile=1, illusionable=0, convinceable=0, pushable=0, pushItems=1, pushCreatures=1, targetDistance=1, runOnHealth=0, targetChange=1)
setBrainFeatures(*argc)
setDefense(armor=0, fire=1, earth=1, energy=1, ice=1, holy=1, death=1, physical=1, drown=1)
setExperience(experience)
setHealth(health, healthmax=None)
setImmunity(paralyze=1, invisible=1, lifedrain=1, drunk=1)
setOutfit(lookhead, lookbody, looklegs, lookfeet)
setRandomWalkInterval(per)
setSkull(skull)
setSpeed(speed)
setTargetChance(chance=10)
setWalkable(state)
spawn(position, place=True, spawnTime=None, spawnDelay=0.1, radius=5, radiusTo=None, monster=None, check=False)
summon(monster=None, chance=10)
voices(*argc)
walkAround(energy=0, fire=0, poison=0)
class game.monster.MonsterBrain

Bases: object

beginThink(monster, check=False)
handleThink(monster, check=True)
walkRandomStep(monster, badDir=None, steps=[0, 1, 2, 3])
game.monster.chance(procent)
game.monster.genMonster(name, look, description='')
game.monster.getMonster(name)
game.monster.regBrainFeature(name, function)

npc Module

class game.npc.ClassAction(on)

Bases: object

game.npc.Conversation(words, open, close=None)
class game.npc.NPC(base, position, cid=None)

Bases: game.creature.Creature

actionIds()
buy(player, itemId, subtype, amount, ignoreCapacity=True, withBackpack=False)
description()
farewell(player)
generateClientID()
handleSpeak(player, said)
handleSpeakTree(player, said)
hasAction(name)
isAttackable(by)
isNPC()
playerSay(player, said, type, channel)
sayTo(to, text, messageType='_MSG_NPC_FROM')
sell(player, itemId, subtype, amount, ignoreEquipped=True)
sendGoods(to, forSale=None, streamX=None)
sendTradeOffers(to)
setRespawn(state)
turnOffBrain()
class game.npc.NPCBase(brain, data)

Bases: object

bloodType(color='blood')
farewell(farewell)
greet(greet)
module(action)
onSaid(what, open, close=None)
regAction(action)
setActions(*argc)
setAddons(addon)
setAttackable(attackable)
setBrainFeatures(*argc)
setDefense(armor=0, fire=0, earth=0, energy=0, ice=0, holy=0, death=0, physical=0, drown=0)
setHealth(health, healthmax=None)
setRandomWalkInterval(per)
setSpeed(speed)
setWalkable(state)
spawn(position, place=True, spawnDelay=0.1, spawnTime=60, radius=5, radiusTo=None)
speakTree(tree, farewell=None)
class game.npc.NPCBrain

Bases: game.monster.MonsterBrain

handleThink(npc, check=True)
game.npc.chance(procent)
game.npc.genNPC(name, look, description='')
game.npc.getNPC(name)
game.npc.regBrainFeature(name, function, priority=1)
game.npc.regClassAction(name, myClass)

pathfinder Module

class game.pathfinder.AStar(checkCreature, zStart, xStart, yStart, xGoal, yGoal, instanceId)

Bases: object

aroundNode(node)
getCheapest()
getNode(x, y)
class game.pathfinder.Node(x, y)

Bases: object

verify(z, instanceId, checkCreature)
game.pathfinder.clear()
game.pathfinder.findPath(checkCreature, zStart, xStart, yStart, xGoal, yGoal, instanceId)

player Module

class game.player.Player(client, data)

Bases: game.creature_talking.PlayerTalking, game.creature_attacks.PlayerAttacks, game.creature.Creature

actionIds()
addCache(item, container=None)
addItem(item, placeOnGround=True)
addMoney(amount)
addMount(name)
addOutfit(name)
addOutfitAddon(name, addon)
addSkillLevel(skill, levels)
addVip(playerId)
addVipByName(*args, **kwargs)
arrowUpContainer(openId)
beginQuest(questIdentifier)
canDoSpell(icon, group)
canUseMount(name)
canUseSpell(name)
canWearOutfit(name)
cancelWalk(direction=None)
checkRemoveKnown()
closeContainer(container)
closeContainerId(openId)
closeMarket()
closeTrade()
cooldownGroup(group, cooldown)
cooldownIcon(icon, cooldown)
cooldownSpell(icon, group, cooldown, groupCooldown=None)
createMarketOffer(type, itemId, amount, price, anonymous=0)
defaultSpeed()
delayWalk(delay)
description(isSelf=False)
dialog(title, message, buttons=['Ok', 'Exit'], defaultEnter=0, defaultExit=1)
exit(message)
findItem(position, sid=None)
findItemById(itemId, count=0)
findItemWithPlacement(position, sid=None)
finishQuest(questIdentifier)
followCallback(who)
freeCapacity()
generateClientID()
getActiveSkill(skill)
getAddonsForOutfit(name)
getBalance()
getContainer(openId)
getDepot(depotId)
getDepotItemCount(depotId)
getDepotMarketCache(depotId)
getExperienceRate()
getGroupFlags(default={})
getIP()
getMoney()
getRegainRate()
getShield(creature)
getSkillAttempts(skill)
getSkull(creature=None)
getSpells()
getStorage(field, default=None)
getVips()
getVocation()
getVocationId()
guild()
guildRank()
hasGroupFlag(flag)
hasGroupFlags(*flags)
houseWindow(text)
isPlayer()
isPushable(by)
isVip(playerId)
itemCount(item)
itemLosePrecent()
itemToContainer(container, item, count=None, recursive=True, stack=True, placeOnGround=True, streamX=None)
itemToInventory(item, slot=None, stack=True)
itemToUse(item)
lastClientMove = None

# Light stuff self.lightLevel = 0x7F self.lightColor = 27

learnSpell(name)
leaveParty()
losePrecent(withBlessings=True)
mapMarker(position, typeId, desc='')
marketDetails(itemId)
marketHistory(*args, **kwargs)
marketOffers(itemId)
marketOwnOffers()
media()
modifyBalance(modBalance)
modifyCache(item, count)
modifyExperience(exp)
modifyLevel(mod)
modifyMagicLevel(mod)
modifyMana(mana)
modifySoul(soul)
modifySpentMana(mana, refresh=False)
modifyStorage(field, change)
newParty()
onDeath()
onSpawn()
openContainer(container, parent=False, update=False)
openMarket(marketId=0)
outfitWindow()
packet(type=None)
party()
pickleDepot()
pickleInventory()
pong()
prepareLogout(force=False)
progressQuest(questIdentifier)
progressQuestMission(questIdentifier)
questCompleted(questIdentifier)
questLine(questIdentifier)
questLog()
questProgress(questIdentifier)
questStarted(questIdentifier)
refreshConditions(stream=None)
refreshInventory(streamX=None)
refreshShield()
refreshSkills(stream=None)
refreshSkull(stream=None)
refreshStatus(stream=None)
refreshViewWindow(stream=None)
removeCache(item)
removeFromDepot(depotId, itemId, count=1)
removeIcon(icon)
removeItem(thing)
removeKnown(creature)
removeMoney(amount)
removeMount(name)
removeOutfit(name)
removeOutfitAddon(name, addon)
removeStorage(field)
removeVip(playerId)
removeVipByName(*args, **kwargs)
save(force=False)
saveExperience()
saveSkills()
saveStorage()
sendFirstPacket()
sendReloginWindow(percent=0)
sendVipList(*args, **kwargs)
setBalance(balance)
setDepot(depotId, storage)
setExperienceRate(rate)
setFollowTarget(cid)
setIcon(icon)
setLanguage(lang)
setLevel(level, send=True)
setMana(mana)
setModes(attack, chase, secure)
setParty(partyObj)
setRegainRate(rate)
setShield(shield)
setSoul(soul)
setStorage(field, value)
setTarget(target)
setTrade(npc)
setWindowHandler(windowId, callback)
sexAdjective()
sexPrefix()
skillAttempt(skillType, amount=1)
soulGain()
square(creature, color=27)
stopAutoWalk()
tempAddSkillLevel(skill, level)
tempRemoveSkillLevel(skill)
textWindow(item, canWrite=False, maxLen=255, text='', writtenBy='', timestamp=0)
togglePremium()
tradeItemRequest(between, items, confirm=False)
tutorial(tutorialId)
unlearnSpell(name)
unpickleInventory(inventoryData)
updateAllContainers()
updateContainer(container, parent=False, update=True)
updateInventory(slot)

protocol Module

game.protocol.getProtocol(version)
game.protocol.loadProtocol(version)

resource Module

class game.resource.Mount(name, cid, speed=0, premium=False)

Bases: object

class game.resource.Outfit(name='', premium=False)

Bases: object

getLook(gender=0)
look(looktype, lookhead=0, lookbody=0, looklegs=0, lookfeet=0, gender=0)
class game.resource.Quest(name)

Bases: object

description(description)
mission(name)
game.resource.genMount(name, cid, speed=0, premium=False)
game.resource.genOutfit(name, premium=False)
game.resource.genQuest(name)
game.resource.getMount(name)
game.resource.getOutfit(name)
game.resource.getQuest(name)
game.resource.regMount(mount)
game.resource.regOutfit(outfit)

scriptsystem Module

class game.scriptsystem.CreatureScripts(parameters=())

Bases: game.scriptsystem.ThingScripts

exception game.scriptsystem.InvalidScriptFunctionArgument

Bases: exceptions.Exception

class game.scriptsystem.NCScripts(parameters=())

Bases: game.scriptsystem.Scripts

run(end=None, **kwargs)
runDefer(end=None, **kwargs)
runSync(end=None, **kwargs)
class game.scriptsystem.RegexTriggerScripts(parameters=())

Bases: game.scriptsystem.TriggerScripts

parameters
register(trigger, callback, weakfunc=True)
registerFirst(trigger, callback, weakfunc=True)
scripts
weaks
class game.scriptsystem.Scripts(parameters=())

Bases: object

parameters
register(callback, weakfunc=True)
run(creature, end=None, **kwargs)
runDefer(creature, end=None, **kwargs)
runSync(creature, end=None, **kwargs)
scripts
unregister(callback)
weaks
class game.scriptsystem.ThingScripts(parameters=())

Bases: object

handleCallback(callback)
haveScripts(id)
makeResult(obj)
parameters
register(id, callback, weakfunc=True)
registerFirst(id, callback, weakfunc=True)
run(thing, creature, end=None, **kwargs)
runDefer(thing, creature, end=None, **kwargs)
runDeferNoReturn(thing, creature, end=None, **kwargs)
runSync(thing, creature, end=None, **kwargs)
scripts
thingScripts
unregAll(id)
unregister(id, callback)
weaks
class game.scriptsystem.TriggerScripts(parameters=())

Bases: object

parameters
register(trigger, callback, weakfunc=True)
registerFirst(trigger, callback, weakfunc=True)
run(trigger, creature, end=None, **kwargs)
runSync(trigger, creature, end=None, **kwargs)
scripts
unregister(trigger, callback)
weaks
game.scriptsystem.access(*groupFlags, **kwargs)
game.scriptsystem.callEvent(time, func)
game.scriptsystem.callEventDate(date, func)
game.scriptsystem.get(type)
game.scriptsystem.handleModule(name)
game.scriptsystem.handlePostLoadEntries()
game.scriptsystem.importer()
game.scriptsystem.regEvent(timeleap, callback)
game.scriptsystem.regEventTime(date, callback)
game.scriptsystem.register(type, *argc)
game.scriptsystem.registerFirst(type, *argc)
game.scriptsystem.registerForAttr(type, attr, callback)
game.scriptsystem.reimportCleanup()
game.scriptsystem.reimporter()
game.scriptsystem.run()
game.scriptsystem.scriptInitPaths(base, subdir=True)
game.scriptsystem.unregister(type, *argc)

spell Module

class game.spell.Rune(rune, icon=0, count=1, target=2, group=1)

Bases: game.spell.Spell

doEffect()
class game.spell.Spell(name=None, words=None, icon=0, target=2, group=1)

Bases: object

area(area)
casterCondition(*argc, **kwargs)
casterEffect(mana=0, health=0, soul=0, callback=None)
cooldowns(cooldown=0, groupCooldown=None)
doEffect()
effects(caster=None, shoot=None, target=None, area=None)
element(type)
range(distance)
require(learned=False, vocations=None, **kwargs)
requireCallback(*args)
requireLess(**kwargs)
targetCondition(*argc, **kwargs)
targetEffect(mana=0, health=0, soul=0, callback=None)
use(itemId=2260, count=1)
game.spell.calculateAreaDirection(position, direction, area)
game.spell.clear()
game.spell.conjure(make, count=1, **kwargs)
game.spell.cure(condition)
game.spell.damage(mlvlMin, mlvlMax, constantMin, constantMax, type=8, lvlMin=5, lvlMax=5)
game.spell.element(type)
game.spell.field(fieldId)
game.spell.heal(mlvlMin, mlvlMax, constantMin, constantMax, lvlMin=5, lvlMax=5, cure=32)
game.spell.mana(mlvlMin, mlvlMax, constantMin, constantMax, lvlMin=5, lvlMax=5)
game.spell.typeToEffect(type)

vocation Module

class game.vocation.Vocation(id, cid, name, description, health, mana, soulticks)

Bases: object

capacityFormula(formula)

Set the capasity formula to formula

description()

Return the description (name) of the vocation

hpFormula(formula)

Set the maximum health formula to formula

manaFormula(formula)

Set the maximum mana formula to formula.

maxCapacity(level)

Return the maximum capasity for level level

maxHP(level)

Return the maximum health for level level.

maxMana(level)

Return the maximum mana for level level.

maxSoul(soul)

Set max soul value to soul

meleeSkillConstant(constant)

Set the melee constant, used in melee damage formulas.

mlevelConstant(constant)

Set the magic level constant.

game.vocation.getVocation(name)

Get the vocation by name

game.vocation.getVocationById(id)

Get the vocation by id

game.vocation.regVocation(id, cid, name, description, health, mana, soulticks)

Register a new vocation, and return the Vocation object

house Module

class game.house.House(id, owner, guild, paid, name, town, size, rent, data)

Bases: object

addDoorAccess(doorId, name)
addGuest(name)
addSubOwner(name)
getDoorAccess(doorId)
haveDoorAccess(doorId, nameOrPlayer)
isGuest(nameOrPlayer)
isSubOwner(nameOrPlayer)
removeDoorAccess(doorId, name)
removeGuest(name)
removeSubOwner(name)
game.house.getHouseById(id)

guild Module

class game.guild.Guild(id, name, motd, balance)

Bases: object

addMoney(amount)
getMoney()
rank(rankId)
removeMoney(amount)
setMoney(amount)
setMotd(motd)
setName(motd)
class game.guild.GuildRank(guild_id, rank_id, title, permissions)

Bases: object

guild()
isLeader()
isMember()
isSubLeader()
permission(permission)
game.guild.getGuildById(id)
game.guild.getGuildByName(name)
game.guild.guildExists(id)
game.guild.load(*args, **kwargs)

party Module

class game.party.Party(leader)

Bases: object

addInvite(creature)
addMember(creature)
broadcast(text)
changeLeader(creature)
checkShareExperience()
disband()
getShield(forMember, byMember)
refreshMemberShields()
removeInvite(player)
removeMember(creature)
toggleShareExperience()