Crossfire Server, Trunk  1.75.0
cfpython_object.cpp
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* CFPython - A Python module for Crossfire RPG. */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: yann.chachkoff@myrealbox.com */
5 /*****************************************************************************/
6 /* That code is placed under the GNU General Public Licence (GPL) */
7 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
8 /*****************************************************************************/
9 /* CrossFire, A Multiplayer game for X-windows */
10 /* */
11 /* Copyright (C) 2000 Mark Wedel */
12 /* Copyright (C) 1992 Frank Tore Johansen */
13 /* */
14 /* This program is free software; you can redistribute it and/or modify */
15 /* it under the terms of the GNU General Public License as published by */
16 /* the Free Software Foundation; either version 2 of the License, or */
17 /* (at your option) any later version. */
18 /* */
19 /* This program is distributed in the hope that it will be useful, */
20 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 /* GNU General Public License for more details. */
23 /* */
24 /* You should have received a copy of the GNU General Public License */
25 /* along with this program; if not, write to the Free Software */
26 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* */
28 /*****************************************************************************/
29 
30 #include <cfpython.h>
31 #include <map>
32 
33 #define EXISTCHECK(ob) { \
34  if (!ob || !ob->obj || (object_was_destroyed(ob->obj, ob->obj->count))) { \
35  PyErr_SetString(PyExc_ReferenceError, "Crossfire object no longer exists"); \
36  return NULL; \
37  } }
38 
44 #define TYPEEXISTCHECK(ob) { \
45  if (!ob || !PyObject_TypeCheck((PyObject*)ob, &Crossfire_ObjectType) || !ob->obj || (object_was_destroyed(ob->obj, ob->obj->count))) { \
46  PyErr_SetString(PyExc_ReferenceError, "Not a Crossfire object or Crossfire object no longer exists"); \
47  return NULL; \
48  } }
49 
50 #define EXISTCHECK_INT(ob) { \
51  if (!ob || !ob->obj || (object_was_destroyed(ob->obj, ob->obj->count))) { \
52  PyErr_SetString(PyExc_ReferenceError, "Crossfire object no longer exists"); \
53  return -1; \
54  } }
55 
56 /* Map for keeping track of which PyObject goes with with Crossfire object */
57 static std::map<object *, PyObject *> object_assoc_table;
58 
59 static void add_object_assoc(object *key, PyObject *value) {
60  object_assoc_table[key] = value;
61 }
62 
63 static PyObject *find_assoc_pyobject(object *key) {
64  auto f = object_assoc_table.find(key);
65  return f == object_assoc_table.end() ? nullptr : f->second;
66 }
67 
68 static void free_object_assoc(object *key) {
69  object_assoc_table.erase(key);
70 }
71 
72 static PyObject *Player_GetTitle(Crossfire_Object *whoptr, void *closure) {
73  char title[MAX_NAME];
74  (void)closure;
75  EXISTCHECK(whoptr);
76  return Py_BuildValue("s", cf_player_get_title(whoptr->obj, title, MAX_NAME));
77 }
78 
79 static int Player_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure) {
80  char *val;
81  (void)closure;
82 
83  EXISTCHECK_INT(whoptr);
84  if (value == NULL) {
85  PyErr_SetString(PyExc_TypeError, "Cannot delete the Title attribute");
86  return -1;
87  }
88  if (!CF_IS_PYSTR(value)) {
89  PyErr_SetString(PyExc_TypeError, "The Title attribute must be a string");
90  return -1;
91  }
92  if (!PyArg_Parse(value, "s", &val))
93  return -1;
94 
95  cf_player_set_title(whoptr->obj, val);
96  return 0;
97 }
98 
99 static PyObject *Player_GetIP(Crossfire_Player *whoptr, void *closure) {
100  (void)closure;
101  EXISTCHECK(whoptr);
102  return Py_BuildValue("s", cf_player_get_ip(whoptr->obj));
103 }
104 
105 static PyObject *Player_GetClient(Crossfire_Player *whoptr, void *closure) {
106  (void)closure;
107  EXISTCHECK(whoptr);
108  return Py_BuildValue("s", cf_player_get_client(whoptr->obj));
109 }
110 
111 static PyObject *Player_GetMarkedItem(Crossfire_Player *whoptr, void *closure) {
112  (void)closure;
113  EXISTCHECK(whoptr);
115 }
116 
117 static int Player_SetMarkedItem(Crossfire_Player *whoptr, PyObject *value, void *closure) {
118  Crossfire_Object *ob;
119  (void)closure;
120 
121  EXISTCHECK_INT(whoptr);
122  if (value == Py_None)
123  cf_player_set_marked_item(whoptr->obj, NULL);
124  else if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
125  return -1;
126  else
127  cf_player_set_marked_item(whoptr->obj, ob->obj);
128  return 0;
129 }
130 
131 static PyObject *Crossfire_Player_Message(Crossfire_Player *who, PyObject *args) {
132  char *message;
133  int color = NDI_UNIQUE|NDI_ORANGE;
134 
135  EXISTCHECK(who);
136  if (!PyArg_ParseTuple(args, "s|i", &message, &color))
137  return NULL;
138 
139  cf_player_message(who->obj, message, color);
140  Py_INCREF(Py_None);
141  return Py_None;
142 }
143 
144 static PyObject *Player_KnowledgeKnown(Crossfire_Player *who, PyObject *args) {
145  const char *knowledge;
146 
147  EXISTCHECK(who);
148  if (!PyArg_ParseTuple(args, "s", &knowledge))
149  return NULL;
150 
151  return Py_BuildValue("i", cf_player_knowledge_has(who->obj, knowledge));
152 }
153 
154 static PyObject *Player_GiveKnowledge(Crossfire_Player *who, PyObject *args) {
155  const char *knowledge;
156 
157  EXISTCHECK(who);
158  if (!PyArg_ParseTuple(args, "s", &knowledge))
159  return NULL;
160 
161  cf_player_knowledge_give(who->obj, knowledge);
162 
163  Py_INCREF(Py_None);
164  return Py_None;
165 }
166 
167 static PyObject *Player_GetParty(Crossfire_Player *whoptr, void *closure) {
168  (void)closure;
169  EXISTCHECK(whoptr);
171 }
172 
173 static int Player_SetParty(Crossfire_Player *whoptr, PyObject *value, void *closure) {
174  Crossfire_Party *ob;
175  (void)closure;
176 
177  EXISTCHECK_INT(whoptr);
178  if (!PyArg_Parse(value, "O!", &Crossfire_PartyType, &ob))
179  return -1;
180  cf_player_set_party(whoptr->obj, ob->party);
181  return 0;
182 }
183 
184 static PyObject *Crossfire_Player_CanPay(Crossfire_Player *who, PyObject *args) {
185  (void)args;
186  EXISTCHECK(who);
187  return Py_BuildValue("i", cf_player_can_pay(who->obj));
188 }
189 
190 static PyObject *Player_GetBedMap(Crossfire_Player *whoptr, void *closure) {
191  char bed[200];
192  (void)closure;
193 
194  EXISTCHECK(whoptr);
195  return Py_BuildValue("s", cf_object_get_string_property(whoptr->obj, CFAPI_PLAYER_PROP_BED_MAP, bed, sizeof(bed)));
196 }
197 
198 static int Player_SetBedMap(Crossfire_Player *whoptr, PyObject *value, void *closure) {
199  char *location;
200  (void)closure;
201 
202  EXISTCHECK_INT(whoptr);
203  if (!PyArg_Parse(value, "s", &location))
204  return -1;
206  return 0;
207 }
208 
209 static PyObject *Player_GetBedX(Crossfire_Player *whoptr, void *closure) {
210  (void)closure;
211  EXISTCHECK(whoptr);
212  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_PLAYER_PROP_BED_X));
213 }
214 
215 static int Player_SetBedX(Crossfire_Player *whoptr, PyObject *value, void *closure) {
216  int x;
217  (void)closure;
218 
219  EXISTCHECK_INT(whoptr);
220  if (!PyArg_Parse(value, "i", &x))
221  return -1;
223  return 0;
224 }
225 
226 static PyObject *Player_GetBedY(Crossfire_Player *whoptr, void *closure) {
227  (void)closure;
228  EXISTCHECK(whoptr);
229  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_PLAYER_PROP_BED_Y));
230 }
231 
232 static int Player_SetBedY(Crossfire_Player *whoptr, PyObject *value, void *closure) {
233  int y;
234  (void)closure;
235 
236  EXISTCHECK_INT(whoptr);
237  if (!PyArg_Parse(value, "i", &y))
238  return -1;
240  return 0;
241 }
242 
243 static PyObject *Player_QuestStart(Crossfire_Player *whoptr, PyObject *args) {
244  char *code;
245  int state;
246  sstring quest_code;
247 
248  EXISTCHECK(whoptr);
249  if (!PyArg_ParseTuple(args, "si", &code, &state))
250  return NULL;
251 
252  quest_code = cf_add_string(code);
253  cf_quest_start(whoptr->obj, quest_code, state);
254  cf_free_string(quest_code);
255 
256  Py_INCREF(Py_None);
257  return Py_None;
258 }
259 
260 static PyObject *Player_QuestGetState(Crossfire_Player *whoptr, PyObject *args) {
261  char *code;
262  int state;
263  sstring quest_code;
264 
265  EXISTCHECK(whoptr);
266  if (!PyArg_ParseTuple(args, "s", &code))
267  return NULL;
268 
269  quest_code = cf_add_string(code);
270  state = cf_quest_get_player_state(whoptr->obj, quest_code);
271  cf_free_string(quest_code);
272 
273  return Py_BuildValue("i", state);
274 }
275 
276 static PyObject *Player_QuestSetState(Crossfire_Player *whoptr, PyObject *args) {
277  char *code;
278  int state;
279  sstring quest_code;
280 
281  EXISTCHECK(whoptr);
282  if (!PyArg_ParseTuple(args, "si", &code, &state))
283  return NULL;
284 
285  quest_code = cf_add_string(code);
286  cf_quest_set_player_state(whoptr->obj, quest_code, state);
287  cf_free_string(quest_code);
288 
289  Py_INCREF(Py_None);
290  return Py_None;
291 }
292 
293 static PyObject *Player_QuestWasCompleted(Crossfire_Player *whoptr, PyObject *args) {
294  char *code;
295  int completed;
296  sstring quest_code;
297 
298  EXISTCHECK(whoptr);
299  if (!PyArg_ParseTuple(args, "s", &code))
300  return NULL;
301 
302  quest_code = cf_add_string(code);
303  completed = cf_quest_was_completed(whoptr->obj, quest_code);
304  cf_free_string(quest_code);
305 
306  return Py_BuildValue("i", completed);
307 }
308 
309 /* Object properties. Get and maybe set. */
310 static PyObject *Object_GetSStringProperty(Crossfire_Object *whoptr, void *closure) {
311  (void)closure;
312  EXISTCHECK(whoptr);
313  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, (int)(intptr_t)closure));
314 }
315 
316 static PyObject *Object_GetIntProperty(Crossfire_Object *whoptr, void *closure) {
317  (void)closure;
318  EXISTCHECK(whoptr);
319  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, (int)(intptr_t)closure));
320 }
321 
322 static PyObject *Object_GetFloatProperty(Crossfire_Object *whoptr, void *closure) {
323  (void)closure;
324  EXISTCHECK(whoptr);
325  return Py_BuildValue("f", cf_object_get_float_property(whoptr->obj, (int)(intptr_t)closure));
326 }
327 
328 static PyObject *Object_GetFlagProperty(Crossfire_Object *whoptr, void *closure) {
329  (void)closure;
330  EXISTCHECK(whoptr);
331  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, (int)(intptr_t)closure));
332 }
333 
334 static PyObject *Object_GetObjectProperty(Crossfire_Object *whoptr, void *closure) {
335  object *op;
336  (void)closure;
337 
338  EXISTCHECK(whoptr);
339  op = cf_object_get_object_property(whoptr->obj, (int)(intptr_t)closure);
340  return Crossfire_Object_wrap(op);
341 }
342 
343 static PyObject *Object_GetName(Crossfire_Object *whoptr, void *closure) {
344  char name[200];
345  (void)closure;
346 
347  EXISTCHECK(whoptr);
348  return Py_BuildValue("s", cf_query_name(whoptr->obj, name, sizeof(name)));
349 }
350 
351 static PyObject *Object_GetNamePl(Crossfire_Object *whoptr, void *closure) {
352  (void)closure;
353  EXISTCHECK(whoptr);
354  return Py_BuildValue("s", (char *)cf_query_name_pl(whoptr->obj));
355 }
356 
357 static PyObject *Object_GetMap(Crossfire_Object *whoptr, void *closure) {
358  mapstruct *m;
359  (void)closure;
360 
361  EXISTCHECK(whoptr);
363  return Crossfire_Map_wrap(m);
364 }
365 
366 static PyObject *Object_GetExp(Crossfire_Object *whoptr, void *closure) {
367  (void)closure;
368  EXISTCHECK(whoptr);
369  return Py_BuildValue("L", cf_object_get_int64_property(whoptr->obj, CFAPI_OBJECT_PROP_EXP));
370 }
371 
372 static PyObject *Object_GetTotalExp(Crossfire_Object *whoptr, void *closure) {
373  (void)closure;
374  EXISTCHECK(whoptr);
375  return Py_BuildValue("L", cf_object_get_int64_property(whoptr->obj, CFAPI_OBJECT_PROP_TOTAL_EXP));
376 }
377 
378 static PyObject *Object_GetExpMul(Crossfire_Object *whoptr, void *closure) {
379  (void)closure;
380  EXISTCHECK(whoptr);
381  return Py_BuildValue("d", cf_object_get_double_property(whoptr->obj, CFAPI_OBJECT_PROP_EXP_MULTIPLIER));
382 }
383 
384 static PyObject *Object_GetPickable(Crossfire_Object *whoptr, void *closure) {
385  (void)closure;
386  EXISTCHECK(whoptr);
387  return Py_BuildValue("i", !cf_object_get_flag(whoptr->obj, FLAG_NO_PICK));
388 }
389 
390 static PyObject *Object_GetMoney(Crossfire_Object *whoptr, void *closure) {
391  (void)closure;
392  EXISTCHECK(whoptr);
393  return Py_BuildValue("i", cf_object_query_money(whoptr->obj));
394 }
395 
396 static PyObject *Object_GetValue(Crossfire_Object *whoptr, void *closure) {
397  (void)closure;
398  EXISTCHECK(whoptr);
399  return Py_BuildValue("l", cf_object_get_long_property(whoptr->obj, CFAPI_OBJECT_PROP_VALUE));
400 }
401 
402 static PyObject *Object_GetArchetype(Crossfire_Object *whoptr, void *closure) {
403  (void)closure;
404  EXISTCHECK(whoptr);
406 }
407 
408 static PyObject *Object_GetOtherArchetype(Crossfire_Object *whoptr, void *closure) {
409  (void)closure;
410  EXISTCHECK(whoptr);
412 }
413 
414 static PyObject *Object_GetExists(Crossfire_Object *whoptr, void *closure) {
415  (void)closure;
416  if (!object_was_destroyed(whoptr->obj, whoptr->obj->count)) {
417  Py_INCREF(Py_True);
418  return Py_True;
419  } else {
420  Py_INCREF(Py_False);
421  return Py_False;
422  }
423 }
424 
425 static PyObject *Object_GetMoveType(Crossfire_Object *whoptr, void *closure) {
426  (void)closure;
427  EXISTCHECK(whoptr);
428  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_TYPE));
429 }
430 
431 static PyObject *Object_GetMoveBlock(Crossfire_Object *whoptr, void *closure) {
432  (void)closure;
433  EXISTCHECK(whoptr);
434  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_BLOCK));
435 }
436 
437 static PyObject *Object_GetMoveAllow(Crossfire_Object *whoptr, void *closure) {
438  (void)closure;
439  EXISTCHECK(whoptr);
440  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_ALLOW));
441 }
442 
443 static PyObject *Object_GetMoveOn(Crossfire_Object *whoptr, void *closure) {
444  (void)closure;
445  EXISTCHECK(whoptr);
446  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_ON));
447 }
448 
449 static PyObject *Object_GetMoveOff(Crossfire_Object *whoptr, void *closure) {
450  (void)closure;
451  EXISTCHECK(whoptr);
452  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_OFF));
453 }
454 
455 static PyObject *Object_GetMoveSlow(Crossfire_Object *whoptr, void *closure) {
456  (void)closure;
457  EXISTCHECK(whoptr);
458  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_SLOW));
459 }
460 
461 static PyObject *Object_GetMaterial(Crossfire_Object *whoptr, void *closure) {
462  (void)closure;
463  EXISTCHECK(whoptr);
464  return Py_BuildValue("{s:s,s:i}", "Name", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_MATERIAL_NAME), "Number", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_MATERIAL));
465 }
466 
468 static int Object_SetStringProperty(Crossfire_Object *whoptr, PyObject *value, void *closure) {
469  char *val;
470 
471  EXISTCHECK_INT(whoptr);
472  if (value == NULL) {
473  PyErr_SetString(PyExc_TypeError, "Cannot delete the attribute");
474  return -1;
475  }
476  if (!CF_IS_PYSTR(value)) {
477  PyErr_SetString(PyExc_TypeError, "The attribute must be a string");
478  return -1;
479  }
480  if (!PyArg_Parse(value, "s", &val))
481  return -1;
482 
483  cf_object_set_string_property(whoptr->obj, (int)(intptr_t)closure, val);
484  return 0;
485 }
486 
487 static int Object_SetIntProperty(Crossfire_Object *whoptr, PyObject *value, void *closure) {
488  int val;
489 
490  EXISTCHECK_INT(whoptr);
491  if (!PyArg_Parse(value, "i", &val))
492  return -1;
493 
494  cf_object_set_int_property(whoptr->obj, (int)(intptr_t)closure, val);
495  return 0;
496 }
497 
498 static int Object_SetFloatProperty(Crossfire_Object *whoptr, PyObject *value, void *closure) {
499  float val;
500 
501  EXISTCHECK_INT(whoptr);
502  if (!PyArg_Parse(value, "f", &val))
503  return -1;
504 
505  cf_object_set_float_property(whoptr->obj, (int)(intptr_t)closure, val);
506  return 0;
507 }
508 
509 static int Object_SetFlagProperty(Crossfire_Object *whoptr, PyObject *value, void *closure) {
510  int val;
511 
512  EXISTCHECK_INT(whoptr);
513  if (!PyArg_Parse(value, "i", &val))
514  return -1;
515 
516  cf_object_set_flag(whoptr->obj, (int)(intptr_t)closure, val);
517  return 0;
518 }
519 
520 static int Object_SetName(Crossfire_Object *whoptr, PyObject *value, void *closure) {
521  char *val;
522  (void)closure;
523 
524  EXISTCHECK_INT(whoptr);
525  if (value == NULL) {
526  PyErr_SetString(PyExc_TypeError, "Cannot delete the Name attribute");
527  return -1;
528  }
529  if (!CF_IS_PYSTR(value)) {
530  PyErr_SetString(PyExc_TypeError, "The Name attribute must be a string");
531  return -1;
532  }
533  if (!PyArg_Parse(value, "s", &val))
534  return -1;
535 
538  return 0;
539 }
540 
541 static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure) {
542  char *val;
543  (void)closure;
544 
545  EXISTCHECK_INT(whoptr);
546  if (value == NULL) {
547  PyErr_SetString(PyExc_TypeError, "Cannot delete the NamePl attribute");
548  return -1;
549  }
550  if (!CF_IS_PYSTR(value)) {
551  PyErr_SetString(PyExc_TypeError, "The NamePl attribute must be a string");
552  return -1;
553  }
554  if (!PyArg_Parse(value, "s", &val))
555  return -1;
556 
558  return 0;
559 }
560 
561 static int Object_SetPickable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
562  int val;
563  (void)closure;
564 
565  EXISTCHECK_INT(whoptr);
566  if (!PyArg_Parse(value, "i", &val))
567  return -1;
568 
569  cf_object_set_flag(whoptr->obj, FLAG_NO_PICK, !val);
570  return 0;
571 }
572 
573 static int Object_SetMap(Crossfire_Object *whoptr, PyObject *value, void *closure) {
574  Crossfire_Map *val;
575  (void)closure;
576 
577  EXISTCHECK_INT(whoptr);
578  if (!PyArg_Parse(value, "O!", &Crossfire_MapType, &val))
579  return -1;
580 
581  cf_object_change_map(whoptr->obj, val->map, NULL, 0, -1, -1);
582  return 0;
583 }
584 
585 static int Object_SetQuantity(Crossfire_Object *whoptr, PyObject *value, void *closure) {
586  int val;
587  (void)closure;
588 
589  EXISTCHECK_INT(whoptr);
590  if (!PyArg_Parse(value, "i", &val))
591  return -1;
592 
593  if (cf_object_set_nrof(whoptr->obj, val) != 0) {
594  PyErr_SetString(PyExc_TypeError, "Invalid quantity");
595  return -1;
596  }
597 
598 /* cf_fix_object(whoptr->obj);*/
599  return 0;
600 }
601 
602 static int Object_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
603  char *face;
604  (void)closure;
605 
606  EXISTCHECK_INT(whoptr);
607  if (!PyArg_Parse(value, "s", &face))
608  return -1;
609 
610  if (!cf_object_set_face(whoptr->obj, face)) {
611  PyErr_SetString(PyExc_TypeError, "Unknown face.");
612  return -1;
613  }
614  return 0;
615 }
616 
617 static int Object_SetAnim(Crossfire_Object *whoptr, PyObject *value, void *closure) {
618  char *anim;
619  (void)closure;
620 
621  EXISTCHECK_INT(whoptr);
622  if (!PyArg_Parse(value, "s", &anim))
623  return -1;
624 
625  if (!cf_object_set_animation(whoptr->obj, anim)) {
626  PyErr_SetString(PyExc_TypeError, "Unknown animation.");
627  return -1;
628  }
629 
630  return 0;
631 }
632 
633 static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure) {
634  long val;
635  (void)closure;
636 
637  EXISTCHECK_INT(whoptr);
638  if (!PyArg_Parse(value, "l", &val))
639  return -1;
640 
642  return 0;
643 }
644 
645 static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure) {
646  Crossfire_Object *ob;
647  (void)closure;
648 
649  EXISTCHECK_INT(whoptr);
650  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
651  return -1;
653  return 0;
654 }
655 
656 static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure) {
657  Crossfire_Object *ob;
658  (void)closure;
659 
660  EXISTCHECK_INT(whoptr);
661  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
662  return -1;
664  return 0;
665 }
666 
667 static int Object_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure) {
668  int64_t val;
669  (void)closure;
670 
671  EXISTCHECK_INT(whoptr);
672  if (!PyArg_Parse(value, "L", &val))
673  return -1;
674 
676  return 0;
677 }
678 
679 static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure) {
680  MoveType move;
681  (void)closure;
682 
683  EXISTCHECK_INT(whoptr);
684  if (!PyArg_Parse(value, "B", &move))
685  return -1;
687  return 0;
688 }
689 
690 static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure) {
691  MoveType move;
692  (void)closure;
693 
694  EXISTCHECK_INT(whoptr);
695  if (!PyArg_Parse(value, "B", &move))
696  return -1;
698  return 0;
699 }
700 
701 static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
702  MoveType move;
703  (void)closure;
704 
705  EXISTCHECK_INT(whoptr);
706  if (!PyArg_Parse(value, "B", &move))
707  return -1;
709  return 0;
710 }
711 
712 static int Object_SetMoveOn(Crossfire_Object *whoptr, PyObject *value, void *closure) {
713  MoveType move;
714  (void)closure;
715 
716  EXISTCHECK_INT(whoptr);
717  if (!PyArg_Parse(value, "B", &move))
718  return -1;
720  return 0;
721 }
722 
723 static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure) {
724  MoveType move;
725  (void)closure;
726 
727  EXISTCHECK_INT(whoptr);
728  if (!PyArg_Parse(value, "B", &move))
729  return -1;
731  return 0;
732 }
733 
734 static int Object_SetMoveSlow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
735  MoveType move;
736  (void)closure;
737 
738  EXISTCHECK_INT(whoptr);
739  if (!PyArg_Parse(value, "B", &move))
740  return -1;
742  return 0;
743 }
744 
745 /* Methods. */
746 
747 static PyObject *Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args) {
748  (void)args;
749  EXISTCHECK(who);
750 
751  if ((current_context->who != NULL) && (((Crossfire_Object *)current_context->who)->obj == who->obj))
752  current_context->who = NULL;
753 
754  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
755  cf_object_remove(who->obj);
756  }
757 
759  Py_INCREF(Py_None);
760  return Py_None;
761 }
762 
763 static PyObject *Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args) {
764  Crossfire_Object *whoptr;
765  int flags;
766 
767  if (!PyArg_ParseTuple(args, "O!i", &Crossfire_ObjectType, &whoptr, &flags))
768  return NULL;
769  EXISTCHECK(who);
770  EXISTCHECK(whoptr);
771 
772  return Py_BuildValue("i", cf_object_apply(whoptr->obj, who->obj, flags));
773 }
774 
775 static PyObject *Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args) {
776  /* Note that this function uses the METH_O calling convention. */
777  Crossfire_Object *whoptr = (Crossfire_Object*)args;
778 
779  EXISTCHECK(who);
780  TYPEEXISTCHECK(whoptr);
781 
782  cf_object_drop(whoptr->obj, who->obj);
783  Py_INCREF(Py_None);
784  return Py_None;
785 }
786 
787 static PyObject *Crossfire_Object_Clone(Crossfire_Object *who, PyObject *args) {
788  int clone_type;
789  object *clone;
790 
791  if (!PyArg_ParseTuple(args, "i", &clone_type))
792  return NULL;
793 
794  if (clone_type != 0 && clone_type != 1)
795  {
796  PyErr_SetString(PyExc_ValueError, "Clone type must be 0 (object_create_clone) or 1 (object_copy).");
797  return NULL;
798  }
799 
800  clone = cf_object_clone(who->obj, clone_type);
801 
802  if (clone == NULL)
803  {
804  PyErr_SetString(PyExc_RuntimeError, "Clone failed.");
805  return NULL;
806  }
807 
808  return Crossfire_Object_wrap(clone);
809 }
810 
811 static PyObject *Crossfire_Object_Split(Crossfire_Object *who, PyObject *args) {
812  int count;
813  char err[255];
814  object *split;
815 
816  err[0] = '\0'; /* Just in case. */
817 
818  if (!PyArg_ParseTuple(args, "i", &count))
819  return NULL;
820 
821  split = cf_object_split(who->obj, count, err, 255);
822 
823  if (split == NULL)
824  {
825  PyErr_SetString(PyExc_ValueError, err);
826  return NULL;
827  }
828 
830 }
831 
832 static PyObject *Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args) {
833  (void)args;
834  cf_fix_object(who->obj);
835  Py_INCREF(Py_None);
836  return Py_None;
837 }
838 
839 static PyObject *Crossfire_Object_Take(Crossfire_Object *who, PyObject *args) {
840  /* Note that this function uses the METH_O calling convention. */
841  Crossfire_Object *whoptr = (Crossfire_Object*)args;
842 
843  EXISTCHECK(who);
844  TYPEEXISTCHECK(whoptr);
845 
846  int val = cf_object_pickup(who->obj, whoptr->obj);
847  if (val)
848  Py_RETURN_TRUE;
849  Py_RETURN_FALSE;
850 }
851 
852 static PyObject *Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args) {
853  Crossfire_Map *where;
854  int x, y;
855  int val;
856 
857  EXISTCHECK(who);
858  if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_MapType, &where, &x, &y))
859  return NULL;
860 
861  val = cf_object_teleport(who->obj, where->map, x, y);
862 
863  return Py_BuildValue("i", val);
864 }
865 
866 static PyObject *Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args) {
867  /* Note that this function uses the METH_O calling convention. */
868  object *trap;
869  object *victim;
870  Crossfire_Object *pcause = (Crossfire_Object*)args;
871 
872  EXISTCHECK(who);
873  TYPEEXISTCHECK(pcause);
874  trap = who->obj;
875  victim = pcause->obj;
876  cf_spring_trap(trap, victim);
877  Py_INCREF(Py_None);
878  return Py_None;
879 }
880 
881 static PyObject *Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args) {
882  /* Note that this function uses the METH_O calling convention. */
883  object *trigger;
884  object *cause;
885  int result;
886  Crossfire_Object *pcause = (Crossfire_Object*)args;
887 
888  EXISTCHECK(who);
889  TYPEEXISTCHECK(pcause);
890  trigger = who->obj;
891  cause = pcause->obj;
892  result = cf_object_check_trigger(trigger, cause);
893 
894  return Py_BuildValue("i", result);
895 }
896 
897 static PyObject *Crossfire_Object_Say(Crossfire_Object *who, PyObject *args) {
898  char *message, buf[2048];
899 
900  EXISTCHECK(who);
901  if (!PyArg_ParseTuple(args, "s", &message))
902  return NULL;
903 
904  /* compatibility */
905  if (current_context->talk == NULL) {
906  cf_object_say(who->obj, message);
907  Py_INCREF(Py_None);
908  return Py_None;
909  }
910 
912  PyErr_SetString(PyExc_ValueError, "too many NPCs");
913  return NULL;
914  }
915 
916  if (strlen(message) >= sizeof(buf) - 1)
917  cf_log(llevError, "warning, too long message in npcSay, will be truncated");
919  snprintf(buf, sizeof(buf), "%s says: %s", who->obj->name, message);
920 
923 
924  Py_INCREF(Py_None);
925  return Py_None;
926 
927 }
928 
929 static PyObject *Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args) {
930  int x, y;
931 
932  EXISTCHECK(who);
933  if (!PyArg_ParseTuple(args, "ii", &x, &y))
934  return NULL;
935 
936  cf_object_transfer(who->obj, x, y, 0, NULL);
937  Py_INCREF(Py_None);
938  return Py_None;
939 }
940 
941 static PyObject *Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args) {
942  char name[200];
943  (void)args;
944 
945  EXISTCHECK(who);
946  return Py_BuildValue("s", cf_query_name(who->obj, name, sizeof(name)));
947 }
948 
949 static PyObject *Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args) {
950  int resist;
951 
952  EXISTCHECK(who);
953  if (!PyArg_ParseTuple(args, "i", &resist))
954  return NULL;
955  if ((resist < 0) || (resist >= NROFATTACKS)) {
956  return Py_BuildValue("l", 0);
957  }
958  return Py_BuildValue("i", cf_object_get_resistance(who->obj, resist));
959 }
960 
961 static PyObject *Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args) {
962  int resist, value;
963 
964  EXISTCHECK(who);
965  if (!PyArg_ParseTuple(args, "ii", &resist, &value))
966  return NULL;
967  if ((resist >= 0) && (resist < NROFATTACKS))
968  cf_object_set_resistance(who->obj, resist, value);
969  Py_INCREF(Py_None);
970  return Py_None;
971 }
972 
973 static PyObject *Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args) {
974  int dir;
975  char *op;
976  Crossfire_Object *pspell;
977 
978  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &op))
979  return NULL;
980  EXISTCHECK(who);
981  EXISTCHECK(pspell);
982 
983  cf_object_cast_spell(who->obj, who->obj, dir, pspell->obj, op);
984 
985  Py_INCREF(Py_None);
986  return Py_None;
987 }
988 
989 static PyObject *Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args) {
990  /* Note that this function uses the METH_O calling convention. */
991  Crossfire_Object *pspell = (Crossfire_Object*)args;
992 
993  EXISTCHECK(who);
994  TYPEEXISTCHECK(pspell);
995 
996  cf_object_learn_spell(who->obj, pspell->obj, 0);
997 
998  Py_INCREF(Py_None);
999  return Py_None;
1000 }
1001 
1002 static PyObject *Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args) {
1003  /* Note that this function uses the METH_O calling convention. */
1004  Crossfire_Object *pspell = (Crossfire_Object*)args;
1005 
1006  EXISTCHECK(who);
1007  TYPEEXISTCHECK(pspell);
1008 
1009  cf_object_forget_spell(who->obj, pspell->obj);
1010  Py_INCREF(Py_None);
1011  return Py_None;
1012 }
1013 
1014 static PyObject *Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args) {
1015  char *spellname;
1016  object *op;
1017 
1018  EXISTCHECK(who);
1019  if (!PyArg_ParseTuple(args, "s", &spellname))
1020  return NULL;
1021 
1022  op = cf_object_check_for_spell(who->obj, spellname);
1023 
1024  return Crossfire_Object_wrap(op);
1025 }
1026 
1027 static PyObject *Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args) {
1028  Crossfire_Object *pspell;
1029  int dir;
1030  char *str;
1031 
1032  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &str))
1033  return NULL;
1034  EXISTCHECK(who);
1035  EXISTCHECK(pspell);
1036 
1037  cf_log_plain(llevError, "CastAbility is deprecated and will be removed, use 'Cast'.\n");
1038  cf_object_cast_spell(who->obj, who->obj, dir, pspell->obj, str);
1039 
1040  Py_INCREF(Py_None);
1041  return Py_None;
1042 }
1043 
1044 static PyObject *Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args) {
1045  uint64_t to_pay;
1046  int val;
1047 
1048  EXISTCHECK(who);
1049  if (!PyArg_ParseTuple(args, "L", &to_pay))
1050  return NULL;
1051 
1052  val = cf_object_pay_amount(who->obj, to_pay);
1053 
1054  return Py_BuildValue("i", val);
1055 }
1056 
1057 static PyObject *Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args) {
1058  /* Note that this function uses the METH_O calling convention. */
1059  Crossfire_Object *op = (Crossfire_Object*)args;
1060  int val;
1061 
1062  EXISTCHECK(who);
1063  TYPEEXISTCHECK(op);
1064 
1065  val = cf_object_pay_item(who->obj, op->obj);
1066 
1067  return Py_BuildValue("i", val);
1068 }
1069 
1070 static PyObject *Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args) {
1071  const char *val;
1072  char *keyname;
1073 
1074  EXISTCHECK(who);
1075  if (!PyArg_ParseTuple(args, "s", &keyname))
1076  return NULL;
1077 
1078  val = cf_object_get_key(who->obj, keyname);
1079 
1080  return Py_BuildValue("s", val ? val : "");
1081 }
1082 
1083 static PyObject *Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args) {
1084  char *keyname;
1085  char *value;
1086  int add_key = 0;
1087 
1088  EXISTCHECK(who);
1089  if (!PyArg_ParseTuple(args, "sz|i", &keyname, &value, &add_key))
1090  return NULL;
1091 
1092  return Py_BuildValue("i", cf_object_set_key(who->obj, keyname, value, add_key));
1093 }
1094 
1095 static PyObject *Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args) {
1096  int mode;
1097  long delay;
1098 
1099  EXISTCHECK(who);
1100  if (!PyArg_ParseTuple(args, "li", &delay, &mode))
1101  return NULL;
1102 
1103  return Py_BuildValue("i", cf_timer_create(who->obj, delay, mode));
1104 }
1105 
1106 static PyObject *Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args) {
1107  char *whatstr;
1108  object *foundob;
1109 
1110  EXISTCHECK(who);
1111  if (!PyArg_ParseTuple(args, "s", &whatstr))
1112  return NULL;
1113 
1114  foundob = cf_object_present_archname_inside(who->obj, whatstr);
1115 
1116  return Crossfire_Object_wrap(foundob);
1117 /* FOR_INV_PREPARE(WHO, tmp) {
1118  if (!strncmp(PyQueryName(tmp), whatstr, strlen(whatstr))) {
1119  return Py_BuildValue("l", (long)(tmp));
1120  }
1121  if (!strncmp(tmp->name, whatstr, strlen(whatstr))) {
1122  return Py_BuildValue("l", (long)(tmp));
1123  }
1124  } FOR_INV_FINISH();
1125 
1126  return Py_BuildValue("l", (long)0);*/
1127 }
1128 
1129 static PyObject *Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args) {
1130  char *whatstr;
1131  object *tmp;
1132 
1133  EXISTCHECK(who);
1134  if (!PyArg_ParseTuple(args, "s", &whatstr))
1135  return NULL;
1136 
1137  tmp = cf_object_find_by_arch_name(who->obj, whatstr);
1138  return Crossfire_Object_wrap(tmp);
1139 }
1140 
1141 static PyObject *Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args) {
1142  int x, y;
1143 
1144  EXISTCHECK(who);
1145  if (!PyArg_ParseTuple(args, "ii", &x, &y))
1146  return NULL;
1147 
1148  return Py_BuildValue("i", cf_object_out_of_map(who->obj, x, y));
1149 }
1150 
1151 static PyObject *Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args) {
1152  char *txt;
1153  object *myob;
1154 
1155  EXISTCHECK(who);
1156  if (!PyArg_ParseTuple(args, "s", &txt))
1157  return NULL;
1158 
1159  myob = cf_create_object_by_name(txt);
1160  if (myob)
1161  myob = cf_object_insert_object(myob, who->obj);
1162 
1163  return Crossfire_Object_wrap(myob);
1164 }
1165 
1166 static PyObject *Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args) {
1167  /* Note that this function uses the METH_O calling convention. */
1168  Crossfire_Object *op = (Crossfire_Object*)args;
1169  object *myob;
1170 
1171  EXISTCHECK(who);
1172  TYPEEXISTCHECK(op);
1173 
1174  /* we can only insert removed object, so first remove it
1175  * from it's current container
1176  */
1177  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
1178  cf_object_remove(who->obj);
1179  }
1180  myob = cf_object_insert_in_ob(who->obj, op->obj);
1181 
1182  return Crossfire_Object_wrap(myob);
1183 }
1184 
1185 static PyObject *Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args) {
1186  /* Note that this function uses the METH_O calling convention. */
1187  Crossfire_Object *op = (Crossfire_Object*)args;
1188 
1189  EXISTCHECK(who);
1190  TYPEEXISTCHECK(op);
1191 
1192  return Py_BuildValue("i", cf_object_change_abil(who->obj, op->obj));
1193 }
1194 
1195 static PyObject *Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args) {
1196  int64_t exp;
1197  const char *skill = NULL;
1198  int arg = 0;
1199 
1200  if (!PyArg_ParseTuple(args, "L|si", &exp, &skill, &arg))
1201  return NULL;
1202  EXISTCHECK(who);
1203  cf_object_change_exp(who->obj, exp, skill, arg);
1204  Py_INCREF(Py_None);
1205  return Py_None;
1206 }
1207 
1208 static PyObject *Crossfire_Object_PermExp(Crossfire_Object *who, PyObject *args) {
1209  (void)args;
1210  EXISTCHECK(who);
1211  return Py_BuildValue("L", cf_object_perm_exp(who->obj));
1212 }
1213 
1214 static PyObject *Crossfire_Object_Move(Crossfire_Object *who, PyObject *args) {
1215  int dir;
1216 
1217  if (!PyArg_ParseTuple(args, "i", &dir))
1218  return NULL;
1219  EXISTCHECK(who);
1220  return Py_BuildValue("i", cf_object_move(who->obj, dir, who->obj));
1221 }
1222 
1223 static PyObject *Crossfire_Object_MoveTo(Crossfire_Object *who, PyObject *args) {
1224  int x,y;
1225 
1226  if (!PyArg_ParseTuple(args, "ii", &x, &y))
1227  return NULL;
1228  EXISTCHECK(who);
1229  return Py_BuildValue("i", cf_object_move_to(who->obj, x, y));
1230 }
1231 
1232 static PyObject *Crossfire_Object_Event(Crossfire_Object *who, PyObject *args) {
1233  int fix;
1234  const char *message = NULL;
1235  object *op1 = NULL;
1236  object *op2 = NULL;
1237  object *op3 = NULL;
1238  Crossfire_Object *activator = NULL;
1239  Crossfire_Object *third = NULL;
1240 
1241  if (!PyArg_ParseTuple(args, "O!O!si", &Crossfire_ObjectType, &activator, &Crossfire_ObjectType, &third, &message, &fix))
1242  return NULL;
1243  EXISTCHECK(who);
1244  EXISTCHECK(activator);
1245  EXISTCHECK(third);
1246  op1 = who->obj;
1247  op2 = activator->obj;
1248  op3 = third->obj;
1249  return Py_BuildValue("i", cf_object_user_event(op1, op2, op3, message, fix));
1250 }
1251 
1252 static PyObject *Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args) {
1253  int level;
1254 
1255  if (!PyArg_ParseTuple(args, "i", &level))
1256  return NULL;
1257  EXISTCHECK(who);
1258 
1259  return Py_BuildValue("i", cf_object_remove_depletion(who->obj, level));
1260 }
1261 
1262 static PyObject *Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args) {
1263  (void)args;
1264  EXISTCHECK(who);
1265  return Py_BuildValue("i", cf_player_arrest(who->obj));
1266 }
1267 
1269  EXISTCHECK_INT(left);
1270  EXISTCHECK_INT(right);
1271  return (left->obj < right->obj ? -1 : (left->obj == right->obj ? 0 : 1));
1272 }
1273 
1274 static PyObject *Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op) {
1275  int result;
1276  if (!left
1277  || !right
1278  || !PyObject_TypeCheck((PyObject*)left, &Crossfire_ObjectType)
1279  || !PyObject_TypeCheck((PyObject*)right, &Crossfire_ObjectType)) {
1280  Py_INCREF(Py_NotImplemented);
1281  return Py_NotImplemented;
1282  }
1283  result = Crossfire_Object_InternalCompare(left, right);
1284  /* Handle removed objects. */
1285  if (result == -1 && PyErr_Occurred())
1286  return NULL;
1287  /* Based on how Python 3.0 (GPL compatible) implements it for internal types: */
1288  switch (op) {
1289  case Py_EQ:
1290  result = (result == 0);
1291  break;
1292  case Py_NE:
1293  result = (result != 0);
1294  break;
1295  case Py_LE:
1296  result = (result <= 0);
1297  break;
1298  case Py_GE:
1299  result = (result >= 0);
1300  break;
1301  case Py_LT:
1302  result = (result == -1);
1303  break;
1304  case Py_GT:
1305  result = (result == 1);
1306  break;
1307  }
1308  return PyBool_FromLong(result);
1309 }
1310 
1311 /* Legacy code: convert to long so that non-object functions work correctly */
1312 static PyObject *Crossfire_Object_Long(PyObject *obj) {
1313  return Py_BuildValue("l", ((Crossfire_Object *)obj)->obj);
1314 }
1315 
1316 /* Python binding */
1317 static PyGetSetDef Object_getseters[] = {
1318  { "Name", (getter)Object_GetName, (setter)Object_SetName, NULL, NULL },
1319  { "NamePl", (getter)Object_GetNamePl, (setter)Object_SetNamePl, NULL, NULL },
1320  { "NameSingular", (getter)Object_GetSStringProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_RAW_NAME },
1321  { "Title", (getter)Object_GetSStringProperty, (setter)Object_SetStringProperty, NULL, (void*)CFAPI_OBJECT_PROP_TITLE },
1322  { "Race", (getter)Object_GetSStringProperty, (setter)Object_SetStringProperty, NULL, (void*)CFAPI_OBJECT_PROP_RACE },
1323  { "Skill", (getter)Object_GetSStringProperty, (setter)Object_SetStringProperty, NULL, (void*)CFAPI_OBJECT_PROP_SKILL },
1324  { "Map", (getter)Object_GetMap, (setter)Object_SetMap, NULL, NULL },
1325  { "Cha", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_CHA },
1326  { "Con", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_CON },
1327  { "Dex", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_DEX },
1328  { "Int", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_INT },
1329  { "Pow", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_POW },
1330  { "Str", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_STR },
1331  { "Wis", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_WIS },
1332  { "HP", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_HP },
1333  { "MaxHP", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_MAXHP },
1334  { "SP", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_SP },
1335  { "MaxSP", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_MAXSP },
1336  { "Grace", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_GP },
1337  { "MaxGrace", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_MAXGP },
1338  { "Food", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_FP },
1339  { "AC", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_AC },
1340  { "WC", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_WC },
1341  { "Dam", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_DAM },
1342  { "Luck", (getter)Object_GetIntProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_LUCK },
1343  { "Exp", (getter)Object_GetExp, (setter)Object_SetExp, NULL, NULL },
1344  { "ExpMul", (getter)Object_GetExpMul, NULL, NULL, NULL },
1345  { "TotalExp", (getter)Object_GetTotalExp, NULL, NULL, NULL },
1346  { "Message", (getter)Object_GetSStringProperty, (setter)Object_SetStringProperty, NULL, (void*)CFAPI_OBJECT_PROP_MESSAGE },
1347  { "Slaying", (getter)Object_GetSStringProperty, (setter)Object_SetStringProperty, NULL, (void*)CFAPI_OBJECT_PROP_SLAYING },
1348  { "Cursed", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_CURSED },
1349  { "Damned", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_DAMNED },
1350  { "Weight", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_WEIGHT },
1351  { "WeightLimit", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_WEIGHT_LIMIT },
1352  { "Above", (getter)Object_GetObjectProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_OB_ABOVE },
1353  { "Below", (getter)Object_GetObjectProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_OB_BELOW },
1354  { "Inventory", (getter)Object_GetObjectProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_INVENTORY },
1355  { "X", (getter)Object_GetIntProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_X },
1356  { "Y", (getter)Object_GetIntProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_Y },
1357  { "Direction", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_DIRECTION },
1358  { "Facing", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_FACING },
1359  { "Unaggressive", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_UNAGGRESSIVE },
1360  { "God", (getter)Object_GetSStringProperty, (setter)Object_SetFlagProperty, NULL, (void*)CFAPI_OBJECT_PROP_GOD },
1361  { "Pickable", (getter)Object_GetPickable, (setter)Object_SetPickable, NULL, NULL },
1362  { "Quantity", (getter)Object_GetIntProperty, (setter)Object_SetQuantity, NULL, (void*)CFAPI_OBJECT_PROP_NROF },
1363  { "Invisible", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_INVISIBLE },
1364  { "Speed", (getter)Object_GetFloatProperty, (setter)Object_SetFloatProperty, NULL, (void*)CFAPI_OBJECT_PROP_SPEED },
1365  { "SpeedLeft", (getter)Object_GetFloatProperty, (setter)Object_SetFloatProperty, NULL, (void*)CFAPI_OBJECT_PROP_SPEED_LEFT },
1366  { "LastSP", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_LAST_SP },
1367  { "LastGrace", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_LAST_GRACE },
1368  { "LastEat", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_LAST_EAT },
1369  { "Level", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_LEVEL },
1370  { "Face", (getter)Object_GetSStringProperty, (setter)Object_SetFace, NULL, (void*)CFAPI_OBJECT_PROP_FACE },
1371  { "Anim", (getter)Object_GetSStringProperty, (setter)Object_SetAnim, NULL, (void*)CFAPI_OBJECT_PROP_ANIMATION },
1372  { "AnimSpeed", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_ANIM_SPEED },
1373  { "AttackType", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_ATTACK_TYPE },
1374  { "BeenApplied", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_BEEN_APPLIED },
1375  { "Identified", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_IDENTIFIED },
1376  { "Alive", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_ALIVE },
1377  { "DungeonMaster", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_WIZ },
1378  { "WasDungeonMaster", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_WAS_WIZ },
1379  { "Applied", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_APPLIED },
1380  { "Unpaid", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_UNPAID },
1381  { "Monster", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_MONSTER },
1382  { "Friendly", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_FRIENDLY },
1383  { "Generator", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_GENERATOR },
1384  { "Thrown", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_IS_THROWN },
1385  { "CanSeeInvisible", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_SEE_INVISIBLE },
1386  { "Rollable", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_CAN_ROLL },
1387  { "Turnable", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_IS_TURNABLE },
1388  { "UsedUp", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_IS_USED_UP },
1389  { "Splitting", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_SPLITTING },
1390  { "Blind", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_BLIND },
1391  { "CanUseSkill", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_CAN_USE_SKILL },
1392  { "KnownCursed", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_KNOWN_CURSED },
1393  { "Stealthy", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_STEALTH },
1394  { "Confused", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_CONFUSED },
1395  { "Sleeping", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_SLEEP },
1396  { "Lifesaver", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_LIFESAVE },
1397  { "Floor", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_IS_FLOOR },
1398  { "HasXRays", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_XRAYS },
1399  { "CanUseRing", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_USE_RING },
1400  { "CanUseBow", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_USE_BOW },
1401  { "CanUseWand", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_USE_RANGE },
1402  { "CanSeeInDark", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_SEE_IN_DARK },
1403  { "KnownMagical", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_KNOWN_MAGICAL },
1404  { "CanUseWeapon", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_USE_WEAPON },
1405  { "CanUseArmour", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_USE_ARMOUR },
1406  { "CanUseScroll", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_USE_SCROLL },
1407  { "CanCastSpell", (getter)Object_GetFlagProperty, NULL, NULL, (void*)FLAG_CAST_SPELL },
1408  { "ReflectSpells", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_REFL_SPELL },
1409  { "ReflectMissiles", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_REFL_MISSILE },
1410  { "Unique", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_UNIQUE },
1411  { "RunAway", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_RUN_AWAY },
1412  { "Scared", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_SCARED },
1413  { "Undead", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_UNDEAD },
1414  { "BlocksView", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_BLOCKSVIEW },
1415  { "HitBack", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_HITBACK },
1416  { "StandStill", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_STAND_STILL },
1417  { "OnlyAttack", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_ONLY_ATTACK },
1418  { "MakeInvisible", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_MAKE_INVIS },
1419  { "Money", (getter)Object_GetMoney, NULL, NULL, NULL },
1420  { "Type", (getter)Object_GetIntProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_TYPE },
1421  { "Subtype", (getter)Object_GetIntProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_SUBTYPE },
1422  { "Value", (getter)Object_GetValue, (setter)Object_SetValue, NULL, NULL },
1423  { "ArchName", (getter)Object_GetSStringProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_ARCH_NAME },
1424  { "Archetype", (getter)Object_GetArchetype, NULL, NULL, NULL },
1425  { "OtherArchetype", (getter)Object_GetOtherArchetype,NULL, NULL, NULL },
1426  { "Exists", (getter)Object_GetExists, NULL, NULL, NULL },
1427  { "NoSave", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_NO_SAVE },
1428  { "Env", (getter)Object_GetObjectProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_ENVIRONMENT },
1429  { "MoveType", (getter)Object_GetMoveType, (setter)Object_SetMoveType, NULL, NULL },
1430  { "MoveBlock", (getter)Object_GetMoveBlock, (setter)Object_SetMoveBlock, NULL, NULL },
1431  { "MoveAllow", (getter)Object_GetMoveAllow, (setter)Object_SetMoveAllow, NULL, NULL },
1432  { "MoveOn", (getter)Object_GetMoveOn, (setter)Object_SetMoveOn, NULL, NULL },
1433  { "MoveOff", (getter)Object_GetMoveOff, (setter)Object_SetMoveOff, NULL, NULL },
1434  { "MoveSlow", (getter)Object_GetMoveSlow, (setter)Object_SetMoveSlow, NULL, NULL },
1435  { "MoveSlowPenalty", (getter)Object_GetFloatProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY },
1436  { "Owner", (getter)Object_GetObjectProperty, (setter)Object_SetOwner, NULL, (void*)CFAPI_OBJECT_PROP_OWNER },
1437  { "Enemy", (getter)Object_GetObjectProperty, (setter)Object_SetEnemy, NULL, (void*)CFAPI_OBJECT_PROP_ENEMY },
1438  { "Count", (getter)Object_GetIntProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_COUNT },
1439  { "GodGiven", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_STARTEQUIP },
1440  { "IsPet", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_FRIENDLY },
1441  { "AttackMovement", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_ATTACK_MOVEMENT },
1442  { "Duration", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_DURATION },
1443  { "GlowRadius", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_GLOW_RADIUS },
1444  { "Animated", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_ANIMATE },
1445  { "NoDamage", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_NO_DAMAGE },
1446  { "RandomMovement", (getter)Object_GetFlagProperty, (setter)Object_SetFlagProperty, NULL, (void*)FLAG_RANDOM_MOVE },
1447  { "Material", (getter)Object_GetMaterial, NULL, NULL, NULL },
1448  { "Container", (getter)Object_GetObjectProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_CONTAINER },
1449  { "ItemPower", (getter)Object_GetIntProperty, (setter)Object_SetIntProperty, NULL, (void*)CFAPI_OBJECT_PROP_ITEM_POWER },
1450  { "CurrentWeapon", (getter)Object_GetObjectProperty, NULL, NULL, (void*)CFAPI_OBJECT_PROP_CURRENT_WEAPON },
1451  { NULL, NULL, NULL, NULL, NULL }
1452 };
1453 
1454 static PyMethodDef ObjectMethods[] = {
1455  { "Remove", (PyCFunction)Crossfire_Object_Remove, METH_NOARGS, NULL },
1456  { "Apply", (PyCFunction)Crossfire_Object_Apply, METH_VARARGS, NULL },
1457  { "Drop", (PyCFunction)Crossfire_Object_Drop, METH_O, NULL },
1458  { "Clone", (PyCFunction)Crossfire_Object_Clone, METH_VARARGS, NULL },
1459  { "Split", (PyCFunction)Crossfire_Object_Split, METH_VARARGS, NULL },
1460  { "Fix", (PyCFunction)Crossfire_Object_Fix, METH_NOARGS, NULL },
1461  { "Say", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
1462  { "Speak", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
1463  { "Take", (PyCFunction)Crossfire_Object_Take, METH_O, NULL },
1464  { "Teleport", (PyCFunction)Crossfire_Object_Teleport, METH_VARARGS, NULL },
1465  { "Reposition", (PyCFunction)Crossfire_Object_Reposition, METH_VARARGS, NULL },
1466  { "QueryName", (PyCFunction)Crossfire_Object_QueryName, METH_NOARGS, NULL },
1467  { "GetResist", (PyCFunction)Crossfire_Object_GetResist, METH_VARARGS, NULL },
1468  { "SetResist", (PyCFunction)Crossfire_Object_SetResist, METH_VARARGS, NULL },
1469  { "ActivateRune", (PyCFunction)Crossfire_Object_ActivateRune, METH_O, NULL },
1470  { "CheckTrigger", (PyCFunction)Crossfire_Object_CheckTrigger, METH_O, NULL },
1471  { "Cast", (PyCFunction)Crossfire_Object_Cast, METH_VARARGS, NULL },
1472  { "LearnSpell", (PyCFunction)Crossfire_Object_LearnSpell, METH_O, NULL },
1473  { "ForgetSpell", (PyCFunction)Crossfire_Object_ForgetSpell, METH_O, NULL },
1474  { "KnowSpell", (PyCFunction)Crossfire_Object_KnowSpell, METH_VARARGS, NULL },
1475  { "CastAbility", (PyCFunction)Crossfire_Object_CastAbility, METH_VARARGS, NULL },
1476  { "PayAmount", (PyCFunction)Crossfire_Object_PayAmount, METH_VARARGS, NULL },
1477  { "Pay", (PyCFunction)Crossfire_Object_Pay, METH_O, NULL },
1478  { "CheckInventory", (PyCFunction)Crossfire_Object_CheckInventory, METH_VARARGS, NULL },
1479  { "CheckArchInventory", (PyCFunction)Crossfire_Object_CheckArchInventory, METH_VARARGS, NULL },
1480  { "OutOfMap", (PyCFunction)Crossfire_Object_GetOutOfMap, METH_VARARGS, NULL },
1481  { "CreateObject", (PyCFunction)Crossfire_Object_CreateInside, METH_VARARGS, NULL },
1482  { "InsertInto", (PyCFunction)Crossfire_Object_InsertInto, METH_O, NULL },
1483  { "ReadKey", (PyCFunction)Crossfire_Object_ReadKey, METH_VARARGS, NULL },
1484  { "WriteKey", (PyCFunction)Crossfire_Object_WriteKey, METH_VARARGS, NULL },
1485  { "CreateTimer", (PyCFunction)Crossfire_Object_CreateTimer, METH_VARARGS, NULL },
1486  { "AddExp", (PyCFunction)Crossfire_Object_AddExp, METH_VARARGS, NULL },
1487  { "Move", (PyCFunction)Crossfire_Object_Move, METH_VARARGS, NULL },
1488  { "MoveTo", (PyCFunction)Crossfire_Object_MoveTo, METH_VARARGS, NULL },
1489  { "ChangeAbil", (PyCFunction)Crossfire_Object_ChangeAbil, METH_O, NULL },
1490  { "Event", (PyCFunction)Crossfire_Object_Event, METH_VARARGS, NULL },
1491  { "RemoveDepletion",(PyCFunction)Crossfire_Object_RemoveDepletion, METH_VARARGS, NULL },
1492  { "Arrest", (PyCFunction)Crossfire_Object_Arrest, METH_VARARGS, NULL },
1493  { "PermExp", (PyCFunction)Crossfire_Object_PermExp, METH_NOARGS, NULL },
1494  { NULL, NULL, 0, NULL }
1495 };
1496 
1498 
1499 static PyObject *Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
1500  Crossfire_Object *self;
1501  (void)args;
1502  (void)kwds;
1503 
1504  self = (Crossfire_Object *)type->tp_alloc(type, 0);
1505  if (self) {
1506  self->obj = NULL;
1507  self->count = 0;
1508  }
1509 
1510  return (PyObject *)self;
1511 }
1512 
1513 static void Crossfire_Object_dealloc(PyObject *obj) {
1514  Crossfire_Object *self;
1515 
1516  self = (Crossfire_Object *)obj;
1517  if (self) {
1518  if (self->obj) {
1519  free_object_assoc(self->obj);
1520  }
1521  Py_TYPE(self)->tp_free(obj);
1522  }
1523 }
1524 
1525 static PyObject *Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
1526  Crossfire_Player *self;
1527  (void)args;
1528  (void)kwds;
1529 
1530  self = (Crossfire_Player *)type->tp_alloc(type, 0);
1531  if (self) {
1532  self->obj = NULL;
1533  self->count = 0;
1534  }
1535 
1536  return (PyObject *)self;
1537 }
1538 
1539 static void Crossfire_Player_dealloc(PyObject *obj) {
1540  Crossfire_Player *self;
1541 
1542  self = (Crossfire_Player *)obj;
1543  if (self) {
1544  if (self->obj) {
1545  free_object_assoc(self->obj);
1546  }
1547  Py_TYPE(self)->tp_free(obj);
1548  }
1549 }
1550 
1551 static PyObject *Player_GetIntProperty(Crossfire_Player *whoptr, void *closure) {
1552  (void)closure;
1553  EXISTCHECK(whoptr);
1554  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, (int)(intptr_t)closure));
1555 }
1556 
1557 static PyObject *Player_GetObjectProperty(Crossfire_Player *whoptr, void *closure) {
1558  EXISTCHECK(whoptr);
1559  object *ob = cf_object_get_object_property(whoptr->obj, (int)(intptr_t)closure);
1560  return Crossfire_Object_wrap(ob);
1561 }
1562 
1563 /* Our actual Python ObjectType */
1564 CF_PYTHON_OBJECT(Object,
1566  &ObjectConvert,
1567  PyObject_HashNotImplemented,
1568  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1569  "Crossfire objects",
1570  (richcmpfunc) Crossfire_Object_RichCompare,
1571  ObjectMethods,
1573  NULL,
1575  );
1576 
1577 static PyGetSetDef Player_getseters[] = {
1578  { "CmdCount", (getter)Player_GetIntProperty,NULL, NULL, (void*)CFAPI_PLAYER_PROP_COUNT},
1579  { "Title", (getter)Player_GetTitle, (setter)Player_SetTitle, NULL, NULL },
1580  { "IP", (getter)Player_GetIP, NULL, NULL, NULL },
1581  { "Client", (getter)Player_GetClient , NULL, NULL, NULL },
1582  { "MarkedItem", (getter)Player_GetMarkedItem, (setter)Player_SetMarkedItem, NULL, NULL },
1583  { "Party", (getter)Player_GetParty, (setter)Player_SetParty, NULL, NULL },
1584  { "BedMap", (getter)Player_GetBedMap, (setter)Player_SetBedMap, NULL, NULL },
1585  { "BedX", (getter)Player_GetBedX, (setter)Player_SetBedX, NULL, NULL },
1586  { "BedY", (getter)Player_GetBedY, (setter)Player_SetBedY, NULL, NULL },
1587  { "Transport", (getter)Player_GetObjectProperty,NULL, NULL, (void*)CFAPI_PLAYER_PROP_TRANSPORT},
1588  { NULL, NULL, NULL, NULL, NULL }
1589 };
1590 
1591 static PyMethodDef PlayerMethods[] = {
1592  { "Message", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
1593  { "Write", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
1594  { "CanPay", (PyCFunction)Crossfire_Player_CanPay, METH_NOARGS, NULL },
1595  { "QuestStart", (PyCFunction)Player_QuestStart, METH_VARARGS, NULL },
1596  { "QuestGetState", (PyCFunction)Player_QuestGetState, METH_VARARGS, NULL },
1597  { "QuestSetState", (PyCFunction)Player_QuestSetState, METH_VARARGS, NULL },
1598  { "QuestWasCompleted", (PyCFunction)Player_QuestWasCompleted, METH_VARARGS, NULL },
1599  { "KnowledgeKnown", (PyCFunction)Player_KnowledgeKnown, METH_VARARGS, NULL },
1600  { "GiveKnowledge", (PyCFunction)Player_GiveKnowledge, METH_VARARGS, NULL },
1601  { NULL, NULL, 0, NULL }
1602 };
1603 
1604 /* Our actual Python ObjectPlayerType */
1605 CF_PYTHON_OBJECT(Player,
1607  NULL,
1608  NULL,
1609  Py_TPFLAGS_DEFAULT,
1610  "Crossfire player",
1611  NULL,
1612  PlayerMethods,
1616  );
1617 
1621 PyObject *Crossfire_Object_wrap(object *what) {
1622  Crossfire_Object *wrapper;
1623  Crossfire_Player *plwrap;
1624  PyObject *pyobj;
1625 
1626  /* return None if no object was to be wrapped */
1627  if (what == NULL) {
1628  Py_INCREF(Py_None);
1629  return Py_None;
1630  }
1631 
1632  pyobj = find_assoc_pyobject(what);
1633  if ((!pyobj) || (object_was_destroyed(((Crossfire_Object *)pyobj)->obj, ((Crossfire_Object *)pyobj)->count))) {
1634  if (what->type == PLAYER) {
1635  plwrap = PyObject_NEW(Crossfire_Player, &Crossfire_PlayerType);
1636  if (plwrap != NULL) {
1637  plwrap->obj = what;
1638  plwrap->count = what->count;
1639  }
1640  pyobj = (PyObject *)plwrap;
1641  } else {
1642  wrapper = PyObject_NEW(Crossfire_Object, &Crossfire_ObjectType);
1643  if (wrapper != NULL) {
1644  wrapper->obj = what;
1645  wrapper->count = what->count;
1646  }
1647  pyobj = (PyObject *)wrapper;
1648  }
1649  add_object_assoc(what, pyobj);
1650  } else {
1651  Py_INCREF(pyobj);
1652  }
1653  return pyobj;
1654 }
FLAG_IS_TURNABLE
#define FLAG_IS_TURNABLE
Object can change face with direction.
Definition: define.h:243
object_was_destroyed
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
Definition: object.h:70
Player_GetObjectProperty
static PyObject * Player_GetObjectProperty(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:1557
FLAG_USE_BOW
#define FLAG_USE_BOW
(Monster) can apply and fire bows
Definition: define.h:280
FLAG_RUN_AWAY
#define FLAG_RUN_AWAY
Object runs away from nearest player \ but can still attack at a distance.
Definition: define.h:267
Object_SetMoveOn
static int Object_SetMoveOn(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:712
CFAPI_OBJECT_PROP_TITLE
#define CFAPI_OBJECT_PROP_TITLE
Definition: plugin.h:132
Player_getseters
static PyGetSetDef Player_getseters[]
Definition: cfpython_object.cpp:1577
PLAYER
@ PLAYER
Definition: object.h:112
cf_log
void cf_log(LogLevel logLevel, const char *format,...)
Wrapper for LOG().
Definition: plugin_common.cpp:1531
Crossfire_Object_Drop
static PyObject * Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:775
Crossfire_Object_CastAbility
static PyObject * Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1027
cf_query_name_pl
sstring cf_query_name_pl(object *ob)
Definition: plugin_common.cpp:1218
Crossfire_Object_Move
static PyObject * Crossfire_Object_Move(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1214
CFAPI_OBJECT_PROP_X
#define CFAPI_OBJECT_PROP_X
Definition: plugin.h:138
Crossfire_Object_Teleport
static PyObject * Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:852
cf_object_check_for_spell
object * cf_object_check_for_spell(object *op, const char *name)
Wrapper for check_spell_known().
Definition: plugin_common.cpp:778
Crossfire_Object::obj
PyObject_HEAD object * obj
Definition: cfpython_object.h:34
Crossfire_Object_CheckTrigger
static PyObject * Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:881
cf_add_string
sstring cf_add_string(const char *str)
Wrapper for add_string().
Definition: plugin_common.cpp:1176
FLAG_USE_RANGE
#define FLAG_USE_RANGE
(Monster) can apply and use range items
Definition: define.h:279
Crossfire_Object_ForgetSpell
static PyObject * Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1002
Object_GetExpMul
static PyObject * Object_GetExpMul(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:378
CFAPI_OBJECT_PROP_CHA
#define CFAPI_OBJECT_PROP_CHA
Definition: plugin.h:203
CFAPI_OBJECT_PROP_ARCH_NAME
#define CFAPI_OBJECT_PROP_ARCH_NAME
Definition: plugin.h:215
Crossfire_Object_WriteKey
static PyObject * Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1083
CFAPI_OBJECT_PROP_ATTACK_MOVEMENT
#define CFAPI_OBJECT_PROP_ATTACK_MOVEMENT
Definition: plugin.h:178
llevError
@ llevError
Error, serious thing.
Definition: logger.h:11
cf_player_set_marked_item
void cf_player_set_marked_item(object *op, object *ob)
Definition: plugin_common.cpp:875
FLAG_ANIMATE
#define FLAG_ANIMATE
The object looks at archetype for faces.
Definition: define.h:229
cf_object_teleport
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
Definition: plugin_common.cpp:1369
cf_object_out_of_map
int cf_object_out_of_map(object *op, int x, int y)
Definition: plugin_common.cpp:1044
Crossfire_Party::party
PyObject_HEAD partylist * party
Definition: cfpython_party.h:35
Object_GetNamePl
static PyObject * Object_GetNamePl(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:351
cf_object_get_string_property
char * cf_object_get_string_property(object *op, int propcode, char *buf, int size)
Definition: plugin_common.cpp:448
talk_info::npc_msg_count
int npc_msg_count
How many NPCs reacted to the text being said.
Definition: dialog.h:58
FLAG_HITBACK
#define FLAG_HITBACK
Object will hit back when hit.
Definition: define.h:254
cf_object_get_long_property
long cf_object_get_long_property(object *op, long propcode)
Definition: plugin_common.cpp:342
CFAPI_OBJECT_PROP_LEVEL
#define CFAPI_OBJECT_PROP_LEVEL
Definition: plugin.h:157
FLAG_USE_SCROLL
#define FLAG_USE_SCROLL
(Monster) can read scroll
Definition: define.h:278
Object_GetMoveAllow
static PyObject * Object_GetMoveAllow(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:437
CFAPI_PLAYER_PROP_BED_X
#define CFAPI_PLAYER_PROP_BED_X
Definition: plugin.h:234
Object_GetFlagProperty
static PyObject * Object_GetFlagProperty(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:328
cf_object_get_sstring_property
sstring cf_object_get_sstring_property(object *op, int propcode)
Definition: plugin_common.cpp:440
cf_player_knowledge_has
int cf_player_knowledge_has(object *op, const char *knowledge)
Wrapper for knowledge_player_has().
Definition: plugin_common.cpp:909
add_object_assoc
static void add_object_assoc(object *key, PyObject *value)
Definition: cfpython_object.cpp:59
Crossfire_Party
Definition: cfpython_party.h:33
Player_SetParty
static int Player_SetParty(Crossfire_Player *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:173
Object_SetName
static int Object_SetName(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:520
Object_SetMap
static int Object_SetMap(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:573
cf_object_get_object_property
object * cf_object_get_object_property(object *op, int propcode)
Definition: plugin_common.cpp:365
Crossfire_Object_InternalCompare
static int Crossfire_Object_InternalCompare(Crossfire_Object *left, Crossfire_Object *right)
Definition: cfpython_object.cpp:1268
Object_SetMoveSlow
static int Object_SetMoveSlow(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:734
cf_object_cast_spell
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Wrapper for cast_spell().
Definition: plugin_common.cpp:744
cf_fix_object
void cf_fix_object(object *op)
Wrapper for fix_object().
Definition: plugin_common.cpp:1165
Crossfire_Object_CreateTimer
static PyObject * Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1095
Crossfire_Object_KnowSpell
static PyObject * Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1014
TYPEEXISTCHECK
#define TYPEEXISTCHECK(ob)
This is meant to be used for parameters where you don't know if the type of the object is correct.
Definition: cfpython_object.cpp:44
CFAPI_OBJECT_PROP_SLAYING
#define CFAPI_OBJECT_PROP_SLAYING
Definition: plugin.h:134
Crossfire_Object
Definition: cfpython_object.h:32
CFAPI_OBJECT_PROP_FRIENDLY
#define CFAPI_OBJECT_PROP_FRIENDLY
Definition: plugin.h:185
CFAPI_OBJECT_PROP_DEX
#define CFAPI_OBJECT_PROP_DEX
Definition: plugin.h:198
cf_player_knowledge_give
void cf_player_knowledge_give(object *op, const char *knowledge)
Wrapper for knowledge_give();.
Definition: plugin_common.cpp:922
CFAPI_OBJECT_PROP_ARCHETYPE
#define CFAPI_OBJECT_PROP_ARCHETYPE
Definition: plugin.h:181
FLAG_FRIENDLY
#define FLAG_FRIENDLY
Will help players.
Definition: define.h:233
Player_GetIP
static PyObject * Player_GetIP(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:99
CFAPI_PLAYER_PROP_COUNT
#define CFAPI_PLAYER_PROP_COUNT
Definition: plugin.h:240
Crossfire_Object_CreateInside
static PyObject * Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1151
Player_KnowledgeKnown
static PyObject * Player_KnowledgeKnown(Crossfire_Player *who, PyObject *args)
Definition: cfpython_object.cpp:144
FLAG_LIFESAVE
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
Definition: define.h:292
Object_SetPickable
static int Object_SetPickable(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:561
cf_create_object_by_name
object * cf_create_object_by_name(const char *name)
Wrapper for create_archetype() and create_archetype_by_object_name().
Definition: plugin_common.cpp:1102
CFAPI_OBJECT_PROP_LAST_EAT
#define CFAPI_OBJECT_PROP_LAST_EAT
Definition: plugin.h:161
CFAPI_OBJECT_PROP_MOVE_ON
#define CFAPI_OBJECT_PROP_MOVE_ON
Definition: plugin.h:223
Crossfire_Object_AddExp
static PyObject * Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1195
CFAPI_OBJECT_PROP_STR
#define CFAPI_OBJECT_PROP_STR
Definition: plugin.h:197
FLAG_USE_ARMOUR
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
Definition: define.h:282
CFAPI_OBJECT_PROP_GOD
#define CFAPI_OBJECT_PROP_GOD
Definition: plugin.h:214
MoveType
unsigned char MoveType
Typdef here to define type large enough to hold bitmask of all movement types.
Definition: define.h:409
Crossfire_Player_CanPay
static PyObject * Crossfire_Player_CanPay(Crossfire_Player *who, PyObject *args)
Definition: cfpython_object.cpp:184
cf_query_name
char * cf_query_name(object *ob, char *name, int size)
Definition: plugin_common.cpp:1210
cf_object_set_float_property
void cf_object_set_float_property(object *op, int propcode, float value)
Definition: plugin_common.cpp:396
Crossfire_Object_InsertInto
static PyObject * Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1166
FLAG_BLIND
#define FLAG_BLIND
If set, object cannot see (visually)
Definition: define.h:323
Object_SetOwner
static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:645
cf_object_apply
int cf_object_apply(object *op, object *author, int flags)
Wrapper for apply_manual().
Definition: plugin_common.cpp:542
CFAPI_OBJECT_PROP_MAXSP
#define CFAPI_OBJECT_PROP_MAXSP
Definition: plugin.h:211
CFAPI_OBJECT_PROP_RAW_NAME
#define CFAPI_OBJECT_PROP_RAW_NAME
Definition: plugin.h:228
FLAG_WIZ
#define FLAG_WIZ
Object has special privilegies.
Definition: define.h:218
FLAG_BEEN_APPLIED
#define FLAG_BEEN_APPLIED
Object was ever applied, for identification purposes.
Definition: define.h:310
Crossfire_Object_Event
static PyObject * Crossfire_Object_Event(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1232
Object_SetFace
static int Object_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:602
PlayerMethods
static PyMethodDef PlayerMethods[]
Definition: cfpython_object.cpp:1591
FLAG_SCARED
#define FLAG_SCARED
Monster is scared (mb player in future)
Definition: define.h:258
cf_object_get_int64_property
int64_t cf_object_get_int64_property(object *op, int propcode)
Definition: plugin_common.cpp:381
cf_object_move_to
int cf_object_move_to(object *op, int x, int y)
Wrapper for move_to().
Definition: plugin_common.cpp:630
Crossfire_Party_wrap
PyObject * Crossfire_Party_wrap(partylist *what)
Definition: cfpython_party.cpp:61
cf_object_free_drop_inventory
void cf_object_free_drop_inventory(object *ob)
Wrapper for object_free_drop_inventory().
Definition: plugin_common.cpp:571
CFAPI_OBJECT_PROP_Y
#define CFAPI_OBJECT_PROP_Y
Definition: plugin.h:139
flags
static const flag_definition flags[]
Flag mapping.
Definition: gridarta-types-convert.cpp:101
object::count
tag_t count
Unique object number for this object.
Definition: object.h:307
CFAPI_OBJECT_PROP_ENEMY
#define CFAPI_OBJECT_PROP_ENEMY
Definition: plugin.h:172
FLAG_XRAYS
#define FLAG_XRAYS
X-ray vision.
Definition: define.h:287
cf_player_can_pay
int cf_player_can_pay(object *op)
Wrapper for can_pay().
Definition: plugin_common.cpp:895
FLAG_MAKE_INVIS
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
Definition: define.h:315
CFAPI_OBJECT_PROP_MOVE_TYPE
#define CFAPI_OBJECT_PROP_MOVE_TYPE
Definition: plugin.h:220
cf_object_set_string_property
void cf_object_set_string_property(object *op, int propcode, const char *value)
Definition: plugin_common.cpp:456
cf_object_perm_exp
int64_t cf_object_perm_exp(object *op)
Wrapper for PERM_EXP macro.
Definition: plugin_common.cpp:515
CFAPI_OBJECT_PROP_FACE
#define CFAPI_OBJECT_PROP_FACE
Definition: plugin.h:217
CFAPI_OBJECT_PROP_ENVIRONMENT
#define CFAPI_OBJECT_PROP_ENVIRONMENT
Definition: plugin.h:125
cf_quest_set_player_state
void cf_quest_set_player_state(object *pl, sstring quest_code, int state)
Wrapper for quest_set_player_state();.
Definition: plugin_common.cpp:2084
Player_GetParty
static PyObject * Player_GetParty(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:167
cf_object_pickup
int cf_object_pickup(object *op, object *what)
Definition: plugin_common.cpp:1443
Player_GetIntProperty
static PyObject * Player_GetIntProperty(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:1551
cf_player_arrest
int cf_player_arrest(object *who)
Wrapper for player_arrest().
Definition: plugin_common.cpp:933
Crossfire_Object_SetResist
static PyObject * Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:961
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:15
FLAG_STEALTH
#define FLAG_STEALTH
Will wake monsters with less range.
Definition: define.h:299
Crossfire_Object_Remove
static PyObject * Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:747
Object_GetTotalExp
static PyObject * Object_GetTotalExp(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:372
CFAPI_OBJECT_PROP_ITEM_POWER
#define CFAPI_OBJECT_PROP_ITEM_POWER
Definition: plugin.h:164
FLAG_CAST_SPELL
#define FLAG_CAST_SPELL
(Monster) can learn and cast spells
Definition: define.h:277
FLAG_CURSED
#define FLAG_CURSED
The object is cursed.
Definition: define.h:303
FLAG_CAN_ROLL
#define FLAG_CAN_ROLL
Object can be rolled.
Definition: define.h:241
CFAPI_OBJECT_PROP_CURRENT_WEAPON
#define CFAPI_OBJECT_PROP_CURRENT_WEAPON
Definition: plugin.h:171
current_context
CFPContext * current_context
Definition: cfpython.cpp:106
buf
StringBuffer * buf
Definition: readable.cpp:1565
Player_SetTitle
static int Player_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:79
cf_player_set_title
void cf_player_set_title(object *op, const char *title)
Definition: plugin_common.cpp:842
cf_spring_trap
void cf_spring_trap(object *trap, object *victim)
Wrapper for spring_trap().
Definition: plugin_common.cpp:1014
Crossfire_Object_Pay
static PyObject * Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1057
Object_GetMoveOn
static PyObject * Object_GetMoveOn(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:443
cf_object_pay_amount
int cf_object_pay_amount(object *pl, uint64_t to_pay)
Wrapper for pay_for_amount().
Definition: plugin_common.cpp:732
CFAPI_OBJECT_PROP_INVISIBLE
#define CFAPI_OBJECT_PROP_INVISIBLE
Definition: plugin.h:216
Crossfire_Object_wrap
PyObject * Crossfire_Object_wrap(object *what)
Python initialized.
Definition: cfpython_object.cpp:1621
name
Plugin animator file specs[Config] name
Definition: animfiles.txt:4
Object_GetMap
static PyObject * Object_GetMap(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:357
NDI_ORANGE
#define NDI_ORANGE
Definition: newclient.h:250
FLAG_REMOVED
#define FLAG_REMOVED
Object is not in any map or invenory.
Definition: define.h:219
cf_object_change_abil
int cf_object_change_abil(object *op, object *tmp)
Wrapper for change_abil().
Definition: plugin_common.cpp:1680
cf_object_set_key
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)
Sets a value for specified key, equivalent to object_set_value().
Definition: plugin_common.cpp:1668
Object_SetFloatProperty
static int Object_SetFloatProperty(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:498
Player_SetMarkedItem
static int Player_SetMarkedItem(Crossfire_Player *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:117
CFAPI_OBJECT_PROP_SKILL
#define CFAPI_OBJECT_PROP_SKILL
Definition: plugin.h:135
FLAG_KNOWN_CURSED
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
Definition: define.h:307
Crossfire_Object_CheckInventory
static PyObject * Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1106
Crossfire_Player::obj
PyObject_HEAD object * obj
Definition: cfpython_object.h:42
Player_QuestSetState
static PyObject * Player_QuestSetState(Crossfire_Player *whoptr, PyObject *args)
Definition: cfpython_object.cpp:276
cf_quest_start
void cf_quest_start(object *pl, sstring quest_code, int state)
Wrapper for quest_start().
Definition: plugin_common.cpp:2073
Crossfire_PlayerType
PyTypeObject Crossfire_PlayerType
Object_SetValue
static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:633
CFPContext::who
PyObject * who
Definition: cfpython.h:96
FLAG_ALIVE
#define FLAG_ALIVE
Object can fight (or be fought)
Definition: define.h:217
CFAPI_OBJECT_PROP_ANIM_SPEED
#define CFAPI_OBJECT_PROP_ANIM_SPEED
Definition: plugin.h:184
m
static event_registration m
Definition: citylife.cpp:424
CFAPI_OBJECT_PROP_AC
#define CFAPI_OBJECT_PROP_AC
Definition: plugin.h:205
FLAG_SEE_INVISIBLE
#define FLAG_SEE_INVISIBLE
Will see invisible player.
Definition: define.h:240
MOVE_ALL
#define MOVE_ALL
Mask of all movement types.
Definition: define.h:389
cf_object_set_animation
int cf_object_set_animation(object *op, const char *animation)
Set the object's animation.
Definition: plugin_common.cpp:486
CFAPI_OBJECT_PROP_MOVE_OFF
#define CFAPI_OBJECT_PROP_MOVE_OFF
Definition: plugin.h:224
cf_log_plain
void cf_log_plain(LogLevel logLevel, const char *message)
Wrapper for LOG() that uses directly a buffer, without format.
Definition: plugin_common.cpp:1551
Crossfire_Map::map
PyObject_HEAD mapstruct * map
Definition: cfpython_map.h:34
CF_IS_PYSTR
#define CF_IS_PYSTR(cfpy_obj)
Definition: cfpython.h:65
FLAG_KNOWN_MAGICAL
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
Definition: define.h:306
CFAPI_OBJECT_PROP_HP
#define CFAPI_OBJECT_PROP_HP
Definition: plugin.h:206
CFAPI_OBJECT_PROP_MAXHP
#define CFAPI_OBJECT_PROP_MAXHP
Definition: plugin.h:210
cf_player_get_party
partylist * cf_player_get_party(object *op)
Definition: plugin_common.cpp:881
cf_object_say
void cf_object_say(object *op, const char *msg)
Definition: plugin_common.cpp:1058
Player_QuestWasCompleted
static PyObject * Player_QuestWasCompleted(Crossfire_Player *whoptr, PyObject *args)
Definition: cfpython_object.cpp:293
CFAPI_OBJECT_PROP_OB_BELOW
#define CFAPI_OBJECT_PROP_OB_BELOW
Definition: plugin.h:121
cf_timer_create
int cf_timer_create(object *ob, long delay, int mode)
Creates a timer, equivalent of calling cftimer_create().
Definition: plugin_common.cpp:1613
FLAG_UNPAID
#define FLAG_UNPAID
Object hasn't been paid for yet.
Definition: define.h:223
CFAPI_OBJECT_PROP_TOTAL_EXP
#define CFAPI_OBJECT_PROP_TOTAL_EXP
Definition: plugin.h:170
Object_GetFloatProperty
static PyObject * Object_GetFloatProperty(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:322
Object_GetExp
static PyObject * Object_GetExp(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:366
CFAPI_PLAYER_PROP_BED_Y
#define CFAPI_PLAYER_PROP_BED_Y
Definition: plugin.h:235
Player_SetBedY
static int Player_SetBedY(Crossfire_Player *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:232
cf_object_set_int64_property
void cf_object_set_int64_property(object *op, int propcode, int64_t value)
Definition: plugin_common.cpp:402
Crossfire_Object_QueryName
static PyObject * Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:941
Crossfire_Object_new
static PyObject * Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Definition: cfpython_object.cpp:1499
CFAPI_OBJECT_PROP_RACE
#define CFAPI_OBJECT_PROP_RACE
Definition: plugin.h:133
CFAPI_OBJECT_PROP_MOVE_BLOCK
#define CFAPI_OBJECT_PROP_MOVE_BLOCK
Definition: plugin.h:221
CFAPI_OBJECT_PROP_FACING
#define CFAPI_OBJECT_PROP_FACING
Definition: plugin.h:144
FLAG_MONSTER
#define FLAG_MONSTER
Will attack players.
Definition: define.h:232
Player_SetBedX
static int Player_SetBedX(Crossfire_Player *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:215
FLAG_CAN_USE_SKILL
#define FLAG_CAN_USE_SKILL
The monster can use skills.
Definition: define.h:308
CFAPI_OBJECT_PROP_WEIGHT
#define CFAPI_OBJECT_PROP_WEIGHT
Definition: plugin.h:166
ObjectMethods
static PyMethodDef ObjectMethods[]
Definition: cfpython_object.cpp:1454
Player_GetBedX
static PyObject * Player_GetBedX(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:209
cf_object_get_movetype_property
MoveType cf_object_get_movetype_property(object *op, int propcode)
Definition: plugin_common.cpp:357
cf_object_find_by_arch_name
object * cf_object_find_by_arch_name(const object *who, const char *name)
Wrapper for object_find_by_arch_name().
Definition: plugin_common.cpp:592
cf_object_get_map_property
mapstruct * cf_object_get_map_property(object *op, int propcode)
Definition: plugin_common.cpp:373
CFAPI_OBJECT_PROP_DAM
#define CFAPI_OBJECT_PROP_DAM
Definition: plugin.h:213
cf_object_query_money
int cf_object_query_money(const object *op)
Wrapper for query_money().
Definition: plugin_common.cpp:992
Crossfire_Object_Clone
static PyObject * Crossfire_Object_Clone(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:787
FLAG_UNAGGRESSIVE
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
Definition: define.h:259
Crossfire_Object_Say
static PyObject * Crossfire_Object_Say(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:897
cfpython.h
Object_GetValue
static PyObject * Object_GetValue(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:396
Object_SetAnim
static int Object_SetAnim(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:617
Object_GetPickable
static PyObject * Object_GetPickable(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:384
MAX_NPC
#define MAX_NPC
How many NPCs maximum will reply to the player.
Definition: dialog.h:45
Crossfire_Player::count
tag_t count
Definition: cfpython_object.h:43
Crossfire_Object_RemoveDepletion
static PyObject * Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1252
Object_GetMoveOff
static PyObject * Object_GetMoveOff(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:449
object::type
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:348
cf_object_clone
object * cf_object_clone(object *op, int clonetype)
Clone an object.
Definition: plugin_common.cpp:683
message
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your message
Definition: survival-guide.txt:34
Player_GetTitle
static PyObject * Player_GetTitle(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:72
CF_PYTHON_OBJECT
CF_PYTHON_OBJECT(Object, Crossfire_Object_dealloc, &ObjectConvert, PyObject_HashNotImplemented, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, "Crossfire objects",(richcmpfunc) Crossfire_Object_RichCompare, ObjectMethods, Object_getseters, NULL, Crossfire_Object_new)
CFAPI_OBJECT_PROP_EXP
#define CFAPI_OBJECT_PROP_EXP
Definition: plugin.h:190
CFAPI_OBJECT_PROP_SPEED
#define CFAPI_OBJECT_PROP_SPEED
Definition: plugin.h:140
CFAPI_OBJECT_PROP_TYPE
#define CFAPI_OBJECT_PROP_TYPE
Definition: plugin.h:145
CFAPI_OBJECT_PROP_NROF
#define CFAPI_OBJECT_PROP_NROF
Definition: plugin.h:142
FLAG_BLOCKSVIEW
#define FLAG_BLOCKSVIEW
Object blocks view.
Definition: define.h:256
free_object_assoc
static void free_object_assoc(object *key)
Definition: cfpython_object.cpp:68
cf_object_get_double_property
double cf_object_get_double_property(object *op, int propcode)
Definition: plugin_common.cpp:432
Crossfire_Archetype_wrap
PyObject * Crossfire_Archetype_wrap(archetype *what)
Definition: cfpython_archetype.cpp:62
title
Information on one title.
Definition: readable.cpp:108
MAX_NAME
#define MAX_NAME
Definition: define.h:41
FLAG_NO_PICK
#define FLAG_NO_PICK
Object can't be picked up.
Definition: define.h:226
FLAG_NO_SAVE
#define FLAG_NO_SAVE
If set (through plugins), the object is not saved on maps.
Definition: define.h:231
Object_SetMoveType
static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:679
Crossfire_Object_RichCompare
static PyObject * Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op)
Definition: cfpython_object.cpp:1274
Object_SetMoveBlock
static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:690
FLAG_REFL_MISSILE
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
Definition: define.h:260
Object_SetExp
static int Object_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:667
CFAPI_OBJECT_PROP_ATTACK_TYPE
#define CFAPI_OBJECT_PROP_ATTACK_TYPE
Definition: plugin.h:149
Object_GetMaterial
static PyObject * Object_GetMaterial(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:461
cf_object_get_flag
int cf_object_get_flag(object *ob, int flag)
Definition: plugin_common.cpp:1286
FLAG_IS_FLOOR
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
Definition: define.h:289
cf_player_get_client
sstring cf_player_get_client(object *op)
Definition: plugin_common.cpp:857
Crossfire_Object_GetOutOfMap
static PyObject * Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1141
CFAPI_OBJECT_PROP_OWNER
#define CFAPI_OBJECT_PROP_OWNER
Definition: plugin.h:191
cf_object_drop
void cf_object_drop(object *op, object *author)
Definition: plugin_common.cpp:1052
cf_object_transfer
int cf_object_transfer(object *op, int x, int y, int randomly, object *originator)
Wrapper for transfer_ob().
Definition: plugin_common.cpp:618
cf_object_set_movetype_property
void cf_object_set_movetype_property(object *op, int propcode, MoveType value)
Definition: plugin_common.cpp:350
CFAPI_OBJECT_PROP_NAME_PLURAL
#define CFAPI_OBJECT_PROP_NAME_PLURAL
Definition: plugin.h:131
Crossfire_Object_Apply
static PyObject * Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:763
object_assoc_table
static std::map< object *, PyObject * > object_assoc_table
Definition: cfpython_object.cpp:57
FLAG_RANDOM_MOVE
#define FLAG_RANDOM_MOVE
NPC will move randomly.
Definition: define.h:296
cf_free_string
void cf_free_string(sstring str)
Wrapper for free_string().
Definition: plugin_common.cpp:1191
FLAG_USE_WEAPON
#define FLAG_USE_WEAPON
(Monster) can wield weapons
Definition: define.h:283
cf_object_present_archname_inside
object * cf_object_present_archname_inside(object *op, char *whatstr)
Kinda wrapper for arch_present_in_ob().
Definition: plugin_common.cpp:579
CFAPI_OBJECT_PROP_WIS
#define CFAPI_OBJECT_PROP_WIS
Definition: plugin.h:200
CFAPI_OBJECT_PROP_POW
#define CFAPI_OBJECT_PROP_POW
Definition: plugin.h:202
cf_object_get_archetype_property
archetype * cf_object_get_archetype_property(object *op, int propcode)
Definition: plugin_common.cpp:416
FLAG_SEE_IN_DARK
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
Definition: define.h:324
CFPContext::talk
struct talk_info * talk
Definition: cfpython.h:105
Object_GetMoveSlow
static PyObject * Object_GetMoveSlow(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:455
FLAG_DAMNED
#define FLAG_DAMNED
The object is very cursed.
Definition: define.h:304
cf_player_get_marked_item
object * cf_player_get_marked_item(object *op)
Definition: plugin_common.cpp:866
CFAPI_OBJECT_PROP_CONTAINER
#define CFAPI_OBJECT_PROP_CONTAINER
Definition: plugin.h:127
FLAG_ONLY_ATTACK
#define FLAG_ONLY_ATTACK
NPC will evaporate if there is no enemy.
Definition: define.h:297
Crossfire_Object_Fix
static PyObject * Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:832
cf_object_insert_in_ob
object * cf_object_insert_in_ob(object *op, object *where)
Wrapper for object_insert_in_ob().
Definition: plugin_common.cpp:1307
Crossfire_Player
Definition: cfpython_object.h:40
CFAPI_OBJECT_PROP_INVENTORY
#define CFAPI_OBJECT_PROP_INVENTORY
Definition: plugin.h:124
CFAPI_OBJECT_PROP_MAP
#define CFAPI_OBJECT_PROP_MAP
Definition: plugin.h:128
cf_object_user_event
int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix)
Definition: plugin_common.cpp:262
cf_object_move
int cf_object_move(object *op, int dir, object *originator)
Definition: plugin_common.cpp:531
Crossfire_Object_PayAmount
static PyObject * Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1044
Crossfire_Object_ChangeAbil
static PyObject * Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1185
cf_object_split
object * cf_object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
Wrapper for object_split().
Definition: plugin_common.cpp:697
cf_player_set_party
void cf_player_set_party(object *op, partylist *party)
Definition: plugin_common.cpp:885
CFAPI_PLAYER_PROP_TRANSPORT
#define CFAPI_PLAYER_PROP_TRANSPORT
Definition: plugin.h:238
FLAG_SLEEP
#define FLAG_SLEEP
NPC is sleeping.
Definition: define.h:294
Crossfire_Object_GetResist
static PyObject * Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:949
Crossfire_Object_ReadKey
static PyObject * Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1070
NDI_UNIQUE
#define NDI_UNIQUE
Print immediately, don't buffer.
Definition: newclient.h:266
FLAG_GENERATOR
#define FLAG_GENERATOR
Will generate type ob->stats.food.
Definition: define.h:235
object::name
sstring name
The name of the object, obviously...
Definition: object.h:319
Crossfire_PartyType
PyTypeObject Crossfire_PartyType
CFAPI_OBJECT_PROP_ANIMATION
#define CFAPI_OBJECT_PROP_ANIMATION
Definition: plugin.h:218
CFAPI_OBJECT_PROP_INT
#define CFAPI_OBJECT_PROP_INT
Definition: plugin.h:201
CFAPI_OBJECT_PROP_SP
#define CFAPI_OBJECT_PROP_SP
Definition: plugin.h:207
Object_SetMoveOff
static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:723
Object_GetOtherArchetype
static PyObject * Object_GetOtherArchetype(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:408
CFAPI_OBJECT_PROP_NAME
#define CFAPI_OBJECT_PROP_NAME
Definition: plugin.h:130
CFAPI_OBJECT_PROP_EXP_MULTIPLIER
#define CFAPI_OBJECT_PROP_EXP_MULTIPLIER
Definition: plugin.h:180
Crossfire_Object_LearnSpell
static PyObject * Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:989
mapstruct
This is a game-map.
Definition: map.h:318
cf_object_set_flag
void cf_object_set_flag(object *ob, int flag, int value)
Definition: plugin_common.cpp:1297
FLAG_NO_DAMAGE
#define FLAG_NO_DAMAGE
monster can't be damaged
Definition: define.h:343
FLAG_IS_THROWN
#define FLAG_IS_THROWN
Object is designed to be thrown.
Definition: define.h:236
Object_GetMoveBlock
static PyObject * Object_GetMoveBlock(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:431
sstring
const typedef char * sstring
Definition: sstring.h:2
FLAG_STAND_STILL
#define FLAG_STAND_STILL
NPC will not (ever) move.
Definition: define.h:295
FLAG_UNDEAD
#define FLAG_UNDEAD
Monster is undead.
Definition: define.h:257
Crossfire_Object_CheckArchInventory
static PyObject * Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1129
EXISTCHECK
#define EXISTCHECK(ob)
Definition: cfpython_object.cpp:33
Player_GetMarkedItem
static PyObject * Player_GetMarkedItem(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:111
Player_GetBedMap
static PyObject * Player_GetBedMap(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:190
CFAPI_PLAYER_PROP_BED_MAP
#define CFAPI_PLAYER_PROP_BED_MAP
Definition: plugin.h:233
cf_object_set_nrof
int cf_object_set_nrof(object *, int nrof)
Definition: plugin_common.cpp:1269
CFAPI_OBJECT_PROP_WC
#define CFAPI_OBJECT_PROP_WC
Definition: plugin.h:204
CFAPI_OBJECT_PROP_GLOW_RADIUS
#define CFAPI_OBJECT_PROP_GLOW_RADIUS
Definition: plugin.h:169
Player_QuestStart
static PyObject * Player_QuestStart(Crossfire_Player *whoptr, PyObject *args)
Definition: cfpython_object.cpp:243
FLAG_APPLIED
#define FLAG_APPLIED
Object is ready for use by living.
Definition: define.h:222
cf_object_check_trigger
int cf_object_check_trigger(object *op, object *cause)
Wrapper for check_trigger().
Definition: plugin_common.cpp:1025
Player_GetBedY
static PyObject * Player_GetBedY(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:226
CF_PYTHON_NUMBER_METHODS
CF_PYTHON_NUMBER_METHODS(Object, Crossfire_Object_Long)
CFAPI_OBJECT_PROP_CON
#define CFAPI_OBJECT_PROP_CON
Definition: plugin.h:199
cf_quest_get_player_state
int cf_quest_get_player_state(object *pl, sstring quest_code)
Wrapper for quest_get_player_state().
Definition: plugin_common.cpp:2060
find_assoc_pyobject
static PyObject * find_assoc_pyobject(object *key)
Definition: cfpython_object.cpp:63
cf_object_set_long_property
void cf_object_set_long_property(object *op, int propcode, long value)
Definition: plugin_common.cpp:390
Object_GetMoveType
static PyObject * Object_GetMoveType(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:425
FLAG_IS_USED_UP
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
Definition: define.h:247
Object_SetFlagProperty
static int Object_SetFlagProperty(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:509
cf_object_get_key
const char * cf_object_get_key(object *op, const char *keyname)
Gets value for specified key, equivalent of object_get_value().
Definition: plugin_common.cpp:1646
CFAPI_OBJECT_PROP_GP
#define CFAPI_OBJECT_PROP_GP
Definition: plugin.h:208
FLAG_STARTEQUIP
#define FLAG_STARTEQUIP
Object was given to player at start.
Definition: define.h:255
Crossfire_Object_dealloc
static void Crossfire_Object_dealloc(PyObject *obj)
Definition: cfpython_object.cpp:1513
CFAPI_OBJECT_PROP_LAST_SP
#define CFAPI_OBJECT_PROP_LAST_SP
Definition: plugin.h:159
Object_getseters
static PyGetSetDef Object_getseters[]
Definition: cfpython_object.cpp:1317
Player_GetClient
static PyObject * Player_GetClient(Crossfire_Player *whoptr, void *closure)
Definition: cfpython_object.cpp:105
CFAPI_OBJECT_PROP_MATERIAL
#define CFAPI_OBJECT_PROP_MATERIAL
Definition: plugin.h:153
CFAPI_OBJECT_PROP_DURATION
#define CFAPI_OBJECT_PROP_DURATION
Definition: plugin.h:227
CFAPI_OBJECT_PROP_OTHER_ARCH
#define CFAPI_OBJECT_PROP_OTHER_ARCH
Definition: plugin.h:182
Object_GetIntProperty
static PyObject * Object_GetIntProperty(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:316
level
int level
Definition: readable.cpp:1563
CFAPI_OBJECT_PROP_OB_ABOVE
#define CFAPI_OBJECT_PROP_OB_ABOVE
Definition: plugin.h:120
Crossfire_Object_MoveTo
static PyObject * Crossfire_Object_MoveTo(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1223
Crossfire_Object_Reposition
static PyObject * Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:929
EXISTCHECK_INT
#define EXISTCHECK_INT(ob)
Definition: cfpython_object.cpp:50
FLAG_CONFUSED
#define FLAG_CONFUSED
Will also be unable to cast spells.
Definition: define.h:298
talk_info::npc_msgs
sstring npc_msgs[MAX_NPC]
What the NPCs will say.
Definition: dialog.h:59
CFAPI_OBJECT_PROP_MOVE_ALLOW
#define CFAPI_OBJECT_PROP_MOVE_ALLOW
Definition: plugin.h:222
Crossfire_Object_Long
static PyObject * Crossfire_Object_Long(PyObject *obj)
Definition: cfpython_object.cpp:1312
Object_SetStringProperty
static int Object_SetStringProperty(Crossfire_Object *whoptr, PyObject *value, void *closure)
Setters.
Definition: cfpython_object.cpp:468
Object_SetIntProperty
static int Object_SetIntProperty(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:487
cf_player_get_title
char * cf_player_get_title(object *op, char *title, int size)
Definition: plugin_common.cpp:834
Player_SetBedMap
static int Player_SetBedMap(Crossfire_Player *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:198
Object_GetMoney
static PyObject * Object_GetMoney(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:390
Object_SetMoveAllow
static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:701
skill
skill
Definition: arch-handbook.txt:585
Crossfire_Object_Split
static PyObject * Crossfire_Object_Split(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:811
FLAG_SPLITTING
#define FLAG_SPLITTING
Object splits into stats.food other objs.
Definition: define.h:253
cf_object_set_face
int cf_object_set_face(object *op, const char *face)
Set the object's face.
Definition: plugin_common.cpp:474
CFAPI_OBJECT_PROP_MOVE_SLOW
#define CFAPI_OBJECT_PROP_MOVE_SLOW
Definition: plugin.h:225
Player_QuestGetState
static PyObject * Player_QuestGetState(Crossfire_Player *whoptr, PyObject *args)
Definition: cfpython_object.cpp:260
cf_player_message
void cf_player_message(object *op, const char *txt, int flags)
Definition: plugin_common.cpp:787
Object_GetArchetype
static PyObject * Object_GetArchetype(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:402
Player_GiveKnowledge
static PyObject * Player_GiveKnowledge(Crossfire_Player *who, PyObject *args)
Definition: cfpython_object.cpp:154
cf_object_change_map
object * cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Wrapper for object_insert_in_map_at().
Definition: plugin_common.cpp:642
CFAPI_OBJECT_PROP_LUCK
#define CFAPI_OBJECT_PROP_LUCK
Definition: plugin.h:189
cf_object_forget_spell
void cf_object_forget_spell(object *op, object *sp)
Wrapper for do_forget_spell(), except takes an object, not a string.
Definition: plugin_common.cpp:768
cf_object_pay_item
int cf_object_pay_item(object *op, object *pl)
Wrapper for pay_for_item().
Definition: plugin_common.cpp:720
code
Crossfire Architecture the general intention is to enhance the enjoyability and playability of CF In this code
Definition: arch-handbook.txt:14
cf_object_insert_object
object * cf_object_insert_object(object *op, object *container)
Definition: plugin_common.cpp:1065
FLAG_WAS_WIZ
#define FLAG_WAS_WIZ
Player was once a wiz.
Definition: define.h:221
cf_object_get_resistance
int16_t cf_object_get_resistance(object *op, int rtype)
Definition: plugin_common.cpp:313
cf_object_set_int_property
void cf_object_set_int_property(object *op, int propcode, int value)
Definition: plugin_common.cpp:329
Crossfire_Object_Cast
static PyObject * Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:973
Object_SetEnemy
static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:656
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2734
CFAPI_OBJECT_PROP_VALUE
#define CFAPI_OBJECT_PROP_VALUE
Definition: plugin.h:156
CFAPI_OBJECT_PROP_MESSAGE
#define CFAPI_OBJECT_PROP_MESSAGE
Definition: plugin.h:136
CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY
#define CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY
Definition: plugin.h:226
Crossfire_Object_ActivateRune
static PyObject * Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:866
FLAG_USE_RING
#define FLAG_USE_RING
(Monster) can use rings, boots, gauntlets, etc
Definition: define.h:284
CFAPI_OBJECT_PROP_MAXGP
#define CFAPI_OBJECT_PROP_MAXGP
Definition: plugin.h:212
CFAPI_OBJECT_PROP_COUNT
#define CFAPI_OBJECT_PROP_COUNT
Definition: plugin.h:129
Crossfire_Player_dealloc
static void Crossfire_Player_dealloc(PyObject *obj)
Definition: cfpython_object.cpp:1539
FLAG_IDENTIFIED
#define FLAG_IDENTIFIED
Item is identifiable (e.g.
Definition: define.h:248
Object_GetExists
static PyObject * Object_GetExists(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:414
CFAPI_OBJECT_PROP_SUBTYPE
#define CFAPI_OBJECT_PROP_SUBTYPE
Definition: plugin.h:146
cf_object_remove
void cf_object_remove(object *op)
Wrapper for object_remove().
Definition: plugin_common.cpp:562
Crossfire_Object_Arrest
static PyObject * Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1262
cf_object_change_exp
void cf_object_change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Wrapper for change_exp().
Definition: plugin_common.cpp:504
Object_SetNamePl
static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:541
Object_SetQuantity
static int Object_SetQuantity(Crossfire_Object *whoptr, PyObject *value, void *closure)
Definition: cfpython_object.cpp:585
Crossfire_Object_PermExp
static PyObject * Crossfire_Object_PermExp(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:1208
Object_GetSStringProperty
static PyObject * Object_GetSStringProperty(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:310
FLAG_UNIQUE
#define FLAG_UNIQUE
Item is really unique (UNIQUE_ITEMS)
Definition: define.h:274
Crossfire_Object_Take
static PyObject * Crossfire_Object_Take(Crossfire_Object *who, PyObject *args)
Definition: cfpython_object.cpp:839
cf_player_get_ip
sstring cf_player_get_ip(object *op)
Definition: plugin_common.cpp:848
Crossfire_Map_wrap
PyObject * Crossfire_Map_wrap(mapstruct *what)
Definition: cfpython_map.cpp:435
CFAPI_OBJECT_PROP_FP
#define CFAPI_OBJECT_PROP_FP
Definition: plugin.h:209
Crossfire_Map
Definition: cfpython_map.h:32
Crossfire_Player_new
static PyObject * Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Definition: cfpython_object.cpp:1525
cf_object_set_object_property
void cf_object_set_object_property(object *op, int propcode, object *value)
Definition: plugin_common.cpp:493
Crossfire_ObjectType
PyTypeObject Crossfire_ObjectType
CFAPI_OBJECT_PROP_LAST_GRACE
#define CFAPI_OBJECT_PROP_LAST_GRACE
Definition: plugin.h:160
cf_object_learn_spell
void cf_object_learn_spell(object *op, object *spell, int special_prayer)
Wrapper for do_learn_spell().
Definition: plugin_common.cpp:756
Crossfire_Player_Message
static PyObject * Crossfire_Player_Message(Crossfire_Player *who, PyObject *args)
Definition: cfpython_object.cpp:131
cf_object_get_int_property
int cf_object_get_int_property(object *op, int propcode)
Definition: plugin_common.cpp:335
cf_quest_was_completed
int cf_quest_was_completed(object *pl, sstring quest_code)
Wrapper for quest_was_completed().
Definition: plugin_common.cpp:2095
Object_GetObjectProperty
static PyObject * Object_GetObjectProperty(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:334
cf_object_get_float_property
float cf_object_get_float_property(object *op, int propcode)
Definition: plugin_common.cpp:408
CFAPI_OBJECT_PROP_DIRECTION
#define CFAPI_OBJECT_PROP_DIRECTION
Definition: plugin.h:143
cf_object_set_resistance
void cf_object_set_resistance(object *op, int rtype, int16_t value)
Definition: plugin_common.cpp:321
Object_GetName
static PyObject * Object_GetName(Crossfire_Object *whoptr, void *closure)
Definition: cfpython_object.cpp:343
cf_object_remove_depletion
int cf_object_remove_depletion(object *op, int level)
Wrapper for remove_depletion().
Definition: plugin_common.cpp:798
CFAPI_OBJECT_PROP_MATERIAL_NAME
#define CFAPI_OBJECT_PROP_MATERIAL_NAME
Definition: plugin.h:154
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
FLAG_REFL_SPELL
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
Definition: define.h:262
CFAPI_OBJECT_PROP_WEIGHT_LIMIT
#define CFAPI_OBJECT_PROP_WEIGHT_LIMIT
Definition: plugin.h:167
face
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the and treasurelist definitions into a single or trs file and the graphics into a face(metadata) and .tar(bitmaps) file
CFAPI_OBJECT_PROP_SPEED_LEFT
#define CFAPI_OBJECT_PROP_SPEED_LEFT
Definition: plugin.h:141
Crossfire_Object::count
tag_t count
Definition: cfpython_object.h:35
Crossfire_MapType
PyTypeObject Crossfire_MapType