Index: trunk/sql/updates/117_trinityscript.sql
===================================================================
--- trunk/sql/updates/117_trinityscript.sql (revision 109)
+++ trunk/sql/updates/117_trinityscript.sql (revision 109)
@@ -0,0 +1,64 @@
+-- 
+-- NOTE: If you have temporary stored data in table `eventai_localized_texts` make sure to make backup of this before running this update!
+-- NOTE: If you have any texts in current eventai_texts and they are not using entries valid for *_texts table, you _will_ get error messages on startup.
+-- NOTE: Do not run this update twice, it may create bad data if you choose to do so.
+-- 
+
+-- drop obsolete table
+DROP TABLE eventai_localized_texts;
+
+-- alter and add fields in table `eventai_texts`
+ALTER TABLE eventai_texts CHANGE COLUMN `id` `entry` mediumint(8) NOT NULL;
+ALTER TABLE eventai_texts CHANGE COLUMN `text` `content_default` text NOT NULL AFTER `entry`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc1` text AFTER `content_default`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc2` text AFTER `content_loc1`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc3` text AFTER `content_loc2`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc4` text AFTER `content_loc3`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc5` text AFTER `content_loc4`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc6` text AFTER `content_loc5`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc7` text AFTER `content_loc6`;
+ALTER TABLE eventai_texts ADD COLUMN `content_loc8` text AFTER `content_loc7`;
+ALTER TABLE eventai_texts ADD COLUMN `sound` mediumint(8) unsigned NOT NULL default '0' AFTER `content_loc8`;
+ALTER TABLE eventai_texts ADD COLUMN `type` tinyint unsigned NOT NULL default '0' AFTER `sound`;
+ALTER TABLE eventai_texts ADD COLUMN `language` tinyint unsigned NOT NULL default '0' AFTER `type`;
+ALTER TABLE eventai_texts MODIFY COLUMN `comment` text;
+
+-- get our current action type, and update text type = yell
+UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=1 WHERE eventai_scripts.action1_type IN (2,7) AND eventai_scripts.action1_param1=eventai_texts.entry;
+UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=1 WHERE eventai_scripts.action2_type IN (2,7) AND eventai_scripts.action2_param1=eventai_texts.entry;
+UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=1 WHERE eventai_scripts.action3_type IN (2,7) AND eventai_scripts.action3_param1=eventai_texts.entry;
+-- get our current action type, and update text type = textemote
+UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=2 WHERE eventai_scripts.action1_type IN (3,8) AND eventai_scripts.action1_param1=eventai_texts.entry;
+UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=2 WHERE eventai_scripts.action2_type IN (3,8) AND eventai_scripts.action2_param1=eventai_texts.entry;
+UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=2 WHERE eventai_scripts.action3_type IN (3,8) AND eventai_scripts.action3_param1=eventai_texts.entry;
+
+-- update our scripts, for all action type 2, 3, 6, 7 & 8 to become 1
+UPDATE eventai_scripts SET action1_type=1 WHERE action1_type IN (2,3,6,7,8);
+UPDATE eventai_scripts SET action2_type=1 WHERE action2_type IN (2,3,6,7,8);
+UPDATE eventai_scripts SET action3_type=1 WHERE action3_type IN (2,3,6,7,8);
+
+-- was OOC, so at least one could be -1, set this to 0 (dev note: below will be bad, if run twice)
+UPDATE eventai_scripts SET action1_param2=0 WHERE action1_type=1 AND action1_param2=-1;
+UPDATE eventai_scripts SET action1_param3=0 WHERE action1_type=1 AND action1_param3=-1;
+UPDATE eventai_scripts SET action2_param2=0 WHERE action2_type=1 AND action2_param2=-1;
+UPDATE eventai_scripts SET action2_param3=0 WHERE action2_type=1 AND action2_param3=-1;
+UPDATE eventai_scripts SET action3_param2=0 WHERE action3_type=1 AND action3_param2=-1;
+UPDATE eventai_scripts SET action3_param3=0 WHERE action3_type=1 AND action3_param3=-1;
+
+-- expect all to be action type 1 now, continue convert to negative text entry
+UPDATE eventai_scripts SET action1_param1=(`action1_param1`) *-1 WHERE action1_type=1 AND action1_param1>0;
+UPDATE eventai_scripts SET action2_param1=(`action2_param1`) *-1 WHERE action2_type=1 AND action2_param1>0;
+UPDATE eventai_scripts SET action3_param1=(`action3_param1`) *-1 WHERE action3_type=1 AND action3_param1>0;
+
+UPDATE eventai_scripts SET action1_param2=(`action1_param2`) *-1 WHERE action1_type=1 AND action1_param2>0;
+UPDATE eventai_scripts SET action2_param2=(`action2_param2`) *-1 WHERE action2_type=1 AND action2_param2>0;
+UPDATE eventai_scripts SET action3_param2=(`action3_param2`) *-1 WHERE action3_type=1 AND action3_param2>0;
+
+UPDATE eventai_scripts SET action1_param3=(`action1_param3`) *-1 WHERE action1_type=1 AND action1_param3>0;
+UPDATE eventai_scripts SET action2_param3=(`action2_param3`) *-1 WHERE action2_type=1 AND action2_param3>0;
+UPDATE eventai_scripts SET action3_param3=(`action3_param3`) *-1 WHERE action3_type=1 AND action3_param3>0;
+
+-- now we have negative numbers in script, must make sure text entries have same entry as script
+UPDATE eventai_texts SET entry=(`entry`) *-1 WHERE entry>0;
+
+ALTER TABLE script_texts MODIFY COLUMN `sound` mediumint(8) unsigned NOT NULL default '0';
Index: trunk/sql/world.sql
===================================================================
--- trunk/sql/world.sql (revision 97)
+++ trunk/sql/world.sql (revision 109)
@@ -570,8 +570,8 @@
   `content_loc8` text,
   `sound` mediumint(8) unsigned NOT NULL default '0',
-  `type` tinyint(3) unsigned NOT NULL default '0',
-  `language` tinyint(3) unsigned NOT NULL default '0',
+  `type` tinyint unsigned NOT NULL default '0',
+  `language` tinyint unsigned NOT NULL default '0',
   `comment` text,
-  PRIMARY KEY  (`entry`)
+  PRIMARY KEY (`entry`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom Texts';
 
@@ -691,28 +691,28 @@
 DROP TABLE IF EXISTS `eventai_scripts`;
 CREATE TABLE `eventai_scripts` (
-  `id` int(11) unsigned NOT NULL auto_increment COMMENT 'Identifier',
+  `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT,
   `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier',
   `event_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Event Type',
