Crossfire Server, Trunk  R21670
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_GetTotalExp(Crossfire_Object *whoptr, void *closure) {
429  EXISTCHECK(whoptr);
430  return Py_BuildValue("L", cf_object_get_int64_property(whoptr->obj, CFAPI_OBJECT_PROP_TOTAL_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 }
961 static PyObject *Object_GetItemPower(Crossfire_Object *whoptr, void *closure) {
962  EXISTCHECK(whoptr);
963  return Py_BuildValue("i", cf_object_get_int_property(whoptr->obj, CFAPI_OBJECT_PROP_ITEM_POWER));
964 }
966 static int Object_SetMessage(Crossfire_Object *whoptr, PyObject *value, void *closure) {
967  char *val;
968 
969  EXISTCHECK_INT(whoptr);
970  if (value == NULL) {
971  PyErr_SetString(PyExc_TypeError, "Cannot delete the Message attribute");
972  return -1;
973  }
974  if (!CF_IS_PYSTR(value)) {
975  PyErr_SetString(PyExc_TypeError, "The Message attribute must be a string");
976  return -1;
977  }
978  if (!PyArg_Parse(value, "s", &val))
979  return -1;
980 
982  return 0;
983 }
984 
985 static int Object_SetName(Crossfire_Object *whoptr, PyObject *value, void *closure) {
986  char *val;
987 
988  EXISTCHECK_INT(whoptr);
989  if (value == NULL) {
990  PyErr_SetString(PyExc_TypeError, "Cannot delete the Name attribute");
991  return -1;
992  }
993  if (!CF_IS_PYSTR(value)) {
994  PyErr_SetString(PyExc_TypeError, "The Name attribute must be a string");
995  return -1;
996  }
997  if (!PyArg_Parse(value, "s", &val))
998  return -1;
999 
1002  return 0;
1003 }
1004 
1005 static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1006  char *val;
1007 
1008  EXISTCHECK_INT(whoptr);
1009  if (value == NULL) {
1010  PyErr_SetString(PyExc_TypeError, "Cannot delete the NamePl attribute");
1011  return -1;
1012  }
1013  if (!CF_IS_PYSTR(value)) {
1014  PyErr_SetString(PyExc_TypeError, "The NamePl attribute must be a string");
1015  return -1;
1016  }
1017  if (!PyArg_Parse(value, "s", &val))
1018  return -1;
1019 
1021  return 0;
1022 }
1023 
1024 static int Object_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1025  char *val;
1026 
1027  EXISTCHECK_INT(whoptr);
1028  if (value == NULL) {
1029  PyErr_SetString(PyExc_TypeError, "Cannot delete the Title attribute");
1030  return -1;
1031  }
1032  if (!CF_IS_PYSTR(value)) {
1033  PyErr_SetString(PyExc_TypeError, "The Title attribute must be a string");
1034  return -1;
1035  }
1036  if (!PyArg_Parse(value, "s", &val))
1037  return -1;
1038 
1040  return 0;
1041 }
1042 
1043 static int Object_SetRace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1044  char *val;
1045 
1046  EXISTCHECK_INT(whoptr);
1047  if (value == NULL) {
1048  PyErr_SetString(PyExc_TypeError, "Cannot delete the Race attribute");
1049  return -1;
1050  }
1051  if (!CF_IS_PYSTR(value)) {
1052  PyErr_SetString(PyExc_TypeError, "The Race attribute must be a string");
1053  return -1;
1054  }
1055  if (!PyArg_Parse(value, "s", &val))
1056  return -1;
1057 
1059  return 0;
1060 }
1061 
1062 static int Object_SetMap(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1063  Crossfire_Map *val;
1064 
1065  EXISTCHECK_INT(whoptr);
1066  if (!PyArg_Parse(value, "O!", &Crossfire_MapType, &val))
1067  return -1;
1068 
1069  cf_object_change_map(whoptr->obj, val->map, NULL, 0, -1, -1);
1070  return 0;
1071 }
1072 
1073 static int Object_SetSlaying(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1074  char *val;
1075 
1076  EXISTCHECK_INT(whoptr);
1077  if (value == NULL) {
1078  PyErr_SetString(PyExc_TypeError, "Cannot delete the Slaying attribute");
1079  return -1;
1080  }
1081  if (!CF_IS_PYSTR(value)) {
1082  PyErr_SetString(PyExc_TypeError, "The Slaying attribute must be a string");
1083  return -1;
1084  }
1085  if (!PyArg_Parse(value, "s", &val))
1086  return -1;
1087 
1089  return 0;
1090 }
1091 
1092 static int Object_SetSkill(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1093  char *val;
1094 
1095  EXISTCHECK_INT(whoptr);
1096  if (value == NULL) {
1097  PyErr_SetString(PyExc_TypeError, "Cannot delete the Skill attribute");
1098  return -1;
1099  }
1100  if (!CF_IS_PYSTR(value)) {
1101  PyErr_SetString(PyExc_TypeError, "The Skill attribute must be a string");
1102  return -1;
1103  }
1104  if (!PyArg_Parse(value, "s", &val))
1105  return -1;
1106 
1108  return 0;
1109 }
1110 
1111 static int Object_SetCursed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1112  int val;
1113 
1114  EXISTCHECK_INT(whoptr);
1115  if (!PyArg_Parse(value, "i", &val))
1116  return -1;
1117 
1118  cf_object_set_flag(whoptr->obj, FLAG_CURSED, val);
1119  return 0;
1120 }
1121 
1122 static int Object_SetDamned(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1123  int val;
1124 
1125  EXISTCHECK_INT(whoptr);
1126  if (!PyArg_Parse(value, "i", &val))
1127  return -1;
1128 
1129  cf_object_set_flag(whoptr->obj, FLAG_DAMNED, val);
1130  return 0;
1131 }
1132 
1133 static int Object_SetApplied(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1134  int val;
1135 
1136  EXISTCHECK_INT(whoptr);
1137  if (!PyArg_Parse(value, "i", &val))
1138  return -1;
1139 
1140  cf_object_set_flag(whoptr->obj, FLAG_APPLIED, val);
1141  return 0;
1142 }
1143 
1144 static int Object_SetStr(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1145  int val;
1146 
1147  EXISTCHECK_INT(whoptr);
1148  if (!PyArg_Parse(value, "i", &val))
1149  return -1;
1150 
1152 /* cf_fix_object(whoptr->obj);*/
1153  return 0;
1154 }
1155 
1156 static int Object_SetDex(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1157  int val;
1158 
1159  EXISTCHECK_INT(whoptr);
1160  if (!PyArg_Parse(value, "i", &val))
1161  return -1;
1162 
1164  /*cf_fix_object(whoptr->obj);*/
1165  return 0;
1166 }
1167 
1168 static int Object_SetCon(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1169  int val;
1170 
1171  EXISTCHECK_INT(whoptr);
1172  if (!PyArg_Parse(value, "i", &val))
1173  return -1;
1174 
1176  /*cf_fix_object(whoptr->obj);*/
1177  return 0;
1178 }
1179 
1180 static int Object_SetInt(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1181  int val;
1182 
1183  EXISTCHECK_INT(whoptr);
1184  if (!PyArg_Parse(value, "i", &val))
1185  return -1;
1186 
1188  /*cf_fix_object(whoptr->obj);*/
1189  return 0;
1190 }
1191 
1192 static int Object_SetPow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1193  int val;
1194 
1195  EXISTCHECK_INT(whoptr);
1196  if (!PyArg_Parse(value, "i", &val))
1197  return -1;
1198 
1200  /*cf_fix_object(whoptr->obj);*/
1201  return 0;
1202 }
1203 
1204 static int Object_SetWis(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1205  int val;
1206 
1207  EXISTCHECK_INT(whoptr);
1208  if (!PyArg_Parse(value, "i", &val))
1209  return -1;
1210 
1212  /*cf_fix_object(whoptr->obj);*/
1213  return 0;
1214 }
1215 
1216 static int Object_SetCha(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1217  int val;
1218 
1219  EXISTCHECK_INT(whoptr);
1220  if (!PyArg_Parse(value, "i", &val))
1221  return -1;
1222 
1224  /*cf_fix_object(whoptr->obj);*/
1225  return 0;
1226 }
1227 
1228 static int Object_SetHP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1229  int val;
1230 
1231  EXISTCHECK_INT(whoptr);
1232  if (!PyArg_Parse(value, "i", &val))
1233  return -1;
1234 
1236  return 0;
1237 }
1238 
1239 static int Object_SetMaxHP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1240  int val;
1241 
1242  EXISTCHECK_INT(whoptr);
1243  if (!PyArg_Parse(value, "i", &val))
1244  return -1;
1245 
1247  return 0;
1248 }
1249 
1250 static int Object_SetSP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1251  int val;
1252 
1253  EXISTCHECK_INT(whoptr);
1254  if (!PyArg_Parse(value, "i", &val))
1255  return -1;
1256 
1258  return 0;
1259 }
1260 
1261 static int Object_SetMaxSP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1262  int val;
1263 
1264  EXISTCHECK_INT(whoptr);
1265  if (!PyArg_Parse(value, "i", &val))
1266  return -1;
1267 
1269  return 0;
1270 }
1271 
1272 static int Object_SetGrace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1273  int val;
1274 
1275  EXISTCHECK_INT(whoptr);
1276  if (!PyArg_Parse(value, "i", &val))
1277  return -1;
1278 
1280  return 0;
1281 }
1282 
1283 static int Object_SetMaxGrace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1284  int val;
1285 
1286  EXISTCHECK_INT(whoptr);
1287  if (!PyArg_Parse(value, "i", &val))
1288  return -1;
1289 
1291  return 0;
1292 }
1293 
1294 static int Object_SetAC(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1295  int val;
1296 
1297  EXISTCHECK_INT(whoptr);
1298  if (!PyArg_Parse(value, "i", &val))
1299  return -1;
1300 
1302  return 0;
1303 }
1304 
1305 static int Object_SetWC(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1306  int val;
1307 
1308  EXISTCHECK_INT(whoptr);
1309  if (!PyArg_Parse(value, "i", &val))
1310  return -1;
1311 
1313  return 0;
1314 }
1315 
1316 static int Object_SetDam(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1317  int val;
1318 
1319  EXISTCHECK_INT(whoptr);
1320  if (!PyArg_Parse(value, "i", &val))
1321  return -1;
1322 
1324  return 0;
1325 }
1326 
1327 static int Object_SetFood(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1328  int val;
1329 
1330  EXISTCHECK_INT(whoptr);
1331  if (!PyArg_Parse(value, "i", &val))
1332  return -1;
1333 
1335  return 0;
1336 }
1337 
1338 static int Object_SetWeight(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1339  int val;
1340 
1341  EXISTCHECK_INT(whoptr);
1342  if (!PyArg_Parse(value, "i", &val))
1343  return -1;
1344 
1346  return 0;
1347 }
1348 
1349 static int Object_SetWeightLimit(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1350  int val;
1351 
1352  EXISTCHECK_INT(whoptr);
1353  if (!PyArg_Parse(value, "i", &val))
1354  return -1;
1355 
1357  return 0;
1358 }
1359 
1360 static int Object_SetDirection(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1361  int val;
1362 
1363  EXISTCHECK_INT(whoptr);
1364  if (!PyArg_Parse(value, "i", &val))
1365  return -1;
1366 
1368  return 0;
1369 }
1370 
1371 static int Object_SetFacing(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1372  int val;
1373 
1374  EXISTCHECK_INT(whoptr);
1375  if (!PyArg_Parse(value, "i", &val))
1376  return -1;
1377 
1379  return 0;
1380 }
1381 
1382 static int Object_SetGod(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1383  char *val;
1384 
1385  EXISTCHECK_INT(whoptr);
1386  if (!PyArg_Parse(value, "s", &val))
1387  return -1;
1388 
1390  return 0;
1391 }
1392 
1393 static int Object_SetSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1394  float val;
1395 
1396  EXISTCHECK_INT(whoptr);
1397  if (!PyArg_Parse(value, "f", &val))
1398  return -1;
1399 
1401 /* cf_fix_object(whoptr->obj);*/
1402  return 0;
1403 }
1404 
1405 static int Object_SetSpeedLeft(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1406  float val;
1407 
1408  EXISTCHECK_INT(whoptr);
1409  if (!PyArg_Parse(value, "f", &val))
1410  return -1;
1411 
1413 /* cf_fix_object(whoptr->obj);*/
1414  return 0;
1415 }
1416 
1417 static int Object_SetQuantity(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1418  int val;
1419 
1420  EXISTCHECK_INT(whoptr);
1421  if (!PyArg_Parse(value, "i", &val))
1422  return -1;
1423 
1424  if (cf_object_set_nrof(whoptr->obj, val) != 0) {
1425  PyErr_SetString(PyExc_TypeError, "Invalid quantity");
1426  return -1;
1427  }
1428 
1429 /* cf_fix_object(whoptr->obj);*/
1430  return 0;
1431 }
1432 
1433 static int Object_SetLastSP(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1434  int val;
1435 
1436  EXISTCHECK_INT(whoptr);
1437  if (!PyArg_Parse(value, "i", &val))
1438  return -1;
1439 
1441 /* cf_fix_object(whoptr->obj);*/
1442  return 0;
1443 }
1444 
1445 static int Object_SetLastGrace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1446  int val;
1447 
1448  EXISTCHECK_INT(whoptr);
1449  if (!PyArg_Parse(value, "i", &val))
1450  return -1;
1451 
1453 /* cf_fix_object(whoptr->obj);*/
1454  return 0;
1455 }
1456 
1457 static int Object_SetLastEat(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1458  int val;
1459 
1460  EXISTCHECK_INT(whoptr);
1461  if (!PyArg_Parse(value, "i", &val))
1462  return -1;
1463 
1465  return 0;
1466 }
1467 
1468 static int Object_SetLevel(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1469  int val;
1470 
1471  EXISTCHECK_INT(whoptr);
1472  if (!PyArg_Parse(value, "i", &val))
1473  return -1;
1474 
1476  return 0;
1477 }
1478 
1479 static int Object_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1480  char *face;
1481 
1482  EXISTCHECK_INT(whoptr);
1483  if (!PyArg_Parse(value, "s", &face))
1484  return -1;
1485 
1486  if (!cf_object_set_face(whoptr->obj, face)) {
1487  PyErr_SetString(PyExc_TypeError, "Unknown face.");
1488  return -1;
1489  }
1490  return 0;
1491 }
1492 
1493 static int Object_SetAnim(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1494  char *anim;
1495 
1496  EXISTCHECK_INT(whoptr);
1497  if (!PyArg_Parse(value, "s", &anim))
1498  return -1;
1499 
1500  if (!cf_object_set_animation(whoptr->obj, anim)) {
1501  PyErr_SetString(PyExc_TypeError, "Unknown animation.");
1502  return -1;
1503  }
1504 
1505  return 0;
1506 }
1507 
1508 static int Object_SetAnimSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1509  int val;
1510 
1511  EXISTCHECK_INT(whoptr);
1512  if (!PyArg_Parse(value, "i", &val))
1513  return -1;
1514 
1516  return 0;
1517 }
1518 
1519 static int Object_SetAttackType(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1520  int val;
1521 
1522  EXISTCHECK_INT(whoptr);
1523  if (!PyArg_Parse(value, "i", &val))
1524  return -1;
1525 
1527 /* cf_fix_object(whoptr->obj);*/
1528  return 0;
1529 }
1530 
1531 static int Object_SetIdentified(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1532  int val;
1533 
1534  EXISTCHECK_INT(whoptr);
1535  if (!PyArg_Parse(value, "i", &val))
1536  return -1;
1537 
1538  cf_object_set_flag(whoptr->obj, FLAG_IDENTIFIED, val);
1539  return 0;
1540 }
1541 
1542 static int Object_SetAlive(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1543  int val;
1544 
1545  EXISTCHECK_INT(whoptr);
1546  if (!PyArg_Parse(value, "i", &val))
1547  return -1;
1548 
1549  cf_object_set_flag(whoptr->obj, FLAG_ALIVE, val);
1550  return 0;
1551 }
1552 
1553 static int Object_SetUnaggressive(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1554  int val;
1555 
1556  EXISTCHECK_INT(whoptr);
1557  if (!PyArg_Parse(value, "i", &val))
1558  return -1;
1559 
1560  cf_object_set_flag(whoptr->obj, FLAG_UNAGGRESSIVE, val);
1561  return 0;
1562 }
1563 
1564 static int Object_SetPickable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1565  int val;
1566 
1567  EXISTCHECK_INT(whoptr);
1568  if (!PyArg_Parse(value, "i", &val))
1569  return -1;
1570 
1571  cf_object_set_flag(whoptr->obj, FLAG_NO_PICK, !val);
1572  return 0;
1573 }
1574 
1575 static int Object_SetInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1576  int val;
1577 
1578  EXISTCHECK_INT(whoptr);
1579  if (!PyArg_ParseTuple(value, "i", &val))
1580  return -1;
1581 
1583  return 0;
1584 }
1585 
1586 static int Object_SetUnpaid(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1587  int val;
1588 
1589  EXISTCHECK_INT(whoptr);
1590  if (!PyArg_Parse(value, "i", &val))
1591  return -1;
1592 
1593  cf_object_set_flag(whoptr->obj, FLAG_UNPAID, val);
1594  return 0;
1595 }
1596 
1597 static int Object_SetFriendly(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1598  int val;
1599 
1600  EXISTCHECK_INT(whoptr);
1601  if (!PyArg_Parse(value, "i", &val))
1602  return -1;
1603 
1604  cf_object_set_flag(whoptr->obj, FLAG_FRIENDLY, val);
1605  return 0;
1606 }
1607 
1608 static int Object_SetCanSeeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1609  int val;
1610 
1611  EXISTCHECK_INT(whoptr);
1612  if (!PyArg_Parse(value, "i", &val))
1613  return -1;
1614 
1615  cf_object_set_flag(whoptr->obj, FLAG_SEE_INVISIBLE, val);
1616  return 0;
1617 }
1618 
1619 static int Object_SetRollable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1620  int val;
1621 
1622  EXISTCHECK_INT(whoptr);
1623  if (!PyArg_Parse(value, "i", &val))
1624  return -1;
1625 
1626  cf_object_set_flag(whoptr->obj, FLAG_CAN_ROLL, val);
1627  return 0;
1628 }
1629 
1630 static int Object_SetTurnable(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1631  int val;
1632 
1633  EXISTCHECK_INT(whoptr);
1634  if (!PyArg_Parse(value, "i", &val))
1635  return -1;
1636 
1637  cf_object_set_flag(whoptr->obj, FLAG_IS_TURNABLE, val);
1638  return 0;
1639 }
1640 
1641 static int Object_SetUsedUp(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1642  int val;
1643 
1644  EXISTCHECK_INT(whoptr);
1645  if (!PyArg_Parse(value, "i", &val))
1646  return -1;
1647 
1648  cf_object_set_flag(whoptr->obj, FLAG_IS_USED_UP, val);
1649  return 0;
1650 }
1651 
1652 static int Object_SetBlind(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1653  int val;
1654 
1655  EXISTCHECK_INT(whoptr);
1656  if (!PyArg_Parse(value, "i", &val))
1657  return -1;
1658 
1659  cf_object_set_flag(whoptr->obj, FLAG_BLIND, val);
1660  return 0;
1661 }
1662 
1663 static int Object_SetKnownCursed(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1664  int val;
1665 
1666  EXISTCHECK_INT(whoptr);
1667  if (!PyArg_Parse(value, "i", &val))
1668  return -1;
1669 
1670  cf_object_set_flag(whoptr->obj, FLAG_KNOWN_CURSED, val);
1671  return 0;
1672 }
1673 
1674 static int Object_SetStealthy(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1675  int val;
1676 
1677  EXISTCHECK_INT(whoptr);
1678  if (!PyArg_Parse(value, "i", &val))
1679  return -1;
1680 
1681  cf_object_set_flag(whoptr->obj, FLAG_STEALTH, val);
1682  return 0;
1683 }
1684 
1685 static int Object_SetConfused(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1686  int val;
1687 
1688  EXISTCHECK_INT(whoptr);
1689  if (!PyArg_Parse(value, "i", &val))
1690  return -1;
1691 
1692  cf_object_set_flag(whoptr->obj, FLAG_CONFUSED, val);
1693  return 0;
1694 }
1695 
1696 static int Object_SetSleeping(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1697  int val;
1698 
1699  EXISTCHECK_INT(whoptr);
1700  if (!PyArg_Parse(value, "i", &val))
1701  return -1;
1702 
1703  cf_object_set_flag(whoptr->obj, FLAG_SLEEP, val);
1704  return 0;
1705 }
1706 
1707 static int Object_SetLifesaver(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1708  int val;
1709 
1710  EXISTCHECK_INT(whoptr);
1711  if (!PyArg_Parse(value, "i", &val))
1712  return -1;
1713 
1714  cf_object_set_flag(whoptr->obj, FLAG_LIFESAVE, val);
1715  return 0;
1716 }
1717 
1718 static int Object_SetHasXRays(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1719  int val;
1720 
1721  EXISTCHECK_INT(whoptr);
1722  if (!PyArg_Parse(value, "i", &val))
1723  return -1;
1724 
1725  cf_object_set_flag(whoptr->obj, FLAG_XRAYS, val);
1726  return 0;
1727 }
1728 
1729 static int Object_SetCanSeeInDark(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1730  int val;
1731 
1732  EXISTCHECK_INT(whoptr);
1733  if (!PyArg_Parse(value, "i", &val))
1734  return -1;
1735 
1736  cf_object_set_flag(whoptr->obj, FLAG_SEE_IN_DARK, val);
1737  return 0;
1738 }
1739 
1740 static int Object_SetKnownMagical(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1741  int val;
1742 
1743  EXISTCHECK_INT(whoptr);
1744  if (!PyArg_Parse(value, "i", &val))
1745  return -1;
1746 
1747  cf_object_set_flag(whoptr->obj, FLAG_KNOWN_MAGICAL, val);
1748  return 0;
1749 }
1750 
1751 static int Object_SetReflectSpells(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1752  int val;
1753 
1754  EXISTCHECK_INT(whoptr);
1755  if (!PyArg_Parse(value, "i", &val))
1756  return -1;
1757 
1758  cf_object_set_flag(whoptr->obj, FLAG_REFL_SPELL, val);
1759  return 0;
1760 }
1761 
1762 static int Object_SetReflectMissiles(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1763  int val;
1764 
1765  EXISTCHECK_INT(whoptr);
1766  if (!PyArg_Parse(value, "i", &val))
1767  return -1;
1768 
1769  cf_object_set_flag(whoptr->obj, FLAG_REFL_MISSILE, val);
1770  return 0;
1771 }
1772 
1773 static int Object_SetUnique(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1774  int val;
1775 
1776  EXISTCHECK_INT(whoptr);
1777  if (!PyArg_Parse(value, "i", &val))
1778  return -1;
1779 
1780  cf_object_set_flag(whoptr->obj, FLAG_UNIQUE, val);
1781  return 0;
1782 }
1783 
1784 static int Object_SetRunAway(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1785  int val;
1786 
1787  EXISTCHECK_INT(whoptr);
1788  if (!PyArg_Parse(value, "i", &val))
1789  return -1;
1790 
1791  cf_object_set_flag(whoptr->obj, FLAG_RUN_AWAY, val);
1792  return 0;
1793 }
1794 
1795 static int Object_SetScared(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1796  int val;
1797 
1798  EXISTCHECK_INT(whoptr);
1799  if (!PyArg_Parse(value, "i", &val))
1800  return -1;
1801 
1802  cf_object_set_flag(whoptr->obj, FLAG_SCARED, val);
1803  return 0;
1804 }
1805 
1806 static int Object_SetUndead(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1807  int val;
1808 
1809  EXISTCHECK_INT(whoptr);
1810  if (!PyArg_Parse(value, "i", &val))
1811  return -1;
1812 
1813  cf_object_set_flag(whoptr->obj, FLAG_UNDEAD, val);
1814  return 0;
1815 }
1816 
1817 static int Object_SetBlocksView(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1818  int val;
1819 
1820  EXISTCHECK_INT(whoptr);
1821  if (!PyArg_Parse(value, "i", &val))
1822  return -1;
1823 
1824  cf_object_set_flag(whoptr->obj, FLAG_BLOCKSVIEW, val);
1825  return 0;
1826 }
1827 
1828 static int Object_SetHitBack(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1829  int val;
1830 
1831  EXISTCHECK_INT(whoptr);
1832  if (!PyArg_Parse(value, "i", &val))
1833  return -1;
1834 
1835  cf_object_set_flag(whoptr->obj, FLAG_HITBACK, val);
1836  return 0;
1837 }
1838 
1839 static int Object_SetStandStill(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1840  int val;
1841 
1842  EXISTCHECK_INT(whoptr);
1843  if (!PyArg_Parse(value, "i", &val))
1844  return -1;
1845 
1846  cf_object_set_flag(whoptr->obj, FLAG_STAND_STILL, val);
1847  return 0;
1848 }
1849 
1850 static int Object_SetOnlyAttack(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1851  int val;
1852 
1853  EXISTCHECK_INT(whoptr);
1854  if (!PyArg_Parse(value, "i", &val))
1855  return -1;
1856 
1857  cf_object_set_flag(whoptr->obj, FLAG_ONLY_ATTACK, val);
1858  return 0;
1859 }
1860 
1861 static int Object_SetMakeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1862  int val;
1863 
1864  EXISTCHECK_INT(whoptr);
1865  if (!PyArg_Parse(value, "i", &val))
1866  return -1;
1867 
1868  cf_object_set_flag(whoptr->obj, FLAG_MAKE_INVIS, val);
1869  return 0;
1870 }
1871 
1872 static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1873  long val;
1874 
1875  EXISTCHECK_INT(whoptr);
1876  if (!PyArg_Parse(value, "l", &val))
1877  return -1;
1878 
1880  return 0;
1881 }
1882 
1883 static int Object_SetNoSave(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1884  long val;
1885 
1886  EXISTCHECK_INT(whoptr);
1887  if (!PyArg_Parse(value, "i", &val))
1888  return -1;
1889 
1890  cf_object_set_flag(whoptr->obj, FLAG_NO_SAVE, val);
1891  return 0;
1892 }
1893 
1894 static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1895  Crossfire_Object *ob;
1896 
1897  EXISTCHECK_INT(whoptr);
1898  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
1899  return -1;
1901  return 0;
1902 }
1903 
1904 static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1905  Crossfire_Object *ob;
1906 
1907  EXISTCHECK_INT(whoptr);
1908  if (!PyArg_Parse(value, "O!", &Crossfire_ObjectType, &ob))
1909  return -1;
1911  return 0;
1912 }
1913 
1914 static int Object_SetGodGiven(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1915  int val;
1916 
1917  EXISTCHECK_INT(whoptr);
1918  if (!PyArg_Parse(value, "i", &val))
1919  return -1;
1920 
1921  cf_object_set_flag(whoptr->obj, FLAG_STARTEQUIP, val);
1922  return 0;
1923 }
1924 
1925 static int Object_SetNoDamage(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1926  int val;
1927 
1928  EXISTCHECK_INT(whoptr);
1929  if (!PyArg_Parse(value, "i", &val))
1930  return -1;
1931 
1932  cf_object_set_flag(whoptr->obj, FLAG_NO_DAMAGE, val);
1933  return 0;
1934 }
1935 
1936 static int Object_SetRandomMovement(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1937  int val;
1938 
1939  EXISTCHECK_INT(whoptr);
1940  if (!PyArg_Parse(value, "i", &val))
1941  return -1;
1942 
1943  cf_object_set_flag(whoptr->obj, FLAG_RANDOM_MOVE, val);
1944  return 0;
1945 }
1946 
1947 static int Object_SetIsPet(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1948  int val;
1949 
1950  EXISTCHECK_INT(whoptr);
1951  if (!PyArg_Parse(value, "i", &val))
1952  return -1;
1953 
1955  return 0;
1956 }
1957 
1958 static int Object_SetAttackMovement(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1959  int val;
1960 
1961  EXISTCHECK_INT(whoptr);
1962  if (!PyArg_Parse(value, "i", &val))
1963  return -1;
1964 
1966  return 0;
1967 }
1968 
1969 static int Object_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1970  int64_t val;
1971 
1972  EXISTCHECK_INT(whoptr);
1973  if (!PyArg_Parse(value, "L", &val))
1974  return -1;
1975 
1977  return 0;
1978 }
1979 
1980 static int Object_SetDuration(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1981  int val;
1982 
1983  EXISTCHECK_INT(whoptr);
1984  if (!PyArg_Parse(value, "i", &val))
1985  return -1;
1986 
1988  return 0;
1989 }
1990 
1991 static int Object_SetGlowRadius(Crossfire_Object *whoptr, PyObject *value, void *closure) {
1992  int val;
1993 
1994  EXISTCHECK_INT(whoptr);
1995  if (!PyArg_Parse(value, "i", &val))
1996  return -1;
1997 
1999  return 0;
2000 }
2001 
2002 static int Object_SetAnimated(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2003  int val;
2004 
2005  EXISTCHECK_INT(whoptr);
2006  if (!PyArg_Parse(value, "i", &val))
2007  return -1;
2008  cf_object_set_flag(whoptr->obj, FLAG_ANIMATE, val);
2009  return 0;
2010 }
2011 
2012 static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2013  MoveType move;
2014 
2015  EXISTCHECK_INT(whoptr);
2016  if (!PyArg_Parse(value, "B", &move))
2017  return -1;
2019  return 0;
2020 }
2021 
2022 static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2023  MoveType move;
2024 
2025  EXISTCHECK_INT(whoptr);
2026  if (!PyArg_Parse(value, "B", &move))
2027  return -1;
2029  return 0;
2030 }
2031 
2032 static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2033  MoveType move;
2034 
2035  EXISTCHECK_INT(whoptr);
2036  if (!PyArg_Parse(value, "B", &move))
2037  return -1;
2039  return 0;
2040 }
2041 
2042 static int Object_SetMoveOn(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2043  MoveType move;
2044 
2045  EXISTCHECK_INT(whoptr);
2046  if (!PyArg_Parse(value, "B", &move))
2047  return -1;
2049  return 0;
2050 }
2051 
2052 static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2053  MoveType move;
2054 
2055  EXISTCHECK_INT(whoptr);
2056  if (!PyArg_Parse(value, "B", &move))
2057  return -1;
2059  return 0;
2060 }
2061 
2062 static int Object_SetMoveSlow(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2063  MoveType move;
2064 
2065  EXISTCHECK_INT(whoptr);
2066  if (!PyArg_Parse(value, "B", &move))
2067  return -1;
2069  return 0;
2070 }
2071 
2072 static int Object_SetItemPower(Crossfire_Object *whoptr, PyObject *value, void *closure) {
2073  int item_power;
2074 
2075  EXISTCHECK_INT(whoptr);
2076  if (!PyArg_Parse(value, "i", &item_power))
2077  return -1;
2079  return 0;
2080 }
2081 
2082 
2083 /* Methods. */
2084 
2085 static PyObject *Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args) {
2086  EXISTCHECK(who);
2087 
2088  if ((current_context->who != NULL) && (((Crossfire_Object *)current_context->who)->obj == who->obj))
2089  current_context->who = NULL;
2090 
2091  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
2092  cf_object_remove(who->obj);
2093  }
2094 
2096  Py_INCREF(Py_None);
2097  return Py_None;
2098 }
2099 
2100 static PyObject *Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args) {
2101  Crossfire_Object *whoptr;
2102  int flags;
2103 
2104  if (!PyArg_ParseTuple(args, "O!i", &Crossfire_ObjectType, &whoptr, &flags))
2105  return NULL;
2106  EXISTCHECK(who);
2107  EXISTCHECK(whoptr);
2108 
2109  return Py_BuildValue("i", cf_object_apply(whoptr->obj, who->obj, flags));
2110 }
2111 
2112 static PyObject *Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args) {
2113  /* Note that this function uses the METH_O calling convention. */
2114  Crossfire_Object *whoptr = (Crossfire_Object*)args;
2115 
2116  EXISTCHECK(who);
2117  TYPEEXISTCHECK(whoptr);
2118 
2119  cf_object_drop(whoptr->obj, who->obj);
2120  Py_INCREF(Py_None);
2121  return Py_None;
2122 }
2123 
2124 static PyObject *Crossfire_Object_Clone(Crossfire_Object *who, PyObject *args) {
2125  int clone_type;
2126  object *clone;
2127 
2128  if (!PyArg_ParseTuple(args, "i", &clone_type))
2129  return NULL;
2130 
2131  if (clone_type != 0 && clone_type != 1)
2132  {
2133  PyErr_SetString(PyExc_ValueError, "Clone type must be 0 (object_create_clone) or 1 (object_copy).");
2134  return NULL;
2135  }
2136 
2137  clone = cf_object_clone(who->obj, clone_type);
2138 
2139  if (clone == NULL)
2140  {
2141  PyErr_SetString(PyExc_RuntimeError, "Clone failed.");
2142  return NULL;
2143  }
2144 
2145  return Crossfire_Object_wrap(clone);
2146 }
2147 
2148 static PyObject *Crossfire_Object_Split(Crossfire_Object *who, PyObject *args) {
2149  int count;
2150  char err[255];
2151  object *split;
2152 
2153  err[0] = '\0'; /* Just in case. */
2154 
2155  if (!PyArg_ParseTuple(args, "i", &count))
2156  return NULL;
2157 
2158  split = cf_object_split(who->obj, count, err, 255);
2159 
2160  if (split == NULL)
2161  {
2162  PyErr_SetString(PyExc_ValueError, err);
2163  return NULL;
2164  }
2165 
2166  return Crossfire_Object_wrap(split);
2167 }
2168 
2169 static PyObject *Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args) {
2170  cf_fix_object(who->obj);
2171  Py_INCREF(Py_None);
2172  return Py_None;
2173 }
2174 
2175 static PyObject *Crossfire_Object_Take(Crossfire_Object *who, PyObject *args) {
2176  /* Note that this function uses the METH_O calling convention. */
2177  Crossfire_Object *whoptr = (Crossfire_Object*)args;
2178 
2179  EXISTCHECK(who);
2180  TYPEEXISTCHECK(whoptr);
2181 
2182  cf_object_pickup(who->obj, whoptr->obj);
2183  Py_INCREF(Py_None);
2184  return Py_None;
2185 }
2186 
2187 static PyObject *Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args) {
2188  Crossfire_Map *where;
2189  int x, y;
2190  int val;
2191 
2192  EXISTCHECK(who);
2193  if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_MapType, &where, &x, &y))
2194  return NULL;
2195 
2196  val = cf_object_teleport(who->obj, where->map, x, y);
2197 
2198  return Py_BuildValue("i", val);
2199 }
2200 
2201 static PyObject *Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args) {
2202  /* Note that this function uses the METH_O calling convention. */
2203  object *trap;
2204  object *victim;
2205  Crossfire_Object *pcause = (Crossfire_Object*)args;
2206 
2207  EXISTCHECK(who);
2208  TYPEEXISTCHECK(pcause);
2209  trap = who->obj;
2210  victim = pcause->obj;
2211  cf_spring_trap(trap, victim);
2212  Py_INCREF(Py_None);
2213  return Py_None;
2214 }
2215 
2216 static PyObject *Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args) {
2217  /* Note that this function uses the METH_O calling convention. */
2218  object *trigger;
2219  object *cause;
2220  int result;
2221  Crossfire_Object *pcause = (Crossfire_Object*)args;
2222 
2223  EXISTCHECK(who);
2224  TYPEEXISTCHECK(pcause);
2225  trigger = who->obj;
2226  cause = pcause->obj;
2227  result = cf_object_check_trigger(trigger, cause);
2228 
2229  return Py_BuildValue("i", result);
2230 }
2231 
2232 static PyObject *Crossfire_Object_Say(Crossfire_Object *who, PyObject *args) {
2233  char *message, buf[2048];
2234 
2235  EXISTCHECK(who);
2236  if (!PyArg_ParseTuple(args, "s", &message))
2237  return NULL;
2238 
2239  /* compatibility */
2240  if (current_context->talk == NULL) {
2241  cf_object_say(who->obj, message);
2242  Py_INCREF(Py_None);
2243  return Py_None;
2244  }
2245 
2247  PyErr_SetString(PyExc_ValueError, "too many NPCs");
2248  return NULL;
2249  }
2250 
2251  if (strlen(message) >= sizeof(buf) - 1)
2252  cf_log(llevError, "warning, too long message in npcSay, will be truncated");
2254  snprintf(buf, sizeof(buf), "%s says: %s", who->obj->name, message);
2255 
2258 
2259  Py_INCREF(Py_None);
2260  return Py_None;
2261 
2262 }
2263 
2264 static PyObject *Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args) {
2265  int x, y;
2266 
2267  EXISTCHECK(who);
2268  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2269  return NULL;
2270 
2271  cf_object_transfer(who->obj, x, y, 0, NULL);
2272  Py_INCREF(Py_None);
2273  return Py_None;
2274 }
2275 
2276 static PyObject *Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args) {
2277  char name[200];
2278 
2279  EXISTCHECK(who);
2280  return Py_BuildValue("s", cf_query_name(who->obj, name, sizeof(name)));
2281 }
2282 
2283 static PyObject *Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args) {
2284  int resist;
2285 
2286  EXISTCHECK(who);
2287  if (!PyArg_ParseTuple(args, "i", &resist))
2288  return NULL;
2289  if ((resist < 0) || (resist >= NROFATTACKS)) {
2290  return Py_BuildValue("l", 0);
2291  }
2292  return Py_BuildValue("i", cf_object_get_resistance(who->obj, resist));
2293 }
2294 
2295 static PyObject *Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args) {
2296  int resist, value;
2297 
2298  EXISTCHECK(who);
2299  if (!PyArg_ParseTuple(args, "ii", &resist, &value))
2300  return NULL;
2301  if ((resist >= 0) && (resist < NROFATTACKS))
2302  cf_object_set_resistance(who->obj, resist, value);
2303  Py_INCREF(Py_None);
2304  return Py_None;
2305 }
2306 
2307 static PyObject *Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args) {
2308  int dir;
2309  char *op;
2310  Crossfire_Object *pspell;
2311 
2312  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &op))
2313  return NULL;
2314  EXISTCHECK(who);
2315  EXISTCHECK(pspell);
2316 
2317  cf_object_cast_spell(who->obj, who->obj, dir, pspell->obj, op);
2318 
2319  Py_INCREF(Py_None);
2320  return Py_None;
2321 }
2322 
2323 static PyObject *Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args) {
2324  /* Note that this function uses the METH_O calling convention. */
2325  Crossfire_Object *pspell = (Crossfire_Object*)args;
2326 
2327  EXISTCHECK(who);
2328  TYPEEXISTCHECK(pspell);
2329 
2330  cf_object_learn_spell(who->obj, pspell->obj, 0);
2331 
2332  Py_INCREF(Py_None);
2333  return Py_None;
2334 }
2335 
2336 static PyObject *Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args) {
2337  /* Note that this function uses the METH_O calling convention. */
2338  Crossfire_Object *pspell = (Crossfire_Object*)args;
2339 
2340  EXISTCHECK(who);
2341  TYPEEXISTCHECK(pspell);
2342 
2343  cf_object_forget_spell(who->obj, pspell->obj);
2344  Py_INCREF(Py_None);
2345  return Py_None;
2346 }
2347 
2348 static PyObject *Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args) {
2349  char *spellname;
2350  object *op;
2351 
2352  EXISTCHECK(who);
2353  if (!PyArg_ParseTuple(args, "s", &spellname))
2354  return NULL;
2355 
2356  op = cf_object_check_for_spell(who->obj, spellname);
2357 
2358  return Crossfire_Object_wrap(op);
2359 }
2360 
2361 static PyObject *Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args) {
2362  Crossfire_Object *pspell;
2363  int dir;
2364  char *str;
2365 
2366  if (!PyArg_ParseTuple(args, "O!is", &Crossfire_ObjectType, &pspell, &dir, &str))
2367  return NULL;
2368  EXISTCHECK(who);
2369  EXISTCHECK(pspell);
2370 
2371  cf_log_plain(llevError, "CastAbility is deprecated and will be removed, use 'Cast'.\n");
2372  cf_object_cast_spell(who->obj, who->obj, dir, pspell->obj, str);
2373 
2374  Py_INCREF(Py_None);
2375  return Py_None;
2376 }
2377 
2378 static PyObject *Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args) {
2379  uint64_t to_pay;
2380  int val;
2381 
2382  EXISTCHECK(who);
2383  if (!PyArg_ParseTuple(args, "L", &to_pay))
2384  return NULL;
2385 
2386  val = cf_object_pay_amount(who->obj, to_pay);
2387 
2388  return Py_BuildValue("i", val);
2389 }
2390 
2391 static PyObject *Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args) {
2392  /* Note that this function uses the METH_O calling convention. */
2393  Crossfire_Object *op = (Crossfire_Object*)args;
2394  int val;
2395 
2396  EXISTCHECK(who);
2397  TYPEEXISTCHECK(op);
2398 
2399  val = cf_object_pay_item(who->obj, op->obj);
2400 
2401  return Py_BuildValue("i", val);
2402 }
2403 
2404 static PyObject *Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args) {
2405  const char *val;
2406  char *keyname;
2407 
2408  EXISTCHECK(who);
2409  if (!PyArg_ParseTuple(args, "s", &keyname))
2410  return NULL;
2411 
2412  val = cf_object_get_key(who->obj, keyname);
2413 
2414  return Py_BuildValue("s", val ? val : "");
2415 }
2416 
2417 static PyObject *Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args) {
2418  char *keyname;
2419  char *value;
2420  int add_key = 0;
2421 
2422  EXISTCHECK(who);
2423  if (!PyArg_ParseTuple(args, "ss|i", &keyname, &value, &add_key))
2424  return NULL;
2425 
2426  return Py_BuildValue("i", cf_object_set_key(who->obj, keyname, value, add_key));
2427 }
2428 
2429 static PyObject *Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args) {
2430  int mode;
2431  long delay;
2432 
2433  EXISTCHECK(who);
2434  if (!PyArg_ParseTuple(args, "li", &delay, &mode))
2435  return NULL;
2436 
2437  return Py_BuildValue("i", cf_timer_create(who->obj, delay, mode));
2438 }
2439 
2440 static PyObject *Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args) {
2441  char *whatstr;
2442  object *foundob;
2443 
2444  EXISTCHECK(who);
2445  if (!PyArg_ParseTuple(args, "s", &whatstr))
2446  return NULL;
2447 
2448  foundob = cf_object_present_archname_inside(who->obj, whatstr);
2449 
2450  return Crossfire_Object_wrap(foundob);
2451 /* FOR_INV_PREPARE(WHO, tmp) {
2452  if (!strncmp(PyQueryName(tmp), whatstr, strlen(whatstr))) {
2453  return Py_BuildValue("l", (long)(tmp));
2454  }
2455  if (!strncmp(tmp->name, whatstr, strlen(whatstr))) {
2456  return Py_BuildValue("l", (long)(tmp));
2457  }
2458  } FOR_INV_FINISH();
2459 
2460  return Py_BuildValue("l", (long)0);*/
2461 }
2462 
2463 static PyObject *Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args) {
2464  char *whatstr;
2465  object *tmp;
2466 
2467  EXISTCHECK(who);
2468  if (!PyArg_ParseTuple(args, "s", &whatstr))
2469  return NULL;
2470 
2471  tmp = cf_object_find_by_arch_name(who->obj, whatstr);
2472  return Crossfire_Object_wrap(tmp);
2473 }
2474 
2475 static PyObject *Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args) {
2476  int x, y;
2477 
2478  EXISTCHECK(who);
2479  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2480  return NULL;
2481 
2482  return Py_BuildValue("i", cf_object_out_of_map(who->obj, x, y));
2483 }
2484 
2485 static PyObject *Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args) {
2486  char *txt;
2487  object *myob;
2488 
2489  EXISTCHECK(who);
2490  if (!PyArg_ParseTuple(args, "s", &txt))
2491  return NULL;
2492 
2493  myob = cf_create_object_by_name(txt);
2494  if (myob)
2495  myob = cf_object_insert_object(myob, who->obj);
2496 
2497  return Crossfire_Object_wrap(myob);
2498 }
2499 
2500 static PyObject *Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args) {
2501  /* Note that this function uses the METH_O calling convention. */
2502  Crossfire_Object *op = (Crossfire_Object*)args;
2503  object *myob;
2504 
2505  EXISTCHECK(who);
2506  TYPEEXISTCHECK(op);
2507 
2508  /* we can only insert removed object, so first remove it
2509  * from it's current container
2510  */
2511  if (!cf_object_get_flag(who->obj, FLAG_REMOVED)) {
2512  cf_object_remove(who->obj);
2513  }
2514  myob = cf_object_insert_in_ob(who->obj, op->obj);
2515 
2516  return Crossfire_Object_wrap(myob);
2517 }
2518 
2519 static PyObject *Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args) {
2520  /* Note that this function uses the METH_O calling convention. */
2521  Crossfire_Object *op = (Crossfire_Object*)args;
2522 
2523  EXISTCHECK(who);
2524  TYPEEXISTCHECK(op);
2525 
2526  return Py_BuildValue("i", cf_object_change_abil(who->obj, op->obj));
2527 }
2528 
2529 static PyObject *Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args) {
2530  int64_t exp;
2531  const char *skill = NULL;
2532  int arg = 0;
2533 
2534  if (!PyArg_ParseTuple(args, "L|si", &exp, &skill, &arg))
2535  return NULL;
2536  EXISTCHECK(who);
2537  cf_object_change_exp(who->obj, exp, skill, arg);
2538  Py_INCREF(Py_None);
2539  return Py_None;
2540 }
2541 
2542 static PyObject *Crossfire_Object_PermExp(Crossfire_Object *who, PyObject *args) {
2543  EXISTCHECK(who);
2544  return Py_BuildValue("l", cf_object_perm_exp(who->obj));
2545 }
2546 
2547 static PyObject *Crossfire_Object_Move(Crossfire_Object *who, PyObject *args) {
2548  int dir;
2549 
2550  if (!PyArg_ParseTuple(args, "i", &dir))
2551  return NULL;
2552  EXISTCHECK(who);
2553  return Py_BuildValue("i", cf_object_move(who->obj, dir, who->obj));
2554 }
2555 
2556 static PyObject *Crossfire_Object_MoveTo(Crossfire_Object *who, PyObject *args) {
2557  int x,y;
2558 
2559  if (!PyArg_ParseTuple(args, "ii", &x, &y))
2560  return NULL;
2561  EXISTCHECK(who);
2562  return Py_BuildValue("i", cf_object_move_to(who->obj, x, y));
2563 }
2564 
2565 static PyObject *Crossfire_Object_Event(Crossfire_Object *who, PyObject *args) {
2566  int fix;
2567  const char *message = NULL;
2568  object *op1 = NULL;
2569  object *op2 = NULL;
2570  object *op3 = NULL;
2571  Crossfire_Object *activator = NULL;
2572  Crossfire_Object *third = NULL;
2573 
2574  if (!PyArg_ParseTuple(args, "O!O!si", &Crossfire_ObjectType, &activator, &Crossfire_ObjectType, &third, &message, &fix))
2575  return NULL;
2576  EXISTCHECK(who);
2577  EXISTCHECK(activator);
2578  EXISTCHECK(third);
2579  op1 = who->obj;
2580  op2 = activator->obj;
2581  op3 = third->obj;
2582  return Py_BuildValue("i", cf_object_user_event(op1, op2, op3, message, fix));
2583 }
2584 
2585 static PyObject *Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args) {
2586  int level;
2587 
2588  if (!PyArg_ParseTuple(args, "i", &level))
2589  return NULL;
2590  EXISTCHECK(who);
2591 
2592  return Py_BuildValue("i", cf_object_remove_depletion(who->obj, level));
2593 }
2594 
2595 static PyObject *Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args) {
2596  EXISTCHECK(who);
2597  return Py_BuildValue("i", cf_player_arrest(who->obj));
2598 }
2599 
2601  EXISTCHECK_INT(left);
2602  EXISTCHECK_INT(right);
2603  return (left->obj < right->obj ? -1 : (left->obj == right->obj ? 0 : 1));
2604 }
2605 
2606 static PyObject *Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op) {
2607  int result;
2608  if (!left
2609  || !right
2610  || !PyObject_TypeCheck((PyObject*)left, &Crossfire_ObjectType)
2611  || !PyObject_TypeCheck((PyObject*)right, &Crossfire_ObjectType)) {
2612  Py_INCREF(Py_NotImplemented);
2613  return Py_NotImplemented;
2614  }
2615  result = Crossfire_Object_InternalCompare(left, right);
2616  /* Handle removed objects. */
2617  if (result == -1 && PyErr_Occurred())
2618  return NULL;
2619  /* Based on how Python 3.0 (GPL compatible) implements it for internal types: */
2620  switch (op) {
2621  case Py_EQ:
2622  result = (result == 0);
2623  break;
2624  case Py_NE:
2625  result = (result != 0);
2626  break;
2627  case Py_LE:
2628  result = (result <= 0);
2629  break;
2630  case Py_GE:
2631  result = (result >= 0);
2632  break;
2633  case Py_LT:
2634  result = (result == -1);
2635  break;
2636  case Py_GT:
2637  result = (result == 1);
2638  break;
2639  }
2640  return PyBool_FromLong(result);
2641 }
2642 
2643 /* Legacy code: convert to long so that non-object functions work correctly */
2644 static PyObject *Crossfire_Object_Long(PyObject *obj) {
2645  return Py_BuildValue("l", ((Crossfire_Object *)obj)->obj);
2646 }
2647 
2648 #ifndef IS_PY3K
2649 static PyObject *Crossfire_Object_Int(PyObject *obj) {
2650  return Py_BuildValue("i", ((Crossfire_Object *)obj)->obj);
2651 }
2652 #endif
2653 
2654 /* Python binding */
2655 static PyGetSetDef Object_getseters[] = {
2656  { "Name", (getter)Object_GetName, (setter)Object_SetName, NULL, NULL },
2657  { "NamePl", (getter)Object_GetNamePl, (setter)Object_SetNamePl, NULL, NULL },
2658  { "Title", (getter)Object_GetTitle, (setter)Object_SetTitle, NULL, NULL },
2659  { "Race", (getter)Object_GetRace, (setter)Object_SetRace, NULL, NULL },
2660  { "Skill", (getter)Object_GetSkill, (setter)Object_SetSkill, NULL, NULL },
2661  { "Map", (getter)Object_GetMap, (setter)Object_SetMap, NULL, NULL },
2662  { "Cha", (getter)Object_GetCha, (setter)Object_SetCha, NULL, NULL },
2663  { "Con", (getter)Object_GetCon, (setter)Object_SetCon, NULL, NULL },
2664  { "Dex", (getter)Object_GetDex, (setter)Object_SetDex, NULL, NULL },
2665  { "Int", (getter)Object_GetInt, (setter)Object_SetInt, NULL, NULL },
2666  { "Pow", (getter)Object_GetPow, (setter)Object_SetPow, NULL, NULL },
2667  { "Str", (getter)Object_GetStr, (setter)Object_SetStr, NULL, NULL },
2668  { "Wis", (getter)Object_GetWis, (setter)Object_SetWis, NULL, NULL },
2669  { "HP", (getter)Object_GetHP, (setter)Object_SetHP, NULL, NULL },
2670  { "MaxHP", (getter)Object_GetMaxHP, (setter)Object_SetMaxHP, NULL, NULL },
2671  { "SP", (getter)Object_GetSP, (setter)Object_SetSP, NULL, NULL },
2672  { "MaxSP", (getter)Object_GetMaxSP, (setter)Object_SetMaxSP, NULL, NULL },
2673  { "Grace", (getter)Object_GetGrace, (setter)Object_SetGrace, NULL, NULL },
2674  { "MaxGrace", (getter)Object_GetMaxGrace, (setter)Object_SetMaxGrace, NULL, NULL },
2675  { "Food", (getter)Object_GetFood, (setter)Object_SetFood, NULL, NULL },
2676  { "AC", (getter)Object_GetAC, (setter)Object_SetAC, NULL, NULL },
2677  { "WC", (getter)Object_GetWC, (setter)Object_SetWC, NULL, NULL },
2678  { "Dam", (getter)Object_GetDam, (setter)Object_SetDam, NULL, NULL },
2679  { "Luck", (getter)Object_GetLuck, NULL, NULL, NULL },
2680  { "Exp", (getter)Object_GetExp, (setter)Object_SetExp, NULL, NULL },
2681  { "ExpMul", (getter)Object_GetExpMul, NULL, NULL, NULL },
2682  { "TotalExp", (getter)Object_GetTotalExp, NULL, NULL, NULL },
2683  { "Message", (getter)Object_GetMessage, (setter)Object_SetMessage, NULL, NULL },
2684  { "Slaying", (getter)Object_GetSlaying, (setter)Object_SetSlaying, NULL, NULL },
2685  { "Cursed", (getter)Object_GetCursed, (setter)Object_SetCursed, NULL, NULL },
2686  { "Damned", (getter)Object_GetDamned, (setter)Object_SetDamned, NULL, NULL },
2687  { "Weight", (getter)Object_GetWeight, (setter)Object_SetWeight, NULL, NULL },
2688  { "WeightLimit", (getter)Object_GetWeightLimit, (setter)Object_SetWeightLimit, NULL, NULL },
2689  { "Above", (getter)Object_GetAbove, NULL, NULL, NULL },
2690  { "Below", (getter)Object_GetBelow, NULL, NULL, NULL },
2691  { "Inventory", (getter)Object_GetInventory, NULL, NULL, NULL },
2692  { "X", (getter)Object_GetX, NULL, NULL, NULL },
2693  { "Y", (getter)Object_GetY, NULL, NULL, NULL },
2694  { "Direction", (getter)Object_GetDirection, (setter)Object_SetDirection, NULL, NULL },
2695  { "Facing", (getter)Object_GetFacing, (setter)Object_SetFacing, NULL, NULL },
2696  { "Unaggressive", (getter)Object_GetUnaggressive, (setter)Object_SetUnaggressive, NULL, NULL },
2697  { "God", (getter)Object_GetGod, (setter)Object_SetGod, NULL, NULL },
2698  { "Pickable", (getter)Object_GetPickable, (setter)Object_SetPickable, NULL, NULL },
2699  { "Quantity", (getter)Object_GetQuantity, (setter)Object_SetQuantity, NULL, NULL },
2700  { "Invisible", (getter)Object_GetInvisible, (setter)Object_SetInvisible, NULL, NULL },
2701  { "Speed", (getter)Object_GetSpeed, (setter)Object_SetSpeed, NULL, NULL },
2702  { "SpeedLeft", (getter)Object_GetSpeedLeft, (setter)Object_SetSpeedLeft, NULL, NULL },
2703  { "LastSP", (getter)Object_GetLastSP, (setter)Object_SetLastSP, NULL, NULL },
2704  { "LastGrace", (getter)Object_GetLastGrace, (setter)Object_SetLastGrace, NULL, NULL },
2705  { "LastEat", (getter)Object_GetLastEat, (setter)Object_SetLastEat, NULL, NULL },
2706  { "Level", (getter)Object_GetLevel, (setter)Object_SetLevel, NULL, NULL },
2707  { "Face", (getter)Object_GetFace, (setter)Object_SetFace, NULL, NULL },
2708  { "Anim", (getter)Object_GetAnim, (setter)Object_SetAnim, NULL, NULL },
2709  { "AnimSpeed", (getter)Object_GetAnimSpeed, (setter)Object_SetAnimSpeed, NULL, NULL },
2710  { "AttackType", (getter)Object_GetAttackType, (setter)Object_SetAttackType, NULL, NULL },
2711  { "BeenApplied", (getter)Object_GetBeenApplied, NULL, NULL, NULL },
2712  { "Identified", (getter)Object_GetIdentified, (setter)Object_SetIdentified, NULL, NULL },
2713  { "Alive", (getter)Object_GetAlive, (setter)Object_SetAlive, NULL, NULL },
2714  { "DungeonMaster", (getter)Object_GetDM, NULL, NULL, NULL },
2715  { "WasDungeonMaster", (getter)Object_GetWasDM, NULL, NULL, NULL },
2716  { "Applied", (getter)Object_GetApplied, (setter)Object_SetApplied, NULL, NULL },
2717  { "Unpaid", (getter)Object_GetUnpaid, (setter)Object_SetUnpaid, NULL, NULL },
2718  { "Monster", (getter)Object_GetMonster, NULL, NULL, NULL },
2719  { "Friendly", (getter)Object_GetFriendly, (setter)Object_SetFriendly, NULL, NULL },
2720  { "Generator", (getter)Object_GetGenerator, NULL, NULL, NULL },
2721  { "Thrown", (getter)Object_GetThrown, NULL, NULL, NULL },
2722  { "CanSeeInvisible", (getter)Object_GetCanSeeInvisible, (setter)Object_SetCanSeeInvisible, NULL, NULL },
2723  { "Rollable", (getter)Object_GetRollable, (setter)Object_SetRollable, NULL, NULL },
2724  { "Turnable", (getter)Object_GetTurnable, (setter)Object_SetTurnable, NULL, NULL },
2725  { "UsedUp", (getter)Object_GetUsedUp, (setter)Object_SetUsedUp, NULL, NULL },
2726  { "Splitting", (getter)Object_GetSplitting, NULL, NULL, NULL },
2727  { "Blind", (getter)Object_GetBlind, (setter)Object_SetBlind, NULL, NULL },
2728  { "CanUseSkill", (getter)Object_GetCanUseSkill, NULL, NULL, NULL },
2729  { "KnownCursed", (getter)Object_GetKnownCursed, (setter)Object_SetKnownCursed, NULL, NULL },
2730  { "Stealthy", (getter)Object_GetStealthy, (setter)Object_SetStealthy, NULL, NULL },
2731  { "Confused", (getter)Object_GetConfused, (setter)Object_SetConfused, NULL, NULL },
2732  { "Sleeping", (getter)Object_GetSleeping, (setter)Object_SetSleeping, NULL, NULL },
2733  { "Lifesaver", (getter)Object_GetLifesaver, (setter)Object_SetLifesaver, NULL, NULL },
2734  { "Floor", (getter)Object_GetFloor, NULL, NULL, NULL },
2735  { "HasXRays", (getter)Object_GetHasXRays, (setter)Object_SetHasXRays, NULL, NULL },
2736  { "CanUseRing", (getter)Object_GetCanUseRing, NULL, NULL, NULL },
2737  { "CanUseBow", (getter)Object_GetCanUseBow, NULL, NULL, NULL },
2738  { "CanUseWand", (getter)Object_GetCanUseWand, NULL, NULL, NULL },
2739  { "CanSeeInDark", (getter)Object_GetCanSeeInDark, (setter)Object_SetCanSeeInDark, NULL, NULL },
2740  { "KnownMagical", (getter)Object_GetKnownMagical, (setter)Object_SetKnownMagical, NULL, NULL },
2741  { "CanUseWeapon", (getter)Object_GetCanUseWeapon, NULL, NULL, NULL },
2742  { "CanUseArmour", (getter)Object_GetCanUseArmour, NULL, NULL, NULL },
2743  { "CanUseScroll", (getter)Object_GetCanUseScroll, NULL, NULL, NULL },
2744  { "CanCastSpell", (getter)Object_GetCanCastSpell, NULL, NULL, NULL },
2745  { "ReflectSpells", (getter)Object_GetReflectSpells, (setter)Object_SetReflectSpells, NULL, NULL },
2746  { "ReflectMissiles", (getter)Object_GetReflectMissiles, (setter)Object_SetReflectMissiles, NULL, NULL },
2747  { "Unique", (getter)Object_GetUnique, (setter)Object_SetUnique, NULL, NULL },
2748  { "RunAway", (getter)Object_GetRunAway, (setter)Object_SetRunAway, NULL, NULL },
2749  { "Scared", (getter)Object_GetScared, (setter)Object_SetScared, NULL, NULL },
2750  { "Undead", (getter)Object_GetUndead, (setter)Object_SetUndead, NULL, NULL },
2751  { "BlocksView", (getter)Object_GetBlocksView, (setter)Object_SetBlocksView, NULL, NULL },
2752  { "HitBack", (getter)Object_GetHitBack, (setter)Object_SetHitBack, NULL, NULL },
2753  { "StandStill", (getter)Object_GetStandStill, (setter)Object_SetStandStill, NULL, NULL },
2754  { "OnlyAttack", (getter)Object_GetOnlyAttack, (setter)Object_SetOnlyAttack, NULL, NULL },
2755  { "MakeInvisible", (getter)Object_GetMakeInvisible, (setter)Object_SetMakeInvisible, NULL, NULL },
2756  { "Money", (getter)Object_GetMoney, NULL, NULL, NULL },
2757  { "Type", (getter)Object_GetType, NULL, NULL, NULL },
2758  { "Subtype", (getter)Object_GetSubtype, NULL, NULL, NULL },
2759  { "Value", (getter)Object_GetValue, (setter)Object_SetValue, NULL, NULL },
2760  { "ArchName", (getter)Object_GetArchName, NULL, NULL, NULL },
2761  { "Archetype", (getter)Object_GetArchetype, NULL, NULL, NULL },
2762  { "OtherArchetype", (getter)Object_GetOtherArchetype,NULL, NULL, NULL },
2763  { "Exists", (getter)Object_GetExists, NULL, NULL, NULL },
2764  { "NoSave", (getter)Object_GetNoSave, (setter)Object_SetNoSave, NULL, NULL },
2765  { "Env", (getter)Object_GetEnv, NULL, NULL, NULL },
2766  { "MoveType", (getter)Object_GetMoveType, (setter)Object_SetMoveType, NULL, NULL },
2767  { "MoveBlock", (getter)Object_GetMoveBlock, (setter)Object_SetMoveBlock, NULL, NULL },
2768  { "MoveAllow", (getter)Object_GetMoveAllow, (setter)Object_SetMoveAllow, NULL, NULL },
2769  { "MoveOn", (getter)Object_GetMoveOn, (setter)Object_SetMoveOn, NULL, NULL },
2770  { "MoveOff", (getter)Object_GetMoveOff, (setter)Object_SetMoveOff, NULL, NULL },
2771  { "MoveSlow", (getter)Object_GetMoveSlow, (setter)Object_SetMoveSlow, NULL, NULL },
2772  { "MoveSlowPenalty", (getter)Object_GetMoveSlowPenalty, NULL, NULL, NULL },
2773  { "Owner", (getter)Object_GetOwner, (setter)Object_SetOwner, NULL, NULL },
2774  { "Enemy", (getter)Object_GetEnemy, (setter)Object_SetEnemy, NULL, NULL },
2775  { "Count", (getter)Object_GetCount, NULL, NULL, NULL },
2776  { "GodGiven", (getter)Object_GetGodGiven, (setter)Object_SetGodGiven, NULL, NULL },
2777  { "IsPet", (getter)Object_GetIsPet, (setter)Object_SetIsPet, NULL, NULL },
2778  { "AttackMovement", (getter)Object_GetAttackMovement, (setter)Object_SetAttackMovement, NULL, NULL },
2779  { "Duration", (getter)Object_GetDuration, (setter)Object_SetDuration, NULL, NULL },
2780  { "GlowRadius", (getter)Object_GetGlowRadius, (setter)Object_SetGlowRadius, NULL, NULL },
2781  { "Animated", (getter)Object_GetAnimated, (setter)Object_SetAnimated, NULL, NULL },
2782  { "NoDamage", (getter)Object_GetNoDamage, (setter)Object_SetNoDamage, NULL, NULL },
2783  { "RandomMovement", (getter)Object_GetRandomMovement, (setter)Object_SetRandomMovement, NULL, NULL },
2784  { "Material", (getter)Object_GetMaterial, NULL, NULL, NULL },
2785  { "Container", (getter)Object_GetContainer, NULL, NULL, NULL },
2786  { "ItemPower", (getter)Object_GetItemPower, (setter)Object_SetItemPower, NULL, NULL },
2787  { NULL, NULL, NULL, NULL, NULL }
2788 };
2789 
2790 static PyMethodDef ObjectMethods[] = {
2791  { "Remove", (PyCFunction)Crossfire_Object_Remove, METH_NOARGS, NULL },
2792  { "Apply", (PyCFunction)Crossfire_Object_Apply, METH_VARARGS, NULL },
2793  { "Drop", (PyCFunction)Crossfire_Object_Drop, METH_O, NULL },
2794  { "Clone", (PyCFunction)Crossfire_Object_Clone, METH_VARARGS, NULL },
2795  { "Split", (PyCFunction)Crossfire_Object_Split, METH_VARARGS, NULL },
2796  { "Fix", (PyCFunction)Crossfire_Object_Fix, METH_NOARGS, NULL },
2797  { "Say", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
2798  { "Speak", (PyCFunction)Crossfire_Object_Say, METH_VARARGS, NULL },
2799  { "Take", (PyCFunction)Crossfire_Object_Take, METH_O, NULL },
2800  { "Teleport", (PyCFunction)Crossfire_Object_Teleport, METH_VARARGS, NULL },
2801  { "Reposition", (PyCFunction)Crossfire_Object_Reposition, METH_VARARGS, NULL },
2802  { "QueryName", (PyCFunction)Crossfire_Object_QueryName, METH_NOARGS, NULL },
2803  { "GetResist", (PyCFunction)Crossfire_Object_GetResist, METH_VARARGS, NULL },
2804  { "SetResist", (PyCFunction)Crossfire_Object_SetResist, METH_VARARGS, NULL },
2805  { "ActivateRune", (PyCFunction)Crossfire_Object_ActivateRune, METH_O, NULL },
2806  { "CheckTrigger", (PyCFunction)Crossfire_Object_CheckTrigger, METH_O, NULL },
2807  { "Cast", (PyCFunction)Crossfire_Object_Cast, METH_VARARGS, NULL },
2808  { "LearnSpell", (PyCFunction)Crossfire_Object_LearnSpell, METH_O, NULL },
2809  { "ForgetSpell", (PyCFunction)Crossfire_Object_ForgetSpell, METH_O, NULL },
2810  { "KnowSpell", (PyCFunction)Crossfire_Object_KnowSpell, METH_VARARGS, NULL },
2811  { "CastAbility", (PyCFunction)Crossfire_Object_CastAbility, METH_VARARGS, NULL },
2812  { "PayAmount", (PyCFunction)Crossfire_Object_PayAmount, METH_VARARGS, NULL },
2813  { "Pay", (PyCFunction)Crossfire_Object_Pay, METH_O, NULL },
2814  { "CheckInventory", (PyCFunction)Crossfire_Object_CheckInventory, METH_VARARGS, NULL },
2815  { "CheckArchInventory", (PyCFunction)Crossfire_Object_CheckArchInventory, METH_VARARGS, NULL },
2816  { "OutOfMap", (PyCFunction)Crossfire_Object_GetOutOfMap, METH_VARARGS, NULL },
2817  { "CreateObject", (PyCFunction)Crossfire_Object_CreateInside, METH_VARARGS, NULL },
2818  { "InsertInto", (PyCFunction)Crossfire_Object_InsertInto, METH_O, NULL },
2819  { "ReadKey", (PyCFunction)Crossfire_Object_ReadKey, METH_VARARGS, NULL },
2820  { "WriteKey", (PyCFunction)Crossfire_Object_WriteKey, METH_VARARGS, NULL },
2821  { "CreateTimer", (PyCFunction)Crossfire_Object_CreateTimer, METH_VARARGS, NULL },
2822  { "AddExp", (PyCFunction)Crossfire_Object_AddExp, METH_VARARGS, NULL },
2823  { "Move", (PyCFunction)Crossfire_Object_Move, METH_VARARGS, NULL },
2824  { "MoveTo", (PyCFunction)Crossfire_Object_MoveTo, METH_VARARGS, NULL },
2825  { "ChangeAbil", (PyCFunction)Crossfire_Object_ChangeAbil, METH_O, NULL },
2826  { "Event", (PyCFunction)Crossfire_Object_Event, METH_VARARGS, NULL },
2827  { "RemoveDepletion",(PyCFunction)Crossfire_Object_RemoveDepletion, METH_VARARGS, NULL },
2828  { "Arrest", (PyCFunction)Crossfire_Object_Arrest, METH_VARARGS, NULL },
2829  { "PermExp", (PyCFunction)Crossfire_Object_PermExp, METH_NOARGS, NULL },
2830  { NULL, NULL, 0, NULL }
2831 };
2832 
2833 static PyNumberMethods ObjectConvert = {
2834  NULL, /* binaryfunc nb_add; */ /* __add__ */
2835  NULL, /* binaryfunc nb_subtract; */ /* __sub__ */
2836  NULL, /* binaryfunc nb_multiply; */ /* __mul__ */
2837 #ifndef IS_PY3K
2838  NULL, /* binaryfunc nb_divide; */ /* __div__ */
2839 #endif
2840  NULL, /* binaryfunc nb_remainder; */ /* __mod__ */
2841  NULL, /* binaryfunc nb_divmod; */ /* __divmod__ */
2842  NULL, /* ternaryfunc nb_power; */ /* __pow__ */
2843  NULL, /* unaryfunc nb_negative; */ /* __neg__ */
2844  NULL, /* unaryfunc nb_positive; */ /* __pos__ */
2845  NULL, /* unaryfunc nb_absolute; */ /* __abs__ */
2846 #ifdef IS_PY3K
2847  NULL, /* inquiry nb_bool; */ /* __bool__ */
2848 #else
2849  NULL, /* inquiry nb_nonzero; */ /* __nonzero__ */
2850 #endif
2851  NULL, /* unaryfunc nb_invert; */ /* __invert__ */
2852  NULL, /* binaryfunc nb_lshift; */ /* __lshift__ */
2853  NULL, /* binaryfunc nb_rshift; */ /* __rshift__ */
2854  NULL, /* binaryfunc nb_and; */ /* __and__ */
2855  NULL, /* binaryfunc nb_xor; */ /* __xor__ */
2856  NULL, /* binaryfunc nb_or; */ /* __or__ */
2857 #ifndef IS_PY3K
2858  NULL, /* coercion nb_coerce; */ /* __coerce__ */
2859 #endif
2860 #ifdef IS_PY3K
2861  /* This is not a typo. For Py3k it should be Crossfire_Object_Long
2862  * and NOT Crossfire_Object_Int.
2863  */
2864  Crossfire_Object_Long, /* unaryfunc nb_int; */ /* __int__ */
2865  NULL, /* void *nb_reserved; */
2866 #else
2867  Crossfire_Object_Int, /* unaryfunc nb_int; */ /* __int__ */
2868  Crossfire_Object_Long, /* unaryfunc nb_long; */ /* __long__ */
2869 #endif
2870  NULL, /* unaryfunc nb_float; */ /* __float__ */
2871 #ifndef IS_PY3K
2872  NULL, /* unaryfunc nb_oct; */ /* __oct__ */
2873  NULL, /* unaryfunc nb_hex; */ /* __hex__ */
2874 #endif
2875  NULL, /* binaryfunc nb_inplace_add; */
2876  NULL, /* binaryfunc nb_inplace_subtract; */
2877  NULL, /* binaryfunc nb_inplace_multiply; */
2878 #ifndef IS_PY3K
2879  NULL, /* binaryfunc nb_inplace_divide; */
2880 #endif
2881  NULL, /* binaryfunc nb_inplace_remainder; */
2882  NULL, /* ternaryfunc nb_inplace_power; */
2883  NULL, /* binaryfunc nb_inplace_lshift; */
2884  NULL, /* binaryfunc nb_inplace_rshift; */
2885  NULL, /* binaryfunc nb_inplace_and; */
2886  NULL, /* binaryfunc nb_inplace_xor; */
2887  NULL, /* binaryfunc nb_inplace_or; */
2888 
2889  NULL, /* binaryfunc nb_floor_divide; */
2890  NULL, /* binaryfunc nb_true_divide; */
2891  NULL, /* binaryfunc nb_inplace_floor_divide; */
2892  NULL, /* binaryfunc nb_inplace_true_divide; */
2893 #if defined(IS_PY25) || defined(IS_PY3K)
2894  NULL /* unaryfunc nb_index; */
2895 #endif
2896 };
2897 
2898 static PyObject *Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
2899  Crossfire_Object *self;
2900 
2901  self = (Crossfire_Object *)type->tp_alloc(type, 0);
2902  if (self) {
2903  self->obj = NULL;
2904  self->count = 0;
2905  }
2906 
2907  return (PyObject *)self;
2908 }
2909 
2910 static void Crossfire_Object_dealloc(PyObject *obj) {
2911  Crossfire_Object *self;
2912 
2913  self = (Crossfire_Object *)obj;
2914  if (self) {
2915  if (self->obj) {
2916  free_object_assoc(self->obj);
2917  }
2918  Py_TYPE(self)->tp_free(obj);
2919  }
2920 }
2921 
2922 static PyObject *Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
2923  Crossfire_Player *self;
2924 
2925  self = (Crossfire_Player *)type->tp_alloc(type, 0);
2926  if (self) {
2927  self->obj = NULL;
2928  self->count = 0;
2929  }
2930 
2931  return (PyObject *)self;
2932 }
2933 
2934 static void Crossfire_Player_dealloc(PyObject *obj) {
2935  Crossfire_Player *self;
2936 
2937  self = (Crossfire_Player *)obj;
2938  if (self) {
2939  if (self->obj) {
2940  free_object_assoc(self->obj);
2941  }
2942  Py_TYPE(self)->tp_free(obj);
2943  }
2944 }
2945 
2946 /* Our actual Python ObjectType */
2947 PyTypeObject Crossfire_ObjectType = {
2948 #ifdef IS_PY3K
2949  /* See http://bugs.python.org/issue4385 */
2950  PyVarObject_HEAD_INIT(NULL, 0)
2951 #else
2952  PyObject_HEAD_INIT(NULL)
2953  0, /* ob_size*/
2954 #endif
2955  "Crossfire.Object", /* tp_name*/
2956  sizeof(Crossfire_Object), /* tp_basicsize*/
2957  0, /* tp_itemsize*/
2958  Crossfire_Object_dealloc, /* tp_dealloc*/
2959  NULL, /* tp_print*/
2960  NULL, /* tp_getattr*/
2961  NULL, /* tp_setattr*/
2962 #ifdef IS_PY3K
2963  NULL, /* tp_reserved */
2964 #else
2965  (cmpfunc)Crossfire_Object_InternalCompare, /* tp_compare*/
2966 #endif
2967  NULL, /* tp_repr*/
2968  &ObjectConvert, /* tp_as_number*/
2969  NULL, /* tp_as_sequence*/
2970  NULL, /* tp_as_mapping*/
2971  PyObject_HashNotImplemented, /* tp_hash */
2972  NULL, /* tp_call*/
2973  NULL, /* tp_str*/
2974  PyObject_GenericGetAttr, /* tp_getattro*/
2975  PyObject_GenericSetAttr, /* tp_setattro*/
2976  NULL, /* tp_as_buffer*/
2977  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags*/
2978  "Crossfire objects", /* tp_doc */
2979  NULL, /* tp_traverse */
2980  NULL, /* tp_clear */
2981  (richcmpfunc)Crossfire_Object_RichCompare, /* tp_richcompare */
2982  0, /* tp_weaklistoffset */
2983  NULL, /* tp_iter */
2984  NULL, /* tp_iternext */
2985  ObjectMethods, /* tp_methods */
2986  NULL, /* tp_members */
2987  Object_getseters, /* tp_getset */
2988  NULL, /* tp_base */
2989  NULL, /* tp_dict */
2990  NULL, /* tp_descr_get */
2991  NULL, /* tp_descr_set */
2992  0, /* tp_dictoffset */
2993  NULL, /* tp_init */
2994  NULL, /* tp_alloc */
2995  Crossfire_Object_new, /* tp_new */
2996  NULL, /* tp_free */
2997  NULL, /* tp_is_gc */
2998  NULL, /* tp_bases */
2999  NULL, /* tp_mro */
3000  NULL, /* tp_cache */
3001  NULL, /* tp_subclasses */
3002  NULL, /* tp_weaklist */
3003  NULL, /* tp_del */
3004 };
3005 
3006 static PyGetSetDef Player_getseters[] = {
3007  { "Title", (getter)Player_GetTitle, (setter)Player_SetTitle, NULL, NULL },
3008  { "IP", (getter)Player_GetIP, NULL, NULL, NULL },
3009  { "MarkedItem", (getter)Player_GetMarkedItem, (setter)Player_SetMarkedItem, NULL, NULL },
3010  { "Party", (getter)Player_GetParty, (setter)Player_SetParty, NULL, NULL },
3011  { "BedMap", (getter)Player_GetBedMap, (setter)Player_SetBedMap, NULL, NULL },
3012  { "BedX", (getter)Player_GetBedX, (setter)Player_SetBedX, NULL, NULL },
3013  { "BedY", (getter)Player_GetBedY, (setter)Player_SetBedY, NULL, NULL },
3014  { NULL, NULL, NULL, NULL, NULL }
3015 };
3016 
3017 static PyMethodDef PlayerMethods[] = {
3018  { "Message", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
3019  { "Write", (PyCFunction)Crossfire_Player_Message, METH_VARARGS, NULL },
3020  { "CanPay", (PyCFunction)Crossfire_Player_CanPay, METH_NOARGS, NULL },
3021  { "QuestStart", (PyCFunction)Player_QuestStart, METH_VARARGS, NULL },
3022  { "QuestGetState", (PyCFunction)Player_QuestGetState, METH_VARARGS, NULL },
3023  { "QuestSetState", (PyCFunction)Player_QuestSetState, METH_VARARGS, NULL },
3024  { "QuestWasCompleted", (PyCFunction)Player_QuestWasCompleted, METH_VARARGS, NULL },
3025  { "KnowledgeKnown", (PyCFunction)Player_KnowledgeKnown, METH_VARARGS, NULL },
3026  { "GiveKnowledge", (PyCFunction)Player_GiveKnowledge, METH_VARARGS, NULL },
3027  { NULL, NULL, 0, NULL }
3028 };
3029 
3030 /* Our actual Python ObjectPlayerType */
3031 PyTypeObject Crossfire_PlayerType = {
3032 #ifdef IS_PY3K
3033  /* See http://bugs.python.org/issue4385 */
3034  PyVarObject_HEAD_INIT(NULL, 0)
3035 #else
3036  PyObject_HEAD_INIT(NULL)
3037  0, /* ob_size*/
3038 #endif
3039  "Crossfire.Player", /* tp_name*/
3040  sizeof(Crossfire_Player), /* tp_basicsize*/
3041  0, /* tp_itemsize*/
3042  Crossfire_Player_dealloc, /* tp_dealloc*/
3043  NULL, /* tp_print*/
3044  NULL, /* tp_getattr*/
3045  NULL, /* tp_setattr*/
3046  NULL, /* tp_compare*/
3047  NULL, /* tp_repr*/
3048  NULL, /* tp_as_number*/
3049  NULL, /* tp_as_sequence*/
3050  NULL, /* tp_as_mapping*/
3051  /* Should be NULL to inherit tp_richcompare and tp_compare from Crossfire_ObjectType. */
3052  NULL, /* tp_hash */
3053  NULL, /* tp_call*/
3054  NULL, /* tp_str*/
3055  PyObject_GenericGetAttr, /* tp_getattro*/
3056  PyObject_GenericSetAttr, /* tp_setattro*/
3057  NULL, /* tp_as_buffer*/
3058  Py_TPFLAGS_DEFAULT, /* tp_flags*/
3059  "Crossfire player", /* tp_doc */
3060  NULL, /* tp_traverse */
3061  NULL, /* tp_clear */
3062  NULL, /* tp_richcompare */
3063  0, /* tp_weaklistoffset */
3064  NULL, /* tp_iter */
3065  NULL, /* tp_iternext */
3066  PlayerMethods, /* tp_methods */
3067  NULL, /* tp_members */
3068  Player_getseters, /* tp_getset */
3069  &Crossfire_ObjectType, /* tp_base */
3070  NULL, /* tp_dict */
3071  NULL, /* tp_descr_get */
3072  NULL, /* tp_descr_set */
3073  0, /* tp_dictoffset */
3074  NULL, /* tp_init */
3075  NULL, /* tp_alloc */
3076  Crossfire_Player_new, /* tp_new */
3077  NULL, /* tp_free */
3078  NULL, /* tp_is_gc */
3079  NULL, /* tp_bases */
3080  NULL, /* tp_mro */
3081  NULL, /* tp_cache */
3082  NULL, /* tp_subclasses */
3083  NULL, /* tp_weaklist */
3084  NULL, /* tp_del */
3085 };
3086 
3090 PyObject *Crossfire_Object_wrap(object *what) {
3091  Crossfire_Object *wrapper;
3092  Crossfire_Player *plwrap;
3093  PyObject *pyobj;
3094 
3095  /* return None if no object was to be wrapped */
3096  if (what == NULL) {
3097  Py_INCREF(Py_None);
3098  return Py_None;
3099  }
3100 
3101  pyobj = find_assoc_pyobject(what);
3102  if ((!pyobj) || (object_was_destroyed(((Crossfire_Object *)pyobj)->obj, ((Crossfire_Object *)pyobj)->count))) {
3103  if (what->type == PLAYER) {
3104  plwrap = PyObject_NEW(Crossfire_Player, &Crossfire_PlayerType);
3105  if (plwrap != NULL) {
3106  plwrap->obj = what;
3107  plwrap->count = what->count;
3108  }
3109  pyobj = (PyObject *)plwrap;
3110  } else {
3111  wrapper = PyObject_NEW(Crossfire_Object, &Crossfire_ObjectType);
3112  if (wrapper != NULL) {
3113  wrapper->obj = what;
3114  wrapper->count = what->count;
3115  }
3116  pyobj = (PyObject *)wrapper;
3117  }
3118  add_object_assoc(what, pyobj);
3119  } else {
3120  Py_INCREF(pyobj);
3121  }
3122  return pyobj;
3123 }
#define CFAPI_OBJECT_PROP_STR
Definition: plugin.h:249
#define CFAPI_OBJECT_PROP_MAP
Definition: plugin.h:180
static int Object_SetExp(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_object_set_nrof(object *, int nrof)
static PyObject * Object_GetMessage(Crossfire_Object *whoptr, void *closure)
static int Object_SetUsedUp(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Split(Crossfire_Object *who, PyObject *args)
Definition: object.h:274
static PyObject * Crossfire_Object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject * Object_GetMaxGrace(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Event(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetSP(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetBelow(Crossfire_Object *whoptr, void *closure)
#define FLAG_SEE_IN_DARK
Definition: define.h:338
static void add_object_assoc(object *key, PyObject *value)
long cf_object_get_long_property(object *op, long propcode)
static PyObject * Object_GetWis(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_MATERIAL
Definition: plugin.h:205
static PyObject * Crossfire_Object_AddExp(Crossfire_Object *who, PyObject *args)
void cf_object_free_drop_inventory(object *ob)
#define CFAPI_OBJECT_PROP_ANIMATION
Definition: plugin.h:270
#define FLAG_DAMNED
Definition: define.h:318
#define FLAG_IS_FLOOR
Definition: define.h:303
int npc_msg_count
Definition: dialog.h:59
#define FLAG_UNPAID
Definition: define.h:236
#define CFAPI_OBJECT_PROP_SP
Definition: plugin.h:259
static PyObject * Object_GetRunAway(Crossfire_Object *whoptr, void *closure)
PyObject_HEAD object * obj
CFPContext * current_context
Definition: cfpython.c:113
static int Object_SetWeightLimit(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetDuration(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_NAME
Definition: plugin.h:182
#define CFAPI_OBJECT_PROP_OB_BELOW
Definition: plugin.h:173
int cf_player_knowledge_has(object *op, const char *knowledge)
static PyObject * Crossfire_Object_Pay(Crossfire_Object *who, PyObject *args)
object * cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y)
static PyObject * Player_GetBedX(Crossfire_Player *whoptr, void *closure)
static int Object_SetScared(Crossfire_Object *whoptr, PyObject *value, void *closure)
PyObject * Crossfire_Party_wrap(partylist *what)
static PyObject * Object_GetAbove(Crossfire_Object *whoptr, void *closure)
static int Object_SetLastSP(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_RACE
Definition: plugin.h:185
static PyObject * Crossfire_Object_CreateInside(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetFace(Crossfire_Object *whoptr, void *closure)
#define FLAG_SLEEP
Definition: define.h:308
static int Object_SetCha(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Crossfire_Object_InternalCompare(Crossfire_Object *left, Crossfire_Object *right)
void cf_spring_trap(object *trap, object *victim)
static int Object_SetHitBack(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCanUseScroll(Crossfire_Object *whoptr, void *closure)
static int Object_SetMaxGrace(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_CastAbility(Crossfire_Object *who, PyObject *args)
#define FLAG_HITBACK
Definition: define.h:267
#define CFAPI_OBJECT_PROP_ARCHETYPE
Definition: plugin.h:233
#define CFAPI_OBJECT_PROP_WEIGHT
Definition: plugin.h:218
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:201
void cf_free_string(sstring str)
#define FLAG_USE_SCROLL
Definition: define.h:292
static int Object_SetMap(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Apply(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_FACE
Definition: plugin.h:269
static PyObject * Object_GetContainer(Crossfire_Object *whoptr, void *closure)
const char * cf_object_get_key(object *op, const char *keyname)
static int Object_SetQuantity(Crossfire_Object *whoptr, PyObject *value, void *closure)
PyObject * Crossfire_Map_wrap(mapstruct *what)
Definition: cfpython_map.c:427
static PyObject * Crossfire_Object_Drop(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetSlaying(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetInventory(Crossfire_Object *whoptr, void *closure)
static int Object_SetApplied(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCanUseWeapon(Crossfire_Object *whoptr, void *closure)
static PyGetSetDef Player_getseters[]
static PyObject * Crossfire_Object_CreateTimer(Crossfire_Object *who, PyObject *args)
static int Object_SetInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Player_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int Object_SetNoSave(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_GOD
Definition: plugin.h:266
static PyObject * Object_GetInvisible(Crossfire_Object *whoptr, void *closure)
PyObject_HEAD partylist * party
#define CFAPI_OBJECT_PROP_DIRECTION
Definition: plugin.h:195
static int Object_SetFood(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_USE_ARMOUR
Definition: define.h:296
static int Object_SetAC(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetAC(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Take(Crossfire_Object *who, PyObject *args)
static int Player_SetBedY(Crossfire_Player *whoptr, PyObject *value, void *closure)
#define FLAG_STAND_STILL
Definition: define.h:309
static PyObject * Object_GetMoveOn(Crossfire_Object *whoptr, void *closure)
void cf_object_set_flag(object *ob, int flag, int value)
int cf_object_set_animation(object *op, const char *animation)
#define CFAPI_OBJECT_PROP_MAXGP
Definition: plugin.h:264
#define NDI_ORANGE
Definition: newclient.h:225
static PyObject * Object_GetTurnable(Crossfire_Object *whoptr, void *closure)
#define FLAG_FRIENDLY
Definition: define.h:246
static PyObject * Player_GetBedMap(Crossfire_Player *whoptr, void *closure)
static PyObject * Object_GetFacing(Crossfire_Object *whoptr, void *closure)
static int Player_SetParty(Crossfire_Player *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetArchetype(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Remove(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetThrown(Crossfire_Object *whoptr, void *closure)
static int Object_SetSlaying(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetNoDamage(Crossfire_Object *whoptr, PyObject *value, void *closure)
object * cf_object_insert_in_ob(object *op, object *where)
static PyObject * Object_GetLastEat(Crossfire_Object *whoptr, void *closure)
partylist * cf_player_get_party(object *op)
static int Object_SetReflectMissiles(Crossfire_Object *whoptr, PyObject *value, void *closure)
unsigned char MoveType
Definition: define.h:432
ptr_assoc * ptr_assoc_table[PTR_ASSOC_TABLESIZE]
Definition: hashtable.h:15
#define CFAPI_OBJECT_PROP_SUBTYPE
Definition: plugin.h:198
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:179
#define CFAPI_OBJECT_PROP_INVENTORY
Definition: plugin.h:176
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:183
static PyObject * Object_GetMonster(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Cast(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetMoveOff(Crossfire_Object *whoptr, void *closure)
int cf_object_pay_item(object *op, object *pl)
#define FLAG_CONFUSED
Definition: define.h:312
static PyObject * Object_GetUnaggressive(Crossfire_Object *whoptr, void *closure)
static PyMethodDef ObjectMethods[]
#define FLAG_STEALTH
Definition: define.h:313
PyTypeObject Crossfire_PartyType
#define FLAG_RANDOM_MOVE
Definition: define.h:310
#define CFAPI_OBJECT_PROP_OWNER
Definition: plugin.h:243
static PyObject * Object_GetNoDamage(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_GetResist(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetLevel(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Long(PyObject *obj)
#define FLAG_USE_WEAPON
Definition: define.h:297
#define CFAPI_OBJECT_PROP_MOVE_ON
Definition: plugin.h:275
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:188
static PyObject * Object_GetTotalExp(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetUndead(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_EXP_MULTIPLIER
Definition: plugin.h:232
static PyObject * Crossfire_Object_ReadKey(Crossfire_Object *who, PyObject *args)
void cf_fix_object(object *op)
static PyObject * Object_GetWeightLimit(Crossfire_Object *whoptr, void *closure)
int cf_object_remove_depletion(object *op, int level)
#define object_was_destroyed(op, old_tag)
Definition: object.h:68
static int Object_SetUnique(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_player_arrest(object *who)
static int Object_SetDuration(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_KnowSpell(Crossfire_Object *who, PyObject *args)
int cf_object_set_face(object *op, const char *face)
static PyObject * Crossfire_Player_CanPay(Crossfire_Player *who, PyObject *args)
static PyObject * Object_GetAttackType(Crossfire_Object *whoptr, void *closure)
object * cf_player_get_marked_item(object *op)
static PyObject * Object_GetCanSeeInDark(Crossfire_Object *whoptr, void *closure)
char * cf_object_get_string_property(object *op, int propcode, char *buf, int size)
static int Object_SetOwner(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetPow(Crossfire_Object *whoptr, void *closure)
void cf_player_knowledge_give(object *op, const char *knowledge)
static PyObject * Crossfire_Object_SetResist(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetQuantity(Crossfire_Object *whoptr, void *closure)
sstring cf_add_string(const char *str)
#define CFAPI_OBJECT_PROP_SLAYING
Definition: plugin.h:186
int cf_object_get_int_property(object *op, int propcode)
static int Object_SetStealthy(Crossfire_Object *whoptr, PyObject *value, void *closure)
int64_t cf_object_perm_exp(object *op)
static int Object_SetPow(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_USE_RING
Definition: define.h:298
static int Object_SetIsPet(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_RichCompare(Crossfire_Object *left, Crossfire_Object *right, int op)
static int Object_SetUnpaid(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetInt(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_OTHER_ARCH
Definition: plugin.h:234
#define CFAPI_OBJECT_PROP_LAST_SP
Definition: plugin.h:211
#define FLAG_REMOVED
Definition: define.h:232
static PyObject * Player_GetParty(Crossfire_Player *whoptr, void *closure)
static PyObject * Object_GetBlocksView(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_LAST_GRACE
Definition: plugin.h:212
int cf_object_transfer(object *op, int x, int y, int randomly, object *originator)
void cf_object_forget_spell(object *op, object *sp)
#define CFAPI_OBJECT_PROP_COUNT
Definition: plugin.h:181
#define FLAG_CAN_ROLL
Definition: define.h:254
#define FLAG_KNOWN_MAGICAL
Definition: define.h:320
void cf_log(LogLevel logLevel, const char *format,...)
static PyObject * Object_GetRollable(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMoveBlock(Crossfire_Object *whoptr, void *closure)
float cf_object_get_float_property(object *op, int propcode)
static PyObject * Object_GetMaterial(Crossfire_Object *whoptr, void *closure)
void cf_object_learn_spell(object *op, object *spell, int special_prayer)
static PyObject * Object_GetStr(Crossfire_Object *whoptr, void *closure)
#define FLAG_IS_USED_UP
Definition: define.h:260
#define MOVE_ALL
Definition: define.h:413
static int Object_SetNamePl(Crossfire_Object *whoptr, PyObject *value, void *closure)
int cf_object_check_trigger(object *op, object *cause)
void cf_quest_start(object *pl, sstring quest_code, int state)
static int Object_SetWC(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_SEE_INVISIBLE
Definition: define.h:253
static int Object_SetMoveAllow(Crossfire_Object *whoptr, PyObject *value, void *closure)
sstring cf_object_get_sstring_property(object *op, int propcode)
static PyObject * Object_GetUsedUp(Crossfire_Object *whoptr, void *closure)
void cf_log_plain(LogLevel logLevel, const char *message)
static PyObject * Object_GetType(Crossfire_Object *whoptr, void *closure)
#define FLAG_UNDEAD
Definition: define.h:270
#define CFAPI_PLAYER_PROP_BED_X
Definition: plugin.h:286
static int Object_SetGod(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetGrace(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_InsertInto(Crossfire_Object *who, PyObject *args)
static PyObject * Crossfire_Object_WriteKey(Crossfire_Object *who, PyObject *args)
static PyObject * Crossfire_Object_CheckInventory(Crossfire_Object *who, PyObject *args)
void cf_quest_set_player_state(object *pl, sstring quest_code, int state)
MoveType cf_object_get_movetype_property(object *op, int propcode)
void cf_player_set_marked_item(object *op, object *ob)
static int Object_SetDam(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetReflectSpells(Crossfire_Object *whoptr, void *closure)
int cf_player_can_pay(object *op)
PyObject_HEAD object * obj
#define CFAPI_OBJECT_PROP_FACING
Definition: plugin.h:196
static int Object_SetUndead(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMakeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_ActivateRune(Crossfire_Object *who, PyObject *args)
int cf_timer_create(object *ob, long delay, int mode)
#define FLAG_ALIVE
Definition: define.h:230
#define CFAPI_OBJECT_PROP_ENVIRONMENT
Definition: plugin.h:177
#define FLAG_REFL_SPELL
Definition: define.h:275
static PyObject * Crossfire_Object_ForgetSpell(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_GP
Definition: plugin.h:260
static int Object_SetTitle(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_CHA
Definition: plugin.h:255
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:278
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:253
void cf_object_set_int_property(object *op, int propcode, int value)
static int Object_SetHasXRays(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_CheckTrigger(Crossfire_Object *who, PyObject *args)
#define FLAG_CAN_USE_SKILL
Definition: define.h:322
#define CFAPI_OBJECT_PROP_LEVEL
Definition: plugin.h:209
object * cf_object_clone(object *op, int clonetype)
#define CFAPI_PLAYER_PROP_BED_MAP
Definition: plugin.h:285
#define FLAG_UNAGGRESSIVE
Definition: define.h:272
static PyObject * Crossfire_Player_Message(Crossfire_Player *who, PyObject *args)
#define CFAPI_OBJECT_PROP_MOVE_ALLOW
Definition: plugin.h:274
#define FLAG_USE_RANGE
Definition: define.h:293
static PyObject * Player_GetBedY(Crossfire_Player *whoptr, void *closure)
void cf_object_set_float_property(object *op, int propcode, float value)
int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix)
static PyObject * Object_GetDamned(Crossfire_Object *whoptr, void *closure)
static int Object_SetLastEat(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetIdentified(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Player_SetBedMap(Crossfire_Player *whoptr, PyObject *value, void *closure)
#define snprintf
Definition: win32.h:46
#define FLAG_NO_SAVE
Definition: define.h:244
static int Object_SetCursed(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetAlive(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetMoveType(Crossfire_Object *whoptr, void *closure)
double cf_object_get_double_property(object *op, int propcode)
#define FLAG_IDENTIFIED
Definition: define.h:261
static PyObject * Object_GetGodGiven(Crossfire_Object *whoptr, void *closure)
static int Object_SetReflectSpells(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetIdentified(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMap(Crossfire_Object *whoptr, void *closure)
static int Object_SetInt(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetLastGrace(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_FP
Definition: plugin.h:261
static int Object_SetKnownCursed(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_BLOCKSVIEW
Definition: define.h:269
static PyObject * Object_GetCursed(Crossfire_Object *whoptr, void *closure)
const char * name
Definition: object.h:311
static int Object_SetRandomMovement(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCount(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetFloor(Crossfire_Object *whoptr, void *closure)
static int Object_SetSkill(Crossfire_Object *whoptr, PyObject *value, void *closure)
sstring cf_query_name_pl(object *ob)
static PyMethodDef PlayerMethods[]
static int Object_SetAttackMovement(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetArchName(Crossfire_Object *whoptr, void *closure)
static int Player_SetBedX(Crossfire_Player *whoptr, PyObject *value, void *closure)
static int Object_SetGlowRadius(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetExpMul(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetOwner(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_LAST_EAT
Definition: plugin.h:213
static int Object_SetLifesaver(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Player_QuestGetState(Crossfire_Player *whoptr, PyObject *args)
static PyObject * Player_GetTitle(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetGlowRadius(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Int(PyObject *obj)
PyObject * Crossfire_Object_wrap(object *what)
#define CFAPI_OBJECT_PROP_MOVE_OFF
Definition: plugin.h:276
#define CFAPI_OBJECT_PROP_WEIGHT_LIMIT
Definition: plugin.h:219
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:190
static PyObject * Object_GetScared(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetOtherArchetype(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetExists(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetEnemy(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetCha(Crossfire_Object *whoptr, void *closure)
#define FLAG_SCARED
Definition: define.h:271
static PyObject * Object_GetAnimated(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetFriendly(Crossfire_Object *whoptr, void *closure)
void * find_assoc_value(ptr_assoc **hash_table, void *key)
Definition: hashtable.c:205
#define CFAPI_OBJECT_PROP_ENEMY
Definition: plugin.h:224
static PyObject * Object_GetExp(Crossfire_Object *whoptr, void *closure)
int cf_object_query_money(const object *op)
#define FLAG_ONLY_ATTACK
Definition: define.h:311
#define FLAG_XRAYS
Definition: define.h:301
static int Object_SetKnownMagical(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure)
int64_t cf_object_get_int64_property(object *op, int propcode)
static int Object_SetStandStill(Crossfire_Object *whoptr, PyObject *value, void *closure)
unsigned __int64 uint64_t
Definition: win32.h:167
static PyObject * Object_GetMoney(Crossfire_Object *whoptr, void *closure)
static int Object_SetDirection(Crossfire_Object *whoptr, PyObject *value, void *closure)
object * cf_object_present_archname_inside(object *op, char *whatstr)
static PyObject * Object_GetUnpaid(Crossfire_Object *whoptr, void *closure)
static int Object_SetConfused(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetName(Crossfire_Object *whoptr, void *closure)
#define FLAG_WIZ
Definition: define.h:231
#define CFAPI_OBJECT_PROP_ITEM_POWER
Definition: plugin.h:216
#define FLAG_BEEN_APPLIED
Definition: define.h:324
static PyObject * Object_GetAnimSpeed(Crossfire_Object *whoptr, void *closure)
static int Object_SetGodGiven(Crossfire_Object *whoptr, PyObject *value, void *closure)
object * cf_object_find_by_arch_name(const object *who, const char *name)
static int Object_SetEnemy(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetLevel(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetPickable(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetLastGrace(Crossfire_Object *whoptr, void *closure)
static PyObject * Player_GiveKnowledge(Crossfire_Player *who, PyObject *args)
static int Object_SetFace(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetAnim(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_Reposition(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetSpeed(Crossfire_Object *whoptr, void *closure)
static PyObject * Crossfire_Object_RemoveDepletion(Crossfire_Object *who, PyObject *args)
#define FLAG_CAST_SPELL
Definition: define.h:291
void cf_object_set_movetype_property(object *op, int propcode, MoveType value)
#define CFAPI_OBJECT_PROP_EXP
Definition: plugin.h:242
mapstruct * cf_object_get_map_property(object *op, int propcode)
PyObject * who
Definition: cfpython.h:116
static PyObject * Object_GetDam(Crossfire_Object *whoptr, void *closure)
void cf_object_remove(object *op)
static PyObject * Crossfire_Object_Move(Crossfire_Object *who, PyObject *args)
#define FLAG_RUN_AWAY
Definition: define.h:280
static PyObject * Object_GetApplied(Crossfire_Object *whoptr, void *closure)
static int Object_SetMoveBlock(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_IS_THROWN
Definition: define.h:249
void add_ptr_assoc(ptr_assoc **hash_table, void *key, void *value)
Definition: hashtable.c:109
signed __int64 int64_t
Definition: win32.h:168
#define CFAPI_OBJECT_PROP_TOTAL_EXP
Definition: plugin.h:222
static const flag_definition flags[]
int cf_object_apply(object *op, object *author, int flags)
void init_ptr_assoc_table(ptr_assoc **hash_table)
Definition: hashtable.c:57
static PyObject * Object_GetReflectMissiles(Crossfire_Object *whoptr, void *closure)
#define EXISTCHECK_INT(ob)
static PyObject * Object_GetKnownCursed(Crossfire_Object *whoptr, void *closure)
int cf_quest_was_completed(object *pl, sstring quest_code)
#define FLAG_KNOWN_CURSED
Definition: define.h:321
void cf_player_set_party(object *op, partylist *party)
object * cf_object_get_object_property(object *op, int propcode)
const char * sstring
Definition: global.h:40
PyTypeObject Crossfire_PlayerType
static PyObject * Object_GetHitBack(Crossfire_Object *whoptr, void *closure)
static int Player_SetMarkedItem(Crossfire_Player *whoptr, PyObject *value, void *closure)
#define FLAG_CURSED
Definition: define.h:317
#define CFAPI_OBJECT_PROP_DAM
Definition: plugin.h:265
Definition: object.h:107
#define CFAPI_OBJECT_PROP_MOVE_TYPE
Definition: plugin.h:272
#define CFAPI_OBJECT_PROP_SKILL
Definition: plugin.h:187
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:257
static int Object_SetFacing(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_ANIMATE
Definition: define.h:242
int cf_object_pay_amount(object *pl, uint64_t to_pay)
#define FLAG_NO_DAMAGE
Definition: define.h:364
static PyObject * Object_GetPickable(Crossfire_Object *whoptr, void *closure)
static int Object_SetName(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define FLAG_GENERATOR
Definition: define.h:248
static PyObject * Player_QuestStart(Crossfire_Player *whoptr, PyObject *args)
static PyObject * Crossfire_Object_PayAmount(Crossfire_Object *who, PyObject *args)
char * cf_player_get_title(object *op, char *title, int size)
static PyObject * Object_GetMoveSlowPenalty(Crossfire_Object *whoptr, void *closure)
#define FLAG_BLIND
Definition: define.h:337
static PyObject * Object_GetMoveAllow(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMoveSlow(Crossfire_Object *whoptr, void *closure)
int cf_object_get_flag(object *ob, int flag)
static PyObject * Object_GetItemPower(Crossfire_Object *whoptr, void *closure)
#define TYPEEXISTCHECK(ob)
static int Object_SetValue(Crossfire_Object *whoptr, PyObject *value, void *closure)
void cf_object_set_int64_property(object *op, int propcode, int64_t value)
static PyObject * Crossfire_Object_Fix(Crossfire_Object *who, PyObject *args)
#define MAX_NPC
Definition: dialog.h:46
#define CFAPI_OBJECT_PROP_SPEED_LEFT
Definition: plugin.h:193
int cf_object_move(object *op, int dir, object *originator)
static PyObject * Object_GetCanUseBow(Crossfire_Object *whoptr, void *closure)
static int Object_SetSpeedLeft(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_LearnSpell(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetAttackMovement(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetLastSP(Crossfire_Object *whoptr, void *closure)
tag_t count
Definition: object.h:299
sstring cf_player_get_ip(object *op)
static PyObject * Object_GetCanCastSpell(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_HP
Definition: plugin.h:258
#define CFAPI_OBJECT_PROP_TITLE
Definition: plugin.h:184
static int Object_SetGrace(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_PLAYER_PROP_BED_Y
Definition: plugin.h:287
static PyObject * Object_GetWeight(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_SPEED
Definition: plugin.h:192
uint8_t type
Definition: object.h:340
static int Object_SetMoveOff(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define CFAPI_OBJECT_PROP_FRIENDLY
Definition: plugin.h:237
static PyObject * Object_GetSubtype(Crossfire_Object *whoptr, void *closure)
void cf_object_change_exp(object *op, int64_t exp, const char *skill_name, int flag)
static PyObject * Object_GetWasDM(Crossfire_Object *whoptr, void *closure)
struct talk_info * talk
Definition: cfpython.h:127
#define CFAPI_OBJECT_PROP_ANIM_SPEED
Definition: plugin.h:236
void cf_object_pickup(object *op, object *what)
#define FLAG_SPLITTING
Definition: define.h:266
void cf_object_drop(object *op, object *author)
#define CFAPI_OBJECT_PROP_LUCK
Definition: plugin.h:241
static PyGetSetDef Object_getseters[]
#define FLAG_APPLIED
Definition: define.h:235
#define NROFATTACKS
Definition: attack.h:17
#define CFAPI_OBJECT_PROP_ARCH_NAME
Definition: plugin.h:267
static PyObject * Object_GetBlind(Crossfire_Object *whoptr, void *closure)
#define FLAG_LIFESAVE
Definition: define.h:306
#define CFAPI_OBJECT_PROP_DEX
Definition: plugin.h:250
static PyObject * Object_GetSpeedLeft(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_ATTACK_MOVEMENT
Definition: plugin.h:230
static int Object_SetTurnable(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Say(Crossfire_Object *who, PyObject *args)
void free_ptr_assoc(ptr_assoc **hash_table, void *key)
Definition: hashtable.c:222
#define FLAG_MAKE_INVIS
Definition: define.h:329
#define CFAPI_OBJECT_PROP_CON
Definition: plugin.h:251
static PyObject * Object_GetSleeping(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetDM(Crossfire_Object *whoptr, void *closure)
#define FLAG_STARTEQUIP
Definition: define.h:268
static void Crossfire_Player_dealloc(PyObject *obj)
void init_object_assoc_table(void)
static PyObject * Object_GetBeenApplied(Crossfire_Object *whoptr, void *closure)
static int Object_SetItemPower(Crossfire_Object *whoptr, PyObject *value, 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:194
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)
#define CFAPI_OBJECT_PROP_MAXSP
Definition: plugin.h:263
static PyObject * Object_GetGod(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetNoSave(Crossfire_Object *whoptr, void *closure)
#define FLAG_MONSTER
Definition: define.h:245
int cf_quest_get_player_state(object *pl, sstring quest_code)
#define NDI_UNIQUE
Definition: newclient.h:245
PyObject * Crossfire_Archetype_wrap(archetype *what)
object * cf_object_check_for_spell(object *op, const char *name)
static PyObject * Object_GetCanUseRing(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_INVISIBLE
Definition: plugin.h:268
static int Object_SetStr(Crossfire_Object *whoptr, PyObject *value, void *closure)
sstring npc_msgs[MAX_NPC]
Definition: dialog.h:60
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
static PyObject * Crossfire_Object_GetOutOfMap(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_TYPE
Definition: plugin.h:197
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:254
static PyObject * Player_KnowledgeKnown(Crossfire_Player *who, PyObject *args)
static PyObject * Player_QuestWasCompleted(Crossfire_Player *whoptr, PyObject *args)
static int Object_SetMaxHP(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetDex(Crossfire_Object *whoptr, void *closure)
#define FLAG_WAS_WIZ
Definition: define.h:234
static int Object_SetDamned(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMaxSP(Crossfire_Object *whoptr, PyObject *value, void *closure)
#define MAX_NAME
Definition: define.h:41
#define CFAPI_OBJECT_PROP_GLOW_RADIUS
Definition: plugin.h:221
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:256
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:277
#define CFAPI_OBJECT_PROP_MATERIAL_NAME
Definition: plugin.h:206
static PyObject * Player_GetIP(Crossfire_Player *whoptr, void *closure)
static PyObject * Crossfire_Object_PermExp(Crossfire_Object *who, PyObject *args)
static int Object_SetRollable(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetCanUseWand(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetHasXRays(Crossfire_Object *whoptr, void *closure)
Definition: map.h:325
#define CF_IS_PYSTR(cfpy_obj)
Definition: cfpython.h:80
PyTypeObject Crossfire_MapType
Definition: cfpython_map.c:551
#define CFAPI_OBJECT_PROP_MAXHP
Definition: plugin.h:262
static PyObject * Object_GetLuck(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetEnv(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetCanUseArmour(Crossfire_Object *whoptr, void *closure)
int cf_object_out_of_map(object *op, int x, int y)
#define FLAG_UNIQUE
Definition: define.h:288
#define FLAG_NO_PICK
Definition: define.h:239
int cf_object_change_abil(object *op, object *tmp)
static PyObject * Crossfire_Object_Arrest(Crossfire_Object *who, PyObject *args)
static PyObject * Crossfire_Object_QueryName(Crossfire_Object *who, PyObject *args)
static int Object_SetCon(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Crossfire_Object_Teleport(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_VALUE
Definition: plugin.h:208
static PyObject * Player_GetMarkedItem(Crossfire_Player *whoptr, void *closure)
#define FLAG_REFL_MISSILE
Definition: define.h:273
static PyObject * Object_GetUnique(Crossfire_Object *whoptr, void *closure)
static int Object_SetCanSeeInvisible(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMessage(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetMoveType(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetValue(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_WIS
Definition: plugin.h:252
#define CFAPI_OBJECT_PROP_DURATION
Definition: plugin.h:279
static PyObject * Object_GetRandomMovement(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_OB_ABOVE
Definition: plugin.h:172
object * cf_create_object_by_name(const char *name)
char * cf_query_name(object *ob, char *name, int size)
int cf_object_move_to(object *op, int x, int y)
static PyObject * Player_QuestSetState(Crossfire_Player *whoptr, PyObject *args)
static PyObject * Crossfire_Object_CheckArchInventory(Crossfire_Object *who, PyObject *args)
#define CFAPI_OBJECT_PROP_Y
Definition: plugin.h:191
#define EXISTCHECK(ob)
static PyObject * Object_GetCon(Crossfire_Object *whoptr, void *closure)
#define FLAG_USE_BOW
Definition: define.h:294
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
static PyObject * Object_GetOnlyAttack(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetMaxSP(Crossfire_Object *whoptr, void *closure)
static int Object_SetWis(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetIsPet(Crossfire_Object *whoptr, void *closure)
static int Object_SetSleeping(Crossfire_Object *whoptr, PyObject *value, void *closure)
static int Object_SetAnimSpeed(Crossfire_Object *whoptr, PyObject *value, void *closure)
static PyObject * Object_GetGenerator(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetAlive(Crossfire_Object *whoptr, void *closure)
static PyObject * Object_GetX(Crossfire_Object *whoptr, void *closure)
#define CFAPI_OBJECT_PROP_MOVE_BLOCK
Definition: plugin.h:273
static PyObject * Object_GetTitle(Crossfire_Object *whoptr, void *closure)
void cf_object_set_object_property(object *op, int propcode, object *value)
static PyObject * Crossfire_Object_ChangeAbil(Crossfire_Object *who, PyObject *args)
static PyObject * Object_GetWC(Crossfire_Object *whoptr, void *closure)
object * cf_object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
static PyObject * Object_GetStandStill(Crossfire_Object *whoptr, void *closure)
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)
static PyObject * Object_GetSplitting(Crossfire_Object *whoptr, void *closure)
#define FLAG_IS_TURNABLE
Definition: define.h:256