diff options
134 files changed, 2691 insertions, 1833 deletions
diff --git a/sql/updates/world/2011_10_18_00_world_spell_group.sql b/sql/updates/world/2011_10_18_00_world_spell_group.sql new file mode 100644 index 00000000000..fc11e3f365b --- /dev/null +++ b/sql/updates/world/2011_10_18_00_world_spell_group.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_group` WHERE `id` = 1114; +INSERT INTO `spell_group` (`id`, `spell_id`) VALUES +(1114,1490), +(1114,60431), +(1114,60432), +(1114,60433), +(1114,51726), +(1114,51734), +(1114,51735); diff --git a/sql/updates/world/2011_10_18_01_world_spell_group_stack_rules.sql b/sql/updates/world/2011_10_18_01_world_spell_group_stack_rules.sql new file mode 100644 index 00000000000..20044aa6241 --- /dev/null +++ b/sql/updates/world/2011_10_18_01_world_spell_group_stack_rules.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_group_stack_rules` WHERE `group_id` = 1114; +INSERT INTO `spell_group_stack_rules` (`group_id`, `stack_rule`) VALUES +(1114,3); diff --git a/sql/updates/world/2011_10_19_00_world_spell_script_names.sql b/sql/updates/world/2011_10_19_00_world_spell_script_names.sql new file mode 100644 index 00000000000..900d26c4e84 --- /dev/null +++ b/sql/updates/world/2011_10_19_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pri_shadowfiend'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(34433,'spell_pri_shadowfiend'); diff --git a/sql/updates/world/2011_10_21_00_world_creature_template_addon.sql b/sql/updates/world/2011_10_21_00_world_creature_template_addon.sql new file mode 100644 index 00000000000..fed232a29d2 --- /dev/null +++ b/sql/updates/world/2011_10_21_00_world_creature_template_addon.sql @@ -0,0 +1,3 @@ +-- Move Shadowfiend's Mana Leech Aura from spellscript to creature addon. +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_pri_shadowfiend'; +UPDATE `creature_template_addon` SET `auras`= '28305' WHERE `entry`=19668; diff --git a/sql/updates/world/2011_10_22_00_world_sai.sql b/sql/updates/world/2011_10_22_00_world_sai.sql new file mode 100644 index 00000000000..534e57297ef --- /dev/null +++ b/sql/updates/world/2011_10_22_00_world_sai.sql @@ -0,0 +1,44 @@ +-- [Q] A Taste of Flame + +-- Cyrus Therepentous SAI +SET @ENTRY := 9459; +SET @GOSSIP := 40060; +UPDATE `creature_template` SET `AIName`='SmartAI',`gossip_menu_id`=@GOSSIP WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,1,62,0,100,0,@GOSSIP,0,0,0,12,9461,1,360000,0,0,0,8,0,0,0,-7656.939941,-3009.474121,133.205612,4.830283,"Cyrus Therepentous - On Gossip Select - Summon Frenzied Black Drake"), +(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Cyrus Therepentous - On Gossip Select (Link) - Close Gossip"); + +-- Actual gossip option and text for Cyrus Therepentous +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP AND `text_id`=2494; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP,2494); +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(@GOSSIP,0,0,"I present you with proof...",1,1,0,0,0,0,NULL); + +-- Frenzied Black Drake SAI +SET @ENTRY := 9461; +SET @SPELL_FRENZY := 8269; +SET @SPELL_DECIMATE := 13459; +SET @SPELL_FLAME_BREATH := 9573; +SET @SPELL_FLAME_BUFFET := 9574; +UPDATE `creature_template` SET `AIName`='SmartAI',`mechanic_immune_mask`=1104 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,0,0,100,0,2300,2900,19500,46300,11,@SPELL_FLAME_BREATH,0,0,0,0,0,2,0,0,0,0,0,0,0,"Frenzied Black Drake - In Combat - Cast Flame Breath"), +(@ENTRY,0,1,0,0,0,100,0,1100,3800,2300,6100,11,@SPELL_FLAME_BUFFET,0,0,0,0,0,2,0,0,0,0,0,0,0,"Frenzied Black Drake - In Combat - Cast Flame Buffet"), +(@ENTRY,0,2,0,0,0,100,0,28500,31600,70100,74400,11,@SPELL_DECIMATE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Frenzied Black Drake - In Combat - Cast Decimate"), +(@ENTRY,0,3,4,2,0,100,1,0,30,0,0,11,@SPELL_FRENZY,1,0,0,0,0,1,0,0,0,0,0,0,0,"Frenzied Black Drake - At 30% HP - Cast Frenzy"), +(@ENTRY,0,4,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Frenzied Black Drake - At 30% HP - Emote Line 0"); +-- Text +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"%s goes into a frenzy!",16,0,100,0,0,0,"Frenzied Black Drake"); + +-- Conditions for the gossip option +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`Comment`) VALUES +(15,@GOSSIP,0,0,9,4022, 'Show gossip if on quest A Taste of Flame (1) OR'), +(15,@GOSSIP,0,1,9,4023, 'Show gossip if on quest A Taste of Flame (2) OR'), +(15,@GOSSIP,0,2,9,4024, 'Show gossip if on quest A Taste of Flame (3) OR'); diff --git a/sql/updates/world/2011_10_22_01_world_quest_relation.sql b/sql/updates/world/2011_10_22_01_world_quest_relation.sql new file mode 100644 index 00000000000..f0d15832b98 --- /dev/null +++ b/sql/updates/world/2011_10_22_01_world_quest_relation.sql @@ -0,0 +1,36 @@ +-- corrected quests in creature_involvedrelation and creature_questrelation +-- Horde npcs 14726 Rashona Straglash +UPDATE `creature_involvedrelation` SET `quest` = 7824 WHERE `id` =14726 AND `quest` =7836; +UPDATE `creature_questrelation` SET `quest` = 7824 WHERE `id` =14726 AND `quest` =7836; +UPDATE `creature_involvedrelation` SET `quest` = 7832 WHERE `id` =14726 AND `quest` =7837; +UPDATE `creature_questrelation` SET `quest` = 7832 WHERE `id` =14726 AND `quest` =7837; + +-- NPC 14727 Vehena +UPDATE `creature_involvedrelation` SET `quest` = 7836 WHERE `id` =14727 AND `quest` =7832; +UPDATE `creature_questrelation` SET `quest` = 7836 WHERE `id` =14727 AND `quest` =7832; +UPDATE `creature_involvedrelation` SET `quest` = 7837 WHERE `id` =14727 AND `quest` =7824; +UPDATE `creature_questrelation` SET `quest` = 7837 WHERE `id` =14727 AND `quest` =7824; + +-- Alliance npcs 14725 Raedon Dustriker +UPDATE `creature_involvedrelation` SET `quest` = 10352 WHERE `id` =14725 AND `quest` =7792; +UPDATE `creature_questrelation` SET `quest` = 10352 WHERE `id` =14725 AND `quest` =7792; +UPDATE `creature_involvedrelation` SET `quest` = 10354 WHERE `id` =14725 AND `quest` =7798; +UPDATE `creature_questrelation` SET `quest` = 10354 WHERE `id` =14725 AND `quest` =7798; + +-- NPC 20604 Dugiru +UPDATE `creature_involvedrelation` SET `quest` = 7792 WHERE `id` =20604 AND `quest` =10352; +UPDATE `creature_questrelation` SET `quest` = 7792 WHERE `id` =20604 AND `quest` =10352; +UPDATE `creature_involvedrelation` SET `quest` = 7798 WHERE `id` =20604 AND `quest` =10354; +UPDATE `creature_questrelation` SET `quest` = 7798 WHERE `id` =20604 AND `quest` =10354; + +-- NPC 14723 Mistina Steelshield +UPDATE `creature_involvedrelation` SET `quest` = 7802 WHERE `id` =14723 AND `quest` =7807; +UPDATE `creature_questrelation` SET `quest` = 7802 WHERE `id` =14723 AND `quest` =7807; +UPDATE `creature_involvedrelation` SET `quest` = 7803 WHERE `id` =14723 AND `quest` =7808; +UPDATE `creature_questrelation` SET `quest` = 7803 WHERE `id` =14723 AND `quest` =7808; + +-- NPC 14724 Bublo Acerbus +UPDATE `creature_involvedrelation` SET `quest` = 7807 WHERE `id` =14724 AND `quest` =7802; +UPDATE `creature_questrelation` SET `quest` = 7807 WHERE `id` =14724 AND `quest` =7802; +UPDATE `creature_involvedrelation` SET `quest` = 7808 WHERE `id` =14724 AND `quest` =7803; +UPDATE `creature_questrelation` SET `quest` = 7808 WHERE `id` =14724 AND `quest` =7803; diff --git a/sql/updates/world/2011_10_22_02_world_gameobject_template.sql b/sql/updates/world/2011_10_22_02_world_gameobject_template.sql new file mode 100644 index 00000000000..8effad58ca6 --- /dev/null +++ b/sql/updates/world/2011_10_22_02_world_gameobject_template.sql @@ -0,0 +1,4 @@ +DELETE FROM `gameobject_template` WHERE `entry` IN (180211,180213); +INSERT INTO `gameobject_template`(`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `AIName`, `ScriptName`, `WDBVerified`) VALUES +(180211,5,6314,'Uther''s Gnome Tribute','','','',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','',12340), +(180213,5,6315,'Uther''s Night Elf Tribute','','','',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','',12340); diff --git a/sql/updates/world/2011_10_22_03_world_sai.sql b/sql/updates/world/2011_10_22_03_world_sai.sql new file mode 100644 index 00000000000..6003e1d365b --- /dev/null +++ b/sql/updates/world/2011_10_22_03_world_sai.sql @@ -0,0 +1,69 @@ +-- [Q] A Meeting With The Magister +-- [Q] An Audience With The Arcanist +SET @ENTRY_HATHOREL := 36670; +SET @ENTRY_TYBALIN := 36669; +SET @QUEST_A := 20439; +SET @QUEST_H := 24451; +SET @GOSSIP_A := 10857; +SET @GOSSIP_H := 10858; +SET @SPELL_SUNREAVER_DISGUISE := 70973; +SET @SPELL_COVENANT_DISGUISE := 70971; +SET @SPELL_CREATE_BLADES := 69722; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@ENTRY_HATHOREL,@ENTRY_TYBALIN); +UPDATE `quest_template` SET `OfferRewardText`="Excellent work. Now that this is in our hands, we must get it to Caladis Brightspear as soon as possible. We can't risk the book falling back into Sunreaver hands.$BI'll ensure that Shandy Glossgleam gets his tabard back without incident, along with a healthy reward for his help",`RequestItemsText`="Have you recovered that book?" WHERE `entry`=@QUEST_A; +UPDATE `quest_template` SET `OfferRewardText`="Excellent work. Now that this is in our hands, we must get it to Myralion Sunblaze as soon as possible. We can't risk the Silver Covenant taking the book from us again.$BI'll get that tabard back to Shandy and see that he's well compensated for his assistance. Once the book is in Myralion's hands, the Silver Covenant won't be a threat anymore.",`RequestItemsText`="Have you recovered that book?" WHERE `entry`=@QUEST_H; +DELETE FROM `creature` WHERE `guid`=150186 AND `id`=@ENTRY_HATHOREL; -- Double-spawned Hathorel +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY_HATHOREL,@ENTRY_HATHOREL*100,@ENTRY_TYBALIN,@ENTRY_TYBALIN*100); +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 +(@ENTRY_TYBALIN,0,0,0,19,0,100,0,@QUEST_A,0,0,0,11,@SPELL_SUNREAVER_DISGUISE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Quest Accept - Cast Sunreaver Disguise"), +(@ENTRY_TYBALIN,0,1,0,20,0,100,0,@QUEST_A,0,0,0,28,@SPELL_SUNREAVER_DISGUISE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Quest Reward - Remove Aura Sunreaver Disguise"), +(@ENTRY_TYBALIN,0,2,3,62,0,100,0,@GOSSIP_A,1,0,0,11,@SPELL_SUNREAVER_DISGUISE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Quest Accept - Cast Sunreaver Disguise"), +(@ENTRY_TYBALIN,0,3,0,61,0,100,0,@GOSSIP_A,1,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Gossip Select - Close Gossip"), +(@ENTRY_TYBALIN,0,4,0,62,0,100,0,@GOSSIP_H,0,0,0,80,@ENTRY_TYBALIN*100,0,0,0,0,0,1,0,0,0,0,0,0,0,"Arcanist Tybalin - On Gossip Select - Run Script"), +(@ENTRY_TYBALIN*100,9,0,0,0,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Script - Close Gossip"), +(@ENTRY_TYBALIN*100,9,1,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Script - Say text 0"), +(@ENTRY_TYBALIN*100,9,2,0,0,0,100,0,6000,6000,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Script - Say text 1"), +(@ENTRY_TYBALIN*100,9,3,0,0,0,100,0,0,0,0,0,11,@SPELL_CREATE_BLADES,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Script - Cast Create Ancient Dragonforged Blades"), +(@ENTRY_TYBALIN*100,9,4,0,0,0,100,0,6000,6000,0,0,1,2,0,0,0,0,0,7,0,0,0,0,0,0,0,"Arcanist Tybalin - On Script - Say text 2"), + +(@ENTRY_HATHOREL,0,0,0,19,0,100,0,@QUEST_H,0,0,0,11,@SPELL_COVENANT_DISGUISE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Quest Accept - Cast Covenant Disguise"), +(@ENTRY_HATHOREL,0,1,0,20,0,100,0,@QUEST_H,0,0,0,28,@SPELL_COVENANT_DISGUISE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Quest Reward - Remove Aura Covenant Disguise"), +(@ENTRY_HATHOREL,0,2,3,62,0,100,0,@GOSSIP_H,1,0,0,11,@SPELL_COVENANT_DISGUISE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Quest Accept - Cast Covenant Disguise"), +(@ENTRY_HATHOREL,0,3,0,61,0,100,0,@GOSSIP_H,1,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Gossip Select - Close Gossip"), +(@ENTRY_HATHOREL,0,4,0,62,0,100,0,@GOSSIP_A,0,0,0,80,@ENTRY_HATHOREL*100,0,0,0,0,0,1,0,0,0,0,0,0,0,"Magister Hathorel - On Gossip Select - Run Script"), +(@ENTRY_HATHOREL*100,9,0,0,0,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Script - Close Gossip"), +(@ENTRY_HATHOREL*100,9,1,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Script - Say text 0"), +(@ENTRY_HATHOREL*100,9,2,0,0,0,100,0,6000,6000,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Script - Say text 1"), +(@ENTRY_HATHOREL*100,9,3,0,0,0,100,0,0,0,0,0,11,@SPELL_CREATE_BLADES,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Script - Cast Create Ancient Dragonforged Blades"), +(@ENTRY_HATHOREL*100,9,4,0,0,0,100,0,6000,6000,0,0,1,2,0,0,0,0,0,7,0,0,0,0,0,0,0,"Magister Hathorel - On Script - Say text 2"); + +-- Actual gossip option +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (@GOSSIP_A,@GOSSIP_H); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES +(@GOSSIP_A,0,0,"I'm ready to deliver the tome, Magister Hathorel.",1,1,0,0,0,0,NULL), +(@GOSSIP_A,1,0,"Would you renew my Sunreaver disguise?",1,1,0,0,0,0,NULL), +(@GOSSIP_H,0,0,"I'm ready to deliver the tome, Arcanist Tybalin.",1,1,0,0,0,0,NULL), +(@GOSSIP_H,1,0,"Would you renew my Covenant disguise?",1,1,0,0,0,0,NULL); + +-- Magister Hathorel +DELETE FROM `creature_text` WHERE `entry` IN (@ENTRY_HATHOREL,@ENTRY_TYBALIN); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY_HATHOREL,0,0,"You're late, courier. No, I don't want any excuses; this errand is far too important.",12,0,100,1,0,0,"Magister Hathorel"), +(@ENTRY_HATHOREL,1,0,"Here's the tome our representative brought from Wyrmrest. Get this to Myralion Sunblaze immediately.",12,0,100,1,0,0,"Magister Hathorel"), +(@ENTRY_HATHOREL,2,0,"Watch your back, courier. I needn't remind you of the value of the book, nor the fact that the Silver Covenant will stop at nothing to take it from us.",12,0,100,1,0,0,"Magister Hathorel"), +-- Arcanist Tybalin +(@ENTRY_TYBALIN,0,0,"It's good to finally see you, courier. Krasus has entrusted us with one of the few remaining copies of Ancient Dragonforged Blades.",12,0,100,1,0,0,"Arcanist Tybalin"), +(@ENTRY_TYBALIN,1,0,"Here is the book. You must ensure it gets to Caladis Brightspear in Icecrown before the Sunreavers realize what is happening.",12,0,100,1,0,0,"Arcanist Tybalin"), +(@ENTRY_TYBALIN,2,0,"Travel quickly! The Sunreavers will not waste any time once they realize that we have the information they seek.",12,0,100,1,0,0,"Arcanist Tybalin"); + +-- Conditions for the gossip options +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (15) AND `SourceGroup` IN (@GOSSIP_A,@GOSSIP_H); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES +(15,@GOSSIP_A,0,9,@QUEST_A), +(15,@GOSSIP_H,0,9,@QUEST_H), + +(15,@GOSSIP_A,1,11,@SPELL_COVENANT_DISGUISE), +(15,@GOSSIP_H,1,11,@SPELL_SUNREAVER_DISGUISE), + +(15,@GOSSIP_A,1,9,@QUEST_A), +(15,@GOSSIP_H,1,9,@QUEST_H); diff --git a/sql/updates/world/2011_10_22_04_world_sai.sql b/sql/updates/world/2011_10_22_04_world_sai.sql new file mode 100644 index 00000000000..71aac7a302b --- /dev/null +++ b/sql/updates/world/2011_10_22_04_world_sai.sql @@ -0,0 +1,145 @@ +-- [Q] Still At It +-- "Tipsy" McManus SAI +SET @ENTRY := 28566; +SET @GOSSIP := 9713; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100+0,@ENTRY*100+1,@ENTRY*100+2,@ENTRY*100+3,@ENTRY*100+4,@ENTRY*100+5,@ENTRY*100+6,@ENTRY*100+7,@ENTRY*100+8); +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 +(@ENTRY,0,0,0,62,0,100,0,@GOSSIP,0,0,0,80,@ENTRY*100+0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - On gossip option select - Run script"), +(@ENTRY,0,1,0,1,1,100,0,5000,5000,11000,11000,88,@ENTRY*100+1,@ENTRY*100+5,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - After 5 Sec - Run Random Script"), +(@ENTRY,0,2,0,38,1,100,0,1,1,0,0,80,@ENTRY*100+6,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - On Data Set 1 1 - Run Completion Script"), +(@ENTRY,0,3,0,1,1,100,1,103900,103900,0,0,80,@ENTRY*100+8,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Call Script Quest successful (phase 1) after some time (104s=9tasks)"), +(@ENTRY,0,4,0,1,2,100,1,0,0,0,0,80,@ENTRY*100+7,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Timed - Run Failure Script"), +(@ENTRY,0,5,0,1,4,100,1,8000,8000,0,0,81,3,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Timed - Set Back Gossip & Quest Flags"), +(@ENTRY,0,6,0,1,4,100,1,8010,8010,0,0,78,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Timed - Reset script"), +-- Start Script +(@ENTRY*100+0,9,0,0,0,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Tipsy McManus - Script 0 - Close Gossip"), +(@ENTRY*100+0,9,1,0,0,0,100,0,0,0,0,0,81,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 0 - Turn of Gossip & Questgiver flags"), +(@ENTRY*100+0,9,2,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 0 - Say Text 0"), +(@ENTRY*100+0,9,3,0,0,0,100,0,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 0 - Set Phase 1"), +-- Wants Orange +(@ENTRY*100+1,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 1 - Say Text 1"), +(@ENTRY*100+1,9,1,0,0,0,100,0,0,0,0,0,12,28535,1,10000,0,0,0,8,0,0,0,5549.62354,5769.51367,-73.42824,2.75762,"Tipsy McManus - Script 1 - Summon Wants Orange"), +(@ENTRY*100+1,9,2,0,0,0,100,0,10000,10000,10000,10000,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 1 - set phase 2"), +-- Wants Papaya +(@ENTRY*100+2,9,0,0,0,0,100,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 2 - Say Text 2"), +(@ENTRY*100+2,9,1,0,0,0,100,0,0,0,0,0,12,28536,1,10000,0,0,0,8,0,0,0,5549.62354,5769.51367,-73.42824,2.75762,"Tipsy McManus - Script 2 - Summon Wants Papaya"), +(@ENTRY*100+2,9,2,0,0,0,100,0,10000,10000,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 2 - set phase 2"), +-- Wants Bananas +(@ENTRY*100+3,9,0,0,0,0,100,0,0,0,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 3 - Say Text 3"), +(@ENTRY*100+3,9,1,0,0,0,100,0,0,0,0,0,12,28537,1,10000,0,0,0,8,0,0,0,5549.62354,5769.51367,-73.42824,2.75762,"Tipsy McManus - Script 3 - Summon Wants Bananas"), +(@ENTRY*100+3,9,2,0,0,0,100,0,10000,10000,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 3 - set phase 2"), +-- Steaming Valve +(@ENTRY*100+4,9,0,0,0,0,100,0,0,0,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 4 - Say Text 4"), +(@ENTRY*100+4,9,1,0,0,0,100,0,0,0,0,0,12,28539,1,10000,0,0,0,8,0,0,0,5548.1,5767.4,-76.2673,-2.1293,"Tipsy McManus - Script 4 - Summon Steaming Valve"), +(@ENTRY*100+4,9,2,0,0,0,100,0,10000,10000,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 4 - set phase 2"), +-- Wants Fire +(@ENTRY*100+5,9,0,0,0,0,100,0,0,0,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 5 - Say Text 5"), +(@ENTRY*100+5,9,1,0,0,0,100,0,0,0,0,0,12,28540,1,10000,0,0,0,8,0,0,0,5552.58,5765.66,-78.0212,-3.00195,"Tipsy McManus - Script 5 - Summon Wants Fire"), +(@ENTRY*100+5,9,2,0,0,0,100,0,10000,10000,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 5 - Set Phase 2"), +-- Task successful +(@ENTRY*100+6,9,0,0,0,0,100,0,0,0,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 6 - Say Text 6"), +-- End failure +(@ENTRY*100+7,9,0,0,0,0,100,0,0,0,0,0,1,7,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 7 - Say Text 7"), +(@ENTRY*100+7,9,1,0,0,0,100,0,0,0,0,0,22,4,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 7 - Set Phase 4"), +-- Completion script +(@ENTRY*100+8,9,0,0,0,0,100,0,0,0,0,0,1,8,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 8 - Say Text 8"), +(@ENTRY*100+8,9,1,0,0,0,100,0,0,0,0,0,50,190643,30000,0,0,0,0,8,0,0,0,5547.13525,5767.09961,-78.025856,2.25147343,"Tipsy McManus - Script 8 - Summon Thunderbrew's Jungle Punch"), +(@ENTRY*100+8,9,2,0,0,0,100,0,0,0,0,0,22,4,0,0,0,0,0,1,0,0,0,0,0,0,0,"Tipsy McManus - Script 8 - Set Phase 4"); + + +-- NPC talk text for "Tipsy" McManus +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Beginning the distillation in 5 seconds.",12,0,100,0,0,0,"Tipsy McManus"), +(@ENTRY,1,0,"Add another orange, quickly!",12,0,100,25,0,0,"Tipsy McManus"), +(@ENTRY,2,0,"Put a papaya in the still!",12,0,100,25,0,0,"Tipsy McManus"), +(@ENTRY,3,0,"Add bananas!",12,0,100,25,0,0,"Tipsy McManus"), +(@ENTRY,4,0,"Pressure's too high! Open the pressure valve!",12,0,100,5,0,0,"Tipsy McManus"), +(@ENTRY,5,0,"The still needs heat! Light the brazier!",12,0,100,5,0,0,"Tipsy McManus"), +(@ENTRY,6,0,"Good job! Keep your eyes open, now.",12,0,100,4,0,0,"Tipsy McManus"), +(@ENTRY,6,1,"That'll do. Never know what it'll need next...",12,0,100,4,0,0,"Tipsy McManus"), +(@ENTRY,6,2,"Nicely handled! Stay on your toes!",12,0,100,4,0,0,"Tipsy McManus"), +(@ENTRY,6,3,"Well done! Be ready for anything!",12,0,100,4,0,0,"Tipsy McManus"), +(@ENTRY,7,0,"It's no good! I'm shutting it down...",12,0,100,0,0,0,"Tipsy McManus"), +(@ENTRY,8,0,"We've done it! Come get the cask.",12,0,100,0,0,0,"Tipsy McManus"); + +-- Add Gossip option +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`) VALUES +(@GOSSIP,0,0,"I'm ready to start the distillation, uh, Tipsy.",1,1); + +-- Add gossip_menu_option condition +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES +(15,@GOSSIP,0,9,12644); -- Quest "Still At It" Has to be active and incomplete + +-- Update creature_template for Wants XX targets +UPDATE `creature_template` SET `minlevel`=70,`maxlevel`=70,`exp`=2,`unit_class`=2,`unit_flags`=`unit_flags`|33554432,`flags_extra`=`flags_extra`|128,`InhabitType`=4,`family`=23,`type`=3 WHERE `entry` IN (28535,28536,28537,28539,28540); + +-- Wants Orange SAI +SET @ENTRY := 28535; +SET @SPELL_ORANGE := 51931; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_ORANGE,0,0,0,45,1,1,0,0,0,0,19,28566,0,0,0,0,0,0,"Wants Orange - On Spellhit - Set Data McManus"); + +-- Wants Papaya SAI +SET @ENTRY := 28536; +SET @SPELL_PAPAYA := 51933; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_PAPAYA,0,0,0,45,1,1,0,0,0,0,19,28566,0,0,0,0,0,0,"Wants Papaya - On Spellhit - Set Data McManus"); + +-- Wants Bananas SAI +SET @ENTRY := 28537; +SET @SPELL_BANANAS := 51932; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_BANANAS,0,0,0,45,1,1,0,0,0,0,19,28566,0,0,0,0,0,0,"Wants Bananas - On Spellhit - Set Data McManus"); + +-- Steam Valve SAI +SET @ENTRY := 28539; +SET @SPELL_STEAM_BLAST := 51920; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,11,0,100,0,0,0,0,0,11,@SPELL_STEAM_BLAST,0,0,0,0,0,1,0,0,0,0,0,0,0,"Steam Valve - Out Of Combat - Cast Cosmetic Steam Blast"), +(@ENTRY,0,1,0,6,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,28566,0,0,0,0,0,0,"Steam Valve - On Death - Set Data McManus"); + +-- Pressure Valve SAI +SET @ENTRY := 190635; +UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=1 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,1,0,0,64,0,100,0,500,500,0,0,51,0,0,0,0,0,0,19,28539,0,0,0,0,0,0,"Pressure Valve - On Gossip Hello - Kill Steam Valve"); + +-- Wants Fire SAI +SET @ENTRY := 28540; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,6,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,28566,0,0,0,0,0,0,"Wants Fire - On Death - Set Data McManus"); + +-- Brazier SAI +SET @ENTRY := 190636; +UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,1,0,0,64,0,100,0,500,500,0,0,51,0,0,0,0,0,0,19,28540,0,0,0,0,0,0,"Brazier - On Gossip Hello - Kill Wants Fire"); + +-- Add Spell Targets +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (51931,51932,51933); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES +(13,51931,18,1,28535), -- Toss Orange requires target Wants Orange +(13,51931,18,1,28536), -- Toss Orange requires target Wants Papaya +(13,51931,18,1,28537), -- Toss Orange requires target Wants Bananas +(13,51933,18,1,28535), -- Toss Papaya requires target Wants Orange +(13,51933,18,1,28536), -- Toss Papaya requires target Wants Papaya +(13,51933,18,1,28537), -- Toss Papaya requires target Wants Bananas +(13,51932,18,1,28535), -- Toss Bananas requires target Wants Orange +(13,51932,18,1,28536), -- Toss Bananas requires target Wants Papaya +(13,51932,18,1,28537); -- Toss Bananas requires target Wants Bananas diff --git a/sql/updates/world/2011_10_22_05_world_misc.sql b/sql/updates/world/2011_10_22_05_world_misc.sql new file mode 100644 index 00000000000..57e4f740530 --- /dev/null +++ b/sql/updates/world/2011_10_22_05_world_misc.sql @@ -0,0 +1,14 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q14112_14145_chum_the_water'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(66741,'spell_q14112_14145_chum_the_water'); + +-- Template updates for creature 35071 (North Sea Mako) +UPDATE `creature_template` SET `faction_A`=14,`faction_H`=14,`baseattacktime`=2000,`InhabitType`=`InhabitType`&~1 WHERE `entry` IN (35071,35060,35061); -- North Sea * (Last 2 entries guessed) +UPDATE `creature_template` SET `faction_A`=1885,`faction_H`=1885,`baseattacktime`=2000 WHERE `entry`=35072; -- Angry Kvaldir +-- Addon data for creature 35071 (North Sea Mako) +DELETE FROM `creature_template_addon` WHERE `entry` IN (35071,35072,35060,35061); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(35071,0,0,1,0, NULL), -- North Sea Mako +(35060,0,0,1,0, NULL), -- North Sea Thresher - guessed +(35061,0,0,1,0, NULL), -- North Sea Blue Shark - guessed +(35072,0,0,1,0, NULL); -- Angry Kvaldir diff --git a/sql/updates/world/2011_10_22_06_world_sai.sql b/sql/updates/world/2011_10_22_06_world_sai.sql new file mode 100644 index 00000000000..433252f4e2d --- /dev/null +++ b/sql/updates/world/2011_10_22_06_world_sai.sql @@ -0,0 +1,19 @@ +-- Snowblind Follower SAI +SET @ENTRY := 29618; +SET @SPELL_NET := 66474; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,1,8,0,100,0,@SPELL_NET,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Snowblind Follower - On Spellhit - Say Line 0 (random)"), +(@ENTRY,0,1,2,61,0,100,0,0,0,0,0,33,34899,0,0,0,0,0,7,0,0,0,0,0,0,0,"Snowblind Follower - On Spellhit (Link) - Quest Credit"), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,41,5000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Snowblind Follower - On Spellhit (Link) - Forced Despawn"); + +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Grrrrr!",12,0,100,0,0,0,"Snowblind Follower"), +(@ENTRY,0,1,"Me not afraid!",12,0,100,0,0,0,"Snowblind Follower"), +(@ENTRY,0,2,"Net not stop me! No... net stop me.",12,0,100,0,0,0,"Snowblind Follower"), +(@ENTRY,0,3,"No kill me!",12,0,100,0,0,0,"Snowblind Follower"), +(@ENTRY,0,4,"No!",12,0,100,0,0,0,"Snowblind Follower"), +(@ENTRY,0,5,"You no take... me!",12,0,100,0,0,0,"Snowblind Follower"); diff --git a/sql/updates/world/2011_10_22_07_world_sai.sql b/sql/updates/world/2011_10_22_07_world_sai.sql new file mode 100644 index 00000000000..8e85d719cf8 --- /dev/null +++ b/sql/updates/world/2011_10_22_07_world_sai.sql @@ -0,0 +1,51 @@ +-- Hooked Net SHOULD hit this hard, fyi! +-- Sunreaver Agent SAI +SET @ENTRY := 36776; +SET @SPELL_HOOKED_NET := 59260; +SET @SPELL_SINISTER_STRIKE := 60195; +SET @SPELL_VANISH := 71400; -- Why is this called Vanish?... It teleports caster behind target +SET @SPELL_EVISCERATE := 15691; +SET @SPELL_BACKSTAB := 71410; +UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|2,`unit_class`=4 WHERE `entry`=@ENTRY; -- Civilian according to video +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Sunreaver Agent - On Aggro - Say Line 0 (random)"), +(@ENTRY,0,1,0,4,0,100,0,0,0,0,0,11,@SPELL_HOOKED_NET,0,0,0,0,0,2,0,0,0,0,0,0,0,"Sunreaver Agent - On Aggro - Cast Hooked Net"), +(@ENTRY,0,2,0,67,0,100,0,1000,3000,0,0,11,@SPELL_BACKSTAB,0,0,0,0,0,2,0,0,0,0,0,0,0,"Sunreaver Agent - Behind Target - Cast Backstab"), +(@ENTRY,0,3,0,0,0,100,0,1000,1500,3000,3000,11,@SPELL_SINISTER_STRIKE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Sunreaver Agent - In Combat - Cast Sinister Strike"), +(@ENTRY,0,4,0,0,0,100,1,4000,6000,0,0,11,@SPELL_VANISH,1,0,0,0,0,2,0,0,0,0,0,0,0,"Sunreaver Agent - In Combat - Cast Vanish"), +(@ENTRY,0,5,0,0,0,100,0,9000,13000,20000,20000,11,@SPELL_EVISCERATE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Sunreaver Agent - In Combat - Cast Eviscerate"); + +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Did you think you would escape with your life?",12,0,100,1,0,0,"Sunreaver Agent"), +(@ENTRY,0,1,"You'll never run us out of the city, Silver Covenant thug!",12,0,100,1,0,0,"Sunreaver Agent"); + +-- Silver Covenant Agent SAI +SET @ENTRY := 36774; +SET @SPELL_HOOKED_NET := 59260; +SET @SPELL_SINISTER_STRIKE := 60195; +SET @SPELL_VANISH := 71400; -- Why is this called Vanish?... It teleports caster behind target +SET @SPELL_EVISCERATE := 15691; +SET @SPELL_BACKSTAB := 71410; +UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|2,`unit_class`=4 WHERE `entry`=@ENTRY; -- Civilian according to video +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Silver Covenant Agent - On Aggro - Say Line 0 (random)"), +(@ENTRY,0,1,0,4,0,100,0,0,0,0,0,11,@SPELL_HOOKED_NET,0,0,0,0,0,2,0,0,0,0,0,0,0,"Silver Covenant Agent - On Aggro - Cast Hooked Net"), +(@ENTRY,0,2,0,67,0,100,0,1000,3000,0,0,11,@SPELL_BACKSTAB,0,0,0,0,0,2,0,0,0,0,0,0,0,"Silver Covenant Agent - Behind Target - Cast Backstab"), +(@ENTRY,0,3,0,0,0,100,0,1000,1500,3000,3000,11,@SPELL_SINISTER_STRIKE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Silver Covenant Agent - In Combat - Cast Sinister Strike"), +(@ENTRY,0,4,0,0,0,100,1,4000,6000,0,0,11,@SPELL_VANISH,1,0,0,0,0,2,0,0,0,0,0,0,0,"Silver Covenant Agent - In Combat - Cast Vanish"), +(@ENTRY,0,5,0,0,0,100,0,9000,13000,20000,20000,11,@SPELL_EVISCERATE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Silver Covenant Agent - In Combat - Cast Eviscerate"); + +-- Texts by +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"You Sunreaver lackeys are all the same.",12,0,100,1,0,0,"Silver Covenant Agent"), +(@ENTRY,0,1,"You won't escape from us so easily!",12,0,100,1,0,0,"Silver Covenant Agent"); + +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=30438; -- Sunreaver Agent +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=30310; -- Silver Covenant Agent diff --git a/sql/updates/world/2011_10_22_08_world_sai.sql b/sql/updates/world/2011_10_22_08_world_sai.sql new file mode 100644 index 00000000000..779f659f9af --- /dev/null +++ b/sql/updates/world/2011_10_22_08_world_sai.sql @@ -0,0 +1,108 @@ +-- [Q] Tails Up +-- Apparently it won't fall asleep due to evading. We are evading because the gossip won't show if we are in combat.. -_- + +-- Frost Leopard SAI +SET @ENTRY := 29327; +SET @QUEST := 13549; +SET @GOSSIP := 54000; +SET @SPELL_RAKE := 54668; +SET @SPELL_BLOWGUN := 62105; +SET @SPELL_SLEEP := 52742; +UPDATE `creature_template` SET `AIName`='SmartAI',`npcflag`=0,`gossip_menu_id`=@GOSSIP,`faction_A`=1990,`faction_H`=1990,`unit_flags`=`unit_flags`|0 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100,@ENTRY*100+1,@ENTRY*100+2,@ENTRY*100+3); +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 +(@ENTRY,0,0,0,0,0,100,0,1000,1000,8000,11000,11,@SPELL_RAKE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Frost Leopard - In Combat - Cast Rake"), +(@ENTRY,0,1,0,25,0,100,0,0,0,0,0,2,1990,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Reset - Set Faction Back"), +(@ENTRY,0,2,0,8,0,100,1,@SPELL_BLOWGUN,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,11,@SPELL_SLEEP,2,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script - Cast Sleep"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,2,35,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script - Set Faction Friendly"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,81,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script - Set npc_flag Gossip"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script - Evade"), -- The gossip only shows out of combat.. +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script - Stop Auto Attack"), + +(@ENTRY,0,3,0,62,0,100,0,@GOSSIP,0,0,0,88,@ENTRY*100+1,@ENTRY*100+3,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Gossip Select - Run Random Script"), +(@ENTRY*100+1,9,0,0,0,0,100,0,0,0,0,0,36,33007,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script 1 - Update Template Male"), +(@ENTRY*100+1,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Frost Leopard - Script 1 - Say Line 0"), +(@ENTRY*100+2,9,0,0,0,0,100,0,0,0,0,0,36,33010,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script 2 - Update Template Female"), +(@ENTRY*100+2,9,1,0,0,0,100,0,0,0,0,0,33,33005,0,0,0,0,0,7,0,0,0,0,0,0,0,"Frost Leopard - On Script 2 - Quest Credit"), +(@ENTRY*100+2,9,2,0,0,0,100,0,0,0,0,0,29,2,0,0,0,0,0,7,0,0,0,0,0,0,0,"Frost Leopard - On Script 2 - Follow Player"), -- Apparently crediting doesn't work through this action +(@ENTRY*100+3,9,0,0,0,0,100,0,0,0,0,0,36,33007,0,0,0,0,0,1,0,0,0,0,0,0,0,"Frost Leopard - On Script 3 - Update Template Male"), +(@ENTRY*100+3,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Frost Leopard - Script 3 - Say Line 0"); + +-- Insert gossip and static text +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP AND `text_id`=14266; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP,14266); +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +(@GOSSIP,0,0,"Lift the frost leopard's tail to check if it's a male or a female.",1,1,0); + +-- Text +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"It's an angry male!",42,0,100,0,0,0,"Male Frost Leopard"); + +-- Male Frost Leopard SAI +SET @ENTRY := 33007; +SET @SPELL_RAKE := 54668; +UPDATE `creature_template` SET `AIName`='SmartAI',`faction_A`=1990,`faction_H`=1990,`unit_flags`=`unit_flags`|0 WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,0,0,100,0,3000,4000,9000,11000,11,@SPELL_RAKE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Male Frost Leopard - In Combat - Cast Rake"); + +-- Icepaw Bear SAI +SET @ENTRY := 29319; +SET @QUEST := 13549; +SET @GOSSIP := 55000; +SET @SPELL_CLAWS_OF_ICE := 54632; +SET @SPELL_BLOWGUN := 62105; +SET @SPELL_SLEEP := 52742; +UPDATE `creature_template` SET `AIName`='SmartAI',`npcflag`=0,`gossip_menu_id`=@GOSSIP,`faction_A`=1990,`faction_H`=1990,`unit_flags`=`unit_flags`|0 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100,@ENTRY*100+1,@ENTRY*100+2,@ENTRY*100+3); +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 +(@ENTRY,0,0,0,0,0,100,0,1000,1000,8000,11000,11,@SPELL_CLAWS_OF_ICE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Icepaw Bear - In Combat - Cast Claws of Ice"), +(@ENTRY,0,1,0,25,0,100,0,0,0,0,0,2,1990,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Reset - Set Faction Back"), +(@ENTRY,0,2,0,8,0,100,1,@SPELL_BLOWGUN,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,11,@SPELL_SLEEP,2,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script - Cast Sleep"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,2,35,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script - Set Faction Friendly"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,81,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script - Set npc_flag Gossip"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script - Evade"), -- The gossip only shows out of combat.. +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script - Stop Auto Attack"), + +(@ENTRY,0,3,0,62,0,100,0,@GOSSIP,0,0,0,88,@ENTRY*100+1,@ENTRY*100+3,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Gossip Select - Run Random Script"), +(@ENTRY*100+1,9,0,0,0,0,100,0,0,0,0,0,36,33008,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script 1 - Update Template Male"), +(@ENTRY*100+1,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Icepaw Bear - Script 1 - Say Line 0"), +(@ENTRY*100+2,9,0,0,0,0,100,0,0,0,0,0,36,33011,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script 2 - Update Template Female"), +(@ENTRY*100+2,9,1,0,0,0,100,0,0,0,0,0,33,33006,0,0,0,0,0,7,0,0,0,0,0,0,0,"Icepaw Bear - On Script 2 - Quest Credit"), +(@ENTRY*100+2,9,2,0,0,0,100,0,0,0,0,0,29,2,0,0,0,0,0,7,0,0,0,0,0,0,0,"Icepaw Bear - On Script 2 - Follow Player"), -- Apparently crediting doesn't work through this action +(@ENTRY*100+3,9,0,0,0,0,100,0,0,0,0,0,36,33008,0,0,0,0,0,1,0,0,0,0,0,0,0,"Icepaw Bear - On Script 3 - Update Template Male"), +(@ENTRY*100+3,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Icepaw Bear - Script 3 - Say Line 0"); + +-- Insert gossip and static text +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP AND `text_id`=14267; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP,14267); +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +(@GOSSIP,0,0,"Lift the icepaw bear's tail to check if it's a male or a female.",1,1,0); + +-- Male Icepaw Bear SAI +SET @ENTRY := 33008; +SET @SPELL_CLAWS_OF_ICE := 54632; +UPDATE `creature_template` SET `AIName`='SmartAI',`faction_A`=1990,`faction_H`=1990,`unit_flags`=`unit_flags`|0 WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,0,0,100,0,3000,4000,9000,11000,11,@SPELL_CLAWS_OF_ICE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Male Icepaw Bear - In Combat - Cast Claws of Ice"); + +-- Text +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"It's an angry male!",42,0,100,0,0,0,"Male Icepaw Bear"); + +-- Only show first gossip if player is on quest Tails Up +DELETE FROM `conditions` WHERE `SourceGroup`=@GOSSIP AND `ConditionValue1`=@QUEST; +DELETE FROM `conditions` WHERE `SourceEntry` IN (@SPELL_BLOWGUN) AND `ConditionValue1` IN (29327,29319); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP,0,0,9,@QUEST,0,0,0,'',"Only show gossip if player is on quest Tails Up"), +(17,0,@SPELL_BLOWGUN,0,19,29327,0,0,0,'',"Spell To'kini's Blowgun can only be cast at Frost Leopard"), +(17,0,@SPELL_BLOWGUN,1,19,29319,0,0,0,'',"Spell To'kini's Blowgun can only be cast at Icepaw Bear"); diff --git a/sql/updates/world/2011_10_22_09_world_sai.sql b/sql/updates/world/2011_10_22_09_world_sai.sql new file mode 100644 index 00000000000..2bf96f951c6 --- /dev/null +++ b/sql/updates/world/2011_10_22_09_world_sai.sql @@ -0,0 +1,47 @@ +-- Talbuk Doe SAI +SET @ENTRY := 20610; -- Talbuk Doe +SET @SPELL_GORE := 32019; -- Gore +SET @SPELL_TAG := 35771; -- Tag Subbued Talbuk +SET @SPELL_TAG_CREDIT := 40347; -- Talbuk Tagging Credit +SET @SPELL_SLEEPING := 42648; -- Sleeping Sleep +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - On Aggro - Say text 0"), +(@ENTRY,0,1,0,0,0,100,0,1000,1000,8000,11000,11,@SPELL_GORE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Talbuk Doe - In Combat - Cast Gore"), +(@ENTRY,0,2,0,2,0,100,1,0,20,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - At 20% HP - Say Text 1"), +(@ENTRY,0,3,0,8,0,100,0,@SPELL_TAG,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - On Spellhit - Run Script"), +(@ENTRY,0,4,0,11,0,100,0,0,0,0,0,19,386,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - On Respawn - Remove Unit Flag"), +(@ENTRY*100,9,0,0,0,0,100,1,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - Script - Evade"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,33,20982,0,0,0,0,0,7,0,0,0,0,0,0,0,"Talbuk Doe - Script - Give Quest Credit"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,18,386,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - Script - Set Unit Flag"),-- Make it un-attackable in any way +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,11,@SPELL_SLEEPING,1,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Doe - Script - Cast Sleeping Sleep"); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"%s calls for the aid of a nearby male!",16,0,100,0,0,0,"Talbuk Doe"), +(@ENTRY,1,0,"%s seems to have weakened.",16,0,100,0,0,0,"Talbuk Doe"); + +-- Talbuk Sire SAI +SET @ENTRY := 20777; -- Talbuk Sire +SET @SPELL_STOMP := 32023; -- Hoof Stomp +SET @SPELL_TAG := 35771; -- Tag Subbued Talbuk +SET @SPELL_SLEEPING := 42648; -- Sleeping Sleep +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,0,0,100,0,1000,1000,8000,11000,11,@SPELL_STOMP,0,0,0,0,0,2,0,0,0,0,0,0,0,"Talbuk Sire - In Combat - Cast Hoof Stomp"), +(@ENTRY,0,1,0,2,0,100,1,0,20,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Sire - At 20% HP - Say Text 0"), +(@ENTRY,0,2,0,8,0,100,0,@SPELL_TAG,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Sire - On Spellhit - Run Script"), +(@ENTRY,0,3,0,11,0,100,0,0,0,0,0,19,386,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Sire - On Respawn - Remove Unit Flag"), +(@ENTRY*100,9,0,0,0,0,100,1,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Ancient Orc Ancestor - Script - Evade"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,11,@SPELL_TAG_CREDIT,2,0,0,0,0,7,0,0,0,0,0,0,0,"Talbuk Sire - Script - Give Killcredit"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,33,20982,0,0,0,0,0,7,0,0,0,0,0,0,0,"Talbuk Sire - Script - Give Quest Credit"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,18,386,0,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Sire - Script - Set Unit Flag"),-- Make it un-attackable in any way +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,11,@SPELL_SLEEPING,1,0,0,0,0,1,0,0,0,0,0,0,0,"Talbuk Sire - Script - Cast Sleeping Sleep"); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"%s seems to have weakened.",16,0,100,0,0,0,"Talbuk Sir"); diff --git a/sql/updates/world/2011_10_22_10_world_sai.sql b/sql/updates/world/2011_10_22_10_world_sai.sql new file mode 100644 index 00000000000..3e53d2a3757 --- /dev/null +++ b/sql/updates/world/2011_10_22_10_world_sai.sql @@ -0,0 +1,28 @@ +-- Farahlon Lasher SAI +SET @ENTRY := 20774; +SET @SPELL_ENTANGLING_ROOTS := 12747; +SET @SPELL_FRENZY := 3019; +SET @SPELL_FLANKING_GROWTH := 36604; +SET @SPELL_ENERGY_FIELD_MODULATOR := 35772; +UPDATE `creature_template` SET `AIName`='SmartAI',`dmgschool`=3 WHERE `entry`=@ENTRY; +DELETE FROM `creature` WHERE `id` IN (21331,20983); -- Those are supposed to be summoned +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,11,@SPELL_FLANKING_GROWTH,0,0,0,0,0,2,0,0,0,0,0,0,0,"Farahlon Lasher - On Aggro - Cast Flanking Growth"), +(@ENTRY,0,1,0,0,0,100,0,20000,20000,25000,25000,11,@SPELL_ENTANGLING_ROOTS,0,0,0,0,0,2,0,0,0,0,0,0,0,"Farahlon Lasher - In Combat - Cast Entanglin Roots"), +(@ENTRY,0,2,0,8,0,100,0,@SPELL_ENERGY_FIELD_MODULATOR,0,0,0,36,20983,0,0,0,0,0,1,0,0,0,0,0,0,0,"Farahlon Lasher - On Spellhit - Change Entry To Mutated"), +(@ENTRY,0,3,0,2,0,100,1,0,30,0,0,11,@SPELL_FRENZY,1,0,0,0,0,1,0,0,0,0,0,0,0,"Farahlon Lasher - At 30% HP - Cast Frenzy"), +(@ENTRY,0,4,0,2,0,100,1,0,30,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Farahlon Lasher - At 30% HP - Say Line 0"); +-- Text +DELETE FROM `creature_text` WHERE `entry` IN (@ENTRY,20983); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"%s goes into a frenzy!",16,0,100,0,0,0,"Farahlon Lasher"), +(20983,0,0,"%s goes into a frenzy!",16,0,100,0,0,0,"Mutated Farahlon Lasher"); + +-- To prevent being able to use the quest item more than once per creature +-- Removing previous entry which didn't work +DELETE FROM `conditions` WHERE `SourceEntry`=35772 AND `ConditionValue2`=20774; +DELETE FROM `conditions` WHERE `SourceEntry`=29818 AND `ConditionValue2`=20774; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(18,0,29818,0,24,1,20774,0,0,'',"Item Energy Field Modulator can only be used if target is Farahlon Lasher"); diff --git a/sql/updates/world/2011_10_22_11_world_sai.sql b/sql/updates/world/2011_10_22_11_world_sai.sql new file mode 100644 index 00000000000..dfae9ae383a --- /dev/null +++ b/sql/updates/world/2011_10_22_11_world_sai.sql @@ -0,0 +1,17 @@ +-- Withered Corpse SAI +SET @ENTRY := 20561; +SET @SPELL_PROTECTORATE_IGNITER := 35372; +UPDATE `creature_template` SET `AIName`='SmartAI',`unit_flags`=`unit_flags`|388 WHERE `entry`=@ENTRY; +DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (@ENTRY,0,0,1,0,"29266"); -- Emote death spell (Permanent Feign Death) +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,8,0,100,0,@SPELL_PROTECTORATE_IGNITER,0,0,0,33,20561,0,0,0,0,0,7,0,0,0,0,0,0,0,"Withered Corpse - On Spellhit - Give Quest Credit"), +(@ENTRY,0,1,0,8,0,100,0,@SPELL_PROTECTORATE_IGNITER,0,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Withered Corpse - On Spellhit - Die"); + +-- Protector Igniter can only be used inside Access Shaft Zeon +-- We are not removing the previous one, just adding an extra check +DELETE FROM `conditions` WHERE `SourceEntry`=35372 AND `ConditionValue1`=3880; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,35372,0,23,3880,0,0,0,'',"Protector Igniter can only be used inside Access Shaft Zeon"); diff --git a/sql/updates/world/2011_10_22_12_world_sai.sql b/sql/updates/world/2011_10_22_12_world_sai.sql new file mode 100644 index 00000000000..c405377f588 --- /dev/null +++ b/sql/updates/world/2011_10_22_12_world_sai.sql @@ -0,0 +1,21 @@ +-- Invis BE Ballista SAI +SET @ENTRY := 19723; +SET @SPELL_BURN_BLOOD_ELF := 34526; +UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|130 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_BURN_BLOOD_ELF,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Invis BE Ballista - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,50,181915,20000,0,0,0,0,1,0,0,0,0,0,0,0,"Invis BE Ballista - Script - Summon Blaze (fire)"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,41,0,0,0,0,0,0,8,0,0,0,0,0,0,0,"Invis BE Ballista - Script - Despawn"); + +-- Invis BE Tent SAI +SET @ENTRY := 19724; +SET @SPELL_BURN_BLOOD_ELF := 34526; +UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|130 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_BURN_BLOOD_ELF,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Invis BE Tent - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,50,181915,20000,0,0,0,0,1,0,0,0,0,0,0,0,"Invis BE Tent - Script - Summon Blaze (fire)"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,41,0,0,0,0,0,0,8,0,0,0,0,0,0,0,"Invis BE Tent - Script - Despawn"); diff --git a/sql/updates/world/2011_10_22_13_world_sai.sql b/sql/updates/world/2011_10_22_13_world_sai.sql new file mode 100644 index 00000000000..17f2efd7b5f --- /dev/null +++ b/sql/updates/world/2011_10_22_13_world_sai.sql @@ -0,0 +1,62 @@ +-- Windyreed Quest Credit (Hut 01) SAI +SET @ENTRY := 18142; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `gameobject` WHERE `id`=182146; -- Remove already spawned hut fires +SET @SPELL_LIVING_FIRE := 31927; -- Living Fire +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_LIVING_FIRE,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Windyreed Quest Credit - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1850.186401,6378.753906,49.132702,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1843.883911,6373.384277,46.005417,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1845.056030,6383.819336,56.662624,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1845.103638,6391.827148,53.700901,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,5,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1831.184937,6391.026855,45.671902,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,6,0,0,0,100,0,0,0,0,0,51,0,0,0,0,0,0,10,60165,17139,0,0,0,0,0,"Windyreed Quest Credit - Script - Kill Creature Inside Burning Hut"); + +-- Windyreed Quest Credit (Hut 02) SAI +SET @ENTRY := 18143; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +SET @SPELL_LIVING_FIRE := 31927; -- Living Fire +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_LIVING_FIRE,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Windyreed Quest Credit - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1915.344116,6350.488770,52.229897,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1907.135986,6353.901367,48.899532,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1911.698730,6354.161133,58.254566,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1926.308350,6360.901855,57.298611,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,5,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1921.458862,6367.373047,59.892593,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,6,0,0,0,100,0,0,0,0,0,51,0,0,0,0,0,0,10,60159,17139,0,0,0,0,0,"Windyreed Quest Credit - Script - Kill Creature Inside Burning Hut"); + +-- Windyreed Quest Credit (Hut 03) SAI +SET @ENTRY := 18144; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +SET @SPELL_LIVING_FIRE := 31927; -- Living Fire +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_LIVING_FIRE,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Windyreed Quest Credit - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1969.078369,6278.307129,56.866646,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1977.147461,6277.312988,59.912029,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1974.763306,6269.175781,51.401920,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1970.424805,6273.501953,61.741539,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,5,0,0,0,100,0,0,0,0,0,51,0,0,0,0,0,0,10,60157,17139,0,0,0,0,0,"Windyreed Quest Credit - Script - Kill Creature Inside Burning Hut"); + +-- Windyreed Quest Credit (Big Hut) SAI +SET @ENTRY := 18110; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +SET @SPELL_LIVING_FIRE := 31927; -- Living Fire +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_LIVING_FIRE,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Windyreed Quest Credit - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1816.939941,6283.669922,61.357101,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1816.94,6283.67,61.3571,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1819.71,6305.89,63.4012,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1819.55,6298.08,73.4331,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,4,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1801.45,6308.03,59.2728,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,5,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1808.88,6307.05,72.4877,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,6,0,0,0,100,0,0,0,0,0,50,182146,20000,0,0,0,0,8,0,0,0,-1794.54,6300.6,71.2263,0,"Windyreed Quest Credit - Script - Summon Hut Fire (Large)"), +(@ENTRY*100,9,7,0,0,0,100,0,0,0,0,0,51,0,0,0,0,0,0,10,60166,17139,0,0,0,0,0,"Windyreed Quest Credit - Script - Kill Creatures Inside Burning Hut"), +(@ENTRY*100,9,8,0,0,0,100,0,0,0,0,0,51,0,0,0,0,0,0,10,60167,17139,0,0,0,0,0,"Windyreed Quest Credit - Script - Kill Creatures Inside Burning Hut"); diff --git a/sql/updates/world/2011_10_22_14_world_sai.sql b/sql/updates/world/2011_10_22_14_world_sai.sql new file mode 100644 index 00000000000..e64b76711b8 --- /dev/null +++ b/sql/updates/world/2011_10_22_14_world_sai.sql @@ -0,0 +1,56 @@ +-- Wazat SAI +SET @ENTRY := 19035; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,1,0,100,0,20000,40000,60000,80000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wazat - OOC - Say Text 0"), +(@ENTRY,0,1,0,1,0,100,0,60000,80000,80000,110000,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wazat - OOC - Say Text 1"), +(@ENTRY,0,2,0,1,0,100,0,110000,130000,150000,170000,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wazat - OOC - Say Text 2"); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Oh sweet, delicious, spotted eggs - you will be mine...",12,0,100,0,0,0,"Wazat"), +(@ENTRY,1,1,"If only I could get this blasted machine working!",12,0,100,0,0,0,"Wazat"), +(@ENTRY,2,2,"They look so delicious...",12,0,100,0,0,0,"Wazat"); + +-- Wazat pathing: 11365 +SET @GUID := 68343; +SET @PATH := @GUID * 10; +UPDATE `creature` SET `MovementType`=2,`position_x`=-2428.169922,`position_y`=6885.750000,`position_z`=4.196100 WHERE `guid`=@GUID; +DELETE FROM `creature_addon` WHERE `guid`=@GUID; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@GUID,@PATH,1,0,''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,-2428.704590,6890.355469,4.297834,20000,0,0,100,0), +(@PATH,2,-2434.878418,6889.507813,4.266439,20000,0,0,100,0), +(@PATH,3,-2428.169922,6885.750000,4.196100,20000,0,0,100,0); + +-- Windroc Matriarch SAI +SET @ENTRY := 19055; +SET @SPELL_EAGLE_CLAW := 30285; -- Eagle Claw +SET @SPELL_WING_BUFFET := 32914; -- Wing Buffet +UPDATE `creature_template` SET `AIName`='SmartAI',`InhabitType`=4,`spell1`=0 WHERE `entry`=@ENTRY; -- Always in air, of course - really? Albino Snake as mind control ability? +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,11,0,100,0,0,0,0,0,53,0,@ENTRY,1,0,0,0,1,0,0,0,0,0,0,0, 'Windroc Matriarch - Start WP movement'), +(@ENTRY,0,1,0,1,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Windroc Matriarch - On Spawn - Emote Text 0"), +(@ENTRY,0,2,0,40,0,100,0,3,@ENTRY,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0,"Windroc Matriarch - Load script 1 at WP 3"), +(@ENTRY,0,3,0,0,0,100,0,4000,4000,6000,6000,11,@SPELL_EAGLE_CLAW,0,0,0,0,0,2,0,0,0,0,0,0,0,"Windroc Matriarch - In Combat - Cast Eagle Claw"), +(@ENTRY,0,4,0,0,0,100,0,7000,8000,11000,14000,11,@SPELL_WING_BUFFET,0,0,0,0,0,2,0,0,0,0,0,0,0,"Windroc Matriarch - In Combat - Cast Wing Buffet"), +-- Script 1 +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,54,1000000000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Windroc Matriarch - Script - Pause Path'), +(@ENTRY*100,9,1,0,0,0,100,1,0,0,0,0,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,"Windroc Matriarch - On Script - Set Faction Aggressive"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'Windroc Matriarch - Script - Remove unit_flag OOC_NOT_ATTACKABLE'), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,20,1,0,0,0,0,0,21,0,0,0,0,0,0,0,'Windroc Matriarch - Script - Attack Nearest Player'); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Emote blabla",16,0,100,0,0,0,"Windroc Matriarch"); +-- Waypoints +DELETE FROM `waypoints` WHERE `entry`=@ENTRY; +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@ENTRY,1,-2422.512695,6910.643555,20.124718,'Windroc Matriarch WP 1'), +(@ENTRY,2,-2420.722168,6901.208008,15.225160,'Windroc Matriarch WP 2'), +(@ENTRY,3,-2400.643066,6887.521973,-1.384245,'Windroc Matriarch WP 3'); diff --git a/sql/updates/world/2011_10_22_15_world_core_script_support.sql b/sql/updates/world/2011_10_22_15_world_core_script_support.sql new file mode 100644 index 00000000000..1d1c59c69d0 --- /dev/null +++ b/sql/updates/world/2011_10_22_15_world_core_script_support.sql @@ -0,0 +1,36 @@ +-- Kurenai Captive +UPDATE `creature_template` SET `ScriptName`='npc_kurenai_captive' WHERE `entry`=18209; +DELETE FROM `creature_template_addon` WHERE `entry`=18209; +INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (18209,0,0,8,0,0,''); -- Kneel +DELETE FROM `script_waypoint` WHERE `entry`=18209; +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`,`point_comment`) VALUES +(18209,1,-1518.593872,8469.956055,-4.101756,0,''), +(18209,2,-1511.784546,8480.531250,-4.033919,0,''), +(18209,3,-1513.447754,8509.764698,-0.109888,0,''), +(18209,4,-1498.857788,8508.805664,0.844676,0,''), +(18209,5,-1454.215088,8495.808594,4.912439,0,''), +(18209,6,-1437.483521,8504.165039,6.879123,0,''), +(18209,7,-1382.29,8539.87,11.139,7500,''), +(18209,8,-1361.22,8521.44,11.144,0,''), +(18209,9,-1324.8,8510.69,13.05,0,''), +(18209,10,-1312.08,8492.71,14.235,0,''); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000482 AND -1000488; +DELETE FROM `creature_text` WHERE `entry` IN (18209,18210); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +-- Maghar Captive +(18210,0,0,"Look out!",12,0,100,0,0,0,"Maghar Captive"), +(18210,1,0,"Don't let them escape! Kill the strong one first!",12,0,100,0,0,0,"Maghar Captive"), +(18210,2,0,"More of them are coming! Watch out!",12,0,100,0,0,0,"Maghar Captive"), +(18210,3,0,"Where do you think you're going? Kill them all!",12,0,100,0,0,0,"Maghar Captive"), +(18210,4,0,"Ride the lightning, filth!",12,0,100,0,0,0,"Maghar Captive"), +(18210,5,0,"FROST SHOCK!",14,0,100,0,0,0,"Maghar Captive"), +(18210,6,0,"It is best that we split up now, in case they send more after us. Hopefully one of us will make it back to Garrosh. Farewell, stranger.",12,0,100,0,0,0,"Maghar Captive"), +-- Kurenai Captive +(18209,0,0,"Look out!",12,0,100,0,0,0,"Kurenai Captive"), +(18209,1,0,"Don't let them escape! Kill the strong one first!",12,0,100,0,0,0,"Kurenai Captive"), +(18209,2,0,"More of them are coming! Watch out!",12,0,100,0,0,0,"Kurenai Captive"), +(18209,3,0,"Where do you think you're going? Kill them all!",12,0,100,0,0,0,"Kurenai Captive"), +(18209,4,0,"Ride the lightning, filth!",12,0,100,0,0,0,"Kurenai Captive"), +(18209,5,0,"FROST SHOCK!",14,0,100,0,0,0,"Kurenai Captive"), +(18209,6,0,"Up ahead is the road to Telaar. We will split up when we reach the fork as they will surely send more Murkblood after us. Hopefully one of us makes it back to Telaar alive.",14,0,100,0,0,0,"Kurenai Captive"); diff --git a/sql/updates/world/2011_10_22_16_world_core_script_support.sql b/sql/updates/world/2011_10_22_16_world_core_script_support.sql new file mode 100644 index 00000000000..c6049d49e19 --- /dev/null +++ b/sql/updates/world/2011_10_22_16_world_core_script_support.sql @@ -0,0 +1,10 @@ +SET @ENTRY := 18428; +UPDATE `gameobject_template` SET `ScriptName`='go_warmaul_prison' WHERE `entry` IN (182484,182486,182487,182488,182489,182490,182491,182492,182493,182494,182495,182496,182497,182498,182499,182501,182502,182503,182504); +UPDATE `quest_template` SET `ReqSpellCast1`=0 WHERE `entry`=9948; +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Death to the ogres!",12,0,100,0,0,0,"Mag'har Prisoner"), +(@ENTRY,1,1,"Many thanks, hero!",12,0,100,0,0,0,"Mag'har Prisoner"), +(@ENTRY,2,2,"One day, a hero will rise and lift the orcs up to their former glory.",12,0,100,0,0,0,"Mag'har Prisoner"), +(@ENTRY,3,3,"Spirits watch over you, $R!",12,0,100,0,0,0,"Mag'har Prisoner"), +(@ENTRY,4,4,"Thank you, $R! Your service to the Mag'har will not be forgotten.",12,0,100,0,0,0,"Mag'har Prisoner"); diff --git a/sql/updates/world/2011_10_22_17_world_conditions.sql b/sql/updates/world/2011_10_22_17_world_conditions.sql new file mode 100644 index 00000000000..db824c4ec3f --- /dev/null +++ b/sql/updates/world/2011_10_22_17_world_conditions.sql @@ -0,0 +1,5 @@ +-- Spell Place Kil'sorrow Banner can not only be cast on Warmaul Ogres +DELETE FROM `conditions` WHERE `SourceEntry` IN (32314) AND `ConditionValue2` IN (17138,18064); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,32314,0,18,1,17138,0,0,'',"Spell Place Kil'sorrow Banner can not only be cast on Warmaul Ogres"), -- Warmaul Reaver +(13,0,32314,1,18,1,18064,0,0,'',"Spell Place Kil'sorrow Banner can not only be cast on Warmaul Ogres"); -- Warmaul Shaman diff --git a/sql/updates/world/2011_10_22_18_world_misc.sql b/sql/updates/world/2011_10_22_18_world_misc.sql new file mode 100644 index 00000000000..c0c118eeb78 --- /dev/null +++ b/sql/updates/world/2011_10_22_18_world_misc.sql @@ -0,0 +1,104 @@ +-- Ancient Orc Ancestor SAI +SET @ENTRY := 18688; +SET @SPELL_SOUL_MIRROR := 34063; -- Soul Mirror +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,0,@SPELL_SOUL_MIRROR,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Ancient Orc Ancestor - On Spellhit - Run Script"), +(@ENTRY,0,1,0,0,0,100,0,20000,40000,60000,180000,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Ancient Orc Ancestor - Timed - Say Line (random)"), +(@ENTRY,0,2,0,6,0,100,0,0,0,0,0,12,19480,3,120000,0,0,0,1,0,0,0,0,0,0,0,"Ancient Orc Ancestor - On Death - Summon Darkened Spirit"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,"Ancient Orc Ancestor - Script - Say Line (random)"), +(@ENTRY*100,9,1,0,0,0,100,1,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Ancient Orc Ancestor - Script - Evade"), +(@ENTRY*100,9,2,0,0,0,100,1,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Ancient Orc Ancestor - Script - Prevent Combat Movement"), +(@ENTRY*100,9,3,0,0,0,100,0,2000,2000,0,0,37,19480,0,0,0,0,0,1,0,0,0,0,0,0,0,"Ancient Orc Ancestor - Script - Die"); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Ancestors watch over you, kind one...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,0,1,"Cease your crying! STOP!",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,0,2,"I remember everything...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,0,3,"It cannot be...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,0,4,"It comes for you...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,0,"The spirits call... I am consumed.",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,1,"Cannot control... It draws me in... The void grows...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,2,"It is dying. It is dying. It is dying.",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,3,"The cold embrace awaits...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,4,"The pain is unbearable.",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,5,"What is happening to me?",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,6,"What is this trickery? I... ARGH...",12,0,100,21,0,0,"Ancient Orc Ancestor"), +(@ENTRY,1,7,"What will become of us when it falls?",12,0,100,21,0,0,"Ancient Orc Ancestor"); + +-- Voidwraith SAI +-- These are somehow summoned but can't find any info on sniffs or google.. +SET @ENTRY := 18659; +UPDATE `creature_template` SET `AIName`='SmartAI',`faction_A`=91,`faction_H`=91,`dmgschool`=5 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +UPDATE `creature` SET `MovementType`=0,`spawndist`=0 WHERE `id`=18662; -- Ancestors +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,6,0,100,0,0,0,0,0,12,19480,3,120000,0,0,0,1,0,0,0,0,0,0,0,"Voidwraith - On Death - Summon Darkened Spirit"); + +-- Darkened Spirit SAI +SET @ENTRY := 19480; +SET @SPELL_CONSUMING_SHADOWS := 31293; -- Consuming Shadows +UPDATE `creature_template` SET `AIName`='SmartAI',`faction_A`=91,`faction_H`=91,`dmgschool`=5 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,0,0,100,0,5000,7000,11000,15000,11,@SPELL_CONSUMING_SHADOWS,0,0,0,0,0,2,0,0,0,0,0,0,0,"Darkened Spirit - In Combat - Cast Consuming Shadows"), +(@ENTRY,0,1,0,6,0,100,0,0,0,0,0,41,5000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Darkened Spirit - Force Despawn 5 Seconds After Death"), +(@ENTRY,0,2,0,1,0,100,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Darkened Spirit - Timed - Say Line"); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"What... What have I become? Arrrgghhh...",12,0,100,21,0,0,"Darkened Spirit"); + +-- Spell Soul Mirror can only be cast at Ancient Orc Spectator +DELETE FROM `conditions` WHERE `SourceEntry`=34063 AND `ConditionValue2`=18688; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,34063,0,18,1,18688,0,0,'',"Spell Soul Mirror can only be cast at Ancient Orc Spectator"); + +-- these still need waypoints and proper aura +DELETE FROM `creature` WHERE `id`=18688; +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 +(66946,18688,530,1,1,0,0,-2225.73,8586.74,-10.361,0.261799,300,0,0,6542,0,0,0,0,0), +(66947,18688,530,1,1,0,0,-1452.95,8533.52,12.8692,3.33358,300,0,0,6542,0,0,0,0,0), +(14337,18688,530,1,1,0,0,-1637.01,8569.54,-12.3352,5.65003,300,0,0,6326,0,0,0,0,0), +(14338,18688,530,1,1,0,0,-2300.29,8571.08,-22.0957,5.65003,300,0,0,6326,0,0,0,0,0), +(14339,18688,530,1,1,0,0,-2407.95,8655.04,-19.7505,5.65003,300,0,0,6542,0,0,0,0,0), +(14340,18688,530,1,1,0,0,-2530.94,8629.31,-25.5884,5.65003,300,0,0,6326,0,0,0,0,0), +(14341,18688,530,1,1,0,0,-2571.84,8558.23,-33.6043,5.65003,300,0,0,6542,0,0,0,0,0), +(14342,18688,530,1,1,0,0,-2218.21,8513.48,-17.1368,5.65003,300,0,0,6542,0,0,0,0,0), +(14343,18688,530,1,1,0,0,-2114.42,8743.48,11.699,5.65003,300,0,0,6326,0,0,0,0,0), +(14977,18688,530,1,1,0,0,-2017.31,8743.44,19.5169,5.65003,300,0,0,6542,0,0,0,0,0), +(14978,18688,530,1,1,0,0,-1812.61,8813.18,30.2393,6.13478,300,0,0,6326,0,0,0,0,0), +(14979,18688,530,1,1,0,0,-1750.87,8877.25,31.67,6.13478,300,0,0,6326,0,0,0,0,0), +(14980,18688,530,1,1,0,0,-1539.61,8686.33,24.643,6.13478,300,0,0,6326,0,0,0,0,0), +(14981,18688,530,1,1,0,0,-1653.31,8494.49,-12.8156,6.13478,300,0,0,6542,0,0,0,0,0), +(14982,18688,530,1,1,0,0,-1579.32,8426.67,-9.33804,6.13478,300,0,0,6326,0,0,0,0,0), +(14983,18688,530,1,1,0,0,-1040.87,7895.8,22.8202,6.13478,300,0,0,6326,0,0,0,0,0), +(14984,18688,530,1,1,0,0,-1059.54,7750.35,25.8758,6.13478,300,0,0,6326,0,0,0,0,0), +(14985,18688,530,1,1,0,0,-908.965,7783.44,40.1036,6.13478,300,0,0,6326,0,0,0,0,0), +(20556,18688,530,1,1,0,0,-886.413,7824.75,40.0754,6.13478,300,0,0,6542,0,0,0,0,0), +(21776,18688,530,1,1,0,0,-878.863,7881.25,38.6467,6.13478,300,0,0,6326,0,0,0,0,0), +(23111,18688,530,1,1,0,0,-1866.27,8098.74,-20.3459,6.13478,300,0,0,6542,0,0,0,0,0), +(24670,18688,530,1,1,0,0,-2106.82,8191.13,-15.5604,6.13478,300,0,0,6542,0,0,0,0,0), +(24761,18688,530,1,1,0,0,-2084.75,8286.22,-11.4935,6.13478,300,0,0,6542,0,0,0,0,0), +(24794,18688,530,1,1,0,0,-2206.14,8306.9,-26.191,6.13478,300,0,0,6542,0,0,0,0,0), +(25100,18688,530,1,1,0,0,-2256,8478.68,-24.6155,6.13478,300,0,0,6542,0,0,0,0,0), +(26559,18688,530,1,1,0,0,-2336.12,8477.34,-30.3842,6.13478,300,0,0,6326,0,0,0,0,0), +(26564,18688,530,1,1,0,0,-2350.53,8641.59,-15.5674,6.13478,300,0,0,6326,0,0,0,0,0), +(31807,18688,530,1,1,0,0,-2379.14,8531.65,-28.7321,6.13478,300,0,0,6326,0,0,0,0,0), +(31833,18688,530,1,1,0,0,-2411.61,8492.45,-33.4541,6.13478,300,0,0,6542,0,0,0,0,0), +(32072,18688,530,1,1,0,0,-2416.02,8330.76,-37.6002,6.13478,300,0,0,6542,0,0,0,0,0), +(40475,18688,530,1,1,0,0,-2336.04,8288.74,-36.3567,1.72398,300,0,0,6326,0,0,0,0,0), +(40476,18688,530,1,1,0,0,-2336.11,8225.27,-35.7699,1.72398,300,0,0,6326,0,0,0,0,0), +(40703,18688,530,1,1,0,0,-2258.45,8221.08,-31.2193,3.93488,300,0,0,6326,0,0,0,0,0), +(40716,18688,530,1,1,0,0,-2203.79,8149.55,-25.1002,3.93488,300,0,0,6326,0,0,0,0,0), +(40725,18688,530,1,1,0,0,-2184.8,8029.08,-17.6373,3.93488,300,0,0,6542,0,0,0,0,0), +(40727,18688,530,1,1,0,0,-2297.12,7848.94,-30.4255,3.93488,300,0,0,6326,0,0,0,0,0), +(42893,18688,530,1,1,0,0,-2544.55,7818.57,-45.0012,3.93488,300,0,0,6326,0,0,0,0,0), +(45204,18688,530,1,1,0,0,-2555.36,7930.22,-55.675,3.93488,300,0,0,6542,0,0,0,0,0), +(46570,18688,530,1,1,0,0,-2622.32,7987.03,-48.9066,3.93488,300,0,0,6542,0,0,0,0,0), +(46819,18688,530,1,1,0,0,-2126.06,8148.39,-15.8518,3.93488,300,0,0,6326,0,0,0,0,0); diff --git a/sql/updates/world/2011_10_22_19_world_sai.sql b/sql/updates/world/2011_10_22_19_world_sai.sql new file mode 100644 index 00000000000..bb873c461ea --- /dev/null +++ b/sql/updates/world/2011_10_22_19_world_sai.sql @@ -0,0 +1,20 @@ +-- Quest 12860, 12927 "Data Mining" +SET @CREDIT := 29752; +SET @SPELL_CREDIT := 59728; +SET @SPELL := 55161; +SET @NPC := 29746; + +UPDATE `creature_template` SET `AIName`='SmartAI', `InhabitType`=7 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,0,@SPELL_CREDIT,0,0,0,33,@CREDIT,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Databank Core - On spell Retrieve Data hit - Give kill credit for quest Data Mining'), +(@NPC,0,1,0,61,0,100,0,0,0,0,0,41,1000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Databank Core - On spell Retrieve Data hit - Despawn (Linked)'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=@SPELL; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=@SPELL; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=@SPELL_CREDIT; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=@SPELL_CREDIT; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,@SPELL,0,29,@NPC,20,0,0, '', 'Spell Retrieve Data will only be cast near Databank'), +(13,0,@SPELL,0,18,1,@NPC,0,0, '', 'Spell Retrieve Data does only target Databank'); diff --git a/sql/updates/world/2011_10_23_00_world_sai.sql b/sql/updates/world/2011_10_23_00_world_sai.sql new file mode 100644 index 00000000000..0d90c2ac9ce --- /dev/null +++ b/sql/updates/world/2011_10_23_00_world_sai.sql @@ -0,0 +1,57 @@ +-- Horde + +-- Fix quest 8359 "Flexing for Nougat" +DELETE FROM `smart_scripts` WHERE `entryorguid`=6929 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 +(6929,0,0,1,62,0,100,0,441,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Gryshka - On gossip option 0 select - Close gossip'), +(6929,0,1,0,61,0,100,0,0,0,0,0,85,24751,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Gryshka - On gossip option 0 select - Player cast Trick or Treat on self'), +(6929,0,2,0,22,0,100,0,41,0,0,0,33,6929,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Gryshka - On flex emote - Give kill credit'); + +-- Fix quest 8358 "Incoming Gundrop" +UPDATE creature_template SET `AIName`= 'SmartAI' WHERE `entry`=11814; +DELETE FROM `smart_scripts` WHERE `entryorguid`=11814 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 +(11814,0,1,0,22,0,100,0,264,0,0,0,33,11814,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Kali Remik - On train emote - Give kill credit'); + +-- Fix quest 8354 "Chicken Clucking for a Mint" +DELETE FROM `smart_scripts` WHERE `entryorguid`=6741 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 +(6741,0,0,1,62,0,100,0,348,2,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Norman - On gossip option 2 select - Close gossip'), +(6741,0,1,0,61,0,100,0,0,0,0,0,85,24751,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Norman - On gossip option 2 select - Player cast Trick or Treat on self'), +(6741,0,2,0,22,0,100,0,22,0,0,0,33,6741,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Norman - On chicken emote - Give kill credit'); + +-- Fix quest 8360 "Dancing for Marzipan" +UPDATE creature_template SET `AIName`= 'SmartAI' WHERE `entry`=6746; +DELETE FROM `smart_scripts` WHERE `entryorguid`=6746 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 +(6746,0,1,0,22,0,100,0,34,0,0,0,33,6746,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Pala - On dance emote - Give kill credit'); + +-- Alliance + +-- Fix quest 8356 "Flexing for Nougat" +DELETE FROM `smart_scripts` WHERE `entryorguid`=6740 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 +(6740,0,0,1,62,0,100,0,342,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Allison - On gossip option 0 select - Close gossip'), +(6740,0,1,0,61,0,100,0,0,0,0,0,85,24751,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Innkeeper Allison - On gossip option 0 select - Player cast Trick or Treat on self'), +(6740,0,2,0,22,0,100,0,41,0,0,0,33,6740,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Allison - On flex emote - Give kill credit'); + +-- Fix quest 8358 "Incoming Gundrop" +UPDATE creature_template SET `AIName`= 'SmartAI' WHERE `entry`=6826; +DELETE FROM `smart_scripts` WHERE `entryorguid`=6826 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 +(6826,0,1,0,22,0,100,0,264,0,0,0,33,6826,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Talvash del Kissel - On train emote - Give kill credit'); + +-- Fix quest 8360 "Dancing for Marzipan" +UPDATE creature_template SET `AIName`= 'SmartAI' WHERE `entry`=6735; +DELETE FROM `smart_scripts` WHERE `entryorguid`=6735 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 +(6735,0,0,1,62,0,100,0,1581,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Saelienne - On gossip option 0 select - Close gossip'), +(6735,0,1,0,61,0,100,0,0,0,0,0,85,24751,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Saelienne - On gossip option 0 select - Player cast Trick or Treat on self'), +(6735,0,2,0,22,0,100,0,34,0,0,0,33,6735,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Saelienne - On dance emote - Give kill credit'); + +-- Fix quest 8353 "Chicken Clucking for a Mint" +DELETE FROM `smart_scripts` WHERE `entryorguid`=5111 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 +(5111,0,0,1,62,0,100,0,345,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Firebrew - On gossip option 0 select - Close gossip'), +(5111,0,1,0,61,0,100,0,0,0,0,0,85,24751,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Firebrew - On gossip option 0 select - Player cast Trick or Treat on self'), +(5111,0,2,0,22,0,100,0,22,0,0,0,33,5111,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Innkeeper Firebrew - On chicken emote - Give kill credit'); diff --git a/sql/updates/world/2011_10_23_01_world_sai.sql b/sql/updates/world/2011_10_23_01_world_sai.sql new file mode 100644 index 00000000000..89eba23683a --- /dev/null +++ b/sql/updates/world/2011_10_23_01_world_sai.sql @@ -0,0 +1,8 @@ +-- Quest 'Ruthless Cunning' exploit fix +-- Spell Place Kil'sorrow Banner can not only be cast on Warmaul Ogres +DELETE FROM `conditions` WHERE `SourceEntry` IN (32307) AND `ConditionValue2` IN (17148,17147,17146,18391); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,32307,0,18,1,17148,0,0,'',"Spell Place Kil'sorrow Banner can not only be cast on Kil'sorrow mobs"), -- Kil'sorrow Deathsworn +(13,0,32307,1,18,1,17147,0,0,'',"Spell Place Kil'sorrow Banner can not only be cast on Kil'sorrow mobs"), -- Kil'sorrow Cultist +(13,0,32307,2,18,1,17146,0,0,'',"Spell Place Kil'sorrow Banner can not only be cast on Kil'sorrow mobs"), -- Kil'sorrow Spellbinder +(13,0,32307,3,18,1,18391,0,0,'',"Spell Place Kil'sorrow Banner can not only be cast on Kil'sorrow mobs"); -- Giselda the Crone diff --git a/sql/updates/world/2011_10_23_02_world_sai.sql b/sql/updates/world/2011_10_23_02_world_sai.sql new file mode 100644 index 00000000000..a6a5da03bbb --- /dev/null +++ b/sql/updates/world/2011_10_23_02_world_sai.sql @@ -0,0 +1,9 @@ +-- Scarlet Onslaught Prisoner SAI +SET @ENTRY := 27349; +SET @SPELL_FLASK_OF_BLIGHT := 48188; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,1,8,0,100,0,@SPELL_FLASK_OF_BLIGHT,0,0,0,33,27253,0,0,0,0,0,7,0,0,0,0,0,0,0,"Scarlet Onslaught Prisoner - On Spellhit - Quest Credit"), +(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Scarlet Onslaught Prisoner - In Combat - Forced Despawn"); diff --git a/sql/updates/world/2011_10_23_03_world_sai.sql b/sql/updates/world/2011_10_23_03_world_sai.sql new file mode 100644 index 00000000000..d38e0a0b4fd --- /dev/null +++ b/sql/updates/world/2011_10_23_03_world_sai.sql @@ -0,0 +1,159 @@ +-- Shattered Rumbler SAI +SET @ENTRY := 17157; +SET @ENTRY_MINION := 18181; -- Minion of Gurok +SET @SPELL_EARTH_RUMBLE := 33840; -- Earth Rumble +SET @SPELL_THROW_GORDAWGS_BULDER := 32001; -- Throw Gordawgs Boulder +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`=''WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY*100 AND `source_type`=9; +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 +(@ENTRY,0,0,0,0,0,100,0,1000,1000,8000,9000,11,@SPELL_EARTH_RUMBLE,0,0,0,0,0,2,0,0,0,0,0,0,0,"Shattered Rumbler - In Combat - Cast Earth Rumble"), +(@ENTRY,0,1,0,8,0,100,1,@SPELL_THROW_GORDAWGS_BULDER,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Shattered Rumbler - On Spellhit - Run Script"), +(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,12,@ENTRY_MINION,4,20000,0,0,0,1,0,0,0,0,0,0,0,"Shattered Rumbler - Script - Summon Minion of Gurok"), +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,12,@ENTRY_MINION,4,20000,0,0,0,1,0,0,0,0,0,0,0,"Shattered Rumbler - Script - Summon Minion of Gurok"), +(@ENTRY*100,9,2,0,0,0,100,0,0,0,0,0,12,@ENTRY_MINION,4,20000,0,0,0,1,0,0,0,0,0,0,0,"Shattered Rumbler - Script - Summon Minion of Gurok"), +(@ENTRY*100,9,3,0,0,0,100,0,0,0,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Shattered Rumbler - Script - Die"); + +-- Minion of Gurok SAI +SET @ENTRY := 18181; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,11,0,100,0,0,0,0,0,89,10,0,0,0,0,0,1,0,0,0,0,0,0,0,"Minion of Gurok - Out of Combat - Set Random Movement"); + +-- Spell Throw Gordawgs Boulder can only be cast at Shattered Rumbler +DELETE FROM `conditions` WHERE `SourceEntry`=24501 AND `ConditionValue2`=17157; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(18,0,24501,0,24,1,17157,0,0,'',"Item Gordawgs Boulder can only be used if target is Shattered Rumbler"); + + +-- Lump SAI +SET @ENTRY := 18351; +SET @QUEST := 9918; +SET @GOSSIP := 21289; +SET @SPELL_SLEEPING_SLEEP := 42648; -- Sleeping Sleep +SET @SPELL_SHOULDER_CHARGE := 31994; -- Shoulder Charge +SET @SPELL_SPEAR_THROW := 32248; -- Spear Throw +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='',`gossip_menu_id`=@GOSSIP+1,`faction_A`=1711,`faction_H`=1711,`unit_flags`=`unit_flags`|528 WHERE `entry`=@ENTRY; +DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,11,0,100,0,0,0,0,0,11,@SPELL_SLEEPING_SLEEP,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - Out Of Combat - Cast Sleeping Sleep"), +(@ENTRY,0,1,0,4,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Lump - On Aggro - Say Line (random)"), +(@ENTRY,0,2,0,62,0,100,0,@GOSSIP+4,0,0,0,33,18354,0,0,0,0,0,7,0,0,0,0,0,0,0,"Lump - On Gossip Select - Give Quest Credit"), +(@ENTRY,0,3,0,2,0,100,1,0,30,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Lump - On 30% HP - Run Script"), +(@ENTRY*100,9,0,0,2,0,100,1,0,0,0,0,2,1080,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - On Script - Set Faction Friendly"), +(@ENTRY*100,9,1,0,2,0,100,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - On Script - Say Line 1"), +(@ENTRY*100,9,2,0,2,0,100,1,1000,1000,0,0,5,447,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - On Script - Emote ONESHOT_FLY_SIT_GROUND_DOWN"), -- He wont sit down, no matter which emote I use - probably due evading +(@ENTRY*100,9,3,0,2,0,100,1,0,0,0,0,20,9,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - On Script - Stop auto-attack"), +(@ENTRY*100,9,4,0,2,0,100,1,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - On Script - Evade"), +(@ENTRY*100,9,5,0,2,0,100,1,0,0,0,0,28,@SPELL_SLEEPING_SLEEP,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lump - On Script - Remove Aura Sleeping Sleep"), -- Prevent gaining it - were leaving combat! +(@ENTRY,0,4,0,9,0,100,0,8,25,1500,2000,11,@SPELL_SHOULDER_CHARGE,1,0,0,0,0,2,0,0,0,0,0,0,0,"Lump - On Player Range - Cast Shoulder Charge"), +(@ENTRY,0,5,0,9,0,100,0,5,40,1500,2000,11,@SPELL_SPEAR_THROW,1,0,0,0,0,2,0,0,0,0,0,0,0,"Lump - On Player Range - Cast Spear Throw"); +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"In Nagrand, food hunt ogre!",12,0,100,0,0,0,"Lump"), +(@ENTRY,0,1,"You taste good with maybe a little salt and pepper.",12,0,100,0,0,0,"Lump"), +(@ENTRY,1,2,"OK, OK! Lump give up!",12,0,100,0,0,0,"Lump"); + +-- Actual story menu +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+1 AND `text_id`=9352; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+1,9352); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+2 AND `text_id`=9353; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+2,9353); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+3 AND `text_id`=9354; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+3,9354); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+4 AND `text_id`=9355; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+4,9355); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+5 AND `text_id`=9356; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+5,9356); + +-- Insert option menu +DELETE FROM `gossip_menu_option` WHERE `menu_id` BETWEEN @GOSSIP+1 AND @GOSSIP+4; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +(@GOSSIP+1,0,0,"I need answers, ogre!",1,1,@GOSSIP+2), +(@GOSSIP+2,1,0,"Why are the Boulderfist out this far? You know that this is Kurenai territory.",1,1,@GOSSIP+3), +(@GOSSIP+3,2,0,"And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar.",1,1,@GOSSIP+4), +(@GOSSIP+4,3,0,"This means war, Lump! War I say!",1,1,@GOSSIP+5); + +-- Only show first gossip if player is on quest Not On My Watch! +DELETE FROM `conditions` WHERE `SourceGroup`=@GOSSIP+1 AND `ConditionValue1`=@QUEST AND `SourceTypeOrReferenceId`=15; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP+1,0,0,9,@QUEST,0,0,0,'',"Only show first gossip if player is on quest Not On My Watch!"); + + +-- Wild Sparrowhawk SAI +SET @ENTRY := 22979; +SET @SPELL_SPARROWHAWK_NET := 39810; -- Sparrowhawk Net +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='',`InhabitType`=4 WHERE `entry`=@ENTRY; -- Always in air +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_SPARROWHAWK_NET,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Wild Sparrowhawk - On Spellhit - Run Script"), +(@ENTRY,0,1,0,6,0,100,0,0,0,0,0,28,@SPELL_SPARROWHAWK_NET,2,0,0,0,0,1,0,0,0,0,0,0,0,"Wild Sparrowhawk - On Death - Remove Aura Sparrowhawk Net"), +(@ENTRY,0,2,0,6,0,100,0,0,0,0,0,41,10,0,0,0,0,0,1,0,0,0,0,0,0,0,'Wild Sparrowhawk - Force Despawn 8 Seconds After Death'), +(@ENTRY*100,9,0,0,0,0,100,0,1000,1000,0,0,25,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wild Sparrowhawk - On Script - Flee For Assist"), -- This is how it should work - there is no flee function in event_scripts, so can't do it blizzlike (event_scripts 39812) +(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,28,@SPELL_SPARROWHAWK_NET,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wild Sparrowhawk - On Script - Remove Aura Sparrowhawk Net"), -- Remove it and add it back later +(@ENTRY*100,9,2,0,0,0,100,0,11000,11000,0,0,56,32320,1,0,0,0,0,7,0,0,0,0,0,0,0,"Wild Sparrowhawk - On Script - Add Item Captured Sparrowhawk"), +(@ENTRY*100,9,3,0,0,0,100,0,11000,11000,0,0,37,0,1,0,0,0,0,1,0,0,0,0,0,0,0,"Wild Sparrowhawk - On Script - Die"); + +-- Spell Sparrowhawk Net can only be cast at Wild Sparrowhawk +DELETE FROM `conditions` WHERE `SourceEntry`=32321 AND `ConditionValue2`=22979 AND `SourceTypeOrReferenceId`=18; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(18,0,32321,0,24,1,22979,0,0,'',"Item Sparrowhawk Net can only be used if target is Wild Sparrowhawk"); + + +-- [Q] Diplomatic Measures +SET @GOSSIP := 21295; +SET @QUEST_HORDE := 10107; +SET @QUEST_ALLIANCE := 10108; + +-- Lantresor of the Blade SAI +SET @ENTRY := 18261; +SET @SPELL_BUNING_BLADE_BLADEMASTER := 32281; -- Burning Blade Blademaster +UPDATE `creature_template` SET `gossip_menu_id`=@GOSSIP+0,`AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,1,0,100,1,0,0,0,0,11,@SPELL_BUNING_BLADE_BLADEMASTER,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lantrestor of the Blade - Out of Combat - Cast Burning Blade Blademaster"), +(@ENTRY,0,1,0,62,0,100,0,@GOSSIP+7,0,0,0,26,@QUEST_ALLIANCE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Lantrestor of the Blade - On Gossip Select - Give Quest Credit"), +(@ENTRY,0,2,0,62,0,100,0,@GOSSIP+7,0,0,0,26,@QUEST_HORDE,0,0,0,0,0,7,0,0,0,0,0,0,0,"Lantrestor of the Blade - On Gossip Select - Give Quest Credit"); + +-- Make the npc_text entries work properly +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+1 AND `text_id`=9362; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+1,9362); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+2 AND `text_id`=9363; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+2,9363); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+3 AND `text_id`=9364; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+3,9364); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+4 AND `text_id`=9365; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+4,9365); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+5 AND `text_id`=9366; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+5,9366); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+6 AND `text_id`=9367; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+6,9367); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+7 AND `text_id`=9368; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+7,9368); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+8 AND `text_id`=9369; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+8,9369); + +-- Insert menu options +DELETE FROM `gossip_menu_option` WHERE `menu_id` BETWEEN @GOSSIP+0 AND @GOSSIP+7; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +(@GOSSIP+0,0,0,"I have killed many of your ogres, Lantresor. I have no fear.",1,1,@GOSSIP+1), +(@GOSSIP+1,1,0,"Should I know? You look like an orc to me.",1,1,@GOSSIP+2), +(@GOSSIP+2,2,0,"And the other half?",1,1,@GOSSIP+3), +(@GOSSIP+3,3,0,"I have heard of your kind, but I never thought to see the day when I would meet a half-breed.",1,1,@GOSSIP+4), +(@GOSSIP+4,4,0,"My apologies. I did not mean to offend. I am here on behalf of my people.",1,1,@GOSSIP+5), +(@GOSSIP+5,5,0,"My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces.",1,1,@GOSSIP+6), +(@GOSSIP+6,6,0,"We will fight you until the end,then, Lantresor. We will not stand idly by as you pillage our towns and kill our people.",1,1,@GOSSIP+7), +(@GOSSIP+7,7,0,"What do I need to do?",1,1,@GOSSIP+8); + +-- Conditions for gossip menu of quest Diplomatic Measures, they are grouped and thus ONE of them must be met in order for the gossip to become visible +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP+0; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP+0,0,0,9,@QUEST_ALLIANCE,0,0,0,'',"Only show first gossip if player is on quest Diplomatic Measures (alliance)"), +(15,@GOSSIP+0,0,1,9,@QUEST_HORDE,0,0,0,'',"Only show first gossip if player is on quest Diplomatic Measures (horde)"); diff --git a/sql/updates/world/2011_10_23_04_world_sai.sql b/sql/updates/world/2011_10_23_04_world_sai.sql new file mode 100644 index 00000000000..27adf09d51a --- /dev/null +++ b/sql/updates/world/2011_10_23_04_world_sai.sql @@ -0,0 +1,50 @@ +-- Altruis the Sufferer SAI +-- [Q] Survey the Land +-- [Q] Illidan's Pupil +SET @ENTRY := 18417; +SET @GOSSIP := 21304; +SET @QUEST_SURVEY := 9991; +SET @QUEST_PUPIL := 10646; +UPDATE `quest_template` SET `SpecialFlags`=`SpecialFlags`|2 WHERE `entry` IN (@QUEST_SURVEY,@QUEST_PUPIL); +UPDATE `creature_template` SET `gossip_menu_id`=@GOSSIP+0,`AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100); +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 +-- Survey the Land +(@ENTRY,0,0,0,62,0,100,0,@GOSSIP+1,0,0,0,52,532,0,0,0,0,0,7,0,0,0,0,0,0,0,"Altruis the Sufferer - On Gossip Select - Activate Taxi Path"), +(@ENTRY,0,1,0,62,0,100,0,@GOSSIP+1,0,0,0,26,@QUEST_SURVEY,0,0,0,0,0,7,0,0,0,0,0,0,0,"Altruis the Sufferer - On Gossip Select - Quest Credit"), +-- Illidan's Pupil +(@ENTRY,0,2,0,62,0,100,0,@GOSSIP+6,0,0,0,26,@QUEST_PUPIL,0,0,0,0,0,7,0,0,0,0,0,0,0,"Altruis the Sufferer - On Gossip Select - Give Quest Credit"); + +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+0 AND `text_id`=9427; +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+1 AND `text_id`=10492; +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+2 AND `text_id`=10493; +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+3 AND `text_id`=10494; +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+4 AND `text_id`=10495; +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+5 AND `text_id`=10497; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(@GOSSIP+0,9427), -- Survey the Land +(@GOSSIP+1,10492), -- Illidan's Pupil +(@GOSSIP+2,10493), -- Illidan's Pupil +(@GOSSIP+3,10494), -- Illidan's Pupil +(@GOSSIP+4,10495), -- Illidan's Pupil +(@GOSSIP+5,10497); -- Illidan's Pupil + +-- Insert menu options +DELETE FROM `gossip_menu_option` WHERE `menu_id` BETWEEN @GOSSIP+0 AND @GOSSIP+6; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +-- Survey the Land +(@GOSSIP+0,0,0,"Well?",1,3,@GOSSIP+1), +(@GOSSIP+1,0,0,"Ok.",1,3,0), +-- Illidan's Pupil +(@GOSSIP+0,1,0,"Tell me about the demon hunter training grounds at the Ruins of Karabor.",1,3,@GOSSIP+2), +(@GOSSIP+2,0,0,"I'm listening.",1,3,@GOSSIP+3), +(@GOSSIP+3,0,0,"Go on, please.",1,3,@GOSSIP+4), +(@GOSSIP+4,0,0,"Interesting.",1,3,@GOSSIP+5), +(@GOSSIP+5,0,0,"That's quite a story.",1,3,@GOSSIP+6), +(@GOSSIP+6,0,0,"There was something else I wanted to ask you, Altruis.",1,3,@GOSSIP+0); -- Back to first page + +-- Conditions for gossip menu of quest Survey the Land +DELETE FROM `conditions` WHERE `SourceGroup` IN (@GOSSIP+0,@GOSSIP+10) AND `ConditionValue1` IN (@QUEST_SURVEY,@QUEST_PUPIL); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP+0,0,0,9,@QUEST_SURVEY,0,0,0,'',"Only show first gossip if player is on quest Survey the Land"), +(15,@GOSSIP+0,1,0,9,@QUEST_PUPIL,0,0,0,'',"Only show first gossip if player is on quest Illidans Pupil"); diff --git a/sql/updates/world/2011_10_23_05_world_misc.sql b/sql/updates/world/2011_10_23_05_world_misc.sql new file mode 100644 index 00000000000..5c730c8cd18 --- /dev/null +++ b/sql/updates/world/2011_10_23_05_world_misc.sql @@ -0,0 +1,16 @@ +-- Ethereum Relay SAI +SET @ENTRY := 20619; +SET @SPELL_SHADOWFORM := 16592; +SET @SPELL_ETHEREUM_RELAY := 39596; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,1,0,100,1,0,0,0,0,11,@SPELL_SHADOWFORM,1,0,0,0,0,1,0,0,0,0,0,0,0,"Ethereum Relay - Out of Combat - Cast Shadowform"), +(@ENTRY,0,1,0,1,0,100,1,0,0,0,0,11,@SPELL_ETHEREUM_RELAY,1,0,0,0,0,1,0,0,0,0,0,0,0,"Ethereum Relay - Out of Combat - Cast Ethereum Relay"); + +-- Re-add what shouldn't be deleted +SET @Gossip = 21289; +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@Gossip AND `id`=0; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`) VALUES +(@Gossip, 0, 0, 'I believe in you.', 1, 1); diff --git a/sql/updates/world/2011_10_23_06_world_sai.sql b/sql/updates/world/2011_10_23_06_world_sai.sql new file mode 100644 index 00000000000..7e0eb7e7e96 --- /dev/null +++ b/sql/updates/world/2011_10_23_06_world_sai.sql @@ -0,0 +1,44 @@ +-- Sundered Rumbler SAI +SET @ENTRY := 18881; +SET @SPELL_SUMMON_SUNDERED_SHARD := 35310; +SET @SPELL_CREATE_ELEMENTAL_POWER := 34525; +SET @SPELL_ELEMENTAL_POWERDER_EXTRACTOR := 34520; +UPDATE `creature_template` SET `AIName`='SmartAI',`dmgschool`=3 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,8,0,100,1,@SPELL_ELEMENTAL_POWERDER_EXTRACTOR,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Sundered Rumbler - On Spellhit - Set Phase 1"), +(@ENTRY,0,1,0,6,1,100,0,0,0,0,0,11,@SPELL_CREATE_ELEMENTAL_POWER,2,0,0,0,0,1,0,0,0,0,0,0,0,"Sundered Rumbler - On Death - Cast Create Elemental Power"), +(@ENTRY,0,2,0,2,0,100,1,0,10,0,0,11,@SPELL_SUMMON_SUNDERED_SHARD,1,0,0,0,0,1,0,0,0,0,0,0,0,"Sundered Rumbler - At 10% HP - Cast Summon Sundered Shard"); + +-- Warp Aberration SAI +SET @ENTRY := 18865; +SET @SPELL_WARP_STORM := 36577; +SET @SPELL_ARCANE_SHIELD := 36640; +SET @SPELL_CREATE_ELEMENTAL_POWER := 34525; +SET @SPELL_ELEMENTAL_POWERDER_EXTRACTOR := 34520; +UPDATE `creature_template` SET `AIName`='SmartAI',`dmgschool`=6 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,4,0,100,0,0,0,0,0,11,@SPELL_ARCANE_SHIELD,0,0,0,0,0,1,0,0,0,0,0,0,0,"Warp Aberration - On Aggro - Cast Arcane Shield"), +(@ENTRY,0,1,0,8,0,100,1,@SPELL_ELEMENTAL_POWERDER_EXTRACTOR,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Warp Aberration - On Spellhit - Set Phase 1"), +(@ENTRY,0,2,0,6,1,100,0,0,0,0,0,11,@SPELL_CREATE_ELEMENTAL_POWER,2,0,0,0,0,1,0,0,0,0,0,0,0,"Warp Aberration - On Death - Cast Create Elemental Power"), +(@ENTRY,0,3,0,0,0,100,0,2500,5000,30000,35000,11,@SPELL_WARP_STORM,0,0,0,0,0,2,0,0,0,0,0,0,0,"Warp Aberration - In Combat - Cast Warp Storm"); + +-- Warp Storm SAI +SET @ENTRY := 21322; +SET @SPELL_WARP_STORM := 36580; +UPDATE `creature_template` SET `AIName`='SmartAI',`modelid1`=18402,`unit_flags`=33554822 WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,54,0,100,1,1000,1000,1000,1000,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Warp Storm - On Just Summoned - Prevent Combat Movement"), +(@ENTRY,0,1,0,4,0,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Warp Storm - On Aggro - Stop Auto Attack"), +(@ENTRY,0,2,0,0,0,100,0,1000,2000,3000,5000,11,@SPELL_WARP_STORM,0,0,0,0,0,1,0,0,0,0,0,0,0,"Warp Storm - In Combat - Cast Warp Storm"); + +-- Conditions for quest item +DELETE FROM `conditions` WHERE `SourceEntry` IN (28547) AND `ConditionValue2` IN (18881,18865); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(18,0,28547,0,24,1,18881,0,0,"","Item Elemental Power Extractor can only be used if target is Sundered Rumbler"), +(18,0,28547,0,24,1,18865,0,0,"","Item Elemental Power Extractor can only be used if target is Warp Aberration"); diff --git a/sql/updates/world/2011_10_23_07_world_creature_templates.sql b/sql/updates/world/2011_10_23_07_world_creature_templates.sql new file mode 100644 index 00000000000..08d1d0a0ec1 --- /dev/null +++ b/sql/updates/world/2011_10_23_07_world_creature_templates.sql @@ -0,0 +1,98 @@ +-- Random Stormwind NPC's +-- Template updates +UPDATE `creature_template` SET `minlevel`=60,`maxlevel`=60,`unit_flags`=`unit_flags`|33555200,`speed_walk`=1,`speed_run`=1.14286 WHERE `entry`=37574; -- [DND] Shaker - Small +UPDATE `creature_template` SET `minlevel`=60,`maxlevel`=60,`unit_flags`=`unit_flags`|33555200,`speed_walk`=1,`speed_run`=1.14286 WHERE `entry`=37543; -- [DND] Shaker +UPDATE `creature_template` SET `speed_run`=1.14286 WHERE `entry`=68; -- Stormwind City Guard +UPDATE `creature_template` SET `speed_run`=1.14286 WHERE `entry`=4075; -- Rat +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|32768 WHERE `entry`=29093; -- Ian Drake +UPDATE `creature_template` SET `npcflag`=`npcflag`|17 WHERE `entry`=11867; -- Woo Ping + +-- Model data 1436 (creature 2456 (Newton Burnside)) +UPDATE `creature_model_info` SET `bounding_radius`=0.306,`combat_reach`=0,`gender`=0 WHERE `modelid` IN (1436 -- Newton Burnside +,1437 -- John Burnside +,1434 -- Thurman Mullby +,1431 -- Keldric Boucher +,5082 -- Morgan Pestle +,2974 -- Aldwin Laughlin +,5547 -- Ben Trias +,3246 -- Elling Trias +,3167 -- Stormwind City Guard +,25901 -- Ian Drake +,5074 -- Renato Gallina +,7991 -- Auctioneer Chilton +,7992 -- Auctioneer Fitch +,5567 -- Melris Malagan +,1525 -- Crier Goodman +,1541 -- Thomas Miller +,5551 -- Harlan Bagley +,1429 -- Gunther Weller +,11804 -- Woo Ping +,1433 -- Roberto Pupellyverbos +,1427 -- Frederick Stover +,1438); -- Topper McNabb +UPDATE `creature_model_info` SET `bounding_radius`=0.208,`combat_reach`=0,`gender`=1 WHERE `modelid` IN (5545 -- Suzetta Gallina +,5444 -- Innkeeper Allison +,1446 -- Lina Stover +,1448 -- Marda Weller +,1443 -- Julia Gallina +,1440 -- Edna Mullby +,1445 -- Lara Moore +,1439 -- Carla Granger +,5446 -- Justine Demalier +,5446 -- Stormwind City Guard +,15594 -- Auctioneer Jaxon +,4888 -- Stephanie Turner +,1450 -- Olivia Burnside +,5546 -- Elaine Trias +,3133 -- Rebecca Laughlin +,1444); -- Kyra Boucher +UPDATE `creature_model_info` SET `bounding_radius`=0.25,`combat_reach`=0,`gender`=2 WHERE `modelid`=5585; -- Fuzz +UPDATE `creature_model_info` SET `bounding_radius`=1,`combat_reach`=0,`gender`=2 WHERE `modelid` IN (1141,1418); -- Rat +UPDATE `creature_model_info` SET `bounding_radius`=0.075,`combat_reach`=0,`gender`=2 WHERE `modelid`=24719; -- [DND] Shaker - Small +-- Addon data +UPDATE `creature_template_addon` SET `bytes1`=0,`bytes2`=257,`mount`=0,`emote`=0,`auras`=NULL WHERE `entry` IN +(2456 -- Newton Burnside +,2457 -- John Burnside +,1285 -- Thurman Mullby +,1286 -- Edna Mullby +,1257 -- Keldric Boucher +,1275 -- Kyra Boucher +,279 -- Morgan Pestle +,5193 -- Rebecca Laughlin +,4974 -- Aldwin Laughlin +,4981 -- Ben Trias +,2455 -- Olivia Burnside +,483 -- Elaine Trias +,482 -- Elling Trias +,68 -- Stormwind City Guard +,1432 -- Renato Gallina +,6174 -- Stephanie Turner +,8670 -- Auctioneer Chilton +,15659 -- Auctioneer Jaxon +,8719 -- Auctioneer Fitch +,12480 -- Melris Malagan +,12481 -- Justine Demalier +,2198 -- Crier Goodman +,3518 -- Thomas Miller +,1976 -- Stormwind City Patroller +,1291 -- Carla Granger +,1427 -- Harlan Bagley +,1295 -- Lara Moore +,1289 -- Gunther Weller +,11867 -- Woo Ping +,6740 -- Innkeeper Allison +,1402 -- Topper McNabb +,1287 -- Marda Weller +,1301 -- Julia Gallina +,277 -- Roberto Pupellyverbos +,1431); -- Suzetta Gallina + +-- Frederick Stover +-- Lina Stover +UPDATE `creature_template_addon` SET `bytes1`=0,`bytes2`=258,`mount`=0,`emote`=0,`auras`=NULL WHERE `entry` IN (1297,1298); +DELETE FROM `creature_template_addon` WHERE `entry` IN (37574,37543,29093,25058); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(37574,0,0,1,0, NULL), -- [DND] Shaker - Small +(37543,0,0,1,0, NULL), -- [DND] Shaker +(29093,0,0,257,0, NULL), -- Ian Drake +(25058,0,3,1,0, NULL); -- Fuzz diff --git a/sql/updates/world/2011_10_23_07_world_sai.sql b/sql/updates/world/2011_10_23_07_world_sai.sql new file mode 100644 index 00000000000..7853b6eb411 --- /dev/null +++ b/sql/updates/world/2011_10_23_07_world_sai.sql @@ -0,0 +1,53 @@ +-- [Q] The Dwarven Spy +SET @ENTRY := 15420; +SET @GOSSIP := 21310; + +-- Waypoints +DELETE FROM `script_waypoint` WHERE `entry`=@ENTRY; +DELETE FROM `waypoints` WHERE `entry`=@ENTRY; +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@ENTRY,1,9294.78,-6682.51,22.42,'Prospector Anvilward'), +(@ENTRY,2,9298.27,-6667.99,22.42,'Prospector Anvilward'), +(@ENTRY,3,9309.63,-6658.84,22.42,'Prospector Anvilward'), +(@ENTRY,4,9304.43,-6649.31,26.46,'Prospector Anvilward'), +(@ENTRY,5,9298.83,-6648,28.61,'Prospector Anvilward'), +(@ENTRY,6,9291.06,-6653.46,31.83,'Prospector Anvilward'), +(@ENTRY,7,9289.08,-6660.17,31.83,'Prospector Anvilward'); + +-- Prospector Anvilward SAI +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='',`gossip_menu_id`=@GOSSIP WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,1,62,0,100,0,@GOSSIP+1,0,0,0,53,0,@ENTRY,0,0,0,2,1,0,0,0,0,0,0,0,'Prospector Anvilward - On Gossip Select - Start WP'), +(@ENTRY,0,1,2,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Prospector Anvilward - On Gossip Select - Start WP'), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,83,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Prospector Anvilward - On Gossip Select - Remove npcflag'), +(@ENTRY,0,3,0,40,0,100,0,1,@ENTRY,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Prospector Anvilward - On WP 1 - Say Line 0'), +(@ENTRY,0,4,5,40,0,100,0,6,@ENTRY,0,0,54,2500,0,0,0,0,0,1,0,0,0,0,0,0,0,'Prospector Anvilward - On WP 6 - Pause Path'), +(@ENTRY,0,5,0,61,0,100,0,0,0,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,'Prospector Anvilward - On WP 6 - Say Line 1'), +(@ENTRY,0,6,7,40,0,100,0,7,@ENTRY,0,0,54,15000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Prospector Anvilward - On WP 7 - Pause Path'), +(@ENTRY,0,7,0,61,0,100,0,0,0,0,0,2,24,0,0,0,0,0,1,0,0,0,0,0,0,0,'Prospector Anvilward - On WP 7 - Set Faction'), +(@ENTRY,0,8,0,1,0,100,1,10000,10000,24000,29000,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,"Prospector Anvilward - Out of Combat - Say Line 2"); + +-- Texts +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@ENTRY,0,0,"Very well. Let's see what you have to show me, $N.",12,1,100,0,0,0,'Prospector Anvilward'), +(@ENTRY,1,0,"What manner of trick is this, $r? If you seek to ambush me, I warn you I will not go down quietly!",12,1,100,0,0,0,'Prospector Anvilward'), +(@ENTRY,2,0,"These arcane sanctums of yours are quite... interesting, Mr. Caidanis. I appreciate the information you have given me today.",12,0,100,1,0,0,'Prospector Anvilward'); + +-- This one was missing.. +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP AND `text_id`=8239; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP,8239); +DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP+1 AND `text_id`=8240; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP+1,8240); + +-- Insert menu options +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (@GOSSIP+0,@GOSSIP+1); +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +(@GOSSIP+0,0,0,"I need a moment of your time, sir.",1,1,@GOSSIP+1), +(@GOSSIP+1,0,0,"Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward.",1,1,0); + +-- Conditions for gossip menu of quest The Dwarven Spy +DELETE FROM `conditions` WHERE `SourceGroup`=@GOSSIP+0 AND `ConditionValue1`=8483; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@GOSSIP+0,0,0,9,8483,0,0,0,'',"Only show first gossip if player is on quest The Dwarven Spy"); diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 1b0800e48ae..7b2ad044eb9 100755 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -27,6 +27,7 @@ #include "AuthSocket.h" #include "AuthCodes.h" #include "SHA1.h" +#include "openssl/crypto.h" #define ChunkSize 2048 diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index 0dc597e98bc..cb6158e94eb 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -88,6 +88,7 @@ class BIH { if (primitives.empty()) return; + buildData dat; dat.maxPrims = leafSize; dat.numPrims = primitives.size(); diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index 55aad9bb029..118ae098c25 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -362,6 +362,7 @@ namespace VMAP { if (triangles.empty()) return false; + GModelRayCallback callback(triangles, vertices); meshTree.intersectRay(ray, callback, distance, stopAtFirstHit); return callback.hit; @@ -470,6 +471,7 @@ namespace VMAP { if (groupModels.empty()) return false; + WModelAreaCallback callback(groupModels, down); groupTree.intersectPoint(p, callback); if (callback.hit != groupModels.end()) @@ -488,6 +490,7 @@ namespace VMAP { if (groupModels.empty()) return false; + WModelAreaCallback callback(groupModels, down); groupTree.intersectPoint(p, callback); if (callback.hit != groupModels.end()) diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 62d7a1f4f58..be0dd8c3679 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1177,9 +1177,8 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 target, Unit* actionInvoker Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) { - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* unit = NULL; @@ -1199,9 +1198,8 @@ Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range) { - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::FriendlyCCedInRange u_check(me, range); @@ -1209,14 +1207,13 @@ void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range) TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); - cell.Visit(p, grid_creature_searcher, *me->GetMap()); + cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range); } void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid) { - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid); @@ -1224,7 +1221,7 @@ void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, flo TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); - cell.Visit(p, grid_creature_searcher, *me->GetMap()); + cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range); } // ********************************* diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 2322e88d105..953bbf7521a 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -363,16 +363,15 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float minimumRange) { Player* player = NULL; - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::PlayerAtMinimumRangeAway check(me, minimumRange); Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(me, player, check); TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher); - cell.Visit(pair, visitor, *(me->GetMap())); + cell.Visit(pair, visitor, *me->GetMap(), *me, minimumRange); return player; } diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index f210f077fdd..06c1570ccd9 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -218,7 +218,7 @@ void npc_escortAI::UpdateAI(uint32 const diff) if (m_bCanReturnToStart) { float fRetX, fRetY, fRetZ; - me->GetRespawnCoord(fRetX, fRetY, fRetZ); + me->GetRespawnPosition(fRetX, fRetY, fRetZ); me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 54c69080c41..143cb1f0ec1 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2877,10 +2877,11 @@ uint32 SmartScript::DoChat(int8 id, uint64 whisperGuid) Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) { - if (!me) return NULL; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + if (!me) + return NULL; + + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* unit = NULL; @@ -2896,10 +2897,11 @@ Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range) { - if (!me) return; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + if (!me) + return; + + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::FriendlyCCedInRange u_check(me, range); @@ -2907,15 +2909,16 @@ void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range) TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); - cell.Visit(p, grid_creature_searcher, *me->GetMap()); + cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range); } void SmartScript::DoFindFriendlyMissingBuff(std::list<Creature*>& list, float range, uint32 spellid) { - if (!me) return; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + if (!me) + return; + + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid); @@ -2923,7 +2926,7 @@ void SmartScript::DoFindFriendlyMissingBuff(std::list<Creature*>& list, float ra TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); - cell.Visit(p, grid_creature_searcher, *me->GetMap()); + cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range); } void SmartScript::SetScript9(SmartScriptHolder& e, uint32 entry) diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index aa4eeb602c0..03d04f4b3df 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -155,33 +155,31 @@ class SmartScript { GameObject* gameObject = NULL; - CellPair p(Trinity::ComputeCellPair(searchObject->GetPositionX(), searchObject->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::GameObjectWithDbGUIDCheck goCheck(*searchObject, guid); Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(searchObject, gameObject, goCheck); TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker); - cell.Visit(p, objectChecker, *searchObject->GetMap()); + cell.Visit(p, objectChecker, *searchObject->GetMap(), *searchObject, searchObject->GetGridActivationRange()); return gameObject; } Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const { - Creature* crea = NULL; - CellPair p(Trinity::ComputeCellPair(searchObject->GetPositionX(), searchObject->GetPositionY())); + Creature* creature = NULL; + CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::CreatureWithDbGUIDCheck target_check(searchObject, guid); - Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(searchObject, crea, target_check); + Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(searchObject, creature, target_check); TypeContainerVisitor<Trinity::CreatureSearcher <Trinity::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker); - cell.Visit(p, unit_checker, *searchObject->GetMap()); + cell.Visit(p, unit_checker, *searchObject->GetMap(), *searchObject, searchObject->GetGridActivationRange()); - return crea; + return creature; } ObjectListMap* mTargetStorage; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index fca4df12587..30f66925060 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -666,10 +666,9 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) // if player is in world he can tell his friends about new achievement else if (GetPlayer()->IsInWorld()) { - CellPair p = Trinity::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED, achievement->ID); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 339f2ebba3b..38fa2643601 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -437,7 +437,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) { m_Events |= BG_STARTING_EVENT_1; - if(!FindBgMap()) + if (!FindBgMap()) { sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID); EndNow(); diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index 10bff57a251..6b19c23ca68 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -103,6 +103,7 @@ class BattlegroundQueue class SelectionPool { public: + SelectionPool(): PlayerCount(0) {}; void Init(); bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount); bool KickGroup(uint32 size); diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 8d03530c7f9..7d6e9f7a004 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -1224,7 +1224,7 @@ GameObject* ChatHandler::GetNearbyGameObject() GameObject* obj = NULL; Trinity::NearestGameObjectCheck check(*pl); Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectCheck> searcher(pl, obj, check); - pl->VisitNearbyGridObject(999, searcher); + pl->VisitNearbyGridObject(SIZE_OF_GRIDS, searcher); return obj; } @@ -1240,15 +1240,14 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object { // search near player then - CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::GameObjectWithDbGUIDCheck go_check(*pl, lowguid); Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(pl, obj, go_check); TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); - cell.Visit(p, object_checker, *pl->GetMap()); + cell.Visit(p, object_checker, *pl->GetMap(), *pl, pl->GetGridActivationRange()); } return obj; diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index e76cbfcc76b..9dda89a6972 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -1859,6 +1859,12 @@ bool ChatHandler::HandleDamageCommand(const char * args) return false; } + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (HasLowerSecurity((Player*)target, 0, false)) + return false; + } + if (!target->isAlive()) return true; @@ -2671,7 +2677,7 @@ bool ChatHandler::HandleResetAllCommand(const char * args) CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'", atLogin, atLogin); - ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true); + ACE_READ_GUARD_RETURN(HashMapHolder<Player>::LockType, guard, *HashMapHolder<Player>::GetLock(), true); HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) itr->second->SetAtLoginFlag(atLogin); @@ -3470,16 +3476,15 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/) return true; } - CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::RespawnDo u_do; Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(pl, u_do); TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker); - cell.Visit(p, obj_worker, *pl->GetMap()); + cell.Visit(p, obj_worker, *pl->GetMap(), *pl, pl->GetGridActivationRange()); return true; } diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index cdd5d61b1c9..31cc21659c9 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -95,7 +95,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) SetFloatValue(OBJECT_FIELD_SCALE_X, 1); SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID()); - m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); + _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); return true; } @@ -211,7 +211,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field* fields) return false; } - m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); + _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); return true; } diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index bd68eb688f5..2e45606b88f 100755 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -70,8 +70,8 @@ class Corpse : public WorldObject, public GridObject<Corpse> void ResetGhostTime() { m_time = time(NULL); } CorpseType GetType() const { return m_type; } - GridPair const& GetGrid() const { return m_grid; } - void SetGrid(GridPair const& grid) { m_grid = grid; } + GridCoord const& GetGridCoord() const { return _gridCoord; } + void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; } Loot loot; // remove insignia ONLY at BG Player* lootRecipient; @@ -88,7 +88,7 @@ class Corpse : public WorldObject, public GridObject<Corpse> private: CorpseType m_type; time_t m_time; - GridPair m_grid; // gride for corpse position for fast search + GridCoord _gridCoord; // gride for corpse position for fast search }; #endif diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 833fcd44554..3d6eaf1a198 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -137,14 +137,13 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) return true; } -Creature::Creature(): Unit(), +Creature::Creature(): Unit(), MapCreature(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootMoney(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL), -MapCreature() +m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; @@ -246,7 +245,7 @@ void Creature::RemoveCorpse(bool setSpawnTime) m_respawnTime = time(NULL) + respawnDelay; float x, y, z, o; - GetRespawnCoord(x, y, z, &o); + GetRespawnPosition(x, y, z, &o); SetHomePosition(x, y, z, o); GetMap()->CreatureRelocation(this, x, y, z, o); } @@ -660,9 +659,8 @@ void Creature::DoFleeToGetAssistance() { Creature* creature = NULL; - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this, getVictim(), radius); Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, creature, u_check); @@ -1761,9 +1759,8 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim) // select nearest hostile unit within the given distance (regardless of threat list). Unit* Creature::SelectNearestTarget(float dist) const { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* target = NULL; @@ -1788,9 +1785,8 @@ Unit* Creature::SelectNearestTarget(float dist) const // select nearest hostile unit within the given attack distance (i.e. distance is ignored if > than ATTACK_DISTANCE), regardless of threat list. Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* target = NULL; @@ -1851,9 +1847,8 @@ void Creature::CallAssistance() std::list<Creature*> assistList; { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); @@ -1879,22 +1874,21 @@ void Creature::CallAssistance() } } -void Creature::CallForHelp(float fRadius) +void Creature::CallForHelp(float radius) { - if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed()) + if (radius <= 0.0f || !getVictim() || isPet() || isCharmed()) return; - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); + Trinity::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), radius); Trinity::CreatureWorker<Trinity::CallOfHelpCreatureInRangeDo> worker(this, u_do); TypeContainerVisitor<Trinity::CreatureWorker<Trinity::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker); - cell.Visit(p, grid_creature_searcher, *GetMap(), *this, fRadius); + cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius); } bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const @@ -2206,7 +2200,7 @@ time_t Creature::GetRespawnTimeEx() const return now; } -void Creature::GetRespawnCoord(float &x, float &y, float &z, float* ori, float* dist) const +void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, float* dist) const { if (m_DBTableGuid) { diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 5a3c80234d8..9f5d8ec202e 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -456,7 +456,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } void Update(uint32 time); // overwrited Unit::Update - void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; + void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 2f353285806..a894ee16c2d 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -16,26 +16,14 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" -#include "QuestDef.h" #include "GameObjectAI.h" #include "ObjectMgr.h" #include "GroupMgr.h" #include "PoolMgr.h" #include "SpellMgr.h" -#include "Spell.h" -#include "UpdateMask.h" -#include "Opcodes.h" -#include "WorldPacket.h" #include "World.h" -#include "DatabaseEnv.h" -#include "LootMgr.h" -#include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" -#include "InstanceScript.h" -#include "Battleground.h" -#include "Util.h" #include "OutdoorPvPMgr.h" #include "BattlegroundAV.h" #include "ScriptMgr.h" @@ -73,15 +61,21 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue), m_AI(N GameObject::~GameObject() { delete m_goValue; + delete m_AI; //if (m_uint32Values) // field array can be not exist if GameOBject not loaded // CleanupsBeforeDelete(); } bool GameObject::AIM_Initialize() { + if (m_AI) + delete m_AI; m_AI = FactorySelector::SelectGameObjectAI(this); - if (!m_AI) return false; + + if (!m_AI) + return false; + m_AI->InitializeAI(); return true; } @@ -608,10 +602,12 @@ void GameObject::Delete() { SetLootState(GO_NOT_READY); if (GetOwnerGUID()) + { if (Unit* owner = GetOwner()) owner->RemoveGameObject(this, false); else //! Owner not in world anymore SetOwnerGUID(0); + } ASSERT (!GetOwnerGUID()); SendObjectDeSpawnAnim(GetGUID()); @@ -935,9 +931,8 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) GameObject* trapGO = NULL; { // using original GO distance - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::NearestGameObjectEntryInObjectRangeCheck go_check(*target, trapEntry, range); Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> checker(this, trapGO, go_check); @@ -955,9 +950,8 @@ GameObject* GameObject::LookupFishingHoleAround(float range) { GameObject* ok = NULL; - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::NearestGameObjectFishingHole u_check(*this, range); Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole> checker(this, ok, u_check); @@ -1539,12 +1533,11 @@ void GameObject::Use(Unit* user) { case 179785: // Silverwing Flag case 179786: // Warsong Flag - // check if it's correct bg - if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_WS) + if (bg->GetTypeID(true) == BATTLEGROUND_WS) bg->EventPlayerClickedOnFlag(player, this); break; case 184142: // Netherstorm Flag - if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_EY) + if (bg->GetTypeID(true) == BATTLEGROUND_EY) bg->EventPlayerClickedOnFlag(player, this); break; } diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index d3832ad9151..07275166130 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1194,25 +1194,23 @@ bool Item::IsRefundExpired() return (GetPlayedTime() > 2*HOUR); } -void Item::SetSoulboundTradeable(AllowedLooterSet* allowedLooters, Player* currentOwner, bool apply) +void Item::SetSoulboundTradeable(AllowedLooterSet& allowedLooters) { - if (apply) - { - SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); - allowedGUIDs = *allowedLooters; - } - else - { - RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); - if (allowedGUIDs.empty()) - return; + SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); + allowedGUIDs = allowedLooters; +} - allowedGUIDs.clear(); - SetState(ITEM_CHANGED, currentOwner); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_BOP_TRADE); - stmt->setUInt32(0, GetGUIDLow()); - CharacterDatabase.Execute(stmt); - } +void Item::ClearSoulboundTradeable(Player* currentOwner) +{ + RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); + if (allowedGUIDs.empty()) + return; + + allowedGUIDs.clear(); + SetState(ITEM_CHANGED, currentOwner); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_BOP_TRADE); + stmt->setUInt32(0, GetGUIDLow()); + CharacterDatabase.Execute(stmt); } bool Item::CheckSoulboundTradeExpire() @@ -1220,7 +1218,7 @@ bool Item::CheckSoulboundTradeExpire() // called from owner's update - GetOwner() MUST be valid if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2*HOUR < GetOwner()->GetTotalPlayedTime()) { - SetSoulboundTradeable(NULL, GetOwner(), false); + ClearSoulboundTradeable(GetOwner()); return true; // remove from tradeable list } diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index b872b354ea7..4a72e7fea2b 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -352,7 +352,8 @@ class Item : public Object bool IsRefundExpired(); // Soulbound trade system - void SetSoulboundTradeable(AllowedLooterSet* allowedLooters, Player* currentOwner, bool apply); + void SetSoulboundTradeable(AllowedLooterSet& allowedLooters); + void ClearSoulboundTradeable(Player* currentOwner); bool CheckSoulboundTradeExpire(); void BuildUpdate(UpdateDataMapType&); diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index 155673edbaa..03212c129fd 100755 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -729,7 +729,6 @@ struct ItemTemplate bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; } bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; } bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_PROTO_FLAG_CONJURED); } - }; // Benchmarked: Faster than std::map (insert/find) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index c55892c6f82..3bbe06dd4fb 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1868,10 +1868,9 @@ namespace Trinity void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::MonsterCustomChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, text, language, TargetGuid); @@ -1883,10 +1882,9 @@ void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGui void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId, language, TargetGuid); @@ -1898,10 +1896,9 @@ void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) void WorldObject::MonsterYell(const char* text, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::MonsterCustomChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, text, language, TargetGuid); @@ -1913,10 +1910,9 @@ void WorldObject::MonsterYell(const char* text, uint32 language, uint64 TargetGu void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, TargetGuid); @@ -1948,10 +1944,9 @@ void WorldObject::MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsB void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::MonsterChatBuilder say_build(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, TargetGuid); @@ -2393,32 +2388,30 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const return go; } -void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const +void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const { - CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange); - Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check); + Trinity::AllGameObjectsWithEntryInRange check(this, entry, maxSearchRange); + Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, gameobjectList, check); TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher); - cell.Visit(pair, visitor, *(this->GetMap())); + cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange); } -void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const +void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureList, uint32 entry, float maxSearchRange) const { - CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - Trinity::AllCreaturesOfEntryInRange check(this, uiEntry, fMaxSearchRange); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check); + Trinity::AllCreaturesOfEntryInRange check(this, entry, maxSearchRange); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, creatureList, check); TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher); - cell.Visit(pair, visitor, *(this->GetMap())); + cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange); } /* @@ -2529,9 +2522,8 @@ void WorldObject::GetNearPoint(WorldObject const* /*searcher*/, float &x, float // adding used positions around object { - CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::NearUsedPosDo u_do(*this, searcher, absAngle, selector); @@ -2826,9 +2818,8 @@ struct WorldObjectChangeAccumulator void WorldObject::BuildUpdate(UpdateDataMapType& data_map) { - CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); WorldObjectChangeAccumulator notifier(*this, data_map); TypeContainerVisitor<WorldObjectChangeAccumulator, WorldTypeMapContainer > player_notifier(notifier); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 7bcd785554e..dfcf6a3cfa4 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -793,9 +793,9 @@ class WorldObject : public Object, public WorldLocation bool isActiveObject() const { return m_isActive; } void setActive(bool isActiveObject); void SetWorldObject(bool apply); - template<class NOTIFIER> void VisitNearbyObject(const float &radius, NOTIFIER ¬ifier) const { if (IsInWorld()) GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); } - template<class NOTIFIER> void VisitNearbyGridObject(const float &radius, NOTIFIER ¬ifier) const { if (IsInWorld()) GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); } - template<class NOTIFIER> void VisitNearbyWorldObject(const float &radius, NOTIFIER ¬ifier) const { if (IsInWorld()) GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); } + template<class NOTIFIER> void VisitNearbyObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); } + template<class NOTIFIER> void VisitNearbyGridObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); } + template<class NOTIFIER> void VisitNearbyWorldObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); } #ifdef MAP_BASED_RAND_GEN int32 irand(int32 min, int32 max) const { return int32 (GetMap()->mtRand.randInt(max - min)) + min; } diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h index 09bc0b4cc80..abe3c299062 100755 --- a/src/server/game/Entities/Object/Updates/UpdateMask.h +++ b/src/server/game/Entities/Object/Updates/UpdateMask.h @@ -72,6 +72,9 @@ class UpdateMask UpdateMask& operator = (const UpdateMask& mask) { + if (this == &mask) + return *this; + SetCount(mask.mCount); memcpy(mUpdateMask, mask.mUpdateMask, mBlocks << 2); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 203f52ca7c5..27713586b54 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1148,7 +1148,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) } } - for (PlayerCreateInfoItems::const_iterator item_id_itr = info->item.begin(); item_id_itr != info->item.end(); ++item_id_itr++) + for (PlayerCreateInfoItems::const_iterator item_id_itr = info->item.begin(); item_id_itr != info->item.end(); ++item_id_itr) StoreNewItemInBestSlots(item_id_itr->item_id, item_id_itr->item_amount); // bags and main-hand weapon must equipped at this moment @@ -2456,7 +2456,7 @@ void Player::RegenerateAll() // Runes act as cooldowns, and they don't need to send any data if (getClass() == CLASS_DEATH_KNIGHT) - for (uint32 i = 0; i < MAX_RUNES; ++i) + for (uint8 i = 0; i < MAX_RUNES; ++i) if (uint32 cd = GetRuneCooldown(i)) SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0); @@ -2860,7 +2860,6 @@ void Player::SetGMVisible(bool on) if (on) { m_ExtraFlags &= ~PLAYER_EXTRA_GM_INVISIBLE; //remove flag - m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GM, SEC_PLAYER); } else @@ -5063,7 +5062,7 @@ void Player::BuildPlayerRepop() StopMirrorTimers(); //disable timers(bars) - SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (float)1.0f); //see radius of death player? + SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, float(1.0f)); //see radius of death player? // set and clear other SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); @@ -9533,7 +9532,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) // End Round (timer), better explain this by example, eg. ends in 19:59 -> A:BC data << uint32(0xde9) << uint32(0x0); // 16 3561 C data << uint32(0xde8) << uint32(0x0); // 17 3560 B - data << uint32(0xde7) << uint32(0x0); // 18 3559 A + data << uint32(0xde7) << uint32(0x0); // 18 3559 A data << uint32(0xe35) << uint32(0x0); // 19 3637 East g - Horde control data << uint32(0xe34) << uint32(0x0); // 20 3636 West g - Horde control data << uint32(0xe33) << uint32(0x0); // 21 3635 South g - Horde control @@ -11898,8 +11897,14 @@ void Player::RemoveAmmo() UpdateDamagePhysical(RANGED_ATTACK); } +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& allowedLooters) { uint32 count = 0; for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) @@ -11919,16 +11924,18 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger CastSpell(this, proto->Spells[i].SpellId, true, pItem); - if (allowedLooters && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound()) + if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound()) { - pItem->SetSoulboundTradeable(allowedLooters, this, true); + pItem->SetSoulboundTradeable(allowedLooters); pItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, GetTotalPlayedTime()); m_itemSoulboundTradeable.push_back(pItem); // save data std::ostringstream ss; - for (AllowedLooterSet::iterator itr = allowedLooters->begin(); itr != allowedLooters->end(); ++itr) - ss << *itr << ' '; + AllowedLooterSet::const_iterator itr = allowedLooters.begin(); + ss << *itr; + for (++itr; itr != allowedLooters.end(); ++itr) + ss << ' ' << *itr; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ITEM_BOP_TRADE); stmt->setUInt32(0, pItem->GetGUIDLow()); @@ -12051,7 +12058,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor pItem->SetNotRefundable(this); - pItem->SetSoulboundTradeable(NULL, this, false); + pItem->ClearSoulboundTradeable(this); RemoveTradeableItem(pItem); pItem->SetState(ITEM_REMOVED, this); } @@ -12168,7 +12175,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor pItem->SetNotRefundable(this); - pItem->SetSoulboundTradeable(NULL, this, false); + pItem->ClearSoulboundTradeable(this); RemoveTradeableItem(pItem); pItem->SetState(ITEM_REMOVED, this); pItem2->SetState(ITEM_CHANGED, this); @@ -12388,7 +12395,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) RemoveItemDurations(pItem); pItem->SetNotRefundable(this); - pItem->SetSoulboundTradeable(NULL, this, false); + pItem->ClearSoulboundTradeable(this); RemoveTradeableItem(pItem); const ItemTemplate* proto = pItem->GetTemplate(); @@ -13335,17 +13342,17 @@ void Player::UpdateSoulboundTradeItems() { if (!*itr) { - itr = m_itemSoulboundTradeable.erase(itr++); + m_itemSoulboundTradeable.erase(itr++); continue; } if ((*itr)->GetOwnerGUID() != GetGUID()) { - itr = m_itemSoulboundTradeable.erase(itr++); + m_itemSoulboundTradeable.erase(itr++); continue; } if ((*itr)->CheckSoulboundTradeExpire()) { - itr = m_itemSoulboundTradeable.erase(itr++); + m_itemSoulboundTradeable.erase(itr++); continue; } ++itr; @@ -13591,7 +13598,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool } } } - // Cast custom spell vs all equal basepoints getted from enchant_amount + // Cast custom spell vs all equal basepoints got from enchant_amount if (basepoints) CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item); else @@ -14581,8 +14588,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) if (!qInfo) return false; - RewardedQuestSet::iterator rewItr = m_RewardedQuests.find(quest_id); - if (!qInfo->IsRepeatable() && rewItr != m_RewardedQuests.end()) + if (!qInfo->IsRepeatable() && m_RewardedQuests.find(quest_id) != m_RewardedQuests.end()) return false; // not allow re-complete quest // auto complete quest @@ -14911,8 +14917,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (log_slot < MAX_QUEST_LOG_SIZE) SetQuestSlot(log_slot, 0); - RewardedQuestSet::const_iterator rewItr = m_RewardedQuests.find(quest_id); - bool rewarded = (rewItr != m_RewardedQuests.end()); + bool rewarded = (m_RewardedQuests.find(quest_id) != m_RewardedQuests.end()); // Not give XP in case already completed once repeatable quest uint32 XP = rewarded ? 0 : uint32(quest->XPValue(this)*sWorld->getRate(RATE_XP_QUEST)); @@ -15661,11 +15666,11 @@ void Player::GroupEventHappens(uint32 questId, WorldObject const* pEventObject) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupGuy = itr->getSource(); + Player* player = itr->getSource(); // for any leave or dead (with not released body) group member at appropriate distance - if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(pEventObject) && !pGroupGuy->GetCorpse()) - pGroupGuy->AreaExploredOrEventHappens(questId); + if (player && player->IsAtGroupRewardDistance(pEventObject) && !player->GetCorpse()) + player->AreaExploredOrEventHappens(questId); } } else @@ -17474,7 +17479,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F AllowedLooterSet looters; for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr) looters.insert(atol(*itr)); - item->SetSoulboundTradeable(&looters, this, true); + item->SetSoulboundTradeable(looters); m_itemSoulboundTradeable.push_back(item); } else @@ -19795,7 +19800,7 @@ void Player::RemoveSpellMods(Spell* spell) for (uint8 i=0; i<MAX_SPELLMOD; ++i) { - for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();) + for (SpellModList::const_iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();) { SpellModifier* mod = *itr; ++itr; @@ -19827,8 +19832,7 @@ void Player::DropModCharge(SpellModifier* mod, Spell* spell) if (spell && mod->ownerAura && mod->charges > 0) { - --mod->charges; - if (mod->charges == 0) + if (--mod->charges == 0) mod->charges = -1; spell->m_appliedMods.insert(mod->ownerAura); @@ -21496,7 +21500,7 @@ void Player::SendInitialPacketsBeforeAddToMap() data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4); data << uint32(secsToTimeBitFields(sWorld->GetGameTime())); - data << (float)0.01666667f; // game speed + data << float(0.01666667f); // game speed data << uint32(0); // added in 3.1.2 GetSession()->SendPacket(&data); @@ -21541,7 +21545,7 @@ void Player::SendInitialPacketsAfterAddToMap() if (HasAuraType(SPELL_AURA_MOD_STUN)) SetMovement(MOVE_ROOT); - // manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that don't must be re-applied. + // manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied. if (HasAuraType(SPELL_AURA_MOD_ROOT)) { WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10); @@ -22320,27 +22324,27 @@ bool Player::GetsRecruitAFriendBonus(bool forXP) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupGuy = itr->getSource(); - if (!pGroupGuy) + Player* player = itr->getSource(); + if (!player) continue; - if (!pGroupGuy->IsAtRecruitAFriendDistance(this)) + if (!player->IsAtRecruitAFriendDistance(this)) continue; // member (alive or dead) or his corpse at req. distance if (forXP) { // level must be allowed to get RaF bonus - if (pGroupGuy->getLevel() > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL)) + if (player->getLevel() > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL)) continue; // level difference must be small enough to get RaF bonus, UNLESS we are lower level - if (pGroupGuy->getLevel() < getLevel()) - if (uint8(getLevel() - pGroupGuy->getLevel()) > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE)) + if (player->getLevel() < getLevel()) + if (uint8(getLevel() - player->getLevel()) > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE)) continue; } - bool ARecruitedB = (pGroupGuy->GetSession()->GetRecruiterId() == GetSession()->GetAccountId()); - bool BRecruitedA = (GetSession()->GetRecruiterId() == pGroupGuy->GetSession()->GetAccountId()); + bool ARecruitedB = (player->GetSession()->GetRecruiterId() == GetSession()->GetAccountId()); + bool BRecruitedA = (GetSession()->GetRecruiterId() == player->GetSession()->GetAccountId()); if (ARecruitedB || BRecruitedA) { recruitAFriend = true; @@ -22368,16 +22372,16 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupGuy = itr->getSource(); - if (!pGroupGuy) + Player* player = itr->getSource(); + if (!player) continue; - if (!pGroupGuy->IsAtGroupRewardDistance(pRewardSource)) + if (!player->IsAtGroupRewardDistance(pRewardSource)) continue; // member (alive or dead) or his corpse at req. distance // quest objectives updated only for alive group member or dead but with not released body - if (pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse()) - pGroupGuy->KilledMonsterCredit(creature_id, creature_guid); + if (player->isAlive()|| !player->GetCorpse()) + player->KilledMonsterCredit(creature_id, creature_guid); } } else // if (!group) @@ -22779,10 +22783,6 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const return false; } -// *********************************** -// -------------TRINITY--------------- -// *********************************** - void Player::StopCastingBindSight() { if (WorldObject* target = GetViewpoint()) @@ -23128,7 +23128,7 @@ void Player::InitRunes() m_runes->runeState = 0; m_runes->lastUsedRune = RUNE_BLOOD; - for (uint32 i = 0; i < MAX_RUNES; ++i) + for (uint8 i = 0; i < MAX_RUNES; ++i) { SetBaseRune(i, runeSlotTypes[i]); // init base types SetCurrentRune(i, runeSlotTypes[i]); // init current types @@ -23137,13 +23137,13 @@ void Player::InitRunes() m_runes->SetRuneState(i); } - for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i) + for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i) SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f); } bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const { - for (uint32 i = 0; i < MAX_RUNES; ++i) + for (uint8 i = 0; i < MAX_RUNES; ++i) if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0) return false; @@ -23202,8 +23202,8 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count); if (msg == EQUIP_ERR_OK) { - AllowedLooterSet* looters = item->GetAllowedLooters(); - Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, (looters->size() > 1) ? looters : NULL); + AllowedLooterSet looters = item->GetAllowedLooters(); + Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, looters); if (qitem) { @@ -24716,7 +24716,7 @@ float Player::GetAverageItemLevel() if (m_items[i] && m_items[i]->GetTemplate()) sum += m_items[i]->GetTemplate()->GetItemLevelIncludingQuality(); - count++; + ++count; } return ((float)sum) / count; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a5067a66d55..7d0803a4c8a 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -743,8 +743,8 @@ enum RestType enum DuelCompleteType { DUEL_INTERRUPTED = 0, - DUEL_WON = 1, - DUEL_FLED = 2 + DUEL_WON = 1, + DUEL_FLED = 2 }; enum TeleportToOptions @@ -1269,8 +1269,8 @@ class Player : public Unit, public GridObject<Player> bool HasItemTotemCategory(uint32 TotemCategory) const; InventoryResult CanUseItem(ItemTemplate const* pItem) const; InventoryResult CanUseAmmo(uint32 item) const; - - Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, AllowedLooterSet* allowedLooters = NULL); + 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* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update); Item* EquipNewItem(uint16 pos, uint32 item, bool update); Item* EquipItem(uint16 pos, Item* pItem, bool update); diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 10c54720350..97629e802d4 100755 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -86,9 +86,10 @@ void Totem::InitStats(uint32 duration) void Totem::InitSummon() { - // use AddAura instead of CastSpell - this in fact should be an AddSpell equivalent for creatures, but nothing like that exists so far. if (m_type == TOTEM_PASSIVE) - AddAura(GetSpell(), this); + { + CastSpell(this, GetSpell(), true); + } // Some totems can have both instant effect and passive spell if (GetSpell(1)) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6439229de9c..c88f18d9131 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4425,14 +4425,26 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const { + std::map<SpellGroup, int32> SameEffectSpellGroup; float multiplier = 1.0f; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if ((*i)->GetMiscValue()& misc_mask) - AddPctN(multiplier, (*i)->GetAmount()); + if (((*i)->GetMiscValue() & misc_mask)) + { + // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup + // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual + if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) + AddPctN(multiplier, (*i)->GetAmount()); + } + } + // Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier + for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) + { + AddPctN(multiplier, itr->second); } + return multiplier; } @@ -10599,11 +10611,6 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); } break; - // Ebon Plague - case 1933: - if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - break; } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index d35298b9963..064542bb013 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1503,6 +1503,20 @@ class Unit : public WorldObject } virtual uint32 GetShieldBlockValue() const =0; + uint32 GetShieldBlockValue(uint32 soft_cap, uint32 hard_cap) const + { + uint32 value = GetShieldBlockValue(); + if (value >= hard_cap) + { + value = (soft_cap + hard_cap) / 2; + } + else if (value > soft_cap) + { + value = soft_cap + ((value - soft_cap) / 2); + } + + return value; + } uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } uint32 GetDefenseSkillValue(Unit const* target = NULL) const; uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const; diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index cb42b898406..2570e50c55a 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1172,7 +1172,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // Spawn if necessary (loaded grids only) Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid)); // We use spawn coords to spawn - if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) + if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { Creature* creature = new Creature; //sLog->outDebug("Spawning creature %u", *itr); @@ -1201,7 +1201,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // this base map checked as non-instanced and then only existed Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid - if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) + if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { GameObject* pGameobject = new GameObject; //sLog->outDebug("Spawning gameobject %u", *itr); diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index f98702d4393..84d27efc8d9 100755 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -165,9 +165,9 @@ Unit* ObjectAccessor::FindUnit(uint64 guid) Player* ObjectAccessor::FindPlayerByName(const char* name) { - ACE_GUARD_RETURN(LockType, g, *HashMapHolder<Player>::GetLock(), NULL); - HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer(); - for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter) + ACE_READ_GUARD_RETURN(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock(), NULL); + HashMapHolder<Player>::MapType const& m = GetPlayers(); + for (HashMapHolder<Player>::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->second->IsInWorld() && strcmp(name, iter->second->GetName()) == 0) return iter->second; @@ -176,9 +176,9 @@ Player* ObjectAccessor::FindPlayerByName(const char* name) void ObjectAccessor::SaveAllPlayers() { - ACE_GUARD(LockType, g, *HashMapHolder<Player>::GetLock()); - HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer(); - for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr) + ACE_READ_GUARD(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock()); + HashMapHolder<Player>::MapType const& m = GetPlayers(); + for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) itr->second->SaveToDB(); } @@ -216,8 +216,8 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse) return; // build mapid*cellid -> guid_set map - CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); - uint32 cell_id = (cell_pair.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); + uint32 cell_id = (cellCoord.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID())); @@ -237,20 +237,20 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) i_player2corpse[corpse->GetOwnerGUID()] = corpse; // build mapid*cellid -> guid_set map - CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); - uint32 cell_id = (cell_pair.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); + uint32 cell_id = (cellCoord.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId()); } } -void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map) +void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map) { ACE_GUARD(LockType, g, i_corpseGuard); for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter) { - if (iter->second->GetGrid() == gridpair) + if (iter->second->GetGridCoord() == gridpair) { // verify, if the corpse in our instance (add only corpses which are) if (map->Instanceable()) @@ -301,7 +301,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type bones->SetUInt32Value(i, corpse->GetUInt32Value(i)); - bones->SetGrid(corpse->GetGrid()); + bones->SetGridCoord(corpse->GetGridCoord()); // bones->m_time = m_time; // don't overwrite time // bones->m_type = m_type; // don't overwrite type bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation()); @@ -380,7 +380,7 @@ void ObjectAccessor::UnloadAll() /// Define the static members of HashMapHolder template <class T> UNORDERED_MAP< uint64, T* > HashMapHolder<T>::m_objectMap; -template <class T> ACE_Thread_Mutex HashMapHolder<T>::i_lock; +template <class T> typename HashMapHolder<T>::LockType HashMapHolder<T>::i_lock; /// Global definitions for the hashmap storage diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index a9be8b4971f..ae88ae3673f 100755 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -48,23 +48,23 @@ class HashMapHolder public: typedef UNORDERED_MAP<uint64, T*> MapType; - typedef ACE_Thread_Mutex LockType; + typedef ACE_RW_Thread_Mutex LockType; static void Insert(T* o) { - ACE_GUARD(LockType, Guard, i_lock); + ACE_WRITE_GUARD(LockType, Guard, i_lock); m_objectMap[o->GetGUID()] = o; } static void Remove(T* o) { - ACE_GUARD(LockType, Guard, i_lock); + ACE_WRITE_GUARD(LockType, Guard, i_lock); m_objectMap.erase(o->GetGUID()); } static T* Find(uint64 guid) { - ACE_GUARD_RETURN(LockType, Guard, i_lock, NULL); + ACE_READ_GUARD_RETURN(LockType, Guard, i_lock, NULL); typename MapType::iterator itr = m_objectMap.find(guid); return (itr != m_objectMap.end()) ? itr->second : NULL; } @@ -155,15 +155,15 @@ class ObjectAccessor if (!obj || obj->GetMapId() != mapid) return NULL; - CellPair p = Trinity::ComputeCellPair(x, y); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord p = Trinity::ComputeCellCoord(x, y); + if (!p.IsCoordValid()) { sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); return NULL; } - CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); + if (!q.IsCoordValid()) { sLog->outError("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; @@ -198,22 +198,22 @@ class ObjectAccessor Player* FindPlayerByName(const char* name); // when using this, you must use the hashmapholder's lock - HashMapHolder<Player>::MapType& GetPlayers() + HashMapHolder<Player>::MapType const& GetPlayers() const { return HashMapHolder<Player>::GetContainer(); } // when using this, you must use the hashmapholder's lock - HashMapHolder<Creature>::MapType& GetCreatures() - { - return HashMapHolder<Creature>::GetContainer(); - } + //HashMapHolder<Creature>::MapType& GetCreatures() + //{ + // return HashMapHolder<Creature>::GetContainer(); + //} - // when using this, you must use the hashmapholder's lock - HashMapHolder<GameObject>::MapType& GetGameObjects() - { - return HashMapHolder<GameObject>::GetContainer(); - } + //// when using this, you must use the hashmapholder's lock + //HashMapHolder<GameObject>::MapType& GetGameObjects() + //{ + // return HashMapHolder<GameObject>::GetContainer(); + //} template<class T> void AddObject(T* object) { @@ -250,7 +250,7 @@ class ObjectAccessor Corpse* GetCorpseForPlayerGUID(uint64 guid); void RemoveCorpse(Corpse* corpse); void AddCorpse(Corpse* corpse); - void AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map); + void AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map); Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false); void RemoveOldCorpses(); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ae7e2d57991..e1ff0821bf8 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1568,8 +1568,8 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.creatures.insert(guid); @@ -1584,8 +1584,8 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data) { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.creatures.erase(guid); @@ -1627,7 +1627,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float // Spawn if necessary (loaded grids only) // We use spawn coords to spawn - if (!map->Instanceable() && map->IsLoaded(x, y)) + if (!map->Instanceable() && map->IsGridLoaded(x, y)) { GameObject* go = new GameObject; if (!go->LoadFromDB(guid, map)) @@ -1663,7 +1663,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) if (Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(mapId))) { // We use spawn coords to spawn - if (!map->Instanceable() && map->IsLoaded(data.posX, data.posY)) + if (!map->Instanceable() && map->IsGridLoaded(data.posX, data.posY)) { Creature* creature = new Creature; if (!creature->LoadFromDB(guid, map)) @@ -1880,8 +1880,8 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.gameobjects.insert(guid); @@ -1896,8 +1896,8 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data { if (mask & 1) { - CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid, i)][cell_id]; cell_guids.gameobjects.erase(guid); diff --git a/src/server/game/Grids/Cells/Cell.h b/src/server/game/Grids/Cells/Cell.h index a7fd879358e..13bb0afc494 100755 --- a/src/server/game/Grids/Cells/Cell.h +++ b/src/server/game/Grids/Cells/Cell.h @@ -29,87 +29,34 @@ class Map; class WorldObject; -enum District -{ - UPPER_DISTRICT = 1, - LOWER_DISTRICT = 1 << 1, - LEFT_DISTRICT = 1 << 2, - RIGHT_DISTRICT = 1 << 3, - CENTER_DISTRICT = 1 << 4, - UPPER_LEFT_DISTRICT = (UPPER_DISTRICT | LEFT_DISTRICT), - UPPER_RIGHT_DISTRICT = (UPPER_DISTRICT | RIGHT_DISTRICT), - LOWER_LEFT_DISTRICT = (LOWER_DISTRICT | LEFT_DISTRICT), - LOWER_RIGHT_DISTRICT = (LOWER_DISTRICT | RIGHT_DISTRICT), - ALL_DISTRICT = (UPPER_DISTRICT | LOWER_DISTRICT | LEFT_DISTRICT | RIGHT_DISTRICT | CENTER_DISTRICT) -}; - struct CellArea { - CellArea() : right_offset(0), left_offset(0), upper_offset(0), lower_offset(0) {} - CellArea(int right, int left, int upper, int lower) : right_offset(right), left_offset(left), upper_offset(upper), lower_offset(lower) {} - bool operator!() const { return !right_offset && !left_offset && !upper_offset && !lower_offset; } + CellArea() {} + CellArea(CellCoord low, CellCoord high) : low_bound(low), high_bound(high) {} + + bool operator!() const { return low_bound == high_bound; } - void ResizeBorders(CellPair& begin_cell, CellPair& end_cell) const + void ResizeBorders(CellCoord& begin_cell, CellCoord& end_cell) const { - begin_cell << left_offset; - begin_cell -= lower_offset; - end_cell >> right_offset; - end_cell += upper_offset; + begin_cell = low_bound; + end_cell = high_bound; } - int right_offset; - int left_offset; - int upper_offset; - int lower_offset; + CellCoord low_bound; + CellCoord high_bound; }; struct Cell { Cell() { data.All = 0; } - Cell(const Cell &cell) { data.All = cell.data.All; } - explicit Cell(CellPair const& p); - - void operator|=(Cell &cell) - { - data.Part.reserved = 0; - cell.data.Part.reserved = 0; - uint32 x, y, old_x, old_y; - Compute(x, y); - cell.Compute(old_x, old_y); - - if (std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1) - { - data.Part.reserved = ALL_DISTRICT; - cell.data.Part.reserved = ALL_DISTRICT; - return; - } - - if (x < old_x) - { - data.Part.reserved |= LEFT_DISTRICT; - cell.data.Part.reserved |= RIGHT_DISTRICT; - } - else if (old_x < x) - { - data.Part.reserved |= RIGHT_DISTRICT; - cell.data.Part.reserved |= LEFT_DISTRICT; - } - if (y < old_y) - { - data.Part.reserved |= UPPER_DISTRICT; - cell.data.Part.reserved |= LOWER_DISTRICT; - } - else if (old_y < y) - { - data.Part.reserved |= LOWER_DISTRICT; - cell.data.Part.reserved |= UPPER_DISTRICT; - } - } + Cell(Cell const& cell) { data.All = cell.data.All; } + explicit Cell(CellCoord const& p); + explicit Cell(float x, float y); void Compute(uint32 &x, uint32 &y) const { - x = data.Part.grid_x*MAX_NUMBER_OF_CELLS + data.Part.cell_x; - y = data.Part.grid_y*MAX_NUMBER_OF_CELLS + data.Part.cell_y; + x = data.Part.grid_x * MAX_NUMBER_OF_CELLS + data.Part.cell_x; + y = data.Part.grid_y * MAX_NUMBER_OF_CELLS + data.Part.cell_y; } bool DiffCell(const Cell &cell) const @@ -131,21 +78,21 @@ struct Cell bool NoCreate() const { return data.Part.nocreate; } void SetNoCreate() { data.Part.nocreate = 1; } - CellPair cellPair() const + CellCoord GetCellCoord() const { - return CellPair( - data.Part.grid_x*MAX_NUMBER_OF_CELLS+data.Part.cell_x, - data.Part.grid_y*MAX_NUMBER_OF_CELLS+data.Part.cell_y); + return CellCoord( + data.Part.grid_x * MAX_NUMBER_OF_CELLS+data.Part.cell_x, + data.Part.grid_y * MAX_NUMBER_OF_CELLS+data.Part.cell_y); } - Cell& operator=(const Cell &cell) + Cell& operator=(Cell const& cell) { this->data.All = cell.data.All; return *this; } - bool operator == (const Cell &cell) const { return (data.All == cell.data.All); } - bool operator != (const Cell &cell) const { return !operator == (cell); } + bool operator == (Cell const& cell) const { return (data.All == cell.data.All); } + bool operator != (Cell const& cell) const { return !operator == (cell); } union { struct @@ -160,15 +107,13 @@ struct Cell uint32 All; } data; - template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &) const; - template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, const WorldObject&, float) const; - template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, float, float, float) const; + template<class T, class CONTAINER> void Visit(CellCoord const&, TypeContainerVisitor<T, CONTAINER>& visitor, Map &, WorldObject const&, float) const; + template<class T, class CONTAINER> void Visit(CellCoord const&, TypeContainerVisitor<T, CONTAINER>& visitor, Map &, float, float, float) const; - static CellArea CalculateCellArea(const WorldObject &obj, float radius); static CellArea CalculateCellArea(float x, float y, float radius); private: - template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair&, const CellPair&) const; + template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, CellCoord const&, CellCoord const&) const; }; #endif diff --git a/src/server/game/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h index d36892ffcb0..af697b9f21d 100755..100644 --- a/src/server/game/Grids/Cells/CellImpl.h +++ b/src/server/game/Grids/Cells/CellImpl.h @@ -25,7 +25,7 @@ #include "Map.h" #include "Object.h" -inline Cell::Cell(CellPair const& p) +inline Cell::Cell(CellCoord const& p) { data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS; data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS; @@ -35,143 +35,35 @@ inline Cell::Cell(CellPair const& p) data.Part.reserved = 0; } -template<class T, class CONTAINER> -inline void -Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m) const -{ - if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) - return; - - uint16 district = (District)this->data.Part.reserved; - if (district == CENTER_DISTRICT) - { - m.Visit(*this, visitor); - return; - } - - // set up the cell range based on the district - // the overloaded operators handle range checking - CellPair begin_cell = standing_cell; - CellPair end_cell = standing_cell; - - switch (district) - { - case ALL_DISTRICT: - { - begin_cell << 1; begin_cell -= 1; // upper left - end_cell >> 1; end_cell += 1; // lower right - break; - } - case UPPER_LEFT_DISTRICT: - { - begin_cell << 1; begin_cell -= 1; // upper left - break; - } - case UPPER_RIGHT_DISTRICT: - { - begin_cell -= 1; // up - end_cell >> 1; // right - break; - } - case LOWER_LEFT_DISTRICT: - { - begin_cell << 1; // left - end_cell += 1; // down - break; - } - case LOWER_RIGHT_DISTRICT: - { - end_cell >> 1; end_cell += 1; // lower right - break; - } - case LEFT_DISTRICT: - { - begin_cell -= 1; // up - end_cell >> 1; end_cell += 1; // lower right - break; - } - case RIGHT_DISTRICT: - { - begin_cell << 1; begin_cell -= 1; // upper left - end_cell += 1; // down - break; - } - case UPPER_DISTRICT: - { - begin_cell << 1; begin_cell -= 1; // upper left - end_cell >> 1; // right - break; - } - case LOWER_DISTRICT: - { - begin_cell << 1; // left - end_cell >> 1; end_cell += 1; // lower right - break; - } - default: - { - ASSERT(false); - break; - } - } - - // loop the cell range - for (uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++) - { - for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; y++) - { - CellPair cell_pair(x, y); - Cell r_zone(cell_pair); - r_zone.data.Part.nocreate = this->data.Part.nocreate; - m.Visit(r_zone, visitor); - } - } -} - -inline int CellHelper(const float radius) -{ - if (radius < 1.0f) - return 0; - - return (int)ceilf(radius/SIZE_OF_GRID_CELL); -} - -inline CellArea Cell::CalculateCellArea(const WorldObject &obj, float radius) +inline Cell::Cell(float x, float y) { - return Cell::CalculateCellArea(obj.GetPositionX(), obj.GetPositionY(), radius); + CellCoord p = Trinity::ComputeCellCoord(x, y); + data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS; + data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS; + data.Part.cell_x = p.x_coord % MAX_NUMBER_OF_CELLS; + data.Part.cell_y = p.y_coord % MAX_NUMBER_OF_CELLS; + data.Part.nocreate = 0; + data.Part.reserved = 0; } inline CellArea Cell::CalculateCellArea(float x, float y, float radius) { if (radius <= 0.0f) - return CellArea(); - - //lets calculate object coord offsets from cell borders. - //TODO: add more correct/generic method for this task - const float x_offset = (x - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; - const float y_offset = (y - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; - - const float x_val = floor(x_offset + CENTER_GRID_CELL_ID + 0.5f); - const float y_val = floor(y_offset + CENTER_GRID_CELL_ID + 0.5f); - - const float x_off = (x_offset - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; - const float y_off = (y_offset - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; + { + CellCoord center = Trinity::ComputeCellCoord(x, y).normalize(); + return CellArea(center, center); + } - const float tmp_diff = radius - CENTER_GRID_CELL_OFFSET; - //lets calculate upper/lower/right/left corners for cell search - int right = CellHelper(tmp_diff + x_off); - int left = CellHelper(tmp_diff - x_off); - int upper = CellHelper(tmp_diff + y_off); - int lower = CellHelper(tmp_diff - y_off); + CellCoord centerX = Trinity::ComputeCellCoord(x - radius, y - radius).normalize(); + CellCoord centerY = Trinity::ComputeCellCoord(x + radius, y + radius).normalize(); - return CellArea(right, left, upper, lower); + return CellArea(centerX, centerY); } template<class T, class CONTAINER> -inline void -Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float radius, float x_off, float y_off) const +inline void Cell::Visit(CellCoord const& standing_cell, TypeContainerVisitor<T, CONTAINER>& visitor, Map& map, float radius, float x_off, float y_off) const { - if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + if (!standing_cell.IsCoordValid()) return; //no jokes here... Actually placing ASSERT() here was good idea, but @@ -179,7 +71,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v //maybe it is better to just return when radius <= 0.0f? if (radius <= 0.0f) { - m.Visit(*this, visitor); + map.Visit(*this, visitor); return; } //lets limit the upper value for search radius @@ -191,57 +83,51 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v //if radius fits inside standing cell if (!area) { - m.Visit(*this, visitor); + map.Visit(*this, visitor); return; } - CellPair begin_cell = standing_cell; - CellPair end_cell = standing_cell; - - area.ResizeBorders(begin_cell, end_cell); //visit all cells, found in CalculateCellArea() //if radius is known to reach cell area more than 4x4 then we should call optimized VisitCircle //currently this technique works with MAX_NUMBER_OF_CELLS 16 and higher, with lower values //there are nothing to optimize because SIZE_OF_GRID_CELL is too big... - if (((end_cell.x_coord - begin_cell.x_coord) > 4) && ((end_cell.y_coord - begin_cell.y_coord) > 4)) + if (((area.high_bound.x_coord - area.low_bound.x_coord) > 4) && ((area.high_bound.y_coord - area.low_bound.y_coord) > 4)) { - VisitCircle(visitor, m, begin_cell, end_cell); + VisitCircle(visitor, map, area.low_bound, area.high_bound); return; } //ALWAYS visit standing cell first!!! Since we deal with small radiuses //it is very essential to call visitor for standing cell firstly... - m.Visit(*this, visitor); + map.Visit(*this, visitor); // loop the cell range - for (uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; ++x) + for (uint32 x = area.low_bound.x_coord; x <= area.high_bound.x_coord; ++x) { - for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y) + for (uint32 y = area.low_bound.y_coord; y <= area.high_bound.y_coord; ++y) { - CellPair cell_pair(x, y); + CellCoord cellCoord(x, y); //lets skip standing cell since we already visited it - if (cell_pair != standing_cell) + if (cellCoord != standing_cell) { - Cell r_zone(cell_pair); + Cell r_zone(cellCoord); r_zone.data.Part.nocreate = this->data.Part.nocreate; - m.Visit(r_zone, visitor); + map.Visit(r_zone, visitor); } } } } template<class T, class CONTAINER> -inline void -Cell::Visit(const CellPair& l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const +inline void Cell::Visit(CellCoord const& standing_cell, TypeContainerVisitor<T, CONTAINER>& visitor, Map& map, WorldObject const& obj, float radius) const { //we should increase search radius by object's radius, otherwise //we could have problems with huge creatures, which won't attack nearest players etc - Visit(l, visitor, m, radius + obj.GetObjectSize(), obj.GetPositionX(), obj.GetPositionY()); + Visit(standing_cell, visitor, map, radius + obj.GetObjectSize(), obj.GetPositionX(), obj.GetPositionY()); } template<class T, class CONTAINER> -inline void -Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const +inline void Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER>& visitor, Map& map, CellCoord const& begin_cell, CellCoord const& end_cell) const { //here is an algorithm for 'filling' circum-squared octagon uint32 x_shift = (uint32)ceilf((end_cell.x_coord - begin_cell.x_coord) * 0.3f - 0.5f); @@ -254,10 +140,10 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel { for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y) { - CellPair cell_pair(x, y); - Cell r_zone(cell_pair); + CellCoord cellCoord(x, y); + Cell r_zone(cellCoord); r_zone.data.Part.nocreate = this->data.Part.nocreate; - m.Visit(r_zone, visitor); + map.Visit(r_zone, visitor); } } @@ -278,16 +164,16 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel { //we visit cells symmetrically from both sides, heading from center to sides and from up to bottom //e.g. filling 2 trapezoids after filling central cell strip... - CellPair cell_pair_left(x_start - step, y); - Cell r_zone_left(cell_pair_left); + CellCoord cellCoord_left(x_start - step, y); + Cell r_zone_left(cellCoord_left); r_zone_left.data.Part.nocreate = this->data.Part.nocreate; - m.Visit(r_zone_left, visitor); + map.Visit(r_zone_left, visitor); //right trapezoid cell visit - CellPair cell_pair_right(x_end + step, y); - Cell r_zone_right(cell_pair_right); + CellCoord cellCoord_right(x_end + step, y); + Cell r_zone_right(cellCoord_right); r_zone_right.data.Part.nocreate = this->data.Part.nocreate; - m.Visit(r_zone_right, visitor); + map.Visit(r_zone_right, visitor); } } } diff --git a/src/server/game/Grids/Grid.h b/src/server/game/Grids/Grid.h index a6e1316718e..a90915d49f0 100755 --- a/src/server/game/Grids/Grid.h +++ b/src/server/game/Grids/Grid.h @@ -72,26 +72,26 @@ class Grid /** Refreshes/update the grid. This required for remote grids. */ - void RefreshGrid(void) { /* TBI */} + //void RefreshGrid(void) { /* TBI */} /** Locks a grid. Any object enters must wait until the grid is unlock. */ - void LockGrid(void) { /* TBI */ } + //void LockGrid(void) { /* TBI */ } /** Unlocks the grid. */ - void UnlockGrid(void) { /* TBI */ } + //void UnlockGrid(void) { /* TBI */ } - /** Grid visitor for grid objects - */ - template<class T> void Visit(TypeContainerVisitor<T, TypeMapContainer<GRID_OBJECT_TYPES> > &visitor) + // Visit grid objects + template<class T> + void Visit(TypeContainerVisitor<T, TypeMapContainer<GRID_OBJECT_TYPES> > &visitor) { visitor.Visit(i_container); } - /** Grid visitor for world objects - */ - template<class T> void Visit(TypeContainerVisitor<T, TypeMapContainer<WORLD_OBJECT_TYPES> > &visitor) + // Visit world objects + template<class T> + void Visit(TypeContainerVisitor<T, TypeMapContainer<WORLD_OBJECT_TYPES> > &visitor) { visitor.Visit(i_objects); } diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index 66eabf77400..44e2588ef81 100755..100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.h @@ -71,21 +71,27 @@ typedef NGrid<MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTyp typedef TypeMapContainer<AllGridObjectTypes> GridTypeMapContainer; typedef TypeMapContainer<AllWorldObjectTypes> WorldTypeMapContainer; -template<const unsigned int LIMIT> +template<uint32 LIMIT> struct CoordPair { - CoordPair(uint32 x=0, uint32 y=0) : x_coord(x), y_coord(y) {} - CoordPair(const CoordPair<LIMIT> &obj) : x_coord(obj.x_coord), y_coord(obj.y_coord) {} - bool operator == (const CoordPair<LIMIT> &obj) const { return (obj.x_coord == x_coord && obj.y_coord == y_coord); } - bool operator != (const CoordPair<LIMIT> &obj) const { return !operator == (obj); } - CoordPair<LIMIT>& operator=(const CoordPair<LIMIT> &obj) + CoordPair(uint32 x=0, uint32 y=0) + : x_coord(x) + , y_coord(y) + {} + + CoordPair(const CoordPair<LIMIT> &obj) + : x_coord(obj.x_coord) + , y_coord(obj.y_coord) + {} + + CoordPair<LIMIT> & operator=(const CoordPair<LIMIT> &obj) { x_coord = obj.x_coord; y_coord = obj.y_coord; return *this; } - void operator<<(const uint32 val) + void dec_x(uint32 val) { if (x_coord > val) x_coord -= val; @@ -93,15 +99,15 @@ struct CoordPair x_coord = 0; } - void operator>>(const uint32 val) + void inc_x(uint32 val) { - if (x_coord+val < LIMIT) + if (x_coord + val < LIMIT) x_coord += val; else x_coord = LIMIT - 1; } - void operator-=(const uint32 val) + void dec_y(uint32 val) { if (y_coord > val) y_coord -= val; @@ -109,20 +115,44 @@ struct CoordPair y_coord = 0; } - void operator+=(const uint32 val) + void inc_y(uint32 val) { - if (y_coord+val < LIMIT) + if (y_coord + val < LIMIT) y_coord += val; else y_coord = LIMIT - 1; } + bool IsCoordValid() const + { + return x_coord < LIMIT && y_coord < LIMIT; + } + + CoordPair& normalize() + { + x_coord = std::min(x_coord, LIMIT - 1); + y_coord = std::min(y_coord, LIMIT - 1); + return *this; + } + uint32 x_coord; uint32 y_coord; }; -typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridPair; -typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellPair; +template<uint32 LIMIT> +bool operator==(const CoordPair<LIMIT> &p1, const CoordPair<LIMIT> &p2) +{ + return (p1.x_coord == p2.x_coord && p1.y_coord == p2.y_coord); +} + +template<uint32 LIMIT> +bool operator!=(const CoordPair<LIMIT> &p1, const CoordPair<LIMIT> &p2) +{ + return !(p1 == p2); +} + +typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridCoord; +typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellCoord; namespace Trinity { @@ -138,17 +168,17 @@ namespace Trinity return RET_TYPE(x_val, y_val); } - inline GridPair ComputeGridPair(float x, float y) + inline GridCoord ComputeGridCoord(float x, float y) { - return Compute<GridPair, CENTER_GRID_ID>(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); + return Compute<GridCoord, CENTER_GRID_ID>(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); } - inline CellPair ComputeCellPair(float x, float y) + inline CellCoord ComputeCellCoord(float x, float y) { - return Compute<CellPair, CENTER_GRID_CELL_ID>(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL); + return Compute<CellCoord, CENTER_GRID_CELL_ID>(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL); } - inline CellPair ComputeCellPair(float x, float y, float &x_off, float &y_off) + inline CellCoord ComputeCellCoord(float x, float y, float &x_off, float &y_off) { double x_offset = (double(x) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; double y_offset = (double(y) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; @@ -157,7 +187,7 @@ namespace Trinity int y_val = int(y_offset + CENTER_GRID_CELL_ID + 0.5f); x_off = (float(x_offset) - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; y_off = (float(y_offset) - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; - return CellPair(x_val, y_val); + return CellCoord(x_val, y_val); } inline void NormalizeMapCoord(float &c) diff --git a/src/server/game/Grids/GridLoader.h b/src/server/game/Grids/GridLoader.h index 0e762d3a07e..43564c920e2 100755 --- a/src/server/game/Grids/GridLoader.h +++ b/src/server/game/Grids/GridLoader.h @@ -30,6 +30,8 @@ GridLoader manages the grid (both local and remote). */ +//I cannot see why this cannot be replaced by a Grid::Visit +/* #include "Define.h" #include "Grid.h" #include "TypeContainerVisitor.h" @@ -44,8 +46,7 @@ class GridLoader { public: - /** Loads the grid - */ + // Loads the grid template<class LOADER> void Load(Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, LOADER &loader) { @@ -54,8 +55,7 @@ class GridLoader grid.UnlockGrid(); } - /** Stop the grid - */ + // Stop the grid template<class STOPER> void Stop(Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, STOPER &stoper) { @@ -63,8 +63,8 @@ class GridLoader stoper.Stop(grid); grid.UnlockGrid(); } - /** Unloads the grid - */ + + // Unloads the grid template<class UNLOADER> void Unload(Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, UNLOADER &unloader) { @@ -73,5 +73,6 @@ class GridLoader grid.UnlockGrid(); } }; +*/ #endif diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp index 91bb926fd02..fd5e3c68a51 100755 --- a/src/server/game/Grids/GridStates.cpp +++ b/src/server/game/Grids/GridStates.cpp @@ -22,23 +22,24 @@ #include "Log.h" void -InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32 /*x*/, const uint32 /*y*/, const uint32) const +InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32) const { } void -ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 x, const uint32 y, const uint32 t_diff) const +ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 t_diff) const { // Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle info.UpdateTimeTracker(t_diff); if (info.getTimeTracker().Passed()) { - if (grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y)) + if (grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(grid)) { - ObjectGridStoper stoper(grid); - stoper.StopN(); + ObjectGridStoper worker; + TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer> visitor(worker); + grid.VisitAllGrids(visitor); grid.SetGridState(GRID_STATE_IDLE); - sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", x, y, m.GetId()); + sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), m.GetId()); } else { @@ -48,24 +49,24 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 x, co } void -IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 x, const uint32 y, const uint32) const +IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32) const { m.ResetGridExpiry(grid); grid.SetGridState(GRID_STATE_REMOVAL); - sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", x, y, m.GetId()); + sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), m.GetId()); } void -RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 x, const uint32 y, const uint32 t_diff) const +RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 t_diff) const { if (!info.getUnloadLock()) { info.UpdateTimeTracker(t_diff); if (info.getTimeTracker().Passed()) { - if (!m.UnloadGrid(x, y, false)) + if (!m.UnloadGrid(grid, false)) { - sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", x, y, m.GetId()); + sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), m.GetId()); m.ResetGridExpiry(grid); } } diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h index 81bf749b63f..78f70356608 100755 --- a/src/server/game/Grids/GridStates.h +++ b/src/server/game/Grids/GridStates.h @@ -40,35 +40,31 @@ class GridState void setMagic() { i_Magic = MAGIC_TESTVAL; } unsigned int i_Magic; #endif - virtual void Update(Map &, NGridType&, GridInfo &, const uint32 x, const uint32 y, const uint32 t_diff) const = 0; + virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0; }; class InvalidState : public GridState { public: - - void Update(Map &, NGridType &, GridInfo &, const uint32 x, const uint32 y, const uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const; }; class ActiveState : public GridState { public: - - void Update(Map &, NGridType &, GridInfo &, const uint32 x, const uint32 y, const uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const; }; class IdleState : public GridState { public: - - void Update(Map &, NGridType &, GridInfo &, const uint32 x, const uint32 y, const uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const; }; class RemovalState : public GridState { public: - - void Update(Map &, NGridType &, GridInfo &, const uint32 x, const uint32 y, const uint32 t_diff) const; + void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const; }; #endif diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h index cd2345e439d..b814fd386a5 100755 --- a/src/server/game/Grids/NGrid.h +++ b/src/server/game/Grids/NGrid.h @@ -69,7 +69,7 @@ typedef enum template < -unsigned int N, +uint32 N, class ACTIVE_OBJECT, class WORLD_OBJECT_TYPES, class GRID_OBJECT_TYPES @@ -77,7 +77,6 @@ class GRID_OBJECT_TYPES 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_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false) @@ -85,17 +84,15 @@ class NGrid i_GridInfo = GridInfo(expiry, unload); } - const GridType& operator()(unsigned short x, unsigned short y) const + GridType& GetGridType(const uint32 x, const uint32 y) { - ASSERT(x < N); - ASSERT(y < N); + ASSERT(x < N && y < N); return i_cells[x][y]; } - GridType& operator()(unsigned short x, unsigned short y) + GridType const& GetGridType(const uint32 x, const uint32 y) const { - ASSERT(x < N); - ASSERT(y < N); + ASSERT(x < N && y < N); return i_cells[x][y]; } @@ -125,54 +122,50 @@ class NGrid template<class SPECIFIC_OBJECT> void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj) { - getGridType(x, y).AddWorldObject(obj); + GetGridType(x, y).AddWorldObject(obj); } template<class SPECIFIC_OBJECT> void RemoveWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj) { - getGridType(x, y).RemoveWorldObject(obj); + GetGridType(x, y).RemoveWorldObject(obj); } - template<class T, class TT> void Visit(TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor) + template<class SPECIFIC_OBJECT> void AddGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj) { - for (unsigned int x=0; x < N; ++x) - for (unsigned int y=0; y < N; ++y) - getGridType(x, y).Visit(visitor); + GetGridType(x, y).AddGridObject(obj); } - template<class T, class TT> void Visit(const uint32 x, const uint32 y, TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor) + template<class SPECIFIC_OBJECT> void RemoveGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj) { - getGridType(x, y).Visit(visitor); + GetGridType(x, y).RemoveGridObject(obj); } - unsigned int ActiveObjectsInGrid(void) const + // Visit all Grids (cells) in NGrid (grid) + template<class T, class TT> + void VisitAllGrids(TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor) { - unsigned int count=0; - for (unsigned int x=0; x < N; ++x) - for (unsigned int y=0; y < N; ++y) - count += i_cells[x][y].ActiveObjectsInGrid(); - return count; + for (uint32 x = 0; x < N; ++x) + for (uint32 y = 0; y < N; ++y) + GetGridType(x, y).Visit(visitor); } - template<class SPECIFIC_OBJECT> bool AddGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj) + // Visit a single Grid (cell) in NGrid (grid) + template<class T, class TT> + void VisitGrid(const uint32 x, const uint32 y, TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor) { - return getGridType(x, y).AddGridObject(obj); + GetGridType(x, y).Visit(visitor); } - template<class SPECIFIC_OBJECT> bool RemoveGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj) + unsigned int ActiveObjectsInGrid(void) const { - return getGridType(x, y).RemoveGridObject(obj); + unsigned int count=0; + for (unsigned int x=0; x < N; ++x) + for (unsigned int y=0; y < N; ++y) + count += i_cells[x][y].ActiveObjectsInGrid(); + return count; } private: - - GridType& getGridType(const uint32 x, const uint32 y) - { - ASSERT(x < N); - ASSERT(y < N); - return i_cells[x][y]; - } - uint32 i_gridId; GridInfo i_GridInfo; GridReference<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> > i_Reference; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index dc938859e92..0377713a520 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -215,7 +215,7 @@ void DelayedUnitRelocation::Visit(PlayerMapType &m) if (player != viewPoint && !viewPoint->IsPositionValid()) continue; - CellPair pair2(Trinity::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY())); + CellCoord pair2(Trinity::ComputeCellCoord(viewPoint->GetPositionX(), viewPoint->GetPositionY())); Cell cell2(pair2); //cell.SetNoCreate(); need load cells around viewPoint or player, that's why its commented diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 0cd15143cee..af86af25db5 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -81,9 +81,9 @@ namespace Trinity { Map &i_map; Cell &cell; - CellPair &p; + CellCoord &p; const float i_radius; - DelayedUnitRelocation(Cell &c, CellPair &pair, Map &map, float radius) : + DelayedUnitRelocation(Cell &c, CellCoord &pair, Map &map, float radius) : i_map(map), cell(c), p(pair), i_radius(radius) {} template<class T> void Visit(GridRefManager<T> &) {} void Visit(CreatureMapType &); diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index ee488f404dc..a696e02fdec 100755 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -28,26 +28,7 @@ #include "CellImpl.h" #include "CreatureAI.h" -class ObjectGridRespawnMover -{ - public: - ObjectGridRespawnMover() {} - - void Move(GridType &grid); - - template<class T> void Visit(GridRefManager<T> &) {} - void Visit(CreatureMapType &m); -}; - -void -ObjectGridRespawnMover::Move(GridType &grid) -{ - TypeContainerVisitor<ObjectGridRespawnMover, GridTypeMapContainer > mover(*this); - grid.Visit(mover); -} - -void -ObjectGridRespawnMover::Visit(CreatureMapType &m) +void ObjectGridEvacuator::Visit(CreatureMapType &m) { // creature in unloading grid can have respawn point in another grid // if it will be unloaded then it will not respawn in original grid until unload/load original grid @@ -82,19 +63,19 @@ class ObjectWorldLoader uint32 i_corpses; }; -template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellPair const& /*cell_pair*/) +template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellCoord const& /*cellCoord*/) { } -template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellPair const& cell_pair) +template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellCoord const& cellCoord) { - Cell cell(cell_pair); + Cell cell(cellCoord); obj->SetCurrentCell(cell); } template <class T> -void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj) +void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj) { obj->GetGridRef().link(&m, obj); ObjectGridLoader::SetObjectCell(obj, cell); @@ -106,7 +87,7 @@ void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* m } template <class T> -void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map) +void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map) { for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid) { @@ -123,7 +104,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> & } } -void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType &m, uint32 &count, Map* map) +void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapType &m, uint32 &count, Map* map) { if (cell_corpses.empty()) return; @@ -154,12 +135,12 @@ ObjectGridLoader::Visit(GameObjectMapType &m) { uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellPair cell_pair(x, y); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord(x, y); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); - LoadHelper(cell_guids.gameobjects, cell_pair, m, i_gameObjects, i_map); + LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map); } void @@ -167,12 +148,12 @@ ObjectGridLoader::Visit(CreatureMapType &m) { uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellPair cell_pair(x, y); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord(x, y); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); - LoadHelper(cell_guids.creatures, cell_pair, m, i_creatures, i_map); + LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map); } void @@ -180,28 +161,12 @@ ObjectWorldLoader::Visit(CorpseMapType &m) { uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellPair cell_pair(x, y); - uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; + CellCoord cellCoord(x, y); + uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; // corpses are always added to spawn mode 0 and they are spawned by their instance id CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), 0, cell_id); - LoadHelper(cell_guids.corpses, cell_pair, m, i_corpses, i_map); -} - -void -ObjectGridLoader::Load(GridType &grid) -{ - { - TypeContainerVisitor<ObjectGridLoader, GridTypeMapContainer > loader(*this); - grid.Visit(loader); - } - - { - ObjectWorldLoader wloader(*this); - TypeContainerVisitor<ObjectWorldLoader, WorldTypeMapContainer > loader(wloader); - grid.Visit(loader); - i_corpses = wloader.i_corpses; - } + LoadHelper(cell_guids.corpses, cellCoord, m, i_corpses, i_map); } void ObjectGridLoader::LoadN(void) @@ -214,35 +179,27 @@ void ObjectGridLoader::LoadN(void) for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y) { i_cell.data.Part.cell_y = y; - GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader; - loader.Load(i_grid(x, y), *this); - } - } - sLog->outDebug(LOG_FILTER_MAPS, "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId()); -} -void ObjectGridUnloader::MoveToRespawnN() -{ - for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x) - { - for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y) - { - ObjectGridRespawnMover mover; - mover.Move(i_grid(x, y)); + //Load creatures and game objects + { + TypeContainerVisitor<ObjectGridLoader, GridTypeMapContainer> visitor(*this); + i_grid.VisitGrid(x, y, visitor); + } + + //Load corpses (not bones) + { + ObjectWorldLoader worker(*this); + TypeContainerVisitor<ObjectWorldLoader, WorldTypeMapContainer> visitor(worker); + i_grid.VisitGrid(x, y, visitor); + i_corpses += worker.i_corpses; + } } } -} - -void -ObjectGridUnloader::Unload(GridType &grid) -{ - TypeContainerVisitor<ObjectGridUnloader, GridTypeMapContainer > unloader(*this); - grid.Visit(unloader); + sLog->outDebug(LOG_FILTER_MAPS, "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId()); } template<class T> -void -ObjectGridUnloader::Visit(GridRefManager<T> &m) +void ObjectGridUnloader::Visit(GridRefManager<T> &m) { while (!m.isEmpty()) { @@ -255,15 +212,7 @@ ObjectGridUnloader::Visit(GridRefManager<T> &m) } } -void -ObjectGridStoper::Stop(GridType &grid) -{ - TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer > stoper(*this); - grid.Visit(stoper); -} - -void -ObjectGridStoper::Visit(CreatureMapType &m) +void ObjectGridStoper::Visit(CreatureMapType &m) { // stop any fights at grid de-activation and remove dynobjects created at cast by creatures for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) @@ -278,23 +227,14 @@ ObjectGridStoper::Visit(CreatureMapType &m) } } -void -ObjectGridCleaner::Stop(GridType &grid) -{ - TypeContainerVisitor<ObjectGridCleaner, GridTypeMapContainer > stoper(*this); - grid.Visit(stoper); -} - -void -ObjectGridCleaner::Visit(CreatureMapType &m) +void ObjectGridCleaner::Visit(CreatureMapType &m) { for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) iter->getSource()->CleanupsBeforeDelete(); } template<class T> -void -ObjectGridCleaner::Visit(GridRefManager<T> &m) +void ObjectGridCleaner::Visit(GridRefManager<T> &m) { for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) iter->getSource()->RemoveFromWorld(); diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h index 5fc5dc47e71..411cae10a90 100755 --- a/src/server/game/Grids/ObjectGridLoader.h +++ b/src/server/game/Grids/ObjectGridLoader.h @@ -36,7 +36,6 @@ class ObjectGridLoader : i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses (0) {} - void Load(GridType &grid); void Visit(GameObjectMapType &m); void Visit(CreatureMapType &m); void Visit(CorpseMapType &) const {} @@ -44,7 +43,7 @@ class ObjectGridLoader void LoadN(void); - template<class T> static void SetObjectCell(T* obj, CellPair const& cellPair); + template<class T> static void SetObjectCell(T* obj, CellCoord const& cellCoord); private: Cell i_cell; @@ -55,79 +54,34 @@ class ObjectGridLoader uint32 i_corpses; }; -class ObjectGridUnloader +//Stop the creatures before unloading the NGrid +class ObjectGridStoper { public: - ObjectGridUnloader(NGridType &grid) : i_grid(grid) {} - - void MoveToRespawnN(); - void UnloadN() - { - for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x) - { - for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y) - { - GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader; - loader.Unload(i_grid(x, y), *this); - } - } - } - - void Unload(GridType &grid); - template<class T> void Visit(GridRefManager<T> &m); - private: - NGridType &i_grid; + void Visit(CreatureMapType &m); + template<class T> void Visit(GridRefManager<T> &) {} }; -class ObjectGridStoper +//Move the foreign creatures back to respawn positions before unloading the NGrid +class ObjectGridEvacuator { public: - ObjectGridStoper(NGridType &grid) : i_grid(grid) {} - - void StopN() - { - for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x) - { - for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y) - { - GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader; - loader.Stop(i_grid(x, y), *this); - } - } - } - - void Stop(GridType &grid); void Visit(CreatureMapType &m); - - template<class NONACTIVE> void Visit(GridRefManager<NONACTIVE> &) {} - private: - NGridType &i_grid; + template<class T> void Visit(GridRefManager<T> &) {} }; +//Clean up and remove from world class ObjectGridCleaner { public: - ObjectGridCleaner(NGridType &grid) : i_grid(grid) {} - - void CleanN() - { - for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x) - { - for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y) - { - GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader; - loader.Stop(i_grid(x, y), *this); - } - } - } - - void Stop(GridType &grid); void Visit(CreatureMapType &m); template<class T> void Visit(GridRefManager<T> &); - private: - NGridType &i_grid; }; -typedef GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> GridLoaderType; +//Delete objects before deleting NGrid +class ObjectGridUnloader +{ + public: + template<class T> void Visit(GridRefManager<T> &m); +}; #endif - diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 0442172b0fd..5f73485c06e 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1052,8 +1052,8 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) 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->size() > 1) ? looters : NULL); + AllowedLooterSet looters = item->GetAllowedLooters(); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); } else { @@ -1105,8 +1105,8 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) 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->size() > 1) ? looters : NULL); + AllowedLooterSet looters = item->GetAllowedLooters(); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); } else { @@ -2065,4 +2065,5 @@ void Group::ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply) slot->flags |= flag; else slot->flags &= ~flag; -}
\ No newline at end of file +} + diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index b9b9ed281fa..f0e21f7f709 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -141,34 +141,36 @@ void InstanceScript::AddDoor(GameObject* door, bool add) for (DoorInfoMap::iterator itr = lower; itr != upper; ++itr) { + DoorInfo const& data = itr->second; + if (add) { - itr->second.bossInfo->door[itr->second.type].insert(door); - switch (itr->second.boundary) + data.bossInfo->door[data.type].insert(door); + switch (data.boundary) { default: case BOUNDARY_NONE: break; case BOUNDARY_N: case BOUNDARY_S: - itr->second.bossInfo->boundary[itr->second.boundary] = door->GetPositionX(); + data.bossInfo->boundary[data.boundary] = door->GetPositionX(); break; case BOUNDARY_E: case BOUNDARY_W: - itr->second.bossInfo->boundary[itr->second.boundary] = door->GetPositionY(); + data.bossInfo->boundary[data.boundary] = door->GetPositionY(); break; case BOUNDARY_NW: case BOUNDARY_SE: - itr->second.bossInfo->boundary[itr->second.boundary] = door->GetPositionX() + door->GetPositionY(); + data.bossInfo->boundary[data.boundary] = door->GetPositionX() + door->GetPositionY(); break; case BOUNDARY_NE: case BOUNDARY_SW: - itr->second.bossInfo->boundary[itr->second.boundary] = door->GetPositionX() - door->GetPositionY(); + data.bossInfo->boundary[data.boundary] = door->GetPositionX() - door->GetPositionY(); break; } } else - itr->second.bossInfo->door[itr->second.type].erase(door); + data.bossInfo->door[data.type].erase(door); } if (add) diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index b0adeb03784..10ae786a7d6 100755 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -149,7 +149,7 @@ struct LootItem bool AllowedForPlayer(Player const* player) const; void AddAllowedLooter(Player const* player); - AllowedLooterSet* GetAllowedLooters() { return &allowedGUIDs; } + const AllowedLooterSet & GetAllowedLooters() const { return allowedGUIDs; } }; struct QuestItem diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 89049f39127..ebeac025f1d 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -141,9 +141,9 @@ void Map::LoadMap(int gx, int gy, bool reload) // load grid map for base map if (!m_parentMap->GridMaps[gx][gy]) - m_parentMap->EnsureGridCreated(GridPair(63-gx, 63-gy)); + m_parentMap->EnsureGridCreated(GridCoord(63-gx, 63-gy)); - ((MapInstanced*)(m_parentMap))->AddGridMapReference(GridPair(gx, gy)); + ((MapInstanced*)(m_parentMap))->AddGridMapReference(GridCoord(gx, gy)); GridMaps[gx][gy] = m_parentMap->GridMaps[gx][gy]; return; } @@ -202,11 +202,11 @@ void Map::DeleteStateMachine() } Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent): -i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId), +_creatureToMoveLock(false), i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId), m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), m_VisibilityNotifyPeriod(DEFAULT_VISIBILITY_NOTIFY_PERIOD), m_activeNonPlayersIter(m_activeNonPlayers.end()), i_gridExpiry(expiry), -i_scriptLock(false), _creatureToMoveLock(false) +i_scriptLock(false) { m_parentMap = (_parent ? _parent : this); for (unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx) @@ -234,73 +234,66 @@ void Map::InitVisibilityDistance() // Template specialization of utility methods template<class T> -void Map::AddToGrid(T* obj, NGridType *grid, Cell const& cell) +void Map::AddToGrid(T* obj, Cell const& cell) { + NGridType* grid = getNGrid(cell.GridX(), cell.GridY()); if (obj->m_isWorldObject) - (*grid)(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj); + grid->GetGridType(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj); else - (*grid)(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj); + grid->GetGridType(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj); } template<> -void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell) +void Map::AddToGrid(Creature* obj, Cell const& cell) { + NGridType* grid = getNGrid(cell.GridX(), cell.GridY()); if (obj->m_isWorldObject) - (*grid)(cell.CellX(), cell.CellY()).AddWorldObject(obj); + grid->GetGridType(cell.CellX(), cell.CellY()).AddWorldObject(obj); else - (*grid)(cell.CellX(), cell.CellY()).AddGridObject(obj); + grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj); obj->SetCurrentCell(cell); } template<class T> -void Map::RemoveFromGrid(T* obj, NGridType *grid, Cell const& cell) +void Map::RemoveFromGrid(T* obj, Cell const& cell) { + NGridType* grid = getNGrid(cell.GridX(), cell.GridY()); if (obj->m_isWorldObject) - (*grid)(cell.CellX(), cell.CellY()).template RemoveWorldObject<T>(obj); + grid->GetGridType(cell.CellX(), cell.CellY()).template RemoveWorldObject<T>(obj); else - (*grid)(cell.CellX(), cell.CellY()).template RemoveGridObject<T>(obj); + grid->GetGridType(cell.CellX(), cell.CellY()).template RemoveGridObject<T>(obj); } template<class T> void Map::SwitchGridContainers(T* obj, bool on) { - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); + if (!p.IsCoordValid()) { sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } Cell cell(p); - if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) + if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != NULL); - GridType &grid = (*ngrid)(cell.CellX(), cell.CellY()); + GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY()); if (on) { grid.RemoveGridObject<T>(obj); grid.AddWorldObject<T>(obj); - /*if (!grid.RemoveGridObject<T>(obj, obj->GetGUID()) - || !grid.AddWorldObject<T>(obj, obj->GetGUID())) - { - ASSERT(false); - }*/ } else { grid.RemoveWorldObject<T>(obj); grid.AddGridObject<T>(obj); - /*if (!grid.RemoveWorldObject<T>(obj, obj->GetGUID()) - || !grid.AddGridObject<T>(obj, obj->GetGUID())) - { - ASSERT(false); - }*/ } obj->m_isWorldObject = on; } @@ -322,8 +315,9 @@ void Map::DeleteFromWorld(Player* pl) delete pl; } -void -Map::EnsureGridCreated(const GridPair &p) +//Create NGrid so the object can be added to it +//But object data is not loaded here +void Map::EnsureGridCreated(const GridCoord &p) { if (!getNGrid(p.x_coord, p.y_coord)) { @@ -350,8 +344,8 @@ Map::EnsureGridCreated(const GridPair &p) } } -void -Map::EnsureGridLoadedAtEnter(const Cell &cell, Player* player) +//Load NGrid and make it active +void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object) { EnsureGridLoaded(cell); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); @@ -360,23 +354,16 @@ Map::EnsureGridLoadedAtEnter(const Cell &cell, Player* player) // refresh grid state & timer if (grid->GetGridState() != GRID_STATE_ACTIVE) { - if (player) - { - sLog->outStaticDebug("Player %s enter cell[%u, %u] triggers loading of grid[%u, %u] on map %u", player->GetName(), cell.CellX(), cell.CellY(), cell.GridX(), cell.GridY(), GetId()); - } - else - { - sLog->outStaticDebug("Active object nearby triggers loading of grid [%u, %u] on map %u", cell.GridX(), cell.GridY(), GetId()); - } - + sLog->outStaticDebug("Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId()); ResetGridExpiry(*grid, 0.1f); grid->SetGridState(GRID_STATE_ACTIVE); } } +//Create NGrid and load the object data in it bool Map::EnsureGridLoaded(const Cell &cell) { - EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); + EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(grid != NULL); @@ -390,7 +377,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) loader.LoadN(); // Add resurrectable corpses to world object list in grid - sObjectAccessor->AddCorpsesToGrid(GridPair(cell.GridX(), cell.GridY()), (*grid)(cell.CellX(), cell.CellY()), this); + sObjectAccessor->AddCorpsesToGrid(GridCoord(cell.GridX(), cell.GridY()), grid->GetGridType(cell.CellX(), cell.CellY()), this); return true; } @@ -399,17 +386,15 @@ bool Map::EnsureGridLoaded(const Cell &cell) void Map::LoadGrid(float x, float y) { - CellPair pair = Trinity::ComputeCellPair(x, y); - Cell cell(pair); - EnsureGridLoaded(cell); + EnsureGridLoaded(Cell(x, y)); } bool Map::AddToMap(Player* player) { // Check if we are adding to correct map ASSERT (player->GetMap() == this); - CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); + if (!p.IsCoordValid()) { sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); return false; @@ -418,10 +403,8 @@ bool Map::AddToMap(Player* player) player->SetMap(this); Cell cell(p); - EnsureGridLoadedAtEnter(cell, player); - NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(grid != NULL); - AddToGrid(player, grid, cell); + EnsureGridLoadedForActiveObject(cell, player); + AddToGrid(player, cell); player->AddToWorld(); @@ -436,7 +419,7 @@ bool Map::AddToMap(Player* player) } template<class T> -void Map::InitializeObject(T* obj) +void Map::InitializeObject(T* /*obj*/) { } @@ -450,8 +433,8 @@ template<class T> void Map::AddToMap(T *obj) { - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); + if (!p.IsCoordValid()) { sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; @@ -465,14 +448,11 @@ Map::AddToMap(T *obj) } if (obj->isActiveObject()) - EnsureGridLoadedAtEnter(cell); + EnsureGridLoadedForActiveObject(cell, obj); else - EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); - - NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(grid != NULL); + EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); - AddToGrid(obj, grid, cell); + AddToGrid(obj, cell); //obj->SetMap(this); obj->AddToWorld(); InitializeObject(obj); @@ -487,29 +467,23 @@ Map::AddToMap(T *obj) obj->UpdateObjectVisibility(true); } -bool Map::loaded(const GridPair &p) const +bool Map::IsGridLoaded(const GridCoord &p) const { return (getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord)); } void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor, TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor) { - CellPair standing_cell(Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY())); - - // Check for correctness of standing_cell, it also avoids problems with update_cell - if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + // Check for valid position + if (!obj->IsPositionValid()) return; - // the overloaded operators handle range checking - // so there's no need for range checking inside the loop - CellPair begin_cell(standing_cell), end_cell(standing_cell); - //lets update mobs/objects in ALL visible cells around object! - CellArea area = Cell::CalculateCellArea(*obj, obj->GetGridActivationRange()); - area.ResizeBorders(begin_cell, end_cell); + // Update mobs/objects in ALL visible cells around object! + CellArea area = Cell::CalculateCellArea(obj->GetPositionX(), obj->GetPositionY(), obj->GetGridActivationRange()); - for (uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; ++x) + for (uint32 x = area.low_bound.x_coord; x <= area.high_bound.x_coord; ++x) { - for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y) + for (uint32 y = area.low_bound.y_coord; y <= area.high_bound.y_coord; ++y) { // marked cells are those that have been visited // don't visit the same cell twice @@ -518,11 +492,10 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj continue; markCell(cell_id); - CellPair pair(x, y); + CellCoord pair(x, y); Cell cell(pair); - cell.data.Part.reserved = CENTER_DISTRICT; - cell.Visit(pair, gridVisitor, *this); - cell.Visit(pair, worldVisitor, *this); + Visit(cell, gridVisitor); + Visit(cell, worldVisitor); } } } @@ -620,8 +593,8 @@ void Map::ProcessRelocationNotifies(const uint32 diff) uint32 gx = grid->getX(), gy = grid->getY(); - CellPair cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); - CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); + CellCoord cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); + CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); for (uint32 x = cell_min.x_coord; x < cell_max.x_coord; ++x) { @@ -631,7 +604,7 @@ void Map::ProcessRelocationNotifies(const uint32 diff) if (!isCellMarked(cell_id)) continue; - CellPair pair(x, y); + CellCoord pair(x, y); Cell cell(pair); cell.SetNoCreate(); @@ -661,8 +634,8 @@ void Map::ProcessRelocationNotifies(const uint32 diff) uint32 gx = grid->getX(), gy = grid->getY(); - CellPair cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); - CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); + CellCoord cell_min(gx*MAX_NUMBER_OF_CELLS, gy*MAX_NUMBER_OF_CELLS); + CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); for (uint32 x = cell_min.x_coord; x < cell_max.x_coord; ++x) { @@ -672,7 +645,7 @@ void Map::ProcessRelocationNotifies(const uint32 diff) if (!isCellMarked(cell_id)) continue; - CellPair pair(x, y); + CellCoord pair(x, y); Cell cell(pair); cell.SetNoCreate(); Visit(cell, grid_notifier); @@ -687,8 +660,8 @@ void Map::RemoveFromMap(Player* player, bool remove) player->RemoveFromWorld(); SendRemoveTransports(player); - CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); + if (!p.IsCoordValid()) sLog->outCrash("Map::Remove: Player is in invalid cell!"); else { @@ -698,11 +671,8 @@ void Map::RemoveFromMap(Player* player, bool remove) else { sLog->outStaticDebug("Remove player %s from grid[%u, %u]", player->GetName(), cell.GridX(), cell.GridY()); - NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(grid != NULL); - player->UpdateObjectVisibility(true); - RemoveFromGrid(player, grid, cell); + RemoveFromGrid(player, cell); } } @@ -720,20 +690,17 @@ Map::RemoveFromMap(T *obj, bool remove) if (obj->isActiveObject()) RemoveFromActive(obj); - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); + if (!p.IsCoordValid()) sLog->outError("Map::Remove: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); else { Cell cell(p); - if (loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) + if (IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) { sLog->outStaticDebug("Remove object " UI64FMTD " from grid[%u, %u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y); - NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(grid != NULL); - obj->UpdateObjectVisibility(true); - RemoveFromGrid(obj, grid, cell); + RemoveFromGrid(obj, cell); } } @@ -753,11 +720,8 @@ Map::PlayerRelocation(Player* player, float x, float y, float z, float orientati { ASSERT(player); - CellPair old_val = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - CellPair new_val = Trinity::ComputeCellPair(x, y); - - Cell old_cell(old_val); - Cell new_cell(new_val); + Cell old_cell(player->GetPositionX(), player->GetPositionY()); + Cell new_cell(x, y); player->Relocate(x, y, z, orientation); @@ -765,14 +729,12 @@ Map::PlayerRelocation(Player* player, float x, float y, float z, float orientati { sLog->outStaticDebug("Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); - NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY()); - RemoveFromGrid(player, oldGrid, old_cell); + RemoveFromGrid(player, old_cell); if (old_cell.DiffGrid(new_cell)) - EnsureGridLoadedAtEnter(new_cell, player); + EnsureGridLoadedForActiveObject(new_cell, player); - NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY()); - AddToGrid(player, newGrid, new_cell); + AddToGrid(player, new_cell); } player->UpdateObjectVisibility(false); @@ -784,9 +746,7 @@ Map::CreatureRelocation(Creature* creature, float x, float y, float z, float ang ASSERT(CheckGridIntegrity(creature, false)); Cell old_cell = creature->GetCurrentCell(); - - CellPair new_val = Trinity::ComputeCellPair(x, y); - Cell new_cell(new_val); + Cell new_cell(x, y); if (!respawnRelocationOnFail && !getNGrid(new_cell.GridX(), new_cell.GridY())) return; @@ -815,7 +775,7 @@ void Map::AddCreatureToMoveList(Creature* c, float x, float y, float z, float an if (_creatureToMoveLock) //can this happen? return; - if(c->_moveState == CREATURE_CELL_MOVE_NONE) + if (c->_moveState == CREATURE_CELL_MOVE_NONE) _creaturesToMove.push_back(c); c->SetNewCellPosition(x, y, z, ang); } @@ -825,7 +785,7 @@ void Map::RemoveCreatureFromMoveList(Creature* c) if (_creatureToMoveLock) //can this happen? return; - if(c->_moveState == CREATURE_CELL_MOVE_ACTIVE) + if (c->_moveState == CREATURE_CELL_MOVE_ACTIVE) c->_moveState = CREATURE_CELL_MOVE_INACTIVE; } @@ -849,11 +809,11 @@ void Map::MoveAllCreaturesInMoveList() continue; // do move or do move to respawn or remove creature if previous all fail - if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellPair(c->_newPosition.m_positionX, c->_newPosition.m_positionY)))) + if (CreatureCellRelocation(c, Cell(c->_newPosition.m_positionX, c->_newPosition.m_positionY))) { // update pos c->Relocate(c->_newPosition); - //CreatureRelocationNotify(c, new_cell, new_cell.cellPair()); + //CreatureRelocationNotify(c, new_cell, new_cell.cellCoord()); c->UpdateObjectVisibility(false); } else @@ -895,8 +855,8 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved in grid[%u, %u] from cell[%u, %u] to cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY()); #endif - RemoveFromGrid(c, getNGrid(old_cell.GridX(), old_cell.GridY()), old_cell); - AddToGrid(c, getNGrid(new_cell.GridX(), new_cell.GridY()), new_cell); + RemoveFromGrid(c, old_cell); + AddToGrid(c, new_cell); } else { @@ -911,28 +871,28 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) // in diff. grids but active creature if (c->isActiveObject()) { - EnsureGridLoadedAtEnter(new_cell); + EnsureGridLoadedForActiveObject(new_cell, c); #ifdef TRINITY_DEBUG sLog->outDebug(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif - RemoveFromGrid(c, getNGrid(old_cell.GridX(), old_cell.GridY()), old_cell); - AddToGrid(c, getNGrid(new_cell.GridX(), new_cell.GridY()), new_cell); + RemoveFromGrid(c, old_cell); + AddToGrid(c, new_cell); return true; } // in diff. loaded grid normal creature - if (loaded(GridPair(new_cell.GridX(), new_cell.GridY()))) + if (IsGridLoaded(GridCoord(new_cell.GridX(), new_cell.GridY()))) { #ifdef TRINITY_DEBUG sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif - RemoveFromGrid(c, getNGrid(old_cell.GridX(), old_cell.GridY()), old_cell); - EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); - AddToGrid(c, getNGrid(new_cell.GridX(), new_cell.GridY()), new_cell); + RemoveFromGrid(c, old_cell); + EnsureGridCreated(GridCoord(new_cell.GridX(), new_cell.GridY())); + AddToGrid(c, new_cell); return true; } @@ -947,12 +907,11 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly) { float resp_x, resp_y, resp_z, resp_o; - c->GetRespawnCoord(resp_x, resp_y, resp_z, &resp_o); - CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y); - Cell resp_cell(resp_val); + c->GetRespawnPosition(resp_x, resp_y, resp_z, &resp_o); + Cell resp_cell(resp_x, resp_y); //creature will be unloaded with grid - if(diffGridOnly && !c->GetCurrentCell().DiffGrid(resp_cell)) + if (diffGridOnly && !c->GetCurrentCell().DiffGrid(resp_cell)) return true; c->CombatStop(); @@ -967,7 +926,7 @@ bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly) { c->Relocate(resp_x, resp_y, resp_z, resp_o); c->GetMotionMaster()->Initialize(); // prevent possible problems with default move generators - //CreatureRelocationNotify(c, resp_cell, resp_cell.cellPair()); + //CreatureRelocationNotify(c, resp_cell, resp_cell.GetCellCoord()); c->UpdateObjectVisibility(false); return true; } @@ -975,19 +934,17 @@ bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly) return false; } -bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll) +bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll) { - NGridType *grid = getNGrid(x, y); - ASSERT(grid != NULL); + const uint32 x = ngrid.getX(); + const uint32 y = ngrid.getY(); { - if (!unloadAll && ActiveObjectsNearGrid(x, y)) + if (!unloadAll && ActiveObjectsNearGrid(ngrid)) return false; sLog->outDebug(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u", x, y, GetId()); - ObjectGridUnloader unloader(*grid); - if (!unloadAll) { // Finish creature moves, remove and delete all creatures with delayed remove before moving to respawn grids @@ -995,22 +952,31 @@ bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll) MoveAllCreaturesInMoveList(); // move creatures to respawn grids if this is diff.grid or to remove list - unloader.MoveToRespawnN(); + ObjectGridEvacuator worker; + TypeContainerVisitor<ObjectGridEvacuator, GridTypeMapContainer> visitor(worker); + ngrid.VisitAllGrids(visitor); // Finish creature moves, remove and delete all creatures with delayed remove before unload MoveAllCreaturesInMoveList(); } - ObjectGridCleaner cleaner(*grid); - cleaner.CleanN(); + { + ObjectGridCleaner worker; + TypeContainerVisitor<ObjectGridCleaner, GridTypeMapContainer> visitor(worker); + ngrid.VisitAllGrids(visitor); + } RemoveAllObjectsInRemoveList(); - unloader.UnloadN(); + { + ObjectGridUnloader worker; + TypeContainerVisitor<ObjectGridUnloader, GridTypeMapContainer> visitor(worker); + ngrid.VisitAllGrids(visitor); + } ASSERT(i_objectsToRemove.empty()); - delete grid; + delete &ngrid; setNGrid(NULL, x, y); } int gx = (MAX_NUMBER_OF_GRIDS - 1) - x; @@ -1030,7 +996,7 @@ bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll) VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gx, gy); } else - ((MapInstanced*)m_parentMap)->RemoveGridMapReference(GridPair(gx, gy)); + ((MapInstanced*)m_parentMap)->RemoveGridMapReference(GridCoord(gx, gy)); GridMaps[gx][gy] = NULL; } @@ -1064,7 +1030,7 @@ void Map::UnloadAll() { NGridType &grid(*i->getSource()); ++i; - UnloadGrid(grid.getX(), grid.getY(), true); // deletes the grid and removes it from the GridRefManager + UnloadGrid(grid, true); // deletes the grid and removes it from the GridRefManager } } @@ -1589,7 +1555,7 @@ inline GridMap* Map::GetGrid(float x, float y) int gy=(int)(32-y/SIZE_OF_GRIDS); //grid y // ensure GridMap is loaded - EnsureGridCreated(GridPair(63-gx, 63-gy)); + EnsureGridCreated(GridCoord(63-gx, 63-gy)); return GridMaps[gx][gy]; } @@ -1858,7 +1824,7 @@ bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const LiquidData liquid_status; LiquidData* liquid_ptr = data ? data : &liquid_status; if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr)) - return true; + return true; } return false; } @@ -1876,9 +1842,7 @@ bool Map::IsUnderWater(float x, float y, float z) const bool Map::CheckGridIntegrity(Creature* c, bool moved) const { Cell const& cur_cell = c->GetCurrentCell(); - - CellPair xy_val = Trinity::ComputeCellPair(c->GetPositionX(), c->GetPositionY()); - Cell xy_cell(xy_val); + Cell xy_cell(c->GetPositionX(), c->GetPositionY()); if (xy_cell != cur_cell) { sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u) X: %f Y: %f (%s) is in grid[%u, %u]cell[%u, %u] instead of grid[%u, %u]cell[%u, %u]", @@ -1897,20 +1861,18 @@ const char* Map::GetMapName() const return i_mapEntry ? i_mapEntry->name[sWorld->GetDefaultDbcLocale()] : "UNNAMEDMAP\x0"; } -void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair) +void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair) { - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::VisibleChangesNotifier notifier(*obj); TypeContainerVisitor<Trinity::VisibleChangesNotifier, WorldTypeMapContainer > player_notifier(notifier); cell.Visit(cellpair, player_notifier, *this, *obj, obj->GetVisibilityRange()); } -void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair) +void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpair) { Trinity::VisibleNotifier notifier(*player); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); TypeContainerVisitor<Trinity::VisibleNotifier, WorldTypeMapContainer > world_notifier(notifier); TypeContainerVisitor<Trinity::VisibleNotifier, GridTypeMapContainer > grid_notifier(notifier); @@ -2027,7 +1989,7 @@ void Map::DelayedUpdate(const uint32 t_diff) GridInfo* info = i->getSource()->getGridInfoRef(); ++i; // The update might delete the map and we need the next map before the iterator gets invalid ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE); - si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, grid->getX(), grid->getY(), t_diff); + si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, t_diff); } } } @@ -2130,28 +2092,25 @@ void Map::SendToPlayers(WorldPacket const* data) const itr->getSource()->GetSession()->SendPacket(data); } -bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const +bool Map::ActiveObjectsNearGrid(NGridType const& ngrid) const { - ASSERT(x < MAX_NUMBER_OF_GRIDS); - ASSERT(y < MAX_NUMBER_OF_GRIDS); - - CellPair cell_min(x*MAX_NUMBER_OF_CELLS, y*MAX_NUMBER_OF_CELLS); - CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); + CellCoord cell_min(ngrid.getX() * MAX_NUMBER_OF_CELLS, ngrid.getY() * MAX_NUMBER_OF_CELLS); + CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS); //we must find visible range in cells so we unload only non-visible cells... float viewDist = GetVisibilityRange(); int cell_range = (int)ceilf(viewDist / SIZE_OF_GRID_CELL) + 1; - cell_min << cell_range; - cell_min -= cell_range; - cell_max >> cell_range; - cell_max += cell_range; + cell_min.dec_x(cell_range); + cell_min.dec_y(cell_range); + cell_max.inc_x(cell_range); + cell_max.inc_y(cell_range); for (MapRefManager::const_iterator iter = m_mapRefManager.begin(); iter != m_mapRefManager.end(); ++iter) { Player* plr = iter->getSource(); - CellPair p = Trinity::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(plr->GetPositionX(), plr->GetPositionY()); if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) && (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord)) return true; @@ -2161,7 +2120,7 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const { WorldObject* obj = *iter; - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) && (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord)) return true; @@ -2178,13 +2137,13 @@ void Map::AddToActive(Creature* c) if (!c->isPet() && c->GetDBTableGUIDLow()) { float x, y, z; - c->GetRespawnCoord(x, y, z); - GridPair p = Trinity::ComputeGridPair(x, y); + c->GetRespawnPosition(x, y, z); + GridCoord p = Trinity::ComputeGridCoord(x, y); if (getNGrid(p.x_coord, p.y_coord)) getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock(); else { - GridPair p2 = Trinity::ComputeGridPair(c->GetPositionX(), c->GetPositionY()); + GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); sLog->outError("Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } @@ -2199,13 +2158,13 @@ void Map::RemoveFromActive(Creature* c) if (!c->isPet() && c->GetDBTableGUIDLow()) { float x, y, z; - c->GetRespawnCoord(x, y, z); - GridPair p = Trinity::ComputeGridPair(x, y); + c->GetRespawnPosition(x, y, z); + GridCoord p = Trinity::ComputeGridCoord(x, y); if (getNGrid(p.x_coord, p.y_coord)) getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock(); else { - GridPair p2 = Trinity::ComputeGridPair(c->GetPositionX(), c->GetPositionY()); + GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); sLog->outError("Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index fd58fd0cc72..053759a3ab3 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -263,20 +263,19 @@ class Map : public GridRefManager<NGridType> bool IsRemovalGrid(float x, float y) const { - GridPair p = Trinity::ComputeGridPair(x, y); + GridCoord p = Trinity::ComputeGridCoord(x, y); return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL; } - bool IsLoaded(float x, float y) const + bool IsGridLoaded(float x, float y) const { - GridPair p = Trinity::ComputeGridPair(x, y); - return loaded(p); + return IsGridLoaded(Trinity::ComputeGridCoord(x, y)); } - bool GetUnloadLock(const GridPair &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); } - void SetUnloadLock(const GridPair &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); } + bool GetUnloadLock(const GridCoord &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); } + void SetUnloadLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); } void LoadGrid(float x, float y); - bool UnloadGrid(const uint32 x, const uint32 y, bool pForce); + bool UnloadGrid(NGridType& ngrid, bool pForce); virtual void UnloadAll(); void ResetGridExpiry(NGridType &grid, float factor = 1) const @@ -371,8 +370,8 @@ class Map : public GridRefManager<NGridType> void AddObjectToSwitchList(WorldObject* obj, bool on); virtual void DelayedUpdate(const uint32 diff); - void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair); - void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair); + void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair); + void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpair); void resetMarkedCells() { marked_cells.reset(); } bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); } @@ -380,7 +379,7 @@ class Map : public GridRefManager<NGridType> bool HavePlayers() const { return !m_mapRefManager.isEmpty(); } uint32 GetPlayersCountExceptGMs() const; - bool ActiveObjectsNearGrid(uint32 x, uint32 y) const; + bool ActiveObjectsNearGrid(NGridType const& ngrid) const; void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); } void RemoveWorldObject(WorldObject* obj) { i_worldObjects.erase(obj); } @@ -420,8 +419,8 @@ class Map : public GridRefManager<NGridType> GameObject* GetGameObject(uint64 guid); DynamicObject* GetDynamicObject(uint64 guid); - MapInstanced* ToMainstanced(){ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return NULL; } - const MapInstanced* ToMainstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return NULL; } + MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return NULL; } + const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return NULL; } InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return NULL; } const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return NULL; } @@ -443,13 +442,14 @@ class Map : public GridRefManager<NGridType> template<class T> void InitializeObject(T* obj); void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang); void RemoveCreatureFromMoveList(Creature* c); + bool _creatureToMoveLock; std::vector<Creature*> _creaturesToMove; - bool loaded(const GridPair &) const; - void EnsureGridCreated(const GridPair &); + bool IsGridLoaded(const GridCoord &) const; + void EnsureGridCreated(const GridCoord &); bool EnsureGridLoaded(Cell const&); - void EnsureGridLoadedAtEnter(Cell const&, Player* player = NULL); + void EnsureGridLoadedForActiveObject(Cell const&, WorldObject* object); void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); } @@ -458,8 +458,7 @@ class Map : public GridRefManager<NGridType> NGridType* getNGrid(uint32 x, uint32 y) const { - ASSERT(x < MAX_NUMBER_OF_GRIDS); - ASSERT(y < MAX_NUMBER_OF_GRIDS); + ASSERT(x < MAX_NUMBER_OF_GRIDS && y < MAX_NUMBER_OF_GRIDS); return i_grids[x][y]; } @@ -471,7 +470,7 @@ class Map : public GridRefManager<NGridType> void UpdateActiveCells(const float &x, const float &y, const uint32 t_diff); protected: - void SetUnloadReferenceLock(const GridPair &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); } + void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); } ACE_Thread_Mutex Lock; @@ -524,10 +523,10 @@ class Map : public GridRefManager<NGridType> // Type specific code for add/remove to/from grid template<class T> - void AddToGrid(T*, NGridType *, Cell const&); + void AddToGrid(T* object, Cell const& cell); template<class T> - void RemoveFromGrid(T*, NGridType *, Cell const&); + void RemoveFromGrid(T* object, Cell const& cell); template<class T> void DeleteFromWorld(T*); @@ -616,28 +615,25 @@ class BattlegroundMap : public Map }; template<class T, class CONTAINER> -inline void -Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor) +inline void Map::Visit(Cell const& cell, TypeContainerVisitor<T, CONTAINER>& visitor) { const uint32 x = cell.GridX(); const uint32 y = cell.GridY(); const uint32 cell_x = cell.CellX(); const uint32 cell_y = cell.CellY(); - if (!cell.NoCreate() || loaded(GridPair(x, y))) + if (!cell.NoCreate() || IsGridLoaded(GridCoord(x, y))) { EnsureGridLoaded(cell); - getNGrid(x, y)->Visit(cell_x, cell_y, visitor); + getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor); } } template<class NOTIFIER> -inline void -Map::VisitAll(const float &x, const float &y, float radius, NOTIFIER ¬ifier) +inline void Map::VisitAll(float const& x, float const& y, float radius, NOTIFIER& notifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier); @@ -648,12 +644,10 @@ Map::VisitAll(const float &x, const float &y, float radius, NOTIFIER ¬ifier) // should be used with Searcher notifiers, tries to search world if nothing found in grid template<class NOTIFIER> -inline void -Map::VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER ¬ifier) +inline void Map::VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier); @@ -666,12 +660,10 @@ Map::VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER ¬ } template<class NOTIFIER> -inline void -Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier) +inline void Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier); @@ -679,12 +671,10 @@ Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier } template<class NOTIFIER> -inline void -Map::VisitGrid(const float &x, const float &y, float radius, NOTIFIER ¬ifier) +inline void Map::VisitGrid(const float &x, const float &y, float radius, NOTIFIER ¬ifier) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); TypeContainerVisitor<NOTIFIER, GridTypeMapContainer > grid_object_notifier(notifier); diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h index 1913f0add51..af303ed0e9e 100755 --- a/src/server/game/Maps/MapInstanced.h +++ b/src/server/game/Maps/MapInstanced.h @@ -43,17 +43,17 @@ class MapInstanced : public Map Map* FindMap(uint32 InstanceId) const { return _FindMap(InstanceId); } bool DestroyInstance(InstancedMaps::iterator &itr); - void AddGridMapReference(const GridPair &p) + void AddGridMapReference(const GridCoord &p) { ++GridMapReference[p.x_coord][p.y_coord]; - SetUnloadReferenceLock(GridPair(63-p.x_coord, 63-p.y_coord), true); + SetUnloadReferenceLock(GridCoord(63-p.x_coord, 63-p.y_coord), true); } - void RemoveGridMapReference(GridPair const& p) + void RemoveGridMapReference(GridCoord const& p) { --GridMapReference[p.x_coord][p.y_coord]; if (!GridMapReference[p.x_coord][p.y_coord]) - SetUnloadReferenceLock(GridPair(63-p.x_coord, 63-p.y_coord), false); + SetUnloadReferenceLock(GridCoord(63-p.x_coord, 63-p.y_coord), false); } InstancedMaps &GetInstancedMaps() { return m_InstancedMaps; } diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 0b7abacad28..8b1c69362f2 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -292,7 +292,7 @@ void MapManager::DoDelayedMovesAndRemoves() bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y) { - GridPair p = Trinity::ComputeGridPair(x, y); + GridCoord p = Trinity::ComputeGridCoord(x, y); int gx=63-p.x_coord; int gy=63-p.y_coord; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 380af30c175..c9fa9346860 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -409,7 +409,7 @@ enum SpellAttr3 enum SpellAttr4 { SPELL_ATTR4_UNK0 = 0x00000001, // 0 - SPELL_ATTR4_UNK1 = 0x00000002, // 1 proc on finishing move? + SPELL_ATTR4_PROC_ONLY_ON_DUMMY = 0x00000002, // 1 proc only on SPELL_EFFECT_DUMMY? SPELL_ATTR4_UNK2 = 0x00000004, // 2 SPELL_ATTR4_UNK3 = 0x00000008, // 3 SPELL_ATTR4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use?? diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 35c19a6a62f..bbef60aa5e7 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -260,7 +260,7 @@ void PoolGroup<Quest>::Despawn1Object(uint32 quest_id) QuestRelations::iterator lastElement = questMap->upper_bound(itr->second); for (; qitr != lastElement; ++qitr) { - if (qitr->first == itr->second) + if (qitr->first == itr->second && qitr->second == itr->first) { questMap->erase(qitr); // iterator is now no more valid break; // but we can exit loop since the element is found @@ -279,7 +279,7 @@ void PoolGroup<Quest>::Despawn1Object(uint32 quest_id) QuestRelations::iterator lastElement = questMap->upper_bound(itr->second); for (; qitr != lastElement; ++qitr) { - if (qitr->first == itr->second) + if (qitr->first == itr->second && qitr->second == itr->first) { questMap->erase(qitr); // iterator is now no more valid break; // but we can exit loop since the element is found @@ -361,7 +361,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj) // Spawn if necessary (loaded grids only) Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid)); // We use spawn coords to spawn - if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) + if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { Creature* creature = new Creature; //sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning creature %u", guid); @@ -387,7 +387,7 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj) // this base map checked as non-instanced and then only existed Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid - if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) + if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { GameObject* pGameobject = new GameObject; //sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning gameobject %u", guid); diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index a1a1f5d5cac..9650afb60e2 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -205,6 +205,11 @@ int32 Quest::GetRewOrReqMoney() const return int32(RewOrReqMoney * sWorld->getRate(RATE_DROP_MONEY)); } +bool Quest::IsAutoComplete() const +{ + return QuestMethod == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE); +} + bool Quest::IsAllowedInRaid() const { if (IsRaidQuest()) diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 61d492ce88c..90e52660160 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -246,7 +246,7 @@ class Quest uint32 GetQuestStartScript() const { return QuestStartScript; } uint32 GetQuestCompleteScript() const { return QuestCompleteScript; } bool IsRepeatable() const { return QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE; } - bool IsAutoComplete() const { return QuestMethod ? false : true; } + bool IsAutoComplete() const; uint32 GetFlags() const { return QuestFlags; } bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; } bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; } diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index b141f889196..88c9795e896 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -266,21 +266,20 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script } } -inline GameObject* Map::_FindGameObject(WorldObject* pSearchObject, uint32 guid) const +inline GameObject* Map::_FindGameObject(WorldObject* searchObject, uint32 guid) const { - GameObject* pGameObject = NULL; + GameObject* gameobject = NULL; - CellPair p(Trinity::ComputeCellPair(pSearchObject->GetPositionX(), pSearchObject->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - Trinity::GameObjectWithDbGUIDCheck goCheck(*pSearchObject, guid); - Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(pSearchObject, pGameObject, goCheck); + Trinity::GameObjectWithDbGUIDCheck goCheck(*searchObject, guid); + Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(searchObject, gameobject, goCheck); TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker); - cell.Visit(p, objectChecker, *pSearchObject->GetMap()); + cell.Visit(p, objectChecker, *searchObject->GetMap(), *searchObject, searchObject->GetGridActivationRange()); - return pGameObject; + return gameobject; } /// Process queued scripts @@ -818,15 +817,14 @@ void Map::ScriptsProcess() { WorldObject* wSource = dynamic_cast <WorldObject*> (source); - CellPair p(Trinity::ComputeCellPair(wSource->GetPositionX(), wSource->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(wSource->GetPositionX(), wSource->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::CreatureWithDbGUIDCheck target_check(wSource, step.script->CallScript.CreatureEntry); Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(wSource, cTarget, target_check); TypeContainerVisitor<Trinity::CreatureSearcher <Trinity::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker); - cell.Visit(p, unit_checker, *wSource->GetMap()); + cell.Visit(p, unit_checker, *wSource->GetMap(), *wSource, wSource->GetGridActivationRange()); } else //check hashmap holders { diff --git a/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp b/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp index 8f32ac84cb8..4c6ec6571a4 100755 --- a/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp @@ -25,12 +25,14 @@ #include "Opcodes.h" #include "Player.h" -void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/) +void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty + uint64 guid = _player->GetGUID(); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); - time_t cur_time = time(NULL); + time_t cur_time = time_t(time(NULL)); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid); WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 4+4*0+4+4*0+4+4); data << uint32(0); // invite count @@ -58,48 +60,52 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/) } */ - data << uint32(0); // unk - data << uint32(secsToTimeBitFields(cur_time)); // current time + data << uint32(cur_time); // server time + data << uint32(secsToTimeBitFields(cur_time)); // server time uint32 counter = 0; size_t p_counter = data.wpos(); - data << uint32(counter); // instance save count + data << uint32(counter); // instance save count - for (int i = 0; i < MAX_DIFFICULTY; ++i) - { + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) - { if (itr->second.perm) { - InstanceSave* save = itr->second.save; + InstanceSave const* save = itr->second.save; data << uint32(save->GetMapId()); data << uint32(save->GetDifficulty()); data << uint32(save->GetResetTime() - cur_time); - data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id + data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id ++counter; } - } - } data.put<uint32>(p_counter, counter); - data << uint32(1135753200); // unk (28.12.2005 12:00) + data << uint32(1135753200); // unk (28.12.2005 07:00) counter = 0; p_counter = data.wpos(); - data << uint32(counter); // raid reset count + data << uint32(counter); // raid reset count + std::set<uint32> sentMaps; + ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap(); for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr) { - uint32 mapid = PAIR32_LOPART(itr->first); - MapEntry const* mapEnt = sMapStore.LookupEntry(mapid); - if (!mapEnt || !mapEnt->IsRaid()) + uint32 mapId = PAIR32_LOPART(itr->first); + + if (sentMaps.find(mapId) != sentMaps.end()) + continue; + + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + if (!mapEntry || !mapEntry->IsRaid()) continue; - data << uint32(mapid); + sentMaps.insert(mapId); + + data << uint32(mapId); data << uint32(itr->second - cur_time); - data << uint32(mapEnt->unk_time); + data << uint32(mapEntry->unk_time); ++counter; } @@ -126,17 +132,16 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/) } */ - sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending calendar"); SendPacket(&data); } -void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) +void WorldSession::HandleCalendarGetEvent(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_EVENT"); recv_data.read_skip<uint64>(); // unk } -void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) +void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GUILD_FILTER"); recv_data.read_skip<uint32>(); // unk1 @@ -144,13 +149,13 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) recv_data.read_skip<uint32>(); // unk3 } -void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data) +void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ARENA_TEAM"); recv_data.read_skip<uint32>(); // unk } -void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) +void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ADD_EVENT"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -185,7 +190,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) //} } -void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) +void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_UPDATE_EVENT"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -203,7 +208,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) //recv_data >> uint32 } -void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) +void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_REMOVE_EVENT"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -214,7 +219,7 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) } -void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) +void WorldSession::HandleCalendarCopyEvent(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COPY_EVENT"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -225,7 +230,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) } -void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) +void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_INVITE"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -238,7 +243,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) } -void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) +void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_RSVP"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -249,7 +254,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) } -void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) +void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -260,7 +265,7 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) //recv_data >> uint64 } -void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) +void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_STATUS"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -272,7 +277,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) //recv_data >> uint32 } -void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) +void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -284,7 +289,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) //recv_data >> uint32 } -void WorldSession::HandleCalendarComplain(WorldPacket &recv_data) +void WorldSession::HandleCalendarComplain(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COMPLAIN"); recv_data.rfinish(); // set to end to avoid warnings spam @@ -294,7 +299,7 @@ void WorldSession::HandleCalendarComplain(WorldPacket &recv_data) //recv_data >> uint64 } -void WorldSession::HandleCalendarGetNumPending(WorldPacket & /*recv_data*/) +void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index 83d92df4f7a..70dc0ace8eb 100755 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -566,10 +566,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) Unit* unit = ObjectAccessor::GetUnit(*_player, guid); - CellPair p = Trinity::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + CellCoord p = Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::EmoteChatBuilder emote_builder(*GetPlayer(), text_emote, emoteNum, unit); diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index eca466436be..f4e3af72892 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -1341,7 +1341,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) _player->ToggleMetaGemsActive(slot, true); //turn on all metagems (except for target item) - itemTarget->SetSoulboundTradeable(NULL, _player, false); // clear tradeable flag + itemTarget->ClearSoulboundTradeable(_player); // clear tradeable flag } void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data) diff --git a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp index 83d3fad3b21..05b4afc99e7 100755 --- a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp @@ -489,10 +489,10 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) } // list of players allowed to receive this item in trade - AllowedLooterSet* looters = item.GetAllowedLooters(); + AllowedLooterSet looters = item.GetAllowedLooters(); // not move item from loot to target inventory - Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, (looters->size() > 1) ? looters : NULL); + Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters); target->SendNewItem(newitem, uint32(item.count), false, false, true); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count); diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index 1b0cef69c04..971e0b89c0f 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -239,8 +239,8 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) data << uint32(matchcount); // placeholder, count of players matching criteria data << uint32(displaycount); // placeholder, count of players displayed - ACE_GUARD(ACE_Thread_Mutex, g, *HashMapHolder<Player>::GetLock()); - HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers(); + ACE_READ_GUARD(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock()); + HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if (AccountMgr::IsPlayerAccount(security)) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 9cb2b1cbe3f..32e65ca7e3f 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -999,6 +999,7 @@ void WorldSession::ProcessQueryCallbacks() HandleCharCreateCallback(pResult, _charCreateCallback.GetParam()); // Don't call FreeResult() here, the callback handler will do that depending on the events in the callback chain } + //! HandlePlayerLoginOpcode if (_charLoginCallback.ready()) { diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 2337f2a34b2..a28e3fca2ab 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -223,10 +223,10 @@ class WorldSession void SizeError(WorldPacket const& packet, uint32 size) const; - void ReadAddonsInfo(WorldPacket &data); + void ReadAddonsInfo(WorldPacket& data); void SendAddonsInfo(); - void ReadMovementInfo(WorldPacket &data, MovementInfo* mi); + void ReadMovementInfo(WorldPacket& data, MovementInfo* mi); void WriteMovementInfo(WorldPacket* data, MovementInfo* mi); void SendPacket(WorldPacket const* packet); @@ -282,7 +282,7 @@ class WorldSession void SendTrainerList(uint64 guid); void SendTrainerList(uint64 guid, const std::string& strTitle); - void SendListInventory(uint64 vendorGuid); + void SendListInventory(uint64 guid); void SendShowBank(uint64 guid); void SendTabardVendorActivate(uint64 guid); void SendSpiritResurrect(); @@ -381,9 +381,7 @@ class WorldSession } bool IsConnectionIdle() const { - if (m_timeOutTime <= 0 && !m_inQueue) - return true; - return false; + return (m_timeOutTime <= 0 && !m_inQueue); } // Recruit-A-Friend Handling @@ -421,11 +419,11 @@ class WorldSession void HandleInspectHonorStatsOpcode(WorldPacket& recvPacket); void HandleMoveWaterWalkAck(WorldPacket& recvPacket); - void HandleFeatherFallAck(WorldPacket &recv_data); + void HandleFeatherFallAck(WorldPacket& recv_data); - void HandleMoveHoverAck(WorldPacket & recv_data); + void HandleMoveHoverAck(WorldPacket& recv_data); - void HandleMountSpecialAnimOpcode(WorldPacket &recvdata); + void HandleMountSpecialAnimOpcode(WorldPacket& recvdata); // character view void HandleShowingHelmOpcode(WorldPacket& recv_data); @@ -438,7 +436,7 @@ class WorldSession void HandleMoveKnockBackAck(WorldPacket& recvPacket); void HandleMoveTeleportAck(WorldPacket& recvPacket); - void HandleForceSpeedChangeAck(WorldPacket & recv_data); + void HandleForceSpeedChangeAck(WorldPacket& recv_data); void HandlePingOpcode(WorldPacket& recvPacket); void HandleAuthSessionOpcode(WorldPacket& recvPacket); @@ -483,10 +481,10 @@ class WorldSession void HandleAreaTriggerOpcode(WorldPacket& recvPacket); - void HandleSetFactionAtWar(WorldPacket & recv_data); - void HandleSetFactionCheat(WorldPacket & recv_data); - void HandleSetWatchedFactionOpcode(WorldPacket & recv_data); - void HandleSetFactionInactiveOpcode(WorldPacket & recv_data); + void HandleSetFactionAtWar(WorldPacket& recv_data); + void HandleSetFactionCheat(WorldPacket& recv_data); + void HandleSetWatchedFactionOpcode(WorldPacket& recv_data); + void HandleSetFactionInactiveOpcode(WorldPacket& recv_data); void HandleUpdateAccountData(WorldPacket& recvPacket); void HandleRequestAccountData(WorldPacket& recvPacket); @@ -507,17 +505,17 @@ class WorldSession void HandleMoveWorldportAckOpcode(); // for server-side calls void HandleMovementOpcodes(WorldPacket& recvPacket); - void HandleSetActiveMoverOpcode(WorldPacket &recv_data); - void HandleMoveNotActiveMover(WorldPacket &recv_data); - void HandleDismissControlledVehicle(WorldPacket &recv_data); - void HandleRequestVehicleExit(WorldPacket &recv_data); - void HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data); - void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data); + void HandleSetActiveMoverOpcode(WorldPacket& recv_data); + void HandleMoveNotActiveMover(WorldPacket& recv_data); + void HandleDismissControlledVehicle(WorldPacket& recv_data); + void HandleRequestVehicleExit(WorldPacket& recv_data); + void HandleChangeSeatsOnControlledVehicle(WorldPacket& recv_data); + void HandleMoveTimeSkippedOpcode(WorldPacket& recv_data); - void HandleRequestRaidInfoOpcode(WorldPacket & recv_data); + void HandleRequestRaidInfoOpcode(WorldPacket& recv_data); - void HandleBattlefieldStatusOpcode(WorldPacket &recv_data); - void HandleBattleMasterHelloOpcode(WorldPacket &recv_data); + void HandleBattlefieldStatusOpcode(WorldPacket& recv_data); + void HandleBattleMasterHelloOpcode(WorldPacket& recv_data); void HandleGroupInviteOpcode(WorldPacket& recvPacket); //void HandleGroupCancelOpcode(WorldPacket& recvPacket); @@ -527,17 +525,17 @@ class WorldSession void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket); void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket); void HandleGroupDisbandOpcode(WorldPacket& recvPacket); - void HandleOptOutOfLootOpcode(WorldPacket &recv_data); + void HandleOptOutOfLootOpcode(WorldPacket& recv_data); void HandleLootMethodOpcode(WorldPacket& recvPacket); - void HandleLootRoll(WorldPacket &recv_data); - void HandleRequestPartyMemberStatsOpcode(WorldPacket &recv_data); - void HandleRaidTargetUpdateOpcode(WorldPacket & recv_data); - void HandleRaidReadyCheckOpcode(WorldPacket & recv_data); - void HandleRaidReadyCheckFinishedOpcode(WorldPacket & recv_data); - void HandleGroupRaidConvertOpcode(WorldPacket & recv_data); - void HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data); - void HandleGroupAssistantLeaderOpcode(WorldPacket & recv_data); - void HandlePartyAssignmentOpcode(WorldPacket & recv_data); + void HandleLootRoll(WorldPacket& recv_data); + void HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data); + void HandleRaidTargetUpdateOpcode(WorldPacket& recv_data); + void HandleRaidReadyCheckOpcode(WorldPacket& recv_data); + void HandleRaidReadyCheckFinishedOpcode(WorldPacket& recv_data); + void HandleGroupRaidConvertOpcode(WorldPacket& recv_data); + void HandleGroupChangeSubGroupOpcode(WorldPacket& recv_data); + void HandleGroupAssistantLeaderOpcode(WorldPacket& recv_data); + void HandlePartyAssignmentOpcode(WorldPacket& recv_data); void HandlePetitionBuyOpcode(WorldPacket& recv_data); void HandlePetitionShowSignOpcode(WorldPacket& recv_data); @@ -613,25 +611,25 @@ class WorldSession void HandleUnacceptTradeOpcode(WorldPacket& recvPacket); void HandleAuctionHelloOpcode(WorldPacket& recvPacket); - void HandleAuctionListItems(WorldPacket & recv_data); - void HandleAuctionListBidderItems(WorldPacket & recv_data); - void HandleAuctionSellItem(WorldPacket & recv_data); - void HandleAuctionRemoveItem(WorldPacket & recv_data); - void HandleAuctionListOwnerItems(WorldPacket & recv_data); - void HandleAuctionPlaceBid(WorldPacket & recv_data); - void HandleAuctionListPendingSales(WorldPacket & recv_data); - - void HandleGetMailList(WorldPacket & recv_data); - void HandleSendMail(WorldPacket & recv_data); - void HandleMailTakeMoney(WorldPacket & recv_data); - void HandleMailTakeItem(WorldPacket & recv_data); - void HandleMailMarkAsRead(WorldPacket & recv_data); - void HandleMailReturnToSender(WorldPacket & recv_data); - void HandleMailDelete(WorldPacket & recv_data); - void HandleItemTextQuery(WorldPacket & recv_data); - void HandleMailCreateTextItem(WorldPacket & recv_data); - void HandleQueryNextMailTime(WorldPacket & recv_data); - void HandleCancelChanneling(WorldPacket & recv_data); + void HandleAuctionListItems(WorldPacket& recv_data); + void HandleAuctionListBidderItems(WorldPacket& recv_data); + void HandleAuctionSellItem(WorldPacket& recv_data); + void HandleAuctionRemoveItem(WorldPacket& recv_data); + void HandleAuctionListOwnerItems(WorldPacket& recv_data); + void HandleAuctionPlaceBid(WorldPacket& recv_data); + void HandleAuctionListPendingSales(WorldPacket& recv_data); + + void HandleGetMailList(WorldPacket& recv_data); + void HandleSendMail(WorldPacket& recv_data); + void HandleMailTakeMoney(WorldPacket& recv_data); + void HandleMailTakeItem(WorldPacket& recv_data); + void HandleMailMarkAsRead(WorldPacket& recv_data); + void HandleMailReturnToSender(WorldPacket& recv_data); + void HandleMailDelete(WorldPacket& recv_data); + void HandleItemTextQuery(WorldPacket& recv_data); + void HandleMailCreateTextItem(WorldPacket& recv_data); + void HandleQueryNextMailTime(WorldPacket& recv_data); + void HandleCancelChanneling(WorldPacket& recv_data); void SendItemPageInfo(ItemTemplate* itemProto); void HandleSplitItemOpcode(WorldPacket& recvPacket); @@ -645,9 +643,9 @@ class WorldSession void HandleListInventoryOpcode(WorldPacket& recvPacket); void HandleAutoStoreBagItemOpcode(WorldPacket& recvPacket); void HandleReadItem(WorldPacket& recvPacket); - void HandleAutoEquipItemSlotOpcode(WorldPacket & recvPacket); - void HandleSwapItem(WorldPacket & recvPacket); - void HandleBuybackItem(WorldPacket & recvPacket); + void HandleAutoEquipItemSlotOpcode(WorldPacket& recvPacket); + void HandleSwapItem(WorldPacket& recvPacket); + void HandleBuybackItem(WorldPacket& recvPacket); void HandleAutoBankItemOpcode(WorldPacket& recvPacket); void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket); void HandleWrapItemOpcode(WorldPacket& recvPacket); @@ -728,18 +726,18 @@ class WorldSession void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket); void HandlePageTextQueryOpcode(WorldPacket& recvPacket); - void HandleTutorialFlag (WorldPacket & recv_data); - void HandleTutorialClear(WorldPacket & recv_data); - void HandleTutorialReset(WorldPacket & recv_data); + void HandleTutorialFlag (WorldPacket& recv_data); + void HandleTutorialClear(WorldPacket& recv_data); + void HandleTutorialReset(WorldPacket& recv_data); //Pet - void HandlePetAction(WorldPacket & recv_data); + void HandlePetAction(WorldPacket& recv_data); void HandlePetStopAttack(WorldPacket& recv_data); void HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2); - void HandlePetNameQuery(WorldPacket & recv_data); - void HandlePetSetAction(WorldPacket & recv_data); - void HandlePetAbandon(WorldPacket & recv_data); - void HandlePetRename(WorldPacket & recv_data); + void HandlePetNameQuery(WorldPacket& recv_data); + void HandlePetSetAction(WorldPacket& recv_data); + void HandlePetAbandon(WorldPacket& recv_data); + void HandlePetRename(WorldPacket& recv_data); void HandlePetCancelAuraOpcode(WorldPacket& recvPacket); void HandlePetSpellAutocastOpcode(WorldPacket& recvPacket); void HandlePetCastSpellOpcode(WorldPacket& recvPacket); @@ -756,15 +754,15 @@ class WorldSession void HandleDismissCritter(WorldPacket& recv_data); //Battleground - void HandleBattlemasterHelloOpcode(WorldPacket &recv_data); - void HandleBattlemasterJoinOpcode(WorldPacket &recv_data); + void HandleBattlemasterHelloOpcode(WorldPacket& recv_data); + void HandleBattlemasterJoinOpcode(WorldPacket& recv_data); void HandleBattlegroundPlayerPositionsOpcode(WorldPacket& recv_data); - void HandlePVPLogDataOpcode(WorldPacket &recv_data); - void HandleBattleFieldPortOpcode(WorldPacket &recv_data); - void HandleBattlefieldListOpcode(WorldPacket &recv_data); - void HandleLeaveBattlefieldOpcode(WorldPacket &recv_data); - void HandleBattlemasterJoinArena(WorldPacket &recv_data); - void HandleReportPvPAFK(WorldPacket &recv_data); + void HandlePVPLogDataOpcode(WorldPacket& recv_data); + void HandleBattleFieldPortOpcode(WorldPacket& recv_data); + void HandleBattlefieldListOpcode(WorldPacket& recv_data); + void HandleLeaveBattlefieldOpcode(WorldPacket& recv_data); + void HandleBattlemasterJoinArena(WorldPacket& recv_data); + void HandleReportPvPAFK(WorldPacket& recv_data); void HandleWardenDataOpcode(WorldPacket& recv_data); void HandleWorldTeleportOpcode(WorldPacket& recv_data); @@ -783,17 +781,17 @@ class WorldSession void HandleInstanceLockResponse(WorldPacket& recvPacket); // Looking for Dungeon/Raid - void HandleLfgSetCommentOpcode(WorldPacket & recv_data); + void HandleLfgSetCommentOpcode(WorldPacket& recv_data); void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recv_data); void HandleLfgPartyLockInfoRequestOpcode(WorldPacket& recv_data); - void HandleLfgJoinOpcode(WorldPacket &recv_data); - void HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/); - void HandleLfgSetRolesOpcode(WorldPacket &recv_data); - void HandleLfgProposalResultOpcode(WorldPacket &recv_data); - void HandleLfgSetBootVoteOpcode(WorldPacket &recv_data); - void HandleLfgTeleportOpcode(WorldPacket &recv_data); - void HandleLfrSearchOpcode(WorldPacket &recv_data); - void HandleLfrLeaveOpcode(WorldPacket &recv_data); + void HandleLfgJoinOpcode(WorldPacket& recv_data); + void HandleLfgLeaveOpcode(WorldPacket& recv_data); + void HandleLfgSetRolesOpcode(WorldPacket& recv_data); + void HandleLfgProposalResultOpcode(WorldPacket& recv_data); + void HandleLfgSetBootVoteOpcode(WorldPacket& recv_data); + void HandleLfgTeleportOpcode(WorldPacket& recv_data); + void HandleLfrSearchOpcode(WorldPacket& recv_data); + void HandleLfrLeaveOpcode(WorldPacket& recv_data); void SendLfgUpdatePlayer(const LfgUpdateData& updateData); void SendLfgUpdateParty(const LfgUpdateData& updateData); @@ -836,7 +834,7 @@ class WorldSession void HandleItemRefundInfoRequest(WorldPacket& recv_data); void HandleItemRefund(WorldPacket& recv_data); - void HandleChannelVoiceOnOpcode(WorldPacket & recv_data); + void HandleChannelVoiceOnOpcode(WorldPacket& recv_data); void HandleVoiceSessionEnableOpcode(WorldPacket& recv_data); void HandleSetActiveVoiceChannel(WorldPacket& recv_data); void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data); @@ -878,7 +876,7 @@ class WorldSession void HandleCalendarGetNumPending(WorldPacket& recv_data); void HandleSpellClick(WorldPacket& recv_data); - void HandleMirrorImageDataRequest(WorldPacket & recv_data); + void HandleMirrorImageDataRequest(WorldPacket& recv_data); void HandleAlterAppearance(WorldPacket& recv_data); void HandleRemoveGlyph(WorldPacket& recv_data); void HandleCharCustomize(WorldPacket& recv_data); @@ -890,8 +888,8 @@ class WorldSession void HandleReadyForAccountDataTimes(WorldPacket& recv_data); void HandleQueryQuestsCompleted(WorldPacket& recv_data); void HandleQuestPOIQuery(WorldPacket& recv_data); - void HandleEjectPassenger(WorldPacket &data); - void HandleEnterPlayerVehicle(WorldPacket &data); + void HandleEjectPassenger(WorldPacket& data); + void HandleEnterPlayerVehicle(WorldPacket& data); void HandleUpdateProjectilePosition(WorldPacket& recvPacket); private: diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 3875156289e..0ddc03e3d5c 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -802,7 +802,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) recvPacket >> clientSeed; recvPacket >> unk5 >> unk6 >> unk7; recvPacket >> unk4; - recvPacket.read (digest, 20); + recvPacket.read(digest, 20); sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", BuiltNumberClient, diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index ec29273d6b0..b7d48f3ece5 100755 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.cpp @@ -192,7 +192,7 @@ class ReactorRunnable : protected ACE_Task_Base } } - sLog->outStaticDebug ("Network Thread Exitting"); + sLog->outStaticDebug ("Network Thread exits"); return 0; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 98b0303a30b..ed585739399 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5711,9 +5711,8 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const // eff_radius == 0 float radius = GetSpellInfo()->GetMaxRange(false); - CellPair p(Trinity::ComputeCellPair(target->GetPositionX(), target->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(target->GetPositionX(), target->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck u_check(target, radius); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck> checker(target, targets, u_check); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 16243396ebb..4d7534509e4 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -598,9 +598,8 @@ WorldObject* Spell::FindCorpseUsing() // non-standard target selection float max_range = m_spellInfo->GetMaxRange(false); - CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); WorldObject* result = NULL; @@ -1202,7 +1201,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied //Spells with this flag cannot trigger if effect is casted on self - // Slice and Dice, relentless strikes, eviscerate bool canEffectTrigger = !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && CanExecuteTriggersOnHit(mask); Unit* spellHitTarget = NULL; @@ -1598,12 +1596,12 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) // this is executed after spell proc spells on target hit // spells are triggered for each hit spell target // info confirmed with retail sniffs of permafrost and shadow weaving - if (!m_hitTriggerSpells.empty() && CanExecuteTriggersOnHit(effMask)) + if (!m_hitTriggerSpells.empty()) { int _duration = 0; for (HitTriggerSpells::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) { - if (roll_chance_i(i->second)) + if (CanExecuteTriggersOnHit(effMask, i->first) && roll_chance_i(i->second)) { m_caster->CastSpell(unit, i->first, true); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id); @@ -5639,7 +5637,16 @@ SpellCastResult Spell::CheckRange(bool strict) if (!strict && m_casttime == 0) return SPELL_CAST_OK; - uint32 range_type = m_spellInfo->RangeEntry ? m_spellInfo->RangeEntry->type : 0; + uint32 range_type = 0; + + if (m_spellInfo->RangeEntry) + { + // self cast is used for triggered spells, no range checking needed + if (m_spellInfo->RangeEntry->ID == 1) + return SPELL_CAST_OK; + + range_type = m_spellInfo->RangeEntry->type; + } Unit* target = m_targets.GetUnitTarget(); float max_range = m_caster->GetSpellMaxRangeForTarget(target, m_spellInfo); @@ -5820,9 +5827,8 @@ SpellCastResult Spell::CheckItems() // check spell focus object if (m_spellInfo->RequiresSpellFocus) { - CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; GameObject* ok = NULL; Trinity::GameObjectFocusCheck go_check(m_caster, m_spellInfo->RequiresSpellFocus); @@ -7085,17 +7091,17 @@ void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTarget } } -bool Spell::CanExecuteTriggersOnHit(uint8 effMask) const +bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo) const { - // check which effects can trigger proc - // don't allow to proc for dummy-only spell target hits - // prevents triggering/procing effects twice from spells like Eviscerate - for (uint8 i = 0;effMask && i < MAX_SPELL_EFFECTS; ++i) + bool only_on_dummy = (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_DUMMY)); + // If triggered spell has SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can only proc on a casted spell with SPELL_EFFECT_DUMMY + // If triggered spell doesn't have SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can NOT proc on SPELL_EFFECT_DUMMY (needs confirmation) + for (uint8 i = 0;i < MAX_SPELL_EFFECTS; ++i) { - if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY) - effMask &= ~(1<<i); + if ((effMask & (1 << i)) && (only_on_dummy == (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY))) + return true; } - return effMask; + return false; } void Spell::PrepareTriggersExecutedOnHit() diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 27b0844f32e..65ed47af322 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -633,7 +633,7 @@ class Spell void CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex); std::list<SpellScript*> m_loadedScripts; - bool CanExecuteTriggersOnHit(uint8 effMask) const; + bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo = NULL) const; void PrepareTriggersExecutedOnHit(); typedef std::list< std::pair<SpellInfo const*, int32> > HitTriggerSpells; HitTriggerSpells m_hitTriggerSpells; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 19f84854ae4..83cecf7d884 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -456,7 +456,11 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); // Shield Slam else if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209) - damage += int32(m_caster->ApplyEffectModifiers(m_spellInfo, effIndex, float(m_caster->GetShieldBlockValue()))); + { + uint8 level = m_caster->getLevel(); + uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f)); + damage += int32(m_caster->ApplyEffectModifiers(m_spellInfo, effIndex, float(block_value))); + } // Victory Rush else if (m_spellInfo->SpellFamilyFlags[1] & 0x100) ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); @@ -716,7 +720,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Shield of Righteousness if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x100000) { - damage += CalculatePctN(m_caster->GetShieldBlockValue(), m_spellInfo->Effects[EFFECT_1].CalcValue()); + uint8 level = m_caster->getLevel(); + uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f)); + damage += CalculatePctN(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue()); break; } break; @@ -1663,13 +1669,6 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } return; } - // Priest Shadowfiend (34433) need apply mana gain trigger aura on pet - case 41967: - { - if (Unit* pet = unitTarget->GetGuardianPet()) - pet->CastSpell(pet, 28305, true); - return; - } } } @@ -3575,7 +3574,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) // add new enchanting if equipped item_owner->ApplyEnchantment(itemTarget, PERM_ENCHANTMENT_SLOT, true); - itemTarget->SetSoulboundTradeable(NULL, item_owner, false); + itemTarget->ClearSoulboundTradeable(item_owner); } } @@ -3639,7 +3638,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) // add new enchanting if equipped item_owner->ApplyEnchantment(itemTarget, PRISMATIC_ENCHANTMENT_SLOT, true); - itemTarget->SetSoulboundTradeable(NULL, item_owner, false); + itemTarget->ClearSoulboundTradeable(item_owner); } void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 4fc9564baa3..35e380736c5 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -694,6 +694,38 @@ void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& } } +bool SpellMgr::AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int32 amount, std::map<SpellGroup, int32>& groups) const +{ + uint32 spellId = spellInfo->GetFirstRankSpell()->Id; + SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellId); + // Find group with SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT if it belongs to one + for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr) + { + SpellGroup group = itr->second; + SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(group); + if (found != mSpellGroupStack.end()) + { + if (found->second == SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT) + { + // Put the highest amount in the map + if (groups.find(group) == groups.end()) + groups[group] = amount; + else + { + int32 curr_amount = groups[group]; + // Take absolute value because this also counts for the highest negative aura + if (abs(curr_amount) < abs(amount)) + groups[group] = amount; + } + // return because a spell should be in only one SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT group + return true; + } + } + } + // Not in a SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT group, so return false + return false; +} + SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const { uint32 spellid_1 = spellInfo1->GetFirstRankSpell()->Id; @@ -3116,6 +3148,7 @@ void SpellMgr::LoadDbcDataCorrections() case 51726: spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; spellInfo->SpellFamilyFlags[2] = 0x10; + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN; break; case 41913: // Parasitic Shadowfiend Passive spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends @@ -3146,6 +3179,24 @@ void SpellMgr::LoadDbcDataCorrections() case 6474: // Earthbind Totem (instant pulse) spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY; break; + case 2895: // Wrath of Air Totem rank 1 (Aura) + case 68933: // Wrath of Air Totem rank 2 (Aura) + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + case 52109: // Flametongue Totem rank 1 (Aura) + case 52110: // Flametongue Totem rank 2 (Aura) + case 52111: // Flametongue Totem rank 3 (Aura) + case 52112: // Flametongue Totem rank 4 (Aura) + case 52113: // Flametongue Totem rank 5 (Aura) + case 58651: // Flametongue Totem rank 6 (Aura) + case 58654: // Flametongue Totem rank 7 (Aura) + case 58655: // Flametongue Totem rank 8 (Aura) + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetB[1] = 0; + break; case 53241: // Marked for Death (Rank 1) case 53243: // Marked for Death (Rank 2) case 53244: // Marked for Death (Rank 3) diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index d701ab2882c..a3c4779e9f3 100755 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -322,6 +322,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap; enum SpellGroup { + SPELL_GROUP_NONE = 0, SPELL_GROUP_ELIXIR_BATTLE = 1, SPELL_GROUP_ELIXIR_GUARDIAN = 2, SPELL_GROUP_ELIXIR_UNSTABLE = 3, @@ -344,8 +345,9 @@ enum SpellGroupStackRule SPELL_GROUP_STACK_RULE_DEFAULT = 0, SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1, SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2, + SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3, }; -#define SPELL_GROUP_STACK_RULE_MAX 3 +#define SPELL_GROUP_STACK_RULE_MAX 4 typedef std::map<SpellGroup, SpellGroupStackRule> SpellGroupStackMap; @@ -596,6 +598,7 @@ class SpellMgr void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells, std::set<SpellGroup>& usedGroups) const; // Spell Group Stack Rules table + bool AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int32 amount, std::map<SpellGroup, int32>& groups) const; SpellGroupStackRule CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const; // Spell proc event table diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 2a352e92d01..68ccf96bb87 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -117,8 +117,8 @@ public: bool first = true; bool footer = false; - ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true); - HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers(); + ACE_READ_GUARD_RETURN(HashMapHolder<Player>::LockType, guard, *HashMapHolder<Player>::GetLock(), true); + HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { AccountTypes itrSec = itr->second->GetSession()->GetSecurity(); diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp index 2a270527fb8..eb791b35e58 100644 --- a/src/server/scripts/Commands/cs_gps.cpp +++ b/src/server/scripts/Commands/cs_gps.cpp @@ -70,7 +70,7 @@ public: return false; } } - CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellCoord cell_val = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); Cell cell(cell_val); uint32 zone_id, area_id; @@ -89,7 +89,7 @@ public: float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); - GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY()); + GridCoord p = Trinity::ComputeGridCoord(obj->GetPositionX(), obj->GetPositionY()); // 63? WHY? int gx = 63 - p.x_coord; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 4de719d684e..4e3f3899b35 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -484,15 +484,14 @@ public: float x, y, z; me->GetPosition(x, y, z); - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, entry, 100); Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index ba2d638d45f..413897c94e8 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -189,22 +189,21 @@ class boss_akilzon : public CreatureScript for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Unit*> tempUnitMap; { - Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, 999); + Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS); Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); - cell.Visit(p, world_unit_searcher, *(me->GetMap())); - cell.Visit(p, grid_unit_searcher, *(me->GetMap())); + cell.Visit(p, world_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); + cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); } //dealdamege for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index d2ad81b4910..aea9e322583 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -233,9 +233,8 @@ class boss_janalai : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, MOB_EGG, 100); @@ -243,7 +242,7 @@ class boss_janalai : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } //sLog->outError("Eggs %d at middle", templist.size()); @@ -267,9 +266,8 @@ class boss_janalai : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, MOB_FIRE_BOMB, 100); @@ -277,7 +275,7 @@ class boss_janalai : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) { @@ -519,9 +517,8 @@ class mob_janalai_hatcher : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(me, 23817, 50); @@ -529,7 +526,7 @@ class mob_janalai_hatcher : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } //sLog->outError("Eggs %d at %d", templist.size(), side); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 17968766a5f..3ff465a3c1d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -162,9 +162,8 @@ class boss_nalorakk : public CreatureScript me->GetPosition(x, y, z); { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::AllFriendlyCreaturesInGrid check(me); @@ -172,7 +171,7 @@ class boss_nalorakk : public CreatureScript TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } if (templist.empty()) diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index 10b7066068b..d02cce3f17c 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -35,91 +35,6 @@ EndContentData */ #include "ScriptedEscortAI.h" /*###### -## npc_prospector_anvilward -######*/ - -#define GOSSIP_HELLO "I need a moment of your time, sir." -#define GOSSIP_SELECT "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward." - -enum eProspectorAnvilward -{ - SAY_ANVIL1 = -1000209, - SAY_ANVIL2 = -1000210, - QUEST_THE_DWARVEN_SPY = 8483, -}; - -class npc_prospector_anvilward : public CreatureScript -{ -public: - npc_prospector_anvilward() : CreatureScript("npc_prospector_anvilward") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(8240, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->CLOSE_GOSSIP_MENU(); - if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilward::npc_prospector_anvilwardAI, creature->AI())) - pEscortAI->Start(true, false, player->GetGUID()); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - player->SEND_GOSSIP_MENU(8239, creature->GetGUID()); - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_prospector_anvilwardAI(creature); - } - - struct npc_prospector_anvilwardAI : public npc_escortAI - { - // CreatureAI functions - npc_prospector_anvilwardAI(Creature* c) : npc_escortAI(c) {} - - // Pure Virtual Functions - void WaypointReached(uint32 i) - { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) - { - case 0: DoScriptText(SAY_ANVIL1, me, player); break; - case 5: DoScriptText(SAY_ANVIL2, me, player); break; - case 6: me->setFaction(24); break; - } - } - - void Reset() - { - me->RestoreFaction(); - } - - void JustDied(Unit* /*killer*/) - { - me->RestoreFaction(); - } - }; - -}; - -/*###### ## Quest 9686 Second Trial ######*/ @@ -711,7 +626,6 @@ public: void AddSC_eversong_woods() { - new npc_prospector_anvilward(); new npc_second_trial_controller(); new npc_second_trial_paladin(); new go_second_trial(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 6186369a3a0..187ff9b9dd7 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -459,7 +459,9 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if (creature) CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true; - }else{//summon at gate + } + else + {//summon at gate creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10, 10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10, 10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); } break; @@ -910,6 +912,7 @@ void hyjalAI::UpdateAI(const uint32 diff) DoMeleeAttackIfReady(); } + void hyjalAI::JustDied(Unit* /*killer*/) { if (IsDummy)return; @@ -932,23 +935,20 @@ void hyjalAI::JustDied(Unit* /*killer*/) instance->SetData(DATA_RESET_RAIDDAMAGE, 0);//reset damage on die } } + void hyjalAI::HideNearPos(float x, float y) { - CellPair pair(Trinity::ComputeCellPair(x, y)); + CellCoord pair(Trinity::ComputeCellCoord(x, y)); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); // First get all creatures. std::list<Creature*> creatures; Trinity::AllFriendlyCreaturesInGrid creature_check(me); Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check); - TypeContainerVisitor - <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, - GridTypeMapContainer> creature_visitor(creature_searcher); - // Get Creatures - cell.Visit(pair, creature_visitor, *(me->GetMap())); + TypeContainerVisitor <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher); + cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) { @@ -959,18 +959,19 @@ void hyjalAI::HideNearPos(float x, float y) } } } + void hyjalAI::RespawnNearPos(float x, float y) { - CellPair p(Trinity::ComputeCellPair(x, y)); + CellCoord p(Trinity::ComputeCellCoord(x, y)); Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::RespawnDo u_do; Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(me, u_do); TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker); - cell.Visit(p, obj_worker, *me->GetMap()); + cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange()); } + void hyjalAI::WaypointReached(uint32 i) { if (i == 1 || (i == 0 && me->GetEntry() == THRALL)) @@ -992,9 +993,8 @@ void hyjalAI::WaypointReached(uint32 i) } //do some talking //all alive guards walk near here - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); // First get all creatures. @@ -1005,7 +1005,7 @@ void hyjalAI::WaypointReached(uint32 i) <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher); - cell.Visit(pair, creature_visitor, *(me->GetMap())); + cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) { @@ -1034,9 +1034,8 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) { if (TeleportTimer <= diff) { - CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> creatures; @@ -1046,7 +1045,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher); - cell.Visit(pair, creature_visitor, *(me->GetMap())); + cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) { diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index dea3d6eaede..605f3a11c8a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -118,7 +118,7 @@ public: return; float x=0.0f, y=0.0f, z=0.0f; - me->GetRespawnCoord(x, y, z); + me->GetRespawnPosition(x, y, z); if (uiCheckDistanceTimer <= uiDiff) uiCheckDistanceTimer = 5*IN_MILLISECONDS; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index e4749fd2ffe..be83c4d326a 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -284,7 +284,7 @@ public: if (m_uiPenetratingColdTimer <= uiDiff) { - me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5)); + me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5)); m_uiPenetratingColdTimer = 20*IN_MILLISECONDS; } else m_uiPenetratingColdTimer -= uiDiff; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 1688624be91..38f334058b8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -1227,7 +1227,7 @@ class npc_tirion_fordring_tft : public CreatureScript SetEquipmentSlots(true); // remove glow on ashbringer } - void sGossipSelect(Player* player, uint32 sender, uint32 action) + void sGossipSelect(Player* /*player*/, uint32 sender, uint32 action) { if (me->GetCreatureInfo()->GossipMenuId == sender && !action) { @@ -1407,14 +1407,14 @@ class npc_raging_spirit : public CreatureScript DoCast(me, SPELL_BOSS_HITTIN_YA, true); } - void IsSummonedBy(Unit* summoner) + void IsSummonedBy(Unit* /*summoner*/) { // player is the spellcaster so register summon manually if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) lichKing->AI()->JustSummoned(me); } - void JustDied(Unit* killer) + void JustDied(Unit* /*killer*/) { if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); @@ -1931,7 +1931,7 @@ class npc_spirit_bomb : public CreatureScript { } - void IsSummonedBy(Unit* summoner) + void IsSummonedBy(Unit* /*summoner*/) { float destX, destY, destZ; me->GetPosition(destX, destY); @@ -1954,7 +1954,7 @@ class npc_spirit_bomb : public CreatureScript { } - void UpdateAI(uint32 const diff) + void UpdateAI(uint32 const /*diff*/) { UpdateVictim(); // no melee attacks @@ -1983,7 +1983,7 @@ class npc_broken_frostmourne : public CreatureScript _events.Reset(); } - void IsSummonedBy(Unit* summoner) + void IsSummonedBy(Unit* /*summoner*/) { _events.SetPhase(PHASE_OUTRO); _events.ScheduleEvent(EVENT_OUTRO_KNOCK_BACK, 3000, 0, PHASE_OUTRO); @@ -2087,7 +2087,6 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* newCaster = GetTarget(); switch (GetTargetApplication()->GetRemoveMode()) { case AURA_REMOVE_BY_ENEMY_SPELL: @@ -2250,7 +2249,7 @@ class spell_the_lich_king_shadow_trap_visual : public SpellScriptLoader { PrepareAuraScript(spell_the_lich_king_shadow_trap_visual_AuraScript); - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_TRAP_AURA, TRIGGERED_NONE); @@ -2633,7 +2632,7 @@ class spell_the_lich_king_cast_back_to_caster : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_cast_back_to_caster_SpellScript); - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); } diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index be9e9308f4f..8ff5a314dcc 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -70,8 +70,9 @@ public: return; Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - - if (!player || player->isGameMaster() || player->IsBeingTeleported()) + + // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass + if (!player || player->isGameMaster() || player->IsBeingTeleported() || player->HasAura(70973) || player->HasAura(70971)) return; switch (me->GetEntry()) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index c081f0970f2..9b0a4a469ae 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -384,7 +384,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO int32 count = 10; uint32 itemid = 24538; // bomb id count - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount); if (msg != EQUIP_ERR_OK) // convert to possible store amount count -= noSpaceForCount; diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index b639050320c..726edb5efb2 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -19,330 +19,20 @@ /* ScriptData SDName: Nagrand SD%Complete: 90 -SDComment: Quest support: 9849, 9868, 9918, 9874, 9991, 10107, 10108, 10044, 10172, 10646, 10085, 10987. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) +SDComment: Quest support: 9868, 9874, 10044, 10172, 10085. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text) SDCategory: Nagrand EndScriptData */ /* ContentData -mob_shattered_rumbler -mob_lump -npc_altruis_the_sufferer npc_greatmother_geyah -npc_lantresor_of_the_blade npc_maghar_captive npc_creditmarker_visit_with_ancestors -mob_sparrowhawk EndContentData */ #include "ScriptPCH.h" #include "ScriptedEscortAI.h" /*###### -## mob_shattered_rumbler - this should be done with ACID -######*/ - -class mob_shattered_rumbler : public CreatureScript -{ -public: - mob_shattered_rumbler() : CreatureScript("mob_shattered_rumbler") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_shattered_rumblerAI (creature); - } - - struct mob_shattered_rumblerAI : public ScriptedAI - { - bool Spawn; - - mob_shattered_rumblerAI(Creature* c) : ScriptedAI(c) {} - - void Reset() - { - Spawn = false; - } - - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit* Hitter, const SpellInfo* Spellkind) - { - if (Spellkind->Id == 32001 && !Spawn) - { - float x = me->GetPositionX(); - float y = me->GetPositionY(); - float z = me->GetPositionZ(); - - Hitter->SummonCreature(18181, x+(0.7f * (rand()%30)), y+(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - Hitter->SummonCreature(18181, x+(rand()%5), y-(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - Hitter->SummonCreature(18181, x-(rand()%5), y+(0.5f *(rand()%60)), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - me->setDeathState(CORPSE); - Spawn = true; - } - return; - } - }; - -}; - -/*###### -## mob_lump -######*/ - -#define SPELL_VISUAL_SLEEP 16093 -#define SPELL_SPEAR_THROW 32248 - -#define LUMP_SAY0 -1000190 -#define LUMP_SAY1 -1000191 - -#define LUMP_DEFEAT -1000192 - -#define GOSSIP_HL "I need answers, ogre!" -#define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory." -#define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar." -#define GOSSIP_SL3 "This means war, Lump! War I say!" - -class mob_lump : public CreatureScript -{ -public: - mob_lump() : CreatureScript("mob_lump") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(9353, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(9354, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(9355, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->SEND_GOSSIP_MENU(9356, creature->GetGUID()); - player->TalkedToCreature(18354, creature->GetGUID()); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - player->SEND_GOSSIP_MENU(9352, creature->GetGUID()); - - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_lumpAI(creature); - } - - struct mob_lumpAI : public ScriptedAI - { - mob_lumpAI(Creature* c) : ScriptedAI(c) - { - bReset = false; - } - - uint32 Reset_Timer; - uint32 Spear_Throw_Timer; - bool bReset; - - void Reset() - { - Reset_Timer = 60000; - Spear_Throw_Timer = 2000; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* done_by, uint32 & damage) - { - if (done_by->GetTypeId() == TYPEID_PLAYER && me->HealthBelowPctDamaged(30, damage)) - { - if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - { - //Take 0 damage - damage = 0; - - CAST_PLR(done_by)->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->setFaction(1080); //friendly - me->SetStandState(UNIT_STAND_STATE_SIT); - DoScriptText(LUMP_DEFEAT, me); - - bReset = true; - } - } - } - - void EnterCombat(Unit* /*who*/) - { - if (me->HasAura(SPELL_VISUAL_SLEEP)) - me->RemoveAura(SPELL_VISUAL_SLEEP); - - if (!me->IsStandState()) - me->SetStandState(UNIT_STAND_STATE_STAND); - - DoScriptText(RAND(LUMP_SAY0, LUMP_SAY1), me); - } - - void UpdateAI(const uint32 diff) - { - //check if we waiting for a reset - if (bReset) - { - if (Reset_Timer <= diff) - { - EnterEvadeMode(); - bReset = false; - me->setFaction(1711); //hostile - return; - } - else Reset_Timer -= diff; - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - //Spear_Throw_Timer - if (Spear_Throw_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SPEAR_THROW); - Spear_Throw_Timer = 20000; - } else Spear_Throw_Timer -= diff; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## npc_altruis_the_sufferer -######*/ - -#define GOSSIP_HATS1 "I see twisted steel and smell sundered earth." -#define GOSSIP_HATS2 "Well...?" -#define GOSSIP_HATS3 "[PH] Story about Illidan's Pupil" - -#define GOSSIP_SATS1 "Legion?" -#define GOSSIP_SATS2 "And now?" -#define GOSSIP_SATS3 "How do you see them now?" -#define GOSSIP_SATS4 "Forge camps?" -#define GOSSIP_SATS5 "Ok." -#define GOSSIP_SATS6 "[PH] Story done" - -class npc_altruis_the_sufferer : public CreatureScript -{ -public: - npc_altruis_the_sufferer() : CreatureScript("npc_altruis_the_sufferer") { } - - bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* /*quest*/) - { - if (!player->GetQuestRewardStatus(9991)) //Survey the Land, q-id 9991 - { - player->CLOSE_GOSSIP_MENU(); - player->ActivateTaxiPathTo(532); //TaxiPath 532 - } - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+10: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - player->SEND_GOSSIP_MENU(9420, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - player->SEND_GOSSIP_MENU(9421, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+12: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - player->SEND_GOSSIP_MENU(9422, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+13: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - player->SEND_GOSSIP_MENU(9423, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+14: - player->SEND_GOSSIP_MENU(9424, creature->GetGUID()); - break; - - case GOSSIP_ACTION_INFO_DEF+20: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - player->SEND_GOSSIP_MENU(9427, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(9991); - break; - - case GOSSIP_ACTION_INFO_DEF+30: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); - player->SEND_GOSSIP_MENU(384, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+31: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(10646); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - //gossip before obtaining Survey the Land - if (player->GetQuestStatus(9991) == QUEST_STATUS_NONE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); - - //gossip when Survey the Land is incomplete (technically, after the flight) - if (player->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); - - //wowwiki.com/Varedis - if (player->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); - - player->SEND_GOSSIP_MENU(9419, creature->GetGUID()); - - return true; - } - -}; - -/*###### ## npc_greatmother_geyah ######*/ @@ -453,83 +143,6 @@ public: }; -/*###### -## npc_lantresor_of_the_blade -######*/ - -#define GOSSIP_HLB "I have killed many of your ogres, Lantresor. I have no fear." -#define GOSSIP_SLB1 "Should I know? You look like an orc to me." -#define GOSSIP_SLB2 "And the other half?" -#define GOSSIP_SLB3 "I have heard of your kind, but I never thought to see the day when I would meet a half-breed." -#define GOSSIP_SLB4 "My apologies. I did not mean to offend. I am here on behalf of my people." -#define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces." -#define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people." -#define GOSSIP_SLB7 "What do I need to do?" - -class npc_lantresor_of_the_blade : public CreatureScript -{ -public: - npc_lantresor_of_the_blade() : CreatureScript("npc_lantresor_of_the_blade") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(9362, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(9363, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(9364, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->SEND_GOSSIP_MENU(9365, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->SEND_GOSSIP_MENU(9366, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->SEND_GOSSIP_MENU(9367, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - player->SEND_GOSSIP_MENU(9368, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - player->SEND_GOSSIP_MENU(9369, creature->GetGUID()); - if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(10107); - if (player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(10108); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - player->SEND_GOSSIP_MENU(9361, creature->GetGUID()); - - return true; - } - -}; - /*##### ## npc_maghar_captive #####*/ @@ -747,113 +360,9 @@ public: }; /*###### -## mob_sparrowhawk +## go_corkis_prison and npc_corki ######*/ -#define SPELL_SPARROWHAWK_NET 39810 -#define SPELL_ITEM_CAPTIVE_SPARROWHAWK 39812 - -class mob_sparrowhawk : public CreatureScript -{ -public: - mob_sparrowhawk() : CreatureScript("mob_sparrowhawk") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_sparrowhawkAI (creature); - } - - struct mob_sparrowhawkAI : public ScriptedAI - { - - mob_sparrowhawkAI(Creature* c) : ScriptedAI(c) {} - - uint32 Check_Timer; - uint64 PlayerGUID; - bool fleeing; - - void Reset() - { - me->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET); - Check_Timer = 1000; - PlayerGUID = 0; - fleeing = false; - } - void AttackStart(Unit* who) - { - if (PlayerGUID) - return; - - ScriptedAI::AttackStart(who); - } - - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit* who) - { - if (!who || PlayerGUID) - return; - - if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) - { - PlayerGUID = who->GetGUID(); - return; - } - - ScriptedAI::MoveInLineOfSight(who); - } - - void UpdateAI(const uint32 diff) - { - if (Check_Timer <= diff) - { - if (PlayerGUID) - { - if (fleeing && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE) - fleeing = false; - - Player* player = Unit::GetPlayer(*me, PlayerGUID); - if (player && me->IsWithinDistInMap(player, 30)) - { - if (!fleeing) - { - me->DeleteThreatList(); - me->GetMotionMaster()->MoveFleeing(player); - fleeing = true; - } - } - else if (fleeing) - { - me->GetMotionMaster()->MovementExpired(false); - PlayerGUID = 0; - fleeing = false; - } - } - Check_Timer = 1000; - } else Check_Timer -= diff; - - if (PlayerGUID) - return; - - ScriptedAI::UpdateAI(diff); - } - - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (caster->GetTypeId() == TYPEID_PLAYER) - { - if (spell->Id == SPELL_SPARROWHAWK_NET && CAST_PLR(caster)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) - { - DoCast(caster, SPELL_ITEM_CAPTIVE_SPARROWHAWK, true); - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - } - return; - } - }; -}; - enum CorkiData { // first quest @@ -916,10 +425,6 @@ public: } }; -/*###### -## npc_corki -######*/ - class npc_corki : public CreatureScript { public: @@ -970,16 +475,241 @@ public: }; }; +/*##### +## npc_kurenai_captive +#####*/ + +enum KurenaiCaptive +{ + SAY_KUR_START = 0, + SAY_KUR_NO_ESCAPE = 1, + SAY_KUR_MORE = 2, + SAY_KUR_MORE_TWO = 3, + SAY_KUR_LIGHTNING = 4, + SAY_KUR_SHOCK = 5, + SAY_KUR_COMPLETE = 6, + + SPELL_KUR_CHAIN_LIGHTNING = 16006, + SPELL_KUR_EARTHBIND_TOTEM = 15786, + SPELL_KUR_FROST_SHOCK = 12548, + SPELL_KUR_HEALING_WAVE = 12491, + + QUEST_TOTEM_KARDASH_A = 9879, + + NPC_KUR_MURK_RAIDER = 18203, + NPC_KUR_MURK_BRUTE = 18211, + NPC_KUR_MURK_SCAVENGER = 18207, + NPC_KUR_MURK_PUTRIFIER = 18202, +}; + +static float kurenaiAmbushA[]= {-1568.805786f, 8533.873047f, 1.958f}; +static float kurenaiAmbushB[]= {-1491.554321f, 8506.483398f, 1.248f}; + +class npc_kurenai_captive : public CreatureScript +{ +public: + npc_kurenai_captive() : CreatureScript("npc_kurenai_captive") { } + + bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) + { + if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_A) + { + if (npc_kurenai_captiveAI* EscortAI = dynamic_cast<npc_kurenai_captiveAI*>(creature->AI())) + { + creature->SetStandState(UNIT_STAND_STATE_STAND); + EscortAI->Start(true, false, player->GetGUID(), quest); + DoScriptText(SAY_KUR_START, creature); + + creature->SummonCreature(NPC_KUR_MURK_RAIDER, kurenaiAmbushA[0]+2.5f, kurenaiAmbushA[1]-2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + creature->SummonCreature(NPC_KUR_MURK_BRUTE, kurenaiAmbushA[0]-2.5f, kurenaiAmbushA[1]+2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + creature->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushA[0], kurenaiAmbushA[1], kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + } + } + return true; + } + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_kurenai_captiveAI(creature); + } + + struct npc_kurenai_captiveAI : public npc_escortAI + { + npc_kurenai_captiveAI(Creature* creature) : npc_escortAI(creature) { } + + uint32 ChainLightningTimer; + uint32 HealTimer; + uint32 FrostShockTimer; + + void Reset() + { + ChainLightningTimer = 1000; + HealTimer = 0; + FrostShockTimer = 6000; + } + + void EnterCombat(Unit* /*who*/) + { + DoCast(me, SPELL_KUR_EARTHBIND_TOTEM, false); + } + + void JustDied(Unit* /*killer*/) + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (Player* player = GetPlayerForEscort()) + { + if (player->GetQuestStatus(QUEST_TOTEM_KARDASH_A) != QUEST_STATUS_COMPLETE) + player->FailQuest(QUEST_TOTEM_KARDASH_A); + } + } + + void WaypointReached(uint32 PointId) + { + switch(PointId) + { + case 3: + { + Talk(SAY_KUR_MORE); + + if (Creature* temp = me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0], kurenaiAmbushB[1], kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) + Talk(SAY_KUR_MORE_TWO); + + me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0]-2.5f, kurenaiAmbushB[1]-2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushB[0]+2.5f, kurenaiAmbushB[1]+2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushB[0]+2.5f, kurenaiAmbushB[1]-2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + } + case 7: + { + Talk(SAY_KUR_COMPLETE); + + if (Player* player = GetPlayerForEscort()) + player->GroupEventHappens(QUEST_TOTEM_KARDASH_A, me); + + SetRun(); + break; + } + } + } + + void JustSummoned(Creature* summoned) + { + if (summoned->GetEntry() == NPC_KUR_MURK_BRUTE) + Talk(SAY_KUR_NO_ESCAPE); + + // This function is for when we summoned enemies to fight - so that does NOT mean we should make our totem count in this! + if (summoned->isTotem()) + return; + + summoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + summoned->AI()->AttackStart(me); + } + + void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) + { + if (spell->Id == SPELL_KUR_CHAIN_LIGHTNING) + { + if (rand()%30) + return; + + Talk(SAY_KUR_LIGHTNING); + } + + if (spell->Id == SPELL_KUR_FROST_SHOCK) + { + if (rand()%30) + return; + + Talk(SAY_KUR_SHOCK); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + if (ChainLightningTimer <= diff) + { + DoCast(me->getVictim(), SPELL_KUR_CHAIN_LIGHTNING); + ChainLightningTimer = urand(7000,14000); + } else ChainLightningTimer -= diff; + + if (HealthBelowPct(30)) + { + if (HealTimer <= diff) + { + DoCast(me, SPELL_KUR_HEALING_WAVE); + HealTimer = 5000; + } else HealTimer -= diff; + } + + if (FrostShockTimer <= diff) + { + DoCast(me->getVictim(), SPELL_KUR_FROST_SHOCK); + FrostShockTimer = urand(7500,15000); + } else FrostShockTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; +}; + +/*###### +## go_warmaul_prison +######*/ + +enum FindingTheSurvivorsData +{ + QUEST_FINDING_THE_SURVIVORS = 9948, + NPC_MAGHAR_PRISONER = 18428, + + SAY_FREE_0 = 0, + SAY_FREE_1 = 1, + SAY_FREE_2 = 2, + SAY_FREE_3 = 3, + SAY_FREE_4 = 4, +}; + +class go_warmaul_prison : public GameObjectScript +{ +public: + go_warmaul_prison() : GameObjectScript("go_warmaul_prison") { } + + bool OnGossipHello(Player* player, GameObject* go) + { + if (player->GetQuestStatus(QUEST_FINDING_THE_SURVIVORS) != QUEST_STATUS_INCOMPLETE) + return false; + + if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 1.0f)) + { + if (prisoner) + { + go->UseDoorOrButton(); + if (player) + player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); + + prisoner->AI()->Talk(RAND(SAY_FREE_0, SAY_FREE_1, SAY_FREE_2, SAY_FREE_3, SAY_FREE_4), player->GetGUID()); + prisoner->ForcedDespawn(6000); + } + } + return true; + } +}; + void AddSC_nagrand() { - new mob_shattered_rumbler(); - new mob_lump(); - new npc_altruis_the_sufferer(); new npc_greatmother_geyah(); - new npc_lantresor_of_the_blade(); new npc_maghar_captive(); new npc_creditmarker_visit_with_ancestors(); - new mob_sparrowhawk(); new npc_corki(); new go_corkis_prison(); + new npc_kurenai_captive(); + new go_warmaul_prison(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 6ae9577070e..3b2cc5f5e00 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -899,7 +899,6 @@ class spell_q9874_liquid_fire : public SpellScriptLoader }; }; - enum SalvagingLifesStength { NPC_SHARD_KILL_CREDIT = 29303, @@ -950,6 +949,7 @@ enum eBattleStandard { NPC_KING_OF_THE_MOUNTAINT_KC = 31766, }; + class spell_q13280_13283_plant_battle_standard: public SpellScriptLoader { public: @@ -978,6 +978,54 @@ public: } }; +enum ChumTheWaterSummons +{ + SUMMON_ANGRY_KVALDIR = 66737, + SUMMON_NORTH_SEA_MAKO = 66738, + SUMMON_NORTH_SEA_THRESHER = 66739, + SUMMON_NORTH_SEA_BLUE_SHARK = 66740 +}; + +class spell_q14112_14145_chum_the_water: public SpellScriptLoader +{ +public: + spell_q14112_14145_chum_the_water() : SpellScriptLoader("spell_q14112_14145_chum_the_water") { } + + class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q14112_14145_chum_the_water_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR)) + return false; + if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO)) + return false; + if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER)) + return false; + if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, RAND(SUMMON_ANGRY_KVALDIR, SUMMON_NORTH_SEA_MAKO, SUMMON_NORTH_SEA_THRESHER, SUMMON_NORTH_SEA_BLUE_SHARK)); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q14112_14145_chum_the_water_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q14112_14145_chum_the_water_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1001,4 +1049,5 @@ void AddSC_quest_spell_scripts() new spell_q9874_liquid_fire(); new spell_q12805_lifeblood_dummy(); new spell_q13280_13283_plant_battle_standard(); + new spell_q14112_14145_chum_the_water(); } diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index ffecf020d24..01aff4bb10f 100755 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -146,12 +146,12 @@ inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; } enum TimeConstants { - MINUTE = 60, - HOUR = MINUTE*60, - DAY = HOUR*24, - WEEK = DAY*7, - MONTH = DAY*30, - YEAR = MONTH*12, + MINUTE = 60, + HOUR = MINUTE*60, + DAY = HOUR*24, + WEEK = DAY*7, + MONTH = DAY*30, + YEAR = MONTH*12, IN_MILLISECONDS = 1000 }; diff --git a/src/server/shared/Cryptography/ARC4.h b/src/server/shared/Cryptography/ARC4.h index 777dbb8cb99..abf753be02f 100755 --- a/src/server/shared/Cryptography/ARC4.h +++ b/src/server/shared/Cryptography/ARC4.h @@ -19,7 +19,7 @@ #ifndef _AUTH_SARC4_H #define _AUTH_SARC4_H -#include "Common.h" +#include "Define.h" #include <openssl/evp.h> class ARC4 diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp index 146f4e992b7..a2db02dfbe3 100755 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp @@ -18,12 +18,11 @@ #include "AuthCrypt.h" #include "Cryptography/HMACSHA1.h" -#include "Logging/Log.h" #include "Cryptography/BigNumber.h" AuthCrypt::AuthCrypt() : _clientDecrypt(SHA_DIGEST_LENGTH), _serverEncrypt(SHA_DIGEST_LENGTH) + , _initialized(false) { - _initialized = false; } AuthCrypt::~AuthCrypt() diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.h b/src/server/shared/Cryptography/Authentication/AuthCrypt.h index 0304ef6b69e..e7463b0d962 100755 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.h +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.h @@ -19,7 +19,6 @@ #ifndef _AUTHCRYPT_H #define _AUTHCRYPT_H -#include <Common.h> #include "Cryptography/ARC4.h" class BigNumber; diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp index 6149a680594..76cb74d5e13 100755 --- a/src/server/shared/Cryptography/BigNumber.cpp +++ b/src/server/shared/Cryptography/BigNumber.cpp @@ -18,31 +18,30 @@ #include "Cryptography/BigNumber.h" #include <openssl/bn.h> +#include <openssl/crypto.h> #include <algorithm> BigNumber::BigNumber() -{ - _bn = BN_new(); - _array = NULL; -} + : _bn(BN_new()) + , _array(NULL) +{ } BigNumber::BigNumber(const BigNumber &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(); BN_set_word(_bn, val); - _array = NULL; } BigNumber::~BigNumber() { BN_free(_bn); - if (_array) delete[] _array; + delete[] _array; } void BigNumber::SetDword(uint32 val) @@ -76,6 +75,8 @@ void BigNumber::SetRand(int numbits) BigNumber BigNumber::operator=(const BigNumber &bn) { + if (this == &bn) + return *this; BN_copy(_bn, bn._bn); return *this; } diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h index 485d4ced470..eb450c27777 100755 --- a/src/server/shared/Cryptography/BigNumber.h +++ b/src/server/shared/Cryptography/BigNumber.h @@ -19,7 +19,7 @@ #ifndef _AUTH_BIGNUMBER_H #define _AUTH_BIGNUMBER_H -#include "Common.h" +#include "Define.h" struct bignum_st; diff --git a/src/server/shared/Cryptography/HMACSHA1.h b/src/server/shared/Cryptography/HMACSHA1.h index 180ac6f4262..2d6e0c276a8 100755 --- a/src/server/shared/Cryptography/HMACSHA1.h +++ b/src/server/shared/Cryptography/HMACSHA1.h @@ -19,7 +19,8 @@ #ifndef _AUTH_HMAC_H #define _AUTH_HMAC_H -#include "Common.h" +#include "Define.h" +#include <string> #include <openssl/hmac.h> #include <openssl/sha.h> diff --git a/src/server/shared/Cryptography/SHA1.h b/src/server/shared/Cryptography/SHA1.h index 27e2d3290d0..9cb9b7b90f9 100755 --- a/src/server/shared/Cryptography/SHA1.h +++ b/src/server/shared/Cryptography/SHA1.h @@ -19,9 +19,9 @@ #ifndef _AUTH_SHA1_H #define _AUTH_SHA1_H -#include "Common.h" +#include "Define.h" +#include <string> #include <openssl/sha.h> -#include <openssl/crypto.h> class BigNumber; diff --git a/src/server/shared/Dynamic/UnorderedMap.h b/src/server/shared/Dynamic/UnorderedMap.h index c698cc0a823..92a7dddf8a8 100755 --- a/src/server/shared/Dynamic/UnorderedMap.h +++ b/src/server/shared/Dynamic/UnorderedMap.h @@ -71,4 +71,3 @@ namespace __gnu_cxx using std::hash_map; #endif #endif - diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 56c02a8e77b..15008f13c10 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -139,7 +139,7 @@ void Log::Initialize() { bool m_gmlog_timestamp = ConfigMgr::GetBoolDefault("GmLogTimestamp", false); - size_t dot_pos = m_gmlog_filename_format.find_last_of("."); + size_t dot_pos = m_gmlog_filename_format.find_last_of('.'); if (dot_pos!=m_gmlog_filename_format.npos) { if (m_gmlog_timestamp) diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 5c23616ac5c..5b2eb6aafb6 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -102,8 +102,10 @@ const int Colors = int(WHITE)+1; class Log { friend class ACE_Singleton<Log, ACE_Thread_Mutex>; - Log(); - ~Log(); + + private: + Log(); + ~Log(); public: void Initialize(); diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 187258e41b3..5919529c6bf 100755 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -17,7 +17,6 @@ */ #include "Util.h" - #include "utf8.h" #ifdef USE_SFMT_FOR_RNG #include "SFMT.h" @@ -162,13 +161,13 @@ std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly) std::ostringstream ss; if (days) - ss << days << (shortText ? "d " : " Day(s) "); + ss << days << (shortText ? "d" : " Day(s) "); if (hours || hoursOnly) - ss << hours << (shortText ? "h " : " Hour(s) "); + ss << hours << (shortText ? "h" : " Hour(s) "); if (!hoursOnly) { if (minutes) - ss << minutes << (shortText ? "m " : " Minute(s) "); + ss << minutes << (shortText ? "m" : " Minute(s) "); if (secs || (!days && !hours && !minutes) ) ss << secs << (shortText ? "s" : " Second(s)."); } diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index cf5ad79f878..564f6028eca 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -115,6 +115,7 @@ void commandFinished(void*, bool /*success*/) printf("TC> "); fflush(stdout); } + /** * Collects all GUIDs (and related info) from deleted characters which are still in the database. * @@ -562,10 +563,11 @@ void CliRunnable::run() { ///- Display the list of available CLI functions then beep //sLog->outString(""); - #if PLATFORM != PLATFORM_WINDOWS +#if PLATFORM != PLATFORM_WINDOWS rl_attempted_completion_function = cli_completion; rl_event_hook = cli_hook_func; - #endif +#endif + if (ConfigMgr::GetBoolDefault("BeepAtStart", true)) printf("\a"); // \a = Alert @@ -580,49 +582,49 @@ void CliRunnable::run() char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin); - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS char commandbuf[256]; command_str = fgets(commandbuf, sizeof(commandbuf), stdin); - #else +#else command_str = readline("TC>"); rl_bind_key('\t', rl_complete); - #endif +#endif + if (command_str != NULL) { - for (int x=0; command_str[x]; x++) - if (command_str[x]=='\r'||command_str[x]=='\n') + for (int x=0; command_str[x]; ++x) + if (command_str[x] == '\r' || command_str[x] == '\n') { - command_str[x]=0; + command_str[x] = 0; break; } if (!*command_str) { - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS printf("TC>"); - #endif +#endif continue; } std::string command; if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8 { - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS printf("TC>"); - #endif +#endif continue; } + fflush(stdout); sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished)); - #if PLATFORM != PLATFORM_WINDOWS +#if PLATFORM != PLATFORM_WINDOWS add_history(command.c_str()); - #endif - +#endif } else if (feof(stdin)) { World::StopNow(SHUTDOWN_EXIT_CODE); } - } } diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index d7cee88b994..60145cf99aa 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -33,22 +33,17 @@ #include "RASocket.h" -RARunnable::RARunnable() : m_Reactor(NULL) +RARunnable::RARunnable() { - ACE_Reactor_Impl* imp = 0; + ACE_Reactor_Impl* imp = NULL; #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - imp = new ACE_Dev_Poll_Reactor(); - imp->max_notify_iterations (128); imp->restart (1); - #else - imp = new ACE_TP_Reactor(); imp->max_notify_iterations (128); - #endif m_Reactor = new ACE_Reactor (imp, 1); @@ -68,7 +63,6 @@ void RARunnable::run() uint16 raport = ConfigMgr::GetIntDefault("Ra.Port", 3443); std::string stringip = ConfigMgr::GetStringDefault("Ra.IP", "0.0.0.0"); - ACE_INET_Addr listen_addr(raport, stringip.c_str()); if (acceptor.open(listen_addr, m_Reactor) == -1) @@ -84,7 +78,6 @@ void RARunnable::run() // don't be too smart to move this outside the loop // the run_reactor_event_loop will modify interval ACE_Time_Value interval(0, 100000); - if (m_Reactor->run_reactor_event_loop(interval) == -1) break; } |