Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/sql/vehicle_accesory.sql b/sql/vehicle_accesory.sql
- new file mode 100644
- index 0000000..239ee7c
- --- /dev/null
- +++ b/sql/vehicle_accesory.sql
- @@ -0,0 +1,64 @@
- +/*
- +author: traponinet (remake from TC).
- +*/
- +
- +DROP TABLE IF EXISTS `vehicle_accessory`;
- +CREATE TABLE `vehicle_accessory` (
- + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
- + `accessory_entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
- + `seat_id` tinyint(1) NOT NULL DEFAULT '0',
- + `minion` tinyint(1) unsigned NOT NULL DEFAULT '0',
- + `description` text NOT NULL,
- + PRIMARY KEY (`entry`,`seat_id`)
- +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Vehicle Accessory System';
- +
- +INSERT INTO `vehicle_accessory`(`entry`,`accessory_entry`,`seat_id`,`minion`,`description`) VALUES
- +(36891,31260,0,0,'Ymirjar Skycaller'),
- +(27626,27627,0,1,'Tatjana\'s Horse'),
- +(28312,28319,7,1,'Wintergrasp Siege Engine'),
- +(32627,32629,7,1,'Wintergrasp Siege Engine'),
- +(32930,32933,0,1,'Kologarn'),
- +(32930,32934,1,1,'Kologarn'),
- +(33109,33167,1,1,'Salvaged Demolisher'),
- +(33109,33620,2,1,'Salvaged Demolisher'),
- +(33060,33067,7,1,'Salvaged Siege Engine'),
- +(29931,29982,0,0,'Drakkari Rider on Drakkari Rhino'),
- +(33113,33114,2,1,'Flame Leviathan'),
- +(33113,33114,3,1,'Flame Leviathan'),
- +(33113,33139,7,1,'Flame Leviathan'),
- +(33114,33142,1,1,'Overload Control Device'),
- +(33114,33143,2,1,'Leviathan Defense Turret'),
- +(36678,38309,0,1,'Professor Putricide - trigger'),
- +(33214,33218,1,1,'Mechanolift 304-A'),
- +(35637,34705,0,0,'Marshal Jacob Alerius\' Mount'),
- +(35633,34702,0,0,'Ambrose Boltspark\'s Mount'),
- +(35768,34701,0,0,'Colosos\' Mount'),
- +(34658,34657,0,0,'Jaelyne Evensong\'s Mount'),
- +(35636,34703,0,0,'Lana Stouthammer\'s Mount'),
- +(35638,35572,0,0,'Mokra the Skullcrusher\'s Mount'),
- +(35635,35569,0,0,'Eressea Dawnsinger\'s Mount'),
- +(35640,35571,0,0,'Runok Wildmane\'s Mount'),
- +(35641,35570,0,0,'Zul\'tore\'s Mount'),
- +(35634,35617,0,0,'Deathstalker Visceri\'s Mount'),
- +(27241,27268,0,0,'Risen Gryphon'),
- +(27661,27662,0,0,'Wintergarde Gryphon'),
- +(29698,29699,0,0,'Drakuru Raptor'),
- +(33778,33780,0,1,'Tournament Hippogryph'),
- +(33687,33695,0,1,'Chillmaw'),
- +(33687,33695,1,1,'Chillmaw'),
- +(33687,33695,2,1,'Chillmaw'),
- +(29625,29694,0,0,'Hyldsmeet Proto-Drake'),
- +(30330,30332,0,0,'Jotunheim Proto-Drake'),
- +(32189,32190,0,0,'Skybreaker Recon Fighter'),
- +(36678,38308,1,1,'Professor Putricide - trigger'),
- +(32640,32642,1,0,'Traveler Mammoth (H) - Vendor'),
- +(32640,32641,2,0,'Traveler Mammoth (H) - Vendor & Repairer'),
- +(32633,32638,1,0,'Traveler Mammoth (A) - Vendor'),
- +(32633,32639,2,0,'Traveler Mammoth (A) - Vendor & Repairer'),
- +(33669,33666,0,0,'Demolisher Engineer Blastwrench'),
- +(29555,29556,0,0,'Goblin Sapper'),
- +(28018,28006,0,1,'Thiassi the Light Bringer'),
- +(28054,28053,0,0,'Lucky Wilhelm - Apple'),
- +(28614,28616,0,1,'Scarlet Gryphon Rider'),
- +(36476,36477,0,0,'Krick on Ick'),
- +(29433,29440,0,0,'Goblin Sapper in K3');
- diff --git a/sql/vehicle_data.sql b/sql/vehicle_data.sql
- new file mode 100644
- index 0000000..62667af
- --- /dev/null
- +++ b/sql/vehicle_data.sql
- @@ -0,0 +1,489 @@
- +/*
- +author: zergtmn. developed by rsa
- +HUGE THANKS FOR BOTH OF THEM !!!
- +*/
- +ALTER TABLE creature_template
- + ADD COLUMN `spell5` mediumint(8) unsigned NOT NULL default '0' AFTER `spell4`,
- + ADD COLUMN `spell6` mediumint(8) unsigned NOT NULL default '0' AFTER `spell5`,
- + ADD COLUMN `spell7` mediumint(8) unsigned NOT NULL default '0' AFTER `spell6`,
- + ADD COLUMN `spell8` mediumint(8) unsigned NOT NULL default '0' AFTER `spell7`,
- + ADD COLUMN `VehicleId` mediumint(8) unsigned NOT NULL default '0' AFTER `PetSpellDataId`,
- + ADD COLUMN `PowerType` tinyint(3) unsigned NOT NULL default '0' AFTER `MaxHealth`;
- +
- +-- Known vehicles from zergtmn
- +#UPDATE `creature_template` SET `VehicleId` = 0;
- +--
- +UPDATE `creature_template` SET `VehicleId` = 23 WHERE `entry` = 23693;
- +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 24083;
- +UPDATE `creature_template` SET `VehicleId` = 8 WHERE `entry` = 24418;
- +UPDATE `creature_template` SET `VehicleId` = 16 WHERE `entry` = 24705;
- +UPDATE `creature_template` SET `VehicleId` = 17 WHERE `entry` = 24750;
- +UPDATE `creature_template` SET `VehicleId` = 26 WHERE `entry` = 25334;
- +UPDATE `creature_template` SET `VehicleId` = 29 WHERE `entry` = 25596;
- +UPDATE `creature_template` SET `VehicleId` = 72 WHERE `entry` = 25743;
- +UPDATE `creature_template` SET `VehicleId` = 27 WHERE `entry` = 25762;
- +UPDATE `creature_template` SET `VehicleId` = 30 WHERE `entry` = 25968;
- +UPDATE `creature_template` SET `VehicleId` = 62 WHERE `entry` = 26472;
- +UPDATE `creature_template` SET `VehicleId` = 36 WHERE `entry` = 26523;
- +UPDATE `creature_template` SET `VehicleId` = 33 WHERE `entry` = 26525;
- +UPDATE `creature_template` SET `VehicleId` = 34 WHERE `entry` = 26572;
- +UPDATE `creature_template` SET `VehicleId` = 53 WHERE `entry` = 26590;
- +UPDATE `creature_template` SET `VehicleId` = 37 WHERE `entry` = 26777;
- +UPDATE `creature_template` SET `VehicleId` = 38 WHERE `entry` = 26778;
- +UPDATE `creature_template` SET `VehicleId` = 40 WHERE `entry` = 26893;
- +UPDATE `creature_template` SET `VehicleId` = 53 WHERE `entry` = 27131;
- +UPDATE `creature_template` SET `VehicleId` = 43 WHERE `entry` = 27213;
- +UPDATE `creature_template` SET `VehicleId` = 48 WHERE `entry` = 27241;
- +UPDATE `creature_template` SET `VehicleId` = 44 WHERE `entry` = 27258;
- +UPDATE `creature_template` SET `VehicleId` = 50 WHERE `entry` = 27261;
- +UPDATE `creature_template` SET `VehicleId` = 46 WHERE `entry` = 27270;
- +UPDATE `creature_template` SET `VehicleId` = 50 WHERE `entry` = 27292;
- +UPDATE `creature_template` SET `VehicleId` = 49 WHERE `entry` = 27354;
- +UPDATE `creature_template` SET `VehicleId` = 55 WHERE `entry` = 27496;
- +UPDATE `creature_template` SET `VehicleId` = 56 WHERE `entry` = 27587;
- +UPDATE `creature_template` SET `VehicleId` = 57 WHERE `entry` = 27593;
- +UPDATE `creature_template` SET `VehicleId` = 59 WHERE `entry` = 27626;
- +UPDATE `creature_template` SET `VehicleId` = 60 WHERE `entry` = 27629;
- +UPDATE `creature_template` SET `VehicleId` = 61 WHERE `entry` = 27661;
- +UPDATE `creature_template` SET `VehicleId` = 154 WHERE `entry` = 27671;
- +UPDATE `creature_template` SET `VehicleId` = 68 WHERE `entry` = 27714;
- +UPDATE `creature_template` SET `VehicleId` = 70 WHERE `entry` = 27755;
- +UPDATE `creature_template` SET `VehicleId` = 256 WHERE `entry` = 27761;
- +UPDATE `creature_template` SET `VehicleId` = 68 WHERE `entry` = 27839;
- +UPDATE `creature_template` SET `VehicleId` = 79 WHERE `entry` = 27881;
- +UPDATE `creature_template` SET `VehicleId` = 160 WHERE `entry` = 27894;
- +UPDATE `creature_template` SET `VehicleId` = 89 WHERE `entry` = 27924;
- +UPDATE `creature_template` SET `VehicleId` = 97 WHERE `entry` = 27992;
- +UPDATE `creature_template` SET `VehicleId` = 97 WHERE `entry` = 27993;
- +UPDATE `creature_template` SET `VehicleId` = 99 WHERE `entry` = 27996;
- +UPDATE `creature_template` SET `VehicleId` = 105 WHERE `entry` = 28009;
- +UPDATE `creature_template` SET `VehicleId` = 100 WHERE `entry` = 28018;
- +UPDATE `creature_template` SET `VehicleId` = 102 WHERE `entry` = 28054;
- +UPDATE `creature_template` SET `VehicleId` = 106 WHERE `entry` = 28094;
- +UPDATE `creature_template` SET `VehicleId` = 110 WHERE `entry` = 28192;
- +UPDATE `creature_template` SET `VehicleId` = 117 WHERE `entry` = 28312;
- +UPDATE `creature_template` SET `VehicleId` = 116 WHERE `entry` = 28319;
- +UPDATE `creature_template` SET `VehicleId` = 244 WHERE `entry` = 28366;
- +UPDATE `creature_template` SET `VehicleId` = 200 WHERE `entry` = 28605;
- +UPDATE `creature_template` SET `VehicleId` = 123 WHERE `entry` = 28606;
- +UPDATE `creature_template` SET `VehicleId` = 200 WHERE `entry` = 28607;
- +UPDATE `creature_template` SET `VehicleId` = 124 WHERE `entry` = 28614;
- +UPDATE `creature_template` SET `VehicleId` = 156 WHERE `entry` = 28670;
- +UPDATE `creature_template` SET `VehicleId` = 158 WHERE `entry` = 28781;
- +UPDATE `creature_template` SET `VehicleId` = 145 WHERE `entry` = 28851;
- +UPDATE `creature_template` SET `VehicleId` = 68 WHERE `entry` = 28887;
- +UPDATE `creature_template` SET `VehicleId` = 153 WHERE `entry` = 29043;
- +UPDATE `creature_template` SET `VehicleId` = 25 WHERE `entry` = 29144;
- +UPDATE `creature_template` SET `VehicleId` = 166 WHERE `entry` = 29414;
- +UPDATE `creature_template` SET `VehicleId` = 168 WHERE `entry` = 29433;
- +UPDATE `creature_template` SET `VehicleId` = 190 WHERE `entry` = 29679;
- +UPDATE `creature_template` SET `VehicleId` = 192 WHERE `entry` = 29691;
- +UPDATE `creature_template` SET `VehicleId` = 193 WHERE `entry` = 29698;
- +UPDATE `creature_template` SET `VehicleId` = 207 WHERE `entry` = 29753;
- +UPDATE `creature_template` SET `VehicleId` = 202 WHERE `entry` = 29857;
- +UPDATE `creature_template` SET `VehicleId` = 208 WHERE `entry` = 29918;
- +UPDATE `creature_template` SET `VehicleId` = 318 WHERE `entry` = 29929;
- +UPDATE `creature_template` SET `VehicleId` = 196 WHERE `entry` = 30013;
- +UPDATE `creature_template` SET `VehicleId` = 213 WHERE `entry` = 30066;
- +UPDATE `creature_template` SET `VehicleId` = 222 WHERE `entry` = 30174;
- +UPDATE `creature_template` SET `VehicleId` = 225 WHERE `entry` = 30204;
- +UPDATE `creature_template` SET `VehicleId` = 234 WHERE `entry` = 30228;
- +UPDATE `creature_template` SET `VehicleId` = 233 WHERE `entry` = 30275;
- +UPDATE `creature_template` SET `VehicleId` = 177 WHERE `entry` = 30320;
- +UPDATE `creature_template` SET `VehicleId` = 228 WHERE `entry` = 30330;
- +UPDATE `creature_template` SET `VehicleId` = 229 WHERE `entry` = 30337;
- +UPDATE `creature_template` SET `VehicleId` = 245 WHERE `entry` = 30342;
- +UPDATE `creature_template` SET `VehicleId` = 230 WHERE `entry` = 30343;
- +UPDATE `creature_template` SET `VehicleId` = 236 WHERE `entry` = 30403;
- +UPDATE `creature_template` SET `VehicleId` = 242 WHERE `entry` = 30470;
- +UPDATE `creature_template` SET `VehicleId` = 247 WHERE `entry` = 30564;
- +UPDATE `creature_template` SET `VehicleId` = 248 WHERE `entry` = 30585;
- +UPDATE `creature_template` SET `VehicleId` = 250 WHERE `entry` = 30645;
- +UPDATE `creature_template` SET `VehicleId` = 262 WHERE `entry` = 31125;
- +UPDATE `creature_template` SET `VehicleId` = 270 WHERE `entry` = 31137;
- +UPDATE `creature_template` SET `VehicleId` = 263 WHERE `entry` = 31139;
- +UPDATE `creature_template` SET `VehicleId` = 265 WHERE `entry` = 31224;
- +UPDATE `creature_template` SET `VehicleId` = 267 WHERE `entry` = 31262;
- +UPDATE `creature_template` SET `VehicleId` = 279 WHERE `entry` = 31583;
- +UPDATE `creature_template` SET `VehicleId` = 280 WHERE `entry` = 31641;
- +UPDATE `creature_template` SET `VehicleId` = 109 WHERE `entry` = 31689;
- +UPDATE `creature_template` SET `VehicleId` = 284 WHERE `entry` = 31702;
- +UPDATE `creature_template` SET `VehicleId` = 174 WHERE `entry` = 31722;
- +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 31857;
- +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 31858;
- +UPDATE `creature_template` SET `VehicleId` = 315 WHERE `entry` = 31861;
- +UPDATE `creature_template` SET `VehicleId` = 315 WHERE `entry` = 31862;
- +UPDATE `creature_template` SET `VehicleId` = 290 WHERE `entry` = 31881;
- +UPDATE `creature_template` SET `VehicleId` = 291 WHERE `entry` = 31884;
- +UPDATE `creature_template` SET `VehicleId` = 294 WHERE `entry` = 32189;
- +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 32212;
- +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 32213;
- +UPDATE `creature_template` SET `VehicleId` = 298 WHERE `entry` = 32225;
- +UPDATE `creature_template` SET `VehicleId` = 318 WHERE `entry` = 32286;
- +UPDATE `creature_template` SET `VehicleId` = 113 WHERE `entry` = 32323;
- +UPDATE `creature_template` SET `VehicleId` = 304 WHERE `entry` = 32490;
- +UPDATE `creature_template` SET `VehicleId` = 165 WHERE `entry` = 32535;
- +UPDATE `creature_template` SET `VehicleId` = 324 WHERE `entry` = 32627;
- +UPDATE `creature_template` SET `VehicleId` = 116 WHERE `entry` = 32629;
- +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 32633;
- +UPDATE `creature_template` SET `VehicleId` = 313 WHERE `entry` = 32640;
- +UPDATE `creature_template` SET `VehicleId` = 160 WHERE `entry` = 32795;
- +UPDATE `creature_template` SET `VehicleId` = 158 WHERE `entry` = 32796;
- +UPDATE `creature_template` SET `VehicleId` = 328 WHERE `entry` = 32930;
- +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 32934;
- +UPDATE `creature_template` SET `VehicleId` = 336 WHERE `entry` = 33060;
- +UPDATE `creature_template` SET `VehicleId` = 335 WHERE `entry` = 33062;
- +UPDATE `creature_template` SET `VehicleId` = 337 WHERE `entry` = 33067;
- +UPDATE `creature_template` SET `VehicleId` = 338 WHERE `entry` = 33109;
- +UPDATE `creature_template` SET `VehicleId` = 387 WHERE `entry` = 33113;
- +UPDATE `creature_template` SET `VehicleId` = 341 WHERE `entry` = 33114;
- +UPDATE `creature_template` SET `VehicleId` = 342 WHERE `entry` = 33118;
- +UPDATE `creature_template` SET `VehicleId` = 345 WHERE `entry` = 33167;
- +UPDATE `creature_template` SET `VehicleId` = 348 WHERE `entry` = 33214;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33217;
- +UPDATE `creature_template` SET `VehicleId` = 353 WHERE `entry` = 33293;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33319;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33321;
- +UPDATE `creature_template` SET `VehicleId` = 368 WHERE `entry` = 33513;
- +UPDATE `creature_template` SET `VehicleId` = 372 WHERE `entry` = 33669;
- +UPDATE `creature_template` SET `VehicleId` = 375 WHERE `entry` = 33687;
- +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 33778;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33844;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33845;
- +UPDATE `creature_template` SET `VehicleId` = 390 WHERE `entry` = 34120;
- +UPDATE `creature_template` SET `VehicleId` = 397 WHERE `entry` = 34161;
- +UPDATE `creature_template` SET `VehicleId` = 430 WHERE `entry` = 34658;
- +UPDATE `creature_template` SET `VehicleId` = 477 WHERE `entry` = 34703;
- +UPDATE `creature_template` SET `VehicleId` = 509 WHERE `entry` = 34775;
- +UPDATE `creature_template` SET `VehicleId` = 438 WHERE `entry` = 34793;
- +UPDATE `creature_template` SET `VehicleId` = 442 WHERE `entry` = 34796;
- +UPDATE `creature_template` SET `VehicleId` = 446 WHERE `entry` = 34826;
- +UPDATE `creature_template` SET `VehicleId` = 452 WHERE `entry` = 34929;
- +UPDATE `creature_template` SET `VehicleId` = 453 WHERE `entry` = 34935;
- +UPDATE `creature_template` SET `VehicleId` = 510 WHERE `entry` = 34944;
- +UPDATE `creature_template` SET `VehicleId` = 447 WHERE `entry` = 35273;
- +UPDATE `creature_template` SET `VehicleId` = 107 WHERE `entry` = 35373;
- +UPDATE `creature_template` SET `VehicleId` = 487 WHERE `entry` = 35474;
- +UPDATE `creature_template` SET `VehicleId` = 107 WHERE `entry` = 35491;
- +UPDATE `creature_template` SET `VehicleId` = 477 WHERE `entry` = 35572;
- +UPDATE `creature_template` SET `VehicleId` = 478 WHERE `entry` = 35633;
- +UPDATE `creature_template` SET `VehicleId` = 479 WHERE `entry` = 35634;
- +UPDATE `creature_template` SET `VehicleId` = 481 WHERE `entry` = 35636;
- +UPDATE `creature_template` SET `VehicleId` = 482 WHERE `entry` = 35637;
- +UPDATE `creature_template` SET `VehicleId` = 483 WHERE `entry` = 35638;
- +UPDATE `creature_template` SET `VehicleId` = 484 WHERE `entry` = 35640;
- +UPDATE `creature_template` SET `VehicleId` = 529 WHERE `entry` = 35644;
- +UPDATE `creature_template` SET `VehicleId` = 489 WHERE `entry` = 35768;
- +UPDATE `creature_template` SET `VehicleId` = 655 WHERE `entry` = 35819;
- +UPDATE `creature_template` SET `VehicleId` = 436 WHERE `entry` = 36356;
- +UPDATE `creature_template` SET `VehicleId` = 522 WHERE `entry` = 36476;
- +UPDATE `creature_template` SET `VehicleId` = 529 WHERE `entry` = 36559;
- +UPDATE `creature_template` SET `VehicleId` = 535 WHERE `entry` = 36661;
- +UPDATE `creature_template` SET `VehicleId` = 551 WHERE `entry` = 36794;
- +UPDATE `creature_template` SET `VehicleId` = 554 WHERE `entry` = 36838;
- +UPDATE `creature_template` SET `VehicleId` = 560 WHERE `entry` = 36891;
- +UPDATE `creature_template` SET `VehicleId` = 562 WHERE `entry` = 36896;
- +UPDATE `creature_template` SET `VehicleId` = 622 WHERE `entry` = 37120;
- +UPDATE `creature_template` SET `VehicleId` = 611 WHERE `entry` = 37968;
- +UPDATE `creature_template` SET `VehicleId` = 636 WHERE `entry` = 38500;
- +
- +-- Mechano-hog, Mekgineer's Chopper
- +UPDATE `creature_template` SET `VehicleId` = 318, IconName = 'vehichleCursor' WHERE `entry` IN (29929, 32286);
- +-- Traveler's Tundra Mammoth
- +-- Grand Ice Mammoth
- +-- Grand Black War Mammoth
- +-- Grand Caravan Mammoth
- +UPDATE `creature_template` SET `VehicleId` = 312, IconName = 'vehichleCursor' WHERE `entry` IN (32633, 32640, 31857, 31858, 31861, 31862, 32212, 32213);
- +-- X-53 Touring Rocket
- +UPDATE `creature_template` SET `VehicleId` = 774, IconName = 'vehichleCursor' WHERE `entry` = 40725;
- +
- +# Sniffed by zergtmn
- +UPDATE `creature_template` SET `VehicleId` = 328 WHERE `entry` = 32930;
- +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 32934;
- +UPDATE `creature_template` SET `VehicleId` = 336 WHERE `entry` = 33060;
- +UPDATE `creature_template` SET `VehicleId` = 335 WHERE `entry` = 33062;
- +UPDATE `creature_template` SET `VehicleId` = 337 WHERE `entry` = 33067;
- +UPDATE `creature_template` SET `VehicleId` = 347 WHERE `entry` = 33108;
- +UPDATE `creature_template` SET `VehicleId` = 338 WHERE `entry` = 33109;
- +UPDATE `creature_template` SET `VehicleId` = 387 WHERE `entry` = 33113;
- +UPDATE `creature_template` SET `VehicleId` = 341 WHERE `entry` = 33114;
- +UPDATE `creature_template` SET `VehicleId` = 342 WHERE `entry` = 33118;
- +UPDATE `creature_template` SET `VehicleId` = 345 WHERE `entry` = 33167;
- +UPDATE `creature_template` SET `VehicleId` = 348 WHERE `entry` = 33214;
- +UPDATE `creature_template` SET `VehicleId` = 381 WHERE `entry` = 33288;
- +UPDATE `creature_template` SET `VehicleId` = 353 WHERE `entry` = 33293;
- +UPDATE `creature_template` SET `VehicleId` = 356 WHERE `entry` = 33364;
- +UPDATE `creature_template` SET `VehicleId` = 357 WHERE `entry` = 33366;
- +UPDATE `creature_template` SET `VehicleId` = 358 WHERE `entry` = 33369;
- +UPDATE `creature_template` SET `VehicleId` = 371 WHERE `entry` = 33651;
- +UPDATE `creature_template` SET `VehicleId` = 372 WHERE `entry` = 33669;
- +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 33778;
- +UPDATE `creature_template` SET `VehicleId` = 385 WHERE `entry` = 33983;
- +UPDATE `creature_template` SET `VehicleId` = 390 WHERE `entry` = 34120;
- +UPDATE `creature_template` SET `VehicleId` = 392 WHERE `entry` = 34146;
- +UPDATE `creature_template` SET `VehicleId` = 395 WHERE `entry` = 34150;
- +UPDATE `creature_template` SET `VehicleId` = 396 WHERE `entry` = 34151;
- +UPDATE `creature_template` SET `VehicleId` = 397 WHERE `entry` = 34161;
- +UPDATE `creature_template` SET `VehicleId` = 399 WHERE `entry` = 34183;
- +
- +UPDATE `creature_template` SET `VehicleId` = 143 WHERE `entry` = 28864; -- Scourge Gryphon
- +UPDATE `creature_template` SET `VehicleId` = 123 WHERE `entry` = 28605; -- Havenshire Stallion
- +UPDATE `creature_template` SET `VehicleId` = 135 WHERE `entry` = 28782; -- Acherus Deathcharger
- +UPDATE `creature_template` SET `VehicleId` = 138 WHERE `entry` = 28817; -- Mine Car
- +UPDATE `creature_template` SET `VehicleId` = 139 WHERE `entry` = 28833; -- Scarlet Cannon
- +
- +UPDATE `creature_template` SET `VehicleId` = 370 WHERE `entry` = 33432; -- Leviathan Mk II
- +UPDATE `creature_template` SET `VehicleId` = 373 WHERE `entry` = 33670; -- Aerial Command Unit
- +
- +UPDATE `creature_template` SET `VehicleId` = 736 WHERE `entry` = 40305; -- Spirit of the Tiger
- +
- +#
- +UPDATE `creature_template` SET `VehicleId` = 220 WHERE `entry` = 30161;
- +UPDATE `creature_template` SET `VehicleId` = 224 WHERE `entry` = 30234;
- +UPDATE `creature_template` SET `VehicleId` = 223 WHERE `entry` = 30248;
- +
- +-- fom Burned
- +UPDATE creature_template SET IconName="vehichleCursor" WHERE entry IN
- +(29144,32633,24418,25334,25743,26191,26523,26813,27061,27258,27354,27409,27496,27587,27593,27626, 27661,27692,27714,27755,27756,27838,27839,27850,27883,27905,27996,28851,29563,29598,29602,29708,
- +29857,29903,30021,30066,30108,30123,30124,30134,30228,30234,30248,30272,30403,30500,31070,31407,
- +31408,31409,31717,31736,31770,31840,31856,31858,31884,32152,32158,32227,32286,32370,32640,33782);
- +
- +UPDATE creature_template SET IconName="Gunner" WHERE entry IN
- +(28319,28366,28833,30236,32629,33067,33080,33139,33264,34111);
- +
- +-- From Timmit
- +-- bone spike
- +UPDATE `creature_template` SET `VehicleId` = 647 WHERE `entry` IN (38711,38970,38971,38972);
- +UPDATE `creature_template` SET `VehicleId` = 533 WHERE `entry` IN (36619,38233,38459,38460);
- +
- +-- Putricide
- +UPDATE `creature_template` SET `VehicleId` = 587 WHERE `entry` IN (36678,38431,38585,38586);
- +UPDATE `creature_template` SET `VehicleId` = 591 WHERE `entry` IN (37672,38605,38786,38787);
- +
- +# full fix
- +UPDATE `creature_template` SET `IconName` = 'vehichleCursor' WHERE `VehicleId` > 0 AND `IconName` IS NULL;
- +
- +# spellclicks
- +-- from zergtmn
- +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (33109, 33062, 33060);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(33109, 62309, 0, 0, 0, 1), -- Demolisher
- +(33062, 65030, 0, 0, 0, 1), -- Chopper
- +(33060, 65031, 0, 0, 0, 1); -- Siege engine
- +
- +-- vehicle spells
- +
- +-- from me
- +-- chopper
- +UPDATE `creature_template` SET `IconName` = 'vehichleCursor', `PowerType` = 3,
- +`spell1` = 62974, `spell2` = 62286, `spell3` = 62299, `spell4` = 64660, `AIName` = 'NullAI'
- +WHERE `entry` IN (33062);
- +-- Siege engine
- +UPDATE `creature_template` SET `IconName` = 'Gunner', `PowerType` = 3,
- +`spell1` = 62345, `spell2` = 62522, `spell3` = 62346, `AIName` = 'NullAI'
- +WHERE `entry` IN (33060);
- +-- demolisher
- +UPDATE `creature_template` SET `IconName` = 'vehichleCursor', `PowerType` = 3,
- +`spell1` = 62306, `spell2` = 62490, `spell3` = 62308, `spell4` = 62324, `AIName` = 'NullAI'
- +WHERE `entry` IN (33109);
- +
- +-- from traponinet
- +
- +-- Salvaged Siege Turret
- +UPDATE `creature_template` SET `PowerType`=3,spell1=62358,spell2=62359,spell3=64677,spell4=0,spell5=0,spell6=0 WHERE `entry`=33067;
- +
- +-- Salvaged Demolisher Mechanic Seat
- +UPDATE `creature_template` SET `PowerType`=3,spell1=62634,spell2=64979,spell3=62479,spell4=62471,spell5=0,spell6=62428 WHERE `entry`=33167;
- +
- +-- Earthen Stoneshaper
- +UPDATE `creature_template` SET `unit_flags`=33587968 WHERE `entry`=33620;
- +
- +-- from Lordron
- +-- Spectral tiger
- +UPDATE `creature_template` SET `VehicleId` = 354 WHERE `entry` = 33357;
- +-- Shalewing
- +UPDATE `creature_template` SET `VehicleId` = 146 WHERE `entry` = 28875;
- +-- Drakkari Skullcrusher
- +UPDATE `creature_template` SET `VehicleId` = 774 WHERE `entry` = 28844;
- +-- ICC
- +UPDATE `creature_template` SET `vehicleId` = 531 WHERE `entry` IN (36598);
- +UPDATE `creature_template` SET `vehicleId` = 532 WHERE `entry` IN (36609,39120,39121,39122);
- +
- +-- from YTDB/TC 570
- +UPDATE `creature_template` SET `VehicleId` = 51 WHERE `entry` = 27409;
- +UPDATE `creature_template` SET `VehicleId` = 107 WHERE `entry` = 28135;
- +UPDATE `creature_template` SET `VehicleId` = 206 WHERE `entry` = 28379;
- +UPDATE `creature_template` SET `VehicleId` = 121 WHERE `entry` = 28468;
- +UPDATE `creature_template` SET `VehicleId` = 492 WHERE `entry` = 25765;
- +UPDATE `creature_template` SET `VehicleId` = 25 WHERE `entry` = 27516;
- +UPDATE `creature_template` SET `VehicleId` = 156 WHERE `entry` = 26788;
- +UPDATE `creature_template` SET `VehicleId` = 129 WHERE `entry` = 28710;
- +UPDATE `creature_template` SET `VehicleId` = 25 WHERE `entry` = 28446;
- +UPDATE `creature_template` SET `VehicleId` = 22 WHERE `entry` = 24825;
- +UPDATE `creature_template` SET `VehicleId` = 22 WHERE `entry` = 24821;
- +UPDATE `creature_template` SET `VehicleId` = 22 WHERE `entry` = 24823;
- +UPDATE `creature_template` SET `VehicleId` = 22 WHERE `entry` = 24806;
- +UPDATE `creature_template` SET `VehicleId` = 200 WHERE `entry` = 26191;
- +UPDATE `creature_template` SET `VehicleId` = 113 WHERE `entry` = 28246;
- +UPDATE `creature_template` SET `VehicleId` = 156 WHERE `entry` = 27850;
- +UPDATE `creature_template` SET `VehicleId` = 156 WHERE `entry` = 27838;
- +UPDATE `creature_template` SET `VehicleId` = 30 WHERE `entry` = 25881;
- +UPDATE `creature_template` SET `VehicleId` = 156 WHERE `entry` = 26807;
- +UPDATE `creature_template` SET `VehicleId` = 34 WHERE `entry` = 26585;
- +UPDATE `creature_template` SET `VehicleId` = 39 WHERE `entry` = 26813;
- +UPDATE `creature_template` SET `VehicleId` = 127 WHERE `entry` = 28669;
- +UPDATE `creature_template` SET `VehicleId` = 203 WHERE `entry` = 29863;
- +UPDATE `creature_template` SET `VehicleId` = 200 WHERE `entry` = 27883;
- +UPDATE `creature_template` SET `VehicleId` = 111 WHERE `entry` = 28222;
- +UPDATE `creature_template` SET `VehicleId` = 115 WHERE `entry` = 28308;
- +UPDATE `creature_template` SET `VehicleId` = 191 WHERE `entry` = 29306;
- +UPDATE `creature_template` SET `VehicleId` = 176 WHERE `entry` = 29351;
- +UPDATE `creature_template` SET `VehicleId` = 177 WHERE `entry` = 29358;
- +UPDATE `creature_template` SET `VehicleId` = 165 WHERE `entry` = 29403;
- +UPDATE `creature_template` SET `VehicleId` = 169 WHERE `entry` = 29460;
- +UPDATE `creature_template` SET `VehicleId` = 173 WHERE `entry` = 29500;
- +UPDATE `creature_template` SET `VehicleId` = 175 WHERE `entry` = 29555;
- +UPDATE `creature_template` SET `VehicleId` = 179 WHERE `entry` = 29579;
- +UPDATE `creature_template` SET `VehicleId` = 181 WHERE `entry` = 29602;
- +UPDATE `creature_template` SET `VehicleId` = 183 WHERE `entry` = 29625;
- +UPDATE `creature_template` SET `VehicleId` = 186 WHERE `entry` = 29677;
- +UPDATE `creature_template` SET `VehicleId` = 198 WHERE `entry` = 29708;
- +UPDATE `creature_template` SET `VehicleId` = 194 WHERE `entry` = 29709;
- +UPDATE `creature_template` SET `VehicleId` = 243 WHERE `entry` = 29736;
- +UPDATE `creature_template` SET `VehicleId` = 197 WHERE `entry` = 29754;
- +UPDATE `creature_template` SET `VehicleId` = 201 WHERE `entry` = 29838;
- +UPDATE `creature_template` SET `VehicleId` = 205 WHERE `entry` = 29884;
- +UPDATE `creature_template` SET `VehicleId` = 209 WHERE `entry` = 29931;
- +UPDATE `creature_template` SET `VehicleId` = 214 WHERE `entry` = 30090;
- +UPDATE `creature_template` SET `VehicleId` = 217 WHERE `entry` = 30124;
- +UPDATE `creature_template` SET `VehicleId` = 219 WHERE `entry` = 30134;
- +UPDATE `creature_template` SET `VehicleId` = 221 WHERE `entry` = 30165;
- +UPDATE `creature_template` SET `VehicleId` = 227 WHERE `entry` = 30301;
- +UPDATE `creature_template` SET `VehicleId` = 25 WHERE `entry` = 30378;
- +UPDATE `creature_template` SET `VehicleId` = 316 WHERE `entry` = 30468;
- +UPDATE `creature_template` SET `VehicleId` = 252 WHERE `entry` = 30719;
- +UPDATE `creature_template` SET `VehicleId` = 259 WHERE `entry` = 31110;
- +UPDATE `creature_template` SET `VehicleId` = 265 WHERE `entry` = 31163;
- +UPDATE `creature_template` SET `VehicleId` = 265 WHERE `entry` = 31220;
- +UPDATE `creature_template` SET `VehicleId` = 265 WHERE `entry` = 31221;
- +UPDATE `creature_template` SET `VehicleId` = 269 WHERE `entry` = 31268;
- +UPDATE `creature_template` SET `VehicleId` = 268 WHERE `entry` = 31269;
- +UPDATE `creature_template` SET `VehicleId` = 273 WHERE `entry` = 31406;
- +UPDATE `creature_template` SET `VehicleId` = 277 WHERE `entry` = 31407;
- +UPDATE `creature_template` SET `VehicleId` = 274 WHERE `entry` = 31408;
- +UPDATE `creature_template` SET `VehicleId` = 278 WHERE `entry` = 31409;
- +UPDATE `creature_template` SET `VehicleId` = 282 WHERE `entry` = 31784;
- +UPDATE `creature_template` SET `VehicleId` = 282 WHERE `entry` = 31785;
- +UPDATE `creature_template` SET `VehicleId` = 736 WHERE `entry` = 31788;
- +UPDATE `creature_template` SET `VehicleId` = 512 WHERE `entry` = 31830;
- +UPDATE `creature_template` SET `VehicleId` = 287 WHERE `entry` = 31838;
- +UPDATE `creature_template` SET `VehicleId` = 291 WHERE `entry` = 32227;
- +UPDATE `creature_template` SET `VehicleId` = 300 WHERE `entry` = 32326;
- +UPDATE `creature_template` SET `VehicleId` = 301 WHERE `entry` = 32344;
- +UPDATE `creature_template` SET `VehicleId` = 302 WHERE `entry` = 32348;
- +UPDATE `creature_template` SET `VehicleId` = 273 WHERE `entry` = 32512;
- +UPDATE `creature_template` SET `VehicleId` = 369 WHERE `entry` = 32531;
- +UPDATE `creature_template` SET `VehicleId` = 40 WHERE `entry` = 30775;
- +UPDATE `creature_template` SET `VehicleId` = 201 WHERE `entry` = 30935;
- +UPDATE `creature_template` SET `VehicleId` = 209 WHERE `entry` = 30936;
- +UPDATE `creature_template` SET `VehicleId` = 191 WHERE `entry` = 31368;
- +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 31669;
- +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 32933;
- +UPDATE `creature_template` SET `VehicleId` = 342 WHERE `entry` = 33190;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33297;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33298;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33300;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33301;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33316;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33317;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33318;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33320;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33322;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33323;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33324;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33408;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33409;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33414;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33416;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 33418;
- +UPDATE `creature_template` SET `VehicleId` = 368 WHERE `entry` = 33519;
- +UPDATE `creature_template` SET `VehicleId` = 369 WHERE `entry` = 33531;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33790;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33791;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33792;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33793;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33794;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33795;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33796;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33798;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33799;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33800;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33842;
- +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33843;
- +UPDATE `creature_template` SET `VehicleId` = 353 WHERE `entry` = 33885;
- +UPDATE `creature_template` SET `VehicleId` = 328 WHERE `entry` = 33909;
- +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 33910;
- +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 33911;
- +UPDATE `creature_template` SET `VehicleId` = 381 WHERE `entry` = 33955;
- +UPDATE `creature_template` SET `VehicleId` = 385 WHERE `entry` = 33984;
- +UPDATE `creature_template` SET `VehicleId` = 387 WHERE `entry` = 34003;
- +UPDATE `creature_template` SET `VehicleId` = 335 WHERE `entry` = 34045;
- +UPDATE `creature_template` SET `VehicleId` = 370 WHERE `entry` = 34106;
- +UPDATE `creature_template` SET `VehicleId` = 371 WHERE `entry` = 34108;
- +UPDATE `creature_template` SET `VehicleId` = 373 WHERE `entry` = 34109;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 34125;
- +UPDATE `creature_template` SET `VehicleId` = 397 WHERE `entry` = 34162;
- +UPDATE `creature_template` SET `VehicleId` = 399 WHERE `entry` = 34214;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 36557;
- +UPDATE `creature_template` SET `VehicleId` = 485 WHERE `entry` = 35641;
- +UPDATE `creature_template` SET `VehicleId` = 480 WHERE `entry` = 35635;
- +UPDATE `creature_template` SET `VehicleId` = 106 WHERE `entry` = 34802;
- +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` = 36558;
- +UPDATE `creature_template` SET `VehicleId` = 477 WHERE `entry` = 36087;
- +UPDATE `creature_template` SET `VehicleId` = 477 WHERE `entry` = 36089;
- +UPDATE `creature_template` SET `VehicleId` = 442 WHERE `entry` = 35438;
- +UPDATE `creature_template` SET `VehicleId` = 442 WHERE `entry` = 35439;
- +UPDATE `creature_template` SET `VehicleId` = 442 WHERE `entry` = 35440;
- +UPDATE `creature_template` SET `VehicleId` = 446 WHERE `entry` = 35270;
- +UPDATE `creature_template` SET `VehicleId` = 446 WHERE `entry` = 35271;
- +UPDATE `creature_template` SET `VehicleId` = 446 WHERE `entry` = 35272;
- +UPDATE `creature_template` SET `VehicleId` = 555 WHERE `entry` = 36839;
- +UPDATE `creature_template` SET `VehicleId` = 599 WHERE `entry` = 37187;
- +UPDATE `creature_template` SET `VehicleId` = 648 WHERE `entry` = 38712;
- +UPDATE `creature_template` SET `VehicleId` = 562 WHERE `entry` = 37636;
- +UPDATE `creature_template` SET `VehicleId` = 560 WHERE `entry` = 37626;
- +UPDATE `creature_template` SET `VehicleId` = 522 WHERE `entry` = 37627;
- +UPDATE `creature_template` SET `VehicleId` = 648 WHERE `entry` = 38974;
- +UPDATE `creature_template` SET `VehicleId` = 648 WHERE `entry` = 38973;
- +UPDATE `creature_template` SET `VehicleId` = 648 WHERE `entry` = 38975;
- +UPDATE `creature_template` SET `VehicleId` = 106 WHERE `entry` = 35419;
- +UPDATE `creature_template` SET `VehicleId` = 106 WHERE `entry` = 35421;
- +UPDATE `creature_template` SET `VehicleId` = 106 WHERE `entry` = 35415;
- +UPDATE `creature_template` SET `VehicleId` = 436 WHERE `entry` = 36358;
- +UPDATE `creature_template` SET `VehicleId` = 36 WHERE `entry` = 35413;
- +UPDATE `creature_template` SET `VehicleId` = 452 WHERE `entry` = 35410;
- +UPDATE `creature_template` SET `VehicleId` = 591 WHERE `entry` = 38285;
- +UPDATE `creature_template` SET `VehicleId` = 718 WHERE `entry` = 40081;
- +UPDATE `creature_template` SET `VehicleId` = 718 WHERE `entry` = 40470;
- +UPDATE `creature_template` SET `VehicleId` = 718 WHERE `entry` = 40471;
- +UPDATE `creature_template` SET `VehicleId` = 718 WHERE `entry` = 40472;
- +UPDATE `creature_template` SET `VehicleId` = 79 WHERE `entry` = 35427;
- +UPDATE `creature_template` SET `VehicleId` = 79 WHERE `entry` = 35429;
- +UPDATE `creature_template` SET `VehicleId` = 591 WHERE `entry` = 38788;
- +UPDATE `creature_template` SET `VehicleId` = 591 WHERE `entry` = 38789;
- +UPDATE `creature_template` SET `VehicleId` = 591 WHERE `entry` = 38790;
- +UPDATE `creature_template` SET `VehicleId` = 700 WHERE `entry` = 39682;
- +UPDATE `creature_template` SET `VehicleId` = 745 WHERE `entry` = 39713;
- +UPDATE `creature_template` SET `VehicleId` = 745 WHERE `entry` = 39714;
- +UPDATE `creature_template` SET `VehicleId` = 753 WHERE `entry` = 39759;
- +UPDATE `creature_template` SET `VehicleId` = 763 WHERE `entry` = 39819;
- +UPDATE `creature_template` SET `VehicleId` = 711 WHERE `entry` = 39860;
- +UPDATE `creature_template` SET `VehicleId` = 747 WHERE `entry` = 40479;
- +-- YTDB updates 571-578
- +UPDATE `creature_template` SET `VehicleId` = 265 WHERE `entry` = 31225;
- +UPDATE `creature_template` SET `VehicleId` = 224 WHERE `entry` = 31748;
- +UPDATE `creature_template` SET `VehicleId` = 223 WHERE `entry` = 31749;
- +UPDATE `creature_template` SET `VehicleId` = 220 WHERE `entry` = 31752;
- +
- +-- Ymirjar Skycaller true fix (delete hack from YTDB)
- +DELETE FROM `creature_template_addon` WHERE `entry` IN (31260, 37643);
- diff --git a/sql/vehicle_quest.sql b/sql/vehicle_quest.sql
- new file mode 100644
- index 0000000..a09a1bc
- --- /dev/null
- +++ b/sql/vehicle_quest.sql
- @@ -0,0 +1,333 @@
- +-- From zergtmn
- +/*
- + Havenshire Stallion
- + Havenshire Mare
- + Havenshire Colt
- +*/
- +UPDATE creature_template SET
- + spell1 = 52264,
- + spell2 = 52268,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 123
- +WHERE entry IN (28605, 28606, 28607);
- +
- +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (28605, 28606, 28607);
- +INSERT INTO npc_spellclick_spells VALUES
- +(28605, 52263, 12680, 1, 12680, 1),
- +(28606, 52263, 12680, 1, 12680, 1),
- +(28607, 52263, 12680, 1, 12680, 1);
- +INSERT IGNORE INTO spell_script_target VALUES (52264, 1, 28653);
- +
- +-- From jahangames
- +-- Massacre at Light's point quest
- +UPDATE creature_template SET
- +spell1 = 52435,
- +spell2 = 52576,
- +spell3 = 0,
- +spell4 = 0,
- +spell5 = 52588,
- +spell6 = 0,
- +VehicleId = 79
- +WHERE entry IN (28833);
- +
- +UPDATE creature_template SET
- +spell1 = 52435,
- +spell2 = 52576,
- +spell3 = 0,
- +spell4 = 0,
- +spell5 = 52588,
- +spell6 = 0,
- +VehicleId = 68
- +WHERE entry IN (28887);
- +
- +INSERT INTO npc_spellclick_spells VALUES ('28833', '52447', '12701', '1', '12701', '1');
- +INSERT INTO npc_spellclick_spells VALUES ('28887', '52447', '12701', '1', '12701', '1');
- +UPDATE creature_template SET minhealth = 26140, maxhealth = 26140, dynamicflags = 0, minmana = 2117, maxmana = 2117, unit_flags = 772, minlevel = 55, maxlevel = 55, unk16 = 10, unk17 = 1, InhabitType = 3, scale = 1, mindmg = 685, maxdmg = 715, armor = 3232, attackpower = 214, unit_class = 2, type = 10 WHERE entry = 28833;
- +UPDATE creature_template SET minhealth = 26140, maxhealth = 26140, dynamicflags = 0, minmana = 0, maxmana = 0, unit_flags = 772, minlevel = 55, maxlevel = 55, unk16 = 10, unk17 = 1, InhabitType = 3, scale = 1, mindmg = 685, maxdmg = 715, armor = 3232, attackpower = 214, unit_class = 2, type = 10 WHERE entry = 28887;
- +INSERT IGNORE INTO spell_script_target VALUES (52576, 1, 28834);
- +INSERT IGNORE INTO spell_script_target VALUES (52576, 1, 28886);
- +INSERT IGNORE INTO spell_script_target VALUES (52576, 1, 28850);
- +
- +-- From Lanc
- +-- quest 12953
- +UPDATE `creature_template` SET
- + spell1 = 55812,
- + spell2 = 0,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 213
- +WHERE entry IN (30066);
- +
- +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (30066);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(30066, 44002, 12953, 1, 12953, 1);
- +INSERT IGNORE INTO `spell_script_target` VALUES (55812, 1, 30096);
- +
- +-- From lanc
- +/* 7th Legion Chain Gun */
- +UPDATE creature_template SET
- + IconName = 'Gunner',
- + spell1 = 49190,
- + spell2 = 49550,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 68
- +WHERE entry IN (27714);
- +
- +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (27714);
- +INSERT INTO npc_spellclick_spells VALUES
- +(27714, 67373, 0, 0, 0, 1);
- +
- +/* Broken-down Shredder */
- +UPDATE creature_template SET
- + IconName = 'vehichleCursor',
- + spell1 = 48558,
- + spell2 = 48604,
- + spell3 = 48548,
- + spell4 = 0,
- + spell5 = 48610,
- + spell6 = 0,
- + VehicleId = 49
- +WHERE entry IN (27354);
- +
- +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (27354);
- +INSERT INTO npc_spellclick_spells VALUES
- +(27354, 67373, 0, 0, 0, 1);
- +INSERT IGNORE INTO spell_script_target VALUES (48610, 1, 27396);
- +
- +/* Forsaken Blight Spreader */
- +UPDATE creature_template SET
- + IconName = 'vehichleCursor',
- + spell1 = 48211,
- + spell2 = 0,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 36
- +WHERE entry IN (26523);
- +
- +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (26523);
- +INSERT INTO npc_spellclick_spells VALUES
- +(26523, 47961, 0, 0, 0, 1);
- +
- +/* Argent Tournament mount */
- +UPDATE creature_template SET
- + spell1 = 62544,
- + spell2 = 62575,
- + spell3 = 63010,
- + spell4 = 62552,
- + spell5 = 64077,
- + spell6 = 62863,
- + VehicleId = 349
- +WHERE entry IN (33844, 33845);
- +UPDATE creature_template SET KillCredit1 = 33340 WHERE entry IN (33272);
- +UPDATE creature_template SET KillCredit1 = 33339 WHERE entry IN (33243);
- +
- +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (33842, 33843);
- +INSERT INTO npc_spellclick_spells VALUES
- +(33842, 63791, 13829, 1, 0, 3),
- +(33842, 63791, 13839, 1, 0, 3),
- +(33842, 63791, 13838, 1, 0, 3),
- +(33843, 63792, 13828, 1, 0, 3),
- +(33843, 63792, 13837, 1, 0, 3),
- +(33843, 63792, 13835, 1, 0, 3);
- +
- +DELETE FROM creature WHERE id IN (33844,33845);
- +UPDATE creature_template SET speed_run = '1.5', unit_flags = 8 WHERE entry IN (33844,33845);
- +
- +-- Quest vehicles Support: Going Bearback (12851)
- +UPDATE `creature_template` SET
- + spell1 = 54897,
- + spell2 = 54907,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 308
- +WHERE entry IN (29598);
- +
- +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (29598);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(29598, 54908, 12851, 1, 12851, 1);
- +
- +INSERT IGNORE INTO `spell_script_target` VALUES (54897, 1, 29358);
- +
- +/* Scourge Gryphon */
- +UPDATE creature_template SET
- + spell1 = 0,
- + spell2 = 0,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 146
- +WHERE entry IN (28864);
- +
- +/* Frostbrood Vanquisher */
- +UPDATE creature_template SET
- + spell1 = 53114,
- + spell2 = 53110,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 156
- +WHERE entry IN (28670);
- +
- +UPDATE creature_template SET maxhealth = 133525, minhealth = 133525, maxmana = 51360, minmana = 51360, InhabitType = 3 WHERE entry = 28670;
- +
- +REPLACE INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `b2_0_sheath`, `emote`, `moveflags`, `auras`) VALUES
- +(28670, 0, 50331648, 1, 0, 1024, '53112 0 53112 1 53112 2');
- +
- +-- from me
- +-- into realm of shadows
- +UPDATE `creature_template` SET `IconName` = 'vehichleCursor',
- +`unit_flags` = 0,
- +`spell1` = 52362
- +WHERE `entry` =28782;
- +
- +UPDATE `quest_template` SET
- +`SrcSpell` = 52359,
- +`SpecialFlags` = 2,
- +`ReqCreatureOrGOId1` = 28768,
- +`ReqCreatureOrGOCount1` = 1,
- +`ReqSpellCast1` = 0,
- +`RewItemId1` = 39208,
- +`RewItemCount1` = 1 WHERE `entry` = 12687;
- +
- +DELETE FROM `creature_involvedrelation` WHERE `quest` in (12687);
- +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28788, 12687);
- +UPDATE `creature_template` SET `npcflag` = 2 WHERE `entry` = 28788;
- +
- +DELETE FROM `spell_script_target` WHERE `entry` = 52349;
- +
- +UPDATE `creature_ai_scripts` SET
- +`action1_type` = '11',
- +`action1_param1` = '52361',
- +`action1_param2` = '6',
- +`action1_param3` = '16',
- +`action2_type` = '11',
- +`action2_param1` = '52357',
- +`action2_param2` = '6',
- +`action2_param3` = '16',
- +`action3_type` = '0'
- +WHERE `id` = 2876806;
- +
- +DELETE FROM `creature` WHERE `id` = 28782;
- +
- +DELETE FROM `creature_template_addon` WHERE `entry` = 28782;
- +
- +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (28782);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(28782, 46598, 0, 0, 0, 1);
- +
- +-- from lanc
- +-- Infected Kodo fix quest (11690)
- +UPDATE `creature_template` SET
- +spell1 = 45877,
- +spell2 = 0,
- +spell3 = 0,
- +spell4 = 0,
- +spell5 = 0,
- +spell6 = 0,
- +VehicleId = 29
- +WHERE `entry` IN (25596);
- +
- +INSERT IGNORE INTO `spell_script_target` VALUES (45877, 1, 25596);
- +
- +-- Horde Siege Tank
- +UPDATE `creature_template` SET
- +spell1 = 50672,
- +spell2 = 45750,
- +spell3 = 50677,
- +spell4 = 47849,
- +spell5 = 47962,
- +spell6 = 0,
- +VehicleId = 26
- +WHERE `entry` IN (25334);
- +
- +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (25334, 27107);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(25334, 47917, 11652, 1, 11652, 1);
- +
- +REPLACE INTO `spell_script_target` VALUES (47962, 1, 27107);
- +
- +REPLACE INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_start_active`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`)
- +VALUES ('47917','4027','11652','1','11652','0','0','2','0'), ('47917','4130','11652','1','11652','0','0','2','0');
- +
- +-- from lanc
- +-- Refurbished Shredder (quest 12050)
- +UPDATE `creature_template` SET
- +spell1 = 47939,
- +spell2 = 47921,
- +spell3 = 47966,
- +spell4 = 47938,
- +spell5 = 0,
- +spell6 = 0,
- +VehicleId = 300
- +WHERE `entry` IN (27061);
- +
- +DELETE FROM `npc_spellclick_spells` WHERE npc_entry IN (27061);
- +INSERT INTO `npc_spellclick_spells` VALUES (27061, 47920, 0, 0, 0, 1);
- +REPLACE INTO `spell_script_target` VALUES (47939, 2, 188539);
- +
- +-- Argent Cannon (quest 13086)
- +UPDATE `creature_template` SET
- + spell1 = 57485,
- + spell2 = 57412,
- + spell3 = 0,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 244
- +WHERE `entry` IN (30236);
- +
- +DELETE FROM `npc_spellclick_spells` WHERE npc_entry IN (30236);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(30236, 57573, 13086, 1, 13086, 1);
- +
- +-- Wyrmrest Vanquisher (quest 12498)
- +UPDATE `creature_template` SET
- + spell1 = 55987,
- + spell2 = 50348,
- + spell3 = 50430,
- + spell4 = 0,
- + spell5 = 0,
- + spell6 = 0,
- + VehicleId = 99
- +WHERE `entry` IN (27996);
- +
- +DELETE FROM `npc_spellclick_spells` WHERE npc_entry IN (27996);
- +INSERT INTO `npc_spellclick_spells` VALUES
- +(27996, 50343, 12498, 1, 12498, 1);
- +
- +REPLACE INTO `creature_template_addon` (entry, auras) VALUES (27996, '53112 0 53112 1 53112 2');
- +
- +-- from me
- +-- Quest Reclamation (12546)
- +UPDATE `creature_template` SET `spell1` = 50978,`spell2` = 50980,`spell3` = 50983,`spell4` = 50985,
- +`VehicleId` = 111
- +WHERE `entry` = 28222;
- +
- +-- from YTDB/TC 578
- +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (27850,27881,28094,28312,28319,28670,32627,32629);
- +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`) VALUES
- +(27850, 60968, 0, 0, 0, 1),
- +(27881, 60968, 0, 0, 0, 1),
- +(28094, 60968, 0, 0, 0, 1),
- +(28312, 60968, 0, 0, 0, 1),
- +(28319, 60968, 0, 0, 0, 1),
- +(28670, 52196, 0, 0, 0, 1),
- +(32627, 60968, 0, 0, 0, 1),
- +(32629, 60968, 0, 0, 0, 1);
- +
- +-- Quest 12996
- +UPDATE `creature_template` SET `spell1` = 54459,`spell2` = 54458,`spell3` = 54460,`VehicleId` = 208 WHERE `creature_template`.`entry` = 29918;
- diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp
- index 5a32a83..8af197d 100644
- --- a/src/game/Bag.cpp
- +++ b/src/game/Bag.cpp
- @@ -64,7 +64,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
- if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
- return false;
- - Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
- + Object::_Create(ObjectGuid(HIGHGUID_CONTAINER, guidlow));
- SetEntry(itemid);
- SetObjectScale(DEFAULT_OBJECT_SCALE);
- diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
- index 8def1ec..2f052a3 100644
- --- a/src/game/Chat.cpp
- +++ b/src/game/Chat.cpp
- @@ -211,7 +211,6 @@ ChatCommand * ChatHandler::getCommandTable()
- { "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValueCommand, "", NULL },
- { "spellcheck", SEC_CONSOLE, true, &ChatHandler::HandleDebugSpellCheckCommand, "", NULL },
- { "spellmods", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpellModsCommand, "", NULL },
- - { "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicleCommand, "", NULL },
- { "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateWorldStateCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- diff --git a/src/game/Chat.h b/src/game/Chat.h
- index f32f53f..19e1cbc 100644
- --- a/src/game/Chat.h
- +++ b/src/game/Chat.h
- @@ -187,7 +187,6 @@ class ChatHandler
- bool HandleDebugSetAuraStateCommand(char* args);
- bool HandleDebugSetItemValueCommand(char* args);
- bool HandleDebugSetValueCommand(char* args);
- - bool HandleDebugSpawnVehicleCommand(char* args);
- bool HandleDebugSpellCheckCommand(char* args);
- bool HandleDebugSpellModsCommand(char* args);
- bool HandleDebugUpdateWorldStateCommand(char* args);
- diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp
- index b546ee8..fe500e5 100644
- --- a/src/game/Corpse.cpp
- +++ b/src/game/Corpse.cpp
- @@ -67,7 +67,7 @@ void Corpse::RemoveFromWorld()
- bool Corpse::Create( uint32 guidlow )
- {
- - Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
- + Object::_Create(ObjectGuid(HIGHGUID_CORPSE, guidlow));
- return true;
- }
- @@ -75,7 +75,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
- {
- MANGOS_ASSERT(owner);
- - WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask());
- + WorldObject::_Create(ObjectGuid(HIGHGUID_CORPSE, guidlow), owner->GetPhaseMask());
- Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
- //we need to assign owner's map for corpse
- @@ -159,7 +159,7 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
- float orientation = fields[5].GetFloat();
- uint32 mapid = fields[6].GetUInt32();
- - Object::_Create(lowguid, 0, HIGHGUID_CORPSE);
- + Object::_Create(ObjectGuid(HIGHGUID_CORPSE, lowguid));
- m_time = time_t(fields[7].GetUInt64());
- m_type = CorpseType(fields[8].GetUInt32());
- diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
- index 36cfb10..72a608b 100644
- --- a/src/game/Creature.cpp
- +++ b/src/game/Creature.cpp
- @@ -153,16 +153,19 @@ Creature::~Creature()
- void Creature::AddToWorld()
- {
- ///- Register the creature for guid lookup
- - if(!IsInWorld() && GetObjectGuid().GetHigh() == HIGHGUID_UNIT)
- + if(!IsInWorld() && GetObjectGuid().IsCreatureOrVehicle())
- GetMap()->GetObjectsStore().insert<Creature>(GetGUID(), (Creature*)this);
- Unit::AddToWorld();
- +
- + if (GetVehicleKit())
- + GetVehicleKit()->Reset();
- }
- void Creature::RemoveFromWorld()
- {
- ///- Remove the creature from the accessor
- - if(IsInWorld() && GetObjectGuid().GetHigh() == HIGHGUID_UNIT)
- + if(IsInWorld() && GetObjectGuid().IsCreatureOrVehicle())
- GetMap()->GetObjectsStore().erase<Creature>(GetGUID(), (Creature*)NULL);
- Unit::RemoveFromWorld();
- @@ -271,6 +274,7 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
- SetDisplayId(display_id);
- SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
- + SetByteValue(UNIT_FIELD_BYTES_0, 3, uint8(cinfo->powerType));
- // Load creature equipment
- if (eventData && eventData->equipment_id)
- @@ -577,7 +581,7 @@ void Creature::Update(uint32 update_diff, uint32 diff)
- if (!isInCombat() || IsPolymorphed())
- RegenerateHealth();
- - RegenerateMana();
- + Regenerate(getPowerType());
- m_regenTimer = REGEN_TIME_FULL;
- break;
- @@ -609,31 +613,78 @@ void Creature::StopGroupLoot()
- m_groupLootId = 0;
- }
- -void Creature::RegenerateMana()
- +void Creature::Regenerate(Powers power)
- {
- - uint32 curValue = GetPower(POWER_MANA);
- - uint32 maxValue = GetMaxPower(POWER_MANA);
- + uint32 curValue = GetPower(power);
- + uint32 maxValue = GetMaxPower(power);
- if (curValue >= maxValue)
- return;
- - uint32 addvalue = 0;
- + float addvalue = 0.0f;
- - // Combat and any controlled creature
- - if (isInCombat() || !GetCharmerOrOwnerGuid().IsEmpty())
- + switch(power)
- {
- - if(!IsUnderLastManaUseEffect())
- + case POWER_MANA:
- {
- - float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
- - float Spirit = GetStat(STAT_SPIRIT);
- + // Combat and any controlled creature
- + if (isInCombat() || !GetCharmerOrOwnerGuid().IsEmpty())
- + {
- + if(!IsUnderLastManaUseEffect())
- + {
- + float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
- + float Spirit = GetStat(STAT_SPIRIT);
- - addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
- + addvalue = int32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
- + }
- + }
- + else
- + addvalue = maxValue / 3;
- + break;
- }
- + case POWER_ENERGY:
- + if (GetObjectGuid().IsVehicle())
- + {
- + if (VehicleEntry const* vehicleInfo = sVehicleStore.LookupEntry(GetCreatureInfo()->VehicleId))
- + {
- +
- + switch (vehicleInfo->m_powerType)
- + {
- + case ENERGY_TYPE_PYRITE:
- + case ENERGY_TYPE_BLOOD:
- + case ENERGY_TYPE_OOZE:
- + break;
- +
- + case ENERGY_TYPE_STEAM:
- + default:
- + addvalue = 10 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_ENERGY);
- + break;
- + }
- + }
- + }
- + else
- + addvalue = 20 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_ENERGY);
- + break;
- + case POWER_FOCUS:
- + addvalue = 24 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_FOCUS);
- + break;
- + default:
- + return;
- }
- - else
- - addvalue = maxValue / 3;
- - ModifyPower(POWER_MANA, addvalue);
- + // Apply modifiers (if any)
- +
- + AuraList const& ModPowerRegenAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN);
- + for(AuraList::const_iterator i = ModPowerRegenAuras.begin(); i != ModPowerRegenAuras.end(); ++i)
- + if ((*i)->GetModifier()->m_miscvalue == power)
- + addvalue += (*i)->GetModifier()->m_amount;
- +
- + AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
- + for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- + if ((*i)->GetModifier()->m_miscvalue == power)
- + addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
- +
- + ModifyPower(power, int32(addvalue));
- }
- void Creature::RegenerateHealth()
- @@ -709,12 +760,37 @@ bool Creature::AIM_Initialize()
- bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, Team team /*= TEAM_NONE*/, const CreatureData *data /*= NULL*/, GameEventCreatureData const* eventData /*= NULL*/)
- {
- + CreatureInfo const *cinfo = sObjectMgr.GetCreatureTemplate(Entry);
- +
- + if (!cinfo)
- + {
- + sLog.outErrorDb("Creature entry %u does not exist.", Entry);
- + return false;
- + }
- +
- MANGOS_ASSERT(map);
- +
- + HighGuid hi = cinfo->VehicleId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT;
- +
- + if (map->GetInstanceId() == 0)
- + {
- + // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid
- + // FIXME: until creature guids is global and for instances used dynamic generated guids
- + // in instance possible load creature duplicates with same DB guid but different in game guids
- + // This will be until implementing per-map creature guids
- + if (map->GetCreature(ObjectGuid(hi, Entry, guidlow)))
- + return false;
- + }
- + else
- + guidlow = sObjectMgr.GenerateLowGuid(hi);
- +
- + ObjectGuid guid(hi, Entry, guidlow);
- +
- SetMap(map);
- SetPhaseMask(phaseMask,false);
- //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0;
- - const bool bResult = CreateFromProto(guidlow, Entry, team, data, eventData);
- + const bool bResult = CreateFromProto(guid, Entry, team, data, eventData);
- if (bResult)
- {
- @@ -1123,19 +1199,32 @@ void Creature::SelectLevel(const CreatureInfo *cinfo, float percentHealth, float
- else
- SetHealthPercent(percentHealth);
- - // mana
- - uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
- - uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
- - uint32 mana = minmana + uint32(rellevel * (maxmana - minmana));
- + SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
- - SetCreateMana(mana);
- - SetMaxPower(POWER_MANA, mana); //MAX Mana
- - SetPower(POWER_MANA, mana);
- + Powers powerType = Powers(cinfo->powerType);
- + uint32 maxPower = 0;
- - // TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)
- + switch(powerType)
- + {
- + case POWER_MANA:
- + {
- + uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
- + uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
- + maxPower = minmana + uint32(rellevel * (maxmana - minmana));
- - SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
- - SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, float(mana));
- + SetCreateMana(maxPower);
- + break;
- + }
- + case POWER_ENERGY:
- + {
- + maxPower = uint32(GetCreatePowers(powerType) * cinfo->power_mod);
- + break;
- + }
- + }
- +
- + SetMaxPower(powerType, maxPower);
- + SetPower(powerType, maxPower);
- + SetModifierValue(UnitMods(UNIT_MOD_POWER_START + powerType), BASE_VALUE, float(maxPower));
- // damage
- float damagemod = _GetDamageMod(rank);
- @@ -1206,21 +1295,19 @@ float Creature::GetSpellDamageMod(int32 Rank)
- }
- }
- -bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, Team team, const CreatureData *data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/)
- +bool Creature::CreateFromProto(ObjectGuid guid, uint32 Entry, Team team, const CreatureData *data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/)
- {
- - CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
- - if(!cinfo)
- - {
- - sLog.outErrorDb("Creature entry %u does not exist.", Entry);
- - return false;
- - }
- m_originalEntry = Entry;
- - Object::_Create(guidlow, Entry, HIGHGUID_UNIT);
- + Object::_Create(guid);
- if (!UpdateEntry(Entry, team, data, eventData, false))
- return false;
- + // Checked at startup
- + if (GetCreatureInfo()->VehicleId)
- + CreateVehicleKit(GetCreatureInfo()->VehicleId);
- +
- return true;
- }
- @@ -1237,17 +1324,6 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map)
- GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(guidlow);
- m_DBTableGuid = guidlow;
- - if (map->GetInstanceId() == 0)
- - {
- - // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid
- - // FIXME: until creature guids is global and for instances used dynamic generated guids
- - // in instance possible load creature duplicates with same DB guid but different in game guids
- - // This will be until implementing per-map creature guids
- - if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guidlow)))
- - return false;
- - }
- - else
- - guidlow = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
- if (!Create(guidlow, map, data->phaseMask, data->id, TEAM_NONE, data, eventData))
- return false;
- diff --git a/src/game/Creature.h b/src/game/Creature.h
- index 563ccb5..da0c10d 100644
- --- a/src/game/Creature.h
- +++ b/src/game/Creature.h
- @@ -80,6 +80,7 @@ struct CreatureInfo
- uint32 maxlevel;
- uint32 minhealth;
- uint32 maxhealth;
- + uint32 powerType;
- uint32 minmana;
- uint32 maxmana;
- uint32 armor;
- @@ -121,13 +122,14 @@ struct CreatureInfo
- int32 resistance6;
- uint32 spells[CREATURE_MAX_SPELLS];
- uint32 PetSpellDataId;
- + uint32 VehicleId;
- uint32 mingold;
- uint32 maxgold;
- char const* AIName;
- uint32 MovementType;
- uint32 InhabitType;
- - float unk16;
- - float unk17;
- + float health_mod;
- + float power_mod;
- bool RacialLeader;
- uint32 questItems[6];
- uint32 movementId;
- @@ -384,7 +386,6 @@ enum CreatureSubtype
- CREATURE_SUBTYPE_GENERIC, // new Creature
- CREATURE_SUBTYPE_PET, // new Pet
- CREATURE_SUBTYPE_TOTEM, // new Totem
- - CREATURE_SUBTYPE_VEHICLE, // new Vehicle
- CREATURE_SUBTYPE_TEMPORARY_SUMMON, // new TemporarySummon
- };
- @@ -414,7 +415,6 @@ class MANGOS_DLL_SPEC Creature : public Unit
- CreatureSubtype GetSubtype() const { return m_subtype; }
- bool IsPet() const { return m_subtype == CREATURE_SUBTYPE_PET; }
- - bool IsVehicle() const { return m_subtype == CREATURE_SUBTYPE_VEHICLE; }
- bool IsTotem() const { return m_subtype == CREATURE_SUBTYPE_TOTEM; }
- bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; }
- @@ -644,7 +644,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
- void SendAreaSpiritHealerQueryOpcode(Player *pl);
- protected:
- - bool CreateFromProto(uint32 guidlow,uint32 Entry, Team team, const CreatureData *data = NULL, GameEventCreatureData const* eventData =NULL);
- + bool CreateFromProto(ObjectGuid guid,uint32 Entry, Team team, const CreatureData *data = NULL, GameEventCreatureData const* eventData =NULL);
- bool InitEntry(uint32 entry, const CreatureData* data = NULL, GameEventCreatureData const* eventData = NULL);
- void RelocationNotify();
- @@ -672,7 +672,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
- float m_respawnradius;
- CreatureSubtype m_subtype; // set in Creatures subclasses for fast it detect without dynamic_cast use
- - void RegenerateMana();
- + void Regenerate(Powers power);
- void RegenerateHealth();
- MovementGeneratorType m_defaultMovementType;
- Cell m_currentCell; // store current cell where creature listed
- diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h
- index c673454..ba0aac6 100644
- --- a/src/game/CreatureAI.h
- +++ b/src/game/CreatureAI.h
- @@ -130,6 +130,9 @@ class MANGOS_DLL_SPEC CreatureAI
- // Called at text emote receive from player
- virtual void ReceiveEmote(Player* /*pPlayer*/, uint32 /*text_emote*/) {}
- + // Called at vehicle enter
- + virtual void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool /*apply*/) {}
- +
- ///== Triggered Actions Requested ==================
- // Called when creature attack expected (if creature can and no have current victim)
- diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
- index b11a773..5756b13 100644
- --- a/src/game/CreatureEventAI.cpp
- +++ b/src/game/CreatureEventAI.cpp
- @@ -913,6 +913,7 @@ void CreatureEventAI::JustReachedHome()
- void CreatureEventAI::EnterEvadeMode()
- {
- + m_creature->ExitVehicle();
- m_creature->RemoveAllAuras();
- m_creature->DeleteThreatList();
- m_creature->CombatStop(true);
- diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h
- index c4c96df..3c5666e 100644
- --- a/src/game/DBCEnums.h
- +++ b/src/game/DBCEnums.h
- @@ -356,7 +356,8 @@ enum SummonPropGroup
- SUMMON_PROP_GROUP_FRIENDLY = 1,
- SUMMON_PROP_GROUP_PETS = 2,
- SUMMON_PROP_GROUP_CONTROLLABLE = 3,
- - SUMMON_PROP_GROUP_VEHICLE = 4
- + SUMMON_PROP_GROUP_VEHICLE = 4,
- + SUMMON_PROP_GROUP_UNCONTROLLABLE_VEHICLE = 5
- };
- // SummonProperties.dbc, col 3
- @@ -462,15 +463,20 @@ enum VehicleFlags
- VEHICLE_FLAG_ALLOW_PITCHING = 0x00000010, // Sets MOVEFLAG2_ALLOW_PITCHING
- VEHICLE_FLAG_FULLSPEEDPITCHING = 0x00000020, // Sets MOVEFLAG2_FULLSPEEDPITCHING
- VEHICLE_FLAG_CUSTOM_PITCH = 0x00000040, // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
- + VEHICLE_FLAG_ACCESSORY = 0x00000200, // Vehicle is accessory? Need additional check!
- VEHICLE_FLAG_ADJUST_AIM_ANGLE = 0x00000400, // Lua_IsVehicleAimAngleAdjustable
- VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800, // Lua_IsVehicleAimPowerAdjustable
- + VEHICLE_FLAG_DISABLE_SWITCH = 0x00400000, // Can't change seats, VEHICLE_ID = 335 chopper
- + VEHICLE_FLAG_NOT_DISMISS = 0x10000000, // Vehicle not dismissed after eject passenger?
- };
- enum VehicleSeatFlags
- {
- SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
- SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
- + SEAT_FLAG_UNCONTROLLED = 0x00002000, // Seat uncontrolled for passenger?
- SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle?
- + SEAT_FLAG_UNATTACKABLE = 0x00008000, // Passenger is not attackable?
- SEAT_FLAG_USABLE = 0x02000000, // Lua_CanExitVehicle
- SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
- SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
- diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
- index 9948032..11a24b9 100644
- --- a/src/game/DBCStructure.h
- +++ b/src/game/DBCStructure.h
- @@ -1796,7 +1796,7 @@ struct VehicleEntry
- uint32 m_uiLocomotionType; // 34
- float m_msslTrgtImpactTexRadius; // 35
- uint32 m_uiSeatIndicatorType; // 36
- - // 37, new in 3.1 - powerType
- + uint32 m_powerType; // 37, new in 3.1 - powerType
- // 38, new in 3.1
- // 39, new in 3.1
- };
- @@ -1850,6 +1850,7 @@ struct VehicleSeatEntry
- int32 m_uiSkin; // 44
- uint32 m_flagsB; // 45
- // 46-57 added in 3.1, floats mostly
- + bool IsUsable() const { return m_flags & SEAT_FLAG_USABLE; }
- };
- struct WMOAreaTableEntry
- diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h
- index 77a8de3..de98126 100644
- --- a/src/game/DBCfmt.h
- +++ b/src/game/DBCfmt.h
- @@ -108,7 +108,7 @@ const char TaxiPathEntryfmt[]="niii";
- const char TaxiPathNodeEntryfmt[]="diiifffiiii";
- const char TeamContributionPointsfmt[]="df";
- const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
- -const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
- +const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
- const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
- const char WMOAreaTableEntryfmt[]="niiixxxxxiixxxxxxxxxxxxxxxxx";
- const char WorldMapAreaEntryfmt[]="xinxffffixx";
- diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
- index 538603f..dd92d0d 100644
- --- a/src/game/DynamicObject.cpp
- +++ b/src/game/DynamicObject.cpp
- @@ -60,7 +60,7 @@ void DynamicObject::RemoveFromWorld()
- bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius )
- {
- - WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
- + WorldObject::_Create(ObjectGuid(HIGHGUID_DYNAMICOBJECT, guidlow), caster->GetPhaseMask());
- SetMap(caster->GetMap());
- Relocate(x, y, z, 0);
- diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
- index d381d97..1015b96 100644
- --- a/src/game/GameObject.cpp
- +++ b/src/game/GameObject.cpp
- @@ -115,7 +115,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
- return false;
- }
- - Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
- + Object::_Create(ObjectGuid(HIGHGUID_GAMEOBJECT, goinfo->id, guidlow));
- m_goInfo = goinfo;
- @@ -1415,6 +1415,8 @@ void GameObject::Use(Unit* user)
- BattleGround *bg = player->GetBattleGround();
- if (!bg)
- return;
- + if (player->GetVehicle())
- + return;
- // BG flag click
- // AB:
- // 15001
- @@ -1451,6 +1453,8 @@ void GameObject::Use(Unit* user)
- BattleGround *bg = player->GetBattleGround();
- if (!bg)
- return;
- + if (player->GetVehicle())
- + return;
- // BG flag dropped
- // WS:
- // 179785 - Silverwing Flag
- diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h
- index 2eeca26..d200a0d 100644
- --- a/src/game/GridDefines.h
- +++ b/src/game/GridDefines.h
- @@ -26,7 +26,6 @@
- // Forward class definitions
- class Corpse;
- class Creature;
- -class Vehicle;
- class DynamicObject;
- class GameObject;
- class Pet;
- @@ -60,7 +59,7 @@ class Camera;
- // Cameras in world list just because linked with Player objects
- typedef TYPELIST_4(Player, Creature/*pets*/, Corpse/*resurrectable*/, Camera) AllWorldObjectTypes;
- typedef TYPELIST_4(GameObject, Creature/*except pets*/, DynamicObject, Corpse/*Bones*/) AllGridObjectTypes;
- -typedef TYPELIST_5(Creature, Pet, Vehicle, GameObject, DynamicObject) AllMapStoredObjectTypes;
- +typedef TYPELIST_4(Creature, Pet, GameObject, DynamicObject) AllMapStoredObjectTypes;
- typedef GridRefManager<Camera> CameraMapType;
- typedef GridRefManager<Corpse> CorpseMapType;
- diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
- index 15a5db9..2add0ab 100644
- --- a/src/game/GroupHandler.cpp
- +++ b/src/game/GroupHandler.cpp
- @@ -797,6 +797,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
- else
- *data << uint64(0);
- }
- +
- + if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
- + *data << uint32(player->m_movementInfo.GetTransportDBCSeat());
- }
- /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
- diff --git a/src/game/Item.cpp b/src/game/Item.cpp
- index b62eda2..2c05c2c 100644
- --- a/src/game/Item.cpp
- +++ b/src/game/Item.cpp
- @@ -247,7 +247,7 @@ Item::Item( )
- bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
- {
- - Object::_Create(guidlow, 0, HIGHGUID_ITEM);
- + Object::_Create(ObjectGuid(HIGHGUID_ITEM, guidlow));
- SetEntry(itemid);
- SetObjectScale(DEFAULT_OBJECT_SCALE);
- @@ -381,7 +381,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
- {
- // create item before any checks for store correct guid
- // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
- - Object::_Create(guidLow, 0, HIGHGUID_ITEM);
- + Object::_Create(ObjectGuid(HIGHGUID_ITEM, guidLow));
- if (!LoadValues(fields[0].GetString()))
- {
- diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
- index e9d316b..546102a 100644
- --- a/src/game/Level2.cpp
- +++ b/src/game/Level2.cpp
- @@ -1794,7 +1794,7 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
- else
- unit = getSelectedCreature();
- - if (!unit || unit->IsPet() || unit->IsTotem() || unit->IsVehicle())
- + if (!unit || unit->IsPet() || unit->IsTotem())
- {
- SendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
- index 888330d..445bb37 100644
- --- a/src/game/Level3.cpp
- +++ b/src/game/Level3.cpp
- @@ -4091,6 +4091,10 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/)
- std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(),true);
- PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), faction, npcflags, Entry, displayid, nativeid);
- +
- + if (cInfo->VehicleId)
- + PSendSysMessage("VehicleId: %u", cInfo->VehicleId);
- +
- PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
- PSendSysMessage(LANG_NPCINFO_HEALTH,target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
- PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction());
- diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp
- index 0d480d5..f9349c1 100644
- --- a/src/game/LootHandler.cpp
- +++ b/src/game/LootHandler.cpp
- @@ -83,6 +83,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
- break;
- }
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- {
- Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
- @@ -216,6 +217,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
- break;
- }
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- {
- Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
- @@ -460,6 +462,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
- return; // item can be looted only single player
- }
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- {
- Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
- @@ -520,7 +523,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
- Loot *pLoot = NULL;
- - if(lootguid.IsCreature())
- + if(lootguid.IsCreatureOrVehicle())
- {
- Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
- if(!pCreature)
- diff --git a/src/game/Map.cpp b/src/game/Map.cpp
- index b4abe04..e7af4f5 100644
- --- a/src/game/Map.cpp
- +++ b/src/game/Map.cpp
- @@ -134,7 +134,7 @@ template<>
- void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
- {
- // add to world object registry in grid
- - if(obj->IsPet() || obj->IsVehicle())
- + if(obj->IsPet())
- {
- (*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj);
- obj->SetCurrentCell(cell);
- @@ -178,7 +178,7 @@ template<>
- void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell)
- {
- // remove from world object registry in grid
- - if(obj->IsPet() || obj->IsVehicle())
- + if(obj->IsPet())
- {
- (*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj);
- }
- @@ -1768,14 +1768,12 @@ void Map::ScriptsProcess()
- break;
- }
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- source = GetCreature(step.sourceGuid);
- break;
- case HIGHGUID_PET:
- source = GetPet(step.sourceGuid);
- break;
- - case HIGHGUID_VEHICLE:
- - source = GetVehicle(step.sourceGuid);
- - break;
- case HIGHGUID_PLAYER:
- source = HashMapHolder<Player>::Find(step.sourceGuid);
- break;
- @@ -1801,14 +1799,12 @@ void Map::ScriptsProcess()
- switch(step.targetGuid.GetHigh())
- {
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- target = GetCreature(step.targetGuid);
- break;
- case HIGHGUID_PET:
- target = GetPet(step.targetGuid);
- break;
- - case HIGHGUID_VEHICLE:
- - target = GetVehicle(step.targetGuid);
- - break;
- case HIGHGUID_PLAYER:
- target = HashMapHolder<Player>::Find(step.targetGuid);
- break;
- @@ -2876,16 +2872,6 @@ Creature* Map::GetCreature(ObjectGuid guid)
- }
- /**
- - * Function return vehicle that in world at CURRENT map
- - *
- - * @param guid must be vehicle guid (HIGHGUID_VEHICLE)
- - */
- -Vehicle* Map::GetVehicle(ObjectGuid guid)
- -{
- - return m_objectsStore.find<Vehicle>(guid.GetRawValue(), (Vehicle*)NULL);
- -}
- -
- -/**
- * Function return pet that in world at CURRENT map
- *
- * @param guid must be pet guid (HIGHGUID_PET)
- @@ -2917,9 +2903,9 @@ Creature* Map::GetAnyTypeCreature(ObjectGuid guid)
- {
- switch(guid.GetHigh())
- {
- - case HIGHGUID_UNIT: return GetCreature(guid);
- + case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE: return GetCreature(guid);
- case HIGHGUID_PET: return GetPet(guid);
- - case HIGHGUID_VEHICLE: return GetVehicle(guid);
- default: break;
- }
- @@ -2971,9 +2957,9 @@ WorldObject* Map::GetWorldObject(ObjectGuid guid)
- {
- case HIGHGUID_PLAYER: return GetPlayer(guid);
- case HIGHGUID_GAMEOBJECT: return GetGameObject(guid);
- - case HIGHGUID_UNIT: return GetCreature(guid);
- + case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE: return GetCreature(guid);
- case HIGHGUID_PET: return GetPet(guid);
- - case HIGHGUID_VEHICLE: return GetVehicle(guid);
- case HIGHGUID_DYNAMICOBJECT:return GetDynamicObject(guid);
- case HIGHGUID_CORPSE:
- {
- @@ -3018,8 +3004,6 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
- return m_DynObjectGuids.Generate();
- case HIGHGUID_PET:
- return m_PetGuids.Generate();
- - case HIGHGUID_VEHICLE:
- - return m_VehicleGuids.Generate();
- default:
- MANGOS_ASSERT(0);
- }
- diff --git a/src/game/Map.h b/src/game/Map.h
- index acad2cd..565a67d 100644
- --- a/src/game/Map.h
- +++ b/src/game/Map.h
- @@ -217,7 +217,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
- Player* GetPlayer(ObjectGuid guid);
- Creature* GetCreature(ObjectGuid guid);
- - Vehicle* GetVehicle(ObjectGuid guid);
- Pet* GetPet(ObjectGuid guid);
- Creature* GetAnyTypeCreature(ObjectGuid guid); // normal creature or pet or vehicle
- GameObject* GetGameObject(ObjectGuid guid);
- @@ -323,7 +322,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
- // Map local low guid counters
- ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT> m_DynObjectGuids;
- ObjectGuidGenerator<HIGHGUID_PET> m_PetGuids;
- - ObjectGuidGenerator<HIGHGUID_VEHICLE> m_VehicleGuids;
- // Type specific code for add/remove to/from grid
- template<class T>
- diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
- index 412382e..bffdfae 100644
- --- a/src/game/MovementHandler.cpp
- +++ b/src/game/MovementHandler.cpp
- @@ -48,6 +48,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
- WorldLocation old_loc;
- GetPlayer()->GetPosition(old_loc);
- + if (_player->GetVehicleKit())
- + _player->GetVehicleKit()->RemoveAllPassengers();
- +
- // get the teleport destination
- WorldLocation &loc = GetPlayer()->GetTeleportDest();
- @@ -420,7 +423,7 @@ void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
- void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
- {
- - DEBUG_LOG("WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
- + DEBUG_LOG("WORLD: Received CMSG_DISMISS_CONTROLLED_VEHICLE");
- recv_data.hexlike();
- ObjectGuid guid;
- @@ -429,18 +432,163 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
- recv_data >> guid.ReadAsPacked();
- recv_data >> mi;
- - ObjectGuid vehicleGUID = _player->GetCharmGuid();
- + if(!GetPlayer()->GetVehicle())
- + return;
- +
- + bool dismiss = true;
- +
- + if (GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & (VEHICLE_FLAG_NOT_DISMISS | VEHICLE_FLAG_ACCESSORY))
- + dismiss = false;
- +
- + GetPlayer()->m_movementInfo = mi;
- + GetPlayer()->ExitVehicle();
- +
- + if (dismiss)
- + if (Creature* vehicle = GetPlayer()->GetMap()->GetAnyTypeCreature(guid))
- + vehicle->ForcedDespawn();
- +}
- +
- +void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_EXIT");
- +
- + GetPlayer()->ExitVehicle();
- +}
- +
- +void WorldSession::HandleRequestVehiclePrevSeat(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_PREV_SEAT");
- +
- + GetPlayer()->ChangeSeat(-1, false);
- +}
- +
- +void WorldSession::HandleRequestVehicleNextSeat(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_NEXT_SEAT");
- +
- + GetPlayer()->ChangeSeat(-1, true);
- +}
- +
- +void WorldSession::HandleRequestVehicleSwitchSeat(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_SWITCH_SEAT");
- + recv_data.hexlike();
- +
- + ObjectGuid guid;
- + recv_data >> guid.ReadAsPacked();
- +
- + int8 seatId;
- + recv_data >> seatId;
- +
- + VehicleKit* pVehicle = GetPlayer()->GetVehicle();
- - if (vehicleGUID.IsEmpty()) // something wrong here...
- + if (!pVehicle)
- return;
- - _player->m_movementInfo = mi;
- + if (GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
- + GetPlayer()->ExitVehicle();
- +
- + if (pVehicle->GetBase()->GetObjectGuid() == guid)
- + GetPlayer()->ChangeSeat(seatId);
- + else if (Unit *Vehicle2 = GetPlayer()->GetMap()->GetUnit(guid))
- + {
- + if (VehicleKit *pVehicle2 = Vehicle2->GetVehicleKit())
- + if (pVehicle2->HasEmptySeat(seatId))
- + {
- + GetPlayer()->ExitVehicle();
- + GetPlayer()->EnterVehicle(pVehicle2, seatId);
- + }
- + }
- +}
- +
- +void WorldSession::HandleEnterPlayerVehicle(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Received CMSG_PLAYER_VEHICLE_ENTER");
- + recv_data.hexlike();
- +
- + ObjectGuid guid;
- + recv_data >> guid;
- +
- + Player* player = sObjectMgr.GetPlayer(guid);
- +
- + if (!player)
- + return;
- +
- + if (!GetPlayer()->IsInSameRaidWith(player))
- + return;
- +
- + if (!GetPlayer()->IsWithinDistInMap(player, INTERACTION_DISTANCE))
- + return;
- +
- + if (player->GetTransport())
- + return;
- +
- + if (VehicleKit* pVehicle = player->GetVehicleKit())
- + GetPlayer()->EnterVehicle(pVehicle);
- +}
- +
- +void WorldSession::HandleEjectPasenger(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Received CMSG_EJECT_PASSENGER");
- + recv_data.hexlike();
- +
- + ObjectGuid guid;
- + recv_data >> guid;
- +
- + Unit* passenger = ObjectAccessor::GetUnit(*GetPlayer(), guid);
- +
- + if (!passenger)
- + return;
- +
- + if (!passenger->GetVehicle() || passenger->GetVehicle() != GetPlayer()->GetVehicleKit())
- + return;
- +
- + passenger->ExitVehicle();
- +
- + // eject and remove creatures of player mounts
- + if (passenger->GetTypeId() == TYPEID_UNIT)
- + passenger->AddObjectToRemoveList();
- +}
- +
- +void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
- +{
- + sLog.outDebug("WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE");
- + recv_data.hexlike();
- +
- + ObjectGuid guid, guid2;
- + recv_data >> guid.ReadAsPacked();
- +
- + MovementInfo mi;
- + recv_data >> mi;
- + GetPlayer()->m_movementInfo = mi;
- +
- + recv_data >> guid2.ReadAsPacked(); //guid of vehicle or of vehicle in target seat
- +
- + int8 seatId;
- + recv_data >> seatId;
- +
- + VehicleKit* pVehicle = GetPlayer()->GetVehicle();
- +
- + if (!pVehicle)
- + return;
- +
- + if (GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
- + GetPlayer()->ExitVehicle();
- +
- + if(guid.GetRawValue() == guid2.GetRawValue())
- + GetPlayer()->ChangeSeat(seatId, false);
- - // using charm guid, because we don't have vehicle guid...
- - if(Vehicle *vehicle = _player->GetMap()->GetVehicle(vehicleGUID))
- + else if (guid2.IsVehicle())
- {
- - // Aura::HandleAuraControlVehicle will call Player::ExitVehicle
- - vehicle->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
- + if (Creature* vehicle = GetPlayer()->GetMap()->GetAnyTypeCreature(guid2))
- + {
- + if (VehicleKit* pVehicle2 = vehicle->GetVehicleKit())
- + if(pVehicle2->HasEmptySeat(seatId))
- + {
- + GetPlayer()->ExitVehicle();
- + GetPlayer()->EnterVehicle(pVehicle2, seatId);
- + }
- + }
- }
- }
- @@ -565,24 +713,28 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
- {
- if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))
- {
- - if (!plMover->m_transport)
- + if (!plMover->GetTransport())
- {
- // elevators also cause the client to send MOVEFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
- for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
- {
- if ((*iter)->GetObjectGuid() == movementInfo.GetTransportGuid())
- {
- - plMover->m_transport = (*iter);
- + plMover->SetTransport(*iter);
- (*iter)->AddPassenger(plMover);
- +
- + if (plMover->GetVehicleKit())
- + plMover->GetVehicleKit()->RemoveAllPassengers();
- +
- break;
- }
- }
- }
- }
- - else if (plMover->m_transport) // if we were on a transport, leave
- + else if (plMover->GetTransport()) // if we were on a transport, leave
- {
- - plMover->m_transport->RemovePassenger(plMover);
- - plMover->m_transport = NULL;
- + plMover->GetTransport()->RemovePassenger(plMover);
- + plMover->SetTransport(NULL);
- movementInfo.ClearTransportData();
- }
- @@ -629,6 +781,9 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
- else // creature charmed
- {
- if (mover->IsInWorld())
- - mover->GetMap()->CreatureRelocation((Creature*)mover, movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
- + {
- + mover->m_movementInfo = movementInfo;
- + mover->SetPosition(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
- + }
- }
- }
- diff --git a/src/game/Object.cpp b/src/game/Object.cpp
- index 2dfa981..e4c86d9 100644
- --- a/src/game/Object.cpp
- +++ b/src/game/Object.cpp
- @@ -92,12 +92,11 @@ void Object::_InitValues()
- m_objectUpdated = false;
- }
- -void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
- +void Object::_Create(ObjectGuid guid)
- {
- if(!m_uint32Values)
- _InitValues();
- - ObjectGuid guid = ObjectGuid(guidhigh, entry, guidlow);
- SetGuidValue(OBJECT_FIELD_GUID, guid);
- SetUInt32Value(OBJECT_FIELD_TYPE, m_objectType);
- m_PackGUID.Set(guid);
- @@ -231,7 +230,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
- uint16 moveFlags2 = (isType(TYPEMASK_UNIT) ? ((Unit*)this)->m_movementInfo.GetMovementFlags2() : MOVEFLAG2_NONE);
- if(GetTypeId() == TYPEID_UNIT)
- - if(((Creature*)this)->IsVehicle())
- + if(((Creature*)this)->GetVehicleKit())
- moveFlags2 |= MOVEFLAG2_ALLOW_PITCHING; // always allow pitch
- *data << uint16(updateFlags); // update flags
- @@ -276,11 +275,6 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
- {
- Player *player = ((Player*)unit);
- - if(player->GetTransport())
- - player->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
- - else
- - player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
- -
- // remove unknown, unused etc flags for now
- player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_SPLINE_ENABLED);
- @@ -294,6 +288,11 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
- break;
- }
- + if (unit->GetTransport() || unit->GetVehicle())
- + unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
- + else
- + unit->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
- +
- // Update movement info time
- unit->m_movementInfo.UpdateTime(WorldTimer::getMSTime());
- // Write movement info
- @@ -506,9 +505,9 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
- }
- // 0x80
- - if(updateFlags & UPDATEFLAG_VEHICLE) // unused for now
- + if(updateFlags & UPDATEFLAG_VEHICLE)
- {
- - *data << uint32(((Vehicle*)this)->GetVehicleId()); // vehicle id
- + *data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleId()); // vehicle id
- *data << float(((WorldObject*)this)->GetOrientation());
- }
- @@ -1047,9 +1046,9 @@ void WorldObject::CleanupsBeforeDelete()
- RemoveFromWorld();
- }
- -void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask )
- +void WorldObject::_Create(ObjectGuid guid, uint32 phaseMask)
- {
- - Object::_Create(guidlow, 0, guidhigh);
- + Object::_Create(guid);
- m_phaseMask = phaseMask;
- }
- diff --git a/src/game/Object.h b/src/game/Object.h
- index 9aa64e5..35b9a03 100644
- --- a/src/game/Object.h
- +++ b/src/game/Object.h
- @@ -355,7 +355,7 @@ class MANGOS_DLL_SPEC Object
- Object ( );
- void _InitValues();
- - void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
- + void _Create(ObjectGuid guid);
- virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
- @@ -427,7 +427,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
- virtual void Update ( uint32 /*update_diff*/, uint32 /*time_diff*/ ) {}
- - void _Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
- + void _Create(ObjectGuid guid, uint32 phaseMask);
- void Relocate(float x, float y, float z, float orientation);
- void Relocate(float x, float y, float z);
- diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp
- index a9de5d0..d4f56ec 100644
- --- a/src/game/ObjectGridLoader.cpp
- +++ b/src/game/ObjectGridLoader.cpp
- @@ -57,7 +57,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
- Creature * c = iter->getSource();
- - MANGOS_ASSERT((!c->IsPet() || !c->IsVehicle()) && "ObjectGridRespawnMover don't must be called for pets");
- + MANGOS_ASSERT(!c->IsPet() && "ObjectGridRespawnMover don't must be called for pets");
- Cell const& cur_cell = c->GetCurrentCell();
- diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
- index 56174f1..679fbfc 100644
- --- a/src/game/ObjectMgr.cpp
- +++ b/src/game/ObjectMgr.cpp
- @@ -654,6 +654,12 @@ void ObjectMgr::LoadCreatureTemplates()
- if (!displayScaleEntry)
- sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid in modelid_1/modelid_2/modelid_3/modelid_4", cInfo->Entry);
- + if (cInfo->powerType >= MAX_POWERS)
- + {
- + sLog.outErrorDb("Creature (Entry: %u) has invalid power type (%u)", cInfo->Entry, cInfo->powerType);
- + const_cast<CreatureInfo*>(cInfo)->powerType = POWER_MANA;
- + }
- +
- // use below code for 0-checks for unit_class
- if (!cInfo->unit_class)
- ERROR_DB_STRICT_LOG("Creature (Entry: %u) not has proper unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class);
- @@ -716,6 +722,15 @@ void ObjectMgr::LoadCreatureTemplates()
- }
- }
- + if (cInfo->VehicleId)
- + {
- + if (!sVehicleStore.LookupEntry(cInfo->VehicleId))
- + {
- + sLog.outErrorDb("Creature (Entry: %u) has non-existing VehicleId (%u)", cInfo->Entry, cInfo->VehicleId);
- + const_cast<CreatureInfo*>(cInfo)->VehicleId = 0;
- + }
- + }
- +
- if(cInfo->MovementType >= MAX_DB_MOTION_TYPE)
- {
- sLog.outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignore and set to IDLE.",cInfo->Entry,cInfo->MovementType);
- @@ -1440,6 +1455,60 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
- }
- }
- +void ObjectMgr::LoadVehicleAccessories()
- +{
- + m_VehicleAccessoryMap.clear(); // needed for reload case
- +
- + uint32 count = 0;
- +
- + QueryResult* result = WorldDatabase.Query("SELECT `entry`,`accessory_entry`,`seat_id`,`minion` FROM `vehicle_accessory`");
- +
- + if (!result)
- + {
- + barGoLink bar(1);
- +
- + bar.step();
- +
- + sLog.outString();
- + sLog.outErrorDb(">> Loaded 0 vehicle accessories. DB table `vehicle_accessory` is empty.");
- + return;
- + }
- +
- + barGoLink bar((int)result->GetRowCount());
- +
- + do
- + {
- + Field *fields = result->Fetch();
- + bar.step();
- +
- + uint32 uiEntry = fields[0].GetUInt32();
- + uint32 uiAccessory = fields[1].GetUInt32();
- + int8 uiSeat = int8(fields[2].GetInt16());
- + bool bMinion = fields[3].GetBool();
- +
- + if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiEntry))
- + {
- + sLog.outErrorDb("Table `vehicle_accessory`: creature template entry %u does not exist.", uiEntry);
- + continue;
- + }
- +
- + if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiAccessory))
- + {
- + sLog.outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
- + continue;
- + }
- +
- + m_VehicleAccessoryMap[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion));
- +
- + ++count;
- + } while (result->NextRow());
- +
- + delete result;
- +
- + sLog.outString();
- + sLog.outString(">> Loaded %u Vehicle Accessories", count);
- +}
- +
- void ObjectMgr::LoadGameobjects()
- {
- uint32 count = 0;
- @@ -5776,6 +5845,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
- case HIGHGUID_ITEM:
- return m_ItemGuids.Generate();
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- return m_CreatureGuids.Generate();
- case HIGHGUID_PLAYER:
- return m_CharGuids.Generate();
- diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
- index 0703e97..5b968bf 100644
- --- a/src/game/ObjectMgr.h
- +++ b/src/game/ObjectMgr.h
- @@ -36,6 +36,7 @@
- #include "ObjectGuid.h"
- #include "Policies/Singleton.h"
- #include "SQLStorages.h"
- +#include "Vehicle.h"
- #include <string>
- #include <map>
- @@ -627,6 +628,14 @@ class ObjectMgr
- return NULL;
- }
- + VehicleAccessoryList const* GetVehicleAccessoryList(uint32 uiEntry) const
- + {
- + VehicleAccessoryMap::const_iterator itr = m_VehicleAccessoryMap.find(uiEntry);
- + if (itr != m_VehicleAccessoryMap.end())
- + return &itr->second;
- + return NULL;
- + }
- +
- void LoadGuilds();
- void LoadArenaTeams();
- void LoadGroups();
- @@ -708,6 +717,8 @@ class ObjectMgr
- void LoadTrainerTemplates();
- void LoadTrainers() { LoadTrainers("npc_trainer", false); }
- + void LoadVehicleAccessories();
- +
- std::string GeneratePetName(uint32 entry);
- uint32 GetBaseXP(uint32 level) const;
- uint32 GetXPForLevel(uint32 level) const;
- @@ -1098,6 +1109,8 @@ class ObjectMgr
- ItemConvertMap m_ItemConvert;
- ItemRequiredTargetMap m_ItemRequiredTarget;
- + VehicleAccessoryMap m_VehicleAccessoryMap;
- +
- typedef std::vector<LocaleConstant> LocalForIndex;
- LocalForIndex m_LocalForIndex;
- diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
- index e81f6a9..08f3fda 100644
- --- a/src/game/Opcodes.cpp
- +++ b/src/game/Opcodes.cpp
- @@ -1168,10 +1168,10 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x473*/ { "CMSG_CHAR_CUSTOMIZE", STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleCharCustomizeOpcode },
- /*0x474*/ { "SMSG_CHAR_CUSTOMIZE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x475*/ { "SMSG_PET_RENAMEABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- - /*0x476*/ { "CMSG_REQUEST_VEHICLE_EXIT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- - /*0x477*/ { "CMSG_REQUEST_VEHICLE_PREV_SEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- - /*0x478*/ { "CMSG_REQUEST_VEHICLE_NEXT_SEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- - /*0x479*/ { "CMSG_REQUEST_VEHICLE_SWITCH_SEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- + /*0x476*/ { "CMSG_REQUEST_VEHICLE_EXIT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleExit },
- + /*0x477*/ { "CMSG_REQUEST_VEHICLE_PREV_SEAT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehiclePrevSeat },
- + /*0x478*/ { "CMSG_REQUEST_VEHICLE_NEXT_SEAT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleNextSeat },
- + /*0x479*/ { "CMSG_REQUEST_VEHICLE_SWITCH_SEAT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleSwitchSeat },
- /*0x47A*/ { "CMSG_PET_LEARN_TALENT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandlePetLearnTalent },
- /*0x47B*/ { "CMSG_PET_UNLEARN_TALENTS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- /*0x47C*/ { "SMSG_SET_PHASE_SHIFT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- @@ -1205,7 +1205,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x498*/ { "SMSG_SERVER_FIRST_ACHIEVEMENT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x499*/ { "SMSG_PET_LEARNED_SPELL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x49A*/ { "SMSG_PET_REMOVED_SPELL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- - /*0x49B*/ { "CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- + /*0x49B*/ { "CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChangeSeatsOnControlledVehicle},
- /*0x49C*/ { "CMSG_HEARTH_AND_RESURRECT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleHearthandResurrect },
- /*0x49D*/ { "SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x49E*/ { "SMSG_CRITERIA_DELETED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- @@ -1218,8 +1218,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x4A5*/ { "UMSG_UNKNOWN_1189", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- /*0x4A6*/ { "SMSG_BATTLEGROUND_INFO_THROTTLED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4A7*/ { "SMSG_PLAYER_VEHICLE_DATA", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- - /*0x4A8*/ { "CMSG_PLAYER_VEHICLE_ENTER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- - /*0x4A9*/ { "CMSG_EJECT_PASSENGER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- + /*0x4A8*/ { "CMSG_PLAYER_VEHICLE_ENTER", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleEnterPlayerVehicle },
- + /*0x4A9*/ { "CMSG_EJECT_PASSENGER", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleEjectPasenger },
- /*0x4AA*/ { "SMSG_PET_GUIDS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4AB*/ { "SMSG_CLIENTCACHE_VERSION", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4AC*/ { "UMSG_UNKNOWN_1196", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
- index a69a73e..e82e6a4 100644
- --- a/src/game/Pet.cpp
- +++ b/src/game/Pet.cpp
- @@ -572,43 +572,6 @@ void Pet::Update(uint32 update_diff, uint32 diff)
- Creature::Update(update_diff, diff);
- }
- -void Pet::Regenerate(Powers power)
- -{
- - uint32 curValue = GetPower(power);
- - uint32 maxValue = GetMaxPower(power);
- -
- - if (curValue >= maxValue)
- - return;
- -
- - float addvalue = 0.0f;
- -
- - switch (power)
- - {
- - case POWER_FOCUS:
- - {
- - // For hunter pets.
- - addvalue = 24 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_FOCUS);
- - break;
- - }
- - case POWER_ENERGY:
- - {
- - // For deathknight's ghoul.
- - addvalue = 20;
- - break;
- - }
- - default:
- - return;
- - }
- -
- - // Apply modifiers (if any).
- - AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
- - for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- - if ((*i)->GetModifier()->m_miscvalue == int32(power))
- - addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
- -
- - ModifyPower(power, (int32)addvalue);
- -}
- -
- void Pet::LooseHappiness()
- {
- uint32 curValue = GetPower(POWER_HAPPINESS);
- @@ -1929,7 +1892,7 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint3
- SetMap(map);
- SetPhaseMask(phaseMask,false);
- - Object::_Create(guidlow, pet_number, HIGHGUID_PET);
- + Object::_Create(ObjectGuid(HIGHGUID_PET, pet_number, guidlow));
- m_DBTableGuid = guidlow;
- m_originalEntry = Entry;
- diff --git a/src/game/Pet.h b/src/game/Pet.h
- index 184626c..c5f681e 100644
- --- a/src/game/Pet.h
- +++ b/src/game/Pet.h
- @@ -168,7 +168,6 @@ class Pet : public Creature
- return m_autospells[pos];
- }
- - void Regenerate(Powers power);
- void LooseHappiness();
- HappinessState GetHappinessState();
- void GivePetXP(uint32 xp);
- diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp
- index 0c4a996..d8af4da 100644
- --- a/src/game/PetAI.cpp
- +++ b/src/game/PetAI.cpp
- @@ -192,7 +192,7 @@ void PetAI::UpdateAI(const uint32 diff)
- }
- // Autocast (casted only in combat or persistent spells in any state)
- - if (!m_creature->IsNonMeleeSpellCasted(false))
- + if (!m_creature->IsNonMeleeSpellCasted(false) && !m_creature->GetObjectGuid().IsVehicle())
- {
- typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
- TargetSpellList targetSpellStore;
- diff --git a/src/game/Player.cpp b/src/game/Player.cpp
- index 545f359..4a31cb1 100644
- --- a/src/game/Player.cpp
- +++ b/src/game/Player.cpp
- @@ -406,8 +406,6 @@ UpdateMask Player::updateVisualBits;
- Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m_achievementMgr(this), m_reputationMgr(this)
- {
- - m_transport = 0;
- -
- m_speakTime = 0;
- m_speakCount = 0;
- @@ -613,9 +611,7 @@ Player::~Player ()
- delete PlayerTalkClass;
- if (m_transport)
- - {
- m_transport->RemovePassenger(this);
- - }
- for(size_t x = 0; x < ItemSetEff.size(); x++)
- if(ItemSetEff[x])
- @@ -644,7 +640,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
- {
- //FIXME: outfitId not used in player creating
- - Object::_Create(guidlow, 0, HIGHGUID_PLAYER);
- + Object::_Create(ObjectGuid(HIGHGUID_PLAYER, guidlow));
- m_name = name;
- @@ -1759,10 +1755,15 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
- if (!(options & TELE_TO_NOT_LEAVE_TRANSPORT) && m_transport)
- {
- m_transport->RemovePassenger(this);
- - m_transport = NULL;
- + SetTransport(NULL);
- m_movementInfo.ClearTransportData();
- }
- + if (GetVehicleKit())
- + GetVehicleKit()->RemoveAllPassengers();
- +
- + ExitVehicle();
- +
- // The player was ported to another map and looses the duel immediately.
- // We have to perform this check before the teleport, otherwise the
- // ObjectAccessor won't find the flag.
- @@ -1776,7 +1777,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
- // reset movement flags at teleport, because player will continue move with these flags after teleport
- m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
- - if ((GetMapId() == mapid) && (!m_transport))
- + if (GetMapId() == mapid && !m_transport)
- {
- //lets reset far teleport flag if it wasn't reset during chained teleports
- SetSemaphoreTeleportFar(false);
- @@ -2238,7 +2239,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
- return NULL;
- // not in interactive state
- - if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL))
- + if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && !hasUnitState(UNIT_STAT_ON_VEHICLE))
- return NULL;
- // exist (we need look pets also for some interaction (quest/etc)
- @@ -2292,7 +2293,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameo
- return NULL;
- // not in interactive state
- - if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL))
- + if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && !hasUnitState(UNIT_STAT_ON_VEHICLE))
- return NULL;
- if (GameObject *go = GetMap()->GetGameObject(guid))
- @@ -2517,6 +2518,9 @@ void Player::GiveXP(uint32 xp, Unit* victim)
- if(!isAlive())
- return;
- + if(hasUnitState(UNIT_STAT_ON_VEHICLE))
- + return;
- +
- uint32 level = getLevel();
- // XP to money conversion processed in Player::RewardQuest
- @@ -4008,6 +4012,7 @@ void Player::InitVisibleBits()
- updateVisualBits.SetBit(PLAYER_BYTES_3);
- updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
- updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
- + updateVisualBits.SetBit(UNIT_NPC_FLAGS);
- // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
- for(uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
- @@ -6070,49 +6075,18 @@ ActionButton const* Player::GetActionButton(uint8 button)
- bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport)
- {
- - // prevent crash when a bad coord is sent by the client
- - if(!MaNGOS::IsValidMapCoord(x,y,z,orientation))
- - {
- - DEBUG_LOG("Player::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for player %d!",x,y,z,orientation,teleport,GetGUIDLow());
- + if (!Unit::SetPosition(x, y, z, orientation, teleport))
- return false;
- - }
- -
- - Map *m = GetMap();
- -
- - const float old_x = GetPositionX();
- - const float old_y = GetPositionY();
- - const float old_z = GetPositionZ();
- - const float old_r = GetOrientation();
- -
- - if( teleport || old_x != x || old_y != y || old_z != z || old_r != orientation )
- - {
- - if (teleport || old_x != x || old_y != y || old_z != z)
- - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING);
- - else
- - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
- - RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
- -
- - // move and update visible state if need
- - m->PlayerRelocation(this, x, y, z, orientation);
- -
- - // reread after Map::Relocation
- - m = GetMap();
- - x = GetPositionX();
- - y = GetPositionY();
- - z = GetPositionZ();
- + // group update
- + if (GetGroup())
- + SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
- - // group update
- - if (GetGroup() && (old_x != x || old_y != y))
- - SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
- -
- - if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
- - GetSession()->SendCancelTrade(); // will close both side trade windows
- - }
- + if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
- + GetSession()->SendCancelTrade(); // will close both side trade windows
- // code block for underwater state update
- - UpdateUnderwaterState(m, x, y, z);
- -
- + UpdateUnderwaterState(GetMap(), x, y, z);
- CheckAreaExploreAndOutdoor();
- return true;
- @@ -8018,6 +7992,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
- break;
- }
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- {
- Creature *creature = GetMap()->GetCreature(guid);
- @@ -14629,7 +14604,7 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid )
- void Player::CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id, bool original_caster )
- {
- - bool isCreature = guid.IsCreature();
- + bool isCreature = guid.IsCreatureOrVehicle();
- uint32 addCastCount = 1;
- for(int i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
- @@ -15191,7 +15166,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
- return false;
- }
- - Object::_Create(guid.GetCounter(), 0, HIGHGUID_PLAYER );
- + Object::_Create(guid);
- m_name = fields[2].GetCppString();
- @@ -15412,19 +15387,21 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
- {
- for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
- {
- - if( (*iter)->GetGUIDLow() == transGUID)
- + Transport* transport = *iter;
- +
- + if (transport->GetGUIDLow() == transGUID)
- {
- - MapEntry const* transMapEntry = sMapStore.LookupEntry((*iter)->GetMapId());
- + MapEntry const* transMapEntry = sMapStore.LookupEntry(transport->GetMapId());
- // client without expansion support
- if(GetSession()->Expansion() < transMapEntry->Expansion())
- {
- - DEBUG_LOG("Player %s using client without required expansion tried login at transport at non accessible map %u", GetName(), (*iter)->GetMapId());
- + DEBUG_LOG("Player %s using client without required expansion tried login at transport at non accessible map %u", GetName(), transport->GetMapId());
- break;
- }
- - m_transport = *iter;
- - m_transport->AddPassenger(this);
- - SetLocationMapId(m_transport->GetMapId());
- + SetTransport(transport);
- + transport->AddPassenger(this);
- + SetLocationMapId(transport->GetMapId());
- break;
- }
- }
- @@ -18070,6 +18047,59 @@ void Player::PossessSpellInitialize()
- GetSession()->SendPacket(&data);
- }
- +void Player::VehicleSpellInitialize()
- +{
- + Creature* charm = (Creature*)GetCharm();
- +
- + if (!charm)
- + return;
- +
- + CharmInfo *charmInfo = charm->GetCharmInfo();
- +
- + if (!charmInfo)
- + {
- + sLog.outError("Player::VehicleSpellInitialize(): vehicle (GUID: %u) has no charminfo!", charm->GetGUIDLow());
- + return;
- + }
- +
- + size_t cooldownsCount = charm->m_CreatureSpellCooldowns.size() + charm->m_CreatureCategoryCooldowns.size();
- +
- + WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1+cooldownsCount*(4+2+4+4));
- + data << charm->GetObjectGuid();
- + data << uint16(0);
- + data << uint32(0);
- + data << uint32(0x08000101); // react state
- +
- + charmInfo->BuildActionBar(&data);
- +
- + data << uint8(0); // additional spells count
- + data << uint8(cooldownsCount);
- +
- + time_t curTime = time(NULL);
- +
- + for (CreatureSpellCooldowns::const_iterator itr = charm->m_CreatureSpellCooldowns.begin(); itr != charm->m_CreatureSpellCooldowns.end(); ++itr)
- + {
- + time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
- +
- + data << uint32(itr->first); // spellid
- + data << uint16(0); // spell category?
- + data << uint32(cooldown); // cooldown
- + data << uint32(0); // category cooldown
- + }
- +
- + for (CreatureSpellCooldowns::const_iterator itr = charm->m_CreatureCategoryCooldowns.begin(); itr != charm->m_CreatureCategoryCooldowns.end(); ++itr)
- + {
- + time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
- +
- + data << uint32(itr->first); // spellid
- + data << uint16(0); // spell category?
- + data << uint32(0); // cooldown
- + data << uint32(cooldown); // category cooldown
- + }
- +
- + GetSession()->SendPacket(&data);
- +}
- +
- void Player::CharmSpellInitialize()
- {
- Unit* charm = GetCharm();
- @@ -18387,7 +18417,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
- if (npc)
- {
- // not let cheating with start flight mounted
- - if (IsMounted())
- + if (IsMounted() || GetVehicle())
- {
- WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
- data << uint32(ERR_TAXIPLAYERALREADYMOUNTED);
- @@ -18416,6 +18446,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
- else
- {
- RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
- + ExitVehicle();
- if (IsInDisallowedMountForm())
- RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
- @@ -19567,7 +19598,10 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
- // target aura duration for caster show only if target exist at caster client
- // send data at target visibility change (adding to client)
- if(target!=this && target->isType(TYPEMASK_UNIT))
- + {
- SendAurasForTarget((Unit*)target);
- + ((Unit*)target)->SendHeartBeat(false);
- + }
- if(target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isAlive())
- ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this);
- @@ -19799,6 +19833,14 @@ void Player::SendInitialPacketsAfterAddToMap()
- SendMessageToSet(&data2,true);
- }
- + if(GetVehicle())
- + {
- + WorldPacket data3(SMSG_FORCE_MOVE_ROOT, 10);
- + data3 << GetPackGUID();
- + data3 << uint32((m_movementInfo.GetVehicleSeatFlags() & SEAT_FLAG_CAN_CAST) ? 2 : 0);
- + SendMessageToSet(&data3,true);
- + }
- +
- SendAurasForTarget(this);
- SendEnchantmentDurations(); // must be after add to map
- SendItemDurations(); // must be after add to map
- @@ -21074,98 +21116,6 @@ void Player::ApplyGlyphs(bool apply)
- ApplyGlyph(i,apply);
- }
- -void Player::EnterVehicle(Vehicle *vehicle)
- -{
- - VehicleEntry const *ve = sVehicleStore.LookupEntry(vehicle->GetVehicleId());
- - if(!ve)
- - return;
- -
- - VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(ve->m_seatID[0]);
- - if(!veSeat)
- - return;
- -
- - vehicle->SetCharmerGuid(GetObjectGuid());
- - vehicle->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- - vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
- - vehicle->setFaction(getFaction());
- -
- - SetCharm(vehicle); // charm
- - m_camera.SetView(vehicle); // set view
- -
- - SetClientControl(vehicle, 1); // redirect controls to vehicle
- - SetMover(vehicle);
- -
- - WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- - GetSession()->SendPacket(&data);
- -
- - data.Initialize(MSG_MOVE_TELEPORT_ACK, 30);
- - data << GetPackGUID();
- - data << uint32(0); // counter?
- - data << uint32(MOVEFLAG_ONTRANSPORT); // transport
- - data << uint16(0); // special flags
- - data << uint32(WorldTimer::getMSTime()); // time
- - data << vehicle->GetPositionX(); // x
- - data << vehicle->GetPositionY(); // y
- - data << vehicle->GetPositionZ(); // z
- - data << vehicle->GetOrientation(); // o
- - // transport part, TODO: load/calculate seat offsets
- - data << vehicle->GetObjectGuid(); // transport guid
- - data << float(veSeat->m_attachmentOffsetX); // transport offsetX
- - data << float(veSeat->m_attachmentOffsetY); // transport offsetY
- - data << float(veSeat->m_attachmentOffsetZ); // transport offsetZ
- - data << float(0); // transport orientation
- - data << uint32(WorldTimer::getMSTime()); // transport time
- - data << uint8(0); // seat
- - // end of transport part
- - data << uint32(0); // fall time
- - GetSession()->SendPacket(&data);
- -
- - data.Initialize(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1);
- - data << vehicle->GetObjectGuid();
- - data << uint16(0);
- - data << uint32(0);
- - data << uint32(0x00000101);
- -
- - for(uint32 i = 0; i < 10; ++i)
- - data << uint16(0) << uint8(0) << uint8(i+8);
- -
- - data << uint8(0);
- - data << uint8(0);
- - GetSession()->SendPacket(&data);
- -}
- -
- -void Player::ExitVehicle(Vehicle *vehicle)
- -{
- - vehicle->SetCharmerGuid(ObjectGuid());
- - vehicle->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- - vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
- - vehicle->setFaction((GetTeam() == ALLIANCE) ? vehicle->GetCreatureInfo()->faction_A : vehicle->GetCreatureInfo()->faction_H);
- -
- - SetCharm(NULL);
- - m_camera.ResetView();
- -
- - SetClientControl(vehicle, 0);
- - SetMover(NULL);
- -
- - WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
- - data << GetPackGUID();
- - data << uint32(0); // counter?
- - data << uint32(MOVEFLAG_ROOT); // fly unk
- - data << uint16(MOVEFLAG2_UNK4); // special flags
- - data << uint32(WorldTimer::getMSTime()); // time
- - data << vehicle->GetPositionX(); // x
- - data << vehicle->GetPositionY(); // y
- - data << vehicle->GetPositionZ(); // z
- - data << vehicle->GetOrientation(); // o
- - data << uint32(0); // fall time
- - GetSession()->SendPacket(&data);
- -
- - RemovePetActionBar();
- -
- - // maybe called at dummy aura remove?
- - // CastSpell(this, 45472, true); // Parachute
- -}
- -
- bool Player::isTotalImmune()
- {
- AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
- @@ -22516,6 +22466,7 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
- return GetMap()->GetGameObject(guid);
- break;
- case HIGHGUID_UNIT:
- + case HIGHGUID_VEHICLE:
- if ((typemask & TYPEMASK_UNIT) && IsInWorld())
- return GetMap()->GetCreature(guid);
- break;
- @@ -22523,10 +22474,6 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
- if ((typemask & TYPEMASK_UNIT) && IsInWorld())
- return GetMap()->GetPet(guid);
- break;
- - case HIGHGUID_VEHICLE:
- - if ((typemask & TYPEMASK_UNIT) && IsInWorld())
- - return GetMap()->GetVehicle(guid);
- - break;
- case HIGHGUID_DYNAMICOBJECT:
- if ((typemask & TYPEMASK_DYNAMICOBJECT) && IsInWorld())
- return GetMap()->GetDynamicObject(guid);
- diff --git a/src/game/Player.h b/src/game/Player.h
- index bc4c0b5..4ef9fc7 100644
- --- a/src/game/Player.h
- +++ b/src/game/Player.h
- @@ -47,11 +47,9 @@ class Channel;
- class DynamicObject;
- class Creature;
- class PlayerMenu;
- -class Transport;
- class UpdateMask;
- class SpellCastTargets;
- class PlayerSocial;
- -class Vehicle;
- class InstanceSave;
- class Spell;
- class Item;
- @@ -1628,6 +1626,7 @@ class MANGOS_DLL_SPEC Player : public Unit
- void SendPetGUIDs();
- void CharmSpellInitialize();
- void PossessSpellInitialize();
- + void VehicleSpellInitialize();
- void RemovePetActionBar();
- bool HasSpell(uint32 spell) const;
- @@ -2245,22 +2244,8 @@ class MANGOS_DLL_SPEC Player : public Unit
- Unit* GetMover() const { return m_mover; }
- bool IsSelfMover() const { return m_mover == this; }// normal case for player not controlling other unit
- - void EnterVehicle(Vehicle *vehicle);
- - void ExitVehicle(Vehicle *vehicle);
- -
- ObjectGuid const& GetFarSightGuid() const { return GetGuidValue(PLAYER_FARSIGHT); }
- - // Transports
- - Transport * GetTransport() const { return m_transport; }
- - void SetTransport(Transport * t) { m_transport = t; }
- -
- - float GetTransOffsetX() const { return m_movementInfo.GetTransportPos()->x; }
- - float GetTransOffsetY() const { return m_movementInfo.GetTransportPos()->y; }
- - float GetTransOffsetZ() const { return m_movementInfo.GetTransportPos()->z; }
- - float GetTransOffsetO() const { return m_movementInfo.GetTransportPos()->o; }
- - uint32 GetTransTime() const { return m_movementInfo.GetTransportTime(); }
- - int8 GetTransSeat() const { return m_movementInfo.GetTransportSeat(); }
- -
- uint32 GetSaveTimer() const { return m_nextSave; }
- void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
- @@ -2598,9 +2583,6 @@ class MANGOS_DLL_SPEC Player : public Unit
- RestType rest_type;
- ////////////////////Rest System/////////////////////
- - // Transports
- - Transport * m_transport;
- -
- uint32 m_resetTalentsCost;
- time_t m_resetTalentsTime;
- uint32 m_usedTalentCount;
- diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp
- index d435fef..b75d1c1 100644
- --- a/src/game/PointMovementGenerator.cpp
- +++ b/src/game/PointMovementGenerator.cpp
- @@ -106,7 +106,7 @@ void PointMovementGenerator<Creature>::MovementInform(Creature &unit)
- if (unit.IsTemporarySummon())
- {
- TemporarySummon* pSummon = (TemporarySummon*)(&unit);
- - if (pSummon->GetSummonerGuid().IsCreature())
- + if (pSummon->GetSummonerGuid().IsCreatureOrVehicle())
- if(Creature* pSummoner = unit.GetMap()->GetCreature(pSummon->GetSummonerGuid()))
- if (pSummoner->AI())
- pSummoner->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id);
- diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp
- index 90b23bb..0f2e227 100644
- --- a/src/game/QueryHandler.cpp
- +++ b/src/game/QueryHandler.cpp
- @@ -188,8 +188,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
- for(int i = 0; i < MAX_CREATURE_MODEL; ++i)
- data << uint32(ci->ModelId[i]);
- - data << float(ci->unk16); // health modifier
- - data << float(ci->unk17); // power modifier
- + data << float(ci->health_mod); // health modifier
- + data << float(ci->power_mod); // power modifier
- data << uint8(ci->RacialLeader);
- for(uint32 i = 0; i < 6; ++i)
- data << uint32(ci->questItems[i]); // itemId[6], quest drop
- diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp
- index de4f661..6c81436 100644
- --- a/src/game/QuestHandler.cpp
- +++ b/src/game/QuestHandler.cpp
- @@ -636,7 +636,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
- {
- uint8 dialogStatus = DIALOG_STATUS_NONE;
- - if (itr->IsCreatureOrPet())
- + if (itr->IsAnyTypeCreature())
- {
- // need also pet quests case support
- Creature *questgiver = GetPlayer()->GetMap()->GetAnyTypeCreature(*itr);
- diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp
- index df9a36b..f660d74 100644
- --- a/src/game/ReactorAI.cpp
- +++ b/src/game/ReactorAI.cpp
- @@ -109,6 +109,7 @@ ReactorAI::EnterEvadeMode()
- DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim %s [guid=%u]", victim->isAlive() ? "out run him" : "is dead", m_creature->GetGUIDLow());
- }
- + m_creature->ExitVehicle();
- m_creature->RemoveAllAuras();
- m_creature->DeleteThreatList();
- i_victimGuid = 0;
- diff --git a/src/game/SQLStorages.cpp b/src/game/SQLStorages.cpp
- index c1ae399..cd335ca 100644
- --- a/src/game/SQLStorages.cpp
- +++ b/src/game/SQLStorages.cpp
- @@ -21,8 +21,8 @@
- #include "Database/SQLStorageImpl.h"
- #include "Database/DatabaseEnv.h"
- -const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiis";
- -const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiii";
- +const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiis";
- +const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiii";
- const char CreatureDataAddonInfofmt[]="iiibbiis";
- const char CreatureModelfmt[]="iffbii";
- const char CreatureInfoAddonInfofmt[]="iiibbiis";
- diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
- index 5a045b3..8731941 100644
- --- a/src/game/SharedDefines.h
- +++ b/src/game/SharedDefines.h
- @@ -155,6 +155,17 @@ enum Powers
- #define MAX_POWERS 7
- +enum EnergyType
- +{
- + ENERGY_TYPE_UNK0 = 0, // Possible mana or flat energy.
- + ENERGY_TYPE_UNK1 = 1, // 2 vehicles in 3.3.5a
- + ENERGY_TYPE_PYRITE = 41, // 2 vehicles in 3.3.5a
- + ENERGY_TYPE_STEAM = 61, // 9 vehicles in 3.3.5a
- + ENERGY_TYPE_OOZE = 121, // 1 vehicle in 3.3.5a
- + ENERGY_TYPE_BLOOD = 141, // 1 vehicle in 3.3.5a
- + ENERGY_TYPE_UNK142 = 142, // 1 vehicle in 3.3.5a
- +};
- +
- enum SpellSchools
- {
- SPELL_SCHOOL_NORMAL = 0,
- @@ -1113,6 +1124,16 @@ enum Targets
- TARGET_SELF2 = 87,
- TARGET_DIRECTLY_FORWARD = 89,
- TARGET_NONCOMBAT_PET = 90,
- + TARGET_OWNED_VEHICLE = 94,
- + TARGET_UNIT_DRIVER = 95,
- + TARGET_UNIT_PASSENGER_0 = 96,
- + TARGET_UNIT_PASSENGER_1 = 97,
- + TARGET_UNIT_PASSENGER_2 = 98,
- + TARGET_UNIT_PASSENGER_3 = 99,
- + TARGET_UNIT_PASSENGER_4 = 100,
- + TARGET_UNIT_PASSENGER_5 = 101,
- + TARGET_UNIT_PASSENGER_6 = 102,
- + TARGET_UNIT_PASSENGER_7 = 103,
- TARGET_IN_FRONT_OF_CASTER_30 = 104,
- };
- diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
- index ed547cf..7986f6b 100644
- --- a/src/game/Spell.cpp
- +++ b/src/game/Spell.cpp
- @@ -43,6 +43,7 @@
- #include "VMapFactory.h"
- #include "BattleGround.h"
- #include "Util.h"
- +#include "Vehicle.h"
- #define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
- @@ -2015,6 +2016,23 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
- if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet() && ((Pet*)target)->getPetType() == MINI_PET)
- targetUnitMap.push_back(target);
- break;
- + case TARGET_OWNED_VEHICLE:
- + if (VehicleKit* vehicle = m_caster->GetVehicle())
- + if (Unit* target = vehicle->GetBase())
- + targetUnitMap.push_back(target);
- + break;
- + case TARGET_UNIT_PASSENGER_0:
- + case TARGET_UNIT_PASSENGER_1:
- + case TARGET_UNIT_PASSENGER_2:
- + case TARGET_UNIT_PASSENGER_3:
- + case TARGET_UNIT_PASSENGER_4:
- + case TARGET_UNIT_PASSENGER_5:
- + case TARGET_UNIT_PASSENGER_6:
- + case TARGET_UNIT_PASSENGER_7:
- + if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetObjectGuid().IsVehicle())
- + if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(targetMode - TARGET_UNIT_PASSENGER_0))
- + targetUnitMap.push_back(unit);
- + break;
- case TARGET_CASTER_COORDINATES:
- {
- // Check original caster is GO - set its coordinates as dst cast
- @@ -3339,7 +3357,7 @@ void Spell::update(uint32 difftime)
- for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- {
- TargetInfo* target = &*ihit;
- - if(!target->targetGUID.IsCreature())
- + if(!target->targetGUID.IsCreatureOrVehicle())
- continue;
- Unit* unit = m_caster->GetObjectGuid() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
- @@ -4701,8 +4719,15 @@ SpellCastResult Spell::CheckCast(bool strict)
- if (locRes != SPELL_CAST_OK)
- return locRes;
- + bool castOnVehicleAllowed = false;
- +
- + if (m_caster->GetVehicle())
- + if ( VehicleSeatEntry const* seatInfo = m_caster->GetVehicle()->GetSeatInfo(m_caster))
- + if (seatInfo->m_flags & SEAT_FLAG_CAN_CAST || seatInfo->m_flags & SEAT_FLAG_CAN_ATTACK)
- + castOnVehicleAllowed = true;
- +
- // not let players cast spells at mount (and let do it to creatures)
- - if (m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell &&
- + if ((m_caster->IsMounted() || (m_caster->GetVehicle() && !castOnVehicleAllowed)) && m_caster->GetTypeId() == TYPEID_PLAYER && !m_IsTriggeredSpell &&
- !IsPassiveSpell(m_spellInfo) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED))
- {
- if (m_caster->IsTaxiFlying())
- @@ -5537,21 +5562,29 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
- if (!_target->isTargetableForAttack())
- return SPELL_FAILED_BAD_TARGETS; // guessed error
- - if(IsPositiveSpell(m_spellInfo->Id))
- + //if(IsPositiveSpell(m_spellInfo->Id))
- + if(IsPositiveSpell(m_spellInfo->Id) && !IsDispelSpell(m_spellInfo))
- {
- if(m_caster->IsHostileTo(_target))
- return SPELL_FAILED_BAD_TARGETS;
- }
- else
- {
- - bool duelvsplayertar = false;
- + bool dualEffect = false;
- for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
- {
- - //TARGET_DUELVSPLAYER is positive AND negative
- - duelvsplayertar |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER);
- + // This effects is positive AND negative. Need for vehicles cast.
- + dualEffect |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER
- + || m_spellInfo->EffectImplicitTargetA[j] == TARGET_IN_FRONT_OF_CASTER_30
- + || m_spellInfo->EffectImplicitTargetA[j] == TARGET_MASTER
- + || m_spellInfo->EffectImplicitTargetA[j] == TARGET_IN_FRONT_OF_CASTER
- + || m_spellInfo->EffectImplicitTargetA[j] == TARGET_EFFECT_SELECT
- + || m_spellInfo->EffectImplicitTargetA[j] == TARGET_CASTER_COORDINATES);
- }
- - if(m_caster->IsFriendlyTo(target) && !duelvsplayertar)
- + if (m_caster->IsFriendlyTo(target) && !(!m_caster->GetCharmerOrOwner() || !m_caster->GetCharmerOrOwner()->IsFriendlyTo(target))
- + && !dualEffect && !IsDispelSpell(m_spellInfo))
- {
- + DEBUG_LOG("Charmed creature attempt to cast spell %d, but target is not valid",m_spellInfo->Id);
- return SPELL_FAILED_BAD_TARGETS;
- }
- }
- @@ -6512,7 +6545,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
- if (target != m_caster && target->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid())
- {
- // any unattackable target skipped
- - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
- + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && target->GetObjectGuid() != m_caster->GetCharmerOrOwnerGuid())
- return false;
- // unselectable targets skipped in all cases except TARGET_SCRIPT targeting
- @@ -6528,6 +6561,13 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
- return false;
- }
- + if (target != m_caster && m_caster->GetCharmerOrOwnerGuid() == target->GetObjectGuid())
- + {
- + if (m_spellInfo->EffectImplicitTargetA[eff] == TARGET_MASTER ||
- + m_spellInfo->EffectImplicitTargetB[eff] == TARGET_MASTER)
- + return true;
- + }
- +
- // Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
- if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER)
- {
- diff --git a/src/game/Spell.h b/src/game/Spell.h
- index a0c37d0..7c37399 100644
- --- a/src/game/Spell.h
- +++ b/src/game/Spell.h
- @@ -392,6 +392,7 @@ class Spell
- void DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
- void DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc = 0);
- void DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
- + void DoSummonVehicle(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
- void WriteSpellGoTargets( WorldPacket * data );
- void WriteAmmoToPacket( WorldPacket * data );
- diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
- index bcedb01..5d48008 100644
- --- a/src/game/SpellAuras.cpp
- +++ b/src/game/SpellAuras.cpp
- @@ -346,7 +346,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
- &Aura::HandleAuraAddMechanicAbilities, //293 SPELL_AURA_ADD_MECHANIC_ABILITIES replaces target's action bars with a predefined spellset
- &Aura::HandleNULL, //294 2 spells, possible prevent mana regen
- &Aura::HandleUnused, //295 unused (3.2.2a)
- - &Aura::HandleNULL, //296 2 spells
- + &Aura::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
- &Aura::HandleNULL, //297 1 spell (counter spell school?)
- &Aura::HandleUnused, //298 unused (3.2.2a)
- &Aura::HandleUnused, //299 unused (3.2.2a)
- @@ -2988,7 +2988,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real)
- if (minfo)
- display_id = minfo->modelid;
- - target->Mount(display_id, GetId());
- + target->Mount(display_id, GetId(), ci->VehicleId, GetMiscValue());
- }
- else
- {
- @@ -3819,7 +3819,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
- {
- ((Creature*)target)->AIM_Initialize();
- }
- - else if(target->GetTypeId() == TYPEID_PLAYER)
- + else if(target->GetTypeId() == TYPEID_PLAYER && !target->GetVehicle())
- {
- ((Player*)target)->SetClientControl(target, 0);
- }
- @@ -3852,7 +3852,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
- target->SetCharmerGuid(ObjectGuid());
- - if(target->GetTypeId() == TYPEID_PLAYER)
- + if(target->GetTypeId() == TYPEID_PLAYER && !target->GetVehicle())
- {
- ((Player*)target)->setFactionForRace(target->getRace());
- ((Player*)target)->SetClientControl(target, 1);
- @@ -4230,7 +4230,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
- target->clearUnitState(UNIT_STAT_STUNNED);
- target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
- - if(!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
- + if(!target->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_ON_VEHICLE)) // prevent allow move if have also root effect
- {
- if(target->getVictim() && target->isAlive())
- target->SetTargetGuid(target->getVictim()->GetObjectGuid());
- @@ -4458,10 +4458,13 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
- if(target->GetTypeId() == TYPEID_PLAYER)
- {
- - WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10);
- - data << target->GetPackGUID();
- - data << (uint32)2;
- - target->SendMessageToSet(&data, true);
- + if(!target->hasUnitState(UNIT_STAT_ON_VEHICLE))
- + {
- + WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10);
- + data << target->GetPackGUID();
- + data << uint32(2);
- + target->SendMessageToSet(&data, true);
- + }
- //Clear unit movement flags
- ((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
- @@ -4500,7 +4503,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
- target->clearUnitState(UNIT_STAT_ROOT);
- - if(!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect
- + if(!target->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ON_VEHICLE)) // prevent allow move if have also stun effect
- {
- if(target->getVictim() && target->isAlive())
- target->SetTargetGuid(target->getVictim()->GetObjectGuid());
- @@ -7930,28 +7933,31 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real)
- if(!Real)
- return;
- + Unit* caster = GetCaster();
- + if (!caster)
- + return;
- +
- Unit* target = GetTarget();
- - if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->IsVehicle())
- + if (!target)
- return;
- - Vehicle* vehicle = (Vehicle*)target;
- - Unit *caster = GetCaster();
- - if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
- + VehicleKit* pVehicle = target->GetVehicleKit();
- +
- + if (target->GetTypeId() != TYPEID_UNIT || !pVehicle)
- return;
- if (apply)
- {
- - ((Player*)caster)->RemovePet(PET_SAVE_AS_CURRENT);
- - ((Player*)caster)->EnterVehicle(vehicle);
- + //((Player*)caster)->RemovePet(PET_SAVE_AS_CURRENT);
- + caster->EnterVehicle(pVehicle);
- }
- else
- {
- - SpellEntry const *spell = GetSpellProto();
- -
- // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
- - caster->RemoveAurasDueToSpell(spell->Id);
- + caster->RemoveAurasDueToSpell(GetId());
- - ((Player*)caster)->ExitVehicle(vehicle);
- + if (caster->GetVehicleKit() == pVehicle)
- + caster->ExitVehicle();
- }
- }
- @@ -9488,3 +9494,39 @@ void SpellAuraHolder::UnregisterSingleCastHolder()
- m_isSingleTarget = false;
- }
- }
- +
- +void Aura::HandleAuraSetVehicle(bool apply, bool real)
- +{
- + if (!real)
- + return;
- +
- + Unit* target = GetTarget();
- +
- + if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
- + return;
- +
- + uint32 vehicleId = GetMiscValue();
- +
- + if (vehicleId == 0)
- + return;
- +
- + if (apply)
- + {
- + if (!target->CreateVehicleKit(vehicleId))
- + return;
- + }
- + else
- + if (target->GetVehicleKit())
- + target->RemoveVehicleKit();
- +
- + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4);
- + data.appendPackGUID(target->GetGUID());
- + data << uint32(apply ? vehicleId : 0);
- + target->SendMessageToSet(&data, true);
- +
- + if (apply)
- + {
- + data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- + ((Player*)target)->GetSession()->SendPacket(&data);
- + }
- +}
- diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
- index 9812dd2..11b66d8 100644
- --- a/src/game/SpellAuras.h
- +++ b/src/game/SpellAuras.h
- @@ -359,6 +359,7 @@ class MANGOS_DLL_SPEC Aura
- void HandleAuraModAllCritChance(bool Apply, bool Real);
- void HandleAuraOpenStable(bool apply, bool Real);
- void HandleAuraAddMechanicAbilities(bool apply, bool Real);
- + void HandleAuraSetVehicle(bool apply, bool Real);
- virtual ~Aura();
- diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
- index 6a3b3db..19cc273 100644
- --- a/src/game/SpellEffects.cpp
- +++ b/src/game/SpellEffects.cpp
- @@ -4276,6 +4276,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
- case UNITNAME_SUMMON_TITLE_MOUNT:
- // TODO
- // EffectSummonVehicle(i);
- + DoSummonVehicle(eff_idx, summon_prop->FactionId);
- break;
- default:
- sLog.outError("EffectSummonType: Unhandled summon title %u", summon_prop->Title);
- @@ -4302,10 +4303,11 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
- break;
- }
- case SUMMON_PROP_GROUP_VEHICLE:
- + case SUMMON_PROP_GROUP_UNCONTROLLABLE_VEHICLE:
- {
- // TODO
- // EffectSummonVehicle(i);
- - sLog.outDebug("EffectSummonType: Unhandled summon group type SUMMON_PROP_GROUP_VEHICLE(%u)", summon_prop->Group);
- + DoSummonVehicle(eff_idx, summon_prop->FactionId);
- break;
- }
- default:
- @@ -4875,6 +4877,61 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
- }
- }
- +void Spell::DoSummonVehicle(SpellEffectIndex eff_idx, uint32 forceFaction)
- +{
- + if (m_caster->hasUnitState(UNIT_STAT_ON_VEHICLE))
- + {
- + if (m_spellInfo->Attributes & SPELL_ATTR_UNK7)
- + m_caster->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
- + else
- + return;
- + }
- +
- + uint32 vehicle_entry = m_spellInfo->EffectMiscValue[eff_idx];
- +
- + if (!vehicle_entry)
- + return;
- +
- + SpellEntry const* m_mountspell = sSpellStore.LookupEntry(m_spellInfo->EffectBasePoints[eff_idx] != 0 ? m_spellInfo->CalculateSimpleValue(eff_idx) : 46598);
- +
- + if (!m_mountspell)
- + m_mountspell = sSpellStore.LookupEntry(46598);
- + // Used BasePoint mount spell, if not present - hardcoded (by Blzz).
- +
- + float px, py, pz;
- + // If dest location present
- + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
- + {
- + px = m_targets.m_destX;
- + py = m_targets.m_destY;
- + pz = m_targets.m_destZ;
- + }
- + // Summon if dest location not present near caster
- + else
- + m_caster->GetClosePoint(px, py, pz,m_caster->GetObjectBoundingRadius());
- +
- + TempSummonType summonType = (GetSpellDuration(m_spellInfo) == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
- +
- + Creature* vehicle = m_caster->SummonCreature(vehicle_entry,px,py,pz,m_caster->GetOrientation(),summonType,GetSpellDuration(m_spellInfo),true);
- +
- + if (vehicle && !vehicle->GetObjectGuid().IsVehicle())
- + {
- + sLog.outError("DoSommonVehicle: Creature (guidlow %d, entry %d) summoned, but this is not vehicle. Correct VehicleId in creature_template.", vehicle->GetGUIDLow(), vehicle->GetEntry());
- + vehicle->ForcedDespawn();
- + return;
- + }
- +
- + if (vehicle)
- + {
- + vehicle->setFaction(forceFaction ? forceFaction : m_caster->getFaction());
- + vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL,m_spellInfo->Id);
- + m_caster->CastSpell(vehicle, m_mountspell, true);
- + DEBUG_LOG("Caster (guidlow %d) summon vehicle (guidlow %d, entry %d) and mounted with spell %d ", m_caster->GetGUIDLow(), vehicle->GetGUIDLow(), vehicle->GetEntry(), m_mountspell->Id);
- + }
- + else
- + sLog.outError("Vehicle (guidlow %d, entry %d) NOT summoned by undefined reason. ", vehicle->GetGUIDLow(), vehicle->GetEntry());
- +}
- +
- void Spell::EffectTeleUnitsFaceCaster(SpellEffectIndex eff_idx)
- {
- if (!unitTarget)
- diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
- index f6238c2..330657a 100644
- --- a/src/game/SpellHandler.cpp
- +++ b/src/game/SpellHandler.cpp
- @@ -586,11 +586,11 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
- ObjectGuid guid;
- recv_data >> guid;
- - if (_player->isInCombat()) // client prevent click and set different icon at combat state
- + Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid);
- + if (!unit)
- return;
- - Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid);
- - if (!unit || unit->isInCombat()) // client prevent click and set different icon at combat state
- + if (_player->isInCombat() && !guid.IsVehicle()) // client prevent click and set different icon at combat state
- return;
- SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry());
- diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
- index 4626479..dbcf0c1 100644
- --- a/src/game/SpellMgr.cpp
- +++ b/src/game/SpellMgr.cpp
- @@ -3328,7 +3328,7 @@ bool SpellMgr::LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefault
- void SpellMgr::LoadPetDefaultSpells()
- {
- - MANGOS_ASSERT(MAX_CREATURE_SPELL_DATA_SLOT==CREATURE_MAX_SPELLS);
- + MANGOS_ASSERT(MAX_CREATURE_SPELL_DATA_SLOT <= CREATURE_MAX_SPELLS);
- mPetDefaultSpellsMap.clear();
- diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
- index cc6de7d..b5ca6dd 100644
- --- a/src/game/TemporarySummon.cpp
- +++ b/src/game/TemporarySummon.cpp
- @@ -164,7 +164,7 @@ void TemporarySummon::UnSummon()
- {
- CombatStop();
- - if (GetSummonerGuid().IsCreature())
- + if (GetSummonerGuid().IsCreatureOrVehicle())
- if(Creature* sum = GetMap()->GetCreature(GetSummonerGuid()))
- if (sum->AI())
- sum->AI()->SummonedCreatureDespawn(this);
- diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp
- index 08af53d..f9fa649 100644
- --- a/src/game/Transports.cpp
- +++ b/src/game/Transports.cpp
- @@ -158,7 +158,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
- return false;
- }
- - Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
- + Object::_Create(ObjectGuid(HIGHGUID_MO_TRANSPORT, guidlow));
- GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow);
- diff --git a/src/game/Traveller.h b/src/game/Traveller.h
- index 2101527..17b0d26 100644
- --- a/src/game/Traveller.h
- +++ b/src/game/Traveller.h
- @@ -84,7 +84,7 @@ inline float Traveller<Creature>::Speed()
- template<>
- inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation)
- {
- - i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation);
- + i_traveller.SetPosition(x, y, z, orientation);
- }
- template<>
- diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
- index 22c7059..377ed6c 100644
- --- a/src/game/Unit.cpp
- +++ b/src/game/Unit.cpp
- @@ -46,8 +46,10 @@
- #include "CellImpl.h"
- #include "Path.h"
- #include "Traveller.h"
- +#include "Vehicle.h"
- #include "VMapFactory.h"
- #include "MovementGenerator.h"
- +#include "Transports.h"
- #include <math.h>
- #include <stdarg.h>
- @@ -265,6 +267,11 @@ Unit::Unit()
- // remove aurastates allowing special moves
- for(int i=0; i < MAX_REACTIVE; ++i)
- m_reactiveTimer[i] = 0;
- +
- + m_transport = NULL;
- +
- + m_pVehicle = NULL;
- + m_pVehicleKit = NULL;
- }
- Unit::~Unit()
- @@ -432,6 +439,91 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
- SendMonsterMove(x, y, z, SPLINETYPE_NORMAL, flags, transitTime, player);
- }
- +bool Unit::SetPosition(float x, float y, float z, float orientation, bool teleport)
- +{
- + // prevent crash when a bad coord is sent by the client
- + if (!MaNGOS::IsValidMapCoord(x, y, z, orientation))
- + {
- + DEBUG_LOG("Unit::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for unit %d!", x, y, z, orientation, teleport, GetGUIDLow());
- + return false;
- + }
- +
- + bool turn = GetOrientation() != orientation;
- + bool relocate = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
- +
- + if (turn)
- + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
- +
- + if (relocate)
- + {
- + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
- +
- + if (GetTypeId() == TYPEID_PLAYER)
- + GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation);
- + else
- + GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
- + }
- + else if (turn)
- + SetOrientation(orientation);
- +
- + if ((relocate || turn) && GetVehicleKit())
- + GetVehicleKit()->RelocatePassengers(x, y, z, orientation);
- +
- + return relocate || turn;
- +}
- +
- +void Unit::SendMonsterMoveTransport(WorldObject *transport, SplineType type, SplineFlags flags, uint32 moveTime, ...)
- +{
- + va_list vargs;
- + va_start(vargs, moveTime);
- +
- + WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, 60);
- + data << GetPackGUID();
- + data << transport->GetPackGUID();
- + data << uint8(m_movementInfo.GetTransportSeat());
- + data << uint8(0); // new in 3.1
- + data << float(transport->GetPositionX());
- + data << float(transport->GetPositionY());
- + data << float(transport->GetPositionZ());
- + data << uint32(WorldTimer::getMSTime());
- +
- + data << uint8(type); // spline type
- +
- + switch(type)
- + {
- + case SPLINETYPE_NORMAL: // normal packet
- + break;
- + case SPLINETYPE_STOP: // stop packet (raw pos?)
- + va_end(vargs);
- + SendMessageToSet(&data, true);
- + return;
- + case SPLINETYPE_FACINGSPOT: // facing spot
- + data << float(va_arg(vargs,double));
- + data << float(va_arg(vargs,double));
- + data << float(va_arg(vargs,double));
- + break;
- + case SPLINETYPE_FACINGTARGET:
- + data << uint64(va_arg(vargs,uint64));
- + break;
- + case SPLINETYPE_FACINGANGLE:
- + data << float(va_arg(vargs,double)); // facing angle
- + break;
- + }
- +
- + va_end(vargs);
- +
- + data << uint32(flags);
- +
- + data << uint32(moveTime); // Time in between points
- + data << uint32(1); // 1 single waypoint
- +
- + data << float(m_movementInfo.GetTransportPos()->x);
- + data << float(m_movementInfo.GetTransportPos()->y);
- + data << float(m_movementInfo.GetTransportPos()->z);
- +
- + SendMessageToSet(&data, true);
- +}
- +
- void Unit::SendHeartBeat(bool toSelf)
- {
- WorldPacket data(MSG_MOVE_HEARTBEAT, 64);
- @@ -842,6 +934,13 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- cVictim->AllLootRemovedFromCorpse();
- }
- + // if vehicle and has passengers - remove his
- + if (cVictim->GetObjectGuid().IsVehicle())
- + {
- + if(cVictim->GetVehicleKit())
- + cVictim->GetVehicleKit()->RemoveAllPassengers();
- + }
- +
- // Call creature just died function
- if (cVictim->AI())
- cVictim->AI()->JustDied(this);
- @@ -849,7 +948,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- if (cVictim->IsTemporarySummon())
- {
- TemporarySummon* pSummon = (TemporarySummon*)cVictim;
- - if (pSummon->GetSummonerGuid().IsCreature())
- + if (pSummon->GetSummonerGuid().IsCreatureOrVehicle())
- if(Creature* pSummoner = cVictim->GetMap()->GetCreature(pSummon->GetSummonerGuid()))
- if (pSummoner->AI())
- pSummoner->AI()->SummonedCreatureJustDied(cVictim);
- @@ -5622,8 +5721,8 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
- if(!isAlive() || !victim->IsInWorld() || !victim->isAlive())
- return false;
- - // player cannot attack in mount state
- - if(GetTypeId()==TYPEID_PLAYER && IsMounted())
- + // player cannot attack while mounted or in vehicle
- + if(GetTypeId()==TYPEID_PLAYER && (IsMounted() || GetVehicle()))
- return false;
- // nobody can attack GM in GM-mode
- @@ -7611,7 +7710,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM) const
- return WeaponSpeed * PPM / 600.0f; // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
- }
- -void Unit::Mount(uint32 mount, uint32 spellId)
- +void Unit::Mount(uint32 mount, uint32 spellId, uint32 vehicleId, uint32 creatureEntry)
- {
- if (!mount)
- return;
- @@ -7645,6 +7744,26 @@ void Unit::Mount(uint32 mount, uint32 spellId)
- pet->ApplyModeFlags(PET_MODE_DISABLE_ACTIONS,true);
- }
- }
- +
- + if (vehicleId)
- + {
- + if (CreateVehicleKit(vehicleId))
- + {
- + GetVehicleKit()->Reset();
- +
- + // Send others that we now have a vehicle
- + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
- + data << GetPackGUID();
- + data << uint32(vehicleId);
- + SendMessageToSet(&data, true);
- +
- + data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- + ((Player*)this)->GetSession()->SendPacket(&data);
- +
- + // mounts can also have accessories
- + GetVehicleKit()->InstallAllAccessories(creatureEntry);
- + }
- + }
- }
- }
- @@ -7676,6 +7795,17 @@ void Unit::Unmount(bool from_aura)
- else
- ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
- }
- +
- + if (GetTypeId() == TYPEID_PLAYER && GetVehicleKit())
- + {
- + // Send other players that we are no longer a vehicle
- + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
- + data << GetPackGUID();
- + data << uint32(0);
- + ((Player*)this)->SendMessageToSet(&data, true);
- +
- + RemoveVehicleKit();
- + }
- }
- void Unit::SetInCombatWith(Unit* enemy)
- @@ -8457,6 +8587,7 @@ void Unit::SetDeathState(DeathState s)
- {
- if (s != ALIVE && s!= JUST_ALIVED)
- {
- + ExitVehicle();
- CombatStop();
- DeleteThreatList();
- ClearComboPointHolders(); // any combo points pointed to unit lost at it death
- @@ -8492,6 +8623,9 @@ void Unit::SetDeathState(DeathState s)
- // remove aurastates allowing special moves
- ClearAllReactives();
- ClearDiminishings();
- +
- + if (GetVehicleKit())
- + GetVehicleKit()->RemoveAllPassengers();
- }
- else if(s == JUST_ALIVED)
- {
- @@ -8527,10 +8661,6 @@ bool Unit::CanHaveThreatList() const
- if (creature->IsTotem())
- return false;
- - // vehicles can not have threat list
- - if (creature->IsVehicle())
- - return false;
- -
- // pets can not have a threat list, unless they are controlled by a creature
- if (creature->IsPet() && creature->GetOwnerGuid().IsPlayer())
- return false;
- @@ -9449,6 +9579,9 @@ void Unit::CleanupsBeforeDelete()
- {
- if(m_uint32Values) // only for fully created object
- {
- + RemoveVehicleKit();
- + ExitVehicle();
- +
- InterruptNonMeleeSpells(true);
- m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
- CombatStop();
- @@ -9516,6 +9649,25 @@ void CharmInfo::InitPossessCreateSpells()
- }
- }
- +void CharmInfo::InitVehicleCreateSpells()
- +{
- + for (uint32 x = ACTION_BAR_INDEX_START; x < ACTION_BAR_INDEX_END; ++x)
- + SetActionBar(x, 0, ActiveStates(0x8 + x));
- +
- + for (uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x)
- + {
- + uint32 spellId = ((Creature*)m_unit)->m_spells[x];
- +
- + if (!spellId)
- + continue;
- +
- + if (IsPassiveSpell(spellId))
- + m_unit->CastSpell(m_unit, spellId, true);
- + else
- + PetActionBar[x].SetAction(spellId);
- + }
- +}
- +
- void CharmInfo::InitCharmCreateSpells()
- {
- if(m_unit->GetTypeId() == TYPEID_PLAYER) //charmed players don't have spells
- @@ -10030,7 +10182,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t
- }
- }
- - if (GetTypeId() == TYPEID_PLAYER)
- + if (GetTypeId() == TYPEID_PLAYER && !GetVehicle())
- ((Player*)this)->SetClientControl(this, !apply);
- }
- @@ -10060,7 +10212,7 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID)
- }
- }
- - if(GetTypeId() == TYPEID_PLAYER)
- + if(GetTypeId() == TYPEID_PLAYER && !GetVehicle())
- ((Player*)this)->SetClientControl(this, !apply);
- }
- @@ -10558,13 +10710,14 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
- ((Player*)this)->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
- else
- {
- + ExitVehicle();
- Creature* c = (Creature*)this;
- // Creature relocation acts like instant movement generator, so current generator expects interrupt/reset calls to react properly
- if (!c->GetMotionMaster()->empty())
- if (MovementGenerator *movgen = c->GetMotionMaster()->top())
- movgen->Interrupt(*c);
- - GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
- + SetPosition(x, y, z, orientation, true);
- SendHeartBeat(false);
- @@ -10628,6 +10781,128 @@ struct SetPvPHelper
- bool state;
- };
- +bool Unit::CreateVehicleKit(uint32 vehicleId)
- +{
- + VehicleEntry const *vehicleInfo = sVehicleStore.LookupEntry(vehicleId);
- +
- + if (!vehicleInfo)
- + return false;
- +
- + m_pVehicleKit = new VehicleKit(this, vehicleInfo);
- + m_updateFlag |= UPDATEFLAG_VEHICLE;
- + return true;
- +}
- +
- +void Unit::RemoveVehicleKit()
- +{
- + if (!m_pVehicleKit)
- + return;
- +
- + m_pVehicleKit->RemoveAllPassengers();
- +
- + delete m_pVehicleKit;
- + m_pVehicleKit = NULL;
- +
- + m_updateFlag &= ~UPDATEFLAG_VEHICLE;
- + RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- + RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
- +}
- +
- +void Unit::ChangeSeat(int8 seatId, bool next)
- +{
- + if (!m_pVehicle)
- + return;
- +
- + if (seatId < 0)
- + {
- + seatId = m_pVehicle->GetNextEmptySeat(m_movementInfo.GetTransportSeat(), next);
- + if (seatId < 0)
- + return;
- + }
- + else if (seatId == m_movementInfo.GetTransportSeat() || !m_pVehicle->HasEmptySeat(seatId))
- + return;
- +
- + if (m_pVehicle->GetPassenger(seatId) &&
- + (!m_pVehicle->GetPassenger(seatId)->GetObjectGuid().IsVehicle() || !m_pVehicle->GetSeatInfo(m_pVehicle->GetPassenger(seatId))))
- + return;
- +
- + m_pVehicle->RemovePassenger(this);
- + m_pVehicle->AddPassenger(this, seatId);
- +}
- +
- +void Unit::EnterVehicle(VehicleKit *vehicle, int8 seatId)
- +{
- + if (!isAlive() || GetVehicleKit() == vehicle)
- + return;
- +
- + if (m_pVehicle)
- + {
- + if (m_pVehicle == vehicle)
- + {
- + if (seatId >= 0)
- + ChangeSeat(seatId);
- +
- + return;
- + }
- + else
- + ExitVehicle();
- + }
- +
- + InterruptNonMeleeSpells(false);
- + RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
- + RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
- +
- + if (!vehicle->AddPassenger(this, seatId))
- + return;
- +
- + m_pVehicle = vehicle;
- +
- + if (Pet *pet = GetPet())
- + pet->Unsummon(PET_SAVE_AS_CURRENT,this);
- +
- + if (GetTypeId() == TYPEID_PLAYER)
- + {
- + Player* player = (Player*)this;
- +
- + if (BattleGround *bg = player->GetBattleGround())
- + bg->EventPlayerDroppedFlag(player);
- +
- + WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA);
- + player->GetSession()->SendPacket(&data);
- +
- + data.Initialize(SMSG_BREAK_TARGET, 8);
- + data << vehicle->GetBase()->GetPackGUID();
- + player->GetSession()->SendPacket(&data);
- + }
- +
- + if (Transport* pTransport = GetTransport())
- + {
- + if (GetTypeId() == TYPEID_PLAYER)
- + pTransport->RemovePassenger((Player*)this);
- +
- + SetTransport(NULL);
- + }
- +}
- +
- +void Unit::ExitVehicle()
- +{
- + if(!m_pVehicle)
- + return;
- +
- + m_pVehicle->RemovePassenger(this);
- + m_pVehicle = NULL;
- +
- + if (GetTypeId() == TYPEID_PLAYER)
- + ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
- +
- + float x = GetPositionX();
- + float y = GetPositionY();
- + float z = GetPositionZ() + 2.0f;
- + GetClosePoint(x, y, z, 2.0f);
- + UpdateAllowedPositionZ(x, y, z);
- + SendMonsterMove(x, y, z + 0.5f, SPLINETYPE_NORMAL, SPLINEFLAG_WALKMODE, 0);
- +}
- +
- void Unit::SetPvP( bool state )
- {
- if(state)
- diff --git a/src/game/Unit.h b/src/game/Unit.h
- index c745c9e..da5dc56 100644
- --- a/src/game/Unit.h
- +++ b/src/game/Unit.h
- @@ -195,7 +195,7 @@ enum UnitRename
- UNIT_CAN_BE_ABANDONED = 0x02,
- };
- -#define CREATURE_MAX_SPELLS 4
- +#define CREATURE_MAX_SPELLS 8
- enum Swing
- {
- @@ -268,6 +268,8 @@ class Item;
- class Pet;
- class PetAura;
- class Totem;
- +class Transport;
- +class VehicleKit;
- struct SpellImmune
- {
- @@ -405,24 +407,25 @@ enum UnitState
- UNIT_STAT_FOLLOW_MOVE = 0x00010000,
- UNIT_STAT_FLEEING = 0x00020000, // FleeMovementGenerator/TimedFleeingMovementGenerator active/onstack
- UNIT_STAT_FLEEING_MOVE = 0x00040000,
- + UNIT_STAT_ON_VEHICLE = 0x00080000, // Unit is on vehicle
- // masks (only for check)
- // can't move currently
- - UNIT_STAT_CAN_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED,
- + UNIT_STAT_CAN_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED | UNIT_STAT_ON_VEHICLE,
- // stay by different reasons
- UNIT_STAT_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED |
- - UNIT_STAT_DISTRACTED,
- + UNIT_STAT_DISTRACTED | UNIT_STAT_ON_VEHICLE,
- // stay or scripted movement for effect( = in player case you can't move by client command)
- UNIT_STAT_NO_FREE_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED |
- UNIT_STAT_TAXI_FLIGHT |
- - UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING,
- + UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ON_VEHICLE,
- // not react at move in sight or other
- UNIT_STAT_CAN_NOT_REACT = UNIT_STAT_STUNNED | UNIT_STAT_DIED |
- - UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING,
- + UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ON_VEHICLE,
- // AI disabled by some reason
- UNIT_STAT_LOST_CONTROL = UNIT_STAT_FLEEING | UNIT_STAT_CONTROLLED,
- @@ -585,6 +588,7 @@ enum NPCFlags
- UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
- UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
- UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click), dynamic, set at loading and don't must be set in DB
- + UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // players with mounts that have vehicle data should have it set
- UNIT_NPC_FLAG_GUARD = 0x10000000 // custom flag for guards
- };
- @@ -721,7 +725,7 @@ class MovementInfo
- {
- public:
- MovementInfo() : moveFlags(MOVEFLAG_NONE), moveFlags2(MOVEFLAG2_NONE), time(0),
- - t_time(0), t_seat(-1), t_time2(0), s_pitch(0.0f), fallTime(0), u_unk1(0.0f) {}
- + t_time(0), t_seat(-1), t_seatInfo(NULL), t_time2(0), s_pitch(0.0f), fallTime(0), u_unk1(0.0f) {}
- // Read/Write methods
- void Read(ByteBuffer &data);
- @@ -734,10 +738,11 @@ class MovementInfo
- MovementFlags GetMovementFlags() const { return MovementFlags(moveFlags); }
- void SetMovementFlags(MovementFlags f) { moveFlags = f; }
- MovementFlags2 GetMovementFlags2() const { return MovementFlags2(moveFlags2); }
- + void AddMovementFlag2(MovementFlags2 f) { moveFlags2 |= f; }
- // Position manipulations
- Position const *GetPos() const { return &pos; }
- - void SetTransportData(ObjectGuid guid, float x, float y, float z, float o, uint32 time, int8 seat)
- + void SetTransportData(ObjectGuid guid, float x, float y, float z, float o, uint32 time, int8 seat, VehicleSeatEntry const* seatInfo = NULL)
- {
- t_guid = guid;
- t_pos.x = x;
- @@ -746,6 +751,7 @@ class MovementInfo
- t_pos.o = o;
- t_time = time;
- t_seat = seat;
- + t_seatInfo = seatInfo;
- }
- void ClearTransportData()
- {
- @@ -756,10 +762,13 @@ class MovementInfo
- t_pos.o = 0.0f;
- t_time = 0;
- t_seat = -1;
- + t_seatInfo = NULL;
- }
- ObjectGuid const& GetTransportGuid() const { return t_guid; }
- Position const *GetTransportPos() const { return &t_pos; }
- int8 GetTransportSeat() const { return t_seat; }
- + uint32 GetTransportDBCSeat() const { return t_seatInfo ? t_seatInfo->m_ID : 0; }
- + uint32 GetVehicleSeatFlags() const { return t_seatInfo ? t_seatInfo->m_flags : 0; }
- uint32 GetTransportTime() const { return t_time; }
- uint32 GetFallTime() const { return fallTime; }
- void ChangeOrientation(float o) { pos.o = o; }
- @@ -784,6 +793,7 @@ class MovementInfo
- Position t_pos;
- uint32 t_time;
- int8 t_seat;
- + VehicleSeatEntry const* t_seatInfo;
- uint32 t_time2;
- // swimming and flying
- float s_pitch;
- @@ -1049,6 +1059,7 @@ struct CharmInfo
- bool HasReactState(ReactStates state) { return (m_reactState == state); }
- void InitPossessCreateSpells();
- + void InitVehicleCreateSpells();
- void InitCharmCreateSpells();
- void InitPetActionBar();
- void InitEmptyActionBar();
- @@ -1306,7 +1317,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
- bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); }
- uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
- - void Mount(uint32 mount, uint32 spellId = 0);
- + void Mount(uint32 mount, uint32 spellId = 0, uint32 vehicleId = 0, uint32 creatureEntry = 0);
- void Unmount(bool from_aura = false);
- uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? GetLevelForTarget(target) : getLevel()) * 5; }
- @@ -1469,6 +1480,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
- // if used additional args in ... part then floats must explicitly casted to double
- void SendMonsterMove(float x, float y, float z, SplineType type, SplineFlags flags, uint32 Time, Player* player = NULL, ...);
- void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
- + void SendMonsterMoveTransport(WorldObject *transport, SplineType type, SplineFlags flags, uint32 moveTime, ...);
- +
- + virtual bool SetPosition(float x, float y, float z, float orientation, bool teleport = false);
- template<typename PathElem, typename PathNode>
- void SendMonsterMoveByPath(Path<PathElem,PathNode> const& path, uint32 start, uint32 end, SplineFlags flags);
- @@ -1954,6 +1968,25 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
- // Movement info
- MovementInfo m_movementInfo;
- + // Transports
- + Transport* GetTransport() const { return m_transport; }
- + void SetTransport(Transport* pTransport) { m_transport = pTransport; }
- +
- + float GetTransOffsetX() const { return m_movementInfo.GetTransportPos()->x; }
- + float GetTransOffsetY() const { return m_movementInfo.GetTransportPos()->y; }
- + float GetTransOffsetZ() const { return m_movementInfo.GetTransportPos()->z; }
- + float GetTransOffsetO() const { return m_movementInfo.GetTransportPos()->o; }
- + uint32 GetTransTime() const { return m_movementInfo.GetTransportTime(); }
- + int8 GetTransSeat() const { return m_movementInfo.GetTransportSeat(); }
- +
- + // Vehicle system
- + void EnterVehicle(VehicleKit *vehicle, int8 seatId = -1);
- + void ExitVehicle();
- + void ChangeSeat(int8 seatId, bool next = true);
- + VehicleKit* GetVehicle() const { return m_pVehicle; }
- + VehicleKit* GetVehicleKit() const { return m_pVehicleKit; }
- + bool CreateVehicleKit(uint32 vehicleId);
- + void RemoveVehicleKit();
- protected:
- explicit Unit ();
- @@ -2003,6 +2036,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
- uint32 m_regenTimer;
- uint32 m_lastManaUseTimer;
- + // Transports
- + Transport* m_transport;
- +
- + VehicleKit* m_pVehicle;
- + VehicleKit* m_pVehicleKit;
- private:
- void CleanupDeletedAuras();
- diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
- index 2e3c73b..2810828 100644
- --- a/src/game/Vehicle.cpp
- +++ b/src/game/Vehicle.cpp
- @@ -21,75 +21,366 @@
- #include "ObjectMgr.h"
- #include "Vehicle.h"
- #include "Unit.h"
- +#include "CreatureAI.h"
- #include "Util.h"
- +#include "WorldPacket.h"
- -Vehicle::Vehicle() : Creature(CREATURE_SUBTYPE_VEHICLE), m_vehicleId(0)
- +VehicleKit::VehicleKit(Unit* base, VehicleEntry const* vehicleInfo) : m_vehicleInfo(vehicleInfo), m_pBase(base), m_uiNumFreeSeats(0)
- {
- - m_updateFlag = (UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_VEHICLE);
- + for (uint32 i = 0; i < MAX_VEHICLE_SEAT; ++i)
- + {
- + uint32 seatId = m_vehicleInfo->m_seatID[i];
- +
- + if (!seatId)
- + continue;
- +
- + if(base)
- + {
- + if(m_vehicleInfo->m_flags & VEHICLE_FLAG_NO_STRAFE)
- + base->m_movementInfo.AddMovementFlag2(MOVEFLAG2_NO_STRAFE);
- +
- + if(m_vehicleInfo->m_flags & VEHICLE_FLAG_NO_JUMPING)
- + base->m_movementInfo.AddMovementFlag2(MOVEFLAG2_NO_JUMPING);
- + }
- +
- + if (VehicleSeatEntry const *seatInfo = sVehicleSeatStore.LookupEntry(seatId))
- + {
- + m_Seats.insert(std::make_pair(i, VehicleSeat(seatInfo)));
- +
- + if (seatInfo->IsUsable())
- + ++m_uiNumFreeSeats;
- + }
- + }
- }
- -Vehicle::~Vehicle()
- +VehicleKit::~VehicleKit()
- {
- }
- -void Vehicle::AddToWorld()
- +void VehicleKit::RemoveAllPassengers()
- {
- - ///- Register the vehicle for guid lookup
- - if(!IsInWorld())
- - GetMap()->GetObjectsStore().insert<Vehicle>(GetGUID(), (Vehicle*)this);
- + for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- + {
- + if (Unit *passenger = itr->second.passenger)
- + {
- + passenger->ExitVehicle();
- - Unit::AddToWorld();
- + // remove creatures of player mounts
- + if (passenger->GetTypeId() == TYPEID_UNIT)
- + passenger->AddObjectToRemoveList();
- + }
- + }
- }
- -void Vehicle::RemoveFromWorld()
- +bool VehicleKit::HasEmptySeat(int8 seatId) const
- {
- - ///- Remove the vehicle from the accessor
- - if(IsInWorld())
- - GetMap()->GetObjectsStore().erase<Vehicle>(GetGUID(), (Vehicle*)NULL);
- + SeatMap::const_iterator seat = m_Seats.find(seatId);
- - ///- Don't call the function for Creature, normal mobs + totems go in a different storage
- - Unit::RemoveFromWorld();
- + if (seat == m_Seats.end())
- + return false;
- +
- + return !seat->second.passenger;
- }
- -void Vehicle::SetDeathState(DeathState s) // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
- +Unit *VehicleKit::GetPassenger(int8 seatId) const
- {
- - Creature::SetDeathState(s);
- + SeatMap::const_iterator seat = m_Seats.find(seatId);
- +
- + if (seat == m_Seats.end())
- + return NULL;
- +
- + return seat->second.passenger;
- }
- -void Vehicle::Update( uint32 update_diff, uint32 diff)
- +int8 VehicleKit::GetNextEmptySeat(int8 seatId, bool next) const
- {
- - Creature::Update(update_diff, diff);
- + SeatMap::const_iterator seat = m_Seats.find(seatId);
- +
- + if (seat == m_Seats.end())
- + return -1;
- +
- + while (seat->second.passenger || !seat->second.seatInfo->IsUsable())
- + {
- + if (next)
- + {
- + ++seat;
- + if (seat == m_Seats.end())
- + seat = m_Seats.begin();
- + }
- + else
- + {
- + if (seat == m_Seats.begin())
- + seat = m_Seats.end();
- + --seat;
- + }
- +
- + if (seat->first == seatId)
- + return -1; // no available seat
- + }
- +
- + return seat->first;
- }
- -bool Vehicle::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, Team team)
- +bool VehicleKit::AddPassenger(Unit *passenger, int8 seatId)
- {
- - SetMap(map);
- + SeatMap::iterator seat;
- - Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);
- + if (seatId < 0) // no specific seat requirement
- + {
- + for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
- + if (!seat->second.passenger && (seat->second.seatInfo->IsUsable() || (seat->second.seatInfo->m_flags & SEAT_FLAG_UNCONTROLLED)))
- + break;
- - if(!InitEntry(Entry))
- - return false;
- + if (seat == m_Seats.end()) // no available seat
- + return false;
- + }
- + else
- + {
- + seat = m_Seats.find(seatId);
- +
- + if (seat == m_Seats.end())
- + return false;
- +
- + if (seat->second.passenger)
- + return false;
- + }
- +
- + seat->second.passenger = passenger;
- + passenger->addUnitState(UNIT_STAT_ON_VEHICLE);
- +
- + VehicleSeatEntry const *seatInfo = seat->second.seatInfo;
- - m_defaultMovementType = IDLE_MOTION_TYPE;
- + passenger->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
- + passenger->m_movementInfo.SetTransportData(m_pBase->GetGUID(),
- + seatInfo->m_attachmentOffsetX, seatInfo->m_attachmentOffsetY, seatInfo->m_attachmentOffsetZ,
- + seatInfo->m_passengerYaw, WorldTimer::getMSTime(), seat->first, seatInfo);
- - AIM_Initialize();
- + if (passenger->GetTypeId() == TYPEID_PLAYER)
- + {
- + ((Player*)passenger)->UnsummonPetTemporaryIfAny();
- - SetVehicleId(vehicleId);
- + ((Player*)passenger)->GetCamera().SetView(m_pBase);
- - SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- - SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
- + WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8+4);
- + data << passenger->GetPackGUID();
- + data << uint32((passenger->m_movementInfo.GetVehicleSeatFlags() & SEAT_FLAG_CAN_CAST) ? 2 : 0);
- + passenger->SendMessageToSet(&data, true);
- + }
- - CreatureInfo const *ci = GetCreatureInfo();
- - setFaction(team == ALLIANCE ? ci->faction_A : ci->faction_H);
- + if (seatInfo->m_flags & SEAT_FLAG_UNATTACKABLE)
- + {
- + passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + }
- - SelectLevel(ci);
- + if (seatInfo->m_flags & SEAT_FLAG_CAN_CONTROL)
- + {
- + m_pBase->StopMoving();
- + m_pBase->GetMotionMaster()->Clear();
- + m_pBase->CombatStop(true);
- + m_pBase->DeleteThreatList();
- + m_pBase->getHostileRefManager().deleteReferences();
- + m_pBase->SetCharmerGuid(passenger->GetObjectGuid());
- + m_pBase->addUnitState(UNIT_STAT_CONTROLLED);
- +
- + passenger->SetCharm(m_pBase);
- +
- + if(m_pBase->HasAuraType(SPELL_AURA_FLY) || m_pBase->HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED))
- + {
- + WorldPacket data;
- + data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
- + data << m_pBase->GetPackGUID();
- + data << (uint32)(0);
- + m_pBase->SendMessageToSet(&data,false);
- + }
- +
- + if (passenger->GetTypeId() == TYPEID_PLAYER)
- + {
- + m_pBase->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
- +
- + if (CharmInfo* charmInfo = m_pBase->InitCharmInfo(m_pBase))
- + {
- + charmInfo->InitVehicleCreateSpells();
- + charmInfo->SetReactState(REACT_PASSIVE);
- + }
- +
- + Player* player = (Player*)passenger;
- + player->SetMover(m_pBase);
- + player->SetClientControl(m_pBase, 1);
- + player->VehicleSpellInitialize();
- + }
- +
- + ((Creature*)m_pBase)->AIM_Initialize();
- +
- + if(m_pBase->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
- + {
- + WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 8+4);
- + data2 << m_pBase->GetPackGUID();
- + data2 << (uint32)(2);
- + m_pBase->SendMessageToSet(&data2,false);
- + }
- + }
- +
- + passenger->SendMonsterMoveTransport(m_pBase, SPLINETYPE_FACINGANGLE, SPLINEFLAG_UNKNOWN5, 0, 0.0f);
- +
- + RelocatePassengers(m_pBase->GetPositionX(), m_pBase->GetPositionY(), m_pBase->GetPositionZ()+0.5f, m_pBase->GetOrientation());
- +
- + UpdateFreeSeatCount();
- +
- + if (m_pBase->GetTypeId() == TYPEID_UNIT)
- + {
- + if (((Creature*)m_pBase)->AI())
- + ((Creature*)m_pBase)->AI()->PassengerBoarded(passenger, seat->first, true);
- + }
- return true;
- }
- -void Vehicle::Dismiss()
- +void VehicleKit::RemovePassenger(Unit *passenger)
- +{
- + SeatMap::iterator seat;
- +
- + for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
- + if (seat->second.passenger == passenger)
- + break;
- +
- + if (seat == m_Seats.end())
- + return;
- +
- + seat->second.passenger = NULL;
- + passenger->clearUnitState(UNIT_STAT_ON_VEHICLE);
- +
- + float px, py, pz, po;
- + m_pBase->GetClosePoint(px, py, pz, m_pBase->GetObjectBoundingRadius(), 2.0f, M_PI_F);
- + po = m_pBase->GetOrientation();
- +
- + passenger->m_movementInfo.ClearTransportData();
- + passenger->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
- +
- + if (seat->second.seatInfo->m_flags & SEAT_FLAG_UNATTACKABLE)
- + {
- + passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + }
- +
- + if (seat->second.seatInfo->m_flags & SEAT_FLAG_CAN_CONTROL)
- + {
- + passenger->SetCharm(NULL);
- + passenger->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
- +
- + m_pBase->SetCharmerGuid(ObjectGuid());
- + m_pBase->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
- + m_pBase->clearUnitState(UNIT_STAT_CONTROLLED);
- +
- + if (passenger->GetTypeId() == TYPEID_PLAYER)
- + {
- + Player* player = (Player*)passenger;
- + player->SetMover(NULL);
- + player->SetClientControl(m_pBase, 0);
- + player->RemovePetActionBar();
- + }
- +
- + ((Creature*)m_pBase)->AIM_Initialize();
- + }
- +
- + if (passenger->GetTypeId() == TYPEID_PLAYER)
- + {
- + ((Player*)passenger)->GetCamera().ResetView();
- +
- + WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4);
- + data << passenger->GetPackGUID();
- + data << uint32(2);
- + passenger->SendMessageToSet(&data, true);
- +
- + ((Player*)passenger)->ResummonPetTemporaryUnSummonedIfAny();
- + }
- + passenger->UpdateAllowedPositionZ(px, py, pz);
- + passenger->SetPosition(px, py, pz + 0.5f, po);
- + UpdateFreeSeatCount();
- +
- + if (m_pBase->GetTypeId() == TYPEID_UNIT)
- + {
- + if (((Creature*)m_pBase)->AI())
- + ((Creature*)m_pBase)->AI()->PassengerBoarded(passenger, seat->first, false);
- + }
- +
- +}
- +
- +void VehicleKit::Reset()
- +{
- + InstallAllAccessories(m_pBase->GetEntry());
- + UpdateFreeSeatCount();
- +}
- +
- +void VehicleKit::InstallAllAccessories(uint32 entry)
- +{
- + VehicleAccessoryList const* mVehicleList = sObjectMgr.GetVehicleAccessoryList(entry);
- + if (!mVehicleList)
- + return;
- +
- + for (VehicleAccessoryList::const_iterator itr = mVehicleList->begin(); itr != mVehicleList->end(); ++itr)
- + InstallAccessory(itr->uiAccessory, itr->uiSeat, itr->bMinion);
- +}
- +
- +void VehicleKit::InstallAccessory( uint32 entry, int8 seatId, bool minion)
- +{
- + if (Unit *passenger = GetPassenger(seatId))
- + {
- + // already installed
- + if (passenger->GetEntry() == entry)
- + return;
- +
- + passenger->ExitVehicle();
- + }
- +
- + if (Creature *accessory = m_pBase->SummonCreature(entry, m_pBase->GetPositionX(), m_pBase->GetPositionY(), m_pBase->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
- + {
- + accessory->SetCreatorGuid(ObjectGuid());
- + accessory->EnterVehicle(this, seatId);
- + accessory->SendHeartBeat(false);
- + }
- +}
- +
- +void VehicleKit::UpdateFreeSeatCount()
- +{
- + m_uiNumFreeSeats = 0;
- +
- + for (SeatMap::const_iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- + {
- + if (!itr->second.passenger && itr->second.seatInfo->IsUsable())
- + ++m_uiNumFreeSeats;
- + }
- +
- + uint32 flag = m_pBase->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK;
- +
- + if (m_uiNumFreeSeats)
- + m_pBase->SetFlag(UNIT_NPC_FLAGS, flag);
- + else
- + m_pBase->RemoveFlag(UNIT_NPC_FLAGS, flag);
- +}
- +
- +void VehicleKit::RelocatePassengers(float x, float y, float z, float ang)
- +{
- + for (SeatMap::const_iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- + {
- + if (Unit *passenger = itr->second.passenger)
- + {
- + float px = x + passenger->m_movementInfo.GetTransportPos()->x;
- + float py = y + passenger->m_movementInfo.GetTransportPos()->y;
- + float pz = z + passenger->m_movementInfo.GetTransportPos()->z;
- + float po = ang + passenger->m_movementInfo.GetTransportPos()->o;
- +
- + passenger->UpdateAllowedPositionZ(px, py, pz);
- + passenger->SetPosition(px, py, pz, po);
- + }
- + }
- +}
- +
- +VehicleSeatEntry const* VehicleKit::GetSeatInfo(Unit* passenger)
- {
- - SendObjectDeSpawnAnim(GetGUID());
- - CombatStop();
- - AddObjectToRemoveList();
- + for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
- + {
- + if (Unit *_passenger = itr->second.passenger)
- + if (_passenger = passenger)
- + return itr->second.seatInfo;
- + }
- + return NULL;
- }
- diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h
- index 194525b..985b6f1 100644
- --- a/src/game/Vehicle.h
- +++ b/src/game/Vehicle.h
- @@ -25,36 +25,56 @@
- #include "Unit.h"
- #include "SharedDefines.h"
- -class Vehicle : public Creature
- +struct VehicleSeat
- {
- - public:
- - explicit Vehicle();
- - virtual ~Vehicle();
- + VehicleSeat(VehicleSeatEntry const *pSeatInfo = NULL) : seatInfo(pSeatInfo), passenger(NULL) {}
- - void AddToWorld();
- - void RemoveFromWorld();
- + VehicleSeatEntry const *seatInfo;
- + Unit* passenger;
- +};
- - bool Create (uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, Team team);
- +typedef std::map<int8, VehicleSeat> SeatMap;
- - void SetDeathState(DeathState s); // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
- - void Update(uint32 update_diff, uint32 diff); // overwrite virtual Creature::Update and Unit::Update
- +struct VehicleAccessory
- +{
- + explicit VehicleAccessory(uint32 _uiAccessory, int8 _uiSeat, bool _bMinion) : uiAccessory(_uiAccessory), uiSeat(_uiSeat), bMinion(_bMinion) {}
- + uint32 uiAccessory;
- + int8 uiSeat;
- + uint32 bMinion;
- +};
- - uint32 GetVehicleId() { return m_vehicleId; }
- - void SetVehicleId(uint32 vehicleid) { m_vehicleId = vehicleid; }
- +typedef std::vector<VehicleAccessory> VehicleAccessoryList;
- +typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
- - void Dismiss();
- +class MANGOS_DLL_SPEC VehicleKit
- +{
- +public:
- + explicit VehicleKit(Unit* base, VehicleEntry const* vehicleInfo);
- + ~VehicleKit();
- - protected:
- - uint32 m_vehicleId;
- + void Reset();
- + void InstallAllAccessories(uint32 entry);
- - private:
- - void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called
- - {
- - MANGOS_ASSERT(false);
- - }
- - void DeleteFromDB() // overwrited of Creature::DeleteFromDB - don't must be called
- - {
- - MANGOS_ASSERT(false);
- - }
- + bool HasEmptySeat(int8 seatId) const;
- + Unit *GetPassenger(int8 seatId) const;
- + int8 GetNextEmptySeat(int8 seatId, bool next) const;
- + bool AddPassenger(Unit *passenger, int8 seatId = -1);
- + void RemovePassenger(Unit *passenger);
- + void RelocatePassengers(float x, float y, float z, float ang);
- + void RemoveAllPassengers();
- + VehicleSeatEntry const* GetSeatInfo(Unit* passenger);
- +
- + uint32 GetVehicleId() const { return m_vehicleInfo->m_ID; }
- + VehicleEntry const* GetVehicleInfo() const { return m_vehicleInfo; }
- + Unit* GetBase() { return m_pBase; }
- +private:
- + void UpdateFreeSeatCount();
- + void InstallAccessory(uint32 entry, int8 seatId, bool minion = true);
- +
- + SeatMap m_Seats;
- + uint32 m_uiNumFreeSeats;
- + VehicleEntry const *m_vehicleInfo;
- + Unit* m_pBase;
- };
- +
- #endif
- diff --git a/src/game/World.cpp b/src/game/World.cpp
- index cf56ec5..846b785 100644
- --- a/src/game/World.cpp
- +++ b/src/game/World.cpp
- @@ -1041,6 +1041,9 @@ void World::SetInitialWorldSettings()
- sLog.outString( ">>> Creature Addon Data loaded" );
- sLog.outString();
- + sLog.outString("Loading Vehicle Accessories...");
- + sObjectMgr.LoadVehicleAccessories();
- +
- sLog.outString( "Loading Creature Respawn Data..." ); // must be after PackInstances()
- sObjectMgr.LoadCreatureRespawnTimes();
- diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
- index 8ac7d17..067cea3 100644
- --- a/src/game/WorldSession.h
- +++ b/src/game/WorldSession.h
- @@ -469,9 +469,17 @@ class MANGOS_DLL_SPEC WorldSession
- void HandleMovementOpcodes(WorldPacket& recvPacket);
- void HandleSetActiveMoverOpcode(WorldPacket &recv_data);
- void HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data);
- - void HandleDismissControlledVehicle(WorldPacket &recv_data);
- void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data);
- + void HandleDismissControlledVehicle(WorldPacket &recv_data);
- + void HandleRequestVehicleExit(WorldPacket &recv_data);
- + void HandleRequestVehiclePrevSeat(WorldPacket &recv_data);
- + void HandleRequestVehicleNextSeat(WorldPacket &recv_data);
- + void HandleRequestVehicleSwitchSeat(WorldPacket &recv_data);
- + void HandleEnterPlayerVehicle(WorldPacket &recv_data);
- + void HandleEjectPasenger(WorldPacket &recv_data);
- + void HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data);
- +
- void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );
- void HandleGroupInviteOpcode(WorldPacket& recvPacket);
- diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp
- index c19fbd9..0da6532 100644
- --- a/src/game/debugcmds.cpp
- +++ b/src/game/debugcmds.cpp
- @@ -645,50 +645,6 @@ bool ChatHandler::HandleDebugArenaCommand(char* /*args*/)
- return true;
- }
- -bool ChatHandler::HandleDebugSpawnVehicleCommand(char* args)
- -{
- - uint32 entry;
- - if (!ExtractUInt32(&args, entry))
- - return false;
- -
- - uint32 id;
- - if (!ExtractUInt32(&args, id))
- - return false;
- -
- - CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
- - if (!ci)
- - return false;
- -
- - VehicleEntry const *ve = sVehicleStore.LookupEntry(id);
- - if (!ve)
- - return false;
- -
- - Vehicle *v = new Vehicle;
- - Map *map = m_session->GetPlayer()->GetMap();
- - if (!v->Create(map->GenerateLocalLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam()))
- - {
- - delete v;
- - return false;
- - }
- -
- - float px, py, pz;
- - m_session->GetPlayer()->GetClosePoint(px, py, pz, m_session->GetPlayer()->GetObjectBoundingRadius());
- -
- - v->Relocate(px, py, pz, m_session->GetPlayer()->GetOrientation());
- -
- - if (!v->IsPositionValid())
- - {
- - sLog.outError("Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
- - v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY());
- - delete v;
- - return false;
- - }
- -
- - map->Add((Creature*)v);
- -
- - return true;
- -}
- -
- bool ChatHandler::HandleDebugSpellCheckCommand(char* /*args*/)
- {
- sLog.outString( "Check expected in code spell properties base at table 'spell_check' content...");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement