Преглед на файлове

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@708 54d463be-8e91-2dee-dedb-b68131a5f0ec

mc_cameri преди 20 години
родител
ревизия
b0e36adc2b
променени са 8 файла, в които са добавени 90 реда и са изтрити 72 реда
  1. 6 0
      Changelog.txt
  2. 4 1
      npc/other/devnpc.txt
  3. 0 69
      src/map/atcommand.c
  4. 70 0
      src/map/charcommand.c
  5. 1 0
      src/map/charcommand.h
  6. 6 1
      src/map/npc.c
  7. 2 0
      src/map/npc.h
  8. 1 1
      src/map/script.c

+ 6 - 0
Changelog.txt

@@ -1,5 +1,11 @@
 Date	Added
 12/21
+	* Added variable 'current_file' which tells the filename of the script while loading npcs [MC Cameri]
+	  -the variable its set in do_init_npc() or something like that, so you can only access it
+	   after the use of do_init_npc().
+	* Fixed the display of a warning saying that a right curly brace was missing [MC Cameri]
+	* Removed @charwarp and @rura+ and added #warp, #rura, #rura+ [MC Cameri]
+	* Removed conf/npcs_list.txt, and placed it in npc/npcs_athena.conf [MC Cameri]
         * Moved some code in pc_break_equip that was causing compile errors [celest]
 	* guild skills vanished due to incorrect placement of a 
 	  check for quest skills in the calc_skilltree code [MouseJstr]

+ 4 - 1
npc/other/devnpc.txt

@@ -228,10 +228,13 @@ Lariatalk:
 
 Lquote0:
 	npctalk "OMGWTFBBQ";
-
+	break;
 Lquote1:
 	npctalk "So its u -> 0";
 	npctalk "... That did not look right";
+	break;
+Lquote2:
+	npc
 
 Lquote2:
 

+ 0 - 69
src/map/atcommand.c

@@ -41,7 +41,6 @@ char msg_table[1000][256]; // Server messages (0-499 reserved for GM commands, 5
 #define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
 ACMD_FUNC(broadcast);
 ACMD_FUNC(localbroadcast);
-ACMD_FUNC(rurap);
 ACMD_FUNC(rura);
 ACMD_FUNC(where);
 ACMD_FUNC(jumpto);
@@ -254,8 +253,6 @@ ACMD_FUNC(charkillableid2);  // by Dino9021
 // First char of commands is configured in atcommand_athena.conf. Leave @ in this list for default value.
 // to set default level, read atcommand_athena.conf first please.
 static AtCommandInfo atcommand_info[] = {
-	{ AtCommand_RuraP,				"@rura+",			60, atcommand_rurap },
-	{ AtCommand_RuraP,				"@charwarp",		60, atcommand_rurap },
 	{ AtCommand_Rura,				"@rura",			40, atcommand_rura },
 	{ AtCommand_Warp,				"@warp",			40, atcommand_rura },
 	{ AtCommand_Where,				"@where",			 1, atcommand_where },
@@ -973,72 +970,6 @@ int atcommand_send(
 	return 0;
 }
 
-/*==========================================
- * @rura+
- *------------------------------------------
- */
-int atcommand_rurap(
-	const int fd, struct map_session_data* sd,
-	const char* command, const char* message)
-{
-	char map_name[100];
-	char character[100];
-	int x = 0, y = 0;
-	struct map_session_data *pl_sd;
-	int m;
-
-	nullpo_retr(-1, sd);
-
-	memset(map_name, '\0', sizeof(map_name));
-	memset(character, '\0', sizeof(character));
-
-	if (!message || !*message || sscanf(message, "%99s %d %d %99[^\n]", map_name, &x, &y, character) < 4) {
-		clif_displaymessage(fd, "Usage: @charwarp/@rura+ <mapname> <x> <y> <char name>");
-		return -1;
-	}
-
-	if (x <= 0)
-		x = rand() % 399 + 1;
-	if (y <= 0)
-		y = rand() % 399 + 1;
-	if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat)
-		strcat(map_name, ".gat");
-
-	if ((pl_sd = map_nick2sd(character)) != NULL) {
-		if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level
-			if (x > 0 && x < 400 && y > 0 && y < 400) {
-				m = map_mapname2mapid(map_name);
-				if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
-					clif_displaymessage(fd, "You are not authorised to warp someone to this map.");
-					return -1;
-				}
-				if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
-					clif_displaymessage(fd, "You are not authorised to warp this player from its actual map.");
-					return -1;
-				}
-				if (pc_setpos(pl_sd, map_name, x, y, 3) == 0) {
-					clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped.
-					clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too).
-				} else {
-					clif_displaymessage(fd, msg_table[1]); // Map not found.
-					return -1;
-				}
-			} else {
-				clif_displaymessage(fd, msg_table[2]); // Coordinates out of range.
-				return -1;
-			}
-		} else {
-			clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
-			return -1;
-		}
-	} else {
-		clif_displaymessage(fd, msg_table[3]); // Character not found.
-		return -1;
-	}
-
-	return 0;
-}
-
 // @rura
 /*==========================================
  *

+ 70 - 0
src/map/charcommand.c

@@ -47,6 +47,7 @@ CCMD_FUNC(itemlist);
 CCMD_FUNC(effect);
 CCMD_FUNC(storagelist);
 CCMD_FUNC(item);
+CCMD_FUNC(warp);
 
 #ifdef TXT_ONLY
 /* TXT_ONLY */
