Atemo 2 years ago
parent
commit
b0456b0e73
2 changed files with 82 additions and 95 deletions
  1. 1 8
      doc/script_commands.txt
  2. 81 87
      src/map/script.cpp

+ 1 - 8
doc/script_commands.txt

@@ -4446,7 +4446,6 @@ you have maximum. Like 'heal', this will not call up any animations or effects.
 *recovery <type>{,<option>,<revive_flag>{,<map name>}};
 *recovery <type>{,<option>,<revive_flag>{,<map name>}};
 
 
 This command will revive and fully restore the HP/SP of the selected characters.
 This command will revive and fully restore the HP/SP of the selected characters.
-It returns 1 upon successful use.
 
 
 <type> is the target, and determines the <option> parameter:
 <type> is the target, and determines the <option> parameter:
  0: Player  -> Character ID number
  0: Player  -> Character ID number
@@ -6484,8 +6483,7 @@ the invoking character. Example can be found in the wedding script.
 
 
 This function will "un-marry" the invoking character from whoever they were
 This function will "un-marry" the invoking character from whoever they were
 married to. Both will no longer be each other's marriage partner, (at least in
 married to. Both will no longer be each other's marriage partner, (at least in
-current SVN, which prevents the cases of multi-spouse problems). It will return
-1 upon success or 0 if the character was not married at all.
+current SVN, which prevents the cases of multi-spouse problems).
 
 
 This function will also destroy both wedding rings and send a message to both
 This function will also destroy both wedding rings and send a message to both
 players, telling them they are now divorced.
 players, telling them they are now divorced.
@@ -7070,9 +7068,6 @@ the invoking NPC's actions, such as using an emotion or talking.
 Whichever of the both NPCs is talked to, both will show a random emotion at the
 Whichever of the both NPCs is talked to, both will show a random emotion at the
 same time.
 same time.
 
 
-As of r16564, command now returns 1 or 0 on success and failure.
-A debug message also shows on the console when no events are triggered.
-
 ---------------------------------------
 ---------------------------------------
 
 
 *cmdothernpc "<npc name>","<command>";
 *cmdothernpc "<npc name>","<command>";
@@ -7080,8 +7075,6 @@ A debug message also shows on the console when no events are triggered.
 This is simply "donpcevent <npc name>::OnCommand<command>".
 This is simply "donpcevent <npc name>::OnCommand<command>".
 It is an approximation of official server script language's 'cmdothernpc'.
 It is an approximation of official server script language's 'cmdothernpc'.
 
 
-Returns true if the command was executed on the other NPC successfully, false if not.
-
 ---------------------------------------
 ---------------------------------------
 
 
 *npctalk "<message>"{,"<NPC name>",<flag>{,<color>}};
 *npctalk "<message>"{,"<NPC name>",<flag>{,<color>}};

+ 81 - 87
src/map/script.cpp

@@ -657,7 +657,7 @@ static unsigned int calc_hash(const char* p)
 	return h % SCRIPT_HASH_SIZE;
 	return h % SCRIPT_HASH_SIZE;
 }
 }
 
 
-bool script_check_RegistryVariableLength(int pType, const char *val, size_t* vlen) 
+bool script_check_RegistryVariableLength(int pType, const char *val, size_t* vlen)
 {
 {
 	size_t len = strlen(val);
 	size_t len = strlen(val);
 
 
@@ -2968,7 +2968,7 @@ unsigned int script_array_highest_key(struct script_state *st, map_session_data
 			return sa->size ? highest_key + 1 : 0;
 			return sa->size ? highest_key + 1 : 0;
 		}
 		}
 	}
 	}
-	
+
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -3572,19 +3572,19 @@ void pop_stack(struct script_state* st, int start, int end)
 	}else if( st->start > start ){
 	}else if( st->start > start ){
 		st->start = start;
 		st->start = start;
 	}
 	}
-	
+
 	if( st->end > end ){
 	if( st->end > end ){
 		st->end -= end - start;
 		st->end -= end - start;
 	}else if( st->end > start ){
 	}else if( st->end > start ){
 		st->end = start;
 		st->end = start;
 	}
 	}
-	
+
 	if( stack->defsp > end ){
 	if( stack->defsp > end ){
 		stack->defsp -= end - start;
 		stack->defsp -= end - start;
 	}else if( stack->defsp > start ){
 	}else if( stack->defsp > start ){
 		stack->defsp = start;
 		stack->defsp = start;
 	}
 	}
-	
+
 	stack->sp -= end - start;
 	stack->sp -= end - start;
 }
 }
 
 
