Jump to content
×
×
  • Create New...

Change Race with Wolfman


Recommended Posts

Hi devs, today I'll show you my change race from C++, with / without wolfman.

 

1) First, change race with WOLFMAN!

 

1. Go to cmd.cpp search

ACMD(do_vote_block_chat);

and after it add:

// Change race
ACMD(do_change_race);
// Change race end

2. Also in cmd.cpp search

// END_OF_BLOCK_CHAT

and after it add:

	// Change race
	{ "change_race",	do_change_race,	0,	POS_DEAD,	GM_IMPLEMENTOR	},
	// Change race end

3. Now, in cmd_gm.cpp you'll need to go at the end of the file and put this code:

ACMD(do_change_race)
{
	char arg1[256], arg2[256];
	two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
	// init
	bool bIsSetSkillGroup = false;
	DWORD dwRace = MAIN_RACE_MAX_NUM;
	DWORD dwSkillGroup = 0;
	// check arg1
	if (!*arg1)
	{
		goto USAGE;
		return;
	}
	// check&analyze arg2
	if (*arg2)
	{
		str_to_number(dwSkillGroup, arg2);
		dwSkillGroup = MINMAX(0, dwSkillGroup, 2);
		bIsSetSkillGroup = true;
	}
	// analyze arg1
	str_to_number(dwRace, arg1);
	if (dwRace >= MAIN_RACE_MAX_NUM)
	{
		goto USAGE;
		return;
	}
	// skip if same race
	if (dwRace==ch->GetRaceNum())
		return;
	// process change race
	ch->ChatPacket(CHAT_TYPE_INFO, "Old race=%u, Group=%u", ch->GetRaceNum(), ch->GetSkillGroup());
	ch->SetRace(dwRace);
	ch->ClearSkill();
	// ch->ClearSubSkill();
	if (bIsSetSkillGroup)
	{
		ch->SetSkillGroup(dwSkillGroup);
	}
	// quick mesh change workaround begin
	ch->SetPolymorph(101);
	ch->SetPolymorph(0);
	// quick mesh change workaround end
	ch->ChatPacket(CHAT_TYPE_INFO, "New race=%u, Group=%u", ch->GetRaceNum(), ch->GetSkillGroup());
	return;
	// Usage
USAGE:
	ch->ChatPacket(CHAT_TYPE_INFO, "Usage: /change_race <race_id>");
	// lista raselor
	ch->ChatPacket(CHAT_TYPE_INFO, "Races list:");
	ch->ChatPacket(CHAT_TYPE_INFO, "tWarrior M = %d", MAIN_RACE_WARRIOR_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tNinja F = %d", MAIN_RACE_ASSASSIN_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tSura M = %d", MAIN_RACE_SURA_M); 
	ch->ChatPacket(CHAT_TYPE_INFO, "tShaman F = %d", MAIN_RACE_SHAMAN_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tWarrior W = %d", MAIN_RACE_WARRIOR_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tNinja M = %d", MAIN_RACE_ASSASSIN_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tSura W = %d", MAIN_RACE_SURA_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tShaman M = %d", MAIN_RACE_SHAMAN_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tWolfman M = %d", MAIN_RACE_WOLFMAN_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tMax race number = %d", MAIN_RACE_MAX_NUM);
	// Group lists.
	ch->ChatPacket(CHAT_TYPE_INFO, "Lista grupelor:");
	ch->ChatPacket(CHAT_TYPE_INFO, "tNone = 0");
	ch->ChatPacket(CHAT_TYPE_INFO, "tFirst = 1");
	ch->ChatPacket(CHAT_TYPE_INFO, "tSecond = 2");
	return;
}

4. You're done.

 

2) If you want change_race without wolfman, put this code in cmd_gm.cpp:

ACMD(do_change_race)
{
	char arg1[256], arg2[256];
	two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
	// init
	bool bIsSetSkillGroup = false;
	DWORD dwRace = MAIN_RACE_MAX_NUM;
	DWORD dwSkillGroup = 0;
	// check arg1
	if (!*arg1)
	{
		goto USAGE;
		return;
	}
	// check&analyze arg2
	if (*arg2)
	{
		str_to_number(dwSkillGroup, arg2);
		dwSkillGroup = MINMAX(0, dwSkillGroup, 2);
		bIsSetSkillGroup = true;
	}
	// analyze arg1
	str_to_number(dwRace, arg1);
	if (dwRace >= MAIN_RACE_MAX_NUM)
	{
		goto USAGE;
		return;
	}
	// skip if same race
	if (dwRace==ch->GetRaceNum())
		return;
	// process change race
	ch->ChatPacket(CHAT_TYPE_INFO, "Old race=%u, Group=%u", ch->GetRaceNum(), ch->GetSkillGroup());
	ch->SetRace(dwRace);
	ch->ClearSkill();
	// ch->ClearSubSkill();
	if (bIsSetSkillGroup)
	{
		ch->SetSkillGroup(dwSkillGroup);
	}
	// quick mesh change workaround begin
	ch->SetPolymorph(101);
	ch->SetPolymorph(0);
	// quick mesh change workaround end
	ch->ChatPacket(CHAT_TYPE_INFO, "New race=%u, Group=%u", ch->GetRaceNum(), ch->GetSkillGroup());
	return;
	// Usage
USAGE:
	ch->ChatPacket(CHAT_TYPE_INFO, "Usage: /change_race <race_id>");
	// lista raselor
	ch->ChatPacket(CHAT_TYPE_INFO, "Races list:");
	ch->ChatPacket(CHAT_TYPE_INFO, "tWarrior M = %d", MAIN_RACE_WARRIOR_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tNinja F = %d", MAIN_RACE_ASSASSIN_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tSura M = %d", MAIN_RACE_SURA_M); 
	ch->ChatPacket(CHAT_TYPE_INFO, "tShaman F = %d", MAIN_RACE_SHAMAN_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tWarrior W = %d", MAIN_RACE_WARRIOR_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tNinja M = %d", MAIN_RACE_ASSASSIN_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tSura W = %d", MAIN_RACE_SURA_W);
	ch->ChatPacket(CHAT_TYPE_INFO, "tShaman M = %d", MAIN_RACE_SHAMAN_M);
	ch->ChatPacket(CHAT_TYPE_INFO, "tMax race number = %d", MAIN_RACE_MAX_NUM);
	// Group lists.
	ch->ChatPacket(CHAT_TYPE_INFO, "Lista grupelor:");
	ch->ChatPacket(CHAT_TYPE_INFO, "tNone = 0");
	ch->ChatPacket(CHAT_TYPE_INFO, "tFirst = 1");
	ch->ChatPacket(CHAT_TYPE_INFO, "tSecond = 2");
	return;
}

1. You're done completly now. Enjoy!

  • Love 2

"Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch"

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.