Browse Source

* Created src/custom/ folder for custom atcommands and script commands.
- A short, simple extension of atcommand.c and script.c that should help cut down on conflicts while updating.
- Concept credits to brAthena.

Signed-off-by: Euphy <euphy@rathena.org>

Euphy 11 years ago
parent
commit
a4fdc72e6d

+ 3 - 0
.gitignore

@@ -57,6 +57,9 @@
 /src/common/obj_sql
 /src/common/obj_sql
 /src/common/svnversion.h
 /src/common/svnversion.h
 
 
+# /src/custom/
+/src/custom
+
 # /src/login/
 # /src/login/
 /src/login/Makefile
 /src/login/Makefile
 /src/login/obj_sql
 /src/login/obj_sql

+ 19 - 0
src/custom/atcommand.inc

@@ -0,0 +1,19 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+/**
+ * Custom Atcommands
+ * Place the body of custom atcommands in this file.
+ * Format:
+ *	ACMD_FUNC(command_name)
+ *	{
+ *		<code>;
+ *	}
+ **/
+
+ACMD_FUNC(newcommand)
+{
+	clif_displaymessage(fd, "It works!");
+	clif_specialeffect(&sd->bl, 343, AREA);
+	return 0;
+}

+ 11 - 0
src/custom/atcommand_def.inc

@@ -0,0 +1,11 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+/**
+ * Custom Atcommands
+ * Place the definition of custom atcommands in this file.
+ * Format:
+ *	ACMD_DEF(command_name),
+ **/
+
+//ACMD_DEF(newcommand),

+ 19 - 0
src/custom/script.inc

@@ -0,0 +1,19 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+/**
+ * Custom Script Commands
+ * Place the body of custom script commands in this file.
+ * Format:
+ *	BUILDIN_FUNC(command_name)
+ *	{
+ *		<code>;
+ *	}
+ **/
+
+BUILDIN_FUNC(example)
+{
+	ShowInfo("buildin_example: It works!\n");
+	script_pushint(st,1);
+	return 0;
+}

+ 11 - 0
src/custom/script_def.inc

@@ -0,0 +1,11 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+/**
+ * Custom Script Commands
+ * Place the definition of custom script commands in this file.
+ * Format:
+ *	BUILDIN_DEF(command_name,"parameters"),
+ **/
+
+//BUILDIN_DEF(example,""),

+ 5 - 0
src/map/atcommand.c

@@ -9081,6 +9081,9 @@ ACMD_FUNC(langtype)
 	return -1;
 	return -1;
 }
 }
 
 
+
+#include "../custom/atcommand.inc"
+
 /**
 /**
  * Fills the reference of available commands in atcommand DBMap
  * Fills the reference of available commands in atcommand DBMap
  **/
  **/
@@ -9095,6 +9098,7 @@ void atcommand_basecommands(void) {
 	 * TODO : all restricted command are crashing case, please look into it
 	 * TODO : all restricted command are crashing case, please look into it
 	 **/
 	 **/
 	AtCommandInfo atcommand_base[] = {
 	AtCommandInfo atcommand_base[] = {
+#include "../custom/atcommand_def.inc"
 		ACMD_DEF2R("warp", mapmove, 1),
 		ACMD_DEF2R("warp", mapmove, 1),
 		ACMD_DEF(where),
 		ACMD_DEF(where),
 		ACMD_DEF(jumpto),
 		ACMD_DEF(jumpto),
@@ -9357,6 +9361,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(channel),
 		ACMD_DEF(channel),
 		ACMD_DEF(fontcolor),
 		ACMD_DEF(fontcolor),
 		ACMD_DEF(langtype),
 		ACMD_DEF(langtype),
+
 	};
 	};
 	AtCommandInfo* atcommand;
 	AtCommandInfo* atcommand;
 	int i;
 	int i;

+ 5 - 0
src/map/script.c

@@ -17990,6 +17990,8 @@ BUILDIN_FUNC(getserverdef){
 	return 0;
 	return 0;
 }
 }
 
 
+#include "../custom/script.inc"
+
 // declarations that were supposed to be exported from npc_chat.c
 // declarations that were supposed to be exported from npc_chat.c
 #ifdef PCRE_SUPPORT
 #ifdef PCRE_SUPPORT
 BUILDIN_FUNC(defpattern);
 BUILDIN_FUNC(defpattern);
@@ -18466,5 +18468,8 @@ struct script_function buildin_func[] = {
 
 
 	BUILDIN_DEF(is_clientver,"ii?"),
 	BUILDIN_DEF(is_clientver,"ii?"),
 	BUILDIN_DEF(getserverdef,"i"),
 	BUILDIN_DEF(getserverdef,"i"),
+
+#include "../custom/script_def.inc"
+
 	{NULL,NULL,NULL},
 	{NULL,NULL,NULL},
 };
 };