Go to the documentation of this file.
22 {
"FindPlayer",
"name: str",
"Player",
"Find the specified player from its name.\n:param name Player's name, case-sensitive.\n:return Player, None if no player matches." },
23 {
nullptr,
nullptr,
nullptr,
nullptr },
27 {
"WriteKey",
"key: str, value: str, add_key: int=0",
"bool",
"Add a key with the specified value to the object.\n:param key Key name.\n:param value Value to give the key.\n:param add_key If 1 then the key is set, if 0 then the key is only updated if it exists.\n:return True if the key was added or updated, False else." },
28 {
nullptr,
nullptr,
nullptr,
nullptr },
31 {
nullptr,
nullptr,
nullptr },
35 {
nullptr,
nullptr,
nullptr,
nullptr },
38 {
"MarkedItem",
"Object",
"Marked item, used by some actions." },
39 {
nullptr,
nullptr,
nullptr },
43 {
nullptr,
nullptr,
nullptr,
nullptr },
46 {
nullptr,
nullptr,
nullptr },
50 {
nullptr,
nullptr,
nullptr,
nullptr },
53 {
nullptr,
nullptr,
nullptr },
57 {
nullptr,
nullptr,
nullptr,
nullptr },
60 {
nullptr,
nullptr,
nullptr },
64 {
nullptr,
nullptr,
nullptr,
nullptr },
67 {
nullptr,
nullptr,
nullptr },
71 for (
size_t s = 0; signatures[s].
method; s++) {
72 if (strcmp(method, signatures[s].method) == 0) {
73 return &signatures[s];
81 pyi << std::endl << indent <<
"\t\"\"\"" << std::endl << description << std::endl << indent <<
"\t\"\"\"" << std::endl << indent <<
"..." << std::endl;
83 pyi <<
" ..." << std::endl;
88 const char *indent = inClass ?
"\t" :
"";
89 for (
size_t m = 0; method[
m].ml_name !=
nullptr; ++
m) {
91 pyi << indent <<
"def " << method[
m].ml_name <<
"(";
93 pyi <<
"self" << (signature->parameters ?
", " :
"");
95 if (signature->parameters) {
96 pyi << signature->parameters;
98 pyi <<
") -> " << signature->type <<
":";
105 for (
size_t s = 0;
properties[s].property; s++) {
106 if (strcmp(property,
properties[s].property) == 0) {
114 pyi <<
"class " <<
name;
116 pyi <<
"(" << base <<
")";
118 pyi <<
":" << std::endl << std::endl;
119 auto property =
obj->tp_getset;
120 while (property->name) {
122 pyi <<
"\t@property" << std::endl;
123 pyi <<
"\tdef " <<
property->name <<
"(self) -> " << signature->type <<
":";
127 pyi <<
"\t@" <<
property->name <<
".setter" << std::endl;
128 pyi <<
"\tdef " <<
property->name <<
"(self, value: " << signature->type <<
") -> None:";
139 pyi <<
"class " <<
name <<
"(enum):" << std::endl;
140 for (
size_t c = 0; constants[
c].
name !=
nullptr;
c++) {
141 pyi <<
"\t" << constants[
c].
name <<
" = " << constants[
c].
value << std::endl;
147 for (
size_t c = 0; constants[
c].
name !=
nullptr;
c++) {
148 pyi << constants[
c].
name <<
" = " << constants[
c].
value << std::endl;
154 std::ofstream pyi(
"Crossfire.pyi");
156 pyi <<
"\"\"\"" << std::endl <<
"Crossfire stubs. Auto-generated file, don't edit." << std::endl <<
"\"\"\"" << std::endl << std::endl;
177 pyi <<
"LogError = 1\nLogInfo = 2\nLogDebug = 3\nLogMonster = 4" << std::endl;
const CFConstant cstMove[]
static const methodSignature playerMethods[]
static const propertySignature objectProperties[]
static const propertySignature archProperties[]
static const propertySignature mapProperties[]
static event_registration c
static methodSignature unknown
static const propertySignature regionProperties[]
static const methodSignature mapMethods[]
const CFConstant cstMessageFlag[]
PyTypeObject Crossfire_PlayerType
static event_registration m
const CFConstant cstDirection[]
void writeMethods(std::ofstream &pyi, const PyMethodDef method[], const methodSignature *signatures, bool inClass)
static const methodSignature archMethods[]
static propertySignature unknownProperty
const CFConstant cstTime[]
const CFConstant cstType[]
const CFConstant cstReplyTypes[]
static const methodSignature regionMethods[]
static const propertySignature partyProperties[]
PyMethodDef CFPythonMethods[]
PyTypeObject Crossfire_PartyType
void writeClass(std::ofstream &pyi, const char *name, const PyTypeObject *obj, const methodSignature *methods, const propertySignature *properties, const char *base=nullptr)
const CFConstant cstAttackType[]
const CFConstant cstAttackTypeNumber[]
PyTypeObject Crossfire_ArchetypeType
void writeEnum(std::ofstream &pyi, const char *name, const CFConstant *constants)
PyTypeObject Crossfire_RegionType
static const methodSignature objectMethods[]
void writeDescriptionAndBody(std::ofstream &pyi, const char *indent, const char *description)
static const propertySignature playerProperties[]
const CFConstant cstAttackMovement[]
const methodSignature * getSignature(const methodSignature *signatures, const char *method)
static const methodSignature partyMethods[]
static const methodSignature moduleMethods[]
PyTypeObject Crossfire_ObjectType
const CFConstant cstEventType[]
void writeConstants(std::ofstream &pyi, const CFConstant *constants)
const char * properties[PROPERTY_COUNT]
PyTypeObject Crossfire_MapType