Jump to content
×
×
  • Create New...

Pick Up With Filter & Instant


Recommended Posts

  • Honorable Member

kEEkWsT.png

 

Try to avoid python memory leaks with lambdas in setevent.

Button.SetToggleDownEvent(ui.__mem_func__(self.__OnClickPickUpFilterButton), Index)

 

Link to comment
Share on other sites

  • Honorable Member
8 minutes ago, xP3NG3Rx said:

kEEkWsT.png

 

Try to avoid python memory leaks with lambdas in setevent.

Button.SetToggleDownEvent(ui.__mem_func__(self.__OnClickPickUpFilterButton), Index)

 

45c6255bd1.png

i will use my vegas wildcard.

@VegaS™

  • Metin2 Dev 1
  • Love 3
  • Lmao 2
Link to comment
Share on other sites

  • Honorable Member

Ahh okay, I see.

Old shit class from 2004:

Spoiler
class ToggleButton(Button):
	def __init__(self):
		Button.__init__(self)

		self.eventUp = None
		self.eventDown = None

	def __del__(self):
		Button.__del__(self)

		self.eventUp = None
		self.eventDown = None

	def SetToggleUpEvent(self, event):
		self.eventUp = event

	def SetToggleDownEvent(self, event):
		self.eventDown = event

	def RegisterWindow(self, layer):
		self.hWnd = wndMgr.RegisterToggleButton(self, layer)

	def OnToggleUp(self):
		if self.eventUp:
			self.eventUp()

	def OnToggleDown(self):
		if self.eventDown:
			self.eventDown()

 

From 2018:

Spoiler
class ToggleButton(Button):
	def __init__(self):
		Button.__init__(self)

		self.eventUp = None
		self.eventDown = None

		self.eventUpArgs = None
		self.eventDownArgs = None

	def __del__(self):
		Button.__del__(self)

		self.eventUp = None
		self.eventDown = None

	def SetToggleUpEvent(self, event, *args):
		self.eventUp = event
		self.eventUpArgs = args

	def SetToggleDownEvent(self, event, *args):
		self.eventDown = event
		self.eventDownArgs = args

	def RegisterWindow(self, layer):
		self.hWnd = wndMgr.RegisterToggleButton(self, layer)

	def OnToggleUp(self):
		if self.eventUp:
			if self.eventUpArgs:
				apply(self.eventUp, self.eventUpArgs)
			else:
				self.eventUp()

	def OnToggleDown(self):
		if self.eventDown:
			if self.eventDownArgs:
				apply(self.eventDown, self.eventDownArgs)
			else:
				self.eventDown()

 

 

  • Love 3
Link to comment
Share on other sites

Good job.

 

One sugestion: Use a BYTE for all filters or a 16 bits type (if it's not enough). You can easly set on every bit of the variable a flag value (0 = not set, 1 = set) and it's more optimized and easier to store in config.

 

spacer.png

  • Love 1
Link to comment
Share on other sites

  • Honorable Member
1 hour ago, Johnny69 said:

Good job.

 

One sugestion: Use a BYTE for all filters or a 16 bits type (if it's not enough). You can easly set on every bit of the variable a flag value (0 = not set, 1 = set) and it's more optimized and easier to store in config.

 

spacer.png

 

Bitset is more useful for this system, I used it in the update. 

Thanks anyway.

  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 8 months later...

It works perfectly! Is it possible to change it to when the item is locked and click on it to pick up? In other words, leave the filter only on the 'Z' key?

 

Edit: 

I would like to make more precise checks, looking at the item's subtype, how can I use type and subtype at the same time?

IsWearableFlag(CItemData::WEARABLE_SHIELD): return 9;

Edited by Klaus
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 8/25/2021 at 4:33 PM, Klaus said:

It works perfectly! Is it possible to change it to when the item is locked and click on it to pick up? In other words, leave the filter only on the 'Z' key?

 

Edit: 

I would like to make more precise checks, looking at the item's subtype, how can I use type and subtype at the same time?

IsWearableFlag(CItemData::WEARABLE_SHIELD): return 9;

I'm following the same questions.

Thanks!

Link to comment
Share on other sites

  • 1 month later...
  • Honorable Member

142676680-98a5679f-da7c-4944-a01d-f2f844

Spoiler

-) Costume Category(BODY, HAIR)

-) Skillforget

+) Chest(GIFTBOX)

+) Potion(USE_POTION, USE_ABILITY_UP, USE_POTION_NODELAY, USE_POTION_CONTINUE)

+) Material

+) Picking Method

 

Edited by Mali
  • Metin2 Dev 1
  • Love 2
Link to comment
Share on other sites

2 minutes ago, rares2017 said:

I had this problem too and it was solved with #include "../gamelib/ItemData.h" in PythonSystem.h

I tried but it shows the same error 😞 

can you please share with me your pythonsystem.h? also, do you have VS22 ?

Edited by SCOOB
Link to comment
Share on other sites

Yeah.. I still have VS2013 so if someone can find a fix for the errors on this vs version, that would be awesome. If not, no problem.

 

Solved Thanks @ Malifor the tips!

If anyone has this problem:

 

Comment the static constexpr line from the header file and then go to the cpp file:

 

Search for:

 

inputFile.open

and

outputFile.open

and then change them like this:

inputFile.open("pickupfile.dat", std::ios::binary);

outputFile.open("pickupfile.dat", std::ios::binary);

 

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

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.