Jump to content

Chest Drop View


Recommended Posts

  • 1 month later...
  • 3 months later...

Problem: When I click on the chest, the window opens, but the duration of the objects time: 0 min. he is writing.

For example: Costumes time 0 min. writes.
Duration 0 min. The duration of the objects. he is writing.

For example: The seven-day costume says 0 minutes.


I'm sorry for my bad english.

Link to comment
Share on other sites

  • 3 weeks later...
  • Honorable Member

thanks for topic here is auto adaptable codes and some improvings..

#ifdef ENABLE_SHOW_CHEST_DROP
#include "../../libgame/include/grid.h"
void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item, int& sizee)
{
	const auto pGroup = GetSpecialItemGroup(dwChestVnum);
	if (!pGroup)
		return;
	std::vector<std::unique_ptr<CGrid>> pGrids;
	pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
	
	for (int i = 0; i < pGroup->GetGroupSize(); i++) {
		const auto itemTable = GetTable(pGroup->GetVnum(i));
		//pass if exp, yang or duplicate item
		if (!itemTable || !itemTable->dwVnum || itemTable->dwVnum < 3 || std::find_if(vec_item.begin(), vec_item.end(), [&pGroup, &i](const TChestDropInfoTable& data) -> bool { return static_cast<DWORD>(pGroup->GetVnum(i)) == data.dwItemVnum; }) != vec_item.end())
			continue;
		bool PushNewGrid = true;
		for (size_t iPage = 0; iPage < pGrids.size(); iPage++) {
			const auto iPos = pGrids.at(iPage)->FindBlank(1, static_cast<int>(itemTable->bSize));
			if (iPos >= 0) {
				pGrids.at(iPage)->Put(iPos, 1, static_cast<int>(itemTable->bSize));
				vec_item.push_back({ static_cast<BYTE>(iPage+1), static_cast<BYTE>(iPos), static_cast<DWORD>(pGroup->GetVnum(i)), static_cast<BYTE>(pGroup->GetCount(i)) });
				PushNewGrid = false;
				break;
			}
		}
		if (PushNewGrid) {
			pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
			i--;//again
		}
	}
}
#endif

 

  • Love 3

 

Link to comment
Share on other sites

  • 2 weeks later...
On 12/7/2019 at 9:30 PM, Mali61 said:

thanks for topic here is auto adaptable codes and some improvings..


#ifdef ENABLE_SHOW_CHEST_DROP
#include "../../libgame/include/grid.h"
void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item, int& sizee)
{
	const auto pGroup = GetSpecialItemGroup(dwChestVnum);
	if (!pGroup)
		return;
	std::vector<std::unique_ptr<CGrid>> pGrids;
	pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
	
	for (int i = 0; i < pGroup->GetGroupSize(); i++) {
		const auto itemTable = GetTable(pGroup->GetVnum(i));
		//pass if exp, yang or duplicate item
		if (!itemTable || !itemTable->dwVnum || itemTable->dwVnum < 3 || std::find_if(vec_item.begin(), vec_item.end(), [&pGroup, &i](const TChestDropInfoTable& data) -> bool { return static_cast<DWORD>(pGroup->GetVnum(i)) == data.dwItemVnum; }) != vec_item.end())
			continue;
		bool PushNewGrid = true;
		for (size_t iPage = 0; iPage < pGrids.size(); iPage++) {
			const auto iPos = pGrids.at(iPage)->FindBlank(1, static_cast<int>(itemTable->bSize));
			if (iPos >= 0) {
				pGrids.at(iPage)->Put(iPos, 1, static_cast<int>(itemTable->bSize));
				vec_item.push_back({ static_cast<BYTE>(iPage+1), static_cast<BYTE>(iPos), static_cast<DWORD>(pGroup->GetVnum(i)), static_cast<BYTE>(pGroup->GetCount(i)) });
				PushNewGrid = false;
				break;
			}
		}
		if (PushNewGrid) {
			pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
			i--;//again
		}
	}
}
#endif

 

Problem: When I click on the chest, the window opens, but the duration of the objects time: 0 min. he is writing.

For example: Costumes time 0 min. writes.
Duration 0 min. The duration of the objects. he is writing.

For example: The seven-day costume says 0 minutes.


I'm sorry for my bad english.

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • Contributor

The system works fine thanks :)

@.ZeNu You should mention in the thread that there are more pages, not static anymore so it is not a problem if a chest contains a lots of item.

 

