-
Notifications
You must be signed in to change notification settings - Fork 84
Database Creator
#summary A tutorial on how to create a MySQL database for Pokenet.
#labels Phase-Deploy
= Introduction =
Setting up a MySQL Pokenet Database is necessary for the game to work. Currently, there is only one method to do so. When setting up a database, ensure you are using the correct version corresponding to your server version (i.e. Fearless Feebas, Valiant Venonat, etc.).
== PHP Setup ==
Requires:
- MySQL 4.0 or 5.0 (5.0 recommended)
- PHP 5.0 (Not tested with 4.0 or 6.0)
= Instructions =
- Set up a MySQL database and note the host, username, database name and password.
- Copy the code below into notepad and save as a pokenetdbsetup.php (be sure to select Save As “All Files”)
- Insert the information into the file (The database host, name, username and password).
- Upload to a web server.
- Open the file in a web browser.
- Enjoy!
= Valiant Venonat - pokenetdbsetup.php =
{{{
Welcome to the Pokenet Database Setup. This may take a few moments.
NOTE: MySQL 5.0 is recommended
<?php
/*
Sets up a pokenet game account database.
Requires MySQL 4 or 5.
/*
/*
EDIT THE FOLLOWING ACCORDINGLY
*/
$host= "";
$dbname = "";
$username = "";
$password = "";
/*
DO NOT EDIT BELOW UNLESS YOU ARE A DEVELOPER
*/
// Make the MySQL Connection
echo “Connecting to database…
”;
mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
//Create the player table
echo “Creating player table…
”;
mysql_query(“CREATE TABLE pn_members(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
username VARCHAR,
password VARCHAR,
dob VARCHAR,
email VARCHAR,
lastLoginTime VARCHAR,
lastLoginServer VARCHAR,
lastLoginIP VARCHAR,
lastLanguageUsed INT,
sprite INT,
party INT,
money INT,
skHerb INT,
skCraft INT,
skFish INT,
skTrain INT,
skCoord INT,
skBreed INT,
x INT,
y INT,
mapX INT,
mapY INT,
badges VARCHAR,
healX INT,
healY INT,
healMapX INT,
healMapY INT,
isSurfing VARCHAR,
muted VARCHAR,
adminLevel INT
)”)
or die(mysql_error());
/* Make usernames UNIQUE */
mysql_query(“ALTER TABLE pn_members add UNIQUE”)
or die(mysql_error());
/*
Create bag table
*/
echo “Creating the bag table…
”;
mysql_query(“CREATE TABLE pn_bag(
member INT NOT NULL,
item INT NOT NULL,
quantity INT NOT NULL
)”) or die(mysql_error());
/*
Create the party table.
A pokemon party stores 6 Pokemon (Id reference).
*/
echo “Creating the Pokemon party table…
”;
mysql_query(“CREATE TABLE pn_party(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
member INT,
pokemon0 INT,
pokemon1 INT,
pokemon2 INT,
pokemon3 INT,
pokemon4 INT,
pokemon5 INT
)”) or die(mysql_error());
/*
Create the Pokemon table
*/
echo “Creating the Pokemon table…
”;
mysql_query(“CREATE TABLE pn_pokemon(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
name VARCHAR,
speciesName VARCHAR,
exp VARCHAR,
baseExp INT,
expType VARCHAR,
isFainted VARCHAR,
level INT,
happiness INT,
gender INT,
nature VARCHAR,
abilityName VARCHAR,
itemName VARCHAR,
isShiny VARCHAR,
originalTrainerName VARCHAR,
currentTrainerName VARCHAR,
contestStats VARCHAR,
move0 VARCHAR,
move1 VARCHAR,
move2 VARCHAR,
move3 VARCHAR,
hp INT,
atk INT,
def INT,
speed INT,
spATK INT,
spDEF INT,
evHP INT,
evATK INT,
evDEF INT,
evSPD INT,
evSPATK INT,
evSPDEF INT,
ivHP INT,
ivATK INT,
ivDEF INT,
ivSPD INT,
ivSPATK INT,
ivSPDEF INT,
pp0 INT,
pp1 INT,
pp2 INT,
pp3 INT,
maxpp0 INT,
maxpp1 INT,
maxpp2 INT,
maxpp3 INT,
ppUp0 INT,
ppUp1 INT,
ppUp2 INT,
ppUp3 INT,
date VARCHAR
)”) or die(mysql_error());
/*
Create the ban table.
*/
echo “Creating the ban table…
”;
mysql_query(“CREATE TABLE pn_bans(
ip VARCHAR
)”) or die(mysql_error());
/*
Create pn_history table
*/
echo “Creating pn_history table…
”;
mysql_query(“CREATE TABLE pn_history(
member INT,
action INT,
with INT,
timestamp DATETIME,
details VARCHAR
)”) or die(mysql_error());
echo “Setup complete”;
?>
}}}
= Fearless Feebas - pokenetdbsetup.php =
{{{
Welcome to the Pokenet Database Setup. This may take a few moments.
NOTE: MySQL 5.0 is recommended
<?php
/*
Sets up a pokenet game account database.
Requires MySQL 4 or 5.
/*
/*
EDIT THE FOLLOWING ACCORDINGLY
*/
$host= "";
$dbname = "";
$username = "";
$password = "";
/*
DO NOT EDIT BELOW UNLESS YOU ARE A DEVELOPER
*/
// Make the MySQL Connection
echo “Connecting to database…
”;
mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
//Create the player table
echo “Creating player table…
”;
mysql_query(“CREATE TABLE pn_members(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
username VARCHAR,
password VARCHAR,
dob VARCHAR,
email VARCHAR,
lastLoginTime VARCHAR,
lastLoginServer VARCHAR,
lastLoginIP VARCHAR,
sprite INT,
pokemons INT,
money INT,
skHerb INT,
skCraft INT,
skFish INT,
skTrain INT,
skCoord INT,
skBreed INT,
x INT,
y INT,
mapX INT,
mapY INT,
badges VARCHAR,
healX INT,
healY INT,
healMapX INT,
healMapY INT,
isSurfing VARCHAR,
muted VARCHAR,
adminLevel INT
)”)
or die(mysql_error());
/*
Create bag table
*/
echo “Creating the bag table…
”;
mysql_query(“CREATE TABLE pn_bag(
member INT NOT NULL,
item INT NOT NULL,
quantity INT NOT NULL
)”) or die(mysql_error());
/*
Create the player pokemon table.
Each player can have their party of 6 Pokemon and 9 boxes
*/
echo “Creating the player’s pokemons tables…
”;
mysql_query(“CREATE TABLE pn_mypokes(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
member INT,
party INT,
box0 INT,
box1 INT,
box2 INT,
box3 INT,
box4 INT,
box5 INT,
box6 INT,
box7 INT,
box8 INT
)”) or die(mysql_error());
/*
Create the box table.
Each box stores 30 Pokemon (Id reference to pokemon table)
*/
echo “Creating the boxes table…
”;
mysql_query(“CREATE TABLE pn_box(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
member INT,
pokemon0 INT NOT NULL DEFAULT ‘-1’,
pokemon1 INT NOT NULL DEFAULT ‘-1’,
pokemon2 INT NOT NULL DEFAULT ‘-1’,
pokemon3 INT NOT NULL DEFAULT ‘-1’,
pokemon4 INT NOT NULL DEFAULT ‘-1’,
pokemon5 INT NOT NULL DEFAULT ‘-1’,
pokemon6 INT NOT NULL DEFAULT ‘-1’,
pokemon7 INT NOT NULL DEFAULT ‘-1’,
pokemon8 INT NOT NULL DEFAULT ‘-1’,
pokemon9 INT NOT NULL DEFAULT ‘-1’,
pokemon10 INT NOT NULL DEFAULT ‘-1’,
pokemon11 INT NOT NULL DEFAULT ‘-1’,
pokemon12 INT NOT NULL DEFAULT ‘-1’,
pokemon13 INT NOT NULL DEFAULT ‘-1’,
pokemon14 INT NOT NULL DEFAULT ‘-1’,
pokemon15 INT NOT NULL DEFAULT ‘-1’,
pokemon16 INT NOT NULL DEFAULT ‘-1’,
pokemon17 INT NOT NULL DEFAULT ‘-1’,
pokemon18 INT NOT NULL DEFAULT ‘-1’,
pokemon19 INT NOT NULL DEFAULT ‘-1’,
pokemon20 INT NOT NULL DEFAULT ‘-1’,
pokemon21 INT NOT NULL DEFAULT ‘-1’,
pokemon22 INT NOT NULL DEFAULT ‘-1’,
pokemon23 INT NOT NULL DEFAULT ‘-1’,
pokemon24 INT NOT NULL DEFAULT ‘-1’,
pokemon25 INT NOT NULL DEFAULT ‘-1’,
pokemon26 INT NOT NULL DEFAULT ‘-1’,
pokemon27 INT NOT NULL DEFAULT ‘-1’,
pokemon28 INT NOT NULL DEFAULT ‘-1’,
pokemon29 INT NOT NULL DEFAULT ‘-1’
)”) or die(mysql_error());
/*
Create the party table.
A pokemon party stores 6 Pokemon (Id reference).
*/
echo “Creating the Pokemon party table…
”;
mysql_query(“CREATE TABLE pn_party(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
member INT,
pokemon0 INT,
pokemon1 INT,
pokemon2 INT,
pokemon3 INT,
pokemon4 INT,
pokemon5 INT
)”) or die(mysql_error());
/*
Create the Pokemon table
*/
echo “Creating the Pokemon table…
”;
mysql_query(“CREATE TABLE pn_pokemon(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY,
name VARCHAR,
speciesName VARCHAR,
exp VARCHAR,
baseExp INT,
expType VARCHAR,
isFainted VARCHAR,
level INT,
happiness INT,
gender INT,
nature VARCHAR,
abilityName VARCHAR,
itemName VARCHAR,
isShiny VARCHAR,
originalTrainerName VARCHAR,
contestStats VARCHAR,
move0 VARCHAR,
move1 VARCHAR,
move2 VARCHAR,
move3 VARCHAR,
hp INT,
atk INT,
def INT,
speed INT,
spATK INT,
spDEF INT,
evHP INT,
evATK INT,
evDEF INT,
evSPD INT,
evSPATK INT,
evSPDEF INT,
ivHP INT,
ivATK INT,
ivDEF INT,
ivSPD INT,
ivSPATK INT,
ivSPDEF INT,
pp0 INT,
pp1 INT,
pp2 INT,
pp3 INT,
maxpp0 INT,
maxpp1 INT,
maxpp2 INT,
maxpp3 INT,
ppUp0 INT,
ppUp1 INT,
ppUp2 INT,
ppUp3 INT,
date VARCHAR
)”) or die(mysql_error());
/*
Create the ban table.
*/
echo “Creating the ban table…
”;
mysql_query(“CREATE TABLE pn_bans(
ip VARCHAR
)”) or die(mysql_error());
echo “Setup complete”;
?>
}}}