From ac19d19560d19c4a2578b479db5d5983865a3a1c Mon Sep 17 00:00:00 2001 From: Chipsi Date: Sun, 9 Oct 2011 14:49:03 +0200 Subject: [PATCH 01/23] Core/Items: Added case for Darkmoon Card: Madness trinket --- src/server/game/Entities/Unit/Unit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6d02d943f6..efddb25eff 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5223,6 +5223,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere break; case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011 case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011 + case CLASS_DEATH_KNIGHT: triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011); cooldown_spell_id = 39511; break; From e814cd8c35e30832d5e5a5129745283fafac20c6 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 Nov 2011 14:57:30 -0500 Subject: [PATCH 02/23] Core/Mechanic: Resurrection (fixed the issue with players ressing in place then being ported to the person who revived them.) --- src/server/game/Entities/Player/Player.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9b1b2c34aa..82e4ffe676 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5087,8 +5087,6 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0)) SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND); - setDeathState(ALIVE); - SetMovement(MOVE_LAND_WALK); SetMovement(MOVE_UNROOT); @@ -5118,6 +5116,8 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) // update visibility UpdateObjectVisibility(); + setDeathState(ALIVE); + if (!applySickness) return; From 04183cb8de5b6ad63741868c14426cb91b79417a Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 18 Nov 2011 16:47:06 -0500 Subject: [PATCH 03/23] Core/LFG: Fix being unable to enter an instance to retrieve body when you have 5 or more instances in the database. --- src/server/game/Maps/MapManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 78aeb32ab2..22eaa77cc9 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -248,7 +248,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) instaceIdToCheck = save->GetInstanceId(); // instanceId can never be 0 - will not be found - if (!player->CheckInstanceCount(instaceIdToCheck)) + if (!player->CheckInstanceCount(instaceIdToCheck) && !player->isDead()) { player->SendTransferAborted(mapid, TRANSFER_ABORT_TOO_MANY_INSTANCES); return false; From ad2b6964c99e6f0adcf3f6fc93df3cec9f5ca8fc Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 21 Nov 2011 15:36:45 +0000 Subject: [PATCH 04/23] DB: Fix DB startup errors *slaps someone* Closes #4016 --- sql/updates/world/2011_11_21_00_world_db_errors.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sql/updates/world/2011_11_21_00_world_db_errors.sql diff --git a/sql/updates/world/2011_11_21_00_world_db_errors.sql b/sql/updates/world/2011_11_21_00_world_db_errors.sql new file mode 100644 index 0000000000..d3ae6fb197 --- /dev/null +++ b/sql/updates/world/2011_11_21_00_world_db_errors.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `lootid`=0 WHERE `entry`=11054; +UPDATE `conditions` SET `SourceTypeOrReferenceId`=17 WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=47305 AND `ConditionTypeOrReference`=20; +UPDATE `conditions` SET `SourceTypeOrReferenceId`=18, `SourceEntry`=36732, `ConditionTypeOrReference`=24 WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=47305 AND `ConditionTypeOrReference`=18; +UPDATE `smart_scripts` SET `target_param1`=35 WHERE `entryorguid`=2275 AND `source_type`=0 AND `id`=0; +UPDATE `smart_scripts` SET `target_param1`=35 WHERE `entryorguid`=1806901 AND `source_type`=9 AND `id`=3; + +DELETE FROM `db_script_string` WHERE `entry` IN (2000000102, 2000000103, 2000000104); +INSERT INTO `db_script_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(2000000102,'Oh, darn...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(2000000103,'Ok, let''s get started!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(2000000104,'... oops.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); From 4e683214da4ab7d5a736b9e129557d9ac2aeaa48 Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 21 Nov 2011 16:16:10 +0000 Subject: [PATCH 05/23] DB/Event/Pilgrim: Add item and mail reward to the "Pilgrim" achievement (A/H) --- sql/updates/world/2011_11_21_01_pilgrim_achievement_reward.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 sql/updates/world/2011_11_21_01_pilgrim_achievement_reward.sql diff --git a/sql/updates/world/2011_11_21_01_pilgrim_achievement_reward.sql b/sql/updates/world/2011_11_21_01_pilgrim_achievement_reward.sql new file mode 100644 index 0000000000..7083107a8c --- /dev/null +++ b/sql/updates/world/2011_11_21_01_pilgrim_achievement_reward.sql @@ -0,0 +1 @@ +UPDATE `achievement_reward` SET `item`=44810, `sender`=28951, `subject`='A Gobbler not yet Gobbled', `text` = 'Can you believe this Plump Turkey made it through November alive?$B$BSince all this friends have been served up on Bountiful Tables with sides of Cranberry Chutney and Spice Bread Stuffing and... ooo... I''m getting hungry. But anyhow! He''s all alone, now, so I was hoping you might be willing to take care of him. There simply isn''t enough room left in my shop!$B$BJust keep him away from cooking fires, please. He gets this strange look in his eyes around them...' WHERE `entry` IN (3478,3656); -- Pilgrim achievement (A/H) From 0c343970d1b6d6811bf13e965e62f6614b8f6f52 Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 21 Nov 2011 16:34:51 +0000 Subject: [PATCH 06/23] DB/Event/Pilgrim: Fix achievement "Turkey Lurkey". By Vincent-Michael Closes #3994 --- ...011_11_21_02_pilgrim_achievement_criteria_data.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sql/updates/world/2011_11_21_02_pilgrim_achievement_criteria_data.sql diff --git a/sql/updates/world/2011_11_21_02_pilgrim_achievement_criteria_data.sql b/sql/updates/world/2011_11_21_02_pilgrim_achievement_criteria_data.sql new file mode 100644 index 0000000000..589dbb0b2a --- /dev/null +++ b/sql/updates/world/2011_11_21_02_pilgrim_achievement_criteria_data.sql @@ -0,0 +1,11 @@ +-- Achievement: Turkey Lurkey +DELETE FROM `achievement_criteria_data` WHERE `type`=2 AND `criteria_id` IN (11158,11159,11160,11161,11162,11163,11164,11165); +INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`) VALUES +(11158, 2, 4, 1), -- Human Rogue +(11159, 2, 4, 4), -- Night Elf Rogue +(11160, 2, 4, 2), -- Orc Rogue +(11161, 2, 4, 8), -- Troll Rogue +(11162, 2, 4, 5), -- Undead Rogue +(11163, 2, 4, 10), -- Blood Elf Rogue +(11164, 2, 4, 3), -- Dwarf Rogue +(11165, 2, 4, 7); -- Gnome Rogue From 7c8f4358ea2615ae2788c92aba686a4a0c89ed5a Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 21 Nov 2011 19:24:12 +0000 Subject: [PATCH 07/23] DB/Event/Pilgrim: Template updates, vendor tables and other misc. stuff (H) --- .../world/2011_11_21_03_pilgrim_misc.sql | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sql/updates/world/2011_11_21_03_pilgrim_misc.sql diff --git a/sql/updates/world/2011_11_21_03_pilgrim_misc.sql b/sql/updates/world/2011_11_21_03_pilgrim_misc.sql new file mode 100644 index 0000000000..ff58b61cb8 --- /dev/null +++ b/sql/updates/world/2011_11_21_03_pilgrim_misc.sql @@ -0,0 +1,145 @@ +-- Misc stuffz +UPDATE `npc_text` SET `WDBVerified`=12340 WHERE `ID`=14648; -- "A Bountiful Table is laid out..." + +-- Template updates +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=3, `unit_flags`=33536 WHERE `entry`=34654; -- Bountiful Feast Hostess +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`unit_flags`=33536 WHERE `entry`=34678; -- Dokin Farplain +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34684; -- Laha Farplain +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`speed_run`=1 WHERE `entry`=35343; -- Bountiful Barrel +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34685; -- Dalni Tallgrass +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`speed_run`=1 WHERE `entry`=35342; -- Bountiful Barrel +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=83,`unit_flags`=33536 WHERE `entry`=34713; -- Ondani Greatmill +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34787; -- John Rigsdale +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=83,`unit_flags`=33536 WHERE `entry`=34786; -- Alice Rigsdale +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`unit_flags`=33536 WHERE `entry`=34677; -- Miles Standish +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=83,`unit_flags`=33536 WHERE `entry`=34712; -- Roberta Carter +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34683; -- Rose Standish +UPDATE `creature_template` SET `faction_A`=714,`faction_H`=714,`baseattacktime`=2000,`npcflag`=640,`speed_run`=1 WHERE `entry`=35341; -- Bountiful Barrel + +UPDATE `creature_template` SET `baseattacktime`=2000,`npcflag`=16777216,`unit_flags`=16384,`speed_run`=1.57143,`VehicleId`=321 WHERE `entry`=34819; -- The Stuffing Chair +UPDATE `creature_template` SET `baseattacktime`=2000,`npcflag`=16777216,`unit_flags`=16384,`speed_run`=1.57143,`VehicleId`=321 WHERE `entry`=34824; -- The Sweet Potato Chair +UPDATE `creature_template` SET `baseattacktime`=2000,`npcflag`=16777216,`unit_flags`=16384,`speed_run`=1.57143,`VehicleId`=321 WHERE `entry`=34823; -- The Cranberry Chair +UPDATE `creature_template` SET `baseattacktime`=2000,`npcflag`=16777216,`unit_flags`=16384,`speed_run`=1.57143,`VehicleId`=321 WHERE `entry`=34812; -- The Turkey Chair +UPDATE `creature_template` SET `baseattacktime`=2000,`npcflag`=16777216,`unit_flags`=16384,`speed_run`=1.57143,`VehicleId`=321 WHERE `entry`=34822; -- The Pie Chair + +UPDATE `creature_model_info` SET `bounding_radius`=0.8725,`combat_reach`=3.75,`gender`=1 WHERE `modelid`=29330; -- Bountiful Feast Hostess +UPDATE `creature_model_info` SET `bounding_radius`=0.9747,`combat_reach`=4.05,`gender`=0 WHERE `modelid`=29339; -- Dokin Farplain +UPDATE `creature_model_info` SET `bounding_radius`=1,`combat_reach`=0,`gender`=0 WHERE `modelid`=29775; -- Bountiful Barrel +UPDATE `creature_model_info` SET `bounding_radius`=0.8725,`combat_reach`=3.75,`gender`=1 WHERE `modelid`=29342; -- Laha Farplain +UPDATE `creature_model_info` SET `bounding_radius`=1.6,`combat_reach`=0,`gender`=2 WHERE `modelid`=29205; -- Chairs +UPDATE `creature_model_info` SET `bounding_radius`=0.8725,`combat_reach`=3.75,`gender`=1 WHERE `modelid`=29397; -- Dalni Tallgrass +UPDATE `creature_model_info` SET `bounding_radius`=0.8725,`combat_reach`=3.75,`gender`=1 WHERE `modelid`=29401; -- Ondani Greatmill +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=29428; -- John Rigsdale +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29427; -- Alice Rigsdale +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=29338; -- Miles Standish +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29365; -- Roberta Carter +UPDATE `creature_model_info` SET `bounding_radius`=0.383,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29340; -- Rose Standish + +DELETE FROM `creature_template_addon` WHERE `entry` IN (34654,34678,35343,34684,34819,34824,34823,34812,34822,34685,35342,34713,34787,34786,34677,34712,34683,35341); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(34654,0,0,1,0, NULL), -- Bountiful Feast Hostess +(34678,0,0,2,0, NULL), -- Dokin Farplain +(35343,0,0,1,0, NULL), -- Bountiful Barrel (TB) +(34684,0,0,1,0, NULL), -- Laha Farplain +(34685,0,0,1,0, NULL), -- Dalni Tallgrass +(35342,0,0,1,0, NULL), -- Bountiful Barrel (OG) +(34713,0,0,2,0, NULL), -- Ondani Greatmill +(34787,0,0,1,0, NULL), -- John Rigsdale +(34786,0,0,2,0, NULL), -- Alice Rigsdale +(34677,0,0,2,0, NULL), -- Miles Standish +(34712,0,0,2,0, NULL), -- Roberta Carter +(34683,0,0,1,0, NULL), -- Rose Standish +(35341,0,0,1,0, NULL), -- Bountiful Barrel +(34819,0,0,1,0, '61795'), -- The Stuffing Chair (Stuffing Server) +(34824,0,0,1,0, '61797'), -- The Sweet Potato Chair (Sweet Potatoes Server) +(34823,0,0,1,0, '61793'), -- The Cranberry Chair (Cranberry Server) +(34812,0,0,1,0, '61796'), -- The Turkey Chair (Turkey Server) +(34822,0,0,1,0, '61794'); -- The Pie Chair (Pie Server) + +-- Vehicles +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (34819,34824,34823,34812,34822); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`, `aura_required`, `aura_forbidden`, `user_type`) VALUES +(34819, 65403, 0, 0, 0, 1, 0, 0, 0), -- The Stuffing Chair (Ride Vehicle) +(34824, 65403, 0, 0, 0, 1, 0, 0, 0), -- The Sweet Potato Chair (Ride Vehicle) +(34823, 65403, 0, 0, 0, 1, 0, 0, 0), -- The Cranberry Chair (Ride Vehicle) +(34812, 65403, 0, 0, 0, 1, 0, 0, 0), -- The Turkey Chair (Ride Vehicle) +(34822, 65403, 0, 0, 0, 1, 0, 0, 0); -- The Pie Chair (Ride Vehicle) + +-- Gossips +UPDATE `creature_template` SET `gossip_menu_id`=10575 WHERE `entry`=34654; -- Bountiful Feast Hostess +DELETE FROM `gossip_menu` WHERE `entry`=10575 AND `text_id`=14633; +DELETE FROM `gossip_menu` WHERE `entry`=10589 AND `text_id`=14648; +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(10575, 14633), +(10589, 14648); + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10575 AND `id`=0; +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 +(10575, 0, 0, 'How do the Bountiful Tables work?', 1, 1, 10589, 0, 0, 0, NULL); + +-- Vendor tables +UPDATE `item_template` SET `BuyCount`=5 WHERE `entry` IN (44835,44853,46797,46793,46796); -- Autumnal Herbs, Honey, Mulgore Sweet Potato, Tangy Southfury Cranberries, Ripe Tirisfal Pumpkin +DELETE FROM `npc_vendor` WHERE `entry` IN (35343,34684,35342,34685,34787,35341,34683); +INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `ExtendedCost`) VALUES +-- 35343 (Bountiful Barrel) +(35343, 1, 46810, 0, 0), -- Bountiful Cookbook +(35343, 2, 46797, 0, 0), -- Mulgore Sweet Potato +(35343, 3, 44835, 0, 0), -- Autumnal Herbs +(35343, 4, 44853, 0, 0), -- Honey +(35343, 5, 159, 0, 0), -- Refreshing Spring Water +(35343, 6, 2678, 0, 0), -- Mild Spices +(35343, 7, 30817, 0, 0), -- Simple Flour +(35343, 8, 46888, 0, 0), -- Bountiful Basket +-- 34684 (Laha Farplain) +(34684, 1, 46810, 0, 0), -- Bountiful Cookbook +(34684, 2, 46797, 0, 0), -- Mulgore Sweet Potato +(34684, 3, 44835, 0, 0), -- Autumnal Herbs +(34684, 4, 44853, 0, 0), -- Honey +(34684, 5, 159, 0, 0), -- Refreshing Spring Water +(34684, 6, 2678, 0, 0), -- Mild Spices +(34684, 7, 30817, 0, 0), -- Simple Flour +(34684, 8, 46888, 0, 0), -- Bountiful Basket +-- 35342 (Bountiful Barrel) +(35342, 1, 46810, 0, 0), -- Bountiful Cookbook +(35342, 2, 46793, 0, 0), -- Tangy Southfury Cranberries +(35342, 3, 44835, 0, 0), -- Autumnal Herbs +(35342, 4, 44853, 0, 0), -- Honey +(35342, 5, 159, 0, 0), -- Refreshing Spring Water +(35342, 6, 2678, 0, 0), -- Mild Spices +(35342, 7, 30817, 0, 0), -- Simple Flour +(35342, 8, 46888, 0, 0), -- Bountiful Basket +-- 34685 (Dalni Tallgrass) +(34685, 1, 46810, 0, 0), -- Bountiful Cookbook +(34685, 2, 46793, 0, 0), -- Tangy Southfury Cranberries +(34685, 3, 44835, 0, 0), -- Autumnal Herbs +(34685, 4, 44853, 0, 0), -- Honey +(34685, 5, 159, 0, 0), -- Refreshing Spring Water +(34685, 6, 2678, 0, 0), -- Mild Spices +(34685, 7, 30817, 0, 0), -- Simple Flour +(34685, 8, 46888, 0, 0), -- Bountiful Basket +-- 34787 (John Rigsdale) +(34787, 1, 46810, 0, 0), -- Bountiful Cookbook +(34787, 2, 44835, 0, 0), -- Autumnal Herbs +(34787, 3, 44853, 0, 0), -- Honey +(34787, 4, 159, 0, 0), -- Refreshing Spring Water +(34787, 5, 2678, 0, 0), -- Mild Spices +(34787, 6, 30817, 0, 0), -- Simple Flour +(34787, 7, 46888, 0, 0), -- Bountiful Basket +-- 35341 (Bountiful Barrel) +(35341, 1, 46810, 0, 0), -- Bountiful Cookbook +(35341, 2, 46796, 0, 0), -- Ripe Tirisfal Pumpkin +(35341, 3, 44835, 0, 0), -- Autumnal Herbs +(35341, 4, 44853, 0, 0), -- Honey +(35341, 5, 159, 0, 0), -- Refreshing Spring Water +(35341, 6, 2678, 0, 0), -- Mild Spices +(35341, 7, 30817, 0, 0), -- Simple Flour +(35341, 8, 46888, 0, 0), -- Bountiful Basket +-- 34683 (Rose Standish) +(34683, 1, 46810, 0, 0), -- Bountiful Cookbook +(34683, 2, 46796, 0, 0), -- Ripe Tirisfal Pumpkin +(34683, 3, 44835, 0, 0), -- Autumnal Herbs +(34683, 4, 44853, 0, 0), -- Honey +(34683, 5, 159, 0, 0), -- Refreshing Spring Water +(34683, 6, 2678, 0, 0), -- Mild Spices +(34683, 7, 30817, 0, 0), -- Simple Flour +(34683, 8, 46888, 0, 0); -- Bountiful Basket \ No newline at end of file From a14cbcaa3e2ca81382c8f5f8d2b145a198a3e037 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Mon, 21 Nov 2011 22:52:53 +0100 Subject: [PATCH 08/23] Core/Units: Partial implementation of SMSG_MOVE_SET_COLLISION_HGT - send proper character collision height on dismount. Fixes #2642 NOTE: Still have to properly implement collision height calculation for mounting up. --- src/server/game/DataStores/DBCStores.cpp | 2 ++ src/server/game/DataStores/DBCStores.h | 1 + src/server/game/DataStores/DBCStructure.h | 24 ++++++++++++++++++++++- src/server/game/DataStores/DBCfmt.h | 3 ++- src/server/game/Entities/Player/Player.h | 14 +++++++++++++ src/server/game/Entities/Unit/Unit.cpp | 9 +++++++++ 6 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index faa73cefb1..6815d73d1b 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -71,6 +71,7 @@ DBCStorage sChrRacesStore(ChrRacesEntryfmt); DBCStorage sCinematicSequencesStore(CinematicSequencesEntryfmt); DBCStorage sCreatureDisplayInfoStore(CreatureDisplayInfofmt); DBCStorage sCreatureFamilyStore(CreatureFamilyfmt); +DBCStorage sCreatureModelDataStore(CreatureModelDatafmt); DBCStorage sCreatureSpellDataStore(CreatureSpellDatafmt); DBCStorage sCreatureTypeStore(CreatureTypefmt); DBCStorage sCurrencyTypesStore(CurrencyTypesfmt); @@ -292,6 +293,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc"); + LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureTypeStore, dbcPath, "CreatureType.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCurrencyTypesStore, dbcPath, "CurrencyTypes.dbc"); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 367746616d..7edfaad03f 100755 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -81,6 +81,7 @@ extern DBCStorage sChrRacesStore; extern DBCStorage sCinematicSequencesStore; extern DBCStorage sCreatureDisplayInfoStore; extern DBCStorage sCreatureFamilyStore; +extern DBCStorage sCreatureModelDataStore; extern DBCStorage sCreatureSpellDataStore; extern DBCStorage sCreatureTypeStore; extern DBCStorage sCurrencyTypesStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index e01acd2e03..32510da70d 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -723,7 +723,7 @@ struct CinematicSequencesEntry struct CreatureDisplayInfoEntry { uint32 Displayid; // 0 m_ID - // 1 m_modelID + uint32 ModelId; // 1 m_modelID // 2 m_soundID // 3 m_extendedDisplayInfoID float scale; // 4 m_creatureModelScale @@ -754,6 +754,28 @@ struct CreatureFamilyEntry // 27 m_iconFile }; +struct CreatureModelDataEntry +{ + uint32 Id; + //uint32 Flags; + //char* ModelPath[16] + //uint32 Unk1; + //float Scale; // Used in calculation of unit collision data + //int32 Unk2 + //int32 Unk3 + //uint32 Unk4 + //uint32 Unk5 + //float Unk6 + //uint32 Unk7 + //float Unk8 + //uint32 Unk9 + //uint32 Unk10 + float CollisionWidth; + float CollisionHeight; + //float Unk11; // Used in calculation of unit collision data when mounted + //float Unks[11] +}; + #define MAX_CREATURE_SPELL_DATA_SLOT 4 struct CreatureSpellDataEntry diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 5d33a3011a..d71565d8a3 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -38,8 +38,9 @@ const char ChatChannelsEntryfmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; const char CinematicSequencesEntryfmt[]="nxxxxxxxxx"; -const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx"; +const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx"; const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx"; +const char CreatureModelDatafmt[]="nxxxxxxxxxxxxxffxxxxxxxxxxxx"; const char CreatureSpellDatafmt[]="niiiixxxx"; const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx"; const char CurrencyTypesfmt[]="xnxi"; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index bb39d902ae..ddafefc087 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2493,6 +2493,20 @@ class Player : public Unit, public GridObject void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); } bool IsInWhisperWhiteList(uint64 guid); + //! Return collision height sent to client + //! we currently only send this on dismount + float GetCollisionHeight() + { + CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); + ASSERT(displayInfo); + CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); + ASSERT(modelData); + + return modelData->CollisionHeight; + + //! TODO: Need a proper calculation for collision height when mounted + } + protected: // Gamemaster whisper whitelist WhisperListContainer WhisperList; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index dc1c4105fe..3b57b43443 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11946,6 +11946,15 @@ void Unit::Unmount() SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); + if (Player* thisPlayer = ToPlayer()) + { + WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); + data.append(GetPackGUID()); + data << uint32(sWorld->GetGameTime()); // Packet counter + data << thisPlayer->GetCollisionHeight(); + thisPlayer->GetSession()->SendPacket(&data); + } + WorldPacket data(SMSG_DISMOUNT, 8); data.appendPackGUID(GetGUID()); SendMessageToSet(&data, true); From 0992f27cad720dcf985645708e8dec415b53821a Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 21 Nov 2011 16:55:38 -0500 Subject: [PATCH 09/23] Fix the correct exit from the dungeon finder queue. By Giuseppe Montesanto Conflicts: src/server/game/DungeonFinding/LFGScripts.cpp --- src/server/game/DungeonFinding/LFGMgr.h | 2 +- src/server/game/DungeonFinding/LFGScripts.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 0d11405789..95cb2e8186 100755 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -292,6 +292,7 @@ class LFGMgr LfgState GetState(uint64 guid); const LfgDungeonSet& GetSelectedDungeons(uint64 guid); uint32 GetDungeon(uint64 guid, bool asId = true); + void SetState(uint64 guid, LfgState state); void ClearState(uint64 guid); void RemovePlayerData(uint64 guid); void RemoveGroupData(uint64 guid); @@ -304,7 +305,6 @@ class LFGMgr uint8 GetRoles(uint64 guid); const std::string& GetComment(uint64 gguid); void RestoreState(uint64 guid); - void SetState(uint64 guid, LfgState state); void SetDungeon(uint64 guid, uint32 dungeon); void SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons); void SetLockedDungeons(uint64 guid, const LfgLockMap& lock); diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index f553b06916..42119a02ef 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -82,6 +82,7 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, } sLFGMgr->ClearState(guid); + sLFGMgr->SetState(guid, LFG_STATE_NONE); if (Player* player = ObjectAccessor::FindPlayer(guid)) { /* From fc24f4959fa9c92ef0d19a64a19da4537a0c834c Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 21 Nov 2011 22:55:31 +0000 Subject: [PATCH 10/23] DB/Event/Pilgrim: Template updates, vendor tables and other misc. stuff (A) --- .../world/2011_11_21_03_pilgrim_misc.sql | 2 +- .../world/2011_11_21_04_pilgrim_misc.sql | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2011_11_21_04_pilgrim_misc.sql diff --git a/sql/updates/world/2011_11_21_03_pilgrim_misc.sql b/sql/updates/world/2011_11_21_03_pilgrim_misc.sql index ff58b61cb8..6547fe9a53 100644 --- a/sql/updates/world/2011_11_21_03_pilgrim_misc.sql +++ b/sql/updates/world/2011_11_21_03_pilgrim_misc.sql @@ -142,4 +142,4 @@ INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `ExtendedCost`) V (34683, 5, 159, 0, 0), -- Refreshing Spring Water (34683, 6, 2678, 0, 0), -- Mild Spices (34683, 7, 30817, 0, 0), -- Simple Flour -(34683, 8, 46888, 0, 0); -- Bountiful Basket \ No newline at end of file +(34683, 8, 46888, 0, 0); -- Bountiful Basket diff --git a/sql/updates/world/2011_11_21_04_pilgrim_misc.sql b/sql/updates/world/2011_11_21_04_pilgrim_misc.sql new file mode 100644 index 0000000000..194c084ebc --- /dev/null +++ b/sql/updates/world/2011_11_21_04_pilgrim_misc.sql @@ -0,0 +1,109 @@ +DELETE FROM `creature_template_addon` WHERE `entry` IN (32823,34645,34783,34682,35337,35338,35340,34711,34676,34708,34644,34744,34710,34675); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(32823,0,0,1,0, NULL), -- Bountiful Table +(34645,0,0,1,0, NULL), -- Elizabeth Barker Winslow +(34783,0,0,1,0, NULL), -- Ranisa Whitebough +(34682,0,0,1,0, NULL), -- Wilmina Holbeck +(35337,0,0,1,0, NULL), -- Bountiful Barrel +(35338,0,0,1,0, NULL), -- Bountiful Barrel +(35340,0,0,1,0, NULL), -- Bountiful Barrel +(34711,0,0,2,0, NULL), -- Mary Allerton +(34676,0,0,2,0, NULL), -- Isaac Allerton +(34708,0,0,2,0, NULL), -- Caitrin Ironkettle +(34644,0,0,2,0, NULL), -- Edward Winslow +(34744,0,0,1,0, NULL), -- Jasper Moore +(34710,0,0,1,0, NULL), -- Ellen Moore +(34675,0,0,2,0, NULL); -- Gregory Tabor + +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34783; -- Ranisa Whitebough +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34645; -- Elizabeth Barker Winslow +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34681; -- Ikaneba Summerset +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`unit_flags`=33536 WHERE `entry`=34682; -- Wilmina Holbeck +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`speed_run`=1 WHERE `entry`=35337; -- Bountiful Barrel +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`speed_run`=1 WHERE `entry`=35338; -- Bountiful Barrel +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=640,`speed_run`=1 WHERE `entry`=35340; -- Bountiful Barrel +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=83,`unit_flags`=33536 WHERE `entry`=34711; -- Mary Allerton +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`unit_flags`=33536 WHERE `entry`=34676; -- Isaac Allerton +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=83,`unit_flags`=33536 WHERE `entry`=34708; -- Caitrin Ironkettle +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`unit_flags`=33536 WHERE `entry`=34644; -- Edward Winslow +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=3,`unit_flags`=33536 WHERE `entry`=34744; -- Jasper Moore +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`npcflag`=83,`unit_flags`=33536 WHERE `entry`=34710; -- Ellen Moore +UPDATE `creature_template` SET `faction_A`=534,`faction_H`=534,`baseattacktime`=2000,`unit_flags`=33536 WHERE `entry`=34675; -- Gregory Tabor + +UPDATE `creature_model_info` SET `bounding_radius`=0.208,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29394; -- Elizabeth Barker Winslow +UPDATE `creature_model_info` SET `bounding_radius`=0.306,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29430; -- Ranisa Whitebough +UPDATE `creature_model_info` SET `bounding_radius`=0.208,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29393; -- Ikaneba Summerset +UPDATE `creature_model_info` SET `bounding_radius`=0.208,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29329; -- Wilmina Holbeck +UPDATE `creature_model_info` SET `bounding_radius`=0.208,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29388; -- Mary Allerton +UPDATE `creature_model_info` SET `bounding_radius`=0.306,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=29391; -- Isaac Allerton +UPDATE `creature_model_info` SET `bounding_radius`=0.347,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29324; -- Caitrin Ironkettle +UPDATE `creature_model_info` SET `bounding_radius`=0.306,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=29392; -- Edward Winslow +UPDATE `creature_model_info` SET `bounding_radius`=0.306,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=29444; -- Jasper Moore +UPDATE `creature_model_info` SET `bounding_radius`=0.208,`combat_reach`=1.5,`gender`=1 WHERE `modelid`=29400; -- Ellen Moore +UPDATE `creature_model_info` SET `bounding_radius`=0.306,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=29337; -- Gregory Tabor + +UPDATE `item_template` SET `BuyCount`=5 WHERE `entry` IN (44854,46784,44855); +DELETE FROM `npc_vendor` WHERE `entry` IN (34645, 34783, 35337, 35338, 35340, 34681, 34682); +INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `ExtendedCost`) VALUES +-- 34645 (Elizabeth Barker Winslow) +(34645, 1, 46809, 0, 0), -- Bountiful Cookbook +(34645, 2, 44854, 0, 0), -- Tangy Wetland Cranberries +(34645, 3, 44835, 0, 0), -- Autumnal Herbs +(34645, 4, 44853, 0, 0), -- Honey +(34645, 5, 159, 0, 0), -- Refreshing Spring Water +(34645, 6, 2678, 0, 0), -- Mild Spices +(34645, 7, 30817, 0, 0), -- Simple Flour +(34645, 8, 46888, 0, 0), -- Bountiful Basket +-- 34783 (Ranisa Whitebough) +(34783, 1, 46809, 0, 0), -- Bountiful Cookbook +(34783, 2, 44835, 0, 0), -- Autumnal Herbs +(34783, 3, 44853, 0, 0), -- Honey +(34783, 4, 159, 0, 0), -- Refreshing Spring Water +(34783, 5, 2678, 0, 0), -- Mild Spices +(34783, 6, 30817, 0, 0), -- Simple Flour +(34783, 7, 46888, 0, 0), -- Bountiful Basket +-- 35337 (Bountiful Barrel) +(35337, 1, 46809, 0, 0), -- Bountiful Cookbook +(35337, 2, 46784, 0, 0), -- Ripe Elwynn Pumpkin +(35337, 3, 44835, 0, 0), -- Autumnal Herbs +(35337, 4, 44853, 0, 0), -- Honey +(35337, 5, 159, 0, 0), -- Refreshing Spring Water +(35337, 6, 2678, 0, 0), -- Mild Spices +(35337, 7, 30817, 0, 0), -- Simple Flour +(35337, 8, 46888, 0, 0), -- Bountiful Basket +-- 35338 (Bountiful Barrel) +(35338, 1, 46809, 0, 0), -- Bountiful Cookbook +(35338, 2, 44855, 0, 0), -- Teldrassil Sweet Potato +(35338, 3, 44835, 0, 0), -- Autumnal Herbs +(35338, 4, 44853, 0, 0), -- Honey +(35338, 5, 159, 0, 0), -- Refreshing Spring Water +(35338, 6, 2678, 0, 0), -- Mild Spices +(35338, 7, 30817, 0, 0), -- Simple Flour +(35338, 8, 46888, 0, 0), -- Bountiful Basket +-- 35340 (Bountiful Barrel) +(35340, 1, 46809, 0, 0), -- Bountiful Cookbook +(35340, 2, 44854, 0, 0), -- Tangy Wetland Cranberries +(35340, 3, 44835, 0, 0), -- Autumnal Herbs +(35340, 4, 44853, 0, 0), -- Honey +(35340, 5, 159, 0, 0), -- Refreshing Spring Water +(35340, 6, 2678, 0, 0), -- Mild Spices +(35340, 7, 30817, 0, 0), -- Simple Flour +(35340, 8, 46888, 0, 0), -- Bountiful Basket +-- 34681 (Ikaneba Summerset) +(34681, 1, 46809, 0, 0), -- Bountiful Cookbook +(34681, 2, 44855, 0, 0), -- Teldrassil Sweet Potato +(34681, 3, 44835, 0, 0), -- Autumnal Herbs +(34681, 4, 44853, 0, 0), -- Honey +(34681, 5, 159, 0, 0), -- Refreshing Spring Water +(34681, 6, 2678, 0, 0), -- Mild Spices +(34681, 7, 30817, 0, 0), -- Simple Flour +(34681, 8, 46888, 0, 0), -- Bountiful Basket +-- 34682 (Wilmina Holbeck) +(34682, 1, 46809, 0, 0), -- Bountiful Cookbook +(34682, 2, 46784, 0, 0), -- Ripe Elwynn Pumpkin +(34682, 3, 44835, 0, 0), -- Autumnal Herbs +(34682, 4, 44853, 0, 0), -- Honey +(34682, 5, 159, 0, 0), -- Refreshing Spring Water +(34682, 6, 2678, 0, 0), -- Mild Spices +(34682, 7, 30817, 0, 0), -- Simple Flour +(34682, 8, 46888, 0, 0); -- Bountiful Basket From 10444a14233566729d368f47b3f3115f834c0388 Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 21 Nov 2011 23:54:33 +0000 Subject: [PATCH 11/23] DB/Event/Pilgrim: Partially fix food tables --- .../world/2011_11_21_05_pilgrim_tables.sql | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sql/updates/world/2011_11_21_05_pilgrim_tables.sql diff --git a/sql/updates/world/2011_11_21_05_pilgrim_tables.sql b/sql/updates/world/2011_11_21_05_pilgrim_tables.sql new file mode 100644 index 0000000000..18881e14ea --- /dev/null +++ b/sql/updates/world/2011_11_21_05_pilgrim_tables.sql @@ -0,0 +1,52 @@ +UPDATE `creature_template` SET `unit_flags`=33555200,`VehicleId`=323 WHERE `entry`=32830; -- Food Holder +UPDATE `creature_template` SET `unit_flags`=33555200,`VehicleId`=325 WHERE `entry`=32840; -- Plate Holder +UPDATE `creature_template` SET `unit_flags`=33554432,`speed_run`=1,`VehicleId`=320 WHERE `entry`=32823; -- Bountiful Table +UPDATE `creature_template` SET `unit_flags`=33554432,`speed_run`=1 WHERE `entry`=32839; -- Sturdy Plate +UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=32824; -- [PH] Pilgrim's Bounty Table - Turkey +UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=32827; -- [PH] Pilgrim's Bounty Table - Cranberry Sauce +UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=32831; -- [PH] Pilgrim's Bounty Table - Stuffing +UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=32825; -- [PH] Pilgrim's Bounty Table - Yams +UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=32829; -- [PH] Pilgrim's Bounty Table - Pie + +UPDATE `creature_model_info` SET `bounding_radius`=1.8,`combat_reach`=0,`gender`=2 WHERE `modelid`=28293; -- Bountiful Table +UPDATE `creature_model_info` SET `bounding_radius`=1.75,`combat_reach`=0,`gender`=2 WHERE `modelid`=28310; -- Sturdy Plate +UPDATE `creature_model_info` SET `bounding_radius`=0.125,`combat_reach`=0.25,`gender`=2 WHERE `modelid`=17188; -- [PH] Pilgrim's Bounty Table - X + +DELETE FROM `creature_template_addon` WHERE `entry` IN (32830,32840,32839,32824,32827,32831,32829,32825); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(32830,0,0,1,0, NULL), -- Food Holder +(32840,0,0,1,0, NULL), -- Plate Holder +(32839,0,0,1,0, NULL), -- Sturdy Plate +(32824,0,0,1,0, NULL), -- [PH] Pilgrim's Bounty Table - Turkey +(32827,0,0,1,0, NULL), -- [PH] Pilgrim's Bounty Table - Cranberry Sauce +(32831,0,0,1,0, NULL), -- [PH] Pilgrim's Bounty Table - Stuffing +(32825,0,0,1,0, NULL), -- [PH] Pilgrim's Bounty Table - Yams +(32829,0,0,1,0, NULL); -- [PH] Pilgrim's Bounty Table - Pie + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (32823,32830,32840); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`, `aura_required`, `aura_forbidden`, `user_type`) VALUES +(32823, 46598, 0, 0, 0, 1, 0, 0, 0), -- Bountiful Table (Ride Vehicle Hardcoded) +(32830, 46598, 0, 0, 0, 1, 0, 0, 0), -- Food Holder (Ride Vehicle Hardcoded) +(32840, 46598, 0, 0, 0, 1, 0, 0, 0); -- Plate Holder (Ride Vehicle Hardcoded) + +DELETE FROM `vehicle_template_accessory` WHERE `entry` IN (32823,32830,32840); +INSERT INTO `vehicle_template_accessory` (`entry`, `accessory_entry`, `seat_id`, `minion`, `description`, `summontype`, `summontimer`) VALUES +(32823, 34812, 0, 1, 'Bountiful Table - The Turkey Chair', 8, 0), +(32823, 34823, 1, 1, 'Bountiful Table - The Cranberry Chair', 8, 0), +(32823, 34819, 2, 1, 'Bountiful Table - The Stuffing Chair', 8, 0), +(32823, 34824, 3, 1, 'Bountiful Table - The Sweet Potato Chair', 8, 0), +(32823, 34822, 4, 1, 'Bountiful Table - The Pie Chair', 8, 0), +(32823, 32830, 5, 1, 'Bountiful Table - Food Holder', 8, 0), +(32823, 32840, 6, 1, 'Bountiful Table - Plate Holder', 8, 0), +-- +(32830, 32824, 0, 1, 'Food Holder - [PH] Pilgrim''s Bounty Table - Turkey', 8, 0), +(32830, 32827, 1, 1, 'Food Holder - [PH] Pilgrim''s Bounty Table - Cranberry Sauce', 8, 0), +(32830, 32831, 2, 1, 'Food Holder - [PH] Pilgrim''s Bounty Table - Stuffing', 8, 0), +(32830, 32825, 3, 1, 'Food Holder - [PH] Pilgrim''s Bounty Table - Yams', 8, 0), +(32830, 32829, 4, 1, 'Food Holder - [PH] Pilgrim''s Bounty Table - Pie', 8, 0), +-- +(32840, 32839, 0, 1, 'Plate Holder - Sturdy Plate', 8, 0), +(32840, 32839, 1, 1, 'Plate Holder - Sturdy Plate', 8, 0), +(32840, 32839, 2, 1, 'Plate Holder - Sturdy Plate', 8, 0), +(32840, 32839, 3, 1, 'Plate Holder - Sturdy Plate', 8, 0), +(32840, 32839, 4, 1, 'Plate Holder - Sturdy Plate', 8, 0); From 367122dd62785a413bfb80d33359c67dba59cded Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Tue, 22 Nov 2011 06:02:18 +0100 Subject: [PATCH 12/23] Core/Packets: Allow CMSG_MOVE_SET_COLLISION_HGT_ACK to be received from the client (currently unhandled) --- src/server/game/Server/Protocol/Opcodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index df7816f7cb..23a9546f37 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1329,7 +1329,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x514*/ { "SMSG_SEND_ALL_COMBAT_LOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x515*/ { "SMSG_OPEN_LFG_DUNGEON_FINDER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x516*/ { "SMSG_MOVE_SET_COLLISION_HGT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x517*/ { "CMSG_MOVE_SET_COLLISION_HGT_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x517*/ { "CMSG_MOVE_SET_COLLISION_HGT_ACK", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x518*/ { "MSG_MOVE_SET_COLLISION_HGT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x519*/ { "CMSG_CLEAR_RANDOM_BG_WIN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x51A*/ { "CMSG_CLEAR_HOLIDAY_BG_WIN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, From 99ad58233bf1bc805d4ecc968795e92c4e5e2b93 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 22 Nov 2011 13:26:54 +0100 Subject: [PATCH 13/23] Core/Opcodes: Change status of CMSG_MOVE_SET_COLLISION_HGT_ACK to Unhandled to kill spam log --- src/server/game/Server/Protocol/Opcodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 23a9546f37..311a94d421 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1329,7 +1329,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x514*/ { "SMSG_SEND_ALL_COMBAT_LOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x515*/ { "SMSG_OPEN_LFG_DUNGEON_FINDER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x516*/ { "SMSG_MOVE_SET_COLLISION_HGT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x517*/ { "CMSG_MOVE_SET_COLLISION_HGT_ACK", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x517*/ { "CMSG_MOVE_SET_COLLISION_HGT_ACK", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x518*/ { "MSG_MOVE_SET_COLLISION_HGT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x519*/ { "CMSG_CLEAR_RANDOM_BG_WIN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x51A*/ { "CMSG_CLEAR_HOLIDAY_BG_WIN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, From 844453274676d82c4d72bc90f2d0931c9fa912ff Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Tue, 22 Nov 2011 20:25:49 +0100 Subject: [PATCH 14/23] Core/Units: Second part of SMSG_MOVE_SET_COLLISION_HGT implementation: compute proper collision height according to client formulae and send this to the client when mounting up. --- src/server/game/DataStores/DBCStructure.h | 6 ++-- src/server/game/DataStores/DBCfmt.h | 2 +- src/server/game/Entities/Player/Player.h | 35 ++++++++++++++++++----- src/server/game/Entities/Unit/Unit.cpp | 8 +++++- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 32510da70d..ba7be495c7 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -760,7 +760,7 @@ struct CreatureModelDataEntry //uint32 Flags; //char* ModelPath[16] //uint32 Unk1; - //float Scale; // Used in calculation of unit collision data + float Scale; // Used in calculation of unit collision data //int32 Unk2 //int32 Unk3 //uint32 Unk4 @@ -770,9 +770,9 @@ struct CreatureModelDataEntry //float Unk8 //uint32 Unk9 //uint32 Unk10 - float CollisionWidth; + //float CollisionWidth; float CollisionHeight; - //float Unk11; // Used in calculation of unit collision data when mounted + float MountHeight; // Used in calculation of unit collision data when mounted //float Unks[11] }; diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index d71565d8a3..ac0b60d7f8 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -40,7 +40,7 @@ const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxx const char CinematicSequencesEntryfmt[]="nxxxxxxxxx"; const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx"; const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx"; -const char CreatureModelDatafmt[]="nxxxxxxxxxxxxxffxxxxxxxxxxxx"; +const char CreatureModelDatafmt[]="nxxxfxxxxxxxxxxffxxxxxxxxxxx"; const char CreatureSpellDatafmt[]="niiiixxxx"; const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx"; const char CurrencyTypesfmt[]="xnxi"; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ddafefc087..9aad63ccb1 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2494,16 +2494,37 @@ class Player : public Unit, public GridObject bool IsInWhisperWhiteList(uint64 guid); //! Return collision height sent to client - //! we currently only send this on dismount - float GetCollisionHeight() + float GetCollisionHeight(bool mounted) { - CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); - ASSERT(displayInfo); - CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); - ASSERT(modelData); + if (mounted) + { + CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID)); + if (!mountDisplayInfo) + return GetCollisionHeight(false); + + CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId); + if (!mountModelData) + return GetCollisionHeight(false); - return modelData->CollisionHeight; + CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); + ASSERT(displayInfo); + CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); + ASSERT(modelData); + float scaleMod = GetFloatValue(OBJECT_FIELD_SCALE_X); // 99% sure about this + + return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f; + } + else + { + //! Dismounting case - use basic default model data + CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); + ASSERT(displayInfo); + CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); + ASSERT(modelData); + + return modelData->CollisionHeight; + } //! TODO: Need a proper calculation for collision height when mounted } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6d8f786665..b99ccd5f35 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11934,6 +11934,12 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) else player->UnsummonPetTemporaryIfAny(); } + + WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); + data.append(GetPackGUID()); + data << uint32(sWorld->GetGameTime()); // Packet counter + data << player->GetCollisionHeight(true); + player->GetSession()->SendPacket(&data); } RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT); @@ -11952,7 +11958,7 @@ void Unit::Unmount() WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); data.append(GetPackGUID()); data << uint32(sWorld->GetGameTime()); // Packet counter - data << thisPlayer->GetCollisionHeight(); + data << thisPlayer->GetCollisionHeight(false); thisPlayer->GetSession()->SendPacket(&data); } From fffe60b0d9a6636a7c1222d8351a7b8fb05ebd11 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 23 Nov 2011 09:44:34 +0100 Subject: [PATCH 15/23] Scripts/Icecrown Citadel: Corrected an overlooked frenzy spam by Shambling Horrors on heroic mode (does not change anything in the fight) --- .../scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 38f334058b..2f4f225561 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -1335,7 +1335,7 @@ class npc_shambling_horror_icc : public CreatureScript void DamageTaken(Unit* /*attacker*/, uint32& damage) { - if (IsHeroic() && me->HealthBelowPctDamaged(20, damage)) + if (!_frenzied && IsHeroic() && me->HealthBelowPctDamaged(20, damage)) { _frenzied = true; DoCast(me, SPELL_FRENZY, true); From 1b3017472be902ddfb900230ea8efc07132927a1 Mon Sep 17 00:00:00 2001 From: Shocker Date: Wed, 23 Nov 2011 14:22:50 +0200 Subject: [PATCH 16/23] Scripts/Naxxramas: Patchwerk's Hateful Strike's timer should be 1s. Closes #4036 --- src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index 10f1b80969..3b87dea025 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -91,7 +91,7 @@ public: _EnterCombat(); Enraged = false; DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me); - events.ScheduleEvent(EVENT_HATEFUL, 1200); + events.ScheduleEvent(EVENT_HATEFUL, 1000); events.ScheduleEvent(EVENT_BERSERK, 360000); if (instance) @@ -131,7 +131,7 @@ public: DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE, H_SPELL_HATEFUL_STRIKE), true); - events.ScheduleEvent(EVENT_HATEFUL, 1200); + events.ScheduleEvent(EVENT_HATEFUL, 1000); break; } case EVENT_BERSERK: @@ -140,7 +140,7 @@ public: events.ScheduleEvent(EVENT_SLIME, 2000); break; case EVENT_SLIME: - DoCast(me->getVictim(), SPELL_SLIME_BOLT); + DoCast(me->getVictim(), SPELL_SLIME_BOLT, true); events.ScheduleEvent(EVENT_SLIME, 2000); break; } From 298c162c86130d59c6c60f2fedc7a9b2af034a8d Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 23 Nov 2011 09:34:08 -0500 Subject: [PATCH 17/23] Do not allow an instance map to be created twice if it already exists. Fix #4018. --- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- src/server/game/Maps/MapInstanced.cpp | 12 ++++++++---- src/server/game/Maps/MapInstanced.h | 15 ++++++--------- src/server/game/Maps/MapManager.cpp | 5 +++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index bc2648ed02..c4df7d647c 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -521,7 +521,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) DeleteInstanceFromDB(instanceId); // even if save not loaded - Map* iMap = ((MapInstanced*)map)->FindMap(instanceId); + Map* iMap = ((MapInstanced*)map)->FindInstanceMap(instanceId); if (iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY); diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index bbade4c9dc..a56a193ba6 100755 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -110,7 +110,7 @@ void MapInstanced::UnloadAll() - create the instance if it's not created already - the player is not actually added to the instance (only in InstanceMap::Add) */ -Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player) +Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) { if (GetId() != mapId || !player) return NULL; @@ -124,7 +124,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player) // the instance id is set in battlegroundid NewInstanceId = player->GetBattlegroundId(); if (!NewInstanceId) return NULL; - map = _FindMap(NewInstanceId); + map = FindInstanceMap(NewInstanceId); if (!map) map = CreateBattleground(NewInstanceId, player->GetBattleground()); } @@ -151,7 +151,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player) { // solo/perm/group NewInstanceId = pSave->GetInstanceId(); - map = _FindMap(NewInstanceId); + map = FindInstanceMap(NewInstanceId); // it is possible that the save exists but the map doesn't if (!map) map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty()); @@ -163,7 +163,11 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player) NewInstanceId = sMapMgr->GenerateInstanceId(); Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid()); - map = CreateInstance(NewInstanceId, NULL, diff); + //Seems it is now possible, but I do not know if it should be allowed + //ASSERT(!FindInstanceMap(NewInstanceId)); + map = FindInstanceMap(NewInstanceId); + if (!map) + map = CreateInstance(NewInstanceId, NULL, diff); } } diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h index af303ed0e9..9b714cb7fb 100755 --- a/src/server/game/Maps/MapInstanced.h +++ b/src/server/game/Maps/MapInstanced.h @@ -39,8 +39,12 @@ class MapInstanced : public Map void UnloadAll(); bool CanEnter(Player* player); - Map* CreateInstance(const uint32 mapId, Player* player); - Map* FindMap(uint32 InstanceId) const { return _FindMap(InstanceId); } + Map* CreateInstanceForPlayer(const uint32 mapId, Player* player); + Map* FindInstanceMap(uint32 instanceId) const + { + InstancedMaps::const_iterator i = m_InstancedMaps.find(instanceId); + return(i == m_InstancedMaps.end() ? NULL : i->second); + } bool DestroyInstance(InstancedMaps::iterator &itr); void AddGridMapReference(const GridCoord &p) @@ -60,18 +64,11 @@ class MapInstanced : public Map virtual void InitVisibilityDistance(); private: - InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty); BattlegroundMap* CreateBattleground(uint32 InstanceId, Battleground* bg); InstancedMaps m_InstancedMaps; - Map* _FindMap(uint32 InstanceId) const - { - InstancedMaps::const_iterator i = m_InstancedMaps.find(InstanceId); - return(i == m_InstancedMaps.end() ? NULL : i->second); - } - uint16 GridMapReference[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; }; #endif diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 22eaa77cc9..2533096cc2 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -125,7 +125,8 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 /*instanceI //if (!obj->IsInWorld()) sLog->outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId()); Map* m = _createBaseMap(id); - if (m && (obj->GetTypeId() == TYPEID_PLAYER) && m->Instanceable()) m = ((MapInstanced*)m)->CreateInstance(id, (Player*)obj); + if (m && obj->GetTypeId() == TYPEID_PLAYER && m->Instanceable()) + m = ((MapInstanced*)m)->CreateInstanceForPlayer(id, (Player*)obj); return m; } @@ -139,7 +140,7 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const if (!map->Instanceable()) return instanceId == 0 ? map : NULL; - return ((MapInstanced*)map)->FindMap(instanceId); + return ((MapInstanced*)map)->FindInstanceMap(instanceId); } bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) From 44693cfa99b871dd46b794594334d5e286c4e881 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 23 Nov 2011 16:57:08 +0100 Subject: [PATCH 18/23] Core: Fixed a few warnings and silly typos in scripts --- src/server/collision/Maps/TileAssembler.cpp | 8 ++++---- src/server/game/Tools/PlayerDump.cpp | 7 ++++--- .../scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp | 2 +- .../ScarletMonastery/boss_mograine_and_whitemane.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 594e1a9382..533a7ca825 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -500,10 +500,10 @@ namespace VMAP { model.setGroupModels(groupsArray); - std::string filename(iSrcDir); - filename.push_back('/'); - filename.append(pModelFilename).append(".vmo"); - success = model.writeFile(filename); + std::string worldModelFileName(iSrcDir); + worldModelFileName.push_back('/'); + worldModelFileName.append(pModelFilename).append(".vmo"); + success = model.writeFile(worldModelFileName); } //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index bdb912aa8b..0c3fd95716 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -443,9 +443,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s typedef PetIds::value_type PetIdsPair; PetIds petids; - uint8 gender; - uint8 race; - uint8 playerClass; + uint8 gender = GENDER_NONE; + uint8 race = RACE_NONE; + uint8 playerClass = 0; + SQLTransaction trans = CharacterDatabase.BeginTransaction(); while (!feof(fin)) { diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp index 592e0054fa..4bc3da1665 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp @@ -110,7 +110,7 @@ class boss_ragnaros : public CreatureScript void KilledUnit(Unit* /*victim*/) { - if (urand(0, 99 < 25)) + if (urand(0, 99) < 25) DoScriptText(SAY_KILL, me); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 3b788c72cd..d0ea617b73 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -102,7 +102,7 @@ public: { if (m_instance) { - if (m_instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED)) + if (m_instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) != NOT_STARTED) m_instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); } } From 638693e78f7c67602ea07c340f5078d494846d01 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 23 Nov 2011 17:55:16 +0100 Subject: [PATCH 19/23] Core: Fixed more warnings (C6246: Local declaration of 'x' hides declaration of the same name in outer scope.) --- src/server/game/AI/CreatureAI.cpp | 4 +- .../game/AI/SmartScripts/SmartScript.cpp | 18 +++--- .../game/Battlegrounds/Battleground.cpp | 8 +-- .../game/Battlegrounds/BattlegroundQueue.cpp | 42 ++++++------ .../Battlegrounds/Zones/BattlegroundAV.cpp | 12 ++-- src/server/game/Chat/Channels/Channel.cpp | 8 +-- src/server/game/Chat/Commands/Level2.cpp | 8 +-- src/server/game/Conditions/DisableMgr.cpp | 10 +-- src/server/game/DungeonFinding/LFGMgr.cpp | 26 ++++---- src/server/game/Entities/Pet/Pet.cpp | 12 ++-- .../game/Entities/Transport/Transport.cpp | 27 +++----- src/server/game/Spells/Spell.cpp | 2 +- .../Karazhan/boss_netherspite.cpp | 6 +- .../BlackTemple/boss_warlord_najentus.cpp | 4 +- .../SerpentShrine/boss_lurker_below.cpp | 2 +- src/server/shared/Logging/Log.cpp | 64 +++++++++---------- 16 files changed, 120 insertions(+), 133 deletions(-) diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 329a2d004a..5752fcede7 100755 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -59,8 +59,8 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) { - if (Unit* target = creature->SelectNearestTarget(maxRangeToNearestTarget)) - creature->AI()->AttackStart(target); + if (Unit* nearTarget = creature->SelectNearestTarget(maxRangeToNearestTarget)) + creature->AI()->AttackStart(nearTarget); else if (creature->isSummon()) { if (Unit* summoner = creature->ToTempSummon()->GetSummoner()) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 2934066043..ffe21536de 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1490,9 +1490,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsSmart(target)) CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker()); } - else if (GameObject* target = (*itr)->ToGameObject()) + else if (GameObject* goTarget = (*itr)->ToGameObject()) { - if (IsSmartGO(target)) + if (IsSmartGO(goTarget)) CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker()); } } @@ -1607,9 +1607,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsSmart(target)) CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker()); } - else if (GameObject* target = (*itr)->ToGameObject()) + else if (GameObject* goTarget = (*itr)->ToGameObject()) { - if (IsSmartGO(target)) + if (IsSmartGO(goTarget)) CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, id, GetLastInvoker()); } } @@ -1637,9 +1637,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsSmart(target)) CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker()); } - else if (GameObject* target = (*itr)->ToGameObject()) + else if (GameObject* goTarget = (*itr)->ToGameObject()) { - if (IsSmartGO(target)) + if (IsSmartGO(goTarget)) CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, id, GetLastInvoker()); } } @@ -2298,10 +2298,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (!me || !me->isInCombat()) return; - Unit* unit = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit); - if (!unit) + Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit); + if (!target) return; - ProcessAction(e, unit); + ProcessAction(e, target); RecalcTimer(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax); break; } diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index b284202512..af350ac39d 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1759,12 +1759,12 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer) for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player* player = ObjectAccessor::FindPlayer(itr->first); - if (!player || player == killer) + Player* creditedPlayer = ObjectAccessor::FindPlayer(itr->first); + if (!creditedPlayer || creditedPlayer == killer) continue; - if (player->GetTeam() == killer->GetTeam() && player->IsAtGroupRewardDistance(player)) - UpdatePlayerScore(player, SCORE_HONORABLE_KILLS, 1); + if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(player)) + UpdatePlayerScore(creditedPlayer, SCORE_HONORABLE_KILLS, 1); } } diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 3005f1f267..0d76759e1b 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -914,43 +914,43 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT]; uint8 found = 0; uint8 team = 0; - + for (uint8 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++) { // take the group that joined first - GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][i].begin(); - for (; itr != m_QueuedGroups[bracket_id][i].end(); ++itr) + GroupsQueueType::iterator itr2 = m_QueuedGroups[bracket_id][i].begin(); + for (; itr2 != m_QueuedGroups[bracket_id][i].end(); ++itr2) { // if group match conditions, then add it to pool - if (!(*itr)->IsInvitedToBGInstanceGUID - && (((*itr)->ArenaMatchmakerRating >= arenaMinRating && (*itr)->ArenaMatchmakerRating <= arenaMaxRating) - || (*itr)->JoinTime < discardTime)) + if (!(*itr2)->IsInvitedToBGInstanceGUID + && (((*itr2)->ArenaMatchmakerRating >= arenaMinRating && (*itr2)->ArenaMatchmakerRating <= arenaMaxRating) + || (*itr2)->JoinTime < discardTime)) { - itr_teams[found++] = itr; + itr_teams[found++] = itr2; team = i; break; } } } - + if (!found) return; - + if (found == 1) { - for (GroupsQueueType::iterator itr = itr_teams[0]; itr != m_QueuedGroups[bracket_id][team].end(); ++itr) + for (GroupsQueueType::iterator itr3 = itr_teams[0]; itr3 != m_QueuedGroups[bracket_id][team].end(); ++itr3) { - if (!(*itr)->IsInvitedToBGInstanceGUID - && (((*itr)->ArenaMatchmakerRating >= arenaMinRating && (*itr)->ArenaMatchmakerRating <= arenaMaxRating) - || (*itr)->JoinTime < discardTime) - && (*itr_teams[0])->ArenaTeamId != (*itr)->ArenaTeamId) + if (!(*itr3)->IsInvitedToBGInstanceGUID + && (((*itr3)->ArenaMatchmakerRating >= arenaMinRating && (*itr3)->ArenaMatchmakerRating <= arenaMaxRating) + || (*itr3)->JoinTime < discardTime) + && (*itr_teams[0])->ArenaTeamId != (*itr3)->ArenaTeamId) { - itr_teams[found++] = itr; + itr_teams[found++] = itr3; break; } } - } - + } + //if we have 2 teams, then start new arena and invite players! if (found == 2) { @@ -962,14 +962,14 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId sLog->outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); return; } - + aTeam->OpponentsTeamRating = hTeam->ArenaTeamRating; hTeam->OpponentsTeamRating = aTeam->ArenaTeamRating; aTeam->OpponentsMatchmakerRating = hTeam->ArenaMatchmakerRating; hTeam->OpponentsMatchmakerRating = aTeam->ArenaMatchmakerRating; sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", aTeam->ArenaTeamId, aTeam->OpponentsTeamRating); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", hTeam->ArenaTeamId, hTeam->OpponentsTeamRating); - + // now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer if (aTeam->Team != ALLIANCE) { @@ -981,12 +981,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam); m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[BG_TEAM_HORDE]); } - + arena->SetArenaMatchmakerRating(ALLIANCE, aTeam->ArenaMatchmakerRating); arena->SetArenaMatchmakerRating( HORDE, hTeam->ArenaMatchmakerRating); InviteGroupToBG(aTeam, arena, ALLIANCE); InviteGroupToBG(hTeam, arena, HORDE); - + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Starting rated arena match!"); arena->StartBattleground(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 491584557a..fe57093087 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -1348,23 +1348,23 @@ bool BattlegroundAV::SetupBattleground() //creatures sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes"); - for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) { if (m_Nodes[i].Owner) - PopulateNode(i); + PopulateNode(BG_AV_Nodes(i)); } //all creatures which don't get despawned through the script are static sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures"); - for (i=0; i < AV_STATICCPLACE_MAX; i++) - AddAVCreature(0, i+AV_CPLACE_MAX); + for (i = 0; i < AV_STATICCPLACE_MAX; i++) + AddAVCreature(0, i + AV_CPLACE_MAX); //mainspiritguides: sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning spiritguides creatures"); AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE); AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE); //spawn the marshals (those who get deleted, if a tower gets destroyed) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning marshal creatures"); - for (i=AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++) - AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH+(i-AV_NPC_A_MARSHAL_SOUTH)); + for (i = AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++) + AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH + (i - AV_NPC_A_MARSHAL_SOUTH)); AddAVCreature(AV_NPC_HERALD, AV_CPLACE_HERALD); return true; } diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 7717d319bb..1968de70f4 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -85,7 +85,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) } else // save { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL); stmt->setString(0, name); stmt->setUInt32(1, m_Team); CharacterDatabase.Execute(stmt); @@ -563,12 +563,12 @@ void Channel::List(Player* player) uint32 count = 0; for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - Player* player = ObjectAccessor::FindPlayer(i->first); + Player* member = ObjectAccessor::FindPlayer(i->first); // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (player && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || player->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && - player->IsVisibleGloballyFor(player)) + if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && + member->IsVisibleGloballyFor(player)) { data << uint64(i->first); data << uint8(i->second.flags); // flags seems to be changed... diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index 763f365486..1dd603094f 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -349,18 +349,18 @@ bool ChatHandler::HandlePInfoCommand(const char* args) std::string bannedby = "unknown"; std::string banreason = ""; - if (QueryResult result = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned " + if (QueryResult result2 = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned " "WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId)) { - Field* fields = result->Fetch(); + Field* fields = result2->Fetch(); banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64(); bannedby = fields[2].GetString(); banreason = fields[3].GetString(); } - else if (QueryResult result = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned " + else if (QueryResult result3 = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned " "WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid))) { - Field* fields = result->Fetch(); + Field* fields = result3->Fetch(); banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64(); bannedby = fields[2].GetString(); banreason = fields[3].GetString(); diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index dafb0ebc11..103781cc49 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -277,12 +277,12 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags { case DISABLE_TYPE_SPELL: { - uint8 flags = itr->second.flags; + uint8 spellFlags = itr->second.flags; if (unit) { - if ((flags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || - (unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && flags & SPELL_DISABLE_PET) || flags & SPELL_DISABLE_CREATURE))) + if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || + (unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE))) { if (flags & SPELL_DISABLE_MAP) { @@ -290,13 +290,13 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags if (mapIds.find(unit->GetMapId()) != mapIds.end()) return true; // Spell is disabled on current map - if (!(flags & SPELL_DISABLE_AREA)) + if (!(spellFlags & SPELL_DISABLE_AREA)) return false; // Spell is disabled on another map, but not this one, return false // Spell is disabled in an area, but not explicitly our current mapId. Continue processing. } - if (flags & SPELL_DISABLE_AREA) + if (spellFlags & SPELL_DISABLE_AREA) { std::set const& areaIds = itr->second.params[1]; if (areaIds.find(unit->GetAreaId()) != areaIds.end()) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 1364f73966..55f798204d 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -254,7 +254,7 @@ void LFGMgr::Update(uint32 diff) if (m_QueueTimer > LFG_QUEUEUPDATE_INTERVAL) { m_QueueTimer = 0; - time_t currTime = time(NULL); + currTime = time(NULL); for (LfgQueueInfoMap::const_iterator itQueue = m_QueueInfoMap.begin(); itQueue != m_QueueInfoMap.end(); ++itQueue) { LfgQueueInfo* queue = itQueue->second; @@ -689,10 +689,9 @@ void LFGMgr::Leave(Player* player, Group* grp /* = NULL*/) { // Remove from Proposals LfgProposalMap::iterator it = m_Proposals.begin(); - uint64 guid = player ? player->GetGUID() : grp->GetLeaderGUID(); while (it != m_Proposals.end()) { - LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(guid); + LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(player ? player->GetGUID() : grp->GetLeaderGUID()); if (itPlayer != it->second->players.end()) { // Mark the player/leader of group who left as didn't accept the proposal @@ -1069,10 +1068,10 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* // Set queue roles needed - As we are using check_roles will not have more that 1 tank, 1 healer, 3 dps for (LfgRolesMap::const_iterator it = check_roles.begin(); it != check_roles.end(); ++it) { - uint8 roles = it->second; - if (roles & ROLE_TANK) + uint8 roles2 = it->second; + if (roles2 & ROLE_TANK) --pqInfo->tanks; - else if (roles & ROLE_HEALER) + else if (roles2 & ROLE_HEALER) --pqInfo->healers; else --pqInfo->dps; @@ -1152,14 +1151,14 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& pla { uint64 guid = (*it)->GetGUID(); LfgLockMap cachedLockMap = GetLockedDungeons(guid); - for (LfgLockMap::const_iterator it = cachedLockMap.begin(); it != cachedLockMap.end() && dungeons.size(); ++it) + for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2) { - uint32 dungeonId = (it->first & 0x00FFFFFF); // Compare dungeon ids + uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId); if (itDungeon != dungeons.end()) { dungeons.erase(itDungeon); - lockMap[guid][dungeonId] = it->second; + lockMap[guid][dungeonId] = it2->second; } } } @@ -1313,8 +1312,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) if (player->groupLowGuid != lowgroupguid) sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid); - uint64 guid = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID(); - LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid); + uint64 guid2 = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID(); + LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid2); if (itQueue == m_QueueInfoMap.end()) { sLog->outError("LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid); @@ -1399,10 +1398,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) // Remove players/groups from Queue for (LfgGuidList::const_iterator it = pProposal->queues.begin(); it != pProposal->queues.end(); ++it) - { - uint64 guid = (*it); - RemoveFromQueue(guid); - } + RemoveFromQueue(*it); // Teleport Player for (LfgPlayerList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 82c551c237..b441ed899d 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -382,29 +382,29 @@ void Pet::SavePetToDB(PetSaveMode mode) // current/stable/not_in_slot if (mode >= PET_SAVE_AS_CURRENT) { - uint32 owner = GUID_LOPART(GetOwnerGUID()); + uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID()); std::string name = m_name; CharacterDatabase.EscapeString(name); - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + trans = CharacterDatabase.BeginTransaction(); // remove current data trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner, m_charmInfo->GetPetNumber()); // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT) if (mode <= PET_SAVE_LAST_STABLE_SLOT) trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'", - PET_SAVE_NOT_IN_SLOT, owner, uint32(mode)); + PET_SAVE_NOT_IN_SLOT, ownerLowGUID, uint32(mode)); // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT - if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT)) + if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT)) trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')", - owner, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT); + ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT); // save pet std::ostringstream ss; ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) " << "VALUES (" << m_charmInfo->GetPetNumber() << ',' << GetEntry() << ',' - << owner << ',' + << ownerLowGUID << ',' << GetNativeDisplayId() << ',' << uint32(getLevel()) << ',' << GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ',' diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 28895cff35..b7f000a6c7 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -365,9 +365,9 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) if (keyFrames[keyFrames.size() - 1].node->mapid != keyFrames[0].node->mapid) teleport = true; - WayPoint pos(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0, + m_WayPoints[0] = WayPoint(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0, keyFrames[0].node->arrivalEventID, keyFrames[0].node->departureEventID); - m_WayPoints[0] = pos; + t += keyFrames[0].node->delay * 1000; uint32 cM = keyFrames[0].node->mapid; @@ -387,12 +387,11 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) if (d > 0) { - float newX, newY, newZ; - newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev; - newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev; - newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev; + float newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev; + float newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev; + float newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev; - bool teleport = false; + teleport = false; if (keyFrames[i].node->mapid != cM) { teleport = true; @@ -400,9 +399,8 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) } // sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ); - WayPoint pos(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0); if (teleport) - m_WayPoints[t] = pos; + m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0); } if (tFrom < tTo) // caught in tFrom dock's "gravitational pull" @@ -439,25 +437,18 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) else t += (long)keyFrames[i + 1].tTo % 100; - bool teleport = false; + teleport = false; if ((keyFrames[i + 1].node->actionFlag == 1) || (keyFrames[i + 1].node->mapid != keyFrames[i].node->mapid)) { teleport = true; cM = keyFrames[i + 1].node->mapid; } - WayPoint pos(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport, + m_WayPoints[t] = WayPoint(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport, 0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID); // sLog->outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport); -/* - if (keyFrames[i+1].delay > 5) - pos.delayed = true; -*/ - //if (teleport) - m_WayPoints[t] = pos; t += keyFrames[i + 1].node->delay * 1000; - // sLog->outString("------"); } uint32 timer = t; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index dc56e04c3b..dff6d3af77 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7027,7 +7027,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo break; default: ASSERT(false); - break; + return; } (*scritr)->_PrepareScriptCall(hookType); for (; effItr != effEndItr ; ++effItr) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 2bcfab8005..aa0fee873e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -136,9 +136,9 @@ public: { uint8 r = rand()%4; uint8 pos[3]; - pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); - pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); - pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) + pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0); + pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1)); + pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0) for (int i=0; i<3; ++i) if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000)) diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 1f60369906..6bf26e795c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -94,7 +94,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, me); + DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, me); events.DelayEvents(5000, GCD_YELL); } @@ -175,7 +175,7 @@ public: SpineTargetGUID = target->GetGUID(); //must let target summon, otherwise you cannot click the spine target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30); - DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me); + DoScriptText(urand(0, 1) ? SAY_NEEDLE1 : SAY_NEEDLE2, me); events.DelayEvents(1500, GCD_CAST); events.DelayEvents(15000, GCD_YELL); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index f69aa1f075..f8ed96632d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -234,7 +234,7 @@ public: { me->MonsterTextEmote(EMOTE_SPOUT, 0, true); me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); + me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); SpoutTimer = 45000; WhirlTimer = 20000;//whirl directly after spout RotTimer = 20000; diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 15008f13c1..697e7616c4 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -556,10 +556,10 @@ void Log::outSQLDriver(const char* str, ...) { outTimestamp(sqlLogFile); - va_list ap; - va_start(ap, str); - vfprintf(sqlLogFile, str, ap); - va_end(ap); + va_list apSQL; + va_start(apSQL, str); + vfprintf(sqlLogFile, str, apSQL); + va_end(apSQL); fprintf(sqlLogFile, "\n"); fflush(sqlLogFile); @@ -646,11 +646,11 @@ void Log::outBasic(const char * str, ...) if (logfile) { outTimestamp(logfile); - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); + va_list ap2; + va_start(ap2, str); + vfprintf(logfile, str, ap2); fprintf(logfile, "\n" ); - va_end(ap); + va_end(ap2); fflush(logfile); } } @@ -690,10 +690,10 @@ void Log::outDetail(const char * str, ...) if (logfile) { outTimestamp(logfile); - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); + va_list ap2; + va_start(ap2, str); + vfprintf(logfile, str, ap2); + va_end(ap2); fprintf(logfile, "\n"); fflush(logfile); @@ -720,10 +720,10 @@ void Log::outDebugInLine(const char * str, ...) if (logfile) { - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); + va_list ap2; + va_start(ap2, str); + vfprintf(logfile, str, ap2); + va_end(ap2); } } } @@ -742,10 +742,10 @@ void Log::outSQLDev(const char* str, ...) if (sqlDevLogFile) { - va_list ap; - va_start(ap, str); - vfprintf(sqlDevLogFile, str, ap); - va_end(ap); + va_list ap2; + va_start(ap2, str); + vfprintf(sqlDevLogFile, str, ap2); + va_end(ap2); fprintf(sqlDevLogFile, "\n"); fflush(sqlDevLogFile); @@ -790,10 +790,10 @@ void Log::outDebug(DebugLogFilters f, const char * str, ...) if (logfile) { outTimestamp(logfile); - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); + va_list ap2; + va_start(ap2, str); + vfprintf(logfile, str, ap2); + va_end(ap2); fprintf(logfile, "\n" ); fflush(logfile); @@ -835,10 +835,10 @@ void Log::outStaticDebug(const char * str, ...) if (logfile) { outTimestamp(logfile); - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); + va_list ap2; + va_start(ap2, str); + vfprintf(logfile, str, ap2); + va_end(ap2); fprintf(logfile, "\n" ); fflush(logfile); @@ -900,11 +900,11 @@ void Log::outCommand(uint32 account, const char * str, ...) if (logfile) { outTimestamp(logfile); - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); + va_list ap2; + va_start(ap2, str); + vfprintf(logfile, str, ap2); fprintf(logfile, "\n" ); - va_end(ap); + va_end(ap2); fflush(logfile); } } From b3fef1e280e36ca744411d91ad8c5fbc105ebab3 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 23 Nov 2011 12:42:11 -0500 Subject: [PATCH 20/23] Fix build. --- src/server/game/Spells/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index dff6d3af77..a484a4976a 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7027,7 +7027,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo break; default: ASSERT(false); - return; + return false; } (*scritr)->_PrepareScriptCall(hookType); for (; effItr != effEndItr ; ++effItr) From 98be413ce02d6c8420458f3df55e3061a9901034 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 23 Nov 2011 12:45:59 -0500 Subject: [PATCH 21/23] Clean up very some confusing MapManager functions (create/find map/base map). --- src/server/game/Entities/Player/Player.cpp | 10 ++++----- .../game/Entities/Transport/Transport.cpp | 4 ++-- src/server/game/Maps/MapManager.cpp | 16 +++++++------- src/server/game/Maps/MapManager.h | 21 ++++++++----------- .../WaypointMovementGenerator.cpp | 2 +- .../Protocol/Handlers/MovementHandler.cpp | 2 +- 6 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 82e4ffe676..bf68ec34b9 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -940,7 +940,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) return false; } - SetMap(sMapMgr->CreateMap(info->mapId, this, 0)); + SetMap(sMapMgr->CreateMap(info->mapId, this)); uint8 powertype = cEntry->powerType; @@ -2205,7 +2205,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!sMapMgr->CanPlayerEnter(mapid, this, false)) return false; - Map* map = sMapMgr->CreateMap(mapid, this, 0); + Map* map = sMapMgr->CreateMap(mapid, this); if (!map || map->CanEnter(this)) { //lets reset near teleport flag if it wasn't reset during chained teleports @@ -16790,7 +16790,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // NOW player must have valid map // load the player's map here if it's not already loaded - Map* map = sMapMgr->CreateMap(mapId, this, instanceId); + Map* map = sMapMgr->CreateMap(mapId, this); if (!map) { @@ -16808,14 +16808,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) RelocateToHomebind(); } - map = sMapMgr->CreateMap(mapId, this, 0); + map = sMapMgr->CreateMap(mapId, this); if (!map) { PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); - map = sMapMgr->CreateMap(mapId, this, 0); + map = sMapMgr->CreateMap(mapId, this); if (!map) { sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index b7f000a6c7..b92e1ad21d 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -98,7 +98,7 @@ void MapManager::LoadTransports() m_TransportsByMap[*i].insert(t); //If we someday decide to use the grid to track transports, here: - t->SetMap(sMapMgr->CreateMap(mapid, t, 0)); + t->SetMap(sMapMgr->CreateBaseMap(mapid)); t->AddToWorld(); ++count; @@ -494,7 +494,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) RemoveFromWorld(); ResetMap(); - Map* newMap = sMapMgr->CreateMap(newMapid, this, 0); + Map* newMap = sMapMgr->CreateBaseMap(newMapid); SetMap(newMap); ASSERT (GetMap()); AddToWorld(); diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 2533096cc2..bb62912d20 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -95,9 +95,9 @@ void MapManager::checkAndCorrectGridStatesArray() ++i_GridStateErrorCount; } -Map* MapManager::_createBaseMap(uint32 id) +Map* MapManager::CreateBaseMap(uint32 id) { - Map* m = _findMap(id); + Map* m = FindBaseMap(id); if (m == NULL) { @@ -119,21 +119,19 @@ Map* MapManager::_createBaseMap(uint32 id) return m; } -Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 /*instanceId*/) +Map* MapManager::CreateMap(uint32 id, Player* player) { - ASSERT(obj); - //if (!obj->IsInWorld()) sLog->outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId()); - Map* m = _createBaseMap(id); + Map* m = CreateBaseMap(id); - if (m && obj->GetTypeId() == TYPEID_PLAYER && m->Instanceable()) - m = ((MapInstanced*)m)->CreateInstanceForPlayer(id, (Player*)obj); + if (m && m->Instanceable()) + m = ((MapInstanced*)m)->CreateInstanceForPlayer(id, player); return m; } Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const { - Map* map = _findMap(mapid); + Map* map = FindBaseMap(mapid); if (!map) return NULL; diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 926ff2c805..6ce641f81b 100755 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -35,14 +35,18 @@ class MapManager friend class ACE_Singleton; public: - - Map* CreateMap(uint32, const WorldObject* obj, uint32 instanceId); - Map const* CreateBaseMap(uint32 id) const { return const_cast(this)->_createBaseMap(id); } - Map* FindMap(uint32 mapid, uint32 instanceId = 0) const; + Map* CreateBaseMap(uint32 mapId); + Map* FindBaseMap(uint32 mapId) const + { + MapMapType::const_iterator iter = i_maps.find(mapId); + return (iter == i_maps.end() ? NULL : iter->second); + } + Map* CreateMap(uint32 mapId, Player* player); + Map* FindMap(uint32 mapId, uint32 instanceId) const; uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const { - Map const* m = CreateBaseMap(mapid); + Map const* m = const_cast(this)->CreateBaseMap(mapid); return m->GetAreaFlag(x, y, z); } uint32 GetAreaId(uint32 mapid, float x, float y, float z) const @@ -163,13 +167,6 @@ class MapManager MapManager(const MapManager &); MapManager& operator=(const MapManager &); - Map* _createBaseMap(uint32 id); - Map* _findMap(uint32 id) const - { - MapMapType::const_iterator iter = i_maps.find(id); - return (iter == i_maps.end() ? NULL : iter->second); - } - ACE_Thread_Mutex Lock; uint32 i_gridCleanUpDelay; MapMapType i_maps; diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 808d8318ea..48e662d08b 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -351,7 +351,7 @@ void FlightPathMovementGenerator::InitEndGridInfo() void FlightPathMovementGenerator::PreloadEndGrid() { // used to preload the final grid where the flightmaster is - Map* endMap = sMapMgr->FindMap(m_endMapId); + Map* endMap = sMapMgr->FindBaseMap(m_endMapId); // Load the grid if (endMap) diff --git a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp index 90368ae301..4e45eb2d6c 100755 --- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp @@ -72,7 +72,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // relocate the player to the teleport destination - Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer(), 0); + Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer()); // the CanEnter checks are done in TeleporTo but conditions may change // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) From 5a0ffefecc23886ae7bc4d3c2c2137b2515eba90 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 23 Nov 2011 12:51:20 -0500 Subject: [PATCH 22/23] Remove unnecessary const_cast. --- src/server/game/Events/GameEventMgr.cpp | 4 ++-- src/server/game/Globals/ObjectMgr.cpp | 6 +++--- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- src/server/game/Pools/PoolMgr.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 4cc735a98d..dbcb07e88f 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1170,7 +1170,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) sObjectMgr->AddCreatureToGrid(*itr, data); // Spawn if necessary (loaded grids only) - Map* map = const_cast(sMapMgr->CreateBaseMap(data->mapid)); + Map* map = sMapMgr->CreateBaseMap(data->mapid); // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { @@ -1199,7 +1199,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) sObjectMgr->AddGameobjectToGrid(*itr, data); // Spawn if necessary (loaded grids only) // this base map checked as non-instanced and then only existed - Map* map = const_cast(sMapMgr->CreateBaseMap(data->mapid)); + Map* map = sMapMgr->CreateBaseMap(data->mapid); // We use current coords to unspawn, not spawn coords since creature can have changed grid if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 287ce288a8..683d7eba63 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1599,7 +1599,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float if (!goinfo) return 0; - Map* map = const_cast(sMapMgr->CreateBaseMap(mapId)); + Map* map = sMapMgr->CreateBaseMap(mapId); if (!map) return 0; @@ -1660,7 +1660,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) AddCreatureToGrid(guid, &data); // Spawn if necessary (loaded grids only) - if (Map* map = const_cast(sMapMgr->CreateBaseMap(mapId))) + if (Map* map = sMapMgr->CreateBaseMap(mapId)) { // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data.posX, data.posY)) @@ -1713,7 +1713,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float AddCreatureToGrid(guid, &data); // Spawn if necessary (loaded grids only) - if (Map* map = const_cast(sMapMgr->CreateBaseMap(mapId))) + if (Map* map = sMapMgr->CreateBaseMap(mapId)) { // We use spawn coords to spawn if (!map->Instanceable() && !map->IsRemovalGrid(x, y)) diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index c4df7d647c..57e5818a9f 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -511,7 +511,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) { sLog->outDebug(LOG_FILTER_MAPS, "InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); - Map* map = (MapInstanced*)sMapMgr->CreateBaseMap(mapid); + Map const* map = sMapMgr->CreateBaseMap(mapid); if (!map->Instanceable()) return; diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index bbef60aa5e..bd8840ff8a 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -359,7 +359,7 @@ void PoolGroup::Spawn1Object(PoolObject* obj) sObjectMgr->AddCreatureToGrid(obj->guid, data); // Spawn if necessary (loaded grids only) - Map* map = const_cast(sMapMgr->CreateBaseMap(data->mapid)); + Map* map = sMapMgr->CreateBaseMap(data->mapid); // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { @@ -385,7 +385,7 @@ void PoolGroup::Spawn1Object(PoolObject* obj) sObjectMgr->AddGameobjectToGrid(obj->guid, data); // Spawn if necessary (loaded grids only) // this base map checked as non-instanced and then only existed - Map* map = const_cast(sMapMgr->CreateBaseMap(data->mapid)); + Map* map = sMapMgr->CreateBaseMap(data->mapid); // We use current coords to unspawn, not spawn coords since creature can have changed grid if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { From 0eb193f2b416af7f34bd89641aec88d843c9197e Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 23 Nov 2011 12:55:00 -0500 Subject: [PATCH 23/23] Revert 2f83db28f2a11384e1b818b1d5d42d0d87111172. Note that here we only want to check baseMap->canEnter, but not instanceMap->canEnter. Thanks to SignFinder. --- src/server/game/Entities/Player/Player.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index bf68ec34b9..84182ad1d2 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2205,7 +2205,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!sMapMgr->CanPlayerEnter(mapid, this, false)) return false; - Map* map = sMapMgr->CreateMap(mapid, this); + // If the map is not created, assume it is possible to enter it. + // It will be created in the WorldPortAck. + Map* map = sMapMgr->FindBaseMap(mapid); if (!map || map->CanEnter(this)) { //lets reset near teleport flag if it wasn't reset during chained teleports