Jump to content

Expanded Reload Commands


masodikbela

Recommended Posts

  • 1 month later...
  • 3 weeks later...
  • 1 month later...
  • 8 months later...

I made a script to reload on locale_string
I thought it was too easy, but I didn't even test it much. If you want to test.

locale.cpp


In function

void locale_init(const char *filename)


Add before FILE * fp = fopen (filename, "rb");

localeString.clear();

 

The function will look like this

void locale_init(const char *filename)
{
	localeString.clear();

	FILE *fp = fopen(filename, "rb");
	char *buf;

	if (!fp)
		return;

	fseek(fp, 0L, SEEK_END);
	int i = ftell(fp);
	fseek(fp, 0L, SEEK_SET);
...




cmd_gm.cpp


In function

ACMD(do_reload)

 

Add below

		case 'c': // cube
			// ·ÎÄà ÇÁ·Î¼¼½º¸¸ °»»êÇÑ´Ù.
			Cube_init();
			break;

 

this

		case 'l':
			ch->ChatPacket(CHAT_TYPE_INFO, "Reloading locale_string.");
			LocaleService_LoadLocaleStringFile();
			break;


I believe it's just that, I tested it quickly and it worked, I'm not sure on other channels.

  • Love 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 1 month later...
  • Premium
1 minute ago, Jordan said:

Thank you!
Is that safe to use on a live server too or only recommended on a dev server?

Except /reload p (because it reloads the protos too) its safe to use on live server, if you don't have any new system or adjustment related to those stuff (so considering you use the basic files its safe).

  • Good 1

The one and only UI programming guideline

Link to comment
Share on other sites

On 12/29/2019 at 9:23 AM, Undead2014 said:

‎Eu tenho uma pergunta estúpida... como posso fazer para recarregar cube?.. Eu tenho ‎


            case 'c':
                ch->ChatPacket(CHAT_TYPE_INFO, "Reloading cube table.");
                Cube_init();
                break;

‎mas não está recarregando quando eu uso /recarregar c ‎

 

It approaches the NPC which has cube and the command

Link to comment
Share on other sites

  • 2 weeks later...

i have to say thank you man, i used it and it works fine and i do really advice you all to use

#define RELOAD_EX - In service.h from common

#ifdef RELOAD_EX

RELOAD EXPANDED CODE - 

#else

OLD CODE - 

#endif 

In case you did something wrong just go edit the RELOAD EXPANDED CODE - and if you wanna switch back to your old reload go nutz comment the #define RELOAD_EX

 

Link to comment
Share on other sites

  • 7 months later...
On 2/18/2020 at 6:34 AM, pask1994 said:

one problem, offline shop npc disappear (value npc 30000) after /reload regen ... please how i fix that?

Sorry to turn the topic back on, but maybe it will help someone.

 

Go go char_manager.cpp 

 

void CHARACTER_MANAGER::DestroyCharacterInMap(long lMapIndex)

Inside search these

if (pkChr && pkChr->GetMapIndex() == lMapIndex && pkChr->IsNPC() && !pkChr->IsPet() && pkChr->GetRider() == NULL)

change to

if (pkChr && pkChr->GetMapIndex() == lMapIndex && pkChr->IsNPC() && !pkChr->IsPet() && !pkChr->IsPrivShop() && pkChr->GetRider() == NULL)

thats all. and now the shops dont disappear after /reload_regen 

Link to comment
Share on other sites

  • 2 months later...
  • 8 months later...
  • 1 year later...
  • Premium

There was a correction today after many years past the release. There was a heap-use-after-free bug in the regen_free_map function, which means that the regen struct has been freed and after that in the increment part of for-loop accessed this deleted struct for the next regen in line. Normally while its not safe, it still doesn't cause any issues since the just-freed memory part is not overwritten yet, but in rare occasions it can happen. Also with debug mode or debuggers using shadow bytes to detect such cases would immediately notice it. This might have been the reason while my vs debugger got stuck back in the old days.

Thanks to @ Karbust for noticing this problem with address sanitizer.

Edited by masodikbela
  • Metin2 Dev 2
  • Love 1

The one and only UI programming guideline

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.