Blizzhackers

Return of the Jedi

* Login   * Register    * FAQ    * Search

Join us on IRC: #bh@irc.synirc.net (or Mibbit Web IRC)


MuleFactory


It is currently Sat May 25, 2013 8:55 pm


All times are UTC [ DST ]





Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: ReadProcessMemory - Items on Ground
PostPosted: Mon Apr 02, 2012 4:56 pm 
 
User
User

Joined: Sun Apr 01, 2012 4:49 pm
Hi,

is it possible to get a list of all items that are on the ground via ReadProcessMemory()?
It's surely possible, but did anyone found out the correct addresses for it already?

Cheers,
Kira

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Mon Apr 02, 2012 5:48 pm 
 
User
User

Joined: Sat Mar 17, 2012 5:39 pm
If there's something, it will be in this thread.

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Mon Apr 02, 2012 7:04 pm 
 
User
User

Joined: Tue Mar 01, 2005 8:31 pm
Just check 0x9C or loop through the rooms.....

for(UnitAny* pUnit = pRoom->pUnitFirst;pUnit;pUnit = pUnit->pListNext)
            {
               if(pUnit->dwType ==UNIT_TYPE_ITEM)
               if(pUnit->dwMode == 3 || pUnit->dwMode == 5)
               {
                                        //Do whatever you want
                                         }                                 
                                  }

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 12:55 am 
 
User
User

Joined: Tue Apr 29, 2008 5:10 am
I have tried several different methods, the one I most liked and the easiest to write and configure was watching for specfic 9c information then running separate functions to handle the actual item info, probably best to just use one or the other, I never got that into item/pickit stuff

_________________
d2bot# : viewtopic.php?f=206&t=489091&start=0
Support : irc://irc.synirc.net/d2bs

Im taking computer sience in college right now. Im taking what im learning in school and trying it out on a 12 year old game.

Oh wait sorry. Everyone here just rips everyone off and puts their little twist on a code.

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 9:23 am 
 
User
User

Joined: Sun Apr 01, 2012 4:49 pm
Hey,

thanks for your answers.. but unfortunately I am totaly new to d2 hacking, I never used any of the tools out there etc, so I have no clue what all this is you mentioned.. :(

What are "rooms"? How do I loop trough them?

I am very experienced in developing with C++, that's why I thought I could simply use ReadProcessMemory().. all I need for this is the addresses fo the items - I can try to find them myself and reverse engineer it, but maybe someone did this already :)

Cheers,
Kira

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 1:47 pm 
 
BHDev
BHDev
User avatar

Joined: Mon Jul 13, 2009 5:13 pm
Location: Denmark
Hello kira.
I already did a lot of this stuff in the language autoit, which is pretty easy to convert to c++. Here's an example of what you want to do (converted, not tested):
HANDLE g_hProc;
inline DWORD pread(DWORD address, HANDLE hProc = g_hProc) {
   DWORD temp;
   ReadProcessMemory(hProc,(void*)address, &temp, sizeof(temp),NULL);
   return temp;
}

struct Item
{
   DWORD pAddress;
   DWORD dwClassId;
   DWORD dwUnitId;
};

typedef std::vector<Item> ItemList;

ItemList ItemsOnGround() {
   DWORD Unit = 0; //UnitAny * Unit;
   ItemList ret;
   Item cur_item;
   //This for() loop iterates through all room2's visible
   for(DWORD ptRoomOther = pread(pRoom2First +
                  pread(pLevel +
                  pread(pRoom2 +
                  pread(pRoom1 +
                  pread(pPath +
                  pread(povUnit)))))); //Room2* ptRoomOther = Unit->pPath->pRoom1->pRoom2->pLevel->pRoom2First
      ptRoomOther;
      ptRoomOther = pread(ptRoomOther + pRoom2Next)) //ptRoomOther = ptRoomOther->pRoom2Next
   {
      //This for() loop iterates through all units in current room2
      for(Unit = pread(pUnitFirst + pread(pRRoom1 + ptRoomOther));
         Unit;
         Unit = pread(Unit + 0xE8)) // Unit = Unit->pListNext
      {
         if(pread(Unit) == UNIT_ITEM) // if(unit->dwType == UNIT_ITEM)
         {
            //Current unit is an item. store some information about it in the return array
            cur_item.dwClassId = pread(Unit + 0x04);
            cur_item.pAddress = Unit;
            cur_item.dwUnitId = pread(Unit + 0x0C);
            ret.push_back(cur_item);
         }
      }
   }
   return ret;
}

You can find original code for this in the library i posted here:
viewtopic.php?f=182&t=485262
specifically, you want to go to \libs\common\units.au3
constants for the code i posted can be found in \libs\autumn\au.vars.au3

Good luck :)

_________________
Autumn, Itemdumper & D2ExtraImage

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 1:54 pm 
 
User
User

Joined: Tue Mar 01, 2005 8:31 pm
Look at the example code and the structs from d2bs.
Also have a look at the constants header.

lol I forgot the room part :facepalm:
for (LPROOM1 pRoom = *p_D2CLIENT_PlayerUnit->pAct->pRoom1; pRoom; pRoom = pRoom->pRoomNext)
{

    for(UnitAny* pUnit = pRoom->pUnitFirst;pUnit;pUnit = pUnit->pListNext)
            {
               if(pUnit->dwType ==UNIT_TYPE_ITEM)
               if(pUnit->dwMode == 3 || pUnit->dwMode == 5)
               {
                                        //Do whatever you want
               }                                 
                                 
             }
}

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 4:50 pm 
 
User
User

Joined: Tue Apr 29, 2008 5:10 am
you can also refer here viewtopic.php?p=2493606#2493606 for information handling item packets, vampire has given you exactly what you need to do to get started though. one more thing you can refer to contants.h file, in any of the public sources available here for more item stuff regarding location/positioning/item type etc

_________________
d2bot# : viewtopic.php?f=206&t=489091&start=0
Support : irc://irc.synirc.net/d2bs

Im taking computer sience in college right now. Im taking what im learning in school and trying it out on a 12 year old game.

Oh wait sorry. Everyone here just rips everyone off and puts their little twist on a code.

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 5:03 pm 
 
User
User

Joined: Sun Apr 01, 2012 4:49 pm
Shaggi, your example code helped me a lot, thanks! This was exactly what I was looking for :)

Do you know if a ReadProcessMemory() is detected by warden at the moment? From what I googled I think it is not, but this informations seems to be very old..

Kira

EDIT: Oh and I can't find what "povRoom" is, would you tell me? :)

Top
 Profile  
 Post subject: Re: ReadProcessMemory - Items on Ground
PostPosted: Tue Apr 03, 2012 5:48 pm 
 
BHDev
BHDev
User avatar

Joined: Mon Jul 13, 2009 5:13 pm
Location: Denmark
Shaggi, your example code helped me a lot, thanks! This was exactly what I was looking for :)

Do you know if a ReadProcessMemory() is detected by warden at the moment? From what I googled I think it is not, but this informations seems to be very old..

Kira

EDIT: Oh and I can't find what "povRoom" is, would you tell me? :)
No problem :) It isn't, and you probably shouldn't worry about it.. :P

Do you mean povUnit? that should be the same as p_D2CLIENT_PlayerUnit + D2CLIENT_OFFSET:
Global Const $PlayerUnit = 0x6FBCD050

_________________
Autumn, Itemdumper & D2ExtraImage

Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron