From f8e816d9185c09d1c17d921b775e483d132982e5 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Tue, 3 Apr 2012 13:29:05 +0200 Subject: Enhanced special support - Made the current charge being saved. - Added script binds: - chr_set_special_recharge_speed - chr_get_special_recharge_speed - chr_set_special_mana - chr_get_special_mana - get_special_info - Added special info lua class. Functions: - name - needed_mana - rechargeable - on_use - on_recharged - category Further the engine no longer sets charge to 0 after using of specials this allows more flexbilillity (like failing specials). Changes on the xml database: - recharge renamed to rechargeable (needed by client and server) - needed - the needed mana to trigger a special (server only) - rechargespeed - the defailt recharge speed in mana per tick (server only) - target - the type of target (either being or point) (server and client) I also made the lua engine pushing nil instead of a 0 light userdata when the pointer was 0. Database update needed. Change is tested. Mana-Mantis: #167, #156 Reviewed-by: bjorn. --- src/sql/mysql/createTables.sql | 7 ++++--- src/sql/sqlite/createTables.sql | 7 ++++--- src/sql/sqlite/updates/update_20_to_21.sql | 11 +++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 src/sql/sqlite/updates/update_20_to_21.sql (limited to 'src/sql') diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index 4917ef47..c47cbd1e 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -117,8 +117,9 @@ DEFAULT CHARSET=utf8; CREATE TABLE mana_char_specials ( - `char_id` int(10) unsigned NOT NULL, - `special_id` int(10) unsigned NOT NULL, + `char_id` int(10) unsigned NOT NULL, + `special_id` int(10) unsigned NOT NULL, + `special_current_mana` int(10) unsigned NOT NULL, PRIMARY KEY (`char_id`, `special_id`), FOREIGN KEY (`char_id`) REFERENCES `mana_characters` (`id`) @@ -437,7 +438,7 @@ AUTO_INCREMENT=0 ; INSERT INTO mana_world_states VALUES('accountserver_startup',-1,'0', NOW()); INSERT INTO mana_world_states VALUES('accountserver_version',-1,'0', NOW()); -INSERT INTO mana_world_states VALUES('database_version', -1,'20', NOW()); +INSERT INTO mana_world_states VALUES('database_version', -1,'21', NOW()); -- all known transaction codes diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql index b286467e..06dbd195 100644 --- a/src/sql/sqlite/createTables.sql +++ b/src/sql/sqlite/createTables.sql @@ -120,8 +120,9 @@ CREATE INDEX mana_char_kill_stats_char on mana_char_kill_stats ( char_id ); CREATE TABLE mana_char_specials ( - char_id INTEGER NOT NULL, - special_id INTEGER NOT NULL, + char_id INTEGER NOT NULL, + special_id INTEGER NOT NULL, + special_current_mana INTEGER NOT NULL, PRIMARY KEY (char_id, special_id), FOREIGN KEY (char_id) REFERENCES mana_characters(id) ); @@ -421,7 +422,7 @@ AS INSERT INTO mana_world_states VALUES('accountserver_startup',-1,'0', strftime('%s','now')); INSERT INTO mana_world_states VALUES('accountserver_version',-1,'0', strftime('%s','now')); -INSERT INTO mana_world_states VALUES('database_version', -1,'20', strftime('%s','now')); +INSERT INTO mana_world_states VALUES('database_version', -1,'21', strftime('%s','now')); -- all known transaction codes diff --git a/src/sql/sqlite/updates/update_20_to_21.sql b/src/sql/sqlite/updates/update_20_to_21.sql new file mode 100644 index 00000000..84565326 --- /dev/null +++ b/src/sql/sqlite/updates/update_20_to_21.sql @@ -0,0 +1,11 @@ +BEGIN; + +ALTER TABLE mana_char_specials ADD COLUMN special_current_mana INTEGER DEFAULT 0 NOT NULL; + +-- Update the database version, and set date of update +UPDATE mana_world_states + SET value = '21', + moddate = strftime('%s','now') + WHERE state_name = 'database_version'; + +END; -- cgit v1.2.3-70-g09d2