浏览代码

* Fixed GM Command Logging (Not sure why TXT logging still isn't working properly :( ) [Codemaster] [SVN 907]
* Fixed one of Lupus' additions to the item_db [Codemaster] [SVN 907]

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

codemaster 20 年之前
父节点
当前提交
9220ebe438
共有 6 个文件被更改,包括 25 次插入24 次删除
  1. 2 0
      Changelog.txt
  2. 1 1
      db/item_db.txt
  3. 4 6
      src/map/atcommand.c
  4. 1 0
      src/map/atcommand.h
  5. 12 12
      src/map/log.c
  6. 5 5
      src/map/map.c

+ 2 - 0
Changelog.txt

@@ -1,5 +1,7 @@
 Date	Added
 01/04
+	* Fixed GM Command Logging (Not sure why TXT logging still isn't working properly :( ) [Codemaster] [SVN 907]
+	* Fixed one of Lupus' additions to the item_db [Codemaster] [SVN 907]
         * Fixed Seismic Weapon Skill (it 100% didn't break target's weapon at 4 level of the skill) [Lupus]
 01/02
         * Re-fixed map-server crashing if an empty line is in skill_castnodex.txt,

+ 1 - 1
db/item_db.txt

@@ -155,7 +155,7 @@
 681,Wedding_Photo_Album,Wedding Photo Album,2,20,0,10,,,,,0,3,,,,,{},{}
 682,Realgar_Wine,Realgar Wine,2,20,0,100,,,,,10477567,2,,,,,{ sc_start SC_ATKPOT,30,30; },{}
 683,Exorcize_Herb,Exorcize Herb,2,20,0,50,,,,,10477567,2,,,,,{ sc_start SC_MATKPOT,30,30; },{}
-684,Durian,Durian,2,20,0,30,,,,,0,3,,,,,{},{ sc_start SC_ATKPOT,30,10; SC_MATKPOT,30,10; }
+684,Durian,Durian,2,20,0,30,,,,,0,3,,,,,{},{ sc_start SC_ATKPOT,30,10; sc_start SC_MATKPOT,30,10; }
 685,Ramadan,Ramadan,2,20,10,300,,,,,0,3,,,,,{},{}
 
 // Scrolls

+ 4 - 6
src/map/atcommand.c

@@ -721,7 +721,7 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
 	if (!*str)
 		return AtCommand_None;
 
-	type = atcommand(gmlvl > 0 ? gmlvl : pc_isGM(sd), str, &info);
+	type = atcommand(sd, gmlvl > 0 ? gmlvl : pc_isGM(sd), str, &info);
 	if (type != AtCommand_None) {
 		char command[100];
 		char output[200];
@@ -747,10 +747,6 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
 			}
 		}
 
-		// ToDo: Fix Logs :)
-		if((log_config.gm) && (info.level >= log_config.gm))
-			log_atcommand(sd, message);
-
 		return info.type;
 	}
 
@@ -761,7 +757,7 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
  *
  *------------------------------------------
  */