Btw did anyone managed to set a tooltip to the chest icon in the drop window? Tried many ways but not succed yet.

Link to comment
Share on other sites

  • 6 months later...
On 12/7/2019 at 7:30 PM, Mali61 said:

thanks for topic here is auto adaptable codes and some improvings..



#ifdef ENABLE_SHOW_CHEST_DROP
#include "../../libgame/include/grid.h"
void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item, int& sizee)
{
	const auto pGroup = GetSpecialItemGroup(dwChestVnum);
	if (!pGroup)
		return;
	std::vector<std::unique_ptr<CGrid>> pGrids;
	pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
	
	for (int i = 0; i < pGroup->GetGroupSize(); i++) {
		const auto itemTable = GetTable(pGroup->GetVnum(i));
		//pass if exp, yang or duplicate item
		if (!itemTable || !itemTable->dwVnum || itemTable->dwVnum < 3 || std::find_if(vec_item.begin(), vec_item.end(), [&pGroup, &i](const TChestDropInfoTable& data) -> bool { return static_cast<DWORD>(pGroup->GetVnum(i)) == data.dwItemVnum; }) != vec_item.end())
			continue;
		bool PushNewGrid = true;
		for (size_t iPage = 0; iPage < pGrids.size(); iPage++) {
			const auto iPos = pGrids.at(iPage)->FindBlank(1, static_cast<int>(itemTable->bSize));
			if (iPos >= 0) {
				pGrids.at(iPage)->Put(iPos, 1, static_cast<int>(itemTable->bSize));
				vec_item.push_back({ static_cast<BYTE>(iPage+1), static_cast<BYTE>(iPos), static_cast<DWORD>(pGroup->GetVnum(i)), static_cast<BYTE>(pGroup->GetCount(i)) });
				PushNewGrid = false;
				break;
			}
		}
		if (PushNewGrid) {
			pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
			i--;//again
		}
	}
}
#endif

 

can some one help implement this function? dont work for me..

 


item_manager.cpp:1870:6: error: no declaration matches 'void ITEM_MANAGER::GetChestItemList(DWORD, std::vector<SChestDropInfoTable>&, int&)'
 void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item, int& sizee)
      ^~~~~~~~~~~~
In file included from item_manager.cpp:19:
item_manager.h:398:9: note: candidate is: 'void ITEM_MANAGER::GetChestItemList(DWORD, std::vector<SChestDropInfoTable>&)'
  void   GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item);
         ^~~~~~~~~~~~~~~~
In file included from item_manager.cpp:19:
item_manager.h:353:7: note: 'class ITEM_MANAGER' defined here
 class ITEM_MANAGER : public singleton<ITEM_MANAGER>
       ^~~~~~~~~~~~


 

Edited by DomeSs
Link to comment
Share on other sites

14 hours ago, DomeSs said:

can some one help implement this function? dont work for me..

 




item_manager.cpp:1870:6: error: no declaration matches 'void ITEM_MANAGER::GetChestItemList(DWORD, std::vector<SChestDropInfoTable>&, int&)'
 void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item, int& sizee)
      ^~~~~~~~~~~~
In file included from item_manager.cpp:19:
item_manager.h:398:9: note: candidate is: 'void ITEM_MANAGER::GetChestItemList(DWORD, std::vector<SChestDropInfoTable>&)'
  void   GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item);
         ^~~~~~~~~~~~~~~~
In file included from item_manager.cpp:19:
item_manager.h:353:7: note: 'class ITEM_MANAGER' defined here
 class ITEM_MANAGER : public singleton<ITEM_MANAGER>
       ^~~~~~~~~~~~


 

 

 

His frunction has 3 parameters but only 2 are used, so I just removed the 3'th parameter.

In addition he is using c++14 that has std::unique_ptr and c++11 doesn't, so I googled it and found that template function.

Enjoy.

#ifdef ENABLE_SHOW_CHEST_DROP
#include "../../libgame/include/grid.h"

