Jump to content

Auto Pick Filter System


Recommended Posts

  • Contributor

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( GitHub )

 

 

Hi guys,

I observed that a person asked for the car pick with filters but they didn't give him the correct answer, and that some cheats have it, here is an example, i tested it in my Test Server and it works correctly, i hope not forgot to add some part of the code since. I finished the system a while ago, if you have one error tell me and i will resolve ?.

 

.png

  • Metin2 Dev 77
  • kekw 1
  • Eyes 1
  • Dislove 2
  • Not Good 2
  • Cry 1
  • Think 1
  • Confused 2
  • Scream 1
  • Lmao 1
  • Good 25
  • Love 6
  • Love 51
Link to comment
Share on other sites

  • Forum Moderator

The idea isn't so bad, but the code has too many useless lines, here's what you can do to improve it.

 

	def RefreshPickupFilter(self):
		#Weapon
		if systemSetting.IsPickUpFilterWeapon():
			self.PickUpFilterList[0].Down()
		else:
			self.PickUpFilterList[0].SetUp()
		#Armor
		if systemSetting.IsPickUpFilterArmor():
			self.PickUpFilterList[1].Down()
		else:
			self.PickUpFilterList[1].SetUp()
		#Ear
		if systemSetting.IsPickUpFilterEar():
			self.PickUpFilterList[2].Down()
		else:
			self.PickUpFilterList[2].SetUp()
		#Neck
		if systemSetting.IsPickUpFilterNeck():
			self.PickUpFilterList[3].Down()
		else:
			self.PickUpFilterList[3].SetUp()
		#Foots
		if systemSetting.IsPickUpFilterFoots():
			self.PickUpFilterList[4].Down()
		else:
			self.PickUpFilterList[4].SetUp()		
		#Shield
		if systemSetting.IsPickUpFilterShield():
			self.PickUpFilterList[5].Down()
		else:
			self.PickUpFilterList[5].SetUp()		
		#Book
		if systemSetting.IsPickUpFilterBook():
			self.PickUpFilterList[6].Down()
		else:
			self.PickUpFilterList[6].SetUp()		
		#Stone
		if systemSetting.IsPickUpFilterStone():
			self.PickUpFilterList[7].Down()
		else:
			self.PickUpFilterList[7].SetUp()		
		#Etc
		if systemSetting.IsPickUpFilterEtc():
			self.PickUpFilterList[8].Down()
		else:
			self.PickUpFilterList[8].SetUp()

To:

