Browse Source

- Modified the nocommand mapflag so you can specify the GM range that is blocked from using commands (eg: "prontera.gat mapflag nocommand 40" disables commands to characters in the GM range 0~39)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8733 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 years ago
parent
commit
84f86fa96e
6 changed files with 18 additions and 9 deletions
  1. 3 0
      Changelog-Trunk.txt
  2. 3 3
      src/map/atcommand.c
  3. 2 2
      src/map/charcommand.c
  4. 1 1
      src/map/map.h
  5. 7 1
      src/map/npc.c
  6. 2 2
      src/map/script.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/09/13
+	* Modified the nocommand mapflag so you can specify the GM range that is
+	  blocked from using commands (eg: "prontera.gat mapflag nocommand 40"
+	  disables commands to characters in the GM range 0~39) [Skotlex]
 	* Modified the char-server TXT whisper system to use the online_db to know
 	  to which map server forward whispers, instead of just sending the whisper
 	  to every map server. [Skotlex]

+ 3 - 3
src/map/atcommand.c

@@ -807,8 +807,8 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
 	if (!*str)
 		return AtCommand_None;
 
-	if (map[sd->bl.m].flag.nocommand &&
-		(gmlvl > 0? gmlvl:pc_isGM(sd)) < battle_config.gm_skilluncond)
+	if (map[sd->bl.m].nocommand &&
+		(gmlvl > 0? gmlvl:pc_isGM(sd)) < map[sd->bl.m].nocommand)
 	{	//Command not allowed on this map.
 		sprintf(atcmd_output, msg_txt(143)); 
 		clif_displaymessage(fd, atcmd_output);
@@ -5820,7 +5820,7 @@ int atcommand_mapinfo(
 	clif_displaymessage(fd, atcmd_output);
 
 	strcpy(atcmd_output,"Other Flags: ");
-	if (map[m_id].flag.nocommand)
+	if (map[m_id].nocommand)
 		strcat(atcmd_output, "NoCommand | ");
 	if (map[m_id].flag.nobaseexp)
 		strcat(atcmd_output, "NoBaseEXP | ");

+ 2 - 2
src/map/charcommand.c

@@ -148,8 +148,8 @@ is_charcommand(const int fd, struct map_session_data* sd, const char* message, i
 	if (!*str)
 		return CharCommand_None;
 
-	if (map[sd->bl.m].flag.nocommand &&
-		(gmlvl > 0? gmlvl:pc_isGM(sd)) < battle_config.gm_skilluncond)
+	if (map[sd->bl.m].nocommand &&
+		(gmlvl > 0? gmlvl:pc_isGM(sd)) < map[sd->bl.m].nocommand)
 	{	//Command not allowed on this map.
 		char output[200];
 		sprintf(output, msg_table[143]); 

+ 1 - 1
src/map/map.h

@@ -1115,7 +1115,6 @@ struct map_data {
 		unsigned nomvploot	: 1; // [Lorky]
 		unsigned nightenabled :1; //For night display. [Skotlex]
 		unsigned restricted	: 1; // [Komurka]
-		unsigned nocommand : 1; //Blocks @/# commands for non-gms. [Skotlex]
 		unsigned nodrop : 1;
 		unsigned novending : 1;
 		unsigned loadevent : 1;
@@ -1134,6 +1133,7 @@ struct map_data {
 	int zone;	// [Komurka]
 	int jexp;	// map experience multiplicator
 	int bexp;	// map experience multiplicator
+	int nocommand; //Blocks @/# commands for non-gms. [Skotlex]
 };
 
 struct map_data_other_server {

+ 7 - 1
src/map/npc.c

@@ -2521,7 +2521,13 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
 		map[m].flag.nomvploot=state;
 	}
 	else if (strcmpi(w3,"nocommand")==0) { // Skotlex
-		map[m].flag.nocommand=state;
+		if (state) {
+			if (sscanf(w4, "%d", &state) == 1)
+				map[m].nocommand =state;
+			else //No level specified, block everyone.
+				map[m].nocommand =100;
+		} else
+			map[m].nocommand=0;
 	}
 	else if (strcmpi(w3,"restricted")==0) { // Komurka
 		if (state) {

+ 2 - 2
src/map/script.c

@@ -8317,7 +8317,7 @@ int buildin_setmapflag(struct script_state *st)
 				map[m].flag.restricted=1;
 				break;
 			case MF_NOCOMMAND:
-				map[m].flag.nocommand=1;
+				map[m].nocommand = (!val || atoi(val) <= 0) ? 100 : atoi(val);
 				break;
 			case MF_JEXP:
 				map[m].jexp = (!val || atoi(val) < 0) ? 100 : atoi(val);
@@ -8461,7 +8461,7 @@ int buildin_removemapflag(struct script_state *st)
 				map[m].flag.restricted=0;
 				break;
 			case MF_NOCOMMAND:
-				map[m].flag.nocommand=0;
+				map[m].nocommand=0;
 				break;
 			case MF_JEXP:
 				map[m].jexp=100;