Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2
You last visited: Today at 06:49

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with m_GroundItemInstanceMap

Discussion on Help with m_GroundItemInstanceMap within the Metin2 forum part of the Popular Games category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2019
Posts: 24
Received Thanks: 3
Question Help with m_GroundItemInstanceMap

Hello guys, I'm trying to iterate over all items on the ground and to do that i tried something like this:

Code:
typedef std::map<DWORD, DWORD*> _GroundItem;
_GroundItem GroundItem = *(_GroundItem*)(Start of the map);

_GroundItem::iterator it = GroundItem.begin()
DWORD itemVid = it->first;
But that did not work. Someone can help? I'm almost 100% sure that the adress is right...
ozuromo is offline  
Old 05/10/2021, 10:35   #2
 
elite*gold: 0
Join Date: Feb 2015
Posts: 26
Received Thanks: 8
You have to iterate over the map, something like:

for ( auto itor = groundItems.begin(); itor != groundItems.end(); itor++) {
DWORD itemID = itor->first;
bla bla bla;
}

If you have a struct for the items, use that as well to retrieve valid data. It all depends how you retrieved your map pointer.

Sorry for the messy coding style, I'm writing from the phone.
Aeryas is offline  
Thanks
1 User
Old 05/10/2021, 11:19   #3
 
elite*gold: 0
Join Date: Dec 2014
Posts: 442
Received Thanks: 211
assuming you have a C++17 compiler
Code:
for (auto const& [vnum, item] : _GroundItem) {
    // do your **** here
}
_asm is offline  
Thanks
1 User
Old 05/10/2021, 17:07   #4
 
MrCrisp's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 747
Received Thanks: 184
Regarding the address of the std::map: It's almost always at Instance+0x4 bytes. Instance+0x8 will get you the current size of the map, as far as I can remember.
MrCrisp is offline  
Thanks
1 User
Old 05/11/2021, 04:23   #5
 
elite*gold: 0
Join Date: Jul 2019
Posts: 24
Received Thanks: 3
Question

Quote:
Originally Posted by MrCrisp View Post
Regarding the address of the std::map: It's almost always at Instance+0x4 bytes. Instance+0x8 will get you the current size of the map, as far as I can remember.
Yeah I have this exact address but when I try to iterate how __asm said my game just crashes... I'm in this for some time now haha ;'(
ozuromo is offline  
Old 05/11/2021, 12:41   #6
 
MrCrisp's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 747
Received Thanks: 184
If you only add 0x4 bytes, you are accessing the vtable. Dereference the pointer and add another 0x4 bytes. Then dereference again and you should get the map pointer.
MrCrisp is offline  
Thanks
1 User
Old 05/11/2021, 23:36   #7
 
elite*gold: 0
Join Date: Jul 2019
Posts: 24
Received Thanks: 3
Quote:
Originally Posted by MrCrisp View Post
If you only add 0x4 bytes, you are accessing the vtable. Dereference the pointer and add another 0x4 bytes. Then dereference again and you should get the map pointer.
If you only add 0x4 bytes, you are accessing the vtable:
Code:
itemInstance + 0x4
Dereference the pointer and add another 0x4 bytes:
Code:
*(DWORD*)(itemInstance + 0x4) + 0x4
Then dereference again and you should get the map pointer:
Code:
mapType* mapPointer = (mapType*)(*(DWORD*)(*(DWORD*)(itemInstance + 0x4) + 0x4));
That just crashes my game... Just to clarify I have other functions and they work just fine, this map is the only thing that I can't get to work.
ozuromo is offline  
Reply


Similar Threads Similar Threads
[HELP]HELP HELP HELP[HELP]
09/23/2013 - Facebook - 3 Replies
GUYS ^^ THIS IS A HELP THREAD NOT REQUEST THREAD BUT YOU CAN CONSIDER IT AS REQUEST THREAD DOES ANYONE OF YOU KNOW THE AUTO SUBMIT PHP CODE? THANKS!
[HELP][HELP][HELP][HELP]!!
09/11/2009 - Soldier Front - 3 Replies
Microsoft Visual C++ Run time error! :(:( **HELP ME PLEASE!!***
help help help help help help
06/28/2009 - Say Hello - 0 Replies
how i can dowmload Mangos 6385 ??????????????????????????????????? please give me the limk i can't see that i know it is in www.elitepvpers.com/.../153716-release-mangos-relea ses-blackscorpian-win32-2-4-3-a.html - but give me link sent it to my email plz



All times are GMT +1. The time now is 06:50.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.