Quellcode durchsuchen

Added @cart as per discussion in tid:70389 (mostly greatly helpful for debugging), after some developer discussion we've decided to make @newmount a permanent command, we however decided to rename it so that if newer mounts are available it doesn't confuse anyone: @mount2.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16749 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind vor 12 Jahren
Ursprung
Commit
1595dda79a
2 geänderte Dateien mit 49 neuen und 6 gelöschten Zeilen
  1. 5 0
      conf/msg_athena.conf
  2. 44 6
      src/map/atcommand.c

+ 5 - 0
conf/msg_athena.conf

@@ -1337,5 +1337,10 @@
 1388: Charcommand failed (usage: %c<command> <char name> <parameters>).
 1389: %s failed. Player not found.
 
+// @cart
+1390: Unknown Cart (usage: %s <0-%d>).
+1391: You do not possess a cart to be removed
+1392: Cart Added.
+
 //Custom translations
 import: conf/import/msg_conf.txt

+ 44 - 6
src/map/atcommand.c

@@ -8559,8 +8559,8 @@ ACMD_FUNC(charcommands)
 	atcommand_commands_sub(sd, fd, COMMAND_CHARCOMMAND);
 	return 0;
 }
-
-ACMD_FUNC(new_mount) {
+/* for new mounts */
+ACMD_FUNC(mount2) {
 
 	clif_displaymessage(sd->fd,msg_txt(1362)); // NOTICE: If you crash with mount your LUA is outdated.
 	if( !(sd->sc.option&OPTION_MOUNTING) ) {
@@ -8779,6 +8779,46 @@ ACMD_FUNC(unloadnpcfile) {
 	}
 	return 0;
 }
+ACMD_FUNC(cart) {
+#define MC_CART_MDFY(x) \
+	sd->status.skill[MC_PUSHCART].id = x?MC_PUSHCART:0; \
+	sd->status.skill[MC_PUSHCART].lv = x?1:0; \
+	sd->status.skill[MC_PUSHCART].flag = x?1:0;
+
+	int val = atoi(message);
+	bool need_skill = pc_checkskill(sd, MC_PUSHCART) ? false : true;
+	
+	if( !message || !*message || val < 0 || val > MAX_CARTS ) {
+		sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>).
+		clif_displaymessage(fd, atcmd_output);
+		return -1;
+	}
+
+	if( val == 0 && !pc_iscarton(sd) ) {
+		clif_displaymessage(fd, msg_txt(1391)); // You do not possess a cart to be removed
+		return -1;
+	}
+	
+	if( need_skill ) {
+		MC_CART_MDFY(1);
+	}
+	
+	if( pc_setcart(sd, val) ) {
+		if( need_skill ) {
+			MC_CART_MDFY(0);
+		}
+		return -1;/* @cart failed */
+	}
+	
+	if( need_skill ) {
+		MC_CART_MDFY(0);
+	}
+	
+	clif_displaymessage(fd, msg_txt(1392)); // Cart Added
+	
+	return 0;
+	#undef MC_CART_MDFY
+}
 /**
  * Fills the reference of available commands in atcommand DBMap
  **/
@@ -9032,10 +9072,8 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(addperm),
 		ACMD_DEF2("rmvperm", addperm),
 		ACMD_DEF(unloadnpcfile),
-		/**
-		 * For Testing Purposes, not going to be here after we're done.
-		 **/
-		ACMD_DEF2("newmount", new_mount),
+		ACMD_DEF(cart),
+		ACMD_DEF(mount2)
 	};
 	AtCommandInfo* atcommand;
 	int i;