viewing paste stats-mod Ea atcommand | C

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