Advertisement
Guest User

vehicles for mangos 11119

a guest
Feb 8th, 2011
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 190.85 KB | None | 0 0
  1. diff --git a/sql/vehicle_accesory.sql b/sql/vehicle_accesory.sql
  2. new file mode 100644
  3. index 0000000..239ee7c
  4. --- /dev/null
  5. +++ b/sql/vehicle_accesory.sql
  6. @@ -0,0 +1,64 @@
  7. +/*
  8. +author: traponinet (remake from TC).
  9. +*/
  10. +
  11. +DROP TABLE IF EXISTS `vehicle_accessory`;
  12. +CREATE TABLE `vehicle_accessory` (
  13. +  `entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
  14. +  `accessory_entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
  15. +  `seat_id` tinyint(1) NOT NULL DEFAULT '0',
  16. +  `minion` tinyint(1) unsigned NOT NULL DEFAULT '0',
  17. +  `description` text NOT NULL,
  18. +  PRIMARY KEY (`entry`,`seat_id`)
  19. +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Vehicle Accessory System';
  20. +
  21. +INSERT INTO `vehicle_accessory`(`entry`,`accessory_entry`,`seat_id`,`minion`,`description`) VALUES
  22. +(36891,31260,0,0,'Ymirjar Skycaller'),
  23. +(27626,27627,0,1,'Tatjana\'s Horse'),
  24. +(28312,28319,7,1,'Wintergrasp Siege Engine'),
  25. +(32627,32629,7,1,'Wintergrasp Siege Engine'),
  26. +(32930,32933,0,1,'Kologarn'),
  27. +(32930,32934,1,1,'Kologarn'),
  28. +(33109,33167,1,1,'Salvaged Demolisher'),
  29. +(33109,33620,2,1,'Salvaged Demolisher'),
  30. +(33060,33067,7,1,'Salvaged Siege Engine'),
  31. +(29931,29982,0,0,'Drakkari Rider on Drakkari Rhino'),
  32. +(33113,33114,2,1,'Flame Leviathan'),
  33. +(33113,33114,3,1,'Flame Leviathan'),
  34. +(33113,33139,7,1,'Flame Leviathan'),
  35. +(33114,33142,1,1,'Overload Control Device'),
  36. +(33114,33143,2,1,'Leviathan Defense Turret'),
  37. +(36678,38309,0,1,'Professor Putricide - trigger'),
  38. +(33214,33218,1,1,'Mechanolift 304-A'),
  39. +(35637,34705,0,0,'Marshal Jacob Alerius\' Mount'),
  40. +(35633,34702,0,0,'Ambrose Boltspark\'s Mount'),
  41. +(35768,34701,0,0,'Colosos\' Mount'),
  42. +(34658,34657,0,0,'Jaelyne Evensong\'s Mount'),
  43. +(35636,34703,0,0,'Lana Stouthammer\'s Mount'),
  44. +(35638,35572,0,0,'Mokra the Skullcrusher\'s Mount'),
  45. +(35635,35569,0,0,'Eressea Dawnsinger\'s Mount'),
  46. +(35640,35571,0,0,'Runok Wildmane\'s Mount'),
  47. +(35641,35570,0,0,'Zul\'tore\'s Mount'),
  48. +(35634,35617,0,0,'Deathstalker Visceri\'s Mount'),
  49. +(27241,27268,0,0,'Risen Gryphon'),
  50. +(27661,27662,0,0,'Wintergarde Gryphon'),
  51. +(29698,29699,0,0,'Drakuru Raptor'),
  52. +(33778,33780,0,1,'Tournament Hippogryph'),
  53. +(33687,33695,0,1,'Chillmaw'),
  54. +(33687,33695,1,1,'Chillmaw'),
  55. +(33687,33695,2,1,'Chillmaw'),
  56. +(29625,29694,0,0,'Hyldsmeet Proto-Drake'),
  57. +(30330,30332,0,0,'Jotunheim Proto-Drake'),
  58. +(32189,32190,0,0,'Skybreaker Recon Fighter'),
  59. +(36678,38308,1,1,'Professor Putricide - trigger'),
  60. +(32640,32642,1,0,'Traveler Mammoth (H) - Vendor'),
  61. +(32640,32641,2,0,'Traveler Mammoth (H) - Vendor & Repairer'),
  62. +(32633,32638,1,0,'Traveler Mammoth (A) - Vendor'),
  63. +(32633,32639,2,0,'Traveler Mammoth (A) - Vendor & Repairer'),
  64. +(33669,33666,0,0,'Demolisher Engineer Blastwrench'),
  65. +(29555,29556,0,0,'Goblin Sapper'),
  66. +(28018,28006,0,1,'Thiassi the Light Bringer'),
  67. +(28054,28053,0,0,'Lucky Wilhelm - Apple'),
  68. +(28614,28616,0,1,'Scarlet Gryphon Rider'),
  69. +(36476,36477,0,0,'Krick on Ick'),
  70. +(29433,29440,0,0,'Goblin Sapper in K3');
  71. diff --git a/sql/vehicle_data.sql b/sql/vehicle_data.sql
  72. new file mode 100644
  73. index 0000000..62667af
  74. --- /dev/null
  75. +++ b/sql/vehicle_data.sql
  76. @@ -0,0 +1,489 @@
  77. +/*
  78. +author: zergtmn. developed by rsa
  79. +HUGE THANKS FOR BOTH OF THEM !!!
  80. +*/
  81. +ALTER TABLE creature_template
  82. +  ADD COLUMN `spell5` mediumint(8) unsigned NOT NULL default '0' AFTER `spell4`,
  83. +  ADD COLUMN `spell6` mediumint(8) unsigned NOT NULL default '0' AFTER `spell5`,
  84. +  ADD COLUMN `spell7` mediumint(8) unsigned NOT NULL default '0' AFTER `spell6`,
  85. +  ADD COLUMN `spell8` mediumint(8) unsigned NOT NULL default '0' AFTER `spell7`,
  86. +  ADD COLUMN `VehicleId` mediumint(8) unsigned NOT NULL default '0' AFTER `PetSpellDataId`,
  87. +  ADD COLUMN `PowerType` tinyint(3) unsigned NOT NULL default '0' AFTER `MaxHealth`;
  88. +
  89. +-- Known vehicles from zergtmn
  90. +#UPDATE `creature_template` SET `VehicleId` = 0;
  91. +--
  92. +UPDATE `creature_template` SET `VehicleId` = 23 WHERE `entry` = 23693;
  93. +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 24083;
  94. +UPDATE `creature_template` SET `VehicleId` = 8 WHERE `entry` = 24418;
  95. +UPDATE `creature_template` SET `VehicleId` = 16 WHERE `entry` = 24705;
  96. +UPDATE `creature_template` SET `VehicleId` = 17 WHERE `entry` = 24750;
  97. +UPDATE `creature_template` SET `VehicleId` = 26 WHERE `entry` = 25334;
  98. +UPDATE `creature_template` SET `VehicleId` = 29 WHERE `entry` = 25596;
  99. +UPDATE `creature_template` SET `VehicleId` = 72 WHERE `entry` = 25743;
  100. +UPDATE `creature_template` SET `VehicleId` = 27 WHERE `entry` = 25762;
  101. +UPDATE `creature_template` SET `VehicleId` = 30 WHERE `entry` = 25968;
  102. +UPDATE `creature_template` SET `VehicleId` = 62 WHERE `entry` = 26472;
  103. +UPDATE `creature_template` SET `VehicleId` = 36 WHERE `entry` = 26523;
  104. +UPDATE `creature_template` SET `VehicleId` = 33 WHERE `entry` = 26525;
  105. +UPDATE `creature_template` SET `VehicleId` = 34 WHERE `entry` = 26572;
  106. +UPDATE `creature_template` SET `VehicleId` = 53 WHERE `entry` = 26590;
  107. +UPDATE `creature_template` SET `VehicleId` = 37 WHERE `entry` = 26777;
  108. +UPDATE `creature_template` SET `VehicleId` = 38 WHERE `entry` = 26778;
  109. +UPDATE `creature_template` SET `VehicleId` = 40 WHERE `entry` = 26893;
  110. +UPDATE `creature_template` SET `VehicleId` = 53 WHERE `entry` = 27131;
  111. +UPDATE `creature_template` SET `VehicleId` = 43 WHERE `entry` = 27213;
  112. +UPDATE `creature_template` SET `VehicleId` = 48 WHERE `entry` = 27241;
  113. +UPDATE `creature_template` SET `VehicleId` = 44 WHERE `entry` = 27258;
  114. +UPDATE `creature_template` SET `VehicleId` = 50 WHERE `entry` = 27261;
  115. +UPDATE `creature_template` SET `VehicleId` = 46 WHERE `entry` = 27270;
  116. +UPDATE `creature_template` SET `VehicleId` = 50 WHERE `entry` = 27292;
  117. +UPDATE `creature_template` SET `VehicleId` = 49 WHERE `entry` = 27354;
  118. +UPDATE `creature_template` SET `VehicleId` = 55 WHERE `entry` = 27496;
  119. +UPDATE `creature_template` SET `VehicleId` = 56 WHERE `entry` = 27587;
  120. +UPDATE `creature_template` SET `VehicleId` = 57 WHERE `entry` = 27593;
  121. +UPDATE `creature_template` SET `VehicleId` = 59 WHERE `entry` = 27626;
  122. +UPDATE `creature_template` SET `VehicleId` = 60 WHERE `entry` = 27629;
  123. +UPDATE `creature_template` SET `VehicleId` = 61 WHERE `entry` = 27661;
  124. +UPDATE `creature_template` SET `VehicleId` = 154 WHERE `entry` = 27671;
  125. +UPDATE `creature_template` SET `VehicleId` = 68 WHERE `entry` = 27714;
  126. +UPDATE `creature_template` SET `VehicleId` = 70 WHERE `entry` = 27755;
  127. +UPDATE `creature_template` SET `VehicleId` = 256 WHERE `entry` = 27761;
  128. +UPDATE `creature_template` SET `VehicleId` = 68 WHERE `entry` = 27839;
  129. +UPDATE `creature_template` SET `VehicleId` = 79 WHERE `entry` = 27881;
  130. +UPDATE `creature_template` SET `VehicleId` = 160 WHERE `entry` = 27894;
  131. +UPDATE `creature_template` SET `VehicleId` = 89 WHERE `entry` = 27924;
  132. +UPDATE `creature_template` SET `VehicleId` = 97 WHERE `entry` = 27992;
  133. +UPDATE `creature_template` SET `VehicleId` = 97 WHERE `entry` = 27993;
  134. +UPDATE `creature_template` SET `VehicleId` = 99 WHERE `entry` = 27996;
  135. +UPDATE `creature_template` SET `VehicleId` = 105 WHERE `entry` = 28009;
  136. +UPDATE `creature_template` SET `VehicleId` = 100 WHERE `entry` = 28018;
  137. +UPDATE `creature_template` SET `VehicleId` = 102 WHERE `entry` = 28054;
  138. +UPDATE `creature_template` SET `VehicleId` = 106 WHERE `entry` = 28094;
  139. +UPDATE `creature_template` SET `VehicleId` = 110 WHERE `entry` = 28192;
  140. +UPDATE `creature_template` SET `VehicleId` = 117 WHERE `entry` = 28312;
  141. +UPDATE `creature_template` SET `VehicleId` = 116 WHERE `entry` = 28319;
  142. +UPDATE `creature_template` SET `VehicleId` = 244 WHERE `entry` = 28366;
  143. +UPDATE `creature_template` SET `VehicleId` = 200 WHERE `entry` = 28605;
  144. +UPDATE `creature_template` SET `VehicleId` = 123 WHERE `entry` = 28606;
  145. +UPDATE `creature_template` SET `VehicleId` = 200 WHERE `entry` = 28607;
  146. +UPDATE `creature_template` SET `VehicleId` = 124 WHERE `entry` = 28614;
  147. +UPDATE `creature_template` SET `VehicleId` = 156 WHERE `entry` = 28670;
  148. +UPDATE `creature_template` SET `VehicleId` = 158 WHERE `entry` = 28781;
  149. +UPDATE `creature_template` SET `VehicleId` = 145 WHERE `entry` = 28851;
  150. +UPDATE `creature_template` SET `VehicleId` = 68 WHERE `entry` = 28887;
  151. +UPDATE `creature_template` SET `VehicleId` = 153 WHERE `entry` = 29043;
  152. +UPDATE `creature_template` SET `VehicleId` = 25 WHERE `entry` = 29144;
  153. +UPDATE `creature_template` SET `VehicleId` = 166 WHERE `entry` = 29414;
  154. +UPDATE `creature_template` SET `VehicleId` = 168 WHERE `entry` = 29433;
  155. +UPDATE `creature_template` SET `VehicleId` = 190 WHERE `entry` = 29679;
  156. +UPDATE `creature_template` SET `VehicleId` = 192 WHERE `entry` = 29691;
  157. +UPDATE `creature_template` SET `VehicleId` = 193 WHERE `entry` = 29698;
  158. +UPDATE `creature_template` SET `VehicleId` = 207 WHERE `entry` = 29753;
  159. +UPDATE `creature_template` SET `VehicleId` = 202 WHERE `entry` = 29857;
  160. +UPDATE `creature_template` SET `VehicleId` = 208 WHERE `entry` = 29918;
  161. +UPDATE `creature_template` SET `VehicleId` = 318 WHERE `entry` = 29929;
  162. +UPDATE `creature_template` SET `VehicleId` = 196 WHERE `entry` = 30013;
  163. +UPDATE `creature_template` SET `VehicleId` = 213 WHERE `entry` = 30066;
  164. +UPDATE `creature_template` SET `VehicleId` = 222 WHERE `entry` = 30174;
  165. +UPDATE `creature_template` SET `VehicleId` = 225 WHERE `entry` = 30204;
  166. +UPDATE `creature_template` SET `VehicleId` = 234 WHERE `entry` = 30228;
  167. +UPDATE `creature_template` SET `VehicleId` = 233 WHERE `entry` = 30275;
  168. +UPDATE `creature_template` SET `VehicleId` = 177 WHERE `entry` = 30320;
  169. +UPDATE `creature_template` SET `VehicleId` = 228 WHERE `entry` = 30330;
  170. +UPDATE `creature_template` SET `VehicleId` = 229 WHERE `entry` = 30337;
  171. +UPDATE `creature_template` SET `VehicleId` = 245 WHERE `entry` = 30342;
  172. +UPDATE `creature_template` SET `VehicleId` = 230 WHERE `entry` = 30343;
  173. +UPDATE `creature_template` SET `VehicleId` = 236 WHERE `entry` = 30403;
  174. +UPDATE `creature_template` SET `VehicleId` = 242 WHERE `entry` = 30470;
  175. +UPDATE `creature_template` SET `VehicleId` = 247 WHERE `entry` = 30564;
  176. +UPDATE `creature_template` SET `VehicleId` = 248 WHERE `entry` = 30585;
  177. +UPDATE `creature_template` SET `VehicleId` = 250 WHERE `entry` = 30645;
  178. +UPDATE `creature_template` SET `VehicleId` = 262 WHERE `entry` = 31125;
  179. +UPDATE `creature_template` SET `VehicleId` = 270 WHERE `entry` = 31137;
  180. +UPDATE `creature_template` SET `VehicleId` = 263 WHERE `entry` = 31139;
  181. +UPDATE `creature_template` SET `VehicleId` = 265 WHERE `entry` = 31224;
  182. +UPDATE `creature_template` SET `VehicleId` = 267 WHERE `entry` = 31262;
  183. +UPDATE `creature_template` SET `VehicleId` = 279 WHERE `entry` = 31583;
  184. +UPDATE `creature_template` SET `VehicleId` = 280 WHERE `entry` = 31641;
  185. +UPDATE `creature_template` SET `VehicleId` = 109 WHERE `entry` = 31689;
  186. +UPDATE `creature_template` SET `VehicleId` = 284 WHERE `entry` = 31702;
  187. +UPDATE `creature_template` SET `VehicleId` = 174 WHERE `entry` = 31722;
  188. +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 31857;
  189. +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 31858;
  190. +UPDATE `creature_template` SET `VehicleId` = 315 WHERE `entry` = 31861;
  191. +UPDATE `creature_template` SET `VehicleId` = 315 WHERE `entry` = 31862;
  192. +UPDATE `creature_template` SET `VehicleId` = 290 WHERE `entry` = 31881;
  193. +UPDATE `creature_template` SET `VehicleId` = 291 WHERE `entry` = 31884;
  194. +UPDATE `creature_template` SET `VehicleId` = 294 WHERE `entry` = 32189;
  195. +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 32212;
  196. +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 32213;
  197. +UPDATE `creature_template` SET `VehicleId` = 298 WHERE `entry` = 32225;
  198. +UPDATE `creature_template` SET `VehicleId` = 318 WHERE `entry` = 32286;
  199. +UPDATE `creature_template` SET `VehicleId` = 113 WHERE `entry` = 32323;
  200. +UPDATE `creature_template` SET `VehicleId` = 304 WHERE `entry` = 32490;
  201. +UPDATE `creature_template` SET `VehicleId` = 165 WHERE `entry` = 32535;
  202. +UPDATE `creature_template` SET `VehicleId` = 324 WHERE `entry` = 32627;
  203. +UPDATE `creature_template` SET `VehicleId` = 116 WHERE `entry` = 32629;
  204. +UPDATE `creature_template` SET `VehicleId` = 312 WHERE `entry` = 32633;
  205. +UPDATE `creature_template` SET `VehicleId` = 313 WHERE `entry` = 32640;
  206. +UPDATE `creature_template` SET `VehicleId` = 160 WHERE `entry` = 32795;
  207. +UPDATE `creature_template` SET `VehicleId` = 158 WHERE `entry` = 32796;
  208. +UPDATE `creature_template` SET `VehicleId` = 328 WHERE `entry` = 32930;
  209. +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 32934;
  210. +UPDATE `creature_template` SET `VehicleId` = 336 WHERE `entry` = 33060;
  211. +UPDATE `creature_template` SET `VehicleId` = 335 WHERE `entry` = 33062;
  212. +UPDATE `creature_template` SET `VehicleId` = 337 WHERE `entry` = 33067;
  213. +UPDATE `creature_template` SET `VehicleId` = 338 WHERE `entry` = 33109;
  214. +UPDATE `creature_template` SET `VehicleId` = 387 WHERE `entry` = 33113;
  215. +UPDATE `creature_template` SET `VehicleId` = 341 WHERE `entry` = 33114;
  216. +UPDATE `creature_template` SET `VehicleId` = 342 WHERE `entry` = 33118;
  217. +UPDATE `creature_template` SET `VehicleId` = 345 WHERE `entry` = 33167;
  218. +UPDATE `creature_template` SET `VehicleId` = 348 WHERE `entry` = 33214;
  219. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33217;
  220. +UPDATE `creature_template` SET `VehicleId` = 353 WHERE `entry` = 33293;
  221. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33319;
  222. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33321;
  223. +UPDATE `creature_template` SET `VehicleId` = 368 WHERE `entry` = 33513;
  224. +UPDATE `creature_template` SET `VehicleId` = 372 WHERE `entry` = 33669;
  225. +UPDATE `creature_template` SET `VehicleId` = 375 WHERE `entry` = 33687;
  226. +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 33778;
  227. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33844;
  228. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE `entry` = 33845;
  229. +UPDATE `creature_template` SET `VehicleId` = 390 WHERE `entry` = 34120;
  230. +UPDATE `creature_template` SET `VehicleId` = 397 WHERE `entry` = 34161;
  231. +UPDATE `creature_template` SET `VehicleId` = 430 WHERE `entry` = 34658;
  232. +UPDATE `creature_template` SET `VehicleId` = 477 WHERE `entry` = 34703;
  233. +UPDATE `creature_template` SET `VehicleId` = 509 WHERE `entry` = 34775;
  234. +UPDATE `creature_template` SET `VehicleId` = 438 WHERE `entry` = 34793;
  235. +UPDATE `creature_template` SET `VehicleId` = 442 WHERE `entry` = 34796;
  236. +UPDATE `creature_template` SET `VehicleId` = 446 WHERE `entry` = 34826;
  237. +UPDATE `creature_template` SET `VehicleId` = 452 WHERE `entry` = 34929;
  238. +UPDATE `creature_template` SET `VehicleId` = 453 WHERE `entry` = 34935;
  239. +UPDATE `creature_template` SET `VehicleId` = 510 WHERE `entry` = 34944;
  240. +UPDATE `creature_template` SET `VehicleId` = 447 WHERE `entry` = 35273;
  241. +UPDATE `creature_template` SET `VehicleId` = 107 WHERE `entry` = 35373;
  242. +UPDATE `creature_template` SET `VehicleId` = 487 WHERE `entry` = 35474;
  243. +UPDATE `creature_template` SET `VehicleId` = 107 WHERE `entry` = 35491;
  244. +UPDATE `creature_template` SET `VehicleId` = 477 WHERE `entry` = 35572;
  245. +UPDATE `creature_template` SET `VehicleId` = 478 WHERE `entry` = 35633;
  246. +UPDATE `creature_template` SET `VehicleId` = 479 WHERE `entry` = 35634;
  247. +UPDATE `creature_template` SET `VehicleId` = 481 WHERE `entry` = 35636;
  248. +UPDATE `creature_template` SET `VehicleId` = 482 WHERE `entry` = 35637;
  249. +UPDATE `creature_template` SET `VehicleId` = 483 WHERE `entry` = 35638;
  250. +UPDATE `creature_template` SET `VehicleId` = 484 WHERE `entry` = 35640;
  251. +UPDATE `creature_template` SET `VehicleId` = 529 WHERE `entry` = 35644;
  252. +UPDATE `creature_template` SET `VehicleId` = 489 WHERE `entry` = 35768;
  253. +UPDATE `creature_template` SET `VehicleId` = 655 WHERE `entry` = 35819;
  254. +UPDATE `creature_template` SET `VehicleId` = 436 WHERE `entry` = 36356;
  255. +UPDATE `creature_template` SET `VehicleId` = 522 WHERE `entry` = 36476;
  256. +UPDATE `creature_template` SET `VehicleId` = 529 WHERE `entry` = 36559;
  257. +UPDATE `creature_template` SET `VehicleId` = 535 WHERE `entry` = 36661;
  258. +UPDATE `creature_template` SET `VehicleId` = 551 WHERE `entry` = 36794;
  259. +UPDATE `creature_template` SET `VehicleId` = 554 WHERE `entry` = 36838;
  260. +UPDATE `creature_template` SET `VehicleId` = 560 WHERE `entry` = 36891;
  261. +UPDATE `creature_template` SET `VehicleId` = 562 WHERE `entry` = 36896;
  262. +UPDATE `creature_template` SET `VehicleId` = 622 WHERE `entry` = 37120;
  263. +UPDATE `creature_template` SET `VehicleId` = 611 WHERE `entry` = 37968;
  264. +UPDATE `creature_template` SET `VehicleId` = 636 WHERE `entry` = 38500;
  265. +
  266. +-- Mechano-hog, Mekgineer's Chopper
  267. +UPDATE `creature_template` SET `VehicleId` = 318, IconName = 'vehichleCursor' WHERE `entry` IN (29929, 32286);
  268. +-- Traveler's Tundra Mammoth
  269. +-- Grand Ice Mammoth
  270. +-- Grand Black War Mammoth
  271. +-- Grand Caravan Mammoth
  272. +UPDATE `creature_template` SET `VehicleId` = 312, IconName = 'vehichleCursor' WHERE `entry` IN (32633, 32640, 31857, 31858, 31861, 31862, 32212, 32213);
  273. +-- X-53 Touring Rocket
  274. +UPDATE `creature_template` SET `VehicleId` = 774, IconName = 'vehichleCursor' WHERE `entry` = 40725;
  275. +
  276. +# Sniffed by zergtmn
  277. +UPDATE `creature_template` SET `VehicleId` = 328 WHERE `entry` = 32930;
  278. +UPDATE `creature_template` SET `VehicleId` = 380 WHERE `entry` = 32934;
  279. +UPDATE `creature_template` SET `VehicleId` = 336 WHERE `entry` = 33060;
  280. +UPDATE `creature_template` SET `VehicleId` = 335 WHERE `entry` = 33062;
  281. +UPDATE `creature_template` SET `VehicleId` = 337 WHERE `entry` = 33067;
  282. +UPDATE `creature_template` SET `VehicleId` = 347 WHERE `entry` = 33108;
  283. +UPDATE `creature_template` SET `VehicleId` = 338 WHERE `entry` = 33109;
  284. +UPDATE `creature_template` SET `VehicleId` = 387 WHERE `entry` = 33113;
  285. +UPDATE `creature_template` SET `VehicleId` = 341 WHERE `entry` = 33114;
  286. +UPDATE `creature_template` SET `VehicleId` = 342 WHERE `entry` = 33118;
  287. +UPDATE `creature_template` SET `VehicleId` = 345 WHERE `entry` = 33167;
  288. +UPDATE `creature_template` SET `VehicleId` = 348 WHERE `entry` = 33214;
  289. +UPDATE `creature_template` SET `VehicleId` = 381 WHERE `entry` = 33288;
  290. +UPDATE `creature_template` SET `VehicleId` = 353 WHERE `entry` = 33293;
  291. +UPDATE `creature_template` SET `VehicleId` = 356 WHERE `entry` = 33364;
  292. +UPDATE `creature_template` SET `VehicleId` = 357 WHERE `entry` = 33366;
  293. +UPDATE `creature_template` SET `VehicleId` = 358 WHERE `entry` = 33369;
  294. +UPDATE `creature_template` SET `VehicleId` = 371 WHERE `entry` = 33651;
  295. +UPDATE `creature_template` SET `VehicleId` = 372 WHERE `entry` = 33669;
  296. +UPDATE `creature_template` SET `VehicleId` = 108 WHERE `entry` = 33778;
  297. +UPDATE `creature_template` SET `VehicleId` = 385 WHERE `entry` = 33983;
  298. +UPDATE `creature_template` SET `VehicleId` = 390 WHERE `entry` = 34120;
  299. +UPDATE `creature_template` SET `VehicleId` = 392 WHERE `entry` = 34146;
  300. +UPDATE `creature_template` SET `VehicleId` = 395 WHERE `entry` = 34150;
  301. +UPDATE `creature_template` SET `VehicleId` = 396 WHERE `entry` = 34151;
  302. +UPDATE `creature_template` SET `VehicleId` = 397 WHERE `entry` = 34161;
  303. +UPDATE `creature_template` SET `VehicleId` = 399 WHERE `entry` = 34183;
  304. +
  305. +UPDATE `creature_template` SET `VehicleId` = 143 WHERE `entry` = 28864; -- Scourge Gryphon
  306. +UPDATE `creature_template` SET `VehicleId` = 123 WHERE `entry` = 28605; -- Havenshire Stallion
  307. +UPDATE `creature_template` SET `VehicleId` = 135 WHERE `entry` = 28782; -- Acherus Deathcharger
  308. +UPDATE `creature_template` SET `VehicleId` = 138 WHERE `entry` = 28817; -- Mine Car
  309. +UPDATE `creature_template` SET `VehicleId` = 139 WHERE `entry` = 28833; -- Scarlet Cannon
  310. +
  311. +UPDATE `creature_template` SET `VehicleId` = 370 WHERE `entry` = 33432; -- Leviathan Mk II
  312. +UPDATE `creature_template` SET `VehicleId` = 373 WHERE `entry` = 33670; -- Aerial Command Unit
  313. +
  314. +UPDATE `creature_template` SET `VehicleId` = 736 WHERE `entry` = 40305; -- Spirit of the Tiger
  315. +
  316. +#
  317. +UPDATE `creature_template` SET `VehicleId` = 220 WHERE `entry` = 30161;
  318. +UPDATE `creature_template` SET `VehicleId` = 224 WHERE `entry` = 30234;
  319. +UPDATE `creature_template` SET `VehicleId` = 223 WHERE `entry` = 30248;
  320. +
  321. +-- fom Burned
  322. +UPDATE creature_template SET IconName="vehichleCursor" WHERE entry IN
  323. +(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,
  324. +29857,29903,30021,30066,30108,30123,30124,30134,30228,30234,30248,30272,30403,30500,31070,31407,
  325. +31408,31409,31717,31736,31770,31840,31856,31858,31884,32152,32158,32227,32286,32370,32640,33782);
  326. +
  327. +UPDATE creature_template SET IconName="Gunner" WHERE entry IN
  328. +(28319,28366,28833,30236,32629,33067,33080,33139,33264,34111);
  329. +
  330. +-- From Timmit
  331. +-- bone spike
  332. +UPDATE `creature_template` SET `VehicleId` = 647 WHERE `entry` IN (38711,38970,38971,38972);
  333. +UPDATE `creature_template` SET `VehicleId` = 533 WHERE `entry` IN (36619,38233,38459,38460);
  334. +
  335. +-- Putricide
  336. +UPDATE `creature_template` SET `VehicleId` = 587 WHERE `entry` IN (36678,38431,38585,38586);
  337. +UPDATE `creature_template` SET `VehicleId` = 591 WHERE `entry` IN (37672,38605,38786,38787);
  338. +
  339. +# full fix
  340. +UPDATE `creature_template` SET `IconName` = 'vehichleCursor' WHERE `VehicleId` > 0 AND `IconName` IS NULL;
  341. +
  342. +# spellclicks
  343. +-- from zergtmn
  344. +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (33109, 33062, 33060);
  345. +INSERT INTO `npc_spellclick_spells` VALUES
  346. +(33109, 62309, 0, 0, 0, 1),  -- Demolisher
  347. +(33062, 65030, 0, 0, 0, 1),  -- Chopper
  348. +(33060, 65031, 0, 0, 0, 1);  -- Siege engine
  349. +
  350. +-- vehicle spells
  351. +
  352. +-- from me
  353. +-- chopper
  354. +UPDATE `creature_template` SET `IconName` = 'vehichleCursor', `PowerType` = 3,
  355. +`spell1` = 62974, `spell2` = 62286, `spell3` = 62299, `spell4` = 64660, `AIName` = 'NullAI'
  356. +WHERE `entry` IN (33062);
  357. +-- Siege engine
  358. +UPDATE `creature_template` SET `IconName` = 'Gunner',  `PowerType` = 3,
  359. +`spell1` = 62345, `spell2` = 62522, `spell3` = 62346, `AIName` = 'NullAI'
  360. +WHERE `entry` IN (33060);
  361. +-- demolisher
  362. +UPDATE `creature_template` SET `IconName` = 'vehichleCursor', `PowerType` = 3,
  363. +`spell1` = 62306, `spell2` = 62490, `spell3` = 62308, `spell4` =  62324, `AIName` = 'NullAI'
  364. +WHERE `entry` IN (33109);
  365. +
  366. +-- from traponinet
  367. +
  368. +-- Salvaged Siege Turret
  369. +UPDATE `creature_template` SET `PowerType`=3,spell1=62358,spell2=62359,spell3=64677,spell4=0,spell5=0,spell6=0 WHERE `entry`=33067;
  370. +
  371. +-- Salvaged Demolisher Mechanic Seat
  372. +UPDATE `creature_template` SET `PowerType`=3,spell1=62634,spell2=64979,spell3=62479,spell4=62471,spell5=0,spell6=62428 WHERE `entry`=33167;
  373. +
  374. +-- Earthen Stoneshaper
  375. +UPDATE `creature_template` SET `unit_flags`=33587968 WHERE `entry`=33620;
  376. +
  377. +-- from Lordron
  378. +-- Spectral tiger
  379. +UPDATE `creature_template` SET `VehicleId` = 354 WHERE `entry` = 33357;
  380. +-- Shalewing
  381. +UPDATE `creature_template` SET `VehicleId` = 146 WHERE `entry` = 28875;
  382. +-- Drakkari Skullcrusher
  383. +UPDATE `creature_template` SET `VehicleId` = 774 WHERE `entry` = 28844;
  384. +-- ICC
  385. +UPDATE `creature_template` SET `vehicleId` = 531 WHERE `entry` IN (36598);
  386. +UPDATE `creature_template` SET `vehicleId` = 532 WHERE `entry` IN (36609,39120,39121,39122);
  387. +
  388. +-- from YTDB/TC 570
  389. +UPDATE `creature_template` SET `VehicleId` = 51  WHERE  `entry` = 27409;
  390. +UPDATE `creature_template` SET `VehicleId` = 107 WHERE  `entry` = 28135;
  391. +UPDATE `creature_template` SET `VehicleId` = 206 WHERE  `entry` = 28379;
  392. +UPDATE `creature_template` SET `VehicleId` = 121 WHERE  `entry` = 28468;
  393. +UPDATE `creature_template` SET `VehicleId` = 492 WHERE  `entry` = 25765;
  394. +UPDATE `creature_template` SET `VehicleId` = 25  WHERE  `entry` = 27516;
  395. +UPDATE `creature_template` SET `VehicleId` = 156 WHERE  `entry` = 26788;
  396. +UPDATE `creature_template` SET `VehicleId` = 129 WHERE  `entry` = 28710;
  397. +UPDATE `creature_template` SET `VehicleId` = 25  WHERE  `entry` = 28446;
  398. +UPDATE `creature_template` SET `VehicleId` = 22  WHERE  `entry` = 24825;
  399. +UPDATE `creature_template` SET `VehicleId` = 22  WHERE  `entry` = 24821;
  400. +UPDATE `creature_template` SET `VehicleId` = 22  WHERE  `entry` = 24823;
  401. +UPDATE `creature_template` SET `VehicleId` = 22  WHERE  `entry` = 24806;
  402. +UPDATE `creature_template` SET `VehicleId` = 200 WHERE  `entry` = 26191;
  403. +UPDATE `creature_template` SET `VehicleId` = 113 WHERE  `entry` = 28246;
  404. +UPDATE `creature_template` SET `VehicleId` = 156 WHERE  `entry` = 27850;
  405. +UPDATE `creature_template` SET `VehicleId` = 156 WHERE  `entry` = 27838;
  406. +UPDATE `creature_template` SET `VehicleId` = 30  WHERE  `entry` = 25881;
  407. +UPDATE `creature_template` SET `VehicleId` = 156 WHERE  `entry` = 26807;
  408. +UPDATE `creature_template` SET `VehicleId` = 34  WHERE  `entry` = 26585;
  409. +UPDATE `creature_template` SET `VehicleId` = 39  WHERE  `entry` = 26813;
  410. +UPDATE `creature_template` SET `VehicleId` = 127 WHERE  `entry` = 28669;
  411. +UPDATE `creature_template` SET `VehicleId` = 203 WHERE  `entry` = 29863;
  412. +UPDATE `creature_template` SET `VehicleId` = 200 WHERE  `entry` = 27883;
  413. +UPDATE `creature_template` SET `VehicleId` = 111 WHERE  `entry` = 28222;
  414. +UPDATE `creature_template` SET `VehicleId` = 115 WHERE  `entry` = 28308;
  415. +UPDATE `creature_template` SET `VehicleId` = 191 WHERE  `entry` = 29306;
  416. +UPDATE `creature_template` SET `VehicleId` = 176 WHERE  `entry` = 29351;
  417. +UPDATE `creature_template` SET `VehicleId` = 177 WHERE  `entry` = 29358;
  418. +UPDATE `creature_template` SET `VehicleId` = 165 WHERE  `entry` = 29403;
  419. +UPDATE `creature_template` SET `VehicleId` = 169 WHERE  `entry` = 29460;
  420. +UPDATE `creature_template` SET `VehicleId` = 173 WHERE  `entry` = 29500;
  421. +UPDATE `creature_template` SET `VehicleId` = 175 WHERE  `entry` = 29555;
  422. +UPDATE `creature_template` SET `VehicleId` = 179 WHERE  `entry` = 29579;
  423. +UPDATE `creature_template` SET `VehicleId` = 181 WHERE  `entry` = 29602;
  424. +UPDATE `creature_template` SET `VehicleId` = 183 WHERE  `entry` = 29625;
  425. +UPDATE `creature_template` SET `VehicleId` = 186 WHERE  `entry` = 29677;
  426. +UPDATE `creature_template` SET `VehicleId` = 198 WHERE  `entry` = 29708;
  427. +UPDATE `creature_template` SET `VehicleId` = 194 WHERE  `entry` = 29709;
  428. +UPDATE `creature_template` SET `VehicleId` = 243 WHERE  `entry` = 29736;
  429. +UPDATE `creature_template` SET `VehicleId` = 197 WHERE  `entry` = 29754;
  430. +UPDATE `creature_template` SET `VehicleId` = 201 WHERE  `entry` = 29838;
  431. +UPDATE `creature_template` SET `VehicleId` = 205 WHERE  `entry` = 29884;
  432. +UPDATE `creature_template` SET `VehicleId` = 209 WHERE  `entry` = 29931;
  433. +UPDATE `creature_template` SET `VehicleId` = 214 WHERE  `entry` = 30090;
  434. +UPDATE `creature_template` SET `VehicleId` = 217 WHERE  `entry` = 30124;
  435. +UPDATE `creature_template` SET `VehicleId` = 219 WHERE  `entry` = 30134;
  436. +UPDATE `creature_template` SET `VehicleId` = 221 WHERE  `entry` = 30165;
  437. +UPDATE `creature_template` SET `VehicleId` = 227 WHERE  `entry` = 30301;
  438. +UPDATE `creature_template` SET `VehicleId` = 25  WHERE  `entry` = 30378;
  439. +UPDATE `creature_template` SET `VehicleId` = 316 WHERE  `entry` = 30468;
  440. +UPDATE `creature_template` SET `VehicleId` = 252 WHERE  `entry` = 30719;
  441. +UPDATE `creature_template` SET `VehicleId` = 259 WHERE  `entry` = 31110;
  442. +UPDATE `creature_template` SET `VehicleId` = 265 WHERE  `entry` = 31163;
  443. +UPDATE `creature_template` SET `VehicleId` = 265 WHERE  `entry` = 31220;
  444. +UPDATE `creature_template` SET `VehicleId` = 265 WHERE  `entry` = 31221;
  445. +UPDATE `creature_template` SET `VehicleId` = 269 WHERE  `entry` = 31268;
  446. +UPDATE `creature_template` SET `VehicleId` = 268 WHERE  `entry` = 31269;
  447. +UPDATE `creature_template` SET `VehicleId` = 273 WHERE  `entry` = 31406;
  448. +UPDATE `creature_template` SET `VehicleId` = 277 WHERE  `entry` = 31407;
  449. +UPDATE `creature_template` SET `VehicleId` = 274 WHERE  `entry` = 31408;
  450. +UPDATE `creature_template` SET `VehicleId` = 278 WHERE  `entry` = 31409;
  451. +UPDATE `creature_template` SET `VehicleId` = 282 WHERE  `entry` = 31784;
  452. +UPDATE `creature_template` SET `VehicleId` = 282 WHERE  `entry` = 31785;
  453. +UPDATE `creature_template` SET `VehicleId` = 736 WHERE  `entry` = 31788;
  454. +UPDATE `creature_template` SET `VehicleId` = 512 WHERE  `entry` = 31830;
  455. +UPDATE `creature_template` SET `VehicleId` = 287 WHERE  `entry` = 31838;
  456. +UPDATE `creature_template` SET `VehicleId` = 291 WHERE  `entry` = 32227;
  457. +UPDATE `creature_template` SET `VehicleId` = 300 WHERE  `entry` = 32326;
  458. +UPDATE `creature_template` SET `VehicleId` = 301 WHERE  `entry` = 32344;
  459. +UPDATE `creature_template` SET `VehicleId` = 302 WHERE  `entry` = 32348;
  460. +UPDATE `creature_template` SET `VehicleId` = 273 WHERE  `entry` = 32512;
  461. +UPDATE `creature_template` SET `VehicleId` = 369 WHERE  `entry` = 32531;
  462. +UPDATE `creature_template` SET `VehicleId` = 40  WHERE  `entry` = 30775;
  463. +UPDATE `creature_template` SET `VehicleId` = 201 WHERE  `entry` = 30935;
  464. +UPDATE `creature_template` SET `VehicleId` = 209 WHERE  `entry` = 30936;
  465. +UPDATE `creature_template` SET `VehicleId` = 191 WHERE  `entry` = 31368;
  466. +UPDATE `creature_template` SET `VehicleId` = 108 WHERE  `entry` = 31669;
  467. +UPDATE `creature_template` SET `VehicleId` = 380 WHERE  `entry` = 32933;
  468. +UPDATE `creature_template` SET `VehicleId` = 342 WHERE  `entry` = 33190;
  469. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33297;
  470. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33298;
  471. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33300;
  472. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33301;
  473. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33316;
  474. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33317;
  475. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33318;
  476. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33320;
  477. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33322;
  478. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33323;
  479. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33324;
  480. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33408;
  481. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33409;
  482. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33414;
  483. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33416;
  484. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 33418;
  485. +UPDATE `creature_template` SET `VehicleId` = 368 WHERE  `entry` = 33519;
  486. +UPDATE `creature_template` SET `VehicleId` = 369 WHERE  `entry` = 33531;
  487. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33790;
  488. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33791;
  489. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33792;
  490. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33793;
  491. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33794;
  492. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33795;
  493. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33796;
  494. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33798;
  495. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33799;
  496. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33800;
  497. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33842;
  498. +UPDATE `creature_template` SET `VehicleId` = 349 WHERE  `entry` = 33843;
  499. +UPDATE `creature_template` SET `VehicleId` = 353 WHERE  `entry` = 33885;
  500. +UPDATE `creature_template` SET `VehicleId` = 328 WHERE  `entry` = 33909;
  501. +UPDATE `creature_template` SET `VehicleId` = 380 WHERE  `entry` = 33910;
  502. +UPDATE `creature_template` SET `VehicleId` = 380 WHERE  `entry` = 33911;
  503. +UPDATE `creature_template` SET `VehicleId` = 381 WHERE  `entry` = 33955;
  504. +UPDATE `creature_template` SET `VehicleId` = 385 WHERE  `entry` = 33984;
  505. +UPDATE `creature_template` SET `VehicleId` = 387 WHERE  `entry` = 34003;
  506. +UPDATE `creature_template` SET `VehicleId` = 335 WHERE  `entry` = 34045;
  507. +UPDATE `creature_template` SET `VehicleId` = 370 WHERE  `entry` = 34106;
  508. +UPDATE `creature_template` SET `VehicleId` = 371 WHERE  `entry` = 34108;
  509. +UPDATE `creature_template` SET `VehicleId` = 373 WHERE  `entry` = 34109;
  510. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 34125;
  511. +UPDATE `creature_template` SET `VehicleId` = 397 WHERE  `entry` = 34162;
  512. +UPDATE `creature_template` SET `VehicleId` = 399 WHERE  `entry` = 34214;
  513. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 36557;
  514. +UPDATE `creature_template` SET `VehicleId` = 485 WHERE  `entry` = 35641;
  515. +UPDATE `creature_template` SET `VehicleId` = 480 WHERE  `entry` = 35635;
  516. +UPDATE `creature_template` SET `VehicleId` = 106 WHERE  `entry` = 34802;
  517. +UPDATE `creature_template` SET `VehicleId` = 0 WHERE  `entry` = 36558;
  518. +UPDATE `creature_template` SET `VehicleId` = 477 WHERE  `entry` = 36087;
  519. +UPDATE `creature_template` SET `VehicleId` = 477 WHERE  `entry` = 36089;
  520. +UPDATE `creature_template` SET `VehicleId` = 442 WHERE  `entry` = 35438;
  521. +UPDATE `creature_template` SET `VehicleId` = 442 WHERE  `entry` = 35439;
  522. +UPDATE `creature_template` SET `VehicleId` = 442 WHERE  `entry` = 35440;
  523. +UPDATE `creature_template` SET `VehicleId` = 446 WHERE  `entry` = 35270;
  524. +UPDATE `creature_template` SET `VehicleId` = 446 WHERE  `entry` = 35271;
  525. +UPDATE `creature_template` SET `VehicleId` = 446 WHERE  `entry` = 35272;
  526. +UPDATE `creature_template` SET `VehicleId` = 555 WHERE  `entry` = 36839;
  527. +UPDATE `creature_template` SET `VehicleId` = 599 WHERE  `entry` = 37187;
  528. +UPDATE `creature_template` SET `VehicleId` = 648 WHERE  `entry` = 38712;
  529. +UPDATE `creature_template` SET `VehicleId` = 562 WHERE  `entry` = 37636;
  530. +UPDATE `creature_template` SET `VehicleId` = 560 WHERE  `entry` = 37626;
  531. +UPDATE `creature_template` SET `VehicleId` = 522 WHERE  `entry` = 37627;
  532. +UPDATE `creature_template` SET `VehicleId` = 648 WHERE  `entry` = 38974;
  533. +UPDATE `creature_template` SET `VehicleId` = 648 WHERE  `entry` = 38973;
  534. +UPDATE `creature_template` SET `VehicleId` = 648 WHERE  `entry` = 38975;
  535. +UPDATE `creature_template` SET `VehicleId` = 106 WHERE  `entry` = 35419;
  536. +UPDATE `creature_template` SET `VehicleId` = 106 WHERE  `entry` = 35421;
  537. +UPDATE `creature_template` SET `VehicleId` = 106 WHERE  `entry` = 35415;
  538. +UPDATE `creature_template` SET `VehicleId` = 436 WHERE  `entry` = 36358;
  539. +UPDATE `creature_template` SET `VehicleId` = 36  WHERE  `entry` = 35413;
  540. +UPDATE `creature_template` SET `VehicleId` = 452 WHERE  `entry` = 35410;
  541. +UPDATE `creature_template` SET `VehicleId` = 591 WHERE  `entry` = 38285;
  542. +UPDATE `creature_template` SET `VehicleId` = 718 WHERE  `entry` = 40081;
  543. +UPDATE `creature_template` SET `VehicleId` = 718 WHERE  `entry` = 40470;
  544. +UPDATE `creature_template` SET `VehicleId` = 718 WHERE  `entry` = 40471;
  545. +UPDATE `creature_template` SET `VehicleId` = 718 WHERE  `entry` = 40472;
  546. +UPDATE `creature_template` SET `VehicleId` = 79  WHERE  `entry` = 35427;
  547. +UPDATE `creature_template` SET `VehicleId` = 79  WHERE  `entry` = 35429;
  548. +UPDATE `creature_template` SET `VehicleId` = 591 WHERE  `entry` = 38788;
  549. +UPDATE `creature_template` SET `VehicleId` = 591 WHERE  `entry` = 38789;
  550. +UPDATE `creature_template` SET `VehicleId` = 591 WHERE  `entry` = 38790;
  551. +UPDATE `creature_template` SET `VehicleId` = 700 WHERE  `entry` = 39682;
  552. +UPDATE `creature_template` SET `VehicleId` = 745 WHERE  `entry` = 39713;
  553. +UPDATE `creature_template` SET `VehicleId` = 745 WHERE  `entry` = 39714;
  554. +UPDATE `creature_template` SET `VehicleId` = 753 WHERE  `entry` = 39759;
  555. +UPDATE `creature_template` SET `VehicleId` = 763 WHERE  `entry` = 39819;
  556. +UPDATE `creature_template` SET `VehicleId` = 711 WHERE  `entry` = 39860;
  557. +UPDATE `creature_template` SET `VehicleId` = 747 WHERE  `entry` = 40479;
  558. +-- YTDB updates 571-578
  559. +UPDATE `creature_template` SET `VehicleId` = 265 WHERE  `entry` = 31225;
  560. +UPDATE `creature_template` SET `VehicleId` = 224 WHERE  `entry` = 31748;
  561. +UPDATE `creature_template` SET `VehicleId` = 223 WHERE  `entry` = 31749;
  562. +UPDATE `creature_template` SET `VehicleId` = 220 WHERE  `entry` = 31752;
  563. +
  564. +-- Ymirjar Skycaller true fix (delete hack from YTDB)
  565. +DELETE FROM `creature_template_addon` WHERE `entry` IN (31260, 37643);
  566. diff --git a/sql/vehicle_quest.sql b/sql/vehicle_quest.sql
  567. new file mode 100644
  568. index 0000000..a09a1bc
  569. --- /dev/null
  570. +++ b/sql/vehicle_quest.sql
  571. @@ -0,0 +1,333 @@
  572. +-- From zergtmn
  573. +/*
  574. +    Havenshire Stallion
  575. +    Havenshire Mare
  576. +    Havenshire Colt
  577. +*/
  578. +UPDATE creature_template SET
  579. +    spell1 = 52264,
  580. +    spell2 = 52268,
  581. +    spell3 = 0,
  582. +    spell4 = 0,
  583. +    spell5 = 0,
  584. +    spell6 = 0,
  585. +    VehicleId = 123
  586. +WHERE entry IN (28605, 28606, 28607);
  587. +
  588. +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (28605, 28606, 28607);
  589. +INSERT INTO npc_spellclick_spells VALUES
  590. +(28605, 52263, 12680, 1, 12680, 1),
  591. +(28606, 52263, 12680, 1, 12680, 1),
  592. +(28607, 52263, 12680, 1, 12680, 1);
  593. +INSERT IGNORE INTO spell_script_target VALUES (52264, 1, 28653);
  594. +
  595. +-- From jahangames
  596. +-- Massacre at Light's point quest
  597. +UPDATE creature_template SET
  598. +spell1 = 52435,
  599. +spell2 = 52576,
  600. +spell3 = 0,
  601. +spell4 = 0,
  602. +spell5 = 52588,
  603. +spell6 = 0,
  604. +VehicleId = 79
  605. +WHERE entry IN (28833);
  606. +
  607. +UPDATE creature_template SET
  608. +spell1 = 52435,
  609. +spell2 = 52576,
  610. +spell3 = 0,
  611. +spell4 = 0,
  612. +spell5 = 52588,
  613. +spell6 = 0,
  614. +VehicleId = 68
  615. +WHERE entry IN (28887);
  616. +
  617. +INSERT INTO npc_spellclick_spells VALUES ('28833', '52447', '12701', '1', '12701', '1');
  618. +INSERT INTO npc_spellclick_spells VALUES ('28887', '52447', '12701', '1', '12701', '1');
  619. +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;
  620. +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;
  621. +INSERT IGNORE INTO spell_script_target VALUES (52576, 1, 28834);
  622. +INSERT IGNORE INTO spell_script_target VALUES (52576, 1, 28886);
  623. +INSERT IGNORE INTO spell_script_target VALUES (52576, 1, 28850);
  624. +
  625. +-- From Lanc
  626. +-- quest 12953
  627. +UPDATE `creature_template` SET
  628. +    spell1 = 55812,
  629. +    spell2 = 0,
  630. +    spell3 = 0,
  631. +    spell4 = 0,
  632. +    spell5 = 0,
  633. +    spell6 = 0,
  634. +    VehicleId = 213
  635. +WHERE entry IN (30066);
  636. +
  637. +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (30066);
  638. +INSERT INTO `npc_spellclick_spells` VALUES
  639. +(30066, 44002, 12953, 1, 12953, 1);
  640. +INSERT IGNORE INTO `spell_script_target` VALUES (55812, 1, 30096);
  641. +
  642. +-- From lanc
  643. +/* 7th Legion Chain Gun */
  644. +UPDATE creature_template SET
  645. +    IconName = 'Gunner',
  646. +    spell1 = 49190,
  647. +    spell2 = 49550,
  648. +    spell3 = 0,
  649. +    spell4 = 0,
  650. +    spell5 = 0,
  651. +    spell6 = 0,
  652. +    VehicleId = 68
  653. +WHERE entry IN (27714);
  654. +
  655. +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (27714);
  656. +INSERT INTO npc_spellclick_spells VALUES
  657. +(27714, 67373, 0, 0, 0, 1);
  658. +
  659. +/* Broken-down Shredder */
  660. +UPDATE creature_template SET
  661. +    IconName = 'vehichleCursor',
  662. +    spell1 = 48558,
  663. +    spell2 = 48604,
  664. +    spell3 = 48548,
  665. +    spell4 = 0,
  666. +    spell5 = 48610,
  667. +    spell6 = 0,
  668. +    VehicleId = 49
  669. +WHERE entry IN (27354);
  670. +
  671. +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (27354);
  672. +INSERT INTO npc_spellclick_spells VALUES
  673. +(27354, 67373, 0, 0, 0, 1);
  674. +INSERT IGNORE INTO spell_script_target VALUES (48610, 1, 27396);
  675. +
  676. +/* Forsaken Blight Spreader */
  677. +UPDATE creature_template SET
  678. +    IconName = 'vehichleCursor',
  679. +    spell1 = 48211,
  680. +    spell2 = 0,
  681. +    spell3 = 0,
  682. +    spell4 = 0,
  683. +    spell5 = 0,
  684. +    spell6 = 0,
  685. +    VehicleId = 36
  686. +WHERE entry IN (26523);
  687. +
  688. +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (26523);
  689. +INSERT INTO npc_spellclick_spells VALUES
  690. +(26523, 47961, 0, 0, 0, 1);
  691. +
  692. +/* Argent Tournament mount */
  693. +UPDATE creature_template SET
  694. +    spell1 = 62544,
  695. +    spell2 = 62575,
  696. +    spell3 = 63010,
  697. +    spell4 = 62552,
  698. +    spell5 = 64077,
  699. +    spell6 = 62863,
  700. +    VehicleId = 349
  701. +WHERE entry IN (33844, 33845);
  702. +UPDATE creature_template SET KillCredit1 = 33340 WHERE entry IN (33272);
  703. +UPDATE creature_template SET KillCredit1 = 33339 WHERE entry IN (33243);
  704. +
  705. +DELETE FROM npc_spellclick_spells WHERE npc_entry IN (33842, 33843);
  706. +INSERT INTO npc_spellclick_spells VALUES
  707. +(33842, 63791, 13829, 1, 0, 3),
  708. +(33842, 63791, 13839, 1, 0, 3),
  709. +(33842, 63791, 13838, 1, 0, 3),
  710. +(33843, 63792, 13828, 1, 0, 3),
  711. +(33843, 63792, 13837, 1, 0, 3),
  712. +(33843, 63792, 13835, 1, 0, 3);
  713. +
  714. +DELETE FROM creature WHERE id IN (33844,33845);
  715. +UPDATE creature_template SET speed_run = '1.5', unit_flags = 8 WHERE entry IN (33844,33845);
  716. +
  717. +-- Quest vehicles Support: Going Bearback (12851)
  718. +UPDATE `creature_template` SET
  719. +    spell1 = 54897,
  720. +    spell2 = 54907,
  721. +    spell3 = 0,
  722. +    spell4 = 0,
  723. +    spell5 = 0,
  724. +    spell6 = 0,
  725. +    VehicleId = 308
  726. +WHERE entry IN (29598);
  727. +
  728. +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (29598);
  729. +INSERT INTO `npc_spellclick_spells` VALUES
  730. +(29598, 54908, 12851, 1, 12851, 1);
  731. +
  732. +INSERT IGNORE INTO `spell_script_target` VALUES (54897, 1, 29358);
  733. +
  734. +/* Scourge Gryphon */
  735. +UPDATE creature_template SET
  736. +    spell1 = 0,
  737. +    spell2 = 0,
  738. +    spell3 = 0,
  739. +    spell4 = 0,
  740. +    spell5 = 0,
  741. +    spell6 = 0,
  742. +    VehicleId = 146
  743. +WHERE entry IN (28864);
  744. +
  745. +/* Frostbrood Vanquisher */
  746. +UPDATE creature_template SET
  747. +    spell1 = 53114,
  748. +    spell2 = 53110,
  749. +    spell3 = 0,
  750. +    spell4 = 0,
  751. +    spell5 = 0,
  752. +    spell6 = 0,
  753. +    VehicleId = 156
  754. +WHERE entry IN (28670);
  755. +
  756. +UPDATE creature_template SET maxhealth = 133525, minhealth = 133525, maxmana = 51360, minmana = 51360, InhabitType = 3 WHERE entry = 28670;
  757. +
  758. +REPLACE INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `b2_0_sheath`, `emote`, `moveflags`, `auras`) VALUES
  759. +(28670, 0, 50331648, 1, 0, 1024, '53112 0 53112 1 53112 2');
  760. +
  761. +-- from me
  762. +-- into realm of shadows
  763. +UPDATE `creature_template` SET `IconName` = 'vehichleCursor',
  764. +`unit_flags` = 0,
  765. +`spell1` = 52362
  766. +WHERE `entry` =28782;
  767. +
  768. +UPDATE `quest_template` SET
  769. +`SrcSpell` = 52359,
  770. +`SpecialFlags` = 2,
  771. +`ReqCreatureOrGOId1` = 28768,
  772. +`ReqCreatureOrGOCount1` = 1,
  773. +`ReqSpellCast1` = 0,
  774. +`RewItemId1` = 39208,
  775. +`RewItemCount1` = 1 WHERE `entry` = 12687;
  776. +
  777. +DELETE FROM `creature_involvedrelation` WHERE `quest` in (12687);
  778. +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28788, 12687);
  779. +UPDATE `creature_template` SET `npcflag` = 2 WHERE `entry` = 28788;
  780. +
  781. +DELETE FROM `spell_script_target` WHERE `entry` = 52349;
  782. +
  783. +UPDATE `creature_ai_scripts` SET
  784. +`action1_type`   = '11',
  785. +`action1_param1` = '52361',
  786. +`action1_param2` = '6',
  787. +`action1_param3` = '16',
  788. +`action2_type`   = '11',
  789. +`action2_param1` = '52357',
  790. +`action2_param2` = '6',
  791. +`action2_param3` = '16',
  792. +`action3_type`   = '0'
  793. +WHERE `id` = 2876806;
  794. +
  795. +DELETE FROM `creature` WHERE `id` = 28782;
  796. +
  797. +DELETE FROM `creature_template_addon` WHERE `entry` = 28782;
  798. +
  799. +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (28782);
  800. +INSERT INTO `npc_spellclick_spells` VALUES
  801. +(28782, 46598, 0, 0, 0, 1);
  802. +
  803. +-- from lanc
  804. +-- Infected Kodo fix quest (11690)
  805. +UPDATE `creature_template` SET
  806. +spell1 = 45877,
  807. +spell2 = 0,
  808. +spell3 = 0,
  809. +spell4 = 0,
  810. +spell5 = 0,
  811. +spell6 = 0,
  812. +VehicleId = 29
  813. +WHERE `entry` IN (25596);
  814. +
  815. +INSERT IGNORE INTO `spell_script_target` VALUES (45877, 1, 25596);
  816. +
  817. +-- Horde Siege Tank
  818. +UPDATE `creature_template` SET
  819. +spell1 = 50672,
  820. +spell2 = 45750,
  821. +spell3 = 50677,
  822. +spell4 = 47849,
  823. +spell5 = 47962,
  824. +spell6 = 0,
  825. +VehicleId = 26
  826. +WHERE `entry` IN (25334);
  827. +
  828. +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (25334, 27107);
  829. +INSERT INTO `npc_spellclick_spells` VALUES
  830. +(25334, 47917, 11652, 1, 11652, 1);
  831. +
  832. +REPLACE INTO `spell_script_target` VALUES (47962, 1, 27107);
  833. +
  834. +REPLACE INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_start_active`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`)
  835. +VALUES ('47917','4027','11652','1','11652','0','0','2','0'), ('47917','4130','11652','1','11652','0','0','2','0');
  836. +
  837. +-- from lanc
  838. +-- Refurbished Shredder (quest 12050)
  839. +UPDATE `creature_template` SET
  840. +spell1 = 47939,
  841. +spell2 = 47921,
  842. +spell3 = 47966,
  843. +spell4 = 47938,
  844. +spell5 = 0,
  845. +spell6 = 0,
  846. +VehicleId = 300
  847. +WHERE `entry` IN (27061);
  848. +
  849. +DELETE FROM `npc_spellclick_spells` WHERE npc_entry IN (27061);
  850. +INSERT INTO `npc_spellclick_spells` VALUES (27061, 47920, 0, 0, 0, 1);
  851. +REPLACE INTO `spell_script_target` VALUES (47939, 2, 188539);
  852. +
  853. +-- Argent Cannon (quest 13086)
  854. +UPDATE `creature_template` SET
  855. +    spell1 = 57485,
  856. +    spell2 = 57412,
  857. +    spell3 = 0,
  858. +    spell4 = 0,
  859. +    spell5 = 0,
  860. +    spell6 = 0,
  861. +    VehicleId = 244
  862. +WHERE `entry` IN (30236);
  863. +
  864. +DELETE FROM `npc_spellclick_spells` WHERE npc_entry IN (30236);
  865. +INSERT INTO `npc_spellclick_spells` VALUES
  866. +(30236, 57573, 13086, 1, 13086, 1);
  867. +
  868. +-- Wyrmrest Vanquisher (quest 12498)
  869. +UPDATE `creature_template` SET
  870. +    spell1 = 55987,
  871. +    spell2 = 50348,
  872. +    spell3 = 50430,
  873. +    spell4 = 0,
  874. +    spell5 = 0,
  875. +    spell6 = 0,
  876. +    VehicleId = 99
  877. +WHERE `entry` IN (27996);
  878. +
  879. +DELETE FROM `npc_spellclick_spells` WHERE npc_entry IN (27996);
  880. +INSERT INTO `npc_spellclick_spells` VALUES
  881. +(27996, 50343, 12498, 1, 12498, 1);
  882. +
  883. +REPLACE INTO `creature_template_addon` (entry, auras) VALUES (27996, '53112 0 53112 1 53112 2');
  884. +
  885. +-- from me
  886. +-- Quest Reclamation (12546)
  887. +UPDATE `creature_template` SET `spell1` = 50978,`spell2` = 50980,`spell3` = 50983,`spell4` = 50985,
  888. +`VehicleId` = 111
  889. +WHERE  `entry` = 28222;
  890. +
  891. +-- from YTDB/TC 578
  892. +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (27850,27881,28094,28312,28319,28670,32627,32629);
  893. +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`) VALUES
  894. +(27850, 60968, 0, 0, 0, 1),
  895. +(27881, 60968, 0, 0, 0, 1),
  896. +(28094, 60968, 0, 0, 0, 1),
  897. +(28312, 60968, 0, 0, 0, 1),
  898. +(28319, 60968, 0, 0, 0, 1),
  899. +(28670, 52196, 0, 0, 0, 1),
  900. +(32627, 60968, 0, 0, 0, 1),
  901. +(32629, 60968, 0, 0, 0, 1);
  902. +
  903. +-- Quest 12996
  904. +UPDATE `creature_template` SET `spell1` = 54459,`spell2` = 54458,`spell3` = 54460,`VehicleId` = 208 WHERE  `creature_template`.`entry` = 29918;
  905. diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp
  906. index 5a32a83..8af197d 100644
  907. --- a/src/game/Bag.cpp
  908. +++ b/src/game/Bag.cpp
  909. @@ -64,7 +64,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
  910.      if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
  911.          return false;
  912.  
  913. -    Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
  914. +    Object::_Create(ObjectGuid(HIGHGUID_CONTAINER, guidlow));
  915.  
  916.      SetEntry(itemid);
  917.      SetObjectScale(DEFAULT_OBJECT_SCALE);
  918. diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
  919. index 8def1ec..2f052a3 100644
  920. --- a/src/game/Chat.cpp
  921. +++ b/src/game/Chat.cpp
  922. @@ -211,7 +211,6 @@ ChatCommand * ChatHandler::getCommandTable()
  923.          { "setvalue",       SEC_ADMINISTRATOR,  false, &ChatHandler::HandleDebugSetValueCommand,            "", NULL },
  924.          { "spellcheck",     SEC_CONSOLE,        true,  &ChatHandler::HandleDebugSpellCheckCommand,          "", NULL },
  925.          { "spellmods",      SEC_ADMINISTRATOR,  false, &ChatHandler::HandleDebugSpellModsCommand,           "", NULL },
  926. -        { "spawnvehicle",   SEC_ADMINISTRATOR,  false, &ChatHandler::HandleDebugSpawnVehicleCommand,        "", NULL },
  927.          { "uws",            SEC_ADMINISTRATOR,  false, &ChatHandler::HandleDebugUpdateWorldStateCommand,    "", NULL },
  928.          { NULL,             0,                  false, NULL,                                                "", NULL }
  929.      };
  930. diff --git a/src/game/Chat.h b/src/game/Chat.h
  931. index f32f53f..19e1cbc 100644
  932. --- a/src/game/Chat.h
  933. +++ b/src/game/Chat.h
  934. @@ -187,7 +187,6 @@ class ChatHandler
  935.          bool HandleDebugSetAuraStateCommand(char* args);
  936.          bool HandleDebugSetItemValueCommand(char* args);
  937.          bool HandleDebugSetValueCommand(char* args);
  938. -        bool HandleDebugSpawnVehicleCommand(char* args);
  939.          bool HandleDebugSpellCheckCommand(char* args);
  940.          bool HandleDebugSpellModsCommand(char* args);
  941.          bool HandleDebugUpdateWorldStateCommand(char* args);
  942. diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp
  943. index b546ee8..fe500e5 100644
  944. --- a/src/game/Corpse.cpp
  945. +++ b/src/game/Corpse.cpp
  946. @@ -67,7 +67,7 @@ void Corpse::RemoveFromWorld()
  947.  
  948.  bool Corpse::Create( uint32 guidlow )
  949.  {
  950. -    Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
  951. +    Object::_Create(ObjectGuid(HIGHGUID_CORPSE, guidlow));
  952.      return true;
  953.  }
  954.  
  955. @@ -75,7 +75,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
  956.  {
  957.      MANGOS_ASSERT(owner);
  958.  
  959. -    WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask());
  960. +    WorldObject::_Create(ObjectGuid(HIGHGUID_CORPSE, guidlow), owner->GetPhaseMask());
  961.      Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
  962.  
  963.      //we need to assign owner's map for corpse
  964. @@ -159,7 +159,7 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
  965.      float orientation   = fields[5].GetFloat();
  966.      uint32 mapid        = fields[6].GetUInt32();
  967.  
  968. -    Object::_Create(lowguid, 0, HIGHGUID_CORPSE);
  969. +    Object::_Create(ObjectGuid(HIGHGUID_CORPSE, lowguid));
  970.  
  971.      m_time = time_t(fields[7].GetUInt64());
  972.      m_type = CorpseType(fields[8].GetUInt32());
  973. diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
  974. index 36cfb10..72a608b 100644
  975. --- a/src/game/Creature.cpp
  976. +++ b/src/game/Creature.cpp
  977. @@ -153,16 +153,19 @@ Creature::~Creature()
  978.  void Creature::AddToWorld()
  979.  {
  980.      ///- Register the creature for guid lookup
  981. -    if(!IsInWorld() && GetObjectGuid().GetHigh() == HIGHGUID_UNIT)
  982. +    if(!IsInWorld() && GetObjectGuid().IsCreatureOrVehicle())
  983.          GetMap()->GetObjectsStore().insert<Creature>(GetGUID(), (Creature*)this);
  984.  
  985.      Unit::AddToWorld();
  986. +
  987. +    if (GetVehicleKit())
  988. +        GetVehicleKit()->Reset();
  989.  }
  990.  
  991.  void Creature::RemoveFromWorld()
  992.  {
  993.      ///- Remove the creature from the accessor
  994. -    if(IsInWorld() && GetObjectGuid().GetHigh() == HIGHGUID_UNIT)
  995. +    if(IsInWorld() && GetObjectGuid().IsCreatureOrVehicle())
  996.          GetMap()->GetObjectsStore().erase<Creature>(GetGUID(), (Creature*)NULL);
  997.  
  998.      Unit::RemoveFromWorld();
  999. @@ -271,6 +274,7 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
  1000.      SetDisplayId(display_id);
  1001.  
  1002.      SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
  1003. +    SetByteValue(UNIT_FIELD_BYTES_0, 3, uint8(cinfo->powerType));
  1004.  
  1005.      // Load creature equipment
  1006.      if (eventData && eventData->equipment_id)
  1007. @@ -577,7 +581,7 @@ void Creature::Update(uint32 update_diff, uint32 diff)
  1008.              if (!isInCombat() || IsPolymorphed())
  1009.                  RegenerateHealth();
  1010.  
  1011. -            RegenerateMana();
  1012. +            Regenerate(getPowerType());
  1013.  
  1014.              m_regenTimer = REGEN_TIME_FULL;
  1015.              break;
  1016. @@ -609,31 +613,78 @@ void Creature::StopGroupLoot()
  1017.      m_groupLootId = 0;
  1018.  }
  1019.  
  1020. -void Creature::RegenerateMana()
  1021. +void Creature::Regenerate(Powers power)
  1022.  {
  1023. -    uint32 curValue = GetPower(POWER_MANA);
  1024. -    uint32 maxValue = GetMaxPower(POWER_MANA);
  1025. +    uint32 curValue = GetPower(power);
  1026. +    uint32 maxValue = GetMaxPower(power);
  1027.  
  1028.      if (curValue >= maxValue)
  1029.          return;
  1030.  
  1031. -    uint32 addvalue = 0;
  1032. +    float addvalue = 0.0f;
  1033.  
  1034. -    // Combat and any controlled creature
  1035. -    if (isInCombat() || !GetCharmerOrOwnerGuid().IsEmpty())
  1036. +    switch(power)
  1037.      {
  1038. -        if(!IsUnderLastManaUseEffect())
  1039. +        case POWER_MANA:
  1040.          {
  1041. -            float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
  1042. -            float Spirit = GetStat(STAT_SPIRIT);
  1043. +            // Combat and any controlled creature
  1044. +            if (isInCombat() || !GetCharmerOrOwnerGuid().IsEmpty())
  1045. +            {
  1046. +                if(!IsUnderLastManaUseEffect())
  1047. +                {
  1048. +                    float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
  1049. +                    float Spirit = GetStat(STAT_SPIRIT);
  1050.  
  1051. -            addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
  1052. +                    addvalue = int32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
  1053. +                }
  1054. +            }
  1055. +            else
  1056. +                addvalue = maxValue / 3;
  1057. +            break;
  1058.          }
  1059. +        case POWER_ENERGY:
  1060. +            if (GetObjectGuid().IsVehicle())
  1061. +            {
  1062. +                if (VehicleEntry const* vehicleInfo = sVehicleStore.LookupEntry(GetCreatureInfo()->VehicleId))
  1063. +                {
  1064. +
  1065. +                    switch (vehicleInfo->m_powerType)
  1066. +                    {
  1067. +                        case ENERGY_TYPE_PYRITE:
  1068. +                        case ENERGY_TYPE_BLOOD:
  1069. +                        case ENERGY_TYPE_OOZE:
  1070. +                        break;
  1071. +
  1072. +                        case ENERGY_TYPE_STEAM:
  1073. +                        default:
  1074. +                            addvalue = 10 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_ENERGY);
  1075. +                        break;
  1076. +                    }
  1077. +                }
  1078. +            }
  1079. +            else
  1080. +                addvalue = 20 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_ENERGY);
  1081. +            break;
  1082. +        case POWER_FOCUS:
  1083. +            addvalue = 24 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_FOCUS);
  1084. +            break;
  1085. +        default:
  1086. +            return;
  1087.      }
  1088. -    else
  1089. -        addvalue = maxValue / 3;
  1090.  
  1091. -    ModifyPower(POWER_MANA, addvalue);
  1092. +    // Apply modifiers (if any)
  1093. +
  1094. +    AuraList const& ModPowerRegenAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN);
  1095. +    for(AuraList::const_iterator i = ModPowerRegenAuras.begin(); i != ModPowerRegenAuras.end(); ++i)
  1096. +        if ((*i)->GetModifier()->m_miscvalue == power)
  1097. +            addvalue += (*i)->GetModifier()->m_amount;
  1098. +
  1099. +    AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
  1100. +    for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
  1101. +        if ((*i)->GetModifier()->m_miscvalue == power)
  1102. +            addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
  1103. +
  1104. +    ModifyPower(power, int32(addvalue));
  1105.  }
  1106.  
  1107.  void Creature::RegenerateHealth()
  1108. @@ -709,12 +760,37 @@ bool Creature::AIM_Initialize()
  1109.  
  1110.  bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, Team team /*= TEAM_NONE*/, const CreatureData *data /*= NULL*/, GameEventCreatureData const* eventData /*= NULL*/)
  1111.  {
  1112. +    CreatureInfo const *cinfo = sObjectMgr.GetCreatureTemplate(Entry);
  1113. +
  1114. +    if (!cinfo)
  1115. +    {
  1116. +        sLog.outErrorDb("Creature entry %u does not exist.", Entry);
  1117. +        return false;
  1118. +    }
  1119. +
  1120.      MANGOS_ASSERT(map);
  1121. +
  1122. +    HighGuid hi = cinfo->VehicleId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT;
  1123. +
  1124. +    if (map->GetInstanceId() == 0)
  1125. +    {
  1126. +        // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid
  1127. +        // FIXME: until creature guids is global and for instances used dynamic generated guids
  1128. +        // in instance possible load creature duplicates with same DB guid but different in game guids
  1129. +        // This will be until implementing per-map creature guids
  1130. +        if (map->GetCreature(ObjectGuid(hi, Entry, guidlow)))
  1131. +            return false;
  1132. +    }
  1133. +    else
  1134. +        guidlow = sObjectMgr.GenerateLowGuid(hi);
  1135. +
  1136. +    ObjectGuid guid(hi, Entry, guidlow);
  1137. +
  1138.      SetMap(map);
  1139.      SetPhaseMask(phaseMask,false);
  1140.  
  1141.      //oX = x;     oY = y;    dX = x;    dY = y;    m_moveTime = 0;    m_startMove = 0;
  1142. -    const bool bResult = CreateFromProto(guidlow, Entry, team, data, eventData);
  1143. +    const bool bResult = CreateFromProto(guid, Entry, team, data, eventData);
  1144.  
  1145.      if (bResult)
  1146.      {
  1147. @@ -1123,19 +1199,32 @@ void Creature::SelectLevel(const CreatureInfo *cinfo, float percentHealth, float
  1148.      else
  1149.          SetHealthPercent(percentHealth);
  1150.  
  1151. -    // mana
  1152. -    uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
  1153. -    uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
  1154. -    uint32 mana = minmana + uint32(rellevel * (maxmana - minmana));
  1155. +    SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
  1156.  
  1157. -    SetCreateMana(mana);
  1158. -    SetMaxPower(POWER_MANA, mana);                          //MAX Mana
  1159. -    SetPower(POWER_MANA, mana);
  1160. +    Powers powerType = Powers(cinfo->powerType);
  1161. +    uint32 maxPower = 0;
  1162.  
  1163. -    // TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)
  1164. +    switch(powerType)
  1165. +    {
  1166. +        case POWER_MANA:
  1167. +        {
  1168. +            uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
  1169. +            uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
  1170. +            maxPower = minmana + uint32(rellevel * (maxmana - minmana));
  1171.  
  1172. -    SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
  1173. -    SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, float(mana));
  1174. +            SetCreateMana(maxPower);
  1175. +            break;
  1176. +        }
  1177. +        case POWER_ENERGY:
  1178. +        {
  1179. +            maxPower = uint32(GetCreatePowers(powerType) * cinfo->power_mod);
  1180. +            break;
  1181. +        }
  1182. +    }
  1183. +
  1184. +    SetMaxPower(powerType, maxPower);
  1185. +    SetPower(powerType, maxPower);
  1186. +    SetModifierValue(UnitMods(UNIT_MOD_POWER_START + powerType), BASE_VALUE, float(maxPower));
  1187.  
  1188.      // damage
  1189.      float damagemod = _GetDamageMod(rank);
  1190. @@ -1206,21 +1295,19 @@ float Creature::GetSpellDamageMod(int32 Rank)
  1191.      }
  1192.  }
  1193.  
  1194. -bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, Team team, const CreatureData *data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/)
  1195. +bool Creature::CreateFromProto(ObjectGuid guid, uint32 Entry, Team team, const CreatureData *data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/)
  1196.  {
  1197. -    CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry);
  1198. -    if(!cinfo)
  1199. -    {
  1200. -        sLog.outErrorDb("Creature entry %u does not exist.", Entry);
  1201. -        return false;
  1202. -    }
  1203.      m_originalEntry = Entry;
  1204.  
  1205. -    Object::_Create(guidlow, Entry, HIGHGUID_UNIT);
  1206. +    Object::_Create(guid);
  1207.  
  1208.      if (!UpdateEntry(Entry, team, data, eventData, false))
  1209.          return false;
  1210.  
  1211. +    // Checked at startup
  1212. +    if (GetCreatureInfo()->VehicleId)
  1213. +        CreateVehicleKit(GetCreatureInfo()->VehicleId);
  1214. +
  1215.      return true;
  1216.  }
  1217.  
  1218. @@ -1237,17 +1324,6 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map)
  1219.      GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(guidlow);
  1220.  
  1221.      m_DBTableGuid = guidlow;
  1222. -    if (map->GetInstanceId() == 0)
  1223. -    {
  1224. -        // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid
  1225. -        // FIXME: until creature guids is global and for instances used dynamic generated guids
  1226. -        // in instance possible load creature duplicates with same DB guid but different in game guids
  1227. -        // This will be until implementing per-map creature guids
  1228. -        if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guidlow)))
  1229. -            return false;
  1230. -    }
  1231. -    else
  1232. -        guidlow = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
  1233.  
  1234.      if (!Create(guidlow, map, data->phaseMask, data->id, TEAM_NONE, data, eventData))
  1235.          return false;
  1236. diff --git a/src/game/Creature.h b/src/game/Creature.h
  1237. index 563ccb5..da0c10d 100644
  1238. --- a/src/game/Creature.h
  1239. +++ b/src/game/Creature.h
  1240. @@ -80,6 +80,7 @@ struct CreatureInfo
  1241.      uint32  maxlevel;
  1242.      uint32  minhealth;
  1243.      uint32  maxhealth;
  1244. +    uint32  powerType;
  1245.      uint32  minmana;
  1246.      uint32  maxmana;
  1247.      uint32  armor;
  1248. @@ -121,13 +122,14 @@ struct CreatureInfo
  1249.      int32   resistance6;
  1250.      uint32  spells[CREATURE_MAX_SPELLS];
  1251.      uint32  PetSpellDataId;
  1252. +    uint32  VehicleId;
  1253.      uint32  mingold;
  1254.      uint32  maxgold;
  1255.      char const* AIName;
  1256.      uint32  MovementType;
  1257.      uint32  InhabitType;
  1258. -    float   unk16;
  1259. -    float   unk17;
  1260. +    float   health_mod;
  1261. +    float   power_mod;
  1262.      bool    RacialLeader;
  1263.      uint32  questItems[6];
  1264.      uint32  movementId;
  1265. @@ -384,7 +386,6 @@ enum CreatureSubtype
  1266.      CREATURE_SUBTYPE_GENERIC,                               // new Creature
  1267.      CREATURE_SUBTYPE_PET,                                   // new Pet
  1268.      CREATURE_SUBTYPE_TOTEM,                                 // new Totem
  1269. -    CREATURE_SUBTYPE_VEHICLE,                               // new Vehicle
  1270.      CREATURE_SUBTYPE_TEMPORARY_SUMMON,                      // new TemporarySummon
  1271.  };
  1272.  
  1273. @@ -414,7 +415,6 @@ class MANGOS_DLL_SPEC Creature : public Unit
  1274.  
  1275.          CreatureSubtype GetSubtype() const { return m_subtype; }
  1276.          bool IsPet() const { return m_subtype == CREATURE_SUBTYPE_PET; }
  1277. -        bool IsVehicle() const { return m_subtype == CREATURE_SUBTYPE_VEHICLE; }
  1278.          bool IsTotem() const { return m_subtype == CREATURE_SUBTYPE_TOTEM; }
  1279.          bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; }
  1280.  
  1281. @@ -644,7 +644,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
  1282.          void SendAreaSpiritHealerQueryOpcode(Player *pl);
  1283.  
  1284.      protected:
  1285. -        bool CreateFromProto(uint32 guidlow,uint32 Entry, Team team, const CreatureData *data = NULL, GameEventCreatureData const* eventData =NULL);
  1286. +        bool CreateFromProto(ObjectGuid guid,uint32 Entry, Team team, const CreatureData *data = NULL, GameEventCreatureData const* eventData =NULL);
  1287.          bool InitEntry(uint32 entry, const CreatureData* data = NULL, GameEventCreatureData const* eventData = NULL);
  1288.          void RelocationNotify();
  1289.  
  1290. @@ -672,7 +672,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
  1291.          float m_respawnradius;
  1292.  
  1293.          CreatureSubtype m_subtype;                          // set in Creatures subclasses for fast it detect without dynamic_cast use
  1294. -        void RegenerateMana();
  1295. +        void Regenerate(Powers power);
  1296.          void RegenerateHealth();
  1297.          MovementGeneratorType m_defaultMovementType;
  1298.          Cell m_currentCell;                                 // store current cell where creature listed
  1299. diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h
  1300. index c673454..ba0aac6 100644
  1301. --- a/src/game/CreatureAI.h
  1302. +++ b/src/game/CreatureAI.h
  1303. @@ -130,6 +130,9 @@ class MANGOS_DLL_SPEC CreatureAI
  1304.          // Called at text emote receive from player
  1305.          virtual void ReceiveEmote(Player* /*pPlayer*/, uint32 /*text_emote*/) {}
  1306.  
  1307. +        // Called at vehicle enter
  1308. +        virtual void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool /*apply*/) {}
  1309. +
  1310.          ///== Triggered Actions Requested ==================
  1311.  
  1312.          // Called when creature attack expected (if creature can and no have current victim)
  1313. diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
  1314. index b11a773..5756b13 100644
  1315. --- a/src/game/CreatureEventAI.cpp
  1316. +++ b/src/game/CreatureEventAI.cpp
  1317. @@ -913,6 +913,7 @@ void CreatureEventAI::JustReachedHome()
  1318.  
  1319.  void CreatureEventAI::EnterEvadeMode()
  1320.  {
  1321. +    m_creature->ExitVehicle();
  1322.      m_creature->RemoveAllAuras();
  1323.      m_creature->DeleteThreatList();
  1324.      m_creature->CombatStop(true);
  1325. diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h
  1326. index c4c96df..3c5666e 100644
  1327. --- a/src/game/DBCEnums.h
  1328. +++ b/src/game/DBCEnums.h
  1329. @@ -356,7 +356,8 @@ enum SummonPropGroup
  1330.      SUMMON_PROP_GROUP_FRIENDLY       = 1,
  1331.      SUMMON_PROP_GROUP_PETS           = 2,
  1332.      SUMMON_PROP_GROUP_CONTROLLABLE   = 3,
  1333. -    SUMMON_PROP_GROUP_VEHICLE        = 4
  1334. +    SUMMON_PROP_GROUP_VEHICLE        = 4,
  1335. +    SUMMON_PROP_GROUP_UNCONTROLLABLE_VEHICLE = 5
  1336.  };
  1337.  
  1338.  // SummonProperties.dbc, col 3
  1339. @@ -462,15 +463,20 @@ enum VehicleFlags
  1340.      VEHICLE_FLAG_ALLOW_PITCHING     = 0x00000010,           // Sets MOVEFLAG2_ALLOW_PITCHING
  1341.      VEHICLE_FLAG_FULLSPEEDPITCHING  = 0x00000020,           // Sets MOVEFLAG2_FULLSPEEDPITCHING
  1342.      VEHICLE_FLAG_CUSTOM_PITCH       = 0x00000040,           // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
  1343. +    VEHICLE_FLAG_ACCESSORY          = 0x00000200,           // Vehicle is accessory? Need additional check!
  1344.      VEHICLE_FLAG_ADJUST_AIM_ANGLE   = 0x00000400,           // Lua_IsVehicleAimAngleAdjustable
  1345.      VEHICLE_FLAG_ADJUST_AIM_POWER   = 0x00000800,           // Lua_IsVehicleAimPowerAdjustable
  1346. +    VEHICLE_FLAG_DISABLE_SWITCH     = 0x00400000,           // Can't change seats, VEHICLE_ID = 335 chopper
  1347. +    VEHICLE_FLAG_NOT_DISMISS        = 0x10000000,           // Vehicle not dismissed after eject passenger?
  1348.  };
  1349.  
  1350.  enum VehicleSeatFlags
  1351.  {
  1352.      SEAT_FLAG_HIDE_PASSENGER        = 0x00000200,           // Passenger is hidden
  1353.      SEAT_FLAG_CAN_CONTROL           = 0x00000800,           // Lua_UnitInVehicleControlSeat
  1354. +    SEAT_FLAG_UNCONTROLLED          = 0x00002000,           // Seat uncontrolled for passenger?
  1355.      SEAT_FLAG_CAN_ATTACK            = 0x00004000,           // Can attack, cast spells and use items from vehicle?
  1356. +    SEAT_FLAG_UNATTACKABLE          = 0x00008000,           // Passenger is not attackable?
  1357.      SEAT_FLAG_USABLE                = 0x02000000,           // Lua_CanExitVehicle
  1358.      SEAT_FLAG_CAN_SWITCH            = 0x04000000,           // Lua_CanSwitchVehicleSeats
  1359.      SEAT_FLAG_CAN_CAST              = 0x20000000,           // Lua_UnitHasVehicleUI
  1360. diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
  1361. index 9948032..11a24b9 100644
  1362. --- a/src/game/DBCStructure.h
  1363. +++ b/src/game/DBCStructure.h
  1364. @@ -1796,7 +1796,7 @@ struct VehicleEntry
  1365.      uint32  m_uiLocomotionType;                             // 34
  1366.      float   m_msslTrgtImpactTexRadius;                      // 35
  1367.      uint32  m_uiSeatIndicatorType;                          // 36
  1368. -                                                            // 37, new in 3.1 - powerType
  1369. +    uint32  m_powerType;                                    // 37, new in 3.1 - powerType
  1370.                                                              // 38, new in 3.1
  1371.                                                              // 39, new in 3.1
  1372.  };
  1373. @@ -1850,6 +1850,7 @@ struct VehicleSeatEntry
  1374.      int32   m_uiSkin;                                       // 44
  1375.      uint32  m_flagsB;                                       // 45
  1376.                                                              // 46-57 added in 3.1, floats mostly
  1377. +    bool IsUsable() const { return m_flags & SEAT_FLAG_USABLE; }
  1378.  };
  1379.  
  1380.  struct WMOAreaTableEntry
  1381. diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h
  1382. index 77a8de3..de98126 100644
  1383. --- a/src/game/DBCfmt.h
  1384. +++ b/src/game/DBCfmt.h
  1385. @@ -108,7 +108,7 @@ const char TaxiPathEntryfmt[]="niii";
  1386.  const char TaxiPathNodeEntryfmt[]="diiifffiiii";
  1387.  const char TeamContributionPointsfmt[]="df";
  1388.  const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
  1389. -const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
  1390. +const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
  1391.  const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
  1392.  const char WMOAreaTableEntryfmt[]="niiixxxxxiixxxxxxxxxxxxxxxxx";
  1393.  const char WorldMapAreaEntryfmt[]="xinxffffixx";
  1394. diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
  1395. index 538603f..dd92d0d 100644
  1396. --- a/src/game/DynamicObject.cpp
  1397. +++ b/src/game/DynamicObject.cpp
  1398. @@ -60,7 +60,7 @@ void DynamicObject::RemoveFromWorld()
  1399.  
  1400.  bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius )
  1401.  {
  1402. -    WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
  1403. +    WorldObject::_Create(ObjectGuid(HIGHGUID_DYNAMICOBJECT, guidlow), caster->GetPhaseMask());
  1404.      SetMap(caster->GetMap());
  1405.      Relocate(x, y, z, 0);
  1406.  
  1407. diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
  1408. index d381d97..1015b96 100644
  1409. --- a/src/game/GameObject.cpp
  1410. +++ b/src/game/GameObject.cpp
  1411. @@ -115,7 +115,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
  1412.          return false;
  1413.      }
  1414.  
  1415. -    Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
  1416. +    Object::_Create(ObjectGuid(HIGHGUID_GAMEOBJECT, goinfo->id, guidlow));
  1417.  
  1418.      m_goInfo = goinfo;
  1419.  
  1420. @@ -1415,6 +1415,8 @@ void GameObject::Use(Unit* user)
  1421.                  BattleGround *bg = player->GetBattleGround();
  1422.                  if (!bg)
  1423.                      return;
  1424. +                if (player->GetVehicle())
  1425. +                    return;
  1426.                  // BG flag click
  1427.                  // AB:
  1428.                  // 15001
  1429. @@ -1451,6 +1453,8 @@ void GameObject::Use(Unit* user)
  1430.                  BattleGround *bg = player->GetBattleGround();
  1431.                  if (!bg)
  1432.                      return;
  1433. +                if (player->GetVehicle())
  1434. +                    return;
  1435.                  // BG flag dropped
  1436.                  // WS:
  1437.                  // 179785 - Silverwing Flag
  1438. diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h
  1439. index 2eeca26..d200a0d 100644
  1440. --- a/src/game/GridDefines.h
  1441. +++ b/src/game/GridDefines.h
  1442. @@ -26,7 +26,6 @@
  1443.  // Forward class definitions
  1444.  class Corpse;
  1445.  class Creature;
  1446. -class Vehicle;
  1447.  class DynamicObject;
  1448.  class GameObject;
  1449.  class Pet;
  1450. @@ -60,7 +59,7 @@ class Camera;
  1451.  // Cameras in world list just because linked with Player objects
  1452.  typedef TYPELIST_4(Player, Creature/*pets*/, Corpse/*resurrectable*/, Camera)           AllWorldObjectTypes;
  1453.  typedef TYPELIST_4(GameObject, Creature/*except pets*/, DynamicObject, Corpse/*Bones*/) AllGridObjectTypes;
  1454. -typedef TYPELIST_5(Creature, Pet, Vehicle, GameObject, DynamicObject)                   AllMapStoredObjectTypes;
  1455. +typedef TYPELIST_4(Creature, Pet, GameObject, DynamicObject)                            AllMapStoredObjectTypes;
  1456.  
  1457.  typedef GridRefManager<Camera>          CameraMapType;
  1458.  typedef GridRefManager<Corpse>          CorpseMapType;
  1459. diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
  1460. index 15a5db9..2add0ab 100644
  1461. --- a/src/game/GroupHandler.cpp
  1462. +++ b/src/game/GroupHandler.cpp
  1463. @@ -797,6 +797,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
  1464.          else
  1465.              *data << uint64(0);
  1466.      }
  1467. +
  1468. +    if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
  1469. +        *data << uint32(player->m_movementInfo.GetTransportDBCSeat());
  1470.  }
  1471.  
  1472.  /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
  1473. diff --git a/src/game/Item.cpp b/src/game/Item.cpp
  1474. index b62eda2..2c05c2c 100644
  1475. --- a/src/game/Item.cpp
  1476. +++ b/src/game/Item.cpp
  1477. @@ -247,7 +247,7 @@ Item::Item( )
  1478.  
  1479.  bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
  1480.  {
  1481. -    Object::_Create(guidlow, 0, HIGHGUID_ITEM);
  1482. +    Object::_Create(ObjectGuid(HIGHGUID_ITEM, guidlow));
  1483.  
  1484.      SetEntry(itemid);
  1485.      SetObjectScale(DEFAULT_OBJECT_SCALE);
  1486. @@ -381,7 +381,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
  1487.  {
  1488.      // create item before any checks for store correct guid
  1489.      // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
  1490. -    Object::_Create(guidLow, 0, HIGHGUID_ITEM);
  1491. +    Object::_Create(ObjectGuid(HIGHGUID_ITEM, guidLow));
  1492.  
  1493.      if (!LoadValues(fields[0].GetString()))
  1494.      {
  1495. diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
  1496. index e9d316b..546102a 100644
  1497. --- a/src/game/Level2.cpp
  1498. +++ b/src/game/Level2.cpp
  1499. @@ -1794,7 +1794,7 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
  1500.      else
  1501.          unit = getSelectedCreature();
  1502.  
  1503. -    if (!unit || unit->IsPet() || unit->IsTotem() || unit->IsVehicle())
  1504. +    if (!unit || unit->IsPet() || unit->IsTotem())
  1505.      {
  1506.          SendSysMessage(LANG_SELECT_CREATURE);
  1507.          SetSentErrorMessage(true);
  1508. diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
  1509. index 888330d..445bb37 100644
  1510. --- a/src/game/Level3.cpp
  1511. +++ b/src/game/Level3.cpp
  1512. @@ -4091,6 +4091,10 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/)
  1513.      std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(),true);
  1514.  
  1515.      PSendSysMessage(LANG_NPCINFO_CHAR,  target->GetDBTableGUIDLow(), faction, npcflags, Entry, displayid, nativeid);
  1516. +
  1517. +    if (cInfo->VehicleId)
  1518. +        PSendSysMessage("VehicleId: %u", cInfo->VehicleId);
  1519. +
  1520.      PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
  1521.      PSendSysMessage(LANG_NPCINFO_HEALTH,target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
  1522.      PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction());
  1523. diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp
  1524. index 0d480d5..f9349c1 100644
  1525. --- a/src/game/LootHandler.cpp
  1526. +++ b/src/game/LootHandler.cpp
  1527. @@ -83,6 +83,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
  1528.              break;
  1529.          }
  1530.          case HIGHGUID_UNIT:
  1531. +        case HIGHGUID_VEHICLE:
  1532.          {
  1533.              Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
  1534.  
  1535. @@ -216,6 +217,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
  1536.              break;
  1537.          }
  1538.          case HIGHGUID_UNIT:
  1539. +        case HIGHGUID_VEHICLE:
  1540.          {
  1541.              Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
  1542.  
  1543. @@ -460,6 +462,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
  1544.              return;                                         // item can be looted only single player
  1545.          }
  1546.          case HIGHGUID_UNIT:
  1547. +        case HIGHGUID_VEHICLE:
  1548.          {
  1549.              Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
  1550.  
  1551. @@ -520,7 +523,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
  1552.  
  1553.      Loot *pLoot = NULL;
  1554.  
  1555. -    if(lootguid.IsCreature())
  1556. +    if(lootguid.IsCreatureOrVehicle())
  1557.      {
  1558.          Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
  1559.          if(!pCreature)
  1560. diff --git a/src/game/Map.cpp b/src/game/Map.cpp
  1561. index b4abe04..e7af4f5 100644
  1562. --- a/src/game/Map.cpp
  1563. +++ b/src/game/Map.cpp
  1564. @@ -134,7 +134,7 @@ template<>
  1565.  void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
  1566.  {
  1567.      // add to world object registry in grid
  1568. -    if(obj->IsPet() || obj->IsVehicle())
  1569. +    if(obj->IsPet())
  1570.      {
  1571.          (*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj);
  1572.          obj->SetCurrentCell(cell);
  1573. @@ -178,7 +178,7 @@ template<>
  1574.  void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell)
  1575.  {
  1576.      // remove from world object registry in grid
  1577. -    if(obj->IsPet() || obj->IsVehicle())
  1578. +    if(obj->IsPet())
  1579.      {
  1580.          (*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj);
  1581.      }
  1582. @@ -1768,14 +1768,12 @@ void Map::ScriptsProcess()
  1583.                      break;
  1584.                  }
  1585.                  case HIGHGUID_UNIT:
  1586. +                case HIGHGUID_VEHICLE:
  1587.                      source = GetCreature(step.sourceGuid);
  1588.                      break;
  1589.                  case HIGHGUID_PET:
  1590.                      source = GetPet(step.sourceGuid);
  1591.                      break;
  1592. -                case HIGHGUID_VEHICLE:
  1593. -                    source = GetVehicle(step.sourceGuid);
  1594. -                    break;
  1595.                  case HIGHGUID_PLAYER:
  1596.                      source = HashMapHolder<Player>::Find(step.sourceGuid);
  1597.                      break;
  1598. @@ -1801,14 +1799,12 @@ void Map::ScriptsProcess()
  1599.              switch(step.targetGuid.GetHigh())
  1600.              {
  1601.                  case HIGHGUID_UNIT:
  1602. +                case HIGHGUID_VEHICLE:
  1603.                      target = GetCreature(step.targetGuid);
  1604.                      break;
  1605.                  case HIGHGUID_PET:
  1606.                      target = GetPet(step.targetGuid);
  1607.                      break;
  1608. -                case HIGHGUID_VEHICLE:
  1609. -                    target = GetVehicle(step.targetGuid);
  1610. -                    break;
  1611.                  case HIGHGUID_PLAYER:
  1612.                      target = HashMapHolder<Player>::Find(step.targetGuid);
  1613.                      break;
  1614. @@ -2876,16 +2872,6 @@ Creature* Map::GetCreature(ObjectGuid guid)
  1615.  }
  1616.  
  1617.  /**
  1618. - * Function return vehicle that in world at CURRENT map
  1619. - *
  1620. - * @param guid must be vehicle guid (HIGHGUID_VEHICLE)
  1621. - */
  1622. -Vehicle* Map::GetVehicle(ObjectGuid guid)
  1623. -{
  1624. -    return m_objectsStore.find<Vehicle>(guid.GetRawValue(), (Vehicle*)NULL);
  1625. -}
  1626. -
  1627. -/**
  1628.   * Function return pet that in world at CURRENT map
  1629.   *
  1630.   * @param guid must be pet guid (HIGHGUID_PET)
  1631. @@ -2917,9 +2903,9 @@ Creature* Map::GetAnyTypeCreature(ObjectGuid guid)
  1632.  {
  1633.      switch(guid.GetHigh())
  1634.      {
  1635. -        case HIGHGUID_UNIT:         return GetCreature(guid);
  1636. +        case HIGHGUID_UNIT:
  1637. +        case HIGHGUID_VEHICLE:      return GetCreature(guid);
  1638.          case HIGHGUID_PET:          return GetPet(guid);
  1639. -        case HIGHGUID_VEHICLE:      return GetVehicle(guid);
  1640.          default:                    break;
  1641.      }
  1642.  
  1643. @@ -2971,9 +2957,9 @@ WorldObject* Map::GetWorldObject(ObjectGuid guid)
  1644.      {
  1645.          case HIGHGUID_PLAYER:       return GetPlayer(guid);
  1646.          case HIGHGUID_GAMEOBJECT:   return GetGameObject(guid);
  1647. -        case HIGHGUID_UNIT:         return GetCreature(guid);
  1648. +        case HIGHGUID_UNIT:
  1649. +        case HIGHGUID_VEHICLE:      return GetCreature(guid);
  1650.          case HIGHGUID_PET:          return GetPet(guid);
  1651. -        case HIGHGUID_VEHICLE:      return GetVehicle(guid);
  1652.          case HIGHGUID_DYNAMICOBJECT:return GetDynamicObject(guid);
  1653.          case HIGHGUID_CORPSE:
  1654.          {
  1655. @@ -3018,8 +3004,6 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
  1656.              return m_DynObjectGuids.Generate();
  1657.          case HIGHGUID_PET:
  1658.              return m_PetGuids.Generate();
  1659. -        case HIGHGUID_VEHICLE:
  1660. -            return m_VehicleGuids.Generate();
  1661.          default:
  1662.              MANGOS_ASSERT(0);
  1663.      }
  1664. diff --git a/src/game/Map.h b/src/game/Map.h
  1665. index acad2cd..565a67d 100644
  1666. --- a/src/game/Map.h
  1667. +++ b/src/game/Map.h
  1668. @@ -217,7 +217,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
  1669.  
  1670.          Player* GetPlayer(ObjectGuid guid);
  1671.          Creature* GetCreature(ObjectGuid guid);
  1672. -        Vehicle* GetVehicle(ObjectGuid guid);
  1673.          Pet* GetPet(ObjectGuid guid);
  1674.          Creature* GetAnyTypeCreature(ObjectGuid guid);      // normal creature or pet or vehicle
  1675.          GameObject* GetGameObject(ObjectGuid guid);
  1676. @@ -323,7 +322,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
  1677.          // Map local low guid counters
  1678.          ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT> m_DynObjectGuids;
  1679.          ObjectGuidGenerator<HIGHGUID_PET> m_PetGuids;
  1680. -        ObjectGuidGenerator<HIGHGUID_VEHICLE> m_VehicleGuids;
  1681.  
  1682.          // Type specific code for add/remove to/from grid
  1683.          template<class T>
  1684. diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
  1685. index 412382e..bffdfae 100644
  1686. --- a/src/game/MovementHandler.cpp
  1687. +++ b/src/game/MovementHandler.cpp
  1688. @@ -48,6 +48,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
  1689.      WorldLocation old_loc;
  1690.      GetPlayer()->GetPosition(old_loc);
  1691.  
  1692. +    if (_player->GetVehicleKit())
  1693. +        _player->GetVehicleKit()->RemoveAllPassengers();
  1694. +
  1695.      // get the teleport destination
  1696.      WorldLocation &loc = GetPlayer()->GetTeleportDest();
  1697.  
  1698. @@ -420,7 +423,7 @@ void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
  1699.  
  1700.  void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
  1701.  {
  1702. -    DEBUG_LOG("WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
  1703. +    DEBUG_LOG("WORLD: Received CMSG_DISMISS_CONTROLLED_VEHICLE");
  1704.      recv_data.hexlike();
  1705.  
  1706.      ObjectGuid guid;
  1707. @@ -429,18 +432,163 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
  1708.      recv_data >> guid.ReadAsPacked();
  1709.      recv_data >> mi;
  1710.  
  1711. -    ObjectGuid vehicleGUID = _player->GetCharmGuid();
  1712. +    if(!GetPlayer()->GetVehicle())
  1713. +        return;
  1714. +
  1715. +    bool dismiss = true;
  1716. +
  1717. +    if (GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & (VEHICLE_FLAG_NOT_DISMISS | VEHICLE_FLAG_ACCESSORY))
  1718. +        dismiss = false;
  1719. +
  1720. +    GetPlayer()->m_movementInfo = mi;
  1721. +    GetPlayer()->ExitVehicle();
  1722. +
  1723. +    if (dismiss)
  1724. +        if (Creature* vehicle = GetPlayer()->GetMap()->GetAnyTypeCreature(guid))
  1725. +            vehicle->ForcedDespawn();
  1726. +}
  1727. +
  1728. +void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data)
  1729. +{
  1730. +    DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_EXIT");
  1731. +
  1732. +    GetPlayer()->ExitVehicle();
  1733. +}
  1734. +
  1735. +void WorldSession::HandleRequestVehiclePrevSeat(WorldPacket &recv_data)
  1736. +{
  1737. +    DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_PREV_SEAT");
  1738. +
  1739. +    GetPlayer()->ChangeSeat(-1, false);
  1740. +}
  1741. +
  1742. +void WorldSession::HandleRequestVehicleNextSeat(WorldPacket &recv_data)
  1743. +{
  1744. +    DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_NEXT_SEAT");
  1745. +
  1746. +    GetPlayer()->ChangeSeat(-1, true);
  1747. +}
  1748. +
  1749. +void WorldSession::HandleRequestVehicleSwitchSeat(WorldPacket &recv_data)
  1750. +{
  1751. +    DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_SWITCH_SEAT");
  1752. +    recv_data.hexlike();
  1753. +
  1754. +    ObjectGuid guid;
  1755. +    recv_data >> guid.ReadAsPacked();
  1756. +
  1757. +    int8 seatId;
  1758. +    recv_data >> seatId;
  1759. +
  1760. +    VehicleKit* pVehicle = GetPlayer()->GetVehicle();
  1761.  
  1762. -    if (vehicleGUID.IsEmpty())                              // something wrong here...
  1763. +    if (!pVehicle)
  1764.          return;
  1765.  
  1766. -    _player->m_movementInfo = mi;
  1767. +    if (GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
  1768. +        GetPlayer()->ExitVehicle();
  1769. +
  1770. +    if (pVehicle->GetBase()->GetObjectGuid() == guid)
  1771. +        GetPlayer()->ChangeSeat(seatId);
  1772. +    else if (Unit *Vehicle2 = GetPlayer()->GetMap()->GetUnit(guid))
  1773. +    {
  1774. +        if (VehicleKit *pVehicle2 = Vehicle2->GetVehicleKit())
  1775. +            if (pVehicle2->HasEmptySeat(seatId))
  1776. +            {
  1777. +                GetPlayer()->ExitVehicle();
  1778. +                GetPlayer()->EnterVehicle(pVehicle2, seatId);
  1779. +            }
  1780. +    }
  1781. +}
  1782. +
  1783. +void WorldSession::HandleEnterPlayerVehicle(WorldPacket &recv_data)
  1784. +{
  1785. +    DEBUG_LOG("WORLD: Received CMSG_PLAYER_VEHICLE_ENTER");
  1786. +    recv_data.hexlike();
  1787. +
  1788. +    ObjectGuid guid;
  1789. +    recv_data >> guid;
  1790. +
  1791. +    Player* player = sObjectMgr.GetPlayer(guid);
  1792. +
  1793. +    if (!player)
  1794. +        return;
  1795. +
  1796. +    if (!GetPlayer()->IsInSameRaidWith(player))
  1797. +        return;
  1798. +
  1799. +    if (!GetPlayer()->IsWithinDistInMap(player, INTERACTION_DISTANCE))
  1800. +        return;
  1801. +
  1802. +    if (player->GetTransport())
  1803. +        return;
  1804. +
  1805. +    if (VehicleKit* pVehicle = player->GetVehicleKit())
  1806. +        GetPlayer()->EnterVehicle(pVehicle);
  1807. +}
  1808. +
  1809. +void WorldSession::HandleEjectPasenger(WorldPacket &recv_data)
  1810. +{
  1811. +    DEBUG_LOG("WORLD: Received CMSG_EJECT_PASSENGER");
  1812. +    recv_data.hexlike();
  1813. +
  1814. +    ObjectGuid guid;
  1815. +    recv_data >> guid;
  1816. +
  1817. +    Unit* passenger = ObjectAccessor::GetUnit(*GetPlayer(), guid);
  1818. +
  1819. +    if (!passenger)
  1820. +        return;
  1821. +
  1822. +    if (!passenger->GetVehicle() || passenger->GetVehicle() != GetPlayer()->GetVehicleKit())
  1823. +        return;
  1824. +
  1825. +    passenger->ExitVehicle();
  1826. +
  1827. +    // eject and remove creatures of player mounts
  1828. +    if (passenger->GetTypeId() == TYPEID_UNIT)
  1829. +        passenger->AddObjectToRemoveList();
  1830. +}
  1831. +
  1832. +void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
  1833. +{
  1834. +    sLog.outDebug("WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE");
  1835. +    recv_data.hexlike();
  1836. +
  1837. +    ObjectGuid guid, guid2;
  1838. +    recv_data >> guid.ReadAsPacked();
  1839. +
  1840. +    MovementInfo mi;
  1841. +    recv_data >> mi;
  1842. +    GetPlayer()->m_movementInfo = mi;
  1843. +
  1844. +    recv_data >> guid2.ReadAsPacked(); //guid of vehicle or of vehicle in target seat
  1845. +
  1846. +    int8 seatId;
  1847. +    recv_data >> seatId;
  1848. +
  1849. +    VehicleKit* pVehicle = GetPlayer()->GetVehicle();
  1850. +
  1851. +    if (!pVehicle)
  1852. +        return;
  1853. +
  1854. +    if (GetPlayer()->GetVehicle()->GetVehicleInfo()->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
  1855. +        GetPlayer()->ExitVehicle();
  1856. +
  1857. +    if(guid.GetRawValue() == guid2.GetRawValue())
  1858. +        GetPlayer()->ChangeSeat(seatId, false);
  1859.  
  1860. -    // using charm guid, because we don't have vehicle guid...
  1861. -    if(Vehicle *vehicle = _player->GetMap()->GetVehicle(vehicleGUID))
  1862. +    else if (guid2.IsVehicle())
  1863.      {
  1864. -        // Aura::HandleAuraControlVehicle will call Player::ExitVehicle
  1865. -        vehicle->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
  1866. +        if (Creature* vehicle = GetPlayer()->GetMap()->GetAnyTypeCreature(guid2))
  1867. +        {
  1868. +            if (VehicleKit* pVehicle2 = vehicle->GetVehicleKit())
  1869. +                if(pVehicle2->HasEmptySeat(seatId))
  1870. +                {
  1871. +                    GetPlayer()->ExitVehicle();
  1872. +                    GetPlayer()->EnterVehicle(pVehicle2, seatId);
  1873. +                }
  1874. +        }
  1875.      }
  1876.  }
  1877.  
  1878. @@ -565,24 +713,28 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
  1879.      {
  1880.          if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))
  1881.          {
  1882. -            if (!plMover->m_transport)
  1883. +            if (!plMover->GetTransport())
  1884.              {
  1885.                  // elevators also cause the client to send MOVEFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
  1886.                  for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
  1887.                  {
  1888.                      if ((*iter)->GetObjectGuid() == movementInfo.GetTransportGuid())
  1889.                      {
  1890. -                        plMover->m_transport = (*iter);
  1891. +                        plMover->SetTransport(*iter);
  1892.                          (*iter)->AddPassenger(plMover);
  1893. +
  1894. +                        if (plMover->GetVehicleKit())
  1895. +                            plMover->GetVehicleKit()->RemoveAllPassengers();
  1896. +
  1897.                          break;
  1898.                      }
  1899.                  }
  1900.              }
  1901.          }
  1902. -        else if (plMover->m_transport)               // if we were on a transport, leave
  1903. +        else if (plMover->GetTransport())               // if we were on a transport, leave
  1904.          {
  1905. -            plMover->m_transport->RemovePassenger(plMover);
  1906. -            plMover->m_transport = NULL;
  1907. +            plMover->GetTransport()->RemovePassenger(plMover);
  1908. +            plMover->SetTransport(NULL);
  1909.              movementInfo.ClearTransportData();
  1910.          }
  1911.  
  1912. @@ -629,6 +781,9 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
  1913.      else                                                    // creature charmed
  1914.      {
  1915.          if (mover->IsInWorld())
  1916. -            mover->GetMap()->CreatureRelocation((Creature*)mover, movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
  1917. +        {
  1918. +            mover->m_movementInfo = movementInfo;
  1919. +            mover->SetPosition(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
  1920. +        }
  1921.      }
  1922.  }
  1923. diff --git a/src/game/Object.cpp b/src/game/Object.cpp
  1924. index 2dfa981..e4c86d9 100644
  1925. --- a/src/game/Object.cpp
  1926. +++ b/src/game/Object.cpp
  1927. @@ -92,12 +92,11 @@ void Object::_InitValues()
  1928.      m_objectUpdated = false;
  1929.  }
  1930.  
  1931. -void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
  1932. +void Object::_Create(ObjectGuid guid)
  1933.  {
  1934.      if(!m_uint32Values)
  1935.          _InitValues();
  1936.  
  1937. -    ObjectGuid guid = ObjectGuid(guidhigh, entry, guidlow);
  1938.      SetGuidValue(OBJECT_FIELD_GUID, guid);
  1939.      SetUInt32Value(OBJECT_FIELD_TYPE, m_objectType);
  1940.      m_PackGUID.Set(guid);
  1941. @@ -231,7 +230,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
  1942.      uint16 moveFlags2 = (isType(TYPEMASK_UNIT) ? ((Unit*)this)->m_movementInfo.GetMovementFlags2() : MOVEFLAG2_NONE);
  1943.  
  1944.      if(GetTypeId() == TYPEID_UNIT)
  1945. -        if(((Creature*)this)->IsVehicle())
  1946. +        if(((Creature*)this)->GetVehicleKit())
  1947.              moveFlags2 |= MOVEFLAG2_ALLOW_PITCHING;         // always allow pitch
  1948.  
  1949.      *data << uint16(updateFlags);                           // update flags
  1950. @@ -276,11 +275,6 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
  1951.              {
  1952.                  Player *player = ((Player*)unit);
  1953.  
  1954. -                if(player->GetTransport())
  1955. -                    player->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
  1956. -                else
  1957. -                    player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
  1958. -
  1959.                  // remove unknown, unused etc flags for now
  1960.                  player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_SPLINE_ENABLED);
  1961.  
  1962. @@ -294,6 +288,11 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
  1963.              break;
  1964.          }
  1965.  
  1966. +        if (unit->GetTransport() || unit->GetVehicle())
  1967. +            unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
  1968. +        else
  1969. +            unit->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
  1970. +
  1971.          // Update movement info time
  1972.          unit->m_movementInfo.UpdateTime(WorldTimer::getMSTime());
  1973.          // Write movement info
  1974. @@ -506,9 +505,9 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
  1975.      }
  1976.  
  1977.      // 0x80
  1978. -    if(updateFlags & UPDATEFLAG_VEHICLE)                    // unused for now
  1979. +    if(updateFlags & UPDATEFLAG_VEHICLE)
  1980.      {
  1981. -        *data << uint32(((Vehicle*)this)->GetVehicleId());  // vehicle id
  1982. +        *data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleId());  // vehicle id
  1983.          *data << float(((WorldObject*)this)->GetOrientation());
  1984.      }
  1985.  
  1986. @@ -1047,9 +1046,9 @@ void WorldObject::CleanupsBeforeDelete()
  1987.      RemoveFromWorld();
  1988.  }
  1989.  
  1990. -void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask )
  1991. +void WorldObject::_Create(ObjectGuid guid, uint32 phaseMask)
  1992.  {
  1993. -    Object::_Create(guidlow, 0, guidhigh);
  1994. +    Object::_Create(guid);
  1995.      m_phaseMask = phaseMask;
  1996.  }
  1997.  
  1998. diff --git a/src/game/Object.h b/src/game/Object.h
  1999. index 9aa64e5..35b9a03 100644
  2000. --- a/src/game/Object.h
  2001. +++ b/src/game/Object.h
  2002. @@ -355,7 +355,7 @@ class MANGOS_DLL_SPEC Object
  2003.          Object ( );
  2004.  
  2005.          void _InitValues();
  2006. -        void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
  2007. +        void _Create(ObjectGuid guid);
  2008.  
  2009.          virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
  2010.  
  2011. @@ -427,7 +427,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
  2012.  
  2013.          virtual void Update ( uint32 /*update_diff*/, uint32 /*time_diff*/ ) {}
  2014.  
  2015. -        void _Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
  2016. +        void _Create(ObjectGuid guid, uint32 phaseMask);
  2017.  
  2018.          void Relocate(float x, float y, float z, float orientation);
  2019.          void Relocate(float x, float y, float z);
  2020. diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp
  2021. index a9de5d0..d4f56ec 100644
  2022. --- a/src/game/ObjectGridLoader.cpp
  2023. +++ b/src/game/ObjectGridLoader.cpp
  2024. @@ -57,7 +57,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
  2025.  
  2026.          Creature * c = iter->getSource();
  2027.  
  2028. -        MANGOS_ASSERT((!c->IsPet() || !c->IsVehicle()) && "ObjectGridRespawnMover don't must be called for pets");
  2029. +        MANGOS_ASSERT(!c->IsPet() && "ObjectGridRespawnMover don't must be called for pets");
  2030.  
  2031.          Cell const& cur_cell  = c->GetCurrentCell();
  2032.  
  2033. diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
  2034. index 56174f1..679fbfc 100644
  2035. --- a/src/game/ObjectMgr.cpp
  2036. +++ b/src/game/ObjectMgr.cpp
  2037. @@ -654,6 +654,12 @@ void ObjectMgr::LoadCreatureTemplates()
  2038.          if (!displayScaleEntry)
  2039.              sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid in modelid_1/modelid_2/modelid_3/modelid_4", cInfo->Entry);
  2040.  
  2041. +        if (cInfo->powerType >= MAX_POWERS)
  2042. +        {
  2043. +            sLog.outErrorDb("Creature (Entry: %u) has invalid power type (%u)", cInfo->Entry, cInfo->powerType);
  2044. +            const_cast<CreatureInfo*>(cInfo)->powerType = POWER_MANA;
  2045. +        }
  2046. +
  2047.          // use below code for 0-checks for unit_class
  2048.          if (!cInfo->unit_class)
  2049.              ERROR_DB_STRICT_LOG("Creature (Entry: %u) not has proper unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class);
  2050. @@ -716,6 +722,15 @@ void ObjectMgr::LoadCreatureTemplates()
  2051.              }
  2052.          }
  2053.  
  2054. +        if (cInfo->VehicleId)
  2055. +        {
  2056. +            if (!sVehicleStore.LookupEntry(cInfo->VehicleId))
  2057. +            {
  2058. +                sLog.outErrorDb("Creature (Entry: %u) has non-existing VehicleId (%u)", cInfo->Entry, cInfo->VehicleId);
  2059. +                const_cast<CreatureInfo*>(cInfo)->VehicleId = 0;
  2060. +            }
  2061. +        }
  2062. +
  2063.          if(cInfo->MovementType >= MAX_DB_MOTION_TYPE)
  2064.          {
  2065.              sLog.outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignore and set to IDLE.",cInfo->Entry,cInfo->MovementType);
  2066. @@ -1440,6 +1455,60 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
  2067.      }
  2068.  }
  2069.  
  2070. +void ObjectMgr::LoadVehicleAccessories()
  2071. +{
  2072. +    m_VehicleAccessoryMap.clear();                           // needed for reload case
  2073. +
  2074. +    uint32 count = 0;
  2075. +
  2076. +    QueryResult* result = WorldDatabase.Query("SELECT `entry`,`accessory_entry`,`seat_id`,`minion` FROM `vehicle_accessory`");
  2077. +
  2078. +    if (!result)
  2079. +    {
  2080. +        barGoLink bar(1);
  2081. +
  2082. +        bar.step();
  2083. +
  2084. +        sLog.outString();
  2085. +        sLog.outErrorDb(">> Loaded 0 vehicle accessories. DB table `vehicle_accessory` is empty.");
  2086. +        return;
  2087. +    }
  2088. +
  2089. +    barGoLink bar((int)result->GetRowCount());
  2090. +
  2091. +    do
  2092. +    {
  2093. +        Field *fields = result->Fetch();
  2094. +        bar.step();
  2095. +
  2096. +        uint32 uiEntry       = fields[0].GetUInt32();
  2097. +        uint32 uiAccessory   = fields[1].GetUInt32();
  2098. +        int8   uiSeat        = int8(fields[2].GetInt16());
  2099. +        bool   bMinion       = fields[3].GetBool();
  2100. +
  2101. +        if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiEntry))
  2102. +        {
  2103. +            sLog.outErrorDb("Table `vehicle_accessory`: creature template entry %u does not exist.", uiEntry);
  2104. +            continue;
  2105. +        }
  2106. +
  2107. +        if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiAccessory))
  2108. +        {
  2109. +            sLog.outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
  2110. +            continue;
  2111. +        }
  2112. +
  2113. +        m_VehicleAccessoryMap[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion));
  2114. +
  2115. +        ++count;
  2116. +    } while (result->NextRow());
  2117. +
  2118. +    delete result;
  2119. +
  2120. +    sLog.outString();
  2121. +    sLog.outString(">> Loaded %u Vehicle Accessories", count);
  2122. +}
  2123. +
  2124.  void ObjectMgr::LoadGameobjects()
  2125.  {
  2126.      uint32 count = 0;
  2127. @@ -5776,6 +5845,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
  2128.          case HIGHGUID_ITEM:
  2129.              return m_ItemGuids.Generate();
  2130.          case HIGHGUID_UNIT:
  2131. +        case HIGHGUID_VEHICLE:
  2132.              return m_CreatureGuids.Generate();
  2133.          case HIGHGUID_PLAYER:
  2134.              return m_CharGuids.Generate();
  2135. diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
  2136. index 0703e97..5b968bf 100644
  2137. --- a/src/game/ObjectMgr.h
  2138. +++ b/src/game/ObjectMgr.h
  2139. @@ -36,6 +36,7 @@
  2140.  #include "ObjectGuid.h"
  2141.  #include "Policies/Singleton.h"
  2142.  #include "SQLStorages.h"
  2143. +#include "Vehicle.h"
  2144.  
  2145.  #include <string>
  2146.  #include <map>
  2147. @@ -627,6 +628,14 @@ class ObjectMgr
  2148.              return NULL;
  2149.          }
  2150.  
  2151. +        VehicleAccessoryList const* GetVehicleAccessoryList(uint32 uiEntry) const
  2152. +        {
  2153. +            VehicleAccessoryMap::const_iterator itr = m_VehicleAccessoryMap.find(uiEntry);
  2154. +            if (itr != m_VehicleAccessoryMap.end())
  2155. +                return &itr->second;
  2156. +            return NULL;
  2157. +        }
  2158. +
  2159.          void LoadGuilds();
  2160.          void LoadArenaTeams();
  2161.          void LoadGroups();
  2162. @@ -708,6 +717,8 @@ class ObjectMgr
  2163.          void LoadTrainerTemplates();
  2164.          void LoadTrainers() { LoadTrainers("npc_trainer", false); }
  2165.  
  2166. +        void LoadVehicleAccessories();
  2167. +
  2168.          std::string GeneratePetName(uint32 entry);
  2169.          uint32 GetBaseXP(uint32 level) const;
  2170.          uint32 GetXPForLevel(uint32 level) const;
  2171. @@ -1098,6 +1109,8 @@ class ObjectMgr
  2172.          ItemConvertMap        m_ItemConvert;
  2173.          ItemRequiredTargetMap m_ItemRequiredTarget;
  2174.  
  2175. +        VehicleAccessoryMap m_VehicleAccessoryMap;
  2176. +
  2177.          typedef             std::vector<LocaleConstant> LocalForIndex;
  2178.          LocalForIndex        m_LocalForIndex;
  2179.  
  2180. diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
  2181. index e81f6a9..08f3fda 100644
  2182. --- a/src/game/Opcodes.cpp
  2183. +++ b/src/game/Opcodes.cpp
  2184. @@ -1168,10 +1168,10 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
  2185.      /*0x473*/ { "CMSG_CHAR_CUSTOMIZE",                          STATUS_AUTHED,   PROCESS_THREADUNSAFE, &WorldSession::HandleCharCustomizeOpcode       },
  2186.      /*0x474*/ { "SMSG_CHAR_CUSTOMIZE",                          STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2187.      /*0x475*/ { "SMSG_PET_RENAMEABLE",                          STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2188. -    /*0x476*/ { "CMSG_REQUEST_VEHICLE_EXIT",                    STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2189. -    /*0x477*/ { "CMSG_REQUEST_VEHICLE_PREV_SEAT",               STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2190. -    /*0x478*/ { "CMSG_REQUEST_VEHICLE_NEXT_SEAT",               STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2191. -    /*0x479*/ { "CMSG_REQUEST_VEHICLE_SWITCH_SEAT",             STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2192. +    /*0x476*/ { "CMSG_REQUEST_VEHICLE_EXIT",                    STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleExit        },
  2193. +    /*0x477*/ { "CMSG_REQUEST_VEHICLE_PREV_SEAT",               STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehiclePrevSeat    },
  2194. +    /*0x478*/ { "CMSG_REQUEST_VEHICLE_NEXT_SEAT",               STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleNextSeat    },
  2195. +    /*0x479*/ { "CMSG_REQUEST_VEHICLE_SWITCH_SEAT",             STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleSwitchSeat  },
  2196.      /*0x47A*/ { "CMSG_PET_LEARN_TALENT",                        STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandlePetLearnTalent            },
  2197.      /*0x47B*/ { "CMSG_PET_UNLEARN_TALENTS",                     STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2198.      /*0x47C*/ { "SMSG_SET_PHASE_SHIFT",                         STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2199. @@ -1205,7 +1205,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
  2200.      /*0x498*/ { "SMSG_SERVER_FIRST_ACHIEVEMENT",                STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2201.      /*0x499*/ { "SMSG_PET_LEARNED_SPELL",                       STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2202.      /*0x49A*/ { "SMSG_PET_REMOVED_SPELL",                       STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2203. -    /*0x49B*/ { "CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE",      STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2204. +    /*0x49B*/ { "CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE",      STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChangeSeatsOnControlledVehicle},
  2205.      /*0x49C*/ { "CMSG_HEARTH_AND_RESURRECT",                    STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleHearthandResurrect        },
  2206.      /*0x49D*/ { "SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA",    STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2207.      /*0x49E*/ { "SMSG_CRITERIA_DELETED",                        STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2208. @@ -1218,8 +1218,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
  2209.      /*0x4A5*/ { "UMSG_UNKNOWN_1189",                            STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2210.      /*0x4A6*/ { "SMSG_BATTLEGROUND_INFO_THROTTLED",             STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2211.      /*0x4A7*/ { "SMSG_PLAYER_VEHICLE_DATA",                     STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2212. -    /*0x4A8*/ { "CMSG_PLAYER_VEHICLE_ENTER",                    STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2213. -    /*0x4A9*/ { "CMSG_EJECT_PASSENGER",                         STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2214. +    /*0x4A8*/ { "CMSG_PLAYER_VEHICLE_ENTER",                    STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleEnterPlayerVehicle        },
  2215. +    /*0x4A9*/ { "CMSG_EJECT_PASSENGER",                         STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleEjectPasenger             },
  2216.      /*0x4AA*/ { "SMSG_PET_GUIDS",                               STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2217.      /*0x4AB*/ { "SMSG_CLIENTCACHE_VERSION",                     STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_ServerSide               },
  2218.      /*0x4AC*/ { "UMSG_UNKNOWN_1196",                            STATUS_NEVER,    PROCESS_INPLACE,      &WorldSession::Handle_NULL                     },
  2219. diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
  2220. index a69a73e..e82e6a4 100644
  2221. --- a/src/game/Pet.cpp
  2222. +++ b/src/game/Pet.cpp
  2223. @@ -572,43 +572,6 @@ void Pet::Update(uint32 update_diff, uint32 diff)
  2224.      Creature::Update(update_diff, diff);
  2225.  }
  2226.  
  2227. -void Pet::Regenerate(Powers power)
  2228. -{
  2229. -    uint32 curValue = GetPower(power);
  2230. -    uint32 maxValue = GetMaxPower(power);
  2231. -
  2232. -    if (curValue >= maxValue)
  2233. -        return;
  2234. -
  2235. -    float addvalue = 0.0f;
  2236. -
  2237. -    switch (power)
  2238. -    {
  2239. -        case POWER_FOCUS:
  2240. -        {
  2241. -            // For hunter pets.
  2242. -            addvalue = 24 * sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_FOCUS);
  2243. -            break;
  2244. -        }
  2245. -        case POWER_ENERGY:
  2246. -        {
  2247. -            // For deathknight's ghoul.
  2248. -            addvalue = 20;
  2249. -            break;
  2250. -        }
  2251. -        default:
  2252. -            return;
  2253. -    }
  2254. -
  2255. -    // Apply modifiers (if any).
  2256. -    AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
  2257. -    for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
  2258. -        if ((*i)->GetModifier()->m_miscvalue == int32(power))
  2259. -            addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
  2260. -
  2261. -    ModifyPower(power, (int32)addvalue);
  2262. -}
  2263. -
  2264.  void Pet::LooseHappiness()
  2265.  {
  2266.      uint32 curValue = GetPower(POWER_HAPPINESS);
  2267. @@ -1929,7 +1892,7 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint3
  2268.      SetMap(map);
  2269.      SetPhaseMask(phaseMask,false);
  2270.  
  2271. -    Object::_Create(guidlow, pet_number, HIGHGUID_PET);
  2272. +    Object::_Create(ObjectGuid(HIGHGUID_PET, pet_number, guidlow));
  2273.  
  2274.      m_DBTableGuid = guidlow;
  2275.      m_originalEntry = Entry;
  2276. diff --git a/src/game/Pet.h b/src/game/Pet.h
  2277. index 184626c..c5f681e 100644
  2278. --- a/src/game/Pet.h
  2279. +++ b/src/game/Pet.h
  2280. @@ -168,7 +168,6 @@ class Pet : public Creature
  2281.                  return m_autospells[pos];
  2282.          }
  2283.  
  2284. -        void Regenerate(Powers power);
  2285.          void LooseHappiness();
  2286.          HappinessState GetHappinessState();
  2287.          void GivePetXP(uint32 xp);
  2288. diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp
  2289. index 0c4a996..d8af4da 100644
  2290. --- a/src/game/PetAI.cpp
  2291. +++ b/src/game/PetAI.cpp
  2292. @@ -192,7 +192,7 @@ void PetAI::UpdateAI(const uint32 diff)
  2293.      }
  2294.  
  2295.      // Autocast (casted only in combat or persistent spells in any state)
  2296. -    if (!m_creature->IsNonMeleeSpellCasted(false))
  2297. +    if (!m_creature->IsNonMeleeSpellCasted(false) && !m_creature->GetObjectGuid().IsVehicle())
  2298.      {
  2299.          typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
  2300.          TargetSpellList targetSpellStore;
  2301. diff --git a/src/game/Player.cpp b/src/game/Player.cpp
  2302. index 545f359..4a31cb1 100644
  2303. --- a/src/game/Player.cpp
  2304. +++ b/src/game/Player.cpp
  2305. @@ -406,8 +406,6 @@ UpdateMask Player::updateVisualBits;
  2306.  
  2307.  Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m_achievementMgr(this), m_reputationMgr(this)
  2308.  {
  2309. -    m_transport = 0;
  2310. -
  2311.      m_speakTime = 0;
  2312.      m_speakCount = 0;
  2313.  
  2314. @@ -613,9 +611,7 @@ Player::~Player ()
  2315.      delete PlayerTalkClass;
  2316.  
  2317.      if (m_transport)
  2318. -    {
  2319.          m_transport->RemovePassenger(this);
  2320. -    }
  2321.  
  2322.      for(size_t x = 0; x < ItemSetEff.size(); x++)
  2323.          if(ItemSetEff[x])
  2324. @@ -644,7 +640,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
  2325.  {
  2326.      //FIXME: outfitId not used in player creating
  2327.  
  2328. -    Object::_Create(guidlow, 0, HIGHGUID_PLAYER);
  2329. +    Object::_Create(ObjectGuid(HIGHGUID_PLAYER, guidlow));
  2330.  
  2331.      m_name = name;
  2332.  
  2333. @@ -1759,10 +1755,15 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
  2334.      if (!(options & TELE_TO_NOT_LEAVE_TRANSPORT) && m_transport)
  2335.      {
  2336.          m_transport->RemovePassenger(this);
  2337. -        m_transport = NULL;
  2338. +        SetTransport(NULL);
  2339.          m_movementInfo.ClearTransportData();
  2340.      }
  2341.  
  2342. +    if (GetVehicleKit())
  2343. +        GetVehicleKit()->RemoveAllPassengers();
  2344. +
  2345. +    ExitVehicle();
  2346. +
  2347.      // The player was ported to another map and looses the duel immediately.
  2348.      // We have to perform this check before the teleport, otherwise the
  2349.      // ObjectAccessor won't find the flag.
  2350. @@ -1776,7 +1777,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
  2351.      // reset movement flags at teleport, because player will continue move with these flags after teleport
  2352.      m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
  2353.  
  2354. -    if ((GetMapId() == mapid) && (!m_transport))
  2355. +    if (GetMapId() == mapid && !m_transport)
  2356.      {
  2357.          //lets reset far teleport flag if it wasn't reset during chained teleports
  2358.          SetSemaphoreTeleportFar(false);
  2359. @@ -2238,7 +2239,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
  2360.          return NULL;
  2361.  
  2362.      // not in interactive state
  2363. -    if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL))
  2364. +    if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)  && !hasUnitState(UNIT_STAT_ON_VEHICLE))
  2365.          return NULL;
  2366.  
  2367.      // exist (we need look pets also for some interaction (quest/etc)
  2368. @@ -2292,7 +2293,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameo
  2369.          return NULL;
  2370.  
  2371.      // not in interactive state
  2372. -    if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL))
  2373. +    if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && !hasUnitState(UNIT_STAT_ON_VEHICLE))
  2374.          return NULL;
  2375.  
  2376.      if (GameObject *go = GetMap()->GetGameObject(guid))
  2377. @@ -2517,6 +2518,9 @@ void Player::GiveXP(uint32 xp, Unit* victim)
  2378.      if(!isAlive())
  2379.          return;
  2380.  
  2381. +    if(hasUnitState(UNIT_STAT_ON_VEHICLE))
  2382. +        return;
  2383. +
  2384.      uint32 level = getLevel();
  2385.  
  2386.      // XP to money conversion processed in Player::RewardQuest
  2387. @@ -4008,6 +4012,7 @@ void Player::InitVisibleBits()
  2388.      updateVisualBits.SetBit(PLAYER_BYTES_3);
  2389.      updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
  2390.      updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
  2391. +    updateVisualBits.SetBit(UNIT_NPC_FLAGS);
  2392.  
  2393.      // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
  2394.      for(uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
  2395. @@ -6070,49 +6075,18 @@ ActionButton const* Player::GetActionButton(uint8 button)
  2396.  
  2397.  bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport)
  2398.  {
  2399. -    // prevent crash when a bad coord is sent by the client
  2400. -    if(!MaNGOS::IsValidMapCoord(x,y,z,orientation))
  2401. -    {
  2402. -        DEBUG_LOG("Player::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for player %d!",x,y,z,orientation,teleport,GetGUIDLow());
  2403. +    if (!Unit::SetPosition(x, y, z, orientation, teleport))
  2404.          return false;
  2405. -    }
  2406. -
  2407. -    Map *m = GetMap();
  2408. -
  2409. -    const float old_x = GetPositionX();
  2410. -    const float old_y = GetPositionY();
  2411. -    const float old_z = GetPositionZ();
  2412. -    const float old_r = GetOrientation();
  2413. -
  2414. -    if( teleport || old_x != x || old_y != y || old_z != z || old_r != orientation )
  2415. -    {
  2416. -        if (teleport || old_x != x || old_y != y || old_z != z)
  2417. -            RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING);
  2418. -        else
  2419. -            RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
  2420.  
  2421. -        RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
  2422. -
  2423. -        // move and update visible state if need
  2424. -        m->PlayerRelocation(this, x, y, z, orientation);
  2425. -
  2426. -        // reread after Map::Relocation
  2427. -        m = GetMap();
  2428. -        x = GetPositionX();
  2429. -        y = GetPositionY();
  2430. -        z = GetPositionZ();
  2431. +    // group update
  2432. +    if (GetGroup())
  2433. +        SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
  2434.  
  2435. -        // group update
  2436. -        if (GetGroup() && (old_x != x || old_y != y))
  2437. -            SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
  2438. -
  2439. -        if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
  2440. -            GetSession()->SendCancelTrade();   // will close both side trade windows
  2441. -    }
  2442. +    if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
  2443. +        GetSession()->SendCancelTrade();   // will close both side trade windows
  2444.  
  2445.      // code block for underwater state update
  2446. -    UpdateUnderwaterState(m, x, y, z);
  2447. -
  2448. +    UpdateUnderwaterState(GetMap(), x, y, z);
  2449.      CheckAreaExploreAndOutdoor();
  2450.  
  2451.      return true;
  2452. @@ -8018,6 +7992,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
  2453.              break;
  2454.          }
  2455.          case HIGHGUID_UNIT:
  2456. +        case HIGHGUID_VEHICLE:
  2457.          {
  2458.              Creature *creature = GetMap()->GetCreature(guid);
  2459.  
  2460. @@ -14629,7 +14604,7 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid )
  2461.  
  2462.  void Player::CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id, bool original_caster )
  2463.  {
  2464. -    bool isCreature = guid.IsCreature();
  2465. +    bool isCreature = guid.IsCreatureOrVehicle();
  2466.  
  2467.      uint32 addCastCount = 1;
  2468.      for(int i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
  2469. @@ -15191,7 +15166,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
  2470.          return false;
  2471.      }
  2472.  
  2473. -    Object::_Create(guid.GetCounter(), 0, HIGHGUID_PLAYER );
  2474. +    Object::_Create(guid);
  2475.  
  2476.      m_name = fields[2].GetCppString();
  2477.  
  2478. @@ -15412,19 +15387,21 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
  2479.      {
  2480.          for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
  2481.          {
  2482. -            if( (*iter)->GetGUIDLow() == transGUID)
  2483. +            Transport* transport = *iter;
  2484. +
  2485. +            if (transport->GetGUIDLow() == transGUID)
  2486.              {
  2487. -                MapEntry const* transMapEntry = sMapStore.LookupEntry((*iter)->GetMapId());
  2488. +                MapEntry const* transMapEntry = sMapStore.LookupEntry(transport->GetMapId());
  2489.                  // client without expansion support
  2490.                  if(GetSession()->Expansion() < transMapEntry->Expansion())
  2491.                  {
  2492. -                    DEBUG_LOG("Player %s using client without required expansion tried login at transport at non accessible map %u", GetName(), (*iter)->GetMapId());
  2493. +                    DEBUG_LOG("Player %s using client without required expansion tried login at transport at non accessible map %u", GetName(), transport->GetMapId());
  2494.                      break;
  2495.                  }
  2496.  
  2497. -                m_transport = *iter;
  2498. -                m_transport->AddPassenger(this);
  2499. -                SetLocationMapId(m_transport->GetMapId());
  2500. +                SetTransport(transport);
  2501. +                transport->AddPassenger(this);
  2502. +                SetLocationMapId(transport->GetMapId());
  2503.                  break;
  2504.              }
  2505.          }
  2506. @@ -18070,6 +18047,59 @@ void Player::PossessSpellInitialize()
  2507.      GetSession()->SendPacket(&data);
  2508.  }
  2509.  
  2510. +void Player::VehicleSpellInitialize()
  2511. +{
  2512. +    Creature* charm = (Creature*)GetCharm();
  2513. +
  2514. +    if (!charm)
  2515. +        return;
  2516. +
  2517. +    CharmInfo *charmInfo = charm->GetCharmInfo();
  2518. +
  2519. +    if (!charmInfo)
  2520. +    {
  2521. +        sLog.outError("Player::VehicleSpellInitialize(): vehicle (GUID: %u) has no charminfo!", charm->GetGUIDLow());
  2522. +        return;
  2523. +    }
  2524. +
  2525. +    size_t cooldownsCount = charm->m_CreatureSpellCooldowns.size() + charm->m_CreatureCategoryCooldowns.size();
  2526. +
  2527. +    WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1+cooldownsCount*(4+2+4+4));
  2528. +    data << charm->GetObjectGuid();
  2529. +    data << uint16(0);
  2530. +    data << uint32(0);
  2531. +    data << uint32(0x08000101);                             // react state
  2532. +
  2533. +    charmInfo->BuildActionBar(&data);
  2534. +
  2535. +    data << uint8(0);                                       // additional spells count
  2536. +    data << uint8(cooldownsCount);
  2537. +
  2538. +    time_t curTime = time(NULL);
  2539. +
  2540. +    for (CreatureSpellCooldowns::const_iterator itr = charm->m_CreatureSpellCooldowns.begin(); itr != charm->m_CreatureSpellCooldowns.end(); ++itr)
  2541. +    {
  2542. +        time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
  2543. +
  2544. +        data << uint32(itr->first);                         // spellid
  2545. +        data << uint16(0);                                  // spell category?
  2546. +        data << uint32(cooldown);                           // cooldown
  2547. +        data << uint32(0);                                  // category cooldown
  2548. +    }
  2549. +
  2550. +    for (CreatureSpellCooldowns::const_iterator itr = charm->m_CreatureCategoryCooldowns.begin(); itr != charm->m_CreatureCategoryCooldowns.end(); ++itr)
  2551. +    {
  2552. +        time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
  2553. +
  2554. +        data << uint32(itr->first);                         // spellid
  2555. +        data << uint16(0);                                  // spell category?
  2556. +        data << uint32(0);                                  // cooldown
  2557. +        data << uint32(cooldown);                           // category cooldown
  2558. +    }
  2559. +
  2560. +    GetSession()->SendPacket(&data);
  2561. +}
  2562. +
  2563.  void Player::CharmSpellInitialize()
  2564.  {
  2565.      Unit* charm = GetCharm();
  2566. @@ -18387,7 +18417,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
  2567.      if (npc)
  2568.      {
  2569.          // not let cheating with start flight mounted
  2570. -        if (IsMounted())
  2571. +        if (IsMounted() || GetVehicle())
  2572.          {
  2573.              WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
  2574.              data << uint32(ERR_TAXIPLAYERALREADYMOUNTED);
  2575. @@ -18416,6 +18446,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
  2576.      else
  2577.      {
  2578.          RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
  2579. +        ExitVehicle();
  2580.  
  2581.          if (IsInDisallowedMountForm())
  2582.              RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
  2583. @@ -19567,7 +19598,10 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
  2584.              // target aura duration for caster show only if target exist at caster client
  2585.              // send data at target visibility change (adding to client)
  2586.              if(target!=this && target->isType(TYPEMASK_UNIT))
  2587. +            {
  2588.                  SendAurasForTarget((Unit*)target);
  2589. +                ((Unit*)target)->SendHeartBeat(false);
  2590. +            }
  2591.  
  2592.              if(target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isAlive())
  2593.                  ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this);
  2594. @@ -19799,6 +19833,14 @@ void Player::SendInitialPacketsAfterAddToMap()
  2595.          SendMessageToSet(&data2,true);
  2596.      }
  2597.  
  2598. +    if(GetVehicle())
  2599. +    {
  2600. +        WorldPacket data3(SMSG_FORCE_MOVE_ROOT, 10);
  2601. +        data3 << GetPackGUID();
  2602. +        data3 << uint32((m_movementInfo.GetVehicleSeatFlags() & SEAT_FLAG_CAN_CAST) ? 2 : 0);
  2603. +        SendMessageToSet(&data3,true);
  2604. +    }
  2605. +
  2606.      SendAurasForTarget(this);
  2607.      SendEnchantmentDurations();                             // must be after add to map
  2608.      SendItemDurations();                                    // must be after add to map
  2609. @@ -21074,98 +21116,6 @@ void Player::ApplyGlyphs(bool apply)
  2610.          ApplyGlyph(i,apply);
  2611.  }
  2612.  
  2613. -void Player::EnterVehicle(Vehicle *vehicle)
  2614. -{
  2615. -    VehicleEntry const *ve = sVehicleStore.LookupEntry(vehicle->GetVehicleId());
  2616. -    if(!ve)
  2617. -        return;
  2618. -
  2619. -    VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(ve->m_seatID[0]);
  2620. -    if(!veSeat)
  2621. -        return;
  2622. -
  2623. -    vehicle->SetCharmerGuid(GetObjectGuid());
  2624. -    vehicle->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
  2625. -    vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
  2626. -    vehicle->setFaction(getFaction());
  2627. -
  2628. -    SetCharm(vehicle);                                      // charm
  2629. -    m_camera.SetView(vehicle);                              // set view
  2630. -
  2631. -    SetClientControl(vehicle, 1);                           // redirect controls to vehicle
  2632. -    SetMover(vehicle);
  2633. -
  2634. -    WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
  2635. -    GetSession()->SendPacket(&data);
  2636. -
  2637. -    data.Initialize(MSG_MOVE_TELEPORT_ACK, 30);
  2638. -    data << GetPackGUID();
  2639. -    data << uint32(0);                                      // counter?
  2640. -    data << uint32(MOVEFLAG_ONTRANSPORT);                   // transport
  2641. -    data << uint16(0);                                      // special flags
  2642. -    data << uint32(WorldTimer::getMSTime());                            // time
  2643. -    data << vehicle->GetPositionX();                        // x
  2644. -    data << vehicle->GetPositionY();                        // y
  2645. -    data << vehicle->GetPositionZ();                        // z
  2646. -    data << vehicle->GetOrientation();                      // o
  2647. -    // transport part, TODO: load/calculate seat offsets
  2648. -    data << vehicle->GetObjectGuid();                       // transport guid
  2649. -    data << float(veSeat->m_attachmentOffsetX);             // transport offsetX
  2650. -    data << float(veSeat->m_attachmentOffsetY);             // transport offsetY
  2651. -    data << float(veSeat->m_attachmentOffsetZ);             // transport offsetZ
  2652. -    data << float(0);                                       // transport orientation
  2653. -    data << uint32(WorldTimer::getMSTime());                            // transport time
  2654. -    data << uint8(0);                                       // seat
  2655. -    // end of transport part
  2656. -    data << uint32(0);                                      // fall time
  2657. -    GetSession()->SendPacket(&data);
  2658. -
  2659. -    data.Initialize(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1);
  2660. -    data << vehicle->GetObjectGuid();
  2661. -    data << uint16(0);
  2662. -    data << uint32(0);
  2663. -    data << uint32(0x00000101);
  2664. -
  2665. -    for(uint32 i = 0; i < 10; ++i)
  2666. -        data << uint16(0) << uint8(0) << uint8(i+8);
  2667. -
  2668. -    data << uint8(0);
  2669. -    data << uint8(0);
  2670. -    GetSession()->SendPacket(&data);
  2671. -}
  2672. -
  2673. -void Player::ExitVehicle(Vehicle *vehicle)
  2674. -{
  2675. -    vehicle->SetCharmerGuid(ObjectGuid());
  2676. -    vehicle->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
  2677. -    vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
  2678. -    vehicle->setFaction((GetTeam() == ALLIANCE) ? vehicle->GetCreatureInfo()->faction_A : vehicle->GetCreatureInfo()->faction_H);
  2679. -
  2680. -    SetCharm(NULL);
  2681. -    m_camera.ResetView();
  2682. -
  2683. -    SetClientControl(vehicle, 0);
  2684. -    SetMover(NULL);
  2685. -
  2686. -    WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
  2687. -    data << GetPackGUID();
  2688. -    data << uint32(0);                                      // counter?
  2689. -    data << uint32(MOVEFLAG_ROOT);                          // fly unk
  2690. -    data << uint16(MOVEFLAG2_UNK4);                         // special flags
  2691. -    data << uint32(WorldTimer::getMSTime());                            // time
  2692. -    data << vehicle->GetPositionX();                        // x
  2693. -    data << vehicle->GetPositionY();                        // y
  2694. -    data << vehicle->GetPositionZ();                        // z
  2695. -    data << vehicle->GetOrientation();                      // o
  2696. -    data << uint32(0);                                      // fall time
  2697. -    GetSession()->SendPacket(&data);
  2698. -
  2699. -    RemovePetActionBar();
  2700. -
  2701. -    // maybe called at dummy aura remove?
  2702. -    // CastSpell(this, 45472, true);                        // Parachute
  2703. -}
  2704. -
  2705.  bool Player::isTotalImmune()
  2706.  {
  2707.      AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
  2708. @@ -22516,6 +22466,7 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
  2709.                  return GetMap()->GetGameObject(guid);
  2710.              break;
  2711.          case HIGHGUID_UNIT:
  2712. +        case HIGHGUID_VEHICLE:
  2713.              if ((typemask & TYPEMASK_UNIT) && IsInWorld())
  2714.                  return GetMap()->GetCreature(guid);
  2715.              break;
  2716. @@ -22523,10 +22474,6 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
  2717.              if ((typemask & TYPEMASK_UNIT) && IsInWorld())
  2718.                  return GetMap()->GetPet(guid);
  2719.              break;
  2720. -        case HIGHGUID_VEHICLE:
  2721. -            if ((typemask & TYPEMASK_UNIT) && IsInWorld())
  2722. -                return GetMap()->GetVehicle(guid);
  2723. -            break;
  2724.          case HIGHGUID_DYNAMICOBJECT:
  2725.              if ((typemask & TYPEMASK_DYNAMICOBJECT) && IsInWorld())
  2726.                  return GetMap()->GetDynamicObject(guid);
  2727. diff --git a/src/game/Player.h b/src/game/Player.h
  2728. index bc4c0b5..4ef9fc7 100644
  2729. --- a/src/game/Player.h
  2730. +++ b/src/game/Player.h
  2731. @@ -47,11 +47,9 @@ class Channel;
  2732.  class DynamicObject;
  2733.  class Creature;
  2734.  class PlayerMenu;
  2735. -class Transport;
  2736.  class UpdateMask;
  2737.  class SpellCastTargets;
  2738.  class PlayerSocial;
  2739. -class Vehicle;
  2740.  class InstanceSave;
  2741.  class Spell;
  2742.  class Item;
  2743. @@ -1628,6 +1626,7 @@ class MANGOS_DLL_SPEC Player : public Unit
  2744.          void SendPetGUIDs();
  2745.          void CharmSpellInitialize();
  2746.          void PossessSpellInitialize();
  2747. +        void VehicleSpellInitialize();
  2748.          void RemovePetActionBar();
  2749.  
  2750.          bool HasSpell(uint32 spell) const;
  2751. @@ -2245,22 +2244,8 @@ class MANGOS_DLL_SPEC Player : public Unit
  2752.          Unit* GetMover() const { return m_mover; }
  2753.          bool IsSelfMover() const { return m_mover == this; }// normal case for player not controlling other unit
  2754.  
  2755. -        void EnterVehicle(Vehicle *vehicle);
  2756. -        void ExitVehicle(Vehicle *vehicle);
  2757. -
  2758.          ObjectGuid const& GetFarSightGuid() const { return GetGuidValue(PLAYER_FARSIGHT); }
  2759.  
  2760. -        // Transports
  2761. -        Transport * GetTransport() const { return m_transport; }
  2762. -        void SetTransport(Transport * t) { m_transport = t; }
  2763. -
  2764. -        float GetTransOffsetX() const { return m_movementInfo.GetTransportPos()->x; }
  2765. -        float GetTransOffsetY() const { return m_movementInfo.GetTransportPos()->y; }
  2766. -        float GetTransOffsetZ() const { return m_movementInfo.GetTransportPos()->z; }
  2767. -        float GetTransOffsetO() const { return m_movementInfo.GetTransportPos()->o; }
  2768. -        uint32 GetTransTime() const { return m_movementInfo.GetTransportTime(); }
  2769. -        int8 GetTransSeat() const { return m_movementInfo.GetTransportSeat(); }
  2770. -
  2771.          uint32 GetSaveTimer() const { return m_nextSave; }
  2772.          void   SetSaveTimer(uint32 timer) { m_nextSave = timer; }
  2773.  
  2774. @@ -2598,9 +2583,6 @@ class MANGOS_DLL_SPEC Player : public Unit
  2775.          RestType rest_type;
  2776.          ////////////////////Rest System/////////////////////
  2777.  
  2778. -        // Transports
  2779. -        Transport * m_transport;
  2780. -
  2781.          uint32 m_resetTalentsCost;
  2782.          time_t m_resetTalentsTime;
  2783.          uint32 m_usedTalentCount;
  2784. diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp
  2785. index d435fef..b75d1c1 100644
  2786. --- a/src/game/PointMovementGenerator.cpp
  2787. +++ b/src/game/PointMovementGenerator.cpp
  2788. @@ -106,7 +106,7 @@ void PointMovementGenerator<Creature>::MovementInform(Creature &unit)
  2789.      if (unit.IsTemporarySummon())
  2790.      {
  2791.          TemporarySummon* pSummon = (TemporarySummon*)(&unit);
  2792. -        if (pSummon->GetSummonerGuid().IsCreature())
  2793. +        if (pSummon->GetSummonerGuid().IsCreatureOrVehicle())
  2794.              if(Creature* pSummoner = unit.GetMap()->GetCreature(pSummon->GetSummonerGuid()))
  2795.                  if (pSummoner->AI())
  2796.                      pSummoner->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id);
  2797. diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp
  2798. index 90b23bb..0f2e227 100644
  2799. --- a/src/game/QueryHandler.cpp
  2800. +++ b/src/game/QueryHandler.cpp
  2801. @@ -188,8 +188,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
  2802.          for(int i = 0; i < MAX_CREATURE_MODEL; ++i)
  2803.              data << uint32(ci->ModelId[i]);
  2804.  
  2805. -        data << float(ci->unk16);                           // health modifier
  2806. -        data << float(ci->unk17);                           // power modifier
  2807. +        data << float(ci->health_mod);                      // health modifier
  2808. +        data << float(ci->power_mod);                       // power modifier
  2809.          data << uint8(ci->RacialLeader);
  2810.          for(uint32 i = 0; i < 6; ++i)
  2811.              data << uint32(ci->questItems[i]);              // itemId[6], quest drop
  2812. diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp
  2813. index de4f661..6c81436 100644
  2814. --- a/src/game/QuestHandler.cpp
  2815. +++ b/src/game/QuestHandler.cpp
  2816. @@ -636,7 +636,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
  2817.      {
  2818.          uint8 dialogStatus = DIALOG_STATUS_NONE;
  2819.  
  2820. -        if (itr->IsCreatureOrPet())
  2821. +        if (itr->IsAnyTypeCreature())
  2822.          {
  2823.              // need also pet quests case support
  2824.              Creature *questgiver = GetPlayer()->GetMap()->GetAnyTypeCreature(*itr);
  2825. diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp
  2826. index df9a36b..f660d74 100644
  2827. --- a/src/game/ReactorAI.cpp
  2828. +++ b/src/game/ReactorAI.cpp
  2829. @@ -109,6 +109,7 @@ ReactorAI::EnterEvadeMode()
  2830.          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());
  2831.      }
  2832.  
  2833. +    m_creature->ExitVehicle();
  2834.      m_creature->RemoveAllAuras();
  2835.      m_creature->DeleteThreatList();
  2836.      i_victimGuid = 0;
  2837. diff --git a/src/game/SQLStorages.cpp b/src/game/SQLStorages.cpp
  2838. index c1ae399..cd335ca 100644
  2839. --- a/src/game/SQLStorages.cpp
  2840. +++ b/src/game/SQLStorages.cpp
  2841. @@ -21,8 +21,8 @@
  2842.  #include "Database/SQLStorageImpl.h"
  2843.  #include "Database/DatabaseEnv.h"
  2844.  
  2845. -const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiis";
  2846. -const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiii";
  2847. +const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiis";
  2848. +const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiiiii";
  2849.  const char CreatureDataAddonInfofmt[]="iiibbiis";
  2850.  const char CreatureModelfmt[]="iffbii";
  2851.  const char CreatureInfoAddonInfofmt[]="iiibbiis";
  2852. diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
  2853. index 5a045b3..8731941 100644
  2854. --- a/src/game/SharedDefines.h
  2855. +++ b/src/game/SharedDefines.h
  2856. @@ -155,6 +155,17 @@ enum Powers
  2857.  
  2858.  #define MAX_POWERS                        7
  2859.  
  2860. +enum EnergyType
  2861. +{
  2862. +    ENERGY_TYPE_UNK0      = 0,                          // Possible mana or flat energy.
  2863. +    ENERGY_TYPE_UNK1      = 1,                          // 2 vehicles in 3.3.5a
  2864. +    ENERGY_TYPE_PYRITE    = 41,                         // 2 vehicles in 3.3.5a
  2865. +    ENERGY_TYPE_STEAM     = 61,                         // 9 vehicles in 3.3.5a
  2866. +    ENERGY_TYPE_OOZE      = 121,                        // 1 vehicle  in 3.3.5a
  2867. +    ENERGY_TYPE_BLOOD     = 141,                        // 1 vehicle  in 3.3.5a
  2868. +    ENERGY_TYPE_UNK142    = 142,                        // 1 vehicle  in 3.3.5a
  2869. +};
  2870. +
  2871.  enum SpellSchools
  2872.  {
  2873.      SPELL_SCHOOL_NORMAL                 = 0,
  2874. @@ -1113,6 +1124,16 @@ enum Targets
  2875.      TARGET_SELF2                       = 87,
  2876.      TARGET_DIRECTLY_FORWARD            = 89,
  2877.      TARGET_NONCOMBAT_PET               = 90,
  2878. +    TARGET_OWNED_VEHICLE               = 94,
  2879. +    TARGET_UNIT_DRIVER                 = 95,
  2880. +    TARGET_UNIT_PASSENGER_0            = 96,
  2881. +    TARGET_UNIT_PASSENGER_1            = 97,
  2882. +    TARGET_UNIT_PASSENGER_2            = 98,
  2883. +    TARGET_UNIT_PASSENGER_3            = 99,
  2884. +    TARGET_UNIT_PASSENGER_4            = 100,
  2885. +    TARGET_UNIT_PASSENGER_5            = 101,
  2886. +    TARGET_UNIT_PASSENGER_6            = 102,
  2887. +    TARGET_UNIT_PASSENGER_7            = 103,
  2888.      TARGET_IN_FRONT_OF_CASTER_30       = 104,
  2889.  };
  2890.  
  2891. diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
  2892. index ed547cf..7986f6b 100644
  2893. --- a/src/game/Spell.cpp
  2894. +++ b/src/game/Spell.cpp
  2895. @@ -43,6 +43,7 @@
  2896.  #include "VMapFactory.h"
  2897.  #include "BattleGround.h"
  2898.  #include "Util.h"
  2899. +#include "Vehicle.h"
  2900.  
  2901.  #define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
  2902.  
  2903. @@ -2015,6 +2016,23 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
  2904.                  if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet() && ((Pet*)target)->getPetType() == MINI_PET)
  2905.                      targetUnitMap.push_back(target);
  2906.              break;
  2907. +        case TARGET_OWNED_VEHICLE:
  2908. +            if (VehicleKit* vehicle = m_caster->GetVehicle())
  2909. +                if (Unit* target = vehicle->GetBase())
  2910. +                    targetUnitMap.push_back(target);
  2911. +            break;
  2912. +        case TARGET_UNIT_PASSENGER_0:
  2913. +        case TARGET_UNIT_PASSENGER_1:
  2914. +        case TARGET_UNIT_PASSENGER_2:
  2915. +        case TARGET_UNIT_PASSENGER_3:
  2916. +        case TARGET_UNIT_PASSENGER_4:
  2917. +        case TARGET_UNIT_PASSENGER_5:
  2918. +        case TARGET_UNIT_PASSENGER_6:
  2919. +        case TARGET_UNIT_PASSENGER_7:
  2920. +            if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetObjectGuid().IsVehicle())
  2921. +                if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(targetMode - TARGET_UNIT_PASSENGER_0))
  2922. +                    targetUnitMap.push_back(unit);
  2923. +            break;
  2924.          case TARGET_CASTER_COORDINATES:
  2925.          {
  2926.              // Check original caster is GO - set its coordinates as dst cast
  2927. @@ -3339,7 +3357,7 @@ void Spell::update(uint32 difftime)
  2928.                          for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
  2929.                          {
  2930.                              TargetInfo* target = &*ihit;
  2931. -                            if(!target->targetGUID.IsCreature())
  2932. +                            if(!target->targetGUID.IsCreatureOrVehicle())
  2933.                                  continue;
  2934.  
  2935.                              Unit* unit = m_caster->GetObjectGuid() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
  2936. @@ -4701,8 +4719,15 @@ SpellCastResult Spell::CheckCast(bool strict)
  2937.      if (locRes != SPELL_CAST_OK)
  2938.          return locRes;
  2939.  
  2940. +    bool castOnVehicleAllowed = false;
  2941. +
  2942. +    if (m_caster->GetVehicle())
  2943. +        if ( VehicleSeatEntry const* seatInfo = m_caster->GetVehicle()->GetSeatInfo(m_caster))
  2944. +            if (seatInfo->m_flags & SEAT_FLAG_CAN_CAST || seatInfo->m_flags & SEAT_FLAG_CAN_ATTACK)
  2945. +                castOnVehicleAllowed = true;
  2946. +
  2947.      // not let players cast spells at mount (and let do it to creatures)
  2948. -    if (m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell &&
  2949. +    if ((m_caster->IsMounted() || (m_caster->GetVehicle() && !castOnVehicleAllowed)) && m_caster->GetTypeId() == TYPEID_PLAYER && !m_IsTriggeredSpell &&
  2950.          !IsPassiveSpell(m_spellInfo) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED))
  2951.      {
  2952.          if (m_caster->IsTaxiFlying())
  2953. @@ -5537,21 +5562,29 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
  2954.              if (!_target->isTargetableForAttack())
  2955.                  return SPELL_FAILED_BAD_TARGETS;            // guessed error
  2956.  
  2957. -            if(IsPositiveSpell(m_spellInfo->Id))
  2958. +            //if(IsPositiveSpell(m_spellInfo->Id))
  2959. +            if(IsPositiveSpell(m_spellInfo->Id) && !IsDispelSpell(m_spellInfo))
  2960.              {
  2961.                  if(m_caster->IsHostileTo(_target))
  2962.                      return SPELL_FAILED_BAD_TARGETS;
  2963.              }
  2964.              else
  2965.              {
  2966. -                bool duelvsplayertar = false;
  2967. +                bool dualEffect = false;
  2968.                  for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
  2969.                  {
  2970. -                                                            //TARGET_DUELVSPLAYER is positive AND negative
  2971. -                    duelvsplayertar |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER);
  2972. +                    // This effects is positive AND negative. Need for vehicles cast.
  2973. +                    dualEffect |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER
  2974. +                                   || m_spellInfo->EffectImplicitTargetA[j] == TARGET_IN_FRONT_OF_CASTER_30
  2975. +                                   || m_spellInfo->EffectImplicitTargetA[j] == TARGET_MASTER
  2976. +                                   || m_spellInfo->EffectImplicitTargetA[j] == TARGET_IN_FRONT_OF_CASTER
  2977. +                                   || m_spellInfo->EffectImplicitTargetA[j] == TARGET_EFFECT_SELECT
  2978. +                                   || m_spellInfo->EffectImplicitTargetA[j] == TARGET_CASTER_COORDINATES);
  2979.                  }
  2980. -                if(m_caster->IsFriendlyTo(target) && !duelvsplayertar)
  2981. +                if (m_caster->IsFriendlyTo(target) && !(!m_caster->GetCharmerOrOwner() || !m_caster->GetCharmerOrOwner()->IsFriendlyTo(target))
  2982. +                     && !dualEffect && !IsDispelSpell(m_spellInfo))
  2983.                  {
  2984. +                    DEBUG_LOG("Charmed creature attempt to cast spell %d, but target is not valid",m_spellInfo->Id);
  2985.                      return SPELL_FAILED_BAD_TARGETS;
  2986.                  }
  2987.              }
  2988. @@ -6512,7 +6545,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
  2989.      if (target != m_caster && target->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid())
  2990.      {
  2991.          // any unattackable target skipped
  2992. -        if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
  2993. +        if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && target->GetObjectGuid() != m_caster->GetCharmerOrOwnerGuid())
  2994.              return false;
  2995.  
  2996.          // unselectable targets skipped in all cases except TARGET_SCRIPT targeting
  2997. @@ -6528,6 +6561,13 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
  2998.              return false;
  2999.      }
  3000.  
  3001. +    if (target != m_caster && m_caster->GetCharmerOrOwnerGuid() == target->GetObjectGuid())
  3002. +    {
  3003. +        if (m_spellInfo->EffectImplicitTargetA[eff] == TARGET_MASTER ||
  3004. +            m_spellInfo->EffectImplicitTargetB[eff] == TARGET_MASTER)
  3005. +            return true;
  3006. +    }
  3007. +
  3008.      // Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
  3009.      if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER)
  3010.      {
  3011. diff --git a/src/game/Spell.h b/src/game/Spell.h
  3012. index a0c37d0..7c37399 100644
  3013. --- a/src/game/Spell.h
  3014. +++ b/src/game/Spell.h
  3015. @@ -392,6 +392,7 @@ class Spell
  3016.          void DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
  3017.          void DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc = 0);
  3018.          void DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
  3019. +        void DoSummonVehicle(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
  3020.  
  3021.          void WriteSpellGoTargets( WorldPacket * data );
  3022.          void WriteAmmoToPacket( WorldPacket * data );
  3023. diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
  3024. index bcedb01..5d48008 100644
  3025. --- a/src/game/SpellAuras.cpp
  3026. +++ b/src/game/SpellAuras.cpp
  3027. @@ -346,7 +346,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
  3028.      &Aura::HandleAuraAddMechanicAbilities,                  //293 SPELL_AURA_ADD_MECHANIC_ABILITIES  replaces target's action bars with a predefined spellset
  3029.      &Aura::HandleNULL,                                      //294 2 spells, possible prevent mana regen
  3030.      &Aura::HandleUnused,                                    //295 unused (3.2.2a)
  3031. -    &Aura::HandleNULL,                                      //296 2 spells
  3032. +    &Aura::HandleAuraSetVehicle,                            //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
  3033.      &Aura::HandleNULL,                                      //297 1 spell (counter spell school?)
  3034.      &Aura::HandleUnused,                                    //298 unused (3.2.2a)
  3035.      &Aura::HandleUnused,                                    //299 unused (3.2.2a)
  3036. @@ -2988,7 +2988,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real)
  3037.          if (minfo)
  3038.              display_id = minfo->modelid;
  3039.  
  3040. -        target->Mount(display_id, GetId());
  3041. +        target->Mount(display_id, GetId(), ci->VehicleId, GetMiscValue());
  3042.      }
  3043.      else
  3044.      {
  3045. @@ -3819,7 +3819,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
  3046.          {
  3047.              ((Creature*)target)->AIM_Initialize();
  3048.          }
  3049. -        else if(target->GetTypeId() == TYPEID_PLAYER)
  3050. +        else if(target->GetTypeId() == TYPEID_PLAYER && !target->GetVehicle())
  3051.          {
  3052.              ((Player*)target)->SetClientControl(target, 0);
  3053.          }
  3054. @@ -3852,7 +3852,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
  3055.  
  3056.          target->SetCharmerGuid(ObjectGuid());
  3057.  
  3058. -        if(target->GetTypeId() == TYPEID_PLAYER)
  3059. +        if(target->GetTypeId() == TYPEID_PLAYER && !target->GetVehicle())
  3060.          {
  3061.              ((Player*)target)->setFactionForRace(target->getRace());
  3062.              ((Player*)target)->SetClientControl(target, 1);
  3063. @@ -4230,7 +4230,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
  3064.          target->clearUnitState(UNIT_STAT_STUNNED);
  3065.          target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
  3066.  
  3067. -        if(!target->hasUnitState(UNIT_STAT_ROOT))         // prevent allow move if have also root effect
  3068. +        if(!target->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_ON_VEHICLE))       // prevent allow move if have also root effect
  3069.          {
  3070.              if(target->getVictim() && target->isAlive())
  3071.                  target->SetTargetGuid(target->getVictim()->GetObjectGuid());
  3072. @@ -4458,10 +4458,13 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
  3073.  
  3074.          if(target->GetTypeId() == TYPEID_PLAYER)
  3075.          {
  3076. -            WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10);
  3077. -            data << target->GetPackGUID();
  3078. -            data << (uint32)2;
  3079. -            target->SendMessageToSet(&data, true);
  3080. +            if(!target->hasUnitState(UNIT_STAT_ON_VEHICLE))
  3081. +            {
  3082. +                WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10);
  3083. +                data << target->GetPackGUID();
  3084. +                data << uint32(2);
  3085. +                target->SendMessageToSet(&data, true);
  3086. +            }
  3087.  
  3088.              //Clear unit movement flags
  3089.              ((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
  3090. @@ -4500,7 +4503,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
  3091.  
  3092.          target->clearUnitState(UNIT_STAT_ROOT);
  3093.  
  3094. -        if(!target->hasUnitState(UNIT_STAT_STUNNED))      // prevent allow move if have also stun effect
  3095. +        if(!target->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ON_VEHICLE))      // prevent allow move if have also stun effect
  3096.          {
  3097.              if(target->getVictim() && target->isAlive())
  3098.                  target->SetTargetGuid(target->getVictim()->GetObjectGuid());
  3099. @@ -7930,28 +7933,31 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real)
  3100.      if(!Real)
  3101.          return;
  3102.  
  3103. +    Unit* caster = GetCaster();
  3104. +    if (!caster)
  3105. +        return;
  3106. +
  3107.      Unit* target = GetTarget();
  3108. -    if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->IsVehicle())
  3109. +    if (!target)
  3110.          return;
  3111. -    Vehicle* vehicle = (Vehicle*)target;
  3112.  
  3113. -    Unit *caster = GetCaster();
  3114. -    if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
  3115. +    VehicleKit* pVehicle = target->GetVehicleKit();
  3116. +
  3117. +    if (target->GetTypeId() != TYPEID_UNIT || !pVehicle)
  3118.          return;
  3119.  
  3120.      if (apply)
  3121.      {
  3122. -        ((Player*)caster)->RemovePet(PET_SAVE_AS_CURRENT);
  3123. -        ((Player*)caster)->EnterVehicle(vehicle);
  3124. +        //((Player*)caster)->RemovePet(PET_SAVE_AS_CURRENT);
  3125. +        caster->EnterVehicle(pVehicle);
  3126.      }
  3127.      else
  3128.      {
  3129. -        SpellEntry const *spell = GetSpellProto();
  3130. -
  3131.          // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
  3132. -        caster->RemoveAurasDueToSpell(spell->Id);
  3133. +        caster->RemoveAurasDueToSpell(GetId());
  3134.  
  3135. -        ((Player*)caster)->ExitVehicle(vehicle);
  3136. +        if (caster->GetVehicleKit() == pVehicle)
  3137. +            caster->ExitVehicle();
  3138.      }
  3139.  }
  3140.  
  3141. @@ -9488,3 +9494,39 @@ void SpellAuraHolder::UnregisterSingleCastHolder()
  3142.          m_isSingleTarget = false;
  3143.      }
  3144.  }
  3145. +
  3146. +void Aura::HandleAuraSetVehicle(bool apply, bool real)
  3147. +{
  3148. +    if (!real)
  3149. +        return;
  3150. +
  3151. +    Unit* target = GetTarget();
  3152. +
  3153. +    if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
  3154. +        return;
  3155. +
  3156. +    uint32 vehicleId = GetMiscValue();
  3157. +
  3158. +    if (vehicleId == 0)
  3159. +        return;
  3160. +
  3161. +    if (apply)
  3162. +    {
  3163. +        if (!target->CreateVehicleKit(vehicleId))
  3164. +            return;
  3165. +    }
  3166. +    else
  3167. +        if (target->GetVehicleKit())
  3168. +            target->RemoveVehicleKit();
  3169. +
  3170. +    WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4);
  3171. +    data.appendPackGUID(target->GetGUID());
  3172. +    data << uint32(apply ? vehicleId : 0);
  3173. +    target->SendMessageToSet(&data, true);
  3174. +
  3175. +    if (apply)
  3176. +    {
  3177. +        data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
  3178. +        ((Player*)target)->GetSession()->SendPacket(&data);
  3179. +    }
  3180. +}
  3181. diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
  3182. index 9812dd2..11b66d8 100644
  3183. --- a/src/game/SpellAuras.h
  3184. +++ b/src/game/SpellAuras.h
  3185. @@ -359,6 +359,7 @@ class MANGOS_DLL_SPEC Aura
  3186.          void HandleAuraModAllCritChance(bool Apply, bool Real);
  3187.          void HandleAuraOpenStable(bool apply, bool Real);
  3188.          void HandleAuraAddMechanicAbilities(bool apply, bool Real);
  3189. +        void HandleAuraSetVehicle(bool apply, bool Real);
  3190.  
  3191.          virtual ~Aura();
  3192.  
  3193. diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
  3194. index 6a3b3db..19cc273 100644
  3195. --- a/src/game/SpellEffects.cpp
  3196. +++ b/src/game/SpellEffects.cpp
  3197. @@ -4276,6 +4276,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
  3198.                  case UNITNAME_SUMMON_TITLE_MOUNT:
  3199.                      // TODO
  3200.                      // EffectSummonVehicle(i);
  3201. +                    DoSummonVehicle(eff_idx, summon_prop->FactionId);
  3202.                      break;
  3203.                  default:
  3204.                      sLog.outError("EffectSummonType: Unhandled summon title %u", summon_prop->Title);
  3205. @@ -4302,10 +4303,11 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
  3206.              break;
  3207.          }
  3208.          case SUMMON_PROP_GROUP_VEHICLE:
  3209. +        case SUMMON_PROP_GROUP_UNCONTROLLABLE_VEHICLE:
  3210.          {
  3211.              // TODO
  3212.              // EffectSummonVehicle(i);
  3213. -            sLog.outDebug("EffectSummonType: Unhandled summon group type SUMMON_PROP_GROUP_VEHICLE(%u)", summon_prop->Group);
  3214. +            DoSummonVehicle(eff_idx, summon_prop->FactionId);
  3215.              break;
  3216.          }
  3217.          default:
  3218. @@ -4875,6 +4877,61 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
  3219.      }
  3220.  }
  3221.  
  3222. +void Spell::DoSummonVehicle(SpellEffectIndex eff_idx, uint32 forceFaction)
  3223. +{
  3224. +    if (m_caster->hasUnitState(UNIT_STAT_ON_VEHICLE))
  3225. +    {
  3226. +        if (m_spellInfo->Attributes & SPELL_ATTR_UNK7)
  3227. +            m_caster->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
  3228. +        else
  3229. +            return;
  3230. +    }
  3231. +
  3232. +    uint32 vehicle_entry = m_spellInfo->EffectMiscValue[eff_idx];
  3233. +
  3234. +    if (!vehicle_entry)
  3235. +        return;
  3236. +
  3237. +    SpellEntry const* m_mountspell = sSpellStore.LookupEntry(m_spellInfo->EffectBasePoints[eff_idx] != 0 ? m_spellInfo->CalculateSimpleValue(eff_idx) : 46598);
  3238. +
  3239. +    if (!m_mountspell)
  3240. +        m_mountspell = sSpellStore.LookupEntry(46598);
  3241. +    // Used BasePoint mount spell, if not present - hardcoded (by Blzz).
  3242. +
  3243. +    float px, py, pz;
  3244. +    // If dest location present
  3245. +    if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
  3246. +    {
  3247. +        px = m_targets.m_destX;
  3248. +        py = m_targets.m_destY;
  3249. +        pz = m_targets.m_destZ;
  3250. +    }
  3251. +    // Summon if dest location not present near caster
  3252. +    else
  3253. +        m_caster->GetClosePoint(px, py, pz,m_caster->GetObjectBoundingRadius());
  3254. +
  3255. +    TempSummonType summonType = (GetSpellDuration(m_spellInfo) == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
  3256. +
  3257. +    Creature* vehicle = m_caster->SummonCreature(vehicle_entry,px,py,pz,m_caster->GetOrientation(),summonType,GetSpellDuration(m_spellInfo),true);
  3258. +
  3259. +    if (vehicle && !vehicle->GetObjectGuid().IsVehicle())
  3260. +    {
  3261. +        sLog.outError("DoSommonVehicle: Creature (guidlow %d, entry %d) summoned, but this is not vehicle. Correct VehicleId in creature_template.", vehicle->GetGUIDLow(), vehicle->GetEntry());
  3262. +        vehicle->ForcedDespawn();
  3263. +        return;
  3264. +    }
  3265. +
  3266. +    if (vehicle)
  3267. +    {
  3268. +        vehicle->setFaction(forceFaction ? forceFaction : m_caster->getFaction());
  3269. +        vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL,m_spellInfo->Id);
  3270. +        m_caster->CastSpell(vehicle, m_mountspell, true);
  3271. +        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);
  3272. +    }
  3273. +    else
  3274. +        sLog.outError("Vehicle (guidlow %d, entry %d) NOT summoned by undefined reason. ", vehicle->GetGUIDLow(), vehicle->GetEntry());
  3275. +}
  3276. +
  3277.  void Spell::EffectTeleUnitsFaceCaster(SpellEffectIndex eff_idx)
  3278.  {
  3279.      if (!unitTarget)
  3280. diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
  3281. index f6238c2..330657a 100644
  3282. --- a/src/game/SpellHandler.cpp
  3283. +++ b/src/game/SpellHandler.cpp
  3284. @@ -586,11 +586,11 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
  3285.      ObjectGuid guid;
  3286.      recv_data >> guid;
  3287.  
  3288. -    if (_player->isInCombat())                              // client prevent click and set different icon at combat state
  3289. +    Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid);
  3290. +    if (!unit)
  3291.          return;
  3292.  
  3293. -    Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid);
  3294. -    if (!unit || unit->isInCombat())                        // client prevent click and set different icon at combat state
  3295. +    if (_player->isInCombat() && !guid.IsVehicle())         // client prevent click and set different icon at combat state
  3296.          return;
  3297.  
  3298.      SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry());
  3299. diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
  3300. index 4626479..dbcf0c1 100644
  3301. --- a/src/game/SpellMgr.cpp
  3302. +++ b/src/game/SpellMgr.cpp
  3303. @@ -3328,7 +3328,7 @@ bool SpellMgr::LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefault
  3304.  
  3305.  void SpellMgr::LoadPetDefaultSpells()
  3306.  {
  3307. -    MANGOS_ASSERT(MAX_CREATURE_SPELL_DATA_SLOT==CREATURE_MAX_SPELLS);
  3308. +    MANGOS_ASSERT(MAX_CREATURE_SPELL_DATA_SLOT <= CREATURE_MAX_SPELLS);
  3309.  
  3310.      mPetDefaultSpellsMap.clear();
  3311.  
  3312. diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
  3313. index cc6de7d..b5ca6dd 100644
  3314. --- a/src/game/TemporarySummon.cpp
  3315. +++ b/src/game/TemporarySummon.cpp
  3316. @@ -164,7 +164,7 @@ void TemporarySummon::UnSummon()
  3317.  {
  3318.      CombatStop();
  3319.  
  3320. -    if (GetSummonerGuid().IsCreature())
  3321. +    if (GetSummonerGuid().IsCreatureOrVehicle())
  3322.          if(Creature* sum = GetMap()->GetCreature(GetSummonerGuid()))
  3323.              if (sum->AI())
  3324.                  sum->AI()->SummonedCreatureDespawn(this);
  3325. diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp
  3326. index 08af53d..f9fa649 100644
  3327. --- a/src/game/Transports.cpp
  3328. +++ b/src/game/Transports.cpp
  3329. @@ -158,7 +158,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
  3330.          return false;
  3331.      }
  3332.  
  3333. -    Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
  3334. +    Object::_Create(ObjectGuid(HIGHGUID_MO_TRANSPORT, guidlow));
  3335.  
  3336.      GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow);
  3337.  
  3338. diff --git a/src/game/Traveller.h b/src/game/Traveller.h
  3339. index 2101527..17b0d26 100644
  3340. --- a/src/game/Traveller.h
  3341. +++ b/src/game/Traveller.h
  3342. @@ -84,7 +84,7 @@ inline float Traveller<Creature>::Speed()
  3343.  template<>
  3344.  inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation)
  3345.  {
  3346. -    i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation);
  3347. +    i_traveller.SetPosition(x, y, z, orientation);
  3348.  }
  3349.  
  3350.  template<>
  3351. diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
  3352. index 22c7059..377ed6c 100644
  3353. --- a/src/game/Unit.cpp
  3354. +++ b/src/game/Unit.cpp
  3355. @@ -46,8 +46,10 @@
  3356.  #include "CellImpl.h"
  3357.  #include "Path.h"
  3358.  #include "Traveller.h"
  3359. +#include "Vehicle.h"
  3360.  #include "VMapFactory.h"
  3361.  #include "MovementGenerator.h"
  3362. +#include "Transports.h"
  3363.  
  3364.  #include <math.h>
  3365.  #include <stdarg.h>
  3366. @@ -265,6 +267,11 @@ Unit::Unit()
  3367.      // remove aurastates allowing special moves
  3368.      for(int i=0; i < MAX_REACTIVE; ++i)
  3369.          m_reactiveTimer[i] = 0;
  3370. +
  3371. +    m_transport = NULL;
  3372. +
  3373. +    m_pVehicle = NULL;
  3374. +    m_pVehicleKit = NULL;
  3375.  }
  3376.  
  3377.  Unit::~Unit()
  3378. @@ -432,6 +439,91 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
  3379.      SendMonsterMove(x, y, z, SPLINETYPE_NORMAL, flags, transitTime, player);
  3380.  }
  3381.  
  3382. +bool Unit::SetPosition(float x, float y, float z, float orientation, bool teleport)
  3383. +{
  3384. +    // prevent crash when a bad coord is sent by the client
  3385. +    if (!MaNGOS::IsValidMapCoord(x, y, z, orientation))
  3386. +    {
  3387. +        DEBUG_LOG("Unit::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for unit %d!", x, y, z, orientation, teleport, GetGUIDLow());
  3388. +        return false;
  3389. +    }
  3390. +
  3391. +    bool turn = GetOrientation() != orientation;
  3392. +    bool relocate = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
  3393. +
  3394. +    if (turn)
  3395. +        RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
  3396. +
  3397. +    if (relocate)
  3398. +    {
  3399. +        RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
  3400. +
  3401. +        if (GetTypeId() == TYPEID_PLAYER)
  3402. +            GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation);
  3403. +        else
  3404. +            GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
  3405. +    }
  3406. +    else if (turn)
  3407. +        SetOrientation(orientation);
  3408. +
  3409. +    if ((relocate || turn) && GetVehicleKit())
  3410. +        GetVehicleKit()->RelocatePassengers(x, y, z, orientation);
  3411. +
  3412. +    return relocate || turn;
  3413. +}
  3414. +
  3415. +void Unit::SendMonsterMoveTransport(WorldObject *transport, SplineType type, SplineFlags flags, uint32 moveTime, ...)
  3416. +{
  3417. +    va_list vargs;
  3418. +    va_start(vargs, moveTime);
  3419. +
  3420. +    WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, 60);
  3421. +    data << GetPackGUID();
  3422. +    data << transport->GetPackGUID();
  3423. +    data << uint8(m_movementInfo.GetTransportSeat());
  3424. +    data << uint8(0);                                       // new in 3.1
  3425. +    data << float(transport->GetPositionX());
  3426. +    data << float(transport->GetPositionY());
  3427. +    data << float(transport->GetPositionZ());
  3428. +    data << uint32(WorldTimer::getMSTime());
  3429. +
  3430. +    data << uint8(type);                                    // spline type
  3431. +
  3432. +    switch(type)
  3433. +    {
  3434. +        case SPLINETYPE_NORMAL:                             // normal packet
  3435. +            break;
  3436. +        case SPLINETYPE_STOP:                               // stop packet (raw pos?)
  3437. +            va_end(vargs);
  3438. +            SendMessageToSet(&data, true);
  3439. +            return;
  3440. +        case SPLINETYPE_FACINGSPOT:                         // facing spot
  3441. +            data << float(va_arg(vargs,double));
  3442. +            data << float(va_arg(vargs,double));
  3443. +            data << float(va_arg(vargs,double));
  3444. +            break;
  3445. +        case SPLINETYPE_FACINGTARGET:
  3446. +            data << uint64(va_arg(vargs,uint64));
  3447. +            break;
  3448. +        case SPLINETYPE_FACINGANGLE:
  3449. +            data << float(va_arg(vargs,double));            // facing angle
  3450. +            break;
  3451. +    }
  3452. +
  3453. +    va_end(vargs);
  3454. +
  3455. +    data << uint32(flags);
  3456. +
  3457. +    data << uint32(moveTime);                               // Time in between points
  3458. +    data << uint32(1);                                      // 1 single waypoint
  3459. +
  3460. +    data << float(m_movementInfo.GetTransportPos()->x);
  3461. +    data << float(m_movementInfo.GetTransportPos()->y);
  3462. +    data << float(m_movementInfo.GetTransportPos()->z);
  3463. +
  3464. +    SendMessageToSet(&data, true);
  3465. +}
  3466. +
  3467.  void Unit::SendHeartBeat(bool toSelf)
  3468.  {
  3469.      WorldPacket data(MSG_MOVE_HEARTBEAT, 64);
  3470. @@ -842,6 +934,13 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  3471.                  cVictim->AllLootRemovedFromCorpse();
  3472.              }
  3473.  
  3474. +            // if vehicle and has passengers - remove his
  3475. +            if (cVictim->GetObjectGuid().IsVehicle())
  3476. +            {
  3477. +                if(cVictim->GetVehicleKit())
  3478. +                    cVictim->GetVehicleKit()->RemoveAllPassengers();
  3479. +            }
  3480. +
  3481.              // Call creature just died function
  3482.              if (cVictim->AI())
  3483.                  cVictim->AI()->JustDied(this);
  3484. @@ -849,7 +948,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  3485.              if (cVictim->IsTemporarySummon())
  3486.              {
  3487.                  TemporarySummon* pSummon = (TemporarySummon*)cVictim;
  3488. -                if (pSummon->GetSummonerGuid().IsCreature())
  3489. +                if (pSummon->GetSummonerGuid().IsCreatureOrVehicle())
  3490.                      if(Creature* pSummoner = cVictim->GetMap()->GetCreature(pSummon->GetSummonerGuid()))
  3491.                          if (pSummoner->AI())
  3492.                              pSummoner->AI()->SummonedCreatureJustDied(cVictim);
  3493. @@ -5622,8 +5721,8 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
  3494.      if(!isAlive() || !victim->IsInWorld() || !victim->isAlive())
  3495.          return false;
  3496.  
  3497. -    // player cannot attack in mount state
  3498. -    if(GetTypeId()==TYPEID_PLAYER && IsMounted())
  3499. +    // player cannot attack while mounted or in vehicle
  3500. +    if(GetTypeId()==TYPEID_PLAYER && (IsMounted() || GetVehicle()))
  3501.          return false;
  3502.  
  3503.      // nobody can attack GM in GM-mode
  3504. @@ -7611,7 +7710,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM) const
  3505.      return WeaponSpeed * PPM / 600.0f;                      // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
  3506.  }
  3507.  
  3508. -void Unit::Mount(uint32 mount, uint32 spellId)
  3509. +void Unit::Mount(uint32 mount, uint32 spellId, uint32 vehicleId, uint32 creatureEntry)
  3510.  {
  3511.      if (!mount)
  3512.          return;
  3513. @@ -7645,6 +7744,26 @@ void Unit::Mount(uint32 mount, uint32 spellId)
  3514.                      pet->ApplyModeFlags(PET_MODE_DISABLE_ACTIONS,true);
  3515.              }
  3516.          }
  3517. +
  3518. +        if (vehicleId)
  3519. +        {
  3520. +            if (CreateVehicleKit(vehicleId))
  3521. +            {
  3522. +                GetVehicleKit()->Reset();
  3523. +
  3524. +                // Send others that we now have a vehicle
  3525. +                WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
  3526. +                data << GetPackGUID();
  3527. +                data << uint32(vehicleId);
  3528. +                SendMessageToSet(&data, true);
  3529. +
  3530. +                data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
  3531. +                ((Player*)this)->GetSession()->SendPacket(&data);
  3532. +
  3533. +                // mounts can also have accessories
  3534. +                GetVehicleKit()->InstallAllAccessories(creatureEntry);
  3535. +            }
  3536. +        }
  3537.      }
  3538.  }
  3539.  
  3540. @@ -7676,6 +7795,17 @@ void Unit::Unmount(bool from_aura)
  3541.          else
  3542.              ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
  3543.      }
  3544. +
  3545. +    if (GetTypeId() == TYPEID_PLAYER && GetVehicleKit())
  3546. +    {
  3547. +        // Send other players that we are no longer a vehicle
  3548. +        WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
  3549. +        data << GetPackGUID();
  3550. +        data << uint32(0);
  3551. +        ((Player*)this)->SendMessageToSet(&data, true);
  3552. +
  3553. +        RemoveVehicleKit();
  3554. +    }
  3555.  }
  3556.  
  3557.  void Unit::SetInCombatWith(Unit* enemy)
  3558. @@ -8457,6 +8587,7 @@ void Unit::SetDeathState(DeathState s)
  3559.  {
  3560.      if (s != ALIVE && s!= JUST_ALIVED)
  3561.      {
  3562. +        ExitVehicle();
  3563.          CombatStop();
  3564.          DeleteThreatList();
  3565.          ClearComboPointHolders();                           // any combo points pointed to unit lost at it death
  3566. @@ -8492,6 +8623,9 @@ void Unit::SetDeathState(DeathState s)
  3567.          // remove aurastates allowing special moves
  3568.          ClearAllReactives();
  3569.          ClearDiminishings();
  3570. +
  3571. +        if (GetVehicleKit())
  3572. +            GetVehicleKit()->RemoveAllPassengers();
  3573.      }
  3574.      else if(s == JUST_ALIVED)
  3575.      {
  3576. @@ -8527,10 +8661,6 @@ bool Unit::CanHaveThreatList() const
  3577.      if (creature->IsTotem())
  3578.          return false;
  3579.  
  3580. -    // vehicles can not have threat list
  3581. -    if (creature->IsVehicle())
  3582. -        return false;
  3583. -
  3584.      // pets can not have a threat list, unless they are controlled by a creature
  3585.      if (creature->IsPet() && creature->GetOwnerGuid().IsPlayer())
  3586.          return false;
  3587. @@ -9449,6 +9579,9 @@ void Unit::CleanupsBeforeDelete()
  3588.  {
  3589.      if(m_uint32Values)                                      // only for fully created object
  3590.      {
  3591. +        RemoveVehicleKit();
  3592. +        ExitVehicle();
  3593. +
  3594.          InterruptNonMeleeSpells(true);
  3595.          m_Events.KillAllEvents(false);                      // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
  3596.          CombatStop();
  3597. @@ -9516,6 +9649,25 @@ void CharmInfo::InitPossessCreateSpells()
  3598.      }
  3599.  }
  3600.  
  3601. +void CharmInfo::InitVehicleCreateSpells()
  3602. +{
  3603. +    for (uint32 x = ACTION_BAR_INDEX_START; x < ACTION_BAR_INDEX_END; ++x)
  3604. +        SetActionBar(x, 0, ActiveStates(0x8 + x));
  3605. +
  3606. +    for (uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x)
  3607. +    {
  3608. +        uint32 spellId = ((Creature*)m_unit)->m_spells[x];
  3609. +
  3610. +        if (!spellId)
  3611. +            continue;
  3612. +
  3613. +        if (IsPassiveSpell(spellId))
  3614. +            m_unit->CastSpell(m_unit, spellId, true);
  3615. +        else
  3616. +            PetActionBar[x].SetAction(spellId);
  3617. +    }
  3618. +}
  3619. +
  3620.  void CharmInfo::InitCharmCreateSpells()
  3621.  {
  3622.      if(m_unit->GetTypeId() == TYPEID_PLAYER)                //charmed players don't have spells
  3623. @@ -10030,7 +10182,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t
  3624.          }
  3625.      }
  3626.  
  3627. -    if (GetTypeId() == TYPEID_PLAYER)
  3628. +    if (GetTypeId() == TYPEID_PLAYER && !GetVehicle())
  3629.          ((Player*)this)->SetClientControl(this, !apply);
  3630.  }
  3631.  
  3632. @@ -10060,7 +10212,7 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID)
  3633.          }
  3634.      }
  3635.  
  3636. -    if(GetTypeId() == TYPEID_PLAYER)
  3637. +    if(GetTypeId() == TYPEID_PLAYER && !GetVehicle())
  3638.          ((Player*)this)->SetClientControl(this, !apply);
  3639.  }
  3640.  
  3641. @@ -10558,13 +10710,14 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
  3642.          ((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));
  3643.      else
  3644.      {
  3645. +        ExitVehicle();
  3646.          Creature* c = (Creature*)this;
  3647.          // Creature relocation acts like instant movement generator, so current generator expects interrupt/reset calls to react properly
  3648.          if (!c->GetMotionMaster()->empty())
  3649.              if (MovementGenerator *movgen = c->GetMotionMaster()->top())
  3650.                  movgen->Interrupt(*c);
  3651.  
  3652. -        GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
  3653. +        SetPosition(x, y, z, orientation, true);
  3654.  
  3655.          SendHeartBeat(false);
  3656.  
  3657. @@ -10628,6 +10781,128 @@ struct SetPvPHelper
  3658.      bool state;
  3659.  };
  3660.  
  3661. +bool Unit::CreateVehicleKit(uint32 vehicleId)
  3662. +{
  3663. +    VehicleEntry const *vehicleInfo = sVehicleStore.LookupEntry(vehicleId);
  3664. +
  3665. +    if (!vehicleInfo)
  3666. +        return false;
  3667. +
  3668. +    m_pVehicleKit = new VehicleKit(this, vehicleInfo);
  3669. +    m_updateFlag |= UPDATEFLAG_VEHICLE;
  3670. +    return true;
  3671. +}
  3672. +
  3673. +void Unit::RemoveVehicleKit()
  3674. +{
  3675. +    if (!m_pVehicleKit)
  3676. +        return;
  3677. +
  3678. +    m_pVehicleKit->RemoveAllPassengers();
  3679. +
  3680. +    delete m_pVehicleKit;
  3681. +    m_pVehicleKit = NULL;
  3682. +
  3683. +    m_updateFlag &= ~UPDATEFLAG_VEHICLE;
  3684. +    RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
  3685. +    RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
  3686. +}
  3687. +
  3688. +void Unit::ChangeSeat(int8 seatId, bool next)
  3689. +{
  3690. +    if (!m_pVehicle)
  3691. +        return;
  3692. +
  3693. +    if (seatId < 0)
  3694. +    {
  3695. +        seatId = m_pVehicle->GetNextEmptySeat(m_movementInfo.GetTransportSeat(), next);
  3696. +        if (seatId < 0)
  3697. +            return;
  3698. +    }
  3699. +    else if (seatId == m_movementInfo.GetTransportSeat() || !m_pVehicle->HasEmptySeat(seatId))
  3700. +        return;
  3701. +
  3702. +    if (m_pVehicle->GetPassenger(seatId) &&
  3703. +       (!m_pVehicle->GetPassenger(seatId)->GetObjectGuid().IsVehicle() || !m_pVehicle->GetSeatInfo(m_pVehicle->GetPassenger(seatId))))
  3704. +        return;
  3705. +
  3706. +    m_pVehicle->RemovePassenger(this);
  3707. +    m_pVehicle->AddPassenger(this, seatId);
  3708. +}
  3709. +
  3710. +void Unit::EnterVehicle(VehicleKit *vehicle, int8 seatId)
  3711. +{
  3712. +    if (!isAlive() || GetVehicleKit() == vehicle)
  3713. +        return;
  3714. +
  3715. +    if (m_pVehicle)
  3716. +    {
  3717. +        if (m_pVehicle == vehicle)
  3718. +        {
  3719. +            if (seatId >= 0)
  3720. +                ChangeSeat(seatId);
  3721. +
  3722. +            return;
  3723. +        }
  3724. +        else
  3725. +            ExitVehicle();
  3726. +    }
  3727. +
  3728. +    InterruptNonMeleeSpells(false);
  3729. +    RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
  3730. +    RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
  3731. +
  3732. +    if (!vehicle->AddPassenger(this, seatId))
  3733. +        return;
  3734. +
  3735. +    m_pVehicle = vehicle;
  3736. +
  3737. +    if (Pet *pet = GetPet())
  3738. +        pet->Unsummon(PET_SAVE_AS_CURRENT,this);
  3739. +
  3740. +    if (GetTypeId() == TYPEID_PLAYER)
  3741. +    {
  3742. +        Player* player = (Player*)this;
  3743. +
  3744. +        if (BattleGround *bg = player->GetBattleGround())
  3745. +            bg->EventPlayerDroppedFlag(player);
  3746. +
  3747. +        WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA);
  3748. +        player->GetSession()->SendPacket(&data);
  3749. +
  3750. +        data.Initialize(SMSG_BREAK_TARGET, 8);
  3751. +        data << vehicle->GetBase()->GetPackGUID();
  3752. +        player->GetSession()->SendPacket(&data);
  3753. +    }
  3754. +
  3755. +    if (Transport* pTransport = GetTransport())
  3756. +    {
  3757. +        if (GetTypeId() == TYPEID_PLAYER)
  3758. +            pTransport->RemovePassenger((Player*)this);
  3759. +
  3760. +        SetTransport(NULL);
  3761. +    }
  3762. +}
  3763. +
  3764. +void Unit::ExitVehicle()
  3765. +{
  3766. +    if(!m_pVehicle)
  3767. +        return;
  3768. +
  3769. +    m_pVehicle->RemovePassenger(this);
  3770. +    m_pVehicle = NULL;
  3771. +
  3772. +    if (GetTypeId() == TYPEID_PLAYER)
  3773. +        ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
  3774. +
  3775. +    float x = GetPositionX();
  3776. +    float y = GetPositionY();
  3777. +    float z = GetPositionZ() + 2.0f;
  3778. +    GetClosePoint(x, y, z, 2.0f);
  3779. +    UpdateAllowedPositionZ(x, y, z);
  3780. +    SendMonsterMove(x, y, z + 0.5f, SPLINETYPE_NORMAL, SPLINEFLAG_WALKMODE, 0);
  3781. +}
  3782. +
  3783.  void Unit::SetPvP( bool state )
  3784.  {
  3785.      if(state)
  3786. diff --git a/src/game/Unit.h b/src/game/Unit.h
  3787. index c745c9e..da5dc56 100644
  3788. --- a/src/game/Unit.h
  3789. +++ b/src/game/Unit.h
  3790. @@ -195,7 +195,7 @@ enum UnitRename
  3791.      UNIT_CAN_BE_ABANDONED   = 0x02,
  3792.  };
  3793.  
  3794. -#define CREATURE_MAX_SPELLS     4
  3795. +#define CREATURE_MAX_SPELLS     8
  3796.  
  3797.  enum Swing
  3798.  {
  3799. @@ -268,6 +268,8 @@ class Item;
  3800.  class Pet;
  3801.  class PetAura;
  3802.  class Totem;
  3803. +class Transport;
  3804. +class VehicleKit;
  3805.  
  3806.  struct SpellImmune
  3807.  {
  3808. @@ -405,24 +407,25 @@ enum UnitState
  3809.      UNIT_STAT_FOLLOW_MOVE     = 0x00010000,
  3810.      UNIT_STAT_FLEEING         = 0x00020000,                     // FleeMovementGenerator/TimedFleeingMovementGenerator active/onstack
  3811.      UNIT_STAT_FLEEING_MOVE    = 0x00040000,
  3812. +    UNIT_STAT_ON_VEHICLE      = 0x00080000,                     // Unit is on vehicle
  3813.  
  3814.      // masks (only for check)
  3815.  
  3816.      // can't move currently
  3817. -    UNIT_STAT_CAN_NOT_MOVE    = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED,
  3818. +    UNIT_STAT_CAN_NOT_MOVE    = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED | UNIT_STAT_ON_VEHICLE,
  3819.  
  3820.      // stay by different reasons
  3821.      UNIT_STAT_NOT_MOVE        = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED |
  3822. -                                UNIT_STAT_DISTRACTED,
  3823. +                                UNIT_STAT_DISTRACTED | UNIT_STAT_ON_VEHICLE,
  3824.  
  3825.      // stay or scripted movement for effect( = in player case you can't move by client command)
  3826.      UNIT_STAT_NO_FREE_MOVE    = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED |
  3827.                                  UNIT_STAT_TAXI_FLIGHT |
  3828. -                                UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING,
  3829. +                                UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ON_VEHICLE,
  3830.  
  3831.      // not react at move in sight or other
  3832.      UNIT_STAT_CAN_NOT_REACT   = UNIT_STAT_STUNNED | UNIT_STAT_DIED |
  3833. -                                UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING,
  3834. +                                UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ON_VEHICLE,
  3835.  
  3836.      // AI disabled by some reason
  3837.      UNIT_STAT_LOST_CONTROL    = UNIT_STAT_FLEEING | UNIT_STAT_CONTROLLED,
  3838. @@ -585,6 +588,7 @@ enum NPCFlags
  3839.      UNIT_NPC_FLAG_STABLEMASTER          = 0x00400000,       // 100%
  3840.      UNIT_NPC_FLAG_GUILD_BANKER          = 0x00800000,       // cause client to send 997 opcode
  3841.      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
  3842. +    UNIT_NPC_FLAG_PLAYER_VEHICLE        = 0x02000000,       // players with mounts that have vehicle data should have it set
  3843.      UNIT_NPC_FLAG_GUARD                 = 0x10000000        // custom flag for guards
  3844.  };
  3845.  
  3846. @@ -721,7 +725,7 @@ class MovementInfo
  3847.  {
  3848.      public:
  3849.          MovementInfo() : moveFlags(MOVEFLAG_NONE), moveFlags2(MOVEFLAG2_NONE), time(0),
  3850. -            t_time(0), t_seat(-1), t_time2(0), s_pitch(0.0f), fallTime(0), u_unk1(0.0f) {}
  3851. +            t_time(0), t_seat(-1), t_seatInfo(NULL), t_time2(0), s_pitch(0.0f), fallTime(0), u_unk1(0.0f) {}
  3852.  
  3853.          // Read/Write methods
  3854.          void Read(ByteBuffer &data);
  3855. @@ -734,10 +738,11 @@ class MovementInfo
  3856.          MovementFlags GetMovementFlags() const { return MovementFlags(moveFlags); }
  3857.          void SetMovementFlags(MovementFlags f) { moveFlags = f; }
  3858.          MovementFlags2 GetMovementFlags2() const { return MovementFlags2(moveFlags2); }
  3859. +        void AddMovementFlag2(MovementFlags2 f) { moveFlags2 |= f; }
  3860.  
  3861.          // Position manipulations
  3862.          Position const *GetPos() const { return &pos; }
  3863. -        void SetTransportData(ObjectGuid guid, float x, float y, float z, float o, uint32 time, int8 seat)
  3864. +        void SetTransportData(ObjectGuid guid, float x, float y, float z, float o, uint32 time, int8 seat, VehicleSeatEntry const* seatInfo = NULL)
  3865.          {
  3866.              t_guid = guid;
  3867.              t_pos.x = x;
  3868. @@ -746,6 +751,7 @@ class MovementInfo
  3869.              t_pos.o = o;
  3870.              t_time = time;
  3871.              t_seat = seat;
  3872. +            t_seatInfo = seatInfo;
  3873.          }
  3874.          void ClearTransportData()
  3875.          {
  3876. @@ -756,10 +762,13 @@ class MovementInfo
  3877.              t_pos.o = 0.0f;
  3878.              t_time = 0;
  3879.              t_seat = -1;
  3880. +            t_seatInfo = NULL;
  3881.          }
  3882.          ObjectGuid const& GetTransportGuid() const { return t_guid; }
  3883.          Position const *GetTransportPos() const { return &t_pos; }
  3884.          int8 GetTransportSeat() const { return t_seat; }
  3885. +        uint32 GetTransportDBCSeat() const { return t_seatInfo ? t_seatInfo->m_ID : 0; }
  3886. +        uint32 GetVehicleSeatFlags() const { return t_seatInfo ? t_seatInfo->m_flags : 0; }
  3887.          uint32 GetTransportTime() const { return t_time; }
  3888.          uint32 GetFallTime() const { return fallTime; }
  3889.          void ChangeOrientation(float o) { pos.o = o; }
  3890. @@ -784,6 +793,7 @@ class MovementInfo
  3891.          Position t_pos;
  3892.          uint32   t_time;
  3893.          int8     t_seat;
  3894. +        VehicleSeatEntry const* t_seatInfo;
  3895.          uint32   t_time2;
  3896.          // swimming and flying
  3897.          float    s_pitch;
  3898. @@ -1049,6 +1059,7 @@ struct CharmInfo
  3899.          bool HasReactState(ReactStates state) { return (m_reactState == state); }
  3900.  
  3901.          void InitPossessCreateSpells();
  3902. +        void InitVehicleCreateSpells();
  3903.          void InitCharmCreateSpells();
  3904.          void InitPetActionBar();
  3905.          void InitEmptyActionBar();
  3906. @@ -1306,7 +1317,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
  3907.  
  3908.          bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); }
  3909.          uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
  3910. -        void Mount(uint32 mount, uint32 spellId = 0);
  3911. +        void Mount(uint32 mount, uint32 spellId = 0, uint32 vehicleId = 0, uint32 creatureEntry = 0);
  3912.          void Unmount(bool from_aura = false);
  3913.  
  3914.          uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? GetLevelForTarget(target) : getLevel()) * 5; }
  3915. @@ -1469,6 +1480,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
  3916.          // if used additional args in ... part then floats must explicitly casted to double
  3917.          void SendMonsterMove(float x, float y, float z, SplineType type, SplineFlags flags, uint32 Time, Player* player = NULL, ...);
  3918.          void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
  3919. +        void SendMonsterMoveTransport(WorldObject *transport, SplineType type, SplineFlags flags, uint32 moveTime, ...);
  3920. +
  3921. +        virtual bool SetPosition(float x, float y, float z, float orientation, bool teleport = false);
  3922.  
  3923.          template<typename PathElem, typename PathNode>
  3924.          void SendMonsterMoveByPath(Path<PathElem,PathNode> const& path, uint32 start, uint32 end, SplineFlags flags);
  3925. @@ -1954,6 +1968,25 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
  3926.          // Movement info
  3927.          MovementInfo m_movementInfo;
  3928.  
  3929. +        // Transports
  3930. +        Transport* GetTransport() const { return m_transport; }
  3931. +        void SetTransport(Transport* pTransport) { m_transport = pTransport; }
  3932. +
  3933. +        float GetTransOffsetX() const { return m_movementInfo.GetTransportPos()->x; }
  3934. +        float GetTransOffsetY() const { return m_movementInfo.GetTransportPos()->y; }
  3935. +        float GetTransOffsetZ() const { return m_movementInfo.GetTransportPos()->z; }
  3936. +        float GetTransOffsetO() const { return m_movementInfo.GetTransportPos()->o; }
  3937. +        uint32 GetTransTime() const { return m_movementInfo.GetTransportTime(); }
  3938. +        int8 GetTransSeat() const { return m_movementInfo.GetTransportSeat(); }
  3939. +
  3940. +        // Vehicle system
  3941. +        void EnterVehicle(VehicleKit *vehicle, int8 seatId = -1);
  3942. +        void ExitVehicle();
  3943. +        void ChangeSeat(int8 seatId, bool next = true);
  3944. +        VehicleKit* GetVehicle() const { return m_pVehicle; }
  3945. +        VehicleKit* GetVehicleKit() const { return m_pVehicleKit; }
  3946. +        bool CreateVehicleKit(uint32 vehicleId);
  3947. +        void RemoveVehicleKit();
  3948.      protected:
  3949.          explicit Unit ();
  3950.  
  3951. @@ -2003,6 +2036,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
  3952.          uint32 m_regenTimer;
  3953.          uint32 m_lastManaUseTimer;
  3954.  
  3955. +        // Transports
  3956. +        Transport* m_transport;
  3957. +
  3958. +        VehicleKit* m_pVehicle;
  3959. +        VehicleKit* m_pVehicleKit;
  3960.      private:
  3961.          void CleanupDeletedAuras();
  3962.  
  3963. diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
  3964. index 2e3c73b..2810828 100644
  3965. --- a/src/game/Vehicle.cpp
  3966. +++ b/src/game/Vehicle.cpp
  3967. @@ -21,75 +21,366 @@
  3968.  #include "ObjectMgr.h"
  3969.  #include "Vehicle.h"
  3970.  #include "Unit.h"
  3971. +#include "CreatureAI.h"
  3972.  #include "Util.h"
  3973. +#include "WorldPacket.h"
  3974.  
  3975. -Vehicle::Vehicle() : Creature(CREATURE_SUBTYPE_VEHICLE), m_vehicleId(0)
  3976. +VehicleKit::VehicleKit(Unit* base, VehicleEntry const* vehicleInfo) : m_vehicleInfo(vehicleInfo), m_pBase(base), m_uiNumFreeSeats(0)
  3977.  {
  3978. -    m_updateFlag = (UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_VEHICLE);
  3979. +    for (uint32 i = 0; i < MAX_VEHICLE_SEAT; ++i)
  3980. +    {
  3981. +        uint32 seatId = m_vehicleInfo->m_seatID[i];
  3982. +
  3983. +        if (!seatId)
  3984. +            continue;
  3985. +
  3986. +        if(base)
  3987. +        {
  3988. +            if(m_vehicleInfo->m_flags & VEHICLE_FLAG_NO_STRAFE)
  3989. +                base->m_movementInfo.AddMovementFlag2(MOVEFLAG2_NO_STRAFE);
  3990. +
  3991. +            if(m_vehicleInfo->m_flags & VEHICLE_FLAG_NO_JUMPING)
  3992. +                base->m_movementInfo.AddMovementFlag2(MOVEFLAG2_NO_JUMPING);
  3993. +        }
  3994. +
  3995. +        if (VehicleSeatEntry const *seatInfo = sVehicleSeatStore.LookupEntry(seatId))
  3996. +        {
  3997. +            m_Seats.insert(std::make_pair(i, VehicleSeat(seatInfo)));
  3998. +
  3999. +            if (seatInfo->IsUsable())
  4000. +                ++m_uiNumFreeSeats;
  4001. +        }
  4002. +    }
  4003.  }
  4004.  
  4005. -Vehicle::~Vehicle()
  4006. +VehicleKit::~VehicleKit()
  4007.  {
  4008.  }
  4009.  
  4010. -void Vehicle::AddToWorld()
  4011. +void VehicleKit::RemoveAllPassengers()
  4012.  {
  4013. -    ///- Register the vehicle for guid lookup
  4014. -    if(!IsInWorld())
  4015. -        GetMap()->GetObjectsStore().insert<Vehicle>(GetGUID(), (Vehicle*)this);
  4016. +    for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
  4017. +    {
  4018. +        if (Unit *passenger = itr->second.passenger)
  4019. +        {
  4020. +            passenger->ExitVehicle();
  4021.  
  4022. -    Unit::AddToWorld();
  4023. +            // remove creatures of player mounts
  4024. +            if (passenger->GetTypeId() == TYPEID_UNIT)
  4025. +                passenger->AddObjectToRemoveList();
  4026. +        }
  4027. +    }
  4028.  }
  4029.  
  4030. -void Vehicle::RemoveFromWorld()
  4031. +bool VehicleKit::HasEmptySeat(int8 seatId) const
  4032.  {
  4033. -    ///- Remove the vehicle from the accessor
  4034. -    if(IsInWorld())
  4035. -        GetMap()->GetObjectsStore().erase<Vehicle>(GetGUID(), (Vehicle*)NULL);
  4036. +    SeatMap::const_iterator seat = m_Seats.find(seatId);
  4037.  
  4038. -    ///- Don't call the function for Creature, normal mobs + totems go in a different storage
  4039. -    Unit::RemoveFromWorld();
  4040. +    if (seat == m_Seats.end())
  4041. +        return false;
  4042. +
  4043. +    return !seat->second.passenger;
  4044.  }
  4045.  
  4046. -void Vehicle::SetDeathState(DeathState s)                       // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
  4047. +Unit *VehicleKit::GetPassenger(int8 seatId) const
  4048.  {
  4049. -    Creature::SetDeathState(s);
  4050. +    SeatMap::const_iterator seat = m_Seats.find(seatId);
  4051. +
  4052. +    if (seat == m_Seats.end())
  4053. +        return NULL;
  4054. +
  4055. +    return seat->second.passenger;
  4056.  }
  4057.  
  4058. -void Vehicle::Update( uint32 update_diff, uint32 diff)
  4059. +int8 VehicleKit::GetNextEmptySeat(int8 seatId, bool next) const
  4060.  {
  4061. -    Creature::Update(update_diff, diff);
  4062. +    SeatMap::const_iterator seat = m_Seats.find(seatId);
  4063. +
  4064. +    if (seat == m_Seats.end())
  4065. +        return -1;
  4066. +
  4067. +    while (seat->second.passenger || !seat->second.seatInfo->IsUsable())
  4068. +    {
  4069. +        if (next)
  4070. +        {
  4071. +            ++seat;
  4072. +            if (seat == m_Seats.end())
  4073. +                seat = m_Seats.begin();
  4074. +        }
  4075. +        else
  4076. +        {
  4077. +            if (seat == m_Seats.begin())
  4078. +                seat = m_Seats.end();
  4079. +            --seat;
  4080. +        }
  4081. +
  4082. +        if (seat->first == seatId)
  4083. +            return -1; // no available seat
  4084. +    }
  4085. +
  4086. +    return seat->first;
  4087.  }
  4088.  
  4089. -bool Vehicle::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, Team team)
  4090. +bool VehicleKit::AddPassenger(Unit *passenger, int8 seatId)
  4091.  {
  4092. -    SetMap(map);
  4093. +    SeatMap::iterator seat;
  4094.  
  4095. -    Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);
  4096. +    if (seatId < 0) // no specific seat requirement
  4097. +    {
  4098. +        for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
  4099. +            if (!seat->second.passenger && (seat->second.seatInfo->IsUsable() || (seat->second.seatInfo->m_flags & SEAT_FLAG_UNCONTROLLED)))
  4100. +                break;
  4101.  
  4102. -    if(!InitEntry(Entry))
  4103. -        return false;
  4104. +        if (seat == m_Seats.end()) // no available seat
  4105. +            return false;
  4106. +    }
  4107. +    else
  4108. +    {
  4109. +        seat = m_Seats.find(seatId);
  4110. +
  4111. +        if (seat == m_Seats.end())
  4112. +            return false;
  4113. +
  4114. +        if (seat->second.passenger)
  4115. +            return false;
  4116. +    }
  4117. +
  4118. +    seat->second.passenger = passenger;
  4119. +    passenger->addUnitState(UNIT_STAT_ON_VEHICLE);
  4120. +
  4121. +    VehicleSeatEntry const *seatInfo = seat->second.seatInfo;
  4122.  
  4123. -    m_defaultMovementType = IDLE_MOTION_TYPE;
  4124. +    passenger->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
  4125. +    passenger->m_movementInfo.SetTransportData(m_pBase->GetGUID(),
  4126. +        seatInfo->m_attachmentOffsetX, seatInfo->m_attachmentOffsetY, seatInfo->m_attachmentOffsetZ,
  4127. +        seatInfo->m_passengerYaw, WorldTimer::getMSTime(), seat->first, seatInfo);
  4128.  
  4129. -    AIM_Initialize();
  4130. +    if (passenger->GetTypeId() == TYPEID_PLAYER)
  4131. +    {
  4132. +        ((Player*)passenger)->UnsummonPetTemporaryIfAny();
  4133.  
  4134. -    SetVehicleId(vehicleId);
  4135. +        ((Player*)passenger)->GetCamera().SetView(m_pBase);
  4136.  
  4137. -    SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
  4138. -    SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
  4139. +        WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8+4);
  4140. +        data << passenger->GetPackGUID();
  4141. +        data << uint32((passenger->m_movementInfo.GetVehicleSeatFlags() & SEAT_FLAG_CAN_CAST) ? 2 : 0);
  4142. +        passenger->SendMessageToSet(&data, true);
  4143. +    }
  4144.  
  4145. -    CreatureInfo const *ci = GetCreatureInfo();
  4146. -    setFaction(team == ALLIANCE ? ci->faction_A : ci->faction_H);
  4147. +    if (seatInfo->m_flags & SEAT_FLAG_UNATTACKABLE)
  4148. +    {
  4149. +        passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  4150. +    }
  4151.  
  4152. -    SelectLevel(ci);
  4153. +    if (seatInfo->m_flags & SEAT_FLAG_CAN_CONTROL)
  4154. +    {
  4155. +        m_pBase->StopMoving();
  4156. +        m_pBase->GetMotionMaster()->Clear();
  4157. +        m_pBase->CombatStop(true);
  4158. +        m_pBase->DeleteThreatList();
  4159. +        m_pBase->getHostileRefManager().deleteReferences();
  4160. +        m_pBase->SetCharmerGuid(passenger->GetObjectGuid());
  4161. +        m_pBase->addUnitState(UNIT_STAT_CONTROLLED);
  4162. +
  4163. +        passenger->SetCharm(m_pBase);
  4164. +
  4165. +        if(m_pBase->HasAuraType(SPELL_AURA_FLY) || m_pBase->HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED))
  4166. +        {
  4167. +            WorldPacket data;
  4168. +            data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
  4169. +            data << m_pBase->GetPackGUID();
  4170. +            data << (uint32)(0);
  4171. +            m_pBase->SendMessageToSet(&data,false);
  4172. +        }
  4173. +
  4174. +        if (passenger->GetTypeId() == TYPEID_PLAYER)
  4175. +        {
  4176. +            m_pBase->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
  4177. +
  4178. +            if (CharmInfo* charmInfo = m_pBase->InitCharmInfo(m_pBase))
  4179. +            {
  4180. +                charmInfo->InitVehicleCreateSpells();
  4181. +                charmInfo->SetReactState(REACT_PASSIVE);
  4182. +            }
  4183. +
  4184. +            Player* player = (Player*)passenger;
  4185. +            player->SetMover(m_pBase);
  4186. +            player->SetClientControl(m_pBase, 1);
  4187. +            player->VehicleSpellInitialize();
  4188. +        }
  4189. +
  4190. +        ((Creature*)m_pBase)->AIM_Initialize();
  4191. +
  4192. +        if(m_pBase->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
  4193. +        {
  4194. +            WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 8+4);
  4195. +            data2 << m_pBase->GetPackGUID();
  4196. +            data2 << (uint32)(2);
  4197. +            m_pBase->SendMessageToSet(&data2,false);
  4198. +        }
  4199. +    }
  4200. +
  4201. +    passenger->SendMonsterMoveTransport(m_pBase, SPLINETYPE_FACINGANGLE, SPLINEFLAG_UNKNOWN5, 0, 0.0f);
  4202. +
  4203. +    RelocatePassengers(m_pBase->GetPositionX(), m_pBase->GetPositionY(), m_pBase->GetPositionZ()+0.5f, m_pBase->GetOrientation());
  4204. +
  4205. +    UpdateFreeSeatCount();
  4206. +
  4207. +    if (m_pBase->GetTypeId() == TYPEID_UNIT)
  4208. +    {
  4209. +        if (((Creature*)m_pBase)->AI())
  4210. +            ((Creature*)m_pBase)->AI()->PassengerBoarded(passenger, seat->first, true);
  4211. +    }
  4212.  
  4213.      return true;
  4214.  }
  4215.  
  4216. -void Vehicle::Dismiss()
  4217. +void VehicleKit::RemovePassenger(Unit *passenger)
  4218. +{
  4219. +    SeatMap::iterator seat;
  4220. +
  4221. +    for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
  4222. +        if (seat->second.passenger == passenger)
  4223. +            break;
  4224. +
  4225. +    if (seat == m_Seats.end())
  4226. +        return;
  4227. +
  4228. +    seat->second.passenger = NULL;
  4229. +    passenger->clearUnitState(UNIT_STAT_ON_VEHICLE);
  4230. +
  4231. +    float px, py, pz, po;
  4232. +    m_pBase->GetClosePoint(px, py, pz, m_pBase->GetObjectBoundingRadius(), 2.0f, M_PI_F);
  4233. +    po = m_pBase->GetOrientation();
  4234. +
  4235. +    passenger->m_movementInfo.ClearTransportData();
  4236. +    passenger->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
  4237. +
  4238. +    if (seat->second.seatInfo->m_flags & SEAT_FLAG_UNATTACKABLE)
  4239. +    {
  4240. +        passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  4241. +    }
  4242. +
  4243. +    if (seat->second.seatInfo->m_flags & SEAT_FLAG_CAN_CONTROL)
  4244. +    {
  4245. +        passenger->SetCharm(NULL);
  4246. +        passenger->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
  4247. +
  4248. +        m_pBase->SetCharmerGuid(ObjectGuid());
  4249. +        m_pBase->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
  4250. +        m_pBase->clearUnitState(UNIT_STAT_CONTROLLED);
  4251. +
  4252. +        if (passenger->GetTypeId() == TYPEID_PLAYER)
  4253. +        {
  4254. +            Player* player = (Player*)passenger;
  4255. +            player->SetMover(NULL);
  4256. +            player->SetClientControl(m_pBase, 0);
  4257. +            player->RemovePetActionBar();
  4258. +        }
  4259. +
  4260. +        ((Creature*)m_pBase)->AIM_Initialize();
  4261. +    }
  4262. +
  4263. +    if (passenger->GetTypeId() == TYPEID_PLAYER)
  4264. +    {
  4265. +        ((Player*)passenger)->GetCamera().ResetView();
  4266. +
  4267. +        WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4);
  4268. +        data << passenger->GetPackGUID();
  4269. +        data << uint32(2);
  4270. +        passenger->SendMessageToSet(&data, true);
  4271. +
  4272. +        ((Player*)passenger)->ResummonPetTemporaryUnSummonedIfAny();
  4273. +    }
  4274. +    passenger->UpdateAllowedPositionZ(px, py, pz);
  4275. +    passenger->SetPosition(px, py, pz + 0.5f, po);
  4276. +    UpdateFreeSeatCount();
  4277. +
  4278. +    if (m_pBase->GetTypeId() == TYPEID_UNIT)
  4279. +    {
  4280. +        if (((Creature*)m_pBase)->AI())
  4281. +            ((Creature*)m_pBase)->AI()->PassengerBoarded(passenger, seat->first, false);
  4282. +    }
  4283. +
  4284. +}
  4285. +
  4286. +void VehicleKit::Reset()
  4287. +{
  4288. +    InstallAllAccessories(m_pBase->GetEntry());
  4289. +    UpdateFreeSeatCount();
  4290. +}
  4291. +
  4292. +void VehicleKit::InstallAllAccessories(uint32 entry)
  4293. +{
  4294. +    VehicleAccessoryList const* mVehicleList = sObjectMgr.GetVehicleAccessoryList(entry);
  4295. +    if (!mVehicleList)
  4296. +        return;
  4297. +
  4298. +    for (VehicleAccessoryList::const_iterator itr = mVehicleList->begin(); itr != mVehicleList->end(); ++itr)
  4299. +        InstallAccessory(itr->uiAccessory, itr->uiSeat, itr->bMinion);
  4300. +}
  4301. +
  4302. +void VehicleKit::InstallAccessory( uint32 entry, int8 seatId, bool minion)
  4303. +{
  4304. +    if (Unit *passenger = GetPassenger(seatId))
  4305. +    {
  4306. +        // already installed
  4307. +        if (passenger->GetEntry() == entry)
  4308. +            return;
  4309. +
  4310. +        passenger->ExitVehicle();
  4311. +    }
  4312. +
  4313. +    if (Creature *accessory = m_pBase->SummonCreature(entry, m_pBase->GetPositionX(), m_pBase->GetPositionY(), m_pBase->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
  4314. +    {
  4315. +        accessory->SetCreatorGuid(ObjectGuid());
  4316. +        accessory->EnterVehicle(this, seatId);
  4317. +        accessory->SendHeartBeat(false);
  4318. +    }
  4319. +}
  4320. +
  4321. +void VehicleKit::UpdateFreeSeatCount()
  4322. +{
  4323. +    m_uiNumFreeSeats = 0;
  4324. +
  4325. +    for (SeatMap::const_iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
  4326. +    {
  4327. +        if (!itr->second.passenger && itr->second.seatInfo->IsUsable())
  4328. +            ++m_uiNumFreeSeats;
  4329. +    }
  4330. +
  4331. +    uint32 flag = m_pBase->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK;
  4332. +
  4333. +    if (m_uiNumFreeSeats)
  4334. +        m_pBase->SetFlag(UNIT_NPC_FLAGS, flag);
  4335. +    else
  4336. +        m_pBase->RemoveFlag(UNIT_NPC_FLAGS, flag);
  4337. +}
  4338. +
  4339. +void VehicleKit::RelocatePassengers(float x, float y, float z, float ang)
  4340. +{
  4341. +    for (SeatMap::const_iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
  4342. +    {
  4343. +        if (Unit *passenger = itr->second.passenger)
  4344. +        {
  4345. +            float px = x + passenger->m_movementInfo.GetTransportPos()->x;
  4346. +            float py = y + passenger->m_movementInfo.GetTransportPos()->y;
  4347. +            float pz = z + passenger->m_movementInfo.GetTransportPos()->z;
  4348. +            float po = ang + passenger->m_movementInfo.GetTransportPos()->o;
  4349. +
  4350. +            passenger->UpdateAllowedPositionZ(px, py, pz);
  4351. +            passenger->SetPosition(px, py, pz, po);
  4352. +        }
  4353. +    }
  4354. +}
  4355. +
  4356. +VehicleSeatEntry const* VehicleKit::GetSeatInfo(Unit* passenger)
  4357.  {
  4358. -    SendObjectDeSpawnAnim(GetGUID());
  4359. -    CombatStop();
  4360. -    AddObjectToRemoveList();
  4361. +    for (SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
  4362. +    {
  4363. +        if (Unit *_passenger = itr->second.passenger)
  4364. +            if (_passenger = passenger)
  4365. +                return itr->second.seatInfo;
  4366. +    }
  4367. +    return NULL;
  4368.  }
  4369. diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h
  4370. index 194525b..985b6f1 100644
  4371. --- a/src/game/Vehicle.h
  4372. +++ b/src/game/Vehicle.h
  4373. @@ -25,36 +25,56 @@
  4374.  #include "Unit.h"
  4375.  #include "SharedDefines.h"
  4376.  
  4377. -class Vehicle : public Creature
  4378. +struct VehicleSeat
  4379.  {
  4380. -    public:
  4381. -        explicit Vehicle();
  4382. -        virtual ~Vehicle();
  4383. +    VehicleSeat(VehicleSeatEntry const *pSeatInfo = NULL) : seatInfo(pSeatInfo), passenger(NULL) {}
  4384.  
  4385. -        void AddToWorld();
  4386. -        void RemoveFromWorld();
  4387. +    VehicleSeatEntry const *seatInfo;
  4388. +    Unit* passenger;
  4389. +};
  4390.  
  4391. -        bool Create (uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, Team team);
  4392. +typedef std::map<int8, VehicleSeat> SeatMap;
  4393.  
  4394. -        void SetDeathState(DeathState s);                   // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
  4395. -        void Update(uint32 update_diff, uint32 diff);                           // overwrite virtual Creature::Update and Unit::Update
  4396. +struct VehicleAccessory
  4397. +{
  4398. +    explicit VehicleAccessory(uint32 _uiAccessory, int8 _uiSeat, bool _bMinion) : uiAccessory(_uiAccessory), uiSeat(_uiSeat), bMinion(_bMinion) {}
  4399. +    uint32 uiAccessory;
  4400. +    int8 uiSeat;
  4401. +    uint32 bMinion;
  4402. +};
  4403.  
  4404. -        uint32 GetVehicleId() { return m_vehicleId; }
  4405. -        void SetVehicleId(uint32 vehicleid) { m_vehicleId = vehicleid; }
  4406. +typedef std::vector<VehicleAccessory> VehicleAccessoryList;
  4407. +typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
  4408.  
  4409. -        void Dismiss();
  4410. +class MANGOS_DLL_SPEC VehicleKit
  4411. +{
  4412. +public:
  4413. +    explicit VehicleKit(Unit* base, VehicleEntry const* vehicleInfo);
  4414. +    ~VehicleKit();
  4415.  
  4416. -    protected:
  4417. -        uint32 m_vehicleId;
  4418. +    void Reset();
  4419. +    void InstallAllAccessories(uint32 entry);
  4420.  
  4421. -    private:
  4422. -        void SaveToDB(uint32, uint8)                        // overwrited of Creature::SaveToDB     - don't must be called
  4423. -        {
  4424. -            MANGOS_ASSERT(false);
  4425. -        }
  4426. -        void DeleteFromDB()                                 // overwrited of Creature::DeleteFromDB - don't must be called
  4427. -        {
  4428. -            MANGOS_ASSERT(false);
  4429. -        }
  4430. +    bool HasEmptySeat(int8 seatId) const;
  4431. +    Unit *GetPassenger(int8 seatId) const;
  4432. +    int8 GetNextEmptySeat(int8 seatId, bool next) const;
  4433. +    bool AddPassenger(Unit *passenger, int8 seatId = -1);
  4434. +    void RemovePassenger(Unit *passenger);
  4435. +    void RelocatePassengers(float x, float y, float z, float ang);
  4436. +    void RemoveAllPassengers();
  4437. +    VehicleSeatEntry const* GetSeatInfo(Unit* passenger);
  4438. +
  4439. +    uint32 GetVehicleId() const { return m_vehicleInfo->m_ID; }
  4440. +    VehicleEntry const* GetVehicleInfo() const { return m_vehicleInfo; }
  4441. +    Unit* GetBase() { return m_pBase; }
  4442. +private:
  4443. +    void UpdateFreeSeatCount();
  4444. +    void InstallAccessory(uint32 entry, int8 seatId, bool minion = true);
  4445. +
  4446. +    SeatMap m_Seats;
  4447. +    uint32 m_uiNumFreeSeats;
  4448. +    VehicleEntry const *m_vehicleInfo;
  4449. +    Unit* m_pBase;
  4450.  };
  4451. +
  4452.  #endif
  4453. diff --git a/src/game/World.cpp b/src/game/World.cpp
  4454. index cf56ec5..846b785 100644
  4455. --- a/src/game/World.cpp
  4456. +++ b/src/game/World.cpp
  4457. @@ -1041,6 +1041,9 @@ void World::SetInitialWorldSettings()
  4458.      sLog.outString( ">>> Creature Addon Data loaded" );
  4459.      sLog.outString();
  4460.  
  4461. +    sLog.outString("Loading Vehicle Accessories...");
  4462. +    sObjectMgr.LoadVehicleAccessories();
  4463. +
  4464.      sLog.outString( "Loading Creature Respawn Data..." );   // must be after PackInstances()
  4465.      sObjectMgr.LoadCreatureRespawnTimes();
  4466.  
  4467. diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
  4468. index 8ac7d17..067cea3 100644
  4469. --- a/src/game/WorldSession.h
  4470. +++ b/src/game/WorldSession.h
  4471. @@ -469,9 +469,17 @@ class MANGOS_DLL_SPEC WorldSession
  4472.          void HandleMovementOpcodes(WorldPacket& recvPacket);
  4473.          void HandleSetActiveMoverOpcode(WorldPacket &recv_data);
  4474.          void HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data);
  4475. -        void HandleDismissControlledVehicle(WorldPacket &recv_data);
  4476.          void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data);
  4477.  
  4478. +        void HandleDismissControlledVehicle(WorldPacket &recv_data);
  4479. +        void HandleRequestVehicleExit(WorldPacket &recv_data);
  4480. +        void HandleRequestVehiclePrevSeat(WorldPacket &recv_data);
  4481. +        void HandleRequestVehicleNextSeat(WorldPacket &recv_data);
  4482. +        void HandleRequestVehicleSwitchSeat(WorldPacket &recv_data);
  4483. +        void HandleEnterPlayerVehicle(WorldPacket &recv_data);
  4484. +        void HandleEjectPasenger(WorldPacket &recv_data);
  4485. +        void HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data);
  4486. +
  4487.          void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );
  4488.  
  4489.          void HandleGroupInviteOpcode(WorldPacket& recvPacket);
  4490. diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp
  4491. index c19fbd9..0da6532 100644
  4492. --- a/src/game/debugcmds.cpp
  4493. +++ b/src/game/debugcmds.cpp
  4494. @@ -645,50 +645,6 @@ bool ChatHandler::HandleDebugArenaCommand(char* /*args*/)
  4495.      return true;
  4496.  }
  4497.  
  4498. -bool ChatHandler::HandleDebugSpawnVehicleCommand(char* args)
  4499. -{
  4500. -    uint32 entry;
  4501. -    if (!ExtractUInt32(&args, entry))
  4502. -        return false;
  4503. -
  4504. -    uint32 id;
  4505. -    if (!ExtractUInt32(&args, id))
  4506. -        return false;
  4507. -
  4508. -    CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
  4509. -    if (!ci)
  4510. -        return false;
  4511. -
  4512. -    VehicleEntry const *ve = sVehicleStore.LookupEntry(id);
  4513. -    if (!ve)
  4514. -        return false;
  4515. -
  4516. -    Vehicle *v = new Vehicle;
  4517. -    Map *map = m_session->GetPlayer()->GetMap();
  4518. -    if (!v->Create(map->GenerateLocalLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam()))
  4519. -    {
  4520. -        delete v;
  4521. -        return false;
  4522. -    }
  4523. -
  4524. -    float px, py, pz;
  4525. -    m_session->GetPlayer()->GetClosePoint(px, py, pz, m_session->GetPlayer()->GetObjectBoundingRadius());
  4526. -
  4527. -    v->Relocate(px, py, pz, m_session->GetPlayer()->GetOrientation());
  4528. -
  4529. -    if (!v->IsPositionValid())
  4530. -    {
  4531. -        sLog.outError("Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
  4532. -            v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY());
  4533. -        delete v;
  4534. -        return false;
  4535. -    }
  4536. -
  4537. -    map->Add((Creature*)v);
  4538. -
  4539. -    return true;
  4540. -}
  4541. -
  4542.  bool ChatHandler::HandleDebugSpellCheckCommand(char* /*args*/)
  4543.  {
  4544.      sLog.outString( "Check expected in code spell properties base at table 'spell_check' content...");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement