log.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. // Logging functions by Azndragon & Codemaster
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include "../common/strlib.h"
  8. #include "../common/nullpo.h"
  9. #include "../common/showmsg.h"
  10. #include "itemdb.h"
  11. #include "map.h"
  12. #include "log.h"
  13. #ifndef SQL_DEBUG
  14. #define mysql_query(_x, _y) mysql_real_query(_x, _y, strlen(_y)) //supports ' in names and runs faster [Kevin]
  15. #else
  16. #define mysql_query(_x, _y) debug_mysql_query(__FILE__, __LINE__, _x, _y)
  17. #endif
  18. struct Log_Config log_config;
  19. char timestring[255];
  20. time_t curtime;
  21. //FILTER OPTIONS
  22. //0 = Don't log
  23. //1 = Log any item
  24. //Bits: ||
  25. //2 - Healing items (0)
  26. //3 - Etc Items(3) + Arrows (10)
  27. //4 - Usable Items(2) + Scrolls,Lures(11)
  28. //5 - Weapon(4)
  29. //6 - Shields,Armor,Headgears,Accessories,etc(5)
  30. //7 - Cards(6)
  31. //8 - Pet Accessories(8) + Eggs(7) (well, monsters don't drop 'em but we'll use the same system for ALL logs)
  32. //9 - Log expensive items ( >= price_log)
  33. //10 - Log big amount of items ( >= amount_log)
  34. //11 - Log refined items (if their refine >= refine_log )
  35. //12 - Log rare items (if their drop chance <= rare_log )
  36. //check if this item should be logged according the settings
  37. int should_log_item(int filter, int nameid, int amount) {
  38. struct item_data *item_data;
  39. if ((item_data= itemdb_exists(nameid)) == NULL) return 0;
  40. if ((filter&1) || // Filter = 1, we log any item
  41. (filter&2 && item_data->type == IT_HEALING ) ||
  42. (filter&4 && (item_data->type == IT_ETC || item_data->type == IT_AMMO) ) ||
  43. (filter&8 && item_data->type == IT_USABLE ) ||
  44. (filter&16 && item_data->type == IT_WEAPON ) ||
  45. (filter&32 && item_data->type == IT_ARMOR ) ||
  46. (filter&64 && item_data->type == IT_CARD ) ||
  47. (filter&128 && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) ||
  48. (filter&256 && item_data->value_buy >= log_config.price_items_log ) || //expensive items
  49. (filter&512 && abs(amount) >= log_config.amount_items_log ) || //big amount of items
  50. (filter&2048 && ((item_data->maxchance <= log_config.rare_items_log) || item_data->nameid == 714) ) //Rare items or Emperium
  51. ) return item_data->nameid;
  52. return 0;
  53. }
  54. int log_branch(struct map_session_data *sd)
  55. {
  56. #ifndef TXT_ONLY
  57. char t_name[NAME_LENGTH*2];
  58. #endif
  59. FILE *logfp;
  60. if(!log_config.enable_logs)
  61. return 0;
  62. nullpo_retr(0, sd);
  63. #ifndef TXT_ONLY
  64. if(log_config.sql_logs > 0)
  65. {
  66. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`branch_date`, `account_id`, `char_id`, `char_name`, `map`) VALUES (NOW(), '%d', '%d', '%s', '%s')",
  67. log_config.log_branch_db, sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name), mapindex_id2name(sd->mapindex));
  68. if(mysql_query(&logmysql_handle, tmp_sql))
  69. {
  70. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  71. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  72. }
  73. } else {
  74. #endif
  75. if((logfp=fopen(log_config.log_branch,"a+")) != NULL) {
  76. time(&curtime);
  77. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  78. fprintf(logfp,"%s - %s[%d:%d]\t%s%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex), RETCODE);
  79. fclose(logfp);
  80. }
  81. #ifndef TXT_ONLY
  82. }
  83. #endif
  84. return 0;
  85. }
  86. int log_pick(struct map_session_data *sd, char *type, int mob_id, int nameid, int amount, struct item *itm)
  87. {
  88. FILE *logfp;
  89. char *mapname;
  90. int obj_id;
  91. nullpo_retr(0, sd);
  92. //Should we log this item? [Lupus]
  93. if (!should_log_item(log_config.filter,nameid, amount))
  94. return 0; //we skip logging this items set - they doesn't met our logging conditions [Lupus]
  95. //either PLAYER or MOB (here we get map name and objects ID)
  96. if(mob_id) {
  97. struct mob_data *md = (struct mob_data*)sd;
  98. obj_id = mob_id;
  99. mapname = map[md->bl.m].name;
  100. } else {
  101. obj_id = sd->char_id;
  102. mapname = (char*)mapindex_id2name(sd->mapindex);
  103. }
  104. if(mapname==NULL)
  105. mapname="";
  106. #ifndef TXT_ONLY
  107. if(log_config.sql_logs > 0)
  108. {
  109. if (itm==NULL) {
  110. //We log common item
  111. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%s')",
  112. log_config.log_pick_db, obj_id, type, nameid, amount, mapname);
  113. } else {
  114. //We log Extended item
  115. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')",
  116. log_config.log_pick_db, obj_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname);
  117. }
  118. if(mysql_query(&logmysql_handle, tmp_sql))
  119. {
  120. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  121. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  122. }
  123. } else {
  124. #endif
  125. if((logfp=fopen(log_config.log_pick,"a+")) != NULL) {
  126. time_t curtime;
  127. time(&curtime);
  128. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  129. if (itm==NULL) {
  130. //We log common item
  131. fprintf(logfp,"%s - %d\t%s\t%d,%d,%s%s",
  132. timestring, obj_id, type, nameid, amount, mapname, RETCODE);
  133. } else {
  134. //We log Extended item
  135. fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s%s",
  136. timestring, obj_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, RETCODE);
  137. }
  138. fclose(logfp);
  139. }
  140. #ifndef TXT_ONLY
  141. }
  142. #endif
  143. return 1; //Logged
  144. }
  145. int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount)
  146. {
  147. // FILE *logfp;
  148. if(!log_config.enable_logs || (log_config.zeny!=1 && abs(amount)<log_config.zeny))
  149. return 0;
  150. nullpo_retr(0, sd);
  151. #ifndef TXT_ONLY
  152. if(log_config.sql_logs > 0)
  153. {
  154. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `src_id`, `type`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%s')",
  155. log_config.log_zeny_db, sd->char_id, src_sd->char_id, type, amount, mapindex_id2name(sd->mapindex));
  156. if(mysql_query(&logmysql_handle, tmp_sql))
  157. {
  158. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  159. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  160. }
  161. } else {
  162. #endif
  163. // if((logfp=fopen(log_config.log_zeny,"a+")) != NULL) {
  164. // time(&curtime);
  165. // strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  166. // fprintf(logfp,"%s - %s[%d]\t%s[%d]\t%d\t%s", timestring, sd->status.name, sd->status.account_id, target_sd->status.name, target_sd->status.account_id, sd->deal.zeny, RETCODE);
  167. // fclose(logfp);
  168. // }
  169. #ifndef TXT_ONLY
  170. }
  171. #endif
  172. return 0;
  173. }
  174. int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
  175. {
  176. FILE *logfp;
  177. if(!log_config.enable_logs)
  178. return 0;
  179. nullpo_retr(0, sd);
  180. #ifndef TXT_ONLY
  181. if(log_config.sql_logs > 0)
  182. {
  183. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ", log_config.log_mvpdrop_db, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex));
  184. if(mysql_query(&logmysql_handle, tmp_sql))
  185. {
  186. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  187. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  188. }
  189. } else {
  190. #endif
  191. if((logfp=fopen(log_config.log_mvpdrop,"a+")) != NULL) {
  192. time(&curtime);
  193. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  194. fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], RETCODE);
  195. fclose(logfp);
  196. }
  197. #ifndef TXT_ONLY
  198. }
  199. #endif
  200. return 0;
  201. }
  202. int log_atcommand(struct map_session_data *sd, const char *message)
  203. {
  204. FILE *logfp;
  205. #ifndef TXT_ONLY
  206. char t_name[NAME_LENGTH*2];
  207. char t_msg[MESSAGE_SIZE*2+1]; //These are the contents of an @ call, so there shouldn't be overflow danger here?
  208. #endif
  209. if(!log_config.enable_logs)
  210. return 0;
  211. nullpo_retr(0, sd);
  212. #ifndef TXT_ONLY
  213. if(log_config.sql_logs > 0)
  214. {
  215. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`atcommand_date`, `account_id`, `char_id`, `char_name`, `map`, `command`) VALUES(NOW(), '%d', '%d', '%s', '%s', '%s') ",
  216. log_config.log_gm_db, sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name), mapindex_id2name(sd->mapindex), jstrescapecpy(t_msg, (char *)message));
  217. if(mysql_query(&logmysql_handle, tmp_sql))
  218. {
  219. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  220. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  221. }
  222. } else {
  223. #endif
  224. if((logfp=fopen(log_config.log_gm,"a+")) != NULL) {
  225. time(&curtime);
  226. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  227. fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
  228. fclose(logfp);
  229. }
  230. #ifndef TXT_ONLY
  231. }
  232. #endif
  233. return 0;
  234. }
  235. int log_npc(struct map_session_data *sd, const char *message)
  236. { //[Lupus]
  237. FILE *logfp;
  238. #ifndef TXT_ONLY
  239. char t_name[NAME_LENGTH*2];
  240. char t_msg[255+1]; //it's 255 chars MAX.
  241. #endif
  242. if(!log_config.enable_logs)
  243. return 0;
  244. nullpo_retr(0, sd);
  245. #ifndef TXT_ONLY
  246. if(log_config.sql_logs > 0)
  247. {
  248. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES(NOW(), '%d', '%d', '%s', '%s', '%s') ",
  249. log_config.log_npc_db, sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name), mapindex_id2name(sd->mapindex), jstrescapecpy(t_msg, (char *)message));
  250. if(mysql_query(&logmysql_handle, tmp_sql))
  251. {
  252. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  253. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  254. }
  255. } else {
  256. #endif
  257. if((logfp=fopen(log_config.log_npc,"a+")) != NULL) {
  258. time(&curtime);
  259. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  260. fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
  261. fclose(logfp);
  262. }
  263. #ifndef TXT_ONLY
  264. }
  265. #endif
  266. return 0;
  267. }
  268. //ChatLogging
  269. // Log CHAT (currently only: Party, Guild, Whisper)
  270. // LOGGING FILTERS [Lupus]
  271. //=============================================================
  272. //0 = Don't log at all
  273. //1 = Log any chat messages
  274. //Advanced Filter Bits: ||
  275. //2 - Log Whisper messages
  276. //3 - Log Party messages
  277. //4 - Log Guild messages
  278. //5 - Log Common messages (not implemented)
  279. //6 - Don't log when WOE is on
  280. //Example:
  281. //log_chat: 1 = logs ANY messages
  282. //log_chat: 6 = logs both Whisper & Party messages
  283. //log_chat: 8 = logs only Guild messages
  284. //log_chat: 18 = logs only Whisper, when WOE is off
  285. int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map, int x, int y, char *dst_charname, char *message){
  286. #ifndef TXT_ONLY
  287. char t_charname[NAME_LENGTH*2];
  288. char t_msg[MESSAGE_SIZE*2+1]; //Chat line fully escaped, with an extra space just in case.
  289. #else
  290. FILE *logfp;
  291. #endif
  292. //Check ON/OFF
  293. if(log_config.chat <= 0)
  294. return 0; //Deactivated
  295. #ifndef TXT_ONLY
  296. if(log_config.sql_logs > 0){
  297. sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `type`, `type_id`, `src_charid`, `src_accountid`, `src_map`, `src_map_x`, `src_map_y`, `dst_charname`, `message`) VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%s', '%s')",
  298. log_config.log_chat_db, type, type_id, src_charid, src_accid, map, x, y, jstrescapecpy(t_charname, dst_charname), jstrescapecpy(t_msg, message));
  299. if(mysql_query(&logmysql_handle, tmp_sql)){
  300. ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
  301. ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
  302. return -1;
  303. }else{
  304. return 0;
  305. }
  306. }
  307. #endif
  308. #ifdef TXT_ONLY
  309. if((logfp = fopen(log_config.log_chat, "a+")) != NULL){
  310. time(&curtime);
  311. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  312. //DATE - type,type_id,src_charid,src_accountid,src_map,src_x,src_y,dst_charname,message
  313. fprintf(logfp, "%s - %s,%d,%d,%d,%s,%d,%d,%s,%s%s",
  314. timestring, type, type_id, src_charid, src_accid, map, x, y, dst_charname, message, RETCODE);
  315. fclose(logfp);
  316. return 0;
  317. }else{
  318. return -1;
  319. }
  320. #endif
  321. return -1;
  322. }
  323. void log_set_defaults(void)
  324. {
  325. memset(&log_config, 0, sizeof(log_config));
  326. //LOG FILTER Default values
  327. log_config.refine_items_log = 5; //log refined items, with refine >= +7
  328. log_config.rare_items_log = 100; //log rare items. drop chance <= 1%
  329. log_config.price_items_log = 1000; //1000z
  330. log_config.amount_items_log = 100;
  331. }
  332. int log_config_read(char *cfgName)
  333. {
  334. static int count = 0;
  335. char line[1024], w1[1024], w2[1024];
  336. FILE *fp;
  337. if ((count++) == 0)
  338. log_set_defaults();
  339. if((fp = fopen(cfgName, "r")) == NULL)
  340. {
  341. ShowError("Log configuration file not found at: %s\n", cfgName);
  342. return 1;
  343. }
  344. while(fgets(line, sizeof(line) -1, fp))
  345. {
  346. if(line[0] == '/' && line[1] == '/')
  347. continue;
  348. if(sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2)
  349. {
  350. if(strcmpi(w1,"enable_logs") == 0) {
  351. log_config.enable_logs = (atoi(w2));
  352. if (log_config.enable_logs&1) //Log everything.
  353. log_config.enable_logs=0xFFFFFFFF;
  354. } else if(strcmpi(w1,"sql_logs") == 0) {
  355. log_config.sql_logs = (atoi(w2));
  356. //start of common filter settings
  357. } else if(strcmpi(w1,"rare_items_log") == 0) {
  358. log_config.rare_items_log = (atoi(w2));
  359. } else if(strcmpi(w1,"refine_items_log") == 0) {
  360. log_config.refine_items_log = (atoi(w2));
  361. } else if(strcmpi(w1,"price_items_log") == 0) {
  362. log_config.price_items_log = (atoi(w2));
  363. } else if(strcmpi(w1,"amount_items_log") == 0) {
  364. log_config.amount_items_log = (atoi(w2));
  365. //end of common filter settings
  366. } else if(strcmpi(w1,"log_branch") == 0) {
  367. log_config.branch = (atoi(w2));
  368. } else if(strcmpi(w1,"log_filter") == 0) {
  369. log_config.filter = (atoi(w2));
  370. } else if(strcmpi(w1,"log_zeny") == 0) {
  371. log_config.zeny = (atoi(w2));
  372. } else if(strcmpi(w1,"log_gm") == 0) {
  373. log_config.gm = (atoi(w2));
  374. } else if(strcmpi(w1,"log_npc") == 0) {
  375. log_config.npc = (atoi(w2));
  376. } else if(strcmpi(w1, "log_chat") == 0) {
  377. log_config.chat = (atoi(w2));
  378. } else if(strcmpi(w1,"log_mvpdrop") == 0) {
  379. log_config.mvpdrop = (atoi(w2));
  380. }
  381. #ifndef TXT_ONLY
  382. else if(strcmpi(w1, "log_branch_db") == 0) {
  383. strcpy(log_config.log_branch_db, w2);
  384. if(log_config.branch == 1)
  385. ShowNotice("Logging Dead Branch Usage to table `%s`\n", w2);
  386. } else if(strcmpi(w1, "log_pick_db") == 0) {
  387. strcpy(log_config.log_pick_db, w2);
  388. if(log_config.filter)
  389. ShowNotice("Logging Item Picks to table `%s`\n", w2);
  390. } else if(strcmpi(w1, "log_zeny_db") == 0) {
  391. strcpy(log_config.log_zeny_db, w2);
  392. if(log_config.zeny == 1)
  393. ShowNotice("Logging Zeny to table `%s`\n", w2);
  394. } else if(strcmpi(w1, "log_mvpdrop_db") == 0) {
  395. strcpy(log_config.log_mvpdrop_db, w2);
  396. if(log_config.mvpdrop == 1)
  397. ShowNotice("Logging MVP Drops to table `%s`\n", w2);
  398. } else if(strcmpi(w1, "log_gm_db") == 0) {
  399. strcpy(log_config.log_gm_db, w2);
  400. if(log_config.gm > 0)
  401. ShowNotice("Logging GM Level %d Commands to table `%s`\n", log_config.gm, w2);
  402. } else if(strcmpi(w1, "log_npc_db") == 0) {
  403. strcpy(log_config.log_npc_db, w2);
  404. if(log_config.npc > 0)
  405. ShowNotice("Logging NPC 'logmes' to table `%s`\n", w2);
  406. } else if(strcmpi(w1, "log_chat_db") == 0) {
  407. strcpy(log_config.log_chat_db, w2);
  408. if(log_config.chat > 0)
  409. ShowNotice("Logging CHAT to table `%s`\n", w2);
  410. }
  411. #endif
  412. else if(strcmpi(w1, "log_branch_file") == 0) {
  413. strcpy(log_config.log_branch, w2);
  414. if(log_config.branch > 0 && log_config.sql_logs < 1)
  415. ShowNotice("Logging Dead Branch Usage to file `%s`.txt\n", w2);
  416. } else if(strcmpi(w1, "log_pick_file") == 0) {
  417. strcpy(log_config.log_pick, w2);
  418. if(log_config.filter > 0 && log_config.sql_logs < 1)
  419. ShowNotice("Logging Item Picks to file `%s`.txt\n", w2);
  420. } else if(strcmpi(w1, "log_zeny_file") == 0) {
  421. strcpy(log_config.log_zeny, w2);
  422. if(log_config.zeny > 0 && log_config.sql_logs < 1)
  423. ShowNotice("Logging Zeny to file `%s`.txt\n", w2);
  424. } else if(strcmpi(w1, "log_mvpdrop_file") == 0) {
  425. strcpy(log_config.log_mvpdrop, w2);
  426. if(log_config.mvpdrop > 0 && log_config.sql_logs < 1)
  427. ShowNotice("Logging MVP Drops to file `%s`.txt\n", w2);
  428. } else if(strcmpi(w1, "log_gm_file") == 0) {
  429. strcpy(log_config.log_gm, w2);
  430. if(log_config.gm > 0 && log_config.sql_logs < 1)
  431. ShowNotice("Logging GM Level %d Commands to file `%s`.txt\n", log_config.gm, w2);
  432. } else if(strcmpi(w1, "log_npc_file") == 0) {
  433. strcpy(log_config.log_npc, w2);
  434. if(log_config.npc > 0 && log_config.sql_logs < 1)
  435. ShowNotice("Logging NPC 'logmes' to file `%s`.txt\n", w2);
  436. } else if(strcmpi(w1, "log_chat_file") == 0) {
  437. strcpy(log_config.log_chat, w2);
  438. if(log_config.chat > 0 && log_config.sql_logs < 1)
  439. ShowNotice("Logging CHAT to file `%s`.txt\n", w2);
  440. //support the import command, just like any other config
  441. } else if(strcmpi(w1,"import") == 0) {
  442. log_config_read(w2);
  443. }
  444. }
  445. }
  446. fclose(fp);
  447. return 0;
  448. }