@@ -80,6 +81,9 @@ static CharCommandInfo charcommand_info[] = {
 	{ CharCommandEffect,				"#effect",					40, charcommand_effect },
 	{ CharCommandStorageList,			"#storagelist",				40, charcommand_storagelist },
 	{ CharCommandItem,					"#item",					60, charcommand_item },
+	{ CharCommandWarp,					"#warp",					60, charcommand_warp },
+	{ CharCommandWarp,					"#rura",					60, charcommand_warp },
+	{ CharCommandWarp,					"#rura+",					60, charcommand_warp },
 
 #ifdef TXT_ONLY
 /* TXT_ONLY */
@@ -1061,3 +1065,69 @@ int charcommand_item(
 
 	return 0;
 }
+
+/*==========================================
+ * #warp/#rura/#rura+ <mapname> <x> <y> <char name>
+ *------------------------------------------
+ */
+int charcommand_warp(
+	const int fd, struct map_session_data* sd,
+	const char* command, const char* message)
+{
+	char map_name[100];
+	char character[100];
+	int x = 0, y = 0;
+	struct map_session_data *pl_sd;
+	int m;
+
+	nullpo_retr(-1, sd);
+
+	memset(map_name, '\0', sizeof(map_name));
+	memset(character, '\0', sizeof(character));
+
+	if (!message || !*message || sscanf(message, "%99s %d %d %99[^\n]", map_name, &x, &y, character) < 4) {
+		clif_displaymessage(fd, "Usage: #warp/#rura/#rura+ <mapname> <x> <y> <char name>");
+		return -1;
+	}
+
+	if (x <= 0)
+		x = rand() % 399 + 1;
+	if (y <= 0)
+		y = rand() % 399 + 1;
+	if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat)
+		strcat(map_name, ".gat");
+
+	if ((pl_sd = map_nick2sd(character)) != NULL) {
+		if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level
+			if (x > 0 && x < 400 && y > 0 && y < 400) {
+				m = map_mapname2mapid(map_name);
+				if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
+					clif_displaymessage(fd, "You are not authorised to warp someone to this map.");
+					return -1;
+				}
+				if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
+					clif_displaymessage(fd, "You are not authorised to warp this player from its actual map.");
+					return -1;
+				}
+				if (pc_setpos(pl_sd, map_name, x, y, 3) == 0) {
+					clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped.
+					clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too).
+				} else {
+					clif_displaymessage(fd, msg_table[1]); // Map not found.
+					return -1;
+				}
+			} else {
+				clif_displaymessage(fd, msg_table[2]); // Coordinates out of range.
+				return -1;
+			}
+		} else {
+			clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
+			return -1;
+		}
+	} else {
+		clif_displaymessage(fd, msg_table[3]); // Character not found.
+		return -1;
+	}
+
+	return 0;
+}

+ 1 - 0
src/map/charcommand.h

@@ -16,6 +16,7 @@ enum CharCommandType {
 	CharCommandEffect,
 	CharCommandStorageList,
 	CharCommandItem, // by MC Cameri
+	CharCommandWarp,
 
 #ifdef TXT_ONLY
 /* TXT_ONLY */

+ 6 - 1
src/map/npc.c

@@ -1674,7 +1674,11 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
 			}
 		}
 		if(curly_count > 0) {
-			printf("warning: Missing right curly at line %d\n",*lines);
+			printf("\n");
+			snprintf(tmp_output,sizeof(tmp_output),"Script skipped. Missing rig"
+				"ht curly brace at line '"CL_WHITE"%d"CL_RESET"' of file \n\t'"
+				CL_WHITE"%s"CL_RESET"'.\n",*lines,current_file);
+			ShowWarning(tmp_output);
 			script=NULL;
 			//exit(1); //Wtf? We do we exit?
 		} else {
@@ -2319,6 +2323,7 @@ int do_init_npc(void)
 			free(nsl->prev);
 			nsl->prev = NULL;
 		}
+		strcpy(current_file,nsl->name);
 		fp=fopen(nsl->name,"r");
 		if (fp==NULL) {
 			printf("file not found : %s\n",nsl->name);

+ 2 - 0
src/map/npc.h

@@ -48,5 +48,7 @@ int npc_gettimerevent_tick(struct npc_data *nd);
 int npc_settimerevent_tick(struct npc_data *nd,int newtimer);
 int npc_delete(struct npc_data *nd);
 
+char current_file[1024];
+
 #endif
 

+ 1 - 1
src/map/script.c

@@ -1517,7 +1517,7 @@ int buildin_goto(struct script_state *st)
 	int pos;
 
 	if( st->stack->stack_data[st->start+2].type!=C_POS ){
-		printf("script: goto: not label !\n");
+		printf("script: goto: not label!\n");
 		st->state=END;
 		return 0;
 	}