Troubles with the SalvageItem function

03/11/2019 20:59 Term!nX#1
Hello,

I am having some troubles with the salvage item function. I did some amateur reversing in olly and actually managed to successfully call the salvage item function but then without changing anything, the function began to crash the game. I was not able to recreate the in-game scenario in which my function worked and in which it crashed the game. Did not change much in-game either. Just restarted the game once.

If you look at the attached picture:
I suspected the salvage item function to be @ 0x800820, so I loaded the registers with the assumed necessary values and did some trial and error tryouts and actually got it working - until it began to crash the game (I could not identify a possible reason for this, I suspect a game restart).

EAX always has a pointer to a 0 - I do not know the purpose.
ECX always seems to be 9, I do not know why.
EDX and EBX contain the itemId of the salvageKit
EDI contains the itemId of the item that is about to be salvaged

I also went up in the call tree but I could not get the function to work again.
Can anyone give me some insight on why I am failing to get this particular function to work? Identing, Selling, Moving, Casting, Targeting - it all works fine, but this salvage thing with its random functionality is driving me nuts.

Yours sincerely
03/13/2019 20:08 Term!nX#2
Update:

So I figured that EAX would be some pointer to something, I do not know really. I managed to find a pointer which would be @ baseAdress A52230 + 0x158 + 0xB8, so it seems to be somewhat related to item management (+0x158 indicates this to me).
It makes the function work, but the weird thing is, I have to manually salvage an item once beforehand, otherwise it will make the game crash.

1) does anyone know the destination of the pointer in EAX? Its purpose?
2) why do I have to manually salvage an item once, before I can call the salvage function from my script engine without crashing the game?

Thank you very much in advance for any insight
03/19/2019 07:18 phat34#3
What your looking for is already in the asm of the gwa2... look closer... and even better follow closely to a good script that is salvaging things and you will see the missing values you are looking for.