Atrinik Server 2.5
Functions | Variables
plugins/plugin_python/atrinik_player.c File Reference
#include <plugin_python.h>

Go to the source code of this file.

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)
static PyObject * get_attribute (Atrinik_Player *pl, void *context)
static int set_attribute (Atrinik_Player *pl, PyObject *value, void *context)
static PyObject * Atrinik_Player_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
static void Atrinik_Player_dealloc (Atrinik_Player *pl)
static PyObject * Atrinik_Player_str (Atrinik_Player *pl)
static int Atrinik_Player_InternalCompare (Atrinik_Player *left, Atrinik_Player *right)
static PyObject * Atrinik_Player_RichCompare (Atrinik_Player *left, Atrinik_Player *right, int op)
int Atrinik_Player_init (PyObject *module)
PyObject * wrap_player (player *pl)

Variables

static fields_struct fields []
static PyMethodDef methods []
static PyGetSetDef getseters [NUM_FIELDS+1]
PyTypeObject Atrinik_PlayerType

Detailed Description

Atrinik Python plugin player related code.

Definition in file atrinik_player.c.


Function Documentation

static void Atrinik_Player_dealloc ( Atrinik_Player pl) [static]

Free a player wrapper.

Parameters:
plThe wrapper to free.

Definition at line 566 of file atrinik_player.c.

int Atrinik_Player_init ( PyObject *  module)

Initialize the player wrapper.

Parameters:
moduleThe Atrinik Python module.
Returns:
1 on success, 0 on failure.

Definition at line 647 of file atrinik_player.c.

static PyObject* Atrinik_Player_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwds 
) [static]

Create a new player wrapper.

Parameters:
typeType object.
argsUnused.
kwdsUnused.
Returns:
The new wrapper.

Definition at line 546 of file atrinik_player.c.

static PyObject* Atrinik_Player_str ( Atrinik_Player pl) [static]

Return a string representation of a player.

Parameters:
plThe player.
Returns:
Python object containing the name of the player.

Definition at line 580 of file atrinik_player.c.

static PyObject* get_attribute ( Atrinik_Player pl,
void *  context 
) [static]

Get player's attribute.

Parameters:
plPython player wrapper.
contextVoid pointer to the field ID.
Returns:
Python object with the attribute value, NULL on failure.

Definition at line 512 of file atrinik_player.c.

static int set_attribute ( Atrinik_Player pl,
PyObject *  value,
void *  context 
) [static]

Set attribute of a player.

Parameters:
whoptrPython player wrapper.
valueValue to set.
contextVoid pointer to the field.
Returns:
0 on success, -1 on failure.

Definition at line 523 of file atrinik_player.c.

PyObject* wrap_player ( player pl)

Utility method to wrap a player.

Parameters:
whatPlayer to wrap.
Returns:
Python object wrapping the real player.

Definition at line 682 of file atrinik_player.c.


Variable Documentation

PyTypeObject Atrinik_PlayerType

Our actual Python PlayerType.

Definition at line 606 of file atrinik_player.c.