template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
    return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item)
{
    const auto pGroup = GetSpecialItemGroup(dwChestVnum);
    if (!pGroup)
        return;
    std::vector<std::unique_ptr<CGrid>> pGrids;
    pGrids.emplace_back(make_unique<CGrid>(15, 5));

    for (int i = 0; i < pGroup->GetGroupSize(); i++) {
        const auto itemTable = GetTable(pGroup->GetVnum(i));
        //pass if exp, yang or duplicate item
        if (!itemTable || !itemTable->dwVnum || itemTable->dwVnum < 3 || std::find_if(vec_item.begin(), vec_item.end(), [&pGroup, &i](const TChestDropInfoTable& data) -> bool { return static_cast<DWORD>(pGroup->GetVnum(i)) == data.dwItemVnum; }) != vec_item.end())
            continue;
        bool PushNewGrid = true;
        for (size_t iPage = 0; iPage < pGrids.size(); iPage++) {
            const auto iPos = pGrids.at(iPage)->FindBlank(1, static_cast<int>(itemTable->bSize));
            if (iPos >= 0) {
                pGrids.at(iPage)->Put(iPos, 1, static_cast<int>(itemTable->bSize));
                vec_item.push_back({ static_cast<BYTE>(iPage + 1), static_cast<BYTE>(iPos), static_cast<DWORD>(pGroup->GetVnum(i)), static_cast<BYTE>(pGroup->GetCount(i)) });
                PushNewGrid = false;
                break;
            }
        }
        if (PushNewGrid) {
            pGrids.emplace_back(make_unique<CGrid>(15, 5));
            i--;//again
        }
    }
}
#endif

 

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

2 hours ago, Drow said:

 

 

His frunction has 3 parameters but only 2 are used, so I just removed the 3'th parameter.

In addition he is using c++14 that has std::unique_ptr and c++11 doesn't, so I googled it and found that template function.

Enjoy.


#ifdef ENABLE_SHOW_CHEST_DROP
#include "../../libgame/include/grid.h"

template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
    return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item)
{
    const auto pGroup = GetSpecialItemGroup(dwChestVnum);
    if (!pGroup)
        return;
    std::vector<std::unique_ptr<CGrid>> pGrids;
    pGrids.emplace_back(make_unique<CGrid>(15, 5));

    for (int i = 0; i < pGroup->GetGroupSize(); i++) {
        const auto itemTable = GetTable(pGroup->GetVnum(i));
        //pass if exp, yang or duplicate item
        if (!itemTable || !itemTable->dwVnum || itemTable->dwVnum < 3 || std::find_if(vec_item.begin(), vec_item.end(), [&pGroup, &i](const TChestDropInfoTable& data) -> bool { return static_cast<DWORD>(pGroup->GetVnum(i)) == data.dwItemVnum; }) != vec_item.end())
            continue;
        bool PushNewGrid = true;
        for (size_t iPage = 0; iPage < pGrids.size(); iPage++) {
            const auto iPos = pGrids.at(iPage)->FindBlank(1, static_cast<int>(itemTable->bSize));
            if (iPos >= 0) {
                pGrids.at(iPage)->Put(iPos, 1, static_cast<int>(itemTable->bSize));
                vec_item.push_back({ static_cast<BYTE>(iPage + 1), static_cast<BYTE>(iPos), static_cast<DWORD>(pGroup->GetVnum(i)), static_cast<BYTE>(pGroup->GetCount(i)) });
                PushNewGrid = false;
                break;
            }
        }
        if (PushNewGrid) {
            pGrids.emplace_back(make_unique<CGrid>(15, 5));
            i--;//again
        }
    }
}
#endif

 

Famous thanks ❤️ 

Anyone known bug if box dont have drop game core crashed? 
viz: gdb game.core
 

#1  TrafficProfiler::Report (dwSize=0, byHeader=<optimized out>, dir=TrafficProfiler::IODIR_OUTPUT, this=0x6) at TrafficProfiler.h:59
No locals.
#2  DESC::Packet (this=<optimized out>, c_pvData=0x0, iSize=0) at desc.cpp:470
        buf = <optimized out>
        stName = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
            _M_p = 0xffff9c74 "DomeSs"}, _M_string_length = 6, {_M_local_buf = "DomeSs\000@s\314\024\b\030\224\243@", _M_allocated_capacity = 1701670724}}
#3  0x0813b3d6 in CInputMain::Acce (this=0x0, pkChar=0x0, c_pData=0x0) at input_main.cpp:3126
        pPC = <optimized out>
        sPacket = 0x40a4b800


 

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...
  • Premium
On 12/7/2019 at 7:30 PM, Mali61 said:

thanks for topic here is auto adaptable codes and some improvings..

It telling me so much error while i compile it... :D

 

https://metin2.download/picture/HlEAvnioC9wwM8XmH9r38su4U1DZ64sz/.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Love 2
  • Love 1

Ulthar

Link to comment
Share on other sites

  • 1 month later...
  • Premium
6 hours ago, Jimmermania said:

