Jump to content

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Description:

https://metin2.download/picture/3JAP32qLlLK407s98dxspyC9aE2cewNJ/.gif

 

 

// 1. PythonPlayerInput.cpp
// 1.0. Search:
void CPythonPlayer::PickCloseItem()
{
	...
}
// 1.0. Add after:
void CPythonPlayer::PickCloseItemVector()
{
	CInstanceBase * pkInstMain = NEW_GetMainActorPtr();
	if (!pkInstMain)
		return;

	TPixelPosition kPPosMain;
	pkInstMain->NEW_GetPixelPosition(&kPPosMain);

	std::vector<DWORD> itemVidList;
	
	CPythonItem& rkItem=CPythonItem::Instance();
	if (!rkItem.GetCloseItemVector(pkInstMain->GetNameString(), kPPosMain, itemVidList))
		return;
	
	if(itemVidList.empty())
		return;
	
	for(int i = 0; i < itemVidList.size(); i++)
		SendClickItemPacket(itemVidList[i]);
}


// 2. PythonItem.cpp
// 2.0. Search:
bool CPythonItem::GetCloseItem (const std::string& myName, const TPixelPosition& c_rPixelPosition, DWORD* pdwItemID, DWORD dwDistance)
{
	....
}
// 2.0. Add after:
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;
}


// 3. PythonItem.h
// 3.0. Search:
		bool	GetCloseMoney(const TPixelPosition & c_rPixelPosition, DWORD* dwItemID, DWORD dwDistance=300);
// 3.0. Adauga sub:
		bool 	GetCloseItemVector(const std::string& myName, const TPixelPosition& c_rPixelPosition, std::vector<DWORD>& itemVidList);
		
		
// 4. PythonPlayer.cpp
// 4.0. Search and replace:
void CPythonPlayer::SendClickItemPacket(DWORD dwIID)
{
	if (IsObserverMode())
		return;
		
	const char * c_szOwnerName;
	if (!CPythonItem::Instance().GetOwnership(dwIID, &c_szOwnerName))
		return;

	if (strlen(c_szOwnerName) > 0)
	if (0 != strcmp(c_szOwnerName, GetName()))
	{
		CItemData * pItemData;
		if (!CItemManager::Instance().GetItemDataPointer(CPythonItem::Instance().GetVirtualNumberOfGroundItem(dwIID), &pItemData))
		{
			Tracenf("CPythonPlayer::SendClickItemPacket(dwIID=%d) : Non-exist item.", dwIID);
			return;
		}
		
		if (!IsPartyMemberByName(c_szOwnerName) || pItemData->IsAntiFlag(CItemData::ITEM_ANTIFLAG_DROP | CItemData::ITEM_ANTIFLAG_GIVE))
		{
			PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotPickItem", Py_BuildValue("()"));
			return;
		}
	}

	CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
	rkNetStream.SendItemPickUpPacket(dwIID);
}


// 5. PythonPlayerModule.cpp
// 5.0. Search:
PyObject * playerPickCloseItem(PyObject* poSelf, PyObject* poArgs)
{
	CPythonPlayer::Instance().PickCloseItem();
	return Py_BuildNone();
}
// 5.0. Add after:
PyObject * playerPickCloseItemVector(PyObject* poSelf, PyObject* poArgs)
{
	CPythonPlayer::Instance().PickCloseItemVector();
	return Py_BuildNone();
}

// 5.1. Search:
		{ "PickCloseItem",				playerPickCloseItem,				METH_VARARGS },
// 5.1.Add after::
		{ "PickCloseItemVector",		playerPickCloseItemVector,			METH_VARARGS },
		
		
		
// 6. PythonPlayer,h
// 6.0. Search:
		void	PickCloseItem();
// 6.0. Add after:
		void 	PickCloseItemVector();
		
		
		
// 7. game.py 
// 7. Search:
	player.PickCloseItem()
// 7. Replace with:
	player.PickCloseItemVector()
	

// You can make option for fast pickup or not.

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 129
  • Eyes 2
  • Flame 1
  • Dislove 1
  • Angry 1
  • Cry 2
  • Think 2
  • Confused 3
  • Scream 2
  • Lmao 2
  • Good 43
  • Love 10
  • Love 130
Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/
Share on other sites

  • Management

Won't this cause lag on servers with a considerable amount of players?

Since it'll send a packet for each item like light speed...

But anyway, thanks for sharing

  • Love 1

raw

raw

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-106814
Share on other sites

Acum 3 ore, Cunoo a spus:

I dont know what is it for what?

This is only for lags.. Better edit source for all drop in inventory, like quest..

This is very horrible.

Dude, i saw this ideea on Rubinum and Aeldra, and of course, this idea was appreciated by the players.The most important.

And what you say can't be applied as in the case presented by me in the gif,.You can make all items directly in the inventory with server source, but is not ok from other points of view.

  • Love 2
Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-106825
Share on other sites

vor 23 Stunden schrieb Cunoo:

I dont know what is it for what?

This is only for lags.. Better edit source for all drop in inventory, like quest..

This is very horrible.

What the heck are you talking about? Why should this produce any lags?! Every second the client sends so many packets to the server, 10 more don't matter, lol.

  • Love 1
Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-106854
Share on other sites

  • Management
11 hours ago, DasSchwarzeT said:

What the heck are you talking about? Why should this produce any lags?! Every second the client sends so many packets to the server, 10 more don't matter, lol.

10 more from each player (depending on how many players and how many drops) (imagine 100 players and 20 drops for each, 1000 packets in practically 1 second)...

raw

raw

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-106883
Share on other sites

  • Premium
Acum 7 minute, charparodar a spus:

