.ZeNu 3109 Posted October 1, 2018 Share Posted October 1, 2018 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( 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 August 27, 2022 by Metin2 Dev Core X - External 2 Internal 102 1 1 1 2 2 3 2 2 40 6 95 Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted October 1, 2018 Management Share Posted October 1, 2018 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 1 Link to comment Share on other sites More sharing options...
Cunoo 210 Posted October 1, 2018 Share Posted October 1, 2018 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. 2 Link to comment Share on other sites More sharing options...
.ZeNu 3109 Posted October 1, 2018 Author Share Posted October 1, 2018 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. 2 Link to comment Share on other sites More sharing options...
DasSchwarzeT 111 Posted October 2, 2018 Share Posted October 2, 2018 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. 1 Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted October 2, 2018 Management Share Posted October 2, 2018 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)... Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted October 2, 2018 Premium Share Posted October 2, 2018 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 Share on other sites More sharing options...
Casawir 18 Posted October 21, 2018 Share Posted October 21, 2018 "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); } 1 9 Link to comment Share on other sites More sharing options...
icaloxi 36 Posted July 2, 2019 Share Posted July 2, 2019 my compiler say very much errors Link to comment Share on other sites More sharing options...
Premium ragem0re 155 Posted July 10, 2019 Premium Share Posted July 10, 2019 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 Share on other sites More sharing options...
.ZeNu 3109 Posted July 10, 2019 Author Share Posted July 10, 2019 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 Share on other sites More sharing options...
Premium ragem0re 155 Posted July 15, 2019 Premium Share Posted July 15, 2019 Hi, thanks for you answer! I already checked the mentioned functions for issues, but they are default ones. Don't you also have the bug? Link to comment Share on other sites More sharing options...
Hudala 0 Posted August 4, 2019 Share Posted August 4, 2019 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 Share on other sites More sharing options...
Syntaax 5 Posted December 17, 2019 Share Posted December 17, 2019 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 Share on other sites More sharing options...
Henay 0 Posted April 14, 2020 Share Posted April 14, 2020 up: fix? Link to comment Share on other sites More sharing options...
Honorable Member Mali 41826 Posted April 14, 2020 Honorable Member Share Posted April 14, 2020 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" 3 Link to comment Share on other sites More sharing options...
Shenzo 4 Posted January 16, 2021 Share Posted January 16, 2021 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 Share on other sites More sharing options...
CrashZ 0 Posted February 4, 2021 Share Posted February 4, 2021 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 Share on other sites More sharing options...
FileNet 0 Posted February 23, 2021 Share Posted February 23, 2021 On 2/4/2021 at 12:07 PM, CrashZ said: Where do i have to add this? Is this the fix to be able to pickup items from party member? PythonItem.cpp -> bool CPythonItem::GetCloseItemVector Link to comment Share on other sites More sharing options...
ggns7 18 Posted December 23, 2023 Share Posted December 23, 2023 How can I make it faster? Im machine. Link to comment Share on other sites More sharing options...
Recommended Posts