Jump to content

Red & Blue Potion Effect


Recommended Posts

Hello @all,

 

this is i think my first Release pls dont hate me for my codestyle im a noob :)

 

https://metin2.download/picture/OR0Hqox99AQYNEvG3FWUFtAgljk4n53p/.gif

 

Install:

 

Search in uiinventory.py: def RefreshBagSlotWindow(self): inside this: self.wndItem.DeactivateSlot(slotNumber)

 

add: 

				if itemVnum >= 72723 and itemVnum <= 72726:
					metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]# <!> globalSlotNumber may be different <!>
					if isActivated:
						self.wndItem.ActivateSlot(i, (238.00 / 255.0), (000.00 / 255.0), (000.00 / 255.0), 1.0)
					else:
						self.wndItem.DeactivateSlot(slotNumber)
				
				if itemVnum >= 72727 and itemVnum <= 72730:
					metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]# <!> globalSlotNumber may be different <!>
					if isActivated:
						self.wndItem.ActivateSlot(i, (000.00 / 255.0), (000.00 / 255.0), (238.00 / 255.0), 1.0)
					else:
						self.wndItem.DeactivateSlot(slotNumber)

this is all pls dont hate me .....

 

have a nice day all :)

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

  • Forum Moderator
Quote
				if itemVnum >= 72723 and itemVnum <= 72726:
					metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]# <!> globalSlotNumber may be different <!>
					if isActivated:
						self.wndItem.ActivateSlot(i, (238.00 / 255.0), (000.00 / 255.0), (000.00 / 255.0), 1.0)
					else:
						self.wndItem.DeactivateSlot(slotNumber)
				
				if itemVnum >= 72727 and itemVnum <= 72730:
					metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]# <!> globalSlotNumber may be different <!>
					if isActivated:
						self.wndItem.ActivateSlot(i, (000.00 / 255.0), (000.00 / 255.0), (238.00 / 255.0), 1.0)
					else:
						self.wndItem.DeactivateSlot(slotNumber)

 

I didn't tested your code, but how you implemented this it's bad because you called multiple times ActivateSlot and DeactivateSlot for no reason (before your code already there're other conditions that are called), so you create small visual bugs for a millisecond. 

So, you could include it in the default code like this:

 

Search for:

Spoiler
				isActivated = 0 != metinSocket[0]

				if isActivated:
					self.wndItem.ActivateSlot(slotNumber)
					potionType = 0;
					if constInfo.IS_AUTO_POTION_HP(itemVnum):
						potionType = player.AUTO_POTION_TYPE_HP
					elif constInfo.IS_AUTO_POTION_SP(itemVnum):
						potionType = player.AUTO_POTION_TYPE_SP

					usedAmount = int(metinSocket[1])
					totalAmount = int(metinSocket[2])
					player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))

				else:
					self.wndItem.DeactivateSlot(slotNumber)

Replace with:

Spoiler
				isActivated, usedAmount, totalAmount = metinSocket[:3]
				if isActivated:
					potionType = 0
					if constInfo.IS_AUTO_POTION_HP(itemVnum):
						potionType = player.AUTO_POTION_TYPE_HP
						self.wndItem.ActivateSlot(slotNumber, (238.00 / 255.0), (000.00 / 255.0), (000.00 / 255.0), 1.0)
						
					elif constInfo.IS_AUTO_POTION_SP(itemVnum):
						potionType = player.AUTO_POTION_TYPE_SP
						self.wndItem.ActivateSlot(slotNumber, (000.00 / 255.0), (000.00 / 255.0), (238.00 / 255.0), 1.0)

					player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, slotNumber)
				else:
					self.wndItem.DeactivateSlot(slotNumber)

 


Also you should say that the function ActivateSlot by default doesn't have those features.

 

Meme for the math method:

.png

  • Love 3
Link to comment
Share on other sites

  • Forum Moderator
18 minutes ago, Bizzy said:

isActivated, usedAmount, totalAmount = metinSocket[:3]

important? but why that?

 

a, b, c = 1, 2, 3
a, b, c = (1, 2, 3)
(a, b, c) = 1, 2, 3
(a, b, c) = (1, 2, 3)

All of the methods are doing same.

isActivated = 0 != metinSocket[0]
usedAmount = int(metinSocket[1])
totalAmount = int(metinSocket[2])

# examples
isActivated, usedAmount, totalAmount = map(int, metinSocket[:3])
isActivated, usedAmount, totalAmount = metinSocket[:3]
isActivated, usedAmount, totalAmount = metinSocket[0], metinSocket[1], metinSocket[2]
isActivated, usedAmount, totalAmount = metinSocket

I choosed metinSocket[:3], for being sure that's reading just the first three items from the list, because other people have 3+ sockets.

 

Please follow the rules:

Rules

§1 Language

(1.1) Language

The language in this board is english. If you want to post something in your own language always add an english translation. The only exception for this rule is this section: Private Servers

 

Edited by VegaS™
  • Love 1
Link to comment
Share on other sites

  • 1 month later...
  • Forum Moderator
On 10/17/2020 at 1:11 AM, wubservice said:

ActivateSlot() takes exactly 2 arguments (6 given)
 

can anybody help me?

You don't have the correct function. Check every source with sash, it has it.

Note that this topic isn't an help request.

Gurgarath
coming soon

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.