diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-03-10 10:27:51 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-08 10:19:40 +0200 |
commit | f712d68495dd8e040c32da3b1c85bcb7845543ec (patch) | |
tree | f1a314bc1ef895c31851428b4ceff8b63d209f66 /src/sql/mysql | |
parent | 8ddda85d923a528c7497a628d2fe10fc40b80a1f (diff) | |
download | manaserv-f712d68495dd8e040c32da3b1c85bcb7845543ec.tar.gz manaserv-f712d68495dd8e040c32da3b1c85bcb7845543ec.tar.bz2 manaserv-f712d68495dd8e040c32da3b1c85bcb7845543ec.tar.xz manaserv-f712d68495dd8e040c32da3b1c85bcb7845543ec.zip |
Cleaned up the inventory handling
Things done:
- Removed the equips table and added another column which keeps track about
whether the item is equipped or not
- Added a message to notify the client about failing equips instead of
hardcoding to chat notification
- Removed the move possibillity. It was a quite long function and our future
idea of the inventory does not need any moves
- Removed the inInventory and inEquipment parameters from chr_inv_count,
but added a equipped key to the table that chr_get_inventory returns
This change makes equipped items still being in the inventory. This means
in-inventory triggers are still active! However it makes no sense to disable
this triggers during equipping since it will appear as still in the inventory
to the client.
Diffstat (limited to 'src/sql/mysql')
-rw-r--r-- | src/sql/mysql/createTables.sql | 18 | ||||
-rw-r--r-- | src/sql/mysql/updates/update_24_to_25.sql | 18 |
2 files changed, 20 insertions, 16 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index fc873712..c15c005b 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -179,21 +179,6 @@ DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- --- table: `mana_char_equips` --- -CREATE TABLE IF NOT EXISTS `mana_char_equips` ( - `id` int(10) unsigned NOT NULL auto_increment, - `owner_id` int(10) unsigned NOT NULL, - `slot_type` int(10) unsigned NOT NULL, - `item_id` int(10) unsigned NOT NULL, - `item_instance` int(10) unsigned NOT NULL, - -- - PRIMARY KEY (`id`), - FOREIGN KEY (`owner_id`) REFERENCES `mana_characters` (`id`) -) ENGINE=InnoDB -DEFAULT CHARSET=utf8; - --- -- table: `mana_inventories` -- todo: remove class_id and amount and reference on mana_item_instances -- @@ -203,6 +188,7 @@ CREATE TABLE IF NOT EXISTS `mana_inventories` ( `slot` tinyint(3) unsigned NOT NULL, `class_id` int(10) unsigned NOT NULL, `amount` tinyint(3) unsigned NOT NULL, + `equipped` tinyint(3) unsigned NOT NULL, -- PRIMARY KEY (`id`), UNIQUE KEY `owner_id` (`owner_id`, `slot`), @@ -420,7 +406,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,'24', NOW()); +INSERT INTO mana_world_states VALUES('database_version', -1,'25', NOW()); -- all known transaction codes diff --git a/src/sql/mysql/updates/update_24_to_25.sql b/src/sql/mysql/updates/update_24_to_25.sql new file mode 100644 index 00000000..8f5ea24e --- /dev/null +++ b/src/sql/mysql/updates/update_24_to_25.sql @@ -0,0 +1,18 @@ +START TRANSACTION; + +ALTER TABLE mana_inventories ADD COLUMN equipped tinyint(3) unsigned NOT NULL; + +INSERT INTO mana_inventories (owner_id, slot, class_id, amount, equipped) +SELECT owner_id, (SELECT IF COUNT(slot) = 0 THEN 1 ELSE MAX(slot) + 1 END IF FROM mana_inventories + WHERE owner_id=owner_id), + item_id, 1, 1 FROM mana_char_equips; + +DROP TABLE mana_char_equips; + +-- Update database version. +UPDATE mana_world_states + SET value = '25', + moddate = UNIX_TIMESTAMP() + WHERE state_name = 'database_version'; + +COMMIT; |