-AtCommandType atcommand(const int level, const char* message, struct AtCommandInfo* info) {
+AtCommandType atcommand(struct map_session_data* sd, const int level, const char* message, struct AtCommandInfo* info) {
 	char* p = (char *)message; // it's 'char' and not 'const char' to have possibility to modify the first character if necessary
 
 	if (!info)
@@ -794,6 +790,8 @@ AtCommandType atcommand(const int level, const char* message, struct AtCommandIn
 				return AtCommand_None;
 			else
 				return AtCommand_Unknown;
+		} else if((log_config.gm) && (atcommand_info[i].level >= log_config.gm)) {
+			log_atcommand(sd, message);
 		}
 		memcpy(info, &atcommand_info[i], sizeof atcommand_info[i]);
 	} else {

+ 1 - 0
src/map/atcommand.h

@@ -252,6 +252,7 @@ AtCommandType
 is_atcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl);
 
 AtCommandType atcommand(
+	struct map_session_data *sd,
 	const int level, const char* message, AtCommandInfo* info);
 int get_atcommand_level(const AtCommandType type);
 

+ 12 - 12
src/map/log.c

@@ -466,51 +466,51 @@ int log_config_read(char *cfgName)
 
 			else if(strcmpi(w1, "log_branch") == 0) {
 				strcpy(log_config.log_branch, w2);
-				if(log_config.branch == 1)
+				if(log_config.branch > 0 && log_config.sql_logs < 1)
 					printf("Logging Dead Branch Usage to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_drop") == 0) {
 				strcpy(log_config.log_drop, w2);
-				if(log_config.drop == 1)
+				if(log_config.drop > 0 && log_config.sql_logs < 1)
 					printf("Logging Item Drops to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_mvpdrop") == 0) {
 				strcpy(log_config.log_mvpdrop, w2);
-				if(log_config.mvpdrop == 1)
+				if(log_config.mvpdrop > 0 && log_config.sql_logs < 1)
 					printf("Logging MVP Drops to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_present") == 0) {
 				strcpy(log_config.log_present, w2);
-				if(log_config.present == 1)
+				if(log_config.present > 0 && log_config.sql_logs < 1)
 					printf("Logging Present Usage & Results to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_produce") == 0) {
 				strcpy(log_config.log_produce, w2);
-				if(log_config.produce == 1)
+				if(log_config.produce > 0 && log_config.sql_logs < 1)
 					printf("Logging Producing to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_refine") == 0) {
 				strcpy(log_config.log_refine, w2);
-				if(log_config.refine == 1)
+				if(log_config.refine > 0 && log_config.sql_logs < 1)
 					printf("Logging Refining to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_trade") == 0) {
 				strcpy(log_config.log_trade, w2);
-				if(log_config.trade == 1)
+				if(log_config.trade > 0 && log_config.sql_logs < 1)
 				{
 					printf("Logging Item Trades");
-					if(log_config.zeny == 1)
+					if(log_config.zeny > 0)
 						printf("and Zeny Trades");
 					printf(" to file `%s`.txt\n", w2);
 				}
 			} else if(strcmpi(w1, "log_vend") == 0) {
 				strcpy(log_config.log_vend, w2);
-				if(log_config.vend == 1)
+				if(log_config.vend > 0  && log_config.sql_logs < 1)
 					printf("Logging Vending to file `%s`.txt\n", w2);
 			} else if(strcmpi(w1, "log_gm") == 0) {
 				strcpy(log_config.log_gm, w2);
-				if(log_config.gm > 0)
+				if(log_config.gm > 0 && log_config.sql_logs < 1)
 					printf("Logging GM Level %d Commands to file `%s`.txt\n", log_config.gm, w2);
 			} else if(strcmpi(w1, "log_npc") == 0) {
 				strcpy(log_config.log_npc, w2);
-				if(log_config.npc > 0)
+				if(log_config.npc > 0 && log_config.sql_logs < 1)
 					printf("Logging NPC 'logmes' to file `%s`.txt\n", w2);
 			//support the import command, just like any other config
-			} else if(strcmpi(w1,"import")==0){
+			} else if(strcmpi(w1,"import") == 0) {
 				log_config_read(w2);
 			}
 		}

+ 5 - 5
src/map/map.c

@@ -2680,8 +2680,8 @@ int do_init(int argc, char *argv[]) {
 
 #ifndef TXT_ONLY
 	unsigned char *SQL_CONF_NAME="conf/inter_athena.conf";
-	unsigned char *LOG_CONF_NAME="conf/log_athena.conf";
 #endif
+	unsigned char *LOG_CONF_NAME="conf/log_athena.conf";
 	unsigned char *MAP_CONF_NAME = "conf/map_athena.conf";
 	unsigned char *BATTLE_CONF_FILENAME = "conf/battle_athena.conf";
 	unsigned char *ATCOMMAND_CONF_FILENAME = "conf/atcommand_athena.conf";
@@ -2715,10 +2715,10 @@ int do_init(int argc, char *argv[]) {
 			GRF_PATH_FILENAME = argv[i+1];
 #ifndef TXT_ONLY
 		else if (strcmp(argv[i],"--sql_config") == 0 || strcmp(argv[i],"--sql-config") == 0)
-		    SQL_CONF_NAME = argv[i+1];
-		else if (strcmp(argv[i],"--log_config") == 0 || strcmp(argv[i],"--log-config") == 0)
-		    LOG_CONF_NAME = argv[i+1];		
+		    SQL_CONF_NAME = argv[i+1];	
 #endif /* not TXT_ONLY */
+		else if (strcmp(argv[i],"--log_config") == 0 || strcmp(argv[i],"--log-config") == 0)
+		    LOG_CONF_NAME = argv[i+1];	
 		else if (strcmp(argv[i],"--run_once") == 0)	// close the map-server as soon as its done.. for testing [Celest]
 			runflag = 0;
 	}
@@ -2758,8 +2758,8 @@ int do_init(int argc, char *argv[]) {
 	script_config_read(SCRIPT_CONF_NAME);
 #ifndef TXT_ONLY
 	sql_config_read(SQL_CONF_NAME);
-	log_config_read(LOG_CONF_NAME);
 #endif /* not TXT_ONLY */
+	log_config_read(LOG_CONF_NAME);
 
 	atexit(do_final);