Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 29.11.2006, 05:56   #1
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default CInventory::GetAdenaAmount() hehehe

So did you guys ever figure out how to use this function? I've tried everything but I can't get it to return the adena amount. It looks like it has a test within the function that DOES actually return the value. This instruction right here is where it stores the value:

0048504E MOV ESI, DWORD PTR DS:[ECX+70]

then later

MOV EAX, ESI

...
retn


For some reason it never makes it to TEST ESI, ESI and you're left with an XORed EAX.

If you figured this out could you shoot me a pm :P

Thanks!
HongK is offline  
Old 30.11.2006, 00:34   #2
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

Theres gotta be SOME asm genius here who knows how this function works :P
HongK is offline  
Old 30.11.2006, 02:44   #3
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

woot nevermind figured it out :P

The reason I was constantly getting 0 was that I was calling this function on enterworld because it was easier to output to file what I was debugging when I logged in rather than on another event .. The problem was that on enterworld my inventory had not been populated yet ROFL

now I can add recipe shops yay

ps. mod can delete this thread if needed
HongK is offline  
Old 30.11.2006, 08:24   #4
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

Having fun modding my code :P?
mcrabben7 is offline  
Old 30.11.2006, 14:42   #5
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

I've added a few new functions to it that you guys hadn't done or finished. Overall your code has been an excellent tutorial. Like I've said previously, that share was probably the best thing ever to come out of PP. If you learn it and understand it, the possibilities on how you can apply it elsewhere are limitless. Function hijacking has always been something I was interested in, but never really had a good foundation on. So thanks to you, I've really advanced myself to a new level. I'm forever grateful to you for that :P

BTW from your code hehe:

// HOW TO USE THIS FUNCTION ? ?
CInventory::GetAdenaAmount()
adena = getUserAdena(pUser or pData ??); // TODO
HongK is offline  
Old 30.11.2006, 16:39   #6
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

So another interesting problem to solve is checking the amount of ANY item in your inventory. There is a function called GetTotalCount but I don't think it's used for anything other than to check when you die and drop an item. The npc server has ownitemcount, but theres no way to call that from the dll.

So what about modifying GetAdenaAmount to check for an item specified by you, rather than just checking for adena?

Here's where it does the check:

0048503D |. 8378 1C 39 |CMP DWORD PTR DS:[EAX+1C],39

First thing that came to mind was oh I'll just hook that line and change 39 to whatever item I want to check for .. Problem there is that it's only a byte and you may want to check for items that are larger than one byte. So we can't overwrite that address with a value thats larger than a byte. Ok, so what about hooking that address and then redirecting to a function written in the dll that will call another function elsewhere that does nothing more than use that same line except with a comparison of an integer rather than just a byte, then return. After that it could be re-written to what it was before the call.

The OTHER interesting problem is if you were to overwrite the comparison to adena, what happens if another person is doing something in game that needs to check their adena and they do it at the same time you triggered it? Say I wanted to compare how many animal bones I had in inventory. Well theoretically it would overwrite 39 with the hex id of animal bone and then the other person would get an error saying he doesn't have enough adena because its checking for animal bones instead lol

Anyway, just thinking out loud.
HongK is offline  
Old 30.11.2006, 16:59   #7
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

item count should be in the CItem * but don't ask me where.

Inventory size is umm..well...look in UserInfo :P
mcrabben7 is offline  
Old 30.11.2006, 17:58   #8
HF
Архивный участник
 
Join Date: Aug 2005
Posts: 1,531
Default

Quote:
Originally Posted by HongK View Post
...

// HOW TO USE THIS FUNCTION ? ?
CInventory::GetAdenaAmount()
adena = getUserAdena(pUser or pData ??); // TODO
have you a full list for all c4 func? I mean npc (ai.obj) and skills (skilldata) functions.
HF is offline  
Old 30.11.2006, 19:07   #9
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

Quote:
Originally Posted by HF View Post
have you a full list for all c4 func? I mean npc (ai.obj) and skills (skilldata) functions.
Oh I'm not doing this for C4.. This is all from the C1 server

I'm sure if you asked mcrabben7 tho he has a list of a number of functions for c4 since they are modding to C5
HongK is offline  
Old 02.12.2006, 22:16   #10
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

mcrabben check your pms pls
HongK is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:29.