diff options
author | Freeyorp <Freeyorp101@hotmail.com> | 2010-05-17 20:55:06 +1200 |
---|---|---|
committer | Freeyorp <Freeyorp101@hotmail.com> | 2010-07-10 21:51:07 +1200 |
commit | 98cdcb1de4f422255aa5ef924042ae7d00a5b968 (patch) | |
tree | 1746776580502fb007581f171fa89638ab6bc64f /src/sql | |
parent | 26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2 (diff) | |
download | manaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.tar.gz manaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.tar.bz2 manaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.tar.xz manaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.zip |
New attribute system and major changes to many low-level areas.
Attribute system:
Structure is no longer completely hardcoded. Attributes and structure is
defined by new xml file (defaulting to stats.xml)
Structure defines non-base modifications to an attribute, to be used by
modifiers from items, effects, etc.
Calculating the base value for core attributes is still done in C++ (and for
such fundamental elements the only reason I can think of to do it any other
way is perhaps being able to quickly change scripts without a compile could be
useful for testing, but such things are a low priority anyway)
Item structure:
Modifiers are now through triggers rather than single events. This also
removes hardcoded types - an item could be both able to be equipped and be
able to be activated.
Item activation no longer consumes by default, this must be specified by the
property <consumes /> inside the trigger.
Currently only attribute modifications, autoattacks, and consumes are defined
as effects, but stubs for others do exist. Autoattacks are currently
non-functional, and this should be rectified with some urgency.
Auto Attacks:
AutoAttacks are now separate entities, though not fully complete, nor fully
integrated with all beings yet. Integration with the Character class is
urgent, integration with other Being children less so.
When fully integrated this will allow for multiple autoattacks, through
equipping multiple items with this as an equip effect or even through other
means if needed.
Equipment structure:
As ItemClass types are no longer hardcoded, so too are equip types. An item
have multiple ways to be equipped across multiple equipment slots with any
number in each slot. Character maximums are global but configurable.
Miscellaneous:
Speed, money, and weight are now attributes.
Some managers have been changed into classes such that their associated
classes can have them as friends, to avoid (ab)use of public accessors.
The serialise procedure should also be set as a friend of Character (both in
the account- and game- server) as well; having public accessors returning
iterators is simply ridiculous.
Some start for such cleanups have been made, but this is not the primary focus
here. Significant work will need to be done before this is resolved
completely, but the start is there.
BuySell::registerPlayerItems() has been completely disabled temporarily. The
previous function iterated through equipment, yet in the context I think it is
intended to fill items? I have been unable to update this function to fit the
modifications made to the Inventory/Equipment/Possessions, as I am unsure what
exactly what it should be doing.
ItemClass::mSpriteId was previously unused, so had been removed, but I
notice that it was used when transmitting equipment to nearby clients.
Experimentation showed that this value was never set to anything other than
0, and so has been left out of the ItemManager rewrite.
I am not entirely sure what is happening here, but it should be worth looking
into at a later time, as I am not sure how equipment appearences would be sent
otherwise.
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/mysql/createTables.sql | 42 | ||||
-rw-r--r-- | src/sql/mysql/updates/update_9_to_10.sql | 49 | ||||
-rw-r--r-- | src/sql/sqlite/createTables.sql | 35 |
3 files changed, 109 insertions, 17 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index a3b37ce0..03129815 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -36,18 +36,10 @@ CREATE TABLE IF NOT EXISTS `mana_characters` ( `level` tinyint(3) unsigned NOT NULL, `char_pts` smallint(5) unsigned NOT NULL, `correct_pts` smallint(5) unsigned NOT NULL, - `money` int(10) unsigned NOT NULL, -- location on the map `x` smallint(5) unsigned NOT NULL, `y` smallint(5) unsigned NOT NULL, `map_id` tinyint(3) unsigned NOT NULL, - -- attributes - `str` smallint(5) unsigned NOT NULL, - `agi` smallint(5) unsigned NOT NULL, - `dex` smallint(5) unsigned NOT NULL, - `vit` smallint(5) unsigned NOT NULL, - `int` smallint(5) unsigned NOT NULL, - `will` smallint(5) unsigned NOT NULL, -- PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), @@ -60,6 +52,23 @@ DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- +-- Create table: `mana_char_attr` +-- + +CREATE TABLE IF NOT EXISTS `mana_char_attr` ( + `char_id` int(10) unsigned NOT NULL, + `attr_id` int(10) unsigned NOT NULL, + `attr_base` double unsigned NOT NULL, + `attr_mod` double unsigned NOT NULL, + -- + PRIMARY KEY (`char_id`, `attr_id`), + FOREIGN KEY (`char_id`) + REFERENCES `mana_characters` (`id`) + ON DELETE CASCADE +) ENGINE=InnoDB +DEFAULT CHARSET=utf8; + +-- -- table: `mana_char_skills` -- CREATE TABLE IF NOT EXISTS `mana_char_skills` ( @@ -169,6 +178,21 @@ 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 tinyint(3) unsigned NOT NULL, + inventory_slot tinyint(3) unsigned NOT NULL, + -- + PRIMARY KEY (`id`), + UNIQUE KEY `owner_id` (`owner_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 -- @@ -396,7 +420,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,'9', NOW()); +INSERT INTO mana_world_states VALUES('database_version', NULL,'10', NOW()); -- all known transaction codes diff --git a/src/sql/mysql/updates/update_9_to_10.sql b/src/sql/mysql/updates/update_9_to_10.sql new file mode 100644 index 00000000..5bb722a8 --- /dev/null +++ b/src/sql/mysql/updates/update_9_to_10.sql @@ -0,0 +1,49 @@ +-- +-- Modify the table `mana_characters` to remove the no longer used columns. +-- Note that this is not an intelligent update script at the moment - the +-- values that were stored here are not currently being transferred +-- into their replacement structures. +-- + +ALTER TABLE `mana_char_attr` DROP `money`; +ALTER TABLE `mana_char_attr` DROP `str`; +ALTER TABLE `mana_char_attr` DROP `agi`; +ALTER TABLE `mana_char_attr` DROP `vit`; +ALTER TABLE `mana_char_attr` DROP `int`; +ALTER TABLE `mana_char_attr` DROP `dex`; +ALTER TABLE `mana_char_attr` DROP `will`; + + +-- +-- Create table: `mana_char_attr` +-- + +CREATE TABLE IF NOT EXISTS `mana_char_attr` ( + `char_id` int(10) unsigned NOT NULL, + `attr_id` int(10) unsigned NOT NULL, + `attr_base` double unsigned NOT NULL, + `attr_mod` double unsigned NOT NULL, + -- + PRIMARY KEY (`char_id`, `attr_id`), + FOREIGN KEY (`char_id`) + REFERENCES `mana_characters` (`id`) + ON DELETE CASCADE +) ENGINE=InnoDB +DEFAULT CHARSET=utf8; + +-- +-- 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 tinyint(3) unsigned NOT NULL, + inventory_slot tinyint(3) unsigned NOT NULL, + -- + PRIMARY KEY (`id`), + UNIQUE KEY `owner_id` (`owner_id`, ) + FOREIGN KEY (owner_id) REFERENCES mana_characters(id) +) ENGINE=InnoDB +DEFAULT CHARSET=utf8; + +UPDATE mana_world_states SET value = '10', moddate = UNIX_TIMESTAMP() WHERE state_name = 'database_version'; diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql index bc5eefba..94aabdad 100644 --- a/src/sql/sqlite/createTables.sql +++ b/src/sql/sqlite/createTables.sql @@ -52,16 +52,9 @@ CREATE TABLE mana_characters level INTEGER NOT NULL, char_pts INTEGER NOT NULL, correct_pts INTEGER NOT NULL, - money INTEGER NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, map_id INTEGER NOT NULL, - str INTEGER NOT NULL, - agi INTEGER NOT NULL, - dex INTEGER NOT NULL, - vit INTEGER NOT NULL, - int INTEGER NOT NULL, - will INTEGER NOT NULL, -- FOREIGN KEY (user_id) REFERENCES mana_accounts(id) ); @@ -71,6 +64,20 @@ CREATE UNIQUE INDEX mana_characters_name ON mana_characters ( name ); ----------------------------------------------------------------------------- +CREATE TABLE mana_char_attr +( + char_id INTEGER NOT NULL, + attr_id INTEGER NOT NULL, + attr_base FLOAT NOT NULL, + attr_mod FLOAT NOT NULL, + -- + FOREIGN KEY (char_id) REFERENCES mana_characters(id) +); + +CREATE INDEX mana_char_attr_char ON mana_char_attr ( char_id ); + +----------------------------------------------------------------------------- + CREATE TABLE mana_char_skills ( char_id INTEGER NOT NULL, @@ -165,6 +172,18 @@ CREATE INDEX mana_item_attributes_item ON mana_item_attributes ( item_id ); ----------------------------------------------------------------------------- +CREATE TABLE mana_char_equips +( + id INTEGER PRIMARY KEY, + owner_id INTEGER NOT NULL, + slot_type INTEGER NOT NULL, + inventory_slot INTEGER NOT NULL, + -- + FOREIGN KEY (owner_id) REFERENCES mana_characters(id) +); + +----------------------------------------------------------------------------- + -- todo: remove class_id and amount and reference on mana_item_instances CREATE TABLE mana_inventories ( @@ -386,7 +405,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,'9', strftime('%s','now')); +INSERT INTO mana_world_states VALUES('database_version', NULL,'10', strftime('%s','now')); -- all known transaction codes |