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

Comparing deliantra/server/plugins/cfpython/cfpython.C (file contents):
Revision 1.1 by elmex, Sun Aug 13 17:16:02 2006 UTC vs.
Revision 1.2 by root, Fri Aug 25 13:24:50 2006 UTC

838 unregisterGlobalEvent = (void* (*)(int*, ...))gethook(&rtype, hooktype, "cfapi_system_unregister_global_event"); 838 unregisterGlobalEvent = (void* (*)(int*, ...))gethook(&rtype, hooktype, "cfapi_system_unregister_global_event");
839 systemDirectory = (void* (*)(int*, ...))gethook(&rtype, hooktype, "cfapi_system_directory"); 839 systemDirectory = (void* (*)(int*, ...))gethook(&rtype, hooktype, "cfapi_system_directory");
840 reCmp = (void* (*)(int*, ...))gethook(&rtype, hooktype, "cfapi_system_re_cmp"); 840 reCmp = (void* (*)(int*, ...))gethook(&rtype, hooktype, "cfapi_system_re_cmp");
841 cf_init_plugin( gethook ); 841 cf_init_plugin( gethook );
842 initContextStack(); 842 initContextStack();
843 registerGlobalEvent(NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener);
844 /*registerGlobalEvent(NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener);*/ 843 /*registerGlobalEvent(NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener);*/
845 /*registerGlobalEvent(NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener);*/ 844 /*registerGlobalEvent(NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener);*/
846 registerGlobalEvent(NULL, EVENT_PLAYER_DEATH, PLUGIN_NAME, globalEventListener);
847 registerGlobalEvent(NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener); 845 registerGlobalEvent(NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener);
848 registerGlobalEvent(NULL, EVENT_LOGIN, PLUGIN_NAME, globalEventListener);
849 registerGlobalEvent(NULL, EVENT_LOGOUT, PLUGIN_NAME, globalEventListener);
850 registerGlobalEvent(NULL, EVENT_MAPENTER, PLUGIN_NAME, globalEventListener);
851 registerGlobalEvent(NULL, EVENT_MAPLEAVE, PLUGIN_NAME, globalEventListener);
852 registerGlobalEvent(NULL, EVENT_MAPRESET, PLUGIN_NAME, globalEventListener);
853 registerGlobalEvent(NULL, EVENT_REMOVE, PLUGIN_NAME, globalEventListener);
854 registerGlobalEvent(NULL, EVENT_SHOUT, PLUGIN_NAME, globalEventListener); 846 registerGlobalEvent(NULL, EVENT_SHOUT, PLUGIN_NAME, globalEventListener);
855 registerGlobalEvent(NULL, EVENT_TELL, PLUGIN_NAME, globalEventListener); 847 registerGlobalEvent(NULL, EVENT_TELL, PLUGIN_NAME, globalEventListener);
856 registerGlobalEvent(NULL, EVENT_MUZZLE, PLUGIN_NAME, globalEventListener); 848 registerGlobalEvent(NULL, EVENT_MUZZLE, PLUGIN_NAME, globalEventListener);
857 registerGlobalEvent(NULL, EVENT_KICK, PLUGIN_NAME, globalEventListener); 849 registerGlobalEvent(NULL, EVENT_KICK, PLUGIN_NAME, globalEventListener);
858 850
892 strcpy(context->options, ""); 884 strcpy(context->options, "");
893 switch(context->event_code) { 885 switch(context->event_code) {
894 case EVENT_CRASH: 886 case EVENT_CRASH:
895 printf( "Unimplemented for now\n"); 887 printf( "Unimplemented for now\n");
896 break; 888 break;
897 case EVENT_BORN:
898 op = va_arg(args, object*);
899 context->activator = Crossfire_Object_wrap(op);
900 snprintf(context->options, sizeof(context->options), "born");
901 cfob = (Crossfire_Object*)context->activator;
902 break;
903 case EVENT_PLAYER_DEATH:
904 op = va_arg(args, object*);
905 context->who = Crossfire_Object_wrap(op);
906 snprintf(context->options, sizeof(context->options), "death");
907 cfob = (Crossfire_Object*)context->who;
908 break;
909 case EVENT_GKILL: 889 case EVENT_GKILL:
910 op = va_arg(args, object*); 890 op = va_arg(args, object*);
911 context->who = Crossfire_Object_wrap(op); 891 context->who = Crossfire_Object_wrap(op);
912 context->activator = Crossfire_Object_wrap(op); 892 context->activator = Crossfire_Object_wrap(op);
913 snprintf(context->options, sizeof(context->options), "gkill"); 893 snprintf(context->options, sizeof(context->options), "gkill");
914 cfob = (Crossfire_Object*)context->who; 894 cfob = (Crossfire_Object*)context->who;
915 break;
916 case EVENT_LOGIN:
917 pl = va_arg(args, player*);
918 context->activator = Crossfire_Object_wrap(pl->ob);
919 buf = va_arg(args, char*);
920 if (buf != NULL)
921 snprintf(context->message, sizeof(context->message), "%s", buf);
922 snprintf(context->options, sizeof(context->options), "login");
923 cfpl = (Crossfire_Player*)context->activator;
924 break;
925 case EVENT_LOGOUT:
926 pl = va_arg(args, player*);
927 context->activator = Crossfire_Object_wrap(pl->ob);
928 buf = va_arg(args, char*);
929 if (buf != NULL)
930 snprintf(context->message, sizeof(context->message), "%s", buf);
931 snprintf(context->options, sizeof(context->options), "logout");
932 cfpl = (Crossfire_Player*)context->activator;
933 break;
934 case EVENT_REMOVE:
935 op = va_arg(args, object*);
936 context->activator = Crossfire_Object_wrap(op);
937 snprintf(context->options, sizeof(context->options), "remove");
938 cfob = (Crossfire_Object*)context->activator;
939 break; 895 break;
940 case EVENT_SHOUT: 896 case EVENT_SHOUT:
941 op = va_arg(args, object*); 897 op = va_arg(args, object*);
942 context->activator = Crossfire_Object_wrap(op); 898 context->activator = Crossfire_Object_wrap(op);
943 buf = va_arg(args, char*); 899 buf = va_arg(args, char*);
962 if (buf != NULL) 918 if (buf != NULL)
963 snprintf(context->message, sizeof(context->message), "%s", buf); 919 snprintf(context->message, sizeof(context->message), "%s", buf);
964 snprintf(context->options, sizeof(context->options), "kick"); 920 snprintf(context->options, sizeof(context->options), "kick");
965 cfob = (Crossfire_Object*)context->activator; 921 cfob = (Crossfire_Object*)context->activator;
966 break; 922 break;
967 case EVENT_MAPENTER:
968 op = va_arg(args, object*);
969 context->activator = Crossfire_Object_wrap(op);
970 snprintf(context->options, sizeof(context->options), "mapenter");
971 cfob = (Crossfire_Object*)context->activator;
972 break;
973 case EVENT_MAPLEAVE:
974 op = va_arg(args, object*);
975 context->activator = Crossfire_Object_wrap(op);
976 snprintf(context->options, sizeof(context->options), "mapleave");
977 cfob = (Crossfire_Object*)context->activator;
978 break;
979 case EVENT_CLOCK: 923 case EVENT_CLOCK:
980 snprintf(context->options, sizeof(context->options), "clock"); 924 snprintf(context->options, sizeof(context->options), "clock");
981 break;
982 case EVENT_MAPRESET:
983 buf = va_arg(args, char*);
984 if (buf != NULL)
985 snprintf(context->message, sizeof(context->message), "%s", buf);
986 snprintf(context->options, sizeof(context->options), "mapreset");
987 break; 925 break;
988 case EVENT_TELL: 926 case EVENT_TELL:
989 snprintf(context->options, sizeof(context->options), "tell"); 927 snprintf(context->options, sizeof(context->options), "tell");
990 break; 928 break;
991 } 929 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines