01-21-2014, 03:29 AM
|
team canada
|
|
Join Date: Jul 2004
Location: Canada
Posts: 5,200
|
|
Here's how I would do it:
Characters
ID - Account
1 - Toran
2 - Toran2
Index on Account
Items
ID - Itemname
1 - Apple
2 - Orange
3 - Banana
4 - Grape
Index on Itemname
CharacterItems
ID - CharacterID - ItemID - Quantity
1 - 1 - 1 - 2
2 - 1 - 2 - 1
3 - 2 - 3 - 4
4 - 2 - 4 - 3
Index on CharacterID
Index on ItemID
Note: ID columns are auto-increment columns. So they just go 1, 2, 3, 4, etc. as you add rows to the table.
On login/character load, you would do a query to load all their item information with at least query and store it in a clientr flag for quick-reference.
When you're making changes (i.e. adding items), you would make them to the database first then reflect that in their clientr flags. |
|
|