From 81ff879313b29ee97375d214b00f78b1f75d3d4a Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Sun, 21 Nov 2004 14:31:17 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@292 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 190 ++++++++++++++------------------------------------ src/map/atcommand.h | 5 +- src/map/charcommand.c | 139 ++++++++++++++++++++++++++++++++++-- src/map/charcommand.h | 4 +- 4 files changed, 190 insertions(+), 148 deletions(-) (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a4d89c293..9343b5bed 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -107,7 +107,6 @@ ATCOMMAND_FUNC(petrename); ATCOMMAND_FUNC(charpetrename); // by Yor ATCOMMAND_FUNC(recall); ATCOMMAND_FUNC(recallall); -ATCOMMAND_FUNC(character_job); ATCOMMAND_FUNC(revive); ATCOMMAND_FUNC(character_stats); ATCOMMAND_FUNC(character_stats_all); @@ -219,7 +218,8 @@ ATCOMMAND_FUNC(changesex); // by MC Cameri ATCOMMAND_FUNC(mute); // celest ATCOMMAND_FUNC(refresh); // by MC Cameri ATCOMMAND_FUNC(petid); // by MC Cameri -ATCOMMAND_FUNC(identify); +ATCOMMAND_FUNC(identify); // by MC Cameri +ATCOMMAND_FUNC(gmotd); // Added by MC Cameri, created by davidsiaw #ifndef TXT_ONLY ATCOMMAND_FUNC(checkmail); // [Valaris] @@ -299,8 +299,8 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Spawn, "@spawn", 50, atcommand_spawn }, // { AtCommand_Spawn, "@summon", 50, atcommand_spawn }, { AtCommand_Monster, "@monster2", 50, atcommand_monster }, - { AtCommand_MonsterSmall, "@monstersmall", 50, atcommand_monstersmall }, - { AtCommand_MonsterBig, "@monsterbig", 50, atcommand_monsterbig }, + { AtCommand_MonsterSmall, "@monstersmall", 50, atcommand_monstersmall }, + { AtCommand_MonsterBig, "@monsterbig", 50, atcommand_monsterbig }, { AtCommand_KillMonster, "@killmonster", 60, atcommand_killmonster }, { AtCommand_KillMonster2, "@killmonster2", 40, atcommand_killmonster2 }, { AtCommand_Refine, "@refine", 60, atcommand_refine }, @@ -324,10 +324,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_PetFriendly, "@petfriendly", 40, atcommand_petfriendly }, { AtCommand_PetHungry, "@pethungry", 40, atcommand_pethungry }, { AtCommand_PetRename, "@petrename", 1, atcommand_petrename }, - { AtCommand_CharPetRename, "@charpetrename", 50, atcommand_charpetrename }, // by Yor { AtCommand_Recall, "@recall", 60, atcommand_recall }, // + /recall - { AtCommand_CharacterJob, "@charjob", 60, atcommand_character_job }, - { AtCommand_CharacterJob, "@charjobchange", 60, atcommand_character_job }, { AtCommand_Revive, "@revive", 60, atcommand_revive }, { AtCommand_CharacterStats, "@charstats", 40, atcommand_character_stats }, { AtCommand_CharacterStatsAll, "@charstatsall", 40, atcommand_character_stats_all }, @@ -477,6 +474,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Refresh, "@refresh", 0, atcommand_refresh }, // by MC Cameri { AtCommand_PetId, "@petid", 40, atcommand_petid }, // by MC Cameri { AtCommand_Identify, "@identify", 40, atcommand_identify }, // by MC Cameri + { AtCommand_Gmotd, "@gmotd", 0, atcommand_gmotd }, // Added by MC Cameri, created by davidsiaw #ifndef TXT_ONLY // sql-only commands { AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris] @@ -2021,8 +2019,10 @@ int atcommand_alive( const int fd, struct map_session_data* sd, const char* command, const char* message) { + if (pc_isdead(sd)) { sd->status.hp = sd->status.max_hp; sd->status.sp = sd->status.max_sp; + clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); pc_setstand(sd); if (battle_config.pc_invincible_time > 0) pc_setinvincibletimer(sd, battle_config.pc_invincible_time); @@ -2030,8 +2030,10 @@ int atcommand_alive( clif_updatestatus(sd, SP_SP); clif_resurrection(&sd->bl, 1); clif_displaymessage(fd, msg_table[16]); // You've been revived! It's a miracle! - return 0; + } + return -1; + } /*========================================== @@ -3959,47 +3961,6 @@ int atcommand_petrename( return 0; } -/*========================================== - * - *------------------------------------------ - */ -int atcommand_charpetrename( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - char character[100]; - struct map_session_data *pl_sd; - - memset(character, '\0', sizeof(character)); - - if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @charpetrename )."); - return -1; - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pl_sd->status.pet_id > 0 && pl_sd->pd) { - if (pl_sd->pet.rename_flag != 0) { - pl_sd->pet.rename_flag = 0; - intif_save_petdata(pl_sd->status.account_id, &pl_sd->pet); - clif_send_petstatus(pl_sd); - clif_displaymessage(fd, msg_table[189]); // This player can now rename his/her pet. - } else { - clif_displaymessage(fd, msg_table[190]); // This player can already rename his/her pet. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - /*========================================== * *------------------------------------------ @@ -4051,87 +4012,6 @@ atcommand_recall( return 0; } -/*========================================== - * 対象キャラクターを転職させる upper指定で転生や養子も可能 - *------------------------------------------ - */ -int atcommand_character_job( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - char character[100]; - struct map_session_data* pl_sd; - int job = 0, upper = -1; - - memset(character, '\0', sizeof(character)); - - if (!message || !*message) { - clif_displaymessage(fd, "Please, enter a job and a player name (usage: @charjob/@charjobchange )."); - return -1; - } - - if (sscanf(message, "%d %d %99[^\n]", &job, &upper, character) < 3) { //upper指定してある - upper = -1; - if (sscanf(message, "%d %99[^\n]", &job, character) < 2) { //upper指定してない上に何か足りない - clif_displaymessage(fd, "Please, enter a job and a player name (usage: @charjob/@charjobchange )."); - return -1; - } - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change job only to lower or same level - if ((job >= 0 && job < MAX_PC_CLASS)) { - - // fix pecopeco display - if ((job != 13 && job != 21 && job != 4014 && job != 4022)) { - if (pc_isriding(sd)) { - if (pl_sd->status.class == 13) - pl_sd->status.class = pl_sd->view_class = 7; - if (pl_sd->status.class == 21) - pl_sd->status.class = pl_sd->view_class = 14; - if (pl_sd->status.class == 4014) - pl_sd->status.class = pl_sd->view_class = 4008; - if (pl_sd->status.class == 4022) - pl_sd->status.class = pl_sd->view_class = 4015; - pl_sd->status.option &= ~0x0020; - clif_changeoption(&pl_sd->bl); - pc_calcstatus(pl_sd, 0); - } - } else { - if (!pc_isriding(sd)) { - if (job == 13) - job = 7; - if (job == 21) - job = 14; - if (job == 4014) - job = 4008; - if (job == 4022) - job = 4015; - } - } - - if (pc_jobchange(pl_sd, job, upper) == 0) - clif_displaymessage(fd, msg_table[48]); // Character's job changed. - else { - clif_displaymessage(fd, msg_table[192]); // Impossible to change the character's job. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[49]); // Invalid job ID. - return -1; - } - } 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; -} - /*========================================== * *------------------------------------------ @@ -4151,14 +4031,19 @@ int atcommand_revive( } if ((pl_sd = map_nick2sd(character)) != NULL) { - pl_sd->status.hp = pl_sd->status.max_hp; - pc_setstand(pl_sd); - if (battle_config.pc_invincible_time > 0) - pc_setinvincibletimer(sd, battle_config.pc_invincible_time); - clif_updatestatus(pl_sd, SP_HP); - clif_updatestatus(pl_sd, SP_SP); - clif_resurrection(&pl_sd->bl, 1); - clif_displaymessage(fd, msg_table[51]); // Character revived. + if (pc_isdead(sd)) { + pl_sd->status.hp = pl_sd->status.max_hp; + clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); + pc_setstand(pl_sd); + if (battle_config.pc_invincible_time > 0) + pc_setinvincibletimer(sd, battle_config.pc_invincible_time); + clif_updatestatus(pl_sd, SP_HP); + clif_updatestatus(pl_sd, SP_SP); + clif_resurrection(&pl_sd->bl, 1); + clif_displaymessage(fd, msg_table[51]); // Character revived. + return 0; + } + return -1; } else { clif_displaymessage(fd, msg_table[3]); // Character not found. return -1; @@ -4726,6 +4611,7 @@ int atcommand_doommap( static void atcommand_raise_sub(struct map_session_data* sd) { if (sd && sd->state.auth && pc_isdead(sd)) { + clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); sd->status.hp = sd->status.max_hp; sd->status.sp = sd->status.max_sp; pc_setstand(sd); @@ -7995,6 +7881,34 @@ atcommand_identify( return 0; } +/*========================================== + * @gmotd (Global MOTD) + * by davidsiaw :P + *------------------------------------------ + */ +int +atcommand_gmotd( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char buf[256]; + FILE *fp; + if( (fp = fopen(motd_txt, "r"))!=NULL){ + while (fgets(buf, 250, fp) != NULL){ + int i; + for( i=0; buf[i]; i++){ + if( buf[i]=='\r' || buf[i]=='\n'){ + buf[i]=0; + break; + } + } + intif_GMmessage(buf,strlen(buf)+1,8); + } + fclose(fp); + } + return 0; +} + #ifndef TXT_ONLY /* Begin SQL-Only commands */ /*========================================== diff --git a/src/map/atcommand.h b/src/map/atcommand.h index cccdaa89a..77ecebf79 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -80,9 +80,7 @@ enum AtCommandType { AtCommand_PetRename, AtCommand_CharPetRename, // by Yor AtCommand_Recall, - AtCommand_CharacterJob, - AtCommand_CharacterJob2, - AtCommand_CharacterJob3, +// AtCommand_CharacterJob, // Now #jobchange AtCommand_Revive, AtCommand_CharacterStats, AtCommand_CharacterStatsAll, @@ -201,6 +199,7 @@ enum AtCommandType { AtCommand_Refresh, // by MC Cameri AtCommand_PetId, // by MC Cameri AtCommand_Identify, // by MC Cameri + AtCommand_Gmotd, // Added by MC Cameri, created by davidsiaw // SQL-only commands start #ifndef TXT_ONLY diff --git a/src/map/charcommand.c b/src/map/charcommand.c index af52aebfa..e26c339d2 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -33,13 +33,17 @@ static char command_symbol = '#'; static char msg_table[1000][1024]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) #define CHARCOMMAND_FUNC(x) int charcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) + +CHARCOMMAND_FUNC(jobchange); +CHARCOMMAND_FUNC(petrename); + #ifdef TXT_ONLY /* TXT_ONLY */ - CHARCOMMAND_FUNC(test); + /* TXT_ONLY */ #else /* SQL-only */ - //CHARCOMMAND_FUNC(funcname); + /* SQL Only */ #endif @@ -51,15 +55,17 @@ static char msg_table[1000][1024]; // Server messages (0-499 reserved for GM com // First char of commands is configured in charcommand_athena.conf. Leave @ in this list for default value. // to set default level, read charcommand_athena.conf first please. static CharCommandInfo charcommand_info[] = { - + { CharCommandJobChange, "#job", 60, charcommand_jobchange }, + { CharCommandJobChange, "#jobchange", 60, charcommand_jobchange }, + { CharCommandPetRename, "#petrename", 50, charcommand_petrename }, + #ifdef TXT_ONLY /* TXT_ONLY */ -// { CharCommandType, "#name", level, charcommand_func }, - { CharCommandTest, "#test", 0, charcommand_test }, + /* TXT_ONLY */ #else /* SQL-only */ -// { CharCommandType, "#name", level, charcommand_func }, + /* SQL Only */ #endif @@ -252,3 +258,124 @@ charcommand_test (const int fd, struct map_session_data* sd, return 0; } +/*========================================== + * 対象キャラクターを転職させる upper指定で転生や養子も可能 + *------------------------------------------ + */ +int charcommand_jobchange( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[100]; + struct map_session_data* pl_sd; + int job = 0, upper = -1; + + memset(character, '\0', sizeof(character)); + + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange )."); + return -1; + } + + if (sscanf(message, "%d %d %99[^\n]", &job, &upper, character) < 3) { //upper指定してある + upper = -1; + if (sscanf(message, "%d %99[^\n]", &job, character) < 2) { //upper指定してない上に何か足りない + clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange )."); + return -1; + } + } + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change job only to lower or same level + if ((job >= 0 && job < MAX_PC_CLASS)) { + + // fix pecopeco display + if ((job != 13 && job != 21 && job != 4014 && job != 4022)) { + if (pc_isriding(sd)) { + if (pl_sd->status.class == 13) + pl_sd->status.class = pl_sd->view_class = 7; + if (pl_sd->status.class == 21) + pl_sd->status.class = pl_sd->view_class = 14; + if (pl_sd->status.class == 4014) + pl_sd->status.class = pl_sd->view_class = 4008; + if (pl_sd->status.class == 4022) + pl_sd->status.class = pl_sd->view_class = 4015; + pl_sd->status.option &= ~0x0020; + clif_changeoption(&pl_sd->bl); + pc_calcstatus(pl_sd, 0); + } + } else { + if (!pc_isriding(sd)) { + if (job == 13) + job = 7; + if (job == 21) + job = 14; + if (job == 4014) + job = 4008; + if (job == 4022) + job = 4015; + } + } + + if (pc_jobchange(pl_sd, job, upper) == 0) + clif_displaymessage(fd, msg_table[48]); // Character's job changed. + else { + clif_displaymessage(fd, msg_table[192]); // Impossible to change the character's job. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[49]); // Invalid job ID. + return -1; + } + } 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; +} + +/*========================================== + * + *------------------------------------------ + */ +int charcommand_petrename( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[100]; + struct map_session_data *pl_sd; + + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #petrename )."); + return -1; + } + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pl_sd->status.pet_id > 0 && pl_sd->pd) { + if (pl_sd->pet.rename_flag != 0) { + pl_sd->pet.rename_flag = 0; + intif_save_petdata(pl_sd->status.account_id, &pl_sd->pet); + clif_send_petstatus(pl_sd); + clif_displaymessage(fd, msg_table[189]); // This player can now rename his/her pet. + } else { + clif_displaymessage(fd, msg_table[190]); // This player can already rename his/her pet. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet. + 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 95ca8aae6..ed191aa8f 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -3,10 +3,12 @@ enum CharCommandType { CharCommand_None = -1, + CharCommandJobChange, + CharCommandPetRename, #ifdef TXT_ONLY /* TXT_ONLY */ - CharCommandTest, + /* TXT_ONLY */ #else /* SQL-only */ -- cgit v1.2.3-60-g2f50