equipping items to a user's account

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
xwhitchx
Forum Commoner
Posts: 38
Joined: Mon Jun 21, 2010 4:30 pm

equipping items to a user's account

Post by xwhitchx »

ok i have a browser game that im working on, and i would like to know how to code something so i can equipped items to the user so there stats will go up or down based off the item. my datebase is in mysql. so if anyone has any input on this plz let me know, or point me the right way.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: equipping items to a user's account

Post by superdezign »

You should probably have a database table for the characters, a table for the equipment, and a table that relates the two.

Code: Select all

`characters`
ID | Name | Level | STA | STR | DEX | INT

`equipment`
ID | Slot | Defense

`character_equipment`
Character_ID | Equipment_ID
It is up to your application to calculate the implied stats (i.e. attack, defense, etc.) based off of the combination of the character stats and the equipment. It is also up to your application to ensure that a character does have 2 items in the same slot, etc.
Post Reply