Skip to content

Commit

Permalink
[10307] Rename two tables to prefix scripted_, making the tables have…
Browse files Browse the repository at this point in the history
… consistent names

Both tables (areatrigger / event_id) are used explicit to store ScriptName for script library use.
In addition rename to ScriptName in instance_template

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Aug 1, 2010
1 parent 51ae74c commit 6fa98d1
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 54 deletions.
84 changes: 42 additions & 42 deletions sql/mangos.sql
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_10299_01_mangos_event_id_scripts` bit(1) default NULL
`required_10307_03_mangos_scripted_event_id` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -106,26 +106,6 @@ LOCK TABLES `areatrigger_involvedrelation` WRITE;
/*!40000 ALTER TABLE `areatrigger_involvedrelation` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `areatrigger_scripts`
--

DROP TABLE IF EXISTS `areatrigger_scripts`;
CREATE TABLE `areatrigger_scripts` (
`entry` MEDIUMINT( 8 ) NOT NULL ,
`ScriptName` CHAR( 64 ) NOT NULL ,
PRIMARY KEY ( `entry` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `areatrigger_scripts`
--

LOCK TABLES `areatrigger_scripts` WRITE;
/*!40000 ALTER TABLE `areatrigger_scripts` DISABLE KEYS */;
/*!40000 ALTER TABLE `areatrigger_scripts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `areatrigger_tavern`
--
Expand Down Expand Up @@ -1417,26 +1397,6 @@ LOCK TABLES `creature_ai_texts` WRITE;
/*!40000 ALTER TABLE `creature_ai_texts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `event_id_scripts`
--

DROP TABLE IF EXISTS `event_id_scripts`;
CREATE TABLE `event_id_scripts` (
`id` mediumint(8) NOT NULL,
`ScriptName` char(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Script library scripted events';

--
-- Dumping data for table `event_id_scripts`
--

LOCK TABLES `event_id_scripts` WRITE;
/*!40000 ALTER TABLE `event_id_scripts` DISABLE KEYS */;
/*!40000 ALTER TABLE `event_id_scripts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `event_scripts`
--
Expand Down Expand Up @@ -2130,7 +2090,7 @@ CREATE TABLE `instance_template` (
`parent` smallint(5) unsigned NOT NULL default '0',
`levelMin` tinyint(3) unsigned NOT NULL default '0',
`levelMax` tinyint(3) unsigned NOT NULL default '0',
`script` varchar(128) NOT NULL default '',
`ScriptName` varchar(128) NOT NULL default '',
PRIMARY KEY (`map`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Expand Down Expand Up @@ -14103,6 +14063,46 @@ LOCK TABLES `reserved_name` WRITE;
/*!40000 ALTER TABLE `reserved_name` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `scripted_areatrigger`
--

DROP TABLE IF EXISTS `scripted_areatrigger`;
CREATE TABLE `scripted_areatrigger` (
`entry` MEDIUMINT( 8 ) NOT NULL ,
`ScriptName` CHAR( 64 ) NOT NULL ,
PRIMARY KEY ( `entry` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `scripted_areatrigger`
--

LOCK TABLES `scripted_areatrigger` WRITE;
/*!40000 ALTER TABLE `scripted_areatrigger` DISABLE KEYS */;
/*!40000 ALTER TABLE `scripted_areatrigger` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `scripted_event_id`
--

DROP TABLE IF EXISTS `scripted_event_id`;
CREATE TABLE `event_id_scripts` (
`id` mediumint(8) NOT NULL,
`ScriptName` char(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Script library scripted events';

--
-- Dumping data for table `scripted_event_id`
--

LOCK TABLES `scripted_event_id` WRITE;
/*!40000 ALTER TABLE `scripted_event_id` DISABLE KEYS */;
/*!40000 ALTER TABLE `scripted_event_id` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `skill_discovery_template`
--
Expand Down
3 changes: 3 additions & 0 deletions sql/updates/10307_01_mangos_instance_template.sql
@@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_10299_01_mangos_event_id_scripts required_10307_01_mangos_instance_template bit;

ALTER TABLE instance_template CHANGE COLUMN `script` `ScriptName` varchar(128) NOT NULL default '';
3 changes: 3 additions & 0 deletions sql/updates/10307_02_mangos_scripted_areatrigger.sql
@@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_10307_01_mangos_instance_template required_10307_02_mangos_scripted_areatrigger bit;

RENAME TABLE areatrigger_scripts TO scripted_areatrigger;
3 changes: 3 additions & 0 deletions sql/updates/10307_03_mangos_scripted_event_id.sql
@@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_10307_02_mangos_scripted_areatrigger required_10307_03_mangos_scripted_event_id bit;

RENAME TABLE event_id_scripts TO scripted_event_id;
6 changes: 6 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -61,6 +61,9 @@ pkgdata_DATA = \
10289_01_mangos_creature_template.sql \
10289_02_mangos_creature_model_info.sql \
10299_01_mangos_event_id_scripts.sql \
10307_01_mangos_instance_template.sql \
10307_02_mangos_scripted_areatrigger.sql \
10307_03_mangos_scripted_event_id.sql \
README

## Additional files to include when running 'make dist'
Expand Down Expand Up @@ -102,4 +105,7 @@ EXTRA_DIST = \
10289_01_mangos_creature_template.sql \
10289_02_mangos_creature_model_info.sql \
10299_01_mangos_event_id_scripts.sql \
10307_01_mangos_instance_template.sql \
10307_02_mangos_scripted_areatrigger.sql \
10307_03_mangos_scripted_event_id.sql \
README
20 changes: 10 additions & 10 deletions src/game/ObjectMgr.cpp
Expand Up @@ -5200,7 +5200,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
void ObjectMgr::LoadAreaTriggerScripts()
{
mAreaTriggerScripts.clear(); // need for reload case
QueryResult *result = WorldDatabase.Query("SELECT entry, ScriptName FROM areatrigger_scripts");
QueryResult *result = WorldDatabase.Query("SELECT entry, ScriptName FROM scripted_areatrigger");

uint32 count = 0;

Expand All @@ -5210,7 +5210,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
bar.step();

sLog.outString();
sLog.outString( ">> Loaded %u areatrigger scripts", count );
sLog.outString( ">> Loaded %u scripted areatrigger", count );
return;
}

Expand All @@ -5229,7 +5229,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
sLog.outErrorDb("Table `areatrigger_scripts` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", Trigger_ID);
sLog.outErrorDb("Table `scripted_areatrigger` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}

Expand All @@ -5245,7 +5245,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
void ObjectMgr::LoadEventIdScripts()
{
mEventIdScripts.clear(); // need for reload case
QueryResult *result = WorldDatabase.Query("SELECT id, ScriptName FROM event_id_scripts");
QueryResult *result = WorldDatabase.Query("SELECT id, ScriptName FROM scripted_event_id");

uint32 count = 0;

Expand All @@ -5255,7 +5255,7 @@ void ObjectMgr::LoadEventIdScripts()
bar.step();

sLog.outString();
sLog.outString( ">> Loaded %u event id scripts", count );
sLog.outString( ">> Loaded %u scripted event id", count );
return;
}

Expand Down Expand Up @@ -5314,7 +5314,7 @@ void ObjectMgr::LoadEventIdScripts()

std::set<uint32>::const_iterator itr = evt_scripts.find(eventId);
if (itr == evt_scripts.end())
sLog.outErrorDb("Table `event_id_scripts` has id %u not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u or path taxi node data",
sLog.outErrorDb("Table `scripted_event_id` has id %u not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u or path taxi node data",
eventId, SPELL_EFFECT_SEND_EVENT);

mEventIdScripts[eventId] = GetScriptId(scriptName);
Expand All @@ -5323,7 +5323,7 @@ void ObjectMgr::LoadEventIdScripts()
delete result;

sLog.outString();
sLog.outString( ">> Loaded %u event id scripts", count );
sLog.outString( ">> Loaded %u scripted event id", count );
}

uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team )
Expand Down Expand Up @@ -8859,11 +8859,11 @@ void ObjectMgr::LoadScriptNames()
"UNION "
"SELECT DISTINCT(ScriptName) FROM item_template WHERE ScriptName <> '' "
"UNION "
"SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' "
"SELECT DISTINCT(ScriptName) FROM scripted_areatrigger WHERE ScriptName <> '' "
"UNION "
"SELECT DISTINCT(ScriptName) FROM event_id_scripts WHERE ScriptName <> '' "
"SELECT DISTINCT(ScriptName) FROM scripted_event_id WHERE ScriptName <> '' "
"UNION "
"SELECT DISTINCT(script) FROM instance_template WHERE script <> ''");
"SELECT DISTINCT(ScriptName) FROM instance_template WHERE ScriptName <> ''");

if( !result )
{
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10306"
#define REVISION_NR "10307"
#endif // __REVISION_NR_H__
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
@@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_10254_01_characters_auctionhouse"
#define REVISION_DB_MANGOS "required_10299_01_mangos_event_id_scripts"
#define REVISION_DB_MANGOS "required_10307_03_mangos_scripted_event_id"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__

2 comments on commit 6fa98d1

@Saeba
Copy link

@Saeba Saeba commented on 6fa98d1 Aug 1, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tipo
+DROP TABLE IF EXISTS scripted_event_id;
+CREATE TABLE event_id_scripts (

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed. Anyway thank for report :)

Please sign in to comment.