[8098] Support uint32 spell ids in code.

* Propertly work with uint32 spell ids in player action bar
* Fix in same time bug with not save equipment set button with id==0
* Merge misc field in character_action and playercreateinfo_action to action field as 3 byte
* Propertly load uint32 spell ids from character_spell
* Fixed types for some pet/creature related structure for spell id storing.
This commit is contained in:
VladimirMangos 2009-06-30 07:37:36 +04:00 committed by tomrus88
parent f1284882a9
commit c9fbd99579
21 changed files with 638 additions and 565 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` (
`required_8072_02_characters_characters` bit(1) default NULL
`required_8098_04_characters_pet_spell` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
@ -305,9 +305,8 @@ DROP TABLE IF EXISTS `character_action`;
CREATE TABLE `character_action` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`button` tinyint(3) unsigned NOT NULL default '0',
`action` smallint(5) unsigned NOT NULL default '0',
`action` int(11) unsigned NOT NULL default '0',
`type` tinyint(3) unsigned NOT NULL default '0',
`misc` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`button`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';

View file

@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`required_8071_01_mangos_command` bit(1) default NULL
`required_8098_02_mangos_playercreateinfo_action` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -9721,9 +9721,8 @@ CREATE TABLE `playercreateinfo_action` (
`race` tinyint(3) unsigned NOT NULL default '0',
`class` tinyint(3) unsigned NOT NULL default '0',
`button` smallint(5) unsigned NOT NULL default '0',
`action` smallint(5) unsigned NOT NULL default '0',
`action` int(11) unsigned NOT NULL default '0',
`type` smallint(5) unsigned NOT NULL default '0',
`misc` smallint(5) unsigned NOT NULL default '0',
KEY `playercreateinfo_race_class_index` (`race`,`class`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -9734,360 +9733,360 @@ CREATE TABLE `playercreateinfo_action` (
LOCK TABLES `playercreateinfo_action` WRITE;
/*!40000 ALTER TABLE `playercreateinfo_action` DISABLE KEYS */;
INSERT INTO `playercreateinfo_action` VALUES
(1,1,1,78,0,0),
(1,1,0,6603,0,0),
(1,1,11,117,128,0),
(1,2,2,635,0,0),
(1,2,0,6603,0,0),
(1,2,1,21084,0,0),
(1,2,10,159,128,0),
(1,2,11,2070,128,0),
(1,4,1,1752,0,0),
(1,4,2,2098,0,0),
(1,4,3,2764,0,0),
(1,4,0,6603,0,0),
(1,4,11,2070,128,0),
(1,5,1,585,0,0),
(1,5,2,2050,0,0),
(1,5,0,6603,0,0),
(1,5,10,159,128,0),
(1,5,11,2070,128,0),
(1,6,0,6603,0,0),
(1,6,1,49576,0,0),
(1,6,2,45477,0,0),
(1,6,3,45462,0,0),
(1,6,4,45902,0,0),
(1,6,5,47541,0,0),
(1,6,11,59752,0,0),
(1,8,1,133,0,0),
(1,8,2,168,0,0),
(1,8,0,6603,0,0),
(1,8,10,159,128,0),
(1,8,11,2070,128,0),
(1,9,1,686,0,0),
(1,9,2,687,0,0),
(1,9,0,6603,0,0),
(1,9,10,159,128,0),
(1,9,11,4604,128,0),
(2,1,1,78,0,0),
(2,1,0,6603,0,0),
(2,1,11,117,128,0),
(2,3,2,75,0,0),
(2,3,1,2973,0,0),
(2,3,0,6603,0,0),
(2,3,11,117,128,0),
(2,3,10,159,128,0),
(2,4,10,0,128,0),
(2,4,1,1752,0,0),
(2,4,2,2098,0,0),
(2,4,0,6603,0,0),
(2,4,11,117,128,0),
(2,6,0,6603,0,0),
(2,6,1,49576,0,0),
(2,6,2,45477,0,0),
(2,6,3,45462,0,0),
(2,6,4,45902,0,0),
(2,6,5,47541,0,0),
(2,6,10,20572,0,0),
(2,7,2,331,0,0),
(2,7,1,403,0,0),
(2,7,0,6603,0,0),
(2,7,11,117,128,0),
(2,7,10,159,128,0),
(2,9,1,686,0,0),
(2,9,2,687,0,0),
(2,9,0,6603,0,0),
(2,9,11,117,128,0),
(2,9,10,159,128,0),
(3,1,1,78,0,0),
(3,1,0,6603,0,0),
(3,1,11,117,128,0),
(3,2,2,635,0,0),
(3,2,0,6603,0,0),
(3,2,1,21084,0,0),
(3,2,10,159,128,0),
(3,2,11,4540,128,0),
(3,3,2,75,0,0),
(3,3,1,2973,0,0),
(3,3,0,6603,0,0),
(3,3,11,117,128,0),
(3,3,10,159,128,0),
(3,4,1,1752,0,0),
(3,4,2,2098,0,0),
(3,4,3,2764,0,0),
(3,4,0,6603,0,0),
(3,4,11,4540,128,0),
(3,5,1,585,0,0),
(3,5,2,2050,0,0),
(3,5,0,6603,0,0),
(3,5,10,159,128,0),
(3,5,11,4540,128,0),
(3,6,0,6603,0,0),
(3,6,1,49576,0,0),
(3,6,2,45477,0,0),
(3,6,3,45462,0,0),
(3,6,4,45902,0,0),
(3,6,5,47541,0,0),
(3,6,10,2481,0,0),
(4,1,1,78,0,0),
(4,1,0,6603,0,0),
(4,1,11,117,128,0),
(4,3,2,75,0,0),
(4,3,1,2973,0,0),
(4,3,0,6603,0,0),
(4,3,11,117,128,0),
(4,3,10,159,128,0),
(4,4,1,1752,0,0),
(4,4,2,2098,0,0),
(4,4,3,2764,0,0),
(4,4,0,6603,0,0),
(4,4,11,4540,128,0),
(4,5,1,585,0,0),
(4,5,2,2050,0,0),
(4,5,0,6603,0,0),
(4,5,10,159,128,0),
(4,5,11,2070,128,0),
(4,6,0,6603,0,0),
(4,6,1,49576,0,0),
(4,6,2,45477,0,0),
(4,6,3,45462,0,0),
(4,6,4,45902,0,0),
(4,6,5,47541,0,0),
(4,6,10,58984,0,0),
(4,6,83,58984,0,0),
(4,11,1,5176,0,0),
(4,11,2,5185,0,0),
(4,11,0,6603,0,0),
(4,11,10,159,128,0),
(4,11,11,4536,128,0),
(5,1,11,4604,128,0),
(5,1,0,6603,0,0),
(5,1,1,78,0,0),
(5,4,11,4604,128,0),
(5,4,3,2764,0,0),
(5,4,2,2098,0,0),
(5,4,1,1752,0,0),
(5,4,0,6603,0,0),
(5,5,10,159,128,0),
(5,5,2,2050,0,0),
(5,5,1,585,0,0),
(5,5,11,4604,128,0),
(5,5,0,6603,0,0),
(5,6,0,6603,0,0),
(5,6,1,49576,0,0),
(5,6,2,45477,0,0),
(5,6,3,45462,0,0),
(5,6,4,45902,0,0),
(5,6,5,47541,0,0),
(5,6,10,20577,0,0),
(5,8,11,4604,128,0),
(5,8,10,159,128,0),
(5,8,2,168,0,0),
(5,8,1,133,0,0),
(5,8,0,6603,0,0),
(5,9,1,686,0,0),
(5,9,10,159,128,0),
(5,9,2,687,0,0),
(5,9,11,4604,128,0),
(5,9,0,6603,0,0),
(6,1,1,78,0,0),
(6,1,2,20549,0,0),
(6,1,11,4540,128,0),
(6,1,0,6603,0,0),
(6,3,1,2973,0,0),
(6,3,10,159,128,0),
(6,3,2,75,0,0),
(6,3,3,20549,0,0),
(6,3,11,117,128,0),
(6,3,0,6603,0,0),
(6,6,0,6603,0,0),
(6,6,1,49576,0,0),
(6,6,2,45477,0,0),
(6,6,3,45462,0,0),
(6,6,4,45902,0,0),
(6,6,5,47541,0,0),
(6,6,10,20549,0,0),
(6,6,75,20549,0,0),
(6,7,1,403,0,0),
(6,7,10,159,128,0),
(6,7,2,331,0,0),
(6,7,3,20549,0,0),
(6,7,11,4604,128,0),
(6,7,0,6603,0,0),
(6,11,1,5176,0,0),
(6,11,10,159,128,0),
(6,11,2,5185,0,0),
(6,11,3,20549,0,0),
(6,11,11,4536,128,0),
(6,11,0,6603,0,0),
(7,1,11,117,128,0),
(7,1,1,78,0,0),
(7,1,0,6603,0,0),
(7,4,11,117,128,0),
(7,4,3,2764,0,0),
(7,4,1,1752,0,0),
(7,4,2,2098,0,0),
(7,4,0,6603,0,0),
(7,6,0,6603,0,0),
(7,6,1,49576,0,0),
(7,6,2,45477,0,0),
(7,6,3,45462,0,0),
(7,6,4,45902,0,0),
(7,6,5,47541,0,0),
(7,6,10,20589,0,0),
(7,6,72,6603,0,0),
(7,6,83,117,128,0),
(7,6,84,6603,0,0),
(7,6,96,6603,0,0),
(7,6,108,6603,0,0),
(7,8,11,4536,128,0),
(7,8,1,133,0,0),
(7,8,2,168,0,0),
(7,8,10,159,128,0),
(7,8,0,6603,0,0),
(7,9,11,4604,128,0),
(7,9,1,686,0,0),
(7,9,2,687,0,0),
(7,9,10,159,128,0),
(7,9,0,6603,0,0),
(8,1,11,117,128,0),
(8,1,1,78,0,0),
(8,1,3,2764,0,0),
(8,1,0,6603,0,0),
(8,3,10,159,128,0),
(8,3,11,4604,128,0),
(8,3,1,2973,0,0),
(8,3,2,75,0,0),
(8,3,0,6603,0,0),
(8,4,1,1752,0,0),
(8,4,3,2764,0,0),
(8,4,2,2098,0,0),
(8,4,11,117,128,0),
(8,4,0,6603,0,0),
(8,5,1,585,0,0),
(8,5,10,159,128,0),
(8,5,2,2050,0,0),
(8,5,11,4540,128,0),
(8,5,0,6603,0,0),
(8,6,0,6603,0,0),
(8,6,1,49576,0,0),
(8,6,2,45477,0,0),
(8,6,3,45462,0,0),
(8,6,4,45902,0,0),
(8,6,5,47541,0,0),
(8,6,10,50621,0,0),
(8,7,1,403,0,0),
(8,7,10,159,128,0),
(8,7,2,331,0,0),
(8,7,11,117,128,0),
(8,7,0,6603,0,0),
(8,8,1,133,0,0),
(8,8,10,159,128,0),
(8,8,2,168,0,0),
(8,8,11,117,128,0),
(8,8,0,6603,0,0),
(10,2,0,6603,0,0),
(10,2,1,21084,0,0),
(10,2,2,635,0,0),
(10,2,3,28734,0,0),
(10,2,4,28730,0,0),
(10,2,10,159,128,0),
(10,2,11,20857,128,0),
(10,3,0,6603,0,0),
(10,3,1,2973,0,0),
(10,3,2,75,0,0),
(10,3,3,28734,0,0),
(10,3,4,28730,0,0),
(10,3,10,159,128,0),
(10,3,11,20857,128,0),
(10,4,0,6603,0,0),
(10,4,1,1752,0,0),
(10,4,2,2098,0,0),
(10,4,3,2764,0,0),
(10,4,4,28734,0,0),
(10,4,5,25046,0,0),
(10,4,11,20857,128,0),
(10,5,0,6603,0,0),
(10,5,1,585,0,0),
(10,5,2,2050,0,0),
(10,5,3,28734,0,0),
(10,5,4,28730,0,0),
(10,5,10,159,128,0),
(10,5,11,20857,128,0),
(10,6,0,6603,0,0),
(10,6,1,49576,0,0),
(10,6,2,45477,0,0),
(10,6,3,45462,0,0),
(10,6,4,45902,0,0),
(10,6,5,47541,0,0),
(10,6,6,50613,0,0),
(10,8,0,6603,0,0),
(10,8,1,133,0,0),
(10,8,2,168,0,0),
(10,8,3,28734,0,0),
(10,8,4,28730,0,0),
(10,8,10,159,128,0),
(10,8,11,20857,128,0),
(10,9,11,20857,128,0),
(10,9,10,159,128,0),
(10,9,4,28730,0,0),
(10,9,3,28734,0,0),
(10,9,2,687,0,0),
(10,9,1,686,0,0),
(10,9,0,6603,0,0),
(11,1,0,6603,0,0),
(11,1,72,6603,0,0),
(11,1,73,78,0,0),
(11,1,74,28880,0,0),
(11,1,83,4540,128,0),
(11,1,84,6603,0,0),
(11,1,96,6603,0,0),
(11,1,108,6603,0,0),
(11,2,0,6603,0,0),
(11,2,1,21084,0,0),
(11,2,2,635,0,0),
(11,2,3,59542,0,0),
(11,2,10,159,128,0),
(11,2,11,4540,128,0),
(11,2,83,4540,128,0),
(11,3,0,6603,0,0),
(11,3,1,2973,0,0),
(11,3,2,75,0,0),
(11,3,3,59543,0,0),
(11,3,10,159,128,0),
(11,3,11,4540,128,0),
(11,3,72,6603,0,0),
(11,3,73,2973,0,0),
(11,3,74,75,0,0),
(11,3,82,159,128,0),
(11,3,83,4540,128,0),
(11,5,0,6603,0,0),
(11,5,1,585,0,0),
(11,5,2,2050,0,0),
(11,5,3,59544,0,0),
(11,5,10,159,128,0),
(11,5,11,4540,128,0),
(11,5,83,4540,128,0),
(11,6,0,6603,0,0),
(11,6,1,49576,0,0),
(11,6,2,45477,0,0),
(11,6,3,45462,0,0),
(11,6,4,45902,0,0),
(11,6,5,47541,0,0),
(11,6,6,59545,0,0),
(11,7,0,6603,0,0),
(11,7,1,403,0,0),
(11,7,2,331,0,0),
(11,7,3,59547,0,0),
(11,7,10,159,128,0),
(11,7,11,4540,128,0),
(11,8,0,6603,0,0),
(11,8,1,133,0,0),
(11,8,2,168,0,0),
(11,8,3,59548,0,0),
(11,8,10,159,128,0),
(11,8,11,4540,128,0),
(11,8,83,4540,128,0);
(1,1,1,78,0),
(1,1,0,6603,0),
(1,1,11,117,128),
(1,2,2,635,0),
(1,2,0,6603,0),
(1,2,1,21084,0),
(1,2,10,159,128),
(1,2,11,2070,128),
(1,4,1,1752,0),
(1,4,2,2098,0),
(1,4,3,2764,0),
(1,4,0,6603,0),
(1,4,11,2070,128),
(1,5,1,585,0),
(1,5,2,2050,0),
(1,5,0,6603,0),
(1,5,10,159,128),
(1,5,11,2070,128),
(1,6,0,6603,0),
(1,6,1,49576,0),
(1,6,2,45477,0),
(1,6,3,45462,0),
(1,6,4,45902,0),
(1,6,5,47541,0),
(1,6,11,59752,0),
(1,8,1,133,0),
(1,8,2,168,0),
(1,8,0,6603,0),
(1,8,10,159,128),
(1,8,11,2070,128),
(1,9,1,686,0),
(1,9,2,687,0),
(1,9,0,6603,0),
(1,9,10,159,128),
(1,9,11,4604,128),
(2,1,1,78,0),
(2,1,0,6603,0),
(2,1,11,117,128),
(2,3,2,75,0),
(2,3,1,2973,0),
(2,3,0,6603,0),
(2,3,11,117,128),
(2,3,10,159,128),
(2,4,10,0,128),
(2,4,1,1752,0),
(2,4,2,2098,0),
(2,4,0,6603,0),
(2,4,11,117,128),
(2,6,0,6603,0),
(2,6,1,49576,0),
(2,6,2,45477,0),
(2,6,3,45462,0),
(2,6,4,45902,0),
(2,6,5,47541,0),
(2,6,10,20572,0),
(2,7,2,331,0),
(2,7,1,403,0),
(2,7,0,6603,0),
(2,7,11,117,128),
(2,7,10,159,128),
(2,9,1,686,0),
(2,9,2,687,0),
(2,9,0,6603,0),
(2,9,11,117,128),
(2,9,10,159,128),
(3,1,1,78,0),
(3,1,0,6603,0),
(3,1,11,117,128),
(3,2,2,635,0),
(3,2,0,6603,0),
(3,2,1,21084,0),
(3,2,10,159,128),
(3,2,11,4540,128),
(3,3,2,75,0),
(3,3,1,2973,0),
(3,3,0,6603,0),
(3,3,11,117,128),
(3,3,10,159,128),
(3,4,1,1752,0),
(3,4,2,2098,0),
(3,4,3,2764,0),
(3,4,0,6603,0),
(3,4,11,4540,128),
(3,5,1,585,0),
(3,5,2,2050,0),
(3,5,0,6603,0),
(3,5,10,159,128),
(3,5,11,4540,128),
(3,6,0,6603,0),
(3,6,1,49576,0),
(3,6,2,45477,0),
(3,6,3,45462,0),
(3,6,4,45902,0),
(3,6,5,47541,0),
(3,6,10,2481,0),
(4,1,1,78,0),
(4,1,0,6603,0),
(4,1,11,117,128),
(4,3,2,75,0),
(4,3,1,2973,0),
(4,3,0,6603,0),
(4,3,11,117,128),
(4,3,10,159,128),
(4,4,1,1752,0),
(4,4,2,2098,0),
(4,4,3,2764,0),
(4,4,0,6603,0),
(4,4,11,4540,128),
(4,5,1,585,0),
(4,5,2,2050,0),
(4,5,0,6603,0),
(4,5,10,159,128),
(4,5,11,2070,128),
(4,6,0,6603,0),
(4,6,1,49576,0),
(4,6,2,45477,0),
(4,6,3,45462,0),
(4,6,4,45902,0),
(4,6,5,47541,0),
(4,6,10,58984,0),
(4,6,83,58984,0),
(4,11,1,5176,0),
(4,11,2,5185,0),
(4,11,0,6603,0),
(4,11,10,159,128),
(4,11,11,4536,128),
(5,1,11,4604,128),
(5,1,0,6603,0),
(5,1,1,78,0),
(5,4,11,4604,128),
(5,4,3,2764,0),
(5,4,2,2098,0),
(5,4,1,1752,0),
(5,4,0,6603,0),
(5,5,10,159,128),
(5,5,2,2050,0),
(5,5,1,585,0),
(5,5,11,4604,128),
(5,5,0,6603,0),
(5,6,0,6603,0),
(5,6,1,49576,0),
(5,6,2,45477,0),
(5,6,3,45462,0),
(5,6,4,45902,0),
(5,6,5,47541,0),
(5,6,10,20577,0),
(5,8,11,4604,128),
(5,8,10,159,128),
(5,8,2,168,0),
(5,8,1,133,0),
(5,8,0,6603,0),
(5,9,1,686,0),
(5,9,10,159,128),
(5,9,2,687,0),
(5,9,11,4604,128),
(5,9,0,6603,0),
(6,1,1,78,0),
(6,1,2,20549,0),
(6,1,11,4540,128),
(6,1,0,6603,0),
(6,3,1,2973,0),
(6,3,10,159,128),
(6,3,2,75,0),
(6,3,3,20549,0),
(6,3,11,117,128),
(6,3,0,6603,0),
(6,6,0,6603,0),
(6,6,1,49576,0),
(6,6,2,45477,0),
(6,6,3,45462,0),
(6,6,4,45902,0),
(6,6,5,47541,0),
(6,6,10,20549,0),
(6,6,75,20549,0),
(6,7,1,403,0),
(6,7,10,159,128),
(6,7,2,331,0),
(6,7,3,20549,0),
(6,7,11,4604,128),
(6,7,0,6603,0),
(6,11,1,5176,0),
(6,11,10,159,128),
(6,11,2,5185,0),
(6,11,3,20549,0),
(6,11,11,4536,128),
(6,11,0,6603,0),
(7,1,11,117,128),
(7,1,1,78,0),
(7,1,0,6603,0),
(7,4,11,117,128),
(7,4,3,2764,0),
(7,4,1,1752,0),
(7,4,2,2098,0),
(7,4,0,6603,0),
(7,6,0,6603,0),
(7,6,1,49576,0),
(7,6,2,45477,0),
(7,6,3,45462,0),
(7,6,4,45902,0),
(7,6,5,47541,0),
(7,6,10,20589,0),
(7,6,72,6603,0),
(7,6,83,117,128),
(7,6,84,6603,0),
(7,6,96,6603,0),
(7,6,108,6603,0),
(7,8,11,4536,128),
(7,8,1,133,0),
(7,8,2,168,0),
(7,8,10,159,128),
(7,8,0,6603,0),
(7,9,11,4604,128),
(7,9,1,686,0),
(7,9,2,687,0),
(7,9,10,159,128),
(7,9,0,6603,0),
(8,1,11,117,128),
(8,1,1,78,0),
(8,1,3,2764,0),
(8,1,0,6603,0),
(8,3,10,159,128),
(8,3,11,4604,128),
(8,3,1,2973,0),
(8,3,2,75,0),
(8,3,0,6603,0),
(8,4,1,1752,0),
(8,4,3,2764,0),
(8,4,2,2098,0),
(8,4,11,117,128),
(8,4,0,6603,0),
(8,5,1,585,0),
(8,5,10,159,128),
(8,5,2,2050,0),
(8,5,11,4540,128),
(8,5,0,6603,0),
(8,6,0,6603,0),
(8,6,1,49576,0),
(8,6,2,45477,0),
(8,6,3,45462,0),
(8,6,4,45902,0),
(8,6,5,47541,0),
(8,6,10,50621,0),
(8,7,1,403,0),
(8,7,10,159,128),
(8,7,2,331,0),
(8,7,11,117,128),
(8,7,0,6603,0),
(8,8,1,133,0),
(8,8,10,159,128),
(8,8,2,168,0),
(8,8,11,117,128),
(8,8,0,6603,0),
(10,2,0,6603,0),
(10,2,1,21084,0),
(10,2,2,635,0),
(10,2,3,28734,0),
(10,2,4,28730,0),
(10,2,10,159,128),
(10,2,11,20857,128),
(10,3,0,6603,0),
(10,3,1,2973,0),
(10,3,2,75,0),
(10,3,3,28734,0),
(10,3,4,28730,0),
(10,3,10,159,128),
(10,3,11,20857,128),
(10,4,0,6603,0),
(10,4,1,1752,0),
(10,4,2,2098,0),
(10,4,3,2764,0),
(10,4,4,28734,0),
(10,4,5,25046,0),
(10,4,11,20857,128),
(10,5,0,6603,0),
(10,5,1,585,0),
(10,5,2,2050,0),
(10,5,3,28734,0),
(10,5,4,28730,0),
(10,5,10,159,128),
(10,5,11,20857,128),
(10,6,0,6603,0),
(10,6,1,49576,0),
(10,6,2,45477,0),
(10,6,3,45462,0),
(10,6,4,45902,0),
(10,6,5,47541,0),
(10,6,6,50613,0),
(10,8,0,6603,0),
(10,8,1,133,0),
(10,8,2,168,0),
(10,8,3,28734,0),
(10,8,4,28730,0),
(10,8,10,159,128),
(10,8,11,20857,128),
(10,9,11,20857,128),
(10,9,10,159,128),
(10,9,4,28730,0),
(10,9,3,28734,0),
(10,9,2,687,0),
(10,9,1,686,0),
(10,9,0,6603,0),
(11,1,0,6603,0),
(11,1,72,6603,0),
(11,1,73,78,0),
(11,1,74,28880,0),
(11,1,83,4540,128),
(11,1,84,6603,0),
(11,1,96,6603,0),
(11,1,108,6603,0),
(11,2,0,6603,0),
(11,2,1,21084,0),
(11,2,2,635,0),
(11,2,3,59542,0),
(11,2,10,159,128),
(11,2,11,4540,128),
(11,2,83,4540,128),
(11,3,0,6603,0),
(11,3,1,2973,0),
(11,3,2,75,0),
(11,3,3,59543,0),
(11,3,10,159,128),
(11,3,11,4540,128),
(11,3,72,6603,0),
(11,3,73,2973,0),
(11,3,74,75,0),
(11,3,82,159,128),
(11,3,83,4540,128),
(11,5,0,6603,0),
(11,5,1,585,0),
(11,5,2,2050,0),
(11,5,3,59544,0),
(11,5,10,159,128),
(11,5,11,4540,128),
(11,5,83,4540,128),
(11,6,0,6603,0),
(11,6,1,49576,0),
(11,6,2,45477,0),
(11,6,3,45462,0),
(11,6,4,45902,0),
(11,6,5,47541,0),
(11,6,6,59545,0),
(11,7,0,6603,0),
(11,7,1,403,0),
(11,7,2,331,0),
(11,7,3,59547,0),
(11,7,10,159,128),
(11,7,11,4540,128),
(11,8,0,6603,0),
(11,8,1,133,0),
(11,8,2,168,0),
(11,8,3,59548,0),
(11,8,10,159,128),
(11,8,11,4540,128),
(11,8,83,4540,128);
/*!40000 ALTER TABLE `playercreateinfo_action` ENABLE KEYS */;
UNLOCK TABLES;

View file

@ -0,0 +1,10 @@
ALTER TABLE character_db_version CHANGE COLUMN required_8072_02_characters_characters required_8098_01_characters_character_action bit;
ALTER TABLE character_action
CHANGE COLUMN action action int(11) unsigned NOT NULL default '0';
UPDATE character_action
SET action = action | ( misc < 16 );
ALTER TABLE character_action
DROP COLUMN misc;

View file

@ -0,0 +1,10 @@
ALTER TABLE db_version CHANGE COLUMN required_8071_01_mangos_command required_8098_02_mangos_playercreateinfo_action bit;
ALTER TABLE playercreateinfo_action
CHANGE COLUMN action action int(11) unsigned NOT NULL default '0';
UPDATE playercreateinfo_action
SET action = action | ( misc < 16 );
ALTER TABLE playercreateinfo_action
DROP COLUMN misc;

View file

@ -0,0 +1,13 @@
ALTER TABLE character_db_version CHANGE COLUMN required_8098_01_characters_character_action required_8098_03_characters_character_pet bit;
UPDATE character_pet
SET abdata = CONCAT(
(SUBSTRING(abdata, 1, length(SUBSTRING_INDEX(abdata, ' ', 1))) >> 8),' ',
SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 1))+2, length(SUBSTRING_INDEX(abdata, ' ', 2))-length(SUBSTRING_INDEX(abdata, ' ', 1))-1),' ',
(SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 2))+2, length(SUBSTRING_INDEX(abdata, ' ', 3))-length(SUBSTRING_INDEX(abdata, ' ', 2))-1) >> 8),' ',
SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 3))+2, length(SUBSTRING_INDEX(abdata, ' ', 4))-length(SUBSTRING_INDEX(abdata, ' ', 3))-1),' ',
(SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 4))+2, length(SUBSTRING_INDEX(abdata, ' ', 5))-length(SUBSTRING_INDEX(abdata, ' ', 4))-1) >> 8),' ',
SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 5))+2, length(SUBSTRING_INDEX(abdata, ' ', 6))-length(SUBSTRING_INDEX(abdata, ' ', 5))-1),' ',
(SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 6))+2, length(SUBSTRING_INDEX(abdata, ' ', 7))-length(SUBSTRING_INDEX(abdata, ' ', 6))-1) >> 8),' ',
SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 7))+2, length(SUBSTRING_INDEX(abdata, ' ', 8))-length(SUBSTRING_INDEX(abdata, ' ', 7))-1),' '
);

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_8098_03_characters_character_pet required_8098_04_characters_pet_spell bit;
UPDATE pet_spell
SET active = ( active >> 8);

View file

@ -235,6 +235,10 @@ pkgdata_DATA = \
8071_01_mangos_command.sql \
8072_01_characters_characters.sql \
8072_02_characters_characters.sql \
8098_01_characters_character_action.sql \
8098_02_mangos_playercreateinfo_action.sql \
8098_03_characters_character_pet.sql \
8098_04_characters_pet_spell.sql \
README
## Additional files to include when running 'make dist'
@ -450,4 +454,8 @@ EXTRA_DIST = \
8071_01_mangos_command.sql \
8072_01_characters_characters.sql \
8072_02_characters_characters.sql \
8098_01_characters_character_action.sql \
8098_02_mangos_playercreateinfo_action.sql \
8098_03_characters_character_pet.sql \
8098_04_characters_pet_spell.sql \
README

View file

@ -68,7 +68,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));

View file

@ -294,7 +294,7 @@ struct CreatureData
struct CreatureDataAddonAura
{
uint16 spell_id;
uint32 spell_id;
uint8 effect_idx;
};
@ -667,10 +667,10 @@ class MANGOS_DLL_SPEC Creature : public Unit
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{
if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->active != ACT_ENABLED)
if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
return 0;
else
return m_charmInfo->GetCharmSpell(pos)->spellId;
return m_charmInfo->GetCharmSpell(pos)->GetAction();
}
void SetCombatStartPosition(float x, float y, float z) { CombatStartX = x; CombatStartY = y; CombatStartZ = z; }

View file

@ -984,40 +984,41 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
CHECK_PACKET_SIZE(recv_data,1+2+1+1);
sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" );
uint8 button, misc, type;
uint16 action;
recv_data >> button >> action >> misc >> type;
sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u MISC: %u", button, action, type, misc );
if(action==0)
uint8 button;
uint32 packetData;
recv_data >> button >> packetData;
uint32 action = ACTION_BUTTON_ACTION(packetData);
uint8 type = ACTION_BUTTON_TYPE(packetData);
sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u", button, action, type );
if (!packetData)
{
sLog.outDetail( "MISC: Remove action from button %u", button );
GetPlayer()->removeActionButton(button);
}
else
{
if(type==ACTION_BUTTON_MACRO || type==ACTION_BUTTON_CMACRO)
switch(type)
{
sLog.outDetail( "MISC: Added Macro %u into button %u", action, button );
GetPlayer()->addActionButton(button,action,type,misc);
case ACTION_BUTTON_MACRO:
case ACTION_BUTTON_CMACRO:
sLog.outDetail( "MISC: Added Macro %u into button %u", action, button );
break;
case ACTION_BUTTON_EQSET:
sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button );
break;
case ACTION_BUTTON_SPELL:
sLog.outDetail( "MISC: Added Spell %u into button %u", action, button );
break;
case ACTION_BUTTON_ITEM:
sLog.outDetail( "MISC: Added Item %u into button %u", action, button );
break;
default:
sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button );
return;
}
else if(type==ACTION_BUTTON_EQSET)
{
sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button );
GetPlayer()->addActionButton(button,action,type,misc);
}
else if(type==ACTION_BUTTON_SPELL)
{
sLog.outDetail( "MISC: Added Spell %u into button %u", action, button );
GetPlayer()->addActionButton(button,action,type,misc);
}
else if(type==ACTION_BUTTON_ITEM)
{
sLog.outDetail( "MISC: Added Item %u into button %u", action, button );
GetPlayer()->addActionButton(button,action,type,misc);
}
else
sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button );
GetPlayer()->addActionButton(button,action,type);
}
}

View file

@ -2404,8 +2404,8 @@ void ObjectMgr::LoadPlayerInfo()
// Load playercreate actions
{
// 0 1 2 3 4 5
QueryResult *result = WorldDatabase.Query("SELECT race, class, button, action, type, misc FROM playercreateinfo_action");
// 0 1 2 3 4
QueryResult *result = WorldDatabase.Query("SELECT race, class, button, action, type FROM playercreateinfo_action");
uint32 count = 0;
@ -2440,10 +2440,7 @@ void ObjectMgr::LoadPlayerInfo()
}
PlayerInfo* pInfo = &playerInfo[current_race][current_class];
pInfo->action[0].push_back(fields[2].GetUInt16());
pInfo->action[1].push_back(fields[3].GetUInt16());
pInfo->action[2].push_back(fields[4].GetUInt16());
pInfo->action[3].push_back(fields[5].GetUInt16());
pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt8(),fields[3].GetUInt32(),fields[4].GetUInt8()));
bar.step();
++count;

View file

@ -422,8 +422,8 @@ void Pet::SavePetToDB(PetSaveMode mode)
// save only spell slots from action bar
for(uint32 i = ACTION_BAR_INDEX_PET_SPELL_START; i < ACTION_BAR_INDEX_PET_SPELL_END; ++i)
{
ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " "
<< uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " ";
ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << " "
<< uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << " ";
};
ss << "', "
@ -1102,7 +1102,7 @@ void Pet::_LoadSpells()
{
Field *fields = result->Fetch();
addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt16()), PETSPELL_UNCHANGED);
addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt8()), PETSPELL_UNCHANGED);
}
while( result->NextRow() );
@ -1404,8 +1404,8 @@ bool Pet::learnSpell(uint32 spell_id)
Unit* owner = GetOwner();
if(owner && owner->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_PET_LEARNED_SPELL, 2);
data << uint16(spell_id);
WorldPacket data(SMSG_PET_LEARNED_SPELL, 4);
data << uint32(spell_id);
((Player*)owner)->GetSession()->SendPacket(&data);
((Player*)owner)->PetSpellInitialize();
@ -1461,8 +1461,8 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
{
if(!m_loading)
{
WorldPacket data(SMSG_PET_REMOVED_SPELL, 2);
data << uint16(spell_id);
WorldPacket data(SMSG_PET_REMOVED_SPELL, 4);
data << uint32(spell_id);
((Player*)GetOwner())->GetSession()->SendPacket(&data);
}
}
@ -1527,8 +1527,9 @@ void Pet::CleanupActionBar()
{
for(int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
if(UnitActionBarEntry const* ab = m_charmInfo->GetActionBarEntry(i))
if(ab->SpellOrAction && ab->IsActionBarForSpell() && !HasSpell(ab->SpellOrAction))
m_charmInfo->SetActionBar(i,0,ACT_DISABLED);
if(uint32 action = ab->GetAction())
if(ab->IsActionBarForSpell() && !HasSpell(action))
m_charmInfo->SetActionBar(i,0,ACT_DISABLED);
}
void Pet::InitPetCreateSpells()
@ -1903,7 +1904,7 @@ void Pet::CastPetAuras(bool current)
void Pet::CastPetAura(PetAura const* aura)
{
uint16 auraId = aura->GetAura(GetEntry());
uint32 auraId = aura->GetAura(GetEntry());
if(!auraId)
return;

View file

@ -69,7 +69,7 @@ enum PetSpellType
struct PetSpell
{
uint16 active; // use instead enum (not good use *uint16* limited enum in case when value in enum not possitive in *int16*)
uint8 active; // use instead enum (not good use *uint8* limited enum in case when value in enum not possitive in *int8*)
PetSpellState state : 8;
PetSpellType type : 8;

View file

@ -34,17 +34,18 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
CHECK_PACKET_SIZE(recv_data, 8+2+2+8);
uint64 guid1;
uint16 spellid;
uint16 flag;
uint32 data;
uint64 guid2;
recv_data >> guid1; //pet guid
recv_data >> spellid;
recv_data >> flag; //delete = 0x0700 CastSpell = C100
recv_data >> data;
recv_data >> guid2; //tag guid
uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)) );
sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
if(!pet)
{
sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) );
@ -72,7 +73,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
switch(flag)
{
case ACT_COMMAND: //0x0700
case ACT_COMMAND: //0x07
switch(spellid)
{
case COMMAND_STAY: //flat=1792 //STAY
@ -121,7 +122,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
pet->SendPetAIReaction(guid1);
}
}
else // charmed player
else // charmed player
{
pet->Attack(TargetUnit,true);
pet->SendPetAIReaction(guid1);
@ -143,10 +144,10 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
_player->Uncharm();
break;
default:
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
break;
case ACT_REACTION: // 0x600
case ACT_REACTION: // 0x6
switch(spellid)
{
case REACT_PASSIVE: //passive
@ -156,9 +157,9 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
break;
}
break;
case ACT_DISABLED: // 0x8100 spell (disabled), ignore
case ACT_PASSIVE: // 0x0100
case ACT_ENABLED: // 0xC100 spell
case ACT_DISABLED: // 0x81 spell (disabled), ignore
case ACT_PASSIVE: // 0x01
case ACT_ENABLED: // 0xC1 spell
{
Unit* unit_target = NULL;
if (((Creature*)pet)->GetGlobalCooldown() > 0)
@ -258,7 +259,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
break;
}
default:
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
}
@ -309,9 +310,6 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" );
uint64 petguid;
uint32 position;
uint16 spell_id;
uint16 act_state;
uint8 count;
recv_data >> petguid;
@ -339,11 +337,16 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
count = (recv_data.size() == 24) ? 2 : 1;
for(uint8 i = 0; i < count; ++i)
{
recv_data >> position;
recv_data >> spell_id;
recv_data >> act_state;
uint32 position;
uint32 data;
sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, act_state);
recv_data >> position;
recv_data >> data;
uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data);
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data);
sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, uint32(act_state));
//ignore invalid position
if(position >= MAX_UNIT_ACTION_BAR_INDEX)
@ -516,10 +519,9 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
sLog.outDetail("CMSG_PET_SPELL_AUTOCAST");
uint64 guid;
uint16 spellid;
uint16 spellid2; //maybe second spell, automatically toggled off when first toggled on?
uint32 spellid;
uint8 state; //1 for on, 0 for off
recvPacket >> guid >> spellid >> spellid2 >> state;
recvPacket >> guid >> spellid >> state;
if(!_player->GetPet() && !_player->GetCharm())
return;

View file

@ -651,21 +651,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
learnDefaultSpells();
// original action bar
std::list<uint16>::const_iterator action_itr[4];
for(int i=0; i<4; ++i)
action_itr[i] = info->action[i].begin();
for (; action_itr[0]!=info->action[0].end() && action_itr[1]!=info->action[1].end();)
{
uint16 taction[4];
for(int i=0; i<4 ;++i)
taction[i] = (*action_itr[i]);
addActionButton((uint8)taction[0], taction[1], (uint8)taction[2], (uint8)taction[3]);
for(int i=0; i<4 ;++i)
++action_itr[i];
}
for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr)
addActionButton(action_itr->button,action_itr->action,action_itr->type);
// original items
CharStartOutfitEntry const* oEntry = NULL;
@ -5427,65 +5414,69 @@ void Player::SendInitialActionButtons() const
sLog.outDetail( "Initializing Action Buttons for '%u'", GetGUIDLow() );
WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(0); // can be 0, 1, 2
data << uint8(0); // can be 0, 1, 2 (talent spec)
for(int button = 0; button < MAX_ACTION_BUTTONS; ++button)
{
ActionButtonList::const_iterator itr = m_actionButtons.find(button);
if(itr != m_actionButtons.end() && itr->second.uState != ACTIONBUTTON_DELETED)
{
data << uint16(itr->second.action);
data << uint8(itr->second.misc);
data << uint8(itr->second.type);
}
data << uint32(itr->second.packedData);
else
{
data << uint32(0);
}
}
GetSession()->SendPacket( &data );
sLog.outDetail( "Action Buttons for '%u' Initialized", GetGUIDLow() );
}
bool Player::addActionButton(const uint8 button, const uint16 action, const uint8 type, const uint8 misc)
ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
{
if(button >= MAX_ACTION_BUTTONS)
{
sLog.outError( "Action %u not added into button %u for player %s: button must be < 132", action, button, GetName() );
return false;
return NULL;
}
// check cheating with adding non-known spells to action bar
if(type==ACTION_BUTTON_SPELL)
if(action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
if(!sSpellStore.LookupEntry(action))
{
sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() );
return false;
}
if(!HasSpell(action))
{
sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() );
return false;
}
sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE );
return NULL;
}
ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
switch(type)
{
case ACTION_BUTTON_SPELL:
if(!sSpellStore.LookupEntry(action))
{
sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() );
return NULL;
}
if (buttonItr==m_actionButtons.end())
{ // just add new button
m_actionButtons[button] = ActionButton(action,type,misc);
if(!HasSpell(action))
{
sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() );
return NULL;
}
break;
case ACTION_BUTTON_ITEM:
if(!objmgr.GetItemPrototype(action))
{
sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() );
return NULL;
}
break;
default:
break; // pther cases not checked at this moment
}
else
{ // change state of current button
ActionButtonUpdateState uState = buttonItr->second.uState;
buttonItr->second = ActionButton(action,type,misc);
if (uState != ACTIONBUTTON_NEW) buttonItr->second.uState = ACTIONBUTTON_CHANGED;
};
sLog.outDetail( "Player '%u' Added Action '%u' to Button '%u'", GetGUIDLow(), action, button );
return true;
// it create new button (NEW state) if need or return existed
ActionButton& ab = m_actionButtons[button];
// set data and update to CHANGED if not NEW
ab.SetActionAndType(action,ActionButtonType(type));
sLog.outDetail( "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, uint32(type), button );
return &ab;
}
void Player::removeActionButton(uint8 button)
@ -14496,7 +14487,7 @@ void Player::_LoadActions(QueryResult *result)
{
m_actionButtons.clear();
//QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow());
//QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow());
if(result)
{
@ -14505,9 +14496,11 @@ void Player::_LoadActions(QueryResult *result)
Field *fields = result->Fetch();
uint8 button = fields[0].GetUInt8();
uint32 action = fields[1].GetUInt32();
uint8 type = fields[2].GetUInt8();
if(addActionButton(button, fields[1].GetUInt16(), fields[2].GetUInt8(), fields[3].GetUInt8()))
m_actionButtons[button].uState = ACTIONBUTTON_UNCHANGED;
if(ActionButton* ab = addActionButton(button, action, type))
ab->uState = ACTIONBUTTON_UNCHANGED;
else
{
sLog.outError( " ...at loading, and will deleted in DB also");
@ -15082,7 +15075,7 @@ void Player::_LoadSpells(QueryResult *result)
{
Field *fields = result->Fetch();
addSpell(fields[0].GetUInt16(), fields[1].GetBool(), false, false, fields[2].GetBool());
addSpell(fields[0].GetUInt32(), fields[1].GetBool(), false, false, fields[2].GetBool());
}
while( result->NextRow() );
@ -15581,14 +15574,14 @@ void Player::_SaveActions()
switch (itr->second.uState)
{
case ACTIONBUTTON_NEW:
CharacterDatabase.PExecute("INSERT INTO character_action (guid,button,action,type,misc) VALUES ('%u', '%u', '%u', '%u', '%u')",
GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.action, (uint32)itr->second.type, (uint32)itr->second.misc );
CharacterDatabase.PExecute("INSERT INTO character_action (guid,button,action,type) VALUES ('%u', '%u', '%u', '%u')",
GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType() );
itr->second.uState = ACTIONBUTTON_UNCHANGED;
++itr;
break;
case ACTIONBUTTON_CHANGED:
CharacterDatabase.PExecute("UPDATE character_action SET action = '%u', type = '%u', misc= '%u' WHERE guid= '%u' AND button= '%u' ",
(uint32)itr->second.action, (uint32)itr->second.type, (uint32)itr->second.misc, GetGUIDLow(), (uint32)itr->first );
CharacterDatabase.PExecute("UPDATE character_action SET action = '%u', type = '%u' WHERE guid= '%u' AND button= '%u' ",
(uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), GetGUIDLow(), (uint32)itr->first );
itr->second.uState = ACTIONBUTTON_UNCHANGED;
++itr;
break;
@ -15599,7 +15592,7 @@ void Player::_SaveActions()
default:
++itr;
break;
};
}
}
}
@ -16413,8 +16406,7 @@ void Player::PetSpellInitialize()
if(itr->second.state == PETSPELL_REMOVED)
continue;
data << uint16(itr->first);
data << uint16(itr->second.active); // pet spell active state isn't boolean
data << uint32(MAKE_UNIT_ACTION_BUTTON(itr->first,itr->second.active));
++addlist;
}
}
@ -16502,7 +16494,7 @@ void Player::CharmSpellInitialize()
{
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
if(charmInfo->GetCharmSpell(i)->spellId)
if(charmInfo->GetCharmSpell(i)->GetAction())
++addlist;
}
}
@ -16527,11 +16519,8 @@ void Player::CharmSpellInitialize()
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
CharmSpellEntry *cspell = charmInfo->GetCharmSpell(i);
if(cspell->spellId)
{
data << uint16(cspell->spellId);
data << uint16(cspell->active);
}
if(cspell->GetAction())
data << uint32(cspell->packedData);
}
}

View file

@ -133,17 +133,6 @@ enum ActionButtonUpdateState
ACTIONBUTTON_DELETED = 3
};
struct ActionButton
{
ActionButton() : action(0), type(0), misc(0), uState( ACTIONBUTTON_NEW ) {}
ActionButton(uint16 _action, uint8 _type, uint8 _misc) : action(_action), type(_type), misc(_misc), uState( ACTIONBUTTON_NEW ) {}
uint16 action;
uint8 type;
uint8 misc;
ActionButtonUpdateState uState;
};
enum ActionButtonType
{
ACTION_BUTTON_SPELL = 0,
@ -153,6 +142,32 @@ enum ActionButtonType
ACTION_BUTTON_ITEM = 128
};
#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
struct ActionButton
{
ActionButton() : packedData(0), uState( ACTIONBUTTON_NEW ) {}
uint32 packedData;
ActionButtonUpdateState uState;
// helpers
ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); }
uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); }
void SetActionAndType(uint32 action, ActionButtonType type)
{
uint32 newData = action | (uint32(type) << 24);
if (newData != packedData)
{
packedData = newData;
if (uState != ACTIONBUTTON_NEW)
uState = ACTIONBUTTON_CHANGED;
}
}
};
#define MAX_ACTION_BUTTONS 132 //checked in 2.3.0
typedef std::map<uint8,ActionButton> ActionButtonList;
@ -190,6 +205,18 @@ struct PlayerLevelInfo
typedef std::list<uint32> PlayerCreateInfoSpells;
struct PlayerCreateInfoAction
{
PlayerCreateInfoAction() : button(0), type(0), action(0) {}
PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {}
uint8 button;
uint8 type;
uint32 action;
};
typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
struct PlayerInfo
{
// existence checked by displayId != 0 // existence checked by displayId != 0
@ -206,7 +233,7 @@ struct PlayerInfo
uint16 displayId_f;
PlayerCreateInfoItems item;
PlayerCreateInfoSpells spell;
std::list<uint16> action[4];
PlayerCreateInfoActions action;
PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
};
@ -1513,7 +1540,7 @@ class MANGOS_DLL_SPEC Player : public Unit
m_cinematic = cine;
}
bool addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc);
ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
void removeActionButton(uint8 button);
void SendInitialActionButtons() const;

View file

@ -2087,10 +2087,10 @@ void SpellMgr::LoadSpellPetAuras()
bar.step();
uint16 spell = fields[0].GetUInt16();
uint32 spell = fields[0].GetUInt32();
uint8 eff = fields[1].GetUInt8();
uint16 pet = fields[2].GetUInt16();
uint16 aura = fields[3].GetUInt16();
uint32 pet = fields[2].GetUInt32();
uint32 aura = fields[3].GetUInt32();
SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff);
if(itr != mSpellPetAuraMap.end())

View file

@ -487,20 +487,20 @@ class PetAura
auras.clear();
}
PetAura(uint16 petEntry, uint16 aura, bool _removeOnChangePet, int _damage) :
PetAura(uint32 petEntry, uint32 aura, bool _removeOnChangePet, int _damage) :
removeOnChangePet(_removeOnChangePet), damage(_damage)
{
auras[petEntry] = aura;
}
uint16 GetAura(uint16 petEntry) const
uint32 GetAura(uint32 petEntry) const
{
std::map<uint16, uint16>::const_iterator itr = auras.find(petEntry);
std::map<uint32, uint32>::const_iterator itr = auras.find(petEntry);
if(itr != auras.end())
return itr->second;
else
{
std::map<uint16, uint16>::const_iterator itr2 = auras.find(0);
std::map<uint32, uint32>::const_iterator itr2 = auras.find(0);
if(itr2 != auras.end())
return itr2->second;
else
@ -508,7 +508,7 @@ class PetAura
}
}
void AddAura(uint16 petEntry, uint16 aura)
void AddAura(uint32 petEntry, uint32 aura)
{
auras[petEntry] = aura;
}
@ -524,7 +524,7 @@ class PetAura
}
private:
std::map<uint16, uint16> auras;
std::map<uint32, uint32> auras;
bool removeOnChangePet;
int32 damage;
};
@ -633,7 +633,7 @@ class SpellMgr
// Accessors (const or static functions)
public:
// Spell affects
SpellAffectEntry const*GetSpellAffect(uint16 spellId, uint8 effectId) const
SpellAffectEntry const*GetSpellAffect(uint32 spellId, uint8 effectId) const
{
SpellAffectMap::const_iterator itr = mSpellAffectMap.find((spellId<<8) + effectId);
if( itr != mSpellAffectMap.end( ) )
@ -833,7 +833,7 @@ class SpellMgr
return mSkillLineAbilityMap.upper_bound(spell_id);
}
PetAura const* GetPetAura(uint16 spell_id, uint8 eff)
PetAura const* GetPetAura(uint32 spell_id, uint8 eff)
{
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff);
if(itr != mSpellPetAuraMap.end())

View file

@ -10384,10 +10384,7 @@ CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0)
{
for(int i =0; i<4; ++i)
{
m_charmspells[i].spellId = 0;
m_charmspells[i].active = ACT_DISABLED;
}
m_charmspells[i].SetActionAndType(0,ACT_DISABLED);
}
void CharmInfo::InitPetActionBar()
@ -10441,18 +10438,22 @@ void CharmInfo::InitCharmCreateSpells()
for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x)
{
uint32 spellId = ((Creature*)m_unit)->m_spells[x];
m_charmspells[x].spellId = spellId;
if(!spellId)
{
m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED);
continue;
}
if (IsPassiveSpell(spellId))
{
m_unit->CastSpell(m_unit, spellId, true);
m_charmspells[x].active = ACT_PASSIVE;
m_charmspells[x].SetActionAndType(spellId,ACT_PASSIVE);
}
else
{
m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED);
ActiveStates newstate;
bool onlyselfcast = true;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
@ -10481,11 +10482,11 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate)
// new spell rank can be already listed
for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
if (PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell())
if (uint32 action = PetActionBar[i].GetAction())
{
if (spellmgr.GetFirstSpellInChain(PetActionBar[i].SpellOrAction) == first_id)
if (PetActionBar[i].IsActionBarForSpell() && spellmgr.GetFirstSpellInChain(action) == first_id)
{
PetActionBar[i].SpellOrAction = spell_id;
PetActionBar[i].SetAction(spell_id);
return true;
}
}
@ -10494,7 +10495,7 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate)
// or use empty slot in other case
for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
if (!PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell())
if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
{
SetActionBar(i,spell_id,newstate == ACT_DECIDE ? ACT_DISABLED : newstate);
return true;
@ -10509,9 +10510,9 @@ bool CharmInfo::RemoveSpellFromActionBar(uint32 spell_id)
for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
if (PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell())
if (uint32 action = PetActionBar[i].GetAction())
{
if (spellmgr.GetFirstSpellInChain(PetActionBar[i].SpellOrAction) == first_id)
if (PetActionBar[i].IsActionBarForSpell() && spellmgr.GetFirstSpellInChain(action) == first_id)
{
SetActionBar(i,0,ACT_DISABLED);
return true;
@ -10528,12 +10529,8 @@ void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply)
return;
for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x)
{
if(spellid == m_charmspells[x].spellId)
{
m_charmspells[x].active = apply ? ACT_ENABLED : ACT_DISABLED;
}
}
if(spellid == m_charmspells[x].GetAction())
m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
}
void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow)
@ -10559,12 +10556,14 @@ void CharmInfo::LoadPetActionBar(const std::string& data )
for(iter = tokens.begin(), index = ACTION_BAR_INDEX_PET_SPELL_START; index < ACTION_BAR_INDEX_PET_SPELL_END; ++iter, ++index )
{
// use unsigned cast to avoid sign negative format use at long-> ActiveStates (int) conversion
PetActionBar[index].Type = atol((*iter).c_str());
uint8 type = atol((*iter).c_str());
++iter;
PetActionBar[index].SpellOrAction = atol((*iter).c_str());
uint32 action = atol((*iter).c_str());
PetActionBar[index].SetActionAndType(action,ActiveStates(type));
// check correctness
if(PetActionBar[index].IsActionBarForSpell() && !sSpellStore.LookupEntry(PetActionBar[index].SpellOrAction))
if(PetActionBar[index].IsActionBarForSpell() && !sSpellStore.LookupEntry(PetActionBar[index].GetAction()))
SetActionBar(index,0,ACT_DISABLED);
}
}
@ -10572,19 +10571,16 @@ void CharmInfo::LoadPetActionBar(const std::string& data )
void CharmInfo::BuildActionBar( WorldPacket* data )
{
for(uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
*data << uint16(PetActionBar[i].SpellOrAction);
*data << uint16(PetActionBar[i].Type);
}
*data << uint32(PetActionBar[i].packedData);
}
void CharmInfo::SetSpellAutocast( uint32 spell_id, bool state )
{
for(int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
if(spell_id == PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell())
if(spell_id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
{
PetActionBar[i].Type = state ? ACT_ENABLED : ACT_DISABLED;
PetActionBar[i].SetType(state ? ACT_ENABLED : ACT_DISABLED);
break;
}
}

View file

@ -718,12 +718,12 @@ enum CurrentSpellTypes
enum ActiveStates
{
ACT_PASSIVE = 0x0100, // 0x0100 - passive
ACT_DISABLED = 0x8100, // 0x8000 - castable
ACT_ENABLED = 0xC100, // 0x4000 | 0x8000 - auto cast + castable
ACT_COMMAND = 0x0700, // 0x0100 | 0x0200 | 0x0400
ACT_REACTION = 0x0600, // 0x0200 | 0x0400
ACT_DECIDE = 0x0001 // what is it?
ACT_PASSIVE = 0x01, // 0x01 - passive
ACT_DISABLED = 0x81, // 0x80 - castable
ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable
ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04
ACT_REACTION = 0x06, // 0x02 | 0x04
ACT_DECIDE = 0x00 // custom
};
enum ReactStates
@ -741,25 +741,43 @@ enum CommandStates
COMMAND_ABANDON = 3
};
#define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
#define MAX_UNIT_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
#define MAKE_UNIT_ACTION_BUTTON(A,T) (uint32(A) | (uint32(T) << 24))
struct UnitActionBarEntry
{
UnitActionBarEntry() : SpellOrAction(0), Type(ACT_DISABLED) {}
UnitActionBarEntry() : packedData(uint32(ACT_DISABLED) << 24) {}
uint16 SpellOrAction;
uint16 Type;
uint32 packedData;
// helper
ActiveStates GetType() const { return ActiveStates(UNIT_ACTION_BUTTON_TYPE(packedData)); }
uint32 GetAction() const { return UNIT_ACTION_BUTTON_ACTION(packedData); }
bool IsActionBarForSpell() const
{
ActiveStates Type = GetType();
return Type == ACT_DISABLED || Type == ACT_ENABLED || Type == ACT_PASSIVE;
}
void SetActionAndType(uint32 action, ActiveStates type)
{
packedData = MAKE_UNIT_ACTION_BUTTON(action,type);
}
void SetType(ActiveStates type)
{
packedData = MAKE_UNIT_ACTION_BUTTON(UNIT_ACTION_BUTTON_ACTION(packedData),type);
}
void SetAction(uint32 action)
{
packedData = (packedData & 0xFF000000) | UNIT_ACTION_BUTTON_ACTION(action);
}
};
struct CharmSpellEntry
{
uint16 spellId;
uint16 active;
};
typedef UnitActionBarEntry CharmSpellEntry;
enum ActionBarIndex
{
@ -798,8 +816,7 @@ struct CharmInfo
void SetSpellAutocast(uint32 spell_id, bool state);
void SetActionBar(uint8 index, uint32 spellOrAction,ActiveStates type)
{
PetActionBar[index].Type = type;
PetActionBar[index].SpellOrAction = spellOrAction;
PetActionBar[index].SetActionAndType(spellOrAction,type);
}
UnitActionBarEntry const* GetActionBarEntry(uint8 index) const { return &(PetActionBar[index]); }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8097"
#define REVISION_NR "8098"
#endif // __REVISION_NR_H__