PDA

View Full Version : [QUESTION]CCreature::DeleteItemInInventory()


HongK
28.11.2006, 18:45
Mcrabben maybe you or someone else could answer this question ...

Basically I'm trying to figure out the way the arguments are passed to this function to delete an item from a players inventory.

What I've gathered so far is that it takes two arguments before the call which I'm guessing are a pointer to the item you want to delete and a value which is the number of that item to delete. Previous calls to that function in the server have the same instructions mov ecx, ebx before the call which should be the pointer to the user struct.

I've gotten it to work, but I get a server error with ObjectDB complaining of an undefined classID followed by another error saying the item does not exist.

Has anyone had any luck using this function or does anyone know any more about the arguments it takes etc? Thanks!

HongK
28.11.2006, 20:08
so I'm wondering if maybe the function doesn't take a pointer to the item, but just accepts the item value itself as a DWORD... :O

In CCreature::AddItemToInventory(int nItemClassID, int nCount, bool isPick)

it takes 2 ints and a bool rather than pointers

mcrabben7
28.11.2006, 20:18
i'd venture $20 on the 2nd one. Want a good way to check? Olly debug, or go there in IDA/Olly and compare the argument passing code for both. If the passing is the same for both i'd go with that.

A lot of l2server functions take more parameters than ncsoft wrote in the debug messages. Don't trust the strings, trust the assembly :)

HongK
28.11.2006, 21:26
i'd venture $20 on the 2nd one. Want a good way to check? Olly debug, or go there in IDA/Olly and compare the argument passing code for both. If the passing is the same for both i'd go with that.

A lot of l2server functions take more parameters than ncsoft wrote in the debug messages. Don't trust the strings, trust the assembly :)

yea I did check them in the assembly .. all local calls to the function tend to push two registers and move ebx to ecx which is typical for getting a pointer to the user struct ... I was confused because I was passing it a pointer to the item and it was executing successfully, but it was erroring in the server console with bad item id .. So I'm guessing it just takes the straight value ..

and yea those debug messages are tricky not showing you all the parameters the functions take >< It's kind of annoying :D

HongK
28.11.2006, 23:40
haha I owe you $20 .. the item was just a value and not a pointer

thanks for your help :P

Nevyn
01.12.2006, 02:27
HongK Its nice seeing you going through all this :)
Wish you goodluck in your continued studying.

HongK
01.12.2006, 14:28
Well you guy's project was just the catalyst I needed. The great thing about it all is that you can take what you learn from it and go do other things not related to lineage 2. To me, that's what you should take away from PP. People came here with a desire to create a better server from c1 and they should leave with the ability to not only be able to do that, but to have the skills to move on to bigger and better things.

mcrabben7
02.12.2006, 06:35
You will never know the sweat, blood, and tears poured into that code ^^ it is of course great to see you coding C2 stuff in, and that's awesome.

Btw, did you ever fix the small CP bug I left behind? Just curious.

You are the only person I know who's really taken something big away from it, but, that's enough for me I guess. We all move on to bigger and better things, anyways :)