diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 93 | ||||
-rw-r--r-- | src/map/atcommand.h | 1 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 16 | ||||
-rw-r--r-- | src/map/skill.h | 3 |
5 files changed, 104 insertions, 11 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index fd0acc5..136617f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -210,8 +210,9 @@ ATCOMMAND_FUNC(adjgmlvl); // by MouseJstr ATCOMMAND_FUNC(adjcmdlvl); // by MouseJstr ATCOMMAND_FUNC(trade); // by MouseJstr ATCOMMAND_FUNC(unmute); // [Valaris] -ATCOMMAND_FUNC(set_magic); -ATCOMMAND_FUNC(magic_info); +ATCOMMAND_FUNC(char_wipe); // [Fate] +ATCOMMAND_FUNC(set_magic); // [Fate] +ATCOMMAND_FUNC(magic_info); // [Fate] #ifndef TXT_ONLY ATCOMMAND_FUNC(checkmail); // [Valaris] @@ -456,8 +457,9 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_AdjCmdLvl, "@adjcmdlvl", 99, atcommand_adjcmdlvl }, { AtCommand_Trade, "@trade", 60, atcommand_trade }, { AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris] + { AtCommand_UnMute, "@charwipe", 60, atcommand_char_wipe }, // [Fate] { AtCommand_SetMagic, "@setmagic", 99, atcommand_set_magic }, // [Fate] - { AtCommand_MagicInfo, "@magicinfo", 99, atcommand_magic_info }, // [Fate] + { AtCommand_MagicInfo, "@magicinfo", 60, atcommand_magic_info }, // [Fate] #ifndef TXT_ONLY // sql-only commands { AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris] @@ -4482,8 +4484,10 @@ int atcommand_character_baselevel( clif_updatestatus(pl_sd, SP_STATUSPOINT); } // to add: remove status points from stats pl_sd->status.base_level += level; + pl_sd->status.base_exp = 0; clif_updatestatus(pl_sd, SP_BASELEVEL); clif_updatestatus(pl_sd, SP_NEXTBASEEXP); + clif_updatestatus(pl_sd, SP_BASEEXP); pc_calcstatus(pl_sd, 0); clif_displaymessage(fd, msg_table[66]); // Character's base level lowered. } @@ -5100,6 +5104,8 @@ int atcommand_charreset( if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset a character only for lower or same GM level pc_resetstate(pl_sd); pc_resetskill(pl_sd); + pc_setglobalreg(pl_sd, "MAGIC_FLAGS", 0); // [Fate] Reset magic quest variables + pc_setglobalreg(pl_sd, "MAGIC_EXP", 0); // [Fate] Reset magic experience sprintf(output, msg_table[208], character); // '%s' skill and stats points reseted! clif_displaymessage(fd, output); } else { @@ -5115,6 +5121,87 @@ int atcommand_charreset( } /*========================================== + * Character Wipe + *------------------------------------------ + */ +int atcommand_char_wipe( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[100]; + char output[200]; + struct map_session_data *pl_sd; + + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + + if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: @charwipe <charname>)."); + return -1; + } + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset a character only for lower or same GM level + int i; + + // Reset base level + pl_sd->status.base_level = 1; + pl_sd->status.base_exp = 0; + clif_updatestatus(pl_sd, SP_BASELEVEL); + clif_updatestatus(pl_sd, SP_NEXTBASEEXP); + clif_updatestatus(pl_sd, SP_BASEEXP); + + // Reset job level + pl_sd->status.job_level = 1; + pl_sd->status.job_exp = 0; + clif_updatestatus(pl_sd, SP_JOBLEVEL); + clif_updatestatus(pl_sd, SP_NEXTJOBEXP); + clif_updatestatus(pl_sd, SP_JOBEXP); + + // Zeny to 50 + pl_sd->status.zeny = 50; + clif_updatestatus(pl_sd, SP_ZENY); + + // Clear inventory + for (i = 0; i < MAX_INVENTORY; i++) { + if (sd->status.inventory[i].amount) { + if (sd->status.inventory[i].equip) + pc_unequipitem(pl_sd, i, 0); + pc_delitem(pl_sd, i, sd->status.inventory[i].amount, 0); + } + } + + // Give knife and shirt + struct item item; + item.nameid = 1201; // knife + item.identify = 1; + item.broken = 0; + pc_additem(pl_sd, &item, 1); + item.nameid = 1202; // shirt + pc_additem(pl_sd, &item, 1); + + // Reset stats and skills + pc_calcstatus(pl_sd, 0); + pc_resetstate(pl_sd); + pc_resetskill(pl_sd); + pc_setglobalreg(pl_sd, "MAGIC_FLAGS", 0); // [Fate] Reset magic quest variables + pc_setglobalreg(pl_sd, "MAGIC_EXP", 0); // [Fate] Reset magic experience + + sprintf(output, "%s: wiped.", character); // '%s' skill and stats points reseted! + clif_displaymessage(fd, output); + } else { + clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + + return 0; +} + +/*========================================== * Character Model by chbrules *------------------------------------------ */ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 7f6d469..4651d39 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -193,6 +193,7 @@ enum AtCommandType { AtCommand_AdjCmdLvl, AtCommand_Trade, AtCommand_UnMute, + AtCommand_CharWipe, // SQL-only commands start #ifndef TXT_ONLY diff --git a/src/map/clif.c b/src/map/clif.c index 6750845..418e56a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4189,7 +4189,7 @@ int clif_skillinfoblock(struct map_session_data *sd) for ( i = c = 0; i < MAX_SKILL; i++){ if( (id=sd->status.skill[i].id)!=0 && (sd->tmw_version >= 1 // [Fate] Version 1 and later don't crash because of bad skill IDs anymore - || (i < TMW_MAGIC || i > TMW_MAGIC_END))){ // [Fate] Hack: Prevent killing the client + || !QUEST_SKILL(i))){ // [Fate] Hack: Prevent killing the client WFIFOW(fd,len ) = id; WFIFOW(fd,len+2) = skill_get_inf(id); WFIFOW(fd,len+4) = 0; diff --git a/src/map/pc.c b/src/map/pc.c index ab75b2e..353f60c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4937,14 +4937,16 @@ int pc_resetstate(struct map_session_data* sd) // add += sumsp(sd->status.luk); // sd->status.status_point+=add; + sd->status.status_point -= 8 * 6; // [Fate] Remove points used for setting stats to 5 + clif_updatestatus(sd,SP_STATUSPOINT); - sd->status.str=1; - sd->status.agi=1; - sd->status.vit=1; - sd->status.int_=1; - sd->status.dex=1; - sd->status.luk=1; + sd->status.str=5; + sd->status.agi=5; + sd->status.vit=5; + sd->status.int_=5; + sd->status.dex=5; + sd->status.luk=5; clif_updatestatus(sd,SP_STR); clif_updatestatus(sd,SP_AGI); @@ -4978,7 +4980,7 @@ int pc_resetskill(struct map_session_data* sd) for(i=1;i<MAX_SKILL;i++){ if( (skill = pc_checkskill(sd,i)) > 0) { if(!(skill_get_inf2(i)&0x01) || battle_config.quest_skill_learn) { - if(!sd->status.skill[i].flag) + if(!sd->status.skill[i].flag && !QUEST_SKILL(i)) sd->status.skill_point += skill; else if(sd->status.skill[i].flag > 2 && sd->status.skill[i].flag != 13) { sd->status.skill_point += (sd->status.skill[i].flag - 2); diff --git a/src/map/skill.h b/src/map/skill.h index b3e3f59..03db31a 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -10,6 +10,9 @@ #define MAX_SKILL_ARROW_DB 150 #define MAX_SKILL_ABRA_DB 350 +#define QUEST_SKILL(i) ((i) >= TMW_MAGIC && (i) < TMW_MAGIC_END) +// [Fate] A `quest skill' is a skill handled via quests, i.e., one that can't be modified via skill points. + // スキルデータベース struct skill_db { int range[MAX_SKILL_LEVEL],hit,inf,pl,nk,max; |