summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-09 02:35:25 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-09 02:36:30 +0200
commit6ae2001e91eaaeb8b72031e96f88820711bb1ca0 (patch)
tree8ab01e1d9e59860837560e6cd8bbd7eabaa428de /src/sql
parent40a31c52aebc19221cc9da8a0f764d21e672937b (diff)
downloadmanaserv-6ae2001e91eaaeb8b72031e96f88820711bb1ca0.tar.gz
manaserv-6ae2001e91eaaeb8b72031e96f88820711bb1ca0.tar.xz
manaserv-6ae2001e91eaaeb8b72031e96f88820711bb1ca0.zip
Add persistent items support based on seeseekey's work.
Also made some random changes where useful, including: - Code formatting fixes, - Design fix about the fact that only the game config option should be checked. - Fixed the size of the values sent and receive to follow the rest of the development. - Fixed variables names to make them show what they are, and not why they are used. Resolves: Mana-Mantis #142.
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/mysql/createTables.sql18
-rw-r--r--src/sql/mysql/updates/update_16_to_17.sql19
-rw-r--r--src/sql/sqlite/createTables.sql14
-rw-r--r--src/sql/sqlite/updates/update_16_to_17.sql16
4 files changed, 65 insertions, 2 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql
index f636503..b75fc0e 100644
--- a/src/sql/mysql/createTables.sql
+++ b/src/sql/mysql/createTables.sql
@@ -179,6 +179,22 @@ DEFAULT CHARSET=utf8
AUTO_INCREMENT=1 ;
--
+-- table: `mana_floor_items`
+--
+CREATE TABLE IF NOT EXISTS `mana_floor_items` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `map_id` int(10) unsigned NOT NULL,
+ `item_id` int(10) unsigned NOT NULL,
+ `amount` smallint(5) unsigned NOT NULL,
+ `pos_x` smallint(5) unsigned NOT NULL,
+ `pos_y` smallint(5) unsigned NOT NULL,
+ --
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8
+AUTO_INCREMENT=1 ;
+
+--
-- table: `mana_char_equips`
--
CREATE TABLE IF NOT EXISTS `mana_char_equips` (
@@ -421,7 +437,7 @@ AUTO_INCREMENT=0 ;
INSERT INTO mana_world_states VALUES('accountserver_startup',NULL,NULL, NOW());
INSERT INTO mana_world_states VALUES('accountserver_version',NULL,NULL, NOW());
-INSERT INTO mana_world_states VALUES('database_version', NULL,'16', NOW());
+INSERT INTO mana_world_states VALUES('database_version', NULL,'17', NOW());
-- all known transaction codes
diff --git a/src/sql/mysql/updates/update_16_to_17.sql b/src/sql/mysql/updates/update_16_to_17.sql
new file mode 100644
index 0000000..008983a
--- /dev/null
+++ b/src/sql/mysql/updates/update_16_to_17.sql
@@ -0,0 +1,19 @@
+-- Create the new floor item table
+CREATE TABLE IF NOT EXISTS `mana_floor_items` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `map_id` int(10) unsigned NOT NULL,
+ `item_id` int(10) unsigned NOT NULL,
+ `amount` smallint(5) unsigned NOT NULL,
+ `pos_x` smallint(5) unsigned NOT NULL,
+ `pos_y` smallint(5) unsigned NOT NULL,
+ --
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8
+AUTO_INCREMENT=1 ;
+
+-- Update database version.
+UPDATE mana_world_states
+SET value = '17',
+moddate = UNIX_TIMESTAMP()
+WHERE state_name = 'database_version';
diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql
index f353b8e..2d7360d 100644
--- a/src/sql/sqlite/createTables.sql
+++ b/src/sql/sqlite/createTables.sql
@@ -173,6 +173,18 @@ CREATE INDEX mana_item_attributes_item ON mana_item_attributes ( item_id );
-----------------------------------------------------------------------------
+CREATE TABLE mana_floor_items
+(
+ id INTEGER PRIMARY KEY,
+ map_id INTEGER NOT NULL,
+ item_id INTEGER NOT NULL,
+ amount INTEGER NOT NULL,
+ pos_x INTEGER NOT NULL,
+ pos_y INTEGER NOT NULL
+);
+
+-----------------------------------------------------------------------------
+
CREATE TABLE mana_char_equips
(
id INTEGER PRIMARY KEY,
@@ -407,7 +419,7 @@ AS
INSERT INTO mana_world_states VALUES('accountserver_startup',NULL,NULL, strftime('%s','now'));
INSERT INTO mana_world_states VALUES('accountserver_version',NULL,NULL, strftime('%s','now'));
-INSERT INTO mana_world_states VALUES('database_version', NULL,'16', strftime('%s','now'));
+INSERT INTO mana_world_states VALUES('database_version', NULL,'17', strftime('%s','now'));
-- all known transaction codes
diff --git a/src/sql/sqlite/updates/update_16_to_17.sql b/src/sql/sqlite/updates/update_16_to_17.sql
new file mode 100644
index 0000000..769c26d
--- /dev/null
+++ b/src/sql/sqlite/updates/update_16_to_17.sql
@@ -0,0 +1,16 @@
+-- Create the new floor item table
+CREATE TABLE mana_floor_items
+(
+ id INTEGER PRIMARY KEY,
+ map_id INTEGER NOT NULL,
+ item_id INTEGER NOT NULL,
+ amount INTEGER NOT NULL,
+ pos_x INTEGER NOT NULL,
+ pos_y INTEGER NOT NULL
+);
+
+-- Update the database version, and set date of update
+UPDATE mana_world_states
+ SET value = '17',
+ moddate = strftime('%s','now')
+ WHERE state_name = 'database_version';