server/contrib/convertConditions
Schmoozerd 8c29893310 [11964] Implement new conditions system
Tree-like design idea by Faramir118, thanks for that!

* Add `conditions` table to store conditions.
* REPLACE current handling of conditions for the *_loot_template tables
  Convert the old conditions in *_loot_template to the new system by SQL-Queries
* ADD support for new conditions to gossip_menu and gossip_menu_option.
  If for these tables no condition_id (new system) is provided, the old conditions will still be used
* Add a small helper python script to contrib/convertConditions, see README there for details
* Add new command to reload the `conditions` table (.reload conditions)
* Add two Meta-Condition types CONDITION_AND (-1) and CONDITION_OR (-2) which are used as:
  value1 (as condition_entry) AND / OR value2 (as condition_entry)

  With these meta-conditions it is possible to create tree like and very complicated combined conditions (like HasAura && (HasItem || HasQuest))

NOTE about conversion:
For easier convertion all the old table data is still preserved, but will be removed eventually (within a circle of the moon approximately)
The python script will not create an optimal initial fill of the `conditions` table. You might want to tweak it manually or suggest some optimized algorithm :)

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2012-04-15 23:06:00 +02:00
..
ConvertConditions.py [11964] Implement new conditions system 2012-04-15 23:06:00 +02:00
README.txt [11964] Implement new conditions system 2012-04-15 23:06:00 +02:00

#
# Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
#

This small Python script is intended to help with the convertion
of the old condition-system to the new conditions system.

Requirements:
* Python 2.5 (at least tested with this version)
* The MySQLdb module (found on http://sourceforge.net/projects/mysql-python/)

You need to edit the ConvertConditions.py file for configure.

First variables that must be set are related to the database connection (host, user, passw).

Then you must specify which databases you want to convert (databases)
For portability, you must provide the name of the database, and the client expansion for which it is.
(2 == WotLK, 1 == TBC, 0 == classic)

You can also provide a list of databases to process multiple in one run.

With the next option, you can specify if you want to load a current `conditions` table (loadOldConditions)
Setting = 1 will load old conditions (default = 0).
In case you want to load from a database, which is not the first database you want the script to work on,
you can provide its name with the database variable.

The script will create (and overwrite existing!) sql-files:
conditions_dump.sql <-- this file stores a possible dump for the conditions table for the old conditions of your databases. (including the loaded)

<DB_NAME>_updates.sql <-- these files store the UPDATE statements to fill the condition_id fields for the tables.
                          One file is created for each provided database.

Backup your data, before you change anything!