|
Atrinik Server 2.5
|
Go to the source code of this file.
Data Structures | |
| struct | _pythoncontext |
| struct | Atrinik_Constant |
| struct | Atrinik_Object |
| struct | Atrinik_Map |
| struct | Atrinik_Party |
| struct | Atrinik_Region |
| struct | Atrinik_Player |
| struct | Atrinik_Archetype |
| struct | Atrinik_AttrList |
| struct | PythonCmdStruct |
| struct | fields_struct |
Defines | |
| #define | IS_PY_LEGACY |
| #define | PyObject_AsFileDescriptor(op) (PyFile_AsFile((op)) ? PyFile_AsFile((op))->fd : -1) |
| #define | PLUGIN_NAME "Python" |
| #define | PLUGIN_VERSION "Atrinik Python Plugin 1.0" |
| #define | AROUND_ALL 0 |
| #define | AROUND_WALL 1 |
| #define | AROUND_BLOCKSVIEW 2 |
| #define | AROUND_PLAYER_ONLY 4 |
| #define | INVENTORY_ONLY 0 |
| #define | INVENTORY_CONTAINERS 1 |
| #define | INVENTORY_ALL 2 |
| #define | LOG hooks->LOG |
| #define | FREE_AND_COPY_HASH(_sv_, _nv_) |
| #define | FREE_AND_CLEAR_HASH(_nv_) |
| #define | SET_ANIMATION(ob, newanim) ob->face = &(*hooks->new_faces)[(*hooks->animations)[ob->animation_id].faces[newanim]] |
| #define | NUM_ANIMATIONS(ob) ((*hooks->animations)[ob->animation_id].num_animations) |
| #define | NUM_FACINGS(ob) ((*hooks->animations)[ob->animation_id].facings) |
| #define | RAISE(msg) |
| #define | INTRAISE(msg) |
| #define | FIELDFLAG_READONLY 1 |
| #define | FIELDFLAG_PLAYER_READONLY 2 |
| #define | FIELDFLAG_PLAYER_FIX 4 |
| #define | OBJ_ITER_TYPE_NONE 0 |
| #define | OBJ_ITER_TYPE_BELOW 1 |
| #define | OBJ_ITER_TYPE_ABOVE 2 |
| #define | OBJ_ITER_TYPE_ONE 3 |
| #define | NUM_FIELDS (sizeof(fields) / sizeof(fields[0])) |
| #define | NR_CUSTOM_CMD 1024 |
| #define | OBJEXISTCHECK_INT(ob) |
| #define | OBJEXISTCHECK(ob) |
| #define | SQUARES_AROUND_ADD(_m, _x, _y) |
| #define | Py_ReturnBoolean(val) |
Typedefs | |
| typedef struct _pythoncontext | PythonContext |
| typedef struct Atrinik_Object | Atrinik_Object |
| typedef struct PythonCmdStruct | PythonCmd |
Enumerations | |
| enum | field_type { FIELDTYPE_SHSTR, FIELDTYPE_CSTR, FIELDTYPE_CARY, FIELDTYPE_UINT8, FIELDTYPE_SINT8, FIELDTYPE_UINT16, FIELDTYPE_SINT16, FIELDTYPE_UINT32, FIELDTYPE_SINT32, FIELDTYPE_UINT64, FIELDTYPE_SINT64, FIELDTYPE_FLOAT, FIELDTYPE_OBJECT, FIELDTYPE_OBJECT2, FIELDTYPE_MAP, FIELDTYPE_OBJECTREF, FIELDTYPE_REGION, FIELDTYPE_PARTY, FIELDTYPE_ARCH, FIELDTYPE_PLAYER, FIELDTYPE_FACE, FIELDTYPE_ANIMATION, FIELDTYPE_BOOLEAN, FIELDTYPE_LIST, FIELDTYPE_KNOWN_SPELLS, FIELDTYPE_CMD_PERMISSIONS, FIELDTYPE_FACTIONS } |
Functions | |
| PyObject * | wrap_object (object *what) |
| int | Atrinik_Object_init (PyObject *module) |
| PyObject * | wrap_map (mapstruct *map) |
| int | Atrinik_Map_init (PyObject *module) |
| PyObject * | wrap_party (party_struct *party) |
| int | Atrinik_Party_init (PyObject *module) |
| PyObject * | wrap_region (region *region) |
| int | Atrinik_Region_init (PyObject *module) |
| PyObject * | wrap_player (player *pl) |
| int | Atrinik_Player_init (PyObject *module) |
| PyObject * | wrap_archetype (archetype *at) |
| int | Atrinik_Archetype_init (PyObject *module) |
| PyObject * | wrap_attr_list (void *ptr, size_t offset, field_type field) |
| int | Atrinik_AttrList_init (PyObject *module) |
| int | generic_field_setter (fields_struct *field, void *ptr, PyObject *value) |
| PyObject * | generic_field_getter (fields_struct *field, void *ptr) |
| PyObject * | generic_rich_compare (int op, int result) |
| int | python_call_int (PyObject *callable, PyObject *arglist) |
Variables | |
| struct plugin_hooklist * | hooks |
| PyObject * | AtrinikError |
| PythonContext * | current_context |
| PyTypeObject | Atrinik_ObjectType |
| PyTypeObject | Atrinik_MapType |
| PyTypeObject | Atrinik_PartyType |
| PyTypeObject | Atrinik_RegionType |
| PyTypeObject | Atrinik_PlayerType |
| PyTypeObject | Atrinik_ArchetypeType |
| PyTypeObject | Atrinik_AttrListType |
Python plugin related header file.
Definition in file plugin_python.h.
| #define FREE_AND_CLEAR_HASH | ( | _nv_ | ) |
{ \
if (_nv_) \
{ \
hooks->free_string_shared(_nv_); \
_nv_ = NULL; \
} \
}
Free old hash and add a reference to the new one.
| _sv_ | Pointer to shared string. |
| _nv_ | String to add reference to. Must be a shared string. |
Definition at line 126 of file plugin_python.h.
| #define FREE_AND_COPY_HASH | ( | _sv_, | |
| _nv_ | |||
| ) |
Free old shared string and add new string.
| _sv_ | Shared string. |
| _nv_ | String to copy to the shared string. |
Definition at line 113 of file plugin_python.h.
| #define INTRAISE | ( | msg | ) |
{ \
PyErr_SetString(PyExc_TypeError, (msg)); \
return -1; \
}
Raise an error using AtrinikError, and return -1.
Definition at line 151 of file plugin_python.h.
| #define IS_PY_LEGACY |
This is for allowing both python 3 and python 2.
Definition at line 44 of file plugin_python.h.
| #define LOG hooks->LOG |
Logs a message to stderr, or to file, and/or even to socket. Or discards the message if it is of no importance, and none have asked to hear messages of that logLevel.
See include/logger.h for possible logLevels. Messages with llevSystem and llevError are always printed, regardless of debug mode.
Additionally, llevError message will cause the server to exit.
| logLevel | Log level of the message |
| format | Format specifiers |
| ... | Arguments for the format |
Definition at line 104 of file plugin_python.h.
| #define NR_CUSTOM_CMD 1024 |
Number of custom commands to allow.
Definition at line 437 of file plugin_python.h.
Get number of fields in the fields array.
Definition at line 434 of file plugin_python.h.
| #define OBJEXISTCHECK | ( | ob | ) |
{ \
if (!(ob) || !(ob)->obj || (ob)->obj->count != (ob)->count || OBJECT_FREE((ob)->obj)) \
{ \
PyErr_SetString(PyExc_ReferenceError, "Atrinik object no longer exists."); \
return NULL; \
} \
}
Definition at line 448 of file plugin_python.h.
| #define OBJEXISTCHECK_INT | ( | ob | ) |
{ \
if (!(ob) || !(ob)->obj || (ob)->obj->count != (ob)->count || OBJECT_FREE((ob)->obj)) \
{ \
PyErr_SetString(PyExc_ReferenceError, "Atrinik object no longer exists."); \
return -1; \
} \
}
Definition at line 439 of file plugin_python.h.
| #define PLUGIN_NAME "Python" |
Name of the plugin.
Definition at line 65 of file plugin_python.h.
| #define PLUGIN_VERSION "Atrinik Python Plugin 1.0" |
Name of the plugin, and its version.
Definition at line 67 of file plugin_python.h.
| #define Py_ReturnBoolean | ( | val | ) |
{ \
if ((val)) \
{ \
Py_INCREF(Py_True); \
return Py_True; \
} \
else \
{ \
Py_INCREF(Py_False); \
return Py_False; \
} \
}
Returns Py_True (increasing its reference) if 'val' is non-NULL, otherwise returns Py_False.
Definition at line 472 of file plugin_python.h.
| #define RAISE | ( | msg | ) |
{ \
PyErr_SetString(AtrinikError, (msg)); \
return NULL; \
}
Raise an error using AtrinikError, and return NULL.
Definition at line 145 of file plugin_python.h.
| #define SQUARES_AROUND_ADD | ( | _m, | |
| _x, | |||
| _y | |||
| ) |
{ \
PyObject *tuple = PyTuple_New(3); \
\
PyTuple_SET_ITEM(tuple, 0, wrap_map((_m))); \
PyTuple_SET_ITEM(tuple, 1, Py_BuildValue("i", (_x))); \
PyTuple_SET_ITEM(tuple, 2, Py_BuildValue("i", (_y))); \
PyList_Append(list, tuple); \
}
Helper macro for the object.SquaresAround() Python function.
Definition at line 459 of file plugin_python.h.
| typedef struct Atrinik_Object Atrinik_Object |
The Atrinik_Object structure.
| typedef struct PythonCmdStruct PythonCmd |
This structure is used to define one Python-implemented command.
| typedef struct _pythoncontext PythonContext |
The Python event context.
| enum field_type |
Types used in objects and maps structs.
Definition at line 201 of file plugin_python.h.
| int Atrinik_Archetype_init | ( | PyObject * | module | ) |
Initialize the archetype wrapper.
| module | The Atrinik Python module. |
Definition at line 165 of file atrinik_archetype.c.
| int Atrinik_AttrList_init | ( | PyObject * | module | ) |
Initializes the AttrList module.
| module | The main Atrinik module. |
Definition at line 589 of file attr_list.c.
| int Atrinik_Map_init | ( | PyObject * | module | ) |
Initialize the map wrapper.
| module | The Atrinik Python module. |
Definition at line 694 of file atrinik_map.c.
| int Atrinik_Object_init | ( | PyObject * | module | ) |
Initialize the object wrapper.
| module | The Atrinik Python module. |
Definition at line 2438 of file atrinik_object.c.
| int Atrinik_Party_init | ( | PyObject * | module | ) |
Initialize the party wrapper.
| module | The Atrinik Python module. |
Definition at line 315 of file atrinik_party.c.
| int Atrinik_Player_init | ( | PyObject * | module | ) |
Initialize the player wrapper.
| module | The Atrinik Python module. |
Definition at line 647 of file atrinik_player.c.
| int Atrinik_Region_init | ( | PyObject * | module | ) |
Initialize the region wrapper.
| module | The Atrinik Python module. |
Definition at line 168 of file atrinik_region.c.
| PyObject* generic_field_getter | ( | fields_struct * | field, |
| void * | ptr | ||
| ) |
A generic field getter for all interfaces.
| type | Type of the field. |
| field_ptr | Field pointer. |
| field_ptr2 | Field pointer for extra data. |
Definition at line 2724 of file plugin_python.c.
| int generic_field_setter | ( | fields_struct * | field, |
| void * | ptr, | ||
| PyObject * | value | ||
| ) |
A generic field setter for all interfaces.
| type | Type of the field. | |
| [out] | field_ptr | Field pointer. |
| value | Value to set for the field pointer. |
Definition at line 2261 of file plugin_python.c.
| PyObject* generic_rich_compare | ( | int | op, |
| int | result | ||
| ) |
Generic rich comparison function.
| op | |
| result |
Definition at line 2822 of file plugin_python.c.
| int python_call_int | ( | PyObject * | callable, |
| PyObject * | arglist | ||
| ) |
Call a function defined in Python script with the specified arguments.
| callable | What to call. |
| arglist | Arguments to call the function with. Will have reference decreased. |
Definition at line 2856 of file plugin_python.c.
| PyObject* wrap_archetype | ( | archetype * | at | ) |
Utility method to wrap an archetype.
| what | Archetype to wrap. |
Definition at line 200 of file atrinik_archetype.c.
| PyObject* wrap_attr_list | ( | void * | ptr, |
| size_t | offset, | ||
| field_type | field | ||
| ) |
Creates a new AttrList wrapping an array.
| ptr | Pointer to the structure the array is in. |
| offset | Where the array is in the structure. |
| field | Type of the array being handled; for example, FIELDTYPE_KNOWN_SPELLS. |
Definition at line 611 of file attr_list.c.
| PyObject* wrap_map | ( | mapstruct * | what | ) |
Utility method to wrap a map.
| what | Map to wrap. |
Definition at line 741 of file atrinik_map.c.
| PyObject* wrap_object | ( | object * | what | ) |
Utility method to wrap an object.
| what | Object to wrap. |
Definition at line 2492 of file atrinik_object.c.
| PyObject* wrap_party | ( | party_struct * | what | ) |
Utility method to wrap a party.
| what | Party to wrap. |
Definition at line 350 of file atrinik_party.c.
| PyObject* wrap_player | ( | player * | pl | ) |
Utility method to wrap a player.
| what | Player to wrap. |
Definition at line 682 of file atrinik_player.c.
| PyObject* wrap_region | ( | region * | what | ) |
Utility method to wrap a region.
| what | Region to wrap. |
Definition at line 203 of file atrinik_region.c.
| PyObject* AtrinikError |
A generic exception that we use for error messages.
Definition at line 48 of file plugin_python.c.
Current context.
Definition at line 53 of file plugin_python.c.
1.7.4