ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/plugins/cfperl/cfperl.xs
(Generate patch)

Comparing deliantra/server/plugins/cfperl/cfperl.xs (file contents):
Revision 1.58 by elmex, Tue Jul 11 16:50:16 2006 UTC vs.
Revision 1.59 by elmex, Sat Jul 15 11:57:02 2006 UTC

48#include <stdarg.h> 48#include <stdarg.h>
49 49
50//#include "EventAPI.h" 50//#include "EventAPI.h"
51#include "perlxsi.c" 51#include "perlxsi.c"
52 52
53extern sint64 *levels; // the experience table
54
53typedef object object_ornull; 55typedef object object_ornull;
54typedef mapstruct mapstruct_ornull; 56typedef mapstruct mapstruct_ornull;
55 57
56static f_plug_api gethook; 58static f_plug_api gethook;
57static f_plug_api registerGlobalEvent; 59static f_plug_api registerGlobalEvent;
412 414
413 /* Pick the global events you want to monitor from this plugin */ 415 /* Pick the global events you want to monitor from this plugin */
414 registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); 416 registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener);
415 registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); 417 registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener);
416 //registerGlobalEvent (NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener); 418 //registerGlobalEvent (NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener);
419 registerGlobalEvent (NULL, EVENT_FIND_UNARMED_SKILL, PLUGIN_NAME, globalEventListener);
420 registerGlobalEvent (NULL, EVENT_PLAYER_USE_SKILL, PLUGIN_NAME, globalEventListener);
421 registerGlobalEvent (NULL, EVENT_MONSTER_USE_SKILL, PLUGIN_NAME, globalEventListener);
417 registerGlobalEvent (NULL, EVENT_PLAYER_DEATH, PLUGIN_NAME, globalEventListener); 422 registerGlobalEvent (NULL, EVENT_PLAYER_DEATH, PLUGIN_NAME, globalEventListener);
418 registerGlobalEvent (NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener); 423 registerGlobalEvent (NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener);
419 registerGlobalEvent (NULL, EVENT_LOGIN, PLUGIN_NAME, globalEventListener); 424 registerGlobalEvent (NULL, EVENT_LOGIN, PLUGIN_NAME, globalEventListener);
420 registerGlobalEvent (NULL, EVENT_LOGOUT, PLUGIN_NAME, globalEventListener); 425 registerGlobalEvent (NULL, EVENT_LOGOUT, PLUGIN_NAME, globalEventListener);
421 registerGlobalEvent (NULL, EVENT_MAPENTER, PLUGIN_NAME, globalEventListener); 426 registerGlobalEvent (NULL, EVENT_MAPENTER, PLUGIN_NAME, globalEventListener);
574 579
575 case EVENT_SHOUT: 580 case EVENT_SHOUT:
576 case EVENT_MUZZLE: 581 case EVENT_MUZZLE:
577 case EVENT_KICK: 582 case EVENT_KICK:
578 PUSH_OB; 583 PUSH_OB;
584 PUSH_PV;
585 break;
586
587 case EVENT_FIND_UNARMED_SKILL:
588 PUSH_OB;
589 break;
590
591 case EVENT_PLAYER_USE_SKILL:
592 case EVENT_MONSTER_USE_SKILL:
593 PUSH_OB;
594 PUSH_OB;
595 PUSH_OB;
596 PUSH_IV;
579 PUSH_PV; 597 PUSH_PV;
580 break; 598 break;
581 599
582 case EVENT_EXTCMD: 600 case EVENT_EXTCMD:
583 PUSH_PL; 601 PUSH_PL;
1158 const_iv (SOUND_TURN_HANDLE) 1176 const_iv (SOUND_TURN_HANDLE)
1159 const_iv (SOUND_FALL_HOLE) 1177 const_iv (SOUND_FALL_HOLE)
1160 const_iv (SOUND_DRINK_POISON) 1178 const_iv (SOUND_DRINK_POISON)
1161 const_iv (SOUND_CAST_SPELL_0) 1179 const_iv (SOUND_CAST_SPELL_0)
1162 1180
1181 const_iv (PREFER_LOW)
1182 const_iv (PREFER_HIGH)
1183
1184 const_iv (ATNR_PHYSICAL)
1185 const_iv (ATNR_MAGIC)
1186 const_iv (ATNR_FIRE)
1187 const_iv (ATNR_ELECTRICITY)
1188 const_iv (ATNR_COLD)
1189 const_iv (ATNR_CONFUSION)
1190 const_iv (ATNR_ACID)
1191 const_iv (ATNR_DRAIN)
1192 const_iv (ATNR_WEAPONMAGIC)
1193 const_iv (ATNR_GHOSTHIT)
1194 const_iv (ATNR_POISON)
1195 const_iv (ATNR_SLOW)
1196 const_iv (ATNR_PARALYZE)
1197 const_iv (ATNR_TURN_UNDEAD)
1198 const_iv (ATNR_FEAR)
1199 const_iv (ATNR_CANCELLATION)
1200 const_iv (ATNR_DEPLETE)
1201 const_iv (ATNR_DEATH)
1202 const_iv (ATNR_CHAOS)
1203 const_iv (ATNR_COUNTERSPELL)
1204 const_iv (ATNR_GODPOWER)
1205 const_iv (ATNR_HOLYWORD)
1206 const_iv (ATNR_BLIND)
1207 const_iv (ATNR_INTERNAL)
1208 const_iv (ATNR_LIFE_STEALING)
1209 const_iv (ATNR_DISEASE)
1210
1163 const_iv (MAP_FLUSH) 1211 const_iv (MAP_FLUSH)
1164 const_iv (MAP_PLAYER_UNIQUE) 1212 const_iv (MAP_PLAYER_UNIQUE)
1165 const_iv (MAP_BLOCK) 1213 const_iv (MAP_BLOCK)
1166 const_iv (MAP_STYLE) 1214 const_iv (MAP_STYLE)
1167 const_iv (MAP_OVERLAY) 1215 const_iv (MAP_OVERLAY)
1214 const_event (REMOVE) 1262 const_event (REMOVE)
1215 const_event (SHOUT) 1263 const_event (SHOUT)
1216 const_event (TELL) 1264 const_event (TELL)
1217 const_event (MUZZLE) 1265 const_event (MUZZLE)
1218 const_event (KICK) 1266 const_event (KICK)
1267 const_event (PLAYER_USE_SKILL)
1268 const_event (MONSTER_USE_SKILL)
1269 const_event (FIND_UNARMED_SKILL)
1219 const_event (EXTCMD) 1270 const_event (EXTCMD)
1220 //const_event (FREE_OB) 1271 //const_event (FREE_OB)
1221 }; 1272 };
1222 1273
1223 AV *av = get_av ("cf::EVENT", 1); 1274 AV *av = get_av ("cf::EVENT", 1);
1400 1451
1401int 1452int
1402cf_find_animation (char *text) 1453cf_find_animation (char *text)
1403 PROTOTYPE: $ 1454 PROTOTYPE: $
1404 1455
1456int random_roll(int min, int max, object *op, int goodbad);
1457
1458int
1459exp_to_level (double exp)
1460 CODE:
1461 int i = 0;
1462 RETVAL = 0;
1463 for (i = 1; i <= settings.max_level; i++)
1464 {
1465 if (levels[i] > exp)
1466 {
1467 RETVAL = i - 1;
1468 break;
1469 }
1470 }
1471 OUTPUT: RETVAL
1472
1473double
1474level_to_min_exp (int level)
1475 CODE:
1476 RETVAL = 0;
1477 if (level > settings.max_level)
1478 RETVAL = levels[settings.max_level];
1479 else if (level < 1)
1480 RETVAL = 0;
1481 else
1482 RETVAL = levels[level];
1483 OUTPUT: RETVAL
1484
1485SV *
1486resistance_to_string (int atnr)
1487 CODE:
1488 if (atnr >= 0 && atnr < NROFATTACKS)
1489 {
1490 RETVAL = newSVpv (resist_plus[atnr], 0);
1491 }
1492 else
1493 {
1494 XSRETURN_UNDEF;
1495 }
1496 OUTPUT: RETVAL
1497
1405MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ 1498MODULE = cf PACKAGE = cf::object PREFIX = cf_object_
1406 1499
1407SV * 1500SV *
1408get_property (object *obj, int type, int idx) 1501get_property (object *obj, int type, int idx)
1409 CODE: 1502 CODE:
1561double pay_player_arch (object *op, const char *arch, double amount) 1654double pay_player_arch (object *op, const char *arch, double amount)
1562 1655
1563void player_lvl_adj (object *who, object *skill = 0) 1656void player_lvl_adj (object *who, object *skill = 0)
1564 1657
1565int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) 1658int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL)
1659
1660int calc_skill_exp (object *who, object *op, object *skill);
1661
1662char *cf_object_get_key (object *op, char *keyname)
1663 ALIAS: key = 0
1664
1665void cf_object_set_key (object *op, char *keyname, char *value)
1666
1667void
1668cf_object_set_resistance (object *op, int rtype, int val)
1669 CODE:
1670 if (rtype >= 0 && rtype < NROFATTACKS)
1671 op->resist[rtype] = val;
1672
1566 1673
1567MODULE = cf PACKAGE = cf::object PREFIX = cf_ 1674MODULE = cf PACKAGE = cf::object PREFIX = cf_
1568 1675
1569void cf_fix_object (object *pl) 1676void cf_fix_object (object *pl)
1570 ALIAS: fix = 0 1677 ALIAS: fix = 0

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines