Crossfire Server, Trunk  R21219
cfpython_object.c
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 <hashtable.h>
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 /* Table for keeping track of which PyObject goes with with Crossfire object */
58 
59 /* Helper functions for dealing with object_assoc_table */
62 }
63 
64 static void add_object_assoc(object *key, PyObject *value) {
65  add_ptr_assoc(object_assoc_table, key, value);
66 }
67 
68 static PyObject *find_assoc_pyobject(object *key) {
69  return (PyObject *)find_assoc_value(object_assoc_table, key);
70 }
71 
72 static void free_object_assoc(object *key) {
74 }
75 
76 static PyObject *Player_GetTitle(Crossfire_Object *whoptr, void *closure) {
77  char title[MAX_NAME];
78  EXISTCHECK(whoptr);
79  return Py_BuildValue("s", cf_player_get_title(whoptr->obj, title, MAX_NAME));
80 }
81 
82 static int Player_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure) {
83  char *val;
84 
85  EXISTCHECK_INT(whoptr);
86  if (value == NULL) {
87  PyErr_SetString(PyExc_TypeError, "Cannot delete the Title attribute");
88  return -1;
89  }
90  if (!CF_IS_PYSTR(value)) {
91  PyErr_SetString(PyExc_TypeError, "The Title attribute must be a string");
92  return -1;
93  }
94  if (!PyArg_Parse(value, "s", &val))
95  return -1;
96 
97  cf_player_set_title(whoptr->obj, val);
98  return 0;
99 }
100 
101 static PyObject *Player_GetIP(Crossfire_Player *whoptr, void *closure) {
102  EXISTCHECK(whoptr);
103  return Py_BuildValue("s", cf_player_get_ip(whoptr->obj));
104 }
105 
106 static PyObject *Player_GetMarkedItem(Crossfire_Player *whoptr, void *closure) {
107  EXISTCHECK(whoptr);
109 }
110 
111 static int Player_SetMarkedItem(Crossfire_Player *whoptr, PyObject *value, void *closure) {
112  Crossfire_Object *ob;
113 
114  EXISTCHECK_INT(whoptr);
115  if (value == Py_None)
116  cf_player_set_marked_item(whoptr->obj, NULL);
117  else if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
118  return -1;
119  else
120  cf_player_set_marked_item(whoptr->obj, ob->obj);
121  return 0;
122 }
123 
124 static PyObject *Crossfire_Player_Message(Crossfire_Player *who, PyObject *args) {
125  char *message;
126  int color = NDI_UNIQUE|NDI_ORANGE;
127 
128  EXISTCHECK(who);
129  if (!PyArg_ParseTuple(args, "s|i", &message, &color))
130  return NULL;
131 
132  cf_player_message(who->obj, message, color);
133  Py_INCREF(Py_None);
134  return Py_None;
135 }
136 
137 static PyObject *Player_KnowledgeKnown(Crossfire_Player *who, PyObject *args) {
138  const char *knowledge;
139 
140  EXISTCHECK(who);
141  if (!PyArg_ParseTuple(args, "s", &knowledge))
142  return NULL;
143 
144  return Py_BuildValue("i", cf_player_knowledge_has(who->obj, knowledge));
145 }
146 
147 static PyObject *Player_GiveKnowledge(Crossfire_Player *who, PyObject *args) {
148  const char *knowledge;
149 
150  EXISTCHECK(who);
151  if (!PyArg_ParseTuple(args, "s", &knowledge))
152  return NULL;
153 
154  cf_player_knowledge_give(who->obj, knowledge);
155 
156  Py_INCREF(Py_None);
157  return Py_None;
158 }
159 
160 static PyObject *Player_GetParty(Crossfire_Player *whoptr, void *closure) {
161  EXISTCHECK(whoptr);
163 }
164 
165 static int Player_SetParty(Crossfire_Player *whoptr, PyObject *value, void *closure) {
166  Crossfire_Party *ob;
167 
168  EXISTCHECK_INT(whoptr);
169  if (!PyArg_Parse(value, "O!", &Crossfire_PartyType, &ob))
170  return -1;
171  cf_player_set_party(whoptr->obj, ob->party);
172  return 0;
173 }
174 
175 static PyObject *Crossfire_Player_CanPay(Crossfire_Player *who, PyObject *args) {
176  EXISTCHECK(who);
177  return Py_BuildValue("i", cf_player_can_pay(who->obj));
178 }
179 
180 static PyObject *Player_GetBedMap(Crossfire_Player *whoptr, void *closure) {
181  char bed[200];
182 
183  EXISTCHECK(whoptr);
184  return Py_BuildValue("s", cf_object_get_string_property(whoptr->obj, CFAPI_PLAYER_PROP_BED_MAP, bed, sizeof(bed)));
185 }
186 
187 static int Player_SetBedMap(Crossfire_Player *whoptr, PyObject *value, void *closure) {
188  char *location;
189 
190  EXISTCHECK_INT(whoptr);
191  if (!PyArg_Parse(value, "s", &location))
192  return -1;
194  return 0;
195 }
196 
197 static PyObject *Player_GetBedX(Crossfire_Player *whoptr, void *closure) {
198  EXISTCHECK(whoptr);
199  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_PLAYER_PROP_BED_X));
200 }
201 
202 static int Player_SetBedX(Crossfire_Player *whoptr, PyObject *value, void *closure) {
203  int x;
204 
205  EXISTCHECK_INT(whoptr);
206  if (!PyArg_Parse(value, "i", &x))
207  return -1;
209  return 0;
210 }
211 
212 static PyObject *Player_GetBedY(Crossfire_Player *whoptr, void *closure) {
213  EXISTCHECK(whoptr);
214  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_PLAYER_PROP_BED_Y));
215 }
216 
217 static int Player_SetBedY(Crossfire_Player *whoptr, PyObject *value, void *closure) {
218  int y;
219 
220  EXISTCHECK_INT(whoptr);
221  if (!PyArg_Parse(value, "i", &y))
222  return -1;
224  return 0;
225 }
226 
227 static PyObject *Player_QuestStart(Crossfire_Player *whoptr, PyObject *args) {
228  char *code;
229  int state;
230  sstring quest_code;
231 
232  EXISTCHECK(whoptr);
233  if (!PyArg_ParseTuple(args, "si", &code, &state))
234  return NULL;
235 
236  quest_code = cf_add_string(code);
237  cf_quest_start(whoptr->obj, quest_code, state);
238  cf_free_string(quest_code);
239 
240  Py_INCREF(Py_None);
241  return Py_None;
242 }
243 
244 static PyObject *Player_QuestGetState(Crossfire_Player *whoptr, PyObject *args) {
245  char *code;
246  int state;
247  sstring quest_code;
248 
249  EXISTCHECK(whoptr);
250  if (!PyArg_ParseTuple(args, "s", &code))
251  return NULL;
252 
253  quest_code = cf_add_string(code);
254  state = cf_quest_get_player_state(whoptr->obj, quest_code);
255  cf_free_string(quest_code);
256 
257  return Py_BuildValue("i", state);
258 }
259 
260 static PyObject *Player_QuestSetState(Crossfire_Player *whoptr, PyObject *args) {
261  char *code;
262  int state;
263  sstring quest_code;
264 
265  EXISTCHECK(whoptr);
266  if (!PyArg_ParseTuple(args, "si", &code, &state))
267  return NULL;
268 
269  quest_code = cf_add_string(code);
270  cf_quest_set_player_state(whoptr->obj, quest_code, state);
271  cf_free_string(quest_code);
272 
273  Py_INCREF(Py_None);
274  return Py_None;
275 }
276 
277 static PyObject *Player_QuestWasCompleted(Crossfire_Player *whoptr, PyObject *args) {
278  char *code;
279  int completed;
280  sstring quest_code;
281 
282  EXISTCHECK(whoptr);
283  if (!PyArg_ParseTuple(args, "s", &code))
284  return NULL;
285 
286  quest_code = cf_add_string(code);
287  completed = cf_quest_was_completed(whoptr->obj, quest_code);
288  cf_free_string(quest_code);
289 
290  return Py_BuildValue("i", completed);
291 }
292 
293 /* Object properties. Get and maybe set. */
294 static PyObject *Object_GetName(Crossfire_Object *whoptr, void *closure) {
295  char name[200];
296 
297  EXISTCHECK(whoptr);
298  return Py_BuildValue("s", cf_query_name(whoptr->obj, name, sizeof(name)));
299 }
300 
301 static PyObject *Object_GetNamePl(Crossfire_Object *whoptr, void *closure) {
302  EXISTCHECK(whoptr);
303  return Py_BuildValue("s", (char *)cf_query_name_pl(whoptr->obj));
304 }
305 
306 static PyObject *Object_GetTitle(Crossfire_Object *whoptr, void *closure) {
307  EXISTCHECK(whoptr);
308  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_TITLE));
309 }
310 
311 static PyObject *Object_GetRace(Crossfire_Object *whoptr, void *closure) {
312  EXISTCHECK(whoptr);
313  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_RACE));
314 }
315 
316 static PyObject *Object_GetMap(Crossfire_Object *whoptr, void *closure) {
317  mapstruct *m;
318 
319  EXISTCHECK(whoptr);
321  return Crossfire_Map_wrap(m);
322 }
323 
324 static PyObject *Object_GetCha(Crossfire_Object *whoptr, void *closure) {
325  EXISTCHECK(whoptr);
326  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_CHA));
327 }
328 
329 static PyObject *Object_GetCon(Crossfire_Object *whoptr, void *closure) {
330  EXISTCHECK(whoptr);
331  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_CON));
332 }
333 
334 static PyObject *Object_GetDex(Crossfire_Object *whoptr, void *closure) {
335  EXISTCHECK(whoptr);
336  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_DEX));
337 }
338 
339 static PyObject *Object_GetInt(Crossfire_Object *whoptr, void *closure) {
340  EXISTCHECK(whoptr);
341  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_INT));
342 }
343 
344 static PyObject *Object_GetPow(Crossfire_Object *whoptr, void *closure) {
345  EXISTCHECK(whoptr);
346  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_POW));
347 }
348 
349 static PyObject *Object_GetStr(Crossfire_Object *whoptr, void *closure) {
350  EXISTCHECK(whoptr);
351  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_STR));
352 }
353 
354 static PyObject *Object_GetWis(Crossfire_Object *whoptr, void *closure) {
355  EXISTCHECK(whoptr);
356  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_WIS));
357 }
358 
359 static PyObject *Object_GetHP(Crossfire_Object *whoptr, void *closure) {
360  EXISTCHECK(whoptr);
361  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_HP));
362 }
363 
364 static PyObject *Object_GetMaxHP(Crossfire_Object *whoptr, void *closure) {
365  EXISTCHECK(whoptr);
366  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_MAXHP));
367 }
368 
369 static PyObject *Object_GetSP(Crossfire_Object *whoptr, void *closure) {
370  EXISTCHECK(whoptr);
371  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_SP));
372 }
373 
374 static PyObject *Object_GetMaxSP(Crossfire_Object *whoptr, void *closure) {
375  EXISTCHECK(whoptr);
376  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_MAXSP));
377 }
378 
379 static PyObject *Object_GetGrace(Crossfire_Object *whoptr, void *closure) {
380  EXISTCHECK(whoptr);
381  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_GP));
382 }
383 
384 static PyObject *Object_GetMaxGrace(Crossfire_Object *whoptr, void *closure) {
385  EXISTCHECK(whoptr);
386  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_MAXGP));
387 }
388 
389 static PyObject *Object_GetFood(Crossfire_Object *whoptr, void *closure) {
390  EXISTCHECK(whoptr);
391  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_FP));
392 }
393 
394 static PyObject *Object_GetAC(Crossfire_Object *whoptr, void *closure) {
395  EXISTCHECK(whoptr);
396  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_AC));
397 }
398 
399 static PyObject *Object_GetWC(Crossfire_Object *whoptr, void *closure) {
400  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_WC));
401 }
402 
403 static PyObject *Object_GetDam(Crossfire_Object *whoptr, void *closure) {
404  EXISTCHECK(whoptr);
405  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_DAM));
406 }
407 
408 static PyObject *Object_GetLuck(Crossfire_Object *whoptr, void *closure) {
409  EXISTCHECK(whoptr);
410  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_LUCK));
411 }
412 
413 static PyObject *Object_GetMessage(Crossfire_Object *whoptr, void *closure) {
414  EXISTCHECK(whoptr);
415  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_MESSAGE));
416 }
417 
418 static PyObject *Object_GetSkill(Crossfire_Object *whoptr, void *closure) {
419  EXISTCHECK(whoptr);
420  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_SKILL));
421 }
422 
423 static PyObject *Object_GetExp(Crossfire_Object *whoptr, void *closure) {
424  EXISTCHECK(whoptr);
425  return Py_BuildValue("L", cf_object_get_int64_property(whoptr->obj, CFAPI_OBJECT_PROP_EXP));
426 }
427 
428 static PyObject *Object_GetPermExp(Crossfire_Object *whoptr, void *closure) {
429  EXISTCHECK(whoptr);
430  return Py_BuildValue("L", cf_object_get_int64_property(whoptr->obj, CFAPI_OBJECT_PROP_PERM_EXP));
431 }
432 
433 static PyObject *Object_GetExpMul(Crossfire_Object *whoptr, void *closure) {
434  EXISTCHECK(whoptr);
435  return Py_BuildValue("d", cf_object_get_double_property(whoptr->obj, CFAPI_OBJECT_PROP_EXP_MULTIPLIER));
436 }
437 
438 static PyObject *Object_GetSlaying(Crossfire_Object *whoptr, void *closure) {
439  EXISTCHECK(whoptr);
440  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_SLAYING));
441 }
442 
443 static PyObject *Object_GetCursed(Crossfire_Object *whoptr, void *closure) {
444  EXISTCHECK(whoptr);
445  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_CURSED));
446 }
447 
448 static PyObject *Object_GetDamned(Crossfire_Object *whoptr, void *closure) {
449  EXISTCHECK(whoptr);
450  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_DAMNED));
451 }
452 
453 static PyObject *Object_GetWeight(Crossfire_Object *whoptr, void *closure) {
454  EXISTCHECK(whoptr);
455  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_WEIGHT));
456 }
457 
458 static PyObject *Object_GetWeightLimit(Crossfire_Object *whoptr, void *closure) {
459  EXISTCHECK(whoptr);
460  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_WEIGHT_LIMIT));
461 }
462 
463 static PyObject *Object_GetAbove(Crossfire_Object *whoptr, void *closure) {
464  object *op;
465 
466  EXISTCHECK(whoptr);
468  return Crossfire_Object_wrap(op);
469 }
470 
471 static PyObject *Object_GetBelow(Crossfire_Object *whoptr, void *closure) {
472  object *op;
473 
474  EXISTCHECK(whoptr);
476  return Crossfire_Object_wrap(op);
477 }
478 
479 static PyObject *Object_GetInventory(Crossfire_Object *whoptr, void *closure) {
480  object *op;
481 
482  EXISTCHECK(whoptr);
484  return Crossfire_Object_wrap(op);
485 }
486 
487 static PyObject *Object_GetX(Crossfire_Object *whoptr, void *closure) {
488  EXISTCHECK(whoptr);
489  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_X));
490 }
491 
492 static PyObject *Object_GetY(Crossfire_Object *whoptr, void *closure) {
493  EXISTCHECK(whoptr);
494  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_Y));
495 }
496 
497 static PyObject *Object_GetDirection(Crossfire_Object *whoptr, void *closure) {
498  EXISTCHECK(whoptr);
499  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_DIRECTION));
500 }
501 
502 static PyObject *Object_GetFacing(Crossfire_Object *whoptr, void *closure) {
503  EXISTCHECK(whoptr);
504  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_FACING));
505 }
506 
507 static PyObject *Object_GetUnaggressive(Crossfire_Object *whoptr, void *closure) {
508  EXISTCHECK(whoptr);
509  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_UNAGGRESSIVE));
510 }
511 
512 static PyObject *Object_GetGod(Crossfire_Object *whoptr, void *closure) {
513  EXISTCHECK(whoptr);
514  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_GOD));
515 }
516 
517 static PyObject *Object_GetPickable(Crossfire_Object *whoptr, void *closure) {
518  EXISTCHECK(whoptr);
519  return Py_BuildValue("i", !cf_object_get_flag(whoptr->obj, FLAG_NO_PICK));
520 }
521 
522 static PyObject *Object_GetQuantity(Crossfire_Object *whoptr, void *closure) {
523  EXISTCHECK(whoptr);
524  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_NROF));
525 }
526 
527 static PyObject *Object_GetInvisible(Crossfire_Object *whoptr, void *closure) {
528  EXISTCHECK(whoptr);
529  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_INVISIBLE));
530 }
531 
532 static PyObject *Object_GetSpeed(Crossfire_Object *whoptr, void *closure) {
533  EXISTCHECK(whoptr);
534  return Py_BuildValue("f", cf_object_get_float_property(whoptr->obj, CFAPI_OBJECT_PROP_SPEED));
535 }
536 
537 static PyObject *Object_GetSpeedLeft(Crossfire_Object *whoptr, void *closure) {
538  EXISTCHECK(whoptr);
539  return Py_BuildValue("f", cf_object_get_float_property(whoptr->obj, CFAPI_OBJECT_PROP_SPEED_LEFT));
540 }
541 
542 static PyObject *Object_GetLastSP(Crossfire_Object *whoptr, void *closure) {
543  EXISTCHECK(whoptr);
544  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_LAST_SP));
545 }
546 
547 static PyObject *Object_GetLastGrace(Crossfire_Object *whoptr, void *closure) {
548  EXISTCHECK(whoptr);
549  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_LAST_GRACE));
550 }
551 
552 static PyObject *Object_GetLastEat(Crossfire_Object *whoptr, void *closure) {
553  EXISTCHECK(whoptr);
554  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_LAST_EAT));
555 }
556 
557 static PyObject *Object_GetLevel(Crossfire_Object *whoptr, void *closure) {
558  EXISTCHECK(whoptr);
559  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_LEVEL));
560 }
561 
562 static PyObject *Object_GetFace(Crossfire_Object *whoptr, void *closure) {
563  char buf[200];
564  EXISTCHECK(whoptr);
565  return Py_BuildValue("s", cf_object_get_string_property(whoptr->obj, CFAPI_OBJECT_PROP_FACE, buf, sizeof(buf)));
566 }
567 
568 static PyObject *Object_GetAnim(Crossfire_Object *whoptr, void *closure) {
569  char buf[200];
570  EXISTCHECK(whoptr);
571  return Py_BuildValue("s", cf_object_get_string_property(whoptr->obj, CFAPI_OBJECT_PROP_ANIMATION, buf, sizeof(buf)));
572 }
573 
574 static PyObject *Object_GetAnimSpeed(Crossfire_Object *whoptr, void *closure) {
575  EXISTCHECK(whoptr);
576  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_ANIM_SPEED));
577 }
578 
579 static PyObject *Object_GetAttackType(Crossfire_Object *whoptr, void *closure) {
580  EXISTCHECK(whoptr);
581  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_ATTACK_TYPE));
582 }
583 
584 static PyObject *Object_GetBeenApplied(Crossfire_Object *whoptr, void *closure) {
585  EXISTCHECK(whoptr);
586  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_BEEN_APPLIED));
587 }
588 
589 static PyObject *Object_GetIdentified(Crossfire_Object *whoptr, void *closure) {
590  EXISTCHECK(whoptr);
591  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_IDENTIFIED));
592 }
593 
594 static PyObject *Object_GetAlive(Crossfire_Object *whoptr, void *closure) {
595  EXISTCHECK(whoptr);
596  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_ALIVE));
597 }
598 
599 static PyObject *Object_GetDM(Crossfire_Object *whoptr, void *closure) {
600  EXISTCHECK(whoptr);
601  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_WIZ));
602 }
603 
604 static PyObject *Object_GetWasDM(Crossfire_Object *whoptr, void *closure) {
605  EXISTCHECK(whoptr);
606  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_WAS_WIZ));
607 }
608 
609 static PyObject *Object_GetApplied(Crossfire_Object *whoptr, void *closure) {
610  EXISTCHECK(whoptr);
611  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_APPLIED));
612 }
613 
614 static PyObject *Object_GetUnpaid(Crossfire_Object *whoptr, void *closure) {
615  EXISTCHECK(whoptr);
616  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_UNPAID));
617 }
618 
619 static PyObject *Object_GetMonster(Crossfire_Object *whoptr, void *closure) {
620  EXISTCHECK(whoptr);
621  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_MONSTER));
622 }
623 
624 static PyObject *Object_GetFriendly(Crossfire_Object *whoptr, void *closure) {
625  EXISTCHECK(whoptr);
626  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_FRIENDLY));
627 }
628 
629 static PyObject *Object_GetGenerator(Crossfire_Object *whoptr, void *closure) {
630  EXISTCHECK(whoptr);
631  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_GENERATOR));
632 }
633 
634 static PyObject *Object_GetThrown(Crossfire_Object *whoptr, void *closure) {
635  EXISTCHECK(whoptr);
636  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_IS_THROWN));
637 }
638 
639 static PyObject *Object_GetCanSeeInvisible(Crossfire_Object *whoptr, void *closure) {
640  EXISTCHECK(whoptr);
641  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_SEE_INVISIBLE));
642 }
643 
644 static PyObject *Object_GetRollable(Crossfire_Object *whoptr, void *closure) {
645  EXISTCHECK(whoptr);
646  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_CAN_ROLL));
647 }
648 
649 static PyObject *Object_GetTurnable(Crossfire_Object *whoptr, void *closure) {
650  EXISTCHECK(whoptr);
651  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_IS_TURNABLE));
652 }
653 
654 static PyObject *Object_GetUsedUp(Crossfire_Object *whoptr, void *closure) {
655  EXISTCHECK(whoptr);
656  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_IS_USED_UP));
657 }
658 
659 static PyObject *Object_GetSplitting(Crossfire_Object *whoptr, void *closure) {
660  EXISTCHECK(whoptr);
661  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_SPLITTING));
662 }
663 
664 static PyObject *Object_GetBlind(Crossfire_Object *whoptr, void *closure) {
665  EXISTCHECK(whoptr);
666  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_BLIND));
667 }
668 
669 static PyObject *Object_GetCanUseSkill(Crossfire_Object *whoptr, void *closure) {
670  EXISTCHECK(whoptr);
671  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_CAN_USE_SKILL));
672 }
673 
674 static PyObject *Object_GetKnownCursed(Crossfire_Object *whoptr, void *closure) {
675  EXISTCHECK(whoptr);
676  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_KNOWN_CURSED));
677 }
678 
679 static PyObject *Object_GetStealthy(Crossfire_Object *whoptr, void *closure) {
680  EXISTCHECK(whoptr);
681  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_STEALTH));
682 }
683 
684 static PyObject *Object_GetConfused(Crossfire_Object *whoptr, void *closure) {
685  EXISTCHECK(whoptr);
686  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_CONFUSED));
687 }
688 
689 static PyObject *Object_GetSleeping(Crossfire_Object *whoptr, void *closure) {
690  EXISTCHECK(whoptr);
691  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_SLEEP));
692 }
693 
694 static PyObject *Object_GetLifesaver(Crossfire_Object *whoptr, void *closure) {
695  EXISTCHECK(whoptr);
696  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_LIFESAVE));
697 }
698 
699 static PyObject *Object_GetFloor(Crossfire_Object *whoptr, void *closure) {
700  EXISTCHECK(whoptr);
701  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_IS_FLOOR));
702 }
703 
704 static PyObject *Object_GetHasXRays(Crossfire_Object *whoptr, void *closure) {
705  EXISTCHECK(whoptr);
706  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_XRAYS));
707 }
708 
709 static PyObject *Object_GetCanUseRing(Crossfire_Object *whoptr, void *closure) {
710  EXISTCHECK(whoptr);
711  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_USE_RING));
712 }
713 
714 static PyObject *Object_GetCanUseBow(Crossfire_Object *whoptr, void *closure) {
715  EXISTCHECK(whoptr);
716  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_USE_BOW));
717 }
718 
719 static PyObject *Object_GetCanUseWand(Crossfire_Object *whoptr, void *closure) {
720  EXISTCHECK(whoptr);
721  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_USE_RANGE));
722 }
723 
724 static PyObject *Object_GetCanSeeInDark(Crossfire_Object *whoptr, void *closure) {
725  EXISTCHECK(whoptr);
726  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_SEE_IN_DARK));
727 }
728 
729 static PyObject *Object_GetKnownMagical(Crossfire_Object *whoptr, void *closure) {
730  EXISTCHECK(whoptr);
731  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_KNOWN_MAGICAL));
732 }
733 
734 static PyObject *Object_GetCanUseWeapon(Crossfire_Object *whoptr, void *closure) {
735  EXISTCHECK(whoptr);
736  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_USE_WEAPON));
737 }
738 
739 static PyObject *Object_GetCanUseArmour(Crossfire_Object *whoptr, void *closure) {
740  EXISTCHECK(whoptr);
741  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_USE_ARMOUR));
742 }
743 
744 static PyObject *Object_GetCanUseScroll(Crossfire_Object *whoptr, void *closure) {
745  EXISTCHECK(whoptr);
746  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_USE_SCROLL));
747 }
748 
749 static PyObject *Object_GetCanCastSpell(Crossfire_Object *whoptr, void *closure) {
750  EXISTCHECK(whoptr);
751  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_CAST_SPELL));
752 }
753 
754 static PyObject *Object_GetReflectSpells(Crossfire_Object *whoptr, void *closure) {
755  EXISTCHECK(whoptr);
756  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_REFL_SPELL));
757 }
758 
759 static PyObject *Object_GetReflectMissiles(Crossfire_Object *whoptr, void *closure) {
760  EXISTCHECK(whoptr);
761  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_REFL_MISSILE));
762 }
763 
764 static PyObject *Object_GetUnique(Crossfire_Object *whoptr, void *closure) {
765  EXISTCHECK(whoptr);
766  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_UNIQUE));
767 }
768 
769 static PyObject *Object_GetRunAway(Crossfire_Object *whoptr, void *closure) {
770  EXISTCHECK(whoptr);
771  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_RUN_AWAY));
772 }
773 
774 static PyObject *Object_GetScared(Crossfire_Object *whoptr, void *closure) {
775  EXISTCHECK(whoptr);
776  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_SCARED));
777 }
778 
779 static PyObject *Object_GetUndead(Crossfire_Object *whoptr, void *closure) {
780  EXISTCHECK(whoptr);
781  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_UNDEAD));
782 }
783 
784 static PyObject *Object_GetBlocksView(Crossfire_Object *whoptr, void *closure) {
785  EXISTCHECK(whoptr);
786  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_BLOCKSVIEW));
787 }
788 
789 static PyObject *Object_GetHitBack(Crossfire_Object *whoptr, void *closure) {
790  EXISTCHECK(whoptr);
791  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_HITBACK));
792 }
793 
794 static PyObject *Object_GetStandStill(Crossfire_Object *whoptr, void *closure) {
795  EXISTCHECK(whoptr);
796  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_STAND_STILL));
797 }
798 
799 static PyObject *Object_GetOnlyAttack(Crossfire_Object *whoptr, void *closure) {
800  EXISTCHECK(whoptr);
801  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_ONLY_ATTACK));
802 }
803 
804 static PyObject *Object_GetMakeInvisible(Crossfire_Object *whoptr, void *closure) {
805  EXISTCHECK(whoptr);
806  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_MAKE_INVIS));
807 }
808 
809 static PyObject *Object_GetMoney(Crossfire_Object *whoptr, void *closure) {
810  EXISTCHECK(whoptr);
811  return Py_BuildValue("i", cf_object_query_money(whoptr->obj));
812 }
813 
814 static PyObject *Object_GetType(Crossfire_Object *whoptr, void *closure) {
815  EXISTCHECK(whoptr);
816  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_TYPE));
817 }
818 
819 static PyObject *Object_GetSubtype(Crossfire_Object *whoptr, void *closure) {
820  EXISTCHECK(whoptr);
821  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_SUBTYPE));
822 }
823 
824 static PyObject *Object_GetValue(Crossfire_Object *whoptr, void *closure) {
825  EXISTCHECK(whoptr);
826  return Py_BuildValue("l", cf_object_get_long_property(whoptr->obj, CFAPI_OBJECT_PROP_VALUE));
827 }
828 
829 static PyObject *Object_GetArchName(Crossfire_Object *whoptr, void *closure) {
830  EXISTCHECK(whoptr);
831  return Py_BuildValue("s", cf_object_get_sstring_property(whoptr->obj, CFAPI_OBJECT_PROP_ARCH_NAME));
832 }
833 
834 static PyObject *Object_GetArchetype(Crossfire_Object *whoptr, void *closure) {
835  EXISTCHECK(whoptr);
837 }
838 
839 static PyObject *Object_GetOtherArchetype(Crossfire_Object *whoptr, void *closure) {
840  EXISTCHECK(whoptr);
842 }
843 
844 static PyObject *Object_GetNoSave(Crossfire_Object *whoptr, void *closure) {
845  EXISTCHECK(whoptr);
846  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_NO_SAVE));
847 }
848 
849 static PyObject *Object_GetExists(Crossfire_Object *whoptr, void *closure) {
850  if (!object_was_destroyed(whoptr->obj, whoptr->obj->count)) {
851  Py_INCREF(Py_True);
852  return Py_True;
853  } else {
854  Py_INCREF(Py_False);
855  return Py_False;
856  }
857 }
858 
859 static PyObject *Object_GetEnv(Crossfire_Object *whoptr, void *closure) {
860  EXISTCHECK(whoptr);
862 }
863 
864 static PyObject *Object_GetMoveType(Crossfire_Object *whoptr, void *closure) {
865  EXISTCHECK(whoptr);
866  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_TYPE));
867 }
868 
869 static PyObject *Object_GetMoveBlock(Crossfire_Object *whoptr, void *closure) {
870  EXISTCHECK(whoptr);
871  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_BLOCK));
872 }
873 
874 static PyObject *Object_GetMoveAllow(Crossfire_Object *whoptr, void *closure) {
875  EXISTCHECK(whoptr);
876  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_ALLOW));
877 }
878 
879 static PyObject *Object_GetMoveOn(Crossfire_Object *whoptr, void *closure) {
880  EXISTCHECK(whoptr);
881  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_ON));
882 }
883 
884 static PyObject *Object_GetMoveOff(Crossfire_Object *whoptr, void *closure) {
885  EXISTCHECK(whoptr);
886  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_OFF));
887 }
888 
889 static PyObject *Object_GetMoveSlow(Crossfire_Object *whoptr, void *closure) {
890  EXISTCHECK(whoptr);
891  return Py_BuildValue("i", cf_object_get_movetype_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_SLOW));
892 }
893 
894 static PyObject *Object_GetMoveSlowPenalty(Crossfire_Object *whoptr, void *closure) {
895  EXISTCHECK(whoptr);
896  return Py_BuildValue("f", cf_object_get_float_property(whoptr->obj, CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY));
897 }
898 
899 static PyObject *Object_GetOwner(Crossfire_Object *whoptr, void *closure) {
900  EXISTCHECK(whoptr);
902 }
903 
904 static PyObject *Object_GetEnemy(Crossfire_Object *whoptr, void *closure) {
905  EXISTCHECK(whoptr);
907 }
908 
909 static PyObject *Object_GetCount(Crossfire_Object *whoptr, void *closure) {
910  EXISTCHECK(whoptr);
911  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_COUNT));
912 }
913 
914 static PyObject *Object_GetGodGiven(Crossfire_Object *whoptr, void *closure) {
915  EXISTCHECK(whoptr);
916  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_STARTEQUIP));
917 }
918 
919 static PyObject *Object_GetNoDamage(Crossfire_Object *whoptr, void *closure) {
920  EXISTCHECK(whoptr);
921  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_NO_DAMAGE));
922 }
923 
924 static PyObject *Object_GetRandomMovement(Crossfire_Object *whoptr, void *closure) {
925  EXISTCHECK(whoptr);
926  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_RANDOM_MOVE));
927 }
928 
929 static PyObject *Object_GetIsPet(Crossfire_Object *whoptr, void *closure) {
930  EXISTCHECK(whoptr);
931  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_FRIENDLY));
932 }
933 
934 static PyObject *Object_GetAttackMovement(Crossfire_Object *whoptr, void *closure) {
935  EXISTCHECK(whoptr);
936  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_ATTACK_MOVEMENT));
937 }
938 
939 static PyObject *Object_GetDuration(Crossfire_Object *whoptr, void *closure) {
940  EXISTCHECK(whoptr);
941  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_DURATION));
942 }
943 
944 static PyObject *Object_GetGlowRadius(Crossfire_Object *whoptr, void *closure) {
945  EXISTCHECK(whoptr);
946  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_GLOW_RADIUS));
947 }
948 
949 static PyObject *Object_GetAnimated(Crossfire_Object *whoptr, void *closure) {
950  EXISTCHECK(whoptr);
951  return Py_BuildValue("i", cf_object_get_flag(whoptr->obj, FLAG_ANIMATE));
952 }
953 static PyObject *Object_GetMaterial(Crossfire_Object *whoptr, void *closure) {
954  EXISTCHECK(whoptr);
955  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));
956 }
957 static PyObject *Object_GetContainer(Crossfire_Object *whoptr, void *closure) {
958  EXISTCHECK(whoptr);
960 }
962 static int Object_SetMessage(Crossfire_Object *whoptr, PyObject *value, void *closure) {
963  char *val;
964 
965  EXISTCHECK_INT(whoptr);
966  if (value == NULL) {
967  PyErr_SetString(PyExc_TypeError, "Cannot delete the Message attribute");
968  return -1;
969  }
970  if (!CF_IS_PYSTR(value)) {
971  PyErr_SetString(PyExc_TypeError, "The Message attribute must be a string");
972  return -1;
973  }
974  if (!PyArg_Parse(value, "s", &val))
975  return -1;
976 
978  return 0;
979 }
980 
981 static int Object_SetName(Crossfire_Object *whoptr, PyObject *value, void *closure) {
982  char *val;
983 
984  EXISTCHECK_INT(whoptr);
985  if (value == NULL) {
986  PyErr_SetString(PyExc_TypeError, "Cannot delete the Name attribute");
987  return -1;
988  }
989  if (!CF_IS_PYSTR(value)) {
990  PyErr_SetString(PyExc_TypeError, "The Name attribute must be a string");
991  return -1;
992  }
993  if (!PyArg_Parse(value, "s", &val))
994  return -1;
995 
998  return 0;
999 }
1000 
1001 static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1002  char *val;
1003 
1004  EXISTCHECK_INT(whoptr);
1005  if (value == NULL) {
1006  PyErr_SetString(PyExc_TypeError, "Cannot delete the NamePl attribute");
1007  return -1;
1008  }
1009  if (!CF_IS_PYSTR(value)) {
1010  PyErr_SetString(PyExc_TypeError, "The NamePl attribute must be a string");
1011  return -1;
1012  }
1013  if (!PyArg_Parse(value, "s", &val))
1014  return -1;
1015 
1017  return 0;
1018 }
1019 
1020 static int Object_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1021  char *val;
1022 
1023  EXISTCHECK_INT(whoptr);
1024  if (value == NULL) {
1025  PyErr_SetString(PyExc_TypeError, "Cannot delete the Title attribute");
1026  return -1;
1027  }
1028  if (!CF_IS_PYSTR(value)) {
1029  PyErr_SetString(PyExc_TypeError, "The Title attribute must be a string");
1030  return -1;
1031  }
1032  if (!PyArg_Parse(value, "s", &val))
1033  return -1;
1034 
1036  return 0;
1037 }
1038 
1039 static int Object_SetRace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1040  char *val;
1041 
1042  EXISTCHECK_INT(whoptr);
1043  if (value == NULL) {
1044  PyErr_SetString(PyExc_TypeError, "Cannot delete the Race attribute");
1045  return -1;
1046  }
1047  if (!CF_IS_PYSTR(value)) {
1048  PyErr_SetString(PyExc_TypeError, "The Race attribute must be a string");
1049  return -1;
1050  }
1051  if (!PyArg_Parse(value, "s", &val))
1052  return -1;
1053 
1055  return 0;
1056 }
1057 
1058 static int Object_SetMap(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1059  Crossfire_Map *val;
1060 
1061  EXISTCHECK_INT(whoptr);
1062  if (!PyArg_Parse(value, "O!", &Crossfire_MapType, &val))
1063  return -1;
1064 
1065  cf_object_change_map(whoptr->obj, val->map, NULL, 0, -1, -1);
1066  return 0;
1067 }
1068 
1069 static int Object_SetSlaying(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1070  char *val;
1071 
1072  EXISTCHECK_INT(whoptr);
1073  if (value == NULL) {
1074  PyErr_SetString(PyExc_TypeError, "Cannot delete the Slaying attribute");
1075  return -1;
1076  }
1077  if (!CF_IS_PYSTR(value)) {
1078  PyErr_SetString(PyExc_TypeError, "The Slaying attribute must be a string");
1079  return -1;
1080  }
1081  if (!PyArg_Parse(value, "s", &val))
1082  return -1;
1083 
1085  return 0;
1086 }
1087 
1088 static int Object_SetSkill(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1089  char *val;
1090 
1091  EXISTCHECK_INT(whoptr);
1092  if (value == NULL) {
1093  PyErr_SetString(PyExc_TypeError, "Cannot delete the Skill attribute");
1094  return -1;
1095  }
1096  if (!CF_IS_PYSTR(value)) {
1097  PyErr_SetString(PyExc_TypeError, "The Skill attribute must be a string");
1098  return -1;
1099  }
1100  if (!PyArg_Parse(value, "s", &val))
1101  return -1;
1102 
1104  return 0;
1105 }
1106 
1107 static int Object_SetCursed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1108  int val;
1109 
1110  EXISTCHECK_INT(whoptr);
1111  if (!PyArg_Parse(value, "i", &val))
1112  return -1;
1113 
1114  cf_object_set_flag(whoptr->obj, FLAG_CURSED, val);
1115  return 0;
1116 }
1117 
1118 static int Object_SetDamned(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1119  int val;
1120 
1121  EXISTCHECK_INT(whoptr);
1122  if (!PyArg_Parse(value, "i", &val))
1123  return -1;
1124 
1125  cf_object_set_flag(whoptr->obj, FLAG_DAMNED, val);
1126  return 0;
1127 }
1128 
1129 static int Object_SetApplied(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1130  int val;
1131 
1132  EXISTCHECK_INT(whoptr);
1133  if (!PyArg_Parse(value, "i", &val))
1134  return -1;
1135 
1136  cf_object_set_flag(whoptr->obj, FLAG_APPLIED, val);
1137  return 0;
1138 }
1139 
1140 static int Object_SetStr(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1141  int val;
1142 
1143  EXISTCHECK_INT(whoptr);
1144  if (!PyArg_Parse(value, "i", &val))
1145  return -1;
1146 
1148 /* cf_fix_object(whoptr->obj);*/
1149  return 0;
1150 }
1151 
1152 static int Object_SetDex(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1153  int val;
1154 
1155  EXISTCHECK_INT(whoptr);
1156  if (!PyArg_Parse(value, "i", &val))
1157  return -1;
1158 
1160  /*cf_fix_object(whoptr->obj);*/
1161  return 0;
1162 }
1163 
1164 static int Object_SetCon(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1165  int val;
1166 
1167  EXISTCHECK_INT(whoptr);
1168  if (!PyArg_Parse(value, "i", &val))
1169  return -1;
1170 
1172  /*cf_fix_object(whoptr->obj);*/
1173  return 0;
1174 }
1175 
1176 static int Object_SetInt(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1177  int val;
1178 
1179  EXISTCHECK_INT(whoptr);
1180  if (!PyArg_Parse(value, "i", &val))
1181  return -1;
1182 
1184  /*cf_fix_object(whoptr->obj);*/
1185  return 0;
1186 }
1187 
1188 static int Object_SetPow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1189  int val;
1190 
1191  EXISTCHECK_INT(whoptr);
1192  if (!PyArg_Parse(value, "i", &val))
1193  return -1;
1194 
1196  /*cf_fix_object(whoptr->obj);*/
1197  return 0;
1198 }
1199 
1200 static int Object_SetWis(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1201  int val;
1202 
1203  EXISTCHECK_INT(whoptr);
1204  if (!PyArg_Parse(value, "i", &val))
1205  return -1;
1206 
1208  /*cf_fix_object(whoptr->obj);*/
1209  return 0;
1210 }
1211 
1212 static int Object_SetCha(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1213  int val;
1214 
1215  EXISTCHECK_INT(whoptr);
1216  if (!PyArg_Parse(value, "i", &val))
1217  return -1;
1218 
1220  /*cf_fix_object(whoptr->obj);*/
1221  return 0;
1222 }
1223 
1224 static int Object_SetHP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1225  int val;
1226 
1227  EXISTCHECK_INT(whoptr);
1228  if (!PyArg_Parse(value, "i", &val))
1229  return -1;
1230 
1232  return 0;
1233 }
1234 
1235 static int Object_SetMaxHP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1236  int val;
1237 
1238  EXISTCHECK_INT(whoptr);
1239  if (!PyArg_Parse(value, "i", &val))
1240  return -1;
1241 
1243  return 0;
1244 }
1245 
1246 static int Object_SetSP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1247  int val;
1248 
1249  EXISTCHECK_INT(whoptr);
1250  if (!PyArg_Parse(value, "i", &val))
1251  return -1;
1252 
1254  return 0;
1255 }
1256 
1257 static int Object_SetMaxSP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1258  int val;
1259 
1260  EXISTCHECK_INT(whoptr);
1261  if (!PyArg_Parse(value, "i", &val))
1262  return -1;
1263 
1265  return 0;
1266 }
1267 
1268 static int Object_SetGrace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1269  int val;
1270 
1271  EXISTCHECK_INT(whoptr);
1272  if (!PyArg_Parse(value, "i", &val))
1273  return -1;
1274 
1276  return 0;
1277 }
1278 
1279 static int Object_SetMaxGrace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1280  int val;
1281 
1282  EXISTCHECK_INT(whoptr);
1283  if (!PyArg_Parse(value, "i", &val))
1284  return -1;
1285 
1287  return 0;
1288 }
1289 
1290 static int Object_SetAC(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1291  int val;
1292 
1293  EXISTCHECK_INT(whoptr);
1294  if (!PyArg_Parse(value, "i", &val))
1295  return -1;
1296 
1298  return 0;
1299 }
1300 
1301 static int Object_SetWC(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1302  int val;
1303 
1304  EXISTCHECK_INT(whoptr);
1305  if (!PyArg_Parse(value, "i", &val))
1306  return -1;
1307 
1309  return 0;
1310 }
1311 
1312 static int Object_SetDam(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1313  int val;
1314 
1315  EXISTCHECK_INT(whoptr);
1316  if (!PyArg_Parse(value, "i", &val))
1317  return -1;
1318 
1320  return 0;
1321 }
1322 
1323 static int Object_SetFood(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1324  int val;
1325 
1326  EXISTCHECK_INT(whoptr);
1327  if (!PyArg_Parse(value, "i", &val))
1328  return -1;
1329 
1331  return 0;
1332 }
1333 
1334 static int Object_SetWeight(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1335  int val;
1336 
1337  EXISTCHECK_INT(whoptr);
1338  if (!PyArg_Parse(value, "i", &val))
1339  return -1;
1340 
1342  return 0;
1343 }
1344 
1345 static int Object_SetWeightLimit(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1346  int val;
1347 
1348  EXISTCHECK_INT(whoptr);
1349  if (!PyArg_Parse(value, "i", &val))
1350  return -1;
1351 
1353  return 0;
1354 }
1355 
1356 static int Object_SetDirection(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1357  int val;
1358 
1359  EXISTCHECK_INT(whoptr);
1360  if (!PyArg_Parse(value, "i", &val))
1361  return -1;
1362 
1364  return 0;
1365 }
1366 
1367 static int Object_SetFacing(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1368  int val;
1369 
1370  EXISTCHECK_INT(whoptr);
1371  if (!PyArg_Parse(value, "i", &val))
1372  return -1;
1373 
1375  return 0;
1376 }
1377 
1378 static int Object_SetGod(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1379  char *val;
1380 
1381  EXISTCHECK_INT(whoptr);
1382  if (!PyArg_Parse(value, "s", &val))
1383  return -1;
1384 
1386  return 0;
1387 }
1388 
1389 static int Object_SetSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1390  float val;
1391 
1392  EXISTCHECK_INT(whoptr);
1393  if (!PyArg_Parse(value, "f", &val))
1394  return -1;
1395 
1397 /* cf_fix_object(whoptr->obj);*/
1398  return 0;
1399 }
1400 
1401 static int Object_SetSpeedLeft(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1402  float val;
1403 
1404  EXISTCHECK_INT(whoptr);
1405  if (!PyArg_Parse(value, "f", &val))
1406  return -1;
1407 
1409 /* cf_fix_object(whoptr->obj);*/
1410  return 0;
1411 }
1412 
1413 static int Object_SetQuantity(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1414  int val;
1415 
1416  EXISTCHECK_INT(whoptr);
1417  if (!PyArg_Parse(value, "i", &val))
1418  return -1;
1419 
1420  if (cf_object_set_nrof(whoptr->obj, val) != 0) {
1421  PyErr_SetString(PyExc_TypeError, "Invalid quantity");
1422  return -1;
1423  }
1424 
1425 /* cf_fix_object(whoptr->obj);*/
1426  return 0;
1427 }
1428 
1429 static int Object_SetLastSP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1430  int val;
1431 
1432  EXISTCHECK_INT(whoptr);
1433  if (!PyArg_Parse(value, "i", &val))
1434  return -1;
1435 
1437 /* cf_fix_object(whoptr->obj);*/
1438  return 0;
1439 }
1440 
1441 static int Object_SetLastGrace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1442  int val;
1443 
1444  EXISTCHECK_INT(whoptr);
1445  if (!PyArg_Parse(value, "i", &val))
1446  return -1;
1447 
1449 /* cf_fix_object(whoptr->obj);*/
1450  return 0;
1451 }
1452 
1453 static int Object_SetLastEat(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1454  int val;
1455 
1456  EXISTCHECK_INT(whoptr);
1457  if (!PyArg_Parse(value, "i", &val))
1458  return -1;
1459 
1461  return 0;
1462 }
1463 
1464 static int Object_SetLevel(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1465  int val;
1466 
1467  EXISTCHECK_INT(whoptr);
1468  if (!PyArg_Parse(value, "i", &val))
1469  return -1;
1470 
1472  return 0;
1473 }
1474 
1475 static int Object_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1476  char *face;
1477 
1478  EXISTCHECK_INT(whoptr);
1479  if (!PyArg_Parse(value, "s", &face))
1480  return -1;
1481 
1482  if (!cf_object_set_face(whoptr->obj, face)) {
1483  PyErr_SetString(PyExc_TypeError, "Unknown face.");
1484  return -1;
1485  }
1486  return 0;
1487 }
1488 
1489 static int Object_SetAnim(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1490  char *anim;
1491 
1492  EXISTCHECK_INT(whoptr);
1493  if (!PyArg_Parse(value, "s", &anim))
1494  return -1;
1495 
1496  if (!cf_object_set_animation(whoptr->obj, anim)) {
1497  PyErr_SetString(PyExc_TypeError, "Unknown animation.");
1498  return -1;
1499  }
1500 
1501  return 0;
1502 }
1503 
1504 static int Object_SetAnimSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1505  int val;
1506 
1507  EXISTCHECK_INT(whoptr);
1508  if (!PyArg_Parse(value, "i", &val))
1509  return -1;
1510 
1512  return 0;
1513 }
1514 
1515 static int Object_SetAttackType(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1516  int val;
1517 
1518  EXISTCHECK_INT(whoptr);
1519  if (!PyArg_Parse(value, "i", &val))
1520  return -1;
1521 
1523 /* cf_fix_object(whoptr->obj);*/
1524  return 0;
1525 }
1526 
1527 static int Object_SetIdentified(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1528  int val;
1529 
1530  EXISTCHECK_INT(whoptr);
1531  if (!PyArg_Parse(value, "i", &val))
1532  return -1;
1533 
1534  cf_object_set_flag(whoptr->obj, FLAG_IDENTIFIED, val);
1535  return 0;
1536 }
1537 
1538 static int Object_SetAlive(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1539  int val;
1540 
1541  EXISTCHECK_INT(whoptr);
1542  if (!PyArg_Parse(value, "i", &val))
1543  return -1;
1544 
1545  cf_object_set_flag(whoptr->obj, FLAG_ALIVE, val);
1546  return 0;
1547 }
1548 
1549 static int Object_SetUnaggressive(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1550  int val;
1551 
1552  EXISTCHECK_INT(whoptr);
1553  if (!PyArg_Parse(value, "i", &val))
1554  return -1;
1555 
1556  cf_object_set_flag(whoptr->obj, FLAG_UNAGGRESSIVE, val);
1557  return 0;
1558 }
1559 
1560 static int Object_SetPickable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1561  int val;
1562 
1563  EXISTCHECK_INT(whoptr);
1564  if (!PyArg_Parse(value, "i", &val))
1565  return -1;
1566 
1567  cf_object_set_flag(whoptr->obj, FLAG_NO_PICK, !val);
1568  return 0;
1569 }
1570 
1571 static int Object_SetInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1572  int val;
1573 
1574  EXISTCHECK_INT(whoptr);
1575  if (!PyArg_ParseTuple(value, "i", &val))
1576  return -1;
1577 
1579  return 0;
1580 }
1581 
1582 static int Object_SetUnpaid(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1583  int val;
1584 
1585  EXISTCHECK_INT(whoptr);
1586  if (!PyArg_Parse(value, "i", &val))
1587  return -1;
1588 
1589  cf_object_set_flag(whoptr->obj, FLAG_UNPAID, val);
1590  return 0;
1591 }
1592 
1593 static int Object_SetFriendly(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1594  int val;
1595 
1596  EXISTCHECK_INT(whoptr);
1597  if (!PyArg_Parse(value, "i", &val))
1598  return -1;
1599 
1600  cf_object_set_flag(whoptr->obj, FLAG_FRIENDLY, val);
1601  return 0;
1602 }
1603 
1604 static int Object_SetCanSeeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1605  int val;
1606 
1607  EXISTCHECK_INT(whoptr);
1608  if (!PyArg_Parse(value, "i", &val))
1609  return -1;
1610 
1611  cf_object_set_flag(whoptr->obj, FLAG_SEE_INVISIBLE, val);
1612  return 0;
1613 }
1614 
1615 static int Object_SetRollable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1616  int val;
1617 
1618  EXISTCHECK_INT(whoptr);
1619  if (!PyArg_Parse(value, "i", &val))
1620  return -1;
1621 
1622  cf_object_set_flag(whoptr->obj, FLAG_CAN_ROLL, val);
1623  return 0;
1624 }
1625 
1626 static int Object_SetTurnable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1627  int val;
1628 
1629  EXISTCHECK_INT(whoptr);
1630  if (!PyArg_Parse(value, "i", &val))
1631  return -1;
1632 
1633  cf_object_set_flag(whoptr->obj, FLAG_IS_TURNABLE, val);
1634  return 0;
1635 }
1636 
1637 static int Object_SetUsedUp(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1638  int val;
1639 
1640  EXISTCHECK_INT(whoptr);
1641  if (!PyArg_Parse(value, "i", &val))
1642  return -1;
1643 
1644  cf_object_set_flag(whoptr->obj, FLAG_IS_USED_UP, val);
1645  return 0;
1646 }
1647 
1648 static int Object_SetBlind(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1649  int val;
1650 
1651  EXISTCHECK_INT(whoptr);
1652  if (!PyArg_Parse(value, "i", &val))
1653  return -1;
1654 
1655  cf_object_set_flag(whoptr->obj, FLAG_BLIND, val);
1656  return 0;
1657 }
1658 
1659 static int Object_SetKnownCursed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1660  int val;
1661 
1662  EXISTCHECK_INT(whoptr);
1663  if (!PyArg_Parse(value, "i", &val))
1664  return -1;
1665 
1666  cf_object_set_flag(whoptr->obj, FLAG_KNOWN_CURSED, val);
1667  return 0;
1668 }
1669 
1670 static int Object_SetStealthy(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1671  int val;
1672 
1673  EXISTCHECK_INT(whoptr);
1674  if (!PyArg_Parse(value, "i", &val))
1675  return -1;
1676 
1677  cf_object_set_flag(whoptr->obj, FLAG_STEALTH, val);
1678  return 0;
1679 }
1680 
1681 static int Object_SetConfused(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1682  int val;
1683 
1684  EXISTCHECK_INT(whoptr);
1685  if (!PyArg_Parse(value, "i", &val))
1686  return -1;
1687 
1688  cf_object_set_flag(whoptr->obj, FLAG_CONFUSED, val);
1689  return 0;
1690 }
1691 
1692 static int Object_SetSleeping(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1693  int val;
1694 
1695  EXISTCHECK_INT(whoptr);
1696  if (!PyArg_Parse(value, "i", &val))
1697  return -1;
1698 
1699  cf_object_set_flag(whoptr->obj, FLAG_SLEEP, val);
1700  return 0;
1701 }
1702 
1703 static int Object_SetLifesaver(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1704  int val;
1705 
1706  EXISTCHECK_INT(whoptr);
1707  if (!PyArg_Parse(value, "i", &val))
1708  return -1;
1709 
1710  cf_object_set_flag(whoptr->obj, FLAG_LIFESAVE, val);
1711  return 0;
1712 }
1713 
1714 static int Object_SetHasXRays(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1715  int val;
1716 
1717  EXISTCHECK_INT(whoptr);
1718  if (!PyArg_Parse(value, "i", &val))
1719  return -1;
1720 
1721  cf_object_set_flag(whoptr->obj, FLAG_XRAYS, val);
1722  return 0;
1723 }
1724 
1725 static int Object_SetCanSeeInDark(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1726  int val;
1727 
1728  EXISTCHECK_INT(whoptr);
1729  if (!PyArg_Parse(value, "i", &val))
1730  return -1;
1731 
1732  cf_object_set_flag(whoptr->obj, FLAG_SEE_IN_DARK, val);
1733  return 0;
1734 }
1735 
1736 static int Object_SetKnownMagical(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1737  int val;
1738 
1739  EXISTCHECK_INT(whoptr);
1740  if (!PyArg_Parse(value, "i", &val))
1741  return -1;
1742 
1743  cf_object_set_flag(whoptr->obj, FLAG_KNOWN_MAGICAL, val);
1744  return 0;
1745 }
1746 
1747 static int Object_SetReflectSpells(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1748  int val;
1749 
1750  EXISTCHECK_INT(whoptr);
1751  if (!PyArg_Parse(value, "i", &val))
1752  return -1;
1753 
1754  cf_object_set_flag(whoptr->obj, FLAG_REFL_SPELL, val);
1755  return 0;
1756 }
1757 
1758 static int Object_SetReflectMissiles(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1759  int val;
1760 
1761  EXISTCHECK_INT(whoptr);
1762  if (!PyArg_Parse(value, "i", &val))
1763  return -1;
1764 
1765  cf_object_set_flag(whoptr->obj, FLAG_REFL_MISSILE, val);
1766  return 0;
1767 }
1768 
1769 static int Object_SetUnique(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1770  int val;
1771 
1772  EXISTCHECK_INT(whoptr);
1773  if (!PyArg_Parse(value, "i", &val))
1774  return -1;
1775 
1776  cf_object_set_flag(whoptr->obj, FLAG_UNIQUE, val);
1777  return 0;
1778 }
1779 
1780 static int Object_SetRunAway(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1781  int val;
1782 
1783  EXISTCHECK_INT(whoptr);
1784  if (!PyArg_Parse(value, "i", &val))
1785  return -1;
1786 
1787  cf_object_set_flag(whoptr->obj, FLAG_RUN_AWAY, val);
1788  return 0;
1789 }
1790 
1791 static int Object_SetScared(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1792  int val;
1793 
1794  EXISTCHECK_INT(whoptr);
1795  if (!PyArg_Parse(value, "i", &val))
1796  return -1;
1797 
1798  cf_object_set_flag(whoptr->obj, FLAG_SCARED, val);
1799  return 0;
1800 }
1801 
1802 static int Object_SetUndead(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1803  int val;
1804 
1805  EXISTCHECK_INT(whoptr);
1806  if (!PyArg_Parse(value, "i", &val))
1807  return -1;
1808 
1809  cf_object_set_flag(whoptr->obj, FLAG_UNDEAD, val);
1810  return 0;
1811 }
1812 
1813 static int Object_SetBlocksView(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1814  int val;
1815 
1816  EXISTCHECK_INT(whoptr);
1817  if (!PyArg_Parse(value, "i", &val))
1818  return -1;
1819 
1820  cf_object_set_flag(whoptr->obj, FLAG_BLOCKSVIEW, val);
1821  return 0;
1822 }
1823 
1824 static int Object_SetHitBack(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1825  int val;
1826 
1827  EXISTCHECK_INT(whoptr);
1828  if (!PyArg_Parse(value, "i", &val))
1829  return -1;
1830 
1831  cf_object_set_flag(whoptr->obj, FLAG_HITBACK, val);
1832  return 0;
1833 }
1834 
1835 static int Object_SetStandStill(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1836  int val;
1837 
1838  EXISTCHECK_INT(whoptr);
1839  if (!PyArg_Parse(value, "i", &val))
1840  return -1;
1841 
1842  cf_object_set_flag(whoptr->obj, FLAG_STAND_STILL, val);
1843  return 0;
1844 }
1845 
1846 static int Object_SetOnlyAttack(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1847  int val;
1848 
1849  EXISTCHECK_INT(whoptr);
1850  if (!PyArg_Parse(value, "i", &val))
1851  return -1;
1852 
1853  cf_object_set_flag(whoptr->obj, FLAG_ONLY_ATTACK, val);
1854  return 0;
1855 }
1856 
1857 static int Object_SetMakeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1858  int val;
1859 
1860  EXISTCHECK_INT(whoptr);
1861  if (!PyArg_Parse(value, "i", &val))
1862  return -1;
1863 
1864  cf_object_set_flag(whoptr->obj, FLAG_MAKE_INVIS, val);
1865  return 0;
1866 }
1867 
1868 static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1869  long val;
1870 
1871  EXISTCHECK_INT(whoptr);
1872  if (!PyArg_Parse(value, "l", &val))
1873  return -1;
1874 
1876  return 0;
1877 }
1878 
1879 static int Object_SetNoSave(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1880  long val;
1881 
1882  EXISTCHECK_INT(whoptr);
1883  if (!PyArg_Parse(value, "i", &val))
1884  return -1;
1885 
1886  cf_object_set_flag(whoptr->obj, FLAG_NO_SAVE, val);
1887  return 0;
1888 }
1889 
1890 static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1891  Crossfire_Object *ob;
1892 
1893  EXISTCHECK_INT(whoptr);
1894  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
1895  return -1;
1897  return 0;
1898 }
1899 
1900 static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1901  Crossfire_Object *ob;
1902 
1903  EXISTCHECK_INT(whoptr);
1904  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
1905  return -1;
1907  return 0;
1908 }
1909 
1910 static int Object_SetGodGiven(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1911  int val;
1912 
1913  EXISTCHECK_INT(whoptr);
1914  if (!PyArg_Parse(value, "i", &val))
1915  return -1;
1916 
1917  cf_object_set_flag(whoptr->obj, FLAG_STARTEQUIP, val);
1918  return 0;
1919 }
1920 
1921 static int Object_SetNoDamage(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1922  int val;
1923 
1924  EXISTCHECK_INT(whoptr);
1925  if (!PyArg_Parse(value, "i", &val))
1926  return -1;
1927 
1928  cf_object_set_flag(whoptr->obj, FLAG_NO_DAMAGE, val);
1929  return 0;
1930 }
1931 
1932 static int Object_SetRandomMovement(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1933  int val;
1934 
1935  EXISTCHECK_INT(whoptr);
1936  if (!PyArg_Parse(value, "i", &val))
1937  return -1;
1938 
1939  cf_object_set_flag(whoptr->obj, FLAG_RANDOM_MOVE, val);
1940  return 0;
1941 }
1942 
1943 static int Object_SetIsPet(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1944  int val;
1945 
1946  EXISTCHECK_INT(whoptr);
1947  if (!PyArg_Parse(value, "i", &val))
1948  return -1;
1949 
1951  return 0;
1952 }
1953 
1954 static int Object_SetAttackMovement(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1955  int val;
1956 
1957  EXISTCHECK_INT(whoptr);
1958  if (!PyArg_Parse(value, "i", &val))
1959  return -1;
1960 
1962  return 0;
1963 }
1964 
1965 static int Object_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1966  int64_t val;
1967 
1968  EXISTCHECK_INT(whoptr);
1969  if (!PyArg_Parse(value, "L", &val))
1970  return -1;
1971 
1973  return 0;
1974 }
1975 
1976 static int Object_SetDuration(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1977  int val;
1978 
1979  EXISTCHECK_INT(whoptr);
1980  if (!PyArg_Parse(value, "i", &val))
1981  return -1;
1982 
1984  return 0;
1985 }
1986 
1987 static int Object_SetGlowRadius(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1988  int val;
1989 
1990  EXISTCHECK_INT(whoptr);
1991  if (!PyArg_Parse(value, "i", &val))
1992  return -1;
1993 
1995  return 0;
1996 }
1997 
1998 static int Object_SetAnimated(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1999  int val;
2000 
2001  EXISTCHECK_INT(whoptr);
2002  if (!PyArg_Parse(value, "i", &val))
2003  return -1;
2004  cf_object_set_flag(whoptr->obj, FLAG_ANIMATE, val);
2005  return 0;
2006 }
2007 
2008 static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2009  MoveType move;
2010 
2011  EXISTCHECK_INT(whoptr);
2012  if (!PyArg_Parse(value, "B", &move))
2013  return -1;
2015  return 0;
2016 }
2017 
2018 static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2019  MoveType move;
2020 
2021  EXISTCHECK_INT(whoptr);
2022  if (!PyArg_Parse(value, "B", &move))
2023  return -1;
2025  return 0;
2026 }
2027 
2028 static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2029  MoveType move;
2030 
2031  EXISTCHECK_INT(whoptr);
2032  if (!PyArg_Parse(value, "B", &move))
2033  return -1;
2035  return 0;
2036 }
2037 
2038 static int Object_SetMoveOn(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2039  MoveType move;
2040 
2041  EXISTCHECK_INT(whoptr);
2042  if (!PyArg_Parse(value, "B", &move))
2043  return -1;
2045  return 0;
2046 }
2047 
2048 static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2049  MoveType move;
2050 
2051  EXISTCHECK_INT(whoptr);
2052  if (!PyArg_Parse(value, "B", &move))
2053  return -1;
2055  return 0;
2056 }
2057 
2058 static int Object_SetMoveSlow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2059  MoveType move;
2060 
2061  EXISTCHECK_INT(whoptr);
2062  if (!PyArg_Parse(value, "B", &move))
2063  return -1;
2065  return 0;
2066 }
2067 
2068 
2069 /* Methods. */
2070 
2071 static PyObject *Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args) {
2072  EXISTCHECK(who);
2073 
2074  if ((current_context->who != NULL) && (((Crossfire_Object *)current_context->who)->obj == who->obj))
2075  current_context->who = NULL;
2076 
2077  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
2078  cf_object_remove(who->obj);
2079  }
2080 
2082  Py_INCREF(Py_None);
2083  return Py_None;
2084 }
2085 
2086 static PyObject *Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args) {
2087  Crossfire_Object *whoptr;
2088  int flags;
2089 
2090  if (!PyArg_ParseTuple(args, "O!i", &Crossfire_ObjectType, &whoptr, &flags))
2091  return NULL;
2092  EXISTCHECK(who);
2093  EXISTCHECK(whoptr);
2094 
2095  return Py_BuildValue("i", cf_object_apply(whoptr->obj, who->obj, flags));
2096 }
2097 
2098 static PyObject *Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args) {
2099  /* Note that this function uses the METH_O calling convention. */
2100  Crossfire_Object *whoptr = (Crossfire_Object*)args;
2101 
2102  EXISTCHECK(who);
2103  TYPEEXISTCHECK(whoptr);
2104 
2105  cf_object_drop(whoptr->obj, who->obj);
2106  Py_INCREF(Py_None);
2107  return Py_None;
2108 }
2109 
2110 static PyObject *Crossfire_Object_Clone(Crossfire_Object *who, PyObject *args) {
2111  int clone_type;
2112  object *clone;
2113 
2114  if (!PyArg_ParseTuple(args, "i", &clone_type))
2115  return NULL;
2116 
2117  if (clone_type != 0 && clone_type != 1)
2118  {
2119  PyErr_SetString(PyExc_ValueError, "Clone type must be 0 (object_create_clone) or 1 (object_copy).");
2120  return NULL;
2121  }
2122 
2123  clone = cf_object_clone(who->obj, clone_type);
2124 
2125  if (clone == NULL)
2126  {
2127  PyErr_SetString(PyExc_RuntimeError, "Clone failed.");
2128  return NULL;
2129  }
2130 
2131  return Crossfire_Object_wrap(clone);
2132 }
2133 
2134 static PyObject *Crossfire_Object_Split(Crossfire_Object *who, PyObject *args) {
2135  int count;
2136  char err[255];
2137  object *split;
2138 
2139  err[0] = '\0'; /* Just in case. */
2140 
2141  if (!PyArg_ParseTuple(args, "i", &count))
2142  return NULL;
2143 
2144  split = cf_object_split(who->obj, count, err, 255);
2145 
2146  if (split == NULL)
2147  {
2148  PyErr_SetString(PyExc_ValueError, err);
2149  return NULL;
2150  }
2151 
2152  return Crossfire_Object_wrap(split);
2153 }
2154 
2155 static PyObject *Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args) {
2156  cf_fix_object(who->obj);
2157  Py_INCREF(Py_None);
2158  return Py_None;
2159 }
2160 
2161 static PyObject *Crossfire_Object_Take(Crossfire_Object *who, PyObject *args) {
2162  /* Note that this function uses the METH_O calling convention. */
2163  Crossfire_Object *whoptr = (Crossfire_Object*)args;
2164 
2165  EXISTCHECK(who);
2166  TYPEEXISTCHECK(whoptr);
2167 
2168  cf_object_pickup(who->obj, whoptr->obj);
2169  Py_INCREF(Py_None);
2170  return Py_None;
2171 }
2172 
2173 static PyObject *Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args) {
2174  Crossfire_Map *where;
2175  int x, y;
2176  int val;
2177 
2178  EXISTCHECK(who);
2179  if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_MapType, &where, &x, &y))
2180  return NULL;
2181 
2182  val = cf_object_teleport(who->obj, where->map, x, y);
2183 
2184  return Py_BuildValue("i", val);
2185 }
2186 
2187 static PyObject *Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args) {
2188  /* Note that this function uses the METH_O calling convention. */
2189  object *trap;
2190  object *victim;
2191  Crossfire_Object *pcause = (Crossfire_Object*)args;
2192 
2193  EXISTCHECK(who);
2194  TYPEEXISTCHECK(pcause);
2195  trap = who->obj;
2196  victim = pcause->obj;
2197  cf_spring_trap(trap, victim);
2198  Py_INCREF(Py_None);
2199  return Py_None;
2200 }
2201 
2202 static PyObject *Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args) {
2203  /* Note that this function uses the METH_O calling convention. */
2204  object *trigger;
2205  object *cause;
2206  int result;
2207  Crossfire_Object *pcause = (Crossfire_Object*)args;
2208 
2209  EXISTCHECK(who);
2210  TYPEEXISTCHECK(pcause);
2211  trigger = who->obj;
2212  cause = pcause->obj;
2213  result = cf_object_check_trigger(trigger, cause);
2214 
2215  return Py_BuildValue("i", result);
2216 }
2217 
2218 static PyObject *Crossfire_Object_Say(Crossfire_Object *who, PyObject *args) {
2219  char *message, buf[2048];
2220 
2221  EXISTCHECK(who);
2222  if (!PyArg_ParseTuple(args, "s", &message))
2223  return NULL;
2224 
2225  /* compatibility */
2226  if (current_context->talk == NULL) {
2227  cf_object_say(who->obj, message);
2228  Py_INCREF(Py_None);
2229  return Py_None;
2230  }
2231 
2233  PyErr_SetString(PyExc_ValueError, "too many NPCs");
2234  return NULL;
2235  }
2236 
2237  if (strlen(message) >= sizeof(buf) - 1)
2238  cf_log(llevError, "warning, too long message in npcSay, will be truncated");
2240  snprintf(buf, sizeof(buf), "%s says: %s", who->obj->name, message);
2241 
2244 
2245  Py_INCREF(Py_None);
2246  return Py_None;
2247 
2248 }
2249 
2250 static PyObject *Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args) {
2251  int x, y;
2252 
2253  EXISTCHECK(who);
2254  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2255  return NULL;
2256 
2257  cf_object_transfer(who->obj, x, y, 0, NULL);
2258  Py_INCREF(Py_None);
2259  return Py_None;
2260 }
2261 
2262 static PyObject *Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args) {
2263  char name[200];
2264 
2265  EXISTCHECK(who);
2266  return Py_BuildValue("s", cf_query_name(who->obj, name, sizeof(name)));
2267 }
2268 
2269 static PyObject *Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args) {
2270  int resist;
2271 
2272  EXISTCHECK(who);
2273  if (!PyArg_ParseTuple(args, "i", &resist))
2274  return NULL;
2275  if ((resist < 0) || (resist >= NROFATTACKS)) {
2276  return Py_BuildValue("l", 0);
2277  }
2278  return Py_BuildValue("i", cf_object_get_resistance(who->obj, resist));
2279 }
2280 
2281 static PyObject *Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args) {
2282  int resist, value;
2283 
2284  EXISTCHECK(who);
2285  if (!PyArg_ParseTuple(args, "ii", &resist, &value))
2286  return NULL;
2287  if ((resist >= 0) && (resist < NROFATTACKS))
2288  cf_object_set_resistance(who->obj, resist, value);
2289  Py_INCREF(Py_None);
2290  return Py_None;
2291 }
2292 
2293 static PyObject *Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args) {
2294  int dir;
2295  char *op;
2296  Crossfire_Object *pspell;
2297 
2298  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &op))
2299  return NULL;
2300  EXISTCHECK(who);
2301  EXISTCHECK(pspell);
2302 
2303  cf_object_cast_spell(who->obj, who->obj, dir, pspell->obj, op);
2304 
2305  Py_INCREF(Py_None);
2306  return Py_None;
2307 }
2308 
2309 static PyObject *Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args) {
2310  /* Note that this function uses the METH_O calling convention. */
2311  Crossfire_Object *pspell = (Crossfire_Object*)args;
2312 
2313  EXISTCHECK(who);
2314  TYPEEXISTCHECK(pspell);
2315 
2316  cf_object_learn_spell(who->obj, pspell->obj, 0);
2317 
2318  Py_INCREF(Py_None);
2319  return Py_None;
2320 }
2321 
2322 static PyObject *Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args) {
2323  /* Note that this function uses the METH_O calling convention. */
2324  Crossfire_Object *pspell = (Crossfire_Object*)args;
2325 
2326  EXISTCHECK(who);
2327  TYPEEXISTCHECK(pspell);
2328 
2329  cf_object_forget_spell(who->obj, pspell->obj);
2330  Py_INCREF(Py_None);
2331  return Py_None;
2332 }
2333 
2334 static PyObject *Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args) {
2335  char *spellname;
2336  object *op;
2337 
2338  EXISTCHECK(who);
2339  if (!PyArg_ParseTuple(args, "s", &spellname))
2340  return NULL;
2341 
2342  op = cf_object_check_for_spell(who->obj, spellname);
2343 
2344  return Crossfire_Object_wrap(op);
2345 }
2346 
2347 static PyObject *Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args) {
2348  Crossfire_Object *pspell;
2349  int dir;
2350  char *str;
2351 
2352  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &str))
2353  return NULL;
2354  EXISTCHECK(who);
2355  EXISTCHECK(pspell);
2356 
2357  cf_object_cast_ability(who->obj, who->obj, dir, pspell->obj, str);
2358 
2359  Py_INCREF(Py_None);
2360  return Py_None;
2361 }
2362 
2363 static PyObject *Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args) {
2364  uint64_t to_pay;
2365  int val;
2366 
2367  EXISTCHECK(who);
2368  if (!PyArg_ParseTuple(args, "L", &to_pay))
2369  return NULL;
2370 
2371  val = cf_object_pay_amount(who->obj, to_pay);
2372 
2373  return Py_BuildValue("i", val);
2374 }
2375 
2376 static PyObject *Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args) {
2377  /* Note that this function uses the METH_O calling convention. */
2378  Crossfire_Object *op = (Crossfire_Object*)args;
2379  int val;
2380 
2381  EXISTCHECK(who);
2382  TYPEEXISTCHECK(op);
2383 
2384  val = cf_object_pay_item(who->obj, op->obj);
2385 
2386  return Py_BuildValue("i", val);
2387 }
2388 
2389 static PyObject *Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args) {
2390  const char *val;
2391  char *keyname;
2392 
2393  EXISTCHECK(who);
2394  if (!PyArg_ParseTuple(args, "s", &keyname))
2395  return NULL;
2396 
2397  val = cf_object_get_key(who->obj, keyname);
2398 
2399  return Py_BuildValue("s", val ? val : "");
2400 }
2401 
2402 static PyObject *Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args) {
2403  char *keyname;
2404  char *value;
2405  int add_key = 0;
2406 
2407  EXISTCHECK(who);
2408  if (!PyArg_ParseTuple(args, "ss|i", &keyname, &value, &add_key))
2409  return NULL;
2410 
2411  return Py_BuildValue("i", cf_object_set_key(who->obj, keyname, value, add_key));
2412 }
2413 
2414 static PyObject *Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args) {
2415  int mode;
2416  long delay;
2417 
2418  EXISTCHECK(who);
2419  if (!PyArg_ParseTuple(args, "li", &delay, &mode))
2420  return NULL;
2421 
2422  return Py_BuildValue("i", cf_timer_create(who->obj, delay, mode));
2423 }
2424 
2425 static PyObject *Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args) {
2426  char *whatstr;
2427  object *foundob;
2428 
2429  EXISTCHECK(who);
2430  if (!PyArg_ParseTuple(args, "s", &whatstr))
2431  return NULL;
2432 
2433  foundob = cf_object_present_archname_inside(who->obj, whatstr);
2434 
2435  return Crossfire_Object_wrap(foundob);
2436 /* FOR_INV_PREPARE(WHO, tmp) {
2437  if (!strncmp(PyQueryName(tmp), whatstr, strlen(whatstr))) {
2438  return Py_BuildValue("l", (long)(tmp));
2439  }
2440  if (!strncmp(tmp->name, whatstr, strlen(whatstr))) {
2441  return Py_BuildValue("l", (long)(tmp));
2442  }
2443  } FOR_INV_FINISH();
2444 
2445  return Py_BuildValue("l", (long)0);*/
2446 }
2447 
2448 static PyObject *Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args) {
2449  char *whatstr;
2450  object *tmp;
2451 
2452  EXISTCHECK(who);
2453  if (!PyArg_ParseTuple(args, "s", &whatstr))
2454  return NULL;
2455 
2456  tmp = cf_object_find_by_arch_name(who->obj, whatstr);
2457  return Crossfire_Object_wrap(tmp);
2458 }
2459 
2460 static PyObject *Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args) {
2461  int x, y;
2462 
2463  EXISTCHECK(who);
2464  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2465  return NULL;
2466 
2467  return Py_BuildValue("i", cf_object_out_of_map(who->obj, x, y));
2468 }
2469 
2470 static PyObject *Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args) {
2471  char *txt;
2472  object *myob;
2473 
2474  EXISTCHECK(who);
2475  if (!PyArg_ParseTuple(args, "s", &txt))
2476  return NULL;
2477 
2478  myob = cf_create_object_by_name(txt);
2479  if (myob)
2480  myob = cf_object_insert_object(myob, who->obj);
2481 
2482  return Crossfire_Object_wrap(myob);
2483 }
2484 
2485 static PyObject *Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args) {
2486  /* Note that this function uses the METH_O calling convention. */
2487  Crossfire_Object *op = (Crossfire_Object*)args;
2488  object *myob;
2489 
2490  EXISTCHECK(who);
2491  TYPEEXISTCHECK(op);
2492 
2493  /* we can only insert removed object, so first remove it
2494  * from it's current container
2495  */
2496  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
2497  cf_object_remove(who->obj);
2498  }
2499  myob = cf_object_insert_in_ob(who->obj, op->obj);
2500 
2501  return Crossfire_Object_wrap(myob);
2502 }
2503 
2504 static PyObject *Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args) {
2505  /* Note that this function uses the METH_O calling convention. */
2506  Crossfire_Object *op = (Crossfire_Object*)args;
2507 
2508  EXISTCHECK(who);
2509  TYPEEXISTCHECK(op);
2510 
2511  return Py_BuildValue("i", cf_object_change_abil(who->obj, op->obj));
2512 }
2513 
2514 static PyObject *Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args) {
2515  int64_t exp;
2516  const char *skill = NULL;
2517  int arg = 0;
2518 
2519  if (!PyArg_ParseTuple(args, "L|si", &exp, &skill, &arg))
2520  return NULL;
2521  EXISTCHECK(who);
2522  cf_object_change_exp(who->obj, exp, skill, arg);
2523  Py_INCREF(Py_None);
2524  return Py_None;
2525 }
2526 
2527 static PyObject *Crossfire_Object_Move(Crossfire_Object *who, PyObject *args) {
2528  int dir;
2529 
2530  if (!PyArg_ParseTuple(args, "i", &dir))
2531  return NULL;
2532  EXISTCHECK(who);
2533  return Py_BuildValue("i", cf_object_move(who->obj, dir, who->obj));
2534 }
2535 
2536 static PyObject *Crossfire_Object_MoveTo(Crossfire_Object *who, PyObject *args) {
2537  int x,y;
2538 
2539  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2540  return NULL;
2541  EXISTCHECK(who);
2542  return Py_BuildValue("i", cf_object_move_to(who->obj, x, y));
2543 }
2544 
2545 static PyObject *Crossfire_Object_Event(Crossfire_Object *who, PyObject *args) {
2546  int fix;
2547  const char *message = NULL;
2548  object *op1 = NULL;
2549  object *op2 = NULL;
2550  object *op3 = NULL;
2551  Crossfire_Object *activator = NULL;
2552  Crossfire_Object *third = NULL;
2553 
2554  if (!PyArg_ParseTuple(args, "O!O!si", &Crossfire_ObjectType, &activator, &Crossfire_ObjectType, &third, &message, &fix))
2555  return NULL;
2556  EXISTCHECK(who);
2557  EXISTCHECK(activator);
2558  EXISTCHECK(third);
2559  op1 = who->obj;
2560  op2 = activator->obj;
2561  op3 = third->obj;
2562  return Py_BuildValue("i", cf_object_user_event(op1, op2, op3, message, fix));
2563 }
2564 
2565 static PyObject *Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args) {
2566  int level;
2567 
2568  if (!PyArg_ParseTuple(args, "i", &level))
2569  return NULL;
2570  EXISTCHECK(who);
2571 
2572  return Py_BuildValue("i", cf_object_remove_depletion(who->obj, level));
2573 }
2574 
2575 static PyObject *Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args) {
2576  EXISTCHECK(who);
2577  return Py_BuildValue("i", cf_player_arrest(who->obj));
2578 }
2579 
2581  EXISTCHECK_INT(left);
2582  EXISTCHECK_INT(right);
2583  return (left->obj < right->obj ? -1 : (left->obj == right->obj ? 0 : 1));
2584 }
2585 
2586 static PyObject *Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op) {
2587  int result;
2588  if (!left
2589  || !right
2590  || !PyObject_TypeCheck((PyObject*)left, &Crossfire_ObjectType)
2591  || !PyObject_TypeCheck((PyObject*)right, &Crossfire_ObjectType)) {
2592  Py_INCREF(Py_NotImplemented);
2593  return Py_NotImplemented;
2594  }
2595  result = Crossfire_Object_InternalCompare(left, right);
2596  /* Handle removed objects. */
2597  if (result == -1 && PyErr_Occurred())
2598  return NULL;
2599  /* Based on how Python 3.0 (GPL compatible) implements it for internal types: */
2600  switch (op) {
2601  case Py_EQ:
2602  result = (result == 0);
2603  break;
2604  case Py_NE:
2605  result = (result != 0);
2606  break;
2607  case Py_LE:
2608  result = (result <= 0);
2609  break;
2610  case Py_GE:
2611  result = (result >= 0);
2612  break;
2613  case Py_LT:
2614  result = (result == -1);
2615  break;
2616  case Py_GT:
2617  result = (result == 1);
2618  break;
2619  }
2620  return PyBool_FromLong(result);
2621 }
2622 
2623 /* Legacy code: convert to long so that non-object functions work correctly */
2624 static PyObject *Crossfire_Object_Long(PyObject *obj) {
2625  return Py_BuildValue("l", ((Crossfire_Object *)obj)->obj);
2626 }
2627 
2628 #ifndef IS_PY3K
2629 static PyObject *Crossfire_Object_Int(PyObject *obj) {
2630  return Py_BuildValue("i", ((Crossfire_Object *)obj)->obj);
2631 }
2632 #endif
2633 
2634 /* Python binding */
2635 static PyGetSetDef Object_getseters[] = {
2636  { "Name", (getter)Object_GetName, (setter)Object_SetName, NULL, NULL },
2637  { "NamePl", (getter)Object_GetNamePl, (setter)Object_SetNamePl, NULL, NULL },
2638  { "Title", (getter)Object_GetTitle, (setter)Object_SetTitle, NULL, NULL },
2639  { "Race", (getter)Object_GetRace, (setter)Object_SetRace, NULL, NULL },
2640  { "Skill", (getter)Object_GetSkill, (setter)Object_SetSkill, NULL, NULL },
2641  { "Map", (getter)Object_GetMap, (setter)Object_SetMap, NULL, NULL },
2642  { "Cha", (getter)Object_GetCha, (setter)Object_SetCha, NULL, NULL },
2643  { "Con", (getter)Object_GetCon, (setter)Object_SetCon, NULL, NULL },
2644  { "Dex", (getter)Object_GetDex, (setter)Object_SetDex, NULL, NULL },
2645  { "Int", (getter)Object_GetInt, (setter)Object_SetInt, NULL, NULL },
2646  { "Pow", (getter)Object_GetPow, (setter)Object_SetPow, NULL, NULL },
2647  { "Str", (getter)Object_GetStr, (setter)Object_SetStr, NULL, NULL },
2648  { "Wis", (getter)Object_GetWis, (setter)Object_SetWis, NULL, NULL },
2649  { "HP", (getter)Object_GetHP, (setter)Object_SetHP, NULL, NULL },
2650  { "MaxHP", (getter)Object_GetMaxHP, (setter)Object_SetMaxHP, NULL, NULL },
2651  { "SP", (getter)Object_GetSP, (setter)Object_SetSP, NULL, NULL },
2652  { "MaxSP", (getter)Object_GetMaxSP, (setter)Object_SetMaxSP, NULL, NULL },
2653  { "Grace", (getter)Object_GetGrace, (setter)Object_SetGrace, NULL, NULL },
2654  { "MaxGrace", (getter)Object_GetMaxGrace, (setter)Object_SetMaxGrace, NULL, NULL },
2655  { "Food", (getter)Object_GetFood, (setter)Object_SetFood, NULL, NULL },
2656  { "AC", (getter)Object_GetAC, (setter)Object_SetAC, NULL, NULL },
2657  { "WC", (getter)Object_GetWC, (setter)Object_SetWC, NULL, NULL },
2658  { "Dam", (getter)Object_GetDam, (setter)Object_SetDam, NULL, NULL },
2659  { "Luck", (getter)Object_GetLuck, NULL, NULL, NULL },
2660  { "Exp", (getter)Object_GetExp, (setter)Object_SetExp, NULL, NULL },
2661  { "ExpMul", (getter)Object_GetExpMul, NULL, NULL, NULL },
2662  { "PermExp", (getter)Object_GetPermExp, NULL, NULL, NULL },
2663  { "Message", (getter)Object_GetMessage, (setter)Object_SetMessage, NULL, NULL },
2664  { "Slaying", (getter)Object_GetSlaying, (setter)Object_SetSlaying, NULL, NULL },
2665  { "Cursed", (getter)Object_GetCursed, (setter)Object_SetCursed, NULL, NULL },
2666  { "Damned", (getter)Object_GetDamned, (setter)Object_SetDamned, NULL, NULL },
2667  { "Weight", (getter)Object_GetWeight, (setter)Object_SetWeight, NULL, NULL },
2668  { "WeightLimit", (getter)Object_GetWeightLimit, (setter)Object_SetWeightLimit, NULL, NULL },
2669  { "Above", (getter)Object_GetAbove, NULL, NULL, NULL },
2670  { "Below", (getter)Object_GetBelow, NULL, NULL, NULL },
2671  { "Inventory", (getter)Object_GetInventory, NULL, NULL, NULL },
2672  { "X", (getter)Object_GetX, NULL, NULL, NULL },
2673  { "Y", (getter)Object_GetY, NULL, NULL, NULL },
2674  { "Direction", (getter)Object_GetDirection, (setter)Object_SetDirection, NULL, NULL },
2675  { "Facing", (getter)Object_GetFacing, (setter)Object_SetFacing, NULL, NULL },
2676  { "Unaggressive", (getter)Object_GetUnaggressive, (setter)Object_SetUnaggressive, NULL, NULL },
2677  { "God", (getter)Object_GetGod, (setter)Object_SetGod, NULL, NULL },
2678  { "Pickable", (getter)Object_GetPickable, (setter)Object_SetPickable, NULL, NULL },
2679  { "Quantity", (getter)Object_GetQuantity, (setter)Object_SetQuantity, NULL, NULL },
2680  { "Invisible", (getter)Object_GetInvisible, (setter)Object_SetInvisible, NULL, NULL },
2681  { "Speed", (getter)Object_GetSpeed, (setter)Object_SetSpeed, NULL, NULL },
2682  { "SpeedLeft", (getter)Object_GetSpeedLeft, (setter)Object_SetSpeedLeft, NULL, NULL },
2683  { "LastSP", (getter)Object_GetLastSP, (setter)Object_SetLastSP, NULL, NULL },
2684  { "LastGrace", (getter)Object_GetLastGrace, (setter)Object_SetLastGrace, NULL, NULL },
2685  { "LastEat", (getter)Object_GetLastEat, (setter)Object_SetLastEat, NULL, NULL },
2686  { "Level", (getter)Object_GetLevel, (setter)Object_SetLevel, NULL, NULL },
2687  { "Face", (getter)Object_GetFace, (setter)Object_SetFace, NULL, NULL },
2688  { "Anim", (getter)Object_GetAnim, (setter)Object_SetAnim, NULL, NULL },
2689  { "AnimSpeed", (getter)Object_GetAnimSpeed, (setter)Object_SetAnimSpeed, NULL, NULL },
2690  { "AttackType", (getter)Object_GetAttackType, (setter)Object_SetAttackType, NULL, NULL },
2691  { "BeenApplied", (getter)Object_GetBeenApplied, NULL, NULL, NULL },
2692  { "Identified", (getter)Object_GetIdentified, (setter)Object_SetIdentified, NULL, NULL },
2693  { "Alive", (getter)Object_GetAlive, (setter)Object_SetAlive, NULL, NULL },
2694  { "DungeonMaster", (getter)Object_GetDM, NULL, NULL, NULL },
2695  { "WasDungeonMaster", (getter)Object_GetWasDM, NULL, NULL, NULL },
2696  { "Applied", (getter)Object_GetApplied, (setter)Object_SetApplied, NULL, NULL },
2697  { "Unpaid", (getter)Object_GetUnpaid, (setter)Object_SetUnpaid, NULL, NULL },
2698  { "Monster", (getter)Object_GetMonster, NULL, NULL, NULL },
2699  { "Friendly", (getter)Object_GetFriendly, (setter)Object_SetFriendly, NULL, NULL },
2700  { "Generator", (getter)Object_GetGenerator, NULL, NULL, NULL },
2701  { "Thrown", (getter)Object_GetThrown, NULL, NULL, NULL },
2702  { "CanSeeInvisible", (getter)Object_GetCanSeeInvisible, (setter)Object_SetCanSeeInvisible, NULL, NULL },
2703  { "Rollable", (getter)Object_GetRollable, (setter)Object_SetRollable, NULL, NULL },
2704  { "Turnable", (getter)Object_GetTurnable, (setter)Object_SetTurnable, NULL, NULL },
2705  { "UsedUp", (getter)Object_GetUsedUp, (setter)Object_SetUsedUp, NULL, NULL },
2706  { "Splitting", (getter)Object_GetSplitting, NULL, NULL, NULL },
2707  { "Blind", (getter)Object_GetBlind, (setter)Object_SetBlind, NULL, NULL },
2708  { "CanUseSkill", (getter)Object_GetCanUseSkill, NULL, NULL, NULL },
2709  { "KnownCursed", (getter)Object_GetKnownCursed, (setter)Object_SetKnownCursed, NULL, NULL },
2710  { "Stealthy", (getter)Object_GetStealthy, (setter)Object_SetStealthy, NULL, NULL },
2711  { "Confused", (getter)Object_GetConfused, (setter)Object_SetConfused, NULL, NULL },
2712  { "Sleeping", (getter)Object_GetSleeping, (setter)Object_SetSleeping, NULL, NULL },
2713  { "Lifesaver", (getter)Object_GetLifesaver, (setter)Object_SetLifesaver, NULL, NULL },
2714  { "Floor", (getter)Object_GetFloor, NULL, NULL, NULL },
2715  { "HasXRays", (getter)Object_GetHasXRays, (setter)Object_SetHasXRays, NULL, NULL },
2716  { "CanUseRing", (getter)Object_GetCanUseRing, NULL, NULL, NULL },
2717  { "CanUseBow", (getter)Object_GetCanUseBow, NULL, NULL, NULL },
2718  { "CanUseWand", (getter)Object_GetCanUseWand, NULL, NULL, NULL },
2719  { "CanSeeInDark", (getter)Object_GetCanSeeInDark, (setter)Object_SetCanSeeInDark, NULL, NULL },
2720  { "KnownMagical", (getter)Object_GetKnownMagical, (setter)Object_SetKnownMagical, NULL, NULL },
2721  { "CanUseWeapon", (getter)Object_GetCanUseWeapon, NULL, NULL, NULL },
2722  { "CanUseArmour", (getter)Object_GetCanUseArmour, NULL, NULL, NULL },
2723  { "CanUseScroll", (getter)Object_GetCanUseScroll, NULL, NULL, NULL },
2724  { "CanCastSpell", (getter)Object_GetCanCastSpell, NULL, NULL, NULL },
2725  { "ReflectSpells", (getter)Object_GetReflectSpells, (setter)Object_SetReflectSpells, NULL, NULL },
2726  { "ReflectMissiles", (getter)Object_GetReflectMissiles, (setter)Object_SetReflectMissiles, NULL, NULL },
2727  { "Unique", (getter)Object_GetUnique, (setter)Object_SetUnique, NULL, NULL },
2728  { "RunAway", (getter)Object_GetRunAway, (setter)Object_SetRunAway, NULL, NULL },
2729  { "Scared", (getter)Object_GetScared, (setter)Object_SetScared, NULL, NULL },
2730  { "Undead", (getter)Object_GetUndead, (setter)Object_SetUndead, NULL, NULL },
2731  { "BlocksView", (getter)Object_GetBlocksView, (setter)Object_SetBlocksView, NULL, NULL },
2732  { "HitBack", (getter)Object_GetHitBack, (setter)Object_SetHitBack, NULL, NULL },
2733  { "StandStill", (getter)Object_GetStandStill, (setter)Object_SetStandStill, NULL, NULL },
2734  { "OnlyAttack", (getter)Object_GetOnlyAttack, (setter)Object_SetOnlyAttack, NULL, NULL },
2735  { "MakeInvisible", (getter)Object_GetMakeInvisible, (setter)Object_SetMakeInvisible, NULL, NULL },
2736  { "Money", (getter)Object_GetMoney, NULL, NULL, NULL },
2737  { "Type", (getter)Object_GetType, NULL, NULL, NULL },
2738  { "Subtype", (getter)Object_GetSubtype, NULL, NULL, NULL },
2739  { "Value", (getter)Object_GetValue, (setter)Object_SetValue, NULL, NULL },
2740  { "ArchName", (getter)Object_GetArchName, NULL, NULL, NULL },
2741  { "Archetype", (getter)Object_GetArchetype, NULL, NULL, NULL },
2742  { "OtherArchetype", (getter)Object_GetOtherArchetype,NULL, NULL, NULL },
2743  { "Exists", (getter)Object_GetExists, NULL, NULL, NULL },
2744  { "NoSave", (getter)Object_GetNoSave, (setter)Object_SetNoSave, NULL, NULL },
2745  { "Env", (getter)Object_GetEnv, NULL, NULL, NULL },
2746  { "MoveType", (getter)Object_GetMoveType, (setter)Object_SetMoveType, NULL, NULL },
2747  { "MoveBlock", (getter)Object_GetMoveBlock, (setter)Object_SetMoveBlock, NULL, NULL },
2748  { "MoveAllow", (getter)Object_GetMoveAllow, (setter)Object_SetMoveAllow, NULL, NULL },
2749  { "MoveOn", (getter)Object_GetMoveOn, (setter)Object_SetMoveOn, NULL, NULL },
2750  { "MoveOff", (getter)Object_GetMoveOff, (setter)Object_SetMoveOff, NULL, NULL },
2751  { "MoveSlow", (getter)Object_GetMoveSlow, (setter)Object_SetMoveSlow, NULL, NULL },
2752  { "MoveSlowPenalty", (getter)Object_GetMoveSlowPenalty, NULL, NULL, NULL },
2753  { "Owner", (getter)Object_GetOwner, (setter)Object_SetOwner, NULL, NULL },
2754  { "Enemy", (getter)Object_GetEnemy, (setter)Object_SetEnemy, NULL, NULL },
2755  { "Count", (getter)Object_GetCount, NULL, NULL, NULL },
2756  { "GodGiven", (getter)Object_GetGodGiven, (setter)Object_SetGodGiven, NULL, NULL },
2757  { "IsPet", (getter)Object_GetIsPet, (setter)Object_SetIsPet, NULL, NULL },
2758  { "AttackMovement", (getter)Object_GetAttackMovement, (setter)Object_SetAttackMovement, NULL, NULL },
2759  { "Duration", (getter)Object_GetDuration, (setter)Object_SetDuration, NULL, NULL },
2760  { "GlowRadius", (getter)Object_GetGlowRadius, (setter)Object_SetGlowRadius, NULL, NULL },
2761  { "Animated", (getter)Object_GetAnimated, (setter)Object_SetAnimated, NULL, NULL },
2762  { "NoDamage", (getter)Object_GetNoDamage, (setter)Object_SetNoDamage, NULL, NULL },
2763  { "RandomMovement", (getter)Object_GetRandomMovement, (setter)Object_SetRandomMovement, NULL, NULL },
2764  { "Material", (getter)Object_GetMaterial, NULL, NULL, NULL },
2765  { "Container", (getter)Object_GetContainer, NULL, NULL, NULL },
2766  { NULL, NULL, NULL, NULL, NULL }
2767 };
2768 
2769 static PyMethodDef ObjectMethods[] = {
2770  { "Remove", (PyCFunction)Crossfire_Object_Remove, METH_NOARGS, NULL },
2771  { "Apply", (PyCFunction)Crossfire_Object_Apply, METH_VARARGS, NULL },
2772  { "Drop", (PyCFunction)Crossfire_Object_Drop, METH_O, NULL },
2773  { "Clone", (PyCFunction)Crossfire_Object_Clone, METH_VARARGS, NULL },
2774  { "Split", (PyCFunction)Crossfire_Object_Split, METH_VARARGS, NULL },
2775  { "Fix", (PyCFunction)Crossfire_Object_Fix, METH_NOARGS, NULL },
2776  { "Say", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
2777  { "Speak", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
2778  { "Take", (PyCFunction)Crossfire_Object_Take, METH_O, NULL },
2779  { "Teleport", (PyCFunction)Crossfire_Object_Teleport, METH_VARARGS, NULL },
2780  { "Reposition", (PyCFunction)Crossfire_Object_Reposition, METH_VARARGS, NULL },
2781  { "QueryName", (PyCFunction)Crossfire_Object_QueryName, METH_NOARGS, NULL },
2782  { "GetResist", (PyCFunction)Crossfire_Object_GetResist, METH_VARARGS, NULL },
2783  { "SetResist", (PyCFunction)Crossfire_Object_SetResist, METH_VARARGS, NULL },
2784  { "ActivateRune", (PyCFunction)Crossfire_Object_ActivateRune, METH_O, NULL },
2785  { "CheckTrigger", (PyCFunction)Crossfire_Object_CheckTrigger, METH_O, NULL },
2786  { "Cast", (PyCFunction)Crossfire_Object_Cast, METH_VARARGS, NULL },
2787  { "LearnSpell", (PyCFunction)Crossfire_Object_LearnSpell, METH_O, NULL },
2788  { "ForgetSpell", (PyCFunction)Crossfire_Object_ForgetSpell, METH_O, NULL },
2789  { "KnowSpell", (PyCFunction)Crossfire_Object_KnowSpell, METH_VARARGS, NULL },
2790  { "CastAbility", (PyCFunction)Crossfire_Object_CastAbility, METH_VARARGS, NULL },
2791  { "PayAmount", (PyCFunction)Crossfire_Object_PayAmount, METH_VARARGS, NULL },
2792  { "Pay", (PyCFunction)Crossfire_Object_Pay, METH_O, NULL },
2793  { "CheckInventory", (PyCFunction)Crossfire_Object_CheckInventory, METH_VARARGS, NULL },
2794  { "CheckArchInventory", (PyCFunction)Crossfire_Object_CheckArchInventory, METH_VARARGS, NULL },
2795  { "OutOfMap", (PyCFunction)Crossfire_Object_GetOutOfMap, METH_VARARGS, NULL },
2796  { "CreateObject", (PyCFunction)Crossfire_Object_CreateInside, METH_VARARGS, NULL },
2797  { "InsertInto", (PyCFunction)Crossfire_Object_InsertInto, METH_O, NULL },
2798  { "ReadKey", (PyCFunction)Crossfire_Object_ReadKey, METH_VARARGS, NULL },
2799  { "WriteKey", (PyCFunction)Crossfire_Object_WriteKey, METH_VARARGS, NULL },
2800  { "CreateTimer", (PyCFunction)Crossfire_Object_CreateTimer, METH_VARARGS, NULL },
2801  { "AddExp", (PyCFunction)Crossfire_Object_AddExp, METH_VARARGS, NULL },
2802  { "Move", (PyCFunction)Crossfire_Object_Move, METH_VARARGS, NULL },
2803  { "MoveTo", (PyCFunction)Crossfire_Object_MoveTo, METH_VARARGS, NULL },
2804  { "ChangeAbil", (PyCFunction)Crossfire_Object_ChangeAbil, METH_O, NULL },
2805  { "Event", (PyCFunction)Crossfire_Object_Event, METH_VARARGS, NULL },
2806  { "RemoveDepletion",(PyCFunction)Crossfire_Object_RemoveDepletion, METH_VARARGS, NULL },
2807  { "Arrest", (PyCFunction)Crossfire_Object_Arrest, METH_VARARGS, NULL },
2808  { NULL, NULL, 0, NULL }
2809 };
2810 
2811 static PyNumberMethods ObjectConvert = {
2812  NULL, /* binaryfunc nb_add; */ /* __add__ */
2813  NULL, /* binaryfunc nb_subtract; */ /* __sub__ */
2814  NULL, /* binaryfunc nb_multiply; */ /* __mul__ */
2815 #ifndef IS_PY3K
2816  NULL, /* binaryfunc nb_divide; */ /* __div__ */
2817 #endif
2818  NULL, /* binaryfunc nb_remainder; */ /* __mod__ */
2819  NULL, /* binaryfunc nb_divmod; */ /* __divmod__ */
2820  NULL, /* ternaryfunc nb_power; */ /* __pow__ */
2821  NULL, /* unaryfunc nb_negative; */ /* __neg__ */
2822  NULL, /* unaryfunc nb_positive; */ /* __pos__ */
2823  NULL, /* unaryfunc nb_absolute; */ /* __abs__ */
2824 #ifdef IS_PY3K
2825  NULL, /* inquiry nb_bool; */ /* __bool__ */
2826 #else
2827  NULL, /* inquiry nb_nonzero; */ /* __nonzero__ */
2828 #endif
2829  NULL, /* unaryfunc nb_invert; */ /* __invert__ */
2830  NULL, /* binaryfunc nb_lshift; */ /* __lshift__ */
2831  NULL, /* binaryfunc nb_rshift; */ /* __rshift__ */
2832  NULL, /* binaryfunc nb_and; */ /* __and__ */
2833  NULL, /* binaryfunc nb_xor; */ /* __xor__ */
2834  NULL, /* binaryfunc nb_or; */ /* __or__ */
2835 #ifndef IS_PY3K
2836  NULL, /* coercion nb_coerce; */ /* __coerce__ */
2837 #endif
2838 #ifdef IS_PY3K
2839  /* This is not a typo. For Py3k it should be Crossfire_Object_Long
2840  * and NOT Crossfire_Object_Int.
2841  */
2842  Crossfire_Object_Long, /* unaryfunc nb_int; */ /* __int__ */
2843  NULL, /* void *nb_reserved; */
2844 #else
2845  Crossfire_Object_Int, /* unaryfunc nb_int; */ /* __int__ */
2846  Crossfire_Object_Long, /* unaryfunc nb_long; */ /* __long__ */
2847 #endif
2848  NULL, /* unaryfunc nb_float; */ /* __float__ */
2849 #ifndef IS_PY3K
2850  NULL, /* unaryfunc nb_oct; */ /* __oct__ */
2851  NULL, /* unaryfunc nb_hex; */ /* __hex__ */
2852 #endif
2853  NULL, /* binaryfunc nb_inplace_add; */
2854  NULL, /* binaryfunc nb_inplace_subtract; */
2855  NULL, /* binaryfunc nb_inplace_multiply; */
2856 #ifndef IS_PY3K
2857  NULL, /* binaryfunc nb_inplace_divide; */
2858 #endif
2859  NULL, /* binaryfunc nb_inplace_remainder; */
2860  NULL, /* ternaryfunc nb_inplace_power; */
2861  NULL, /* binaryfunc nb_inplace_lshift; */
2862  NULL, /* binaryfunc nb_inplace_rshift; */
2863  NULL, /* binaryfunc nb_inplace_and; */
2864  NULL, /* binaryfunc nb_inplace_xor; */
2865  NULL, /* binaryfunc nb_inplace_or; */
2866 
2867  NULL, /* binaryfunc nb_floor_divide; */
2868  NULL, /* binaryfunc nb_true_divide; */
2869  NULL, /* binaryfunc nb_inplace_floor_divide; */
2870  NULL, /* binaryfunc nb_inplace_true_divide; */
2871 #if defined(IS_PY25) || defined(IS_PY3K)
2872  NULL /* unaryfunc nb_index; */
2873 #endif
2874 };
2875 
2876 static PyObject *Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
2877  Crossfire_Object *self;
2878 
2879  self = (Crossfire_Object *)type->tp_alloc(type, 0);
2880  if (self) {
2881  self->obj = NULL;
2882  self->count = 0;
2883  }
2884 
2885  return (PyObject *)self;
2886 }
2887 
2888 static void Crossfire_Object_dealloc(PyObject *obj) {
2889  Crossfire_Object *self;
2890 
2891  self = (Crossfire_Object *)obj;
2892  if (self) {
2893  if (self->obj) {
2894  free_object_assoc(self->obj);
2895  }
2896  Py_TYPE(self)->tp_free(obj);
2897  }
2898 }
2899 
2900 static PyObject *Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
2901  Crossfire_Player *self;
2902 
2903  self = (Crossfire_Player *)type->tp_alloc(type, 0);
2904  if (self) {
2905  self->obj = NULL;
2906  self->count = 0;
2907  }
2908 
2909  return (PyObject *)self;
2910 }
2911 
2912 static void Crossfire_Player_dealloc(PyObject *obj) {
2913  Crossfire_Player *self;
2914 
2915  self = (Crossfire_Player *)obj;
2916  if (self) {
2917  if (self->obj) {
2918  free_object_assoc(self->obj);
2919  }
2920  Py_TYPE(self)->tp_free(obj);
2921  }
2922 }
2923 
2924 /* Our actual Python ObjectType */
2925 PyTypeObject Crossfire_ObjectType = {
2926 #ifdef IS_PY3K
2927  /* See http://bugs.python.org/issue4385 */
2928  PyVarObject_HEAD_INIT(NULL, 0)
2929 #else
2930  PyObject_HEAD_INIT(NULL)
2931  0, /* ob_size*/
2932 #endif
2933  "Crossfire.Object", /* tp_name*/
2934  sizeof(Crossfire_Object), /* tp_basicsize*/
2935  0, /* tp_itemsize*/
2936  Crossfire_Object_dealloc, /* tp_dealloc*/
2937  NULL, /* tp_print*/
2938  NULL, /* tp_getattr*/
2939  NULL, /* tp_setattr*/
2940 #ifdef IS_PY3K
2941  NULL, /* tp_reserved */
2942 #else
2943  (cmpfunc)Crossfire_Object_InternalCompare, /* tp_compare*/
2944 #endif
2945  NULL, /* tp_repr*/
2946  &ObjectConvert, /* tp_as_number*/
2947  NULL, /* tp_as_sequence*/
2948  NULL, /* tp_as_mapping*/
2949  PyObject_HashNotImplemented, /* tp_hash */
2950  NULL, /* tp_call*/
2951  NULL, /* tp_str*/
2952  PyObject_GenericGetAttr, /* tp_getattro*/
2953  PyObject_GenericSetAttr, /* tp_setattro*/
2954  NULL, /* tp_as_buffer*/
2955  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags*/
2956  "Crossfire objects", /* tp_doc */
2957  NULL, /* tp_traverse */
2958  NULL, /* tp_clear */
2959  (richcmpfunc)Crossfire_Object_RichCompare, /* tp_richcompare */
2960  0, /* tp_weaklistoffset */
2961  NULL, /* tp_iter */
2962  NULL, /* tp_iternext */
2963  ObjectMethods, /* tp_methods */
2964  NULL, /* tp_members */
2965  Object_getseters, /* tp_getset */
2966  NULL, /* tp_base */
2967  NULL, /* tp_dict */
2968  NULL, /* tp_descr_get */
2969  NULL, /* tp_descr_set */
2970  0, /* tp_dictoffset */
2971  NULL, /* tp_init */
2972  NULL, /* tp_alloc */
2973  Crossfire_Object_new, /* tp_new */
2974  NULL, /* tp_free */
2975  NULL, /* tp_is_gc */
2976  NULL, /* tp_bases */
2977  NULL, /* tp_mro */
2978  NULL, /* tp_cache */
2979  NULL, /* tp_subclasses */
2980  NULL, /* tp_weaklist */
2981  NULL, /* tp_del */
2982 };
2983 
2984 static PyGetSetDef Player_getseters[] = {
2985  { "Title", (getter)Player_GetTitle, (setter)Player_SetTitle, NULL, NULL },
2986  { "IP", (getter)Player_GetIP, NULL, NULL, NULL },
2987  { "MarkedItem", (getter)Player_GetMarkedItem, (setter)Player_SetMarkedItem, NULL, NULL },
2988  { "Party", (getter)Player_GetParty, (setter)Player_SetParty, NULL, NULL },
2989  { "BedMap", (getter)Player_GetBedMap, (setter)Player_SetBedMap, NULL, NULL },
2990  { "BedX", (getter)Player_GetBedX, (setter)Player_SetBedX, NULL, NULL },
2991  { "BedY", (getter)Player_GetBedY, (setter)Player_SetBedY, NULL, NULL },
2992  { NULL, NULL, NULL, NULL, NULL }
2993 };
2994 
2995 static PyMethodDef PlayerMethods[] = {
2996  { "Message", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
2997  { "Write", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
2998  { "CanPay", (PyCFunction)Crossfire_Player_CanPay, METH_NOARGS, NULL },
2999  { "QuestStart", (PyCFunction)Player_QuestStart, METH_VARARGS, NULL },
3000  { "QuestGetState", (PyCFunction)Player_QuestGetState, METH_VARARGS, NULL },
3001  { "QuestSetState", (PyCFunction)Player_QuestSetState, METH_VARARGS, NULL },
3002  { "QuestWasCompleted", (PyCFunction)Player_QuestWasCompleted, METH_VARARGS, NULL },
3003  { "KnowledgeKnown", (PyCFunction)Player_KnowledgeKnown, METH_VARARGS, NULL },
3004  { "GiveKnowledge", (PyCFunction)Player_GiveKnowledge, METH_VARARGS, NULL },
3005  { NULL, NULL, 0, NULL }
3006 };
3007 
3008 /* Our actual Python ObjectPlayerType */
3009 PyTypeObject Crossfire_PlayerType = {
3010 #ifdef IS_PY3K
3011  /* See http://bugs.python.org/issue4385 */
3012  PyVarObject_HEAD_INIT(NULL, 0)
3013 #else
3014  PyObject_HEAD_INIT(NULL)
3015  0, /* ob_size*/
3016 #endif
3017  "Crossfire.Player", /* tp_name*/
3018  sizeof(Crossfire_Player), /* tp_basicsize*/
3019  0, /* tp_itemsize*/
3020  Crossfire_Player_dealloc, /* tp_dealloc*/
3021  NULL, /* tp_print*/
3022  NULL, /* tp_getattr*/
3023  NULL, /* tp_setattr*/
3024  NULL, /* tp_compare*/
3025  NULL, /* tp_repr*/
3026  NULL, /* tp_as_number*/
3027  NULL, /* tp_as_sequence*/
3028  NULL, /* tp_as_mapping*/
3029  /* Should be NULL to inherit tp_richcompare and tp_compare from Crossfire_ObjectType. */
3030  NULL, /* tp_hash */
3031  NULL, /* tp_call*/
3032  NULL, /* tp_str*/
3033  PyObject_GenericGetAttr, /* tp_getattro*/
3034  PyObject_GenericSetAttr, /* tp_setattro*/
3035  NULL, /* tp_as_buffer*/
3036  Py_TPFLAGS_DEFAULT, /* tp_flags*/
3037  "Crossfire player", /* tp_doc */
3038  NULL, /* tp_traverse */
3039  NULL, /* tp_clear */
3040  NULL, /* tp_richcompare */
3041  0, /* tp_weaklistoffset */
3042  NULL, /* tp_iter */
3043  NULL, /* tp_iternext */
3044  PlayerMethods, /* tp_methods */
3045  NULL, /* tp_members */
3046  Player_getseters, /* tp_getset */
3047  &Crossfire_ObjectType, /* tp_base */
3048  NULL, /* tp_dict */
3049  NULL, /* tp_descr_get */
3050  NULL, /* tp_descr_set */
3051  0, /* tp_dictoffset */
3052  NULL, /* tp_init */
3053  NULL, /* tp_alloc */
3054  Crossfire_Player_new, /* tp_new */
3055  NULL, /* tp_free */
3056  NULL, /* tp_is_gc */
3057  NULL, /* tp_bases */
3058  NULL, /* tp_mro */
3059  NULL, /* tp_cache */
3060  NULL, /* tp_subclasses */
3061  NULL, /* tp_weaklist */
3062  NULL, /* tp_del */
3063 };
3064 
3068 PyObject *Crossfire_Object_wrap(object *what) {
3069  Crossfire_Object *wrapper;
3070  Crossfire_Player *plwrap;
3071  PyObject *pyobj;
3072 
3073  /* return None if no object was to be wrapped */
3074  if (what == NULL) {
3075  Py_INCREF(Py_None);
3076  return Py_None;
3077  }
3078 
3079  pyobj = find_assoc_pyobject(what);
3080  if ((!pyobj) || (object_was_destroyed(((Crossfire_Object *)pyobj)->obj, ((Crossfire_Object *)pyobj)->count))) {
3081  if (what->type == PLAYER) {
3082  plwrap = PyObject_NEW(Crossfire_Player, &Crossfire_PlayerType);
3083  if (plwrap != NULL) {
3084  plwrap->obj = what;
3085  plwrap->count = what->count;
3086  }
3087  pyobj = (PyObject *)plwrap;
3088  } else {
3089  wrapper = PyObject_NEW(Crossfire_Object, &Crossfire_ObjectType);
3090  if (wrapper != NULL) {
3091  wrapper->obj = what;
3092  wrapper->count = what->count;
3093  }
3094  pyobj = (PyObject *)wrapper;
3095  }
3096  add_object_assoc(what, pyobj);
3097  } else {
3098  Py_INCREF(pyobj);
3099  }
3100  return pyobj;
3101 }
#define CFAPI_OBJECT_PROP_STR
Definition: plugin.h:248
#define CFAPI_OBJECT_PROP_MAP
Definition: plugin.h:179
static int Object_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_object_set_nrof(object *, int nrof)
static PyObject * Object_GetMessage(Crossfire_Object *whoptr, void *closure)
static int Object_SetUsedUp(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Split(Crossfire_Object *who, PyObject *args)
Definition: object.h:274
static PyObject * Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject * Object_GetMaxGrace(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Event(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetSP(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetBelow(Crossfire_Object *whoptr, void *closure)
#define FLAG_SEE_IN_DARK
Definition: define.h:338
static void add_object_assoc(object *key, PyObject *value)
long cf_object_get_long_property(object *op, long propcode)
static PyObject * Object_GetWis(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_MATERIAL
Definition: plugin.h:204
static PyObject * Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args)
void cf_object_free_drop_inventory(object *ob)
#define CFAPI_OBJECT_PROP_ANIMATION
Definition: plugin.h:269
#define FLAG_DAMNED
Definition: define.h:318
#define FLAG_IS_FLOOR
Definition: define.h:303
int npc_msg_count
Definition: dialog.h:59
#define FLAG_UNPAID
Definition: define.h:236
#define CFAPI_OBJECT_PROP_SP
Definition: plugin.h:258
static PyObject * Object_GetRunAway(Crossfire_Object *whoptr, void *closure)
PyObject_HEAD object * obj
CFPContext * current_context
Definition: cfpython.c:113
static int Object_SetWeightLimit(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetDuration(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_NAME
Definition: plugin.h:181
#define CFAPI_OBJECT_PROP_OB_BELOW
Definition: plugin.h:172
int cf_player_knowledge_has(object *op, const char *knowledge)
static PyObject * Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args)
object * cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y)
static PyObject * Player_GetBedX(Crossfire_Player *whoptr, void *closure)
static int Object_SetScared(Crossfire_Object *whoptr, PyObject *value, void *closure)
PyObject * Crossfire_Party_wrap(partylist *what)
static PyObject * Object_GetAbove(Crossfire_Object *whoptr, void *closure)
static int Object_SetLastSP(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_RACE
Definition: plugin.h:184
static PyObject * Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetFace(Crossfire_Object *whoptr, void *closure)
#define FLAG_SLEEP
Definition: define.h:308
static int Object_SetCha(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Crossfire_Object_InternalCompare(Crossfire_Object *left, Crossfire_Object *right)
void cf_spring_trap(object *trap, object *victim)
static int Object_SetHitBack(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCanUseScroll(Crossfire_Object *whoptr, void *closure)
static int Object_SetMaxGrace(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args)
#define FLAG_HITBACK
Definition: define.h:267
#define CFAPI_OBJECT_PROP_ARCHETYPE
Definition: plugin.h:232
#define CFAPI_OBJECT_PROP_WEIGHT
Definition: plugin.h:217
static PyObject * Object_GetStealthy(Crossfire_Object *whoptr, void *closure)
static PyObject * find_assoc_pyobject(object *key)
#define CFAPI_OBJECT_PROP_ATTACK_TYPE
Definition: plugin.h:200
void cf_free_string(sstring str)
#define FLAG_USE_SCROLL
Definition: define.h:292
static int Object_SetMap(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_FACE
Definition: plugin.h:268
int cf_object_cast_ability(object *caster, object *ctoo, int dir, object *sp, char *flags)
static PyObject * Object_GetContainer(Crossfire_Object *whoptr, void *closure)
const char * cf_object_get_key(object *op, const char *keyname)
static int Object_SetQuantity(Crossfire_Object *whoptr, PyObject *value, void *closure)
PyObject * Crossfire_Map_wrap(mapstruct *what)
Definition: cfpython_map.c:427
static PyObject * Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetSlaying(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetInventory(Crossfire_Object *whoptr, void *closure)
static int Object_SetApplied(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCanUseWeapon(Crossfire_Object *whoptr, void *closure)
static PyGetSetDef Player_getseters[]
static PyObject * Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args)
static int Object_SetInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int Object_SetNoSave(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_GOD
Definition: plugin.h:265
static PyObject * Object_GetInvisible(Crossfire_Object *whoptr, void *closure)
PyObject_HEAD partylist * party
#define CFAPI_OBJECT_PROP_DIRECTION
Definition: plugin.h:194
static int Object_SetFood(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_USE_ARMOUR
Definition: define.h:296
static int Object_SetAC(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetAC(Crossfire_Object *whoptr, void *closure)
#define FLAG_IS_USED_UP
Definition: define.h:260
static PyObject * Crossfire_Object_Take(Crossfire_Object *who, PyObject *args)
static int Player_SetBedY(Crossfire_Player *whoptr, PyObject *value, void *closure)
#define FLAG_STAND_STILL
Definition: define.h:309
static PyObject * Object_GetMoveOn(Crossfire_Object *whoptr, void *closure)
void cf_object_set_flag(object *ob, int flag, int value)
int cf_object_set_animation(object *op, const char *animation)
#define CFAPI_OBJECT_PROP_MAXGP
Definition: plugin.h:263
#define NDI_ORANGE
Definition: newclient.h:225
static PyObject * Object_GetTurnable(Crossfire_Object *whoptr, void *closure)
#define FLAG_FRIENDLY
Definition: define.h:246
static PyObject * Player_GetBedMap(Crossfire_Player *whoptr, void *closure)
static PyObject * Object_GetFacing(Crossfire_Object *whoptr, void *closure)
static int Player_SetParty(Crossfire_Player *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetArchetype(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetThrown(Crossfire_Object *whoptr, void *closure)
static int Object_SetSlaying(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetNoDamage(Crossfire_Object *whoptr, PyObject *value, void *closure)
object * cf_object_insert_in_ob(object *op, object *where)
static PyObject * Object_GetLastEat(Crossfire_Object *whoptr, void *closure)
partylist * cf_player_get_party(object *op)
static int Object_SetReflectMissiles(Crossfire_Object *whoptr, PyObject *value, void *closure)
unsigned char MoveType
Definition: define.h:432
ptr_assoc * ptr_assoc_table[PTR_ASSOC_TABLESIZE]
Definition: hashtable.h:15
#define CFAPI_OBJECT_PROP_SUBTYPE
Definition: plugin.h:197
void cf_object_set_resistance(object *op, int rtype, int16_t value)
static int Object_SetHP(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_MoveTo(Crossfire_Object *who, PyObject *args)
static int Object_SetBlocksView(Crossfire_Object *whoptr, PyObject *value, void *closure)
int16_t cf_object_get_resistance(object *op, int rtype)
static int Object_SetBlind(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_CONTAINER
Definition: plugin.h:178
#define CFAPI_OBJECT_PROP_INVENTORY
Definition: plugin.h:175
static int Object_SetAttackType(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetFood(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_NAME_PLURAL
Definition: plugin.h:182
static PyObject * Object_GetMonster(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetMoveOff(Crossfire_Object *whoptr, void *closure)
int cf_object_pay_item(object *op, object *pl)
#define FLAG_CONFUSED
Definition: define.h:312
static PyObject * Object_GetUnaggressive(Crossfire_Object *whoptr, void *closure)
static PyMethodDef ObjectMethods[]
#define FLAG_STEALTH
Definition: define.h:313
PyTypeObject Crossfire_PartyType
#define FLAG_RANDOM_MOVE
Definition: define.h:310
#define CFAPI_OBJECT_PROP_OWNER
Definition: plugin.h:242
static PyObject * Object_GetNoDamage(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetLevel(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Long(PyObject *obj)
#define FLAG_USE_WEAPON
Definition: define.h:297
#define CFAPI_OBJECT_PROP_MOVE_ON
Definition: plugin.h:274
static PyObject * Object_GetCanSeeInvisible(Crossfire_Object *whoptr, void *closure)
static int Object_SetSP(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_MESSAGE
Definition: plugin.h:187
static PyObject * Object_GetUndead(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_EXP_MULTIPLIER
Definition: plugin.h:231
static PyObject * Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args)
void cf_fix_object(object *op)
static PyObject * Object_GetWeightLimit(Crossfire_Object *whoptr, void *closure)
int cf_object_remove_depletion(object *op, int level)
#define object_was_destroyed(op, old_tag)
Definition: object.h:68
static int Object_SetUnique(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_player_arrest(object *who)
static int Object_SetDuration(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args)
int cf_object_set_face(object *op, const char *face)
static PyObject * Crossfire_Player_CanPay(Crossfire_Player *who, PyObject *args)
static PyObject * Object_GetAttackType(Crossfire_Object *whoptr, void *closure)
object * cf_player_get_marked_item(object *op)
static PyObject * Object_GetCanSeeInDark(Crossfire_Object *whoptr, void *closure)
char * cf_object_get_string_property(object *op, int propcode, char *buf, int size)
static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetPow(Crossfire_Object *whoptr, void *closure)
void cf_player_knowledge_give(object *op, const char *knowledge)
static PyObject * Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetQuantity(Crossfire_Object *whoptr, void *closure)
sstring cf_add_string(const char *str)
#define CFAPI_OBJECT_PROP_SLAYING
Definition: plugin.h:185
int cf_object_get_int_property(object *op, int propcode)
static int Object_SetStealthy(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetPow(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_USE_RING
Definition: define.h:298
static int Object_SetIsPet(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op)
static int Object_SetUnpaid(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetInt(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_OTHER_ARCH
Definition: plugin.h:233
#define CFAPI_OBJECT_PROP_LAST_SP
Definition: plugin.h:210
#define FLAG_REMOVED
Definition: define.h:232
static PyObject * Player_GetParty(Crossfire_Player *whoptr, void *closure)
static PyObject * Object_GetBlocksView(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_LAST_GRACE
Definition: plugin.h:211
int cf_object_transfer(object *op, int x, int y, int randomly, object *originator)
void cf_object_forget_spell(object *op, object *sp)
#define CFAPI_OBJECT_PROP_COUNT
Definition: plugin.h:180
#define FLAG_CAN_ROLL
Definition: define.h:254
#define FLAG_KNOWN_MAGICAL
Definition: define.h:320
void cf_log(LogLevel logLevel, const char *format,...)
static PyObject * Object_GetRollable(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMoveBlock(Crossfire_Object *whoptr, void *closure)
float cf_object_get_float_property(object *op, int propcode)
static PyObject * Object_GetMaterial(Crossfire_Object *whoptr, void *closure)
void cf_object_learn_spell(object *op, object *spell, int special_prayer)
static PyObject * Object_GetStr(Crossfire_Object *whoptr, void *closure)
#define MOVE_ALL
Definition: define.h:413
static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_object_check_trigger(object *op, object *cause)
void cf_quest_start(object *pl, sstring quest_code, int state)
static int Object_SetWC(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_SEE_INVISIBLE
Definition: define.h:253
static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure)
sstring cf_object_get_sstring_property(object *op, int propcode)
static PyObject * Object_GetUsedUp(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetType(Crossfire_Object *whoptr, void *closure)
#define FLAG_UNDEAD
Definition: define.h:270
#define CFAPI_PLAYER_PROP_BED_X
Definition: plugin.h:285
static int Object_SetGod(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetGrace(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args)
static PyObject * Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args)
static PyObject * Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args)
void cf_quest_set_player_state(object *pl, sstring quest_code, int state)
MoveType cf_object_get_movetype_property(object *op, int propcode)
void cf_player_set_marked_item(object *op, object *ob)
static int Object_SetDam(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetReflectSpells(Crossfire_Object *whoptr, void *closure)
int cf_player_can_pay(object *op)
PyObject_HEAD object * obj
#define CFAPI_OBJECT_PROP_FACING
Definition: plugin.h:195
static int Object_SetUndead(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMakeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args)
int cf_timer_create(object *ob, long delay, int mode)
#define FLAG_ALIVE
Definition: define.h:230
#define CFAPI_OBJECT_PROP_ENVIRONMENT
Definition: plugin.h:176
#define FLAG_REFL_SPELL
Definition: define.h:275
static PyObject * Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_GP
Definition: plugin.h:259
static int Object_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_CHA
Definition: plugin.h:254
static PyObject * Object_GetMaxHP(Crossfire_Object *whoptr, void *closure)
static void Crossfire_Object_dealloc(PyObject *obj)
#define PyObject_HashNotImplemented
Definition: cfpython.h:73
static int Player_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetConfused(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMakeInvisible(Crossfire_Object *whoptr, void *closure)
PyTypeObject Crossfire_ObjectType
static ptr_assoc_table object_assoc_table
#define CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY
Definition: plugin.h:277
static PyObject * Object_GetY(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetCanUseSkill(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_INT
Definition: plugin.h:252
void cf_object_set_int_property(object *op, int propcode, int value)
static int Object_SetHasXRays(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args)
#define FLAG_CAN_USE_SKILL
Definition: define.h:322
#define CFAPI_OBJECT_PROP_LEVEL
Definition: plugin.h:208
object * cf_object_clone(object *op, int clonetype)
#define CFAPI_PLAYER_PROP_BED_MAP
Definition: plugin.h:284
#define FLAG_UNAGGRESSIVE
Definition: define.h:272
static PyObject * Crossfire_Player_Message(Crossfire_Player *who, PyObject *args)
#define CFAPI_OBJECT_PROP_MOVE_ALLOW
Definition: plugin.h:273
#define FLAG_USE_RANGE
Definition: define.h:293
static PyObject * Player_GetBedY(Crossfire_Player *whoptr, void *closure)
void cf_object_set_float_property(object *op, int propcode, float value)
int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix)
static PyObject * Object_GetDamned(Crossfire_Object *whoptr, void *closure)
static int Object_SetLastEat(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetIdentified(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Player_SetBedMap(Crossfire_Player *whoptr, PyObject *value, void *closure)
#define snprintf
Definition: win32.h:46
#define FLAG_NO_SAVE
Definition: define.h:244
static int Object_SetCursed(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetAlive(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetMoveType(Crossfire_Object *whoptr, void *closure)
double cf_object_get_double_property(object *op, int propcode)
#define FLAG_IDENTIFIED
Definition: define.h:261
static PyObject * Object_GetGodGiven(Crossfire_Object *whoptr, void *closure)
static int Object_SetReflectSpells(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetIdentified(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMap(Crossfire_Object *whoptr, void *closure)
static int Object_SetInt(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetLastGrace(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_FP
Definition: plugin.h:260
static int Object_SetKnownCursed(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_BLOCKSVIEW
Definition: define.h:269
static PyObject * Object_GetCursed(Crossfire_Object *whoptr, void *closure)
const char * name
Definition: object.h:311
static int Object_SetRandomMovement(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCount(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetFloor(Crossfire_Object *whoptr, void *closure)
static int Object_SetSkill(Crossfire_Object *whoptr, PyObject *value, void *closure)
sstring cf_query_name_pl(object *ob)
static PyMethodDef PlayerMethods[]
static int Object_SetAttackMovement(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetArchName(Crossfire_Object *whoptr, void *closure)
static int Player_SetBedX(Crossfire_Player *whoptr, PyObject *value, void *closure)
static int Object_SetGlowRadius(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetExpMul(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetOwner(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_LAST_EAT
Definition: plugin.h:212
static int Object_SetLifesaver(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Player_QuestGetState(Crossfire_Player *whoptr, PyObject *args)
static PyObject * Player_GetTitle(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetGlowRadius(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Int(PyObject *obj)
PyObject * Crossfire_Object_wrap(object *what)
#define CFAPI_OBJECT_PROP_MOVE_OFF
Definition: plugin.h:275
#define CFAPI_OBJECT_PROP_WEIGHT_LIMIT
Definition: plugin.h:218
static PyObject * Object_GetNamePl(Crossfire_Object *whoptr, void *closure)
object * cf_object_insert_object(object *op, object *container)
static int Object_SetMoveSlow(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetRace(Crossfire_Object *whoptr, PyObject *value, void *closure)
void cf_object_say(object *op, char *msg)
static PyObject * Object_GetHP(Crossfire_Object *whoptr, void *closure)
PyObject_HEAD mapstruct * map
Definition: cfpython_map.h:34
static PyObject * Object_GetDirection(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_X
Definition: plugin.h:189
static PyObject * Object_GetScared(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetOtherArchetype(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetExists(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetEnemy(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetCha(Crossfire_Object *whoptr, void *closure)
#define FLAG_SCARED
Definition: define.h:271
static PyObject * Object_GetAnimated(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetFriendly(Crossfire_Object *whoptr, void *closure)
void * find_assoc_value(ptr_assoc **hash_table, void *key)
Definition: hashtable.c:205
#define CFAPI_OBJECT_PROP_ENEMY
Definition: plugin.h:223
static PyObject * Object_GetExp(Crossfire_Object *whoptr, void *closure)
int cf_object_query_money(const object *op)
#define FLAG_ONLY_ATTACK
Definition: define.h:311
#define FLAG_XRAYS
Definition: define.h:301
static int Object_SetKnownMagical(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure)
int64_t cf_object_get_int64_property(object *op, int propcode)
static int Object_SetStandStill(Crossfire_Object *whoptr, PyObject *value, void *closure)
unsigned __int64 uint64_t
Definition: win32.h:167
static PyObject * Object_GetMoney(Crossfire_Object *whoptr, void *closure)
static int Object_SetDirection(Crossfire_Object *whoptr, PyObject *value, void *closure)
object * cf_object_present_archname_inside(object *op, char *whatstr)
static PyObject * Object_GetUnpaid(Crossfire_Object *whoptr, void *closure)
static int Object_SetConfused(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetName(Crossfire_Object *whoptr, void *closure)
#define FLAG_WIZ
Definition: define.h:231
#define FLAG_BEEN_APPLIED
Definition: define.h:324
static PyObject * Object_GetAnimSpeed(Crossfire_Object *whoptr, void *closure)
static int Object_SetGodGiven(Crossfire_Object *whoptr, PyObject *value, void *closure)
object * cf_object_find_by_arch_name(const object *who, const char *name)
static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetLevel(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetPickable(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetLastGrace(Crossfire_Object *whoptr, void *closure)
static PyObject * Player_GiveKnowledge(Crossfire_Player *who, PyObject *args)
static int Object_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetAnim(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetSpeed(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args)
#define FLAG_CAST_SPELL
Definition: define.h:291
void cf_object_set_movetype_property(object *op, int propcode, MoveType value)
#define CFAPI_OBJECT_PROP_EXP
Definition: plugin.h:241
mapstruct * cf_object_get_map_property(object *op, int propcode)
PyObject * who
Definition: cfpython.h:116
static PyObject * Object_GetDam(Crossfire_Object *whoptr, void *closure)
void cf_object_remove(object *op)
static PyObject * Crossfire_Object_Move(Crossfire_Object *who, PyObject *args)
#define FLAG_RUN_AWAY
Definition: define.h:280
static PyObject * Object_GetApplied(Crossfire_Object *whoptr, void *closure)
static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_IS_THROWN
Definition: define.h:249
void add_ptr_assoc(ptr_assoc **hash_table, void *key, void *value)
Definition: hashtable.c:109
signed __int64 int64_t
Definition: win32.h:168
static const flag_definition flags[]
int cf_object_apply(object *op, object *author, int flags)
void init_ptr_assoc_table(ptr_assoc **hash_table)
Definition: hashtable.c:57
#define CFAPI_OBJECT_PROP_PERM_EXP
Definition: plugin.h:221
static PyObject * Object_GetReflectMissiles(Crossfire_Object *whoptr, void *closure)
#define EXISTCHECK_INT(ob)
static PyObject * Object_GetKnownCursed(Crossfire_Object *whoptr, void *closure)
int cf_quest_was_completed(object *pl, sstring quest_code)
#define FLAG_KNOWN_CURSED
Definition: define.h:321
void cf_player_set_party(object *op, partylist *party)
object * cf_object_get_object_property(object *op, int propcode)
const char * sstring
Definition: global.h:40
PyTypeObject Crossfire_PlayerType
static PyObject * Object_GetHitBack(Crossfire_Object *whoptr, void *closure)
static int Player_SetMarkedItem(Crossfire_Player *whoptr, PyObject *value, void *closure)
#define FLAG_CURSED
Definition: define.h:317
#define CFAPI_OBJECT_PROP_DAM
Definition: plugin.h:264
Definition: object.h:107
#define CFAPI_OBJECT_PROP_MOVE_TYPE
Definition: plugin.h:271
#define CFAPI_OBJECT_PROP_SKILL
Definition: plugin.h:186
static int Object_SetRunAway(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetWeight(Crossfire_Object *whoptr, PyObject *value, void *closure)
void cf_player_message(object *op, char *txt, int flags)
#define CFAPI_OBJECT_PROP_AC
Definition: plugin.h:256
static int Object_SetFacing(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_ANIMATE
Definition: define.h:242
int cf_object_pay_amount(object *pl, uint64_t to_pay)
#define FLAG_NO_DAMAGE
Definition: define.h:364
static PyObject * Object_GetPickable(Crossfire_Object *whoptr, void *closure)
static int Object_SetName(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_GENERATOR
Definition: define.h:248
static PyObject * Player_QuestStart(Crossfire_Player *whoptr, PyObject *args)
static PyObject * Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args)
char * cf_player_get_title(object *op, char *title, int size)
static PyObject * Object_GetMoveSlowPenalty(Crossfire_Object *whoptr, void *closure)
#define FLAG_BLIND
Definition: define.h:337
static PyObject * Object_GetMoveAllow(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMoveSlow(Crossfire_Object *whoptr, void *closure)
int cf_object_get_flag(object *ob, int flag)
#define TYPEEXISTCHECK(ob)
static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure)
void cf_object_set_int64_property(object *op, int propcode, int64_t value)
static PyObject * Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args)
#define MAX_NPC
Definition: dialog.h:46
#define CFAPI_OBJECT_PROP_SPEED_LEFT
Definition: plugin.h:192
int cf_object_move(object *op, int dir, object *originator)
static PyObject * Object_GetCanUseBow(Crossfire_Object *whoptr, void *closure)
static int Object_SetSpeedLeft(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetAttackMovement(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetLastSP(Crossfire_Object *whoptr, void *closure)
tag_t count
Definition: object.h:299
sstring cf_player_get_ip(object *op)
static PyObject * Object_GetCanCastSpell(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_HP
Definition: plugin.h:257
#define CFAPI_OBJECT_PROP_TITLE
Definition: plugin.h:183
static int Object_SetGrace(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_PLAYER_PROP_BED_Y
Definition: plugin.h:286
static PyObject * Object_GetWeight(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_SPEED
Definition: plugin.h:191
uint8_t type
Definition: object.h:338
static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_FRIENDLY
Definition: plugin.h:236
static PyObject * Object_GetSubtype(Crossfire_Object *whoptr, void *closure)
void cf_object_change_exp(object *op, int64_t exp, const char *skill_name, int flag)
static PyObject * Object_GetWasDM(Crossfire_Object *whoptr, void *closure)
struct talk_info * talk
Definition: cfpython.h:127
#define CFAPI_OBJECT_PROP_ANIM_SPEED
Definition: plugin.h:235
void cf_object_pickup(object *op, object *what)
#define FLAG_SPLITTING
Definition: define.h:266
void cf_object_drop(object *op, object *author)
#define CFAPI_OBJECT_PROP_LUCK
Definition: plugin.h:240
static PyGetSetDef Object_getseters[]
#define FLAG_APPLIED
Definition: define.h:235
#define NROFATTACKS
Definition: attack.h:17
#define CFAPI_OBJECT_PROP_ARCH_NAME
Definition: plugin.h:266
static PyObject * Object_GetBlind(Crossfire_Object *whoptr, void *closure)
#define FLAG_LIFESAVE
Definition: define.h:306
#define CFAPI_OBJECT_PROP_DEX
Definition: plugin.h:249
static PyObject * Object_GetSpeedLeft(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_ATTACK_MOVEMENT
Definition: plugin.h:229
static int Object_SetTurnable(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Say(Crossfire_Object *who, PyObject *args)
void free_ptr_assoc(ptr_assoc **hash_table, void *key)
Definition: hashtable.c:222
#define FLAG_MAKE_INVIS
Definition: define.h:329
#define CFAPI_OBJECT_PROP_CON
Definition: plugin.h:250
static PyObject * Object_GetSleeping(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetDM(Crossfire_Object *whoptr, void *closure)
#define FLAG_STARTEQUIP
Definition: define.h:268
static void Crossfire_Player_dealloc(PyObject *obj)
void init_object_assoc_table(void)
static PyObject * Object_GetBeenApplied(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetRace(Crossfire_Object *whoptr, void *closure)
static int Object_SetCanSeeInDark(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define Py_TYPE(ob)
Definition: cfpython.h:66
#define CFAPI_OBJECT_PROP_NROF
Definition: plugin.h:193
static PyObject * Object_GetKnownMagical(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetSkill(Crossfire_Object *whoptr, void *closure)
void cf_player_set_title(object *op, const char *title)
static PyObject * Object_GetPermExp(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_MAXSP
Definition: plugin.h:262
static PyObject * Object_GetGod(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetNoSave(Crossfire_Object *whoptr, void *closure)
#define FLAG_MONSTER
Definition: define.h:245
int cf_quest_get_player_state(object *pl, sstring quest_code)
#define NDI_UNIQUE
Definition: newclient.h:245
PyObject * Crossfire_Archetype_wrap(archetype *what)
object * cf_object_check_for_spell(object *op, const char *name)
static PyObject * Object_GetCanUseRing(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_INVISIBLE
Definition: plugin.h:267
static int Object_SetStr(Crossfire_Object *whoptr, PyObject *value, void *closure)
sstring npc_msgs[MAX_NPC]
Definition: dialog.h:60
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
static PyObject * Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_TYPE
Definition: plugin.h:196
static int Object_SetUnaggressive(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Clone(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_POW
Definition: plugin.h:253
static PyObject * Player_KnowledgeKnown(Crossfire_Player *who, PyObject *args)
static PyObject * Player_QuestWasCompleted(Crossfire_Player *whoptr, PyObject *args)
static int Object_SetMaxHP(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetDex(Crossfire_Object *whoptr, void *closure)
#define FLAG_WAS_WIZ
Definition: define.h:234
static int Object_SetDamned(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMaxSP(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define MAX_NAME
Definition: define.h:41
#define CFAPI_OBJECT_PROP_GLOW_RADIUS
Definition: plugin.h:220
static PyObject * Object_GetLifesaver(Crossfire_Object *whoptr, void *closure)
archetype * cf_object_get_archetype_property(object *op, int propcode)
static int Object_SetDex(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetAnim(Crossfire_Object *whoptr, PyObject *value, void *closure)
void cf_object_set_string_property(object *op, int propcode, const char *value)
#define CFAPI_OBJECT_PROP_WC
Definition: plugin.h:255
static int Object_SetOnlyAttack(Crossfire_Object *whoptr, PyObject *value, void *closure)
static void free_object_assoc(object *key)
void cf_object_set_long_property(object *op, int propcode, long value)
static int Object_SetMoveOn(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetAnimated(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetFriendly(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyNumberMethods ObjectConvert
#define CFAPI_OBJECT_PROP_MOVE_SLOW
Definition: plugin.h:276
#define CFAPI_OBJECT_PROP_MATERIAL_NAME
Definition: plugin.h:205
static PyObject * Player_GetIP(Crossfire_Player *whoptr, void *closure)
static int Object_SetRollable(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCanUseWand(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetHasXRays(Crossfire_Object *whoptr, void *closure)
Definition: map.h:325
#define CF_IS_PYSTR(cfpy_obj)
Definition: cfpython.h:80
PyTypeObject Crossfire_MapType
Definition: cfpython_map.c:551
#define CFAPI_OBJECT_PROP_MAXHP
Definition: plugin.h:261
static PyObject * Object_GetLuck(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetEnv(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetCanUseArmour(Crossfire_Object *whoptr, void *closure)
int cf_object_out_of_map(object *op, int x, int y)
#define FLAG_UNIQUE
Definition: define.h:288
#define FLAG_NO_PICK
Definition: define.h:239
int cf_object_change_abil(object *op, object *tmp)
static PyObject * Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args)
static PyObject * Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args)
static int Object_SetCon(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_VALUE
Definition: plugin.h:207
static PyObject * Player_GetMarkedItem(Crossfire_Player *whoptr, void *closure)
#define FLAG_REFL_MISSILE
Definition: define.h:273
static PyObject * Object_GetUnique(Crossfire_Object *whoptr, void *closure)
static int Object_SetCanSeeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMessage(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetValue(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_WIS
Definition: plugin.h:251
#define CFAPI_OBJECT_PROP_DURATION
Definition: plugin.h:278
static PyObject * Object_GetRandomMovement(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_OB_ABOVE
Definition: plugin.h:171
object * cf_create_object_by_name(const char *name)
char * cf_query_name(object *ob, char *name, int size)
int cf_object_move_to(object *op, int x, int y)
static PyObject * Player_QuestSetState(Crossfire_Player *whoptr, PyObject *args)
static PyObject * Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_Y
Definition: plugin.h:190
#define EXISTCHECK(ob)
static PyObject * Object_GetCon(Crossfire_Object *whoptr, void *closure)
#define FLAG_USE_BOW
Definition: define.h:294
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
static PyObject * Object_GetOnlyAttack(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMaxSP(Crossfire_Object *whoptr, void *closure)
static int Object_SetWis(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetIsPet(Crossfire_Object *whoptr, void *closure)
static int Object_SetSleeping(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetAnimSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetGenerator(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetAlive(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetX(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_MOVE_BLOCK
Definition: plugin.h:272
static PyObject * Object_GetTitle(Crossfire_Object *whoptr, void *closure)
void cf_object_set_object_property(object *op, int propcode, object *value)
static PyObject * Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetWC(Crossfire_Object *whoptr, void *closure)
object * cf_object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
static PyObject * Object_GetStandStill(Crossfire_Object *whoptr, void *closure)
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)
static PyObject * Object_GetSplitting(Crossfire_Object *whoptr, void *closure)
#define FLAG_IS_TURNABLE
Definition: define.h:256