/* ....[@@@..[@@@..............[@.................. MUD++ is a written from ....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and ....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++. ....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing ....[@......[@..[@@@@@..[@@@@@.................. development project. All ................................................ contributions are welcome. ....Copyright(C).1995.Melvin.Smith.............. Enjoy. ------------------------------------------------------------------------------ Melvin Smith (aka Fusion) msmith@hom.net MUD++ development mailing list mudpp@van.ml.org ------------------------------------------------------------------------------ trigs.h */ #if !defined( _TRIGS_H ) #define _TRIGS_H #include "io.h" #include "llist.h" #include "bit.h" class String; class Thing; class MudObject; class Char; class Object; class Room; class Repop; class Social; class Attack; // Character triggers #define CTRIG_CREATED 1 #define CTRIG_UPDATE 2 #define CTRIG_GIVEN_GOLD 3 #define CTRIG_GIVEN_OBJECT 4 #define CTRIG_TOLD 5 #define CTRIG_ATTACKED 6 #define CTRIG_HIT 7 #define CTRIG_KILLED 8 #define CTRIG_SOCIALED 9 #define CTRIG_LOOKED_AT 10 typedef bool (*ctrigT_created) (Char *, Room *, Repop *); typedef bool (*ctrigT_update) (Char *); typedef bool (*ctrigT_given_gold) (Char *, Char *, int); typedef bool (*ctrigT_given_object) (Char *, Char *, Object *); typedef bool (*ctrigT_told) (Char *, Char *, const char *); typedef bool (*ctrigT_attacked) (Char *, Char *); typedef bool (*ctrigT_hit) (Char *, Char * ,Attack *); typedef bool (*ctrigT_killed) (Char *, MudObject * ); typedef bool (*ctrigT_socialed) (Char *, Char *, const Social *); typedef bool (*ctrigT_looked_at) (Char *, Char *); // Object Triggers #define OTRIG_CREATED 1 #define OTRIG_UPDATE 2 #define OTRIG_TIMER_OUT 3 #define OTRIG_PICKED 4 #define OTRIG_DROPPED 5 #define OTRIG_GIVEN 6 #define OTRIG_WORN 7 #define OTRIG_REMOVED 8 #define OTRIG_USED 9 #define OTRIG_LOOKED_AT 10 #define OTRIG_ITEM_PUT_INTO 11 #define OTRIG_ITEM_GET_FROM 12 typedef bool (*otrigT_created) (Object *, Room *, Repop *); typedef bool (*otrigT_update) (Object *); typedef bool (*otrigT_timer_out) (Object *); typedef bool (*otrigT_picked) (Object *, Char *, Room *); typedef bool (*otrigT_dropped) (Object *, Char *, Room *); typedef bool (*otrigT_given) (Object *, Char *, Char *); typedef bool (*otrigT_worn) (Object *, Char * ); typedef bool (*otrigT_removed) (Object *, Char * ); typedef bool (*otrigT_used) (Object *, Char *, MudObject *); typedef bool (*otrigT_looked_at) (Object *, Char *); typedef bool (*otrigT_item_put_into) (Object *, Char *, Object *); typedef bool (*otrigT_item_get_from) (Object *, Char *, Object *); // Room Triggers #define RTRIG_UPDATE 1 #define RTRIG_DROPPED_ITEM 2 #define RTRIG_PICKED_ITEM 3 #define RTRIG_STRANGE_CMD 4 #define RTRIG_SAID_IN 5 #define RTRIG_ENTERED 6 #define RTRIG_LEFT 7 #define RTRIG_SOCIALED_IN 8 typedef bool (*rtrigT_update) (Room *); typedef bool (*rtrigT_dropped_item) (Room *, Char *, Object * ); typedef bool (*rtrigT_picked_item) (Room *, Char *, Object * ); typedef bool (*rtrigT_strange_cmd) (Room *, Char *, const String & ,const String & ); typedef bool (*rtrigT_said_in) (Room *, Char *, const char * ); typedef bool (*rtrigT_entered) (Room *, Char *, Room * ); typedef bool (*rtrigT_left) (Room *, Char *, Room * ); typedef bool (*rtrigT_socialed_in) (Room *, Char *, Char *, const Social * ); const int MAX_NEWTRIG_BIT_FIELDS = 1; struct TriggerData { int type; void * fun; }; #define trigfun_entry( type ) struct { const char * name; type fun; } extern const bitType ctrig_types[]; extern const bitType otrig_types[]; extern const bitType rtrig_types[]; // watch out - this 2 defines are for internal use only #define returnLookupTrig( table, name ) \ {\ int i;\ for ( i = 0; table[i].name ; i++ )\ {\ if (table[i].name[0] == name[0] )\ if ( !strcmp(table[i].name, name ) )\ return table[i].fun;\ }\ return NULL;\ } #define returnLookupTrigName( table, fun ) \ {\ int i;\ for ( i = 0; table[i].name; i++ )\ {\ if (table[i].fun == fun )\ return table[i].name; \ }\ return NULL;\ } void * lookupCtrig( int type, const char * name ); const char * lookupCtrigName( int type, void * ); const char * getCtrigName( int type, int index ); void * lookupOtrig( int type, const char * name ); const char * lookupOtrigName( int type, void * ); const char * getOtrigName( int type, int index ); void * lookupRtrig( int type, const char * name ); const char * lookupRtrigName( int type, void * ); const char * getRtrigName( int type, int index ); #endif // _TRIGS_H