log.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. // Logging functions by Azndragon & Codemaster
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include "map.h"
  6. #include "nullpo.h"
  7. #include "log.h"
  8. struct Log_Config log_config;
  9. int log_branch(struct map_session_data *sd)
  10. {
  11. FILE *logfp;
  12. if(log_config.enable_logs <= 0)
  13. return 0;
  14. nullpo_retr(0, sd);
  15. #ifndef TXT_ONLY
  16. if(log_config.sql_logs > 0)
  17. {
  18. sprintf(tmp_sql, "INSERT INTO `%s` (`branch_date`, `account_id`, `char_id`, `char_name`, `map`) VALUES (NOW(), '%d', '%d', '%s', '%s')", log_config.log_branch_db, sd->status.account_id, sd->status.char_id, sd->status.name, sd->mapname);
  19. if(mysql_query(&mmysql_handle, tmp_sql))
  20. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  21. } else {
  22. #endif
  23. if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
  24. char timestring[255];
  25. time_t curtime;
  26. time(&curtime);
  27. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  28. fprintf(logfp,"%s - %s[%d:%d]\t%s%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, sd->mapname, RETCODE);
  29. fclose(logfp);
  30. }
  31. #ifndef TXT_ONLY
  32. }
  33. #endif
  34. return 0;
  35. }
  36. int log_drop(struct map_session_data *sd, int monster_id, int *log_drop)
  37. {
  38. FILE *logfp;
  39. if(log_config.enable_logs <= 0)
  40. return 0;
  41. nullpo_retr(0, sd);
  42. #ifndef TXT_ONLY
  43. if(log_config.sql_logs > 0)
  44. {
  45. sprintf(tmp_sql, "INSERT INTO `%s` (`drop_date`, `kill_char_id`, `monster_id`, `item1`, `item2`, `item3`, `item4`, `item5`, `item6`, `item7`, `item8`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s') ", log_config.log_drop_db, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], sd->mapname);
  46. if(mysql_query(&mmysql_handle, tmp_sql))
  47. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  48. } else {
  49. #endif
  50. if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
  51. char timestring[255];
  52. time_t curtime;
  53. time(&curtime);
  54. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  55. fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d,%d,%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], RETCODE);
  56. fclose(logfp);
  57. }
  58. #ifndef TXT_ONLY
  59. }
  60. #endif
  61. return 0;
  62. }
  63. int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
  64. {
  65. FILE *logfp;
  66. if(log_config.enable_logs <= 0)
  67. return 0;
  68. nullpo_retr(0, sd);
  69. #ifndef TXT_ONLY
  70. if(log_config.sql_logs > 0)
  71. {
  72. sprintf(tmp_sql, "INSERT 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], sd->mapname);
  73. if(mysql_query(&mmysql_handle, tmp_sql))
  74. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  75. } else {
  76. #endif
  77. if((logfp=fopen(log_config.log_mvpdrop,"a+")) != NULL) {
  78. char timestring[255];
  79. time_t curtime;
  80. time(&curtime);
  81. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  82. 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);
  83. fclose(logfp);
  84. }
  85. #ifndef TXT_ONLY
  86. }
  87. #endif
  88. return 0;
  89. }
  90. int log_present(struct map_session_data *sd, int source_type, int nameid)
  91. {
  92. FILE *logfp;
  93. if(log_config.enable_logs <= 0)
  94. return 0;
  95. nullpo_retr(0, sd);
  96. #ifndef TXT_ONLY
  97. if(log_config.sql_logs > 0)
  98. {
  99. sprintf(tmp_sql, "INSERT INTO `%s` (`present_date`, `src_id`, `account_id`, `char_id`, `char_name`, `nameid`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%s', '%d', '%s') ", log_config.log_present_db, source_type, sd->status.account_id, sd->status.char_id, sd->status.name, nameid, sd->mapname);
  100. if(mysql_query(&mmysql_handle, tmp_sql))
  101. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  102. } else {
  103. #endif
  104. if((logfp=fopen(log_config.log_present,"a+")) != NULL) {
  105. char timestring[255];
  106. time_t curtime;
  107. time(&curtime);
  108. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  109. fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, source_type, nameid, RETCODE);
  110. fclose(logfp);
  111. }
  112. #ifndef TXT_ONLY
  113. }
  114. #endif
  115. return 0;
  116. }
  117. int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, int slot3, int success)
  118. {
  119. FILE *logfp;
  120. if(log_config.enable_logs <= 0)
  121. return 0;
  122. nullpo_retr(0, sd);
  123. #ifndef TXT_ONLY
  124. if(log_config.sql_logs > 0)
  125. {
  126. sprintf(tmp_sql, "INSERT INTO `%s` (`produce_date`, `account_id`, `char_id`, `char_name`, `nameid`, `slot1`, `slot2`, `slot3`, `map`, `success`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%s', '%d') ", log_config.log_produce_db, sd->status.account_id, sd->status.char_id, sd->status.name, nameid, slot1, slot2, slot3, sd->mapname, success);
  127. if(mysql_query(&mmysql_handle, tmp_sql))
  128. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  129. } else {
  130. #endif
  131. if((logfp=fopen(log_config.log_produce,"a+")) != NULL) {
  132. char timestring[255];
  133. time_t curtime;
  134. time(&curtime);
  135. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  136. fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, nameid, slot1, slot2, slot3, success, RETCODE);
  137. fclose(logfp);
  138. }
  139. #ifndef TXT_ONLY
  140. }
  141. #endif
  142. return 0;
  143. }
  144. int log_refine(struct map_session_data *sd, int n, int success)
  145. {
  146. FILE *logfp;
  147. int log_card[4];
  148. int item_level;
  149. int i;
  150. if(log_config.enable_logs <= 0)
  151. return 0;
  152. nullpo_retr(0, sd);
  153. if(success == 0)
  154. item_level = 0;
  155. else
  156. item_level = sd->status.inventory[n].refine + 1;
  157. for(i=0;i<4;i++)
  158. log_card[i] = sd->status.inventory[n].card[i];
  159. #ifndef TXT_ONLY
  160. if(log_config.sql_logs > 0)
  161. {
  162. sprintf(tmp_sql, "INSERT INTO `%s` (`refine_date`, `account_id`, `char_id`, `char_name`, `nameid`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `success`, `item_level`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d')", log_config.log_refine_db, sd->status.account_id, sd->status.char_id, sd->status.name, sd->status.inventory[n].nameid, sd->status.inventory[n].refine, log_card[0], log_card[1], log_card[2], log_card[3], sd->mapname, success, item_level);
  163. if(mysql_query(&mmysql_handle, tmp_sql))
  164. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  165. } else {
  166. #endif
  167. if((logfp=fopen(log_config.log_refine,"a+")) != NULL) {
  168. char timestring[255];
  169. time_t curtime;
  170. time(&curtime);
  171. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  172. fprintf(logfp,"%s - %s[%d:%d]\t%d,%d\t%d%d%d%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, sd->status.inventory[n].nameid, sd->status.inventory[n].refine, log_card[0], log_card[1], log_card[2], log_card[3], success, item_level, RETCODE);
  173. fclose(logfp);
  174. }
  175. #ifndef TXT_ONLY
  176. }
  177. #endif
  178. return 0;
  179. }
  180. int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, int n,int amount)
  181. {
  182. FILE *logfp;
  183. int log_nameid, log_amount, log_refine, log_card[4];
  184. int i;
  185. if(log_config.enable_logs <= 0)
  186. return 0;
  187. nullpo_retr(0, sd);
  188. if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
  189. return 1;
  190. if(sd->status.inventory[n].amount < 0)
  191. return 1;
  192. log_nameid = sd->status.inventory[n].nameid;
  193. log_amount = sd->status.inventory[n].amount;
  194. log_refine = sd->status.inventory[n].refine;
  195. for(i=0;i<4;i++)
  196. log_card[i] = sd->status.inventory[n].card[i];
  197. #ifndef TXT_ONLY
  198. if(log_config.sql_logs > 0)
  199. {
  200. sprintf(tmp_sql, "INSERT INTO `%s` (`trade_date`, `src_account_id`, `src_char_id`, `src_char_name`, `des_account_id`, `des_char_id`, `des_char_name`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')", log_config.log_trade_db, sd->status.account_id, sd->status.char_id, sd->status.name, target_sd->status.account_id, target_sd->status.char_id, target_sd->status.name, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], sd->mapname);
  201. if(mysql_query(&mmysql_handle, tmp_sql))
  202. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  203. } else {
  204. #endif
  205. if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
  206. char timestring[255];
  207. time_t curtime;
  208. time(&curtime);
  209. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  210. fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, target_sd->status.name, target_sd->status.account_id, target_sd->status.char_id, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], RETCODE);
  211. fclose(logfp);
  212. }
  213. #ifndef TXT_ONLY
  214. }
  215. #endif
  216. return 0;
  217. }
  218. int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int amount, int zeny)
  219. {
  220. FILE *logfp;
  221. int log_nameid, log_amount, log_refine, log_card[4];
  222. int i;
  223. if(log_config.enable_logs <= 0)
  224. return 0;
  225. nullpo_retr(0, sd);
  226. if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
  227. return 1;
  228. if(sd->status.inventory[n].amount< 0)
  229. return 1;
  230. log_nameid = sd->status.inventory[n].nameid;
  231. log_amount = sd->status.inventory[n].amount;
  232. log_refine = sd->status.inventory[n].refine;
  233. for(i=0;i<4;i++)
  234. log_card[i] = sd->status.inventory[n].card[i];
  235. #ifndef TXT_ONLY
  236. if(log_config.sql_logs > 0)
  237. {
  238. sprintf(tmp_sql, "INSERT INTO `%s` (`vend_date`, `vend_account_id`, `vend_char_id`, `vend_char_name`, `buy_account_id`, `buy_char_id`, `buy_char_name`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `zeny`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d')", log_config.log_vend_db, sd->status.account_id, sd->status.char_id, sd->status.name, vsd->status.account_id, vsd->status.char_id, vsd->status.name, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], sd->mapname, zeny);
  239. if(mysql_query(&mmysql_handle, tmp_sql))
  240. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  241. } else {
  242. #endif
  243. if((logfp=fopen(log_config.log_vend,"a+")) != NULL) {
  244. char timestring[255];
  245. time_t curtime;
  246. time(&curtime);
  247. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  248. fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t%d,%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, vsd->status.name, vsd->status.account_id, vsd->status.char_id, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], zeny, RETCODE);
  249. fclose(logfp);
  250. }
  251. #ifndef TXT_ONLY
  252. }
  253. #endif
  254. return 0;
  255. }
  256. int log_zeny(struct map_session_data *sd, struct map_session_data *target_sd,int amount)
  257. {
  258. FILE *logfp;
  259. if(log_config.enable_logs <= 0)
  260. return 0;
  261. nullpo_retr(0, sd);
  262. #ifndef TXT_ONLY
  263. if(log_config.sql_logs > 0)
  264. {
  265. sprintf(tmp_sql,"INSERT INTO `%s` (`trade_date`, `src_account_id`, `src_char_id`, `src_char_name`, `des_account_id`, `des_char_id`, `des_char_name`, `map`, `zeny`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%s', '%s', '%d')", log_config.log_trade_db, sd->status.account_id, sd->status.char_id, sd->status.name, target_sd->status.account_id, target_sd->status.char_id, target_sd->status.name, sd->mapname, sd->deal_zeny);
  266. if(mysql_query(&mmysql_handle, tmp_sql))
  267. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  268. } else {
  269. #endif
  270. if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
  271. char timestring[255];
  272. time_t curtime;
  273. time(&curtime);
  274. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  275. 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);
  276. fclose(logfp);
  277. }
  278. #ifndef TXT_ONLY
  279. }
  280. #endif
  281. return 0;
  282. }
  283. int log_atcommand(struct map_session_data *sd, const char *message)
  284. {
  285. FILE *logfp;
  286. if(log_config.enable_logs <= 0)
  287. return 0;
  288. nullpo_retr(0, sd);
  289. #ifndef TXT_ONLY
  290. if(log_config.sql_logs > 0)
  291. {
  292. sprintf(tmp_sql, "INSERT INTO `%s` (`atcommand_date`, `account_id`, `char_id`, `char_name`, `map`, `command`) VALUES(NOW(), '%d', '%d', '%s', '%s', '%s') ", log_config.log_gm_db, sd->status.account_id, sd->status.char_id, sd->status.name, sd->mapname, message);
  293. if(mysql_query(&mmysql_handle, tmp_sql))
  294. printf("DB server Error - %s\n",mysql_error(&mmysql_handle));
  295. } else {
  296. #endif
  297. if((logfp=fopen(log_config.log_gm,"a+")) != NULL) {
  298. char timestring[255];
  299. time_t curtime;
  300. time(&curtime);
  301. strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
  302. fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
  303. fclose(logfp);
  304. }
  305. #ifndef TXT_ONLY
  306. }
  307. #endif
  308. return 0;
  309. }
  310. int log_config_read(char *cfgName)
  311. {
  312. char line[1024], w1[1024], w2[1024];
  313. FILE *fp;
  314. if((fp = fopen(cfgName, "r")) == NULL)
  315. {
  316. printf("Log configuration file not found at: %s\n", cfgName);
  317. return 1;
  318. }
  319. while(fgets(line, sizeof(line) -1, fp))
  320. {
  321. if(line[0] == '/' && line[1] == '/')
  322. continue;
  323. if(sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2)
  324. {
  325. if(strcmpi(w1,"enable_logs") == 0) {
  326. log_config.enable_logs = (atoi(w2));
  327. } else if(strcmpi(w1,"sql_logs") == 0) {
  328. log_config.sql_logs = (atoi(w2));
  329. } else if(strcmpi(w1,"log_branch") == 0) {
  330. log_config.branch = (atoi(w2));
  331. } else if(strcmpi(w1,"log_drop") == 0) {
  332. log_config.drop = (atoi(w2));
  333. } else if(strcmpi(w1,"log_mvpdrop") == 0) {
  334. log_config.mvpdrop = (atoi(w2));
  335. } else if(strcmpi(w1,"log_present") == 0) {
  336. log_config.present = (atoi(w2));
  337. } else if(strcmpi(w1,"log_produce") == 0) {
  338. log_config.produce = (atoi(w2));
  339. } else if(strcmpi(w1,"log_refine") == 0) {
  340. log_config.refine = (atoi(w2));
  341. } else if(strcmpi(w1,"log_trade") == 0) {
  342. log_config.trade = (atoi(w2));
  343. } else if(strcmpi(w1,"log_vend") == 0) {
  344. log_config.vend = (atoi(w2));
  345. } else if(strcmpi(w1,"log_zeny") == 0) {
  346. if(log_config.trade != 1)
  347. log_config.zeny = 0;
  348. else
  349. log_config.zeny = (atoi(w2));
  350. } else if(strcmpi(w1,"log_gm") == 0) {
  351. log_config.gm = (atoi(w2));
  352. }
  353. else if(strcmpi(w1, "log_branch_db") == 0) {
  354. strcpy(log_config.log_branch_db, w2);
  355. if(log_config.branch == 1)
  356. printf("Logging Dead Branch Usage to table `%s`\n", w2);
  357. } else if(strcmpi(w1, "log_drop_db") == 0) {
  358. strcpy(log_config.log_drop_db, w2);
  359. if(log_config.drop == 1)
  360. printf("Logging Item Drops to table `%s`\n", w2);
  361. } else if(strcmpi(w1, "log_mvpdrop_db") == 0) {
  362. strcpy(log_config.log_mvpdrop_db, w2);
  363. if(log_config.mvpdrop == 1)
  364. printf("Logging MVP Drops to table `%s`\n", w2);
  365. } else if(strcmpi(w1, "log_present_db") == 0) {
  366. strcpy(log_config.log_present_db, w2);
  367. if(log_config.present == 1)
  368. printf("Logging Present Usage & Results to table `%s`\n", w2);
  369. } else if(strcmpi(w1, "log_produce_db") == 0) {
  370. strcpy(log_config.log_produce_db, w2);
  371. if(log_config.produce == 1)
  372. printf("Logging Producing to table `%s`\n", w2);
  373. } else if(strcmpi(w1, "log_refine_db") == 0) {
  374. strcpy(log_config.log_refine_db, w2);
  375. if(log_config.refine == 1)
  376. printf("Logging Refining to table `%s`\n", w2);
  377. } else if(strcmpi(w1, "log_trade_db") == 0) {
  378. strcpy(log_config.log_trade_db, w2);
  379. if(log_config.trade == 1)
  380. {
  381. printf("Logging Item Trades");
  382. if(log_config.zeny == 1)
  383. printf("and Zeny Trades");
  384. printf(" to table `%s`\n", w2);
  385. }
  386. } else if(strcmpi(w1, "log_vend_db") == 0) {
  387. strcpy(log_config.log_vend_db, w2);
  388. if(log_config.vend == 1)
  389. printf("Logging Vending to table `%s`\n", w2);
  390. } else if(strcmpi(w1, "log_gm_db") == 0) {
  391. strcpy(log_config.log_gm_db, w2);
  392. if(log_config.gm > 0)
  393. printf("Logging GM Level %d Commands to table `%s`\n", log_config.gm, w2);
  394. }
  395. else if(strcmpi(w1, "log_branch") == 0) {
  396. strcpy(log_config.log_branch, w2);
  397. if(log_config.branch == 1)
  398. printf("Logging Dead Branch Usage to file `%s`.txt\n", w2);
  399. } else if(strcmpi(w1, "log_drop") == 0) {
  400. strcpy(log_config.log_drop, w2);
  401. if(log_config.drop == 1)
  402. printf("Logging Item Drops to file `%s`.txt\n", w2);
  403. } else if(strcmpi(w1, "log_mvpdrop") == 0) {
  404. strcpy(log_config.log_mvpdrop, w2);
  405. if(log_config.mvpdrop == 1)
  406. printf("Logging MVP Drops to file `%s`.txt\n", w2);
  407. } else if(strcmpi(w1, "log_present") == 0) {
  408. strcpy(log_config.log_present, w2);
  409. if(log_config.present == 1)
  410. printf("Logging Present Usage & Results to file `%s`.txt\n", w2);
  411. } else if(strcmpi(w1, "log_produce") == 0) {
  412. strcpy(log_config.log_produce, w2);
  413. if(log_config.produce == 1)
  414. printf("Logging Producing to file `%s`.txt\n", w2);
  415. } else if(strcmpi(w1, "log_refine") == 0) {
  416. strcpy(log_config.log_refine, w2);
  417. if(log_config.refine == 1)
  418. printf("Logging Refining to file `%s`.txt\n", w2);
  419. } else if(strcmpi(w1, "log_trade") == 0) {
  420. strcpy(log_config.log_trade, w2);
  421. if(log_config.trade == 1)
  422. {
  423. printf("Logging Item Trades");
  424. if(log_config.zeny == 1)
  425. printf("and Zeny Trades");
  426. printf(" to file `%s`.txt\n", w2);
  427. }
  428. } else if(strcmpi(w1, "log_vend") == 0) {
  429. strcpy(log_config.log_vend, w2);
  430. if(log_config.vend == 1)
  431. printf("Logging Vending to file `%s`.txt\n", w2);
  432. } else if(strcmpi(w1, "log_gm") == 0) {
  433. strcpy(log_config.log_gm, w2);
  434. if(log_config.gm > 0)
  435. printf("Logging GM Level %d Commands to file `%s`.txt\n", log_config.gm, w2);
  436. }
  437. }
  438. }
  439. fclose(fp);
  440. return 0;
  441. }