I installed this, no errors, it opens fine, but it doesnt show any item inside the box. Why ?

I have installed without any error, but with my new source, i cannot use cuz of the turkey bonus inventory. xd

Do you have any syserr? Then show me in 
 

Quote

this

 

Ulthar

Link to comment
Share on other sites

  • 1 month later...

hello i have problem with this system every time i go to lunched game and sign up it's exite and on syser say

 networkModule.SetSelectCharacterPhase - <type 'exceptions.ImportError'>:No module named uiChestDrop

iam sure i have this file uichestdrop  on folder root  

 

there are any example how to fixed this ? 

 

Link to comment
Share on other sites

1 hour ago, blackhero said:

hello i have problem with this system every time i go to lunched game and sign up it's exite and on syser say

 networkModule.SetSelectCharacterPhase - <type 'exceptions.ImportError'>:No module named uiChestDrop

iam sure i have this file uichestdrop  on folder root  

 

there are any example how to fixed this ? 

 

Import uiChestDrop

Link to comment
Share on other sites

41 minutes ago, blackhero said:

no i have import 

 

if app.ENABLE_SHOW_CHEST_DROP:
    import uiChestDrop

 

the problem from something other

networkModule.SetSelectCharacterPhase - <type 'exceptions.ImportError'>:No module named uiChestDrop

can't find file ... try to rename

make sure the file name is uiChestDrop not uichestdrop

 

Edited by rares2017
Link to comment
Share on other sites

  • 2 months later...

rename in uichestdrop should go

On 12/7/2019 at 7:30 PM, Mali said:

thanks for topic here is auto adaptable codes and some improvings..

#ifdef ENABLE_SHOW_CHEST_DROP
#include "../../libgame/include/grid.h"
void ITEM_MANAGER::GetChestItemList(DWORD dwChestVnum, std::vector<TChestDropInfoTable>& vec_item, int& sizee)
{
	const auto pGroup = GetSpecialItemGroup(dwChestVnum);
	if (!pGroup)
		return;
	std::vector<std::unique_ptr<CGrid>> pGrids;
	pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
	
	for (int i = 0; i < pGroup->GetGroupSize(); i++) {
		const auto itemTable = GetTable(pGroup->GetVnum(i));
		//pass if exp, yang or duplicate item
		if (!itemTable || !itemTable->dwVnum || itemTable->dwVnum < 3 || std::find_if(vec_item.begin(), vec_item.end(), [&pGroup, &i](const TChestDropInfoTable& data) -> bool { return static_cast<DWORD>(pGroup->GetVnum(i)) == data.dwItemVnum; }) != vec_item.end())
			continue;
		bool PushNewGrid = true;
		for (size_t iPage = 0; iPage < pGrids.size(); iPage++) {
			const auto iPos = pGrids.at(iPage)->FindBlank(1, static_cast<int>(itemTable->bSize));
			if (iPos >= 0) {
				pGrids.at(iPage)->Put(iPos, 1, static_cast<int>(itemTable->bSize));
				vec_item.push_back({ static_cast<BYTE>(iPage+1), static_cast<BYTE>(iPos), static_cast<DWORD>(pGroup->GetVnum(i)), static_cast<BYTE>(pGroup->GetCount(i)) });
				PushNewGrid = false;
				break;
			}
		}
		if (PushNewGrid) {
			pGrids.emplace_back(std::make_unique<CGrid>(15, 5));
			i--;//again
		}
	}
}
#endif

 

does it work with c ++ 11?

Link to comment
Share on other sites

  • 10 months later...
  • 4 weeks later...
  • Premium
On 8/4/2022 at 9:21 AM, ARiniii said:

Hello!

I have a problem with the system:

UNKNOWN HEADER: 215, LAST HEADER: 11(5), REMAIN BYTES: 4, fd: 20

When I want to open the chest but disconnects from the server.

Anyone know what the problem could be?

Packet problems, check out the packet.h files

Ulthar

Link to comment
Share on other sites

  • 1 month later...
On 8/4/2022 at 9:21 AM, ARiniii said:

Hello!

I have a problem with the system:

UNKNOWN HEADER: 215, LAST HEADER: 11(5), REMAIN BYTES: 4, fd: 20

When I want to open the chest but disconnects from the server.

Anyone know what the problem could be?

 Client source packet.h:

Spoiler

GKuoVuP.png

 

Server source packet.h:

Spoiler

xPblyPj.png

maybe

Edited by Metin2 Dev
Core X - External 2 Internal
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.