@@ -3642,7 +3642,7 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos,
 	st->oid = oid;
 	st->oid = oid;
 	st->sleep.timer = INVALID_TIMER;
 	st->sleep.timer = INVALID_TIMER;
 	st->npc_item_flag = battle_config.item_enabled_npc;
 	st->npc_item_flag = battle_config.item_enabled_npc;
-	
+
 	if( st->script->instances != USHRT_MAX )
 	if( st->script->instances != USHRT_MAX )
 		st->script->instances++;
 		st->script->instances++;
 	else {
 	else {
@@ -6344,7 +6344,7 @@ BUILDIN_FUNC(cleararray)
 			set_reg_num( st, sd, reference_uid( id, start ), name, value, script_getref( st,2 ) );
 			set_reg_num( st, sd, reference_uid( id, start ), name, value, script_getref( st,2 ) );
 		}
 		}
 	}
 	}
-	
+
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -6554,14 +6554,14 @@ BUILDIN_FUNC(deletearray)
 			list = script_array_cpy_list(sa);
 			list = script_array_cpy_list(sa);
 			size = sa->size;
 			size = sa->size;
 			qsort(list, size, sizeof(unsigned int), script_array_index_cmp);
 			qsort(list, size, sizeof(unsigned int), script_array_index_cmp);
-			
+
 			ARR_FIND(0, size, i, list[i] >= start);
 			ARR_FIND(0, size, i, list[i] >= start);
-			
+
 			for( ; i < size && list[i] < start + count; i++ ) {
 			for( ; i < size && list[i] < start + count; i++ ) {
 				// Clear any entries between start and start+count, if they exist
 				// Clear any entries between start and start+count, if they exist
 				clear_reg( st, sd, reference_uid( id, list[i] ), name, reference_getref( data ) );
 				clear_reg( st, sd, reference_uid( id, list[i] ), name, reference_getref( data ) );
 			}
 			}
