Solved How to understand what I need to add to the DB?

Status
Not open for further replies.

Caves

The Annoying Newbie
Premium
Joined
Sep 13, 2024
Messages
67
Solutions
2
Reaction score
30
Points
18
So I've added the Item Lock feature.
It works on the client side while I'm logged in but when I reconnect the Item Lock status disappears. So I think it has to be added to the DB.
I don't have any knowledge on Database stuff but I'm trying to understand what needs to be added can someone please break it down to a total noob level?
Can somebody direct me or give me a hint on what I need to add/do and where so that for the next other features that I add I can do it on my own.

What I've understood so far is that the Item Lock feature touches the DbManagerFun.cpp and DbManagerSave.cpp

From DbMngFun:
Hey There!
Please login and(or) register to see this awesome content today.

From DbMngSave: in line
Hey There!
Please login and(or) register to see this awesome content today.

What I have tried so far:
So I've been doing some trial and error and tried adding IsLocked and bIsLocked to some db tables. But I have no luck in making it save.
I'm not sure if I'm properly adding them or if I am in the right tables but every time I do, I restart the sql server.

I tried adding to the bottom of these tables BASE_VALUE_TBL, ITEM_REMOVE_TBL, and ITEM_SEND_TBL
1727648972017.png


Thank you!
 
Last edited:
I'm posting to see if I can read your full message. And then I'll edit this reply.
7.png
 
I assume you've already changed the CDbManager::GetOneItem and CDbManager::SaveOneItem functions to 'serialize' more item attributes.
If I remember correctly, this 'serialized string' that represents the player's inventory is passed to the CHARACTER_STR stored procedure in the database and sometimes directly by queries that access INVENTORY_TBL and INVENTORY_EXT_TBL tables.

Double check if CHARACTER_STR is iprepared to receive this new size of data (in argment 'im_Inventory') , and also to record a larger amount in the above-mentioned tables.
also, 'm_extInventory' and 'm_Inventory' columns need to support this larger amount of characters. (n extra characters * n inventory max size).

It is also good to see if the new attribute is being serialized/deserialized in the same position in the string.
 
I assume you've already changed the CDbManager::GetOneItem and CDbManager::SaveOneItem functions to 'serialize' more item attributes.
If I remember correctly, this 'serialized string' that represents the player's inventory is passed to the CHARACTER_STR stored procedure in the database and sometimes directly by queries that access INVENTORY_TBL and INVENTORY_EXT_TBL tables.

Double check if CHARACTER_STR is iprepared to receive this new size of data (in argment 'im_Inventory') , and also to record a larger amount in the above-mentioned tables.
also, 'm_extInventory' and 'm_Inventory' columns need to support this larger amount of characters. (n extra characters * n inventory max size).

It is also good to see if the new attribute is being serialized/deserialized in the same position in the string.

Yes, I have added what was in the GetOneItem and SaveOneItem to these

Hey There!
Please login and(or) register to see this awesome content today.
Hey There!
Please login and(or) register to see this awesome content today.

And so after looking into what you said I tried to look into the db files of the source that I got it from and is it safe to say that it seems like it doesn't have anything in it to have the db for the lock in it?
Hey There!
Please login and(or) register to see this awesome content today.
 
Yes, I have added what was in the GetOneItem and SaveOneItem to these

Hey There!
Please login and(or) register to see this awesome content today.
Hey There!
Please login and(or) register to see this awesome content today.

And so after looking into what you said I tried to look into the db files of the source that I got it from and is it safe to say that it seems like it doesn't have anything in it to have the db for the lock in it?
Hey There!
Please login and(or) register to see this awesome content today.
Apparently your DB already uses the parameters to store the inventory with varchar(max)

There is a mismatch in the order of attributes in 'serialization/deserialization'.
Since you are storing bIsLocked after GetLook (ModelChange) ...you also need to retrieve those values em same order:
Hey There!
Please login and(or) register to see this awesome content today.
 
  • Like
Reactions: Caves
Solution
Apparently your DB already uses the parameters to store the inventory with varchar(max)

There is a mismatch in the order of attributes in 'serialization/deserialization'.
Since you are storing bIsLocked after GetLook (ModelChange) ...you also need to retrieve those values em same order:
Hey There!
Please login and(or) register to see this awesome content today.
Thank you for helping with my problem.

Summary:
It turns out that nothing is missing from the db but rather the problem was with how the data was being stored and being pulled out.
Simply aligning the order in which the data came went in and came out was the solution.

I want to thank @Fliperworld for this additional knowledge.

Thank you!!
 
  • Like
Reactions: Cikk and Kia
Status
Not open for further replies.