def RefreshPickupFilter(self):
	checkFilterList = (
		systemSetting.IsPickUpFilterWeapon(), systemSetting.IsPickUpFilterArmor(),
		systemSetting.IsPickUpFilterEar(), systemSetting.IsPickUpFilterNeck(),
		systemSetting.IsPickUpFilterFoots(), systemSetting.IsPickUpFilterShield(),
		systemSetting.IsPickUpFilterBook(), systemSetting.IsPickUpFilterStone(),
		systemSetting.IsPickUpFilterEtc()
	)
	
	for child, flag in zip(self.PickUpFilterList, checkFilterList):
		if flag:
			child.Down()
		else:
			child.SetUp()

 

			self.PickUpFilterList.append(GetObject("Pick_Up_FilterWeapon"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterArmor"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterEar"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterNeck"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterFoots"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterShield"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterBook"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterStone"))
			self.PickUpFilterList.append(GetObject("Pick_Up_FilterEtc"))

To:

for name in ('Weapon','Armor','Ear','Neck','Foots','Shield','Book','Stone','Etc'):
	self.PickUpFilterList.append(GetObject("Pick_Up_Filter{}".format(name)))

 

		self.PickUpFilterList[0].SetToggleUpEvent(self.__OnClickPickupFilterButtonWeapon) # Weapon
		self.PickUpFilterList[0].SetToggleDownEvent(self.__OnClickPickupFilterButtonWeapon) # Weapon
		self.PickUpFilterList[1].SetToggleUpEvent(self.__OnClickPickupFilterButtonArmor) # Armor
		self.PickUpFilterList[1].SetToggleDownEvent(self.__OnClickPickupFilterButtonArmor) # Armor
		self.PickUpFilterList[2].SetToggleUpEvent(self.__OnClickPickupFilterButtonEar) # Ear
		self.PickUpFilterList[2].SetToggleDownEvent(self.__OnClickPickupFilterButtonEar) # Ear
		self.PickUpFilterList[3].SetToggleUpEvent(self.__OnClickPickupFilterButtonNeck) # Neck
		self.PickUpFilterList[3].SetToggleDownEvent(self.__OnClickPickupFilterButtonNeck) # Neck
		self.PickUpFilterList[4].SetToggleUpEvent(self.__OnClickPickupFilterButtonFoots) # Foots
		self.PickUpFilterList[4].SetToggleDownEvent(self.__OnClickPickupFilterButtonFoots) # Foots
		self.PickUpFilterList[5].SetToggleUpEvent(self.__OnClickPickupFilterButtonShield) # Shield
		self.PickUpFilterList[5].SetToggleDownEvent(self.__OnClickPickupFilterButtonShield) # Shield
		self.PickUpFilterList[6].SetToggleUpEvent(self.__OnClickPickupFilterButtonBook) # Books
		self.PickUpFilterList[6].SetToggleDownEvent(self.__OnClickPickupFilterButtonBook) # Books
		self.PickUpFilterList[7].SetToggleUpEvent(self.__OnClickPickupFilterButtonStone) # Stone
		self.PickUpFilterList[7].SetToggleDownEvent(self.__OnClickPickupFilterButtonStone) # Stone
		self.PickUpFilterList[8].SetToggleUpEvent(self.__OnClickPickupFilterButtonEtc) # Etc
		self.PickUpFilterList[8].SetToggleDownEvent(self.__OnClickPickupFilterButtonEtc) # Etc

To:

eventFuncList = (
	self.__OnClickPickupFilterButtonWeapon, self.__OnClickPickupFilterButtonArmor, self.__OnClickPickupFilterButtonEar,
	self.__OnClickPickupFilterButtonNeck, self.__OnClickPickupFilterButtonFoots, self.__OnClickPickupFilterButtonShield,
	self.__OnClickPickupFilterButtonBook, self.__OnClickPickupFilterButtonStone, self.__OnClickPickupFilterButtonEtc
)

for child, event in zip(self.PickUpFilterList, eventFuncList):
	child.SetToggleUpEvent(event)
	child.SetToggleDownEvent(event)

 

  • Metin2 Dev 25
  • Not Good 2
  • Confused 1
  • Lmao 1
  • Good 8
  • Love 4
  • Love 42
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • Contributor
En 5/11/2019 a las 5:20, Tallywa dijo:

bump

In pythonItem.cpp add after this function bool CPythonItem::GetCloseItem(const TPixelPosition & c_rPixelPosition, DWORD * pdwItemID, DWORD dwDistance)

 

bool CPythonItem::GetCloseItemVector(const std::string& myName, const TPixelPosition& c_rPixelPosition, std::vector<DWORD>& itemVidList)
{
	DWORD dwCloseItemDistance = 1000 * 1000;
	
	TGroundItemInstanceMap::iterator i;
	for (i = m_GroundItemInstanceMap.begin(); i != m_GroundItemInstanceMap.end(); ++i)
	{
		TGroundItemInstance * pInstance = i->second;

		DWORD dwxDistance = DWORD(c_rPixelPosition.x - pInstance->v3EndPosition.x);
		DWORD dwyDistance = DWORD(c_rPixelPosition.y - (-pInstance->v3EndPosition.y));
		DWORD dwDistance = DWORD(dwxDistance * dwxDistance + dwyDistance * dwyDistance);

		if (dwDistance < dwCloseItemDistance && (pInstance->stOwnership == "" || pInstance->stOwnership == myName))
		{
			itemVidList.push_back(i->first);
		}
	}

	return true;
}

 

pythonItem.h after this bool    GetCloseItem(const TPixelPosition & c_rPixelPosition, DWORD* pdwItemID, DWORD dwDistance=300); add

bool 	GetCloseItemVector(const std::string& myName, const TPixelPosition& c_rPixelPosition, std::vector<DWORD>& itemVidList);

 

  • Metin2 Dev 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 3 weeks later...
  • Bronze

How can i set more than one filter on true, at the moment is so when i activate one of the filters it's works fine but when i activate the second one it picks up all the items.

 

Example:

1.I activate only Weapon, the filter works fine it's not picking up any Weapon anymore

2. I activate Weapon and Armor, the filter isn't work anymore, so it's picking up all the items i drop

spacer.png

Link to comment
Share on other sites

  • 6 months later...

Hi, can I ask for help? I need to add another item to one lift, how to add it to make it work?


Example: if (CPythonSystem :: Instance (). IsPickUpFilterStone ())
if (pItemData-> GetType () == CItemData :: ITEM_TYPE_METIN)
rkNetStream.SendItemPickUpPacket (dwIID);


And add to that, for example: ITEM_TYPE_USE

 

Thanks for the help.

Link to comment
Share on other sites

  • 1 year later...
On 12/28/2019 at 6:45 PM, Dex said:

Example:

1.I activate only Weapon, the filter works fine it's not picking up any Weapon anymore

2. I activate Weapon and Armor, the filter isn't work anymore, so it's picking up all the items i drop

Has anyone found a solution for this? And where can i change the language in this?

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.