summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2010-07-09 15:21:50 +0200
committerPhilipp Sehmisch <mana@crushnet.org>2010-07-09 15:22:11 +0200
commit26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2 (patch)
tree6d7ea0ebe8be228a61315f72122eed3f2f995a0b /src/sql
parent2627acefebc688d9d9733abe23ba5aae79f66ea0 (diff)
downloadmanaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.gz
manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.tar.xz
manaserv-26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2.zip
Added LUA script bindings for manipulating the specials available to a character.
Added script call for getting the cost of a special (recharge only for now) Deleting specials works server-sided but the client isn't informed about it properly. Specials without recharge cost don't appear for the player. Both of these features require an additional netcode message. Reviewed-by: Freeyorp
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/mysql/createTables.sql15
-rw-r--r--src/sql/mysql/updates/update_8_to_9.sql16
-rw-r--r--src/sql/sqlite/createTables.sql14
-rw-r--r--src/sql/sqlite/updates/update_8_to_9.sql16
4 files changed, 59 insertions, 2 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql
index 1f9bce3..a3b37ce 100644
--- a/src/sql/mysql/createTables.sql
+++ b/src/sql/mysql/createTables.sql
@@ -103,6 +103,19 @@ CREATE TABLE IF NOT EXISTS `mana_char_kill_stats`
) ENGINE=InnoDB
DEFAULT CHARSET=utf8;
+-- Create table 'mana_char_specials'
+
+CREATE TABLE mana_char_specials
+(
+ `char_id` int(10) unsigned NOT NULL,
+ `special_id` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`char_id`, `special_id`),
+ FOREIGN KEY (`char_id`)
+ REFERENCES `mana_characters` (`id`)
+ ON DELETE CASCADE
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8;
+
--
-- table: `mana_items`
@@ -383,7 +396,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,'8', NOW());
+INSERT INTO mana_world_states VALUES('database_version', NULL,'9', NOW());
-- all known transaction codes
diff --git a/src/sql/mysql/updates/update_8_to_9.sql b/src/sql/mysql/updates/update_8_to_9.sql
new file mode 100644
index 0000000..499cd73
--- /dev/null
+++ b/src/sql/mysql/updates/update_8_to_9.sql
@@ -0,0 +1,16 @@
+-- Create table 'mana_char_specials'
+
+CREATE TABLE mana_char_specials
+(
+ `char_id` int(10) unsigned NOT NULL,
+ `special_id` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`char_id`, `special_id`),
+ FOREIGN KEY (`char_id`)
+ REFERENCES `mana_characters` (`id`)
+ ON DELETE CASCADE
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8;
+
+
+UPDATE mana_world_states SET value = '9' WHERE state_name = 'database_version';
+
diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql
index f4b4b1d..bc5eefb 100644
--- a/src/sql/sqlite/createTables.sql
+++ b/src/sql/sqlite/createTables.sql
@@ -110,6 +110,18 @@ CREATE INDEX mana_char_kill_stats_char on mana_char_status_effects ( char_id );
-----------------------------------------------------------------------------
+CREATE TABLE mana_char_specials
+(
+ char_id INTEGER NOT NULL,
+ special_id INTEGER NOT NULL,
+ PRIMARY KEY (char_id, special_id),
+ FOREIGN KEY (char_id) REFERENCES mana_characters(id)
+);
+
+CREATE INDEX mana_char_specials_char on mana_char_specials ( char_id );
+
+-----------------------------------------------------------------------------
+
CREATE TABLE mana_items
(
id INTEGER PRIMARY KEY,
@@ -374,7 +386,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,'8', strftime('%s','now'));
+INSERT INTO mana_world_states VALUES('database_version', NULL,'9', strftime('%s','now'));
-- all known transaction codes
diff --git a/src/sql/sqlite/updates/update_8_to_9.sql b/src/sql/sqlite/updates/update_8_to_9.sql
new file mode 100644
index 0000000..efc0d02
--- /dev/null
+++ b/src/sql/sqlite/updates/update_8_to_9.sql
@@ -0,0 +1,16 @@
+CREATE TABLE mana_char_specials
+(
+ char_id INTEGER NOT NULL,
+ special_id INTEGER NOT NULL,
+ PRIMARY KEY (char_id, special_id),
+ FOREIGN KEY (char_id) REFERENCES mana_characters(id)
+);
+
+CREATE INDEX mana_char_specials_char on mana_char_specials ( char_id );
+
+-- update the database version, and set date of update
+UPDATE mana_world_states
+ SET value = '9',
+ moddate = strftime('%s','now')
+ WHERE state_name = 'database_version';
+