Jump to content
  • 0
Sign in to follow this  
Söel

@reloadscript

Question

Hi dears,
 

 

I have a modification of command @reloadscript that was performed by Shiraz, a member of brAthena community would like the help of you to be leaving the command compatible with Hercules.
 
Simple modification where you can choose to recharge only NPCs, or NPCs and mobs. Useful for those who do not want to relive MvPs after using the command.
 
@reloadscript: reloads scripts not mob ;@reloadscript mobscript: reloads all scripts;

 

Modification
Index: src/map/atcommand.c===================================================================--- src/map/atcommand.c	(revision 1514)+++ src/map/atcommand.c	(working copy)@@ -3702,6 +3702,7 @@  *------------------------------------------*/ ACMD_FUNC(reloadscript) {+	char arg[12]; 	nullpo_retr(-1, sd); 	//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." ); 	//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );@@ -3709,7 +3710,8 @@ 	flush_fifos(); 	map_reloadnpc(true); // reload config files seeking for npcs 	script_reload();-	npc_reload();+	snprintf(arg, sizeof(arg), "%s", message);+	npc_reload(arg);  	clif_displaymessage(fd, msg_txt(100)); // Scripts have been reloaded. Index: src/map/npc.c===================================================================--- src/map/npc.c	(revision 1514)+++ src/map/npc.c	(working copy)@@ -3635,7 +3635,7 @@ }  //Clear then reload npcs files-int npc_reload(void) {+int npc_reload(char arg[]) { 	struct npc_src_list *nsl; 	int m, i; 	int npc_new_min = npc_id;@@ -3662,13 +3662,14 @@ 				npc_unload((struct npc_data *)bl, false); 			break; 		case BL_MOB:-			unit_free(bl,CLR_OUTSIGHT);+			if(!strcmp(arg, "mobscript"))+				unit_free(bl,CLR_OUTSIGHT); 			break; 		} 	} 	mapit_free(iter); -	if(battle_config.dynamic_mobs)+	if(battle_config.dynamic_mobs && !strcmp(arg, "mobscript")) 	{// dynamic check by [random] 		for (m = 0; m < map_num; m++) { 			for (i = 0; i < MAX_MOB_LIST_PER_MAP; i++) {@@ -3695,7 +3696,9 @@  	//TODO: the following code is copy-pasted from do_init_npc(); clean it up 	// Reloading npcs now-	for (nsl = npc_src_files; nsl; nsl = nsl->next) {+	for (nsl = npc_src_files; nsl; nsl = nsl->next){+		if(strstr(nsl->name, "npc/monstros/") && strcmp(arg, "mobscript"))+			continue; 		ShowStatus("Carregando arquivo de NPC: %s"CL_CLL"r", nsl->name); 		npc_parsesrcfile(nsl->name,false); 	}@@ -3706,7 +3709,7 @@ 		"t-'"CL_WHITE"%d"CL_RESET"' Monstrosn" 		"t-'"CL_WHITE"%d"CL_RESET"' Monstros em cachen" 		"t-'"CL_WHITE"%d"CL_RESET"' Monstros fora de cachen",-		npc_id - npc_new_min, npc_warp, npc_shop, npc_script, npc_mob, npc_cache_mob, npc_delay_mob);+		npc_id - npc_new_min, npc_warp, npc_shop, npc_script, (!strcmp(arg, "mobscript")?npc_mob:0), (!strcmp(arg, "mobscript")?npc_cache_mob:0), npc_delay_mob);  	do_final_instance(); 	Index: src/map/npc.h===================================================================--- src/map/npc.h	(revision 1514)+++ src/map/npc.h	(working copy)@@ -154,7 +154,7 @@ int npc_remove_map(struct npc_data* nd); void npc_unload_duplicates (struct npc_data* nd); int npc_unload(struct npc_data* nd, bool single);-int npc_reload(void);+int npc_reload(char arg[]); void npc_read_event_script(void); int npc_script_event(struct map_session_data* sd, enum npce_event type); 

 
Edited by Söel

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

hercules files are kinda different than the one you posted and seems like that patch was made with brAthena and not Hercules, look how different is the reloadscript structure from Hercules:

 

 

 

 

ACMD(reloadscript) {struct s_mapiterator* iter;struct map_session_data* pl_sd;//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );iter = mapit_getallusers();for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {if (pl_sd->npc_id || pl_sd->npc_shopid) {if (pl_sd->state.using_fake_npc) {clif->clearunit_single(pl_sd->npc_id, CLR_OUTSIGHT, pl_sd->fd);pl_sd->state.using_fake_npc = 0;}if (pl_sd->state.menu_or_input)pl_sd->state.menu_or_input = 0;if (pl_sd->npc_menu)pl_sd->npc_menu = 0;pl_sd->npc_id = 0;pl_sd->npc_shopid = 0;if (pl_sd->st && pl_sd->st->state != END)pl_sd->st->state = END;}}mapit->free(iter);flush_fifos();map->reloadnpc(true); // reload config files seeking for npcsscript->reload();npc->reload();clif->message(fd, msg_fd(fd,100)); // Scripts have been reloaded.return true;} 

 

 

 

Share this post


Link to post
Share on other sites
  • 0

Precisely, so he posted requesting an aid to be adapting it for use in Hercules.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.