Jump to content

Fix for the Refresh of the Skill Cooldown


Recommended Posts

On 8/16/2020 at 1:22 PM, Shang said:

 

This bug is not related to my fix since I didn't touch the uiTaskbar.py.

But you can try this to fix the activate animation to be resetted all the time:

 

EterPythonLib/PythonSlotWindow.cpp:

On void CSlotWindow::ActivateSlot(DWORD dwIndex) method add this under return:

	if (pSlot->bActive)
		return;
  Hide contents

It should look like this:

	TSlot * pSlot;
	if (!GetSlotPointer(dwIndex, &pSlot))
		return;

	if (pSlot->bActive)
		return;

 

 

And to fix the ActivateSlot to be propagating to the slot you put the icon on the taskbar you can try this fix:

On void CSlotWindow::ClearSlot(TSlot * pSlot) method find the ActiveEffect array hiding and just replace it with __DestroySlotEnableEffect(); or however your function is called.

 

Long time but finally here, I bring to you the second version of this fix. I think I fixed every bug I saw on this post.

New download link: 

This is the hidden content, please

If missed something or just new bugs are found write on the post. Please do not create new threads trying to get help from something related to this post, just write here.

I modified every file you find on the .zip so if you already installed the first version check everything again.

 

PS: If any Moderator sees this, update the first post please.

 

1 minute ago, Mind Rapist said:

Thanks for the response. I was able to fix everything by making a clean reinstallation of the code (apparently I left something behind the 1st time) so the only thing I couldn't fix was this:

and the one in the taskbar that changing position of the active skill adds the effect to the second slot

I imagine you installed this version instead of the one from the first post, am I right?

If the bug of the taskbar is still present you can take the code from the character skills' window, it uses almost the same syntax, you will be able to adapt it.

  • Metin2 Dev 1
  • Love 2
  • Active+ Member
28 minutes ago, Shang said:

 

I imagine you installed this version instead of the one from the first post, am I right?

If the bug of the taskbar is still present you can take the code from the character skills' window, it uses almost the same syntax, you will be able to adapt it.

Actually yes I saw the message for a v2 coming up but I (wrongly) assumed the link in the main thread will be updated. I ran the update with the new

Quote

TransferSlotCoolTime

and the skill page works peachy on togglables On/Off, death, page change, mastery upgrade and point up.

