[10788] Replace bytes in single field bytes2 by independent fields for creature_addon.

This commit is contained in:
VladimirMangos 2010-11-27 23:50:26 +03:00
parent 9460ed0494
commit 0c8a7c3826
9 changed files with 50 additions and 22 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `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'; ) 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', `guid` int(10) unsigned NOT NULL default '0',
`mount` mediumint(8) unsigned NOT NULL default '0', `mount` mediumint(8) unsigned NOT NULL default '0',
`bytes1` int(10) 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', `emote` int(10) unsigned NOT NULL default '0',
`moveflags` int(10) unsigned NOT NULL default '0', `moveflags` int(10) unsigned NOT NULL default '0',
`auras` text, `auras` text,
@ -1278,7 +1279,8 @@ CREATE TABLE `creature_template_addon` (
`entry` mediumint(8) unsigned NOT NULL default '0', `entry` mediumint(8) unsigned NOT NULL default '0',
`mount` mediumint(8) unsigned NOT NULL default '0', `mount` mediumint(8) unsigned NOT NULL default '0',
`bytes1` int(10) 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', `emote` mediumint(8) unsigned NOT NULL default '0',
`moveflags` int(10) unsigned NOT NULL default '0', `moveflags` int(10) unsigned NOT NULL default '0',
`auras` text, `auras` text,

View file

@ -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;

View file

@ -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;

View file

@ -127,6 +127,8 @@ pkgdata_DATA = \
10764_01_mangos_spell_proc_event.sql \ 10764_01_mangos_spell_proc_event.sql \
10786_01_mangos_spell_proc_item_enchant.sql \ 10786_01_mangos_spell_proc_item_enchant.sql \
10786_02_mangos_spell_proc_event.sql \ 10786_02_mangos_spell_proc_event.sql \
10788_01_mangos_creature_addon.sql \
10788_02_mangos_creature_template_addon.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -234,4 +236,6 @@ EXTRA_DIST = \
10764_01_mangos_spell_proc_event.sql \ 10764_01_mangos_spell_proc_event.sql \
10786_01_mangos_spell_proc_item_enchant.sql \ 10786_01_mangos_spell_proc_item_enchant.sql \
10786_02_mangos_spell_proc_event.sql \ 10786_02_mangos_spell_proc_event.sql \
10788_01_mangos_creature_addon.sql \
10788_02_mangos_creature_template_addon.sql \
README README

View file

@ -1852,20 +1852,19 @@ bool Creature::LoadCreatureAddon(bool reload)
SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF));
} }
if (cainfo->bytes2 != 0) // UNIT_FIELD_BYTES_2
{ // 0 SheathState
// 0 SheathState // 1 UnitPVPStateFlags Set at Creature::UpdateEntry (SetPvp())
// 1 UnitPVPStateFlags Set at Creature::UpdateEntry (SetPvp()) // 2 UnitRename Pet only, so always 0 for default creature
// 2 UnitRename Pet only, so always 0 for default creature // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
// 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)); if (cainfo->pvp_state != 0)
SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_2, 1, cainfo->pvp_state);
//SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
SetByteValue(UNIT_FIELD_BYTES_2, 2, 0); //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);
SetByteValue(UNIT_FIELD_BYTES_2, 3, 0);
}
if (cainfo->emote != 0) if (cainfo->emote != 0)
SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote);

View file

@ -197,13 +197,14 @@ struct CreatureDataAddonAura
SpellEffectIndex effect_idx; SpellEffectIndex effect_idx;
}; };
// from `creature_addon` table // from `creature_addon` and `creature_template_addon`tables
struct CreatureDataAddon struct CreatureDataAddon
{ {
uint32 guidOrEntry; uint32 guidOrEntry;
uint32 mount; uint32 mount;
uint32 bytes1; uint32 bytes1;
uint32 bytes2; uint8 stash; // SheathState
uint8 pvp_state; // UnitPVPStateFlags
uint32 emote; uint32 emote;
uint32 splineFlags; uint32 splineFlags;
CreatureDataAddonAura const* auras; // loaded as char* "spell1 eff1 spell2 eff2 ... " CreatureDataAddonAura const* auras; // loaded as char* "spell1 eff1 spell2 eff2 ... "

View file

@ -27,9 +27,9 @@ extern DatabaseMysql WorldDatabase;
const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiis"; const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiis";
const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiii"; const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiii";
const char CreatureDataAddonInfofmt[]="iiiiiis"; const char CreatureDataAddonInfofmt[]="iiilliis";
const char CreatureModelfmt[]="iffbii"; const char CreatureModelfmt[]="iffbii";
const char CreatureInfoAddonInfofmt[]="iiiiiis"; const char CreatureInfoAddonInfofmt[]="iiilliis";
const char EquipmentInfofmt[]="iiii"; const char EquipmentInfofmt[]="iiii";
const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis"; const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii";

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10787" #define REVISION_NR "10788"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_10664_01_characters_arena_team_stats" #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" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__