Capuche Posted May 3, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted May 3, 2013 About this command : *recovery;This command will revive and restore full HP and SP to all characters currentlyconnected to the server. I have never seen a script using this command, and it's not in any npc script in the svn. Btw a lot of script need to revive dead player and we often use atcommand script resulting an entry in atcommand log, or a trick with warp command. If we don't use it I suggest to customize it a little ? What do you think ? Maybe something like this ? recovery <target>,<string>;<target> : 0 - Character (optionnal) 1 - Map (Character on map) 2 - All Characters<string> : <target> : 0 => character's name (optionnal) <target> : 1 => map's name (player attached map's name by default) Tried for fun : (yeah my skill in c sux a little) BUILDIN_FUNC(recovery) { TBL_PC* sd = NULL; struct block_list *bl = NULL; struct s_mapiterator *iter = NULL; int map = 0, type = 0; const char *mapname; if( script_hasdata(st,2) ) { if( !script_isstring(st,2) ) type = script_getnum(st,2); else { ShowError("script:recovery: Invalid type. Expected int got string\n"); st->state = END; return 1; } } switch (type){ case 0: if( script_hasdata(st,3) ) sd = map_nick2sd(script_getstr(st,3)); else sd = script_rid2sd(st); if( sd == NULL ) { ShowError("player not attached : recovery type %d\n", type); return 1; } if( pc_isdead(sd) ) status_revive(&sd->bl, 100, 100); else status_percent_heal(&sd->bl, 100, 100); clif_displaymessage(sd->fd,msg_txt(sd,680)); break; case 1: if( script_hasdata(st,3) ) { mapname = script_getstr(st,3); if( (map = map_mapname2mapid(mapname)) < 0 ) return 0; } else { sd = script_rid2sd(st); if( sd == NULL ) return 0; map = sd->bl.m; } case 2: iter = mapit_getallusers(); for (sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) { if( map != sd->bl.m && type != 2 ) continue; if(pc_isdead(sd)) status_revive(&sd->bl, 100, 100); else status_percent_heal(&sd->bl, 100, 100); clif_displaymessage(sd->fd,msg_txt(sd,680)); } mapit_free(iter); break; default: ShowWarning("script: buildin_recovery: Invalid type %d\n", type); script_pushint(st,-1); return 1; } return 0; } BUILDIN_DEF(recovery,"??"), 2 Link to comment Share on other sites More sharing options...
PewN Posted May 4, 2013 Group: Members Topic Count: 209 Topics Per Day: 0.04 Content Count: 892 Reputation: 27 Joined: 12/09/11 Last Seen: April 16, 2016 Share Posted May 4, 2013 wow. very useful script commandThanks for this capuche Link to comment Share on other sites More sharing options...
Jaburak Posted May 4, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: 22 hours ago Share Posted May 4, 2013 Goodwork! Thanks! Link to comment Share on other sites More sharing options...
Capuche Posted May 4, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Author Share Posted May 4, 2013 Thanks! but it sound like a release while it was a suggestion.. Link to comment Share on other sites More sharing options...
Akinari Posted May 5, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 247 Reputation: 207 Joined: 10/23/12 Last Seen: March 2, 2022 Share Posted May 5, 2013 I've started working on this. I've made an outline on what else I'd like to add. /*========================================================================= * Fully Recover a Character's HP/SP * recovery <target>,<string>,<revive_flag>; [Capuche] * <target> : * 0 - Character * 1 - Character Party * 2 - Character Guild * 3 - Map (Character on map) * 4 - All Characters * <string> : * <target> : 0-2 => Character's name * <target> : 3 => Map's name (player attached map's name by default) * <revive_flag> : * : 0 => Don't revive dead players * : 1 => Revive dead players *-------------------------------------------------------------------------*/ 1 Link to comment Share on other sites More sharing options...
Capuche Posted May 5, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Author Share Posted May 5, 2013 Add party target and guild target is a good idea. But I would like something to restrict the command for players on some map for guild and party. About the revive flag, I suggest to leave the flag by default to revive + full heal * <revive_flag> : * : 0 => Both (default) * : 1 => Full heal only player alive * : 2 => Revive only dead players /*========================================================================= * Fully Recover a Character's HP/SP * recovery <target>,<character target>,<mapname>,<revive_flag>; [Capuche] * <target> : * 0 - Character * 1 - Character Party * 2 - Character Guild * 3 - Map (Character on map) * 4 - All Characters * <character target> : * <target> : 0-2 => Character's name * <target> : other => Empty * <mapname> : * <target> : 1-3 => Map's name (player attached map's name by default for target 3) * Can be empty for target 1-2 => all map * <revive_flag> : * : 0 => Both (default) * : 1 => Full heal only player alive * : 2 => Revive only dead players *-------------------------------------------------------------------------*/ It's a bit screw up like this... I wonder if your is better finally. But I would prefer a revive flag like mine. How do you feel about it ? Link to comment Share on other sites More sharing options...
Euphy Posted May 5, 2013 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted May 5, 2013 Looks good, Capuche. Can't think of anything else to add. Thanks for working on this, Akinari! 1 Link to comment Share on other sites More sharing options...
Capuche Posted May 5, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Author Share Posted May 5, 2013 There is the percent heal when heal/revive.. but I believe it would make too much arg Link to comment Share on other sites More sharing options...
Akinari Posted May 6, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 247 Reputation: 207 Joined: 10/23/12 Last Seen: March 2, 2022 Share Posted May 6, 2013 Added revive flag as per your suggestion. Looking into optional map string for guild and party now. Might have to move some stuff around. Edit: Going to make a bitwise flag for it. * <revive_flag> : (Add together flags to specify how you want to heal) * : 1 => Revive and Recover * : 2 => Only Full Heal * : 4 => Only Revive * : 8 => Party/Guild Map Only (must specify argument 5) *-------------------------------------------------------------------------*/ Here's the result in script_commands documentation. Let me know what you think. *recovery <type>{,<string>,<revive_flag>{,<map>}};Recovery can be used to recover all HP/SP to specific characters as well as revive. Party and Guild type uses a player name, not party or guild name.<type> is who you are targeting. Valid types are: - 0: Specific Character (<string> or target is invoker) - 1: Party (<string> or target party is invoker's) - 2: Guild (<string> or target party is invoker's) - 3: Map (<string> or invoker map) - 4: All<revive_flag> is used to determine what actions to take.This is a bitmask (like some config settings) and can be added together. - 1: Revive and Recover (Default) - 2: Only Full Heal - 4: Only Revive - 8: Party/Guild Map Only (must specify argument 4)<map> is used only when <revive_flag> has config 8 (party and guild <type> only).Note: If giving <revive_flag> of 8, a heal action is still required. [1,2,4]Examples: //Only revive characters in invoking party on map morocc recovery 1,strcharinfo(0),12,"morocc"; //Fully heal (don't revive) all members of invoking character's guild recovery 2,2; //Revive and fully heal everyone in map prontera recovery 3,"prontera"; //Only revive all dead characters on server recovery 4,4; Edit: Changing some more stuff around. I was informed this was too confusing. Going with ID's for arguments rather than names. 1 Link to comment Share on other sites More sharing options...
Euphy Posted May 6, 2013 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted May 6, 2013 The bitmask doesn't make sense. 1 = 2+4. :< (I prefer what you had before.) 1 Link to comment Share on other sites More sharing options...
Capuche Posted May 6, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Author Share Posted May 6, 2013 For the bitmask maybe - 1: Only Full Heal - 2: Only Revive - 4: Party/Guild Map Only (must specify argument 4) and by default revive_flag = 3 Going with ID's for arguments rather than names. Yeah maybe it's less confusing with char id, party id and guild id in argument 2 for type 0-2 ? Link to comment Share on other sites More sharing options...
Akinari Posted May 6, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 247 Reputation: 207 Joined: 10/23/12 Last Seen: March 2, 2022 Share Posted May 6, 2013 Implemented in r17321. Should be easier to understand in this format. 1 Link to comment Share on other sites More sharing options...
Recommended Posts