diff --git a/sql/mangos.sql b/sql/mangos.sql index 6188a2858..e01a90763 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -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_10786_02_mangos_spell_proc_event` bit(1) default NULL + `required_10788_02_mangos_creature_template_addon` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -838,7 +838,8 @@ CREATE TABLE `creature_addon` ( `guid` int(10) unsigned NOT NULL default '0', `mount` mediumint(8) unsigned NOT NULL default '0', `bytes1` int(10) unsigned NOT NULL default '0', - `bytes2` int(10) unsigned NOT NULL default '0', + `b2_0_sheath` tinyint(3) unsigned NOT NULL DEFAULT '0', + `b2_1_pvp_state` tinyint(3) unsigned NOT NULL DEFAULT '0', `emote` int(10) unsigned NOT NULL default '0', `moveflags` int(10) unsigned NOT NULL default '0', `auras` text, @@ -1278,7 +1279,8 @@ CREATE TABLE `creature_template_addon` ( `entry` mediumint(8) unsigned NOT NULL default '0', `mount` mediumint(8) unsigned NOT NULL default '0', `bytes1` int(10) unsigned NOT NULL default '0', - `bytes2` int(10) unsigned NOT NULL default '0', + `b2_0_sheath` tinyint(3) unsigned NOT NULL DEFAULT '0', + `b2_1_pvp_state` tinyint(3) unsigned NOT NULL DEFAULT '0', `emote` mediumint(8) unsigned NOT NULL default '0', `moveflags` int(10) unsigned NOT NULL default '0', `auras` text, diff --git a/sql/updates/10788_01_mangos_creature_addon.sql b/sql/updates/10788_01_mangos_creature_addon.sql new file mode 100644 index 000000000..0edb0479e --- /dev/null +++ b/sql/updates/10788_01_mangos_creature_addon.sql @@ -0,0 +1,11 @@ +ALTER TABLE db_version CHANGE COLUMN required_10786_02_mangos_spell_proc_event required_10788_01_mangos_creature_addon bit; + +ALTER TABLE creature_addon + ADD COLUMN b2_0_sheath tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER bytes1, + ADD COLUMN b2_1_pvp_state tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER b2_0_sheath; + +UPDATE creature_addon SET b2_0_sheath = bytes2 & 0x000000FF; +UPDATE creature_addon SET b2_1_pvp_state = (bytes2 & 0x0000FF00) >> 8; + +ALTER TABLE creature_addon + DROP COLUMN bytes2; diff --git a/sql/updates/10788_02_mangos_creature_template_addon.sql b/sql/updates/10788_02_mangos_creature_template_addon.sql new file mode 100644 index 000000000..4097e41ca --- /dev/null +++ b/sql/updates/10788_02_mangos_creature_template_addon.sql @@ -0,0 +1,11 @@ +ALTER TABLE db_version CHANGE COLUMN required_10788_01_mangos_creature_addon required_10788_02_mangos_creature_template_addon bit; + +ALTER TABLE creature_template_addon + ADD COLUMN b2_0_sheath tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER bytes1, + ADD COLUMN b2_1_pvp_state tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER b2_0_sheath; + +UPDATE creature_template_addon SET b2_0_sheath = bytes2 & 0x000000FF; +UPDATE creature_template_addon SET b2_1_pvp_state = (bytes2 & 0x0000FF00) >> 8; + +ALTER TABLE creature_template_addon + DROP COLUMN bytes2; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 0818b94dc..540a485dd 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -127,6 +127,8 @@ pkgdata_DATA = \ 10764_01_mangos_spell_proc_event.sql \ 10786_01_mangos_spell_proc_item_enchant.sql \ 10786_02_mangos_spell_proc_event.sql \ + 10788_01_mangos_creature_addon.sql \ + 10788_02_mangos_creature_template_addon.sql \ README ## Additional files to include when running 'make dist' @@ -234,4 +236,6 @@ EXTRA_DIST = \ 10764_01_mangos_spell_proc_event.sql \ 10786_01_mangos_spell_proc_item_enchant.sql \ 10786_02_mangos_spell_proc_event.sql \ + 10788_01_mangos_creature_addon.sql \ + 10788_02_mangos_creature_template_addon.sql \ README diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index be412a6bb..75d314b38 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1852,20 +1852,19 @@ bool Creature::LoadCreatureAddon(bool reload) SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF)); } - if (cainfo->bytes2 != 0) - { - // 0 SheathState - // 1 UnitPVPStateFlags Set at Creature::UpdateEntry (SetPvp()) - // 2 UnitRename Pet only, so always 0 for default creature - // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura + // UNIT_FIELD_BYTES_2 + // 0 SheathState + // 1 UnitPVPStateFlags Set at Creature::UpdateEntry (SetPvp()) + // 2 UnitRename Pet only, so always 0 for default creature + // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura + if (cainfo->stash != 0) + SetByteValue(UNIT_FIELD_BYTES_2, 0, cainfo->stash); - SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF)); - SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF)); - //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF)); - SetByteValue(UNIT_FIELD_BYTES_2, 2, 0); - //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF)); - SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); - } + if (cainfo->pvp_state != 0) + SetByteValue(UNIT_FIELD_BYTES_2, 1, cainfo->pvp_state); + + //SetByteValue(UNIT_FIELD_BYTES_2, 2, 0); + //SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); if (cainfo->emote != 0) SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); diff --git a/src/game/Creature.h b/src/game/Creature.h index 931bbdcd6..70200da11 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -197,13 +197,14 @@ struct CreatureDataAddonAura SpellEffectIndex effect_idx; }; -// from `creature_addon` table +// from `creature_addon` and `creature_template_addon`tables struct CreatureDataAddon { uint32 guidOrEntry; uint32 mount; uint32 bytes1; - uint32 bytes2; + uint8 stash; // SheathState + uint8 pvp_state; // UnitPVPStateFlags uint32 emote; uint32 splineFlags; CreatureDataAddonAura const* auras; // loaded as char* "spell1 eff1 spell2 eff2 ... " diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index b8d2a397a..247fb4a79 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -27,9 +27,9 @@ extern DatabaseMysql WorldDatabase; const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiis"; const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiii"; -const char CreatureDataAddonInfofmt[]="iiiiiis"; +const char CreatureDataAddonInfofmt[]="iiilliis"; const char CreatureModelfmt[]="iffbii"; -const char CreatureInfoAddonInfofmt[]="iiiiiis"; +const char CreatureInfoAddonInfofmt[]="iiilliis"; const char EquipmentInfofmt[]="iiii"; const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis"; const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 007040da1..b72d78909 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10787" + #define REVISION_NR "10788" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index cc4ad4000..dc3d28e9c 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10664_01_characters_arena_team_stats" - #define REVISION_DB_MANGOS "required_10786_02_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_10788_02_mangos_creature_template_addon" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__