diff options
author | Valaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-01-29 16:10:48 +0000 |
---|---|---|
committer | Valaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-01-29 16:10:48 +0000 |
commit | 620e60eebce2c1f35c5c9a82f6ca365b316587f5 (patch) | |
tree | 38a39e0415f419d9a49ae456ed0e26654c23d559 /src/plugins/sample.c | |
parent | a2675f07d7da22a7c6ae11f545bf8f671e785a82 (diff) | |
download | hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.gz hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.bz2 hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.xz hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.zip |
AS OF SVN REV. 5901, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5094 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/plugins/sample.c')
-rw-r--r-- | src/plugins/sample.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/plugins/sample.c b/src/plugins/sample.c new file mode 100644 index 000000000..5a8e2a286 --- /dev/null +++ b/src/plugins/sample.c @@ -0,0 +1,77 @@ +// Sample Athena plugin
+
+#include <stdio.h>
+#include <string.h>
+#include "../common/plugin.h"
+
+////// Plugin information ////////
+//
+PLUGIN_INFO = {
+// change only the following area
+ "Test", // Plugin name
+ PLUGIN_ALL, // Which servers is this plugin for
+ "0.1", // Plugin version
+ PLUGIN_VERSION, // Minimum plugin engine version to run
+ "A sample plugin" // Short description of plugin
+};
+
+////// Plugin event list //////////
+// Format: <plugin function>,<event name>
+// All registered functions to a event gets executed
+// (In descending order) when its called.
+// Multiple functions can be called by multiple events too,
+// So it's up to your creativity ^^
+//
+PLUGIN_EVENTS_TABLE = {
+// change only the following area
+ { "test_me", "Plugin_Test" }, // when the plugin is tested for compatibility
+ { "do_init", "Plugin_Init" }, // when plugins are loaded
+ { "do_final", "Plugin_Final" }, // when plugins are unloaded
+ { "some_function", "some_event" },
+ { "some_function", "another_event" },
+ { NULL, NULL }
+};
+
+///// Variables /////
+char *server_type;
+char *server_name;
+
+//////// Plugin functions //////////
+int do_init ()
+{
+ // import symbols from the server
+ IMPORT_SYMBOL(server_type, 0);
+ IMPORT_SYMBOL(server_name, 1);
+
+ printf ("Server type is ");
+ switch (*server_type) {
+ case PLUGIN_LOGIN: printf ("Login\n"); break;
+ case PLUGIN_CHAR: printf ("Char\n"); break;
+ case PLUGIN_MAP: printf ("Map\n"); break;
+ }
+ printf ("Filename is %s\n", server_name);
+
+ return 1;
+}
+
+int do_final ()
+{
+ printf ("Bye world\n");
+
+ return 1;
+}
+
+int some_function ()
+{
+ printf ("Some function\n");
+ return 0;
+}
+
+// return 1 if the testing passes, otherwise 0
+// (where the plugin will be deactivated)
+int test_me ()
+{
+ if (1 + 1 == 2)
+ return 1;
+ return 0;
+}
|