From The Mana World
(updated tablespecs to use sqltable templates)
Line 21: Line 21:
* level
* level
** describes the user rights in the game (10 = normal user, 50 = gm, 99 = administrator)
** describes the user rights in the game (10 = normal user, 50 = gm, 99 = administrator)


=== Characters ===
=== Characters ===
{|border=1 cellpadding=5 cellspacing=0
 
|+ tmw_characters
{{beginsqltable|tmw_characters}}
|-bgcolor=lightgrey
{{sqltablerow|id            | INTEGER    | PRIMARY KEY      |                | unique id of the character                             }}
! Column name !! Datatype !! Nullable !! References !! Description
{{sqltablerow|user_id        | INTEGER    | NOT NULL        | tmw_accounts.id | id of the owner                                         }}
|-
{{sqltablerow|name          | TEXT        | NOT NULL UNIQUE  |                | name of the character                                   }}
|id            || INTEGER    || PRIMARY KEY      ||                || unique id of the character
{{sqltablerow|gender        | INTEGER    | NOT NULL        |                | gender of the character (0/1)                           }}
|-                                                                   
{{sqltablerow|hair_style    | INTEGER    | NOT NULL        |                | id of the hair sprite                                   }}
|user_id        || INTEGER    || NOT NULL        || tmw_accounts.id || id of the owner
{{sqltablerow|hair_color    | INTEGER    | NOT NULL        |                | id of the hair color                                   }}
|-                                                                   
{{sqltablerow|level          | INTEGER    | NOT NULL        |                | experience level of the character                       }}
|name          || TEXT        || NOT NULL UNIQUE  ||                || name of the character
{{sqltablerow|char_pts      | INTEGER    | NOT NULL        |                | available points to raise attributes                   }}
|-                                                                   
{{sqltablerow|correct_pts    | INTEGER    | NOT NULL        |                | available points to lower attributes and regain char_pts}}
|gender        || INTEGER    || NOT NULL        ||                || gender of the character (0/1)
{{sqltablerow|money          | INTEGER    | NOT NULL        |                | GP of the character                                     }}
|-                                                                   
{{sqltablerow|x              | INTEGER    | NOT NULL        |                | x position of the character on the map                 }}
|hair_style    || INTEGER    || NOT NULL        ||                || id of the hair sprite
{{sqltablerow|y              | INTEGER    | NOT NULL        |                | y position of the character on the map                 }}
|-                                                                   
{{sqltablerow|map_id        | INTEGER    | NOT NULL        | tmw_maps.id    | id of the current map the character is located         }}
|hair_color    || INTEGER    || NOT NULL        ||                || id of the hair color  
{{sqltablerow|str            | INTEGER    | NOT NULL        |                | strength of the character                               }}
|-                                                                   
{{sqltablerow|agi            | INTEGER    | NOT NULL        |                | agility of the character                               }}
|level          || INTEGER    || NOT NULL        ||                || experience level of the character
{{sqltablerow|dex            | INTEGER    | NOT NULL        |                | dexternity of the character                             }}
|-                                                                   
{{sqltablerow|vit            | INTEGER    | NOT NULL        |                | vitality of the character                               }}
|char_pts      || INTEGER    || NOT NULL        ||                || available points to raise attributes
{{sqltablerow|int            | INTEGER    | NOT NULL        |                | intelligence of the character                           }}
|-                                                                   
{{sqltablerow|will          | INTEGER    | NOT NULL        |                | willpower of the character                             }}
|correct_pts    || INTEGER    || NOT NULL        ||                || available points to lower attributes and regain char_pts
{{sqltablerow|unarmed_exp    | INTEGER    | NOT NULL        |                | Experience: unarmed                                     }}
|-                                                                   
{{sqltablerow|knife_exp      | INTEGER    | NOT NULL        |                | Experience: knifes                                     }}
|money          || INTEGER    || NOT NULL        ||                || GP of the character
{{sqltablerow|sword_exp      | INTEGER    | NOT NULL        |                | Experience: swords                                     }}
|-                                                                   
{{sqltablerow|polearm_exp    | INTEGER    | NOT NULL        |                | Experience: polearms                                   }}
|x              || INTEGER    || NOT NULL        ||                || x position of the character on the map
{{sqltablerow|staff_exp      | INTEGER    | NOT NULL        |                | Experience: staffs                                     }}
|-                                                                   
{{sqltablerow|whip_exp      | INTEGER    | NOT NULL        |                | Experience: whips                                       }}
|y              || INTEGER    || NOT NULL        ||                || y position of the character on the map
{{sqltablerow|bow_exp        | INTEGER    | NOT NULL        |                | Experience: bows                                       }}
|-                                                                   
{{sqltablerow|shoot_exp      | INTEGER    | NOT NULL        |                | Experience: shooting                                   }}
|map_id        || INTEGER    || NOT NULL        || tmw_maps.id    || id of the current map the character is located  
{{sqltablerow|mace_exp      | INTEGER    | NOT NULL        |                | Experience: maces                                       }}
|-                                                                   
{{sqltablerow|axe_exp        | INTEGER    | NOT NULL        |                | Experience: axes                                       }}
|str            || INTEGER    || NOT NULL        ||                || strength of the character
{{sqltablerow|thrown_exp    | INTEGER    | NOT NULL        |                | Experience: throwing                                   }}
|-                                                                   
{{endsqltable}}
|agi            || INTEGER    || NOT NULL        ||                || agility of the character
 
|-                                                                   
|dex            || INTEGER    || NOT NULL        ||                || dexternity of the character
|-                                                                   
|vit            || INTEGER    || NOT NULL        ||                || vitality of the character
|-                                                                   
|int            || INTEGER    || NOT NULL        ||                || intelligence of the character
|-                                                                   
|will          || INTEGER    || NOT NULL        ||                || willpower of the character
|-                                                                   
|unarmed_exp    || INTEGER    || NOT NULL        ||                || Experience: unarmed
|-                                                                   
|knife_exp      || INTEGER    || NOT NULL        ||                || Experience: knifes
|-                                                                   
|sword_exp      || INTEGER    || NOT NULL        ||                || Experience: swords
|-                                                                   
|polearm_exp    || INTEGER    || NOT NULL        ||                || Experience: polearms
|-                                                                   
|staff_exp      || INTEGER    || NOT NULL        ||                || Experience: staffs
|-                                                                   
|whip_exp      || INTEGER    || NOT NULL        ||                || Experience: whips
|-                                                                   
|bow_exp        || INTEGER    || NOT NULL        ||                || Experience: bows
|-                                                                   
|shoot_exp      || INTEGER    || NOT NULL        ||                || Experience: shooting
|-                                                                   
|mace_exp      || INTEGER    || NOT NULL        ||                || Experience: maces
|-                                                                   
|axe_exp        || INTEGER    || NOT NULL        ||                || Experience: axes
|-                                                                   
|thrown_exp    || INTEGER    || NOT NULL        ||                || Experience: throwing
|}


