mrlongshen Posted February 10, 2013 Posted February 10, 2013 Index: src/map/atcommand.c =================================================================== --- src/map/atcommand.c (revision 15160) +++ src/map/atcommand.c (working copy) @@ -8847,6 +8847,48 @@ return 0; } /*========================================== * Cydh * @afk2 * Turns on/off logout on player with aw message *------------------------------------------*/ int atcommand_afk2(const int fd, struct map_session_data* sd, const char* command, const char* message) { char temp_msg[CHAT_SIZE_MAX]; nullpo_retr(-1, sd); memset(temp_msg, '\0', sizeof(temp_msg)); if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) { if (!message || !*message || sscanf(message, "%255[^\n]", temp_msg) < 1) { clif_displaymessage(sd->fd, "Please, enter at least an option (usage: @afk2 <away message>)."); return -1; } else { sd->state.away = 1; sd->state.monster_ignore = 1; sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } sscanf(message, "%255[^\n]", sd->state.away_msg); clif_authfail_fd(fd, 15); pc_setsit(sd); skill_sit(sd,1); clif_sitting(&sd->bl,1); clif_changelook(&sd->bl,LOOK_HEAD_TOP,471); } } else clif_displaymessage(fd, "AFK is not allowed on this map."); return 0; } /*========================================== * atcommand_info[] structure definition @@ -9151,7 +9151,8 @@ { "charcommands", 1,1, atcommand_commands }, { "font", 1,1, atcommand_font }, { "afk2", 0,99, atcommand_afk2 }, }; /*========================================== * Command lookup functions Index: src/map/clif.c =================================================================== --- src/map/clif.c (revision 15160) +++ src/map/clif.c (working copy) @@ -9867,7 +9867,19 @@ clif_wis_end(fd, 2); // 2: ignored by target return; } + + // if player is @away. [Cydh] + if( dstsd->state.away == 1 ) + { + char output_away[256]; + + clif_wis_end(fd, 0); // 0: success to send wisper + sprintf(output_away, "(away) \"%s\"", dstsd->state.away_msg); + clif_wis_message(fd, dstsd->status.name, output_away, strlen(output_away) + 1); // send @away message to sender + clif_wis_message(dstsd->fd, sd->status.name, message, messagelen); // show meesage from sender + return; + } // if player is autotrading if( dstsd->state.autotrade == 1 ) { Index: src/map/pc.h =================================================================== --- src/map/pc.h (revision 15160) +++ src/map/pc.h (working copy) @@ -140,4 +140,7 @@ struct guild *gmaster_flag; unsigned int warping : 1;//states whether you're in the middle of a warp processing + + unsigned int away : 1; //@away auto message. [Cydh] + unsigned char away_msg[CHAT_SIZE_MAX]; //@away auto message. [Cydh] } state; struct { can someone edit this src modification from eathena to rathena ? I hope I can use it on rathena. Thanks Quote
Patotron Posted February 10, 2013 Posted February 10, 2013 (edited) Try this (Dont tested, so i dont know if it works). atcommand.c [i hope you know where you need to place this ] /*========================================== * Cydh [Edited by TxusToni to work on rAthena] * @afk2 * Turns on/off logout on player with aw message *------------------------------------------*/ ACMD_FUNC(afk2) { struct map_session_data* pl_sd; char temp_msg[CHAT_SIZE_MAX]; nullpo_retr(-1, sd); memset(temp_msg, '\0', sizeof(temp_msg)); if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) { if (!message || !*message || sscanf(message, "%255[^\n]", temp_msg) < 1) { clif_displaymessage(sd->fd, "Please, enter at least an option (usage: @afk2 <away message>)."); return -1; } else { sd->state.away = 1; sd->state.monster_ignore = 1; sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } sscanf(message, "%255[^\n]", sd->state.away_msg); clif_authfail_fd(fd, 15); pc_setsit(sd); skill_sit(sd,1); clif_sitting(&sd->bl,1); clif_changelook(&sd->bl,LOOK_HEAD_TOP,471); } } else clif_displaymessage(fd, "AFK is not allowed on this map."); return 0; } ACMD_DEF(afk2), clif.c [ Search this - clif_wis_end(fd, 2); // 2: ignored by target and put, down: // if player is @away. [Cydh] [Edited by TxusToni to work on rAthena] if( dstsd->state.away == 1 ) { char output_away[256]; clif_wis_end(fd, 0); // 0: success to send wisper sprintf(output_away, "(away) \"%s\"", dstsd->state.away_msg); clif_wis_message(fd, dstsd->status.name, output_away, strlen(output_away) + 1); // send @away message to sender clif_wis_message(dstsd->fd, sd->status.name, message, messagelen); // show meesage from sender return; } pc.h [ Search this : unsigned int warping : 1; and put down: ] unsigned int away : 1; //@away auto message. [Cydh] [Edited by TxusToni to work on rAthena] unsigned char away_msg[CHAT_SIZE_MAX]; //@away auto message. [Cydh] [Edited by TxusToni to work on rAthena] As i said, dont know if it will work, try it. Edited February 10, 2013 by TxusToni Quote
mrlongshen Posted February 10, 2013 Author Posted February 10, 2013 bro, can u give me the guide. because i dont where to put Quote
Patotron Posted February 10, 2013 Posted February 10, 2013 (edited) Seach this: [in atcommand.c] clif_displaymessage(fd, msg_txt(1188)); // Autoloot is now off. return 0; } and put the code down of that. /*========================================== * Cydh [Edited by TxusToni to work on rAthena] * @afk2 * Turns on/off logout on player with aw message *------------------------------------------*/ ACMD_FUNC(afk2) { struct map_session_data* pl_sd; char temp_msg[CHAT_SIZE_MAX]; nullpo_retr(-1, sd); memset(temp_msg, '\0', sizeof(temp_msg)); if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) { if (!message || !*message || sscanf(message, "%255[^\n]", temp_msg) < 1) { clif_displaymessage(sd->fd, "Please, enter at least an option (usage: @afk2 <away message>)."); return -1; } else { sd->state.away = 1; sd->state.monster_ignore = 1; sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } sscanf(message, "%255[^\n]", sd->state.away_msg); clif_authfail_fd(fd, 15); pc_setsit(sd); skill_sit(sd,1); clif_sitting(&sd->bl,1); clif_changelook(&sd->bl,LOOK_HEAD_TOP,471); } } else clif_displaymessage(fd, "AFK is not allowed on this map."); return 0; } Search this: ACMD_DEF(autoloot), and put the code down of that. ACMD_DEF(afk2), Search this: [in clif.c] clif_wis_end(fd, 2); // 2: ignored by target return; } And put the code down. // if player is @away. [Cydh] [Edited by TxusToni to work on rAthena] if( dstsd->state.away == 1 ) { char output_away[256]; clif_wis_end(fd, 0); // 0: success to send wisper sprintf(output_away, "(away) \"%s\"", dstsd->state.away_msg); clif_wis_message(fd, dstsd->status.name, output_away, strlen(output_away) + 1); // send @away message to sender clif_wis_message(dstsd->fd, sd->status.name, message, messagelen); // show meesage from sender return; } Search this: [in pc.h] unsigned int warping : 1; and put the code down. unsigned int away : 1; //@away auto message. [Cydh] [Edited by TxusToni to work on rAthena] unsigned char away_msg[CHAT_SIZE_MAX]; //@away auto message. [Cydh] [Edited by TxusToni to work on rAthena] As i said, dont know if it will work, try it. Edited February 10, 2013 by TxusToni Quote
Cydh Posted February 11, 2013 Posted February 11, 2013 Working for rAthena svn17128 at_afk2-rA17128.patch @afk2 (@afk + @away message + notice board hat style) 1 Quote
mrlongshen Posted February 13, 2013 Author Posted February 13, 2013 Working for rAthena svn17128 at_afk2-rA17128.patch @afk2 (@afk + @away message + notice board hat style) thx alot bro. now using it Quote
Question
mrlongshen
can someone edit this src modification from eathena to rathena ?
I hope I can use it on rathena. Thanks
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.