-  `event_inverse_phase_mask` int(11) NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in',
+  `event_inverse_phase_mask` int(11) signed NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in',
   `event_chance` int(3) unsigned NOT NULL default '100',
   `event_flags` int(3) unsigned NOT NULL default '0',
-  `event_param1` int(11) NOT NULL default '0',
-  `event_param2` int(11) NOT NULL default '0',
-  `event_param3` int(11) NOT NULL default '0',
-  `event_param4` int(11) NOT NULL default '0',
+  `event_param1` int(11) signed NOT NULL default '0',
+  `event_param2` int(11) signed NOT NULL default '0',
+  `event_param3` int(11) signed NOT NULL default '0',
+  `event_param4` int(11) signed NOT NULL default '0',
   `action1_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type',
-  `action1_param1` int(11) NOT NULL default '0',
-  `action1_param2` int(11) NOT NULL default '0',
-  `action1_param3` int(11) NOT NULL default '0',
+  `action1_param1` int(11) signed NOT NULL default '0',
+  `action1_param2` int(11) signed NOT NULL default '0',
+  `action1_param3` int(11) signed NOT NULL default '0',
   `action2_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type',
-  `action2_param1` int(11) NOT NULL default '0',
-  `action2_param2` int(11) NOT NULL default '0',
-  `action2_param3` int(11) NOT NULL default '0',
+  `action2_param1` int(11) signed NOT NULL default '0',
+  `action2_param2` int(11) signed NOT NULL default '0',
+  `action2_param3` int(11) signed NOT NULL default '0',
   `action3_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type',
-  `action3_param1` int(11) NOT NULL default '0',
-  `action3_param2` int(11) NOT NULL default '0',
-  `action3_param3` int(11) NOT NULL default '0',
+  `action3_param1` int(11) signed NOT NULL default '0',
+  `action3_param2` int(11) signed NOT NULL default '0',
+  `action3_param3` int(11) signed NOT NULL default '0',
   `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts';
 
@@ -732,5 +732,5 @@
 DROP TABLE IF EXISTS `eventai_summons`;
 CREATE TABLE `eventai_summons` (
-  `id` int(11) unsigned NOT NULL auto_increment COMMENT 'Location Identifier',
+  `id` int(11) unsigned NOT NULL COMMENT 'Location Identifier' AUTO_INCREMENT,
   `position_x` float NOT NULL default '0',
   `position_y` float NOT NULL default '0',
@@ -739,5 +739,5 @@
   `spawntimesecs` int(11) unsigned NOT NULL default '120',
   `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations';
 
@@ -757,9 +757,20 @@
 DROP TABLE IF EXISTS `eventai_texts`;
 CREATE TABLE `eventai_texts` (
-  `id` int(11) unsigned NOT NULL default '0' COMMENT 'Identifier',
-  `text` varchar(255) NOT NULL default '',
-  `comment` varchar(255) NOT NULL default '' COMMENT 'Text Comment',
-  PRIMARY KEY  (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Texts used in EventAI';
+  `entry` mediumint(8) NOT NULL,
+  `content_default` text NOT NULL,
+  `content_loc1` text,
+  `content_loc2` text,
+  `content_loc3` text,
+  `content_loc4` text,
+  `content_loc5` text,
+  `content_loc6` text,
+  `content_loc7` text,
+  `content_loc8` text,
+  `sound` mediumint(8) unsigned NOT NULL default '0',
+  `type` tinyint unsigned NOT NULL default '0',
+  `language` tinyint unsigned NOT NULL default '0',
+  `comment` text,
+  PRIMARY KEY (`entry`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts';
 
 --
@@ -770,4 +781,36 @@
 /*!40000 ALTER TABLE `eventai_texts` DISABLE KEYS */;
 /*!40000 ALTER TABLE `eventai_texts` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `script_texts`
+--
+
+DROP TABLE IF EXISTS `script_texts`;
+CREATE TABLE `script_texts` (
+  `entry` mediumint(8) NOT NULL,
+  `content_default` text NOT NULL,
+  `content_loc1` text,
+  `content_loc2` text,
+  `content_loc3` text,
+  `content_loc4` text,
+  `content_loc5` text,
+  `content_loc6` text,
+  `content_loc7` text,
+  `content_loc8` text,
+  `sound` mediumint(8) unsigned NOT NULL default '0',
+  `type` tinyint unsigned NOT NULL default '0',
+  `language` tinyint unsigned NOT NULL default '0',
+  `comment` text,
+  PRIMARY KEY  (`entry`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts';
+
+--
+-- Dumping data for table `script_texts`
+--
+
+LOCK TABLES `eventai_texts` WRITE;
+/*!40000 ALTER TABLE `script_texts` DISABLE KEYS */;
+/*!40000 ALTER TABLE `script_texts` ENABLE KEYS */;
 UNLOCK TABLES;
 