=== Character Inventory ===
=== Character Inventory ===
{|border=1 cellpadding=5 cellspacing=0
 
|+ tmw_inventories
{{beginsqltable|tmw_inventories}}
|-bgcolor=lightgrey
{{sqltablerow|id            | INTEGER    | PRIMARY KEY      |                  | unique id of the item                         }}
! Column name !! Datatype !! Nullable !! References !! Description
{{sqltablerow|owner_id      | INTEGER    | NOT NULL        | tmw_characters.id | id of the owning character                     }}
|-
{{sqltablerow|slot          | INTEGER    | NOT NULL        |                  | inventory slot where the item is equipped     }}
|id            || INTEGER    || PRIMARY KEY      ||                  || unique id of the item
{{sqltablerow|class_id      | INTEGER    | NOT NULL        |                  | type of the item, see items.xml file of tmwserv}}
|-
{{sqltablerow|amount        | INTEGER    | NOT NULL        |                  | amount of items per slot                       }}
|owner_id      || INTEGER    || NOT NULL        || tmw_characters.id || id of the owning character
{{endsqltable}}
|-
 
|slot          || INTEGER    || NOT NULL        ||                  || inventory slot where the item is equipped
|-
|class_id      || INTEGER    || NOT NULL        ||                  || type of the item, see items.xml file of tmwserv
|-
|amount        || INTEGER    || NOT NULL        ||                  || amount of items per slot
|}


