log.c 18 KB

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