Merge branch 'master' into 4.3.4

Conflicts:
	src/server/game/Entities/Object/Object.cpp
	src/server/game/Entities/Object/Object.h
	src/server/game/Entities/Pet/Pet.cpp
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Player/Player.h
	src/server/game/Events/GameEventMgr.cpp
	src/server/game/Loot/LootMgr.cpp
	src/server/shared/Packets/ByteBuffer.h
This commit is contained in:
Spp committed 2013-03-25 14:34:22 +01:00
commit c97c381ea0
54 files changed
+924 -465

No files matched your search

@@ -0,0 +1,9 @@
-- Fix quest 14077: The Light's Mercy
SET @SPELL := 66390;
SET @NPC := 34852;
SET @NPC_REWARD := 34852;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` = @NPC;
DELETE FROM `smart_scripts` WHERE `entryorguid` = @NPC AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`,`event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`,`action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(@NPC,0,0,1,8,0,100,0x01,@SPELL,0,0,0,33,@NPC_REWARD,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Slain Tualiq Villager - On spell hit - Give kill credit for quest 14077'),
(@NPC,0,1,0,61,0,100,1,0,0,0,0,41,2000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Slain Tualiq Villager - Despawn after 2 seconds');
@@ -0,0 +1,7 @@
DELETE FROM `smart_scripts` WHERE `entryorguid`=9026 AND `source_type`=0 AND `id`=2;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(9026,0,2,0,6,0,100,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, "Overmaster Pyron - On Death - Say Line 0");
DELETE FROM `creature_text` WHERE `entry`=9026 AND `groupid`=0;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(9026,0,0, "I will be reborn, mortals! Incendius shall raise me from these ashes!",12,0,100,0,0,0,"Overmaster Pyron");
@@ -0,0 +1,11 @@
SET @CGUID := 54428; -- set by TDB team (3)
DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+2;
INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES
(@CGUID+0, 36656, 571, 1, 1, 5647.669, 2106.526, 798.1375, 4.764749, 120, 0, 0), -- Silver Covenant Sentinel (Area: 4862)
(@CGUID+1, 36656, 571, 1, 1, 5657.819, 2105.712, 798.1375, 4.590216, 120, 0, 0), -- Silver Covenant Sentinel (Area: 4862)
(@CGUID+2, 36624, 571, 1, 1, 5652.733, 2106.208, 798.1375, 4.572762, 120, 0, 0); -- Caladis Brightspear (Area: 4862)
DELETE FROM `creature_addon` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+2;
INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
(@CGUID+0, 0, 0, 0x10000, 0x1, 0, '71311'),
(@CGUID+1, 0, 0, 0x10000, 0x1, 0, '71311'),
(@CGUID+2, 0, 0, 0x10000, 0x1, 0, '71311');
@@ -0,0 +1,9 @@
UPDATE `smart_scripts` SET `event_phase_mask`=0 WHERE `entryorguid`=2289 AND `source_type`=1;
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry`=1494;
DELETE FROM `smart_scripts` WHERE `entryorguid`=1494;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(1494,0,0,0,1,0,100,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'On Respawn - Say Line - Yell Text on Summon');
-- Add missing creature_text
DELETE FROM `creature_text` WHERE `entry`=1494 AND `groupid`=0;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(1494,0,0, 'Mmmh...I SMELL FOOD!',14,0,100,0,0,0, 'Negolash Yell on Summon');
@@ -0,0 +1,318 @@
-- missing objects/mobs on Demon Fall Ridge
SET @OGUID := 6040;
SET @CGUID := 108860;
DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+3;
INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
(@OGUID+0,1622 ,1,1,1,1559.646 ,-2812.193,181.5358 ,0 ,0 ,0 ,0 ,1 ,120,255,1), -- Bruiseweed (Area: Demon Fall Ridge),
(@OGUID+1,1623 ,1,1,1,1599.648 ,-3088.057,89.47401 ,0 ,0 ,0 ,0 ,1 ,120,255,1), -- Wild Steelbloom (Area: Demon Fall Ridge),
(@OGUID+2,1732 ,1,1,1,1619.236 ,-3106.807,90.91071 ,0 ,0 ,0 ,0 ,1 ,120,255,1), -- Tin Vein (Area: Demon Fall Ridge),
(@OGUID+3,176784,1,1,1,1550.686 ,-2862.281,181.7537 ,3.141593 ,0 ,0 ,0 ,1 ,120,255,1); -- Bonfire (Area: Demon Fall Ridge);
DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID AND @CGUID+25;
INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES
(@CGUID+00,11697,1,1,1,1377.036,-2832.29,108.1152,5.778122,120,10,1), -- Mannoroc Lasher (Area: Demon Fall Ridge) (waypoints or random movement)
(@CGUID+01,11697,1,1,1,1442.845,-2781.555,143.3298,3.407407,120,10,1), -- Mannoroc Lasher (Area: Demon Fall Ridge) (possible waypoints or random movement)
(@CGUID+02,11697,1,1,1,1520.548,-2910.79,128.7899,0.3708913,120,10,1), -- Mannoroc Lasher (Area: Demon Fall Ridge) (possible waypoints or random movement)
(@CGUID+03,11697,1,1,1,1522.825,-2851.57,182.1475,5.156503,120,10,1), -- Mannoroc Lasher (Area: Demon Fall Ridge) (waypoints or random movement)
(@CGUID+04,11697,1,1,1,1538.938,-2878.932,183.4645,1.239184,120,0,0), -- Mannoroc Lasher (Area: Demon Fall Ridge)
(@CGUID+05,11697,1,1,1,1544.031,-2848.745,182.5147,5.044002,120,0,0), -- Mannoroc Lasher (Area: Demon Fall Ridge)
(@CGUID+06,11697,1,1,1,1544.416,-2863.002,112.0556,2.701836,120,10,1), -- Mannoroc Lasher (Area: Demon Fall Ridge) (possible waypoints or random movement)
(@CGUID+07,11697,1,1,1,1563.016,-2859.155,182.2932,4.066617,120,0,0), -- Mannoroc Lasher (Area: Demon Fall Ridge)
(@CGUID+08,11697,1,1,1,1581.573,-2897.424,182.3294,1.43117,120,0,0), -- Mannoroc Lasher (Area: Demon Fall Ridge)
(@CGUID+09,16030,1,1,1,1625.747,-3095.011,89.12293,2.2015,120,10,1), -- Maggot (Area: Demon Fall Ridge)
(@CGUID+10,16030,1,1,1,1636.01,-3052.925,90.07569,4.715363,120,10,1), -- Maggot (Area: Demon Fall Ridge)
(@CGUID+11,16030,1,1,1,1647.72,-3076.708,88.33277,1.016972,120,10,1), -- Maggot (Area: Demon Fall Ridge)
(@CGUID+12,6073,1,1,1,1420.36,-2797,153.2968,4.158457,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+13,6073,1,1,1,1451.373,-2815.769,154.2159,4.385233,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+14,6073,1,1,1,1500.756,-2835.735,111.587,5.95405,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+15,6073,1,1,1,1512.830,-2877.935,111.1157,2.860,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+16,6073,1,1,1,1550.406,-2885.673,132.9547,4.354227,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+17,6073,1,1,1,1555.71,-2901.445,182.4397,3.857178,120,10,1), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+18,6073,1,1,1,1566.779,-2894.126,132.5958,0.1956479,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+19,6073,1,1,1,1537.930,-2823.109,181.6067,5.282221,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+20,6073,1,1,1,1583.341,-2959.558,182.2528,5.410459,120,0,0), -- Searing Infernal (Area: Demon Fall Ridge)
(@CGUID+21,6115,1,1,1,1420.313,-2851.199,133.127,0.9438578,120,10,1), -- Roaming Felguard (Area: Demon Fall Ridge) (waypoints or random movement)
(@CGUID+22,6115,1,1,1,1461.483,-2783.054,154.6106,4.637331,120,10,1), -- Roaming Felguard (Area: Demon Fall Ridge) (waypoints or random movement)
(@CGUID+23,6115,1,1,1,1521.961,-2856.834,111.6264,4.90235,120,10,1), -- Roaming Felguard (Area: Demon Fall Ridge) (waypoints or random movement)
(@CGUID+24,6115,1,1,1,1610.802,-3083.251,89.95774,1.347837,120,10,1), -- Roaming Felguard (Area: Demon Fall Ridge) waypoints or random movement)
(@CGUID+25,6115,1,1,1,1611.121,-2985.179,182.0912,2.853907,120,10,1); -- Roaming Felguard (Area: Demon Fall Ridge) (waypoints or random movement)
-- reposition to avoid position clash with other mob
UPDATE creature SET position_x = 1553.05,position_y = -2844.765,position_z = 129.70,orientation = 0.6726,MovementType = 0,spawndist = 0 WHERE `guid` = 20082;
-- pathing for Felguard #20872 on
SET @WPID := 208720;
UPDATE `creature` SET `MovementType`=2,`position_x`=1445.667358,`position_y`=-2785.956299,`position_z`=144.079132,`currentwaypoint`=0 WHERE `guid`=20872;
DELETE FROM `creature_addon` WHERE `guid`=20872;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (20872,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1445.667358,-2785.956299,144.079132,0,0,0,0,100,0),
(@WPID,1,1450.664429,-2799.601807,144.581528,0,0,0,0,100,0),
(@WPID,2,1457.757935,-2801.675293,145.510452,0,0,0,0,100,0),
(@WPID,3,1467.130493,-2804.867188,147.879959,0,0,0,0,100,0),
(@WPID,4,1476.766113,-2806.016602,149.540283,0,0,0,0,100,0),
(@WPID,5,1478.050537,-2798.385254,149.963150,0,0,0,0,100,0),
(@WPID,6,1473.788696,-2787.377197,152.504379,0,0,0,0,100,0),
(@WPID,7,1468.064453,-2783.520264,154.801208,0,0,0,0,100,0),
(@WPID,8,1460.110718,-2782.338135,154.570343,0,0,0,0,100,0),
(@WPID,9,1466.063477,-2783.569580,155.144333,0,0,0,0,100,0),
(@WPID,10,1473.382202,-2788.681152,152.407547,0,0,0,0,100,0),
(@WPID,11,1477.975464,-2797.371094,150.017349,0,0,0,0,100,0),
(@WPID,12,1473.043457,-2804.988770,149.482895,0,0,0,0,100,0),
(@WPID,13,1465.716309,-2806.197021,147.414398,0,0,0,0,100,0),
(@WPID,14,1457.339355,-2802.397949,145.514069,0,0,0,0,100,0),
(@WPID,15,1450.980835,-2794.119385,144.331573,0,0,0,0,100,0);
-- pathing for Felguard #20874 on
SET @WPID := 208740;
UPDATE `creature` SET `MovementType`=2,`position_x`=1427.127686,`position_y`=-2794.929199,`position_z`=153.367630,`currentwaypoint`=0 WHERE `guid`=20874;
DELETE FROM `creature_addon` WHERE `guid`=20874;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (20874,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1427.127686,-2794.929199,153.367630,0,0,0,0,100,0),
(@WPID,1,1434.866943,-2792.607666,153.983551,0,0,0,0,100,0),
(@WPID,2,1439.881104,-2789.645996,156.961761,0,0,0,0,100,0),
(@WPID,3,1446.391846,-2787.082031,158.247574,0,0,0,0,100,0),
(@WPID,4,1452.749390,-2784.158691,156.516998,0,0,0,0,100,0),
(@WPID,5,1461.059204,-2782.987793,154.608047,0,0,0,0,100,0),
(@WPID,6,1459.080078,-2790.694580,157.111328,0,0,0,0,100,0),
(@WPID,7,1457.619629,-2795.229492,158.473236,0,0,0,0,100,0),
(@WPID,8,1455.797607,-2801.988037,158.055511,0,0,0,0,100,0),
(@WPID,9,1453.832642,-2808.706543,155.066422,0,0,0,0,100,0),
(@WPID,10,1451.864258,-2814.851807,153.940338,0,0,0,0,100,0),
(@WPID,11,1453.883789,-2807.040039,155.886780,0,0,0,0,100,0),
(@WPID,12,1457.238525,-2798.087891,158.691376,0,0,0,0,100,0),
(@WPID,13,1459.887451,-2791.610352,157.409363,0,0,0,0,100,0),
(@WPID,14,1461.216431,-2782.308350,154.564026,0,0,0,0,100,0),
(@WPID,15,1450.710571,-2784.914063,157.356842,0,0,0,0,100,0),
(@WPID,16,1444.170044,-2787.408203,158.144180,0,0,0,0,100,0),
(@WPID,17,1434.528687,-2791.566895,154.061630,0,0,0,0,100,0);
-- pathing for Felguard #20876 on
SET @WPID := 208760;
UPDATE creature SET `MovementType`=2,`position_x`=1519.061279,`position_y`=-2911.228271,`position_z`=128.724503,`currentwaypoint`=0 WHERE `guid` = 20876;
DELETE FROM `creature_addon` WHERE `guid` = 20876;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (20876,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1519.061279,-2911.228271,128.724503,0,0,0,0,100,0),
(@WPID,1,1520.779297,-2904.444336,130.019699,0,0,0,0,100,0),
(@WPID,2,1523.576782,-2894.323975,129.760376,0,0,0,0,100,0),
(@WPID,3,1525.399658,-2887.565674,129.650497,0,0,0,0,100,0),
(@WPID,4,1527.510254,-2880.891602,127.859444,0,0,0,0,100,0),
(@WPID,5,1530.465454,-2871.784424,124.707077,0,0,0,0,100,0),
(@WPID,6,1534.396240,-2865.125244,124.945396,0,0,0,0,100,0),
(@WPID,7,1541.486206,-2857.385254,129.325195,0,0,0,0,100,0),
(@WPID,8,1546.340820,-2852.342285,129.804764,0,0,0,0,100,0),
(@WPID,9,1551.960815,-2845.879395,129.609558,0,0,0,0,100,0),
(@WPID,10,1547.109009,-2851.705322,129.800903,0,0,0,0,100,0),
(@WPID,11,1542.209229,-2856.704590,129.541779,0,0,0,0,100,0),
(@WPID,12,1534.886353,-2864.229248,125.346100,0,0,0,0,100,0),
(@WPID,13,1530.252686,-2871.376953,124.679268,0,0,0,0,100,0),
(@WPID,14,1528.427368,-2877.171631,126.128044,0,0,0,0,100,0),
(@WPID,15,1525.856323,-2887.348633,129.625702,0,0,0,0,100,0),
(@WPID,16,1523.781738,-2894.034180,129.770584,0,0,0,0,100,0),
(@WPID,17,1521.690063,-2900.714355,129.564087,0,0,0,0,100,0);
-- pathing for Lasher CGUID+0
SET @WPID := (@CGUID+0)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1377.440918,`position_y`=-2831.153320,`position_z`=108.026917,`currentwaypoint`=0 WHERE `guid` = @CGUID+0;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+0;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+0,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1377.440918,-2831.153320,108.026917,0,0,0,0,100,0),
(@WPID,1,1382.229004,-2827.563721,108.826355,0,0,0,0,100,0),
(@WPID,2,1391.730957,-2823.097656,109.964256,0,0,0,0,100,0),
(@WPID,3,1403.629517,-2820.422607,113.992607,0,0,0,0,100,0),
(@WPID,4,1414.020630,-2821.883545,116.552795,0,0,0,0,100,0),
(@WPID,5,1425.679565,-2823.227295,118.282143,0,0,0,0,100,0),
(@WPID,6,1437.257935,-2822.140869,120.388496,0,0,0,0,100,0),
(@WPID,7,1444.380127,-2817.184570,120.541428,0,0,0,0,100,0),
(@WPID,8,1439.560669,-2812.109863,120.442703,0,0,0,0,100,0),
(@WPID,9,1429.911133,-2806.321045,121.627449,0,0,0,0,100,0),
(@WPID,10,1420.165527,-2802.415283,122.528816,0,0,0,0,100,0),
(@WPID,11,1406.437866,-2799.521240,123.336349,0,0,0,0,100,0),
(@WPID,12,1408.145020,-2806.980225,124.640030,0,0,0,0,100,0),
(@WPID,13,1411.558472,-2817.519531,130.557297,0,0,0,0,100,0),
(@WPID,14,1414.248291,-2826.448975,134.029892,0,0,0,0,100,0),
(@WPID,15,1416.987061,-2833.898926,134.158966,0,0,0,0,100,0),
(@WPID,16,1418.680298,-2841.623291,134.089142,0,0,0,0,100,0),
(@WPID,17,1417.675415,-2851.522949,133.205948,0,0,0,0,100,0),
(@WPID,18,1419.567261,-2843.880615,134.064331,0,0,0,0,100,0),
(@WPID,19,1418.282349,-2835.081543,133.903214,0,0,0,0,100,0),
(@WPID,20,1413.755615,-2826.055420,133.871857,0,0,0,0,100,0),
(@WPID,21,1410.707886,-2816.007813,129.677521,0,0,0,0,100,0),
(@WPID,22,1407.735840,-2804.345947,123.423225,0,0,0,0,100,0),
(@WPID,23,1411.128418,-2800.364258,123.362190,0,0,0,0,100,0),
(@WPID,24,1423.222046,-2802.809082,122.215492,0,0,0,0,100,0),
(@WPID,25,1432.720093,-2807.233643,121.249458,0,0,0,0,100,0),
(@WPID,26,1442.866333,-2811.426514,120.474632,0,0,0,0,100,0),
(@WPID,27,1442.986938,-2817.752686,120.496185,0,0,0,0,100,0),
(@WPID,28,1432.807739,-2820.319336,120.214920,0,0,0,0,100,0),
(@WPID,29,1422.910767,-2822.051270,118.090607,0,0,0,0,100,0),
(@WPID,30,1411.085083,-2819.568359,115.681824,0,0,0,0,100,0),
(@WPID,31,1400.672852,-2819.333740,113.069351,0,0,0,0,100,0),
(@WPID,32,1392.437012,-2822.626953,110.105415,0,0,0,0,100,0),
(@WPID,33,1381.681763,-2827.953857,108.544312,0,0,0,0,100,0);
-- pathing for Lasher CGUID+3
SET @WPID := (@CGUID+3)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1525.115723,`position_y`=-2850.323975,`position_z`=182.264648,`currentwaypoint`=0 WHERE `guid` = @CGUID+3;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+3;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+3,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1525.115723,-2850.323975,182.264648,0,0,0,0,100,0),
(@WPID,1,1531.196411,-2840.045166,182.315933,0,0,0,0,100,0),
(@WPID,2,1540.609741,-2830.145752,182.035614,0,0,0,0,100,0),
(@WPID,3,1550.371094,-2824.623535,181.914169,0,0,0,0,100,0),
(@WPID,4,1560.609863,-2825.602783,181.713562,0,0,0,0,100,0),
(@WPID,5,1573.442139,-2834.195557,181.620041,0,0,0,0,100,0),
(@WPID,6,1573.676636,-2843.122803,182.236511,0,0,0,0,100,0),
(@WPID,7,1575.495605,-2852.658936,183.287399,0,0,0,0,100,0),
(@WPID,8,1573.915161,-2863.642578,182.804459,0,0,0,0,100,0),
(@WPID,9,1568.231201,-2881.090820,183.118271,0,0,0,0,100,0),
(@WPID,10,1558.646729,-2884.779541,183.471115,0,0,0,0,100,0),
(@WPID,11,1549.383301,-2877.014160,182.969772,0,0,0,0,100,0),
(@WPID,12,1541.126465,-2864.694092,182.265366,0,0,0,0,100,0);
-- pathing for Felguard CGUID+21 on
SET @WPID := (@CGUID+21)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1418.673340,`position_y`=-2849.543701,`position_z`=133.128998,`currentwaypoint`=0 WHERE `guid` = @CGUID+21;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+21;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+21,@WPID);
DELETE FROM `waypoint_data` WHERE id=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1418.673340,-2849.543701,133.128998,0,0,0,0,100,0),
(@WPID,1,1419.053223,-2840.867188,133.872528,0,0,0,0,100,0),
(@WPID,2,1416.689941,-2834.154297,134.137970,0,0,0,0,100,0),
(@WPID,3,1414.608398,-2827.471436,134.225082,0,0,0,0,100,0),
(@WPID,4,1412.582764,-2820.770996,132.077194,0,0,0,0,100,0),
(@WPID,5,1409.088867,-2810.655762,126.843498,0,0,0,0,100,0),
(@WPID,6,1411.302002,-2817.291016,130.399963,0,0,0,0,100,0),
(@WPID,7,1413.902222,-2826.605957,134.035446,0,0,0,0,100,0),
(@WPID,8,1416.532471,-2833.090820,134.308105,0,0,0,0,100,0),
(@WPID,9,1418.736084,-2841.765137,134.127487,0,0,0,0,100,0);
-- pathing for Felguard CGUID+22 on
SET @WPID := (@CGUID+22)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1461.952393,`position_y`=-2777.578613,`position_z`=154.923584,`currentwaypoint`=0 WHERE `guid` = @CGUID+22;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+22;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+22,@WPID);
DELETE FROM `waypoint_data` WHERE id=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1461.952393,-2777.578613,154.923584,0,0,0,0,100,0),
(@WPID,1,1465.133545,-2767.573975,154.857132,0,0,0,0,100,0),
(@WPID,2,1472.367310,-2758.643555,156.072708,0,0,0,0,100,0),
(@WPID,3,1482.150879,-2754.233887,156.292877,0,0,0,0,100,0),
(@WPID,4,1493.999512,-2752.110352,158.143372,0,0,0,0,100,0),
(@WPID,5,1497.644165,-2753.630127,159.105545,0,0,0,0,100,0),
(@WPID,6,1500.601318,-2760.660889,160.422638,0,0,0,0,100,0),
(@WPID,7,1501.830933,-2768.006348,160.797318,0,0,0,0,100,0),
(@WPID,8,1503.898804,-2771.084473,161.295364,0,0,0,0,100,0),
(@WPID,9,1509.369507,-2777.201904,163.673080,0,0,0,0,100,0),
(@WPID,10,1512.175049,-2785.971191,165.083893,0,0,0,0,100,0),
(@WPID,11,1513.801514,-2792.097412,165.634216,0,0,0,0,100,0),
(@WPID,12,1518.169800,-2796.058838,165.138840,0,0,0,0,100,0),
(@WPID,13,1524.349854,-2800.773926,167.720108,0,0,0,0,100,0),
(@WPID,14,1525.073975,-2806.124023,169.219666,0,0,0,0,100,0),
(@WPID,15,1522.830933,-2812.213623,170.961700,0,0,0,0,100,0),
(@WPID,16,1511.613159,-2814.369385,174.126556,0,0,0,0,100,0),
(@WPID,17,1510.135620,-2812.832031,174.583145,0,0,0,0,100,0),
(@WPID,18,1507.537842,-2804.130127,177.219849,0,0,0,0,100,0),
(@WPID,19,1510.847778,-2799.395020,178.859070,0,0,0,0,100,0),
(@WPID,20,1516.893555,-2797.346436,180.676239,0,0,0,0,100,0),
(@WPID,21,1522.649170,-2800.572021,182.535858,0,0,0,0,100,0),
(@WPID,22,1524.135986,-2803.739746,183.545761,0,0,0,0,100,0),
(@WPID,23,1525.988403,-2809.307129,183.373550,0,0,0,0,100,0),
(@WPID,24,1531.261963,-2816.573486,183.528900,0,0,0,0,100,0),
(@WPID,25,1525.760620,-2811.326904,183.373657,0,0,0,0,100,0),
(@WPID,26,1524.779297,-2808.985840,183.373657,0,0,0,0,100,0),
(@WPID,27,1523.441772,-2802.632324,183.127411,0,0,0,0,100,0),
(@WPID,28,1517.132202,-2796.257080,180.712280,0,0,0,0,100,0),
(@WPID,29,1513.053223,-2798.000732,179.479279,0,0,0,0,100,0),
(@WPID,30,1507.427002,-2804.455811,177.126724,0,0,0,0,100,0),
(@WPID,31,1508.335205,-2810.697266,175.403000,0,0,0,0,100,0),
(@WPID,32,1511.198853,-2812.709717,174.371857,0,0,0,0,100,0),
(@WPID,33,1517.645874,-2814.697510,172.516037,0,0,0,0,100,0),
(@WPID,34,1522.476196,-2811.204834,170.816132,0,0,0,0,100,0),
(@WPID,35,1524.924316,-2804.578857,168.840012,0,0,0,0,100,0),
(@WPID,36,1522.207397,-2800.135010,167.209824,0,0,0,0,100,0),
(@WPID,37,1515.743164,-2793.846436,165.489563,0,0,0,0,100,0),
(@WPID,38,1513.621826,-2789.284180,165.761047,0,0,0,0,100,0),
(@WPID,39,1511.703735,-2782.553467,165.049728,0,0,0,0,100,0),
(@WPID,40,1509.514526,-2776.442139,163.672668,0,0,0,0,100,0),
(@WPID,41,1504.341187,-2768.239258,160.875214,0,0,0,0,100,0),
(@WPID,42,1499.623779,-2758.871826,160.065994,0,0,0,0,100,0),
(@WPID,43,1492.976929,-2750.636963,158.080460,0,0,0,0,100,0),
(@WPID,44,1487.860107,-2750.589600,157.576538,0,0,0,0,100,0),
(@WPID,45,1478.629761,-2755.590332,155.843948,0,0,0,0,100,0),
(@WPID,46,1469.609863,-2761.452148,155.947708,0,0,0,0,100,0),
(@WPID,47,1465.007324,-2767.513184,154.872833,0,0,0,0,100,0),
(@WPID,48,1462.420410,-2775.385254,155.379456,0,0,0,0,100,0);
-- pathing for Felguard CGUID+23 on
SET @WPID := (@CGUID+23)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1529.591064,`position_y`=-2869.343506,`position_z`=124.593094,`currentwaypoint`=0 WHERE `guid` = @CGUID+23;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+23;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+23,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1529.591064,-2869.343506,124.593094,0,0,0,0,100,0),
(@WPID,1,1521.646606,-2867.309082,125.010071,0,0,0,0,100,0),
(@WPID,2,1513.953125,-2865.164551,121.647118,0,0,0,0,100,0),
(@WPID,3,1505.404785,-2862.673584,118.801720,0,0,0,0,100,0),
(@WPID,4,1503.566650,-2868.243408,116.714241,0,0,0,0,100,0),
(@WPID,5,1502.711060,-2874.966064,113.316238,0,0,0,0,100,0),
(@WPID,6,1512.905396,-2877.691650,111.030319,0,0,0,0,100,0),
(@WPID,7,1521.637085,-2882.186279,111.867195,0,0,0,0,100,0),
(@WPID,8,1529.314087,-2885.161865,111.463722,0,0,0,0,100,0),
(@WPID,9,1539.290527,-2881.081299,112.201981,0,0,0,0,100,0),
(@WPID,10,1543.733276,-2870.510986,112.591675,0,0,0,0,100,0),
(@WPID,11,1538.328125,-2855.836182,111.515526,0,0,0,0,100,0),
(@WPID,12,1527.172241,-2852.837158,111.962715,0,0,0,0,100,0),
(@WPID,13,1519.438599,-2860.600342,111.478615,0,0,0,0,100,0),
(@WPID,14,1511.972412,-2870.450684,111.600555,0,0,0,0,100,0),
(@WPID,15,1507.419556,-2876.432617,112.032738,0,0,0,0,100,0),
(@WPID,16,1504.038330,-2877.903809,112.833618,0,0,0,0,100,0),
(@WPID,17,1502.584595,-2873.350342,113.795448,0,0,0,0,100,0),
(@WPID,18,1505.001221,-2866.783203,117.746407,0,0,0,0,100,0),
(@WPID,19,1506.119873,-2863.151855,118.807045,0,0,0,0,100,0),
(@WPID,20,1513.878296,-2865.620605,121.673973,0,0,0,0,100,0),
(@WPID,21,1527.201050,-2868.420166,124.730896,0,0,0,0,100,0);
-- pathing for Felguard CGUID+24 on
SET @WPID := (@CGUID+24)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1682.383301,`position_y`=-3116.470459,`position_z`=89.554993,`currentwaypoint`=0 WHERE `guid` = @CGUID+24;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+24;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+24,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1682.383301,-3116.470459,89.554993,0,0,0,0,100,0),
(@WPID,1,1674.620605,-3109.400146,88.976250,0,0,0,0,100,0),
(@WPID,2,1658.956787,-3095.415039,89.265846,0,0,0,0,100,0),
(@WPID,3,1653.566772,-3084.082275,88.686615,0,0,0,0,100,0),
(@WPID,4,1646.295532,-3068.169434,88.805115,0,0,0,0,100,0),
(@WPID,5,1636.780884,-3059.662109,88.973808,0,0,0,0,100,0),
(@WPID,6,1624.316528,-3060.500488,89.142319,0,0,0,0,100,0),
(@WPID,7,1617.466064,-3070.297119,89.184601,0,0,0,0,100,0),
(@WPID,8,1617.102051,-3082.547607,89.317902,0,0,0,0,100,0),
(@WPID,9,1627.488770,-3091.394531,88.658096,0,0,0,0,100,0),
(@WPID,10,1637.340332,-3094.989258,88.381920,0,0,0,0,100,0),
(@WPID,11,1650.978027,-3098.081299,88.389397,0,0,0,0,100,0),
(@WPID,12,1665.720093,-3104.706787,88.814766,0,0,0,0,100,0);
-- pathing for Felguard CGUID+25 on
SET @WPID := (@CGUID+25)*10;
UPDATE `creature` SET `MovementType`=2,`position_x`=1606.020386,`position_y`=-2979.190918,`position_z`=182.066589,`currentwaypoint`=0 WHERE `guid` = @CGUID+25;
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+25;
INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES (@CGUID+25,@WPID);
DELETE FROM `waypoint_data` WHERE `id`=@WPID;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@WPID,0,1606.020386,-2979.190918,182.066589,0,0,0,0,100,0),
(@WPID,1,1592.612793,-2967.980469,181.734604,0,0,0,0,100,0),
(@WPID,2,1584.635986,-2961.699951,182.099609,0,0,0,0,100,0),
(@WPID,3,1576.772339,-2950.720215,182.331390,0,0,0,0,100,0),
(@WPID,4,1570.186157,-2937.653564,181.647690,0,0,0,0,100,0),
(@WPID,5,1569.346313,-2915.366455,181.606720,0,0,0,0,100,0),
(@WPID,6,1567.291138,-2897.670410,181.974411,0,0,0,0,100,0),
(@WPID,7,1561.564575,-2883.124512,183.536499,0,0,0,0,100,0),
(@WPID,8,1554.509888,-2870.604492,182.784332,0,0,0,0,100,0),
(@WPID,9,1559.559570,-2883.650391,183.535065,0,0,0,0,100,0),
(@WPID,10,1565.662109,-2900.051514,181.913925,0,0,0,0,100,0),
(@WPID,11,1570.201538,-2913.283936,181.571747,0,0,0,0,100,0),
(@WPID,12,1573.806274,-2932.618896,181.725723,0,0,0,0,100,0),
(@WPID,13,1579.702026,-2949.056885,182.503983,0,0,0,0,100,0),
(@WPID,14,1586.535400,-2960.601807,182.164642,0,0,0,0,100,0),
(@WPID,15,1595.999878,-2972.899414,181.872986,0,0,0,0,100,0);
@@ -0,0 +1,3 @@
DELETE FROM `spell_target_position` WHERE `id`=53821;
INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES
(53821, 609, 2359.64, -5662.41, 382.261, 0.596899); -- Teach: Death Gate
@@ -0,0 +1 @@
DELETE FROM `creature_ai_scripts` WHERE `creature_id`=34852;
@@ -0,0 +1,2 @@
-- The Forging of Quel'Serrar (7509)
UPDATE `quest_template` SET `RequiredClasses` = 3 WHERE `Id` = 7509; -- Warrior & Paladin
@@ -30,17 +30,22 @@ enum AuthResult
WOW_FAIL_DB_BUSY = 0x08,
WOW_FAIL_VERSION_INVALID = 0x09,
WOW_FAIL_VERSION_UPDATE = 0x0A,
WOW_FAIL_INVALID_SERVER = 0x0B,
WOW_FAIL_SUSPENDED = 0x0C,
WOW_FAIL_FAIL_NOACCESS = 0x0D,
WOW_SUCCESS_SURVEY = 0x0E,
WOW_FAIL_PARENTCONTROL = 0x0F,
WOW_FAIL_LOCKED_ENFORCED = 0x10,
WOW_FAIL_TRIAL_ENDED = 0x11,
WOW_FAIL_USE_BATTLENET = 0x12,
WOW_FAIL_TOO_FAST = 0x16,
WOW_FAIL_CHARGEBACK = 0x17,
WOW_FAIL_ANTI_INDULGENCE = 0x13,
WOW_FAIL_EXPIRED = 0x14,
WOW_FAIL_NO_GAME_ACCOUNT = 0x15,
WOW_FAIL_CHARGEBACK = 0x16,
WOW_FAIL_INTERNET_GAME_ROOM_WITHOUT_BNET = 0x17,
WOW_FAIL_GAME_ACCOUNT_LOCKED = 0x18,
WOW_FAIL_INTERNET_GAME_ROOM_WITHOUT_BNET = 0x19,
WOW_FAIL_UNLOCKABLE_LOCK = 0x20,
WOW_FAIL_UNLOCKABLE_LOCK = 0x19,
WOW_FAIL_CONVERSION_REQUIRED = 0x20,
WOW_FAIL_DISCONNECTED = 0xFF
};
+3 -3
View File
@@ -29,13 +29,13 @@
#include <list>
class SpellInfo;
class CreatureAI;
class CreatureGroup;
class Group;
class Quest;
class Player;
class SpellInfo;
class WorldSession;
class CreatureGroup;
enum CreatureFlagsExtra
{
@@ -27,6 +27,7 @@
#include "DatabaseEnv.h"
class GameObjectAI;
class Group;
#define MAX_GAMEOBJECT_QUEST_ITEMS 6
+113 -86
View File
@@ -16,13 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Object.h"
#include "Common.h"
#include "SharedDefines.h"
#include "WorldPacket.h"
#include "Opcodes.h"
#include "Log.h"
#include "World.h"
#include "Object.h"
#include "Creature.h"
#include "Player.h"
#include "Vehicle.h"
@@ -200,8 +200,9 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
updateType = UPDATETYPE_CREATE_OBJECT2;
break;
case HIGHGUID_UNIT:
if (ToUnit()->ToTempSummon() && IS_PLAYER_GUID(ToUnit()->ToTempSummon()->GetSummonerGUID()))
updateType = UPDATETYPE_CREATE_OBJECT2;
if (TempSummon const* summon = ToUnit()->ToTempSummon())
if (IS_PLAYER_GUID(summon->GetSummonerGUID()))
updateType = UPDATETYPE_CREATE_OBJECT2;
break;
case HIGHGUID_GAMEOBJECT:
if (IS_PLAYER_GUID(ToGameObject()->GetOwnerGUID()))
@@ -214,7 +215,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
if (isType(TYPEMASK_GAMEOBJECT))
{
switch (((GameObject*)this)->GetGoType())
switch (ToGameObject()->GetGoType())
{
case GAMEOBJECT_TYPE_TRAP:
case GAMEOBJECT_TYPE_DUEL_ARBITER:
@@ -231,8 +232,10 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
}
}
if (ToUnit() && ToUnit()->getVictim())
flags |= UPDATEFLAG_HAS_TARGET;
if (Unit const* unit = ToUnit())
if (unit->getVictim())
flags |= UPDATEFLAG_HAS_TARGET;
ByteBuffer buf(500);
buf << uint8(updateType);
@@ -349,6 +352,17 @@ uint16 Object::GetUInt16Value(uint16 index, uint8 offset) const
void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
{
Unit const* self = NULL;
ObjectGuid guid = GetGUID();
uint32 movementFlags = 0;
uint16 movementFlagsExtra = 0;
bool hasFallDirection = false;
bool hasFallData = false;
bool hasPitch = false;
bool hasSpline = false;
bool hasSplineElevation = false;
uint32 unkLoopCounter = 0;
// Bit content
data->WriteBit(0);
@@ -369,10 +383,16 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
if (flags & UPDATEFLAG_LIVING)
{
Unit const* self = ToUnit();
ObjectGuid guid = GetGUID();
uint32 movementFlags = self->m_movementInfo.GetMovementFlags();
uint16 movementFlagsExtra = self->m_movementInfo.GetExtraMovementFlags();
self = ToUnit();
movementFlags = self->m_movementInfo.GetMovementFlags();
movementFlagsExtra = self->m_movementInfo.GetExtraMovementFlags();
hasPitch = ((movementFlags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) ||
(movementFlagsExtra & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING));
hasSpline = self->IsSplineEnabled();
hasSplineElevation = movementFlags & MOVEMENTFLAG_SPLINE_ELEVATION;
hasFallData = movementFlagsExtra & MOVEMENTFLAG2_INTERPOLATED_TURNING;
hasFallDirection = movementFlags & MOVEMENTFLAG_FALLING;
if (GetTypeId() == TYPEID_UNIT)
movementFlags &= MOVEMENTFLAG_MASK_CREATURE_ALLOWED;
@@ -385,14 +405,14 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
data->WriteBits(movementFlags, 30);
data->WriteBit(0);
data->WriteBit(!((movementFlags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) ||
(movementFlagsExtra & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))); // Has pitch
data->WriteBit(self->IsSplineEnabled()); // Has spline data
data->WriteBit(movementFlagsExtra & MOVEMENTFLAG2_INTERPOLATED_TURNING);// Has fall data
data->WriteBit(!(movementFlags & MOVEMENTFLAG_SPLINE_ELEVATION)); // Has spline elevation
data->WriteBit(!hasPitch); // Has pitch
data->WriteBit(hasSpline); // Has spline data
data->WriteBit(hasFallData); // Has fall data
data->WriteBit(!hasSplineElevation); // Has spline elevation
data->WriteBit(guid[5]);
data->WriteBit(self->m_movementInfo.t_guid); // Has transport data
data->WriteBit(0); // Is missing time
if (self->m_movementInfo.t_guid)
{
ObjectGuid transGuid = self->m_movementInfo.t_guid;
@@ -410,12 +430,13 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
}
data->WriteBit(guid[4]);
if (self->IsSplineEnabled())
if (hasSpline)
Movement::PacketBuilder::WriteCreateBits(*self->movespline, *data);
data->WriteBit(guid[6]);
if (movementFlagsExtra & MOVEMENTFLAG2_INTERPOLATED_TURNING)
data->WriteBit(movementFlags & MOVEMENTFLAG_FALLING);
if (hasFallData)
data->WriteBit(hasFallDirection);
data->WriteBit(guid[0]);
data->WriteBit(guid[1]);
@@ -443,7 +464,7 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
if (flags & UPDATEFLAG_HAS_TARGET)
{
ObjectGuid victimGuid = ToUnit()->getVictim()->GetGUID(); // checked in BuildCreateUpdateBlockForPlayer
ObjectGuid victimGuid = self->getVictim()->GetGUID(); // checked in BuildCreateUpdateBlockForPlayer
data->WriteBit(victimGuid[2]);
data->WriteBit(victimGuid[7]);
data->WriteBit(victimGuid[0]);
@@ -469,18 +490,12 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
if (flags & UPDATEFLAG_LIVING)
{
Unit const* self = ToUnit();
ObjectGuid guid = GetGUID();
uint32 movementFlags = self->m_movementInfo.GetMovementFlags();
uint16 movementFlagsExtra = self->m_movementInfo.GetExtraMovementFlags();
if (GetTypeId() == TYPEID_UNIT)
movementFlags &= MOVEMENTFLAG_MASK_CREATURE_ALLOWED;
data->WriteByteSeq(guid[4]);
*data << self->GetSpeed(MOVE_RUN_BACK);
if (movementFlagsExtra & MOVEMENTFLAG2_INTERPOLATED_TURNING)
if (hasFallData)
{
if (movementFlags & MOVEMENTFLAG_FALLING)
if (hasFallDirection)
{
*data << float(self->m_movementInfo.j_cosAngle);
*data << float(self->m_movementInfo.j_xyspeed);
@@ -492,14 +507,15 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
}
*data << self->GetSpeed(MOVE_SWIM_BACK);
if (movementFlags & MOVEMENTFLAG_SPLINE_ELEVATION)
if (hasSplineElevation)
*data << float(self->m_movementInfo.splineElevation);
if (self->IsSplineEnabled())
if (hasSpline)
Movement::PacketBuilder::WriteCreateData(*self->movespline, *data);
*data << float(self->GetPositionZMinusOffset());
data->WriteByteSeq(guid[5]);
if (self->m_movementInfo.t_guid)
{
ObjectGuid transGuid = self->m_movementInfo.t_guid;
@@ -547,8 +563,7 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
*data << float(self->GetOrientation());
*data << self->GetSpeed(MOVE_RUN);
if ((movementFlags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) ||
(movementFlagsExtra & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
if (hasPitch)
*data << float(self->m_movementInfo.pitch);
*data << self->GetSpeed(MOVE_FLIGHT);
@@ -556,7 +571,6 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
if (flags & UPDATEFLAG_VEHICLE)
{
Unit const* self = ToUnit();
*data << float(self->GetOrientation());
*data << uint32(self->GetVehicleKit()->GetVehicleInfo()->m_ID);
}
@@ -625,7 +639,7 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
if (flags & UPDATEFLAG_HAS_TARGET)
{
ObjectGuid victimGuid = ToUnit()->getVictim()->GetGUID(); // checked in BuildCreateUpdateBlockForPlayer
ObjectGuid victimGuid = self->getVictim()->GetGUID(); // checked in BuildCreateUpdateBlockForPlayer
data->WriteByteSeq(victimGuid[4]);
data->WriteByteSeq(victimGuid[0]);
data->WriteByteSeq(victimGuid[3]);
@@ -650,45 +664,50 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
*data << uint32(getMSTime()); // Unknown - getMSTime is wrong.
}
void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
void Object::_BuildValuesUpdate(uint8 updateType, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
{
if (!target)
return;
bool IsActivateToQuest = false;
if (updatetype == UPDATETYPE_CREATE_OBJECT || updatetype == UPDATETYPE_CREATE_OBJECT2)
{
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsDynTransport())
{
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
IsActivateToQuest = true;
if (((GameObject*)this)->GetGoArtKit())
updateMask->SetBit(GAMEOBJECT_BYTES_1);
}
else if (isType(TYPEMASK_UNIT))
{
if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
updateMask->SetBit(UNIT_FIELD_AURASTATE);
}
// Before trying to convert to each type there is a check, so safe
Unit const* unit = ToUnit();
GameObject const* go = ToGameObject();
if (unit)
{
if (unit->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
updateMask->SetBit(UNIT_FIELD_AURASTATE);
}
else // case UPDATETYPE_VALUES
else if (go)
{
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
if (updateType == UPDATETYPE_CREATE_OBJECT || updateType == UPDATETYPE_CREATE_OBJECT2)
{
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
IsActivateToQuest = true;
if (!go->IsDynTransport())
{
if (go->ActivateToQuest(target) || target->isGameMaster())
IsActivateToQuest = true;
updateMask->SetBit(GAMEOBJECT_BYTES_1);
if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST && ToGameObject()->GetGOInfo()->chest.groupLootRules &&
ToGameObject()->HasLootRecipient())
updateMask->SetBit(GAMEOBJECT_FLAGS);
if (go->GetGoArtKit())
updateMask->SetBit(GAMEOBJECT_BYTES_1);
}
}
else if (isType(TYPEMASK_UNIT))
else
{
if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
updateMask->SetBit(UNIT_FIELD_AURASTATE);
if (!go->IsTransport())
{
if (go->ActivateToQuest(target) || target->isGameMaster())
IsActivateToQuest = true;
updateMask->SetBit(GAMEOBJECT_BYTES_1);
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.groupLootRules &&
go->HasLootRecipient())
{
updateMask->SetBit(GAMEOBJECT_FLAGS);
}
}
}
}
@@ -696,14 +715,15 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
if (GetTypeId() == TYPEID_PLAYER && target != this)
valCount = PLAYER_END_NOT_SELF;
WPAssert(updateMask && updateMask->GetCount() == valCount);
ASSERT(updateMask && updateMask->GetCount() == valCount);
*data << (uint8)updateMask->GetBlockCount();
*data << uint8(updateMask->GetBlockCount());
updateMask->AppendToPacket(data);
// 2 specialized loops for speed optimization in non-unit case
if (isType(TYPEMASK_UNIT)) // unit (creature/player) case
if (unit) // unit (creature/player) case
{
Creature const* creature = ToCreature();
for (uint16 index = 0; index < valCount; ++index)
{
if (updateMask->GetBit(index))
@@ -720,7 +740,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
if (appendValue & UNIT_NPC_FLAG_TRAINER)
{
if (!this->ToCreature()->isCanTrainingOf(target, false))
if (!creature->isCanTrainingOf(target, false))
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
}
}
@@ -729,8 +749,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
}
else if (index == UNIT_FIELD_AURASTATE)
{
// Check per caster aura states to not enable using a pell in client if specified aura is not by target
*data << ((Unit*)this)->BuildAuraStateUpdateForTarget(target);
// Check per caster aura states to not enable using a spell in client if specified aura is not by target
*data << unit->BuildAuraStateUpdateForTarget(target);
}
// FIXME: Some values at server stored in float format but must be sent to client in uint32 format
else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
@@ -759,7 +779,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
{
if (GetTypeId() == TYPEID_UNIT)
{
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
// this also applies for transform auras
if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(ToUnit()->getTransForm()))
@@ -799,7 +819,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
{
uint32 dynamicFlags = m_uint32Values[index];
if (Creature const* creature = ToCreature())
if (creature)
{
if (creature->hasLootRecipient())
{
@@ -824,16 +844,14 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
}
// unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
if (Unit const* unit = ToUnit())
if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID()))
dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID()))
dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
*data << dynamicFlags;
}
// FG: pretend that OTHER players in own group are friendly ("blue")
else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
{
Unit const* unit = ToUnit();
if (unit->IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && unit->IsInRaidWith(target))
{
FactionTemplateEntry const* ft1 = unit->getFactionTemplateEntry();
@@ -866,7 +884,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
}
}
}
else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case
else if (go) // gameobject case
{
for (uint16 index = 0; index < valCount; ++index)
{
@@ -877,7 +895,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
{
if (IsActivateToQuest)
{
switch (ToGameObject()->GetGoType())
switch (go->GetGoType())
{
case GAMEOBJECT_TYPE_CHEST:
if (target->isGameMaster())
@@ -910,8 +928,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask*
else if (index == GAMEOBJECT_FLAGS)
{
uint32 flags = m_uint32Values[index];
if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST)
if (ToGameObject()->GetGOInfo()->chest.groupLootRules && !ToGameObject()->IsLootAllowedFor(target))
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
if (go->GetGOInfo()->chest.groupLootRules && !go->IsLootAllowedFor(target))
flags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
*data << flags;
@@ -1444,6 +1462,14 @@ bool Object::PrintIndexError(uint32 index, bool set) const
return false;
}
bool Position::operator==(Position const &a)
{
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
G3D::fuzzyEq(a.m_positionY, m_positionY) &&
G3D::fuzzyEq(a.m_positionZ, m_positionZ) &&
G3D::fuzzyEq(a.m_orientation, m_orientation));
}
bool Position::HasInLine(WorldObject const* target, float width) const
{
if (!HasInArc(M_PI, target))
@@ -2187,7 +2213,7 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const
const WorldObject* seer = this;
// Pets don't have detection, they use the detection of their masters
if (const Unit* thisUnit = ToUnit())
if (Unit const* thisUnit = ToUnit())
if (Unit* controller = thisUnit->GetCharmerOrOwner())
seer = controller;
@@ -2239,8 +2265,9 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
float distance = GetExactDist(obj);
float combatReach = 0.0f;
if (isType(TYPEMASK_UNIT))
combatReach = ((Unit*)this)->GetCombatReach();
Unit const* unit = ToUnit();
if (unit)
combatReach = unit->GetCombatReach();
if (distance < combatReach)
return true;
@@ -2248,14 +2275,14 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
if (!HasInArc(M_PI, obj))
return false;
GameObject const* go = ToGameObject();
for (uint32 i = 0; i < TOTAL_STEALTH_TYPES; ++i)
{
if (!(obj->m_stealth.GetFlags() & (1 << i)))
continue;
if (isType(TYPEMASK_UNIT))
if (((Unit*)this)->HasAuraTypeWithMiscvalue(SPELL_AURA_DETECT_STEALTH, i))
return true;
if (unit && unit->HasAuraTypeWithMiscvalue(SPELL_AURA_DETECT_STEALTH, i))
return true;
// Starting points
int32 detectionValue = 30;
@@ -2267,8 +2294,8 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
// Apply modifiers
detectionValue += m_stealthDetect.GetValue(StealthType(i));
if (obj->isType(TYPEMASK_GAMEOBJECT))
if (Unit* owner = ((GameObject*)obj)->GetOwner())
if (go)
if (Unit* owner = go->GetOwner())
detectionValue -= int32(owner->getLevelForTarget(this) - 1) * 5;
detectionValue -= obj->m_stealth.GetValue(StealthType(i));
+55 -58
View File
@@ -21,10 +21,8 @@
#include "Common.h"
#include "UpdateMask.h"
#include "UpdateData.h"
#include "GridReference.h"
#include "ObjectDefines.h"
#include "GridDefines.h"
#include "Map.h"
#include <set>
@@ -101,20 +99,20 @@ enum NotifyFlags
NOTIFY_ALL = 0xFF
};
class WorldPacket;
class UpdateData;
class ByteBuffer;
class WorldSession;
class Corpse;
class Creature;
class Player;
class InstanceScript;
class GameObject;
class TempSummon;
class Vehicle;
class CreatureAI;
class ZoneScript;
class Unit;
class DynamicObject;
class GameObject;
class InstanceScript;
class Player;
class TempSummon;
class Transport;
class Unit;
class UpdateData;
class WorldObject;
class WorldPacket;
class ZoneScript;
typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
@@ -351,17 +349,24 @@ struct Position
float m_orientation;
//public:
bool operator==(Position const &a);
inline bool operator!=(Position const &a)
{
return !(operator==(a));
}
void Relocate(float x, float y)
{ m_positionX = x; m_positionY = y;}
void Relocate(float x, float y, float z)
{ m_positionX = x; m_positionY = y; m_positionZ = z; }
void Relocate(float x, float y, float z, float orientation)
{ m_positionX = x; m_positionY = y; m_positionZ = z; SetOrientation(orientation); }
void Relocate(const Position &pos)
void Relocate(Position const &pos)
{ m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; SetOrientation(pos.m_orientation); }
void Relocate(const Position* pos)
void Relocate(Position const* pos)
{ m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; SetOrientation(pos->m_orientation); }
void RelocateOffset(const Position &offset);
void RelocateOffset(Position const &offset);
void SetOrientation(float orientation)
{ m_orientation = NormalizeOrientation(orientation); }
@@ -397,37 +402,37 @@ struct Position
{ float dx = m_positionX - x; float dy = m_positionY - y; return dx*dx + dy*dy; }
float GetExactDist2d(const float x, const float y) const
{ return sqrt(GetExactDist2dSq(x, y)); }
float GetExactDist2dSq(const Position* pos) const
float GetExactDist2dSq(Position const* pos) const
{ float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; return dx*dx + dy*dy; }
float GetExactDist2d(const Position* pos) const
float GetExactDist2d(Position const* pos) const
{ return sqrt(GetExactDist2dSq(pos)); }
float GetExactDistSq(float x, float y, float z) const
{ float dz = m_positionZ - z; return GetExactDist2dSq(x, y) + dz*dz; }
float GetExactDist(float x, float y, float z) const
{ return sqrt(GetExactDistSq(x, y, z)); }
float GetExactDistSq(const Position* pos) const
float GetExactDistSq(Position const* pos) const
{ float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; float dz = m_positionZ - pos->m_positionZ; return dx*dx + dy*dy + dz*dz; }
float GetExactDist(const Position* pos) const
float GetExactDist(Position const* pos) const
{ return sqrt(GetExactDistSq(pos)); }
void GetPositionOffsetTo(const Position & endPos, Position & retOffset) const;
void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const;
float GetAngle(const Position* pos) const;
float GetAngle(Position const* pos) const;
float GetAngle(float x, float y) const;
float GetRelativeAngle(const Position* pos) const
float GetRelativeAngle(Position const* pos) const
{ return GetAngle(pos) - m_orientation; }
float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
void GetSinCos(float x, float y, float &vsin, float &vcos) const;
bool IsInDist2d(float x, float y, float dist) const
{ return GetExactDist2dSq(x, y) < dist * dist; }
bool IsInDist2d(const Position* pos, float dist) const
bool IsInDist2d(Position const* pos, float dist) const
{ return GetExactDist2dSq(pos) < dist * dist; }
bool IsInDist(float x, float y, float z, float dist) const
{ return GetExactDistSq(x, y, z) < dist * dist; }
bool IsInDist(const Position* pos, float dist) const
bool IsInDist(Position const* pos, float dist) const
{ return GetExactDistSq(pos) < dist * dist; }
bool HasInArc(float arcangle, const Position* pos, float border = 2.0f) const;
bool HasInArc(float arcangle, Position const* pos, float border = 2.0f) const;
bool HasInLine(WorldObject const* target, float width) const;
std::string ToString() const;
@@ -471,23 +476,15 @@ struct MovementInfo
// falling
uint32 fallTime;
// jumping
float j_zspeed, j_cosAngle, j_sinAngle, j_xyspeed;
float j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed;
// spline
float splineElevation;
MovementInfo()
{
pos.Relocate(0, 0, 0, 0);
guid = 0;
flags = 0;
flags2 = 0;
time = t_time = t_time2 = t_time3 = fallTime = 0;
splineElevation = 0;
pitch = j_zspeed = j_sinAngle = j_cosAngle = j_xyspeed = 0.0f;
t_guid = 0;
t_pos.Relocate(0, 0, 0, 0);
t_seat = -1;
}
MovementInfo() :
guid(), flags(), flags2(), pos(), time(), t_guid(), t_pos(),
t_seat(-1), t_time(), t_time2(), pitch(), fallTime(),
j_zspeed(), j_sinAngle(), j_cosAngle(), j_xyspeed()
{ }
uint32 GetMovementFlags() const { return flags; }
void SetMovementFlags(uint32 flag) { flags = flag; }
@@ -575,14 +572,14 @@ class WorldObject : public Object, public WorldLocation
void MovePositionToFirstCollision(Position &pos, float dist, float angle);
void GetFirstCollisionPosition(Position &pos, float dist, float angle);
void GetRandomNearPosition(Position &pos, float radius);
void GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const;
void GetContactPoint(WorldObject const* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const;
float GetObjectSize() const;
void UpdateGroundPositionZ(float x, float y, float &z) const;
void UpdateAllowedPositionZ(float x, float y, float &z) const;
void GetRandomPoint(const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const;
void GetRandomPoint(const Position &srcPos, float distance, Position &pos) const;
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const;
void GetRandomPoint(Position const &srcPos, float distance, Position &pos) const;
uint32 GetInstanceId() const { return m_InstanceId; }
@@ -602,24 +599,24 @@ class WorldObject : public Object, public WorldLocation
virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
float GetDistance(const WorldObject* obj) const;
float GetDistance(const Position &pos) const;
float GetDistance(WorldObject const* obj) const;
float GetDistance(Position const &pos) const;
float GetDistance(float x, float y, float z) const;
float GetDistance2d(const WorldObject* obj) const;
float GetDistance2d(WorldObject const* obj) const;
float GetDistance2d(float x, float y) const;
float GetDistanceZ(const WorldObject* obj) const;
float GetDistanceZ(WorldObject const* obj) const;
bool IsSelfOrInSameMap(const WorldObject* obj) const;
bool IsInMap(const WorldObject* obj) const;
bool IsSelfOrInSameMap(WorldObject const* obj) const;
bool IsInMap(WorldObject const* obj) const;
bool IsWithinDist3d(float x, float y, float z, float dist) const;
bool IsWithinDist3d(const Position* pos, float dist) const;
bool IsWithinDist3d(Position const* pos, float dist) const;
bool IsWithinDist2d(float x, float y, float dist) const;
bool IsWithinDist2d(const Position* pos, float dist) const;
bool IsWithinDist2d(Position const* pos, float dist) const;
// use only if you will sure about placing both object at same map
bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const;
bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const;
bool IsWithinLOS(float x, float y, float z) const;
bool IsWithinLOSInMap(const WorldObject* obj) const;
bool IsWithinLOSInMap(WorldObject const* obj) const;
bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) const;
bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
@@ -627,7 +624,7 @@ class WorldObject : public Object, public WorldLocation
bool isInFront(WorldObject const* target, float arc = M_PI) const;
bool isInBack(WorldObject const* target, float arc = M_PI) const;
bool IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size = 0) const;
bool IsInBetween(WorldObject const* obj1, WorldObject const* obj2, float size = 0) const;
virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
@@ -658,7 +655,7 @@ class WorldObject : public Object, public WorldLocation
float GetGridActivationRange() const;
float GetVisibilityRange() const;
float GetSightRange(const WorldObject* target = NULL) const;
float GetSightRange(WorldObject const* target = NULL) const;
bool canSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const;
FlaggedValuesArray32<int32, uint32, StealthType, TOTAL_STEALTH_TYPES> m_stealth;
@@ -685,7 +682,7 @@ class WorldObject : public Object, public WorldLocation
void SetZoneScript();
ZoneScript* GetZoneScript() const { return m_zoneScript; }
TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const;
TempSummon* SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const;
TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0) const;
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime);
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
@@ -787,13 +784,13 @@ namespace Trinity
class ObjectDistanceOrderPred
{
public:
ObjectDistanceOrderPred(const WorldObject* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {}
bool operator()(const WorldObject* pLeft, const WorldObject* pRight) const
ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {}
bool operator()(WorldObject const* pLeft, WorldObject const* pRight) const
{
return m_ascending ? m_refObj->GetDistanceOrder(pLeft, pRight) : !m_refObj->GetDistanceOrder(pLeft, pRight);
}
private:
const WorldObject* m_refObj;
WorldObject const* m_refObj;
const bool m_ascending;
};
}
@@ -20,6 +20,8 @@
#define __UPDATEDATA_H
#include "ByteBuffer.h"
#include <set>
class WorldPacket;
enum OBJECT_UPDATE_TYPE
+34 -26
View File
@@ -35,9 +35,10 @@
#define PET_XP_FACTOR 0.05f
Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner, true),
m_usedTalentCount(0), m_removed(false), m_petType(type), m_duration(0),
m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL)
Pet::Pet(Player* owner, PetType type) :
Guardian(NULL, owner, true), m_usedTalentCount(0), m_removed(false),
m_petType(type), m_duration(0), m_auraRaidUpdateMask(0), m_loading(false),
m_declinedname(NULL)
{
ASSERT(m_owner->GetTypeId() == TYPEID_PLAYER);
@@ -554,7 +555,7 @@ void Pet::Update(uint32 diff)
{
if (owner->GetPetGUID() != GetGUID())
{
sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName().c_str());
sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), GetOwner()->GetName().c_str());
Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
return;
}
@@ -788,19 +789,24 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
//Determine pet type
PetType petType = MAX_PET_TYPE;
if (isPet() && m_owner->GetTypeId() == TYPEID_PLAYER)
if (isPet() && GetOwner()->GetTypeId() == TYPEID_PLAYER)
{
if ((m_owner->getClass() == CLASS_WARLOCK)
|| (m_owner->getClass() == CLASS_SHAMAN) // Fire Elemental
|| (m_owner->getClass() == CLASS_DEATH_KNIGHT)) // Risen Ghoul
if (GetOwner()->getClass() == CLASS_WARLOCK
|| GetOwner()->getClass() == CLASS_SHAMAN // Fire Elemental
|| GetOwner()->getClass() == CLASS_DEATH_KNIGHT) // Risen Ghoul
{
petType = SUMMON_PET;
else if (m_owner->getClass() == CLASS_HUNTER)
}
else if (GetOwner()->getClass() == CLASS_HUNTER)
{
petType = HUNTER_PET;
m_unitTypeMask |= UNIT_MASK_HUNTER_PET;
}
else
sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass());
{
sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u",
GetEntry(), GetOwner()->getClass());
}
}
uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry;
@@ -868,12 +874,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
{
case SUMMON_PET:
{
//the damage bonus used for pets is either fire or shadow damage, whatever is higher
uint32 fire = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
uint32 shadow = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
uint32 val = (fire > shadow) ? fire : shadow;
SetBonusDamage(int32 (val * 0.15f));
//bonusAP += val * 0.57;
// the damage bonus used for pets is either fire or shadow damage, whatever is higher
int32 fire = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
int32 shadow = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
int32 val = (fire > shadow) ? fire : shadow;
if (val < 0)
val = 0;
SetBonusDamage(val * 0.15f);
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
@@ -898,14 +906,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
{
case 510: // mage Water Elemental
{
SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f));
SetBonusDamage(int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f));
break;
}
case 1964: //force of nature
{
if (!pInfo)
SetCreateHealth(30 + 30*petlevel);
float bonusDmg = m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f;
float bonusDmg = GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f;
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - (petlevel / 2) + bonusDmg));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + (petlevel / 2) + bonusDmg));
break;
@@ -925,7 +933,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetCreateHealth(40*petlevel);
SetCreateMana(28 + 10*petlevel);
}
SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f));
SetBonusDamage(int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f));
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel));
break;
@@ -937,7 +945,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetCreateMana(28 + 10*petlevel);
SetCreateHealth(28 + 30*petlevel);
}
int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f));
int32 bonus_dmg = int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f);
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel) + bonus_dmg));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel) + bonus_dmg));
@@ -966,16 +974,16 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel)));
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(m_owner->GetArmor()) * 0.35f); // Bonus Armor (35% of player armor)
SetModifierValue(UNIT_MOD_STAT_STAMINA, BASE_VALUE, float(m_owner->GetStat(STAT_STAMINA)) * 0.3f); // Bonus Stamina (30% of player stamina)
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(GetOwner()->GetArmor()) * 0.35f); // Bonus Armor (35% of player armor)
SetModifierValue(UNIT_MOD_STAT_STAMINA, BASE_VALUE, float(GetOwner()->GetStat(STAT_STAMINA)) * 0.3f); // Bonus Stamina (30% of player stamina)
if (!HasAura(58877))//prevent apply twice for the 2 wolves
AddAura(58877, this);//Spirit Hunt, passive, Spirit Wolves' attacks heal them and their master for 150% of damage done.
break;
}
case 31216: // Mirror Image
{
SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f));
SetDisplayId(m_owner->GetDisplayId());
SetBonusDamage(int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f));
SetDisplayId(GetOwner()->GetDisplayId());
if (!pInfo)
{
SetCreateMana(28 + 30*petlevel);
@@ -990,7 +998,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetCreateMana(28 + 10*petlevel);
SetCreateHealth(28 + 30*petlevel);
}
SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f));
SetBonusDamage(int32(GetOwner()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f));
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
break;
@@ -998,7 +1006,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
case 28017: // Bloodworms
{
SetCreateHealth(4 * petlevel);
SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f));
SetBonusDamage(int32(GetOwner()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f));
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4)));
}
+5 -11
View File
@@ -11904,14 +11904,8 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje
return EQUIP_ERR_OK;
}
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId)
{
AllowedLooterSet allowedLooters;
return StoreNewItem(dest, item, update, randomPropertyId, allowedLooters);
}
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters)
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet const& allowedLooters)
{
uint32 count = 0;
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
@@ -12028,7 +12022,6 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
const ItemTemplate* proto = pItem->GetTemplate();
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
@@ -16197,15 +16190,16 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
{
uint16 addkillcount = 1;
uint32 real_entry = entry;
Creature* killed = NULL;
if (guid)
{
Creature* killed = GetMap()->GetCreature(guid);
killed = GetMap()->GetCreature(guid);
if (killed && killed->GetEntry())
real_entry = killed->GetEntry();
}
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, 0, guid ? GetMap()->GetCreature(guid) : NULL);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, 0, killed);
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
@@ -26575,7 +26569,7 @@ void Player::RefundItem(Item* item)
{
ItemPosCountVec dest;
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count);
ASSERT(msg == EQUIP_ERR_OK) /// Already checked before
ASSERT(msg == EQUIP_ERR_OK); /// Already checked before
Item* it = StoreNewItem(dest, itemid, true);
SendNewItem(it, count, true, false, true);
}
+2 -2
View File
@@ -1384,8 +1384,7 @@ class Player : public Unit, public GridObject<Player>
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
InventoryResult CanUseAmmo(uint32 item) const;
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters);
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, AllowedLooterSet const& allowedLooters = AllowedLooterSet());
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
Item* EquipNewItem(uint16 pos, uint32 item, bool update);
Item* EquipItem(uint16 pos, Item* pItem, bool update);
@@ -2915,4 +2914,5 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
basevalue = T((float)basevalue + diff);
return T(diff);
}
#endif
@@ -28,15 +28,8 @@
#include "AccountMgr.h"
#include "WorldSession.h"
PlayerSocial::PlayerSocial()
{
m_playerGUID = 0;
}
PlayerSocial::~PlayerSocial()
{
m_playerSocialMap.clear();
}
PlayerSocial::PlayerSocial(): m_playerGUID()
{ }
uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag)
{
@@ -104,7 +104,6 @@ class PlayerSocial
friend class SocialMgr;
public:
PlayerSocial();
~PlayerSocial();
// adding/removing
bool AddToSocialList(uint32 friend_guid, bool ignore);
void RemoveFromSocialList(uint32 friend_guid, bool ignore);
+1 -1
View File
@@ -9000,7 +9000,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
AddPct(DoneTotalMod, GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC, spellProto->Mechanic));
// done scripted mod (take it from owner)
Unit const * const owner = GetOwner() ? GetOwner() : this;
Unit const* owner = GetOwner() ? GetOwner() : this;
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
+32 -10
View File
@@ -19,6 +19,7 @@
#ifndef __UNIT_H
#define __UNIT_H
#include "DBCStructure.h"
#include "EventProcessor.h"
#include "FollowerReference.h"
#include "FollowerRefManager.h"
@@ -126,14 +127,32 @@ enum SpellValueMod
SPELLVALUE_AURA_STACK
};
typedef std::pair<SpellValueMod, int32> CustomSpellValueMod;
class CustomSpellValues : public std::vector<CustomSpellValueMod>
class CustomSpellValues
{
public:
void AddSpellMod(SpellValueMod mod, int32 value)
{
push_back(std::make_pair(mod, value));
}
typedef std::pair<SpellValueMod, int32> CustomSpellValueMod;
typedef std::vector<CustomSpellValueMod> StorageType;
public:
typedef StorageType::const_iterator const_iterator;
public:
void AddSpellMod(SpellValueMod mod, int32 value)
{
storage_.push_back(CustomSpellValueMod(mod, value));
}
const_iterator begin() const
{
return storage_.begin();
}
const_iterator end() const
{
return storage_.end();
}
private:
StorageType storage_;
};
enum SpellFacingFlags
@@ -1424,10 +1443,13 @@ class Unit : public WorldObject
void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL);
void ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = NULL);
void GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTriggeringProc, std::list<AuraApplication*>* procAuras, ProcEventInfo eventInfo);
void GetProcAurasTriggeredOnEvent(AuraApplicationList& aurasTriggeringProc, AuraApplicationList* procAuras, ProcEventInfo eventInfo);
void TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo);
void TriggerAurasProcOnEvent(std::list<AuraApplication*>* myProcAuras, std::list<AuraApplication*>* targetProcAuras, Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo);
void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, std::list<AuraApplication*>& procAuras);
void TriggerAurasProcOnEvent(AuraApplicationList* myProcAuras, AuraApplicationList* targetProcAuras,
Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget,
uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell,
DamageInfo* damageInfo, HealInfo* healInfo);
void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationList& procAuras);
void HandleEmoteCommand(uint32 anim_id);
void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false);
+2 -2
View File
@@ -205,7 +205,7 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7
// 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event");
if (!result)
{
@@ -792,7 +792,7 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
// 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost, type FROM game_event_npc_vendor ORDER BY guid, slot ASC");
if (!result)
@@ -47,6 +47,35 @@ ObjectAccessor::~ObjectAccessor()
{
}
template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/)
{
T* obj = HashMapHolder<T>::Find(guid);
if (!obj || obj->GetMapId() != mapid)
return NULL;
CellCoord p = Trinity::ComputeCellCoord(x, y);
if (!p.IsCoordValid())
{
sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
return NULL;
}
CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!q.IsCoordValid())
{
sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
}
int32 dx = int32(p.x_coord) - int32(q.x_coord);
int32 dy = int32(p.y_coord) - int32(q.y_coord);
if (dx > -2 && dx < 2 && dy > -2 && dy < 2)
return obj;
else
return NULL;
}
Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/)
{
Player* player = HashMapHolder<Player>::Find(guid);
+1 -28
View File
@@ -138,34 +138,7 @@ class ObjectAccessor
return NULL;
}
template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/)
{
T* obj = HashMapHolder<T>::Find(guid);
if (!obj || obj->GetMapId() != mapid)
return NULL;
CellCoord p = Trinity::ComputeCellCoord(x, y);
if (!p.IsCoordValid())
{
sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
return NULL;
}
CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!q.IsCoordValid())
{
sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
}
int32 dx = int32(p.x_coord) - int32(q.x_coord);
int32 dy = int32(p.y_coord) - int32(q.y_coord);
if (dx > -2 && dx < 2 && dy > -2 && dy < 2)
return obj;
else
return NULL;
}
template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/);
// these functions return objects only if in map of specified object
static WorldObject* GetWorldObject(WorldObject const&, uint64);
+2 -4
View File
@@ -85,13 +85,11 @@ template<uint32 LIMIT>
struct CoordPair
{
CoordPair(uint32 x=0, uint32 y=0)
: x_coord(x)
, y_coord(y)
: x_coord(x), y_coord(y)
{}
CoordPair(const CoordPair<LIMIT> &obj)
: x_coord(obj.x_coord)
, y_coord(obj.y_coord)
: x_coord(obj.x_coord), y_coord(obj.y_coord)
{}
CoordPair<LIMIT> & operator=(const CoordPair<LIMIT> &obj)
+4 -9
View File
@@ -78,15 +78,10 @@ class NGrid
{
public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> GridType;
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true)
: i_gridId(id)
, i_GridInfo(GridInfo(expiry, unload))
, i_x(x)
, i_y(y)
, i_cellstate(GRID_STATE_INVALID)
, i_GridObjectDataLoaded(false)
{
}
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true) :
i_gridId(id), i_GridInfo(GridInfo(expiry, unload)), i_x(x), i_y(y),
i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false)
{ }
GridType& GetGridType(const uint32 x, const uint32 y)
{
+4 -6
View File
@@ -1369,8 +1369,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
AllowedLooterSet looters = item->GetAllowedLooters();
player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters);
player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters());
}
else
{
@@ -1422,8 +1421,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
AllowedLooterSet looters = item->GetAllowedLooters();
player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters);
player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters());
}
else
{
@@ -2174,7 +2172,7 @@ void Group::SetLfgRoles(uint64 guid, const uint8 roles)
return;
slot->roles = roles;
SendUpdate();
SendUpdate();
}
bool Group::IsFull() const
@@ -2222,7 +2220,7 @@ uint32 Group::GetLowGUID() const
return GUID_LOPART(m_guid);
}
const char * Group::GetLeaderName() const
char const* Group::GetLeaderName() const
{
return m_leaderName.c_str();
}
@@ -51,14 +51,13 @@ InstanceSaveManager::~InstanceSaveManager()
++next;
(*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
}
save->m_playerList.clear();
for (InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next)
{
++next;
(*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
}
save->m_groupList.clear();
delete save;
}
}
+2 -6
View File
@@ -1230,15 +1230,11 @@ void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, Lo
LootTemplate::~LootTemplate()
{
while (!Entries.empty())
{
delete Entries.back();
Entries.pop_back();
}
for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i)
delete *i;
for (size_t i = 0; i < Groups.size(); ++i)
delete Groups[i];
Groups.clear();
}
// Adds an entry to the group (at loading stage)
-2
View File
@@ -29,8 +29,6 @@
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL)
{
// initialize instanced maps list
m_InstancedMaps.clear();
// fill with zero
memset(&GridMapReference, 0, MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_GRIDS*sizeof(uint16));
}
+10 -3
View File
@@ -23,7 +23,6 @@
#include "SpellInfo.h"
#include "Unit.h"
class Unit;
class SpellInfo;
struct SpellModifier;
struct ProcTriggerSpell;
@@ -153,7 +152,15 @@ class Aura
bool IsArea() const;
bool IsPassive() const;
bool IsDeathPersistent() const;
bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
bool IsRemovedOnShapeLost(Unit* target) const
{
return GetCasterGUID() == target->GetGUID()
&& m_spellInfo->Stances
&& !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT)
&& !(m_spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT);
}
bool CanBeSaved() const;
bool IsRemoved() const { return m_isRemoved; }
bool CanBeSentToClient() const;
@@ -175,7 +182,7 @@ class Aura
// Helpers for targets
ApplicationMap const & GetApplicationMap() {return m_applications;}
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
void GetApplicationList(Unit::AuraApplicationList& applicationList) const;
const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); }
+2 -2
View File
@@ -460,7 +460,7 @@ class Spell
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsNextMeleeSwingSpell() const;
bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; };
bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; }
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
bool IsAutoActionResetSpell() const;
@@ -495,7 +495,7 @@ class Spell
Unit* const m_caster;
SpellValue * const m_spellValue;
SpellValue* const m_spellValue;
uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
// e.g. damage around area spell trigered by victim aura and damage enemies of aura caster
@@ -19,7 +19,6 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "MapManager.h"
#include "MoveSplineInit.h"
#include "Player.h"
#include "icecrown_citadel.h"
@@ -672,7 +672,7 @@ public:
if (Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000))
{
Cyclone->ToCreature()->SetObjectScale(3.0f);
Cyclone->SetObjectScale(3.0f);
Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Cyclone->setFaction(me->getFaction());
Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true);
@@ -164,24 +164,24 @@ class boss_warchief_kargath_bladefist : public CreatureScript
{
for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr)
{
Unit* temp = Unit::GetUnit(*me, *itr);
if (temp && temp->isAlive())
Creature* creature = Unit::GetCreature(*me, *itr);
if (creature && creature->isAlive())
{
temp->GetMotionMaster()->Clear(true);
me->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
temp->ToCreature()->RemoveCorpse();
creature->GetMotionMaster()->Clear(true);
me->DealDamage(creature, creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
creature->RemoveCorpse();
}
}
adds.clear();
for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr)
{
Unit* temp = Unit::GetUnit(*me, *itr);
if (temp && temp->isAlive())
Creature* creature = Unit::GetCreature(*me, *itr);
if (creature && creature->isAlive())
{
temp->GetMotionMaster()->Clear(true);
me->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
temp->ToCreature()->RemoveCorpse();
creature->GetMotionMaster()->Clear(true);
me->DealDamage(creature, creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
creature->RemoveCorpse();
}
}
assassins.clear();
@@ -474,16 +474,16 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(1194);
if (Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
{
Creepjack->ToCreature()->AI()->EnterEvadeMode();
Creepjack->AI()->EnterEvadeMode();
Creepjack->setFaction(1194);
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
if (Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20))
if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20))
{
Malone->ToCreature()->AI()->EnterEvadeMode();
Malone->AI()->EnterEvadeMode();
Malone->setFaction(1194);
Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
@@ -521,31 +521,31 @@ public:
{
if (Event)
SayTimer = NextStep(++Step);
} else SayTimer -= diff;
}
else
SayTimer -= diff;
if (Attack)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
me->setFaction(14);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (player)
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
{
Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
if (Creepjack)
{
Creepjack->Attack(player, true);
Creepjack->setFaction(14);
Creepjack->GetMotionMaster()->MoveChase(player);
Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
if (Malone)
{
Malone->Attack(player, true);
Malone->setFaction(14);
Malone->GetMotionMaster()->MoveChase(player);
Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
{
Creepjack->Attack(player, true);
Creepjack->setFaction(14);
Creepjack->GetMotionMaster()->MoveChase(player);
Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20))
{
Malone->Attack(player, true);
Malone->setFaction(14);
Malone->GetMotionMaster()->MoveChase(player);
Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
DoStartMovement(player);
AttackStart(player);
}
@@ -557,17 +557,17 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveAllAuras();
if (Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
{
Creepjack->ToCreature()->AI()->EnterEvadeMode();
Creepjack->AI()->EnterEvadeMode();
Creepjack->setFaction(1194);
Creepjack->GetMotionMaster()->MoveTargetedHome();
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
if (Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20))
if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20))
{
Malone->ToCreature()->AI()->EnterEvadeMode();
Malone->AI()->EnterEvadeMode();
Malone->setFaction(1194);
Malone->GetMotionMaster()->MoveTargetedHome();
Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+2 -1
View File
@@ -813,6 +813,7 @@ class spell_item_scroll_of_recall : public SpellScriptLoader
enum ShadowsFate
{
SPELL_SOUL_FEAST = 71203,
NPC_SINDRAGOSA = 36853
};
class spell_item_unsated_craving : public SpellScriptLoader
@@ -831,7 +832,7 @@ class spell_item_unsated_craving : public SpellScriptLoader
return false;
Unit* target = procInfo.GetActionTarget();
if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || target->isSummon())
if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || (target->GetEntry() != NPC_SINDRAGOSA && target->isSummon()))
return false;
return true;
+2 -1
View File
@@ -16,6 +16,7 @@ file(GLOB_RECURSE sources_Configuration Configuration/*.cpp Configuration/*.h)
file(GLOB_RECURSE sources_Cryptography Cryptography/*.cpp Cryptography/*.h)
file(GLOB_RECURSE sources_Database Database/*.cpp Database/*.h)
file(GLOB_RECURSE sources_DataStores DataStores/*.cpp DataStores/*.h)
file(GLOB_RECURSE sources_Debugging Debugging/*.cpp Debugging/*.h)
file(GLOB_RECURSE sources_Dynamic Dynamic/*.cpp Dynamic/*.h)
file(GLOB_RECURSE sources_Logging Logging/*.cpp Logging/*.h)
file(GLOB_RECURSE sources_Packets Packets/*.cpp Packets/*.h)
@@ -39,13 +40,13 @@ set(shared_STAT_SRCS
${sources_Cryptography}
${sources_Database}
${sources_DataStores}
${sources_Debugging}
${sources_Dynamic}
${sources_Logging}
${sources_Packets}
${sources_Threading}
${sources_Utilities}
${sources_localdir}
Debugging/Errors.h
)
include_directories(
+1
View File
@@ -18,6 +18,7 @@
#ifndef TRINITY_CONTAINERS_H
#define TRINITY_CONTAINERS_H
#include "Define.h"
#include <list>
//! Because circular includes are bad
@@ -20,15 +20,10 @@
#include "Cryptography/HMACSHA1.h"
#include "Cryptography/BigNumber.h"
AuthCrypt::AuthCrypt() : _clientDecrypt(SHA_DIGEST_LENGTH), _serverEncrypt(SHA_DIGEST_LENGTH)
, _initialized(false)
{
}
AuthCrypt::~AuthCrypt()
{
}
AuthCrypt::AuthCrypt() :
_clientDecrypt(SHA_DIGEST_LENGTH), _serverEncrypt(SHA_DIGEST_LENGTH),
_initialized(false)
{ }
void AuthCrypt::Init(BigNumber* K)
{
@@ -27,7 +27,6 @@ class AuthCrypt
{
public:
AuthCrypt();
~AuthCrypt();
void Init(BigNumber* K);
void DecryptRecv(uint8 *, size_t);
+3 -6
View File
@@ -24,18 +24,15 @@
#include <algorithm>
BigNumber::BigNumber()
: _bn(BN_new())
, _array(NULL)
: _bn(BN_new()), _array(NULL)
{ }
BigNumber::BigNumber(BigNumber const& bn)
: _bn(BN_dup(bn._bn))
, _array(NULL)
: _bn(BN_dup(bn._bn)), _array(NULL)
{ }
BigNumber::BigNumber(uint32 val)
: _bn(BN_new())
, _array(NULL)
: _bn(BN_new()), _array(NULL)
{
BN_set_word(_bn, val);
}
+1 -1
View File
@@ -40,7 +40,7 @@ void HmacHash::Finalize()
{
uint32 length = 0;
HMAC_Final(&m_ctx, (uint8*)m_digest, &length);
ASSERT(length == SHA_DIGEST_LENGTH)
ASSERT(length == SHA_DIGEST_LENGTH);
}
uint8 *HmacHash::ComputeHash(BigNumber* bn)
+2 -1
View File
@@ -19,6 +19,7 @@
#define DB2STORE_H
#include "DB2FileLoader.h"
#include "Common.h"
#include "ByteBuffer.h"
#include <vector>
@@ -229,4 +230,4 @@ private:
StringPoolList m_stringPoolList;
};
#endif
#endif
@@ -55,8 +55,8 @@ class DatabaseWorkerPool
memset(_connectionCount, 0, sizeof(_connectionCount));
_connections.resize(IDX_SIZE);
WPFatal (mysql_thread_safe(), "Used MySQL library isn't thread-safe.");
WPFatal (mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION, "TrinityCore does not support MySQL versions below 5.1");
WPFatal(mysql_thread_safe(), "Used MySQL library isn't thread-safe.");
WPFatal(mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION, "TrinityCore does not support MySQL versions below 5.1");
}
~DatabaseWorkerPool()
+38
View File
@@ -0,0 +1,38 @@
#include "Errors.h"
#include "Log.h"
#include <ace/Stack_Trace.h>
#include <ace/OS_NS_unistd.h>
namespace Trinity {
void Assert(char const *file, int line, char const *function, char const *message)
{
ACE_Stack_Trace st;
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n",
file, line, function, message, st.c_str());
*((volatile int*)NULL) = 0;
}
void Fatal(char const *file, int line, char const *function, char const *message)
{
sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n",
file, line, function, message);
ACE_OS::sleep(10);
*((volatile int*)NULL) = 0;
}
void Error(char const *file, int line, char const *function, char const *message)
{
sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ERROR:\n %s\n",
file, line, function, message);
*((volatile int*)NULL) = 0;
}
void Warning(char const *file, int line, char const *function, char const *message)
{
sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n",
file, line, function, message);
}
} // namespace Trinity
+16 -8
View File
@@ -19,15 +19,23 @@
#ifndef TRINITYCORE_ERRORS_H
#define TRINITYCORE_ERRORS_H
#include "Common.h"
#include "Log.h"
#include <ace/Stack_Trace.h>
#include <ace/OS_NS_unistd.h>
namespace Trinity {
#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } }
#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } }
#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } }
#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } }
void Assert(char const *file, int line, char const *function, char const *message);
void Fatal(char const *file, int line, char const *function, char const *message);
void Error(char const *file, int line, char const *function, char const *message);
void Warning(char const *file, int line, char const *function, char const *message);
} // namespace Trinity
#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while(0)
#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0)
#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0)
#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0)
#define ASSERT WPAssert
#endif
@@ -3,6 +3,8 @@
// MSDN Magazine, 2002
// FILE: WheatyExceptionReport.CPP
//==========================================
#include "CompilerDefs.h"
#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__)
#define WIN32_LEAN_AND_MEAN
#pragma warning(disable:4996)
+2
View File
@@ -218,6 +218,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type)
return "SOAP";
case LOG_FILTER_RBAC:
return "RBAC";
case LOG_FILTER_CHEAT:
return "CHEAT";
default:
break;
}
+5 -8
View File
@@ -68,10 +68,11 @@ enum LogFilterType
LOG_FILTER_SERVER_LOADING = 40,
LOG_FILTER_OPCODES = 41,
LOG_FILTER_SOAP = 42,
LOG_FILTER_RBAC = 43
LOG_FILTER_RBAC = 43,
LOG_FILTER_CHEAT = 44
};
const uint8 MaxLogFilter = 43;
const uint8 MaxLogFilter = 45;
// Values assigned have their equivalent in enum ACE_Log_Priority
enum LogLevel
@@ -108,12 +109,8 @@ enum AppenderFlags
struct LogMessage
{
LogMessage(LogLevel _level, LogFilterType _type, std::string _text)
: level(_level)
, type(_type)
, text(_text)
{
mtime = time(NULL);
}
: level(_level), type(_type), text(_text), mtime(time(NULL))
{ }
static std::string getTimeStr(time_t time);
std::string getTimeStr();
+1 -2
View File
@@ -25,8 +25,7 @@ class LogOperation
{
public:
LogOperation(Logger* _logger, LogMessage* _msg)
: logger(_logger)
, msg(_msg)
: logger(_logger), msg(_msg)
{ }
~LogOperation();
+95
View File
@@ -0,0 +1,95 @@
#include "ByteBuffer.h"
#include "Log.h"
#include <ace/Stack_Trace.h>
#include <sstream>
ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos,
size_t size, size_t valueSize)
{
std::ostringstream ss;
ACE_Stack_Trace trace;
ss << "Attempted to " << (add ? "put" : "get") << " value with size: "
<< valueSize << " in ByteBuffer (pos: " << pos << " size: " << size
<< ")\n\n" << trace.c_str();
message().assign(ss.str());
}
ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size,
size_t valueSize)
{
std::ostringstream ss;
ACE_Stack_Trace trace;
ss << "Attempted to put a "
<< (valueSize > 0 ? "NULL-pointer" : "zero-sized value")
<< " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n"
<< trace.c_str();
message().assign(ss.str());
}
void ByteBuffer::print_storage() const
{
if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output
return;
std::ostringstream o;
o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
o << read<uint8>(i) << " - ";
o << " ";
sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void ByteBuffer::textlike() const
{
if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output
return;
std::ostringstream o;
o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
{
char buf[1];
snprintf(buf, 1, "%c", read<uint8>(i));
o << buf;
}
o << " ";
sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void ByteBuffer::hexlike() const
{
if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output
return;
uint32 j = 1, k = 1;
std::ostringstream o;
o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
{
char buf[3];
snprintf(buf, 1, "%2X ", read<uint8>(i));
if ((i == (j * 8)) && ((i != (k * 16))))
{
o << "| ";
++j;
}
else if (i == (k * 16))
{
o << "\n";
++k;
++j;
}
o << buf;
}
o << " ";
sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
+32 -110
View File
@@ -19,66 +19,47 @@
#ifndef _BYTEBUFFER_H
#define _BYTEBUFFER_H
#include "Common.h"
#include "Define.h"
#include "Debugging/Errors.h"
#include "Log.h"
#include "Utilities/ByteConverter.h"
#include <exception>
#include <list>
#include <map>
#include <string>
#include <vector>
#include <cstring>
class ByteBufferException
// Root of ByteBuffer exception hierarchy
class ByteBufferException : public std::exception
{
public:
ByteBufferException(size_t pos, size_t size, size_t valueSize)
: Pos(pos), Size(size), ValueSize(valueSize)
{
}
public:
~ByteBufferException() throw() { }
protected:
size_t Pos;
size_t Size;
size_t ValueSize;
char const * what() const throw() { return msg_.c_str(); }
protected:
std::string & message() throw() { return msg_; }
private:
std::string msg_;
};
class ByteBufferPositionException : public ByteBufferException
{
public:
ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize)
: ByteBufferException(pos, size, valueSize), _add(add)
{
PrintError();
}
public:
ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize);
protected:
void PrintError() const
{
ACE_Stack_Trace trace;
sLog->outError(LOG_FILTER_NETWORKIO, "Attempted to %s value with size: " SIZEFMTD " in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stack trace: %s]",
(_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str());
}
private:
bool _add;
~ByteBufferPositionException() throw() { }
};
class ByteBufferSourceException : public ByteBufferException
{
public:
ByteBufferSourceException(size_t pos, size_t size, size_t valueSize)
: ByteBufferException(pos, size, valueSize)
{
PrintError();
}
public:
ByteBufferSourceException(size_t pos, size_t size, size_t valueSize);
protected:
void PrintError() const
{
ACE_Stack_Trace trace;
sLog->outError(LOG_FILTER_NETWORKIO, "Attempted to put a %s in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD ")\n[Stack trace: %s]",
(ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str());
}
~ByteBufferSourceException() throw() { }
};
class ByteBuffer
@@ -453,7 +434,7 @@ class ByteBuffer
{
if (_rpos + len > size())
throw ByteBufferPositionException(false, _rpos, len, size());
memcpy(dest, &_storage[_rpos], len);
std::memcpy(dest, &_storage[_rpos], len);
_rpos += len;
}
@@ -485,8 +466,7 @@ class ByteBuffer
{
if (!length)
return std::string();
char* buffer = new char[length + 1];
memset(buffer, 0, length + 1);
char* buffer = new char[length + 1]();
read((uint8*)buffer, length);
std::string retval = buffer;
delete[] buffer;
@@ -504,8 +484,7 @@ class ByteBuffer
uint32 ReadPackedTime()
{
uint32 packedDate = read<uint32>();
tm lt;
memset(&lt, 0, sizeof(lt));
tm lt = tm();
lt.tm_min = packedDate & 0x3F;
lt.tm_hour = (packedDate >> 6) & 0x1F;
@@ -565,7 +544,7 @@ class ByteBuffer
if (_storage.size() < _wpos + cnt)
_storage.resize(_wpos + cnt);
memcpy(&_storage[_wpos], src, cnt);
std::memcpy(&_storage[_wpos], src, cnt);
_wpos += cnt;
}
@@ -618,71 +597,14 @@ class ByteBuffer
if (!src)
throw ByteBufferSourceException(_wpos, size(), cnt);
memcpy(&_storage[pos], src, cnt);
std::memcpy(&_storage[pos], src, cnt);
}
void print_storage() const
{
if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
void print_storage() const;
std::ostringstream o;
o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
o << read<uint8>(i) << " - ";
o << " ";
void textlike() const;
sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void textlike() const
{
if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
std::ostringstream o;
o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
{
char buf[1];
snprintf(buf, 1, "%c", read<uint8>(i));
o << buf;
}
o << " ";
sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void hexlike() const
{
if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
uint32 j = 1, k = 1;
std::ostringstream o;
o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
{
char buf[3];
snprintf(buf, 1, "%2X ", read<uint8>(i));
if ((i == (j * 8)) && ((i != (k * 16))))
{
o << "| ";
++j;
}
else if (i == (k * 16))
{
o << "\n";
++k;
++j;
}
o << buf;
}
o << " ";
sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void hexlike() const;
protected:
size_t _rpos, _wpos, _bitpos;
+2 -1
View File
@@ -1097,7 +1097,7 @@ AccountInstancesPerHour = 5
# RBAC.DefaultGroups
# Description: Comma separated list of groups to be added to any account
# Check auth.rbac_groups for correct ids
# Default: "" (No group)
# Default: "" (No group)
RBAC.DefaultGroups = ""
@@ -2680,6 +2680,7 @@ Appenders=Console Server GM DBErrors Char RA Warden Chat
# 41 - Opcodes (just id and name sent / received)
# 42 - SOAP
# 43 - RBAC (Role Based Access Control)
# 44 - Cheat (used to log cheat attempts)
#
# LogLevel
# 0 - (Disabled)