=== Guilds ===
=== Guilds ===
{|border=1 cellpadding=5 cellspacing=0
 
|+ tmw_guilds
{{beginsqltable|tmw_guilds}}
|-bgcolor=lightgrey
{{sqltablerow|id            | INTEGER    | PRIMARY KEY    |  | unique id of the guid   }}
! Column name !! Datatype !! Nullable !! References !! Description
{{sqltablerow|name          | TEXT        | NOT NULL UNIQUE |  | unique name of the guild}}
|-
{{endsqltable}}
|id            || INTEGER    || PRIMARY KEY    ||| unique id of the guid
|-                                               
|name          || TEXT        || NOT NULL UNIQUE ||| unique name of the guild
|}




Line 122: Line 82:
The table ''tmw_guild_members'' stores informations which character is member in which guild and which rights does he has.
The table ''tmw_guild_members'' stores informations which character is member in which guild and which rights does he has.


{|border=1 cellpadding=5 cellspacing=0
{{beginsqltable|tmw_guild_members}}
|+ tmw_guild_members
{{sqltablerow|guild_id        | INTEGER    | NOT NULL | tmw_guilds.id    | reference to the guild                                               }}
|-bgcolor=lightgrey
{{sqltablerow|member_id      | INTEGER    | NOT NULL | tmw_characters.id | reference to the characters                                           }}
! Column name !! Datatype !! Nullable !! References !! Description
{{sqltablerow|rights          | INTEGER    | NOT NULL |                  | id showing the rights a character has in this guild (member, admin...)}}
|-
{{endsqltable}}
|guild_id        || INTEGER    || NOT NULL || tmw_guilds.id    || reference to the guild
|-
|member_id      || INTEGER    || NOT NULL || tmw_characters.id || reference to the characters
|-
|rights          || INTEGER    || NOT NULL ||                  || id showing the rights a character has in this guild (member, admin...)
|}




Line 139: Line 93:
This table is used to store states of quests per character, e.g. if a character has just finished a quest or is currently at the second part of the long journey...
This table is used to store states of quests per character, e.g. if a character has just finished a quest or is currently at the second part of the long journey...


{|border=1 cellpadding=5 cellspacing=0
{{beginsqltable|tmw_guild_members}}
|+ tmw_guild_members
{{sqltablerow|owner_id        | INTEGER    | NOT NULL | tmw_characters.id | reference to the character         }}
|-bgcolor=lightgrey
{{sqltablerow|name            | TEXT        | NOT NULL |                  | name of the quest variable         }}
! Column name !! Datatype !! Nullable !! References !! Description
{{sqltablerow|value          | TEXT        | NOT NULL |                  | current value of the quest variable}}
|-
{{endsqltable}}
|owner_id        || INTEGER    || NOT NULL || tmw_characters.id || reference to the character
 
|-
|name            || TEXT        || NOT NULL ||                  || name of the quest variable  
|-
|value          || TEXT        || NOT NULL ||                  || current value of the quest variable  
|}


== Reference  ==
== Reference  ==

Revision as of 13:54, 12 September 2008

This article contains information for Programmers working or interested in working for The Mana World

SQL table specifications

User accounts