fields_struct fields[] [static]
Initial value:
{
    {"next", FIELDTYPE_PLAYER, offsetof(player, next), FIELDFLAG_READONLY, 0},
    {"prev", FIELDTYPE_PLAYER, offsetof(player, prev), FIELDFLAG_READONLY, 0},

    {"party", FIELDTYPE_PARTY, offsetof(player, party), FIELDFLAG_READONLY, 0},
    
    {"class_ob", FIELDTYPE_OBJECT, offsetof(player, class_ob), FIELDFLAG_READONLY, 0},
    {"savebed_map", FIELDTYPE_CARY, offsetof(player, savebed_map), 0, sizeof(((player *) NULL)->savebed_map)},
    {"bed_x", FIELDTYPE_SINT16, offsetof(player, bed_x), 0, 0},
    {"bed_y", FIELDTYPE_SINT16, offsetof(player, bed_y), 0, 0},
    {"ob", FIELDTYPE_OBJECT, offsetof(player, ob), FIELDFLAG_READONLY, 0},
    {"quest_container", FIELDTYPE_OBJECT, offsetof(player, quest_container), FIELDFLAG_READONLY, 0},
    {"dm_stealth", FIELDTYPE_BOOLEAN, offsetof(player, dm_stealth), 0, 0},
    {"target_object", FIELDTYPE_OBJECTREF, offsetof(player, target_object), 0, offsetof(player, target_object_count)},
    {"no_shout", FIELDTYPE_BOOLEAN, offsetof(player, no_shout), 0, 0},
    {"known_spells", FIELDTYPE_LIST, offsetof(player, known_spells), 0, FIELDTYPE_KNOWN_SPELLS},
    {"cmd_permissions", FIELDTYPE_LIST, offsetof(player, cmd_permissions), 0, FIELDTYPE_CMD_PERMISSIONS},
    {"factions", FIELDTYPE_LIST, offsetof(player, faction_ids), 0, FIELDTYPE_FACTIONS},
    {"fame", FIELDTYPE_SINT64, offsetof(player, fame), 0, FIELDTYPE_FACTIONS},

    {"s_ext_title_flag", FIELDTYPE_BOOLEAN, offsetof(player, socket.ext_title_flag), 0, 0},
    {"s_host", FIELDTYPE_CSTR, offsetof(player, socket.host), FIELDFLAG_READONLY, 0},
    {"s_socket_version", FIELDTYPE_UINT32, offsetof(player, socket.socket_version), FIELDFLAG_READONLY, 0}
}

Player fields.

Definition at line 38 of file atrinik_player.c.

PyGetSetDef getseters[NUM_FIELDS+1] [static]

This is filled in when we initialize our player type.

Definition at line 603 of file atrinik_player.c.

PyMethodDef methods[] [static]
Initial value:
{
    {"GetEquipment", (PyCFunction) Atrinik_Player_GetEquipment, METH_VARARGS, 0},
    {"CanCarry", (PyCFunction) Atrinik_Player_CanCarry, METH_O, 0},
    {"GetSkill", (PyCFunction) Atrinik_Player_GetSkill, METH_VARARGS, 0},
    {"AddExp", (PyCFunction) Atrinik_Player_AddExp, METH_VARARGS, 0},
    {"WriteToSocket", (PyCFunction) Atrinik_Player_WriteToSocket, METH_VARARGS, 0},
    {"BankDeposit", (PyCFunction) Atrinik_Player_BankDeposit, METH_VARARGS, 0},
    {"BankWithdraw", (PyCFunction) Atrinik_Player_BankWithdraw, METH_VARARGS, 0},
    {"BankBalance", (PyCFunction) Atrinik_Player_BankBalance, METH_NOARGS, 0},
    {"SwapApartments", (PyCFunction) Atrinik_Player_SwapApartments, METH_VARARGS, 0},
    {"ExecuteCommand", (PyCFunction) Atrinik_Player_ExecuteCommand, METH_VARARGS, 0},
    {"DoKnowSpell", (PyCFunction) Atrinik_Player_DoKnowSpell, METH_VARARGS, 0},
    {"AcquireSpell", (PyCFunction) Atrinik_Player_AcquireSpell, METH_VARARGS, 0},
    {"DoKnowSkill", (PyCFunction) Atrinik_Player_DoKnowSkill, METH_VARARGS, 0},
    {"AcquireSkill", (PyCFunction) Atrinik_Player_AcquireSkill, METH_VARARGS, 0},
    {"FindMarkedObject", (PyCFunction) Atrinik_Player_FindMarkedObject, METH_NOARGS, 0},
    {"Sound", (PyCFunction) Atrinik_Player_Sound, METH_VARARGS | METH_KEYWORDS, 0},
    {"Examine", (PyCFunction) Atrinik_Player_Examine, METH_VARARGS, 0},
    {NULL, NULL, 0, 0}
}

Available Python methods for the AtrinikPlayer type.

Definition at line 485 of file atrinik_player.c.