# 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 }, };