Atrinik Server 2.5
Functions
Python player functions

Functions

static PyObject * Atrinik_Player_GetEquipment (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_CanCarry (Atrinik_Player *pl, PyObject *what)
static PyObject * Atrinik_Player_GetSkill (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_AddExp (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_WriteToSocket (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_BankDeposit (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_BankWithdraw (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_BankBalance (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_SwapApartments (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_ExecuteCommand (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_DoKnowSpell (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_AcquireSpell (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_DoKnowSkill (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_AcquireSkill (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_FindMarkedObject (Atrinik_Player *pl, PyObject *args)
static PyObject * Atrinik_Player_Sound (Atrinik_Player *pl, PyObject *args, PyObject *keywds)
static PyObject * Atrinik_Player_Examine (Atrinik_Player *pl, PyObject *args)

Detailed Description

Functions that can only be used on players (not the objects they are controlling).

To access object's player controller, you can use something like:

 activator = WhoIsActivator()
 player = activator.Controller()

In the above example, player points to the player structure (which Python is wrapping) that is controlling the object 'activator'. In this way, you can, for example, use something like this to get player's save bed, among other things:

 print(WhoIsActivator().Controller().savebed_map)

Function Documentation

static PyObject* Atrinik_Player_AcquireSkill ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.AcquireSkill(int skill)

Player will learn skill.

Parameters:
skillID of the skill to learn.

Definition at line 411 of file atrinik_player.c.

static PyObject* Atrinik_Player_AcquireSpell ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.AcquireSpell(int spell, int [learn = True])

Player acquires the specified spell.

Parameters:
spellID of the spell to acquire.
learnIf False, the player will forget the spell instead.

Definition at line 368 of file atrinik_player.c.

static PyObject* Atrinik_Player_AddExp ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.AddExp(int skill, int exp, int [exact = False])

Add (or subtract) experience.

Parameters:
skillID of the skill to receive/lose exp in.
expHow much exp to gain/lose.
exactIf True, the given exp will not be capped.

Definition at line 196 of file atrinik_player.c.

static PyObject* Atrinik_Player_BankBalance ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.BankBalance()

Figure out how much money player has in bank.

Returns:
Integer value of the money in bank.

Definition at line 284 of file atrinik_player.c.

static PyObject* Atrinik_Player_BankDeposit ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.BankDeposit(string text)

Deposit money to bank.

Parameters:
textHow much money to deposit, in string representation.
Returns:
Tuple containing the status code (one of Bank return values) and amount of money deposited as integer.

Definition at line 242 of file atrinik_player.c.

static PyObject* Atrinik_Player_BankWithdraw ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.BankWithdraw(string text)

Withdraw money from bank.

Parameters:
textHow much money to withdraw, in string representation.
Returns:
Tuple containing the status code (one of Bank return values) and amount of money withdrawn as integer.

Definition at line 264 of file atrinik_player.c.

static PyObject* Atrinik_Player_CanCarry ( Atrinik_Player pl,
PyObject *  what 
) [static]

player.CanCarry(object|int what)

Check whether the player can carry the object 'what', taking weight limit into consideration.

Parameters:
whatObject that player wants to get. This can be the exact weight to check instead of calculating the object's weight.
Exceptions:
ValueErrorif 'what' is neither an object nor an integer.
Returns:
True if the player can carry the object, False otherwise.

Definition at line 121 of file atrinik_player.c.

static PyObject* Atrinik_Player_DoKnowSkill ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.DoKnowSkill(int skill)

Check if player knows a given skill.

Parameters:
skillID of the skill to check for.
Returns:
True if the player knows the skill, False otherwise.

Definition at line 395 of file atrinik_player.c.

static PyObject* Atrinik_Player_DoKnowSpell ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.DoKnowSpell(int spell)

Check if player knows a given spell.

Parameters:
spellID of the spell to check for.
Returns:
True if the player knows the spell, False otherwise.

Definition at line 351 of file atrinik_player.c.

static PyObject* Atrinik_Player_Examine ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.Examine(object obj)

Makes player examine the specified object.

Parameters:
objObject to examine.

Definition at line 467 of file atrinik_player.c.

static PyObject* Atrinik_Player_ExecuteCommand ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.ExecuteCommand(string command)

Make player execute a command.

Parameters:
commandCommand to execute.
Exceptions:
AtrinikErrorif player is not in a state to execute commands.
Returns:
Return value of the command.

Definition at line 320 of file atrinik_player.c.

static PyObject* Atrinik_Player_FindMarkedObject ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.FindMarkedObject()

Find marked object in player's inventory.

Returns:
The marked object, or None if no object is marked.

Definition at line 430 of file atrinik_player.c.

static PyObject* Atrinik_Player_GetEquipment ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.GetEquipment(int slot)

Get a player's current equipment for a given slot.

Parameters:
slotOne of PLAYER_EQUIP_xxx constants.
Exceptions:
ValueErrorif 'slot' is lower than 0 or higher than PLAYER_EQUIP_MAX.
Returns:
The equipment for the given slot, can be None.

Definition at line 95 of file atrinik_player.c.

static PyObject* Atrinik_Player_GetSkill ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.GetSkill(int type, int id)

Get skill or experience object.

Parameters:
typeOne of:
  • TYPE_SKILL: get skill object.
  • TYPE_EXPERIENCE: get experience category object.
idID of the skill/experience.
Exceptions:
ValueErrorif 'type' or 'id' parameters are not valid.
Returns:
Skill/experience object, can be None if the player doesn't have the skill or the experience category (the latter should not happen).

Definition at line 153 of file atrinik_player.c.

static PyObject* Atrinik_Player_Sound ( Atrinik_Player pl,
PyObject *  args,
PyObject *  keywds 
) [static]

player.Sound(string filename, int [type = CMD_SOUND_EFFECT], int [x = 0], int [y = 0], int [loop = 0], int [volume = 0])

Play a sound to the specified player.

Parameters:
filenameSound file to play.
typeSound type being played, one of Sound command types.
xX position where the sound is playing from. Can be 0.
yY position where the sound is playing from. Can be 0.
loopHow many times to loop the sound, -1 for infinite number.
volumeVolume adjustment.

Definition at line 446 of file atrinik_player.c.

static PyObject* Atrinik_Player_SwapApartments ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.SwapApartments(string oldmap, string newmap, int x, int y)

Swaps oldmap apartment with newmap one.

Copies old items from oldmap to newmap at x, y and saves the map.

Parameters:
oldmapThe old apartment map.
oldmapThe new apartment map.
xX position to copy the items to.
yY position to copy the items to.
Returns:
True on success, False on failure.

Definition at line 301 of file atrinik_player.c.

static PyObject* Atrinik_Player_WriteToSocket ( Atrinik_Player pl,
PyObject *  args 
) [static]

player.WriteToSocket(int command_id, string command_data)

Send a socket command to player's client. This can be used to fake a book GUI, for example.

Parameters:
command_idThe command's ID to send.
command_dataData to send.

Definition at line 219 of file atrinik_player.c.