10 more from each player (depending on how many players and how many drops) (imagine 100 players and 20 drops for each, 1000 packets in practically 1 second)...

Get a big server and test it. No, it doesn't make lagg.

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-106886
Share on other sites

  • 3 weeks later...

"c++11" code, a  little bit optimised maybe someone will be interested;
 

void CPythonPlayer::PickCloseItemVector()
{
	CInstanceBase * pkInstMain = NEW_GetMainActorPtr();
	if (!pkInstMain)
		return;

	TPixelPosition kPPosMain;
	pkInstMain->NEW_GetPixelPosition(&kPPosMain);

	CPythonItem& rkItem = CPythonItem::Instance();

	std::vector<DWORD> itemlist{ rkItem.GetCloseItemVector(pkInstMain->GetNameString(), kPPosMain)};

	if (itemlist.empty())
		return;

	for (auto &i : itemlist)
		SendClickItemVectorPacket(i);
}

 

std::vector<DWORD> CPythonItem::GetCloseItemVector(const std::string & myName, const TPixelPosition & c_rPixelPosition)
{
	DWORD dwCloseItemDistance = 1000 * 1000;

	std::vector<DWORD> itemlist;

	for (auto &i : m_GroundItemInstanceMap)
	{
		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))
		{
			itemlist.push_back(i.first);
		}
	}
	return itemlist; // moving vector not explicit
}

 

 

void CPythonPlayer::SendClickItemVectorPacket(DWORD dwIID)
{
	if (IsObserverMode())
		return;

	CPythonNetworkStream& rkNetStream = CPythonNetworkStream::Instance();
	rkNetStream.SendItemPickUpPacket(dwIID);
}

 

  • Love 1
  • Love 10
Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-107622
Share on other sites

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

Hi, thanks for sharing!

Unfortunately I've found a bug.

It does only pickup items that you dropped and ignore party member drops.

However it is possible to pick them up by clicking on.

I don't see any way to check for party members on client-side, maybe someone do. (?)

Appreciate any help, thanks.

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-117019
Share on other sites

Acum 37 minute, ragem0re a spus:

Hi, thanks for sharing!

Unfortunately I've found a bug.

It does only pickup items that you dropped and ignore party member drops.

However it is possible to pick them up by clicking on.

I don't see any way to check for party members on client-side, maybe someone do. (?)

Appreciate any help, thanks.

You probably refer to:

Binary/UserInterface/PythonPlayer.cpp:

In function

 ::SendClickItemPacket

:
you have this condition: 

if (!IsPartyMemberByName(c_szOwnerName) ... 

And source server: 

In file:  Char_item.cpp , Function ::PickupItem.

else if (!IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_DROP)

You have a condition for Party Group and antiflags object.

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-117021
Share on other sites

  • 3 weeks later...
Am 10.7.2019 um 15:51 schrieb ragem0re:

Hi, thanks for sharing!

Unfortunately I've found a bug.

It does only pickup items that you dropped and ignore party member drops.

However it is possible to pick them up by clicking on.

I don't see any way to check for party members on client-side, maybe someone do. (?)

Appreciate any help, thanks.

I have exactly the same Problem :(

 

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-117944
Share on other sites

  • 4 months later...
Am 10.7.2019 um 15:51 schrieb ragem0re:

Hi, thanks for sharing!

Unfortunately I've found a bug.

It does only pickup items that you dropped and ignore party member drops.

However it is possible to pick them up by clicking on.

I don't see any way to check for party members on client-side, maybe someone do. (?)

Appreciate any help, thanks.

Have anyone a fix for that ?

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-121726
Share on other sites

  • 3 months later...
  • Honorable Member
4 hours ago, Henay said:

up: fix?

		if (dwDistance < dwCloseItemDistance
			&& (pInstance->stOwnership.empty()
			|| pInstance->stOwnership == myName
			|| CPythonPlayer::Instance().IsPartyMemberByName(pInstance->stOwnership.c_str())))
#include "PythonPlayer.h"

 

  • Love 3

 

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-126280
Share on other sites

  • 9 months later...
On 4/14/2020 at 11:14 PM, Mali61 said:

		if (dwDistance < dwCloseItemDistance
			&& (pInstance->stOwnership.empty()
			|| pInstance->stOwnership == myName
			|| CPythonPlayer::Instance().IsPartyMemberByName(pInstance->stOwnership.c_str())))

#include "PythonPlayer.h"

 

 

Thanks for this update! Could you maybe share code by which i can set in game option between single pickup (player.PickCloseItem()) and vector pickup (player.PickCloseItemVector())?

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-135136
Share on other sites

  • 3 weeks later...
On 4/14/2020 at 11:14 PM, Mali61 said:

		if (dwDistance < dwCloseItemDistance
			&& (pInstance->stOwnership.empty()
			|| pInstance->stOwnership == myName
			|| CPythonPlayer::Instance().IsPartyMemberByName(pInstance->stOwnership.c_str())))

#include "PythonPlayer.h"

 

 

Where do i have to add this? Is this the fix to be able to pickup items from party member?

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-135900
Share on other sites

  • 3 weeks later...
  • 2 years later...
  • 9 months later...

Is it possible to create a button to activate and deactivate picking up items alone?

“To be humble with superiors is duty, with equals is courtesy, with inferiors is nobility.”
Benjamin Franklin

 

Por favor, desative seu AdBlock quando usar meus links de download.

Please, disable your 
AdBlock when use my download links.

Me

AdBlock 
On:   


699691-icon-20-sad-face-eyebrows-48.png

 

Adblock Off:  



Streamline-65-48.png

 

 

Angry One Piece GIF by Toei Animation

Link to comment
https://metin2.dev/topic/19633-metin2-instant-pickup/#findComment-167475
Share on other sites

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.