diff options
-rw-r--r-- | Changelog.txt | 5 | ||||
-rw-r--r-- | src/char/char.c | 3 | ||||
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/map/atcommand.c | 23 | ||||
-rw-r--r-- | src/map/atcommand.h | 1 | ||||
-rw-r--r-- | src/map/charcommand.c | 47 | ||||
-rw-r--r-- | src/map/charcommand.h | 1 | ||||
-rw-r--r-- | src/map/mob.c | 3 |
8 files changed, 81 insertions, 4 deletions
diff --git a/Changelog.txt b/Changelog.txt index 6f9f872ed..ba2e5eca3 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,10 @@ Date Added 12/14 + * common/mmo.h: changed base_level and job_level to unsigned int to increase max levels [Codemaster] + * char/char.c: added a NULL check for the file in parse_friend_txt [Codemaster] + * map/atcommand.c/.h: added @clearweather (thanks to Dexity) [Codemaster] + * map/charcommand.c/.h: added #spiritball [Codemaster] + * map/mob.c: fixed a compiler warning (ln was an int and was supposed to be an unsigned long int) [Codemaster] * Added nullpo_retb to nullpo.c - does a break; if null [celest] * Replaced some parts in skill.c with nullpo checks [celest] * Corrected some typos - penaly -> penalty [celest] diff --git a/src/char/char.c b/src/char/char.c index 2d5c5ba7d..50e1c4f0a 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -577,6 +577,9 @@ int parse_friend_txt(struct mmo_charstatus *p) // Open the file and look for the ID fp = fopen(friends_txt, "r"); + + if(fp == NULL) + return 1; while(fgets(line, sizeof(line)-1, fp)) { diff --git a/src/common/mmo.h b/src/common/mmo.h index 3504b00e4..378f324a1 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -129,7 +129,7 @@ struct mmo_charstatus { short head_top,head_mid,head_bottom; char name[24]; - unsigned char base_level,job_level; + unsigned int base_level,job_level; short str,agi,vit,int_,dex,luk; unsigned char char_num,sex; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d460bfa2d..ff7ff00da 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -206,6 +206,7 @@ ATCOMMAND_FUNC(trade); // by MouseJstr ATCOMMAND_FUNC(send); // by davidsiaw ATCOMMAND_FUNC(setbattleflag); // by MouseJstr ATCOMMAND_FUNC(unmute); // [Valaris] +ATCOMMAND_FUNC(clearweather); // Dexity ATCOMMAND_FUNC(uptime); // by MC Cameri ATCOMMAND_FUNC(changesex); // by MC Cameri ATCOMMAND_FUNC(mute); // celest @@ -455,6 +456,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Send, "@send", 60, atcommand_send }, { AtCommand_SetBattleFlag, "@setbattleflag", 60, atcommand_setbattleflag }, { AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris] + { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity { AtCommand_UpTime, "@uptime", 0, atcommand_uptime }, // by MC Cameri { AtCommand_ChangeSex, "@changesex", 1, atcommand_changesex }, // by MC Cameri { AtCommand_Mute, "@mute", 99, atcommand_mute }, // [celest] @@ -7686,6 +7688,27 @@ atcommand_leaves( clif_specialeffect(&sd->bl,effno,2); return 0; } + +/*========================================== + * Clearing Weather Effects by Dexity + *------------------------------------------ + */ +int +atcommand_clearweather( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int effno = 0; + nullpo_retr(-1, sd); + map[sd->bl.m].flag.rain=0; + map[sd->bl.m].flag.snow=0; + map[sd->bl.m].flag.sakura=0; + map[sd->bl.m].flag.fog=0; + map[sd->bl.m].flag.leaves=0; + clif_specialeffect(&sd->bl,effno,2); + return 0; +} + /*========================================== * *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index ce8fc2359..5cb40b433 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -187,6 +187,7 @@ enum AtCommandType { AtCommand_Send, AtCommand_SetBattleFlag, AtCommand_UnMute, + AtCommand_Clearweather, // by Dexity AtCommand_UpTime, // by MC Cameri AtCommand_ChangeSex, // by MC Cameri AtCommand_Mute, // [celest] diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 4c22ecbcc..56cf6b316 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -42,6 +42,7 @@ CCMD_FUNC(option); CCMD_FUNC(save); CCMD_FUNC(stats_all); CCMD_FUNC(reset); +CCMD_FUNC(spiritball); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -70,6 +71,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandReset, "#reset", 60, charcommand_reset }, { CharCommandSave, "#save", 60, charcommand_save }, { CharCommandStatsAll, "#statsall", 40, charcommand_stats_all }, + { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -248,8 +250,8 @@ int charcommand_config_read(const char *cfgName) { charcommand_config_read(w2); else if (strcmpi(w1, "command_symbol") == 0 && w2[0] > 31 && w2[0] != '/' && // symbol of standard ragnarok GM commands - w2[0] != '%' && // symbol of party chat speaking - w2[0] != '@') // symbol for @commands + w2[0] != '%' // symbol of party chat speaking + ) command_symbol = w2[0]; } fclose(fp); @@ -701,3 +703,44 @@ int charcommand_stats_all(const int fd, struct map_session_data* sd, const char* return 0; } +/*========================================== + * CharSpiritBall Function by PalasX + *------------------------------------------ + */ +int charcommand_spiritball(const int fd, struct map_session_data* sd,const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char character[100]; + int spirit = 0; + + memset(character, '\0', sizeof(character)); + + if(!message || !*message || sscanf(message, "%d %99[^\n]", &spirit, character) < 2 || spirit < 0 || spirit > 1000) { + clif_displaymessage(fd, "Usage: @spiritball <number: 0-1000>) <CHARACTER_NAME>."); + return -1; + } + + if((pl_sd = map_nick2sd(character)) != NULL) { + if (spirit >= 0 && spirit <= 0x7FFF) { + if (pl_sd->spiritball != spirit || spirit > 999) { + if (pl_sd->spiritball > 0) + pc_delspiritball(pl_sd, pl_sd->spiritball, 1); + pl_sd->spiritball = spirit; + clif_spiritball(pl_sd); + // no message, player can look the difference + if (spirit > 1000) + clif_displaymessage(fd, msg_table[204]); // WARNING: more than 1000 spiritballs can CRASH your server and/or client! + } else { + clif_displaymessage(fd, msg_table[205]); // You already have this number of spiritballs. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 11babb816..27629d9b7 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -11,6 +11,7 @@ enum CharCommandType { CharCommandOption, CharCommandSave, CharCommandStatsAll, + CharCommandSpiritball, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/mob.c b/src/map/mob.c index d773de1ec..a7516c784 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4185,7 +4185,8 @@ void mob_reload(void) static int mob_read_sqldb(void) { char line[1024]; - int i,class,ln=0; + int i,class; + long unsigned int ln=0; char *str[55],*p,*np; memset(mob_db,0,sizeof(mob_db)); |