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
  • 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 2
Link to comment
  • 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
  • 3 months later...
  • 1 month later...

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
  • 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
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
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\[email protected]\314\024\b\030\224\[email protected]", _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
  • 4 weeks later...
  • 4 months later...
  • VIP
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

 

Hidden Content

    Give reaction to this post to see the hidden content.

  • Metin2 Dev 1
  • Love 1
Link to comment
  • 1 month later...
  • VIP
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

 

Link to comment
  • 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
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
2 hours ago, rares2017 said:

Import uiChestDrop

no i have import 

 

if app.ENABLE_SHOW_CHEST_DROP:
    import uiChestDrop

 

the problem from something other

Link to comment
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

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


×
×
  • 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.