Skip to content

Commit

Permalink
[9881] Add additional fields to *_scripts tables for storage of more …
Browse files Browse the repository at this point in the history
…data.

Currently not in use by any SCRIPT_COMMAND_* but we have secret plans to be revealed in the future!

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed May 12, 2010
1 parent 2c0e105 commit 669a3df
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 14 deletions.
20 changes: 19 additions & 1 deletion 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_9854_01_mangos_spell_bonus_data` bit(1) default NULL
`required_9881_01_mangos_scripts` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -1366,6 +1366,9 @@ CREATE TABLE `event_scripts` (
`command` mediumint(8) unsigned NOT NULL default '0',
`datalong` mediumint(8) unsigned NOT NULL default '0',
`datalong2` int(10) unsigned NOT NULL default '0',
`datalong3` int(10) unsigned NOT NULL default '0',
`datalong4` int(10) unsigned NOT NULL default '0',
`data_flags` tinyint(3) unsigned NOT NULL default '0',
`dataint` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
Expand Down Expand Up @@ -1843,6 +1846,9 @@ CREATE TABLE `gameobject_scripts` (
`command` mediumint(8) unsigned NOT NULL default '0',
`datalong` mediumint(8) unsigned NOT NULL default '0',
`datalong2` int(10) unsigned NOT NULL default '0',
`datalong3` int(10) unsigned NOT NULL default '0',
`datalong4` int(10) unsigned NOT NULL default '0',
`data_flags` tinyint(3) unsigned NOT NULL default '0',
`dataint` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
Expand Down Expand Up @@ -2013,6 +2019,9 @@ CREATE TABLE `gossip_scripts` (
`command` mediumint(8) unsigned NOT NULL default '0',
`datalong` mediumint(8) unsigned NOT NULL default '0',
`datalong2` int(10) unsigned NOT NULL default '0',
`datalong3` int(10) unsigned NOT NULL default '0',
`datalong4` int(10) unsigned NOT NULL default '0',
`data_flags` tinyint(3) unsigned NOT NULL default '0',
`dataint` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
Expand Down Expand Up @@ -13716,6 +13725,9 @@ CREATE TABLE `quest_end_scripts` (
`command` mediumint(8) unsigned NOT NULL default '0',
`datalong` mediumint(8) unsigned NOT NULL default '0',
`datalong2` int(10) unsigned NOT NULL default '0',
`datalong3` int(10) unsigned NOT NULL default '0',
`datalong4` int(10) unsigned NOT NULL default '0',
`data_flags` tinyint(3) unsigned NOT NULL default '0',
`dataint` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
Expand Down Expand Up @@ -13791,6 +13803,9 @@ CREATE TABLE `quest_start_scripts` (
`command` mediumint(8) unsigned NOT NULL default '0',
`datalong` mediumint(8) unsigned NOT NULL default '0',
`datalong2` int(10) unsigned NOT NULL default '0',
`datalong3` int(10) unsigned NOT NULL default '0',
`datalong4` int(10) unsigned NOT NULL default '0',
`data_flags` tinyint(3) unsigned NOT NULL default '0',
`dataint` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
Expand Down Expand Up @@ -18764,6 +18779,9 @@ CREATE TABLE `spell_scripts` (
`command` mediumint(8) unsigned NOT NULL default '0',
`datalong` mediumint(8) unsigned NOT NULL default '0',
`datalong2` int(10) unsigned NOT NULL default '0',
`datalong3` int(10) unsigned NOT NULL default '0',
`datalong4` int(10) unsigned NOT NULL default '0',
`data_flags` tinyint(3) unsigned NOT NULL default '0',
`dataint` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
Expand Down
25 changes: 25 additions & 0 deletions sql/updates/9881_01_mangos_scripts.sql
@@ -0,0 +1,25 @@
ALTER TABLE db_version CHANGE COLUMN required_9854_01_mangos_spell_bonus_data required_9881_01_mangos_scripts bit;

ALTER TABLE event_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2;
ALTER TABLE event_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3;
ALTER TABLE event_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4;

ALTER TABLE gameobject_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2;
ALTER TABLE gameobject_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3;
ALTER TABLE gameobject_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4;

ALTER TABLE gossip_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2;
ALTER TABLE gossip_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3;
ALTER TABLE gossip_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4;

ALTER TABLE quest_end_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2;
ALTER TABLE quest_end_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3;
ALTER TABLE quest_end_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4;

ALTER TABLE quest_start_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2;
ALTER TABLE quest_start_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3;
ALTER TABLE quest_start_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4;

ALTER TABLE spell_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2;
ALTER TABLE spell_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3;
ALTER TABLE spell_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4;
2 changes: 2 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -58,6 +58,7 @@ pkgdata_DATA = \
9826_01_mangos_spell_script_target.sql \
9849_01_characters_saved_variables.sql \
9854_01_mangos_spell_bonus_data.sql \
9881_01_mangos_scripts.sql \
README

## Additional files to include when running 'make dist'
Expand Down Expand Up @@ -96,4 +97,5 @@ EXTRA_DIST = \
9826_01_mangos_spell_script_target.sql \
9849_01_characters_saved_variables.sql \
9854_01_mangos_spell_bonus_data.sql \
9881_01_mangos_scripts.sql \
README
25 changes: 14 additions & 11 deletions src/game/ObjectMgr.cpp
Expand Up @@ -4159,7 +4159,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)

scripts.clear(); // need for reload support

QueryResult *result = WorldDatabase.PQuery( "SELECT id,delay,command,datalong,datalong2,dataint, x, y, z, o FROM %s", tablename );
QueryResult *result = WorldDatabase.PQuery( "SELECT id, delay, command, datalong, datalong2, datalong3, datalong4, data_flags, dataint, x, y, z, o FROM %s", tablename );

uint32 count = 0;

Expand All @@ -4181,16 +4181,19 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)

Field *fields = result->Fetch();
ScriptInfo tmp;
tmp.id = fields[0].GetUInt32();
tmp.delay = fields[1].GetUInt32();
tmp.command = fields[2].GetUInt32();
tmp.datalong = fields[3].GetUInt32();
tmp.datalong2 = fields[4].GetUInt32();
tmp.dataint = fields[5].GetInt32();
tmp.x = fields[6].GetFloat();
tmp.y = fields[7].GetFloat();
tmp.z = fields[8].GetFloat();
tmp.o = fields[9].GetFloat();
tmp.id = fields[0].GetUInt32();
tmp.delay = fields[1].GetUInt32();
tmp.command = fields[2].GetUInt32();
tmp.datalong = fields[3].GetUInt32();
tmp.datalong2 = fields[4].GetUInt32();
tmp.datalong3 = fields[5].GetUInt32();
tmp.datalong4 = fields[6].GetUInt32();
tmp.data_flags = fields[7].GetUInt32();
tmp.dataint = fields[8].GetInt32();
tmp.x = fields[9].GetFloat();
tmp.y = fields[10].GetFloat();
tmp.z = fields[11].GetFloat();
tmp.o = fields[12].GetFloat();

// generic command args check
switch(tmp.command)
Expand Down
3 changes: 3 additions & 0 deletions src/game/ObjectMgr.h
Expand Up @@ -75,6 +75,9 @@ struct ScriptInfo
uint32 command;
uint32 datalong;
uint32 datalong2;
uint32 datalong3;
uint32 datalong4;
uint32 data_flags;
int32 dataint;
float x;
float y;
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 "9880"
#define REVISION_NR "9881"
#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_9849_01_characters_saved_variables"
#define REVISION_DB_MANGOS "required_9854_01_mangos_spell_bonus_data"
#define REVISION_DB_MANGOS "required_9881_01_mangos_scripts"
#define REVISION_DB_REALMD "required_9748_01_realmd_realmlist"
#endif // __REVISION_SQL_H__

5 comments on commit 669a3df

@LordJZ
Copy link
Contributor

@LordJZ LordJZ commented on 669a3df May 12, 2010

Choose a reason for hiding this comment

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

W00t, this project needs moar scriptz!

@arjanwoldring
Copy link

Choose a reason for hiding this comment

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

Darn, NoFantasy made me curious...:P

@Andrewzz
Copy link

Choose a reason for hiding this comment

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

Damn now I cant wait to know what is comming into MaNGOS :D
P.D: Hope it to be "near future" xD

@NoFantasy
Copy link

Choose a reason for hiding this comment

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

Lol, it's nothing big planned, just improving script_command_ a bit. Making it more useful for events like having creatures "talk with each other" at quest end for example. Instead of source talking to target, switch to find a near buddy who will do the talking. Ok detail though, makes things come more alive and dynamic.

@Grandres
Copy link

Choose a reason for hiding this comment

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

Could you update http://udbwiki.webhop.net/index.php/Main_Page ? I'll be greatful. :)

Please sign in to comment.