Thanks everyone for your questions/answers/support and if u are trying to implement this system make sure you download this link (should say v2?

This is the hidden content, please

and don't forget the includes:

PythonSlotWindow.cpp

Quote

#include "../UserInterface/PythonSkill.h"

and GameLib/ItemData.h:
 

Quote

#include "GameType.h"

 

  • Metin2 Dev 27
  • muscle 1
  • Love 1
  • Love 5
  • Active+ Member

Taskbar issue FIX

I would like to show my appreciation once again to every single one of you who asked and answered questions so we can have a complete solution for skill slots in this post. I am posting below the simple solution to the taskbar problem (active effect multiplying when changing a toggled skill/item's position) so we can have all solutions in one place.

In uiTaskbar.py find:

	## QuickSlot
	def RefreshQuickSlot(self):
	...
					## NOTE : Activate µΗΎξ ΐΦ΄ΩΈι ΎΖΐΜΔάµµ Ύχµ¥ΐΜΖ®
			=======>	if player.IsSkillActive(Position):	<========
						slot.ActivateSlot(slotNumber)

				elif player.SLOT_TYPE_EMOTION == Type:
					...
				...

	def canAddQuickSlot(self, Type, slotNumber):

and add the else statement below like so:

	## QuickSlot
	def RefreshQuickSlot(self):
	...
					## NOTE : Activate µΗΎξ ΐΦ΄ΩΈι ΎΖΐΜΔάµµ Ύχµ¥ΐΜΖ®
					if player.IsSkillActive(Position):
						slot.ActivateSlot(slotNumber)
					else:
						slot.DeactivateSlot(slotNumber)

				elif player.SLOT_TYPE_EMOTION == Type:
					...
				...

	def canAddQuickSlot(self, Type, slotNumber):
  • 8 months later...
  • Premium

Hey guys,
I know it's been a while and I don't wanna necro, but I still have some problems with the Toggle Effect. Whenever I have a skill toggle active and cast any other Spell or even mount my Horse, the toggle effect vanishes in the Skill Window - when I have two toggles only the most recent gets activated. It stays active in the Affect Info and in the Taskbar though. Any Hints on where I should look?

It looks pretty much like this: 
spacer.png

As I want to learn, I just need some tips and no full solution 😋 

Fixed it:
I added a check, to only store the cooldown time when its greater 0 in OnUseSkill. Had a feeling it has to do with the "non-exisiting" cooldown resetting visually. Everything works now as expected 🙂
Thanks for sharing the bigger part of the solution and sorry for necroing 🫠

Edited by KOrgaz
Found solution myself
  • 1 month later...
  • 4 weeks later...

I added all the codes you gave without any problems. In the first codes you gave, there was no problem when the skill page was opened after riding after using the skills, only when the skill level changed from master to grandmaster or perfectmaster, there was a highlight problem and a time problem. But now, after doing everything you said, the same problem continues. Use the skill and change the page.

  • 7 months later...

Fixed the issue without editing the source.

 

def __RefreshSkillPage(self, name, slotCount):
	global SHOW_LIMIT_SUPPORT_SKILL_LIST

	skillPage = self.skillPageDict[name]
	startSlotIndex = skillPage.GetStartIndex()

	if name == "ACTIVE" and self.PAGE_HORSE == self.curSelectedSkillGroup:
		startSlotIndex += slotCount

	getSkillType = skill.GetSkillType
	getSkillIndex = player.GetSkillIndex
	getSkillGrade = player.GetSkillGrade
	getSkillLevel = player.GetSkillLevel

	for i in xrange(slotCount + 1):
		slotIndex = i + startSlotIndex
		skillIndex = getSkillIndex(slotIndex)

		for j in xrange(skill.SKILL_GRADE_COUNT):
			skillPage.ClearSlot(self.__GetRealSkillSlot(j, i))

		if skillIndex == 0:
			continue

		skillGrade = getSkillGrade(slotIndex)
		skillLevel = getSkillLevel(slotIndex)
		skillType = getSkillType(skillIndex)

		# Special case: riding skill
		if skillIndex == player.SKILL_INDEX_RIDING:
			if skillGrade == 1:
				skillLevel += 19
			elif skillGrade == 2:
				skillLevel += 29
			elif skillGrade == 3:
				skillLevel = 40

			skillPage.SetSkillSlotNew(slotIndex, skillIndex, max(skillLevel - 1, 0), skillLevel)
			skillPage.SetSlotCount(slotIndex, skillLevel)
			continue

		# Active skills
		if skillType == skill.SKILL_TYPE_ACTIVE:
			for j in xrange(skill.SKILL_GRADE_COUNT):
				realSlotIndex = self.__GetRealSkillSlot(j, slotIndex)
				skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel)
				skillPage.SetCoverButton(realSlotIndex)

				if skillGrade == skill.SKILL_GRADE_COUNT and j == (skill.SKILL_GRADE_COUNT - 1):
					skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
				elif not self.__CanUseSkillNow() or skillGrade != j:
					skillPage.SetSlotCount(realSlotIndex, 0)
					skillPage.DisableCoverButton(realSlotIndex)
				else:
					skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)

				# Apply cooldown/activation only to the correct grade or PM
				isEffectiveGrade = (
					(skillGrade == skill.SKILL_GRADE_COUNT and j == skill.SKILL_GRADE_COUNT - 1) or
					(j == skillGrade)
				)
				if isEffectiveGrade:
					if player.IsSkillActive(skillIndex):
						skillPage.ActivateSlot(realSlotIndex)

					if player.IsSkillCoolTime(skillIndex):
						coolTime, elapsed = player.GetSkillCoolTime(skillIndex)
						if elapsed < coolTime:
							skillPage.SetSlotCoolTime(realSlotIndex, coolTime, elapsed)
		else:
			# Other skills (support, etc.)
			if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
				realSlotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)
				skillPage.SetSkillSlot(realSlotIndex, skillIndex, skillLevel)
				skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)

				if skill.CanUseSkill(skillIndex):
					skillPage.SetCoverButton(realSlotIndex)

		skillPage.RefreshSlot()


 

Edited by xRooT
  • 2 months later...
  • Active+ Member

After reading through all the posts here, I've unfortunately run into two bugs.

The first one happens when I activate the 'Magic Weapon' spell and then switch to another tab (for example, the horse skills page). If a horse skill is in the same slot, it also appears activated, even though the skill itself is inactive and has no points assigned to it. It seems the 'active' state of the slot is carrying over between tabs.

The second bug is that the 'Magic Weapon' spell effect never expires in the character window (in the UI), although it expires correctly on the skill bar. This leads to a further problem where the effect gets duplicated in the character window if the spell is cast again.

I've added everything correctly, trying it both with and without the recommended fixes from people.

I'll be always helpful!  😉

  • Premium
13 hours ago, ReFresh said:

After reading through all the posts here, I've unfortunately run into two bugs.

The first one happens when I activate the 'Magic Weapon' spell and then switch to another tab (for example, the horse skills page). If a horse skill is in the same slot, it also appears activated, even though the skill itself is inactive and has no points assigned to it. It seems the 'active' state of the slot is carrying over between tabs.

The second bug is that the 'Magic Weapon' spell effect never expires in the character window (in the UI), although it expires correctly on the skill bar. This leads to a further problem where the effect gets duplicated in the character window if the spell is cast again.

I've added everything correctly, trying it both with and without the recommended fixes from people.

For me everything is working fine with V2, can you send your uicharacter im curious ? 

 

I have only a bug this one :

 

 

Unfortunately I already have 

"m_CoolDownStore.clear();"

in void CSlotWindow::__Initialize()

(and nowhere else)

 

Anyway thanks for this system/fix !

Edited by ARiver

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.