Advertisement
Lighta

stats-mod Ea atcommand

Feb 11th, 2012
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.59 KB | None | 0 0
  1. # This patch file was generated by NetBeans IDE
  2. # It uses platform neutral UTF-8 encoding and \n newlines.
  3. Index : src/map/atcommand.c
  4. --- Base (BASE)
  5. +++ Locally Modified (Based On LOCAL)
  6. @@ -36,6 +36,7 @@
  7.  #include "storage.h"
  8.  #include "trade.h"
  9.  #include "unit.h"
  10. +#include "statslof.h"
  11.  
  12.  #ifndef TXT_ONLY
  13.  #include "mail.h"
  14. @@ -8562,7 +8563,136 @@
  15.     return 0;
  16.  }
  17.  
  18. +ACMD_FUNC(statslof)
  19. +{
  20. +   char function[10], type[8];
  21. +   int tmp=0;
  22.  
  23. +   memset(function, '\0', sizeof(function));   //Raz value
  24. +   memset(type, '\0', sizeof(type));
  25. +  
  26. +   sscanf(message, "%10s %8s", function, type);
  27. +   if(!strncmp(function, "init", sizeof("init"))) {
  28. +       tmp=statslof_init();
  29. +       switch(tmp) {
  30. +           case CMDOK : clif_displaymessage(fd,"Initialisation done"); break;
  31. +           case CMDFAIL : clif_displaymessage(fd,"Init FAILED check CLI"); break;
  32. +           default : clif_displaymessage(fd,"Eror on Init");
  33. +       }
  34. +   }
  35. +   else if(!strncmp(function, "enable", sizeof("enable"))) {
  36. +       if(!strncmp(type, "woe", sizeof("woe")))
  37. +           tmp=statslof_enable(TYPEWOE);
  38. +       else if(!strncmp(type, "rwc", sizeof("rwc")))
  39. +           tmp=statslof_enable(TYPERWC);
  40. +       else
  41. +           clif_displaymessage(fd,"Bad type parameter please use : woe, rwc");
  42. +       switch(tmp) {
  43. +           case CMDOK : clif_displaymessage(fd,"Stats enable"); break;
  44. +           case CMDFAIL : clif_displaymessage(fd,"Stats are already enable"); break;
  45. +           default : clif_displaymessage(fd,"Enable Stats failed");
  46. +       }
  47. +   }
  48. +   else if(!strncmp(function, "disable", sizeof("disable"))) {
  49. +       if(!strncmp(type, "woe", sizeof("woe")))
  50. +           tmp=statslof_disable(TYPEWOE);
  51. +       else if(!strncmp(type, "rwc", sizeof("rwc")))
  52. +           tmp=statslof_disable(TYPERWC);
  53. +       else
  54. +           clif_displaymessage(fd,"Bad type parameter please use : woe, rwc");
  55. +       switch(tmp) {
  56. +           case CMDOK : clif_displaymessage(fd,"Stats enable"); break;
  57. +           case CMDFAIL : clif_displaymessage(fd,"Stats are already enable"); break;
  58. +           default : clif_displaymessage(fd,"Enable Stats failed");
  59. +       }
  60. +   }
  61. +  
  62. +   else if(!strncmp(function, "insert", sizeof("insert"))) {
  63. +       #ifndef TXT_ONLY
  64. +       tmp=statslof_insert_inDB();
  65. +       switch(tmp) {
  66. +           case CMDOK : clif_displaymessage(fd,"Stats stored sucessfull"); break;
  67. +           case CMDFAIL : clif_displaymessage(fd,"Stats storage failed"); break;
  68. +           default : clif_displaymessage(fd,"Stats storage error");
  69. +       }
  70. +       #else /* not TXT_ONLY */
  71. +       clif_displaymessage(fd,"Cette commande n'est pas disponible en mode .txt");
  72. +       #endif
  73. +   }
  74. +   else if(!strncmp(function, "create", sizeof("create"))) {
  75. +       tmp=statslof_insert_inCSV();
  76. +       switch(tmp) {
  77. +           case CMDOK : clif_displaymessage(fd,"CSV Stats created sucessfully"); break;
  78. +           case CMDFAIL : clif_displaymessage(fd,"CSV Stats creation failed"); break;
  79. +           default : clif_displaymessage(fd,"CSV Stats error");
  80. +       }
  81. +   }
  82. +   else if(!strncmp(function, "clean", sizeof("clean"))) {
  83. +       tmp=statslof_clean();
  84. +       switch(tmp) {
  85. +           case CMDOK : clif_displaymessage(fd, "Clean StatsWoe done"); break;
  86. +           case CMDFAIL : clif_displaymessage(fd,"An error occured, clean fail"); break;
  87. +           default : clif_displaymessage(fd,"Error nothing was done !!");
  88. +       }
  89. +   }
  90. +   else if(!strncmp(function, "display", sizeof("display"))) {
  91. +       if(!strncmp(type, "skill", sizeof("skill"))) {
  92. +           tmp=statslof_display(sd, STATSKILL);
  93. +       }
  94. +       else if(!strncmp(type, "kill", sizeof("kill"))) {
  95. +           tmp=statslof_display(sd, STATKILL);
  96. +       }
  97. +       else if(!strncmp(type, "conso", sizeof("conso"))) {
  98. +           tmp=statslof_display(sd, STATCONSO);
  99. +       }
  100. +       else if(!strncmp(type, "dmg", sizeof("dmg"))) {
  101. +           tmp=statslof_display(sd, STATDMG);
  102. +       }
  103. +       else if(!strncmp(type, "heal", sizeof("heal"))) {
  104. +           tmp=statslof_display(sd, STATHEAL);
  105. +       }
  106. +       else if(!strncmp(type, "gkill", sizeof("gkill"))) {
  107. +           tmp=statslof_display(sd, STATGKILL);
  108. +       }
  109. +       else if(!strncmp(type, "gskill", sizeof("gskill"))) {
  110. +           tmp=statslof_display(sd, STATGSKILL);
  111. +       }
  112. +       else {
  113. +           clif_displaymessage(fd,"Bad type parameter please use : skill, kill, conso, dmg, heal, gkill, gskill");
  114. +       }
  115. +       switch(tmp) {
  116. +           case CMDOK : clif_displaymessage(fd,"All stats displayed"); break;
  117. +           case CMDFAIL : clif_displaymessage(fd,"Stats was truncated an error occured"); break;
  118. +           default : clif_displaymessage(fd,"Error nothing was done !!");
  119. +       }
  120. +   }
  121. +   else if(!strncmp(function, "test", sizeof("test"))) {
  122. +       tmp=statslof_test(sd);
  123. +       switch(tmp) {
  124. +           case CMDOK : clif_displaymessage(fd, "Test sucefully done"); break;
  125. +           case CMDFAIL : clif_displaymessage(fd,"Test return an Error"); break;
  126. +           default : clif_displaymessage(fd,"Error nothing was done !!");
  127. +       }
  128. +   }
  129. +   else if(!strncmp(function, "reset", sizeof("reset"))) {
  130. +       tmp=statslof_reset();
  131. +       switch(tmp) {
  132. +           case CMDOK : clif_displaymessage(fd, "Reset was done successfully"); break;
  133. +           case CMDFAIL : clif_displaymessage(fd,"Reset return an Error"); break;
  134. +           default : clif_displaymessage(fd,"Error nothing was done !!");
  135. +       }
  136. +   }
  137. +   else {
  138. +       clif_displaymessage(fd,"Bad syntaxe. Please use : statslof function type");
  139. +       clif_displaymessage(fd,"Where function are :enable, disable, display, create, insert, clean, reset, test");
  140. +       clif_displaymessage(fd,"Where type are : woe, rwc, skill, kill, conso, dmg");
  141. +   }
  142. +  
  143. +   return 0;
  144. +}
  145. +
  146. +
  147. +
  148.  /*==========================================
  149.   * atcommand_info[] structure definition
  150.   *------------------------------------------*/
  151. @@ -8865,6 +8995,7 @@
  152.     { "delitem",           60,60,     atcommand_delitem },
  153.     { "charcommands",       1,1,      atcommand_commands },
  154.     { "font",               1,1,      atcommand_font },
  155. +        { "statslof",          99,99,     atcommand_statslof },
  156.  };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement