Page 1 of 1

Bag ID's in character_items

Posted: Fri Jan 02, 2009 6:16 pm
by John Adams
LE, what is the logic behind the bag_id value? is it random, or some method to it? I am trying to create starting_items with the food/water inside LE's huge sack (grin) but wanted to make sure any value I put would work without breaking anything.

I'm trying to back-fill starting_items to existing characters and not having any luck with things showing up in bag_id 1, slot 0 and 1 (the food and water). I've done this before, I just can't seem to recall how I did it. :D

Re: Bag ID's in character_items

Posted: Fri Jan 02, 2009 6:41 pm
by LethalEncounter
If you delete all the entries from character_items and then set up starting_items as you want, the next time the player logs in they will automatically get the items as specified in your starting_items table. However, to answer your original question the bag_id field is the id of the bag that the particular item is in. The bag_id field is 0 if it is a bag and it is in an inventory slot. The field can also be negative in special cases such as bank slots.

Re: Bag ID's in character_items

Posted: Fri Jan 02, 2009 6:52 pm
by John Adams
Ahh, maybe that's what it was. Nuke the character_items and let starting_items just do it's magic.

I was asking where the actual bag_id value comes from... if that is randomly generated or not, because it seems to be all over the map. For instance, my LE bag was bag_id 18 before the wipe. Now, that same bag in the same slot is bag_id 80744, neither of which are the item_id of the bag itself. Does that make more sense?

Either way, I won't bother forcing anything into a slot with SQL, I'll let World handle the job. :)

Re: Bag ID's in character_items

Posted: Fri Jan 02, 2009 7:23 pm
by LethalEncounter
Bah, listen to what I'm saying :P

The value of the bag_id field is the ID in the character_items table of the bag.

Examples:

Code: Select all

id   	 type   	 account_id   	 char_id   	 bag_id   	 slot   	 item_id   	 creator   	 condition_   	 attuned   	 count   	 max_sell_value
1    NOT-EQUIPPED    0    750    0    0    1    LethalEncounter  	100  	0  	1  	0
2 	NOT-EQUIPPED 	0 	750 	1 	0 	40198 	  	                100 	0 	20 	0
3 	NOT-EQUIPPED 	0 	750 	1 	1 	39908 	  	                100 	0 	20 	0

4 	NOT-EQUIPPED 	0 	396 	0 	0 	1 	LethalEncounter 	100 	0 	1 	0
5 	NOT-EQUIPPED 	0 	396 	4 	0 	40198 	  	                100 	0 	20 	0
6 	NOT-EQUIPPED 	0 	396 	4 	1 	39908 	  	                100 	0 	20 	0

Look at the entry with the ID of 1 in the first example. That is the bag and it is in the first slot of the inventory (bag_id is 0 so in inventory, and slot is 0 so it is the first slot). Now look at the entries with IDs of 2 and 3. The 1 in the bag_id field means that the bag they are in is the entry in the character_items table with the id of 1.

The second example is the same, the 4 is the unique id of the bag, which is why that is in the bag_id field for all items inside the bag.

Re: Bag ID's in character_items

Posted: Fri Jan 02, 2009 7:47 pm
by John Adams
Heh, believe it or not, I already get that part.

But nevermind. What I was looking for is unnecessary anyway, so I will stop trying to explain my twisted questions =)