Crossfire Server, Trunk  R20513
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_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1465  char *face;
1466 
1467  EXISTCHECK_INT(whoptr);
1468  if (!PyArg_Parse(value, "s", &face))
1469  return -1;
1470 
1471  if (!cf_object_set_face(whoptr->obj, face)) {
1472  PyErr_SetString(PyExc_TypeError, "Unknown face.");
1473  return -1;
1474  }
1475  return 0;
1476 }
1477 
1478 static int Object_SetAnim(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1479  char *anim;
1480 
1481  EXISTCHECK_INT(whoptr);
1482  if (!PyArg_Parse(value, "s", &anim))
1483  return -1;
1484 
1485  if (!cf_object_set_animation(whoptr->obj, anim)) {
1486  PyErr_SetString(PyExc_TypeError, "Unknown animation.");
1487  return -1;
1488  }
1489 
1490  return 0;
1491 }
1492 
1493 static int Object_SetAnimSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1494  int val;
1495 
1496  EXISTCHECK_INT(whoptr);
1497  if (!PyArg_Parse(value, "i", &val))
1498  return -1;
1499 
1501  return 0;
1502 }
1503 
1504 static int Object_SetAttackType(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 /* cf_fix_object(whoptr->obj);*/
1513  return 0;
1514 }
1515 
1516 static int Object_SetIdentified(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1517  int val;
1518 
1519  EXISTCHECK_INT(whoptr);
1520  if (!PyArg_Parse(value, "i", &val))
1521  return -1;
1522 
1523  cf_object_set_flag(whoptr->obj, FLAG_IDENTIFIED, val);
1524  return 0;
1525 }
1526 
1527 static int Object_SetAlive(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_ALIVE, val);
1535  return 0;
1536 }
1537 
1538 static int Object_SetUnaggressive(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_UNAGGRESSIVE, val);
1546  return 0;
1547 }
1548 
1549 static int Object_SetPickable(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_NO_PICK, !val);
1557  return 0;
1558 }
1559 
1560 static int Object_SetInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1561  int val;
1562 
1563  EXISTCHECK_INT(whoptr);
1564  if (!PyArg_ParseTuple(value, "i", &val))
1565  return -1;
1566 
1568  return 0;
1569 }
1570 
1571 static int Object_SetUnpaid(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1572  int val;
1573 
1574  EXISTCHECK_INT(whoptr);
1575  if (!PyArg_Parse(value, "i", &val))
1576  return -1;
1577 
1578  cf_object_set_flag(whoptr->obj, FLAG_UNPAID, val);
1579  return 0;
1580 }
1581 
1582 static int Object_SetFriendly(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_FRIENDLY, val);
1590  return 0;
1591 }
1592 
1593 static int Object_SetCanSeeInvisible(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_SEE_INVISIBLE, val);
1601  return 0;
1602 }
1603 
1604 static int Object_SetRollable(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_CAN_ROLL, val);
1612  return 0;
1613 }
1614 
1615 static int Object_SetTurnable(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_IS_TURNABLE, val);
1623  return 0;
1624 }
1625 
1626 static int Object_SetUsedUp(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_USED_UP, val);
1634  return 0;
1635 }
1636 
1637 static int Object_SetBlind(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_BLIND, val);
1645  return 0;
1646 }
1647 
1648 static int Object_SetKnownCursed(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_KNOWN_CURSED, val);
1656  return 0;
1657 }
1658 
1659 static int Object_SetStealthy(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_STEALTH, val);
1667  return 0;
1668 }
1669 
1670 static int Object_SetConfused(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_CONFUSED, val);
1678  return 0;
1679 }
1680 
1681 static int Object_SetSleeping(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_SLEEP, val);
1689  return 0;
1690 }
1691 
1692 static int Object_SetLifesaver(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_LIFESAVE, val);
1700  return 0;
1701 }
1702 
1703 static int Object_SetHasXRays(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_XRAYS, val);
1711  return 0;
1712 }
1713 
1714 static int Object_SetCanSeeInDark(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_SEE_IN_DARK, val);
1722  return 0;
1723 }
1724 
1725 static int Object_SetKnownMagical(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_KNOWN_MAGICAL, val);
1733  return 0;
1734 }
1735 
1736 static int Object_SetReflectSpells(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_REFL_SPELL, val);
1744  return 0;
1745 }
1746 
1747 static int Object_SetReflectMissiles(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_MISSILE, val);
1755  return 0;
1756 }
1757 
1758 static int Object_SetUnique(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_UNIQUE, val);
1766  return 0;
1767 }
1768 
1769 static int Object_SetRunAway(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_RUN_AWAY, val);
1777  return 0;
1778 }
1779 
1780 static int Object_SetScared(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_SCARED, val);
1788  return 0;
1789 }
1790 
1791 static int Object_SetUndead(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_UNDEAD, val);
1799  return 0;
1800 }
1801 
1802 static int Object_SetBlocksView(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_BLOCKSVIEW, val);
1810  return 0;
1811 }
1812 
1813 static int Object_SetHitBack(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_HITBACK, val);
1821  return 0;
1822 }
1823 
1824 static int Object_SetStandStill(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_STAND_STILL, val);
1832  return 0;
1833 }
1834 
1835 static int Object_SetOnlyAttack(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_ONLY_ATTACK, val);
1843  return 0;
1844 }
1845 
1846 static int Object_SetMakeInvisible(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_MAKE_INVIS, val);
1854  return 0;
1855 }
1856 
1857 static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1858  long val;
1859 
1860  EXISTCHECK_INT(whoptr);
1861  if (!PyArg_Parse(value, "l", &val))
1862  return -1;
1863 
1865  return 0;
1866 }
1867 
1868 static int Object_SetNoSave(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1869  long val;
1870 
1871  EXISTCHECK_INT(whoptr);
1872  if (!PyArg_Parse(value, "i", &val))
1873  return -1;
1874 
1875  cf_object_set_flag(whoptr->obj, FLAG_NO_SAVE, val);
1876  return 0;
1877 }
1878 
1879 static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1880  Crossfire_Object *ob;
1881 
1882  EXISTCHECK_INT(whoptr);
1883  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
1884  return -1;
1886  return 0;
1887 }
1888 
1889 static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1890  Crossfire_Object *ob;
1891 
1892  EXISTCHECK_INT(whoptr);
1893  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
1894  return -1;
1896  return 0;
1897 }
1898 
1899 static int Object_SetGodGiven(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1900  int val;
1901 
1902  EXISTCHECK_INT(whoptr);
1903  if (!PyArg_Parse(value, "i", &val))
1904  return -1;
1905 
1906  cf_object_set_flag(whoptr->obj, FLAG_STARTEQUIP, val);
1907  return 0;
1908 }
1909 
1910 static int Object_SetNoDamage(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_NO_DAMAGE, val);
1918  return 0;
1919 }
1920 
1921 static int Object_SetRandomMovement(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_RANDOM_MOVE, val);
1929  return 0;
1930 }
1931 
1932 static int Object_SetIsPet(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 
1940  return 0;
1941 }
1942 
1943 static int Object_SetAttackMovement(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_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1955  int64_t val;
1956 
1957  EXISTCHECK_INT(whoptr);
1958  if (!PyArg_Parse(value, "L", &val))
1959  return -1;
1960 
1962  return 0;
1963 }
1964 
1965 static int Object_SetDuration(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1966  int val;
1967 
1968  EXISTCHECK_INT(whoptr);
1969  if (!PyArg_Parse(value, "i", &val))
1970  return -1;
1971 
1973  return 0;
1974 }
1975 
1976 static int Object_SetGlowRadius(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_SetAnimated(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  cf_object_set_flag(whoptr->obj, FLAG_ANIMATE, val);
1994  return 0;
1995 }
1996 
1997 static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1998  MoveType move;
1999 
2000  EXISTCHECK_INT(whoptr);
2001  if (!PyArg_Parse(value, "B", &move))
2002  return -1;
2004  return 0;
2005 }
2006 
2007 static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2008  MoveType move;
2009 
2010  EXISTCHECK_INT(whoptr);
2011  if (!PyArg_Parse(value, "B", &move))
2012  return -1;
2014  return 0;
2015 }
2016 
2017 static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2018  MoveType move;
2019 
2020  EXISTCHECK_INT(whoptr);
2021  if (!PyArg_Parse(value, "B", &move))
2022  return -1;
2024  return 0;
2025 }
2026 
2027 static int Object_SetMoveOn(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2028  MoveType move;
2029 
2030  EXISTCHECK_INT(whoptr);
2031  if (!PyArg_Parse(value, "B", &move))
2032  return -1;
2034  return 0;
2035 }
2036 
2037 static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2038  MoveType move;
2039 
2040  EXISTCHECK_INT(whoptr);
2041  if (!PyArg_Parse(value, "B", &move))
2042  return -1;
2044  return 0;
2045 }
2046 
2047 static int Object_SetMoveSlow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2048  MoveType move;
2049 
2050  EXISTCHECK_INT(whoptr);
2051  if (!PyArg_Parse(value, "B", &move))
2052  return -1;
2054  return 0;
2055 }
2056 
2057 
2058 /* Methods. */
2059 
2060 static PyObject *Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args) {
2061  EXISTCHECK(who);
2062 
2063  if ((current_context->who != NULL) && (((Crossfire_Object *)current_context->who)->obj == who->obj))
2064  current_context->who = NULL;
2065 
2066  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
2067  cf_object_remove(who->obj);
2068  }
2069 
2071  Py_INCREF(Py_None);
2072  return Py_None;
2073 }
2074 
2075 static PyObject *Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args) {
2076  Crossfire_Object *whoptr;
2077  int flags;
2078 
2079  if (!PyArg_ParseTuple(args, "O!i", &Crossfire_ObjectType, &whoptr, &flags))
2080  return NULL;
2081  EXISTCHECK(who);
2082  EXISTCHECK(whoptr);
2083 
2084  return Py_BuildValue("i", cf_object_apply(whoptr->obj, who->obj, flags));
2085 }
2086 
2087 static PyObject *Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args) {
2088  /* Note that this function uses the METH_O calling convention. */
2089  Crossfire_Object *whoptr = (Crossfire_Object*)args;
2090 
2091  EXISTCHECK(who);
2092  TYPEEXISTCHECK(whoptr);
2093 
2094  cf_object_drop(whoptr->obj, who->obj);
2095  Py_INCREF(Py_None);
2096  return Py_None;
2097 }
2098 
2099 static PyObject *Crossfire_Object_Clone(Crossfire_Object *who, PyObject *args) {
2100  int clone_type;
2101  object *clone;
2102 
2103  if (!PyArg_ParseTuple(args, "i", &clone_type))
2104  return NULL;
2105 
2106  if (clone_type != 0 && clone_type != 1)
2107  {
2108  PyErr_SetString(PyExc_ValueError, "Clone type must be 0 (object_create_clone) or 1 (object_copy).");
2109  return NULL;
2110  }
2111 
2112  clone = cf_object_clone(who->obj, clone_type);
2113 
2114  if (clone == NULL)
2115  {
2116  PyErr_SetString(PyExc_RuntimeError, "Clone failed.");
2117  return NULL;
2118  }
2119 
2120  return Crossfire_Object_wrap(clone);
2121 }
2122 
2123 static PyObject *Crossfire_Object_Split(Crossfire_Object *who, PyObject *args) {
2124  int count;
2125  char err[255];
2126  object *split;
2127 
2128  err[0] = '\0'; /* Just in case. */
2129 
2130  if (!PyArg_ParseTuple(args, "i", &count))
2131  return NULL;
2132 
2133  split = cf_object_split(who->obj, count, err, 255);
2134 
2135  if (split == NULL)
2136  {
2137  PyErr_SetString(PyExc_ValueError, err);
2138  return NULL;
2139  }
2140 
2141  return Crossfire_Object_wrap(split);
2142 }
2143 
2144 static PyObject *Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args) {
2145  cf_fix_object(who->obj);
2146  Py_INCREF(Py_None);
2147  return Py_None;
2148 }
2149 
2150 static PyObject *Crossfire_Object_Take(Crossfire_Object *who, PyObject *args) {
2151  /* Note that this function uses the METH_O calling convention. */
2152  Crossfire_Object *whoptr = (Crossfire_Object*)args;
2153 
2154  EXISTCHECK(who);
2155  TYPEEXISTCHECK(whoptr);
2156 
2157  cf_object_pickup(who->obj, whoptr->obj);
2158  Py_INCREF(Py_None);
2159  return Py_None;
2160 }
2161 
2162 static PyObject *Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args) {
2163  Crossfire_Map *where;
2164  int x, y;
2165  int val;
2166 
2167  EXISTCHECK(who);
2168  if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_MapType, &where, &x, &y))
2169  return NULL;
2170 
2171  val = cf_object_teleport(who->obj, where->map, x, y);
2172 
2173  return Py_BuildValue("i", val);
2174 }
2175 
2176 static PyObject *Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args) {
2177  /* Note that this function uses the METH_O calling convention. */
2178  object *trap;
2179  object *victim;
2180  Crossfire_Object *pcause = (Crossfire_Object*)args;
2181 
2182  EXISTCHECK(who);
2183  TYPEEXISTCHECK(pcause);
2184  trap = who->obj;
2185  victim = pcause->obj;
2186  cf_spring_trap(trap, victim);
2187  Py_INCREF(Py_None);
2188  return Py_None;
2189 }
2190 
2191 static PyObject *Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args) {
2192  /* Note that this function uses the METH_O calling convention. */
2193  object *trigger;
2194  object *cause;
2195  int result;
2196  Crossfire_Object *pcause = (Crossfire_Object*)args;
2197 
2198  EXISTCHECK(who);
2199  TYPEEXISTCHECK(pcause);
2200  trigger = who->obj;
2201  cause = pcause->obj;
2202  result = cf_object_check_trigger(trigger, cause);
2203 
2204  return Py_BuildValue("i", result);
2205 }
2206 
2207 static PyObject *Crossfire_Object_Say(Crossfire_Object *who, PyObject *args) {
2208  char *message, buf[2048];
2209 
2210  EXISTCHECK(who);
2211  if (!PyArg_ParseTuple(args, "s", &message))
2212  return NULL;
2213 
2214  /* compatibility */
2215  if (current_context->talk == NULL) {
2216  cf_object_say(who->obj, message);
2217  Py_INCREF(Py_None);
2218  return Py_None;
2219  }
2220 
2222  PyErr_SetString(PyExc_ValueError, "too many NPCs");
2223  return NULL;
2224  }
2225 
2226  if (strlen(message) >= sizeof(buf) - 1)
2227  cf_log(llevError, "warning, too long message in npcSay, will be truncated");
2229  snprintf(buf, sizeof(buf), "%s says: %s", who->obj->name, message);
2230 
2233 
2234  Py_INCREF(Py_None);
2235  return Py_None;
2236 
2237 }
2238 
2239 static PyObject *Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args) {
2240  int x, y;
2241 
2242  EXISTCHECK(who);
2243  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2244  return NULL;
2245 
2246  cf_object_transfer(who->obj, x, y, 0, NULL);
2247  Py_INCREF(Py_None);
2248  return Py_None;
2249 }
2250 
2251 static PyObject *Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args) {
2252  char name[200];
2253 
2254  EXISTCHECK(who);
2255  return Py_BuildValue("s", cf_query_name(who->obj, name, sizeof(name)));
2256 }
2257 
2258 static PyObject *Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args) {
2259  int resist;
2260 
2261  EXISTCHECK(who);
2262  if (!PyArg_ParseTuple(args, "i", &resist))
2263  return NULL;
2264  if ((resist < 0) || (resist >= NROFATTACKS)) {
2265  return Py_BuildValue("l", 0);
2266  }
2267  return Py_BuildValue("i", cf_object_get_resistance(who->obj, resist));
2268 }
2269 
2270 static PyObject *Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args) {
2271  int resist, value;
2272 
2273  EXISTCHECK(who);
2274  if (!PyArg_ParseTuple(args, "ii", &resist, &value))
2275  return NULL;
2276  if ((resist >= 0) && (resist < NROFATTACKS))
2277  cf_object_set_resistance(who->obj, resist, value);
2278  Py_INCREF(Py_None);
2279  return Py_None;
2280 }
2281 
2282 static PyObject *Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args) {
2283  int dir;
2284  char *op;
2285  Crossfire_Object *pspell;
2286 
2287  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &op))
2288  return NULL;
2289  EXISTCHECK(who);
2290  EXISTCHECK(pspell);
2291 
2292  cf_object_cast_spell(who->obj, who->obj, dir, pspell->obj, op);
2293 
2294  Py_INCREF(Py_None);
2295  return Py_None;
2296 }
2297 
2298 static PyObject *Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args) {
2299  /* Note that this function uses the METH_O calling convention. */
2300  Crossfire_Object *pspell = (Crossfire_Object*)args;
2301 
2302  EXISTCHECK(who);
2303  TYPEEXISTCHECK(pspell);
2304 
2305  cf_object_learn_spell(who->obj, pspell->obj, 0);
2306 
2307  Py_INCREF(Py_None);
2308  return Py_None;
2309 }
2310 
2311 static PyObject *Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args) {
2312  /* Note that this function uses the METH_O calling convention. */
2313  Crossfire_Object *pspell = (Crossfire_Object*)args;
2314 
2315  EXISTCHECK(who);
2316  TYPEEXISTCHECK(pspell);
2317 
2318  cf_object_forget_spell(who->obj, pspell->obj);
2319  Py_INCREF(Py_None);
2320  return Py_None;
2321 }
2322 
2323 static PyObject *Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args) {
2324  char *spellname;
2325  object *op;
2326 
2327  EXISTCHECK(who);
2328  if (!PyArg_ParseTuple(args, "s", &spellname))
2329  return NULL;
2330 
2331  op = cf_object_check_for_spell(who->obj, spellname);
2332 
2333  return Crossfire_Object_wrap(op);
2334 }
2335 
2336 static PyObject *Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args) {
2337  Crossfire_Object *pspell;
2338  int dir;
2339  char *str;
2340 
2341  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &str))
2342  return NULL;
2343  EXISTCHECK(who);
2344  EXISTCHECK(pspell);
2345 
2346  cf_object_cast_ability(who->obj, who->obj, dir, pspell->obj, str);
2347 
2348  Py_INCREF(Py_None);
2349  return Py_None;
2350 }
2351 
2352 static PyObject *Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args) {
2353  uint64_t to_pay;
2354  int val;
2355 
2356  EXISTCHECK(who);
2357  if (!PyArg_ParseTuple(args, "L", &to_pay))
2358  return NULL;
2359 
2360  val = cf_object_pay_amount(who->obj, to_pay);
2361 
2362  return Py_BuildValue("i", val);
2363 }
2364 
2365 static PyObject *Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args) {
2366  /* Note that this function uses the METH_O calling convention. */
2367  Crossfire_Object *op = (Crossfire_Object*)args;
2368  int val;
2369 
2370  EXISTCHECK(who);
2371  TYPEEXISTCHECK(op);
2372 
2373  val = cf_object_pay_item(who->obj, op->obj);
2374 
2375  return Py_BuildValue("i", val);
2376 }
2377 
2378 static PyObject *Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args) {
2379  const char *val;
2380  char *keyname;
2381 
2382  EXISTCHECK(who);
2383  if (!PyArg_ParseTuple(args, "s", &keyname))
2384  return NULL;
2385 
2386  val = cf_object_get_key(who->obj, keyname);
2387 
2388  return Py_BuildValue("s", val ? val : "");
2389 }
2390 
2391 static PyObject *Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args) {
2392  char *keyname;
2393  char *value;
2394  int add_key = 0;
2395 
2396  EXISTCHECK(who);
2397  if (!PyArg_ParseTuple(args, "ss|i", &keyname, &value, &add_key))
2398  return NULL;
2399 
2400  return Py_BuildValue("i", cf_object_set_key(who->obj, keyname, value, add_key));
2401 }
2402 
2403 static PyObject *Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args) {
2404  int mode;
2405  long delay;
2406 
2407  EXISTCHECK(who);
2408  if (!PyArg_ParseTuple(args, "li", &delay, &mode))
2409  return NULL;
2410 
2411  return Py_BuildValue("i", cf_timer_create(who->obj, delay, mode));
2412 }
2413 
2414 static PyObject *Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args) {
2415  char *whatstr;
2416  object *foundob;
2417 
2418  EXISTCHECK(who);
2419  if (!PyArg_ParseTuple(args, "s", &whatstr))
2420  return NULL;
2421 
2422  foundob = cf_object_present_archname_inside(who->obj, whatstr);
2423 
2424  return Crossfire_Object_wrap(foundob);
2425 /* FOR_INV_PREPARE(WHO, tmp) {
2426  if (!strncmp(PyQueryName(tmp), whatstr, strlen(whatstr))) {
2427  return Py_BuildValue("l", (long)(tmp));
2428  }
2429  if (!strncmp(tmp->name, whatstr, strlen(whatstr))) {
2430  return Py_BuildValue("l", (long)(tmp));
2431  }
2432  } FOR_INV_FINISH();
2433 
2434  return Py_BuildValue("l", (long)0);*/
2435 }
2436 
2437 static PyObject *Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args) {
2438  char *whatstr;
2439  object *tmp;
2440 
2441  EXISTCHECK(who);
2442  if (!PyArg_ParseTuple(args, "s", &whatstr))
2443  return NULL;
2444 
2445  tmp = cf_object_find_by_arch_name(who->obj, whatstr);
2446  return Crossfire_Object_wrap(tmp);
2447 }
2448 
2449 static PyObject *Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args) {
2450  int x, y;
2451 
2452  EXISTCHECK(who);
2453  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2454  return NULL;
2455 
2456  return Py_BuildValue("i", cf_object_out_of_map(who->obj, x, y));
2457 }
2458 
2459 static PyObject *Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args) {
2460  char *txt;
2461  object *myob;
2462 
2463  EXISTCHECK(who);
2464  if (!PyArg_ParseTuple(args, "s", &txt))
2465  return NULL;
2466 
2467  myob = cf_create_object_by_name(txt);
2468  if (myob)
2469  myob = cf_object_insert_object(myob, who->obj);
2470 
2471  return Crossfire_Object_wrap(myob);
2472 }
2473 
2474 static PyObject *Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args) {
2475  /* Note that this function uses the METH_O calling convention. */
2476  Crossfire_Object *op = (Crossfire_Object*)args;
2477  object *myob;
2478 
2479  EXISTCHECK(who);
2480  TYPEEXISTCHECK(op);
2481 
2482  /* we can only insert removed object, so first remove it
2483  * from it's current container
2484  */
2485  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
2486  cf_object_remove(who->obj);
2487  }
2488  myob = cf_object_insert_in_ob(who->obj, op->obj);
2489 
2490  return Crossfire_Object_wrap(myob);
2491 }
2492 
2493 static PyObject *Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args) {
2494  /* Note that this function uses the METH_O calling convention. */
2495  Crossfire_Object *op = (Crossfire_Object*)args;
2496 
2497  EXISTCHECK(who);
2498  TYPEEXISTCHECK(op);
2499 
2500  return Py_BuildValue("i", cf_object_change_abil(who->obj, op->obj));
2501 }
2502 
2503 static PyObject *Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args) {
2504  int64_t exp;
2505  const char *skill = NULL;
2506  int arg = 0;
2507 
2508  if (!PyArg_ParseTuple(args, "L|si", &exp, &skill, &arg))
2509  return NULL;
2510  EXISTCHECK(who);
2511  cf_object_change_exp(who->obj, exp, skill, arg);
2512  Py_INCREF(Py_None);
2513  return Py_None;
2514 }
2515 
2516 static PyObject *Crossfire_Object_Move(Crossfire_Object *who, PyObject *args) {
2517  int dir;
2518 
2519  if (!PyArg_ParseTuple(args, "i", &dir))
2520  return NULL;
2521  EXISTCHECK(who);
2522  return Py_BuildValue("i", cf_object_move(who->obj, dir, who->obj));
2523 }
2524 
2525 static PyObject *Crossfire_Object_MoveTo(Crossfire_Object *who, PyObject *args) {
2526  int x,y;
2527 
2528  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2529  return NULL;
2530  EXISTCHECK(who);
2531  return Py_BuildValue("i", cf_object_move_to(who->obj, x, y));
2532 }
2533 
2534 static PyObject *Crossfire_Object_Event(Crossfire_Object *who, PyObject *args) {
2535  int fix;
2536  const char *message = NULL;
2537  object *op1 = NULL;
2538  object *op2 = NULL;
2539  object *op3 = NULL;
2540  Crossfire_Object *activator = NULL;
2541  Crossfire_Object *third = NULL;
2542 
2543  if (!PyArg_ParseTuple(args, "O!O!si", &Crossfire_ObjectType, &activator, &Crossfire_ObjectType, &third, &message, &fix))
2544  return NULL;
2545  EXISTCHECK(who);
2546  EXISTCHECK(activator);
2547  EXISTCHECK(third);
2548  op1 = who->obj;
2549  op2 = activator->obj;
2550  op3 = third->obj;
2551  return Py_BuildValue("i", cf_object_user_event(op1, op2, op3, message, fix));
2552 }
2553 
2554 static PyObject *Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args) {
2555  int level;
2556 
2557  if (!PyArg_ParseTuple(args, "i", &level))
2558  return NULL;
2559  EXISTCHECK(who);
2560 
2561  return Py_BuildValue("i", cf_object_remove_depletion(who->obj, level));
2562 }
2563 
2564 static PyObject *Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args) {
2565  EXISTCHECK(who);
2566  return Py_BuildValue("i", cf_player_arrest(who->obj));
2567 }
2568 
2570  EXISTCHECK_INT(left);
2571  EXISTCHECK_INT(right);
2572  return (left->obj < right->obj ? -1 : (left->obj == right->obj ? 0 : 1));
2573 }
2574 
2575 static PyObject *Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op) {
2576  int result;
2577  if (!left
2578  || !right
2579  || !PyObject_TypeCheck((PyObject*)left, &Crossfire_ObjectType)
2580  || !PyObject_TypeCheck((PyObject*)right, &Crossfire_ObjectType)) {
2581  Py_INCREF(Py_NotImplemented);
2582  return Py_NotImplemented;
2583  }
2584  result = Crossfire_Object_InternalCompare(left, right);
2585  /* Handle removed objects. */
2586  if (result == -1 && PyErr_Occurred())
2587  return NULL;
2588  /* Based on how Python 3.0 (GPL compatible) implements it for internal types: */
2589  switch (op) {
2590  case Py_EQ:
2591  result = (result == 0);
2592  break;
2593  case Py_NE:
2594  result = (result != 0);
2595  break;
2596  case Py_LE:
2597  result = (result <= 0);
2598  break;
2599  case Py_GE:
2600  result = (result >= 0);
2601  break;
2602  case Py_LT:
2603  result = (result == -1);
2604  break;
2605  case Py_GT:
2606  result = (result == 1);
2607  break;
2608  }
2609  return PyBool_FromLong(result);
2610 }
2611 
2612 /* Legacy code: convert to long so that non-object functions work correctly */
2613 static PyObject *Crossfire_Object_Long(PyObject *obj) {
2614  return Py_BuildValue("l", ((Crossfire_Object *)obj)->obj);
2615 }
2616 
2617 #ifndef IS_PY3K
2618 static PyObject *Crossfire_Object_Int(PyObject *obj) {
2619  return Py_BuildValue("i", ((Crossfire_Object *)obj)->obj);
2620 }
2621 #endif
2622 
2623 /* Python binding */
2624 static PyGetSetDef Object_getseters[] = {
2625  { "Name", (getter)Object_GetName, (setter)Object_SetName, NULL, NULL },
2626  { "NamePl", (getter)Object_GetNamePl, (setter)Object_SetNamePl, NULL, NULL },
2627  { "Title", (getter)Object_GetTitle, (setter)Object_SetTitle, NULL, NULL },
2628  { "Race", (getter)Object_GetRace, (setter)Object_SetRace, NULL, NULL },
2629  { "Skill", (getter)Object_GetSkill, (setter)Object_SetSkill, NULL, NULL },
2630  { "Map", (getter)Object_GetMap, (setter)Object_SetMap, NULL, NULL },
2631  { "Cha", (getter)Object_GetCha, (setter)Object_SetCha, NULL, NULL },
2632  { "Con", (getter)Object_GetCon, (setter)Object_SetCon, NULL, NULL },
2633  { "Dex", (getter)Object_GetDex, (setter)Object_SetDex, NULL, NULL },
2634  { "Int", (getter)Object_GetInt, (setter)Object_SetInt, NULL, NULL },
2635  { "Pow", (getter)Object_GetPow, (setter)Object_SetPow, NULL, NULL },
2636  { "Str", (getter)Object_GetStr, (setter)Object_SetStr, NULL, NULL },
2637  { "Wis", (getter)Object_GetWis, (setter)Object_SetWis, NULL, NULL },
2638  { "HP", (getter)Object_GetHP, (setter)Object_SetHP, NULL, NULL },
2639  { "MaxHP", (getter)Object_GetMaxHP, (setter)Object_SetMaxHP, NULL, NULL },
2640  { "SP", (getter)Object_GetSP, (setter)Object_SetSP, NULL, NULL },
2641  { "MaxSP", (getter)Object_GetMaxSP, (setter)Object_SetMaxSP, NULL, NULL },
2642  { "Grace", (getter)Object_GetGrace, (setter)Object_SetGrace, NULL, NULL },
2643  { "MaxGrace", (getter)Object_GetMaxGrace, (setter)Object_SetMaxGrace, NULL, NULL },
2644  { "Food", (getter)Object_GetFood, (setter)Object_SetFood, NULL, NULL },
2645  { "AC", (getter)Object_GetAC, (setter)Object_SetAC, NULL, NULL },
2646  { "WC", (getter)Object_GetWC, (setter)Object_SetWC, NULL, NULL },
2647  { "Dam", (getter)Object_GetDam, (setter)Object_SetDam, NULL, NULL },
2648  { "Luck", (getter)Object_GetLuck, NULL, NULL, NULL },
2649  { "Exp", (getter)Object_GetExp, (setter)Object_SetExp, NULL, NULL },
2650  { "ExpMul", (getter)Object_GetExpMul, NULL, NULL, NULL },
2651  { "PermExp", (getter)Object_GetPermExp, NULL, NULL, NULL },
2652  { "Message", (getter)Object_GetMessage, (setter)Object_SetMessage, NULL, NULL },
2653  { "Slaying", (getter)Object_GetSlaying, (setter)Object_SetSlaying, NULL, NULL },
2654  { "Cursed", (getter)Object_GetCursed, (setter)Object_SetCursed, NULL, NULL },
2655  { "Damned", (getter)Object_GetDamned, (setter)Object_SetDamned, NULL, NULL },
2656  { "Weight", (getter)Object_GetWeight, (setter)Object_SetWeight, NULL, NULL },
2657  { "WeightLimit", (getter)Object_GetWeightLimit, (setter)Object_SetWeightLimit, NULL, NULL },
2658  { "Above", (getter)Object_GetAbove, NULL, NULL, NULL },
2659  { "Below", (getter)Object_GetBelow, NULL, NULL, NULL },
2660  { "Inventory", (getter)Object_GetInventory, NULL, NULL, NULL },
2661  { "X", (getter)Object_GetX, NULL, NULL, NULL },
2662  { "Y", (getter)Object_GetY, NULL, NULL, NULL },
2663  { "Direction", (getter)Object_GetDirection, (setter)Object_SetDirection, NULL, NULL },
2664  { "Facing", (getter)Object_GetFacing, (setter)Object_SetFacing, NULL, NULL },
2665  { "Unaggressive", (getter)Object_GetUnaggressive, (setter)Object_SetUnaggressive, NULL, NULL },
2666  { "God", (getter)Object_GetGod, (setter)Object_SetGod, NULL, NULL },
2667  { "Pickable", (getter)Object_GetPickable, (setter)Object_SetPickable, NULL, NULL },
2668  { "Quantity", (getter)Object_GetQuantity, (setter)Object_SetQuantity, NULL, NULL },
2669  { "Invisible", (getter)Object_GetInvisible, (setter)Object_SetInvisible, NULL, NULL },
2670  { "Speed", (getter)Object_GetSpeed, (setter)Object_SetSpeed, NULL, NULL },
2671  { "SpeedLeft", (getter)Object_GetSpeedLeft, (setter)Object_SetSpeedLeft, NULL, NULL },
2672  { "LastSP", (getter)Object_GetLastSP, (setter)Object_SetLastSP, NULL, NULL },
2673  { "LastGrace", (getter)Object_GetLastGrace, (setter)Object_SetLastGrace, NULL, NULL },
2674  { "LastEat", (getter)Object_GetLastEat, (setter)Object_SetLastEat, NULL, NULL },
2675  { "Level", (getter)Object_GetLevel, NULL, NULL, NULL },
2676  { "Face", (getter)Object_GetFace, (setter)Object_SetFace, NULL, NULL },
2677  { "Anim", (getter)Object_GetAnim, (setter)Object_SetAnim, NULL, NULL },
2678  { "AnimSpeed", (getter)Object_GetAnimSpeed, (setter)Object_SetAnimSpeed, NULL, NULL },
2679  { "AttackType", (getter)Object_GetAttackType, (setter)Object_SetAttackType, NULL, NULL },
2680  { "BeenApplied", (getter)Object_GetBeenApplied, NULL, NULL, NULL },
2681  { "Identified", (getter)Object_GetIdentified, (setter)Object_SetIdentified, NULL, NULL },
2682  { "Alive", (getter)Object_GetAlive, (setter)Object_SetAlive, NULL, NULL },
2683  { "DungeonMaster", (getter)Object_GetDM, NULL, NULL, NULL },
2684  { "WasDungeonMaster", (getter)Object_GetWasDM, NULL, NULL, NULL },
2685  { "Applied", (getter)Object_GetApplied, (setter)Object_SetApplied, NULL, NULL },
2686  { "Unpaid", (getter)Object_GetUnpaid, (setter)Object_SetUnpaid, NULL, NULL },
2687  { "Monster", (getter)Object_GetMonster, NULL, NULL, NULL },
2688  { "Friendly", (getter)Object_GetFriendly, (setter)Object_SetFriendly, NULL, NULL },
2689  { "Generator", (getter)Object_GetGenerator, NULL, NULL, NULL },
2690  { "Thrown", (getter)Object_GetThrown, NULL, NULL, NULL },
2691  { "CanSeeInvisible", (getter)Object_GetCanSeeInvisible, (setter)Object_SetCanSeeInvisible, NULL, NULL },
2692  { "Rollable", (getter)Object_GetRollable, (setter)Object_SetRollable, NULL, NULL },
2693  { "Turnable", (getter)Object_GetTurnable, (setter)Object_SetTurnable, NULL, NULL },
2694  { "UsedUp", (getter)Object_GetUsedUp, (setter)Object_SetUsedUp, NULL, NULL },
2695  { "Splitting", (getter)Object_GetSplitting, NULL, NULL, NULL },
2696  { "Blind", (getter)Object_GetBlind, (setter)Object_SetBlind, NULL, NULL },
2697  { "CanUseSkill", (getter)Object_GetCanUseSkill, NULL, NULL, NULL },
2698  { "KnownCursed", (getter)Object_GetKnownCursed, (setter)Object_SetKnownCursed, NULL, NULL },
2699  { "Stealthy", (getter)Object_GetStealthy, (setter)Object_SetStealthy, NULL, NULL },
2700  { "Confused", (getter)Object_GetConfused, (setter)Object_SetConfused, NULL, NULL },
2701  { "Sleeping", (getter)Object_GetSleeping, (setter)Object_SetSleeping, NULL, NULL },
2702  { "Lifesaver", (getter)Object_GetLifesaver, (setter)Object_SetLifesaver, NULL, NULL },
2703  { "Floor", (getter)Object_GetFloor, NULL, NULL, NULL },
2704  { "HasXRays", (getter)Object_GetHasXRays, (setter)Object_SetHasXRays, NULL, NULL },
2705  { "CanUseRing", (getter)Object_GetCanUseRing, NULL, NULL, NULL },
2706  { "CanUseBow", (getter)Object_GetCanUseBow, NULL, NULL, NULL },
2707  { "CanUseWand", (getter)Object_GetCanUseWand, NULL, NULL, NULL },
2708  { "CanSeeInDark", (getter)Object_GetCanSeeInDark, (setter)Object_SetCanSeeInDark, NULL, NULL },
2709  { "KnownMagical", (getter)Object_GetKnownMagical, (setter)Object_SetKnownMagical, NULL, NULL },
2710  { "CanUseWeapon", (getter)Object_GetCanUseWeapon, NULL, NULL, NULL },
2711  { "CanUseArmour", (getter)Object_GetCanUseArmour, NULL, NULL, NULL },
2712  { "CanUseScroll", (getter)Object_GetCanUseScroll, NULL, NULL, NULL },
2713  { "CanCastSpell", (getter)Object_GetCanCastSpell, NULL, NULL, NULL },
2714  { "ReflectSpells", (getter)Object_GetReflectSpells, (setter)Object_SetReflectSpells, NULL, NULL },
2715  { "ReflectMissiles", (getter)Object_GetReflectMissiles, (setter)Object_SetReflectMissiles, NULL, NULL },
2716  { "Unique", (getter)Object_GetUnique, (setter)Object_SetUnique, NULL, NULL },
2717  { "RunAway", (getter)Object_GetRunAway, (setter)Object_SetRunAway, NULL, NULL },
2718  { "Scared", (getter)Object_GetScared, (setter)Object_SetScared, NULL, NULL },
2719  { "Undead", (getter)Object_GetUndead, (setter)Object_SetUndead, NULL, NULL },
2720  { "BlocksView", (getter)Object_GetBlocksView, (setter)Object_SetBlocksView, NULL, NULL },
2721  { "HitBack", (getter)Object_GetHitBack, (setter)Object_SetHitBack, NULL, NULL },
2722  { "StandStill", (getter)Object_GetStandStill, (setter)Object_SetStandStill, NULL, NULL },
2723  { "OnlyAttack", (getter)Object_GetOnlyAttack, (setter)Object_SetOnlyAttack, NULL, NULL },
2724  { "MakeInvisible", (getter)Object_GetMakeInvisible, (setter)Object_SetMakeInvisible, NULL, NULL },
2725  { "Money", (getter)Object_GetMoney, NULL, NULL, NULL },
2726  { "Type", (getter)Object_GetType, NULL, NULL, NULL },
2727  { "Subtype", (getter)Object_GetSubtype, NULL, NULL, NULL },
2728  { "Value", (getter)Object_GetValue, (setter)Object_SetValue, NULL, NULL },
2729  { "ArchName", (getter)Object_GetArchName, NULL, NULL, NULL },
2730  { "Archetype", (getter)Object_GetArchetype, NULL, NULL, NULL },
2731  { "OtherArchetype", (getter)Object_GetOtherArchetype,NULL, NULL, NULL },
2732  { "Exists", (getter)Object_GetExists, NULL, NULL, NULL },
2733  { "NoSave", (getter)Object_GetNoSave, (setter)Object_SetNoSave, NULL, NULL },
2734  { "Env", (getter)Object_GetEnv, NULL, NULL, NULL },
2735  { "MoveType", (getter)Object_GetMoveType, (setter)Object_SetMoveType, NULL, NULL },
2736  { "MoveBlock", (getter)Object_GetMoveBlock, (setter)Object_SetMoveBlock, NULL, NULL },
2737  { "MoveAllow", (getter)Object_GetMoveAllow, (setter)Object_SetMoveAllow, NULL, NULL },
2738  { "MoveOn", (getter)Object_GetMoveOn, (setter)Object_SetMoveOn, NULL, NULL },
2739  { "MoveOff", (getter)Object_GetMoveOff, (setter)Object_SetMoveOff, NULL, NULL },
2740  { "MoveSlow", (getter)Object_GetMoveSlow, (setter)Object_SetMoveSlow, NULL, NULL },
2741  { "MoveSlowPenalty", (getter)Object_GetMoveSlowPenalty, NULL, NULL, NULL },
2742  { "Owner", (getter)Object_GetOwner, (setter)Object_SetOwner, NULL, NULL },
2743  { "Enemy", (getter)Object_GetEnemy, (setter)Object_SetEnemy, NULL, NULL },
2744  { "Count", (getter)Object_GetCount, NULL, NULL, NULL },
2745  { "GodGiven", (getter)Object_GetGodGiven, (setter)Object_SetGodGiven, NULL, NULL },
2746  { "IsPet", (getter)Object_GetIsPet, (setter)Object_SetIsPet, NULL, NULL },
2747  { "AttackMovement", (getter)Object_GetAttackMovement, (setter)Object_SetAttackMovement, NULL, NULL },
2748  { "Duration", (getter)Object_GetDuration, (setter)Object_SetDuration, NULL, NULL },
2749  { "GlowRadius", (getter)Object_GetGlowRadius, (setter)Object_SetGlowRadius, NULL, NULL },
2750  { "Animated", (getter)Object_GetAnimated, (setter)Object_SetAnimated, NULL, NULL },
2751  { "NoDamage", (getter)Object_GetNoDamage, (setter)Object_SetNoDamage, NULL, NULL },
2752  { "RandomMovement", (getter)Object_GetRandomMovement, (setter)Object_SetRandomMovement, NULL, NULL },
2753  { "Material", (getter)Object_GetMaterial, NULL, NULL, NULL },
2754  { "Container", (getter)Object_GetContainer, NULL, NULL, NULL },
2755  { NULL, NULL, NULL, NULL, NULL }
2756 };
2757 
2758 static PyMethodDef ObjectMethods[] = {
2759  { "Remove", (PyCFunction)Crossfire_Object_Remove, METH_NOARGS, NULL },
2760  { "Apply", (PyCFunction)Crossfire_Object_Apply, METH_VARARGS, NULL },
2761  { "Drop", (PyCFunction)Crossfire_Object_Drop, METH_O, NULL },
2762  { "Clone", (PyCFunction)Crossfire_Object_Clone, METH_VARARGS, NULL },
2763  { "Split", (PyCFunction)Crossfire_Object_Split, METH_VARARGS, NULL },
2764  { "Fix", (PyCFunction)Crossfire_Object_Fix, METH_NOARGS, NULL },
2765  { "Say", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
2766  { "Speak", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
2767  { "Take", (PyCFunction)Crossfire_Object_Take, METH_O, NULL },
2768  { "Teleport", (PyCFunction)Crossfire_Object_Teleport, METH_VARARGS, NULL },
2769  { "Reposition", (PyCFunction)Crossfire_Object_Reposition, METH_VARARGS, NULL },
2770  { "QueryName", (PyCFunction)Crossfire_Object_QueryName, METH_NOARGS, NULL },
2771  { "GetResist", (PyCFunction)Crossfire_Object_GetResist, METH_VARARGS, NULL },
2772  { "SetResist", (PyCFunction)Crossfire_Object_SetResist, METH_VARARGS, NULL },
2773  { "ActivateRune", (PyCFunction)Crossfire_Object_ActivateRune, METH_O, NULL },
2774  { "CheckTrigger", (PyCFunction)Crossfire_Object_CheckTrigger, METH_O, NULL },
2775  { "Cast", (PyCFunction)Crossfire_Object_Cast, METH_VARARGS, NULL },
2776  { "LearnSpell", (PyCFunction)Crossfire_Object_LearnSpell, METH_O, NULL },
2777  { "ForgetSpell", (PyCFunction)Crossfire_Object_ForgetSpell, METH_O, NULL },
2778  { "KnowSpell", (PyCFunction)Crossfire_Object_KnowSpell, METH_VARARGS, NULL },
2779  { "CastAbility", (PyCFunction)Crossfire_Object_CastAbility, METH_VARARGS, NULL },
2780  { "PayAmount", (PyCFunction)Crossfire_Object_PayAmount, METH_VARARGS, NULL },
2781  { "Pay", (PyCFunction)Crossfire_Object_Pay, METH_O, NULL },
2782  { "CheckInventory", (PyCFunction)Crossfire_Object_CheckInventory, METH_VARARGS, NULL },
2783  { "CheckArchInventory", (PyCFunction)Crossfire_Object_CheckArchInventory, METH_VARARGS, NULL },
2784  { "OutOfMap", (PyCFunction)Crossfire_Object_GetOutOfMap, METH_VARARGS, NULL },
2785  { "CreateObject", (PyCFunction)Crossfire_Object_CreateInside, METH_VARARGS, NULL },
2786  { "InsertInto", (PyCFunction)Crossfire_Object_InsertInto, METH_O, NULL },
2787  { "ReadKey", (PyCFunction)Crossfire_Object_ReadKey, METH_VARARGS, NULL },
2788  { "WriteKey", (PyCFunction)Crossfire_Object_WriteKey, METH_VARARGS, NULL },
2789  { "CreateTimer", (PyCFunction)Crossfire_Object_CreateTimer, METH_VARARGS, NULL },
2790  { "AddExp", (PyCFunction)Crossfire_Object_AddExp, METH_VARARGS, NULL },
2791  { "Move", (PyCFunction)Crossfire_Object_Move, METH_VARARGS, NULL },
2792  { "MoveTo", (PyCFunction)Crossfire_Object_MoveTo, METH_VARARGS, NULL },
2793  { "ChangeAbil", (PyCFunction)Crossfire_Object_ChangeAbil, METH_O, NULL },
2794  { "Event", (PyCFunction)Crossfire_Object_Event, METH_VARARGS, NULL },
2795  { "RemoveDepletion",(PyCFunction)Crossfire_Object_RemoveDepletion, METH_VARARGS, NULL },
2796  { "Arrest", (PyCFunction)Crossfire_Object_Arrest, METH_VARARGS, NULL },
2797  { NULL, NULL, 0, NULL }
2798 };
2799 
2800 static PyNumberMethods ObjectConvert = {
2801  NULL, /* binaryfunc nb_add; */ /* __add__ */
2802  NULL, /* binaryfunc nb_subtract; */ /* __sub__ */
2803  NULL, /* binaryfunc nb_multiply; */ /* __mul__ */
2804 #ifndef IS_PY3K
2805  NULL, /* binaryfunc nb_divide; */ /* __div__ */
2806 #endif
2807  NULL, /* binaryfunc nb_remainder; */ /* __mod__ */
2808  NULL, /* binaryfunc nb_divmod; */ /* __divmod__ */
2809  NULL, /* ternaryfunc nb_power; */ /* __pow__ */
2810  NULL, /* unaryfunc nb_negative; */ /* __neg__ */
2811  NULL, /* unaryfunc nb_positive; */ /* __pos__ */
2812  NULL, /* unaryfunc nb_absolute; */ /* __abs__ */
2813 #ifdef IS_PY3K
2814  NULL, /* inquiry nb_bool; */ /* __bool__ */
2815 #else
2816  NULL, /* inquiry nb_nonzero; */ /* __nonzero__ */
2817 #endif
2818  NULL, /* unaryfunc nb_invert; */ /* __invert__ */
2819  NULL, /* binaryfunc nb_lshift; */ /* __lshift__ */
2820  NULL, /* binaryfunc nb_rshift; */ /* __rshift__ */
2821  NULL, /* binaryfunc nb_and; */ /* __and__ */
2822  NULL, /* binaryfunc nb_xor; */ /* __xor__ */
2823  NULL, /* binaryfunc nb_or; */ /* __or__ */
2824 #ifndef IS_PY3K
2825  NULL, /* coercion nb_coerce; */ /* __coerce__ */
2826 #endif
2827 #ifdef IS_PY3K
2828  /* This is not a typo. For Py3k it should be Crossfire_Object_Long
2829  * and NOT Crossfire_Object_Int.
2830  */
2831  Crossfire_Object_Long, /* unaryfunc nb_int; */ /* __int__ */
2832  NULL, /* void *nb_reserved; */
2833 #else
2834  Crossfire_Object_Int, /* unaryfunc nb_int; */ /* __int__ */
2835  Crossfire_Object_Long, /* unaryfunc nb_long; */ /* __long__ */
2836 #endif
2837  NULL, /* unaryfunc nb_float; */ /* __float__ */
2838 #ifndef IS_PY3K
2839  NULL, /* unaryfunc nb_oct; */ /* __oct__ */
2840  NULL, /* unaryfunc nb_hex; */ /* __hex__ */
2841 #endif
2842  NULL, /* binaryfunc nb_inplace_add; */
2843  NULL, /* binaryfunc nb_inplace_subtract; */
2844  NULL, /* binaryfunc nb_inplace_multiply; */
2845 #ifndef IS_PY3K
2846  NULL, /* binaryfunc nb_inplace_divide; */
2847 #endif
2848  NULL, /* binaryfunc nb_inplace_remainder; */
2849  NULL, /* ternaryfunc nb_inplace_power; */
2850  NULL, /* binaryfunc nb_inplace_lshift; */
2851  NULL, /* binaryfunc nb_inplace_rshift; */
2852  NULL, /* binaryfunc nb_inplace_and; */
2853  NULL, /* binaryfunc nb_inplace_xor; */
2854  NULL, /* binaryfunc nb_inplace_or; */
2855 
2856  NULL, /* binaryfunc nb_floor_divide; */
2857  NULL, /* binaryfunc nb_true_divide; */
2858  NULL, /* binaryfunc nb_inplace_floor_divide; */
2859  NULL, /* binaryfunc nb_inplace_true_divide; */
2860 #if defined(IS_PY25) || defined(IS_PY3K)
2861  NULL /* unaryfunc nb_index; */
2862 #endif
2863 };
2864 
2865 static PyObject *Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
2866  Crossfire_Object *self;
2867 
2868  self = (Crossfire_Object *)type->tp_alloc(type, 0);
2869  if (self) {
2870  self->obj = NULL;
2871  self->count = 0;
2872  }
2873 
2874  return (PyObject *)self;
2875 }
2876 
2877 static void Crossfire_Object_dealloc(PyObject *obj) {
2878  Crossfire_Object *self;
2879 
2880  self = (Crossfire_Object *)obj;
2881  if (self) {
2882  if (self->obj) {
2883  free_object_assoc(self->obj);
2884  }
2885  Py_TYPE(self)->tp_free(obj);
2886  }
2887 }
2888 
2889 static PyObject *Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
2890  Crossfire_Player *self;
2891 
2892  self = (Crossfire_Player *)type->tp_alloc(type, 0);
2893  if (self) {
2894  self->obj = NULL;
2895  self->count = 0;
2896  }
2897 
2898  return (PyObject *)self;
2899 }
2900 
2901 static void Crossfire_Player_dealloc(PyObject *obj) {
2902  Crossfire_Player *self;
2903 
2904  self = (Crossfire_Player *)obj;
2905  if (self) {
2906  if (self->obj) {
2907  free_object_assoc(self->obj);
2908  }
2909  Py_TYPE(self)->tp_free(obj);
2910  }
2911 }
2912 
2913 /* Our actual Python ObjectType */
2914 PyTypeObject Crossfire_ObjectType = {
2915 #ifdef IS_PY3K
2916  /* See http://bugs.python.org/issue4385 */
2917  PyVarObject_HEAD_INIT(NULL, 0)
2918 #else
2919  PyObject_HEAD_INIT(NULL)
2920  0, /* ob_size*/
2921 #endif
2922  "Crossfire.Object", /* tp_name*/
2923  sizeof(Crossfire_Object), /* tp_basicsize*/
2924  0, /* tp_itemsize*/
2925  Crossfire_Object_dealloc, /* tp_dealloc*/
2926  NULL, /* tp_print*/
2927  NULL, /* tp_getattr*/
2928  NULL, /* tp_setattr*/
2929 #ifdef IS_PY3K
2930  NULL, /* tp_reserved */
2931 #else
2932  (cmpfunc)Crossfire_Object_InternalCompare, /* tp_compare*/
2933 #endif
2934  NULL, /* tp_repr*/
2935  &ObjectConvert, /* tp_as_number*/
2936  NULL, /* tp_as_sequence*/
2937  NULL, /* tp_as_mapping*/
2938  PyObject_HashNotImplemented, /* tp_hash */
2939  NULL, /* tp_call*/
2940  NULL, /* tp_str*/
2941  PyObject_GenericGetAttr, /* tp_getattro*/
2942  PyObject_GenericSetAttr, /* tp_setattro*/
2943  NULL, /* tp_as_buffer*/
2944  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags*/
2945  "Crossfire objects", /* tp_doc */
2946  NULL, /* tp_traverse */
2947  NULL, /* tp_clear */
2948  (richcmpfunc)Crossfire_Object_RichCompare, /* tp_richcompare */
2949  0, /* tp_weaklistoffset */
2950  NULL, /* tp_iter */
2951  NULL, /* tp_iternext */
2952  ObjectMethods, /* tp_methods */
2953  NULL, /* tp_members */
2954  Object_getseters, /* tp_getset */
2955  NULL, /* tp_base */
2956  NULL, /* tp_dict */
2957  NULL, /* tp_descr_get */
2958  NULL, /* tp_descr_set */
2959  0, /* tp_dictoffset */
2960  NULL, /* tp_init */
2961  NULL, /* tp_alloc */
2962  Crossfire_Object_new, /* tp_new */
2963  NULL, /* tp_free */
2964  NULL, /* tp_is_gc */
2965  NULL, /* tp_bases */
2966  NULL, /* tp_mro */
2967  NULL, /* tp_cache */
2968  NULL, /* tp_subclasses */
2969  NULL, /* tp_weaklist */
2970  NULL, /* tp_del */
2971 };
2972 
2973 static PyGetSetDef Player_getseters[] = {
2974  { "Title", (getter)Player_GetTitle, (setter)Player_SetTitle, NULL, NULL },
2975  { "IP", (getter)Player_GetIP, NULL, NULL, NULL },
2976  { "MarkedItem", (getter)Player_GetMarkedItem, (setter)Player_SetMarkedItem, NULL, NULL },
2977  { "Party", (getter)Player_GetParty, (setter)Player_SetParty, NULL, NULL },
2978  { "BedMap", (getter)Player_GetBedMap, (setter)Player_SetBedMap, NULL, NULL },
2979  { "BedX", (getter)Player_GetBedX, (setter)Player_SetBedX, NULL, NULL },
2980  { "BedY", (getter)Player_GetBedY, (setter)Player_SetBedY, NULL, NULL },
2981  { NULL, NULL, NULL, NULL, NULL }
2982 };
2983 
2984 static PyMethodDef PlayerMethods[] = {
2985  { "Message", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
2986  { "Write", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
2987  { "CanPay", (PyCFunction)Crossfire_Player_CanPay, METH_NOARGS, NULL },
2988  { "QuestStart", (PyCFunction)Player_QuestStart, METH_VARARGS, NULL },
2989  { "QuestGetState", (PyCFunction)Player_QuestGetState, METH_VARARGS, NULL },
2990  { "QuestSetState", (PyCFunction)Player_QuestSetState, METH_VARARGS, NULL },
2991  { "QuestWasCompleted", (PyCFunction)Player_QuestWasCompleted, METH_VARARGS, NULL },
2992  { "KnowledgeKnown", (PyCFunction)Player_KnowledgeKnown, METH_VARARGS, NULL },
2993  { "GiveKnowledge", (PyCFunction)Player_GiveKnowledge, METH_VARARGS, NULL },
2994  { NULL, NULL, 0, NULL }
2995 };
2996 
2997 /* Our actual Python ObjectPlayerType */
2998 PyTypeObject Crossfire_PlayerType = {
2999 #ifdef IS_PY3K
3000  /* See http://bugs.python.org/issue4385 */
3001  PyVarObject_HEAD_INIT(NULL, 0)
3002 #else
3003  PyObject_HEAD_INIT(NULL)
3004  0, /* ob_size*/
3005 #endif
3006  "Crossfire.Player", /* tp_name*/
3007  sizeof(Crossfire_Player), /* tp_basicsize*/
3008  0, /* tp_itemsize*/
3009  Crossfire_Player_dealloc, /* tp_dealloc*/
3010  NULL, /* tp_print*/
3011  NULL, /* tp_getattr*/
3012  NULL, /* tp_setattr*/
3013  NULL, /* tp_compare*/
3014  NULL, /* tp_repr*/
3015  NULL, /* tp_as_number*/
3016  NULL, /* tp_as_sequence*/
3017  NULL, /* tp_as_mapping*/
3018  /* Should be NULL to inherit tp_richcompare and tp_compare from Crossfire_ObjectType. */
3019  NULL, /* tp_hash */
3020  NULL, /* tp_call*/
3021  NULL, /* tp_str*/
3022  PyObject_GenericGetAttr, /* tp_getattro*/
3023  PyObject_GenericSetAttr, /* tp_setattro*/
3024  NULL, /* tp_as_buffer*/
3025  Py_TPFLAGS_DEFAULT, /* tp_flags*/
3026  "Crossfire player", /* tp_doc */
3027  NULL, /* tp_traverse */
3028  NULL, /* tp_clear */
3029  NULL, /* tp_richcompare */
3030  0, /* tp_weaklistoffset */
3031  NULL, /* tp_iter */
3032  NULL, /* tp_iternext */
3033  PlayerMethods, /* tp_methods */
3034  NULL, /* tp_members */
3035  Player_getseters, /* tp_getset */
3036  &Crossfire_ObjectType, /* tp_base */
3037  NULL, /* tp_dict */
3038  NULL, /* tp_descr_get */
3039  NULL, /* tp_descr_set */
3040  0, /* tp_dictoffset */
3041  NULL, /* tp_init */
3042  NULL, /* tp_alloc */
3043  Crossfire_Player_new, /* tp_new */
3044  NULL, /* tp_free */
3045  NULL, /* tp_is_gc */
3046  NULL, /* tp_bases */
3047  NULL, /* tp_mro */
3048  NULL, /* tp_cache */
3049  NULL, /* tp_subclasses */
3050  NULL, /* tp_weaklist */
3051  NULL, /* tp_del */
3052 };
3053 
3057 PyObject *Crossfire_Object_wrap(object *what) {
3058  Crossfire_Object *wrapper;
3059  Crossfire_Player *plwrap;
3060  PyObject *pyobj;
3061 
3062  /* return None if no object was to be wrapped */
3063  if (what == NULL) {
3064  Py_INCREF(Py_None);
3065  return Py_None;
3066  }
3067 
3068  pyobj = find_assoc_pyobject(what);
3069  if ((!pyobj) || (object_was_destroyed(((Crossfire_Object *)pyobj)->obj, ((Crossfire_Object *)pyobj)->count))) {
3070  if (what->type == PLAYER) {
3071  plwrap = PyObject_NEW(Crossfire_Player, &Crossfire_PlayerType);
3072  if (plwrap != NULL) {
3073  plwrap->obj = what;
3074  plwrap->count = what->count;
3075  }
3076  pyobj = (PyObject *)plwrap;
3077  } else {
3078  wrapper = PyObject_NEW(Crossfire_Object, &Crossfire_ObjectType);
3079  if (wrapper != NULL) {
3080  wrapper->obj = what;
3081  wrapper->count = what->count;
3082  }
3083  pyobj = (PyObject *)wrapper;
3084  }
3085  add_object_assoc(what, pyobj);
3086  } else {
3087  Py_INCREF(pyobj);
3088  }
3089  return pyobj;
3090 }
#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)
Error, serious thing.
Definition: logger.h:11
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)
Main Crossfire structure, one ingame object.
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
if set ob not effected by darkness
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)
Wrapper for object_free_drop_inventory().
#define CFAPI_OBJECT_PROP_ANIMATION
Definition: plugin.h:269
#define FLAG_DAMNED
The object is very cursed.
Definition: define.h:318
#define FLAG_IS_FLOOR
Can&#39;t see what&#39;s underneath this object.
Definition: define.h:303
int npc_msg_count
How many NPCs reacted to the text being said.
Definition: dialog.h:59
#define FLAG_UNPAID
Object hasn&#39;t been paid for yet.
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:112
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)
Wrapper for knowledge_player_has().
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)
Wrapper for object_insert_in_map_at().
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
NPC is sleeping.
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)
Wrapper for spring_trap().
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
Object will hit back when hit.
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)
Wrapper for free_string().
#define FLAG_USE_SCROLL
(Monster) can read 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)
Should there be a difference nowadays between that and cast_spell ?
static PyObject * Object_GetContainer(Crossfire_Object *whoptr, void *closure)
const char * cf_object_get_key(object *op, const char *keyname)
Gets value for specified key, equivalent of object_get_value().
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
(Monster) can wear armour/shield/helmet
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
When (–food<0) the object will exit.
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
NPC will not (ever) move.
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)
Set the object&#39;s 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)
Information on one title.
Definition: readable.c:106
#define FLAG_FRIENDLY
Will help players.
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)
Wrapper for object_insert_in_ob().
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
Typdef here to define type large enough to hold bitmask of all movement types.
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)
Wrapper for pay_for_item().
#define FLAG_CONFUSED
Will also be unable to cast spells.
Definition: define.h:312
static PyObject * Object_GetUnaggressive(Crossfire_Object *whoptr, void *closure)
static PyMethodDef ObjectMethods[]
#define FLAG_STEALTH
Will wake monsters with less range.
Definition: define.h:313
PyTypeObject Crossfire_PartyType
#define FLAG_RANDOM_MOVE
NPC will move randomly.
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
(Monster) can wield weapons
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)
Wrapper for fix_object().
static PyObject * Object_GetWeightLimit(Crossfire_Object *whoptr, void *closure)
int cf_object_remove_depletion(object *op, int level)
Wrapper for remove_depletion().
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
Definition: object.h:68
static int Object_SetUnique(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_player_arrest(object *who)
Wrapper for player_arrest().
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)
Set the object&#39;s 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)
Wrapper for knowledge_give();.
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)
Wrapper for add_string().
#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
(Monster) can use rings, boots, gauntlets, etc
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
Object is not in any map or invenory.
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)
Wrapper for transfer_ob().
void cf_object_forget_spell(object *op, object *sp)
Wrapper for do_forget_spell(), except takes an object, not a string.
#define CFAPI_OBJECT_PROP_COUNT
Definition: plugin.h:180
#define FLAG_CAN_ROLL
Object can be rolled.
Definition: define.h:254
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
Definition: define.h:320
void cf_log(LogLevel logLevel, const char *format,...)
Wrapper for LOG().
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)
Wrapper for do_learn_spell().
static PyObject * Object_GetStr(Crossfire_Object *whoptr, void *closure)
#define MOVE_ALL
Mask of all movement types.
Definition: define.h:413
static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_object_check_trigger(object *op, object *cause)
Wrapper for check_trigger().
void cf_quest_start(object *pl, sstring quest_code, int state)
Wrapper for quest_start().
static int Object_SetWC(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_SEE_INVISIBLE
Will see invisible player.
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
Monster is 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)
Wrapper for quest_set_player_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)
Wrapper for can_pay().
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)
Creates a timer, equivalent of calling cftimer_create().
#define FLAG_ALIVE
Object can fight (or be fought)
Definition: define.h:230
#define CFAPI_OBJECT_PROP_ENVIRONMENT
Definition: plugin.h:176
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
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
The monster can use skills.
Definition: define.h:322
#define CFAPI_OBJECT_PROP_LEVEL
Definition: plugin.h:208
object * cf_object_clone(object *op, int clonetype)
Clone an object.
#define CFAPI_PLAYER_PROP_BED_MAP
Definition: plugin.h:284
#define FLAG_UNAGGRESSIVE
Monster doesn&#39;t attack players.
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
(Monster) can apply and use range items
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
If set (through plugins), the object is not saved on maps.
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
Player knows full info about item.
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
Object blocks view.
Definition: define.h:269
static PyObject * Object_GetCursed(Crossfire_Object *whoptr, void *closure)
const char * name
The name of the object, obviously...
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)
Python initialized.
#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
Monster is scared (mb player in future)
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)
Find the value associated with a given 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)
Wrapper for query_money().
#define FLAG_ONLY_ATTACK
NPC will evaporate if there is no enemy.
Definition: define.h:311
#define FLAG_XRAYS
X-ray vision.
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)
Kinda wrapper for arch_present_in_ob().
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
Object has special privilegies.
Definition: define.h:231
#define FLAG_BEEN_APPLIED
The object has 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)
Wrapper for object_find_by_arch_name().
static int Object_SetEnemy(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
(Monster) can learn and cast spells
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)
Wrapper for object_remove().
static PyObject * Crossfire_Object_Move(Crossfire_Object *who, PyObject *args)
#define FLAG_RUN_AWAY
Object runs away from nearest player \ but can still attack at a distance.
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
Object is designed to be thrown.
Definition: define.h:249
void add_ptr_assoc(ptr_assoc **hash_table, void *key, void *value)
Adds a value to a hash table which one can lookup with key.
Definition: hashtable.c:109
signed __int64 int64_t
Definition: win32.h:168
static const flag_definition flags[]
Flag mapping.
int cf_object_apply(object *op, object *author, int flags)
Wrapper for apply_manual().
void init_ptr_assoc_table(ptr_assoc **hash_table)
Initialises the hash table for a pointer association 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)
Wrapper for quest_was_completed().
#define FLAG_KNOWN_CURSED
The object is known to be 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
Strings that should be manipulated through add_string() and free_string().
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
The object is cursed.
Definition: define.h:317
#define CFAPI_OBJECT_PROP_DAM
Definition: plugin.h:264
See Player.
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
The object looks at archetype for faces.
Definition: define.h:242
int cf_object_pay_amount(object *pl, uint64_t to_pay)
Wrapper for pay_for_amount().
#define FLAG_NO_DAMAGE
monster can&#39;t be damaged
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
Will generate type ob->stats.food.
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
If set, object cannot see (visually)
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)
This is meant to be used for parameters where you don&#39;t know if the type of the object is correct...
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
How many NPCs maximum will reply to the player.
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
Unique object number for this object.
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
PLAYER, BULLET, etc.
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)
Wrapper for change_exp().
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
Object splits into stats.food other objs.
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
Object is ready for use by living.
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
Saves a players&#39; life once, then destr.
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)
Remove the association with a given key.
Definition: hashtable.c:222
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
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
Object was given to player at start.
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
Will attack players.
Definition: define.h:245
int cf_quest_get_player_state(object *pl, sstring quest_code)
Wrapper for quest_get_player_state().
#define NDI_UNIQUE
Print immediately, don&#39;t buffer.
Definition: newclient.h:245
PyObject * Crossfire_Archetype_wrap(archetype *what)
object * cf_object_check_for_spell(object *op, const char *name)
Wrapper for check_spell_known().
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]
What the NPCs will say.
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
Player was once a 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)
This is a game-map.
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
Item is really unique (UNIQUE_ITEMS)
Definition: define.h:288
#define FLAG_NO_PICK
Object can&#39;t be picked up.
Definition: define.h:239
int cf_object_change_abil(object *op, object *tmp)
Wrapper for change_abil().
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
Arrows will reflect from object.
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)
Setters.
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)
Wrapper for create_archetype() and create_archetype_by_object_name().
char * cf_query_name(object *ob, char *name, int size)
int cf_object_move_to(object *op, int x, int y)
Wrapper for move_to().
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
(Monster) can apply and fire bows
Definition: define.h:294
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Wrapper for cast_spell().
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)
Wrapper for object_split().
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)
Sets a value for specified key, equivalent to object_set_value().
static PyObject * Object_GetSplitting(Crossfire_Object *whoptr, void *closure)
#define FLAG_IS_TURNABLE
Object can change face with direction.
Definition: define.h:256