Jump to content

Fix horse skills after changing horse riding position


Recommended Posts

  • Premium

There is a problem, when you change position of horse riding skill in playersettingsmodule, you cannot use horse skills. For me, the way skills work on the client side of thing is really dumb, but they went even furher. I don't understand why, client checks if player has a horse riding level from the fixed skill slot, not from skill info itself. 

Spoiler

.png

 

Without my fix, it goes like this:

Spoiler

.gif

With fix:

Spoiler

2022-07-22-12-53-42.gif

 

Actual fix:

Spoiler
// PythonPlayerInput.cpp

// find:
bool CPythonPlayer::__CanAttack()
{
	[...]
}

// Replace with:
extern const DWORD c_iSkillIndex_Riding;
bool CPythonPlayer::__CanAttack()
{
	if (__IsProcessingEmotion())
	{
		return false;
	}

	if (IsOpenPrivateShop())
		return false;

	if (IsObserverMode())
		return false;

	CInstanceBase* pkInstMain = NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	DWORD dwSkillIndex = 0;
	GetSkillSlotIndex(c_iSkillIndex_Riding, &dwSkillIndex);
	if (pkInstMain->IsMountingHorse() && pkInstMain->IsNewMount() && (GetSkillGrade(dwSkillIndex) < 1 && GetSkillLevel(dwSkillIndex) < 11))
	{
		return false;
	}

	return pkInstMain->CanAttack();
}

// PythonPlayerSkill.cpp

// Find:
bool CPythonPlayer::__CanUseSkill()
{
	[...]
}

// Replace with:
extern const DWORD c_iSkillIndex_Riding;
bool CPythonPlayer::__CanUseSkill()
{
	CInstanceBase* pkInstMain=NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	if (IsObserverMode())
		return false;

	DWORD dwSkillIndex = 0;
	GetSkillSlotIndex(c_iSkillIndex_Riding, &dwSkillIndex);
	if (pkInstMain->IsMountingHorse() && (GetSkillGrade(dwSkillIndex) < 1 && GetSkillLevel(dwSkillIndex) < 20))
	{
		return false;
	}

	return pkInstMain->CanUseSkill();
}

 


 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 4
  • Good 5
  • Love 1
Link to comment
Share on other sites

  • Honorable Member

This is what I did some time ago:

DWORD GetHorseSkillSlotIndex()
{
	constexpr auto HorseSkillIndex = 130;
	static DWORD RequireSkillSlotIndex = 0;
	if (!RequireSkillSlotIndex)
		CPythonPlayer::Instance().FindSkillSlotIndexBySkillIndex(HorseSkillIndex, &RequireSkillSlotIndex);
	return RequireSkillSlotIndex;
}

bool CPythonPlayer::__CanUseSkill()
{
	CInstanceBase* pkInstMain=NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	if (IsObserverMode())
		return false;

	// Terrible skill slot index managament
	if (pkInstMain->IsMountingHorse() && (GetSkillGrade(GetHorseSkillSlotIndex()) < 1 && GetSkillLevel(GetHorseSkillSlotIndex()) < 20))
		return false;

	return pkInstMain->CanUseSkill();
}

bool CPythonPlayer::__CanAttack()
{
	if (__IsProcessingEmotion())
		return false;

	if (IsOpenPrivateShop())
		return false;

	if (IsObserverMode())
		return false;

	CInstanceBase* pkInstMain=NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	// Terrible skill slot index managament
	if (pkInstMain->IsMountingHorse() && pkInstMain->IsNewMount() && (GetSkillGrade(GetHorseSkillSlotIndex()) < 1 && GetSkillLevel(GetHorseSkillSlotIndex()) < 11))
		return false;

	return pkInstMain->CanAttack();
}

I haven't tested your solution, but using GetSkillSlotIndex should be better than FindSkillSlotIndexBySkillIndex.

Edited by martysama0134
  • Metin2 Dev 2
  • Good 1
Link to comment
Share on other sites

  • Active Member

So, if I'm not mistaken, we can do that like the @martysama0134 said and we can add the DWORD GetHorseSkillSlotIndex() to PythonPlayer.h to make the function shared in CPythonPlayer class.

This is the hidden content, please

Edited by ReFresh
  • Metin2 Dev 31
  • Good 5
  • Love 6

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Honorable Member
5 minutes ago, ReFresh said:

So, if I'm not mistaken, we can do that like the @martysama0134 said and we can add the DWORD GetHorseSkillSlotIndex() to PythonPlayer.h to make the function shared in CPythonPlayer class.

Yes, if you want.

Link to comment
Share on other sites

i've noticed that bug when i changed skill order.

its really pathetic to get information from the order. i was disabled that check because in these days you know people are using premium mounts and its formality to give them level 30 horse or check that info but as i said its my opinion.

btw as i remember required horse level for horse skill is 20.

thanks for share.

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.