tmw_accounts
Column name Datatype Nullable References Description
id INTEGER PRIMARY KEY unique id of an account }}
username TEXT NOT NULL UNIQUE username / loginname of an user
password TEXT NOT NULL password of an user (sha256 encoded)
email TEXT NOT NULL email (sha256 encoded, only for pwd recovery)
level INTEGER NOT NULL numeric level of the user account
banned INTEGER NOT NULL unixtimestamp until when the account is banned
registration INTEGER NOT NULL unixtimestamp of account registration
lastlogin INTEGER NOT NULL unixtimestamp of last login with client

Details

  • email
    • The email is stored as a one-way sha256 hash value. This ensures, that the email address a user enters cannot be used to send spam mails. It is only used to validate the mailaddress during password recovery procedure.
  • level
    • describes the user rights in the game (10 = normal user, 50 = gm, 99 = administrator)


Characters

tmw_characters
Column name Datatype Nullable References Description
id INTEGER PRIMARY KEY unique id of the character
user_id INTEGER NOT NULL tmw_accounts.id id of the owner
name TEXT NOT NULL UNIQUE name of the character
gender INTEGER NOT NULL gender of the character (0/1)
hair_style INTEGER NOT NULL id of the hair sprite
hair_color INTEGER NOT NULL id of the hair color
level INTEGER NOT NULL experience level of the character
char_pts INTEGER NOT NULL available points to raise attributes
correct_pts INTEGER NOT NULL available points to lower attributes and regain char_pts
money INTEGER NOT NULL GP of the character
x INTEGER NOT NULL x position of the character on the map
y INTEGER NOT NULL y position of the character on the map
map_id INTEGER NOT NULL tmw_maps.id id of the current map the character is located
str INTEGER NOT NULL strength of the character
agi INTEGER NOT NULL agility of the character
dex INTEGER NOT NULL dexternity of the character
vit INTEGER NOT NULL vitality of the character
int INTEGER NOT NULL intelligence of the character
will INTEGER NOT NULL willpower of the character
unarmed_exp INTEGER NOT NULL Experience: unarmed
knife_exp INTEGER NOT NULL Experience: knifes
sword_exp INTEGER NOT NULL Experience: swords
polearm_exp INTEGER NOT NULL Experience: polearms
staff_exp INTEGER NOT NULL Experience: staffs
whip_exp INTEGER NOT NULL Experience: whips
bow_exp INTEGER NOT NULL Experience: bows
shoot_exp INTEGER NOT NULL Experience: shooting
mace_exp INTEGER NOT NULL Experience: maces
axe_exp INTEGER NOT NULL Experience: axes
thrown_exp INTEGER NOT NULL Experience: throwing


Character Inventory

tmw_inventories
Column name Datatype Nullable References Description
id INTEGER PRIMARY KEY unique id of the item
owner_id INTEGER NOT NULL tmw_characters.id id of the owning character
slot INTEGER NOT NULL inventory slot where the item is equipped
class_id INTEGER NOT NULL type of the item, see items.xml file of tmwserv
amount INTEGER NOT NULL amount of items per slot


Guilds

tmw_guilds
Column name Datatype Nullable References Description
id INTEGER PRIMARY KEY unique id of the guid
name TEXT NOT NULL UNIQUE unique name of the guild


Guild memberships

The table tmw_guild_members stores informations which character is member in which guild and which rights does he has.

tmw_guild_members
Column name Datatype Nullable References Description
guild_id INTEGER NOT NULL tmw_guilds.id reference to the guild
member_id INTEGER NOT NULL tmw_characters.id reference to the characters
rights INTEGER NOT NULL id showing the rights a character has in this guild (member, admin...)


Quest states

This table is used to store states of quests per character, e.g. if a character has just finished a quest or is currently at the second part of the long journey...

tmw_guild_members
Column name Datatype Nullable References Description
owner_id INTEGER NOT NULL tmw_characters.id reference to the character
name TEXT NOT NULL name of the quest variable
value TEXT NOT NULL current value of the quest variable


Reference

Since the database is changing relatively often while we're still developing 0.1.0 and nobody likes to keep this page up to date, here is the link to the source code that specifies creation of the database tables. The source code is always right!