You're right about the command always checking for player first, but a check for the second argument in the command is no good as the second argument can also contain a party ID, guild ID, or map name. I think (untested) the real fix would look like this.
Index: src/map/script.c
===================================================================
--- src/map/script.c (revision 17485)
+++ src/map/script.c (working copy)
@@ -12883,10 +12883,8 @@
*-------------------------------------------------------------------------*/
BUILDIN_FUNC(recovery)
{
- TBL_PC *sd = script_rid2sd(st);
-
+ TBL_PC *sd;
int map = 0, type = 0, revive = 1;
-
type = script_getnum(st,2);
if(script_hasdata(st,4))
@@ -12896,6 +12894,8 @@
case 0:
if(script_hasdata(st,3))
sd=map_charid2sd(script_getnum(st,3));
+ else
+ sd = script_rid2sd(st);
if(sd == NULL) //If we don't have sd by now, bail out
return 0;
recovery_sub(sd, revive);
@@ -12915,8 +12915,10 @@
}
if(script_hasdata(st,3))
p_id = script_getnum(st,3);
- else
+ else {
+ sd = script_rid2sd(st);
p_id = (sd)?sd->status.party_id:0;
+ }
p = party_search(p_id);
if(p == NULL)
return 0;
@@ -12943,8 +12945,10 @@
}
if(script_hasdata(st,3))
g_id = script_getnum(st,3);
- else
+ else {
+ sd = script_rid2sd(st);
g_id = (sd)?sd->status.guild_id:0;
+ }
g = guild_search(g_id);
if(g == NULL)
return 0;
@@ -12959,8 +12963,10 @@
case 3:
if(script_hasdata(st,3))
map = map_mapname2mapid(script_getstr(st,3));
- else
+ else {
+ sd = script_rid2sd(st);
map = (sd)?sd->bl.m:0; //No sd and no map given - return
+ }
if(map < 1)
return 1;
case 4:
Also, something like this should have been posted in bug reports.