It is more about the SQL queries than it is when coding the PHP.
Have you tried to read the code yet?
-
- $item_mall->setlog(true); // enable/disable to create an information stream of who bought what
- $item_mall->setaccount_id(1); // set the users account ID
- $item_mall->setalevel(100); // set the users access level
-
I'll try to help you change the code, but since I don't have the projects compiled on my computer I can not guarantee it will work.
As you can see you have the
$item_mall->setaccount_id(1) < if put your character ID in there, we are pass most of the trouble already. the only thing that is left is to change the SQL queries.
If you found a way to get the current character (I do not suggest it by using a $_GET variable). We can change the SQL queries
Find the function
decreaseMoney($type,$amount) -
- if ( $type == 'D' ) {
- $sql = "SELECT donation FROM accounts WHERE id=%d;";
- } else {
- $sql = "SELECT zulystorage FROM accounts WHERE id=%d;";
- }
-
You can change the 'D' to 'R' for reborn poins. if that suits you of course... or leave it there to keep it simple.
Now we can change some SQL queries Whohooo!!!
-
- if ( $type == 'D' ) {
- $sql = "SELECT reborn_points FROM characters WHERE id=%d;";
- } else {
- $sql = "SELECT zuly FROM characters WHERE id=%d;";
- }
-
When we scroll down the code we find in the same function the following lines
-
- if ( $type == 'D' ) {
- $sql = "UPDATE accounts SET donation=donation-%d WHERE id=%d AND online=1;";
- } else {
- $sql = "UPDATE accounts SET zulystorage=zulystorage-%d WHERE id=%d AND online=1;";
- }
-
Here we have to change it to (maybe you know what to change already Go for it!)
-
- if ( $type == 'D' ) {
- $sql = "UPDATE characters SET reborn_points=reborn_points-%d WHERE id=%d;";
- } else {
- $sql = "UPDATE characters SET zuly=zuly-%d WHERE id=%d;";
- }
-
Notice that a player can now purchase items while still being in game.. This might a user to abuse the item mall...
Now the it will become tricky adding the item to a user's inventory, since the account id is not available anymore...
scroll down to the function
addItemToCarfind the SQL querie
-
- $sql = "INSERT INTO storage (owner,itemnum,itemtype,refine,slotnum,socketed,count) VALUES (%d,%d,%d,%d,%d,%d,%d);";
-
to
-
- $sql = "INSERT INTO items (owner,itemnum,itemtype,refine,slotnum,socketed,count) VALUES (%d,%d,%d,%d,%d,%d,%d);";
-
Phew lucky storage and items use the same database layout (WIN ^^)
Now we continue, Phew hard word take a break, get something to eat or drink before we contune
****
* Some elevator music in the meanwhile *
***
Now we scroll down to the next function
getFreeSlot-
- $sql = "SELECT slotnum FROM storage WHERE owner=%d;";
-
We change this to
-
- $sql = "SELECT slotnum FROM items WHERE owner=%d;";
-
A little bit further in the same function we find the following for loop
for ( $x = 159; $x >= 1; $x--) { I am not sure about the number
159 ... Since you're using the inventory, the numbers are different.... so you'll have to find it yourself, or a friendly person can help me out here
And that should be about it
Good luck