![]() |
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! |
Theres gotta be SOME asm genius here who knows how this function works :P
|
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 |
Having fun modding my code :P?
|
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 |
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. |
item count should be in the CItem * but don't ask me where.
Inventory size is umm..well...look in UserInfo :P |
Quote:
|
Quote:
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 :D |
mcrabben check your pms pls
|
| All times are GMT. The time now is 21:45. |