-			
+
 			for( ; i < size && list[i] < end; i++ ) {
 			for( ; i < size && list[i] < end; i++ ) {
 				// Move back count positions any entries between start+count to fill the gaps
 				// Move back count positions any entries between start+count to fill the gaps
 				if( is_string ){
 				if( is_string ){
@@ -6582,7 +6582,7 @@ BUILDIN_FUNC(deletearray)
 		unsigned int *list = NULL, size = 0;
 		unsigned int *list = NULL, size = 0;
 		list = script_array_cpy_list(sa);
 		list = script_array_cpy_list(sa);
 		size = sa->size;
 		size = sa->size;
-		
+
 		for(i = 0; i < size; i++) {
 		for(i = 0; i < size; i++) {
 			if( list[i] >= start ) // Less expensive than sorting it, most likely
 			if( list[i] >= start ) // Less expensive than sorting it, most likely
 				clear_reg( st, sd, reference_uid( id, list[i] ), name, reference_getref( data ) );
 				clear_reg( st, sd, reference_uid( id, list[i] ), name, reference_getref( data ) );
@@ -6692,7 +6692,7 @@ BUILDIN_FUNC(inarray)
 			if( temp == value ){
 			if( temp == value ){
 				script_pushint( st, i );
 				script_pushint( st, i );
 				return SCRIPT_CMD_SUCCESS;
 				return SCRIPT_CMD_SUCCESS;
-			}	
+			}
 		}
 		}
 	}
 	}
 
 
@@ -7010,7 +7010,7 @@ static bool script_getitem_randomoption(struct script_state *st, map_session_dat
 	opt_id_idx = reference_getindex(opt_id);
 	opt_id_idx = reference_getindex(opt_id);
 	opt_val_idx = reference_getindex(opt_val);
 	opt_val_idx = reference_getindex(opt_val);
 	opt_param_idx = reference_getindex(opt_param);
 	opt_param_idx = reference_getindex(opt_param);
-	
+
 	for (i = 0; i < opt_id_n && i < MAX_ITEM_RDM_OPT; i++) {
 	for (i = 0; i < opt_id_n && i < MAX_ITEM_RDM_OPT; i++) {
 		it->option[i].id = (short)get_val2_num( st, reference_uid( opt_id_id, opt_id_idx + i ), opt_id_ref );
 		it->option[i].id = (short)get_val2_num( st, reference_uid( opt_id_id, opt_id_idx + i ), opt_id_ref );
 		it->option[i].value = (short)get_val2_num( st, reference_uid( opt_val_id, opt_val_idx + i ), opt_val_ref );
 		it->option[i].value = (short)get_val2_num( st, reference_uid( opt_val_id, opt_val_idx + i ), opt_val_ref );
@@ -7456,7 +7456,7 @@ BUILDIN_FUNC(checkweight2)
 	int nb_it, nb_nb; //array size
 	int nb_it, nb_nb; //array size
 
 
 	TBL_PC *sd;
 	TBL_PC *sd;
-	
+
 	if (!script_rid2sd(sd))
 	if (!script_rid2sd(sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -7683,7 +7683,7 @@ BUILDIN_FUNC(getitem2)
 		if (strcmpi(command,"getitem3") == 0) {
 		if (strcmpi(command,"getitem3") == 0) {
 			offset = 11;
 			offset = 11;
 			aid_pos = 14;
 			aid_pos = 14;
-		} 
+		}
 		if (strcmpi(command,"getitem4") == 0) {
 		if (strcmpi(command,"getitem4") == 0) {
 			grade_offset = 11;
 			grade_offset = 11;
 			offset = 12;
 			offset = 12;
@@ -7770,7 +7770,7 @@ BUILDIN_FUNC(getitem2)
 		}
 		}
 
 
 		int get_count = 0;
 		int get_count = 0;
-	
+
 		//Check if it's stackable.
 		//Check if it's stackable.
 		if( !itemdb_isstackable2( item_data.get() ) ){
 		if( !itemdb_isstackable2( item_data.get() ) ){
 			get_count = 1;
 			get_count = 1;
@@ -8148,7 +8148,7 @@ BUILDIN_FUNC(makeitem2) {
 	}
 	}
 	else
 	else
 		m = map_mapname2mapid(mapname);
 		m = map_mapname2mapid(mapname);
-	
+
 	struct item_data *id;
 	struct item_data *id;
 
 
 	if ((id = itemdb_search(nameid))) {
 	if ((id = itemdb_search(nameid))) {
@@ -8158,7 +8158,7 @@ BUILDIN_FUNC(makeitem2) {
 
 
 		char iden = (char)script_getnum(st,7);
 		char iden = (char)script_getnum(st,7);
 		char ref = (char)script_getnum(st,8);
 		char ref = (char)script_getnum(st,8);
-		char attr = (char)script_getnum(st,9);		
+		char attr = (char)script_getnum(st,9);
 
 
 		if (id->type==IT_WEAPON || id->type==IT_ARMOR || id->type==IT_SHADOWGEAR) {
 		if (id->type==IT_WEAPON || id->type==IT_ARMOR || id->type==IT_SHADOWGEAR) {
 			if(ref > MAX_REFINE)
 			if(ref > MAX_REFINE)
@@ -8615,7 +8615,7 @@ BUILDIN_FUNC(delitem2)
 			}
 			}
 			it.enchantgrade = static_cast<e_enchantgrade>(grade);
 			it.enchantgrade = static_cast<e_enchantgrade>(grade);
 		}
 		}
-		
+
 		bool res = script_getitem_randomoption(st, sd, &it, command, offset);
 		bool res = script_getitem_randomoption(st, sd, &it, command, offset);
 		if (!res)
 		if (!res)
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
@@ -8714,7 +8714,7 @@ BUILDIN_FUNC(readparam)
 	}else{
 	}else{
 		script_rid2sd(sd);
 		script_rid2sd(sd);
 	}
 	}
-	
+
 	if( !sd ){
 	if( !sd ){
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
@@ -8944,7 +8944,7 @@ BUILDIN_FUNC(getguildname)
 	guild_id = script_getnum(st,2);
 	guild_id = script_getnum(st,2);
 	if( ( g = guild_search(guild_id) ) != NULL )
 	if( ( g = guild_search(guild_id) ) != NULL )
 		script_pushstrcopy(st,g->name);
 		script_pushstrcopy(st,g->name);
-	else 
+	else
 		script_pushconststr(st,"null");
 		script_pushconststr(st,"null");
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -8961,7 +8961,7 @@ BUILDIN_FUNC(getguildmaster)
 	guild_id = script_getnum(st,2);
 	guild_id = script_getnum(st,2);
 	if( ( g = guild_search(guild_id) ) != NULL )
 	if( ( g = guild_search(guild_id) ) != NULL )
 		script_pushstrcopy(st,g->member[0].name);
 		script_pushstrcopy(st,g->member[0].name);
-	else 
+	else
 		script_pushconststr(st,"null");
 		script_pushconststr(st,"null");
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -10269,7 +10269,7 @@ BUILDIN_FUNC(end)
 	if (sd){
 	if (sd){
 		if (sd->state.callshop == 0)
 		if (sd->state.callshop == 0)
 			clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
 			clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
-		else 
+		else
 			sd->state.callshop = 0;
 			sd->state.callshop = 0;
 	}
 	}
 
 
@@ -10777,13 +10777,13 @@ BUILDIN_FUNC(guild_has_permission){
 	}
 	}
 
 
 	int position = guild_getposition(sd);
 	int position = guild_getposition(sd);
-	
+
 	if( position < 0 || ( sd->guild->position[position].mode&permission ) != permission ){
 	if( position < 0 || ( sd->guild->position[position].mode&permission ) != permission ){
 		script_pushint( st, false );
 		script_pushint( st, false );
 
 
 		return SCRIPT_CMD_SUCCESS;
 		return SCRIPT_CMD_SUCCESS;
 	}
 	}
-	
+
 	script_pushint( st, true );
 	script_pushint( st, true );
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -10910,7 +10910,7 @@ BUILDIN_FUNC(getexp){
 		ShowError( "buildin_getexp: Called with negative base exp.\n" );
 		ShowError( "buildin_getexp: Called with negative base exp.\n" );
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
-	
+
 	int64 job = script_getnum64( st, 3 );
 	int64 job = script_getnum64( st, 3 );
 
 
 	if( job < 0 ){
 	if( job < 0 ){
@@ -11365,9 +11365,8 @@ BUILDIN_FUNC(donpcevent)
 	if( !npc_event_do(event) ) {
 	if( !npc_event_do(event) ) {
 		struct npc_data * nd = map_id2nd(st->oid);
 		struct npc_data * nd = map_id2nd(st->oid);
 		ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
 		ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
-		script_pushint(st, 0);
-	} else
-		script_pushint(st, 1);
+		return SCRIPT_CMD_FAILURE;
+	}
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -11382,12 +11381,10 @@ BUILDIN_FUNC(cmdothernpc)	// Added by RoVeRT
 	safesnprintf(event,EVENT_NAME_LENGTH, "%s::%s%s",npc,script_config.oncommand_event_name,command);
 	safesnprintf(event,EVENT_NAME_LENGTH, "%s::%s%s",npc,script_config.oncommand_event_name,command);
 	check_event(st, event);
 	check_event(st, event);
 
 
-	if( npc_event_do(event) ){
-		script_pushint(st, true);
-	}else{
+	if( !npc_event_do(event) )
 		struct npc_data * nd = map_id2nd(st->oid);
 		struct npc_data * nd = map_id2nd(st->oid);
 		ShowDebug("NPCEvent '%s' not found! (source: %s)\n", event, nd ? nd->name : "Unknown");
 		ShowDebug("NPCEvent '%s' not found! (source: %s)\n", event, nd ? nd->name : "Unknown");
-		script_pushint(st, false);
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -11719,7 +11716,7 @@ BUILDIN_FUNC(announce)
 			else
 			else
 				bl = nullptr;
 				bl = nullptr;
 		}
 		}
-		
+
 		if (bl == nullptr)
 		if (bl == nullptr)
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 
 
@@ -12840,7 +12837,7 @@ BUILDIN_FUNC(waitingroomkick)
 	struct npc_data* nd;
 	struct npc_data* nd;
 	struct chat_data* cd;
 	struct chat_data* cd;
 	const char* kickusername;
 	const char* kickusername;
-	
+
 	nd = npc_name2id(script_getstr(st,2));
 	nd = npc_name2id(script_getstr(st,2));
 	kickusername = script_getstr(st,3);
 	kickusername = script_getstr(st,3);
 
 
@@ -12864,7 +12861,7 @@ BUILDIN_FUNC(getwaitingroomusers)
 		nd = npc_name2id(script_getstr(st, 2));
 		nd = npc_name2id(script_getstr(st, 2));
 	else
 	else
 		nd = (struct npc_data *)map_id2bl(st->oid);
 		nd = (struct npc_data *)map_id2bl(st->oid);
-	
+
 	if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) {
 	if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) {
 		for(i = 0; i < cd->users; ++i) {
 		for(i = 0; i < cd->users; ++i) {
 			setd_sub_num( st, NULL, ".@waitingroom_users", j, cd->usersd[i]->status.account_id, NULL );
 			setd_sub_num( st, NULL, ".@waitingroom_users", j, cd->usersd[i]->status.account_id, NULL );
@@ -13514,7 +13511,7 @@ BUILDIN_FUNC(emotion)
 
 
 	if (!bl)
 	if (!bl)
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	
+
 	clif_emotion(bl, type);
 	clif_emotion(bl, type);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -13879,7 +13876,7 @@ BUILDIN_FUNC(successremovecards) {
 
 
 		for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
 		for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
 			item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
 			item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
-		
+
 		for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
 		for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
 			item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
 			item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
 			item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
 			item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
@@ -13965,7 +13962,7 @@ BUILDIN_FUNC(failedremovecards) {
 
 
 			for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
 			for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
 				item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
 				item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
-			
+
 			for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
 			for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
 				item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
 				item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
 				item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
 				item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
@@ -14119,10 +14116,9 @@ BUILDIN_FUNC(divorce)
 	if (!script_charid2sd(2, sd))
 	if (!script_charid2sd(2, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
-	if (!pc_divorce(sd)) {
+	if (!pc_divorce(sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	}
-	script_pushint(st,1);
+
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -14136,11 +14132,10 @@ BUILDIN_FUNC(ispartneron)
 	if (!script_charid2sd(2, sd))
 	if (!script_charid2sd(2, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
-	if (!pc_ismarried(sd) || map_charid2sd(sd->status.partner_id) == NULL) {
-		return SCRIPT_CMD_FAILURE;
-	}
-
-	script_pushint(st,1);
+	if (!pc_ismarried(sd) || map_charid2sd(sd->status.partner_id) == NULL)
+		script_pushint(st,0);
+	else
+		script_pushint(st,1);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -15219,10 +15214,10 @@ BUILDIN_FUNC(skilleffect)
 {
 {
 	TBL_PC *sd;
 	TBL_PC *sd;
 	uint16 skill_id, skill_lv;
 	uint16 skill_id, skill_lv;
-	
+
 	if (!script_rid2sd(sd))
 	if (!script_rid2sd(sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	
+
 	skill_id = ( script_isstring(st, 2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	skill_id = ( script_isstring(st, 2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	skill_lv = script_getnum(st,3);
 	skill_lv = script_getnum(st,3);
 
 
@@ -15466,7 +15461,7 @@ BUILDIN_FUNC(atcommand) {
 
 
 /** Displays a message for the player only (like system messages like "you got an apple" )
 /** Displays a message for the player only (like system messages like "you got an apple" )
 * dispbottom("<message>"{,<color>{,<char_id>}})
 * dispbottom("<message>"{,<color>{,<char_id>}})
-* @param message 
+* @param message
 * @param color Hex color default (Green)
 * @param color Hex color default (Green)
 */
 */
 BUILDIN_FUNC(dispbottom)
 BUILDIN_FUNC(dispbottom)
@@ -15622,7 +15617,6 @@ BUILDIN_FUNC(recovery)
 			ShowWarning("script: buildin_recovery: Invalid type %d\n", type);
 			ShowWarning("script: buildin_recovery: Invalid type %d\n", type);
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 	}
 	}
-	script_pushint(st,1); //Successfully executed without errors
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -16905,7 +16899,7 @@ BUILDIN_FUNC(implode)
 		script_reportdata(data);
 		script_reportdata(data);
 		return SCRIPT_CMD_FAILURE;// data type mismatch
 		return SCRIPT_CMD_FAILURE;// data type mismatch
 	}
 	}
-	
+
 	map_session_data* sd = nullptr;
 	map_session_data* sd = nullptr;
 
 
 	if( not_server_variable(*name) && !script_rid2sd(sd) ) {
 	if( not_server_variable(*name) && !script_rid2sd(sd) ) {
@@ -18166,12 +18160,12 @@ BUILDIN_FUNC(getrandmobid)
 	int lv;
 	int lv;
 	if ( script_hasdata(st, 4) ) {
 	if ( script_hasdata(st, 4) ) {
 		lv = script_getnum(st, 4);
 		lv = script_getnum(st, 4);
-		
+
 		if (lv <= 0) {
 		if (lv <= 0) {
 			ShowWarning("buildin_getrandmobid: Invalid level %d.\n", lv);
 			ShowWarning("buildin_getrandmobid: Invalid level %d.\n", lv);
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
-		
+
 		// If a level is provided, make sure it is respected
 		// If a level is provided, make sure it is respected
 		flag |= RMF_CHECK_MOB_LV;
 		flag |= RMF_CHECK_MOB_LV;
 	} else {
 	} else {
@@ -19514,7 +19508,7 @@ BUILDIN_FUNC(unitwalk)
 	struct unit_data *ud = NULL;
 	struct unit_data *ud = NULL;
 	const char *cmd = script_getfuncname(st), *done_label = "";
 	const char *cmd = script_getfuncname(st), *done_label = "";
 	uint8 off = 5;
 	uint8 off = 5;
-	
+
 	if (!script_rid2bl(2, bl))
 	if (!script_rid2bl(2, bl))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -19884,7 +19878,7 @@ BUILDIN_FUNC(sleep)
 		st->state = RERUNLINE;
 		st->state = RERUNLINE;
 		st->sleep.tick = ticks;
 		st->sleep.tick = ticks;
 	// Second call(by timer after sleeping time is over)
 	// Second call(by timer after sleeping time is over)
-	} else {		
+	} else {
 		// Continue the script
 		// Continue the script
 		st->state = RUN;
 		st->state = RUN;
 		st->sleep.tick = 0;
 		st->sleep.tick = 0;
@@ -19914,12 +19908,12 @@ BUILDIN_FUNC(sleep2)
 			ShowError( "buildin_sleep2: no unit is attached\n" );
 			ShowError( "buildin_sleep2: no unit is attached\n" );
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
-		
+
 		// sleep for the target amount of time
 		// sleep for the target amount of time
 		st->state = RERUNLINE;
 		st->state = RERUNLINE;
 		st->sleep.tick = ticks;
 		st->sleep.tick = ticks;
 	// Second call(by timer after sleeping time is over)
 	// Second call(by timer after sleeping time is over)
-	} else {		
+	} else {
 		// Check if the unit is still attached
 		// Check if the unit is still attached
 		// NOTE: This should never happen, since run_script_timer already checks this
 		// NOTE: This should never happen, since run_script_timer already checks this
 		if (map_id2bl(st->rid) == NULL) {
 		if (map_id2bl(st->rid) == NULL) {
@@ -20268,7 +20262,7 @@ BUILDIN_FUNC(mercenary_delete)
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
 	}
 	}
-	
+
 	mercenary_delete(sd->md, type);
 	mercenary_delete(sd->md, type);
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -20556,7 +20550,7 @@ BUILDIN_FUNC(questinfo_refresh)
 	if (!script_charid2sd(2, sd))
 	if (!script_charid2sd(2, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
-	pc_show_questinfo(sd); 
+	pc_show_questinfo(sd);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -20579,7 +20573,7 @@ BUILDIN_FUNC(setquest)
 	}
 	}
 
 
 	//20120410 or 20090218 ? no reason that shouldn't work for 2009
 	//20120410 or 20090218 ? no reason that shouldn't work for 2009
-	pc_show_questinfo(sd); 
+	pc_show_questinfo(sd);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -20597,7 +20591,7 @@ BUILDIN_FUNC(erasequest)
 		script_reportsrc(st);
 		script_reportsrc(st);
 		script_reportfunc(st);
 		script_reportfunc(st);
 	}
 	}
-	pc_show_questinfo(sd); 
+	pc_show_questinfo(sd);
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -20624,7 +20618,7 @@ BUILDIN_FUNC(completequest)
 BUILDIN_FUNC(changequest)
 BUILDIN_FUNC(changequest)
 {
 {
 	map_session_data *sd;
 	map_session_data *sd;
-	
+
 	if (!script_charid2sd(4, sd))
 	if (!script_charid2sd(4, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -20859,7 +20853,7 @@ BUILDIN_FUNC(bg_create) {
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
-/// Adds attached player or <char id> (if specified) to an existing 
+/// Adds attached player or <char id> (if specified) to an existing
 /// battleground group and warps it to the specified coordinates on
 /// battleground group and warps it to the specified coordinates on
 /// the given map.
 /// the given map.
 /// bg_join(<battle group>,{"<map name>",<x>,<y>{,<char id>}});
 /// bg_join(<battle group>,{"<map name>",<x>,<y>{,<char id>}});
@@ -21737,7 +21731,7 @@ BUILDIN_FUNC(instance_info)
 				ShowError( "buildin_instance_info: Type IIT_MAP requires a numeric index argument.\n" );
 				ShowError( "buildin_instance_info: Type IIT_MAP requires a numeric index argument.\n" );
 				return SCRIPT_CMD_FAILURE;
 				return SCRIPT_CMD_FAILURE;
 			}
 			}
-			
+
 			index = script_getnum(st, 4);
 			index = script_getnum(st, 4);
 
 
 			if( index < 0 ){
 			if( index < 0 ){
@@ -22207,7 +22201,7 @@ BUILDIN_FUNC(showdigit)
  **/
  **/
 BUILDIN_FUNC(makerune) {
 BUILDIN_FUNC(makerune) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	
+
 	if (!script_charid2sd(3, sd))
 	if (!script_charid2sd(3, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -22220,7 +22214,7 @@ BUILDIN_FUNC(makerune) {
  **/
  **/
 BUILDIN_FUNC(checkdragon) {
 BUILDIN_FUNC(checkdragon) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	
+
 	if (!script_charid2sd(2, sd))
 	if (!script_charid2sd(2, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -22276,7 +22270,7 @@ BUILDIN_FUNC(setdragon) {
  **/
  **/
 BUILDIN_FUNC(ismounting) {
 BUILDIN_FUNC(ismounting) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	
+
 	if (!script_charid2sd(2, sd))
 	if (!script_charid2sd(2, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -22295,7 +22289,7 @@ BUILDIN_FUNC(ismounting) {
  **/
  **/
 BUILDIN_FUNC(setmounting) {
 BUILDIN_FUNC(setmounting) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	
+
 	if (!script_charid2sd(2, sd))
 	if (!script_charid2sd(2, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
@@ -22637,10 +22631,10 @@ BUILDIN_FUNC(getrandgroupitem) {
 BUILDIN_FUNC(getgroupitem) {
 BUILDIN_FUNC(getgroupitem) {
 	TBL_PC *sd;
 	TBL_PC *sd;
 	int group_id = script_getnum(st,2);
 	int group_id = script_getnum(st,2);
-	
+
 	if (!script_charid2sd(4, sd))
 	if (!script_charid2sd(4, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	
+
 	if (itemdb_group.pc_get_itemgroup(group_id, (script_hasdata(st, 3) ? script_getnum(st, 3) != 0 : false), sd)) {
 	if (itemdb_group.pc_get_itemgroup(group_id, (script_hasdata(st, 3) ? script_getnum(st, 3) != 0 : false), sd)) {
 		ShowError("buildin_getgroupitem: Invalid group id '%d' specified.\n",group_id);
 		ShowError("buildin_getgroupitem: Invalid group id '%d' specified.\n",group_id);
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
@@ -22700,7 +22694,7 @@ BUILDIN_FUNC(npcskill)
 
 
 	if (!script_rid2sd(sd))
 	if (!script_rid2sd(sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	
+
 	if (script_isstring(st, 2)) {
 	if (script_isstring(st, 2)) {
 		const char *name = script_getstr(st, 2);
 		const char *name = script_getstr(st, 2);
 
 
@@ -23122,7 +23116,7 @@ BUILDIN_FUNC(vip_time) {
 	if (!script_nick2sd(3, sd))
 	if (!script_nick2sd(3, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
-	chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0); 
+	chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0);
 #endif
 #endif
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -23238,7 +23232,7 @@ BUILDIN_FUNC(bonus_script) {
 
 
 	if (!script_charid2sd(7, sd))
 	if (!script_charid2sd(7, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	
+
 	script_str = script_getstr(st,2);
 	script_str = script_getstr(st,2);
 	dur = 1000 * abs(script_getnum(st,3));
 	dur = 1000 * abs(script_getnum(st,3));
 	FETCH(4, flag);
 	FETCH(4, flag);
@@ -23429,7 +23423,7 @@ BUILDIN_FUNC(addspiritball) {
 BUILDIN_FUNC(delspiritball) {
 BUILDIN_FUNC(delspiritball) {
 	uint8 count;
 	uint8 count;
 	map_session_data *sd = NULL;
 	map_session_data *sd = NULL;
-	
+
 	if (script_hasdata(st,3)) {
 	if (script_hasdata(st,3)) {
 		if (!script_isstring(st,3))
 		if (!script_isstring(st,3))
 			sd = map_charid2sd(script_getnum(st,3));
 			sd = map_charid2sd(script_getnum(st,3));
@@ -23591,7 +23585,7 @@ BUILDIN_FUNC(npcshopupdate) {
 	if( !nd || ( nd->subtype != NPCTYPE_SHOP && nd->subtype != NPCTYPE_CASHSHOP && nd->subtype != NPCTYPE_ITEMSHOP && nd->subtype != NPCTYPE_POINTSHOP && nd->subtype != NPCTYPE_MARKETSHOP ) ) { // Not found.
 	if( !nd || ( nd->subtype != NPCTYPE_SHOP && nd->subtype != NPCTYPE_CASHSHOP && nd->subtype != NPCTYPE_ITEMSHOP && nd->subtype != NPCTYPE_POINTSHOP && nd->subtype != NPCTYPE_MARKETSHOP ) ) { // Not found.
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
-	
+
 	if (!nd->u.shop.count) {
 	if (!nd->u.shop.count) {
 		ShowError("buildin_npcshopupdate: Attempt to update empty shop from '%s'.\n", nd->exname);
 		ShowError("buildin_npcshopupdate: Attempt to update empty shop from '%s'.\n", nd->exname);
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
@@ -23924,10 +23918,10 @@ BUILDIN_FUNC(minmax){
 	int64 value;
 	int64 value;
 	// Function pointer for our comparison function (either min or max at the moment)
 	// Function pointer for our comparison function (either min or max at the moment)
 	int64 (*func)(int64, int64);
 	int64 (*func)(int64, int64);
-	
+
 	// Get the real function name
 	// Get the real function name
 	functionname = script_getfuncname(st);
 	functionname = script_getfuncname(st);
-	
+
 	// Our data should start at offset 2
 	// Our data should start at offset 2
 	i = 2;
 	i = 2;
 
 
@@ -23950,7 +23944,7 @@ BUILDIN_FUNC(minmax){
 	// As long as we have data on our script stack
 	// As long as we have data on our script stack
 	while( script_hasdata(st,i) ){
 	while( script_hasdata(st,i) ){
 		struct script_data *data;
 		struct script_data *data;
-		
+
 		// Get the next piece of data from the script stack
 		// Get the next piece of data from the script stack
 		data = script_getdata( st, i );
 		data = script_getdata( st, i );
 
 
@@ -23995,7 +23989,7 @@ BUILDIN_FUNC(minmax){
 			// Skip empty arrays
 			// Skip empty arrays
 			if( start < end ){
 			if( start < end ){
 				int id;
 				int id;
-				
+
 				// For getting the values we need the id of the array
 				// For getting the values we need the id of the array
 				id = reference_getid( data );
 				id = reference_getid( data );
 
 
@@ -24841,7 +24835,7 @@ BUILDIN_FUNC(channel_kick) {
 		case CHAN_TYPE_MAP: res = channel_pcquit(tsd,4); break;
 		case CHAN_TYPE_MAP: res = channel_pcquit(tsd,4); break;
 		default: res = channel_clean(ch,tsd,0); break;
 		default: res = channel_clean(ch,tsd,0); break;
 	}
 	}
-	
+
 	if (res == 0) {
 	if (res == 0) {
 		char output[CHAT_SIZE_MAX+1];
 		char output[CHAT_SIZE_MAX+1];
 		safesnprintf(output, CHAT_SIZE_MAX, msg_txt(tsd,889), ch->alias, tsd->status.name); // "%s %s is kicked"
 		safesnprintf(output, CHAT_SIZE_MAX, msg_txt(tsd,889), ch->alias, tsd->status.name); // "%s %s is kicked"
@@ -25124,7 +25118,7 @@ BUILDIN_FUNC(achievementcomplete) {
 		ShowWarning("buildin_achievementcomplete: Achievement '%d' doesn't exist.\n", achievement_id);
 		ShowWarning("buildin_achievementcomplete: Achievement '%d' doesn't exist.\n", achievement_id);
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
-	
+
 	if( !sd->state.pc_loaded ){
 	if( !sd->state.pc_loaded ){
 		// Simply ignore it on the first call, because the status will be recalculated after loading anyway
 		// Simply ignore it on the first call, because the status will be recalculated after loading anyway
 		return SCRIPT_CMD_SUCCESS;
 		return SCRIPT_CMD_SUCCESS;
@@ -25563,7 +25557,7 @@ BUILDIN_FUNC(mail){
 				}
 				}
 			}
 			}
 		}
 		}
-	
+
 		// Random Options
 		// Random Options
 		if( !script_hasdata(st,11 + MAX_SLOTS) ){
 		if( !script_hasdata(st,11 + MAX_SLOTS) ){
 			break;
 			break;
@@ -25990,7 +25984,7 @@ BUILDIN_FUNC(naviregisterwarp) {
 	link.hidden = nd->navi.hidden;
 	link.hidden = nd->navi.hidden;
 
 
 	nd->links.push_back(link);
 	nd->links.push_back(link);
-	
+
 #endif
 #endif
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -26511,7 +26505,7 @@ BUILDIN_FUNC(itemlink)
 	struct item item = {};
 	struct item item = {};
 
 
 	item.nameid = script_getnum(st, 2);
 	item.nameid = script_getnum(st, 2);
-	
+
 	if( !item_db.exists( item.nameid ) ){
 	if( !item_db.exists( item.nameid ) ){
 		ShowError( "buildin_itemlink: Item ID %u does not exists.\n", item.nameid );
 		ShowError( "buildin_itemlink: Item ID %u does not exists.\n", item.nameid );
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
@@ -26538,7 +26532,7 @@ BUILDIN_FUNC(itemlink)
 BUILDIN_FUNC(mesitemlink){
 BUILDIN_FUNC(mesitemlink){
 	t_itemid nameid = script_getnum( st, 2 );
 	t_itemid nameid = script_getnum( st, 2 );
 	std::shared_ptr<item_data> data = item_db.find( nameid );
 	std::shared_ptr<item_data> data = item_db.find( nameid );
-	
+
 	if( data == nullptr ){
 	if( data == nullptr ){
 		ShowError( "buildin_mesitemlink: Item ID %u does not exists.\n", nameid );
 		ShowError( "buildin_mesitemlink: Item ID %u does not exists.\n", nameid );
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
@@ -26573,7 +26567,7 @@ BUILDIN_FUNC(addfame) {
 
 
 	if (!pc_addfame(*sd, script_getnum(st, 2)))
 	if (!pc_addfame(*sd, script_getnum(st, 2)))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
-	
+
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }