diff options
12 files changed, 377 insertions, 82 deletions
diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index 423883a77f4..c5a011871ca 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -938,6 +938,7 @@ DROP TABLE IF EXISTS `character_queststatus_rewarded`; CREATE TABLE `character_queststatus_rewarded` ( `guid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier', `quest` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Quest Identifier', + `active` tinyint(10) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`guid`,`quest`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Player System'; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/sql/updates/characters/2012_03_04_00_characters_character_queststatus_rewarded.sql b/sql/updates/characters/2012_03_04_00_characters_character_queststatus_rewarded.sql new file mode 100644 index 00000000000..e4dbf73ad7a --- /dev/null +++ b/sql/updates/characters/2012_03_04_00_characters_character_queststatus_rewarded.sql @@ -0,0 +1 @@ +ALTER TABLE `character_queststatus_rewarded` ADD `active` tinyint(3) unsigned NOT NULL DEFAULT '1' AFTER `quest`; diff --git a/sql/updates/world/2013_03_04_01_world_waypoint_data.sql b/sql/updates/world/2013_03_04_01_world_waypoint_data.sql new file mode 100644 index 00000000000..3a2001e7e36 --- /dev/null +++ b/sql/updates/world/2013_03_04_01_world_waypoint_data.sql @@ -0,0 +1,153 @@ +SET @GUID := 40470; +SET @PATH := @GUID*10; +DELETE FROM `creature` where `id`=18686; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES +(@GUID,18686,530,1,1,0,0,-2847.327,3195.10722,7.4167,.0910940,300,0,0,9144,13525,2,0,0,0); +-- Pathing Data +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`) VALUES +(@PATH,1,-2843.86,3205.97,5.45323,0,0,0,0,100), +(@PATH,2,-2829.24,3218.81,9.59048,0,0,0,0,100), +(@PATH,3,-2814.12,3235.72,10.1736,0,0,0,0,100), +(@PATH,4,-2792.54,3259.91,5.91885,0,0,0,0,100), +(@PATH,5,-2774.46,3280.17,2.8828,0,0,0,0,100), +(@PATH,6,-2751.21,3306.24,0.199384,0,0,0,0,100), +(@PATH,7,-2728.55,3318.21,-0.833018,0,0,0,0,100), +(@PATH,8,-2719.59,3331.35,-1.04936,0,0,0,0,100), +(@PATH,9,-2708.94,3349.74,-0.819842,0,0,0,0,100), +(@PATH,10,-2694.72,3374.29,-0.156626,0,0,0,0,100), +(@PATH,11,-2685.08,3390.93,0.328583,0,0,0,0,100), +(@PATH,12,-2675.69,3407.16,0.474826,0,0,0,0,100), +(@PATH,13,-2669.68,3416.29,0.743526,0,0,0,0,100), +(@PATH,14,-2660.96,3425.20,0.805554,0,0,0,0,100), +(@PATH,15,-2654.25,3430.82,0.77502,0,0,0,0,100), +(@PATH,16,-2645.46,3437.83,1.28666,0,0,0,0,100), +(@PATH,17,-2639.59,3442.50,3.25542,0,0,0,0,100), +(@PATH,18,-2630.71,3449.41,1.86245,0,0,0,0,100), +(@PATH,19,-2621.54,3456.21,0.653284,0,0,0,0,100), +(@PATH,20,-2617.41,3460.51,0.593326,0,0,0,0,100), +(@PATH,21,-2611.50,3471.52,0.520041,0,0,0,0,100), +(@PATH,22,-2610.04,3475.69,0.53993,0,0,0,0,100), +(@PATH,23,-2606.90,3480.85,0.492544,0,0,0,0,100), +(@PATH,24,-2590.41,3502.84,0.225892,0,0,0,0,100), +(@PATH,25,-2582.03,3512.00,0.101641,0,0,0,0,100), +(@PATH,26,-2566.36,3522.06,0.189451,0,0,0,0,100), +(@PATH,27,-2534.38,3523.07,1.3404,0,0,0,0,100), +(@PATH,28,-2523.33,3527.83,1.66667,0,0,0,0,100), +(@PATH,29,-2516.31,3533.95,1.65006,0,0,0,0,100), +(@PATH,30,-2507.47,3544.67,1.56155,0,0,0,0,100), +(@PATH,31,-2491.83,3549.68,1.43199,0,0,0,0,100), +(@PATH,32,-2471.56,3551.98,1.23732,0,0,0,0,100), +(@PATH,33,-2463.14,3555.66,1.03546,0,0,0,0,100), +(@PATH,34,-2456.30,3555.25,0.942503,0,0,0,0,100), +(@PATH,35,-2452.53,3537.02,0.402467,0,0,0,0,100), +(@PATH,36,-2446.32,3528.59,-0.236494,0,0,0,0,100), +(@PATH,37,-2462.93,3549.41,1.08819,0,0,0,0,100), +(@PATH,38,-2460.92,3557.50,1.00403,0,0,0,0,100), +(@PATH,39,-2425.49,3596.20,0.274173,0,0,0,0,100), +(@PATH,40,-2405.20,3613.88,0.217946,0,0,0,0,100), +(@PATH,41,-2391.31,3632.83,0.792431,0,0,0,0,100), +(@PATH,42,-2383.97,3658.54,0.99065,0,0,0,0,100), +(@PATH,43,-2351.54,3700.72,0.420721,0,0,0,0,100), +(@PATH,44,-2314.59,3729.83,0.0297019,0,0,0,0,100), +(@PATH,45,-2296.57,3749.89,0.363868,0,0,0,0,100), +(@PATH,46,-2285.44,3767.70,0.291327,0,0,0,0,100), +(@PATH,47,-2279.30,3787.95,0.314858,0,0,0,0,100), +(@PATH,48,-2276.30,3799.32,0.521091,0,0,0,0,100), +(@PATH,49,-2254.61,3831.13,2.70024,0,0,0,0,100), +(@PATH,50,-2251.75,3848.92,5.15061,0,0,0,0,100), +(@PATH,51,-2249.52,3869.55,2.39354,0,0,0,0,100), +(@PATH,52,-2244.66,3893.46,1.58335,0,0,0,0,100), +(@PATH,53,-2239.88,3904.19,1.10899,0,0,0,0,100), +(@PATH,54,-2224.28,3927.45,0.706091,0,0,0,0,100), +(@PATH,55,-2187.45,3958.22,0.921813,0,0,0,0,100), +(@PATH,56,-2175.09,3978.98,0.929392,0,0,0,0,100), +(@PATH,57,-2171.14,4011.04,0.450247,0,0,0,0,100), +(@PATH,58,-2175.93,4027.88,0.519539,0,0,0,0,100), +(@PATH,59,-2187.96,4064.43,1.42810,0,0,0,0,100), +(@PATH,60,-2166.44,4102.49,4.27243,0,0,0,0,100), -- Had guid as action_id +(@PATH,61,-1700.15,3993.57,55.6859,0,0,0,0,100), +(@PATH,62,-1710.59,4034.97,60.6101,0,0,0,0,100), +(@PATH,63,-1719.95,4059.83,62.7452,0,0,0,0,100), +(@PATH,64,-1718.67,4104.32,64.3796,0,0,0,0,100), +(@PATH,65,-1743.77,4151.60,62.3929,0,0,0,0,100), +(@PATH,66,-1754.61,4173.29,58.3691,0,0,0,0,100), +(@PATH,67,-1788.41,4206.51,44.1839,0,0,0,0,100), +(@PATH,68,-1818.93,4214.12,33.1137,0,0,0,0,100), +(@PATH,69,-1841.51,4228.10,22.0741,0,0,0,0,100), +(@PATH,70,-1871.54,4263.50,8.22153,0,0,0,0,100), +(@PATH,71,-1891.00,4295.91,3.23019,0,0,0,0,100), +(@PATH,72,-1911.96,4351.49,1.66825,0,0,0,0,100), +(@PATH,73,-1910.12,4389.42,1.77078,0,0,0,0,100), +(@PATH,74,-1907.67,4417.31,2.99456,0,0,0,0,100), +(@PATH,75,-1917.63,4452.07,6.27493,0,0,0,0,100), +(@PATH,76,-1929.40,4473.47,8.90937,0,0,0,0,100), +(@PATH,77,-1942.74,4489.67,11.1029,0,0,0,0,100), +(@PATH,78,-1958.47,4508.45,12.7432,0,0,0,0,100), +(@PATH,79,-1975.36,4519.94,13.1616,0,0,0,0,100), +(@PATH,80,-1982.19,4524.49,13.0993,0,0,0,0,100), +(@PATH,81,-1983.38,4507.03,12.7591,0,0,0,0,100), +(@PATH,82,-1984.02,4496.55,11.9535,0,0,0,0,100), +(@PATH,83,-1984.87,4482.57,11.1499,0,0,0,0,100), +(@PATH,84,-1978.92,4509.87,12.6695,0,0,0,0,100), +(@PATH,85,-1978.12,4527.35,13.36,0,0,0,0,100), +(@PATH,86,-1967.33,4546.79,12.8741,0,0,0,0,100), +(@PATH,87,-1953.04,4566.47,10.1123,0,0,0,0,100), +(@PATH,88,-1946.50,4582.91,7.44598,0,0,0,0,100), +(@PATH,89,-1948.30,4599.58,4.61956,0,0,0,0,100), +(@PATH,90,-1955.08,4637.48,-0.0588505,0,0,0,0,100), +(@PATH,91,-1943.63,4685.04,-2.18987,0,0,0,0,100), +(@PATH,92,-1941.99,4705.25,-2.67768,0,0,0,0,100), +(@PATH,93,-1945.22,4727.47,-3.22917,0,0,0,0,100), +(@PATH,94,-1951.89,4748.79,-2.9388,0,0,0,0,100), +(@PATH,95,-1957.77,4773.70,-1.42409,0,0,0,0,100), +(@PATH,96,-1957.36,4798.11,-0.0807409,0,0,0,0,100), +(@PATH,97,-1944.66,4829.17,0.67,0,0,0,0,100), +(@PATH,98,-1929.68,4851.09,1.64973,0,0,0,0,100), +(@PATH,99,-1918.23,4883.89,2.11937,0,0,0,0,100), +(@PATH,100,-1901.18,4906.49,-1.12705,0,0,0,0,100), +(@PATH,101,-1881.87,4926.69,-9.60835,0,0,0,0,100), +(@PATH,102,-1870.05,4946.21,-17.0149,0,0,0,0,100), +(@PATH,103,-1866.49,4960.25,-20.2899,0,0,0,0,100), +(@PATH,104,-1860.94,5033.3,-26.0991,0,0,0,0,100), +(@PATH,105,-1869.80,4962.46,-20.3781,0,0,0,0,100), +(@PATH,106,-1884.86,4924.67,-8.30171,0,0,0,0,100), +(@PATH,107,-1904.83,4905.16,-0.202733,0,0,0,0,100), +(@PATH,108,-1922.67,4912.5,6.06643,0,0,0,0,100), +(@PATH,109,-1937.46,4934.99,14.8054,0,0,0,0,100), +(@PATH,110,-1953.22,4961.69,24.7149,0,0,0,0,100), +(@PATH,111,-1958.07,4992.99,30.1767,0,0,0,0,100), +(@PATH,112,-1958.74,5013.42,32.4293,0,0,0,0,100), +(@PATH,113,-1947.03,5042.52,25.2899,0,0,0,0,100), +(@PATH,114,-1942.58,5058.03,19.5292,0,0,0,0,100), +(@PATH,115,-1963.32,5083.08,11.1075,0,0,0,0,100), +(@PATH,116,-1984.50,5100.08,7.82778,0,0,0,0,100), +(@PATH,117,-2004.59,5114.07,8.26657,0,0,0,0,100), +(@PATH,118,-2029.48,5123.26,8.48839,0,0,0,0,100), +(@PATH,119,-2055.94,5125.38,7.48301,0,0,0,0,100), +(@PATH,120,-2089.33,5115.44,3.14184,0,0,0,0,100), +(@PATH,121,-2112.53,5107.32,-2.40737,0,0,0,0,100), +(@PATH,122,-2137.40,5108.51,-11.5709,0,0,0,0,100), +(@PATH,123,-2155.69,5115.97,-18.1534,0,0,0,0,100), +(@PATH,124,-2170.60,5125.13,-21.2824,0,0,0,0,100), +(@PATH,125,-2182.81,5131.87,-21.667,0,0,0,0,100), +(@PATH,126,-2198.88,5138.77,-21.2323,0,0,0,0,100), +(@PATH,127,-2219.62,5144.57,-19.6848,0,0,0,0,100), +(@PATH,128,-2238.57,5146.29,-17.4706,0,0,0,0,100), +(@PATH,129,-2266.45,5144.26,-13.0598,0,0,0,0,100), +(@PATH,130,-2290.86,5142.23,-9.17377,0,0,0,0,100), +(@PATH,131,-2308.35,5142.09,-7.11532,0,0,0,0,100), +(@PATH,132,-2333.72,5149.44,-5.0165,0,0,0,0,100), +(@PATH,133,-2365.45,5157.88,-2.8501,0,0,0,0,100), +(@PATH,134,-2390.26,5158.22,-1.19618,0,0,0,0,100), +(@PATH,135,-2417.84,5153.35,0.775549,0,0,0,0,100), +(@PATH,136,-2442.28,5142.04,3.53141,0,0,0,0,100), +(@PATH,137,-2469.81,5120.56,6.76948,0,0,0,0,100), +(@PATH,138,-2498.06,5115.06,7.87731,0,0,0,0,100), +(@PATH,139,-2532.85,5118.89,7.54034,0,0,0,0,100), +(@PATH,140,-2555.60,5120.59,7.69492,0,0,0,0,100), -- GUID+1 as action_id +(@PATH,141,-2843.86,3205.97,5.45323,0,0,0,0,100); +-- Assign Path +DELETE FROM `creature_addon` WHERE `guid`=@GUID; +INSERT INTO `creature_addon` (`guid`,`path_id`) VALUES +(@GUID,@PATH); diff --git a/sql/updates/world/2013_03_04_02_world_quest_template.sql b/sql/updates/world/2013_03_04_02_world_quest_template.sql new file mode 100644 index 00000000000..82f01a39a85 --- /dev/null +++ b/sql/updates/world/2013_03_04_02_world_quest_template.sql @@ -0,0 +1,2 @@ +UPDATE `quest_template` SET `PrevQuestId`=0 WHERE `Id`=8345; +UPDATE `quest_template` SET `NextQuestId`=0 WHERE `Id`=8330; diff --git a/sql/updates/world/2013_03_04_03_world_sai.sql b/sql/updates/world/2013_03_04_03_world_sai.sql new file mode 100644 index 00000000000..6cb234cc805 --- /dev/null +++ b/sql/updates/world/2013_03_04_03_world_sai.sql @@ -0,0 +1,77 @@ +-- The Admiral Revealed (12852) - http://www.wowhead.com/quest=12852 +-- http://www.youtube.com/watch?v=I9doc1BVmA8 +SET @WHIRLWIND := 49807; -- Admiral's Whirlwind, AoE, used in phase 1 +SET @STRIKE := 57846; -- Admiral's Heroic Strike, cast on tank, used in phase 1 +SET @CLEAVE := 15284; -- Admiral's Cleave, cast in cone, used in phase 1 +SET @TOUCH := 60501; -- Selfcast on Mal'Ganis, heals him, used in phase 2 +SET @SLEEP := 53045; -- Mal'Ganis Sleep,Cast on random group member, used in phase 2 +SET @BLAST := 60500; -- Mal'Ganis Mind Blast, Cast on random group member, used in phase 2 +SET @CARRION := 60502; -- Mal'Ganis Carrion Swarm, Cast in cone, used in phase 2 +SET @SHIELD := 50161; -- Cast when Admiral on 50 % +SET @ITEMSPELL := 31699; -- Spell to disable shield +SET @ADMIRAL := 29621; -- Grand Admiral Westwind +SET @MALGANIS := 29620; -- Dreadlord Mal'Ganis +SET @PORTAL := 27731; -- Portal visual +SET @LEGION_TELEPORT := 35502; -- Mal'Ganis Legion Portal visual +SET @CREDIT_BUNNY := 29627; -- Cute little flaming bunny +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (@CREDIT_BUNNY); +DELETE FROM `smart_scripts` WHERE `entryorguid`=@CREDIT_BUNNY 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 +(@CREDIT_BUNNY, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 75, @PORTAL, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Credit Bunny - Just Summoned - Cast Portal'); +-- SAI for Grand Admiral Westwind +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (@ADMIRAL,@MALGANIS,@ADMIRAL*100); +DELETE FROM `smart_scripts` WHERE `entryorguid`IN (@ADMIRAL,@ADMIRAL*100) AND `source_type` IN (0,9); +DELETE FROM `smart_scripts` WHERE `entryorguid`=@MALGANIS 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 +(@ADMIRAL, 0, 0, 1, 4, 0, 100, 0, 0, 0, 0, 0, 42, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On aggro - Set invicibility at 1 HP'), +(@ADMIRAL, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Link - Say line 0'), +(@ADMIRAL, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Link - Set phase 1'), +(@ADMIRAL, 0, 3, 4, 2, 0, 100, 1, 0, 50, 0, 0, 11, @SHIELD, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - At 50% HP - Cast Protection Sphere'), +(@ADMIRAL, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - Link - Say line 1'), +(@ADMIRAL, 0, 5, 6, 8, 0, 100, 0, @ITEMSPELL, 0, 0, 0, 28, @SHIELD, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On spell hit - Remove aura'), +(@ADMIRAL, 0, 6, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - Link - Say line 2'), +(@ADMIRAL, 0, 7, 8, 2, 0, 100, 1, 0, 30, 0, 0, 3, @MALGANIS, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - At 30% HP - Morph to Dreadlord Mal''Ganis'), +(@ADMIRAL, 0, 8, 9, 61, 0, 100, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Link - Set phase 2'), +(@ADMIRAL, 0, 9,10, 61, 0, 100, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - Link - Say line 3'), +(@ADMIRAL, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,'Grand Admiral Westwind - Link - Sheath'), +(@ADMIRAL, 0, 11, 0, 2, 0, 100, 1, 0, 15, 0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - At 15% HP - Say line 4'), +(@ADMIRAL, 0, 12, 0, 1, 0, 100, 0, 0, 0, 0, 0, 3, @ADMIRAL, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On evade - Restore model'), +(@ADMIRAL, 0, 13, 14, 2, 0, 100, 1, 1, 1, 0, 0, 18, 33554434, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On 1 hp - Set unit_flags'), +(@ADMIRAL, 0, 14, 15, 61, 0, 100, 1, 0, 0, 0, 0, 12, @CREDIT_BUNNY, 1, 19000, 0, 0, 0, 8, 0, 0, 0, 7494.893066, 4871.533203, -12.655286, 1.376, 'Grand Admiral Westwind - On Link - Summon Npc'), +(@ADMIRAL, 0, 15, 16, 61, 0, 100, 1, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Link - Stop Combat/Attack Attack State'), +(@ADMIRAL, 0, 16, 0, 61, 0, 100, 0, 0, 0, 0, 0, 80, @ADMIRAL*100, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Link - Start timed script'), +(@ADMIRAL*100, 9, 0, 0, 0, 0, 100, 0, 1500, 1500, 0, 0, 22, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On script - Set phase 3'), +(@ADMIRAL*100, 9, 1, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 69, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7494.788, 4872.567, -12.72154, 0, 'Grand Admiral Westwind - On Script - Move to Pos'), +(@ADMIRAL*100, 9, 2, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 1, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Script - Say line 6'), +(@ADMIRAL*100, 9, 3, 0, 0, 0, 100, 0, 4000, 4000, 0, 0, 11, @LEGION_TELEPORT, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Script - Cast spell on self'), +(@ADMIRAL*100, 9, 4, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 33, @CREDIT_BUNNY, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Script - Give quest credit'), +(@ADMIRAL*100, 9, 5, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 41, 3500, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Script - Despawn'), +(@ADMIRAL, 0, 17, 0, 11, 0, 100, 0, 0, 0, 0, 0, 19, 33554434, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Respawn - Unset unit_flags'), +(@ADMIRAL, 0, 18, 0, 0, 1, 100, 0, 15000, 16000, 16000, 16000, 11, @WHIRLWIND, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 1 - Cast Whirlwind'), +(@ADMIRAL, 0, 19, 0, 0, 1, 100, 0, 6000, 7000, 6000, 7000, 11, @STRIKE, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 1 - Cast Heroic Strike'), +(@ADMIRAL, 0, 20, 0, 0, 2, 100, 0, 15000, 16000, 15000, 16000, 11, @SLEEP, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 2 - Cast Sleep'), +(@ADMIRAL, 0, 21, 0, 0, 2, 100, 0, 6000, 7000, 6000, 7000, 11, @TOUCH, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 2- Cast Vampiric Touch'), +(@ADMIRAL, 0, 22, 0, 0, 1, 100, 0, 13000, 13500, 13000, 13500, 11, @CLEAVE, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 1 - Cast Cleave'), +(@ADMIRAL, 0, 23, 0, 0, 2, 100, 0, 8000, 9000, 8000, 9000, 11, @CARRION, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 2 - Cast Carrion Swarm'), +(@ADMIRAL, 0, 24, 0, 0, 2, 100, 0, 18000, 19000, 18000, 19000, 11, @BLAST, 1, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - In combat Phase 2 - Cast Mind Blast'), +(@ADMIRAL, 0, 25, 0, 25, 0, 100, 0, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Grand Admiral Westwind - On Reset - Allow Attack State'); +/* +Sound ID's +14429 Final speech - When he uses portal +14428 2% HP - When he becomes immune +14427 15 % - When he rages +14426 30% HP - When he morphs +14207 Sphere removed - When Item spell is used on him +14205 Sphere cast - When he casts sphere on self +14201 Beginning of combat - When he aggros +*/ +-- Sniffed text with sounds +DELETE FROM `creature_text` WHERE `entry` IN (@ADMIRAL,@MALGANIS); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ADMIRAL,0,0, 'How did you find me? Did Landgren tell?',12,0,100,0,0,14201, 'Grand Admiral Westwind'), +(@ADMIRAL,1,0, 'You thought I would just let you kill me?',12,0,100,0,0,14205, 'Grand Admiral Westwind'), +(@ADMIRAL,2,0, 'WHAT?! No matter. Even without my sphere, I will crush you! Behold my true identity and despair!',14,0,100,0,0,14207, 'Grand Admiral Westwind'), +(@ADMIRAL,3,0, 'Gah! I spent too much time in that weak little shell.',14,0,100,0,0,14426, 'Grand Admiral Westwind'), +(@ADMIRAL,4,0, 'Kirel narak! I am Mal''Ganis. I AM ETERNAL!',14,0,100,0,0,14427, 'Grand Admiral Westwind'), +(@ADMIRAL,5,0, 'ENOUGH! I waste my time here. I must gather my strength on the homeworld.',14,0,100,0,0,14428, 'Grand Admiral Westwind'), +(@ADMIRAL,6,0, 'You''ll never defeat the Lich King without my forces. I''ll have my revenge... on him AND you!',14,0,100,0,0,14429, 'Grand Admiral Westwind'); diff --git a/sql/updates/world/2013_03_04_04_world_player_factionchange_quests.sql b/sql/updates/world/2013_03_04_04_world_player_factionchange_quests.sql new file mode 100644 index 00000000000..163383cf0a5 --- /dev/null +++ b/sql/updates/world/2013_03_04_04_world_player_factionchange_quests.sql @@ -0,0 +1,11 @@ +-- ---------------------------- +-- Table structure for `player_factionchange_quests` +-- ---------------------------- +DROP TABLE IF EXISTS `player_factionchange_quests`; +CREATE TABLE `player_factionchange_quests` ( + `alliance_id` int(10) unsigned NOT NULL, + `horde_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`alliance_id`,`horde_id`), + UNIQUE INDEX `alliance_uniq` (`alliance_id`), + UNIQUE INDEX `horde_uniq` (`horde_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a405dc8ce02..93ce832b982 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -19522,7 +19522,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) { if (saveItr->second) { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, saveItr->first); trans->Append(stmt); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c82ea46f0f7..b421bca7d00 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7684,13 +7684,13 @@ uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id) return 0; } -SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id) +SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spellId) const { - return SpellScriptsBounds(_spellScriptsStore.lower_bound(spell_id), _spellScriptsStore.upper_bound(spell_id)); + return SpellScriptsBounds(_spellScriptsStore.equal_range(spellId)); } // this allows calculating base reputations to offline players, just by race and class -int32 ObjectMgr::GetBaseReputationOff(FactionEntry const* factionEntry, uint8 race, uint8 playerClass) +int32 ObjectMgr::GetBaseReputationOf(FactionEntry const* factionEntry, uint8 race, uint8 playerClass) { if (!factionEntry) return 0; @@ -8600,11 +8600,11 @@ void ObjectMgr::LoadFactionChangeAchievements() uint32 horde = fields[1].GetUInt32(); if (!sAchievementMgr->GetAchievement(alliance)) - sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Achievement %u (alliance_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); else if (!sAchievementMgr->GetAchievement(horde)) - sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Achievement %u (horde_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); else - FactionChange_Achievements[alliance] = horde; + FactionChangeAchievements[alliance] = horde; ++count; } @@ -8635,11 +8635,11 @@ void ObjectMgr::LoadFactionChangeItems() uint32 horde = fields[1].GetUInt32(); if (!GetItemTemplate(alliance)) - sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Item %u (alliance_id) referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); else if (!GetItemTemplate(horde)) - sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Item %u (horde_id) referenced in `player_factionchange_items` does not exist, pair skipped!", horde); else - FactionChange_Items[alliance] = horde; + FactionChangeItems[alliance] = horde; ++count; } @@ -8648,15 +8648,15 @@ void ObjectMgr::LoadFactionChangeItems() sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } -void ObjectMgr::LoadFactionChangeSpells() +void ObjectMgr::LoadFactionChangeQuests() { uint32 oldMSTime = getMSTime(); - QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_spells"); + QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_quests"); if (!result) { - sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change quest pairs. DB table `player_factionchange_quests` is empty."); return; } @@ -8669,18 +8669,18 @@ void ObjectMgr::LoadFactionChangeSpells() uint32 alliance = fields[0].GetUInt32(); uint32 horde = fields[1].GetUInt32(); - if (!sSpellMgr->GetSpellInfo(alliance)) - sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); - else if (!sSpellMgr->GetSpellInfo(horde)) - sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); + if (!sObjectMgr->GetQuestTemplate(alliance)) + sLog->outError(LOG_FILTER_SQL, "Quest %u (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance); + else if (!sObjectMgr->GetQuestTemplate(horde)) + sLog->outError(LOG_FILTER_SQL, "Quest %u (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde); else - FactionChange_Spells[alliance] = horde; + FactionChangeQuests[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeReputations() @@ -8705,11 +8705,11 @@ void ObjectMgr::LoadFactionChangeReputations() uint32 horde = fields[1].GetUInt32(); if (!sFactionStore.LookupEntry(alliance)) - sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Reputation %u (alliance_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); else if (!sFactionStore.LookupEntry(horde)) - sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Reputation %u (horde_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); else - FactionChange_Reputation[alliance] = horde; + FactionChangeReputation[alliance] = horde; ++count; } @@ -8718,6 +8718,41 @@ void ObjectMgr::LoadFactionChangeReputations() sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } +void ObjectMgr::LoadFactionChangeSpells() +{ + uint32 oldMSTime = getMSTime(); + + QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_spells"); + + if (!result) + { + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); + return; + } + + uint32 count = 0; + + do + { + Field* fields = result->Fetch(); + + uint32 alliance = fields[0].GetUInt32(); + uint32 horde = fields[1].GetUInt32(); + + if (!sSpellMgr->GetSpellInfo(alliance)) + sLog->outError(LOG_FILTER_SQL, "Spell %u (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); + else if (!sSpellMgr->GetSpellInfo(horde)) + sLog->outError(LOG_FILTER_SQL, "Spell %u (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); + else + FactionChangeSpells[alliance] = horde; + + ++count; + } + while (result->NextRow()); + + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); +} + void ObjectMgr::LoadFactionChangeTitles() { uint32 oldMSTime = getMSTime(); @@ -8740,11 +8775,11 @@ void ObjectMgr::LoadFactionChangeTitles() uint32 horde = fields[1].GetUInt32(); if (!sCharTitlesStore.LookupEntry(alliance)) - sLog->outError(LOG_FILTER_SQL, "Title %u referenced in `player_factionchange_title` does not exist, pair skipped!", alliance); + sLog->outError(LOG_FILTER_SQL, "Title %u (alliance_id) referenced in `player_factionchange_title` does not exist, pair skipped!", alliance); else if (!sCharTitlesStore.LookupEntry(horde)) - sLog->outError(LOG_FILTER_SQL, "Title %u referenced in `player_factionchange_title` does not exist, pair skipped!", horde); + sLog->outError(LOG_FILTER_SQL, "Title %u (horde_id) referenced in `player_factionchange_title` does not exist, pair skipped!", horde); else - FactionChange_Titles[alliance] = horde; + FactionChangeTitles[alliance] = horde; ++count; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 0a5b878e8fa..e621cf96696 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -379,7 +379,7 @@ struct ScriptInfo typedef std::multimap<uint32, ScriptInfo> ScriptMap; typedef std::map<uint32, ScriptMap > ScriptMapMap; typedef std::multimap<uint32, uint32> SpellScriptsContainer; -typedef std::pair<SpellScriptsContainer::iterator, SpellScriptsContainer::iterator> SpellScriptsBounds; +typedef std::pair<SpellScriptsContainer::const_iterator, SpellScriptsContainer::const_iterator> SpellScriptsBounds; extern ScriptMapMap sSpellScripts; extern ScriptMapMap sEventScripts; extern ScriptMapMap sWaypointScripts; @@ -780,7 +780,7 @@ class ObjectMgr AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const; uint32 GetAreaTriggerScriptId(uint32 trigger_id); - SpellScriptsBounds GetSpellScriptsBounds(uint32 spell_id); + SpellScriptsBounds GetSpellScriptsBounds(uint32 spellId) const; RepRewardRate const* GetRepRewardRate(uint32 factionId) const { @@ -799,7 +799,7 @@ class ObjectMgr return NULL; } - int32 GetBaseReputationOff(FactionEntry const* factionEntry, uint8 race, uint8 playerClass); + int32 GetBaseReputationOf(FactionEntry const* factionEntry, uint8 race, uint8 playerClass); RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const { @@ -1205,16 +1205,18 @@ class ObjectMgr value = data[loc_idx]; } - CharacterConversionMap FactionChange_Achievements; - CharacterConversionMap FactionChange_Items; - CharacterConversionMap FactionChange_Spells; - CharacterConversionMap FactionChange_Reputation; - CharacterConversionMap FactionChange_Titles; + CharacterConversionMap FactionChangeAchievements; + CharacterConversionMap FactionChangeItems; + CharacterConversionMap FactionChangeQuests; + CharacterConversionMap FactionChangeReputation; + CharacterConversionMap FactionChangeSpells; + CharacterConversionMap FactionChangeTitles; void LoadFactionChangeAchievements(); void LoadFactionChangeItems(); - void LoadFactionChangeSpells(); + void LoadFactionChangeQuests(); void LoadFactionChangeReputations(); + void LoadFactionChangeSpells(); void LoadFactionChangeTitles(); private: diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index eb5326e8094..eb9db1439c6 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1896,44 +1896,6 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) trans->Append(stmt); } - // Delete all current quests - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); - stmt->setUInt32(0, GUID_LOPART(guid)); - trans->Append(stmt); - - // Delete record of the faction old completed quests - { - std::ostringstream quests; - ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates(); - for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter) - { - Quest *qinfo = iter->second; - uint32 requiredRaces = qinfo->GetRequiredRaces(); - if (team == TEAM_ALLIANCE) - { - if (requiredRaces & RACEMASK_ALLIANCE) - { - quests << uint32(qinfo->GetQuestId()); - quests << ','; - } - } - else // if (team == TEAM_HORDE) - { - if (requiredRaces & RACEMASK_HORDE) - { - quests << uint32(qinfo->GetQuestId()); - quests << ','; - } - } - } - - std::string questsStr = quests.str(); - questsStr = questsStr.substr(0, questsStr.length() - 1); - - if (!questsStr.empty()) - trans->PAppend("DELETE FROM `character_queststatus_rewarded` WHERE guid='%u' AND quest IN (%s)", lowGuid, questsStr.c_str()); - } - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) { // Reset guild @@ -1991,7 +1953,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) trans->Append(stmt); // Achievement conversion - for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Achievements.begin(); it != sObjectMgr->FactionChange_Achievements.end(); ++it) + for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeAchievements.begin(); it != sObjectMgr->FactionChangeAchievements.end(); ++it) { uint32 achiev_alliance = it->first; uint32 achiev_horde = it->second; @@ -2009,7 +1971,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) } // Item conversion - for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Items.begin(); it != sObjectMgr->FactionChange_Items.end(); ++it) + for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeItems.begin(); it != sObjectMgr->FactionChangeItems.end(); ++it) { uint32 item_alliance = it->first; uint32 item_horde = it->second; @@ -2021,8 +1983,53 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) trans->Append(stmt); } + // Delete all current quests + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); + stmt->setUInt32(0, GUID_LOPART(guid)); + trans->Append(stmt); + + // Quest conversion + for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeQuests.begin(); it != sObjectMgr->FactionChangeQuests.end(); ++it) + { + uint32 quest_alliance = it->first; + uint32 quest_horde = it->second; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); + stmt->setUInt32(0, lowGuid); + stmt->setUInt32(1, (team == TEAM_ALLIANCE ? quest_alliance : quest_horde)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE); + stmt->setUInt32(0, (team == TEAM_ALLIANCE ? quest_alliance : quest_horde)); + stmt->setUInt32(1, (team == TEAM_ALLIANCE ? quest_horde : quest_alliance)); + stmt->setUInt32(2, lowGuid); + trans->Append(stmt); + } + + // Mark all rewarded quests as "active" (will count for completed quests achievements) + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); + + // Disable all old-faction specific quests + { + ObjectMgr::QuestMap const& questTemplates = sObjectMgr->GetQuestTemplates(); + for (ObjectMgr::QuestMap::const_iterator iter = questTemplates.begin(); iter != questTemplates.end(); ++iter) + { + Quest const* quest = iter->second; + uint32 newRaceMask = (team == TEAM_ALLIANCE) ? RACEMASK_ALLIANCE : RACEMASK_HORDE; + if (!(quest->GetRequiredRaces() & newRaceMask)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); + stmt->setUInt32(0, lowGuid); + stmt->setUInt32(1, quest->GetQuestId()); + trans->Append(stmt); + } + } + } + // Spell conversion - for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Spells.begin(); it != sObjectMgr->FactionChange_Spells.end(); ++it) + for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeSpells.begin(); it != sObjectMgr->FactionChangeSpells.end(); ++it) { uint32 spell_alliance = it->first; uint32 spell_horde = it->second; @@ -2040,7 +2047,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) } // Reputation conversion - for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Reputation.begin(); it != sObjectMgr->FactionChange_Reputation.end(); ++it) + for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeReputation.begin(); it != sObjectMgr->FactionChangeReputation.end(); ++it) { uint32 reputation_alliance = it->first; uint32 reputation_horde = it->second; @@ -2066,10 +2073,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation); // old base reputation - int32 oldBaseRep = sObjectMgr->GetBaseReputationOff(factionEntry, oldRace, playerClass); + int32 oldBaseRep = sObjectMgr->GetBaseReputationOf(factionEntry, oldRace, playerClass); // new base reputation - int32 newBaseRep = sObjectMgr->GetBaseReputationOff(sFactionStore.LookupEntry(newReputation), race, playerClass); + int32 newBaseRep = sObjectMgr->GetBaseReputationOf(sFactionStore.LookupEntry(newReputation), race, playerClass); // final reputation shouldnt change int32 FinalRep = oldDBRep + oldBaseRep; @@ -2101,7 +2108,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) for (uint32 index = 0; index < ktcount; ++index) knownTitles[index] = atol(tokens[index]); - for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Titles.begin(); it != sObjectMgr->FactionChange_Titles.end(); ++it) + for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChangeTitles.begin(); it != sObjectMgr->FactionChangeTitles.end(); ++it) { uint32 title_alliance = it->first; uint32 title_horde = it->second; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index f4da15aefa3..6b264921360 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -114,7 +114,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_CHARACTER_SKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_CHARACTER_RANDOMBG, "SELECT guid FROM character_battleground_random WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_CHARACTER_BANNED, "SELECT guid FROM character_banned WHERE guid = ? AND active = 1", CONNECTION_ASYNC); - PrepareStatement(CHAR_SEL_CHARACTER_QUESTSTATUSREW, "SELECT quest FROM character_queststatus_rewarded WHERE guid = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_SEL_CHARACTER_QUESTSTATUSREW, "SELECT quest FROM character_queststatus_rewarded WHERE guid = ? AND active = 1", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES, "SELECT instanceId, releaseTime FROM account_instance_times WHERE accountId = ?", CONNECTION_ASYNC); // End LoginQueryHolder content @@ -514,8 +514,11 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_MAIL, "UPDATE mail SET has_items = ?, expire_time = ?, deliver_time = ?, money = ?, cod = ?, checked = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_REP_CHAR_QUESTSTATUS, "REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, "DELETE FROM character_queststatus WHERE guid = ? AND quest = ?", CONNECTION_ASYNC); - PrepareStatement(CHAR_INS_CHAR_QUESTSTATUS, "INSERT IGNORE INTO character_queststatus_rewarded (guid, quest) VALUES (?, ?)", CONNECTION_ASYNC); + PrepareStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED, "INSERT IGNORE INTO character_queststatus_rewarded (guid, quest, active) VALUES (?, ?, 1)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, "DELETE FROM character_queststatus_rewarded WHERE guid = ? AND quest = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE, "UPDATE character_queststatus_rewarded SET quest = ? WHERE quest = ? AND guid = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE, "UPDATE character_queststatus_rewarded SET active = 1 WHERE guid = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST, "UPDATE character_queststatus_rewarded SET active = 0 WHERE quest = ? AND guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_SKILL_BY_SKILL, "DELETE FROM character_skills WHERE guid = ? AND skill = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_CHAR_SKILLS, "INSERT INTO character_skills (guid, skill, value, max) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_UDP_CHAR_SKILLS, "UPDATE character_skills SET value = ?, max = ? WHERE guid = ? AND skill = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 4c5f5d27899..ae15ddb0551 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -454,8 +454,11 @@ enum CharacterDatabaseStatements CHAR_UPD_MAIL, CHAR_REP_CHAR_QUESTSTATUS, CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, - CHAR_INS_CHAR_QUESTSTATUS, + CHAR_INS_CHAR_QUESTSTATUS_REWARDED, CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, + CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE, + CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE, + CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST, CHAR_DEL_CHAR_SKILL_BY_SKILL, CHAR_INS_CHAR_SKILLS, CHAR_UDP_CHAR_SKILLS, |