From 68bfe8c831c107ccdd43475ed2a89b7848b6ab32 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 15 May 2012 12:41:00 +0200 Subject: [PATCH 001/147] Core/Spell: Fix not using Shadowstep while rooted --- ...2012_05_15_00_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_rogue.cpp | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 sql/updates/world/2012_05_15_00_world_spell_script_names.sql diff --git a/sql/updates/world/2012_05_15_00_world_spell_script_names.sql b/sql/updates/world/2012_05_15_00_world_spell_script_names.sql new file mode 100644 index 0000000000..980aceff51 --- /dev/null +++ b/sql/updates/world/2012_05_15_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=36554; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(36554,'spell_rog_shadowstep'); diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 3a4132f62f..a315f867e3 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -386,6 +386,34 @@ class spell_rog_deadly_poison : public SpellScriptLoader } }; +class spell_rog_shadowstep : public SpellScriptLoader +{ + public: + spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { } + + class spell_rog_shadowstep_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rog_shadowstep_SpellScript); + + SpellCastResult CheckCast() + { + if (GetCaster()->HasUnitState(UNIT_STATE_ROOT)) + return SPELL_FAILED_ROOTED; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_rog_shadowstep_SpellScript(); + } +}; + void AddSC_rogue_spell_scripts() { new spell_rog_cheat_death(); @@ -394,4 +422,5 @@ void AddSC_rogue_spell_scripts() new spell_rog_prey_on_the_weak(); new spell_rog_shiv(); new spell_rog_deadly_poison(); + new spell_rog_shadowstep(); } From bf6e334c5fd92933e66f099cec371129557ec2b1 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 2 Aug 2012 18:38:55 +0200 Subject: [PATCH 002/147] Core/Spells: Fix some summon vehicle spells with basepoint 1 ty zwerg --- src/server/game/Spells/SpellEffects.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 58c24aa895..886541922c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2420,12 +2420,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) return; // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE - uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED; - if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue())) - spell = spellProto->Id; + uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()); + if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) + spellId = spellInfo->Id; // Hard coded enter vehicle spell - m_originalCaster->CastSpell(summon, spell, true); + m_originalCaster->CastSpell(summon, spellId, true); uint32 faction = properties->Faction; if (!faction) From 1dd2a70cd5d3c16b83d12564a67d4d092b94b0c1 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 13:53:23 +0200 Subject: [PATCH 003/147] DB/Disables: Disable 217 quests that shouldnt be attainable ingame, part of a cleanup --- .../world/2012_08_04_00_world_disables.sql | 219 ++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 sql/updates/world/2012_08_04_00_world_disables.sql diff --git a/sql/updates/world/2012_08_04_00_world_disables.sql b/sql/updates/world/2012_08_04_00_world_disables.sql new file mode 100644 index 0000000000..f3f197ba23 --- /dev/null +++ b/sql/updates/world/2012_08_04_00_world_disables.sql @@ -0,0 +1,219 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (73,108,241,242,259,326,327,352,390,406,462,490,497,534,548,612,636,740,774,796,797,798,799,800,801,802,803,810,811,814,820,839,856,859,904,946,987,988,989,1128,1129,1155,1156,1157,1158,1161,1162,1163,1165,1263,1272,1277,1278,1279,1280,1281,1283,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1390,1397,1441,1443,1460,1461,1533,1537,1538,1659,1660,1662,1663,1664,2020,2971,3023,3064,3241,3383,3401,3403,3404,3405,3422,3423,3424,3425,3515,3516,3529,3530,3531,3622,3623,3624,3885,3910,4323,4541,4905,5053,5205,5207,5208,5209,5303,5304,5506,5512,5516,5520,5523,5532,5653,5659,5664,5665,5666,5667,5668,5669,5670,5671,5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712,6003,6165,6202,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6841,6842,7069,7904,8002,8244,8245,8247,8248,8337,8339,8340,8444,8445,8448,8449,8450,8451,8452,8453,8454,8458,8459,8571,9031,9306,9307,9445,9596,9597,9599,9679,9745,10370,10402,10616,10743,10890,11127); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,73,0,'','','Deprecated quest: No Reward'), +(1,108,0,'','','Deprecated quest: Mystery Reward'), +(1,241,0,'','','Deprecated quest: HEY MISTER WILSON!'), +(1,242,0,'','','Deprecated quest: '), +(1,259,0,'','','Deprecated quest: '), +(1,326,0,'','','Deprecated quest: '), +(1,327,0,'','','Deprecated quest: '), +(1,352,0,'','','Deprecated quest: '), +(1,390,0,'','','Deprecated quest: '), +(1,406,0,'','','Deprecated quest: '), +(1,462,0,'','','Deprecated quest: '), +(1,490,0,'','','Deprecated quest: '), +(1,497,0,'','','Deprecated quest: '), +(1,534,0,'','','Deprecated quest: '), +(1,548,0,'','','Deprecated quest: Bloodstone Pendant'), +(1,612,0,'','','Deprecated quest: '), +(1,636,0,'','','Deprecated quest: Legends of the Earth '), +(1,740,0,'','','Deprecated quest: '), +(1,774,0,'','','Deprecated quest: '), +(1,796,0,'','','Deprecated quest: '), +(1,797,0,'','','Deprecated quest: '), +(1,798,0,'','','Deprecated quest: '), +(1,799,0,'','','Deprecated quest: '), +(1,800,0,'','','Deprecated quest: '), +(1,801,0,'','','Deprecated quest: '), +(1,802,0,'','','Deprecated quest: '), +(1,803,0,'','','Deprecated quest: '), +(1,810,0,'','','Deprecated quest: '), +(1,811,0,'','','Deprecated quest: '), +(1,814,0,'','','Deprecated quest: '), +(1,820,0,'','','Deprecated quest: '), +(1,839,0,'','','Deprecated quest: '), +(1,856,0,'','','Deprecated quest: '), +(1,859,0,'','','Deprecated quest: '), +(1,904,0,'','','Deprecated quest: '), +(1,946,0,'','','Deprecated quest: '), +(1,987,0,'','','Deprecated quest: '), +(1,988,0,'','','Deprecated quest: '), +(1,989,0,'','','Deprecated quest: '), +(1,1128,0,'','','Deprecated quest: The Gnome Pit Crew is Thirsty'), +(1,1129,0,'','','Deprecated quest: The Goblin Pit Crew is Thirsty'), +(1,1155,0,'','','Deprecated quest: bug crystal side quest'), +(1,1156,0,'','','Deprecated quest: speak to alchemist pestlezugg'), +(1,1157,0,'','','Deprecated quest: pestlezugg needs items'), +(1,1158,0,'','','Deprecated quest: speak to rabine saturna'), +(1,1161,0,'','','Deprecated quest: gossip shade of ambermoon'), +(1,1162,0,'','','Deprecated quest: speak to hamuul runetotem'), +(1,1163,0,'','','Deprecated quest: speak to tyrande whisperwind'), +(1,1165,0,'','','Deprecated quest: Ore for the Races'), +(1,1263,0,'','','Deprecated quest: The Burning Inn '), +(1,1272,0,'','','Deprecated quest: Finding Reethe '), +(1,1277,0,'','','Deprecated quest: The Centaur Hoofprints'), +(1,1278,0,'','','Deprecated quest: The Grim Totem Clan'), +(1,1279,0,'','','Deprecated quest: The Centaur Hoofprints'), +(1,1280,0,'','','Deprecated quest: The Centaur Hoofprints'), +(1,1281,0,'','','Deprecated quest: Jim''s Song '), +(1,1283,0,'','','Deprecated quest: Fire at the Shady Rest '), +(1,1289,0,'','','Deprecated quest: Vimes''s Report'), +(1,1290,0,'','','Deprecated quest: Investigating Mosarn'), +(1,1291,0,'','','Deprecated quest: Centaur Hoofprints'), +(1,1292,0,'','','Deprecated quest: Centaur Hoofprints'), +(1,1293,0,'','','Deprecated quest: Centaur Hoofprints'), +(1,1294,0,'','','Deprecated quest: Centaur Sympathies'), +(1,1295,0,'','','Deprecated quest: Course of Action'), +(1,1296,0,'','','Deprecated quest: Course of Action'), +(1,1297,0,'','','Deprecated quest: Course of Action'), +(1,1298,0,'','','Deprecated quest: Thrall''s Dirty Work'), +(1,1299,0,'','','Deprecated quest: Thrall''s Dirty Work'), +(1,1300,0,'','','Deprecated quest: Lorn Grim Totem'), +(1,1390,0,'','','Deprecated quest: Oops, We Killed Them Again.'), +(1,1397,0,'','','Deprecated quest: Saved!'), +(1,1441,0,'','','Deprecated quest: '), +(1,1443,0,'','','Deprecated quest: The Shakedown'), +(1,1460,0,'','','Deprecated quest: '), +(1,1461,0,'','','Deprecated quest: '), +(1,1533,0,'','','Deprecated quest: Call of Air'), +(1,1537,0,'','','Deprecated quest: Call of Air'), +(1,1538,0,'','','Deprecated quest: Call of Air'), +(1,1659,0,'','','Deprecated quest: '), +(1,1660,0,'','','Deprecated quest: '), +(1,1662,0,'','','Deprecated quest: '), +(1,1663,0,'','','Deprecated quest: '), +(1,1664,0,'','','Deprecated quest: '), +(1,2020,0,'','','Deprecated quest: '), +(1,2971,0,'','','Deprecated quest: '), +(1,3023,0,'','','Deprecated quest: '), +(1,3064,0,'','','Deprecated quest: Pirate Hats'), +(1,3241,0,'','','Deprecated quest: Dreadmist Peak'), +(1,3383,0,'','','Deprecated quest: '), +(1,3401,0,'','','Deprecated quest: '), +(1,3403,0,'','','Deprecated quest: '), +(1,3404,0,'','','Deprecated quest: '), +(1,3405,0,'','','Deprecated quest: '), +(1,3422,0,'','','Deprecated quest: '), +(1,3423,0,'','','Deprecated quest: '), +(1,3424,0,'','','Deprecated quest: '), +(1,3425,0,'','','Deprecated quest: '), +(1,3515,0,'','','Deprecated quest: '), +(1,3516,0,'','','Deprecated quest: '), +(1,3529,0,'','','Deprecated quest: '), +(1,3530,0,'','','Deprecated quest: '), +(1,3531,0,'','','Deprecated quest: '), +(1,3622,0,'','','Deprecated quest: '), +(1,3623,0,'','','Deprecated quest: '), +(1,3624,0,'','','Deprecated quest: '), +(1,3885,0,'','','Deprecated quest: The Gadgetzan Run'), +(1,3910,0,'','','Deprecated quest: The Un''Goro Run'), +(1,4323,0,'','','Deprecated quest: Get those Hyenas!!!'), +(1,4541,0,'','','Deprecated quest: '), +(1,4905,0,'','','Deprecated quest: '), +(1,5053,0,'','','Deprecated quest: '), +(1,5205,0,'','','Deprecated quest: '), +(1,5207,0,'','','Deprecated quest: The True Summoner'), +(1,5208,0,'','','Deprecated quest: The Blessing of Evil'), +(1,5209,0,'','','Deprecated quest: '), +(1,5303,0,'','','Deprecated quest: '), +(1,5304,0,'','','Deprecated quest: '), +(1,5506,0,'','','Deprecated quest: '), +(1,5512,0,'','','Deprecated quest: '), +(1,5516,0,'','','Deprecated quest: '), +(1,5520,0,'','','Deprecated quest: '), +(1,5523,0,'','','Deprecated quest: '), +(1,5532,0,'','','Deprecated quest: Ring of the Dawn'), +(1,5653,0,'','','Deprecated quest: Hex of Weakness'), +(1,5659,0,'','','Deprecated quest: Touch of Weakness'), +(1,5664,0,'','','Deprecated quest: '), +(1,5665,0,'','','Deprecated quest: '), +(1,5666,0,'','','Deprecated quest: '), +(1,5667,0,'','','Deprecated quest: '), +(1,5668,0,'','','Deprecated quest: A Blessing of Light'), +(1,5669,0,'','','Deprecated quest: A Blessing of Light'), +(1,5670,0,'','','Deprecated quest: A Blessing of Light'), +(1,5671,0,'','','Deprecated quest: A Blessing of Light'), +(1,5681,0,'','','Deprecated quest: '), +(1,5682,0,'','','Deprecated quest: '), +(1,5683,0,'','','Deprecated quest: '), +(1,5684,0,'','','Deprecated quest: '), +(1,5685,0,'','','Deprecated quest: The Light Protects You'), +(1,5686,0,'','','Deprecated quest: The Light Protects You'), +(1,5687,0,'','','Deprecated quest: The Light Protects You'), +(1,5688,0,'','','Deprecated quest: A Touch of Voodoo'), +(1,5689,0,'','','Deprecated quest: A Touch of Voodoo'), +(1,5690,0,'','','Deprecated quest: A Touch of Voodoo'), +(1,5691,0,'','','Deprecated quest: In the Dark it was Created'), +(1,5692,0,'','','Deprecated quest: In the Dark It was Created'), +(1,5693,0,'','','Deprecated quest: In the Dark It was Created'), +(1,5694,0,'','','Deprecated quest: '), +(1,5695,0,'','','Deprecated quest: '), +(1,5696,0,'','','Deprecated quest: '), +(1,5697,0,'','','Deprecated quest: '), +(1,5698,0,'','','Deprecated quest: A Small Amount of Hope'), +(1,5699,0,'','','Deprecated quest: A Small Amount of Hope'), +(1,5700,0,'','','Deprecated quest: A Small Amount of Hope'), +(1,5701,0,'','','Deprecated quest: The Rites of Old'), +(1,5702,0,'','','Deprecated quest: The Rites of Old'), +(1,5703,0,'','','Deprecated quest: The Rites of Old'), +(1,5704,0,'','','Deprecated quest: Undead Priest Robe'), +(1,5705,0,'','','Deprecated quest: No Longer a Shadow'), +(1,5706,0,'','','Deprecated quest: No Longer a Shadow'), +(1,5707,0,'','','Deprecated quest: Flirting With Darkness'), +(1,5708,0,'','','Deprecated quest: Flirting With Darkness'), +(1,5709,0,'','','Deprecated quest: Flirting With Darkness'), +(1,5710,0,'','','Deprecated quest: Troll Priest Robe'), +(1,5711,0,'','','Deprecated quest: The Lost Ways'), +(1,5712,0,'','','Deprecated quest: The Lost Ways'), +(1,6003,0,'','','Deprecated quest: Green With Envy'), +(1,6165,0,'','','Deprecated quest: Archmage Timolain''s Remains'), +(1,6202,0,'','','Deprecated quest: Good and Evil'), +(1,6702,0,'','','Deprecated quest: SF,RFK,GNOMER,BF'), +(1,6703,0,'','','Deprecated quest: SF,RFK,GNOMER,BF - Repeatable'), +(1,6704,0,'','','Deprecated quest: SM,RFD,ULD'), +(1,6705,0,'','','Deprecated quest: SM,RFD,ULD - Repeatable'), +(1,6706,0,'','','Deprecated quest: ZUL,ST,MAR'), +(1,6707,0,'','','Deprecated quest: ZUL,ST,MAR - Repeatable'), +(1,6708,0,'','','Deprecated quest: BRD,DM,BRS'), +(1,6709,0,'','','Deprecated quest: BRD,DM,BRS - Repeatable'), +(1,6710,0,'','','Deprecated quest: UBRS,STRATH,SCHOL'), +(1,6711,0,'','','Deprecated quest: UBRS,STRATH,SCHOL - Repeatable'), +(1,6841,0,'','','Deprecated quest: '), +(1,6842,0,'','','Deprecated quest: '), +(1,7069,0,'','','Deprecated quest: '), +(1,7904,0,'','','Deprecated quest: '), +(1,8002,0,'','','Deprecated quest: Silverwing Sentinels '), +(1,8244,0,'','','Deprecated quest: '), +(1,8245,0,'','','Deprecated quest: '), +(1,8247,0,'','','Deprecated quest: '), +(1,8248,0,'','','Deprecated quest: '), +(1,8337,0,'','','Deprecated quest: '), +(1,8339,0,'','','Deprecated quest: Royalty of the Council UNUSED'), +(1,8340,0,'','','Deprecated quest: Twilight Signet Ring '), +(1,8444,0,'','','Deprecated quest: gossip shade of ambermoon'), +(1,8445,0,'','','Deprecated quest: gossip shade of ambermoon'), +(1,8448,0,'','','Deprecated quest: Mystery Reward'), +(1,8449,0,'','','Deprecated quest: Mystery Reward'), +(1,8450,0,'','','Deprecated quest: Mystery Reward'), +(1,8451,0,'','','Deprecated quest: Mystery Reward'), +(1,8452,0,'','','Deprecated quest: Mystery Reward'), +(1,8453,0,'','','Deprecated quest: Mystery Reward'), +(1,8454,0,'','','Deprecated quest: Mystery Reward'), +(1,8458,0,'','','Deprecated quest: '), +(1,8459,0,'','','Deprecated quest: '), +(1,8571,0,'','','Deprecated quest: Armor Kits'), +(1,9031,0,'','','Deprecated quest: Anthion''s Parting Words'), +(1,9306,0,'','','Deprecated quest: Speak with Vindicator Aldar'), +(1,9307,0,'','','Deprecated quest: Compassion'), +(1,9445,0,'','','Deprecated quest: Placeholder: A Worthy Offering'), +(1,9596,0,'','','Deprecated quest: Control'), +(1,9597,0,'','','Deprecated quest: '), +(1,9599,0,'','','Deprecated quest: '), +(1,9679,0,'','','Deprecated quest: Return to Knight-Lord Bloodvalor'), +(1,9745,0,'','','Deprecated quest: Suppressing the Flame'), +(1,10370,0,'','','Deprecated quest: Nazgrel''s Command '), +(1,10402,0,'','','Deprecated quest: '), +(1,10616,0,'','','Deprecated quest: Breadcrumb'), +(1,10743,0,'','','Deprecated quest: [DEPRECATED]Hero of the Mok''Nathal'), +(1,10890,0,'','','Deprecated quest: [UNUSED] '), +(1,11127,0,'','','Deprecated quest: Thunderbrew Secrets'); From 0285425c3e0867d89e34ce9ab7e12cd44143015a Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 14:38:42 +0200 Subject: [PATCH 004/147] DB/Disables: Disable 47 placeholders and deprecated quests --- .../world/2012_08_04_01_world_disables.sql | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sql/updates/world/2012_08_04_01_world_disables.sql diff --git a/sql/updates/world/2012_08_04_01_world_disables.sql b/sql/updates/world/2012_08_04_01_world_disables.sql new file mode 100644 index 0000000000..ca9f62564d --- /dev/null +++ b/sql/updates/world/2012_08_04_01_world_disables.sql @@ -0,0 +1,50 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (3631,4487,4488,4489,4490,4183,4184,4185,4186,4223,4224,402,550,620,785,908,909,9662,11179,11461,12087,12103,12108,12156,12426,12682,12764,12765,24222,24227,10452,10453,11125,11179,11437,11438,11444,11445,11974,12179,12228,12233,12590,14119,14147,14148,14149,14150); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1, 402,0,'','','Deprecated quest: Sirra is Busy'), +(1, 550,0,'','','Deprecated quest: Battle of Hillsbrad'), +(1, 620,0,'','','Deprecated quest: The Monogrammed Sash'), +(1, 785,0,'','','Deprecated quest: A Strategic Alliance'), +(1, 908,0,'','','Deprecated quest: A Strategic Alliance'), +(1, 909,0,'','','Deprecated quest: A Strategic Alliance'), +(1,3631,0,'','','Deprecated quest: Summon Felsteed'), +(1,4487,0,'','','Deprecated quest: Summon Felsteed'), +(1,4488,0,'','','Deprecated quest: Summon Felsteed'), +(1,4489,0,'','','Deprecated quest: Summon Felsteed'), +(1,4490,0,'','','Deprecated quest: Summon Felsteed'), +(1,4183,0,'','','Deprecated quest: The True Masters'), +(1,4184,0,'','','Deprecated quest: The True Masters'), +(1,4185,0,'','','Deprecated quest: The True Masters'), +(1,4186,0,'','','Deprecated quest: The True Masters'), +(1,4223,0,'','','Deprecated quest: The True Masters'), +(1,4224,0,'','','Deprecated quest: The True Masters'), +-- some random ones: +(1, 9662,0,'','','Deprecated quest:Deprecated: Keanna''s Freedom'), +(1,11179,0,'','','Deprecated quest:[Temporarily Deprecated Awaiting a New Mob]Finlay Is Gutless'), +(1,11461,0,'','','Deprecated quest:DEPRECATED'), +(1,12087,0,'','','Deprecated quest:A Little Help Here? DEPRECATED'), +(1,12103,0,'','','Deprecated quest:DEPRECATED'), +(1,12108,0,'','','Deprecated quest:DEPRECATED'), +(1,12156,0,'','','Deprecated quest:DEPRECAED'), +(1,12426,0,'','','Deprecated quest:DEPRECATED'), +(1,12682,0,'','','Deprecated quest:Uncharted Territory (DEPRECATED)'), +(1,12764,0,'','','Deprecated quest:The Secret to Kungaloosh (DEPRECATED)'), +(1,12765,0,'','','Deprecated quest:Kungaloosh (DEPRECATED)'), +(1,24222,0,'','','Deprecated quest:Call to Arms: Eye of the Storm DEPRECATED'), +(1,24227,0,'','','Deprecated quest:DEPRECATED'), +(1,10452,0,'','','Deprecated quest:DON''T USE [PH] Fel Orc 1'), +(1,10453,0,'','','Deprecated quest:DON''T USE [PH] Fel Orc bread'), +(1,11125,0,'','','Deprecated quest:[PH] New Hinterlands Quest'), +(1,11437,0,'','','Deprecated quest:[PH] Beer Garden A'), +(1,11438,0,'','','Deprecated quest:[PH] Beer Garden B'), +(1,11444,0,'','','Deprecated quest:[PH] Beer Garden A'), +(1,11445,0,'','','Deprecated quest:[PH] Beer Garden B'), +(1,11974,0,'','','Deprecated quest:[ph] Now, When I Grow Up...'), +(1,12179,0,'','','Deprecated quest:Specialization 1 [PH]'), +(1,12228,0,'','','Deprecated quest:Reacquiring the Magic [PH]'), +(1,12233,0,'','','Deprecated quest:[Depricated]Sewing Your Seed'), +(1,12590,0,'','','Deprecated quest:Blahblah[PH]'), +(1,14119,0,'','','Deprecated quest:Blank [PH]'), +(1,14147,0,'','','Deprecated quest:Blank [PH]'), +(1,14148,0,'','','Deprecated quest:Blank [PH]'), +(1,14149,0,'','','Deprecated quest:Blank [PH]'), +(1,14150,0,'','','Deprecated quest:Blank [PH]'); From c4d01e58c44db8c120ccbe9c2a93bd53975a02c1 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 15:08:12 +0200 Subject: [PATCH 005/147] DB/Disables: Disable 21 quests named REUSE or UNUSED --- .../world/2012_08_04_02_world_disables.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sql/updates/world/2012_08_04_02_world_disables.sql diff --git a/sql/updates/world/2012_08_04_02_world_disables.sql b/sql/updates/world/2012_08_04_02_world_disables.sql new file mode 100644 index 0000000000..cccc7141d6 --- /dev/null +++ b/sql/updates/world/2012_08_04_02_world_disables.sql @@ -0,0 +1,23 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (7790,8152,8237,8971,8972,8973,8974,8975,8976,9296,9750,10145,10207,10549,11493,11588,11589,11997,12313,13840,24797); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,7790,0,'','','Deprecated quest: REUSE'), +(1,8152,0,'','','Deprecated quest: REUSE'), +(1,8237,0,'','','Deprecated quest: REUSE'), +(1,8971,0,'','','Deprecated quest: REUSE'), +(1,8972,0,'','','Deprecated quest: REUSE'), +(1,8973,0,'','','Deprecated quest: REUSE'), +(1,8974,0,'','','Deprecated quest: REUSE'), +(1,8975,0,'','','Deprecated quest: REUSE'), +(1,8976,0,'','','Deprecated quest: REUSE'), +(1,9296,0,'','','Deprecated quest: reuse'), +(1,9750,0,'','','Deprecated quest: UNUSED Urgent Delivery'), +(1,10145,0,'','','Deprecated quest: Mission: Sever the Tie UNUSED'), +(1,10207,0,'','','Deprecated quest: Forward Base: Reaver''s Fall REUSE'), +(1,10549,0,'','','Deprecated quest: REUSE'), +(1,11493,0,'','','Deprecated quest: UNUSED'), +(1,11588,0,'','','Deprecated quest: REUSE'), +(1,11589,0,'','','Deprecated quest: REUSE'), +(1,11997,0,'','','Deprecated quest: REUSE'), +(1,12313,0,'','','Deprecated quest: UNUSED Save Brewfest!'), +(1,13840,0,'','','Deprecated quest: REUSE'), +(1,24797,0,'','','Deprecated quest: REUSE'); From 22415bee66f1bc74cc620df25c32840b10361604 Mon Sep 17 00:00:00 2001 From: Faq Date: Sat, 4 Aug 2012 16:25:36 +0300 Subject: [PATCH 006/147] Core/Spells: Wrath of the Plaguebringer should be a debuff. Tibbi --- src/server/game/Spells/SpellInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index a397bb1370..0dad4fda76 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2205,14 +2205,16 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELLFAMILY_GENERIC: switch (Id) { + case 29214: // Wrath of the Plaguebringer case 34700: // Allergic Reaction + case 54836: // Wrath of the Plaguebringer case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura case 62532: // Conservator's Grip return false; + case 30877: // Tag Murloc case 61716: // Rabbit Costume case 61734: // Noblegarden Bunny - case 30877: // Tag Murloc case 62344: // Fists of Stone return true; default: From 76ef6e45a292547108f324f220f4e66257802ff8 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 15:42:50 +0200 Subject: [PATCH 007/147] DB/Disables: Disable 35 quests named OR containing a - that should not be attainable --- .../world/2012_08_04_03_world_disables.sql | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sql/updates/world/2012_08_04_03_world_disables.sql diff --git a/sql/updates/world/2012_08_04_03_world_disables.sql b/sql/updates/world/2012_08_04_03_world_disables.sql new file mode 100644 index 0000000000..d039350c87 --- /dev/null +++ b/sql/updates/world/2012_08_04_03_world_disables.sql @@ -0,0 +1,38 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9754,9755,10215,11522,12445,12731,12923,13541); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,9754,0,'','','Deprecated quest: '), +(1,9755,0,'','','Deprecated quest: '), +(1,10215,0,'','','Deprecated quest: '), +(1,11522,0,'','','Deprecated quest: '), +(1,12445,0,'','','Deprecated quest: '), +(1,12731,0,'','','Deprecated quest: '), +(1,12923,0,'','','Deprecated quest: '), +(1,13541,0,'','','Deprecated quest: '), +-- some others that contain a - +(1,7797,0,'','','Deprecated quest: Dimensional Ripper - Everlook'), +(1,7869,0,'','','Deprecated quest: test quest - do not use'), +(1,7870,0,'','','Deprecated quest: test quest2 - do not use'), +(1,7906,0,'','','Deprecated quest: Darkmoon Cards - Beasts'), +(1,9378,0,'','','Deprecated quest: DND FLAG The Dread Citadel - Naxxramas'), +(1,9611,0,'','','Deprecated quest: Azuremyst: aa - A - Quest Flag 000'), +(1,9880,0,'','','Deprecated quest: Hellfire Penninsula: -pn - A - ToWoW - Hellfire Turnin Cap'), +(1,9881,0,'','','Deprecated quest: Hellfire Penninsula: -pn - H - ToWoW - Hellfire Turnin Cap'), +(1,9908,0,'','','Deprecated quest: Hellfire Penninsula: -pn - A - ToWoW - Hellfire Turnin'), +(1,9909,0,'','','Deprecated quest: Hellfire Penninsula: -pn - H - ToWoW - Hellfire Turnin'), +(1,9949,0,'','','Deprecated quest: A Bird's-Eye View'), +(1,9950,0,'','','Deprecated quest: A Bird's-Eye View'), +(1,10088,0,'','','Deprecated quest: When This Mine's a-Rockin''), +(1,10181,0,'','','Deprecated quest: Collector's Edition: -pn - E - FLAG'), +(1,10214,0,'','','Deprecated quest: When This Mine's a-Rockin''), +(1,10454,0,'','','Deprecated quest: FLAG - OFF THE RAILS'), +(1,11197,0,'','','Deprecated quest: ZZOLD Upper Deck Promo - Ghost Wolf Mount OLD'), +(1,11226,0,'','','Deprecated quest: Upper Deck Promo - Spectral Tiger Mount'), +(1,11577,0,'','','Deprecated quest: WoW Collector's Edition: - DEM - E - FLAG'), +(1,11874,0,'','','Deprecated quest: Upper Deck Promo - Rocket Mount'), +(1,11937,0,'','','Deprecated quest: FLAG - all torch return quests are complete'), +(1,12485,0,'','','Deprecated quest: Howling Fjord: aa - A - LK FLAG'), +(1,12600,0,'','','Deprecated quest: Upper Deck Promo - Bear Mount'), +(1,13123,0,'','','Deprecated quest: WotLK Collector's Edition: - DEM - E - FLAG'), +(1,13210,0,'','','Deprecated quest: Blizzard Account: - DEM - E - FLAG'), +(1,13317,0,'','','Deprecated quest: ----'), +(1,13990,0,'','','Deprecated quest: Upper Deck Promo - Chicken Mount'); From 5c73852382241d71769d6a4fc7488451168c006b Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 15:59:34 +0200 Subject: [PATCH 008/147] DB/Disables: disable 35 deprecated CtA quests --- .../world/2012_08_04_04_world_disables.sql | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sql/updates/world/2012_08_04_04_world_disables.sql diff --git a/sql/updates/world/2012_08_04_04_world_disables.sql b/sql/updates/world/2012_08_04_04_world_disables.sql new file mode 100644 index 0000000000..14a0d6f94a --- /dev/null +++ b/sql/updates/world/2012_08_04_04_world_disables.sql @@ -0,0 +1,34 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (11335,11336,11337,11338,11339,11340,11341,11342,13405,13407,13427,13428,14163,14164,14178,14179,14180,14181,14182,14183,24216,24217,24218,24219,24220,24221,24223,24224,24225,24226,24426,24427); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,11335,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,11336,0,'','','Deprecated quest: Call to Arms: Alterac Valley'), +(1,11337,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'), +(1,11338,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,11339,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,11340,0,'','','Deprecated quest: Call to Arms: Alterac Valley'), +(1,11341,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'), +(1,11342,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,13405,0,'','','Deprecated quest: Call to Arms: Strand of the Ancients'), +(1,13407,0,'','','Deprecated quest: Call to Arms: Strand of the Ancients'), +(1,13427,0,'','','Deprecated quest: Call to Arms: Alterac Valley'), +(1,13428,0,'','','Deprecated quest: Call to Arms: Alterac Valley'), +(1,14163,0,'','','Deprecated quest: Call to Arms: Isle of Conquest'), +(1,14164,0,'','','Deprecated quest: Call to Arms: Isle of Conquest'), +(1,14178,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,14179,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'), +(1,14180,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,14181,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,14182,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'), +(1,14183,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24216,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24217,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24218,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24219,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24220,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,24221,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,24223,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,24224,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24225,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'), +(1,24226,0,'','','Deprecated quest: Call to Arms: Arathi Basin'), +(1,24426,0,'','','Deprecated quest: Call to Arms: Alterac Valley'), +(1,24427,0,'','','Deprecated quest: Call to Arms: Alterac Valley'); From d2ae736f6da2f8da66e1fba8cce6377b7ae9de46 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 16:17:48 +0200 Subject: [PATCH 009/147] DB/Disables: another 26 related to BG's deprecated. also fixed an SQL syntax error on previous file, wrong file got committed --- .../world/2012_08_04_03_world_disables.sql | 14 +++++----- .../world/2012_08_04_05_world_disables.sql | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 sql/updates/world/2012_08_04_05_world_disables.sql diff --git a/sql/updates/world/2012_08_04_03_world_disables.sql b/sql/updates/world/2012_08_04_03_world_disables.sql index d039350c87..21b55a3e93 100644 --- a/sql/updates/world/2012_08_04_03_world_disables.sql +++ b/sql/updates/world/2012_08_04_03_world_disables.sql @@ -19,20 +19,20 @@ INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comm (1,9881,0,'','','Deprecated quest: Hellfire Penninsula: -pn - H - ToWoW - Hellfire Turnin Cap'), (1,9908,0,'','','Deprecated quest: Hellfire Penninsula: -pn - A - ToWoW - Hellfire Turnin'), (1,9909,0,'','','Deprecated quest: Hellfire Penninsula: -pn - H - ToWoW - Hellfire Turnin'), -(1,9949,0,'','','Deprecated quest: A Bird's-Eye View'), -(1,9950,0,'','','Deprecated quest: A Bird's-Eye View'), -(1,10088,0,'','','Deprecated quest: When This Mine's a-Rockin''), -(1,10181,0,'','','Deprecated quest: Collector's Edition: -pn - E - FLAG'), -(1,10214,0,'','','Deprecated quest: When This Mine's a-Rockin''), +(1,9949,0,'','','Deprecated quest: A Bird''s-Eye View'), +(1,9950,0,'','','Deprecated quest: A Bird''s-Eye View'), +(1,10088,0,'','','Deprecated quest: When This Mine''s a-Rockin'''), +(1,10181,0,'','','Deprecated quest: Collector''s Edition: -pn - E - FLAG'), +(1,10214,0,'','','Deprecated quest: When This Mine''s a-Rockin'''), (1,10454,0,'','','Deprecated quest: FLAG - OFF THE RAILS'), (1,11197,0,'','','Deprecated quest: ZZOLD Upper Deck Promo - Ghost Wolf Mount OLD'), (1,11226,0,'','','Deprecated quest: Upper Deck Promo - Spectral Tiger Mount'), -(1,11577,0,'','','Deprecated quest: WoW Collector's Edition: - DEM - E - FLAG'), +(1,11577,0,'','','Deprecated quest: WoW Collector''s Edition: - DEM - E - FLAG'), (1,11874,0,'','','Deprecated quest: Upper Deck Promo - Rocket Mount'), (1,11937,0,'','','Deprecated quest: FLAG - all torch return quests are complete'), (1,12485,0,'','','Deprecated quest: Howling Fjord: aa - A - LK FLAG'), (1,12600,0,'','','Deprecated quest: Upper Deck Promo - Bear Mount'), -(1,13123,0,'','','Deprecated quest: WotLK Collector's Edition: - DEM - E - FLAG'), +(1,13123,0,'','','Deprecated quest: WotLK Collector''s Edition: - DEM - E - FLAG'), (1,13210,0,'','','Deprecated quest: Blizzard Account: - DEM - E - FLAG'), (1,13317,0,'','','Deprecated quest: ----'), (1,13990,0,'','','Deprecated quest: Upper Deck Promo - Chicken Mount'); diff --git a/sql/updates/world/2012_08_04_05_world_disables.sql b/sql/updates/world/2012_08_04_05_world_disables.sql new file mode 100644 index 0000000000..ce123e4e5b --- /dev/null +++ b/sql/updates/world/2012_08_04_05_world_disables.sql @@ -0,0 +1,28 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (8384,8386,8389,8390,8391,8392,8397,8398,8404,8405,8406,8407,8408,8431,8432,8433,8434,8435,8440,8441,8442,8443,8567,8568,8569,8570); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,8384,0,'','','Deprecated quest: Claiming Arathi Basin'), +(1,8386,0,'','','Deprecated quest: Fight for Warsong Gulch'), +(1,8389,0,'','','Deprecated quest: Battle of Warsong Gulch'), +(1,8390,0,'','','Deprecated quest: Conquering Arathi Basin'), +(1,8391,0,'','','Deprecated quest: Claiming Arathi Basin'), +(1,8392,0,'','','Deprecated quest: Claiming Arathi Basin'), +(1,8397,0,'','','Deprecated quest: Claiming Arathi Basin'), +(1,8398,0,'','','Deprecated quest: Claiming Arathi Basin'), +(1,8404,0,'','','Deprecated quest: Fight for Warsong Gulch'), +(1,8405,0,'','','Deprecated quest: Fight for Warsong Gulch'), +(1,8406,0,'','','Deprecated quest: Fight for Warsong Gulch'), +(1,8407,0,'','','Deprecated quest: Fight for Warsong Gulch'), +(1,8408,0,'','','Deprecated quest: Fight for Warsong Gulch'), +(1,8431,0,'','','Deprecated quest: Battle of Warsong Gulch'), +(1,8432,0,'','','Deprecated quest: Battle of Warsong Gulch'), +(1,8433,0,'','','Deprecated quest: Battle of Warsong Gulch'), +(1,8434,0,'','','Deprecated quest: Battle of Warsong Gulch'), +(1,8435,0,'','','Deprecated quest: Battle of Warsong Gulch'), +(1,8440,0,'','','Deprecated quest: Conquering Arathi Basin'), +(1,8441,0,'','','Deprecated quest: Conquering Arathi Basin'), +(1,8442,0,'','','Deprecated quest: Conquering Arathi Basin'), +(1,8443,0,'','','Deprecated quest: Conquering Arathi Basin'), +(1,8567,0,'','','Deprecated quest: Past Victories in Warsong Gulch'), +(1,8568,0,'','','Deprecated quest: Past Victories in Warsong Gulch'), +(1,8569,0,'','','Deprecated quest: Past Efforts in Warsong Gulch'), +(1,8570,0,'','','Deprecated quest: Past Efforts in Warsong Gulch'); From 71b0dc94c1afecd03d3e93ab42c2352738402b70 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 16:28:38 +0200 Subject: [PATCH 010/147] DB/Quest: add dungeonflag for rewardquests --- .../world/2012_08_04_06_world_quest_template.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sql/updates/world/2012_08_04_06_world_quest_template.sql diff --git a/sql/updates/world/2012_08_04_06_world_quest_template.sql b/sql/updates/world/2012_08_04_06_world_quest_template.sql new file mode 100644 index 0000000000..fe48c887ae --- /dev/null +++ b/sql/updates/world/2012_08_04_06_world_quest_template.sql @@ -0,0 +1,10 @@ +UPDATE `quest_template` SET `specialflags`= `specialflags`|8 WHERE `id` IN ( +24889, -- Classic Random 5-15 (Nth) +24890, -- Classic Random 15-25 (Nth) +24891, -- Classic Random 24-34 (Nth) +24892, -- Classic Random 35-45 (Nth) +24893, -- Classic Random 46-55 (Nth) +24894, -- Classic Random 56-60 (Nth) +24895, -- Classic Random 60-64 (Nth) +24896); -- Classic Random 65-70 (Nth) + From 0b3343dd68d23fb83cdf361a203a0517d51f3b7a Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 16:57:08 +0200 Subject: [PATCH 011/147] DB/Quest: Add questrelations for Honor the Flame quests Closes #5989 --- ..._04_07_world_game_event_creature_quest.sql | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sql/updates/world/2012_08_04_07_world_game_event_creature_quest.sql diff --git a/sql/updates/world/2012_08_04_07_world_game_event_creature_quest.sql b/sql/updates/world/2012_08_04_07_world_game_event_creature_quest.sql new file mode 100644 index 0000000000..b72f8edd46 --- /dev/null +++ b/sql/updates/world/2012_08_04_07_world_game_event_creature_quest.sql @@ -0,0 +1,110 @@ +-- Hordes's Honor the Flame +-- Add missing creature_quesrelation and involvedrealation that were blocking quests +DELETE FROM `game_event_creature_quest` WHERE `quest` IN (11846,11845,11852,11839,11859,11841,11851,11855,11835,11858,11863,13500,13493,13494,13495,13496,13497,13498,13499,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840); +INSERT INTO `game_event_creature_quest` (`eventEntry`,`id`, `quest`) VALUES +-- Flame Keeper of Eastern Kingdom? {Achievement=1025} +(1,25933, 11850), -- Ghostland +(1,25931, 11848), -- Eversong woods +(1,25935, 11853), -- Hillsbrad Foothills +(1,25941, 11857), -- Swamp of sorrows +(1,25920, 11837), -- Cape of Stranglethorn +(1,25927, 11844), -- Burning Steppes +(1,25944, 11860), -- The Hinterlands +(1,25939, 11584), -- Silverpine Forest +(1,25946, 11862), -- Tirisfal Glades +(1,25925, 11842), -- Badlands +(1,25923, 11840), -- Arathi Highlands +-- The Flame Keeper of Kalimdore - {Achievement=1026} +(1,25929, 11846), -- Durotar +(1,25928, 11845), -- Desolace +(1,25936, 11852), -- Mulgore +(1,25922, 11839), -- Winterspring +(1,25943, 11859), -- Barrens +(1,25884, 11841), -- Ashenvale +-- The Flame Keeper of Outland - {Achievement=1027} +(1,25934, 11851), -- Hellfire Peninsula +(1,25938, 11855), -- Shadowmoon Valley +(1,25918, 11835), -- Netherstorm +(1,25942, 11858), -- Terokkar +(1,25947, 11863), -- Terokkar +-- Flame Keeper of Northrend - {Achievement=6009} +(1,32816, 13500), -- Zul'Drak +(1,32809, 13493), -- Borean Tundra +(1,32810, 13494), -- Sholazar Basin +(1,32811, 13495), -- Dragonblight +(1,32815, 13499), -- Crystalsong Forest +(1,32814, 13498), -- Storm Peaks +(1,32813, 13497), -- Grizzly Hills +(1,32812, 13496); -- Howling Fjords +-- add missing quest-involved relations +DELETE FROM `creature_involvedrelation` WHERE `quest` IN (11846,11845,11852,11839,11859,11841,11851,11855,11835,11858,11863,13500,13493,13494,13495,13496,13497,13498,13499,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840); +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES +(25929, 11846), -- Durotar +(25928, 11845), -- Desolace +(25936, 11852), -- Mulgore +(25922, 11839), -- Winterspring +(25943, 11859), -- Barrens +(25884, 11841), -- Ashenvale +(25934, 11851), -- Hellfire Peninsula +(25938, 11855), -- Shadowmoon Valley +(25918, 11835), -- Netherstorm +(25942, 11858), -- Terokkar +(25947, 11863), -- Terokkar +(32816, 13500), -- Zul'Drak +(32809, 13493), -- Borean Tundra +(32810, 13494), -- Sholazar Basin +(32811, 13495), -- Dragonblight +(32815, 13499), -- Crystalsong Forest +(32814, 13498), -- Storm Peaks +(32813, 13497), -- Grizzly Hills +(32812, 13496), -- Howling Fjords +(25933, 11850), -- Ghostland +(25931, 11848), -- Eversong woods +(25935, 11853), -- Hillsbrad Foothills +(25941, 11857), -- Swamp of sorrows +(25920, 11837), -- Cape of Stranglethorn +(25927, 11844), -- Burning Steppes +(25944, 11860), -- The Hinterlands +(25939, 11584), -- Silverpine Forest +(25946, 11862), -- Tirisfal Glades +(25925, 11842), -- Badlands +(25923, 11840); -- Arathi Highlands +-- update quest texts and rewardcash +UPDATE `quest_template` SET `RewardOrRequiredMoney`=37000,`RewardMoneyMaxLevel`=66300, `OfferRewardText`='Honor the Durotar flame!' WHERE `Id`=11846; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Mulgore flame!' WHERE `Id`=11852; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Barrens flame!',`RewardOrRequiredMoney`=37000, `RewardMoneyMaxLevel`=66300 WHERE `Id`=11859; -- Barrens +UPDATE `quest_template` SET `OfferRewardText`='Honor the Tanaris flame!',`RequestItemsText`='' WHERE `Id`=11838 LIMIT 1; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Ashenvale flame!' WHERE `Id`=11841; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Winterspring flame!' WHERE `Id`=11839; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Desolace flame!' WHERE `Id`=11845; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Thousand Needles flame!' WHERE `Id`=11861; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Feralas flame!' WHERE `Id`=11849; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Dustwallow Marsh flame!' WHERE `Id`=11847; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Silithus flame!' WHERE `Id`=11836; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Stonetalon Mountains flame!' WHERE `Id`=11856; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Hellfire Peninsula flame!' WHERE `Id`=11851; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Shadowmoon Valley flame!' WHERE `Id`=11855; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Nagrand flame!', `RequestItemsText`='' WHERE `Id`=11821; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Netherstorm flame!' WHERE `Id`=11835; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Blades Edge Mountains flame! ', `RequestItemsText`='' WHERE `Id`=11843; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Terokkar flame!' WHERE `Id`=11858; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Zangarmarsh flame!' WHERE `Id`=11863; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Zul''Drak flame!' WHERE `Id`=13500; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Borean Tundra flame!' WHERE `Id`=13493; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Sholazar Basin flame!' WHERE `Id`=13494; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Dragonblight flame!' WHERE `Id`=13495; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Crystalsong Forest flame!' WHERE `Id`=13499; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Storm Peaks flame!' WHERE `Id`=13498; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Grizzly Hills flame!' WHERE `Id`=13497; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Howling Fjords flame!' WHERE `Id`=13496; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Ghostland flame!' WHERE `Id`=11850; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Eversong woods flame!' WHERE `Id`=11848; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Hillsbrad Foothills flame!' WHERE `Id`=11853; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Swamp of sorrows flame!' WHERE `Id`=11857; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Cape of Stranglethorn flame!' WHERE `Id`=11837; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Burning Steppes flame!' WHERE `Id`=11844; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Hinterlands flame!' WHERE `Id`=11860; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Silverpine Forest flame!' WHERE `Id`=11584; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Tirisfal Glades flame!' WHERE `Id`=11862; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Badlands flame!' WHERE `Id`=11842; +UPDATE `quest_template` SET `OfferRewardText`='Honor the Arathi Highlands flame!' WHERE `Id`=11840; From 6a7dc4d28ba3c3c1e1fa10cba26afed5252a05b5 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 17:16:34 +0200 Subject: [PATCH 012/147] DB/Disables: add T3 deprecated quests --- .../world/2012_08_04_08_world_disables.sql | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sql/updates/world/2012_08_04_08_world_disables.sql diff --git a/sql/updates/world/2012_08_04_08_world_disables.sql b/sql/updates/world/2012_08_04_08_world_disables.sql new file mode 100644 index 0000000000..6944c45f1f --- /dev/null +++ b/sql/updates/world/2012_08_04_08_world_disables.sql @@ -0,0 +1,65 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9034,9036,9037,9038,9039,9040,9041,9042,9043,9044,9046,9047,9048,9049,9050,9054,9055,9056,9057,9058,9059,9060,9061,9068,9069,9070,9071,9072,9073,9074,9075,9077,9078,9079,9080,9081,9082,9083,9084,9086,9087,9088,9089,9090,9091,9092,9093,9095,9096,9097,9098,9099,9100,9101,9102,9103,9104,9105,9106,9107,9108,9109,9110); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,9034,0,'','','Deprecated quest: Dreadnaught Breastplate'), +(1,9036,0,'','','Deprecated quest: Dreadnaught Legplates'), +(1,9037,0,'','','Deprecated quest: Dreadnaught Helmet'), +(1,9038,0,'','','Deprecated quest: Dreadnaught Pauldrons'), +(1,9039,0,'','','Deprecated quest: Dreadnaught Sabatons'), +(1,9040,0,'','','Deprecated quest: Dreadnaught Gauntlets'), +(1,9041,0,'','','Deprecated quest: Dreadnaught Waistguard'), +(1,9042,0,'','','Deprecated quest: Dreadnaught Bracers'), +(1,9043,0,'','','Deprecated quest: Redemption Tunic'), +(1,9044,0,'','','Deprecated quest: Redemption Legguards'), +(1,9046,0,'','','Deprecated quest: Redemption Spaulders'), +(1,9047,0,'','','Deprecated quest: Redemption Boots'), +(1,9048,0,'','','Deprecated quest: Redemption Handguards'), +(1,9049,0,'','','Deprecated quest: Redemption Girdle'), +(1,9050,0,'','','Deprecated quest: Redemption Wristguards'), +(1,9054,0,'','','Deprecated quest: Cryptstalker Tunic'), +(1,9055,0,'','','Deprecated quest: Cryptstalker Legguards'), +(1,9056,0,'','','Deprecated quest: Cryptstalker Headpiece'), +(1,9057,0,'','','Deprecated quest: Cryptstalker Spaulders'), +(1,9058,0,'','','Deprecated quest: Cryptstalker Boots'), +(1,9059,0,'','','Deprecated quest: Cryptstalker Handguards'), +(1,9060,0,'','','Deprecated quest: Cryptstalker Girdle'), +(1,9061,0,'','','Deprecated quest: Cryptstalker Wristguards'), +(1,9068,0,'','','Deprecated quest: Earthshatter Tunic'), +(1,9069,0,'','','Deprecated quest: Earthshatter Legguards'), +(1,9070,0,'','','Deprecated quest: Earthshatter Headpiece'), +(1,9071,0,'','','Deprecated quest: Earthshatter Spaulders'), +(1,9072,0,'','','Deprecated quest: Earthshatter Boots'), +(1,9073,0,'','','Deprecated quest: Earthshatter Handguards'), +(1,9074,0,'','','Deprecated quest: Earthshatter Girdle'), +(1,9075,0,'','','Deprecated quest: Earthshatter Wristguards'), +(1,9077,0,'','','Deprecated quest: Bonescythe Breastplate'), +(1,9078,0,'','','Deprecated quest: Bonescythe Legplates'), +(1,9079,0,'','','Deprecated quest: Bonescythe Helmet'), +(1,9080,0,'','','Deprecated quest: Bonescythe Pauldrons'), +(1,9081,0,'','','Deprecated quest: Bonescythe Sabatons'), +(1,9082,0,'','','Deprecated quest: Bonescythe Gauntlets'), +(1,9083,0,'','','Deprecated quest: Bonescythe Waistguard'), +(1,9084,0,'','','Deprecated quest: Bonescythe Bracers'), +(1,9086,0,'','','Deprecated quest: Dreamwalker Tunic'), +(1,9087,0,'','','Deprecated quest: Dreamwalker Legguards'), +(1,9088,0,'','','Deprecated quest: Dreamwalker Headpiece'), +(1,9089,0,'','','Deprecated quest: Dreamwalker Spaulders'), +(1,9090,0,'','','Deprecated quest: Dreamwalker Boots'), +(1,9091,0,'','','Deprecated quest: Dreamwalker Handguards'), +(1,9092,0,'','','Deprecated quest: Dreamwalker Girdle'), +(1,9093,0,'','','Deprecated quest: Dreamwalker Wristguards'), +(1,9095,0,'','','Deprecated quest: Frostfire Robe'), +(1,9096,0,'','','Deprecated quest: Frostfire Leggings'), +(1,9097,0,'','','Deprecated quest: Frostfire Circlet'), +(1,9098,0,'','','Deprecated quest: Frostfire Shoulderpads'), +(1,9099,0,'','','Deprecated quest: Frostfire Sandals'), +(1,9100,0,'','','Deprecated quest: Frostfire Gloves'), +(1,9101,0,'','','Deprecated quest: Frostfire Belt'), +(1,9102,0,'','','Deprecated quest: Frostfire Bindings'), +(1,9103,0,'','','Deprecated quest: Plagueheart Robe'), +(1,9104,0,'','','Deprecated quest: Plagueheart Leggings'), +(1,9105,0,'','','Deprecated quest: Plagueheart Circlet'), +(1,9106,0,'','','Deprecated quest: Plagueheart Shoulderpads'), +(1,9107,0,'','','Deprecated quest: Plagueheart Sandals'), +(1,9108,0,'','','Deprecated quest: Plagueheart Gloves'), +(1,9109,0,'','','Deprecated quest: Plagueheart Belt'), +(1,9110,0,'','','Deprecated quest: Plagueheart Bindings'); From 61c93deecf908621a29024f1f6aa8ce5135eb534 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 17:23:57 +0200 Subject: [PATCH 013/147] DB/Disables: add priest T3 as well, stupid "of Faith" suffix got unnoted --- sql/updates/world/2012_08_04_09_world_disables.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sql/updates/world/2012_08_04_09_world_disables.sql diff --git a/sql/updates/world/2012_08_04_09_world_disables.sql b/sql/updates/world/2012_08_04_09_world_disables.sql new file mode 100644 index 0000000000..3023625410 --- /dev/null +++ b/sql/updates/world/2012_08_04_09_world_disables.sql @@ -0,0 +1,10 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9111,9112,9113,9114,9115,9116,9117,9118); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +(1,9111,0,'','','Deprecated quest: Robe of Faith'), +(1,9112,0,'','','Deprecated quest: Leggings of Faith'), +(1,9113,0,'','','Deprecated quest: Circlet of Faith'), +(1,9114,0,'','','Deprecated quest: Shoulderpads of Faith'), +(1,9115,0,'','','Deprecated quest: Sandals of Faith'), +(1,9116,0,'','','Deprecated quest: Gloves of Faith'), +(1,9117,0,'','','Deprecated quest: Belt of Faith'), +(1,9118,0,'','','Deprecated quest: Bindings of Faith'); From 0deaa521bcae3ab9004529473aceadee134f3a68 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 4 Aug 2012 17:43:45 +0200 Subject: [PATCH 014/147] DB/Disables another 39 deprecated quests --- .../world/2012_08_04_10_world_disables.sql | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sql/updates/world/2012_08_04_10_world_disables.sql diff --git a/sql/updates/world/2012_08_04_10_world_disables.sql b/sql/updates/world/2012_08_04_10_world_disables.sql new file mode 100644 index 0000000000..1d991eafef --- /dev/null +++ b/sql/updates/world/2012_08_04_10_world_disables.sql @@ -0,0 +1,43 @@ +DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (2018,5101,7681,7682,8230,8270,8274,9284,9285,9286,9577,9583,11121,11994,12015,12493,12911,13649,14106,9713,9926,11087,11115,11116,11353,11518,12186,12187,12494,12845,13807,14185,14186,14187,24808,24809,24810,24811,25238); +INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES +-- containing "test" +(1,2018,0,'','','Deprecated quest: Rokar''s Test'), +(1,5101,0,'','','Deprecated quest: Lee''s Ultimate Test Quest... of Doom!'), +(1,7681,0,'','','Deprecated quest: Hunter test quest'), +(1,7682,0,'','','Deprecated quest: Hunter test quest2'), +(1,8230,0,'','','Deprecated quest: Collin''s Test Quest'), +(1,8270,0,'','','Deprecated quest: test copy quest'), +(1,8274,0,'','','Deprecated quest: Test Kill Quest'), +(1,9284,0,'','','Deprecated quest: Aldor Faction Test'), +(1,9285,0,'','','Deprecated quest: Consortium Faction Test'), +(1,9286,0,'','','Deprecated quest: Scryers Faction Test'), +(1,9577,0,'','','Deprecated quest: DAILY TEST QUEST (PVP)'), +(1,9583,0,'','','Deprecated quest: Omar''s Test Quest'), +(1,11121,0,'','','Deprecated quest: DAILY TEST QUEST (RAID)'), +(1,11994,0,'','','Deprecated quest: Juno''s Flag Tester'), +(1,12015,0,'','','Deprecated quest: Test Quest for Craig'), +(1,12493,0,'','','Deprecated quest: PvP Test'), +(1,12911,0,'','','Deprecated quest: Kill Credit Test'), +(1,13649,0,'','','Deprecated quest: Justin''s Fun Test'), +(1,14106,0,'','','Deprecated quest: Na Kada''s Quest Test'), +-- containing "flag" +(1,9713,0,'','','Deprecated quest: Glowcap Harvesting Enabling Flag'), +(1,9926,0,'','','Deprecated quest: FLAG Shadow Council/Warmaul Questline'), +(1,11087,0,'','','Deprecated quest: HYJAL FLAG'), +(1,11115,0,'','','Deprecated quest: The Mark of Vashj (FLAG ONLY)'), +(1,11116,0,'','','Deprecated quest: Trial of the Naaru: (QUEST FLAG)'), +(1,11353,0,'','','Deprecated quest: FLAG: Got the work shirt'), +(1,11518,0,'','','Deprecated quest: Sunwell Daily Portal Flag'), +(1,12186,0,'','','Deprecated quest: FLAG: Winner'), +(1,12187,0,'','','Deprecated quest: FLAG: Participant'), +(1,12494,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (20)'), +(1,12845,0,'','','Deprecated quest: Dalaran Teleport Crystal Flag'), +(1,13807,0,'','','Deprecated quest: FLAG: Tournament Invitation'), +(1,14185,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (40)'), +(1,14186,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (60)'), +(1,14187,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (70)'), +(1,24808,0,'','','Deprecated quest: Tank Ring Flag'), +(1,24809,0,'','','Deprecated quest: Healer Ring Flag'), +(1,24810,0,'','','Deprecated quest: Melee Ring Flag'), +(1,24811,0,'','','Deprecated quest: Caster Ring Flag'), +(1,25238,0,'','','Deprecated quest: Strength Ring Flag'); From 63f8cf277048fa3036e32d42962f80b857ff5a24 Mon Sep 17 00:00:00 2001 From: TheSensei Date: Sat, 4 Aug 2012 18:33:29 +0200 Subject: [PATCH 015/147] DB/Quest: add quest&seasonal relations for Midsummer Fire Festival --- ..._04_11_world_game_event_creature_quest.sql | 365 ++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 sql/updates/world/2012_08_04_11_world_game_event_creature_quest.sql diff --git a/sql/updates/world/2012_08_04_11_world_game_event_creature_quest.sql b/sql/updates/world/2012_08_04_11_world_game_event_creature_quest.sql new file mode 100644 index 0000000000..224749c7e1 --- /dev/null +++ b/sql/updates/world/2012_08_04_11_world_game_event_creature_quest.sql @@ -0,0 +1,365 @@ +-- Add all quests connected with Midsummer Fire Festival that are to be reseted on each next year to game_event_seasonal_questrelation, so players can complete them on and on... /as of different festivals/. +DELETE FROM `game_event_seasonal_questrelation` WHERE `questId` IN (11846,11845,11852,11839,11859,11841,11849,11861,11847,11836,11838,11856,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840,11851,11855,11835,11858,11863,11821,11854,11843,13500,13493,13494,13495,13496,13497,13498,13499,11805,11812,11815,11834,11833,11831,11817,11811,11806,11809,11826,11824,11826,11827,11819,11583,11828,11816,11810,11808,11804,11832,11813,11814,11820,11822,11823,11821,11830,11818,11825,11807,11829,13485,13487,13489,13488,13490,13486,13491,13492,11770,11769,11777,11803,11783,11773,11765,11771,11785,11800,11780,11802,11774,11772,11776,11781,11801,11768,11784,11580,11786,11766,11764,11775,11779,11799,11782,11787,11767,11778,13458,13441,13450,13451,13457,13455,13454,13453,11734,11741,11744,11763,11762,11760,11746,11740,11735,11738,11753,11755,11756,11748,11581,11757,11745,11739,11737,11732,11761,11742,11743,11749,11751,11752,11750,11759,11747,11754,11736,11758,13440,13443,13445,13444,13449,13446,13442,13447,13431,9324,11935,9326,9325,9332,9331,9330,11933,11972); +INSERT INTO `game_event_seasonal_questrelation` (`questId`, `eventEntry`) VALUES +(11846,1), -- Durotar // Honor the Flame (Horde) - Kalimdor +(11845,1), -- Desolace +(11852,1), -- Mulgore +(11839,1), -- Winterspring +(11859,1), -- Barrens +(11849,1), -- Feralas +(11841,1), -- Ashenvale +(11847,1), -- Dustwallow marsh +(11861,1), -- Thousand Needles +(11856,1), -- Stonetalon Mountains +(11836,1), -- Silithus +(11838,1), -- Tanaris +(11850,1), -- Ghostland // Honor the Flame (Horde) - Eeastern Kingdoms +(11848,1), -- Eversong woods +(11853,1), -- Hillsbrad Foothills +(11857,1), -- Swamp of sorrows +(11837,1), -- Cape of Stranglethorn +(11844,1), -- Burning Steppes +(11860,1), -- The Hinterlands +(11584,1), -- Silverpine Forest +(11862,1), -- Tirisfal Glades +(11842,1), -- Badlands +(11840,1), -- Arathi Highlands +(11851,1), -- Hellfire Peninsula // Honor the Flame (Horde) - Outland +(11855,1), -- Shadowmoon Valley +(11835,1), -- Netherstorm +(11858,1), -- Terokkar +(11863,1), -- Zangarmarsh +(11854,1), -- Nagrand +(11843,1), -- Blade''s Edge Mountains +(13500,1), -- Zul'Drak // Honor the Flame (Horde) - Northrend +(13493,1), -- Borean Tundra +(13494,1), -- Sholazar Basin +(13495,1), -- Dragonblight +(13499,1), -- Crystalsong Forest +(13498,1), -- Storm Peaks +(13497,1), -- Grizzly Hills +(13496,1), -- Howling Fjords +(11805,1), -- Ashenvale // Honor the Flame (Alliance) - Kalimdor +(11812,1), -- Desolace +(11815,1), -- Dustwallow Marsh +(11834,1), -- Winterspring +(11833,1), -- Tanaris +(11831,1), -- Silithus +(11817,1), -- Feralas +(11811,1), -- Darkshore +(11806,1), -- Azuremyst Isle +(11809,1), -- Bloodmyst Isle +(11824,1), -- Teldrassil +(11826,1), -- The Hinterlands // Honor the Flame (Alliance) - Eeastern Kingdoms +(11827,1), -- The Western Plaguelands +(11819,1), -- Hillsbrad Foothills +(11583,1), -- Westfall +(11828,1), -- Wetlands +(11816,1), -- Elwynn Forest +(11810,1), -- Burning Steppes +(11808,1), -- Blasted Lands +(11804,1), -- Arathi Highlands +(11832,1), -- Cape of Stranglethorn +(11813,1), -- Dun Morogh +(11814,1), -- Duskwood +(11820,1), -- Loch Modan +(11822,1), -- Redridge Mountains +(11823,1), -- Shadowmoon Valley // Honor the Flame (Alliance) - Outland +(11821,1), -- Nagrand +(11830,1), -- Netherstorm +(11818,1), -- Hellfire Peninsula +(11825,1), -- Terokkar +(11807,1), -- Blade's Edge +(11829,1), -- Zangarmarsh +(13485,1), -- Borean Tundra // Honor the Flame (Alliance) - Northrend +(13487,1), -- Dragonblight +(13489,1), -- Grizzly Hills +(13488,1), -- Howling Fjord +(13492,1), -- Zul'Drak +(13490,1), -- The Storm Peaks +(13486,1), -- Sholazar Basin +(13491,1), -- Crystalsong Forest +(11770,1), -- Durotar // Desecrate the Flame (Alliance) - Kalimdor +(11769,1), -- Desolace +(11777,1), -- Mulgore +(11803,1), -- Winterspring +(11783,1), -- Barrens +(11773,1), -- Feralas +(11765,1), -- Ashenvale +(11771,1), -- Dustwallow marsh +(11785,1), -- Thousand Needles +(11800,1), -- Silithus +(11780,1), -- Stonetalon Mountains +(11802,1), -- Tanaris +(11774,1), -- Ghostland // Desecrate the Flame (Alliance) - Eastern Kingdoms +(11772,1), -- Eversong woods +(11776,1), -- Hillsbrad Foothills +(11781,1), -- Swamp of sorrows +(11801,1), -- Cape of Stranglethorn +(11768,1), -- Burning Steppes +(11784,1), -- The Hinterlands +(11580,1), -- Silverpine Forest +(11786,1), -- Tirisfal Glades +(11766,1), -- Badlands +(11764,1), -- Arathi Highlands +(11775,1), -- Hellfire Peninsula // Desecrate the Flame (Alliance) - Outland +(11779,1), -- Shadowmoon Valley +(11799,1), -- Netherstorm +(11782,1), -- Terokkar +(11787,1), -- Zangarmarsh +(11767,1), -- Blade' Edge +(11778,1), -- Nagrand +(13458,1), -- Zul'Drak // Desecrate the Flame (Alliance) - Northrend +(13441,1), -- Borean Tundra +(13450,1), -- Sholazar Basin +(13451,1), -- Dragonblight +(13457,1), -- Crystalsong Forest +(13455,1), -- Storm Peaks +(13454,1), -- Grizzly Hills +(13453,1), -- Howling Fjords +(11734,1), -- Ashenvale // Desecrate the Flame (Horde) - Kalimdor +(11741,1), -- Desolace +(11744,1), -- Dustwallow Marsh +(11763,1), -- Winterspring +(11762,1), -- Tanaris +(11760,1), -- Silithus +(11746,1), -- Feralas +(11740,1), -- Darkshore +(11735,1), -- Azuremyst Isle +(11738,1), -- Bloodmyst Isle +(11753,1), -- Teldrassil +(11755,1), -- The Hinterlands // Desecrate the Flame (Horde) - Eastern Kingdoms +(11756,1), -- The Western Plaguelands +(11748,1), -- Hillsbrad Foothills +(11581,1), -- Westfall +(11757,1), -- Wetlands +(11745,1), -- Elwynn Forest +(11739,1), -- Burning Steppes +(11737,1), -- Blasted Lands +(11732,1), -- Arathi Highlands +(11761,1), -- Cape of Stranglethorn +(11742,1), -- Dun Morogh +(11743,1), -- Duskwood +(11749,1), -- Loch Modan +(11751,1), -- Redridge Mountains +(11752,1), -- Shadowmoon Valley // Desecrate the Flame (Horde) - Outland +(11750,1), -- Nagrand +(11759,1), -- Netherstorm +(11747,1), -- Hellfire Peninsula +(11754,1), -- Terokkar +(11736,1), -- Blade's Edge +(11758,1), -- Zangarmarsh +(13440,1), -- Borean Tundra // Desecrate the Flame (Horde) - Northrend +(13443,1), -- Dragonblight +(13445,1), -- Grizzly +(13444,1), -- Howling Fjord +(13449,1), -- Zul'Drak +(13446,1), -- The Storm Peaks +(13442,1), -- Sholazar Basin +(13447,1), -- Crystalsong Forest +(11972,1), -- Shards of Ahune +(9324,1), -- Stealing Orgrimmar''s Flame +(11935,1), -- Stealing Silvermoon''s Flame +(9326,1), -- Stealing the Undercity''s Flame +(9325,1), -- Stealing Thunder Bluff''s Flame +(9332,1), -- Stealing Darnassus''s Flame +(9331,1), -- Stealing Ironforge''s Flame +(9330,1), -- Stealing Stormwind''s Flame +(11933,1); -- Stealing the Exodar''s Flame +-- Add quest relations to game_event_gameobject_quest and game_event_creature_quest +DELETE FROM `game_event_creature_quest` WHERE `quest` IN (11846,11845,11852,11839,11859,11841,11849,11861,11847,11836,11838,11856,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840,11851,11855,11835,11858,11863,11821,11854,11843,13500,13493,13494,13495,13496,13497,13498,13499,11805,11812,11815,11834,11833,11831,11817,11811,11806,11809,11826,11824,11826,11827,11819,11583,11828,11816,11810,11808,11804,11832,11813,11814,11820,11822,11823,11821,11830,11818,11825,11807,11829,13485,13487,13489,13488,13490,13486,13491,13492,11805,11812,11815,11834,11833,11831,11817,11811,11806,11809,11824,11826,11827,11819,11583,11828,11816,11810,11808,11804,11832,11813,11814,11820,11822,13485,13487,13489,13488,13490,13486,13491,13490,11823,11821,11830,11818,11825,11807,11829,11775,11917,11947,11948,11952,11953,11954,11886,11891,12012,11955,11696,11691,11971,11970,11966,11964,11922,11923,11926,11925,11731,11657,11921,11924,9339,9365); +INSERT INTO `game_event_creature_quest` (`eventEntry`,`id`, `quest`) VALUES +(1,25929, 11846), -- Durotar // Honor the Flame (Horde) - Kalimdor +(1,25928, 11845), -- Desolace +(1,25936, 11852), -- Mulgore +(1,25922, 11839), -- Winterspring +(1,25943, 11859), -- Barrens +(1,25932, 11849), -- Feralas +(1,25884, 11841), -- Ashenvale +(1,25930, 11847), -- Dustwallow marsh +(1,25945, 11861), -- Thousand Needles +(1,25919, 11836), -- Silithus +(1,25921, 11838), -- Tanaris +(1,25940, 11856), -- Stonetalon Mountains +(1,25934, 11851), -- Hellfire Peninsula // Honor the Flame (Horde) - Outland +(1,25938, 11855), -- Shadowmoon Valley +(1,25918, 11835), -- Netherstorm +(1,25942, 11858), -- Terokkar +(1,25947, 11863), -- Zangarmarsh +(1,25937, 11854), -- Nagrand +(1,25926, 11843), -- Blade''s Edge Mountains +(1,32816, 13500), -- Zul'Drak // Honor the Flame (Horde) - Northrend +(1,32809, 13493), -- Borean Tundra +(1,32810, 13494), -- Sholazar Basin +(1,32811, 13495), -- Dragonblight +(1,32815, 13499), -- Crystalsong Forest +(1,32814, 13498), -- Storm Peaks +(1,32813, 13497), -- Grizzly Hills +(1,32812, 13496), -- Howling Fjords +(1,25933, 11850), -- Ghostland // Honor the Flame (Horde) - Eastern Kingdoms +(1,25931, 11848), -- Eversong woods +(1,25935, 11853), -- Hillsbrad Foothills +(1,25941, 11857), -- Swamp of sorrows +(1,25920, 11837), -- Cape of Stranglethorn +(1,25927, 11844), -- Burning Steppes +(1,25944, 11860), -- The Hinterlands +(1,25939, 11584), -- Silverpine Forest +(1,25946, 11862), -- Tirisfal Glades +(1,25925, 11842), -- Badlands +(1,25923, 11840), -- Arathi Highlands +(1,25883, 11805), -- Ashenvale // Honor the Flame (Alliance) - Kalimdor +(1,25894, 11812), -- Desolace +(1,25897, 11815), -- Dustwallow Marsh +(1,25917, 11834), -- Winterspring +(1,25916, 11833), -- Tanaris +(1,25914, 11831), -- Silithus +(1,25899, 11817), -- Feralas +(1,25893, 11811), -- Darkshore +(1,25888, 11806), -- Azuremyst Isle +(1,25891, 11809), -- Bloodmyst Isle +(1,25906, 11824), -- Teldrassil +(1,25908, 11826), -- The Hinterlands // Honor the Flame (Alliance) - Eeastern Kingdoms +(1,25909, 11827), -- The Western Plaguelands +(1,25901, 11819), -- Hillsbrad Foothills +(1,25910, 11583), -- Westfall +(1,25911, 11828), -- Wetlands +(1,25898, 11816), -- Elwynn Forest +(1,25892, 11810), -- Burning Steppes +(1,25890, 11808), -- Blasted Lands +(1,25887, 11804), -- Arathi Highlands +(1,25915, 11832), -- Cape of Stranglethorn +(1,25895, 11813), -- Dun Morogh +(1,25896, 11814), -- Duskwood +(1,25902, 11820), -- Loch Modan +(1,25904, 11822), -- Redridge Mountains +(1,32801, 13485), -- Borean Tundra // Honor the Flame (Alliance) - Northrend +(1,32803, 13487), -- Dragonblight +(1,32805, 13489), -- Grizzly +(1,32804, 13488), -- Howling Fjord +(1,32808, 13492), -- Zul'Drak +(1,32806, 13490), -- The Storm Peaks +(1,32802, 13486), -- Sholazar Basin +(1,32807, 13491), -- Crystalsong Forest +(1,25905, 11823), -- Shadowmoon Valley // Honor the Flame (Alliance) - Outland +(1,25903, 11821), -- Nagrand +(1,25913, 11830), -- Netherstorm +(1,25900, 11818), -- Hellfire Peninsula +(1,25907, 11825), -- Terokkar +(1,25889, 11807), -- Blade's Edge +(1,25912, 11829), -- Zangarmarsh +(1,26221, 11917), -- Striking Back +(1,26221, 11947), -- Striking Back +(1,26221, 11948), -- Striking Back +(1,26221, 11952), -- Striking Back +(1,26221, 11953), -- Striking Back +(1,26221, 11954), -- Striking Back +(1,26221, 11886), -- Unusual Activity +(1,25324, 11891), -- An Innocent Disguise +(1,25324, 12012), -- Inform the Elder +(1,26221, 11955), -- Ahune, the Frost Lord +(1,25710, 11696), -- Ahune is Here! +(1,25697, 11691), -- Summon Ahune +(1,19169, 11971), -- The Spinner of Summer Tales /Horde/ +(1,19178, 11971), -- The Spinner of Summer Tales +(1,19175, 11971), -- The Spinner of Summer Tales +(1,19176, 11971), -- The Spinner of Summer Tales +(1,19177, 11971), -- The Spinner of Summer Tales +(1,20102, 11971), -- The Spinner of Summer Tales +(1,19171, 11970), -- The Master of Summer Lore /Alliance/ +(1,19148, 11970), -- The Master of Summer Lore +(1,19172, 11970), -- The Master of Summer Lore +(1,18927, 11970), -- The Master of Summer Lore +(1,19173, 11970), -- The Master of Summer Lore +(1,20102, 11970), -- The Master of Summer Lore +(1,16818, 11966), -- Incense for the Festival Scorchlings +(1,16817, 11964), -- Incense for the Summer Scorchlings +(1,26113, 11922), -- Torch Tossing /H/ +(1,26113, 11923), -- Torch Catching /H/ +(1,26113, 11926), -- More Torch Tossing /H/ +(1,26113, 11925), -- More Torch Catching /H/ +(1,25975, 11731), -- Torch Tossing /A/ +(1,25975, 11657), -- Torch Catching /A/ +(1,25975, 11921), -- More Torch Tossing /A/ +(1,25975, 11924), -- More Torch Catching /A/ +(1,16818, 9339), -- A Thief''s Reward /H/ +(1,16817, 9365); -- A Thief''s Reward /A/ +DELETE FROM `game_event_gameobject_quest` WHERE `quest` IN (11767,11778,11787,11782,11799,11779,11775,11734,11741,11744,11763,11762,11760,11746,11740,11735,11738,11753,11755,11756,11748,11581,11757,11745,11739,11737,11732,11761,11742,11743,11749,11751,13440,13443,13445,13444,13449,13446,13442,13447,11752,11750,11759,11747,11754,11736,11758,11770,11769,11777,11803,11783,11773,11765,11771,11785,11800,11780,11802,11774,11772,11776,11781,11801,11768,11784,11580,11786,11766,11764,13458,13441,13450,13451,13457,13455,13454,13453); +INSERT INTO `game_event_gameobject_quest` (`eventEntry`,`id`, `quest`) VALUES +(1,187916, 11734), -- Ashenvale // Desecrate the Flame (Horde) - Kalimdor +(1,187924, 11741), -- Desolace +(1,187927, 11744), -- Dustwallow Marsh +(1,187946, 11763), -- Winterspring +(1,187945, 11762), -- Tanaris +(1,187943, 11760), -- Silithus +(1,187929, 11746), -- Feralas +(1,187923, 11740), -- Darkshore +(1,187917, 11735), -- Azuremyst Isle +(1,187921, 11738), -- Bloodmyst Isle +(1,187936, 11753), -- Teldrassil +(1,187938, 11755), -- The Hinterlands // Desecrate the Flame (Horde) - Eeastern Kingdoms +(1,187939, 11756), -- The Western Plaguelands +(1,187931, 11748), -- Hillsbrad Foothills +(1,187564, 11581), -- Westfall +(1,187940, 11757), -- Wetlands +(1,187928, 11745), -- Elwynn Forest +(1,187922, 11739), -- Burning Steppes +(1,187920, 11737), -- Blasted Lands +(1,187914, 11732), -- Arathi Highlands +(1,187944, 11761), -- Cape of Stranglethorn +(1,187925, 11742), -- Dun Morogh +(1,187926, 11743), -- Duskwood +(1,187932, 11749), -- Loch Modan +(1,187934, 11751), -- Redridge Mountains +(1,194032, 13440), -- Borean Tundra // Desecrate the Flame (Horde) - Northrend +(1,194036, 13443), -- Dragonblight +(1,194040, 13445), -- Grizzly +(1,194038, 13444), -- Howling Fjord +(1,194049, 13449), -- Zul'Drak +(1,194044, 13446), -- The Storm Peaks +(1,194035, 13442), -- Sholazar Basin +(1,194045, 13447), -- Crystalsong Forest +(1,187935, 11752), -- Shadowmoon Valley // Desecrate the Flame (Horde) - Outland +(1,187933, 11750), -- Nagrand +(1,187942, 11759), -- Netherstorm +(1,187930, 11747), -- Hellfire Peninsula +(1,187937, 11754), -- Terokkar +(1,187919, 11736), -- Blade's Edge +(1,187941, 11758), -- Zangarmarsh +(1,187958, 11770), -- Durotar // Desecrate the Flame (Alliance) - Kalimdor +(1,187957, 11769), -- Desolace +(1,187965, 11777), -- Mulgore +(1,187953, 11803), -- Winterspring +(1,187971, 11783), -- Barrens +(1,187961, 11773), -- Feralas +(1,187948, 11765), -- Ashenvale +(1,187959, 11771), -- Dustwallow marsh +(1,187973, 11785), -- Thousand Needles +(1,187950, 11800), -- Silithus +(1,187968, 11780), -- Stonetalon Mountains +(1,187952, 11802), -- Tanaris +(1,187962, 11774), -- Ghostland // Desecrate the Flame (Alliance) - Eeastern Kingdoms +(1,187960, 11772), -- Eversong woods +(1,187964, 11776), -- Hillsbrad Foothills +(1,187969, 11781), -- Swamp of sorrows +(1,187951, 11801), -- Cape of Stranglethorn +(1,187956, 11768), -- Burning Steppes +(1,187972, 11784), -- The Hinterlands +(1,187559, 11580), -- Silverpine Forest +(1,187974, 11786), -- Tirisfal Glades +(1,187954, 11766), -- Badlands +(1,187947, 11764), -- Arathi Highlands +(1,187963, 11775), -- Hellfire Peninsula // Desecrate the Flame (Alliance) - Outland +(1,187967, 11779), -- Shadowmoon Valley +(1,187949, 11799), -- Netherstorm +(1,187970, 11782), -- Terokkar +(1,187975, 11787), -- Zangarmarsh +(1,187955, 11767), -- Blade' Edge +(1,187966, 11778), -- Nagrand +(1,194048, 13458), -- Zul'Drak // Desecrate the Flame (Alliance) - Northend +(1,194033, 13441), -- Borean Tundra +(1,194034, 13450), -- Sholazar Basin +(1,194037, 13451), -- Dragonblight +(1,194046, 13457), -- Crystalsong Forest +(1,194043, 13455), -- Storm Peaks +(1,194042, 13454), -- Grizzly Hills +(1,194039, 13453); -- Howling Fjords From f9cb4280bd8f1c29e4acbae5339bce40c3b52bcb Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sun, 5 Aug 2012 00:28:23 +0200 Subject: [PATCH 016/147] Core/ByteBuffer: Print stack trace in ByteBufferException::PrintError. --- src/server/shared/Packets/ByteBuffer.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 045c5fd91c..760fcfd48d 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -50,8 +50,10 @@ class ByteBufferPositionException : public ByteBufferException protected: void PrintError() const { - sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " , - (_add ? "put" : "get"), ValueSize, Pos, Size); + ACE_Stack_Trace trace; + + sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stacktrace: %s]" , + (_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str()); } private: @@ -70,8 +72,10 @@ class ByteBufferSourceException : public ByteBufferException protected: void PrintError() const { - sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")", - (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size); + ACE_Stack_Trace trace; + + sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")\n[Stacktrace: %s]", + (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str()); } }; From cc0ff69ca4271614b4bb6f5813ea6267cc140edb Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 3 Aug 2012 15:15:19 +0200 Subject: [PATCH 017/147] Core/Commands: * Add remove support for disable command * Add quest disables support * Add check for no existent entry * Fix problems with flags 0 * Fix code style --- .../2012_08_05_00_world_trinity_string.sql | 5 + .../world/2012_08_05_01_world_command.sql | 19 ++ src/server/game/Miscellaneous/Language.h | 5 +- src/server/scripts/Commands/cs_disable.cpp | 316 ++++++++++++++---- .../Database/Implementation/WorldDatabase.cpp | 3 +- .../Database/Implementation/WorldDatabase.h | 1 + 6 files changed, 277 insertions(+), 72 deletions(-) create mode 100644 sql/updates/world/2012_08_05_00_world_trinity_string.sql create mode 100644 sql/updates/world/2012_08_05_01_world_command.sql diff --git a/sql/updates/world/2012_08_05_00_world_trinity_string.sql b/sql/updates/world/2012_08_05_00_world_trinity_string.sql new file mode 100644 index 0000000000..e432f598c0 --- /dev/null +++ b/sql/updates/world/2012_08_05_00_world_trinity_string.sql @@ -0,0 +1,5 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (5032,5033,5034); +INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES +(5032,'No battleground found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5033,'No achievement criteria found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5034,'No outdoor PvP found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/world/2012_08_05_01_world_command.sql b/sql/updates/world/2012_08_05_01_world_command.sql new file mode 100644 index 0000000000..f19bfe1c0d --- /dev/null +++ b/sql/updates/world/2012_08_05_01_world_command.sql @@ -0,0 +1,19 @@ +DELETE FROM `command` WHERE `name` IN ( +'disable add quest','disable add map','disable add battleground','disable add achievement_criteria','disable add spell','disable add outdoorpvp','disable add vmap', +'disable remove quest','disable remove map','disable remove battleground','disable remove achievement_criteria','disable remove spell','disable remove outdoorpvp','disable remove vmap' +); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('disable add quest',3,'Syntax: .disable add quest $entry $flag $comment'), +('disable add map',3,'Syntax: .disable add map $entry $flag $comment'), +('disable add battleground',3,'Syntax: .disable add battleground $entry $flag $comment'), +('disable add achievement_criteria',3,'Syntax: .disable add achievement_criteria $entry $flag $comment'), +('disable add spell',3,'Syntax: .disable add spell $entry $flag $comment'), +('disable add outdoorpvp',3,'Syntax: .disable add outdoorpvp $entry $flag $comment'), +('disable add vmap',3,'Syntax: .disable add vmap $entry $flag $comment'), +('disable remove quest',3,'Syntax: .disable remove quest $entry'), +('disable remove map',3,'Syntax: .disable remove map $entry'), +('disable remove battleground',3,'Syntax: .disable remove battleground $entry'), +('disable remove achievement_criteria',3,'Syntax: .disable remove achievement_criteria $entry'), +('disable remove spell',3,'Syntax: .disable remove spell $entry'), +('disable remove outdoorpvp',3,'Syntax: .disable remove outdoorpvp $entry'), +('disable remove vmap',3,'Syntax: .disable remove vmap $entry'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index aec72835d8..a766108dbb 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -957,7 +957,10 @@ enum TrinityStrings LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029, LANG_FLEE = 5030, LANG_NPCINFO_AIINFO = 5031, - // Room for more Trinity strings 5032-9999 + LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032, + LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033, + LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034, + // Room for more Trinity strings 5035-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index e7f3388503..a2a80edd43 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ObjectMgr.h" #include "Chat.h" #include "DisableMgr.h" +#include "OutdoorPvP.h" class disable_commandscript : public CommandScript { @@ -34,56 +35,230 @@ public: ChatCommand* GetCommands() const { - + static ChatCommand removeDisableCommandTable[] = + { + { "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &HandleRemoveDisableMapCommand, "", NULL }, + { "battleground", SEC_ADMINISTRATOR, true, &HandleRemoveDisableBattlegroundCommand, "", NULL }, + { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleRemoveDisableAchievementCriteriaCommand, "", NULL }, + { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "", NULL }, + { "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand addDisableCommandTable[] = + { + { "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &HandleAddDisableMapCommand, "", NULL }, + { "battleground", SEC_ADMINISTRATOR, true, &HandleAddDisableBattlegroundCommand, "", NULL }, + { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleAddDisableAchievementCriteriaCommand, "", NULL }, + { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "", NULL }, + { "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand disableCommandTable[] = { - { "spell", SEC_GAMEMASTER, false, &HandleDisableSpellCommand, "", NULL }, - { "map", SEC_GAMEMASTER, false, &HandleDisableMapCommand, "", NULL }, - { "battleground", SEC_GAMEMASTER, false, &HandleDisableBattlegroundCommand, "", NULL }, - { "achievement_criteria", SEC_GAMEMASTER, false, &HandleDisableAchievementCriteriaCommand, "", NULL }, - { "outdoorpvp", SEC_GAMEMASTER, false, &HandleDisableOutdoorPvPCommand, "", NULL }, - { "vmap", SEC_GAMEMASTER, false, &HandleDisableVmapCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - + { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable }, + { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand commandTable[] = { - { "disable", SEC_GAMEMASTER, false, NULL, "", disableCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable }, + { NULL, 0, false, NULL, "", NULL } }; return commandTable; } - - static void HandleDisables(ChatHandler* handler, char const* args, uint8 disableType) + static bool HandleAddDisables(ChatHandler* handler, char const* args, uint8 disableType) { - char* cEntry = strtok((char*)args, " "); - if (!cEntry || !atoi(cEntry)) + char* entryStr = strtok((char*)args, " "); + if (!entryStr || !atoi(entryStr)) + return false; + + char* flagsStr = strtok(NULL, " "); + uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0; + + char* commentStr = strtok(NULL, ""); + if (!commentStr) + return false; + + std::string disableComment = commentStr; + uint32 entry = uint32(atoi(entryStr)); + + std::string disableTypeStr = ""; + + switch (disableType) { - handler->SendSysMessage("No entry specified."); - return; + case DISABLE_TYPE_SPELL: + { + if (!sSpellMgr->GetSpellInfo(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "spell"; + break; + } + case DISABLE_TYPE_QUEST: + { + if (!sObjectMgr->GetQuestTemplate(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "quest"; + break; + } + case DISABLE_TYPE_MAP: + { + if (!sMapStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "map"; + break; + } + case DISABLE_TYPE_BATTLEGROUND: + { + if (!sBattlemasterListStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "battleground"; + break; + } + case DISABLE_TYPE_ACHIEVEMENT_CRITERIA: + { + if (!sAchievementCriteriaStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "achievement criteria"; + break; + } + case DISABLE_TYPE_OUTDOORPVP: + { + if (entry > MAX_OUTDOORPVP_TYPES) + { + handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "outdoorpvp"; + break; + } + case DISABLE_TYPE_VMAP: + { + if (!sMapStore.LookupEntry(entry)) + { + handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND); + handler->SetSentErrorMessage(true); + return false; + } + disableTypeStr = "vmap"; + break; + } + default: + break; + } + + PreparedStatement* stmt = NULL; + stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (result) + { + handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry); + handler->SetSentErrorMessage(true); + return false; } - char* cFlags = strtok(NULL, " "); - if (!cFlags || !atoi(cFlags)) - { - handler->SendSysMessage("No flags specified."); - return; - } + stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + stmt->setUInt16(2, flags); + stmt->setString(3, disableComment); + WorldDatabase.Execute(stmt); - char* cComment = strtok(NULL, ""); - if (!cComment) - { - handler->SendSysMessage("No comment specified."); - return; - } + handler->PSendSysMessage("Add Disabled %s (Id: %u) for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str()); + return true; + } - std::string entryStr = cEntry; - std::string disableComment = cComment; - uint32 entry = (uint32)atoi(cEntry); - uint8 flags = atoi(cFlags); + static bool HandleAddDisableSpellCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + return HandleAddDisables(handler, args, DISABLE_TYPE_SPELL); + } + static bool HandleAddDisableQuestCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_QUEST); + } + + static bool HandleAddDisableMapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_MAP); + } + + static bool HandleAddDisableBattlegroundCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); + } + + static bool HandleAddDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); + } + + static bool HandleAddDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + HandleAddDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); + return true; + } + + static bool HandleAddDisableVmapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleAddDisables(handler, args, DISABLE_TYPE_VMAP); + } + + static bool HandleRemoveDisables(ChatHandler* handler, char const* args, uint8 disableType) + { + char* entryStr = strtok((char*)args, " "); + if (!entryStr || !atoi(entryStr)) + return false; + + uint32 entry = uint32(atoi(entryStr)); std::string disableTypeStr = ""; @@ -92,6 +267,9 @@ public: case DISABLE_TYPE_SPELL: disableTypeStr = "spell"; break; + case DISABLE_TYPE_QUEST: + disableTypeStr = "quest"; + break; case DISABLE_TYPE_MAP: disableTypeStr = "map"; break; @@ -109,87 +287,85 @@ public: break; } - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); + PreparedStatement* stmt = NULL; + stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); - PreparedQueryResult result = WorldDatabase.Query(stmt); - - - if (result) + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { - handler->PSendSysMessage("This %s (id %u) is already disabled.", disableTypeStr.c_str(), entry); - return; + handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry); + handler->SetSentErrorMessage(true); + return false; } - PreparedStatement* stmt2 = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES); - stmt2->setUInt32(0, entry); - stmt2->setUInt8(1, disableType); - stmt2->setUInt16(2, flags); - stmt2->setString(3, disableComment); - WorldDatabase.Execute(stmt2); - - handler->PSendSysMessage("Disabled %s %u for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str()); - return; + stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES); + stmt->setUInt32(0, entry); + stmt->setUInt8(1, disableType); + WorldDatabase.Execute(stmt); + handler->PSendSysMessage("Remove Disabled %s (Id: %u)", disableTypeStr.c_str(), entry); + return true; } - static bool HandleDisableSpellCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableSpellCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_SPELL); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_SPELL); } - static bool HandleDisableMapCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableQuestCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_MAP); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_QUEST); } - static bool HandleDisableBattlegroundCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableMapCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); - return true; + return HandleAddDisables(handler, args, DISABLE_TYPE_MAP); } - static bool HandleDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_BATTLEGROUND); } - static bool HandleDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA); } - static bool HandleDisableVmapCommand(ChatHandler* handler, char const* args) + static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler* handler, char const* args) { if (!*args) return false; - HandleDisables(handler, args, DISABLE_TYPE_VMAP); - return true; + return HandleRemoveDisables(handler, args, DISABLE_TYPE_OUTDOORPVP); } + static bool HandleRemoveDisableVmapCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + return HandleRemoveDisables(handler, args, DISABLE_TYPE_VMAP); + } }; void AddSC_disable_commandscript() { new disable_commandscript(); -} \ No newline at end of file +} diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index 3b59f283dd..872d9ec415 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -89,5 +89,6 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); - PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ? AND flags > 0", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index 10163d33c8..6d7df87cc8 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -111,6 +111,7 @@ enum WorldDatabaseStatements WORLD_INS_GAMEOBJECT, WORLD_SEL_DISABLES, WORLD_INS_DISABLES, + WORLD_DEL_DISABLES, MAX_WORLDDATABASE_STATEMENTS, }; From 0b98656b2878e1a6f644e1cd8b7745370efc488b Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 5 Aug 2012 02:16:24 +0200 Subject: [PATCH 018/147] Core/Spells: Remove no longer needed hack to Apply Enchanted Bridle --- src/server/game/Spells/SpellMgr.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3cc3a87733..e2b7df2889 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3241,10 +3241,6 @@ void SpellMgr::LoadDbcDataCorrections() // this needs research on modifier applying rules, does not seem to be in Attributes fields spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000); break; - case 63163: // Apply Enchanted Bridle (Argent Tournament) - spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1 - spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0) - break; case 45602: // Ride Carpet spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)" break; From 9afbb75321354da1f4797da812eb9cd4a6ef4ce5 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 5 Aug 2012 04:18:22 +0200 Subject: [PATCH 019/147] Core/Spells: Fix Divine Shield and Ice Block casted in Cyclone --- src/server/game/Spells/Spell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3742ee5fc5..1dedf8ba91 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5544,7 +5544,7 @@ SpellCastResult Spell::CheckCasterAuras() const // We use bitmasks so the loop is done only once and not on every aura check below. if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY) { - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY) school_immune |= uint32(m_spellInfo->Effects[i].MiscValue); @@ -5612,7 +5612,7 @@ SpellCastResult Spell::CheckCasterAuras() const SpellInfo const* auraInfo = aura->GetSpellInfo(); if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune) continue; - if (auraInfo->GetSchoolMask() & school_immune) + if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE)) continue; if (auraInfo->GetDispelMask() & dispel_immune) continue; From 3f42094b9c563d2b2d5f2dfe43d8d47c9114f71f Mon Sep 17 00:00:00 2001 From: Spp Date: Sun, 5 Aug 2012 15:38:25 +0200 Subject: [PATCH 020/147] Core/Logging: Add option to remove timestamp, Log Level and Log Filter Type from logged msgs - Appender config option .Timestamp and .Backup became obsolete - New Appender config option .Flags added Appender Console prefixes Log Level and Log Filter Type to the logged text as default Appender File prefixes Timestamp, Log Level and Log Filter Type to the logged text as default --- src/server/authserver/authserver.conf.dist | 19 ++++---- src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/shared/Logging/Appender.cpp | 48 +++++++++++++++++-- src/server/shared/Logging/Appender.h | 21 +++++++- src/server/shared/Logging/AppenderConsole.cpp | 10 ++-- src/server/shared/Logging/AppenderConsole.h | 2 +- src/server/shared/Logging/AppenderFile.cpp | 11 ++--- src/server/shared/Logging/AppenderFile.h | 2 +- src/server/shared/Logging/Log.cpp | 11 ++--- src/server/worldserver/worldserver.conf.dist | 19 ++++---- 11 files changed, 100 insertions(+), 47 deletions(-) diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index d77b40e659..30a319237a 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -206,16 +206,15 @@ LoginDatabase.WorkerThreads = 1 # Default: a - (Append) # w - (Overwrite) # -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) +# Appender.name.Flags +# Description: +# Default: Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # # Logger config values: Given a logger "name" the following options # can be read: diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index df515f879f..9aecf3c4c2 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1006,7 +1006,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 6e45ebf37c..6fdbf8a535 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -534,7 +534,7 @@ void WorldSession::LogoutPlayer(bool Save) // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 0b92e74c1e..db7857064d 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -31,8 +31,8 @@ std::string LogMessage::getTimeStr() return getTimeStr(mtime); } -Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */): -id(_id), name(_name), type(_type), level(_level) +Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */): +id(_id), name(_name), type(_type), level(_level), flags(_flags) { } @@ -60,6 +60,11 @@ LogLevel Appender::getLogLevel() const return level; } +AppenderFlags Appender::getFlags() const +{ + return flags; +} + void Appender::setLogLevel(LogLevel _level) { level = _level; @@ -67,9 +72,40 @@ void Appender::setLogLevel(LogLevel _level) void Appender::write(LogMessage& message) { - if (level && level <= message.level) - _write(message); - //else fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe + if (!level || level > message.level) + { + //fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe + return; + } + + message.prefix.clear(); + if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP) + message.prefix.append(message.getTimeStr().c_str()); + + if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL) + { + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + char text[MAX_QUERY_LEN]; + snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level)); + message.prefix.append(text); + } + + if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE) + { + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + char text[MAX_QUERY_LEN]; + snprintf(text, MAX_QUERY_LEN, "[%-15s]", Appender::getLogFilterTypeString(message.type)); + message.prefix.append(text); + } + + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + _write(message); } const char* Appender::getLogLevelString(LogLevel level) @@ -163,6 +199,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "WORLDSERVER"; case LOG_FILTER_GAMEEVENTS: return "GAMEEVENTS"; + case LOG_FILTER_CALENDAR: + return "CALENDAR"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 3105f0e6bb..429a685d4e 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -85,9 +85,23 @@ enum AppenderType APPENDER_DB, }; +enum AppenderFlags +{ + APPENDER_FLAGS_NONE = 0x00, + APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01, + APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02, + APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04, + APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender + APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender +}; + struct LogMessage { - LogMessage(LogLevel _level, LogFilterType _type, std::string _text): level(_level), type(_type), text(_text) + LogMessage(LogLevel _level, LogFilterType _type, std::string _text) + : level(_level) + , type(_type) + , text(_text) + , param1(0) { mtime = time(NULL); } @@ -98,6 +112,7 @@ struct LogMessage LogLevel level; LogFilterType type; std::string text; + std::string prefix; uint32 param1; time_t mtime; }; @@ -105,13 +120,14 @@ struct LogMessage class Appender { public: - Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED); + Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE); virtual ~Appender(); uint8 getId() const; std::string const& getName() const; AppenderType getType() const; LogLevel getLogLevel() const; + AppenderFlags getFlags() const; void setLogLevel(LogLevel); void write(LogMessage& message); @@ -125,6 +141,7 @@ class Appender std::string name; AppenderType type; LogLevel level; + AppenderFlags flags; }; typedef std::map AppenderMap; diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index 30c7cc4d13..839f8512ad 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -21,9 +21,11 @@ #include -AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level): -Appender(id, name, APPENDER_CONSOLE, level), _colored(false), _colors() +AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags): +Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false) { + for (uint8 i = 0; i < MaxLogLevels; ++i) + _colors[i] = ColorTypes(MaxColors); } void AppenderConsole::InitColors(std::string const& str) @@ -183,9 +185,9 @@ void AppenderConsole::_write(LogMessage& message) } SetColor(stdout_stream, _colors[index]); - utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str()); ResetColor(stdout_stream); } else - utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str()); } diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index b81fe6dde5..ad7d9543cd 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -45,7 +45,7 @@ const uint8 MaxColors = uint8(WHITE) + 1; class AppenderConsole: public Appender { public: - AppenderConsole(uint8 _id, std::string const& name, LogLevel level); + AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags); void InitColors(const std::string& init_str); private: diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index cb875240c4..d66771b905 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -18,16 +18,16 @@ #include "AppenderFile.h" #include "Common.h" -AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, bool _backup) - : Appender(id, name, APPENDER_FILE, level) +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags) + : Appender(id, name, APPENDER_FILE, level, _flags) , filename(_filename) , logDir(_logDir) , mode(_mode) - , backup(_backup) { dynamicName = std::string::npos != filename.find("%u"); + backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; if (!dynamicName) - logfile = OpenFile(_filename, _mode, _backup); + logfile = OpenFile(_filename, _mode, backup); } AppenderFile::~AppenderFile() @@ -50,8 +50,7 @@ void AppenderFile::_write(LogMessage& message) if (logfile) { - fprintf(logfile, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); - + fprintf(logfile, "%s%s", message.prefix.c_str(), message.text.c_str()); fflush(logfile); if (dynamicName) diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index 8d8b0c43a5..e9cb858f62 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -23,7 +23,7 @@ class AppenderFile: public Appender { public: - AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, bool backup); + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags); ~AppenderFile(); FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 2ced38847b..0bf8bcded8 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -103,7 +103,8 @@ void Log::CreateAppenderFromConfig(const char* name) { case APPENDER_CONSOLE: { - AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level); + AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; appender->InitColors(GetConfigStringDefault(base, "Colors", "")); @@ -114,10 +115,9 @@ void Log::CreateAppenderFromConfig(const char* name) { std::string filename = GetConfigStringDefault(base, "File", ""); std::string mode = GetConfigStringDefault(base, "Mode", "a"); - std::string timestamp = GetConfigStringDefault(base, "Timestamp", ""); - bool backup = GetConfigIntDefault(base, "Backup", 0); + AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_TIMESTAMP | APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); - if (!timestamp.empty()) + if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { size_t dot_pos = filename.find_last_of("."); if (dot_pos != filename.npos) @@ -127,7 +127,7 @@ void Log::CreateAppenderFromConfig(const char* name) } uint8 id = NextAppenderId(); - appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), backup); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } @@ -228,7 +228,6 @@ void Log::EnableDBAppenders() for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) if (it->second && it->second->getType() == APPENDER_DB) ((AppenderDB *)it->second)->setEnable(true); - } void Log::log(LogFilterType filter, LogLevel level, char const* str, ...) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 614d7f95eb..f31326b104 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2637,16 +2637,15 @@ PlayerDump.DisallowOverwrite = 1 # Default: a - (Append) # w - (Overwrite) # -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) +# Appender.name.Flags +# Description: +# Default: Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # # Logger config values: Given a logger "name" the following options # can be read: From 1bd8cb9a7cbaa1a3644328adcceb6a0bc3039156 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 5 Aug 2012 19:56:16 +0100 Subject: [PATCH 021/147] Script/Commands: Fix a copy paste type in .reload item_set_names command --- src/server/scripts/Commands/cs_reload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index c8568feaeb..3bb29f8abf 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -949,7 +949,7 @@ public: static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) { sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); - LoadRandomEnchantmentsTable(); + sObjectMgr->LoadItemSetNames(); handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); return true; } From 2e3e62875b6b1bea5becd877c58349aae6006bfc Mon Sep 17 00:00:00 2001 From: Faq Date: Sun, 5 Aug 2012 16:13:49 +0300 Subject: [PATCH 022/147] Core/Spells: Generic fix for auras with effect SPELL_EFFECT_APPLY_AREA_AURA_ENEMY Author Vincent-Michael --- src/server/game/Spells/SpellInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 0dad4fda76..7b3f9a1bef 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2210,7 +2210,6 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case 54836: // Wrath of the Plaguebringer case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura - case 62532: // Conservator's Grip return false; case 30877: // Tag Murloc case 61716: // Rabbit Costume @@ -2300,6 +2299,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELL_EFFECT_HEAL_PCT: case SPELL_EFFECT_ENERGIZE_PCT: return true; + case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: + return false; // non-positive aura use case SPELL_EFFECT_APPLY_AURA: From 483fb42306b82d92ea4c32ce016dbdd7fa91381d Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 08:49:31 +0200 Subject: [PATCH 023/147] Core/Logging: Move player delete logging to new type LOG_FILTER_PLAYER_DELETE (34). Also add missing sql from 55ce180f28 --- .../world/2012_08_06_00_world_command.sql | 4 ++++ src/server/game/Handlers/CharacterHandler.cpp | 16 ++++++---------- src/server/shared/Logging/Appender.cpp | 2 ++ src/server/shared/Logging/Appender.h | 5 +++-- src/server/worldserver/worldserver.conf.dist | 1 + 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 sql/updates/world/2012_08_06_00_world_command.sql diff --git a/sql/updates/world/2012_08_06_00_world_command.sql b/sql/updates/world/2012_08_06_00_world_command.sql new file mode 100644 index 0000000000..50628aaa58 --- /dev/null +++ b/sql/updates/world/2012_08_06_00_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('server togglequerylog', 'server set loglevel'); + +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('server set loglevel',4,'Syntax: .server set loglevel $facility $name $loglevel. $facility can take the values: appender (a) or logger (l). $loglevel can take the values: disabled (0), trace (1), debug (2), info (3), warn (4), error (5) or fatal (6)'); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 9aecf3c4c2..e4926bfad2 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -687,7 +687,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) if (sGuildMgr->GetGuildByLeader(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER; + data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER); SendPacket(&data); return; } @@ -696,18 +696,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) if (sArenaTeamMgr->GetArenaTeamByCaptain(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN; + data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN); SendPacket(&data); return; } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(guid)); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (result) + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); accountId = fields[0].GetUInt32(); @@ -719,22 +716,21 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_SUCCESS; + data << uint8(CHAR_DELETE_SUCCESS); SendPacket(&data); } diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index db7857064d..abb2649c46 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -201,6 +201,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "GAMEEVENTS"; case LOG_FILTER_CALENDAR: return "CALENDAR"; + case LOG_FILTER_PLAYER_DELETE: + return "PLAYER_DELETE"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 429a685d4e..323da3f2be 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -58,10 +58,11 @@ enum LogFilterType LOG_FILTER_AUTHSERVER, LOG_FILTER_WORLDSERVER, LOG_FILTER_GAMEEVENTS, - LOG_FILTER_CALENDAR + LOG_FILTER_CALENDAR, + LOG_FILTER_PLAYER_DELETE }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index f31326b104..3fe9ab4c37 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2695,6 +2695,7 @@ PlayerDump.DisallowOverwrite = 1 # 31 - Worldserver # 32 - Game Events # 33 - Calendar +# 34 - Player delete # # Logger.name.Level # Description: Logger level of logging From 5746b688fa156f2ea3a72a8f655042c24bdae8c4 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 09:30:47 +0200 Subject: [PATCH 024/147] Core/Logging: Reload Logging options when .reload config is used --- src/server/game/World/World.cpp | 1 + src/server/shared/Logging/Log.cpp | 26 +++++++++++++++----------- src/server/shared/Logging/Log.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 3a13f48d80..ab3b715008 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -398,6 +398,7 @@ void World::LoadConfigSettings(bool reload) sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str()); return; } + sLog->LoadFromConfig(); } ///- Read the player limit and the Message of the day from the config file diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 0bf8bcded8..cce670922f 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -32,18 +32,8 @@ Log::Log() { SetRealmID(0); - AppenderId = 0; - /// Common log files data - m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - if (!m_logsDir.empty()) - if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) - m_logsDir.push_back('/'); - m_logsTimestamp = "_" + GetTimestampStr(); - - ReadAppendersFromConfig(); - ReadLoggersFromConfig(); - worker = new LogWorker(); + LoadFromConfig(); } Log::~Log() @@ -426,6 +416,20 @@ void Log::Close() it->second = NULL; } appenders.clear(); + loggers.clear(); delete worker; worker = NULL; } + +void Log::LoadFromConfig() +{ + Close(); + AppenderId = 0; + m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + if (!m_logsDir.empty()) + if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) + m_logsDir.push_back('/'); + ReadAppendersFromConfig(); + ReadLoggersFromConfig(); + worker = new LogWorker(); +} diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 5e2b7972dc..7b0e8cd381 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -40,6 +40,7 @@ class Log ~Log(); public: + void LoadFromConfig(); void Close(); bool ShouldLog(LogFilterType type, LogLevel level) const; bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); From 97c4b92eb02fc673d1230aadaee23aa7827a9761 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 12:10:33 +0200 Subject: [PATCH 025/147] Core/Logging: Try to simplify configuration of loggers and appenders Changed multiple lines to a simple format: - Logger.name=Type,LogLevel,Flags,AppenderList - Appender.name=Type,LogLevel,Flags,optional1,optional2 * Type = File: optional1 = File name, optiona2 = Mode * Type = Console: optional1 = Colors Created a default set of loggers and appenders. - Root logger defaults to Error, that means you will see nothing on console by default (not even loading) - You need to add the loggers to Loggers options if you want to enable them, otherwise Root logger will be used for all types Restored outSQLDriver (LOG_FILTER_SQL_DRIVER), outSQLDev (LOG_FILTER_SQL_DEV), outArena (LOG_FILTER_ARENA) and outChar (LOG_FILTER_CHARACTER) functionality by creating new types (LOG_FILTER_CHARACTER is a rename of LOG_FILTER_DELETE. Note: You need to update your config file... again (yeah sorry... trying to make it simpler) --- src/server/authserver/authserver.conf.dist | 178 +++++----- src/server/game/Battlegrounds/ArenaTeam.cpp | 20 +- src/server/game/Entities/Player/Player.cpp | 76 ++--- src/server/game/Handlers/CharacterHandler.cpp | 15 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/scripts/Commands/cs_account.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- .../shared/Database/DatabaseWorkerPool.h | 16 +- src/server/shared/Logging/Appender.cpp | 10 +- src/server/shared/Logging/Appender.h | 7 +- src/server/shared/Logging/Log.cpp | 107 ++++-- src/server/worldserver/worldserver.conf.dist | 321 +++++++++--------- 12 files changed, 400 insertions(+), 356 deletions(-) diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 30a319237a..d1c92dcf1d 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -149,123 +149,101 @@ LoginDatabase.WorkerThreads = 1 ################################################################################################### # # Logging system options. -# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. # +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 # -# Appender config values: Given a appender "name" the following options -# can be read: +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) # -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) # -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" # -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files # -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) # -# Appender.name.Flags -# Description: -# Default: Console = 6, File = 7, DB = 0 -# 0 - None -# 1 - Prefix Timestamp to the text -# 2 - Prefix Log Level to the text -# 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) + +Appender.Console=1,2,6 +Appender.Auth=2,2,7,Auth.log,w + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver + +Logger.Root=0,3,Console Auth + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) # -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 7 - Network input/output, -# 30 - Authserver -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger +# AppenderList: List of appenders linked to logger # (Using spaces as separator). # # Appenders # Description: List of Appenders to read from config # (Using spaces as separator). -# Default: "Console Auth" +# Default: "Console Server" + +Appenders=Console Auth + # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). # Default: "root" -Loggers=root -Appenders=Console Auth - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Auth.Type=2 -Appender.Auth.Level=2 -Appender.Auth.File=Auth.log -Appender.Auth.Mode=w - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Auth +Loggers=Root diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 7c6cabe37b..b9ddabcf25 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -87,7 +87,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin // Add captain as member AddMember(CaptainGuid); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); + sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); return true; } @@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { - sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); return false; } @@ -184,7 +184,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); return true; } @@ -251,7 +251,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (newMember.Name.empty()) { sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); - this->DelMember(newMember.Guid, true); + DelMember(newMember.Guid, true); continue; } @@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } @@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(uint64 guid) newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0; - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType()); } } @@ -321,7 +321,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) // delete all info regarding this team for (uint32 i = 0; i < ARENA_TEAM_END; ++i) player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency @@ -346,7 +346,7 @@ void ArenaTeam::Disband(WorldSession* session) BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Update database @@ -507,7 +507,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun data << str1 << str2 << str3; break; default: - sLog->outError(LOG_FILTER_BATTLEGROUND, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); + sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); return; } @@ -529,7 +529,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type) default: break; } - sLog->outError(LOG_FILTER_BATTLEGROUND, "FATAL: Unknown arena team type %u for some arena team", type); + sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2fd80b7b84..0731046892 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1228,7 +1228,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - sLog->outError(LOG_FILTER_PLAYER, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); return false; } @@ -1534,7 +1534,7 @@ void Player::Update(uint32 p_time) { //sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad); //if (m_spellModTakingSpell) - sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); + sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); m_spellModTakingSpell = NULL; } @@ -1731,7 +1731,7 @@ void Player::Update(uint32 p_time) { // m_nextSave reseted in SaveToDB call SaveToDB(); - sLog->outInfo(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); } else m_nextSave -= p_time; @@ -1879,12 +1879,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { - sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Don't build enum.", guid); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid); return false; } else if (!IsValidGender(gender)) { - sLog->outError(LOG_FILTER_PLAYER, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); return false; } @@ -2066,14 +2066,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation)) { - sLog->outError(LOG_FILTER_PLAYER, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", + sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); + sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2426,7 +2426,7 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - sLog->outFatal(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); + sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } } @@ -3355,7 +3355,7 @@ void Player::SendInitialSpells() GetSession()->SendPacket(&data); - sLog->outInfo(LOG_FILTER_PLAYER, "CHARACTER: Sent Initial Spells"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells"); } void Player::RemoveMail(uint32 id) @@ -3436,7 +3436,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3445,7 +3445,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3455,7 +3455,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3464,7 +3464,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); return false; } @@ -3509,7 +3509,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3518,7 +3518,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3528,7 +3528,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3537,7 +3537,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); return false; } @@ -4291,7 +4291,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); continue; } @@ -5003,7 +5003,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) if (result) { - sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { Field* fields = result->Fetch(); @@ -5418,7 +5418,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { - sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } @@ -5426,7 +5426,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { - sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } @@ -5442,7 +5442,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { if (GetGuildId() == 0) { - sLog->outDebug(LOG_FILTER_PLAYER, "You are not member of a guild"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild"); return TotalCost; } @@ -5457,7 +5457,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } else if (!HasEnoughMoney(costs)) { - sLog->outDebug(LOG_FILTER_PLAYER, "You do not have enough money"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money"); return TotalCost; } else @@ -5665,7 +5665,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if (modGroup >= BASEMOD_END || modType >= MOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); return; } @@ -5696,7 +5696,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if (modGroup >= BASEMOD_END || modType > MOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "trial to access non existed BaseModGroup or wrong BaseModType!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; } @@ -5710,7 +5710,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const { if (modGroup >= BASEMOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "wrong BaseModGroup in GetTotalBaseModValue()!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!"); return 0.0f; } @@ -6432,7 +6432,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { - sLog->outError(LOG_FILTER_PLAYER, "Skill not found in SkillLineStore: skill #%u", id); + sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id); return; } @@ -6592,8 +6592,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const void Player::SendActionButtons(uint32 state) const { - sLog->outInfo(LOG_FILTER_PLAYER, "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); - WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); data << uint8(state); /* @@ -6615,20 +6613,20 @@ void Player::SendActionButtons(uint32 state) const } GetSession()->SendPacket(&data); - sLog->outInfo(LOG_FILTER_PLAYER, "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); + sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); } bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6637,7 +6635,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); return false; } @@ -6650,7 +6648,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); return false; } break; @@ -6672,7 +6670,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) // set data and update to CHANGED if not NEW ab.SetActionAndType(action, ActionButtonType(type)); - sLog->outInfo(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); return &ab; } @@ -6687,7 +6685,7 @@ void Player::removeActionButton(uint8 button) else buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save - sLog->outInfo(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); } ActionButton const* Player::GetActionButton(uint8 button) @@ -7698,7 +7696,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) if (item->IsBroken()) return; - sLog->outInfo(LOG_FILTER_PLAYER, "applying mods for item %u ", item->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow()); uint8 attacktype = Player::GetAttackBySlot(slot); @@ -8290,7 +8288,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError(LOG_FILTER_PLAYER, "WORLD: unknown Item spellid %i", spellData.SpellId); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId); continue; } @@ -8359,7 +8357,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]); continue; } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index e4926bfad2..7451bd2dc2 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -658,8 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte SendPacket(&data); std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass()); @@ -716,15 +715,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_CHARACTER, LOG_LEVEL_DEBUG)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outDebug(LOG_FILTER_CHARACTER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); @@ -1002,7 +1001,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) @@ -1179,7 +1178,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(RESPONSE_SUCCESS); @@ -1446,7 +1445,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) if (result) { std::string oldname = result->Fetch()[0].GetString(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); } Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 6fdbf8a535..118b0d68d5 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -534,7 +534,7 @@ void WorldSession::LogoutPlayer(bool Save) // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index db975419a2..1024a3acf1 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -111,7 +111,7 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password." + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password." , handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str() , handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow()); } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 355ff195cf..7f25a11bcd 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1325,7 +1325,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - sLog->outInfo(LOG_FILTER_SQL, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index d86b99a062..9d6fabb9df 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -64,7 +64,7 @@ class DatabaseWorkerPool bool res = true; _connectionInfo = MySQLConnectionInfo(infoString); - sLog->outWarn(LOG_FILTER_SQL, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); //! Open asynchronous connections (delayed operations) @@ -88,17 +88,17 @@ class DatabaseWorkerPool } if (res) - sLog->outWarn(LOG_FILTER_SQL, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); else - sLog->outError(LOG_FILTER_SQL, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + sLog->outError(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " "for specific errors.", GetDatabaseName()); return res; } void Close() { - sLog->outWarn(LOG_FILTER_SQL, "Closing down DatabasePool '%s'.", GetDatabaseName()); + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName()); //! Shuts down delaythreads for this connection pool by underlying deactivate(). //! The next dequeue attempt in the worker thread tasks will result in an error, @@ -114,7 +114,7 @@ class DatabaseWorkerPool t->Close(); //! Closes the actualy MySQL connection. } - sLog->outWarn(LOG_FILTER_SQL, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", GetDatabaseName()); //! Shut down the synchronous connections @@ -127,7 +127,7 @@ class DatabaseWorkerPool //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; - sLog->outWarn(LOG_FILTER_SQL, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); } /** @@ -351,10 +351,10 @@ class DatabaseWorkerPool switch (transaction->GetSize()) { case 0: - sLog->outWarn(LOG_FILTER_SQL, "Transaction contains 0 queries. Not executing."); + sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing."); return; case 1: - sLog->outWarn(LOG_FILTER_SQL, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); break; default: break; diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index abb2649c46..be30a54ff0 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -201,8 +201,14 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "GAMEEVENTS"; case LOG_FILTER_CALENDAR: return "CALENDAR"; - case LOG_FILTER_PLAYER_DELETE: - return "PLAYER_DELETE"; + case LOG_FILTER_CHARACTER: + return "CHARACTER"; + case LOG_FILTER_ARENAS: + return "ARENAS"; + case LOG_FILTER_SQL_DRIVER: + return "SQL DRIVER"; + case LOG_FILTER_SQL_DEV: + return "SQL DEV"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 323da3f2be..7d7375a1ed 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -59,10 +59,13 @@ enum LogFilterType LOG_FILTER_WORLDSERVER, LOG_FILTER_GAMEEVENTS, LOG_FILTER_CALENDAR, - LOG_FILTER_PLAYER_DELETE + LOG_FILTER_CHARACTER, + LOG_FILTER_ARENAS, + LOG_FILTER_SQL_DRIVER, + LOG_FILTER_SQL_DEV }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_SQL_DEV) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index cce670922f..c9ba159cde 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -19,7 +19,7 @@ #include "Log.h" #include "Common.h" #include "Config.h" - +#include "Util.h" #include "AppenderConsole.h" #include "AppenderFile.h" #include "AppenderDB.h" @@ -82,30 +82,66 @@ void Log::CreateAppenderFromConfig(const char* name) if (!name || *name == '\0') return; - std::string base = "Appender."; - base.append(name); - base.push_back('.'); + // Format=type,level,flags,optional1,optional2 + // if type = File. optional1 = file and option2 = mode + // if type = Console. optional1 = Color + std::string options = "Appender."; + options.append(name); + options = ConfigMgr::GetStringDefault(options.c_str(), ""); + Tokens tokens(options, ','); + Tokens::iterator iter = tokens.begin(); - LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); - AppenderType type = AppenderType(GetConfigIntDefault(base, "Type", 0)); + if (tokens.size() < 2) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str()); + return; + } - switch(type) + AppenderFlags flags = APPENDER_FLAGS_NONE; + AppenderType type = AppenderType(atoi(*iter)); + ++iter; + LogLevel level = LogLevel(atoi(*iter)); + if (level > LOG_LEVEL_FATAL) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %u for appender %s\n", level, name); + return; + } + + if (++iter != tokens.end()) + flags = AppenderFlags(atoi(*iter)); + + switch (type) { case APPENDER_CONSOLE: { - AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + if (flags == APPENDER_FLAGS_NONE) + flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; - - appender->InitColors(GetConfigStringDefault(base, "Colors", "")); + if (++iter != tokens.end()) + appender->InitColors(*iter); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe break; } case APPENDER_FILE: { - std::string filename = GetConfigStringDefault(base, "File", ""); - std::string mode = GetConfigStringDefault(base, "Mode", "a"); - AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_TIMESTAMP | APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + std::string filename; + std::string mode = "a"; + + if (++iter == tokens.end()) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name); + return; + } + + if (flags == APPENDER_FLAGS_NONE) + flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE | APPENDER_FLAGS_PREFIX_TIMESTAMP); + + filename = *iter; + + if (++iter != tokens.end()) + mode = *iter; if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { @@ -121,13 +157,14 @@ void Log::CreateAppenderFromConfig(const char* name) //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } - case APPENDER_DB: // TODO Set realm! + case APPENDER_DB: { uint8 id = NextAppenderId(); appenders[id] = new AppenderDB(id, name, level, realm); break; } default: + fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %u for appender %s\n", type, name); break; } } @@ -137,29 +174,49 @@ void Log::CreateLoggerFromConfig(const char* name) if (!name || *name == '\0') return; - std::string base = "Logger."; - base.append(name); - base.push_back('.'); + LogLevel level = LOG_LEVEL_DISABLED; + int32 type = -1; - LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); - int32 type = GetConfigIntDefault(base, "Type", -1); + std::string options = "Logger."; + options.append(name); + options = ConfigMgr::GetStringDefault(options.c_str(), ""); - if (type < 0) + Tokens tokens(options, ','); + Tokens::iterator iter = tokens.begin(); + + if (tokens.size() != 3) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Missing entry %sType in config. Logger ignored\n", name); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong configuration for logger %s. Config line: %s\n", name, options.c_str()); + return; + } + + type = atoi(*iter); + if (type > MaxLogFilter) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name); return; } Logger& logger = loggers[type]; - if (!logger.getName().empty()) - fprintf(stderr, "Error while configuring Logger %s. Replacing (name: %s, Type: %u, Level: %u) with (name: %s, Type: %u, Level: %u)\n", - name, logger.getName().c_str(), logger.getType(), logger.getLogLevel(), name, type, level); + { + fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name); + return; + } + + ++iter; + level = LogLevel(atoi(*iter)); + if (level > LOG_LEVEL_FATAL) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name); + return; + } logger.Create(name, LogFilterType(type), level); //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe - std::istringstream ss(GetConfigStringDefault(base, "Appenders", "")); + ++iter; + std::istringstream ss(*iter); std::string str; ss >> str; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 3fe9ab4c37..be5a452c7b 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1148,15 +1148,6 @@ Warden.NumMemChecks = 3 Warden.NumOtherChecks = 7 -# -# Warden.LogFile -# Description: Client check fails will be logged here. -# Default: "" - (Disabled) -# "Warden.log" - (Enabled) -# - -Warden.LogFile = "" - # # Warden.ClientResponseDelay # Description: Time (in seconds) before client is getting disconnecting for not responding. @@ -2580,174 +2571,186 @@ PlayerDump.DisallowOverwrite = 1 ################################################################################################### # # Logging system options. -# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. # +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 # -# Appender config values: Given a appender "name" the following options -# can be read: +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) # -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) # -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" # -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files # -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) # -# Appender.name.Flags -# Description: -# Default: Console = 6, File = 7, DB = 0 -# 0 - None -# 1 - Prefix Timestamp to the text -# 2 - Prefix Log Level to the text -# 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) + +Appender.Console=1,2,6 +Appender.Server=2,2,7,Server.log,w +Appender.GM=2,2,7,GM.log +Appender.SQL=2,2,7,SQL.log +Appender.DBErrors=2,2,7,DBErrors.log +Appender.Char=2,2,7,Char.log,w +Appender.RA=2,2,7,RA.log +Appender.Arenas=2,2,7,Arena.log +Appender.SQLDev=2,2,7,SQLDev.log +Appender.SQLDriver=2,2,7,SQLDriver.log +Appender.Warden=2,2,7,Warden.log +Appender.Chat=2,2,7,Chat.log + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# 34 - Character (Exclusive to log login, logout, create, rename, delete actions) +# 35 - Arenas +# 36 - SQL Driver +# 37 - SQL Dev + +Logger.Root=0,5,Console Server +Logger.Units=1,3,Console Server +Logger.Pets=2,3,Console Server +Logger.Vehicles=3,3,Console Server +Logger.TCSR=4,3,Console Server +Logger.AI=5,3,Console Server +Logger.MapScripts=6,3,Console Server +Logger.NetWork=7,3,Console Server +Logger.Spells=8,3,Console Server +Logger.Achievements=9,3,Console Server +Logger.Conditions=10,3,Console Server +Logger.Pool=11,3,Console Server +Logger.AuctionHouse=12,3,Console Server +Logger.Battlegrounds=13,3,Console Server +Logger.OutdoorPvP=14,3,Console Server +Logger.ChatSystem=15,3,Console Server +Logger.LFG=16,3,Console Server +Logger.Maps=17,3,Console Server +Logger.Player=18,3,Console Server +Logger.PlayerLoading=19,3,Console Server +Logger.PlayerItems=20,3,Console Server +Logger.PlayerSkills=21,3,Console Server +Logger.PlayerChat=22,3,Chat +Logger.Loot=23,3,Console Server +Logger.Guilds=24,3,Console Server +Logger.Transports=25,3,Console Server +Logger.SQL=26,2,Console Server SQL +Logger.GM=27,3,Console Server GM +Logger.RA=28,3,RA +Logger.Warden=29,3,Warden +Logger.Authserver=30,3,Console Server +Logger.Worldserver=31,3,Console Server +Logger.GameEvents=32,3,Console Server +Logger.Calendar=33,3,Console Server +Logger.Character=34,3,Char +Logger.Arenas=35,3,Arenas +Logger.SQLDriver=36,5,SQLDriver +Logger.SQLDev=37,3,SQLDev + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) # -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors and SQL Driver -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# 34 - Player delete -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger +# AppenderList: List of appenders linked to logger # (Using spaces as separator). # # Appenders # Description: List of Appenders to read from config # (Using spaces as separator). # Default: "Console Server" + +Appenders=Console Server + # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). # Default: "root" -Loggers=root GM SQL -Appenders=Console Server GM SQL - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Server.Type=2 -Appender.Server.Level=2 -Appender.Server.File=Server.log -Appender.Server.Mode=w - -Appender.GM.Type=2 -Appender.GM.Level=2 -Appender.GM.File=gm_#%u.log - -Appender.SQL.Type=2 -Appender.SQL.Level=2 -Appender.SQL.File=SQL.log - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Server - -Logger.SQL.Type=26 -Logger.SQL.Level=3 -Logger.SQL.Appenders=Console Server SQL - -Logger.GM.Type=27 -Logger.GM.Level=3 -Logger.GM.Appenders=Console Server GM +Loggers=Root From 6d21515939388c5f24e3954880a21bea10c35173 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:20:24 +0200 Subject: [PATCH 026/147] Core/Logging: Implement logging to database --- sql/updates/auth/2012_08_06_00_auth_logs.sql | 2 ++ src/server/shared/Logging/AppenderDB.cpp | 27 +++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 sql/updates/auth/2012_08_06_00_auth_logs.sql diff --git a/sql/updates/auth/2012_08_06_00_auth_logs.sql b/sql/updates/auth/2012_08_06_00_auth_logs.sql new file mode 100644 index 0000000000..04e90e7d20 --- /dev/null +++ b/sql/updates/auth/2012_08_06_00_auth_logs.sql @@ -0,0 +1,2 @@ +ALTER TABLE `logs` ADD COLUMN `level` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `type`; + diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 63af917619..0254ec72bd 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -16,12 +16,7 @@ */ #include "AppenderDB.h" - -/* FIXME -#include "DatabaseWorkerPool.h" -#include "Implementation/LoginDatabase.h" // For logging -extern DatabaseWorkerPool LoginDatabase; -*/ +#include "Database/DatabaseEnv.h" AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId): Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false) @@ -32,13 +27,21 @@ AppenderDB::~AppenderDB() { } -void AppenderDB::_write(LogMessage& /*message*/) +void AppenderDB::_write(LogMessage& message) { -/* FIXME - if (enable) - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, severity, string) " - "VALUES (" UI64FMTD ", %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); -*/ + if (!enable) + return; + switch (message.type) + { + case LOG_FILTER_SQL: + case LOG_FILTER_SQL_DRIVER: + case LOG_FILTER_SQL_DEV: + break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type + default: + LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, level, string) " + "VALUES (" UI64FMTD ", %u, %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); + break; + } } void AppenderDB::setEnable(bool _enable) From 156d1e7b3c5201fd9d7c2510d2f40ec5adf90a84 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:23:09 +0200 Subject: [PATCH 027/147] Core/SQL: Kill core if error 1064 is triggered (error code 1064 you have an error in your sql syntax). This means the sql has an build error and core fix is needed --- src/server/shared/Database/MySQLConnection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 7332cb3ec0..c6d2a165ca 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -520,7 +520,11 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) ACE_OS::sleep(10); std::abort(); return false; - + case ER_PARSE_ERROR: + sLog->outError(LOG_FILTER_SQL, "Error while parsing SQL. Core fix required."); + ACE_OS::sleep(10); + std::abort(); + return false; default: sLog->outError(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); return false; From 4a5a077b655664e2daa98dfe3e7e781605734027 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:36:34 +0200 Subject: [PATCH 028/147] Core/Logging: Use prepared statements in AppenderDB --- .../shared/Database/Implementation/LoginDatabase.cpp | 2 +- src/server/shared/Logging/AppenderDB.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 028d927a72..31d9f5ec1f 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -59,7 +59,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 0254ec72bd..8836be2b24 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -37,9 +37,14 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DRIVER: case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type - default: - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, level, string) " - "VALUES (" UI64FMTD ", %u, %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); + default: + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_INS_LOG); + stmt->setUInt64(0, message.mtime); + stmt->setUInt32(1, realm); + stmt->setUInt8(2, message.type); + stmt->setUInt8(3, message.level); + stmt->setString(4, message.text); + LoginDatabase.Execute(stmt); break; } } From 5aa54ca0e97b48194376e504ad5d2b91cc8abdd1 Mon Sep 17 00:00:00 2001 From: kandera Date: Mon, 6 Aug 2012 13:02:11 -0300 Subject: [PATCH 029/147] Update src/server/shared/Logging/AppenderDB.cpp Core/Appender: fix typo --- src/server/shared/Logging/AppenderDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 8836be2b24..76abfca2d8 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -38,7 +38,7 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type default: - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_INS_LOG); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setUInt64(0, message.mtime); stmt->setUInt32(1, realm); stmt->setUInt8(2, message.type); From 429130522e223c8a5cd80d6e23fda4cc30ce5132 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 7 Aug 2012 04:21:58 +0200 Subject: [PATCH 030/147] Core/Authserver: Fix logging crash at startup --- src/server/shared/Logging/Log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index c9ba159cde..1dca5e7100 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -29,7 +29,7 @@ #include #include -Log::Log() +Log::Log() : worker(NULL) { SetRealmID(0); m_logsTimestamp = "_" + GetTimestampStr(); From f8cd39b2ed1056f409c2690ac8bb661fbcb68e18 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 7 Aug 2012 17:45:10 +0200 Subject: [PATCH 031/147] Core/Players: Improved alcohol handling, weeeeeeeeeeeeeeeee Closes #7293 --- sql/base/characters_database.sql | 2 +- .../2012_08_07_00_characters_characters.sql | 2 + src/server/game/Entities/Player/Player.cpp | 62 +++++++++---------- src/server/game/Entities/Player/Player.h | 7 +-- src/server/game/Spells/SpellEffects.cpp | 14 +++-- src/server/scripts/Commands/cs_modify.cpp | 15 ++--- 6 files changed, 49 insertions(+), 53 deletions(-) create mode 100644 sql/updates/characters/2012_08_07_00_characters_characters.sql diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index b4a3af6e8f..bbd5a70e93 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -1177,7 +1177,7 @@ CREATE TABLE `characters` ( `chosenTitle` int(10) unsigned NOT NULL DEFAULT '0', `knownCurrencies` bigint(20) unsigned NOT NULL DEFAULT '0', `watchedFaction` int(10) unsigned NOT NULL DEFAULT '0', - `drunk` smallint(5) unsigned NOT NULL DEFAULT '0', + `drunk` tinyint(3) unsigned NOT NULL DEFAULT '0', `health` int(10) unsigned NOT NULL DEFAULT '0', `power1` int(10) unsigned NOT NULL DEFAULT '0', `power2` int(10) unsigned NOT NULL DEFAULT '0', diff --git a/sql/updates/characters/2012_08_07_00_characters_characters.sql b/sql/updates/characters/2012_08_07_00_characters_characters.sql new file mode 100644 index 0000000000..e9bea82ad4 --- /dev/null +++ b/sql/updates/characters/2012_08_07_00_characters_characters.sql @@ -0,0 +1,2 @@ +UPDATE characters SET drunk = (drunk / 256) & 0xFF; +ALTER TABLE characters CHANGE drunk drunk tinyint(3) unsigned NOT NULL DEFAULT '0'; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 0731046892..72c500513c 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -726,7 +726,6 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep m_MirrorTimerFlagsLast = UNDERWATER_NONE; m_isInWater = false; m_drunkTimer = 0; - m_drunk = 0; m_restTime = 0; m_deathTimer = 0; m_deathExpireTime = 0; @@ -1458,49 +1457,51 @@ void Player::HandleDrowning(uint32 time_diff) m_MirrorTimerFlagsLast = m_MirrorTimerFlags; } -///The player sobers by 256 every 10 seconds +///The player sobers by 1% every 9 seconds void Player::HandleSobering() { m_drunkTimer = 0; - uint32 drunk = (m_drunk <= 256) ? 0 : (m_drunk - 256); + uint8 currentDrunkValue = GetDrunkValue(); + uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0; SetDrunkValue(drunk); } -DrunkenState Player::GetDrunkenstateByValue(uint16 value) +DrunkenState Player::GetDrunkenstateByValue(uint8 value) { - if (value >= 23000) + if (value >= 90) return DRUNKEN_SMASHED; - if (value >= 12800) + if (value >= 50) return DRUNKEN_DRUNK; - if (value & 0xFFFE) + if (value) return DRUNKEN_TIPSY; return DRUNKEN_SOBER; } -void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) +void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/) { - uint32 oldDrunkenState = Player::GetDrunkenstateByValue(m_drunk); + bool isSobering = newDrunkValue < GetDrunkValue(); + uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue()); + if (newDrunkValue > 100) + newDrunkValue = 100; // select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates - int32 drunkPercent = newDrunkenValue * 100 / 0xFFFF; - drunkPercent = std::max(drunkPercent, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE)); - + int32 drunkPercent = std::max(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE)); if (drunkPercent) { m_invisibilityDetect.AddFlag(INVISIBILITY_DRUNK); m_invisibilityDetect.SetValue(INVISIBILITY_DRUNK, drunkPercent); } - else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkenValue) + else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue) m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK); - m_drunk = newDrunkenValue; - SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & 0xFFFF0001) | (m_drunk & 0xFFFE)); - - uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk); - + uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue); + SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue); UpdateObjectVisibility(); + if (!isSobering) + m_drunkTimer = 0; // reset sobering timer + if (newDrunkenState == oldDrunkenState) return; @@ -1508,7 +1509,6 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) data << uint64(GetGUID()); data << uint32(newDrunkenState); data << uint32(itemId); - SendMessageToSet(&data, true); } @@ -1749,11 +1749,10 @@ void Player::Update(uint32 p_time) m_Last_tick = now; } - if (m_drunk) + if (GetDrunkValue()) { m_drunkTimer += p_time; - - if (m_drunkTimer > 10*IN_MILLISECONDS) + if (m_drunkTimer > 9 * IN_MILLISECONDS) HandleSobering(); } @@ -16748,7 +16747,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32()); SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32()); - SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8()); + SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8()); + SetByteValue(PLAYER_BYTES_3, 1, fields[49].GetUInt8()); SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32()); SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32()); @@ -17058,13 +17058,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // set value, including drunk invisibility detection // calculate sobering. after 15 minutes logged out, the player will be sober again - float soberFactor; - if (time_diff > 15*MINUTE) - soberFactor = 0; - else - soberFactor = 1-time_diff/(15.0f*MINUTE); - uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); - SetDrunkValue(newDrunkenValue); + uint8 newDrunkValue = 0; + if (time_diff < GetDrunkValue() * 9) + newDrunkValue = GetDrunkValue() - time_diff / 9; + + SetDrunkValue(newDrunkValue); m_cinematic = fields[18].GetUInt8(); m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32(); @@ -18658,7 +18656,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE)); stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES)); stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX)); - stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); + stmt->setUInt8(index++, GetDrunkValue()); stmt->setUInt32(index++, GetHealth()); for (uint32 i = 0; i < MAX_POWERS; ++i) @@ -18769,7 +18767,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE)); stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES)); stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX)); - stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); + stmt->setUInt8(index++, GetDrunkValue()); stmt->setUInt32(index++, GetHealth()); for (uint32 i = 0; i < MAX_POWERS; ++i) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 774e75104b..413d7fae32 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2050,9 +2050,9 @@ class Player : public Unit, public GridObject inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; } - void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0); - uint16 GetDrunkValue() const { return m_drunk; } - static DrunkenState GetDrunkenstateByValue(uint16 value); + void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0); + uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); } + static DrunkenState GetDrunkenstateByValue(uint8 value); uint32 GetDeathTimer() const { return m_deathTimer; } uint32 GetCorpseReclaimDelay(bool pvp) const; @@ -2720,7 +2720,6 @@ class Player : public Unit, public GridObject time_t m_lastDailyQuestTime; uint32 m_drunkTimer; - uint16 m_drunk; uint32 m_weaponChangeTimer; uint32 m_zoneUpdateId; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 484d03f150..d30f6e593d 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4772,16 +4772,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player* player = (Player*)unitTarget; - uint16 currentDrunk = player->GetDrunkValue(); - uint16 drunkMod = damage * 256; - if (currentDrunk + drunkMod > 0xFFFF) + Player* player = unitTarget->ToPlayer(); + uint8 currentDrunk = player->GetDrunkValue(); + uint8 drunkMod = damage; + if (currentDrunk + drunkMod > 100) { - currentDrunk = 0xFFFF; - player->CastSpell(player, 67468, false); + currentDrunk = 100; + if (rand_chance() < 25.0f) + player->CastSpell(player, 67468, false); // Drunken Vomit } else currentDrunk += drunkMod; + player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0); } diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 1747b80efd..a88c765c59 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1130,20 +1130,15 @@ public: static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args) { - if (!*args) return false; + if (!*args) + return false; - uint32 drunklevel = (uint32)atoi(args); + uint8 drunklevel = (uint8)atoi(args); if (drunklevel > 100) drunklevel = 100; - uint16 drunkMod = drunklevel * 0xFFFF / 100; - - Player* target = handler->getSelectedPlayer(); - if (!target) - target = handler->GetSession()->GetPlayer(); - - if (target) - target->SetDrunkValue(drunkMod); + if (Player* target = handler->getSelectedPlayer()) + target->SetDrunkValue(drunklevel); return true; } From f87655b9167008a3051a980ddff7d43b14ccb0da Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Thu, 9 Aug 2012 09:32:33 +0200 Subject: [PATCH 032/147] DB/Misc: add npcflag for 0b98656b2878e1a6f644e1cd8b7745370efc488b (thx Vincent-Michael) DB/Loot: add missing recipe to loot --- sql/updates/world/2012_08_09_00_world_creature_template.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sql/updates/world/2012_08_09_00_world_creature_template.sql diff --git a/sql/updates/world/2012_08_09_00_world_creature_template.sql b/sql/updates/world/2012_08_09_00_world_creature_template.sql new file mode 100644 index 0000000000..8d04c13dc8 --- /dev/null +++ b/sql/updates/world/2012_08_09_00_world_creature_template.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `npcflag`=`npcflag` |2 WHERE `entry` IN (25918,25929,25931,25933,25936,25938,25946,32811,32812,32813,32816); + +DELETE FROM `creature_loot_template` WHERE `entry` IN(17465,20583) AND `item`=22554; +INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +(17465,22554,15,1,0,1,1), -- Formula: Enchant 2H Weapon - Savagery +(20583,22554,15,1,0,1,1); -- Formula: Enchant 2H Weapon - Savagery From 78fdeca8518506328209654d1fa503a7cd649ff1 Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 9 Aug 2012 12:54:35 +0200 Subject: [PATCH 033/147] Core/Logging: Fix crash in AppenderFile deconstructor when logfile is uninitialized --- src/server/shared/Logging/AppenderFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index d66771b905..d47a7c4028 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -26,8 +26,8 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co { dynamicName = std::string::npos != filename.find("%u"); backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; - if (!dynamicName) - logfile = OpenFile(_filename, _mode, backup); + + logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL; } AppenderFile::~AppenderFile() From ca0a54f3572e91f75f880ff9b8e74c450f7d9c36 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 9 Aug 2012 14:31:09 +0200 Subject: [PATCH 034/147] Core/Logging: Fixed a possible crash with dynamic log file names --- src/server/shared/Logging/Appender.h | 2 +- src/server/shared/Logging/AppenderFile.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 7d7375a1ed..332edbf170 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -139,7 +139,7 @@ class Appender static const char* getLogFilterTypeString(LogFilterType type); private: - virtual void _write(LogMessage& /*message*/) {}; + virtual void _write(LogMessage& /*message*/) = 0; uint8 id; std::string name; diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index d47a7c4028..01a2f34baa 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -26,7 +26,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co { dynamicName = std::string::npos != filename.find("%u"); backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; - + logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL; } @@ -54,7 +54,10 @@ void AppenderFile::_write(LogMessage& message) fflush(logfile); if (dynamicName) + { fclose(logfile); + logfile = NULL; + } } } From 8585df1c1946f5f4f61e80bf877821871a1fb364 Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Thu, 9 Aug 2012 22:05:25 +0100 Subject: [PATCH 035/147] DB/SAI: Fix quest Territorial Trespass --- sql/updates/world/2012_08_09_01_world_sai.sql | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sql/updates/world/2012_08_09_01_world_sai.sql diff --git a/sql/updates/world/2012_08_09_01_world_sai.sql b/sql/updates/world/2012_08_09_01_world_sai.sql new file mode 100644 index 0000000000..94dce1bcc2 --- /dev/null +++ b/sql/updates/world/2012_08_09_01_world_sai.sql @@ -0,0 +1,48 @@ +-- Territorial Trespass (13051) + +SET @NPC_VERANUS := 30461; +SET @QUEST := 13051; +SET @EVENT := 19714; +SET @NPC_THORIM := 30462; +SET @SPELL_MOUNT := 43671; + +UPDATE `creature_template` SET `HoverHeight`=10.8,`speed_walk`=3.2,`speed_run`=1.42857146263123,`VehicleId`=237,`minlevel`=80,`faction_A`=14,`faction_H`=14,`unit_flags`=0x8140,`InhabitType`=5 WHERE `entry`=@NPC_VERANUS; + +DELETE FROM `creature_template_addon` WHERE `entry`=@NPC_VERANUS; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES +(@NPC_VERANUS,0,0x3000000,0x1,''); + +DELETE FROM `creature_text` WHERE `entry` IN (@NPC_VERANUS,@NPC_THORIM); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_VERANUS,0,0,'%s lets out a bellowing roar as she descends upon the nest.',16,0,100,15,0,0,'Veranus'), +(@NPC_THORIM,0,0,'Look out below!',14,0,100,0,0,0,'Thorim'), +(@NPC_THORIM,1,0,'Easy there, girl! Don''t you recognize your old master?',12,0,100,0,0,0,'Thorim'), +(@NPC_THORIM,2,0,'I will see you at the Temple of Storms. Looks like I''m going to have to break her in again.',12,0,100,0,0,0,'Thorim'); + +-- Veranus SAI +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@NPC_VERANUS,@NPC_THORIM); +DELETE FROM `smart_scripts` WHERE (`entryorguid` IN (@NPC_VERANUS,@NPC_THORIM) AND `source_type`=0) OR (`entryorguid`=@NPC_THORIM*100 AND `source_type`=9); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@NPC_VERANUS,0,0,0,54,0,100,0,0,0,0,0,53,1,@NPC_VERANUS,0,@QUEST,0,0,1,0,0,0,0,0,0,0,'Veranus - On Summoned - Start WP-Movement'), +(@NPC_VERANUS,0,1,2,58,0,100,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veranus - On WP-End - Talk(emote)'), +(@NPC_VERANUS,0,2,3,61,0,100,0,1,0,0,0,33,@NPC_VERANUS,0,0,0,0,0,7,0,0,0,0,0,0,0,'Veranus - On WP-End - Give quest credit'), +(@NPC_VERANUS,0,3,0,61,0,100,0,0,0,0,0,12,@NPC_THORIM,8,0,0,0,0,8,0,0,0,7096.863,-904.658,1119.904,2.338741,'Veranus - On WP-End - Summon Thorim'), +(@NPC_VERANUS,0,4,5,38,0,100,0,1,1,0,0,46,100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veranus - On data - Move forward'), +(@NPC_VERANUS,0,5,0,61,0,100,0,0,0,0,0,41,10000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veranus - On data - despawn'), +-- +(@NPC_THORIM,0,0,0,54,0,100,0,0,0,0,0,80,@NPC_THORIM*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Summoned - Start script'), +(@NPC_THORIM,0,1,0,38,0,100,0,1,1,0,0,41,10000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On data - despawn'), +(@NPC_THORIM*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Talk(yell)'), +(@NPC_THORIM*100,9,1,0,0,0,100,0,0,0,0,0,11,@SPELL_MOUNT,0,0,0,0,0,7,0,0,0,0,0,0,0,'Thorim - On Script - Cast spell mount'), +(@NPC_THORIM*100,9,2,0,0,0,100,0,10000,10000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Talk(say)'), +(@NPC_THORIM*100,9,3,0,0,0,100,0,5000,5000,0,0,1,2,1000,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Talk(say)'), +(@NPC_THORIM*100,9,4,0,0,0,100,0,0,0,0,0,45,1,1,0,0,0,0,7,0,0,0,0,0,0,0,'Thorim - On Script - Set data'), +(@NPC_THORIM*100,9,5,0,0,0,100,0,0,0,0,0,45,1,1,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Set data'); + +DELETE FROM `waypoints` WHERE `entry`=@NPC_VERANUS; +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@NPC_VERANUS,1,7083.224,-912.2372,1090.213,'Veranus - WP1'); + +DELETE FROM `event_scripts` WHERE `id`=@EVENT; +INSERT INTO `event_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES +(@EVENT,0,10,@NPC_VERANUS,600000,0,6947.481,-859.5176,1147.604,5.674867); From f57531376b9ae17f2f290604041ec4b2086621e5 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 10 Aug 2012 03:03:52 +0100 Subject: [PATCH 036/147] DB/Conditions: Fix startup db errors Closes #7334 --- sql/updates/world/2012_08_10_00_world_conditions.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sql/updates/world/2012_08_10_00_world_conditions.sql diff --git a/sql/updates/world/2012_08_10_00_world_conditions.sql b/sql/updates/world/2012_08_10_00_world_conditions.sql new file mode 100644 index 0000000000..14c5c570b6 --- /dev/null +++ b/sql/updates/world/2012_08_10_00_world_conditions.sql @@ -0,0 +1,7 @@ +SET @ENTRY := 27482; -- Wounded Westfall Infantry npc +SET @SPELL := 48845; -- Renew Infantry spell +SET @ITEM := 37576; -- Renewing Bandage item +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceEntry`=@ITEM; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=@SPELL; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,@SPELL,0,31,1,3,@ENTRY,0,0,0,'', "Item Renewing Bandage target Wounded Westfall Infantry"); From 2f6b08807dbab89777c0d2f3ab015fc03c029cd7 Mon Sep 17 00:00:00 2001 From: nelegalno Date: Fri, 10 Aug 2012 03:06:32 +0100 Subject: [PATCH 037/147] DB/Loot: Loot fixes for Temple of Ahn'Qiraj boses Closes #7335 --- .../2012_08_10_01_world_loot_template.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 sql/updates/world/2012_08_10_01_world_loot_template.sql diff --git a/sql/updates/world/2012_08_10_01_world_loot_template.sql b/sql/updates/world/2012_08_10_01_world_loot_template.sql new file mode 100644 index 0000000000..07d400dc0d --- /dev/null +++ b/sql/updates/world/2012_08_10_01_world_loot_template.sql @@ -0,0 +1,25 @@ +-- Emperor Vek'nilash update loot chance based on http://old.wowhead.com/npc=15275#drops:0+1-15 by nelegalno +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21606; -- Belt of the Fallen Emperor +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=12 WHERE `entry`=15275 AND `item`=21604; -- Bracelets of Royal Redemption +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21605; -- Gloves of the Hidden Temple +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21607; -- Grasp of the Fallen Emperor +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 7 WHERE `entry`=15275 AND `item`=21679; -- Kalimdor's Revenge +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21609; -- Regenerating Belt of Vek'nilash +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=63 WHERE `entry`=15275 AND `item`=20726; -- Formula: Enchant Gloves - Threat + +-- Emperor Vek'lor update loot chance based on http://old.wowhead.com/npc=15276#drops:0+1-15 by nelegalno +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15276 AND `item`=21600; -- Boots of Epiphany +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=13 WHERE `entry`=15276 AND `item`=21602; -- Qiraji Execution Bracers +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=13 WHERE `entry`=15276 AND `item`=21601; -- Ring of Emperor Vek'lor +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=14 WHERE `entry`=15276 AND `item`=21598; -- Royal Qiraji Belt +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 7 WHERE `entry`=15276 AND `item`=21597; -- Royal Scepter of Vek'lor +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=13 WHERE `entry`=15276 AND `item`=21599; -- Vek'lor's Gloves of Devastation +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=64 WHERE `entry`=15276 AND `item`=20735; -- Formula: Enchant Cloak - Subtlety + +-- Princess Huhuran update loot chance based on http://old.wowhead.com/npc=15509#drops:0+1-15 by nelegalno +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=15 WHERE `entry`=15509 AND `item`=21621; -- Cloak of the Golden Hive +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=15 WHERE `entry`=15509 AND `item`=21619; -- Gloves of the Messiah +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=16 WHERE `entry`=15509 AND `item`=21618; -- Hive Defiler Wristguards +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 8 WHERE `entry`=15509 AND `item`=21616; -- Huhuran's Stinger +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=17 WHERE `entry`=15509 AND `item`=21620; -- Ring of the Martyr +UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=14 WHERE `entry`=15509 AND `item`=21617; -- Wasphide Gauntlets From 41682b59a39a6645c85098ec49fce29fba5a4f42 Mon Sep 17 00:00:00 2001 From: Kinzcool Date: Fri, 10 Aug 2012 03:07:46 +0100 Subject: [PATCH 038/147] DB/Scripts: Add missing sounds to npc 29309 Closes #7305 --- sql/updates/world/2012_08_10_02_world_script_texts.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sql/updates/world/2012_08_10_02_world_script_texts.sql diff --git a/sql/updates/world/2012_08_10_02_world_script_texts.sql b/sql/updates/world/2012_08_10_02_world_script_texts.sql new file mode 100644 index 0000000000..0b97df592e --- /dev/null +++ b/sql/updates/world/2012_08_10_02_world_script_texts.sql @@ -0,0 +1,6 @@ +UPDATE `script_texts` SET `sound`=14036 WHERE `entry` = -1619015; +UPDATE `script_texts` SET `sound`=14037 WHERE `entry` = -1619016; +UPDATE `script_texts` SET `sound`=14038 WHERE `entry` = -1619017; +UPDATE `script_texts` SET `sound`=14039 WHERE `entry` = -1619018; +UPDATE `script_texts` SET `sound`=14034 WHERE `entry` = -1619019; +UPDATE `script_texts` SET `sound`=14035 WHERE `entry` = -1619020; From 76f0e87263a17d648f37be727954066ad6055f0a Mon Sep 17 00:00:00 2001 From: nelegalno Date: Fri, 10 Aug 2012 03:18:04 +0100 Subject: [PATCH 039/147] DB/Quests: Zandalar Tribe Quests Required Class/Race FIX Closes #7322 --- .../2012_08_10_03_world_quest_template.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sql/updates/world/2012_08_10_03_world_quest_template.sql diff --git a/sql/updates/world/2012_08_10_03_world_quest_template.sql b/sql/updates/world/2012_08_10_03_world_quest_template.sql new file mode 100644 index 0000000000..c4aebf5ba1 --- /dev/null +++ b/sql/updates/world/2012_08_10_03_world_quest_template.sql @@ -0,0 +1,18 @@ +-- Zandalar Tribe Quests Required Class/Race fix by nelegalno + +-- Maywiki of Zuldazar Quests Required Class +UPDATE `quest_template` SET `RequiredClasses` = 64 WHERE `Id` IN (8056,8074,8075,8116,8117,8118,8119); -- Shaman +UPDATE `quest_template` SET `RequiredClasses` = 1024 WHERE `Id` IN (8057,8064,8065,8110,8111,8112,8113); -- Druid + +-- Al'tabim the All-Seeing Quests Required Class +UPDATE `quest_template` SET `RequiredClasses` = 16 WHERE `Id` IN (8049,8050,8051,8052,8061,8070,8071); -- Priest +UPDATE `quest_template` SET `RequiredClasses` = 128 WHERE `Id` IN (8060,8068,8069,8101,8102,8103,8104); -- Mage +UPDATE `quest_template` SET `RequiredClasses` = 256 WHERE `Id` IN (8059,8076,8077,8106,8107,8108,8109); -- Warlock + +-- Falthir the Sightless Quests Required Class +UPDATE `quest_template` SET `RequiredClasses` = 4 WHERE `Id` IN (8062,8066,8067,8145,8146,8147,8148); -- Hunter +UPDATE `quest_template` SET `RequiredClasses` = 8 WHERE `Id` IN (8063,8072,8073,8141,8142,8143,8144); -- Rogue +UPDATE `quest_template` SET `RequiredRaces` = 152 WHERE `Id` = 8144; -- Night Elf, Undead and Troll + +-- Jin'rokh the Breaker +UPDATE `quest_template` SET `RequiredRaces` = 513 WHERE `Id` = 8048; -- Human and Blood Elf From 6dd1e198cdd306be524de9f5274684033578b0ca Mon Sep 17 00:00:00 2001 From: RedSonja Date: Fri, 10 Aug 2012 03:24:45 +0100 Subject: [PATCH 040/147] DB/NPCs: Fix Barim Splithoof leather trainer gossip options Closes #2677 --- sql/updates/world/2012_08_10_04_world_gossip.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sql/updates/world/2012_08_10_04_world_gossip.sql diff --git a/sql/updates/world/2012_08_10_04_world_gossip.sql b/sql/updates/world/2012_08_10_04_world_gossip.sql new file mode 100644 index 0000000000..a2082447df --- /dev/null +++ b/sql/updates/world/2012_08_10_04_world_gossip.sql @@ -0,0 +1,5 @@ +-- -18754 Barim Splithoof Leather working trainer +DELETE FROM `gossip_menu_option` WHERE `menu_id`=7816; +INSERT INTO `gossip_menu_option` VALUES +(7816,0,3, 'I would like to train.', 5,16,0,0,0,0,NULL), +(7816,1,1, 'Let me browse your goods.', 3,128,0,0,0,0,NULL); From 68453c69b7577f6b17aedd82b8c177dcead2cc7d Mon Sep 17 00:00:00 2001 From: gecko32 Date: Fri, 10 Aug 2012 03:37:03 +0100 Subject: [PATCH 041/147] DB/Quests: Fix a typo in Message to Freewind Post description Closes #7340 --- sql/updates/world/2012_08_10_05_world_quest_template.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2012_08_10_05_world_quest_template.sql diff --git a/sql/updates/world/2012_08_10_05_world_quest_template.sql b/sql/updates/world/2012_08_10_05_world_quest_template.sql new file mode 100644 index 0000000000..a65e7e76a4 --- /dev/null +++ b/sql/updates/world/2012_08_10_05_world_quest_template.sql @@ -0,0 +1,2 @@ +-- Change $B$$B at end of details text to $B$B +UPDATE `quest_template` SET `Details`='Brave traveler, the centaurs have increased their attacks in this area. Freewind Post must know about this renewed harassment immediately! Seek Cliffwatcher Longhorn at Freewind Post to the southeast and give him this urgent message.$b$bBe warned, avoid the Grimtotem Clan nearby... they have been acting strange toward us lately.$B$B' WHERE `Id`=4542; From 53bc7c2ff5facfe0abddbba4d26ed6462974052c Mon Sep 17 00:00:00 2001 From: Svannon Date: Fri, 10 Aug 2012 03:59:12 +0100 Subject: [PATCH 042/147] DB/NPCs: Add missing Tracker Val'zij spawn Closes #2662 --- .../world/2012_08_10_06_world_creature.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sql/updates/world/2012_08_10_06_world_creature.sql diff --git a/sql/updates/world/2012_08_10_06_world_creature.sql b/sql/updates/world/2012_08_10_06_world_creature.sql new file mode 100644 index 0000000000..3d59f06db7 --- /dev/null +++ b/sql/updates/world/2012_08_10_06_world_creature.sql @@ -0,0 +1,16 @@ +SET @CGUID:=42571; -- Need 2 +DELETE FROM `creature` WHERE `id` IN (30395,30469); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES +(@CGUID+0,30395,571,1,1,0,0,8348.886,-2509.476,1147.369,3.700098,120,0,0,12600,0,0,0,0,0), +(@CGUID+1,30469,571,1,1,0,0,7620.369,-1609.421,969.6507,0.767944,120,0,0,12600,0,0,0,0,0); + +-- Template updates +UPDATE `creature_template` SET `npcflag`=`npcflag`|3 WHERE `entry`=30395; -- Chieftain Swiftspear +UPDATE `creature_template` SET `faction_A`=1978,`faction_H`=1978 WHERE `entry`=30469; -- Tracker Val'zij +-- Model data +UPDATE `creature_model_info` SET `bounding_radius`=0.6076385,`combat_reach`=2.625,`gender`=0 WHERE `modelid`=27004; -- Chieftain Swiftspear +-- Addon data +DELETE FROM `creature_template_addon` WHERE `entry`IN (30395,30469); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(30395,0,0,1,0, NULL), -- Chieftain Swiftspear +(30469,0,8,1,0, NULL); -- Tracker Val'zij From c8b3812940d87ce7cae80a666358f1c79e117433 Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Sat, 11 Aug 2012 12:12:51 +0200 Subject: [PATCH 043/147] Db/Loot: assign lootid to npc --- sql/updates/world/2012_08_11_00_world_creature_template.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 sql/updates/world/2012_08_11_00_world_creature_template.sql diff --git a/sql/updates/world/2012_08_11_00_world_creature_template.sql b/sql/updates/world/2012_08_11_00_world_creature_template.sql new file mode 100644 index 0000000000..972b125d24 --- /dev/null +++ b/sql/updates/world/2012_08_11_00_world_creature_template.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `lootid`=`entry` WHERE `entry` IN (17465,20583); From 04ee08acd2723ce06e7cebdabed0ef09d55b44a0 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 11 Aug 2012 14:43:26 +0100 Subject: [PATCH 044/147] DB/Schema: Add primary keys to quest_poi and quest_poi_points tables --- .../world/2012_08_11_01_world_quest_poi.sql | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sql/updates/world/2012_08_11_01_world_quest_poi.sql diff --git a/sql/updates/world/2012_08_11_01_world_quest_poi.sql b/sql/updates/world/2012_08_11_01_world_quest_poi.sql new file mode 100644 index 0000000000..6672df2bc9 --- /dev/null +++ b/sql/updates/world/2012_08_11_01_world_quest_poi.sql @@ -0,0 +1,60 @@ +-- PK and new index for quest_poi +ALTER TABLE `quest_poi` DROP INDEX `questId`; +ALTER TABLE `quest_poi` DROP INDEX `id`; +ALTER TABLE `quest_poi` ADD PRIMARY KEY (`questId`, `id`); +ALTER TABLE `quest_poi` ADD INDEX `idx` (`questId`, `id`); + +-- Correct data for quest_poi_points that violate the PK +UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=0 AND `x`=-1041 AND `y`=-5585; +UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25446 AND `id`=0 AND `x`=-1062 AND `y`=-5631; +UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25446 AND `id`=0 AND `x`=-1066 AND `y`=-5375; +UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25446 AND `id`=0 AND `x`=-1189 AND `y`=-5343; +UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25446 AND `id`=0 AND `x`=-1195 AND `y`=-5618; +UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25446 AND `id`=0 AND `x`=-1269 AND `y`=-5386; +UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25446 AND `id`=0 AND `x`=-1289 AND `y`=-5571; +UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25446 AND `id`=0 AND `x`=-1320 AND `y`=-5477; +UPDATE `quest_poi_points` SET `idx`=8 WHERE `questId`=25446 AND `id`=0 AND `x`=-1322 AND `y`=-5527; +UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=1 AND `x`=-1502 AND `y`=-5263; +UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25446 AND `id`=1 AND `x`=-1532 AND `y`=-5341; +UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25446 AND `id`=1 AND `x`=-1589 AND `y`=-5340; +UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25446 AND `id`=1 AND `x`=-1611 AND `y`=-5276; +UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25446 AND `id`=2 AND `x`=-1020 AND `y`=-5153; +UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25446 AND `id`=2 AND `x`=-1089 AND `y`=-5174; +UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25446 AND `id`=2 AND `x`=-1128 AND `y`=-5131; +UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25446 AND `id`=2 AND `x`=-0955 AND `y`=-5186; +UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=3 AND `x`=-0654 AND `y`=-5627; +UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25446 AND `id`=3 AND `x`=-0688 AND `y`=-5518; +UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25446 AND `id`=3 AND `x`=-0730 AND `y`=-5656; +UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25446 AND `id`=3 AND `x`=-0732 AND `y`=-5499; +UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25446 AND `id`=3 AND `x`=-0795 AND `y`=-5544; +UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25446 AND `id`=3 AND `x`=-0806 AND `y`=-5674; +UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25446 AND `id`=3 AND `x`=-0835 AND `y`=-5606; +UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=4 AND `x`=-0747 AND `y`=-5004; + +UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25461 AND `x`=246 AND `y`=-4715; +UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25461 AND `x`=247 AND `y`=-4675; +UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25461 AND `x`=248 AND `y`=-4673; +UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25461 AND `x`=266 AND `y`=-4830; +UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25461 AND `x`=284 AND `y`=-4628; +UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25461 AND `x`=302 AND `y`=-4612; +UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25461 AND `x`=343 AND `y`=-4831; +UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25461 AND `x`=345 AND `y`=-4831; +UPDATE `quest_poi_points` SET `idx`=8 WHERE `questId`=25461 AND `x`=376 AND `y`=-4778; +UPDATE `quest_poi_points` SET `idx`=9 WHERE `questId`=25461 AND `x`=380 AND `y`=-4661; +UPDATE `quest_poi_points` SET `idx`=10 WHERE `questId`=25461 AND `x`=411 AND `y`=-4704; + +UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25444 AND `x`=-1014 AND `y`=-4911; +UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25444 AND `x`=-0644 AND `y`=-4999; +UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25444 AND `x`=-0673 AND `y`=-4932; +UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25444 AND `x`=-0673 AND `y`=-5062; +UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25444 AND `x`=-0736 AND `y`=-5100; +UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25444 AND `x`=-0740 AND `y`=-4873; +UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25444 AND `x`=-0808 AND `y`=-4831; +UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25444 AND `x`=-0808 AND `y`=-5100; +UPDATE `quest_poi_points` SET `idx`=8 WHERE `questId`=25444 AND `x`=-0887 AND `y`=-5062; +UPDATE `quest_poi_points` SET `idx`=9 WHERE `questId`=25444 AND `x`=-0892 AND `y`=-4776; +UPDATE `quest_poi_points` SET `idx`=10 WHERE `questId`=25444 AND `x`=-0959 AND `y`=-4995; +UPDATE `quest_poi_points` SET `idx`=11 WHERE `questId`=25444 AND `x`=-0984 AND `y`=-4785; + +-- PK for quest_poi_points +ALTER TABLE `quest_poi_points` ADD PRIMARY KEY (`questId`, `id`, `idx`); From a3adf6a2b95427b7e6322b62e53a2fbf6ced7871 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 11 Aug 2012 16:53:43 +0200 Subject: [PATCH 045/147] Scripts/Grizzly Hills: Fix uninitialized variable in npc_venture_co_straggler. minor cleanup --- .../scripts/Northrend/grizzly_hills.cpp | 149 +++++++++--------- 1 file changed, 74 insertions(+), 75 deletions(-) diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 1a0f6b5737..4ca12bc82a 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -600,100 +600,99 @@ enum eSmokeEmOut QUEST_SMOKE_EM_OUT_H = 12324, SPELL_SMOKE_BOMB = 49075, SPELL_CHOP = 43410, - NPC_VENTURE_CO_STABLES_KC = 27568, + SPELL_VENTURE_STRAGGLER_CREDIT = 49093, }; class npc_venture_co_straggler : public CreatureScript { -public: - npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { } + public: + npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_venture_co_stragglerAI(creature); - } - - struct npc_venture_co_stragglerAI : public ScriptedAI - { - npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { } - - uint64 uiPlayerGUID; - uint32 uiRunAwayTimer; - uint32 uiTimer; - uint32 uiChopTimer; - - void Reset() + struct npc_venture_co_stragglerAI : public ScriptedAI { - uiPlayerGUID = 0; - uiTimer = 0; - uiChopTimer = urand(10000, 12500); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - } + npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { } - void UpdateAI(const uint32 uiDiff) - { - if (uiRunAwayTimer <= uiDiff) + uint64 uiPlayerGUID; + uint32 uiRunAwayTimer; + uint32 uiTimer; + uint32 uiChopTimer; + + void Reset() { - if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID)) + uiPlayerGUID = 0; + uiTimer = 0; + uiRunAwayTimer = 0; + uiChopTimer = urand(10000, 12500); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_AGGRESSIVE); + } + + void UpdateAI(const uint32 uiDiff) + { + if (uiPlayerGUID && uiRunAwayTimer <= uiDiff) { - switch (uiTimer) + if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID)) { - case 0: - if (player->GetQuestStatus(QUEST_SMOKE_EM_OUT_A) == QUEST_STATUS_INCOMPLETE || - player->GetQuestStatus(QUEST_SMOKE_EM_OUT_H) == QUEST_STATUS_INCOMPLETE) - player->KilledMonsterCredit(NPC_VENTURE_CO_STABLES_KC, 0); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ()); - uiRunAwayTimer = 2500; - ++uiTimer; - break; - case 1: - DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ()); - uiRunAwayTimer = 2500; - ++uiTimer; - break; - case 2: - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ()); - uiRunAwayTimer = 2500; - ++uiTimer; - break; - case 3: - me->DisappearAndDie(); - uiTimer = 0; - break; + switch (uiTimer) + { + case 0: + DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ()); + uiRunAwayTimer = 2500; + ++uiTimer; + break; + case 1: + DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ()); + uiRunAwayTimer = 2500; + ++uiTimer; + break; + case 2: + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ()); + uiRunAwayTimer = 2500; + ++uiTimer; + break; + case 3: + me->DisappearAndDie(); + uiTimer = 0; + break; + } } } + else if (uiRunAwayTimer) + uiRunAwayTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + if (uiChopTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CHOP); + uiChopTimer = urand(10000, 12000); + } + else + uiChopTimer -= uiDiff; + + DoMeleeAttackIfReady(); } - else - uiRunAwayTimer -= uiDiff; - if (!UpdateVictim()) - return; - - if (uiChopTimer <= uiDiff) + void SpellHit(Unit* caster, SpellInfo const* spell) { - DoCast(me->getVictim(), SPELL_CHOP); - uiChopTimer = urand(10000, 12000); + if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_PASSIVE); + me->CombatStop(false); + uiPlayerGUID = caster->GetGUID(); + uiRunAwayTimer = 3500; + } } - else - uiChopTimer -= uiDiff; + }; - DoMeleeAttackIfReady(); - } - - void SpellHit(Unit* pCaster, const SpellInfo* pSpell) + CreatureAI* GetAI(Creature* creature) const { - if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - me->CombatStop(false); - uiPlayerGUID = pCaster->GetGUID(); - uiRunAwayTimer = 3500; - } + return new npc_venture_co_stragglerAI(creature); } - }; }; void AddSC_grizzly_hills() From a55f00a2ad0ab094a0c97652e7a05f9c8553547a Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 12 Aug 2012 04:20:58 +0200 Subject: [PATCH 046/147] Update sql/base/auth_database.sql --- sql/base/auth_database.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql index 14aaa4658e..a052a74c83 100644 --- a/sql/base/auth_database.sql +++ b/sql/base/auth_database.sql @@ -143,6 +143,7 @@ CREATE TABLE `logs` ( `time` int(10) unsigned NOT NULL, `realm` int(10) unsigned NOT NULL, `type` tinyint(3) unsigned NOT NULL, + `level` tinyint(3) unsigned NOT NULL DEFAULT '0', `string` text CHARACTER SET latin1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; From 666602e1aad855d80ff0657ad80ffe60f5054ea9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 12 Aug 2012 13:56:43 +0200 Subject: [PATCH 047/147] Scripts: Fixed some unitialized variables --- src/server/scripts/Kalimdor/moonglade.cpp | 5 ++++- .../scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 9df208d257..3c8d226790 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -296,7 +296,10 @@ public: struct npc_clintar_spiritAI : public npc_escortAI { public: - npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {} + npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) + { + PlayerGUID = 0; + } uint8 Step; uint32 CurrWP; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 654d763ddb..2f37fb06f2 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -134,6 +134,7 @@ class instance_ulduar : public InstanceMapScript elderCount = 0; conSpeedAtory = false; Unbroken = true; + _algalonSummoned = false; _summonAlgalon = false; memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID)); From da229008bb1e9c1c548cdc0052b978a1394a53d2 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 12 Aug 2012 13:03:27 +0200 Subject: [PATCH 048/147] Scripts/The Culling of Stratholme: Fix quest credit for Mal'Ganis --- sql/updates/world/2012_08_12_00_world_conditions.sql | 3 +++ .../CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2012_08_12_00_world_conditions.sql diff --git a/sql/updates/world/2012_08_12_00_world_conditions.sql b/sql/updates/world/2012_08_12_00_world_conditions.sql new file mode 100644 index 0000000000..6e1fd0ac1d --- /dev/null +++ b/sql/updates/world/2012_08_12_00_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=58124; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,58124,0,0,32,0,0x90,0,0,0,0,'','Mal''Ganis Kill Credit - Player target'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index d4359a100b..88b2a76667 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -36,6 +36,7 @@ enum Spells SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. H_SPELL_SLEEP = 58849, SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack. + SPELL_MAL_GANIS_KILL_CREDIT = 58124, // Quest credit SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc }; @@ -238,9 +239,9 @@ public: if (instance) { instance->SetData(DATA_MAL_GANIS_EVENT, DONE); - + DoCastAOE(SPELL_MAL_GANIS_KILL_CREDIT); // give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc - DoCast(me, SPELL_KILL_CREDIT); + DoCastAOE(SPELL_KILL_CREDIT); } } From 7d29e585df3c16b22a7177d43e3ec1e1136a4ad4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 12 Aug 2012 14:16:11 +0200 Subject: [PATCH 049/147] Scripts/Karazhan: Fixed some uninitialized variables --- .../EasternKingdoms/Karazhan/boss_moroes.cpp | 22 +++++-------------- .../Karazhan/boss_prince_malchezaar.cpp | 4 ++++ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index bc29a6f1f3..06c1243645 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -75,8 +75,8 @@ public: { boss_moroesAI(Creature* creature) : ScriptedAI(creature) { - for (uint8 i = 0; i < 4; ++i) - AddId[i] = 0; + memset(AddId, 0, sizeof(AddId)); + memset(AddGUID, 0, sizeof(AddGUID)); instance = creature->GetInstanceScript(); } @@ -105,10 +105,8 @@ public: Enrage = false; InVanish = false; - if (me->GetHealth() > 0) - { + if (me->GetHealth()) SpawnAdds(); - } if (instance) instance->SetData(TYPE_MOROES, NOT_STARTED); @@ -193,10 +191,9 @@ public: bool isAddlistEmpty() { for (uint8 i = 0; i < 4; ++i) - { if (AddId[i] == 0) return true; - } + return false; } @@ -341,17 +338,10 @@ struct boss_moroes_guestAI : public ScriptedAI if (!instance) return; - uint64 MoroesGUID = instance->GetData64(DATA_MOROES); - Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID)); - if (Moroes) - { + if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES))) for (uint8 i = 0; i < 4; ++i) - { - uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]; - if (GUID) + if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) GuestGUID[i] = GUID; - } - } } Unit* SelectGuestTarget() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 1ed4da1f25..d5add0f0bb 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -187,6 +187,7 @@ public: boss_malchezaarAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); + memset(axes, 0, sizeof(axes)); } InstanceScript* instance; @@ -218,7 +219,10 @@ public: positions.clear(); for (uint8 i = 0; i < 5; ++i) + { enfeeble_targets[i] = 0; + enfeeble_health[i] = 0; + } for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); From bd37e73fdf61bae823bdc174b261f6f185ca0b12 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 12 Aug 2012 17:19:47 +0100 Subject: [PATCH 050/147] SQL: Rename 2 PR'ed SQL files --- ...cript_names.sql => 2012_08_12_01_world_spell_script_names.sql} | 0 ...cript_names.sql => 2012_08_12_02_world_spell_script_names.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename sql/updates/world/{2012_05_15_00_world_spell_script_names.sql => 2012_08_12_01_world_spell_script_names.sql} (100%) rename sql/updates/world/{2012_02_02_01_world_spell_script_names.sql => 2012_08_12_02_world_spell_script_names.sql} (100%) diff --git a/sql/updates/world/2012_05_15_00_world_spell_script_names.sql b/sql/updates/world/2012_08_12_01_world_spell_script_names.sql similarity index 100% rename from sql/updates/world/2012_05_15_00_world_spell_script_names.sql rename to sql/updates/world/2012_08_12_01_world_spell_script_names.sql diff --git a/sql/updates/world/2012_02_02_01_world_spell_script_names.sql b/sql/updates/world/2012_08_12_02_world_spell_script_names.sql similarity index 100% rename from sql/updates/world/2012_02_02_01_world_spell_script_names.sql rename to sql/updates/world/2012_08_12_02_world_spell_script_names.sql From 65469c9ee916fd8a910ce39e94cc929b4e1487ea Mon Sep 17 00:00:00 2001 From: e000 Date: Sun, 12 Aug 2012 20:04:02 +0200 Subject: [PATCH 051/147] Core/Gameobject: Properly toggle collision state when a gameobject is activated or spawned. --- src/server/game/Entities/GameObject/GameObject.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 7375ed9f88..20e5055dc1 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -138,9 +138,8 @@ void GameObject::AddToWorld() bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; if (m_model) GetMap()->Insert(*m_model); - if (startOpen ^ toggledState) - EnableCollision(false); + EnableCollision(startOpen ^ toggledState); WorldObject::AddToWorld(); } } @@ -1923,7 +1922,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); // Use the current go state - if (GetGoState() == GO_STATE_ACTIVE) + if (GetGoState() != GO_STATE_ACTIVE) startOpen = !startOpen; if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) From f92946e128ed44de21c97900b0a935c7c55fcd65 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 12 Aug 2012 20:06:12 +0200 Subject: [PATCH 052/147] Core/Misc: Fix some mem-leaks and uninitialized variables. --- .../game/Battlegrounds/Zones/BattlegroundIC.cpp | 3 ++- .../SunwellPlateau/instance_sunwell_plateau.cpp | 11 +++-------- .../EasternKingdoms/ZulAman/instance_zulaman.cpp | 9 +++++---- .../Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 12 ++++++++++++ .../TrialOfTheChampion/boss_argent_challenge.cpp | 2 -- .../DraktharonKeep/instance_drak_tharon_keep.cpp | 6 +----- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 1 + .../ShadowLabyrinth/boss_grandmaster_vorpil.cpp | 1 + .../SteamVault/instance_steam_vault.cpp | 12 ++++-------- .../Outland/GruulsLair/instance_gruuls_lair.cpp | 10 ++-------- .../Outland/TempestKeep/Eye/instance_the_eye.cpp | 12 ++++-------- 11 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 202869567d..90571dfb75 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -57,7 +57,8 @@ BattlegroundIC::BattlegroundIC() BattlegroundIC::~BattlegroundIC() { - + delete gunshipHorde; + delete gunshipAlliance; } void BattlegroundIC::HandlePlayerResurrect(Player* player) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 68b3bdb9b7..6324c5adf1 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -276,14 +276,9 @@ public: std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 305e3813eb..235bec7cc8 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -180,12 +180,13 @@ class instance_zulaman : public InstanceMapScript std::string GetSaveData() { + OUT_SAVE_INST_DATA; + std::ostringstream ss; ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute; - char* data = new char[ss.str().length()+1]; - strcpy(data, ss.str().c_str()); - //sLog->outError(LOG_FILTER_TSCR, "Zul'aman saved, %s.", data); - return data; + + OUT_SAVE_INST_DATA_COMPLETE; + return ss.str(); } void Load(const char* load) diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 6c0d43b053..3a6a3f6241 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -119,6 +119,18 @@ public: void Initialize() { GahzRillaEncounter = NOT_STARTED; + ZumrahGUID = 0; + BlyGUID = 0; + WeegliGUID = 0; + OroGUID = 0; + RavenGUID = 0; + MurtaGUID = 0; + EndDoorGUID = 0; + PyramidPhase = 0; + major_wave_Timer = 0; + minor_wave_Timer = 0; + addGroupSize = 0; + waypoint = 0; } void OnCreatureCreate(Creature* creature) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 76d5949eb4..d77c84b297 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -219,8 +219,6 @@ public: } InstanceScript* instance; - - Creature* pMemory; uint64 MemoryGUID; bool bHealth; diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 7778a79a81..7875d8edac 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -190,16 +190,12 @@ public: { OUT_SAVE_INST_DATA; - std::string str_data; - std::ostringstream saveStream; saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + return saveStream.str(); } void Load(const char* in) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 191f4530e6..4866705337 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -101,6 +101,7 @@ public: boss_ingvar_the_plundererAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); + bIsUndead = false; } InstanceScript* instance; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index c1850ee821..a1780d1d4a 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -171,6 +171,7 @@ public: summonTraveler_Timer = 90000; banish_Timer = 17000; HelpYell = false; + sumportals = false; destroyPortals(); if (instance) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 26ab54746b..dd0b5ea916 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -200,16 +200,12 @@ public: std::string GetSaveData() { OUT_SAVE_INST_DATA; + std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index fdb386372d..fa67659ca6 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -171,15 +171,9 @@ public: OUT_SAVE_INST_DATA; std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 78ffddca4d..1230b7e88c 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -166,16 +166,12 @@ class instance_the_eye : public InstanceMapScript std::string GetSaveData() { OUT_SAVE_INST_DATA; + std::ostringstream stream; stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; + + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); } void Load(const char* in) From d1ed95faa58af818f2d6b7f21e6054047a042f20 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 13 Aug 2012 13:47:51 +0200 Subject: [PATCH 053/147] Scripts: Fixed more uninitialized variables --- .../scripts/Northrend/Naxxramas/boss_four_horsemen.cpp | 1 + src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp | 3 +++ .../Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp | 5 +++-- .../Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index f81ddbf6bf..29a0a11af9 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -104,6 +104,7 @@ public: if (me->GetEntry() == MOB_HORSEMEN[i]) id = Horsemen(i); caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); + encounterActionReset = false; } Horsemen id; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 152f0b2d64..5d430ae048 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -58,6 +58,9 @@ public: Anomalus = 0; Keristrasza = 0; + AnomalusContainmentSphere = 0; + OrmoroksContainmentSphere = 0; + TelestrasContainmentSphere = 0; } void OnCreatureCreate(Creature* creature) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index f0d64bb834..a6ad7befc3 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -172,6 +172,7 @@ public: boss_skadiAI(Creature* creature) : ScriptedAI(creature), Summons(me) { instance = creature->GetInstanceScript(); + m_uiGraufGUID = 0; } InstanceScript* instance; @@ -207,7 +208,7 @@ public: Summons.DespawnAll(); me->SetSpeed(MOVE_FLIGHT, 3.0f); - if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) + if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted()) me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); if (instance) { @@ -221,7 +222,7 @@ public: me->SetCanFly(false); me->Dismount(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) + if (!Unit::GetCreature(*me, m_uiGraufGUID)) me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 5dacaff2d6..39fd01a926 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -121,6 +121,9 @@ public: m_uiActiveOrder[i] = m_uiActiveOrder[r]; m_uiActiveOrder[r] = temp; } + + m_uiActivedCreatureGUID = 0; + m_uiOrbGUID = 0; } bool m_bIsWalking; From 56d10f218ddba624f78aff250e271dac7a134af6 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 13 Aug 2012 19:24:47 +0200 Subject: [PATCH 054/147] Core: Fix warnings --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 72c500513c..2814b7dba6 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17059,7 +17059,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // set value, including drunk invisibility detection // calculate sobering. after 15 minutes logged out, the player will be sober again uint8 newDrunkValue = 0; - if (time_diff < GetDrunkValue() * 9) + if (time_diff < uint32(GetDrunkValue()) * 9) newDrunkValue = GetDrunkValue() - time_diff / 9; SetDrunkValue(newDrunkValue); From d1071d6e818dda613f87d631b6cefc5f0f707498 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 13 Aug 2012 19:37:58 +0200 Subject: [PATCH 055/147] Scripts/Trial of the Crusader: Convert script_texts in creature_text --- .../2012_08_13_00_world_creature_text.sql | 133 +++++++++++++ .../world/2012_08_13_01_world_creature.sql | 10 + .../boss_anubarak_trial.cpp | 25 +-- .../boss_faction_champions.cpp | 12 +- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 26 +-- .../boss_northrend_beasts.cpp | 39 ++-- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 39 ++-- .../instance_trial_of_the_crusader.cpp | 8 + .../trial_of_the_crusader.cpp | 175 ++++++++++-------- .../trial_of_the_crusader.h | 1 + 10 files changed, 317 insertions(+), 151 deletions(-) create mode 100644 sql/updates/world/2012_08_13_00_world_creature_text.sql create mode 100644 sql/updates/world/2012_08_13_01_world_creature.sql diff --git a/sql/updates/world/2012_08_13_00_world_creature_text.sql b/sql/updates/world/2012_08_13_00_world_creature_text.sql new file mode 100644 index 0000000000..aeb24dbfe9 --- /dev/null +++ b/sql/updates/world/2012_08_13_00_world_creature_text.sql @@ -0,0 +1,133 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1649999 AND -1649000; +DELETE FROM `creature_text` WHERE `entry` IN (34996,34990,34995,36095,34796,35144,34799,34797,34780,35458,34496,34497,16980,35877,34564,34660); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +-- Highlord Tirion Fordring + -- Northrend Beasts +(34996, 0, 0, 'Welcome, champions! You have heard the call of the Argent Crusade and you have boldly answered! It is here, in the Crusaders'' Coliseum, that you will face your greatest challenges. Those of you who survive the rigors of the coliseum will join the Argent Crusade on its march to Icecrown Citadel.', 14, 0, 100, 0, 0, 16036, 'Highlord Tirion Fordring - Welcome'), +(34996, 1, 0, 'Hailing from the deepest, darkest caverns of the Storm Peaks, Gormok the Impaler! Battle on, heroes!', 14, 0, 100, 0, 0, 16038, 'Highlord Tirion Fordring - Summing Gormok the Impaler'), +(34996, 2, 0, 'Steel yourselves, heroes, for the twin terrors, Acidmaw and Dreadscale, enter the arena!', 14, 0, 100, 0, 0, 16039, 'Highlord Tirion Fordring - Summing Acidmaw and Dreadscale'), +(34996, 3, 0, 'The air itself freezes with the introduction of our next combatant, Icehowl! Kill or be killed, champions!', 14, 0, 100, 0, 0, 16040, 'Highlord Tirion Fordring Summing Icehowl'), +(34996, 4, 0, 'The monstrous menagerie has been vanquished!', 14, 0, 100, 0, 0, 16041, 'Highlord Tirion Fordring - Northrend Beasts Done'), +(34996, 5, 0, 'Tragic... They fought valiantly, but the beasts of Northrend triumphed. Let us observe a moment of silence for our fallen heroes.', 14, 0, 0, 0, 0, 16042, 'Highlord Tirion Fordring - Northrend Beasts FAIL'), + -- Lord Jaraxxus +(34996, 6, 0, 'Grand Warlock Wilfred Fizzlebang will summon forth your next challenge. Stand by for his entry.', 14, 0, 100, 0, 0, 16043, 'Highlord Tirion Fordring - Summing Wilfred Fizzlebang'), +(34996, 7, 0, 'Quickly, heroes, destroy the demon lord before it can open a portal to its twisted demonic realm!', 14, 0, 100, 5, 0, 16044, 'Highlord Tirion Fordring to Wilfred Fizzlebang - Lord Jaraxxus Intro'), +(34996, 8, 0, 'The loss of Wilfred Fizzlebang, while unfortunate, should be a lesson to those that dare dabble in dark magic. Alas, you are victorious and must now face the next challenge.', 14, 0, 100, 0, 0, 16045, 'Highlord Tirion Fordring - Lord Jaraxxus Outro'), +(34996, 9, 0, 'Everyone calm down! Compose yourselves! There is no conspiracy at play here! The warlock acted on his own volition, outside of influences from the Alliance. The tournament must go on!', 14, 0, 100, 5, 0, 16046, 'Highlord Tirion Fordring - Lord Jaraxxus Outro'), + -- Faction Champions +(34996, 10, 0, 'The next battle will be against the Argent Crusade''s most powerful knights! Only by defeating them will you be deemed worthy...', 14, 0, 100, 0, 0, 16047, 'Highlord Tirion Fordring - Faction Champions Intro'), +(34996, 11, 0, 'Very well. I will allow it. Fight with honor!', 14, 0, 100, 1, 0, 16048, 'Highlord Tirion Fordring - Faction Champions Intro'), +(34996, 12, 0, 'A shallow and tragic victory. We are weaker as a whole from the losses suffered today. Who but the Lich King could benefit from such foolishness? Great warriors have lost their lives. And for what? The true threat looms ahead - the Lich King awaits us all in death.', 14, 0, 100, 0, 0, 16049, 'Highlord Tirion Fordring - Faction Champions Outro'), + -- Twin Val'kyr +(34996, 13, 0, 'Only by working together will you overcome the final challenge. From the depths of Icecrown come two of the Scourge''s most powerful lieutenants: fearsome val''kyr, winged harbingers of the Lich King!', 14, 0, 100, 0, 0, 16050, 'Highlord Tirion Fordring - Twin Val''kyr Intro'), +(34996, 14, 0, 'Let the games begin!', 14, 0, 100, 0, 0, 16037, 'Highlord Tirion Fordring - Twin Val''kyr Intro'), + -- Anub''arak +(34996, 15, 0, 'A mighty blow has been dealt to the Lich King! You have proven yourselves as able bodied champions of the Argent Crusade. Together we will strike against Icecrown Citadel and destroy what remains of the Scourge! There is no challenge that we cannot face united!', 14, 0, 100, 5, 0, 16051, 'Highlord Tirion Fordring - Anub''arak Intro'), +(34996, 16, 0, 'Arthas! You are hopelessly outnumbered! Lay down Frostmourne and I will grant you a just death.', 14, 0, 100, 25, 0, 16052, 'Highlord Tirion Fordring'), + +-- King Varian Wrynn +(34990, 0, 0, 'Your beasts will be no match for my champions, Tirion!', 14, 0, 0, 0, 0, 16069, 'King Varian Wrynn'), +(34990, 1, 0, 'The Alliance doesn''t need the help of a demon lord to deal with Horde filth! Come, pig!', 14, 0, 100, 5, 0, 16064, 'King Varian Wrynn'), +(34990, 2, 0, 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', 14, 0, 100, 5, 0, 16066, 'King Varian Wrynn'), +(34990, 3, 0, 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', 14, 0, 100, 5, 0, 16065, 'King Varian Wrynn'), +(34990, 4, 0, 'GLORY TO THE ALLIANCE!', 14, 0, 0, 0, 0, 16067, 'King Varian Wrynn'), +(34990, 5, 0, 'Not even the Lich King most powerful minions can stand against the Alliance! All hail our victors!', 14, 0, 0, 0, 0, 16068, 'King Varian Wrynn'), +(34990, 6, 0, 'Hardly a challenge.', 14, 0, 100, 274, 0, 16061, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 1, 'HAH!', 14, 0, 100, 5, 0, 16060, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 2, 'Is this the best the Horde has to offer?', 14, 0, 100, 6, 0, 16063, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 3, 'Worthless scrub.', 14, 0, 100, 25, 0, 16062, 'King Varian Wrynn - Faction Champions Kill Player'), + +-- Garrosh Hellscream +(34995, 0, 0, 'The Horde demands justice! We challenge the Alliance. Allow us to battle in place of your knights, paladin. We will show these dogs what it means to insult the Horde!', 14, 0, 100, 1, 0, 16023, 'Garrosh Hellscream'), +(34995, 1, 0, 'I''ve seen more worthy challenges in the Ring of Blood. You waste our time, paladin.', 14, 0, 100, 1, 0, 16026, 'Garrosh Hellscream'), +(34995, 2, 0, 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde? Your deaths will be swift!', 14, 0, 100, 5, 0, 16021, 'Garrosh Hellscream'), +(34995, 3, 0, 'That was just a taste of what the future brings. FOR THE HORDE!', 14, 0, 100, 1, 0, 16024, 'Garrosh Hellscream'), +(34995, 4, 0, 'Show them no mercy, Horde champions! LOK''TAR OGAR!', 14, 0, 0, 0, 0, 16022, 'Garrosh - Faction Champions Intro'), +(34995, 5, 0, 'Do you still question the might of the Horde, paladin? We will take on all comers!', 14, 0, 100, 1, 0, 16025, 'Garrosh Hellscream'), +(34995, 6, 0, 'Weakling!', 14, 0, 0, 0, 0, 16017, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 1, 'Pathetic!', 14, 0, 0, 0, 0, 16018, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 2, 'Overpowered.', 14, 0, 0, 0, 0, 16019, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 3, 'Lok''tar!', 14, 0, 0, 0, 0, 16020, 'Garrosh Hellscream - Faction Champions Kill Player'), + +-- Highlord Tirion Fordring +(36095, 0, 0, 'Champions, you''re alive! Not only have you defeated every challenge of the Trial of the Crusader, but also thwarted Arthas'' plans! Your skill and cunning will prove to be a powerful weapon against the Scourge. Well done! Allow one of the Crusade''s mages to transport you to the surface!', 14, 0, 100, 5, 0, 16053, 'Highlord Tirion Fordring'), +(36095, 1, 0, 'Let me hand you the chests as a reward, and let its contents will serve you faithfully in the campaign against Arthas in the heart of the Icecrown Citadel!', 41, 0, 0, 0, 0, 0, 'Highlord Tirion Fordring'), + +-- Gormok +(34796, 0, 0, 'My slaves! Destroy the enemy!', 41, 0, 0, 0, 0, 0, 'Gormok the Impaler - Snowball'), + +-- Acidmaw +(35144, 0, 0, 'Upon seeing its companion perish, %s becomes enraged!', 41, 0, 100, 0, 0, 0, 'Acidmaw to Beasts Controller - Enrage'), + +-- Dreadscale +(34799, 0, 0, 'Upon seeing its companion perish, %s becomes enraged!', 41, 0, 100, 0, 0, 0, 'Dreadscale to Beasts Controller - Enrage'), + +-- Icehowl +(34797, 0, 0, '%s glares at $n and lets out a bellowing roar!', 41, 0, 100, 0, 0, 0, 'Icehowl - Start'), +(34797, 1, 0, '%s crashes into the Coliseum wall and is stunned!', 41, 0, 100, 0, 0, 0, 'Icehowl - Crash'), +(34797, 2, 0, 'Trampling combatants underfoot, %s goes into a frothing rage!', 41, 0, 100, 0, 0, 0, 'Icehowl - Fail'), + +-- Wilfred Fizzlebang +(35458, 0, 0, 'Thank you, Highlord. Now, challengers, I will begin the ritual of summoning. When I am done a fearsome doomguard will appear!', 14, 0, 100, 2, 0, 16268, 'Wilfred Fizzlebang - Intro'), +(35458, 1, 0, 'Prepare for oblivion!', 14, 0, 100, 0, 0, 16269, 'Wilfred Fizzlebang - Intro'), +(35458, 2, 0, 'A-HA! I''ve done it! Behold the absolute power of Wilfred Fizzlebang, master summoner! You are bound to me, demon!', 14, 0, 100, 5, 0, 16270, 'Wilfred Fizzlebang to Wilfred Fizzlebang - Intro'), +(35458, 3, 0, 'But I''m in charge here...', 14, 0, 100, 5, 0, 16271, 'Wilfred Fizzlebang to Wilfred Fizzlebang - Death'), + +-- Lord Jaraxxus +(34780, 0, 0, 'Trifling gnome! Your arrogance will be your undoing!', 14, 0, 100, 397, 0, 16143, 'Lord Jaraxxus to Wilfred Fizzlebang - Intro'), +(34780, 1, 0, 'You face Jaraxxus, Eredar Lord of the Burning Legion!', 14, 0, 100, 0, 0, 16144, 'Lord Jaraxxus - Aggro'), +(34780, 2, 0, '$n has |cFFFF0000Legion Flames!|r', 41, 0, 100, 0, 0, 0, 'Lord Jaraxxus - Legion Flame'), +(34780, 3, 0, '%s creates a Nether Portal!', 41, 0, 100, 0, 0, 16150, 'Lord Jaraxxus - Summing Nether Portal'), +(34780, 4, 0, 'Come forth, sister! Your master calls!', 14, 0, 100, 0, 0, 16150, 'Lord Jaraxxus - Summoning Mistress of Pain'), +(34780, 5, 0, '$n has |cFF00FFFFIncinerate Flesh!|r Heal $g him:her;!', 41, 0, 100, 0, 0, 16149, 'Lord Jaraxxus - Incinerate Flesh'), +(34780, 6, 0, 'FLESH FROM BONE!', 14, 0, 100, 0, 0, 16149, 'Lord Jaraxxus - Incinerate Flesh'), +(34780, 7, 0, '%s creates an |cFF00FF00Infernal Volcano!|r', 41, 0, 100, 0, 0, 16151, 'Lord Jaraxxus - Summoning Infernal Volcano emote'), +(34780, 8, 0, 'IN-FER-NO!', 14, 0, 100, 0, 0, 16151, 'Lord Jaraxxus - Summoning Infernals'), +(34780, 9, 0, 'Insignificant gnat!', 14, 0, 0, 0, 0, 16145, 'Lord Jaraxxus - Killing a player'), +(34780, 9, 1, 'Banished to the Nether!', 14, 0, 0, 0, 0, 16146, 'Lord Jaraxxus - Killing a player'), +(34780, 10, 0, 'Another will take my place. Your world is doomed...', 14, 0, 100, 0, 0, 16147, 'Lord Jaraxxus - Death'), +(34780, 11, 0,'', 14, 0, 0, 0, 0, 16148, 'Lord Jaraxxus - Berserk'), + +-- Eydis Darkban +(34496, 0, 0, 'In the name of our dark master. For the Lich King. You. Will. Die.', 14, 0, 100, 0, 0, 16272, 'Eydis Darkbane - Aggro'), +(34496, 1, 0, 'Let the light consume you!', 14, 0, 100, 0, 0, 16279, 'Eydis Darkbane to Fjola Lightbane - Light Vortex'), +(34496, 2, 0, 'Let the dark consume you!', 14, 0, 100, 0, 0, 16278, 'Eydis Darkbane to Fjola Lightbane - Dark Vortex'), +(34496, 3, 0, '%s begins to cast |cFF9932CDDark Vortex!|r Switch to |cFF9932CDDark|r Essence!', 41, 0, 100, 0, 0, 16278, 'Eydis Darkbane to Fjola Lightbane - Dark Vortex emote'), +(34496, 4, 0, '%s begins to cast |cFFFF0000Twin''s Pact!|r', 41, 0, 100, 0, 0, 16274, 'Eydis Darkbane to Fjola Lightbane - Twin''s Pact emote'), +(34496, 5, 0, 'CHAOS!', 14, 0, 100, 0, 0, 16274, 'Eydis Darkbane to Fjola Lightbane - Twin''s Pact'), +(34496, 6, 0, 'You have been measured and found wanting.', 14, 0, 100, 0, 0, 16276, 'Eydis Darkbane - Killing a player'), +(34496, 6, 1, 'UNWORTHY!', 14, 0, 100, 0, 0, 16276, 'Eydis Darkbane - Killing a player'), +(34496, 7, 0, 'YOU ARE FINISHED!', 14, 0, 0, 0, 0, 16273, 'Eydis Darkbane - Berserk'), +(34496, 8, 0, 'The Scourge cannot be stopped...', 14, 0, 100, 0, 0, 16275, 'Eydis Darkbane - Death'), + +-- Fjola Lightbane +(34497, 0, 0, 'In the name of our dark master. For the Lich King. You. Will. Die.', 14, 0, 100, 0, 0, 16272, 'Fjola Lightbane - Aggro'), +(34497, 1, 0, 'Let the light consume you!', 14, 0, 100, 0, 0, 16279, 'Fjola Lightbane to Fjola Lightbane - Light Vortex'), +(34497, 2, 0, 'Let the dark consume you!', 14, 0, 100, 0, 0, 16278, 'Fjola Lightbane to Fjola Lightbane - Dark Vortex'), +(34497, 3, 0, '%s begins to cast |cFFFFFFFFLight Vortex!|r Switch to |cFFFFFFFFLight|r Essence!', 41, 0, 100, 0, 0, 16279, 'Fjola Lightbane to Fjola Lightbane - Light Vortex emote'), +(34497, 4, 0, '%s begins to cast Twin''s Pact!', 41, 0, 100, 0, 0, 16274, 'Fjola Lightbane to Fjola Lightbane - Twin''s Pact emote'), +(34497, 5, 0, 'CHAOS!', 14, 0, 100, 0, 0, 16274, 'Fjola Lightbane to Fjola Lightbane - Twin''s Pact'), +(34497, 6, 0, 'You have been measured and found wanting.', 14, 0, 100, 0, 0, 16276, 'Fjola Lightbane - Killing a player'), +(34497, 6, 1, 'UNWORTHY!', 14, 0, 100, 0, 0, 16276, 'Fjola Lightbane - Killing a player'), +(34497, 7, 0, 'YOU ARE FINISHED!', 14, 0, 0, 0, 0, 16273, 'Fjola Lightbane - Berserk'), +(34497, 8, 0, 'The Scourge cannot be stopped...', 14, 0, 100, 0, 0, 16275, 'Fjola Lightbane - Death'), + +-- The Lich King +(35877, 0, 0, 'You will have your challenge, Fordring.', 14, 0, 100, 0, 0, 16321, 'The Lich King'), +(35877, 1, 0, 'The souls of your fallen champions will be mine, Fordring.', 14, 0, 100, 0, 0, 16323, 'The Lich King'), +(35877, 2, 0, 'The Nerubians built an empire beneath the frozen wastes of Northrend. An empire that you so foolishly built your structures upon. MY EMPIRE.', 14, 0, 100, 11, 0, 16322, 'The Lich King'), + +-- Anub''arak +(34564, 0, 0, 'Ahhh, our guests have arrived, just as the master promised.', 14, 0, 100, 0, 0, 16235, 'Anub''arak - Intro'), +(34564, 1, 0, 'This place will serve as your tomb!', 14, 0, 100, 0, 0, 16234, 'Anub''arak - Aggro'), +(34564, 2, 0, 'Auum na-l ak-k-k-k, isshhh. Rise, minions. Devour...', 14, 0, 100, 0, 0, 16240, 'Anub''arak - Submerge'), +(34564, 3, 0, '%s burrows into the ground!', 41, 0, 100, 0, 0, 16240, 'Anub''arak - Burrows'), +(34564, 4, 0, '%s emerges from the ground!', 41, 0, 100, 0, 0, 0, 'Anub''arak - Emerge emote'), +(34564, 5, 0, 'The swarm shall overtake you!', 14, 0, 100, 0, 0, 16241, 'Anub''arak - Leeching Swarm'), +(34564, 6, 0, '%s unleashes a Leeching Swarm to heal himself!', 41, 0, 100, 0, 0, 16241, 'Anub''arak - Leeching Swarm emote'), +(34564, 7, 0, 'F-lakkh shir!', 14, 0, 100, 0, 0, 16236, 'Anub''arak - Killing a player'), +(34564, 7, 1, 'Another soul to sate the host.', 14, 0, 100, 0, 0, 16237, 'Anub''arak - Killing a player'), +(34564, 8, 0, 'I have failed you, master...', 14, 0, 100, 0, 0, 16238, 'Anub''arak - Death'), + +-- Anub''arak Spike +(34660, 0, 0, '%s''s spikes pursue $n!', 41, 0, 100, 0, 0, 0, 'Anub''arak - Spike target'); diff --git a/sql/updates/world/2012_08_13_01_world_creature.sql b/sql/updates/world/2012_08_13_01_world_creature.sql new file mode 100644 index 0000000000..4d8544206d --- /dev/null +++ b/sql/updates/world/2012_08_13_01_world_creature.sql @@ -0,0 +1,10 @@ +SET @GUID := 42575; +SET @ENTRY := 36095; -- Highlord Tirion Fordring + +DELETE FROM `creature` WHERE `id`=@ENTRY; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES +(@GUID,@ENTRY,649,15,1,648.9167,131.0208,141.6161,0,7200,0,0); + +DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY; +INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES +(@ENTRY,0,0x0,0x1,'57545'); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index b3b9801fd0..1019deac10 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -37,15 +37,17 @@ EndScriptData */ enum Yells { - SAY_INTRO = -1649055, - SAY_AGGRO = -1649056, - SAY_KILL1 = -1649057, - SAY_KILL2 = -1649058, - SAY_DEATH = -1649059, - EMOTE_SPIKE = -1649060, - SAY_BURROWER = -1649061, - EMOTE_LEECHING_SWARM = -1649062, - SAY_LEECHING_SWARM = -1649063, + SAY_INTRO = 0, + SAY_AGGRO = 1, + EMOTE_SUBMERGE = 2, + EMOTE_BURROWER = 3, + SAY_EMERGE = 4, + SAY_LEECHING_SWARM = 5, + EMOTE_LEECHING_SWARM = 6, + SAY_KILL_PLAYER = 7, + SAY_DEATH = 8, + + EMOTE_SPIKE = 0, }; enum Summons @@ -195,7 +197,7 @@ public: { if (who->GetTypeId() == TYPEID_PLAYER) { - DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me); + Talk(SAY_KILL_PLAYER); if (instance) instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } @@ -321,7 +323,7 @@ public: DoCast(me, SPELL_SUBMERGE_ANUBARAK); DoCast(me, SPELL_CLEAR_ALL_DEBUFFS); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SAY_BURROWER, me); + Talk(EMOTE_BURROWER); m_uiScarabSummoned = 0; m_uiSummonScarabTimer = 4*IN_MILLISECONDS; m_uiStage = 2; @@ -669,6 +671,7 @@ public: { m_uiTargetGUID = who->GetGUID(); DoCast(who, SPELL_MARK); + Talk(EMOTE_SPIKE, who->GetGUID()); me->SetSpeed(MOVE_RUN, 0.5f); m_uiSpeed = 0; m_uiIncreaseSpeedTimer = 1*IN_MILLISECONDS; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 3b0aeb958c..c662daf367 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -33,10 +33,9 @@ EndScriptData */ #include "SpellAuraEffects.h" #include "trial_of_the_crusader.h" -enum eYell +enum Yells { - SAY_GARROSH_KILL_ALLIANCE_PLAYER4 = -1649118, - SAY_VARIAN_KILL_HORDE_PLAYER4 = -1649123, + SAY_KILL_PLAYER = 6, }; enum eAIs @@ -359,11 +358,12 @@ struct boss_faction_championsAI : public ScriptedAI if (TeamInInstance == ALLIANCE) { if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN))) - DoScriptText(SAY_VARIAN_KILL_HORDE_PLAYER4+urand(0, 3), temp); // + cause we are on negative + temp->AI()->Talk(SAY_KILL_PLAYER); } else - if (Creature* temp = me->FindNearestCreature(NPC_GARROSH, 300.f)) - DoScriptText(SAY_GARROSH_KILL_ALLIANCE_PLAYER4+urand(0, 3), temp); // + cause we are on negative + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH))) + temp->AI()->Talk(SAY_KILL_PLAYER); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 4e791dfc22..f9e2080895 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -36,16 +36,18 @@ EndScriptData */ enum Yells { - SAY_INTRO = -1649030, - SAY_AGGRO = -1649031, - SAY_DEATH = -1649032, - EMOTE_INCINERATE = -1649033, - SAY_INCINERATE = -1649034, - EMOTE_LEGION_FLAME = -1649035, - EMOTE_NETHER_PORTAL = -1649036, - SAY_NETHER_PORTAL = -1649037, - EMOTE_INFERNAL_ERUPTION = -1649038, - SAY_INFERNAL_ERUPTION = -1649039, + SAY_INTRO = 0, + SAY_AGGRO = 1, + EMOTE_LEGION_FLAME = 2, + EMOTE_NETHER_PORTAL = 3, + SAY_MISTRESS_OF_PAIN = 4, + EMOTE_INCINERATE = 5, + SAY_INCINERATE = 6, + EMOTE_INFERNAL_ERUPTION = 7, + SAY_INFERNAL_ERUPTION = 8, + SAY_KILL_PLAYER = 9, + SAY_DEATH = 10, + SAY_BERSERK = 11, }; enum Equipment @@ -192,8 +194,8 @@ public: if (m_uiSummonNetherPortalTimer <= uiDiff) { - DoScriptText(EMOTE_NETHER_PORTAL, me); - DoScriptText(SAY_NETHER_PORTAL, me); + Talk(EMOTE_NETHER_PORTAL); + Talk(SAY_MISTRESS_OF_PAIN); DoCast(SPELL_NETHER_PORTAL); m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS; } else m_uiSummonNetherPortalTimer -= uiDiff; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 6c69ccbc72..8dd4f7dad3 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -35,16 +35,16 @@ EndScriptData */ enum Yells { - //Gormok - SAY_SNOBOLLED = -1649000, - //Acidmaw & Dreadscale - SAY_SUBMERGE = -1649010, - SAY_EMERGE = -1649011, - SAY_BERSERK = -1649012, - //Icehowl - SAY_TRAMPLE_STARE = -1649020, - SAY_TRAMPLE_FAIL = -1649021, - SAY_TRAMPLE_START = -1649022, + // Gormok + EMOTE_SNOBOLLED = 0, + + // Acidmaw & Dreadscale + EMOTE_ENRAGE = 0, + + // Icehowl + EMOTE_TRAMPLE_START = 0, + EMOTE_TRAMPLE_CRASH = 1, + EMOTE_TRAMPLE_FAIL = 2, }; enum Equipment @@ -239,7 +239,7 @@ public: if (m_uiSummonCount > 0) { me->SummonCreature(NPC_SNOBOLD_VASSAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); - DoScriptText(SAY_SNOBOLLED, me); + Talk(EMOTE_SNOBOLLED); } m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else m_uiSummonTimer -= diff; @@ -460,12 +460,11 @@ struct boss_jormungarAI : public ScriptedAI if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged) { - DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(SPELL_ENRAGE); enraged = true; - DoScriptText(SAY_BERSERK, me); + Talk(EMOTE_ENRAGE); switch (stage) { case 0: @@ -512,7 +511,6 @@ struct boss_jormungarAI : public ScriptedAI case 1: // Submerge me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_SUBMERGE_0); - DoScriptText(SAY_SUBMERGE, me); me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); stage = 2; case 2: // Wait til emerge @@ -524,7 +522,6 @@ struct boss_jormungarAI : public ScriptedAI break; case 3: // Emerge me->SetDisplayId(modelStationary); - DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); DoCast(me, SPELL_EMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); @@ -558,7 +555,6 @@ struct boss_jormungarAI : public ScriptedAI case 5: // Submerge me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_SUBMERGE_0); - DoScriptText(SAY_SUBMERGE, me); me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); stage = 6; case 6: // Wait til emerge @@ -570,7 +566,6 @@ struct boss_jormungarAI : public ScriptedAI break; case 7: // Emerge me->SetDisplayId(modelMobile); - DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); DoCast(me, SPELL_EMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); @@ -925,7 +920,6 @@ public: { m_uiTrampleTargetGUID = target->GetGUID(); me->SetTarget(m_uiTrampleTargetGUID); - DoScriptText(SAY_TRAMPLE_STARE, me, target); m_bTrampleCasted = false; SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); @@ -953,7 +947,7 @@ public: } else m_uiTrampleTimer -= diff; break; case 4: - DoScriptText(SAY_TRAMPLE_START, me); + Talk(EMOTE_TRAMPLE_START, m_uiTrampleTargetGUID); me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); me->SetTarget(0); m_uiStage = 5; @@ -985,7 +979,12 @@ public: if (!m_bTrampleCasted) { DoCast(me, SPELL_STAGGERED_DAZE); - DoScriptText(SAY_TRAMPLE_FAIL, me); + Talk(EMOTE_TRAMPLE_CRASH); + } + else + { + DoCast(me, SPELL_FROTHING_RAGE, true); + Talk(EMOTE_TRAMPLE_FAIL); } m_bMovementStarted = false; me->GetMotionMaster()->MovementExpired(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 4cfe4f61db..203e49420b 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -40,17 +40,15 @@ EndScriptData */ enum Yells { - SAY_AGGRO = -1649040, - SAY_DEATH = -1649041, - SAY_BERSERK = -1649042, - EMOTE_SHIELD = -1649043, - SAY_SHIELD = -1649044, - SAY_KILL1 = -1649045, - SAY_KILL2 = -1649046, - EMOTE_LIGHT_VORTEX = -1649047, - SAY_LIGHT_VORTEX = -1649048, - EMOTE_DARK_VORTEX = -1649049, - SAY_DARK_VORTEX = -1649050, + SAY_AGGRO = 0, + SAY_NIGHT = 1, + SAY_LIGHT = 2, + EMOTE_VORTEX = 3, + EMOTE_TWINK_PACT = 4, + SAY_TWINK_PACT = 5, + SAY_KILL_PLAYER = 6, + SAY_BERSERK = 7, + SAY_DEATH = 8, }; enum Equipment @@ -167,7 +165,6 @@ struct boss_twin_baseAI : public ScriptedAI uint32 m_uiTouchTimer; uint32 m_uiBerserkTimer; - int32 m_uiVortexSay; int32 m_uiVortexEmote; uint32 m_uiSisterNpcId; uint32 m_uiMyEmphatySpellId; @@ -179,7 +176,8 @@ struct boss_twin_baseAI : public ScriptedAI uint32 m_uiSpikeSpellId; uint32 m_uiTouchSpellId; - void Reset() { + void Reset() + { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->ModifyAuraState(m_uiAuraState, true); @@ -224,7 +222,7 @@ struct boss_twin_baseAI : public ScriptedAI { if (who->GetTypeId() == TYPEID_PLAYER) { - DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me); + Talk(SAY_KILL_PLAYER); if (instance) instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } @@ -336,8 +334,7 @@ struct boss_twin_baseAI : public ScriptedAI { if (Creature* pSister = GetSister()) pSister->AI()->DoAction(ACTION_VORTEX); - DoScriptText(m_uiVortexEmote, me); - DoScriptText(m_uiVortexSay, me); + Talk(m_uiVortexEmote); DoCastAOE(m_uiVortexSpellId); m_uiStage = 0; m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS; @@ -348,8 +345,8 @@ struct boss_twin_baseAI : public ScriptedAI case 2: // Shield+Pact if (m_uiSpecialAbilityTimer <= uiDiff) { - DoScriptText(EMOTE_SHIELD, me); - DoScriptText(SAY_SHIELD, me); + Talk(EMOTE_TWINK_PACT); + Talk(SAY_TWINK_PACT); if (Creature* pSister = GetSister()) { pSister->AI()->DoAction(ACTION_PACT); @@ -426,8 +423,7 @@ public: m_uiStage = 0; m_uiWeapon = EQUIP_MAIN_1; m_uiAuraState = AURA_STATE_UNKNOWN22; - m_uiVortexEmote = EMOTE_LIGHT_VORTEX; - m_uiVortexSay = SAY_LIGHT_VORTEX; + m_uiVortexEmote = EMOTE_VORTEX; m_uiSisterNpcId = NPC_DARKBANE; m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK; m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER; @@ -496,8 +492,7 @@ public: m_uiStage = 1; m_uiWeapon = EQUIP_MAIN_2; m_uiAuraState = AURA_STATE_UNKNOWN19; - m_uiVortexEmote = EMOTE_DARK_VORTEX; - m_uiVortexSay = SAY_DARK_VORTEX; + m_uiVortexEmote = EMOTE_VORTEX; m_uiSisterNpcId = NPC_LIGHTBANE; m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT; m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 4dfe570802..3fb76ea52d 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -47,6 +47,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript uint64 BarrentGUID; uint64 TirionGUID; + uint64 TirionFordringGUID; uint64 FizzlebangGUID; uint64 GarroshGUID; uint64 VarianGUID; @@ -85,6 +86,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript TrialCounter = 50; EventStage = 0; + TirionFordringGUID = 0; + TributeChestGUID = 0; MainGateDoorGUID = 0; @@ -147,6 +150,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript case NPC_TIRION: TirionGUID = creature->GetGUID(); break; + case NPC_TIRION_FORDRING: + TirionFordringGUID = creature->GetGUID(); + break; case NPC_FIZZLEBANG: FizzlebangGUID = creature->GetGUID(); break; @@ -422,6 +428,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript return BarrentGUID; case NPC_TIRION: return TirionGUID; + case NPC_TIRION_FORDRING: + return TirionFordringGUID; case NPC_FIZZLEBANG: return FizzlebangGUID; case NPC_GARROSH: diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 4ad93c0afe..2a8eab0040 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -34,45 +34,58 @@ EndScriptData */ enum eYells { - SAY_STAGE_0_01 = -1649070, - SAY_STAGE_0_02 = -1649071, - SAY_STAGE_0_03a = -1649072, - SAY_STAGE_0_03h = -1649073, - SAY_STAGE_0_04 = -1649074, - SAY_STAGE_0_05 = -1649075, - SAY_STAGE_0_06 = -1649076, - SAY_STAGE_0_WIPE = -1649077, - SAY_STAGE_1_01 = -1649080, - SAY_STAGE_1_02 = -1649081, - SAY_STAGE_1_03 = -1649082, - SAY_STAGE_1_04 = -1649083, - SAY_STAGE_1_05 = -1649030, //INTRO Jaraxxus - SAY_STAGE_1_06 = -1649084, - SAY_STAGE_1_07 = -1649086, - SAY_STAGE_1_08 = -1649087, - SAY_STAGE_1_09 = -1649088, - SAY_STAGE_1_10 = -1649089, - SAY_STAGE_1_11 = -1649090, - SAY_STAGE_2_01 = -1649091, - SAY_STAGE_2_02a = -1649092, - SAY_STAGE_2_02h = -1649093, - SAY_STAGE_2_03 = -1649094, - SAY_STAGE_2_04a = -1649095, - SAY_STAGE_2_04h = -1649096, - SAY_STAGE_2_05a = -1649097, - SAY_STAGE_2_05h = -1649098, - SAY_STAGE_2_06 = -1649099, - SAY_STAGE_3_01 = -1649100, - SAY_STAGE_3_02 = -1649101, - SAY_STAGE_3_03a = -1649102, - SAY_STAGE_3_03h = -1649103, - SAY_STAGE_4_01 = -1649104, - SAY_STAGE_4_02 = -1649105, - SAY_STAGE_4_03 = -1649106, - SAY_STAGE_4_04 = -1649107, - SAY_STAGE_4_05 = -1649108, - SAY_STAGE_4_06 = -1649109, - SAY_STAGE_4_07 = -1649110, + // Highlord Tirion Fordring - 34996 + SAY_STAGE_0_01 = 0, + SAY_STAGE_0_02 = 1, + SAY_STAGE_0_04 = 2, + SAY_STAGE_0_05 = 3, + SAY_STAGE_0_06 = 4, + SAY_STAGE_0_WIPE = 5, + SAY_STAGE_1_01 = 6, + SAY_STAGE_1_07 = 7, + SAY_STAGE_1_08 = 8, + SAY_STAGE_1_11 = 9, + SAY_STAGE_2_01 = 10, + SAY_STAGE_2_03 = 11, + SAY_STAGE_2_06 = 12, + SAY_STAGE_3_01 = 13, + SAY_STAGE_3_02 = 14, + SAY_STAGE_4_01 = 15, + SAY_STAGE_4_03 = 16, + + // Varian Wrynn + SAY_STAGE_0_03a = 0, + SAY_STAGE_1_10 = 1, + SAY_STAGE_2_02a = 2, + SAY_STAGE_2_04a = 3, + SAY_STAGE_2_05a = 4, + SAY_STAGE_3_03a = 5, + + // Garrosh + SAY_STAGE_0_03h = 0, + SAY_STAGE_1_09 = 1, + SAY_STAGE_2_02h = 2, + SAY_STAGE_2_04h = 3, + SAY_STAGE_2_05h = 4, + SAY_STAGE_3_03h = 5, + + // Wilfred Fizzlebang + SAY_STAGE_1_02 = 0, + SAY_STAGE_1_03 = 1, + SAY_STAGE_1_04 = 2, + SAY_STAGE_1_06 = 3, + + // Lord Jaraxxus + SAY_STAGE_1_05 = 0, + + // The Lich King + SAY_STAGE_4_02 = 0, + SAY_STAGE_4_05 = 1, + SAY_STAGE_4_04 = 2, + + // Highlord Tirion Fordring - 36095 + SAY_STAGE_4_06 = 0, + SAY_STAGE_4_07 = 1, }; struct _Messages @@ -289,13 +302,13 @@ class boss_lich_king_toc : public CreatureScript switch (instance->GetData(TYPE_EVENT)) { case 5010: - DoScriptText(SAY_STAGE_4_02, me); + Talk(SAY_STAGE_4_02); m_uiUpdateTimer = 3000; me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]); instance->SetData(TYPE_EVENT, 5020); break; case 5030: - DoScriptText(SAY_STAGE_4_04, me); + Talk(SAY_STAGE_4_04); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); m_uiUpdateTimer = 10000; instance->SetData(TYPE_EVENT, 5040); @@ -312,7 +325,7 @@ class boss_lich_king_toc : public CreatureScript instance->SetData(TYPE_EVENT, 5060); break; case 5060: - DoScriptText(SAY_STAGE_4_05, me); + Talk(SAY_STAGE_4_05); me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); m_uiUpdateTimer = 2500; instance->SetData(TYPE_EVENT, 5070); @@ -371,7 +384,7 @@ class npc_fizzlebang_toc : public CreatureScript void JustDied(Unit* killer) { - DoScriptText(SAY_STAGE_1_06, me, killer); + Talk(SAY_STAGE_1_06, killer->GetGUID()); instance->SetData(TYPE_EVENT, 1180); if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) { @@ -430,13 +443,13 @@ class npc_fizzlebang_toc : public CreatureScript m_uiUpdateTimer = 4000; break; case 1120: - DoScriptText(SAY_STAGE_1_02, me); + Talk(SAY_STAGE_1_02); instance->SetData(TYPE_EVENT, 1130); m_uiUpdateTimer = 12000; break; case 1130: me->GetMotionMaster()->MovementExpired(); - DoScriptText(SAY_STAGE_1_03, me); + Talk(SAY_STAGE_1_03); me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI); if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN)) { @@ -470,7 +483,7 @@ class npc_fizzlebang_toc : public CreatureScript m_uiUpdateTimer = 3000; break; case 1140: - DoScriptText(SAY_STAGE_1_04, me); + Talk(SAY_STAGE_1_04); if (Creature* temp = me->SummonCreature(NPC_JARAXXUS, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 5.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -492,7 +505,7 @@ class npc_fizzlebang_toc : public CreatureScript break; case 1144: if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) - DoScriptText(SAY_STAGE_1_05, temp); + temp->AI()->Talk(SAY_STAGE_1_05); instance->SetData(TYPE_EVENT, 1150); m_uiUpdateTimer = 5000; break; @@ -555,13 +568,13 @@ class npc_tirion_toc : public CreatureScript { case 110: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_01, me); + Talk(SAY_STAGE_0_01); m_uiUpdateTimer = 22000; instance->SetData(TYPE_EVENT, 120); break; case 140: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_02, me); + Talk(SAY_STAGE_0_02); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 150); break; @@ -587,7 +600,7 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 160); break; case 200: - DoScriptText(SAY_STAGE_0_04, me); + Talk(SAY_STAGE_0_04); m_uiUpdateTimer = 8000; instance->SetData(TYPE_EVENT, 205); break; @@ -619,7 +632,7 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 230); break; case 300: - DoScriptText(SAY_STAGE_0_05, me); + Talk(SAY_STAGE_0_05); m_uiUpdateTimer = 8000; instance->SetData(TYPE_EVENT, 305); break; @@ -646,54 +659,54 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 320); break; case 400: - DoScriptText(SAY_STAGE_0_06, me); + Talk(SAY_STAGE_0_06); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 666: - DoScriptText(SAY_STAGE_0_WIPE, me); + Talk(SAY_STAGE_0_WIPE); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 1010: - DoScriptText(SAY_STAGE_1_01, me); + Talk(SAY_STAGE_1_01); m_uiUpdateTimer = 7000; instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); instance->SetData(TYPE_EVENT, 0); break; case 1180: - DoScriptText(SAY_STAGE_1_07, me); + Talk(SAY_STAGE_1_07); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 0); break; case 2000: - DoScriptText(SAY_STAGE_1_08, me); + Talk(SAY_STAGE_1_08); m_uiUpdateTimer = 18000; instance->SetData(TYPE_EVENT, 2010); break; case 2030: - DoScriptText(SAY_STAGE_1_11, me); + Talk(SAY_STAGE_1_11); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 3000: - DoScriptText(SAY_STAGE_2_01, me); + Talk(SAY_STAGE_2_01); m_uiUpdateTimer = 12000; instance->SetData(TYPE_EVENT, 3050); break; case 3001: - DoScriptText(SAY_STAGE_2_01, me); + Talk(SAY_STAGE_2_01); m_uiUpdateTimer = 12000; instance->SetData(TYPE_EVENT, 3051); break; case 3060: - DoScriptText(SAY_STAGE_2_03, me); + Talk(SAY_STAGE_2_03); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 3070); break; case 3061: - DoScriptText(SAY_STAGE_2_03, me); + Talk(SAY_STAGE_2_03); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 3071); break; @@ -718,17 +731,17 @@ class npc_tirion_toc : public CreatureScript break; //Crusaders battle end case 3100: - DoScriptText(SAY_STAGE_2_06, me); + Talk(SAY_STAGE_2_06); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 0); break; case 4000: - DoScriptText(SAY_STAGE_3_01, me); + Talk(SAY_STAGE_3_01); m_uiUpdateTimer = 13000; instance->SetData(TYPE_EVENT, 4010); break; case 4010: - DoScriptText(SAY_STAGE_3_02, me); + Talk(SAY_STAGE_3_02); if (Creature* temp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { temp->SetVisible(false); @@ -769,7 +782,7 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 5000); break; case 5000: - DoScriptText(SAY_STAGE_4_01, me); + Talk(SAY_STAGE_4_01); m_uiUpdateTimer = 10000; instance->SetData(TYPE_EVENT, 5005); break; @@ -779,7 +792,7 @@ class npc_tirion_toc : public CreatureScript me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5); break; case 5020: - DoScriptText(SAY_STAGE_4_03, me); + Talk(SAY_STAGE_4_03); m_uiUpdateTimer = 1000; instance->SetData(TYPE_EVENT, 0); break; @@ -789,14 +802,16 @@ class npc_tirion_toc : public CreatureScript instance->SetData(TYPE_EVENT, 6005); break; case 6005: - DoScriptText(SAY_STAGE_4_06, me); + if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) + tirionFordring->AI()->Talk(NPC_TIRION_FORDRING); m_uiUpdateTimer = 20000; instance->SetData(TYPE_EVENT, 6010); break; case 6010: if (IsHeroic()) { - DoScriptText(SAY_STAGE_4_07, me); + if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) + tirionFordring->AI()->Talk(SAY_STAGE_4_07); m_uiUpdateTimer = 60000; instance->SetData(TYPE_ANUBARAK, SPECIAL); instance->SetData(TYPE_EVENT, 6020); @@ -854,7 +869,7 @@ class npc_garrosh_toc : public CreatureScript { case 130: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_03h, me); + Talk(SAY_STAGE_0_03h); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 132); break; @@ -864,27 +879,27 @@ class npc_garrosh_toc : public CreatureScript instance->SetData(TYPE_EVENT, 140); break; case 2010: - DoScriptText(SAY_STAGE_1_09, me); + Talk(SAY_STAGE_1_09); m_uiUpdateTimer = 9000; instance->SetData(TYPE_EVENT, 2020); break; case 3050: - DoScriptText(SAY_STAGE_2_02h, me); + Talk(SAY_STAGE_2_02h); m_uiUpdateTimer = 15000; instance->SetData(TYPE_EVENT, 3060); break; case 3070: - DoScriptText(SAY_STAGE_2_04h, me); + Talk(SAY_STAGE_2_04h); m_uiUpdateTimer = 6000; instance->SetData(TYPE_EVENT, 3080); break; case 3081: - DoScriptText(SAY_STAGE_2_05h, me); + Talk(SAY_STAGE_2_05h); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 3091); break; case 4030: - DoScriptText(SAY_STAGE_3_03h, me); + Talk(SAY_STAGE_3_03h); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 4040); break; @@ -935,7 +950,7 @@ class npc_varian_toc : public CreatureScript { case 120: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); - DoScriptText(SAY_STAGE_0_03a, me); + Talk(SAY_STAGE_0_03a); m_uiUpdateTimer = 2000; instance->SetData(TYPE_EVENT, 122); break; @@ -945,27 +960,27 @@ class npc_varian_toc : public CreatureScript instance->SetData(TYPE_EVENT, 130); break; case 2020: - DoScriptText(SAY_STAGE_1_10, me); + Talk(SAY_STAGE_1_10); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 2030); break; case 3051: - DoScriptText(SAY_STAGE_2_02a, me); + Talk(SAY_STAGE_2_02a); m_uiUpdateTimer = 10000; instance->SetData(TYPE_EVENT, 3061); break; case 3071: - DoScriptText(SAY_STAGE_2_04a, me); + Talk(SAY_STAGE_2_04a); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 3081); break; case 3080: - DoScriptText(SAY_STAGE_2_05a, me); + Talk(SAY_STAGE_2_05a); m_uiUpdateTimer = 3000; instance->SetData(TYPE_EVENT, 3090); break; case 4020: - DoScriptText(SAY_STAGE_3_03a, me); + Talk(SAY_STAGE_3_03a); m_uiUpdateTimer = 5000; instance->SetData(TYPE_EVENT, 4040); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index 99525b6fb3..f361c3521d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -162,6 +162,7 @@ enum eCreature { NPC_BARRENT = 34816, NPC_TIRION = 34996, + NPC_TIRION_FORDRING = 36095, NPC_FIZZLEBANG = 35458, NPC_GARROSH = 34995, NPC_VARIAN = 34990, From c9f4866648a8e22cfda2f92b7f6afae6c8c86695 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 00:01:39 +0200 Subject: [PATCH 056/147] Scripts/Trial Of The Crusader: * Fix typo * Fix creature_text group id for King Varian Wrynn / Garrosh Hellscream --- .../2012_08_14_00_world_creature_text.sql | 24 +++++++++++++++++++ .../trial_of_the_crusader.cpp | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2012_08_14_00_world_creature_text.sql diff --git a/sql/updates/world/2012_08_14_00_world_creature_text.sql b/sql/updates/world/2012_08_14_00_world_creature_text.sql new file mode 100644 index 0000000000..bd0f353193 --- /dev/null +++ b/sql/updates/world/2012_08_14_00_world_creature_text.sql @@ -0,0 +1,24 @@ +DELETE FROM `creature_text` WHERE `entry` IN (34990,34995); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +-- King Varian Wrynn +(34990, 0, 0, 'Your beasts will be no match for my champions, Tirion!', 14, 0, 0, 0, 0, 16069, 'King Varian Wrynn - Northrend Beasts Outro'), +(34990, 1, 0, 'The Alliance doesn''t need the help of a demon lord to deal with Horde filth! Come, pig!', 14, 0, 100, 5, 0, 16064, 'King Varian Wrynn - Lord Jaraxxus Outro'), +(34990, 2, 0, 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', 14, 0, 100, 5, 0, 16066, 'King Varian Wrynn - Faction Champions Intro'), +(34990, 3, 0, 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', 14, 0, 100, 5, 0, 16065, 'King Varian Wrynn - Faction Champions Intro'), +(34990, 4, 0, 'GLORY TO THE ALLIANCE!', 14, 0, 100, 0, 0, 16067, 'King Varian Wrynn - Victory'), +(34990, 5, 0, 'Not even the Lich King most powerful minions can stand against the Alliance! All hail our victors!', 14, 0, 0, 0, 0, 16068, 'King Varian Wrynn - Faction Champions Outro'), +(34990, 6, 0, 'Hardly a challenge.', 14, 0, 100, 274, 0, 16061, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 1, 'HAH!', 14, 0, 100, 5, 0, 16060, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 2, 'Is this the best the Horde has to offer?', 14, 0, 100, 6, 0, 16063, 'King Varian Wrynn - Faction Champions Kill Player'), +(34990, 6, 3, 'Worthless scrub.', 14, 0, 100, 25, 0, 16062, 'King Varian Wrynn - Faction Champions Kill Player'), +-- Garrosh Hellscream +(34995, 0, 0, 'I''ve seen more worthy challenges in the Ring of Blood. You waste our time, paladin.', 14, 0, 100, 1, 0, 16026, 'Garrosh Hellscream - Northrend Beasts Outro'), +(34995, 1, 0, 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde? Your deaths will be swift!', 14, 0, 100, 5, 0, 16021, 'Garrosh Hellscream - Lord Jaraxxus Outro'), +(34995, 2, 0, 'The Horde demands justice! We challenge the Alliance. Allow us to battle in place of your knights, paladin. We will show these dogs what it means to insult the Horde!', 14, 0, 100, 1, 0, 16023, 'Garrosh Hellscream - Faction Champions Intro'), +(34995, 3, 0, 'Show them no mercy, Horde champions! LOK''TAR OGAR!', 14, 0, 0, 0, 0, 16022, 'Garrosh - Faction Champions Intro'), +(34995, 4, 0, 'That was just a taste of what the future brings. FOR THE HORDE!', 14, 0, 100, 1, 0, 16024, 'Garrosh Hellscream - Faction Champions Victory'), +(34995, 5, 0, 'Do you still question the might of the Horde, paladin? We will take on all comers!', 14, 0, 100, 1, 0, 16025, 'Garrosh Hellscream - Faction Champions Outro'), +(34995, 6, 0, 'Weakling!', 14, 0, 100, 0, 0, 16017, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 1, 'Pathetic!', 14, 0, 100, 0, 0, 16018, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 2, 'Overpowered.', 14, 0, 100, 0, 0, 16019, 'Garrosh Hellscream - Faction Champions Kill Player'), +(34995, 6, 3, 'Lok''tar!', 14, 0, 100, 0, 0, 16020, 'Garrosh Hellscream - Faction Champions Kill Player'); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 2a8eab0040..7064368f09 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -803,7 +803,7 @@ class npc_tirion_toc : public CreatureScript break; case 6005: if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) - tirionFordring->AI()->Talk(NPC_TIRION_FORDRING); + tirionFordring->AI()->Talk(SAY_STAGE_4_06); m_uiUpdateTimer = 20000; instance->SetData(TYPE_EVENT, 6010); break; From a896fa8e76f8a43bcd6c9fe9812dbed5acc90858 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 18:10:15 +0200 Subject: [PATCH 057/147] Scripts/Onyxias Lair: Convert script_texts in creature_text --- .../2012_08_14_01_world_creature_text.sql | 8 +++++++ .../Kalimdor/OnyxiasLair/boss_onyxia.cpp | 23 +++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 sql/updates/world/2012_08_14_01_world_creature_text.sql diff --git a/sql/updates/world/2012_08_14_01_world_creature_text.sql b/sql/updates/world/2012_08_14_01_world_creature_text.sql new file mode 100644 index 0000000000..0f182ae098 --- /dev/null +++ b/sql/updates/world/2012_08_14_01_world_creature_text.sql @@ -0,0 +1,8 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=10184; +DELETE FROM `creature_text` WHERE `entry`=10184; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(10184, 0, 0, 'How fortuitous. Usually, I must leave my lair in order to feed.', 14, 0, 100, 0, 0, 0, 'Onyxia - Aggro'), +(10184, 1, 0, 'Learn your place mortal!', 14, 0, 100, 0, 0, 0, 'Onyxia - Kill Player'), +(10184, 2, 0, 'This meaningless exertion bores me. I''ll incinerate you all from above!', 14, 0, 100, 0, 0, 0, 'Onyxia - Phase 2'), +(10184, 3, 0, 'It seems you''ll need another lesson, mortals!', 14, 0, 100, 0, 0, 0, 'Onyxia - Phase 3'), +(10184, 4, 0, '%s takes in a deep breath...', 41, 0, 100, 0, 0, 0, 'Onyxia - Deep Breath Emote'); diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 1fdf941d75..c243682cc6 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -35,11 +35,14 @@ EndScriptData */ enum Yells { - SAY_AGGRO = -1249000, - SAY_KILL = -1249001, - SAY_PHASE_2_TRANS = -1249002, - SAY_PHASE_3_TRANS = -1249003, - EMOTE_BREATH = -1249004, + // Say + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_PHASE_2_TRANS = 2, + SAY_PHASE_3_TRANS = 3, + + // Emote + EMOTE_BREATH = 4, }; enum Spells @@ -184,7 +187,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); me->SetInCombatWithZone(); if (instance) @@ -227,7 +230,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell) @@ -269,7 +272,7 @@ public: me->SetCanFly(true); me->GetMotionMaster()->MovePoint(11, Phase2Location.GetPositionX(), Phase2Location.GetPositionY(), Phase2Location.GetPositionZ()+25); me->SetSpeed(MOVE_FLIGHT, 1.0f); - DoScriptText(SAY_PHASE_2_TRANS, me); + Talk(SAY_PHASE_2_TRANS); if (instance) instance->SetData(DATA_ONYXIA_PHASE, Phase); WhelpTimer = 5000; @@ -416,7 +419,7 @@ public: Phase = PHASE_END; if (instance) instance->SetData(DATA_ONYXIA_PHASE, Phase); - DoScriptText(SAY_PHASE_3_TRANS, me); + Talk(SAY_PHASE_3_TRANS); SetCombatMovement(true); me->SetCanFly(false); @@ -432,7 +435,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); - DoScriptText(EMOTE_BREATH, me); + Talk(EMOTE_BREATH); DoCast(me, PointData->SpellId); DeepBreathTimer = 70000; } From 0f40869627b9f6281cac34b203b9d7496c482449 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 20:15:27 +0200 Subject: [PATCH 058/147] DB/Creature: Add Missing spawn for Mistcaller Soo-gan --- sql/updates/world/2012_08_14_02_world_creature.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sql/updates/world/2012_08_14_02_world_creature.sql diff --git a/sql/updates/world/2012_08_14_02_world_creature.sql b/sql/updates/world/2012_08_14_02_world_creature.sql new file mode 100644 index 0000000000..5096c7d6b4 --- /dev/null +++ b/sql/updates/world/2012_08_14_02_world_creature.sql @@ -0,0 +1,12 @@ +SET @GUID := 42613; +SET @ENTRY := 28114; -- Mistcaller Soo-gan + +DELETE FROM `creature` WHERE `id`=@ENTRY; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES +(@GUID,@ENTRY,571,1,1,0,0,6165.004,5092.975,-97.29356,0.7504916,120,0,0,117700,3809,0); + +DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY; +INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES +(@ENTRY,0,0,0x10000,0x1,0,'51589 52215'); + +UPDATE `creature_template` SET `npcflag`=`npcflag` |1 WHERE `entry`=@ENTRY; From 302051da3d01dce352e514caff7485ef9afe4df1 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 23:46:42 +0200 Subject: [PATCH 059/147] Core/Scripts: Fixed more uninitialized variables --- src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp | 1 + .../Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index ecf173b02e..a8afd19cd9 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -109,6 +109,7 @@ class boss_halazzi : public CreatureScript if (instance) instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); + LynxGUID = 0; TransformCount = 0; BerserkTimer = 600000; CheckTimer = 1000; diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 7875d8edac..99401c1d94 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -70,6 +70,7 @@ public: void Initialize() { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); uiTrollgore = 0; uiNovos = 0; uiDred = 0; From bddaf9b3a4c4385a02ff11ba92aef95ebac7ccab Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Tue, 14 Aug 2012 23:58:08 +0200 Subject: [PATCH 060/147] Core/Scripts: Fix uninitialized variable in boss_akilzon --- src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index c7d6e2fb6e..871a82c8e2 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -116,8 +116,7 @@ class boss_akilzon : public CreatureScript CloudGUID = 0; CycloneGUID = 0; DespawnSummons(); - for (uint8 i = 0; i < 8; ++i) - BirdGUIDs[i] = 0; + memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); StormCount = 0; StormSequenceTimer = 0; From a306d39bb4c20b48fb1a0a3d035a18c206205701 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 15 Aug 2012 00:06:19 +0200 Subject: [PATCH 061/147] Core/Scripts: Missing change from previous commit --- src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 871a82c8e2..068d00f550 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -80,7 +80,9 @@ class boss_akilzon : public CreatureScript boss_akilzonAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); + memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); } + InstanceScript* instance; uint64 BirdGUIDs[8]; From b77d88ec51e734a65f3d2ce3c69991980ac23ffd Mon Sep 17 00:00:00 2001 From: Spp Date: Wed, 15 Aug 2012 15:59:11 +0200 Subject: [PATCH 062/147] Core/Logging: Fix crash on authserver shutdown Closes #7365 Closes #7325 --- src/server/shared/Logging/Log.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 1dca5e7100..27f33754da 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -181,12 +181,18 @@ void Log::CreateLoggerFromConfig(const char* name) options.append(name); options = ConfigMgr::GetStringDefault(options.c_str(), ""); + if (options.empty()) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name); + return; + } + Tokens tokens(options, ','); Tokens::iterator iter = tokens.begin(); if (tokens.size() != 3) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong configuration for logger %s. Config line: %s\n", name, options.c_str()); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str()); return; } @@ -467,15 +473,15 @@ void Log::SetRealmID(uint32 id) void Log::Close() { + delete worker; + worker = NULL; + loggers.clear(); for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) { delete it->second; it->second = NULL; } appenders.clear(); - loggers.clear(); - delete worker; - worker = NULL; } void Log::LoadFromConfig() From 52a5991c1258073d561e8b74ef99a7b940808d92 Mon Sep 17 00:00:00 2001 From: Spp Date: Wed, 15 Aug 2012 19:58:02 +0200 Subject: [PATCH 063/147] Core/Logging: Added documentation about this system - Restored old CharDump (LOG_FILTER_PLAYER_DUMP) but disabled by default. - "%s" is now used to set dynamic file names, only used by GM commands and Player dump --- doc/LoggingHOWTO.txt | 276 ++++++++++++++++++ src/server/authserver/authserver.conf.dist | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 8 +- src/server/shared/Logging/Appender.h | 9 +- src/server/shared/Logging/AppenderFile.cpp | 4 +- src/server/shared/Logging/Log.cpp | 22 +- src/server/shared/Logging/Log.h | 1 + src/server/worldserver/worldserver.conf.dist | 21 +- 8 files changed, 325 insertions(+), 18 deletions(-) create mode 100644 doc/LoggingHOWTO.txt diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt new file mode 100644 index 0000000000..12850eb06c --- /dev/null +++ b/doc/LoggingHOWTO.txt @@ -0,0 +1,276 @@ +Logging system "log4j-like" + +--- LOGGERS AND APPENDERS --- + +Logging system has two components: loggers and appenders. These types of +components enable users to log messages according to message type and level and +control at runtime where they are reported. + +LOGGERS + +The first and foremost advantage of this system resided in the ability to +disable certain log statements while allowing others to print unhindered. +This capability assumes that the loggers are categorized according to some +developer-chosen criteria. + +Loggers follow hierarchy, if a logger is not defined a root logger will be used + +Loggers may be assigned levels. The set of possible levels are TRACE, DEBUG, +INFO, WARN, ERROR AND FATAL, or be disabled using level DISABLED. + +By definition the printing method determines the level of a logging request. +For example, sLog->outInfo(...) is a logging request of level INFO. + +A logging request is said to be enabled if its level is higher than or equal to +the level of its logger. Otherwise, the request is said to be disabled. A logger +without an assigned level will inherit one from the hierarchy + +Example +Logger Name Assigned Level Inherited Level +root Proot Proot +Network None Proot + +As Network is not defined, it uses the root logger and it's log level. +TRACE < DEBUG < INFO < WARN < ERROR < FATAL. + + +APPENDERS + +The ability to selectively enable of dissable logging request based on their +loggers is only part of the picture. This system allows logging requests to +print to multiple destinations. An output destination is called an appender. +Current system defines appenders for Console, files and Database, but can be +easily extended to remote socket server, NT event loggers, syslog daemons or +any other system. + +More than one appender can be attached to one logger. Each enabled logging +request for a given logger will be forwarded to all the appenders in that +logger + + +CONFIGURATION + +System will read "Loggers" and "Appenders" to know the list of loggers and +appenders to read from config file. Both are a list of elements separated +by space. + +Once we have the list of appenders to read, system will try to configure a new +appender from its config line. Appender config line follows the format: + + Type,LogLevel,Flags,optional1,optional2 + +Its a list of elements separated by comma where each element has its own meaning + Type: Type of the appender + 1 - (Console) + 2 - (File) + 3 - (DB) + LogLevel: Log level + 0 - (Disabled) + 1 - (Trace) + 2 - (Debug) + 3 - (Info) + 4 - (Warn) + 5 - (Error) + 6 - (Fatal) + Flags: Define some extra modifications to do to logging message + 1 - Prefix Timestamp to the text + 2 - Prefix Log Level to the text + 4 - Prefix Log Filter type to the text + 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS + (Only used with Type = 2) + 16 - Make a backup of existing file before overwrite + (Only used with Mode = w) + +Depending on the type, elements optional1 and optional2 will take different + + Colors (read as optional1 if Type = Console) + Format: "fatal error warn info debug trace" + 0 - BLACK + 1 - RED + 2 - GREEN + 3 - BROWN + 4 - BLUE + 5 - MAGENTA + 6 - CYAN + 7 - GREY + 8 - YELLOW + 9 - LRED + 10 - LGREEN + 11 - LBLUE + 12 - LMAGENTA + 13 - LCYAN + 14 - WHITE + Example: "13 11 9 5 3 1" + + File: Name of the file (read as optional1 if Type = File) + Allows to use one "%u" to create dynamic files + + Mode: Mode to open the file (read as optional2 if Type = File) + a - (Append) + w - (Overwrite) + +Example: + Appender.Console1=1,2,6 + + Creates new appender to log to console any message with log level DEBUG + or higher and prefixes log type and level to the message. + + Appender.Console2=1,5,1,13 11 9 5 3 1 + + Creates new appender to log to console any message with log level ERROR + or higher and prefixes timestamp to the message using colored text. + + Appender.File=2,2,7,Auth.log,w + + Creates new appender to log to file "Auth.log" any message with log level + DEBUG or higher and prefixes timestamp, type and level to message + +In the example, having two different loggers to log to console is perfectly +legal but redundant. + +Once we have the list of loggers to read, system will try to configure a new +logger from its config line. Logger config line follows the format: + + Type,LogLevel,AppenderList + +Its a list of elements separated by comma where each element has its own meaning + Type: Type of the logger ( + 0 - Default. Each type that has no config will + rely on this one. Core will create this logger + (disabled) if it's not configured + 1 - Units that doesn't fit in other categories + 2 - Pets + 3 - Vehicles + 4 - C++ AI, instance scripts, etc. + 5 - DB AI, such as SAI, EAI, CreatureAI + 6 - DB map scripts + 7 - Network input/output, + such as packet handlers and netcode logs + 8 - Spellsystem and aurasystem + 9 - Achievement system + 10 - Condition system + 11 - Pool system + 12 - Auction house + 13 - Arena's and battlegrounds + 14 - Outdoor PVP + 15 - Chat system + 16 - LFG system + 17 - Maps, instances (not scripts), + grids, cells, visibility, etc. + 18 - Player that doesn't fit in other categories. + 19 - Player loading from DB + (Player::_LoadXXX functions) + 20 - Items + 21 - Player skills (do not confuse with spells) + 22 - Player chat logs + 23 - loot + 24 - guilds + 25 - transports + 26 - SQL. DB errors + 27 - GM Commands + 28 - Remote Access Commands + 29 - Warden + 30 - Authserver + 31 - Worldserver + 32 - Game Events + 33 - Calendar + 34 - Character (Exclusive to login, logout, create, rename and delete) + 35 - Arenas + 36 - SQL Driver + 37 - SQL Dev + LogLevel + 0 - (Disabled) + 1 - (Trace) + 2 - (Debug) + 3 - (Info) + 4 - (Warn) + 5 - (Error) + 6 - (Fatal) + AppenderList: List of appenders linked to logger + (Using spaces as separator). + +--- EXAMPLES --- + +EXAMPLE 1 + +Log errors to console and a file called server.log that only contain +logs for this server run. File should prefix timestamp, type and log level to +the messages. Console should prefix type and log level. + + Appenders=Console Server + Loggers=Root + Appender.Console=1,5,6 + Appender.Server=2,5,7,Server.log,w + Logger.Root=0,5,Console Server + +Lets trace how system will log two different messages: + 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); + System will try to find logger of type GUILD, as no logger is configured + for GUILD it will use Root logger. As message Log Level is equal or higher + than the Log level of logger the message is sent to the Appenders + configured in the Logger. "Console" and "Server". + Console will write: "ERROR [GUILD ] Guild 1 created" + Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created" + + 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is + not equal or higher than the Log level of logger the message its discarted. + +EXAMPLE 2 + +Same example that above, but now i want to see all messages of level INFO on +file and server file should add timestamp on creation. + + Appenders=Console Server + Loggers=Root + Appender.Console=1,5,6 + Appender.Server=2,4,15,Server.log + Logger.Root=0,4,Console Server + +Lets trace how system will log two different messages: + 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); + Performs exactly as example 1. + 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is + equal or higher than the Log level of logger the message is sent to the + Appenders configured in the Logger. "Console" and "Server". + Console will discard msg as Log Level is not higher or equal to this + appender + Server will write to file + "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" + +EXAMPLE 3 +As a dev, i may be interested in logging just a particular part of the core +while i'm trying to fix something. So... i want to debug GUILDS to maximum +and also some CHARACTER events to some point. Also im checking some Waypoints +so i want SQLDEV to be logged to file without prefixes. All other messages +should only be logged to console, GUILD to TRACE and CHARACTER to INFO + + Appenders=Console SQLDev + Loggers=Guild Characters SQLDev + Appender.Console=1,1 + Appender.SQLDev=2,2,0,SQLDev.log + Logger.Guild=24,1,Console + Logger.Characters=34,3,Console + Logger.SQLDev=37,3,SQLDev + +With this config, any message logger with a Log type different to GUILD, +CHARACTER or SQLDEV will be ignored, as we didn't define a logger Root and +system created a default Root disabled. Appender Console, log level should be +defined to allow all possible messages of its loggers, in this case GUILD uses +TRACE (1), so Appender should allow it. Logger Characters will limit it's own +messages to INFO (3) + +--- SOME EXTRA COMMENTS --- +why this system is better than previous one? +- Can be extended: Anyone can easily create new appenders to log to new + systems as syslog or IRC, having all code related to that system in particular + files +- It's asyncronous: Uses threads to write messages, so core performance wont be + affected by IO operations +- Lets us select "What to log" and "Where to log" on the fly. You can log to a + dozen of files without having to change a single line of code + + \ No newline at end of file diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index d1c92dcf1d..15dd02d905 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -170,7 +170,7 @@ LoginDatabase.WorkerThreads = 1 # 5 - (Error) # 6 - (Fatal) # -# Flags: Default Console = 6, File = 7, DB = 0 +# Flags: # 0 - None # 1 - Prefix Timestamp to the text # 2 - Prefix Log Level to the text diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 7451bd2dc2..8544266840 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -719,11 +719,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_CHARACTER, LOG_LEVEL_DEBUG)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outDebug(LOG_FILTER_CHARACTER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + { + std::ostringstream ss; + ss << GetAccountId() << '_' << name.c_str(); + sLog->outCharDump(ss.str().c_str(), dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + } } Player::DeleteFromDB(guid, GetAccountId()); diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 332edbf170..ebe7408d40 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -62,10 +62,12 @@ enum LogFilterType LOG_FILTER_CHARACTER, LOG_FILTER_ARENAS, LOG_FILTER_SQL_DRIVER, - LOG_FILTER_SQL_DEV + LOG_FILTER_SQL_DEV, + LOG_FILTER_PLAYER_DUMP, + LOG_FILTER_BATTLEFIELD }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_SQL_DEV) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_BATTLEFIELD) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel @@ -105,7 +107,6 @@ struct LogMessage : level(_level) , type(_type) , text(_text) - , param1(0) { mtime = time(NULL); } @@ -117,7 +118,7 @@ struct LogMessage LogFilterType type; std::string text; std::string prefix; - uint32 param1; + std::string param1; time_t mtime; }; diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 01a2f34baa..67adff39aa 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -24,7 +24,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co , logDir(_logDir) , mode(_mode) { - dynamicName = std::string::npos != filename.find("%u"); + dynamicName = std::string::npos != filename.find("%s"); backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL; @@ -44,7 +44,7 @@ void AppenderFile::_write(LogMessage& message) if (dynamicName) { char namebuf[TRINITY_PATH_MAX]; - snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1); + snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str()); logfile = OpenFile(namebuf, mode, backup); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 27f33754da..64f7e697f1 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -449,6 +449,23 @@ void Log::outFatal(LogFilterType filter, const char * str, ...) va_end(ap); } +void Log::outCharDump(const char* param, const char * str, ...) +{ + if (!str || !ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) + return; + + va_list ap; + va_start(ap, str); + char text[MAX_QUERY_LEN]; + vsnprintf(text, MAX_QUERY_LEN, str, ap); + va_end(ap); + + LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, text); + msg->param1 = param; + + write(msg); +} + void Log::outCommand(uint32 account, const char * str, ...) { if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO)) @@ -461,7 +478,10 @@ void Log::outCommand(uint32 account, const char * str, ...) va_end(ap); LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text); - msg->param1 = account; + + std::ostringstream ss; + ss << account; + msg->param1 = ss.str(); write(msg); } diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 7b0e8cd381..cd1e9dc80d 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -56,6 +56,7 @@ class Log void EnableDBAppenders(); void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); + void outCharDump(const char* param, const char* str, ...) ATTR_PRINTF(3, 4); static std::string GetTimestampStr(); void SetRealmID(uint32 id); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index be5a452c7b..789af4e371 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2592,7 +2592,7 @@ PlayerDump.DisallowOverwrite = 1 # 5 - (Error) # 6 - (Fatal) # -# Flags: Default Console = 6, File = 7, DB = 0 +# Flags: # 0 - None # 1 - Prefix Timestamp to the text # 2 - Prefix Log Level to the text @@ -2629,13 +2629,14 @@ PlayerDump.DisallowOverwrite = 1 Appender.Console=1,2,6 Appender.Server=2,2,7,Server.log,w -Appender.GM=2,2,7,GM.log +Appender.GM=2,2,7,GM_%s.log Appender.SQL=2,2,7,SQL.log Appender.DBErrors=2,2,7,DBErrors.log Appender.Char=2,2,7,Char.log,w +Appender.CharDump=2,2,0,chardumps/%s.log Appender.RA=2,2,7,RA.log Appender.Arenas=2,2,7,Arena.log -Appender.SQLDev=2,2,7,SQLDev.log +Appender.SQLDev=2,2,0,SQLDev.log Appender.SQLDriver=2,2,7,SQLDriver.log Appender.Warden=2,2,7,Warden.log Appender.Chat=2,2,7,Chat.log @@ -2684,12 +2685,14 @@ Appender.Chat=2,2,7,Chat.log # 31 - Worldserver # 32 - Game Events # 33 - Calendar -# 34 - Character (Exclusive to log login, logout, create, rename, delete actions) +# 34 - Character (Exclusive to log login, logout, create, rename) # 35 - Arenas # 36 - SQL Driver # 37 - SQL Dev +# 38 - Player Dump +# 39 - Battlefield -Logger.Root=0,5,Console Server +Logger.Root=0,3,Console Server Logger.Units=1,3,Console Server Logger.Pets=2,3,Console Server Logger.Vehicles=3,3,Console Server @@ -2715,7 +2718,7 @@ Logger.PlayerChat=22,3,Chat Logger.Loot=23,3,Console Server Logger.Guilds=24,3,Console Server Logger.Transports=25,3,Console Server -Logger.SQL=26,2,Console Server SQL +Logger.SQL=26,2,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA Logger.Warden=29,3,Warden @@ -2727,6 +2730,8 @@ Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas Logger.SQLDriver=36,5,SQLDriver Logger.SQLDev=37,3,SQLDev +Logger.CharDump=38,5,CharDump +Logger.Battlefield=39,3,Console Server # LogLevel # 0 - (Disabled) @@ -2745,7 +2750,7 @@ Logger.SQLDev=37,3,SQLDev # (Using spaces as separator). # Default: "Console Server" -Appenders=Console Server +Appenders=Console Server GM Char Arenas Warden DBErrors CharDump # # Loggers @@ -2753,4 +2758,4 @@ Appenders=Console Server # (Using spaces as separator). # Default: "root" -Loggers=Root +Loggers=Root GM Character Arenas Warden SQL From ca2bc35713895adebbae30e1b371d9ff2d970bff Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 15 Aug 2012 21:30:55 +0100 Subject: [PATCH 064/147] Misc: CRLF to LF, whitespace cleanup and tabs to spaces --- doc/LoggingHOWTO.txt | 82 +- src/server/scripts/Commands/cs_disable.cpp | 14 +- src/server/scripts/Commands/cs_misc.cpp | 5758 ++++++++++---------- src/server/shared/Logging/AppenderDB.cpp | 2 +- src/server/shared/Logging/Log.cpp | 2 +- 5 files changed, 2929 insertions(+), 2929 deletions(-) diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt index 12850eb06c..4e61812d7d 100644 --- a/doc/LoggingHOWTO.txt +++ b/doc/LoggingHOWTO.txt @@ -23,7 +23,7 @@ For example, sLog->outInfo(...) is a logging request of level INFO. A logging request is said to be enabled if its level is higher than or equal to the level of its logger. Otherwise, the request is said to be disabled. A logger -without an assigned level will inherit one from the hierarchy +without an assigned level will inherit one from the hierarchy Example Logger Name Assigned Level Inherited Level @@ -72,16 +72,16 @@ Its a list of elements separated by comma where each element has its own meaning 4 - (Warn) 5 - (Error) 6 - (Fatal) - Flags: Define some extra modifications to do to logging message + Flags: Define some extra modifications to do to logging message 1 - Prefix Timestamp to the text 2 - Prefix Log Level to the text 4 - Prefix Log Filter type to the text 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS - (Only used with Type = 2) + (Only used with Type = 2) 16 - Make a backup of existing file before overwrite - (Only used with Mode = w) + (Only used with Mode = w) -Depending on the type, elements optional1 and optional2 will take different +Depending on the type, elements optional1 and optional2 will take different Colors (read as optional1 if Type = Console) Format: "fatal error warn info debug trace" @@ -111,22 +111,22 @@ Depending on the type, elements optional1 and optional2 will take different Example: Appender.Console1=1,2,6 - - Creates new appender to log to console any message with log level DEBUG - or higher and prefixes log type and level to the message. - - Appender.Console2=1,5,1,13 11 9 5 3 1 - - Creates new appender to log to console any message with log level ERROR - or higher and prefixes timestamp to the message using colored text. - - Appender.File=2,2,7,Auth.log,w - - Creates new appender to log to file "Auth.log" any message with log level - DEBUG or higher and prefixes timestamp, type and level to message - + + Creates new appender to log to console any message with log level DEBUG + or higher and prefixes log type and level to the message. + + Appender.Console2=1,5,1,13 11 9 5 3 1 + + Creates new appender to log to console any message with log level ERROR + or higher and prefixes timestamp to the message using colored text. + + Appender.File=2,2,7,Auth.log,w + + Creates new appender to log to file "Auth.log" any message with log level + DEBUG or higher and prefixes timestamp, type and level to message + In the example, having two different loggers to log to console is perfectly -legal but redundant. +legal but redundant. Once we have the list of loggers to read, system will try to configure a new logger from its config line. Logger config line follows the format: @@ -188,7 +188,7 @@ Its a list of elements separated by comma where each element has its own meaning 6 - (Fatal) AppenderList: List of appenders linked to logger (Using spaces as separator). - + --- EXAMPLES --- EXAMPLE 1 @@ -198,23 +198,23 @@ logs for this server run. File should prefix timestamp, type and log level to the messages. Console should prefix type and log level. Appenders=Console Server - Loggers=Root + Loggers=Root Appender.Console=1,5,6 Appender.Server=2,5,7,Server.log,w Logger.Root=0,5,Console Server Lets trace how system will log two different messages: 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); - System will try to find logger of type GUILD, as no logger is configured - for GUILD it will use Root logger. As message Log Level is equal or higher - than the Log level of logger the message is sent to the Appenders - configured in the Logger. "Console" and "Server". - Console will write: "ERROR [GUILD ] Guild 1 created" - Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created" - + System will try to find logger of type GUILD, as no logger is configured + for GUILD it will use Root logger. As message Log Level is equal or higher + than the Log level of logger the message is sent to the Appenders + configured in the Logger. "Console" and "Server". + Console will write: "ERROR [GUILD ] Guild 1 created" + Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created" + 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); - System will try to find logger of type CHARACTER, as no logger is - configured for CHARACTER it will use Root logger. As message Log Level is + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is not equal or higher than the Log level of logger the message its discarted. EXAMPLE 2 @@ -223,23 +223,23 @@ Same example that above, but now i want to see all messages of level INFO on file and server file should add timestamp on creation. Appenders=Console Server - Loggers=Root + Loggers=Root Appender.Console=1,5,6 Appender.Server=2,4,15,Server.log Logger.Root=0,4,Console Server Lets trace how system will log two different messages: 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created"); - Performs exactly as example 1. + Performs exactly as example 1. 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in"); - System will try to find logger of type CHARACTER, as no logger is - configured for CHARACTER it will use Root logger. As message Log Level is + System will try to find logger of type CHARACTER, as no logger is + configured for CHARACTER it will use Root logger. As message Log Level is equal or higher than the Log level of logger the message is sent to the - Appenders configured in the Logger. "Console" and "Server". + Appenders configured in the Logger. "Console" and "Server". Console will discard msg as Log Level is not higher or equal to this - appender - Server will write to file - "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" + appender + Server will write to file + "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" EXAMPLE 3 As a dev, i may be interested in logging just a particular part of the core @@ -249,11 +249,11 @@ so i want SQLDEV to be logged to file without prefixes. All other messages should only be logged to console, GUILD to TRACE and CHARACTER to INFO Appenders=Console SQLDev - Loggers=Guild Characters SQLDev + Loggers=Guild Characters SQLDev Appender.Console=1,1 Appender.SQLDev=2,2,0,SQLDev.log Logger.Guild=24,1,Console - Logger.Characters=34,3,Console + Logger.Characters=34,3,Console Logger.SQLDev=37,3,SQLDev With this config, any message logger with a Log type different to GUILD, diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index a2a80edd43..0bb376b08d 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -62,7 +62,7 @@ public: { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable }, { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable }, { NULL, 0, false, NULL, "", NULL } - }; + }; static ChatCommand commandTable[] = { { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable }, @@ -88,7 +88,7 @@ public: uint32 entry = uint32(atoi(entryStr)); std::string disableTypeStr = ""; - + switch (disableType) { case DISABLE_TYPE_SPELL: @@ -171,12 +171,12 @@ public: default: break; } - + PreparedStatement* stmt = NULL; stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); - PreparedQueryResult result = WorldDatabase.Query(stmt); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (result) { handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry); @@ -290,8 +290,8 @@ public: PreparedStatement* stmt = NULL; stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); - stmt->setUInt8(1, disableType); - PreparedQueryResult result = WorldDatabase.Query(stmt); + stmt->setUInt8(1, disableType); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 80847d7dec..1edaaf5bcb 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1,2879 +1,2879 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "Chat.h" -#include "ScriptMgr.h" -#include "AccountMgr.h" -#include "ArenaTeamMgr.h" -#include "CellImpl.h" -#include "GridNotifiers.h" -#include "Group.h" -#include "InstanceSaveMgr.h" -#include "MovementGenerator.h" -#include "ObjectAccessor.h" -#include "SpellAuras.h" -#include "TargetedMovementGenerator.h" -#include "WeatherMgr.h" -#include "ace/INET_Addr.h" - -class misc_commandscript : public CommandScript -{ -public: - misc_commandscript() : CommandScript("misc_commandscript") { } - - ChatCommand* GetCommands() const - { - static ChatCommand groupCommandTable[] = - { - { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL }, - { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL }, - { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand petCommandTable[] = - { - { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, - { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, - { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand sendCommandTable[] = - { - { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL }, - { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL }, - { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL }, - { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand commandTable[] = - { - { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, - { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, - { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL }, - { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL }, - { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL }, - { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL }, - { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL }, - { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL }, - { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL }, - { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL }, - { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL }, - { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL }, - { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL }, - { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL }, - { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL }, - { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL }, - { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL }, - { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL }, - { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL }, - { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL }, - { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL }, - { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL }, - { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL }, - { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL }, - { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL }, - { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL }, - { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL }, - { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL }, - { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL }, - { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL }, - { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL }, - { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL }, - { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL }, - { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL }, - { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL }, - { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, - { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, - { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL }, - { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL }, - { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL }, - { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL }, - { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL }, - { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL }, - { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL }, - { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL }, - { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL }, - { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, - { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, - { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL }, - { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, - { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL }, - { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL }, - { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL }, - { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL }, - { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - return commandTable; - } - - static bool HandleDevCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER)) - handler->GetSession()->SendNotification(LANG_DEV_ON); - else - handler->GetSession()->SendNotification(LANG_DEV_OFF); - return true; - } - - std::string argstr = (char*)args; - - if (argstr == "on") - { - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); - handler->GetSession()->SendNotification(LANG_DEV_ON); - return true; - } - - if (argstr == "off") - { - handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); - handler->GetSession()->SendNotification(LANG_DEV_OFF); - return true; - } - - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - static bool HandleGPSCommand(ChatHandler* handler, char const* args) - { - WorldObject* object = NULL; - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - - if (!object) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - object = handler->getSelectedUnit(); - - if (!object) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); - Cell cell(cellCoord); - - uint32 zoneId, areaId; - object->GetZoneAndAreaId(zoneId, areaId); - - MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); - - float zoneX = object->GetPositionX(); - float zoneY = object->GetPositionY(); - - Map2ZoneCoordinates(zoneX, zoneY, zoneId); - - Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); - - GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); - - // 63? WHY? - int gridX = 63 - gridCoord.x_coord; - int gridY = 63 - gridCoord.y_coord; - - uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - - if (haveVMap) - { - if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) - handler->PSendSysMessage("You are outdoors"); - else - handler->PSendSysMessage("You are indoors"); - } - else - handler->PSendSysMessage("no VMAP available for area info"); - - handler->PSendSysMessage(LANG_MAP_POSITION, - object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), - object->GetPhaseMask(), - object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), - cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), - zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); - - LiquidData liquidStatus; - ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); - - if (status) - handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); - - return true; - } - - static bool HandleAuraCommand(ChatHandler* handler, char const* args) - { - Unit* target = handler->getSelectedUnit(); - if (!target) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); - - return true; - } - - static bool HandleUnAuraCommand(ChatHandler* handler, char const* args) - { - Unit* target = handler->getSelectedUnit(); - if (!target) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - std::string argstr = args; - if (argstr == "all") - { - target->RemoveAllAuras(); - return true; - } - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - if (!spellId) - return false; - - target->RemoveAurasDueToSpell(spellId); - - return true; - } - // Teleport to Player - static bool HandleAppearCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - Player* _player = handler->GetSession()->GetPlayer(); - if (target == _player || targetGuid == _player->GetGUID()) - { - handler->SendSysMessage(LANG_CANT_TELEPORT_SELF); - handler->SetSentErrorMessage(true); - return false; - } - - if (target) - { - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - std::string chrNameLink = handler->playerLink(targetName); - - Map* map = target->GetMap(); - if (map->IsBattlegroundOrArena()) - { - // only allow if gm mode is on - if (!_player->isGameMaster()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - // if both players are in different bgs - else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) - _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff - - // all's well, set bg id - // when porting out from the bg, it will be reset to 0 - _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); - // remember current position as entry point for return at bg end teleportation - if (!_player->GetMap()->IsBattlegroundOrArena()) - _player->SetBattlegroundEntryPoint(); - } - else if (map->IsDungeon()) - { - // we have to go to instance, and can go to player only if: - // 1) we are in his group (either as leader or as member) - // 2) we are not bound to any group and have GM mode on - if (_player->GetGroup()) - { - // we are in group, we can go only if we are in the player group - if (_player->GetGroup() != target->GetGroup()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - // we are not in group, let's verify our GM mode - if (!_player->isGameMaster()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - // if the player or the player's group is bound to another instance - // the player will not be bound to another one - InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid())); - if (!bind) - { - Group* group = _player->GetGroup(); - // if no bind exists, create a solo bind - InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind - if (!gBind) - if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) - _player->BindToInstance(save, !save->CanReset()); - } - - if (map->IsRaid()) - _player->SetRaidDifficulty(target->GetRaidDifficulty()); - else - _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); - } - - handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); - - // stop flight if need - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - _player->SaveRecallPosition(); - - // to point to see at target with same orientation - float x, y, z; - target->GetContactPoint(_player, x, y, z); - - _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); - _player->SetPhaseMask(target->GetPhaseMask(), true); - } - else - { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); - - // to point where player stay (if loaded) - float x, y, z, o; - uint32 map; - bool in_flight; - if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid)) - return false; - - // stop flight if need - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - _player->SaveRecallPosition(); - - _player->TeleportTo(map, x, y, z, _player->GetOrientation()); - } - - return true; - } - // Summon Player - static bool HandleSummonCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - Player* _player = handler->GetSession()->GetPlayer(); - if (target == _player || targetGuid == _player->GetGUID()) - { - handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF); - handler->SetSentErrorMessage(true); - return false; - } - - if (target) - { - std::string nameLink = handler->playerLink(targetName); - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - if (target->IsBeingTeleported()) - { - handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - Map* map = handler->GetSession()->GetPlayer()->GetMap(); - - if (map->IsBattlegroundOrArena()) - { - // only allow if gm mode is on - if (!_player->isGameMaster()) - { - handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - // if both players are in different bgs - else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId()) - target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff - - // all's well, set bg id - // when porting out from the bg, it will be reset to 0 - target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId()); - // remember current position as entry point for return at bg end teleportation - if (!target->GetMap()->IsBattlegroundOrArena()) - target->SetBattlegroundEntryPoint(); - } - else if (map->IsDungeon()) - { - Map* map = target->GetMap(); - - if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId()) - target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true); - - // we are in instance, and can summon only player in our group with us as lead - if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() || - (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || - (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())) - // the last check is a bit excessive, but let it be, just in case - { - handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); - if (handler->needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); - - // stop flight if need - if (target->isInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - target->SaveRecallPosition(); - - // before GM - float x, y, z; - handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); - target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); - target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true); - } - else - { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE)); - - // in point where GM stay - Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(), - handler->GetSession()->GetPlayer()->GetPositionX(), - handler->GetSession()->GetPlayer()->GetPositionY(), - handler->GetSession()->GetPlayer()->GetPositionZ(), - handler->GetSession()->GetPlayer()->GetOrientation(), - handler->GetSession()->GetPlayer()->GetZoneId(), - targetGuid); - } - - return true; - } - // Summon group of player - static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args) - { - Player* target; - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - Group* group = target->GetGroup(); - - std::string nameLink = handler->GetNameLink(target); - - if (!group) - { - handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - Map* gmMap = handler->GetSession()->GetPlayer()->GetMap(); - bool toInstance = gmMap->Instanceable(); - - // we are in instance, and can summon only player in our group with us as lead - if (toInstance && ( - !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || - (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))) - // the last check is a bit excessive, but let it be, just in case - { - handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); - handler->SetSentErrorMessage(true); - return false; - } - - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* player = itr->getSource(); - - if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession()) - continue; - - // check online security - if (handler->HasLowerSecurity(player, 0)) - return false; - - std::string plNameLink = handler->GetNameLink(player); - - if (player->IsBeingTeleported() == true) - { - handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - if (toInstance) - { - Map* playerMap = player->GetMap(); - - if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId()) - { - // cannot summon from instance to instance - handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); - if (handler->needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); - - // stop flight if need - if (player->isInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case - else - player->SaveRecallPosition(); - - // before GM - float x, y, z; - handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize()); - player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation()); - } - - return true; - } - - static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/) - { - handler->ShowHelpForCommand(handler->getCommandTable(), ""); - return true; - } - - static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* target = handler->getSelectedUnit(); - - if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (handler->HasLowerSecurity((Player*)target, 0, false)) - return false; - } - - if (target->isAlive()) - { - if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) - handler->GetSession()->GetPlayer()->Kill(target); - else - handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - return true; - } - - static bool HandleReviveCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) - return false; - - if (target) - { - target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); - target->SpawnCorpseBones(); - target->SaveToDB(); - } - else - // will resurrected at login without corpse - sObjectAccessor->ConvertCorpseForPlayer(targetGuid); - - return true; - } - - static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - // If player is not mounted, so go out :) - if (!player->IsMounted()) - { - handler->SendSysMessage(LANG_CHAR_NON_MOUNTED); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->isInFlight()) - { - handler->SendSysMessage(LANG_YOU_IN_FLIGHT); - handler->SetSentErrorMessage(true); - return false; - } - - player->Dismount(); - player->RemoveAurasByType(SPELL_AURA_MOUNTED); - return true; - } - - static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) - { - uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); - - if (guid == 0) - { - handler->SendSysMessage(LANG_NO_SELECTION); - handler->SetSentErrorMessage(true); - return false; - } - - handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); - return true; - } - - static bool HandleHelpCommand(ChatHandler* handler, char const* args) - { - char const* cmd = strtok((char*)args, " "); - if (!cmd) - { - handler->ShowHelpForCommand(handler->getCommandTable(), "help"); - handler->ShowHelpForCommand(handler->getCommandTable(), ""); - } - else - { - if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd)) - handler->SendSysMessage(LANG_NO_HELP_CMD); - } - - return true; - } - // move item to other slot - static bool HandleItemMoveCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char const* param1 = strtok((char*)args, " "); - if (!param1) - return false; - - char const* param2 = strtok(NULL, " "); - if (!param2) - return false; - - uint8 srcSlot = uint8(atoi(param1)); - uint8 dstSlot = uint8(atoi(param2)); - - if (srcSlot == dstSlot) - return true; - - if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true)) - return false; - - if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false)) - return false; - - uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot); - uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot); - - handler->GetSession()->GetPlayer()->SwapItem(src, dst); - - return true; - } - - static bool HandleCooldownCommand(ChatHandler* handler, char const* args) - { - Player* target = handler->getSelectedPlayer(); - if (!target) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - - std::string nameLink = handler->GetNameLink(target); - - if (!*args) - { - target->RemoveAllSpellCooldown(); - handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str()); - } - else - { - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellIid = handler->extractSpellIdFromLink((char*)args); - if (!spellIid) - return false; - - if (!sSpellMgr->GetSpellInfo(spellIid)) - { - handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - target->RemoveSpellCooldown(spellIid, true); - handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); - } - return true; - } - - static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args) - { - WorldObject* obj = NULL; - - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); - - if (!obj) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - obj = handler->getSelectedUnit(); - - if (!obj) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj)); - return true; - } - // Teleport player to last position - static bool HandleRecallCommand(ChatHandler* handler, char const* args) - { - Player* target; - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - if (target->IsBeingTeleported()) - { - handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - // stop flight if need - if (target->isInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - - target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); - return true; - } - - static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - // save GM account without delay and output message - if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) - { - if (Player* target = handler->getSelectedPlayer()) - target->SaveToDB(); - else - player->SaveToDB(); - handler->SendSysMessage(LANG_PLAYER_SAVED); - return true; - } - - // save if the player has last been saved over 20 seconds ago - uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); - if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS)) - player->SaveToDB(); - - return true; - } - - // Save all players in the world - static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/) - { - sObjectAccessor->SaveAllPlayers(); - handler->SendSysMessage(LANG_PLAYERS_SAVED); - return true; - } - - // kick player - static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args) - { - Player* target = NULL; - std::string playerName; - if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) - return false; - - if (handler->GetSession() && target == handler->GetSession()->GetPlayer()) - { - handler->SendSysMessage(LANG_COMMAND_KICKSELF); - handler->SetSentErrorMessage(true); - return false; - } - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD)) - sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); - else - handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); - - target->GetSession()->KickPlayer(); - - return true; - } - - static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - if (player->isInFlight()) - { - handler->SendSysMessage(LANG_YOU_IN_FLIGHT); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->isInCombat()) - { - handler->SendSysMessage(LANG_YOU_IN_COMBAT); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { - // if player is dead and stuck, send ghost to graveyard - player->RepopAtGraveyard(); - return true; - } - - // cast spell Stuck - player->CastSpell(player, 7355, false); - return true; - } - // Enable on\off all taxi paths - static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - std::string argStr = (char*)args; - - Player* chr = handler->getSelectedPlayer(); - - if (!chr) - chr = handler->GetSession()->GetPlayer(); - else if (handler->HasLowerSecurity(chr, 0)) // check online security - return false; - - if (argStr == "on") - { - chr->SetTaxiCheater(true); - handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str()); - if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); - return true; - } - - if (argStr == "off") - { - chr->SetTaxiCheater(false); - handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str()); - if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); - - return true; - } - - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - - return false; - } - - static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char* px = strtok((char*)args, " "); - if (!px) - return false; - - uint32 graveyardId = uint32(atoi(px)); - - uint32 team; - - char* px2 = strtok(NULL, " "); - - if (!px2) - team = 0; - else if (strncmp(px2, "horde", 6) == 0) - team = HORDE; - else if (strncmp(px2, "alliance", 9) == 0) - team = ALLIANCE; - else - return false; - - WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId); - - if (!graveyard) - { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId); - handler->SetSentErrorMessage(true); - return false; - } - - Player* player = handler->GetSession()->GetPlayer(); - - uint32 zoneId = player->GetZoneId(); - - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); - if (!areaEntry || areaEntry->zone !=0) - { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId); - handler->SetSentErrorMessage(true); - return false; - } - - if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team)) - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId); - else - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId); - - return true; - } - - static bool HandleNearGraveCommand(ChatHandler* handler, char const* args) - { - uint32 team; - - size_t argStr = strlen(args); - - if (!*args) - team = 0; - else if (strncmp((char*)args, "horde", argStr) == 0) - team = HORDE; - else if (strncmp((char*)args, "alliance", argStr) == 0) - team = ALLIANCE; - else - return false; - - Player* player = handler->GetSession()->GetPlayer(); - uint32 zone_id = player->GetZoneId(); - - WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); - - if (graveyard) - { - uint32 graveyardId = graveyard->ID; - - GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id); - if (!data) - { - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId); - handler->SetSentErrorMessage(true); - return false; - } - - team = data->team; - - std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); - - if (team == 0) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (team == HORDE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (team == ALLIANCE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - - handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id); - } - else - { - std::string team_name; - - if (team == 0) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (team == HORDE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (team == ALLIANCE) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - - if (team == ~uint32(0)) - handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); - else - handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); - } - - return true; - } - - static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - int32 flag = int32(atoi((char*)args)); - - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - if (flag != 0) - { - handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str()); - if (handler->needReportToTarget(playerTarget)) - ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); - } - else - { - handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str()); - if (handler->needReportToTarget(playerTarget)) - ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); - } - - for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) - { - if (flag != 0) - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); - else - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); - } - - return true; - } - - static bool HandleShowAreaCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - int32 area = GetAreaFlagByAreaID(atoi((char*)args)); - int32 offset = area / 32; - uint32 val = uint32((1 << (area % 32))); - - if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) - { - handler->SendSysMessage(LANG_BAD_VALUE); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val))); - - handler->SendSysMessage(LANG_EXPLORE_AREA); - return true; - } - - static bool HandleHideAreaCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - int32 area = GetAreaFlagByAreaID(atoi((char*)args)); - int32 offset = area / 32; - uint32 val = uint32((1 << (area % 32))); - - if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) - { - handler->SendSysMessage(LANG_BAD_VALUE); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val))); - - handler->SendSysMessage(LANG_UNEXPLORE_AREA); - return true; - } - - static bool HandleAddItemCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - uint32 itemId = 0; - - if (args[0] == '[') // [name] manual form - { - char const* itemNameStr = strtok((char*)args, "]"); - - if (itemNameStr && itemNameStr[0]) - { - std::string itemName = itemNameStr+1; - WorldDatabase.EscapeString(itemName); - - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); - stmt->setString(0, itemName); - PreparedQueryResult result = WorldDatabase.Query(stmt); - - if (!result) - { - handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1); - handler->SetSentErrorMessage(true); - return false; - } - itemId = result->Fetch()->GetUInt32(); - } - else - return false; - } - else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r - { - char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); - if (!id) - return false; - itemId = uint32(atol(id)); - } - - char const* ccount = strtok(NULL, " "); - - int32 count = 1; - - if (ccount) - count = strtol(ccount, NULL, 10); - - if (count == 0) - count = 1; - - Player* player = handler->GetSession()->GetPlayer(); - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - playerTarget = player; - - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); - - ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); - if (!itemTemplate) - { - handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); - handler->SetSentErrorMessage(true); - return false; - } - - // Subtract - if (count < 0) - { - playerTarget->DestroyItemCount(itemId, -count, true, false); - handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); - return true; - } - - // Adding items - uint32 noSpaceForCount = 0; - - // check space and find places - ItemPosCountVec dest; - InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) // convert to possible store amount - count -= noSpaceForCount; - - if (count == 0 || dest.empty()) // can't add any - { - handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); - handler->SetSentErrorMessage(true); - return false; - } - - Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); - - // remove binding (let GM give it to another player later) - if (player == playerTarget) - for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) - if (Item* item1 = player->GetItemByPos(itr->pos)) - item1->SetBinding(false); - - if (count > 0 && item) - { - player->SendNewItem(item, count, false, true); - if (player != playerTarget) - playerTarget->SendNewItem(item, count, true, false); - } - - if (noSpaceForCount > 0) - handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); - - return true; - } - - static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r - if (!id) - return false; - - uint32 itemSetId = atol(id); - - // prevent generation all items with itemset field value '0' - if (itemSetId == 0) - { - handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); - handler->SetSentErrorMessage(true); - return false; - } - - Player* player = handler->GetSession()->GetPlayer(); - Player* playerTarget = handler->getSelectedPlayer(); - if (!playerTarget) - playerTarget = player; - - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); - - bool found = false; - ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); - for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) - { - if (itr->second.ItemSet == itemSetId) - { - found = true; - ItemPosCountVec dest; - InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); - if (msg == EQUIP_ERR_OK) - { - Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); - - // remove binding (let GM give it to another player later) - if (player == playerTarget) - item->SetBinding(false); - - player->SendNewItem(item, 1, false, true); - if (player != playerTarget) - playerTarget->SendNewItem(item, 1, true, false); - } - else - { - player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); - handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); - } - } - } - - if (!found) - { - handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); - handler->SetSentErrorMessage(true); - return false; - } - - return true; - } - - static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/) - { - handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID()); - return true; - } - - static bool HandleChangeWeather(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - // Weather is OFF - if (!sWorld->getBoolConfig(CONFIG_WEATHER)) - { - handler->SendSysMessage(LANG_WEATHER_DISABLED); - handler->SetSentErrorMessage(true); - return false; - } - - // *Change the weather of a cell - char const* px = strtok((char*)args, " "); - char const* py = strtok(NULL, " "); - - if (!px || !py) - return false; - - uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand - float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather - - Player* player = handler->GetSession()->GetPlayer(); - uint32 zoneid = player->GetZoneId(); - - Weather* weather = WeatherMgr::FindWeather(zoneid); - - if (!weather) - weather = WeatherMgr::AddWeather(zoneid); - if (!weather) - { - handler->SendSysMessage(LANG_NO_WEATHER); - handler->SetSentErrorMessage(true); - return false; - } - - weather->SetWeather(WeatherType(type), grade); - - return true; - } - - - static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/) - { - Player* SelectedPlayer = handler->getSelectedPlayer(); - if (!SelectedPlayer) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - // each skills that have max skill value dependent from level seted to current level max skill value - SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); - return true; - } - - static bool HandleSetSkillCommand(ChatHandler* handler, char const* args) - { - // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r - char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill"); - if (!skillStr) - return false; - - char const* levelStr = strtok(NULL, " "); - if (!levelStr) - return false; - - char const* maxPureSkill = strtok(NULL, " "); - - int32 skill = atoi(skillStr); - if (skill <= 0) - { - handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); - handler->SetSentErrorMessage(true); - return false; - } - - int32 level = uint32(atol(levelStr)); - - Player* target = handler->getSelectedPlayer(); - if (!target) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill); - if (!skillLine) - { - handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); - handler->SetSentErrorMessage(true); - return false; - } - - std::string tNameLink = handler->GetNameLink(target); - - if (!target->GetSkillValue(skill)) - { - handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]); - handler->SetSentErrorMessage(true); - return false; - } - - uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill); - - if (level <= 0 || level > max || max <= 0) - return false; - - target->SetSkill(skill, target->GetSkillStep(skill), level, max); - handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max); - - return true; - } - // show info of player - static bool HandlePInfoCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); - - if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) - { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); - targetGuid = parseGUID; - } - else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - uint32 accId = 0; - uint32 money = 0; - uint32 totalPlayerTime = 0; - uint8 level = 0; - uint32 latency = 0; - uint8 race; - uint8 Class; - int64 muteTime = 0; - int64 banTime = -1; - uint32 mapId; - uint32 areaId; - uint32 phase = 0; - - // get additional information from Player object - if (target) - { - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - accId = target->GetSession()->GetAccountId(); - money = target->GetMoney(); - totalPlayerTime = target->GetTotalPlayedTime(); - level = target->getLevel(); - latency = target->GetSession()->GetLatency(); - race = target->getRace(); - Class = target->getClass(); - muteTime = target->GetSession()->m_muteTime; - mapId = target->GetMapId(); - areaId = target->GetAreaId(); - phase = target->GetPhaseMask(); - } - // get additional information from DB - else - { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - return false; - - Field* fields = result->Fetch(); - totalPlayerTime = fields[0].GetUInt32(); - level = fields[1].GetUInt8(); - money = fields[2].GetUInt32(); - accId = fields[3].GetUInt32(); - race = fields[4].GetUInt8(); - Class = fields[5].GetUInt8(); - mapId = fields[6].GetUInt16(); - areaId = fields[7].GetUInt16(); - } - - std::string userName = handler->GetTrinityString(LANG_ERROR); - std::string eMail = handler->GetTrinityString(LANG_ERROR); - std::string lastIp = handler->GetTrinityString(LANG_ERROR); - uint32 security = 0; - std::string lastLogin = handler->GetTrinityString(LANG_ERROR); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); - stmt->setInt32(0, int32(realmID)); - stmt->setUInt32(1, accId); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (result) - { - Field* fields = result->Fetch(); - userName = fields[0].GetString(); - security = fields[1].GetUInt8(); - eMail = fields[2].GetString(); - muteTime = fields[5].GetUInt64(); - - if (eMail.empty()) - eMail = "-"; - - if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)) - { - lastIp = fields[3].GetString(); - lastLogin = fields[4].GetString(); - - uint32 ip = inet_addr(lastIp.c_str()); -#if TRINITY_ENDIAN == BIGENDIAN - EndianConvertReverse(ip); -#endif - - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); - - stmt->setUInt32(0, ip); - - PreparedQueryResult result2 = WorldDatabase.Query(stmt); - - if (result2) - { - Field* fields2 = result2->Fetch(); - lastIp.append(" ("); - lastIp.append(fields2[0].GetString()); - lastIp.append(")"); - } - } - else - { - lastIp = "-"; - lastLogin = "-"; - } - } - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency); - - std::string bannedby = "unknown"; - std::string banreason = ""; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS); - stmt->setUInt32(0, accId); - PreparedQueryResult result2 = LoginDatabase.Query(stmt); - if (!result2) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); - result2 = CharacterDatabase.Query(stmt); - } - - if (result2) - { - Field* fields = result2->Fetch(); - banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); - bannedby = fields[2].GetString(); - banreason = fields[3].GetString(); - } - - if (muteTime > 0) - handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str()); - - if (banTime >= 0) - handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str()); - - std::string raceStr, ClassStr; - switch (race) - { - case RACE_HUMAN: - raceStr = "Human"; - break; - case RACE_ORC: - raceStr = "Orc"; - break; - case RACE_DWARF: - raceStr = "Dwarf"; - break; - case RACE_NIGHTELF: - raceStr = "Night Elf"; - break; - case RACE_UNDEAD_PLAYER: - raceStr = "Undead"; - break; - case RACE_TAUREN: - raceStr = "Tauren"; - break; - case RACE_GNOME: - raceStr = "Gnome"; - break; - case RACE_TROLL: - raceStr = "Troll"; - break; - case RACE_BLOODELF: - raceStr = "Blood Elf"; - break; - case RACE_DRAENEI: - raceStr = "Draenei"; - break; - } - - switch (Class) - { - case CLASS_WARRIOR: - ClassStr = "Warrior"; - break; - case CLASS_PALADIN: - ClassStr = "Paladin"; - break; - case CLASS_HUNTER: - ClassStr = "Hunter"; - break; - case CLASS_ROGUE: - ClassStr = "Rogue"; - break; - case CLASS_PRIEST: - ClassStr = "Priest"; - break; - case CLASS_DEATH_KNIGHT: - ClassStr = "Death Knight"; - break; - case CLASS_SHAMAN: - ClassStr = "Shaman"; - break; - case CLASS_MAGE: - ClassStr = "Mage"; - break; - case CLASS_WARLOCK: - ClassStr = "Warlock"; - break; - case CLASS_DRUID: - ClassStr = "Druid"; - break; - } - - std::string timeStr = secsToTimeString(totalPlayerTime, true, true); - uint32 gold = money /GOLD; - uint32 silv = (money % GOLD) / SILVER; - uint32 copp = (money % GOLD) % SILVER; - handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp); - - // Add map, zone, subzone and phase to output - int locale = handler->GetSessionDbcLocale(); - std::string areaName = ""; - std::string zoneName = ""; - - MapEntry const* map = sMapStore.LookupEntry(mapId); - - AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); - if (area) - { - areaName = area->area_name[locale]; - - AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); - if (zone) - zoneName = zone->area_name[locale]; - } - - if (target) - { - if (!zoneName.empty()) - handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase); - else - handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "", phase); - } - else - handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); - - return true; - } - - static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - // accept only explicitly selected target (not implicitly self targeting case) - Unit* target = handler->getSelectedUnit(); - if (player->GetSelection() && target) - { - if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) - { - handler->SendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (target->isDead()) - target->ToCreature()->Respawn(); - return true; - } - - CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - - Trinity::RespawnDo u_do; - Trinity::WorldObjectWorker worker(player, u_do); - - TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); - cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); - - return true; - } - // mute player for some times - static bool HandleMuteCommand(ChatHandler* handler, char const* args) - { - char* nameStr; - char* delayStr; - handler->extractOptFirstArg((char*)args, &nameStr, &delayStr); - if (!delayStr) - return false; - - char const* muteReason = strtok(NULL, "\r"); - std::string muteReasonStr = "No reason"; - if (muteReason != NULL) - muteReasonStr = muteReason; - - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) - return false; - - uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - - // find only player from same account if any - if (!target) - if (WorldSession* session = sWorld->FindSession(accountId)) - target = session->GetPlayer(); - - uint32 notSpeakTime = uint32(atoi(delayStr)); - - // must have strong lesser security level - if (handler->HasLowerSecurity (target, targetGuid, true)) - return false; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); - - if (target) - { - // Target is online, mute will be in effect right away. - int64 muteTime = time(NULL) + notSpeakTime * MINUTE; - target->GetSession()->m_muteTime = muteTime; - stmt->setInt64(0, muteTime); - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); - } - else - { - // Target is offline, mute will be in effect starting from the next login. - int32 muteTime = -int32(notSpeakTime * MINUTE); - stmt->setInt64(0, muteTime); - } - - stmt->setUInt32(1, accountId); - LoginDatabase.Execute(stmt); - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str()); - - return true; - } - - // unmute player - static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) - { - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - - // find only player from same account if any - if (!target) - if (WorldSession* session = sWorld->FindSession(accountId)) - target = session->GetPlayer(); - - // must have strong lesser security level - if (handler->HasLowerSecurity (target, targetGuid, true)) - return false; - - if (target) - { - if (target->CanSpeak()) - { - handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED); - handler->SetSentErrorMessage(true); - return false; - } - - target->GetSession()->m_muteTime = 0; - } - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); - stmt->setInt64(0, 0); - stmt->setUInt32(1, accountId); - LoginDatabase.Execute(stmt); - - if (target) - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); - - std::string nameLink = handler->playerLink(targetName); - - handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); - - return true; - } - - - static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow()); - - MotionMaster* motionMaster = unit->GetMotionMaster(); - float x, y, z; - motionMaster->GetDestination(x, y, z); - - for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) - { - MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i); - if (!movementGenerator) - { - handler->SendSysMessage("Empty"); - continue; - } - - switch (movementGenerator->GetMovementGeneratorType()) - { - case IDLE_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_IDLE); - break; - case RANDOM_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_RANDOM); - break; - case WAYPOINT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT); - break; - case ANIMAL_RANDOM_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); - break; - case CONFUSED_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_CONFUSED); - break; - case CHASE_MOTION_TYPE: - { - Unit* target = NULL; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast const*>(movementGenerator)->GetTarget(); - else - target = static_cast const*>(movementGenerator)->GetTarget(); - - if (!target) - handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); - else - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); - break; - } - case FOLLOW_MOTION_TYPE: - { - Unit* target = NULL; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast const*>(movementGenerator)->GetTarget(); - else - target = static_cast const*>(movementGenerator)->GetTarget(); - - if (!target) - handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); - else - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); - break; - } - case HOME_MOTION_TYPE: - { - if (unit->GetTypeId() == TYPEID_UNIT) - handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); - else - handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); - break; - } - case FLIGHT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_FLIGHT); - break; - case POINT_MOTION_TYPE: - { - handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); - break; - } - case FLEEING_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_FEAR); - break; - case DISTRACT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_DISTRACT); - break; - case EFFECT_MOTION_TYPE: - handler->SendSysMessage(LANG_MOVEGENS_EFFECT); - break; - default: - handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType()); - break; - } - } - return true; - } - /* - ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator - Without this function 3rd party scripting library will get linking errors (unresolved external) - when attempting to use the PointMovementGenerator - */ - static bool HandleComeToMeCommand(ChatHandler* handler, char const* args) - { - char const* newFlagStr = strtok((char*)args, " "); - if (!newFlagStr) - return false; - - Creature* caster = handler->getSelectedCreature(); - if (!caster) - { - handler->SendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - Player* player = handler->GetSession()->GetPlayer(); - - caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - - return true; - } - - static bool HandleDamageCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Unit* target = handler->getSelectedUnit(); - if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (handler->HasLowerSecurity((Player*)target, 0, false)) - return false; - } - - if (!target->isAlive()) - return true; - - char* damageStr = strtok((char*)args, " "); - if (!damageStr) - return false; - - int32 damage_int = atoi((char*)damageStr); - if (damage_int <= 0) - return true; - - uint32 damage = damage_int; - - char* schoolStr = strtok((char*)NULL, " "); - - // flat melee damage without resistence/etc reduction - if (!schoolStr) - { - handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - if (target != handler->GetSession()->GetPlayer()) - handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); - return true; - } - - uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; - if (school >= MAX_SPELL_SCHOOL) - return false; - - SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); - - if (Unit::IsDamageReducedByArmor(schoolmask)) - damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); - - char* spellStr = strtok((char*)NULL, " "); - - // melee damage by specific school - if (!spellStr) - { - uint32 absorb = 0; - uint32 resist = 0; - - handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); - - if (damage <= absorb + resist) - return true; - - damage -= absorb + resist; - - handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb); - handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); - handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); - return true; - } - - // non-melee damage - - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form - uint32 spellid = handler->extractSpellIdFromLink((char*)args); - if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) - return false; - - handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); - return true; - } - - static bool HandleCombatStopCommand(ChatHandler* handler, char const* args) - { - Player* target = NULL; - - if (args && strlen(args) > 0) - { - target = sObjectAccessor->FindPlayerByName(args); - if (!target) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - - if (!target) - { - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - } - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - target->CombatStop(); - target->getHostileRefManager().deleteReferences(); - return true; - } - - static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/) - { - sArenaTeamMgr->DistributeArenaPoints(); - return true; - } - - static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args) - { - Player* target; - if (!handler->extractPlayerTarget((char*)args, &target)) - return false; - - // check online security - if (handler->HasLowerSecurity(target, 0)) - return false; - - // Repair items - target->DurabilityRepairAll(false, 0, false); - - handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str()); - if (handler->needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); - - return true; - } - - static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* player = handler->getSelectedPlayer(); - if (!player) - { - handler->PSendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - - // check online security - if (handler->HasLowerSecurity(player, 0)) - return false; - - if (strncmp(args, "on", 3) == 0) - player->SetMovement(MOVE_WATER_WALK); // ON - else if (strncmp(args, "off", 4) == 0) - player->SetMovement(MOVE_LAND_WALK); // OFF - else - { - handler->SendSysMessage(LANG_USE_BOL); - return false; - } - - handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str()); - if (handler->needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str()); - return true; - } - - // Send mail by command - static bool HandleSendMailCommand(ChatHandler* handler, char const* args) - { - // format: name "subject text" "mail text" - Player* target; - uint64 targetGuid; - std::string targetName; - if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char const* msgSubject = handler->extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char const* msgText = handler->extractQuotedArg(tail2); - if (!msgText) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - //- TODO: Fix poor design - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - MailDraft(subject, text) - .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); - - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; - } - // Send items by mail - static bool HandleSendItemsCommand(ChatHandler* handler, char const* args) - { - // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] - Player* receiver; - uint64 receiverGuid; - std::string receiverName; - if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char const* msgSubject = handler->extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char const* msgText = handler->extractQuotedArg(tail2); - if (!msgText) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // extract items - typedef std::pair ItemPair; - typedef std::list< ItemPair > ItemPairs; - ItemPairs items; - - // get all tail string - char* tail = strtok(NULL, ""); - - // get from tail next item str - while (char* itemStr = strtok(tail, " ")) - { - // and get new tail - tail = strtok(NULL, ""); - - // parse item str - char const* itemIdStr = strtok(itemStr, ":"); - char const* itemCountStr = strtok(NULL, " "); - - uint32 itemId = atoi(itemIdStr); - if (!itemId) - return false; - - ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId); - if (!item_proto) - { - handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1; - if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount))) - { - handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId); - handler->SetSentErrorMessage(true); - return false; - } - - while (itemCount > item_proto->GetMaxStackSize()) - { - items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize())); - itemCount -= item_proto->GetMaxStackSize(); - } - - items.push_back(ItemPair(itemId, itemCount)); - - if (items.size() > MAX_MAIL_ITEMS) - { - handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); - handler->SetSentErrorMessage(true); - return false; - } - } - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - // fill mail - MailDraft draft(subject, text); - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) - { - if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0)) - { - item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted - draft.AddItem(item); - } - } - - draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = handler->playerLink(receiverName); - handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; - } - /// Send money by mail - static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args) - { - /// format: name "subject text" "mail text" money - - Player* receiver; - uint64 receiverGuid; - std::string receiverName; - if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) - return false; - - char* tail1 = strtok(NULL, ""); - if (!tail1) - return false; - - char* msgSubject = handler->extractQuotedArg(tail1); - if (!msgSubject) - return false; - - char* tail2 = strtok(NULL, ""); - if (!tail2) - return false; - - char* msgText = handler->extractQuotedArg(tail2); - if (!msgText) - return false; - - char* moneyStr = strtok(NULL, ""); - int32 money = moneyStr ? atoi(moneyStr) : 0; - if (money <= 0) - return false; - - // msgSubject, msgText isn't NUL after prev. check - std::string subject = msgSubject; - std::string text = msgText; - - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - MailDraft(subject, text) - .AddMoney(money) - .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); - - CharacterDatabase.CommitTransaction(trans); - - std::string nameLink = handler->playerLink(receiverName); - handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); - return true; - } - /// Send a message to a player in game - static bool HandleSendMessageCommand(ChatHandler* handler, char const* args) - { - /// - Find the player - Player* player; - if (!handler->extractPlayerTarget((char*)args, &player)) - return false; - - char* msgStr = strtok(NULL, ""); - if (!msgStr) - return false; - - ///- Check that he is not logging out. - if (player->GetSession()->isLogingOut()) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - - /// - Send the message - // Use SendAreaTriggerMessage for fastest delivery. - player->GetSession()->SendAreaTriggerMessage("%s", msgStr); - player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); - - // Confirmation message - std::string nameLink = handler->GetNameLink(player); - handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr); - - return true; - } - - static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - Creature* creatureTarget = handler->getSelectedCreature(); - - if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) - { - handler->PSendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry()); - // Creatures with family 0 crashes the server - if (!creatrueTemplate->family) - { - handler->PSendSysMessage("This creature cannot be tamed. (family id: 0)."); - handler->SetSentErrorMessage(true); - return false; - } - - if (player->GetPetGUID()) - { - handler->PSendSysMessage("You already have a pet"); - handler->SetSentErrorMessage(true); - return false; - } - - // Everything looks OK, create new pet - Pet* pet = new Pet(player, HUNTER_PET); - if (!pet->CreateBaseAtCreature(creatureTarget)) - { - delete pet; - handler->PSendSysMessage("Error 1"); - return false; - } - - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view - - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); - - if (!pet->InitStatsForLevel(creatureTarget->getLevel())) - { - sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); - handler->PSendSysMessage("Error 2"); - delete pet; - return false; - } - - // prepare visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1); - - pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); - // this enables pet details window (Shift+P) - pet->InitPetCreateSpells(); - pet->SetFullHealth(); - - pet->GetMap()->AddToMap(pet->ToCreature()); - - // visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); - - player->SetMinion(pet, true); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - player->PetSpellInitialize(); - - return true; - } - - static bool HandlePetLearnCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* player = handler->GetSession()->GetPlayer(); - Pet* pet = player->GetPet(); - - if (!pet) - { - handler->PSendSysMessage("You have no pet"); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - - if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) - return false; - - // Check if pet already has it - if (pet->HasSpell(spellId)) - { - handler->PSendSysMessage("Pet already has spell: %u", spellId); - handler->SetSentErrorMessage(true); - return false; - } - - // Check if spell is valid - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) - { - handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); - handler->SetSentErrorMessage(true); - return false; - } - - pet->learnSpell(spellId); - - handler->PSendSysMessage("Pet has learned spell %u", spellId); - return true; - } - - static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - Player* player = handler->GetSession()->GetPlayer(); - Pet* pet = player->GetPet(); - if (!pet) - { - handler->PSendSysMessage("You have no pet"); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 spellId = handler->extractSpellIdFromLink((char*)args); - - if (pet->HasSpell(spellId)) - pet->removeSpell(spellId, false); - else - handler->PSendSysMessage("Pet doesn't have that spell"); - - return true; - } - - static bool HandleFreezeCommand(ChatHandler* handler, char const* args) - { - std::string name; - Player* player; - char const* TargetName = strtok((char*)args, " "); // get entered name - if (!TargetName) // if no name entered use target - { - player = handler->getSelectedPlayer(); - if (player) //prevent crash with creature as target - { - name = player->GetName(); - normalizePlayerName(name); - } - } - else // if name entered - { - name = TargetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); - } - - if (!player) - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - - if (player == handler->GetSession()->GetPlayer()) - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); - return true; - } - - // effect - if (player && (player != handler->GetSession()->GetPlayer())) - { - handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); - - // stop combat + make player unattackable + duel stop + stop some spells - player->setFaction(35); - player->CombatStop(); - if (player->IsNonMeleeSpellCasted(true)) - player->InterruptNonMeleeSpells(true); - player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - // if player class = hunter || warlock remove pet if alive - if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) - { - if (Pet* pet = player->GetPet()) - { - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - // not let dismiss dead pet - if (pet && pet->isAlive()) - player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); - } - } - - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); - - // save player - player->SaveToDB(); - } - - return true; - } - - static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args) - { - std::string name; - Player* player; - char* targetName = strtok((char*)args, " "); // Get entered name - - if (targetName) - { - name = targetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); - } - else // If no name was entered - use target - { - player = handler->getSelectedPlayer(); - if (player) - name = player->GetName(); - } - - if (player) - { - handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - - // Reset player faction + allow combat + allow duels - player->setFactionForRace(player->getRace()); - player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - // Remove Freeze spell (allowing movement and spells) - player->RemoveAurasDueToSpell(9454); - - // Save player - player->SaveToDB(); - } - else - { - if (targetName) - { - // Check for offline players - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); - stmt->setString(0, name); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - - // If player found: delete his freeze aura - Field* fields = result->Fetch(); - uint32 lowGuid = fields[0].GetUInt32(); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); - stmt->setUInt32(0, lowGuid); - CharacterDatabase.Execute(stmt); - - handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - return true; - } - else - { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; - } - } - - return true; - } - - static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/) - { - // Get names from DB - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - if (!result) - { - handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); - return true; - } - - // Header of the names - handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE); - - // Output of the results - do - { - Field* fields = result->Fetch(); - std::string player = fields[0].GetString(); - handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); - } - while (result->NextRow()); - - return true; - } - - static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args) - { - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* nameStr = strtok((char*)args, " "); - - if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) - if (group && group->GetLeaderGUID() != guid) - { - group->ChangeLeader(guid); - group->SendUpdate(); - } - - return true; - } - - static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args) - { - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* nameStr = strtok((char*)args, " "); - - if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) - if (group) - group->Disband(); - - return true; - } - - static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args) - { - Player* player = NULL; - Group* group = NULL; - uint64 guid = 0; - char* nameStr = strtok((char*)args, " "); - - if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true)) - if (group) - group->RemoveMember(guid); - - return true; - } - - static bool HandlePlayAllCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - uint32 soundId = atoi((char*)args); - - if (!sSoundEntriesStore.LookupEntry(soundId)) - { - handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); - handler->SetSentErrorMessage(true); - return false; - } - - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID(); - sWorld->SendGlobalMessage(&data); - - handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); - return true; - } - - static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - return false; - - handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true); - return true; - } - - static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - unit = handler->GetSession()->GetPlayer(); - - unit->RemoveCharmAuras(); - - return true; - } - - static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/) - { - Unit* unit = handler->getSelectedUnit(); - if (!unit) - return false; - - handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true); - return true; - } - - static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - if (player->isPossessing()) - return false; - - player->StopCastingBindSight(); - return true; - } -}; - -void AddSC_misc_commandscript() -{ - new misc_commandscript(); -} +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Chat.h" +#include "ScriptMgr.h" +#include "AccountMgr.h" +#include "ArenaTeamMgr.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "Group.h" +#include "InstanceSaveMgr.h" +#include "MovementGenerator.h" +#include "ObjectAccessor.h" +#include "SpellAuras.h" +#include "TargetedMovementGenerator.h" +#include "WeatherMgr.h" +#include "ace/INET_Addr.h" + +class misc_commandscript : public CommandScript +{ +public: + misc_commandscript() : CommandScript("misc_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand groupCommandTable[] = + { + { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL }, + { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand petCommandTable[] = + { + { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL }, + { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL }, + { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand sendCommandTable[] = + { + { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL }, + { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL }, + { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL }, + { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL }, + { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, + { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL }, + { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL }, + { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL }, + { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL }, + { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL }, + { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL }, + { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL }, + { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL }, + { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL }, + { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL }, + { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL }, + { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL }, + { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL }, + { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL }, + { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL }, + { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL }, + { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL }, + { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL }, + { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL }, + { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL }, + { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL }, + { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL }, + { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL }, + { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL }, + { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL }, + { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL }, + { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL }, + { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL }, + { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL }, + { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL }, + { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL }, + { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL }, + { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL }, + { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, + { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, + { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL }, + { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL }, + { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL }, + { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL }, + { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL }, + { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL }, + { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL }, + { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL }, + { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL }, + { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, + { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, + { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL }, + { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, + { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL }, + { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL }, + { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL }, + { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL }, + { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleDevCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER)) + handler->GetSession()->SendNotification(LANG_DEV_ON); + else + handler->GetSession()->SendNotification(LANG_DEV_OFF); + return true; + } + + std::string argstr = (char*)args; + + if (argstr == "on") + { + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); + handler->GetSession()->SendNotification(LANG_DEV_ON); + return true; + } + + if (argstr == "off") + { + handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); + handler->GetSession()->SendNotification(LANG_DEV_OFF); + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + static bool HandleGPSCommand(ChatHandler* handler, char const* args) + { + WorldObject* object = NULL; + if (*args) + { + uint64 guid = handler->extractGuidFromLink((char*)args); + if (guid) + object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); + + if (!object) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + object = handler->getSelectedUnit(); + + if (!object) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + } + + CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); + Cell cell(cellCoord); + + uint32 zoneId, areaId; + object->GetZoneAndAreaId(zoneId, areaId); + + MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); + AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); + + float zoneX = object->GetPositionX(); + float zoneY = object->GetPositionY(); + + Map2ZoneCoordinates(zoneX, zoneY, zoneId); + + Map const* map = object->GetMap(); + float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); + float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + + GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); + + // 63? WHY? + int gridX = 63 - gridCoord.x_coord; + int gridY = 63 - gridCoord.y_coord; + + uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; + + if (haveVMap) + { + if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) + handler->PSendSysMessage("You are outdoors"); + else + handler->PSendSysMessage("You are indoors"); + } + else + handler->PSendSysMessage("no VMAP available for area info"); + + handler->PSendSysMessage(LANG_MAP_POSITION, + object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), + zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), + areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), + object->GetPhaseMask(), + object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), + cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), + zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); + + LiquidData liquidStatus; + ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); + + if (status) + handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); + + return true; + } + + static bool HandleAuraCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) + Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); + + return true; + } + + static bool HandleUnAuraCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + std::string argstr = args; + if (argstr == "all") + { + target->RemoveAllAuras(); + return true; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + if (!spellId) + return false; + + target->RemoveAurasDueToSpell(spellId); + + return true; + } + // Teleport to Player + static bool HandleAppearCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + Player* _player = handler->GetSession()->GetPlayer(); + if (target == _player || targetGuid == _player->GetGUID()) + { + handler->SendSysMessage(LANG_CANT_TELEPORT_SELF); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + std::string chrNameLink = handler->playerLink(targetName); + + Map* map = target->GetMap(); + if (map->IsBattlegroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) + _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff + + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!_player->GetMap()->IsBattlegroundOrArena()) + _player->SetBattlegroundEntryPoint(); + } + else if (map->IsDungeon()) + { + // we have to go to instance, and can go to player only if: + // 1) we are in his group (either as leader or as member) + // 2) we are not bound to any group and have GM mode on + if (_player->GetGroup()) + { + // we are in group, we can go only if we are in the player group + if (_player->GetGroup() != target->GetGroup()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + // we are not in group, let's verify our GM mode + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + // if the player or the player's group is bound to another instance + // the player will not be bound to another one + InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid())); + if (!bind) + { + Group* group = _player->GetGroup(); + // if no bind exists, create a solo bind + InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind + if (!gBind) + if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) + _player->BindToInstance(save, !save->CanReset()); + } + + if (map->IsRaid()) + _player->SetRaidDifficulty(target->GetRaidDifficulty()); + else + _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); + } + + handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + // to point to see at target with same orientation + float x, y, z; + target->GetContactPoint(_player, x, y, z); + + _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); + _player->SetPhaseMask(target->GetPhaseMask(), true); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); + + // to point where player stay (if loaded) + float x, y, z, o; + uint32 map; + bool in_flight; + if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid)) + return false; + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(map, x, y, z, _player->GetOrientation()); + } + + return true; + } + // Summon Player + static bool HandleSummonCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + Player* _player = handler->GetSession()->GetPlayer(); + if (target == _player || targetGuid == _player->GetGUID()) + { + handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF); + handler->SetSentErrorMessage(true); + return false; + } + + if (target) + { + std::string nameLink = handler->playerLink(targetName); + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + Map* map = handler->GetSession()->GetPlayer()->GetMap(); + + if (map->IsBattlegroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId()) + target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff + + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!target->GetMap()->IsBattlegroundOrArena()) + target->SetBattlegroundEntryPoint(); + } + else if (map->IsDungeon()) + { + Map* map = target->GetMap(); + + if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId()) + target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true); + + // we are in instance, and can summon only player in our group with us as lead + if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() || + (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || + (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())) + // the last check is a bit excessive, but let it be, just in case + { + handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); + if (handler->needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + target->SaveRecallPosition(); + + // before GM + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); + target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); + target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE)); + + // in point where GM stay + Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(), + handler->GetSession()->GetPlayer()->GetPositionX(), + handler->GetSession()->GetPlayer()->GetPositionY(), + handler->GetSession()->GetPlayer()->GetPositionZ(), + handler->GetSession()->GetPlayer()->GetOrientation(), + handler->GetSession()->GetPlayer()->GetZoneId(), + targetGuid); + } + + return true; + } + // Summon group of player + static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + Group* group = target->GetGroup(); + + std::string nameLink = handler->GetNameLink(target); + + if (!group) + { + handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + Map* gmMap = handler->GetSession()->GetPlayer()->GetMap(); + bool toInstance = gmMap->Instanceable(); + + // we are in instance, and can summon only player in our group with us as lead + if (toInstance && ( + !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) || + (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))) + // the last check is a bit excessive, but let it be, just in case + { + handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); + handler->SetSentErrorMessage(true); + return false; + } + + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* player = itr->getSource(); + + if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession()) + continue; + + // check online security + if (handler->HasLowerSecurity(player, 0)) + return false; + + std::string plNameLink = handler->GetNameLink(player); + + if (player->IsBeingTeleported() == true) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + if (toInstance) + { + Map* playerMap = player->GetMap(); + + if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId()) + { + // cannot summon from instance to instance + handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); + if (handler->needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); + + // stop flight if need + if (player->isInFlight()) + { + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + player->SaveRecallPosition(); + + // before GM + float x, y, z; + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize()); + player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation()); + } + + return true; + } + + static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/) + { + handler->ShowHelpForCommand(handler->getCommandTable(), ""); + return true; + } + + static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* target = handler->getSelectedUnit(); + + if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (handler->HasLowerSecurity((Player*)target, 0, false)) + return false; + } + + if (target->isAlive()) + { + if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) + handler->GetSession()->GetPlayer()->Kill(target); + else + handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + return true; + } + + static bool HandleReviveCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) + return false; + + if (target) + { + target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); + target->SpawnCorpseBones(); + target->SaveToDB(); + } + else + // will resurrected at login without corpse + sObjectAccessor->ConvertCorpseForPlayer(targetGuid); + + return true; + } + + static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // If player is not mounted, so go out :) + if (!player->IsMounted()) + { + handler->SendSysMessage(LANG_CHAR_NON_MOUNTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isInFlight()) + { + handler->SendSysMessage(LANG_YOU_IN_FLIGHT); + handler->SetSentErrorMessage(true); + return false; + } + + player->Dismount(); + player->RemoveAurasByType(SPELL_AURA_MOUNTED); + return true; + } + + static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) + { + uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); + + if (guid == 0) + { + handler->SendSysMessage(LANG_NO_SELECTION); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + return true; + } + + static bool HandleHelpCommand(ChatHandler* handler, char const* args) + { + char const* cmd = strtok((char*)args, " "); + if (!cmd) + { + handler->ShowHelpForCommand(handler->getCommandTable(), "help"); + handler->ShowHelpForCommand(handler->getCommandTable(), ""); + } + else + { + if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd)) + handler->SendSysMessage(LANG_NO_HELP_CMD); + } + + return true; + } + // move item to other slot + static bool HandleItemMoveCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char const* param1 = strtok((char*)args, " "); + if (!param1) + return false; + + char const* param2 = strtok(NULL, " "); + if (!param2) + return false; + + uint8 srcSlot = uint8(atoi(param1)); + uint8 dstSlot = uint8(atoi(param2)); + + if (srcSlot == dstSlot) + return true; + + if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true)) + return false; + + if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false)) + return false; + + uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot); + uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot); + + handler->GetSession()->GetPlayer()->SwapItem(src, dst); + + return true; + } + + static bool HandleCooldownCommand(ChatHandler* handler, char const* args) + { + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + std::string nameLink = handler->GetNameLink(target); + + if (!*args) + { + target->RemoveAllSpellCooldown(); + handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str()); + } + else + { + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellIid = handler->extractSpellIdFromLink((char*)args); + if (!spellIid) + return false; + + if (!sSpellMgr->GetSpellInfo(spellIid)) + { + handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + target->RemoveSpellCooldown(spellIid, true); + handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); + } + return true; + } + + static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args) + { + WorldObject* obj = NULL; + + if (*args) + { + uint64 guid = handler->extractGuidFromLink((char*)args); + if (guid) + obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + + if (!obj) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + else + { + obj = handler->getSelectedUnit(); + + if (!obj) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + } + + handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj)); + return true; + } + // Teleport player to last position + static bool HandleRecallCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + + target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); + return true; + } + + static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // save GM account without delay and output message + if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) + { + if (Player* target = handler->getSelectedPlayer()) + target->SaveToDB(); + else + player->SaveToDB(); + handler->SendSysMessage(LANG_PLAYER_SAVED); + return true; + } + + // save if the player has last been saved over 20 seconds ago + uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); + if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS)) + player->SaveToDB(); + + return true; + } + + // Save all players in the world + static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/) + { + sObjectAccessor->SaveAllPlayers(); + handler->SendSysMessage(LANG_PLAYERS_SAVED); + return true; + } + + // kick player + static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + std::string playerName; + if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + return false; + + if (handler->GetSession() && target == handler->GetSession()->GetPlayer()) + { + handler->SendSysMessage(LANG_COMMAND_KICKSELF); + handler->SetSentErrorMessage(true); + return false; + } + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD)) + sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); + else + handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str()); + + target->GetSession()->KickPlayer(); + + return true; + } + + static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + if (player->isInFlight()) + { + handler->SendSysMessage(LANG_YOU_IN_FLIGHT); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isInCombat()) + { + handler->SendSysMessage(LANG_YOU_IN_COMBAT); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + { + // if player is dead and stuck, send ghost to graveyard + player->RepopAtGraveyard(); + return true; + } + + // cast spell Stuck + player->CastSpell(player, 7355, false); + return true; + } + // Enable on\off all taxi paths + static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + std::string argStr = (char*)args; + + Player* chr = handler->getSelectedPlayer(); + + if (!chr) + chr = handler->GetSession()->GetPlayer(); + else if (handler->HasLowerSecurity(chr, 0)) // check online security + return false; + + if (argStr == "on") + { + chr->SetTaxiCheater(true); + handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str()); + if (handler->needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); + return true; + } + + if (argStr == "off") + { + chr->SetTaxiCheater(false); + handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str()); + if (handler->needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); + + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + + return false; + } + + static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + if (!px) + return false; + + uint32 graveyardId = uint32(atoi(px)); + + uint32 team; + + char* px2 = strtok(NULL, " "); + + if (!px2) + team = 0; + else if (strncmp(px2, "horde", 6) == 0) + team = HORDE; + else if (strncmp(px2, "alliance", 9) == 0) + team = ALLIANCE; + else + return false; + + WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId); + + if (!graveyard) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + uint32 zoneId = player->GetZoneId(); + + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); + if (!areaEntry || areaEntry->zone !=0) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId); + handler->SetSentErrorMessage(true); + return false; + } + + if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team)) + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId); + else + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId); + + return true; + } + + static bool HandleNearGraveCommand(ChatHandler* handler, char const* args) + { + uint32 team; + + size_t argStr = strlen(args); + + if (!*args) + team = 0; + else if (strncmp((char*)args, "horde", argStr) == 0) + team = HORDE; + else if (strncmp((char*)args, "alliance", argStr) == 0) + team = ALLIANCE; + else + return false; + + Player* player = handler->GetSession()->GetPlayer(); + uint32 zone_id = player->GetZoneId(); + + WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); + + if (graveyard) + { + uint32 graveyardId = graveyard->ID; + + GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id); + if (!data) + { + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId); + handler->SetSentErrorMessage(true); + return false; + } + + team = data->team; + + std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); + + if (team == 0) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (team == HORDE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (team == ALLIANCE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id); + } + else + { + std::string team_name; + + if (team == 0) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (team == HORDE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (team == ALLIANCE) + team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + if (team == ~uint32(0)) + handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); + else + handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); + } + + return true; + } + + static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + int32 flag = int32(atoi((char*)args)); + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + if (flag != 0) + { + handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str()); + if (handler->needReportToTarget(playerTarget)) + ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); + } + else + { + handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str()); + if (handler->needReportToTarget(playerTarget)) + ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); + } + + for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) + { + if (flag != 0) + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); + else + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); + } + + return true; + } + + static bool HandleShowAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + int32 area = GetAreaFlagByAreaID(atoi((char*)args)); + int32 offset = area / 32; + uint32 val = uint32((1 << (area % 32))); + + if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val))); + + handler->SendSysMessage(LANG_EXPLORE_AREA); + return true; + } + + static bool HandleHideAreaCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + int32 area = GetAreaFlagByAreaID(atoi((char*)args)); + int32 offset = area / 32; + uint32 val = uint32((1 << (area % 32))); + + if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val))); + + handler->SendSysMessage(LANG_UNEXPLORE_AREA); + return true; + } + + static bool HandleAddItemCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 itemId = 0; + + if (args[0] == '[') // [name] manual form + { + char const* itemNameStr = strtok((char*)args, "]"); + + if (itemNameStr && itemNameStr[0]) + { + std::string itemName = itemNameStr+1; + WorldDatabase.EscapeString(itemName); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); + stmt->setString(0, itemName); + PreparedQueryResult result = WorldDatabase.Query(stmt); + + if (!result) + { + handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1); + handler->SetSentErrorMessage(true); + return false; + } + itemId = result->Fetch()->GetUInt32(); + } + else + return false; + } + else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r + { + char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); + if (!id) + return false; + itemId = uint32(atol(id)); + } + + char const* ccount = strtok(NULL, " "); + + int32 count = 1; + + if (ccount) + count = strtol(ccount, NULL, 10); + + if (count == 0) + count = 1; + + Player* player = handler->GetSession()->GetPlayer(); + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + playerTarget = player; + + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); + + ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); + if (!itemTemplate) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + // Subtract + if (count < 0) + { + playerTarget->DestroyItemCount(itemId, -count, true, false); + handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + return true; + } + + // Adding items + uint32 noSpaceForCount = 0; + + // check space and find places + ItemPosCountVec dest; + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= noSpaceForCount; + + if (count == 0 || dest.empty()) // can't add any + { + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + handler->SetSentErrorMessage(true); + return false; + } + + Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + + // remove binding (let GM give it to another player later) + if (player == playerTarget) + for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) + if (Item* item1 = player->GetItemByPos(itr->pos)) + item1->SetBinding(false); + + if (count > 0 && item) + { + player->SendNewItem(item, count, false, true); + if (player != playerTarget) + playerTarget->SendNewItem(item, count, true, false); + } + + if (noSpaceForCount > 0) + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + + return true; + } + + static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r + if (!id) + return false; + + uint32 itemSetId = atol(id); + + // prevent generation all items with itemset field value '0' + if (itemSetId == 0) + { + handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + Player* playerTarget = handler->getSelectedPlayer(); + if (!playerTarget) + playerTarget = player; + + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); + + bool found = false; + ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); + for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) + { + if (itr->second.ItemSet == itemSetId) + { + found = true; + ItemPosCountVec dest; + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); + + // remove binding (let GM give it to another player later) + if (player == playerTarget) + item->SetBinding(false); + + player->SendNewItem(item, 1, false, true); + if (player != playerTarget) + playerTarget->SendNewItem(item, 1, true, false); + } + else + { + player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); + handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); + } + } + } + + if (!found) + { + handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/) + { + handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID()); + return true; + } + + static bool HandleChangeWeather(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + // Weather is OFF + if (!sWorld->getBoolConfig(CONFIG_WEATHER)) + { + handler->SendSysMessage(LANG_WEATHER_DISABLED); + handler->SetSentErrorMessage(true); + return false; + } + + // *Change the weather of a cell + char const* px = strtok((char*)args, " "); + char const* py = strtok(NULL, " "); + + if (!px || !py) + return false; + + uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand + float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather + + Player* player = handler->GetSession()->GetPlayer(); + uint32 zoneid = player->GetZoneId(); + + Weather* weather = WeatherMgr::FindWeather(zoneid); + + if (!weather) + weather = WeatherMgr::AddWeather(zoneid); + if (!weather) + { + handler->SendSysMessage(LANG_NO_WEATHER); + handler->SetSentErrorMessage(true); + return false; + } + + weather->SetWeather(WeatherType(type), grade); + + return true; + } + + + static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/) + { + Player* SelectedPlayer = handler->getSelectedPlayer(); + if (!SelectedPlayer) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // each skills that have max skill value dependent from level seted to current level max skill value + SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); + return true; + } + + static bool HandleSetSkillCommand(ChatHandler* handler, char const* args) + { + // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r + char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill"); + if (!skillStr) + return false; + + char const* levelStr = strtok(NULL, " "); + if (!levelStr) + return false; + + char const* maxPureSkill = strtok(NULL, " "); + + int32 skill = atoi(skillStr); + if (skill <= 0) + { + handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + handler->SetSentErrorMessage(true); + return false; + } + + int32 level = uint32(atol(levelStr)); + + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill); + if (!skillLine) + { + handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + handler->SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = handler->GetNameLink(target); + + if (!target->GetSkillValue(skill)) + { + handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]); + handler->SetSentErrorMessage(true); + return false; + } + + uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill); + + if (level <= 0 || level > max || max <= 0) + return false; + + target->SetSkill(skill, target->GetSkillStep(skill), level, max); + handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max); + + return true; + } + // show info of player + static bool HandlePInfoCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + + uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + + if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) + { + target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + targetGuid = parseGUID; + } + else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + uint32 accId = 0; + uint32 money = 0; + uint32 totalPlayerTime = 0; + uint8 level = 0; + uint32 latency = 0; + uint8 race; + uint8 Class; + int64 muteTime = 0; + int64 banTime = -1; + uint32 mapId; + uint32 areaId; + uint32 phase = 0; + + // get additional information from Player object + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + accId = target->GetSession()->GetAccountId(); + money = target->GetMoney(); + totalPlayerTime = target->GetTotalPlayedTime(); + level = target->getLevel(); + latency = target->GetSession()->GetLatency(); + race = target->getRace(); + Class = target->getClass(); + muteTime = target->GetSession()->m_muteTime; + mapId = target->GetMapId(); + areaId = target->GetAreaId(); + phase = target->GetPhaseMask(); + } + // get additional information from DB + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); + stmt->setUInt32(0, GUID_LOPART(targetGuid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + return false; + + Field* fields = result->Fetch(); + totalPlayerTime = fields[0].GetUInt32(); + level = fields[1].GetUInt8(); + money = fields[2].GetUInt32(); + accId = fields[3].GetUInt32(); + race = fields[4].GetUInt8(); + Class = fields[5].GetUInt8(); + mapId = fields[6].GetUInt16(); + areaId = fields[7].GetUInt16(); + } + + std::string userName = handler->GetTrinityString(LANG_ERROR); + std::string eMail = handler->GetTrinityString(LANG_ERROR); + std::string lastIp = handler->GetTrinityString(LANG_ERROR); + uint32 security = 0; + std::string lastLogin = handler->GetTrinityString(LANG_ERROR); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); + stmt->setInt32(0, int32(realmID)); + stmt->setUInt32(1, accId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (result) + { + Field* fields = result->Fetch(); + userName = fields[0].GetString(); + security = fields[1].GetUInt8(); + eMail = fields[2].GetString(); + muteTime = fields[5].GetUInt64(); + + if (eMail.empty()) + eMail = "-"; + + if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)) + { + lastIp = fields[3].GetString(); + lastLogin = fields[4].GetString(); + + uint32 ip = inet_addr(lastIp.c_str()); +#if TRINITY_ENDIAN == BIGENDIAN + EndianConvertReverse(ip); +#endif + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); + + stmt->setUInt32(0, ip); + + PreparedQueryResult result2 = WorldDatabase.Query(stmt); + + if (result2) + { + Field* fields2 = result2->Fetch(); + lastIp.append(" ("); + lastIp.append(fields2[0].GetString()); + lastIp.append(")"); + } + } + else + { + lastIp = "-"; + lastLogin = "-"; + } + } + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency); + + std::string bannedby = "unknown"; + std::string banreason = ""; + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS); + stmt->setUInt32(0, accId); + PreparedQueryResult result2 = LoginDatabase.Query(stmt); + if (!result2) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); + stmt->setUInt32(0, GUID_LOPART(targetGuid)); + result2 = CharacterDatabase.Query(stmt); + } + + if (result2) + { + Field* fields = result2->Fetch(); + banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); + bannedby = fields[2].GetString(); + banreason = fields[3].GetString(); + } + + if (muteTime > 0) + handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str()); + + if (banTime >= 0) + handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str()); + + std::string raceStr, ClassStr; + switch (race) + { + case RACE_HUMAN: + raceStr = "Human"; + break; + case RACE_ORC: + raceStr = "Orc"; + break; + case RACE_DWARF: + raceStr = "Dwarf"; + break; + case RACE_NIGHTELF: + raceStr = "Night Elf"; + break; + case RACE_UNDEAD_PLAYER: + raceStr = "Undead"; + break; + case RACE_TAUREN: + raceStr = "Tauren"; + break; + case RACE_GNOME: + raceStr = "Gnome"; + break; + case RACE_TROLL: + raceStr = "Troll"; + break; + case RACE_BLOODELF: + raceStr = "Blood Elf"; + break; + case RACE_DRAENEI: + raceStr = "Draenei"; + break; + } + + switch (Class) + { + case CLASS_WARRIOR: + ClassStr = "Warrior"; + break; + case CLASS_PALADIN: + ClassStr = "Paladin"; + break; + case CLASS_HUNTER: + ClassStr = "Hunter"; + break; + case CLASS_ROGUE: + ClassStr = "Rogue"; + break; + case CLASS_PRIEST: + ClassStr = "Priest"; + break; + case CLASS_DEATH_KNIGHT: + ClassStr = "Death Knight"; + break; + case CLASS_SHAMAN: + ClassStr = "Shaman"; + break; + case CLASS_MAGE: + ClassStr = "Mage"; + break; + case CLASS_WARLOCK: + ClassStr = "Warlock"; + break; + case CLASS_DRUID: + ClassStr = "Druid"; + break; + } + + std::string timeStr = secsToTimeString(totalPlayerTime, true, true); + uint32 gold = money /GOLD; + uint32 silv = (money % GOLD) / SILVER; + uint32 copp = (money % GOLD) % SILVER; + handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp); + + // Add map, zone, subzone and phase to output + int locale = handler->GetSessionDbcLocale(); + std::string areaName = ""; + std::string zoneName = ""; + + MapEntry const* map = sMapStore.LookupEntry(mapId); + + AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); + if (area) + { + areaName = area->area_name[locale]; + + AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); + if (zone) + zoneName = zone->area_name[locale]; + } + + if (target) + { + if (!zoneName.empty()) + handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase); + else + handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "", phase); + } + else + handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); + + return true; + } + + static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + // accept only explicitly selected target (not implicitly self targeting case) + Unit* target = handler->getSelectedUnit(); + if (player->GetSelection() && target) + { + if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->isDead()) + target->ToCreature()->Respawn(); + return true; + } + + CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); + Cell cell(p); + cell.SetNoCreate(); + + Trinity::RespawnDo u_do; + Trinity::WorldObjectWorker worker(player, u_do); + + TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); + cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); + + return true; + } + // mute player for some times + static bool HandleMuteCommand(ChatHandler* handler, char const* args) + { + char* nameStr; + char* delayStr; + handler->extractOptFirstArg((char*)args, &nameStr, &delayStr); + if (!delayStr) + return false; + + char const* muteReason = strtok(NULL, "\r"); + std::string muteReasonStr = "No reason"; + if (muteReason != NULL) + muteReasonStr = muteReason; + + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) + return false; + + uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld->FindSession(accountId)) + target = session->GetPlayer(); + + uint32 notSpeakTime = uint32(atoi(delayStr)); + + // must have strong lesser security level + if (handler->HasLowerSecurity (target, targetGuid, true)) + return false; + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + + if (target) + { + // Target is online, mute will be in effect right away. + int64 muteTime = time(NULL) + notSpeakTime * MINUTE; + target->GetSession()->m_muteTime = muteTime; + stmt->setInt64(0, muteTime); + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); + } + else + { + // Target is offline, mute will be in effect starting from the next login. + int32 muteTime = -int32(notSpeakTime * MINUTE); + stmt->setInt64(0, muteTime); + } + + stmt->setUInt32(1, accountId); + LoginDatabase.Execute(stmt); + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str()); + + return true; + } + + // unmute player + static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) + { + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld->FindSession(accountId)) + target = session->GetPlayer(); + + // must have strong lesser security level + if (handler->HasLowerSecurity (target, targetGuid, true)) + return false; + + if (target) + { + if (target->CanSpeak()) + { + handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED); + handler->SetSentErrorMessage(true); + return false; + } + + target->GetSession()->m_muteTime = 0; + } + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); + stmt->setInt64(0, 0); + stmt->setUInt32(1, accountId); + LoginDatabase.Execute(stmt); + + if (target) + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); + + std::string nameLink = handler->playerLink(targetName); + + handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); + + return true; + } + + + static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow()); + + MotionMaster* motionMaster = unit->GetMotionMaster(); + float x, y, z; + motionMaster->GetDestination(x, y, z); + + for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) + { + MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i); + if (!movementGenerator) + { + handler->SendSysMessage("Empty"); + continue; + } + + switch (movementGenerator->GetMovementGeneratorType()) + { + case IDLE_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_IDLE); + break; + case RANDOM_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_RANDOM); + break; + case WAYPOINT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT); + break; + case ANIMAL_RANDOM_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); + break; + case CONFUSED_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_CONFUSED); + break; + case CHASE_MOTION_TYPE: + { + Unit* target = NULL; + if (unit->GetTypeId() == TYPEID_PLAYER) + target = static_cast const*>(movementGenerator)->GetTarget(); + else + target = static_cast const*>(movementGenerator)->GetTarget(); + + if (!target) + handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); + else if (target->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); + else + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); + break; + } + case FOLLOW_MOTION_TYPE: + { + Unit* target = NULL; + if (unit->GetTypeId() == TYPEID_PLAYER) + target = static_cast const*>(movementGenerator)->GetTarget(); + else + target = static_cast const*>(movementGenerator)->GetTarget(); + + if (!target) + handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); + else if (target->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); + else + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); + break; + } + case HOME_MOTION_TYPE: + { + if (unit->GetTypeId() == TYPEID_UNIT) + handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); + else + handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); + break; + } + case FLIGHT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_FLIGHT); + break; + case POINT_MOTION_TYPE: + { + handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); + break; + } + case FLEEING_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_FEAR); + break; + case DISTRACT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_DISTRACT); + break; + case EFFECT_MOTION_TYPE: + handler->SendSysMessage(LANG_MOVEGENS_EFFECT); + break; + default: + handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType()); + break; + } + } + return true; + } + /* + ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator + Without this function 3rd party scripting library will get linking errors (unresolved external) + when attempting to use the PointMovementGenerator + */ + static bool HandleComeToMeCommand(ChatHandler* handler, char const* args) + { + char const* newFlagStr = strtok((char*)args, " "); + if (!newFlagStr) + return false; + + Creature* caster = handler->getSelectedCreature(); + if (!caster) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + return true; + } + + static bool HandleDamageCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Unit* target = handler->getSelectedUnit(); + if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (handler->HasLowerSecurity((Player*)target, 0, false)) + return false; + } + + if (!target->isAlive()) + return true; + + char* damageStr = strtok((char*)args, " "); + if (!damageStr) + return false; + + int32 damage_int = atoi((char*)damageStr); + if (damage_int <= 0) + return true; + + uint32 damage = damage_int; + + char* schoolStr = strtok((char*)NULL, " "); + + // flat melee damage without resistence/etc reduction + if (!schoolStr) + { + handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (target != handler->GetSession()->GetPlayer()) + handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); + return true; + } + + uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; + if (school >= MAX_SPELL_SCHOOL) + return false; + + SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); + + if (Unit::IsDamageReducedByArmor(schoolmask)) + damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); + + char* spellStr = strtok((char*)NULL, " "); + + // melee damage by specific school + if (!spellStr) + { + uint32 absorb = 0; + uint32 resist = 0; + + handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); + + if (damage <= absorb + resist) + return true; + + damage -= absorb + resist; + + handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb); + handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); + handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); + return true; + } + + // non-melee damage + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellid = handler->extractSpellIdFromLink((char*)args); + if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) + return false; + + handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); + return true; + } + + static bool HandleCombatStopCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + + if (args && strlen(args) > 0) + { + target = sObjectAccessor->FindPlayerByName(args); + if (!target) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + } + + if (!target) + { + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + } + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + target->CombatStop(); + target->getHostileRefManager().deleteReferences(); + return true; + } + + static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/) + { + sArenaTeamMgr->DistributeArenaPoints(); + return true; + } + + static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args) + { + Player* target; + if (!handler->extractPlayerTarget((char*)args, &target)) + return false; + + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + // Repair items + target->DurabilityRepairAll(false, 0, false); + + handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str()); + if (handler->needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); + + return true; + } + + static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->getSelectedPlayer(); + if (!player) + { + handler->PSendSysMessage(LANG_NO_CHAR_SELECTED); + handler->SetSentErrorMessage(true); + return false; + } + + // check online security + if (handler->HasLowerSecurity(player, 0)) + return false; + + if (strncmp(args, "on", 3) == 0) + player->SetMovement(MOVE_WATER_WALK); // ON + else if (strncmp(args, "off", 4) == 0) + player->SetMovement(MOVE_LAND_WALK); // OFF + else + { + handler->SendSysMessage(LANG_USE_BOL); + return false; + } + + handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str()); + if (handler->needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str()); + return true; + } + + // Send mail by command + static bool HandleSendMailCommand(ChatHandler* handler, char const* args) + { + // format: name "subject text" "mail text" + Player* target; + uint64 targetGuid; + std::string targetName; + if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char const* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char const* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + //- TODO: Fix poor design + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + MailDraft(subject, text) + .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); + + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + // Send items by mail + static bool HandleSendItemsCommand(ChatHandler* handler, char const* args) + { + // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] + Player* receiver; + uint64 receiverGuid; + std::string receiverName; + if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char const* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char const* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // extract items + typedef std::pair ItemPair; + typedef std::list< ItemPair > ItemPairs; + ItemPairs items; + + // get all tail string + char* tail = strtok(NULL, ""); + + // get from tail next item str + while (char* itemStr = strtok(tail, " ")) + { + // and get new tail + tail = strtok(NULL, ""); + + // parse item str + char const* itemIdStr = strtok(itemStr, ":"); + char const* itemCountStr = strtok(NULL, " "); + + uint32 itemId = atoi(itemIdStr); + if (!itemId) + return false; + + ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId); + if (!item_proto) + { + handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1; + if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount))) + { + handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId); + handler->SetSentErrorMessage(true); + return false; + } + + while (itemCount > item_proto->GetMaxStackSize()) + { + items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize())); + itemCount -= item_proto->GetMaxStackSize(); + } + + items.push_back(ItemPair(itemId, itemCount)); + + if (items.size() > MAX_MAIL_ITEMS) + { + handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); + handler->SetSentErrorMessage(true); + return false; + } + } + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + // fill mail + MailDraft draft(subject, text); + + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) + { + if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0)) + { + item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted + draft.AddItem(item); + } + } + + draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(receiverName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + /// Send money by mail + static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args) + { + /// format: name "subject text" "mail text" money + + Player* receiver; + uint64 receiverGuid; + std::string receiverName; + if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char* msgSubject = handler->extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char* msgText = handler->extractQuotedArg(tail2); + if (!msgText) + return false; + + char* moneyStr = strtok(NULL, ""); + int32 money = moneyStr ? atoi(moneyStr) : 0; + if (money <= 0) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + MailDraft(subject, text) + .AddMoney(money) + .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + + CharacterDatabase.CommitTransaction(trans); + + std::string nameLink = handler->playerLink(receiverName); + handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; + } + /// Send a message to a player in game + static bool HandleSendMessageCommand(ChatHandler* handler, char const* args) + { + /// - Find the player + Player* player; + if (!handler->extractPlayerTarget((char*)args, &player)) + return false; + + char* msgStr = strtok(NULL, ""); + if (!msgStr) + return false; + + ///- Check that he is not logging out. + if (player->GetSession()->isLogingOut()) + { + handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + /// - Send the message + // Use SendAreaTriggerMessage for fastest delivery. + player->GetSession()->SendAreaTriggerMessage("%s", msgStr); + player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); + + // Confirmation message + std::string nameLink = handler->GetNameLink(player); + handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr); + + return true; + } + + static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + Creature* creatureTarget = handler->getSelectedCreature(); + + if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) + { + handler->PSendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry()); + // Creatures with family 0 crashes the server + if (!creatrueTemplate->family) + { + handler->PSendSysMessage("This creature cannot be tamed. (family id: 0)."); + handler->SetSentErrorMessage(true); + return false; + } + + if (player->GetPetGUID()) + { + handler->PSendSysMessage("You already have a pet"); + handler->SetSentErrorMessage(true); + return false; + } + + // Everything looks OK, create new pet + Pet* pet = new Pet(player, HUNTER_PET); + if (!pet->CreateBaseAtCreature(creatureTarget)) + { + delete pet; + handler->PSendSysMessage("Error 1"); + return false; + } + + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view + + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + + if (!pet->InitStatsForLevel(creatureTarget->getLevel())) + { + sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + handler->PSendSysMessage("Error 2"); + delete pet; + return false; + } + + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1); + + pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); + // this enables pet details window (Shift+P) + pet->InitPetCreateSpells(); + pet->SetFullHealth(); + + pet->GetMap()->AddToMap(pet->ToCreature()); + + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); + + player->SetMinion(pet, true); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + player->PetSpellInitialize(); + + return true; + } + + static bool HandlePetLearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Pet* pet = player->GetPet(); + + if (!pet) + { + handler->PSendSysMessage("You have no pet"); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (!spellId || !sSpellMgr->GetSpellInfo(spellId)) + return false; + + // Check if pet already has it + if (pet->HasSpell(spellId)) + { + handler->PSendSysMessage("Pet already has spell: %u", spellId); + handler->SetSentErrorMessage(true); + return false; + } + + // Check if spell is valid + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) + { + handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId); + handler->SetSentErrorMessage(true); + return false; + } + + pet->learnSpell(spellId); + + handler->PSendSysMessage("Pet has learned spell %u", spellId); + return true; + } + + static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->GetSession()->GetPlayer(); + Pet* pet = player->GetPet(); + if (!pet) + { + handler->PSendSysMessage("You have no pet"); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 spellId = handler->extractSpellIdFromLink((char*)args); + + if (pet->HasSpell(spellId)) + pet->removeSpell(spellId, false); + else + handler->PSendSysMessage("Pet doesn't have that spell"); + + return true; + } + + static bool HandleFreezeCommand(ChatHandler* handler, char const* args) + { + std::string name; + Player* player; + char const* TargetName = strtok((char*)args, " "); // get entered name + if (!TargetName) // if no name entered use target + { + player = handler->getSelectedPlayer(); + if (player) //prevent crash with creature as target + { + name = player->GetName(); + normalizePlayerName(name); + } + } + else // if name entered + { + name = TargetName; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name.c_str()); + } + + if (!player) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + if (player == handler->GetSession()->GetPlayer()) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); + return true; + } + + // effect + if (player && (player != handler->GetSession()->GetPlayer())) + { + handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); + + // stop combat + make player unattackable + duel stop + stop some spells + player->setFaction(35); + player->CombatStop(); + if (player->IsNonMeleeSpellCasted(true)) + player->InterruptNonMeleeSpells(true); + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // if player class = hunter || warlock remove pet if alive + if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) + { + if (Pet* pet = player->GetPet()) + { + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + // not let dismiss dead pet + if (pet && pet->isAlive()) + player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); + } + } + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) + Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); + + // save player + player->SaveToDB(); + } + + return true; + } + + static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args) + { + std::string name; + Player* player; + char* targetName = strtok((char*)args, " "); // Get entered name + + if (targetName) + { + name = targetName; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name.c_str()); + } + else // If no name was entered - use target + { + player = handler->getSelectedPlayer(); + if (player) + name = player->GetName(); + } + + if (player) + { + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + + // Reset player faction + allow combat + allow duels + player->setFactionForRace(player->getRace()); + player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // Remove Freeze spell (allowing movement and spells) + player->RemoveAurasDueToSpell(9454); + + // Save player + player->SaveToDB(); + } + else + { + if (targetName) + { + // Check for offline players + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); + stmt->setString(0, name); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + // If player found: delete his freeze aura + Field* fields = result->Fetch(); + uint32 lowGuid = fields[0].GetUInt32(); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); + stmt->setUInt32(0, lowGuid); + CharacterDatabase.Execute(stmt); + + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + return true; + } + else + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + } + + return true; + } + + static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/) + { + // Get names from DB + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) + { + handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); + return true; + } + + // Header of the names + handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE); + + // Output of the results + do + { + Field* fields = result->Fetch(); + std::string player = fields[0].GetString(); + handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); + } + while (result->NextRow()); + + return true; + } + + static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) + if (group && group->GetLeaderGUID() != guid) + { + group->ChangeLeader(guid); + group->SendUpdate(); + } + + return true; + } + + static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) + if (group) + group->Disband(); + + return true; + } + + static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args) + { + Player* player = NULL; + Group* group = NULL; + uint64 guid = 0; + char* nameStr = strtok((char*)args, " "); + + if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true)) + if (group) + group->RemoveMember(guid); + + return true; + } + + static bool HandlePlayAllCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + uint32 soundId = atoi((char*)args); + + if (!sSoundEntriesStore.LookupEntry(soundId)) + { + handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); + handler->SetSentErrorMessage(true); + return false; + } + + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID(); + sWorld->SendGlobalMessage(&data); + + handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); + return true; + } + + static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + return false; + + handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true); + return true; + } + + static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + unit = handler->GetSession()->GetPlayer(); + + unit->RemoveCharmAuras(); + + return true; + } + + static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + if (!unit) + return false; + + handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true); + return true; + } + + static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + if (player->isPossessing()) + return false; + + player->StopCastingBindSight(); + return true; + } +}; + +void AddSC_misc_commandscript() +{ + new misc_commandscript(); +} diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 76abfca2d8..d85a4db9f7 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -37,7 +37,7 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DRIVER: case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type - default: + default: PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setUInt64(0, message.mtime); stmt->setUInt32(1, realm); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 64f7e697f1..8e740ba83b 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -109,7 +109,7 @@ void Log::CreateAppenderFromConfig(const char* name) if (++iter != tokens.end()) flags = AppenderFlags(atoi(*iter)); - + switch (type) { case APPENDER_CONSOLE: From 8a1e7dd0709027825a3cd28a9d5911d0e2750501 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Aug 2012 00:23:44 +0200 Subject: [PATCH 065/147] Core/Loading: Re-enable Server loading log --- doc/LoggingHOWTO.txt | 4 +- .../collision/Models/GameObjectModel.cpp | 2 +- .../game/AI/EventAI/CreatureEventAIMgr.cpp | 12 +- .../game/AI/SmartScripts/SmartScriptMgr.cpp | 8 +- src/server/game/Addons/AddonMgr.cpp | 4 +- .../game/AuctionHouse/AuctionHouseMgr.cpp | 12 +- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Conditions/DisableMgr.cpp | 8 +- src/server/game/DataStores/DBCStores.cpp | 2 +- src/server/game/Globals/ObjectMgr.cpp | 210 ++++----- src/server/game/Groups/GroupMgr.cpp | 12 +- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- .../Movement/Waypoints/WaypointManager.cpp | 2 +- src/server/game/Skills/SkillDiscovery.cpp | 2 +- src/server/game/Skills/SkillExtraItems.cpp | 2 +- src/server/game/Texts/CreatureTextMgr.cpp | 6 +- src/server/game/Tickets/TicketMgr.cpp | 6 +- .../game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/server/game/Weather/WeatherMgr.cpp | 2 +- src/server/game/World/World.cpp | 436 +++++++++--------- src/server/shared/Logging/Appender.cpp | 16 +- src/server/shared/Logging/Appender.h | 5 +- src/server/worldserver/worldserver.conf.dist | 66 +-- 23 files changed, 415 insertions(+), 408 deletions(-) diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt index 4e61812d7d..79b03d3dd2 100644 --- a/doc/LoggingHOWTO.txt +++ b/doc/LoggingHOWTO.txt @@ -239,7 +239,7 @@ Lets trace how system will log two different messages: Console will discard msg as Log Level is not higher or equal to this appender Server will write to file - "2012-08-15 INFO [CHARACTER ] Guild 1 Player Name Logged in" + "2012-08-15 INFO [CHARACTER ] Player Name Logged in" EXAMPLE 3 As a dev, i may be interested in logging just a particular part of the core @@ -272,5 +272,3 @@ why this system is better than previous one? affected by IO operations - Lets us select "What to log" and "Where to log" on the fly. You can log to a dozen of files without having to change a single line of code - - \ No newline at end of file diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 6045cbc4c9..6cb0f90d98 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -83,7 +83,7 @@ void LoadGameObjectModelList() } fclose(model_list_file); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 7289a4eed2..728b17b0bb 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -43,7 +43,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); return; } @@ -98,7 +98,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -114,7 +114,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); return; } @@ -146,7 +146,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -167,7 +167,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); return; } @@ -738,6 +738,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 7a997609b5..3b69408354 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -50,7 +50,7 @@ void SmartWaypointMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); return; } @@ -88,7 +88,7 @@ void SmartWaypointMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); } @@ -117,7 +117,7 @@ void SmartAIMgr::LoadSmartAIFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); return; } @@ -234,7 +234,7 @@ void SmartAIMgr::LoadSmartAIFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 6af8782791..a0789040e9 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -43,7 +43,7 @@ void LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!"); return; } @@ -63,7 +63,7 @@ void LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index ab08262a92..84b5513b65 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -263,7 +263,7 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); return; } @@ -296,7 +296,7 @@ void AuctionHouseMgr::LoadAuctionItems() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -309,7 +309,7 @@ void AuctionHouseMgr::LoadAuctions() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); return; } @@ -335,7 +335,7 @@ void AuctionHouseMgr::LoadAuctions() CharacterDatabase.CommitTransaction(trans); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -734,7 +734,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() if (!expAuctions) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete"); return; } @@ -782,7 +782,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() } while (expAuctions->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 67ba643dd9..7bb2855651 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -926,7 +926,7 @@ void ConditionMgr::LoadConditions(bool isReload) } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 6215cf5bb7..27695f3eaf 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -59,7 +59,7 @@ void LoadDisables() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!"); return; } @@ -228,7 +228,7 @@ void LoadDisables() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); } @@ -239,7 +239,7 @@ void CheckQuestDisables() uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size(); if (!count) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables."); return; } @@ -259,7 +259,7 @@ void CheckQuestDisables() ++itr; } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 48ceda2a21..850c58bdf9 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -636,7 +636,7 @@ void LoadDBCStores(const std::string& dataPath) exit(1); } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index fc4386633f..efe944d541 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -296,7 +296,7 @@ void ObjectMgr::LoadCreatureLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -333,7 +333,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -360,7 +360,7 @@ void ObjectMgr::LoadPointOfInterestLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -388,7 +388,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); return; } @@ -491,7 +491,7 @@ void ObjectMgr::LoadCreatureTemplates() for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) CheckCreatureTemplate(&itr->second); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -504,7 +504,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); return; } @@ -563,7 +563,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -881,7 +881,7 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); return; } @@ -947,7 +947,7 @@ void ObjectMgr::LoadCreatureAddons() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -986,7 +986,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); return; } @@ -1039,7 +1039,7 @@ void ObjectMgr::LoadEquipmentTemplates() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1117,7 +1117,7 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); return; } @@ -1162,7 +1162,7 @@ void ObjectMgr::LoadCreatureModelInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1348,7 +1348,7 @@ void ObjectMgr::LoadLinkedRespawn() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); } @@ -1535,7 +1535,7 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1840,7 +1840,7 @@ void ObjectMgr::LoadGameobjects() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -2009,7 +2009,7 @@ void ObjectMgr::LoadItemLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -2052,7 +2052,7 @@ void ObjectMgr::LoadItemTemplates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty."); return; } @@ -2614,7 +2614,7 @@ void ObjectMgr::LoadItemTemplates() for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2650,7 +2650,7 @@ void ObjectMgr::LoadItemSetNameLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } @@ -2679,7 +2679,7 @@ void ObjectMgr::LoadItemSetNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); return; } @@ -2734,7 +2734,7 @@ void ObjectMgr::LoadItemSetNames() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2791,7 +2791,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2808,7 +2808,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); return; } @@ -2836,7 +2836,7 @@ void ObjectMgr::LoadVehicleAccessories() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2929,7 +2929,7 @@ void ObjectMgr::LoadPetLevelInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3071,7 +3071,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3085,7 +3085,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); } else @@ -3143,7 +3143,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3200,7 +3200,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3247,7 +3247,7 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3329,7 +3329,7 @@ void ObjectMgr::LoadPlayerInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3443,7 +3443,7 @@ void ObjectMgr::LoadPlayerInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3502,7 +3502,7 @@ void ObjectMgr::LoadPlayerInfo() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -4289,7 +4289,7 @@ void ObjectMgr::LoadQuests() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -4338,7 +4338,7 @@ void ObjectMgr::LoadQuestLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -4367,7 +4367,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); return; } @@ -4659,7 +4659,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4804,7 +4804,7 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); return; } @@ -4852,7 +4852,7 @@ void ObjectMgr::LoadSpellScriptNames() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4862,7 +4862,7 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts."); return; } @@ -4910,7 +4910,7 @@ void ObjectMgr::ValidateSpellScripts() ++count; } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4923,7 +4923,7 @@ void ObjectMgr::LoadPageTexts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!"); return; } @@ -4953,7 +4953,7 @@ void ObjectMgr::LoadPageTexts() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -4989,7 +4989,7 @@ void ObjectMgr::LoadPageTextLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -5002,7 +5002,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); return; } @@ -5032,7 +5032,7 @@ void ObjectMgr::LoadInstanceTemplate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5122,7 +5122,7 @@ void ObjectMgr::LoadInstanceEncounters() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5143,7 +5143,7 @@ void ObjectMgr::LoadGossipText() int count = 0; if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count); return; } @@ -5183,7 +5183,7 @@ void ObjectMgr::LoadGossipText() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5226,7 +5226,7 @@ void ObjectMgr::LoadNpcTextLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -5252,7 +5252,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found."); return; // any mails need to be returned or deleted } @@ -5356,7 +5356,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); } @@ -5370,7 +5370,7 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); return; } @@ -5415,7 +5415,7 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5429,7 +5429,7 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); return; } @@ -5454,7 +5454,7 @@ void ObjectMgr::LoadTavernAreaTriggers() _tavernAreaTriggerStore.insert(Trigger_ID); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5467,7 +5467,7 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); return; } @@ -5492,7 +5492,7 @@ void ObjectMgr::LoadAreaTriggerScripts() _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5611,7 +5611,7 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); return; } @@ -5658,7 +5658,7 @@ void ObjectMgr::LoadGraveyardZones() sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5904,7 +5904,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); return; } @@ -5951,7 +5951,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -5965,7 +5965,7 @@ void ObjectMgr::LoadAccessRequirements() QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); return; } @@ -6043,7 +6043,7 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore[requirement_ID] = ar; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6268,7 +6268,7 @@ void ObjectMgr::LoadGameObjectLocales() AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -6345,7 +6345,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); return; } @@ -6515,7 +6515,7 @@ void ObjectMgr::LoadGameObjectTemplate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6544,7 +6544,7 @@ void ObjectMgr::LoadExplorationBaseXP() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6568,7 +6568,7 @@ void ObjectMgr::LoadPetNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); return; } @@ -6589,7 +6589,7 @@ void ObjectMgr::LoadPetNames() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6604,7 +6604,7 @@ void ObjectMgr::LoadPetNumber() _hiPetNumber = fields[0].GetUInt32()+1; } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); } @@ -6638,7 +6638,7 @@ void ObjectMgr::LoadCorpses() PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES)); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty."); return; } @@ -6667,7 +6667,7 @@ void ObjectMgr::LoadCorpses() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6730,7 +6730,7 @@ void ObjectMgr::LoadReputationRewardRate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6804,7 +6804,7 @@ void ObjectMgr::LoadReputationOnKill() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6819,7 +6819,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty."); return; } @@ -6916,7 +6916,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6963,7 +6963,7 @@ void ObjectMgr::LoadPointsOfInterest() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7035,7 +7035,7 @@ void ObjectMgr::LoadQuestPOI() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7103,7 +7103,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7182,7 +7182,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); } @@ -7252,7 +7252,7 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); return; } @@ -7279,7 +7279,7 @@ void ObjectMgr::LoadReservedPlayersNames() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7433,7 +7433,7 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests"); return; } @@ -7482,7 +7482,7 @@ void ObjectMgr::LoadGameObjectForQuests() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7531,7 +7531,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table); return false; } @@ -7571,9 +7571,9 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max } while (result->NextRow()); if (min_value == MIN_TRINITY_STRING_ID) - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); return true; @@ -7631,7 +7631,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7757,7 +7757,7 @@ void ObjectMgr::LoadGameTele() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -7902,7 +7902,7 @@ void ObjectMgr::LoadMailLevelRewards() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8023,7 +8023,7 @@ void ObjectMgr::LoadTrainerSpell() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8114,7 +8114,7 @@ void ObjectMgr::LoadVendors() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8156,7 +8156,7 @@ void ObjectMgr::LoadGossipMenu() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8220,7 +8220,7 @@ void ObjectMgr::LoadGossipMenuItems() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8399,7 +8399,7 @@ void ObjectMgr::LoadScriptNames() while (result->NextRow()); std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8503,7 +8503,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); return; } @@ -8552,7 +8552,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() } } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8589,7 +8589,7 @@ void ObjectMgr::LoadFactionChangeAchievements() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8601,7 +8601,7 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); return; } @@ -8626,7 +8626,7 @@ void ObjectMgr::LoadFactionChangeItems() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8663,7 +8663,7 @@ void ObjectMgr::LoadFactionChangeSpells() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -8675,7 +8675,7 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); return; } @@ -8700,7 +8700,7 @@ void ObjectMgr::LoadFactionChangeReputations() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 3a758f6df3..7cb8a8ff7b 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -125,7 +125,7 @@ void GroupMgr::LoadGroups() ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!"); return; } @@ -151,7 +151,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -169,7 +169,7 @@ void GroupMgr::LoadGroups() QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!"); return; } @@ -190,7 +190,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -203,7 +203,7 @@ void GroupMgr::LoadGroups() "LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid"); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); return; } @@ -235,7 +235,7 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 4ca7f97c02..48ed7bdba1 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -275,7 +275,7 @@ void InstanceSaveManager::LoadInstances() // Load reset times and clean expired instances sInstanceSaveMgr->LoadResetTimes(); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 214fd23fc8..a01e18347f 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -86,7 +86,7 @@ void WaypointMgr::Load() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index d9cfbe6b69..3eac3d34fd 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -153,7 +153,7 @@ void LoadSkillDiscoveryTable() sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); } - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 9cb4c145b3..9e2648dc94 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -110,7 +110,7 @@ void LoadSkillExtraItemTable() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index f64043b703..7818527b34 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -77,7 +77,7 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); return; } @@ -136,7 +136,7 @@ void CreatureTextMgr::LoadCreatureTexts() ++textCount; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); } @@ -166,7 +166,7 @@ void CreatureTextMgr::LoadCreatureTextLocales() ++textCount; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index d03ffbbb1f..0a4682db75 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -263,7 +263,7 @@ void TicketMgr::LoadTickets() PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); return; } @@ -290,7 +290,7 @@ void TicketMgr::LoadTickets() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -303,7 +303,7 @@ void TicketMgr::LoadSurveys() if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys")) _lastSurveyId = (*result)[0].GetUInt32(); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 2bd9a157e7..f87b81c8be 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -63,7 +63,7 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 0e7f1c87b2..da62122d7a 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -137,7 +137,7 @@ void LoadWeatherData() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index ab3b715008..9ec9849118 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -418,27 +418,27 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1); if (rate_values[RATE_HEALTH] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); rate_values[RATE_HEALTH] = 1; } rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1); if (rate_values[RATE_POWER_MANA] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); rate_values[RATE_POWER_MANA] = 1; } rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1); rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1); if (rate_values[RATE_POWER_RAGE_LOSS] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); rate_values[RATE_POWER_RAGE_LOSS] = 1; } rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1); rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1); if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1; } rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f); @@ -462,7 +462,7 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f); if (rate_values[RATE_REPAIRCOST] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); rate_values[RATE_REPAIRCOST] = 0.0f; } rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f); @@ -499,13 +499,13 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f); if (rate_values[RATE_TALENT] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); rate_values[RATE_TALENT] = 1.0f; } rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f); if (rate_values[RATE_MOVESPEED] < 0) { - sLog->outError(LOG_FILTER_GENERAL, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); rate_values[RATE_MOVESPEED] = 1.0f; } for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED]; @@ -514,12 +514,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f); if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE; } else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE) { - sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE; } @@ -527,12 +527,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f); if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f; @@ -540,25 +540,25 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f) { - sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f; } ///- Read other configuration items from the config file @@ -568,7 +568,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1); if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9) { - sLog->outError(LOG_FILTER_GENERAL, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); m_int_configs[CONFIG_COMPRESSION] = 1; } m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true); @@ -592,14 +592,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0); if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL) { - sLog->outError(LOG_FILTER_GENERAL, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0; } m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS); if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY) { - sLog->outError(LOG_FILTER_GENERAL, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); + sLog->outError(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; } if (reload) @@ -608,7 +608,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100); if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) { - sLog->outError(LOG_FILTER_GENERAL, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if (reload) @@ -620,7 +620,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085); if (val != m_int_configs[CONFIG_PORT_WORLD]) - sLog->outError(LOG_FILTER_GENERAL, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); } else m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085); @@ -639,7 +639,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("GameType", 0); if (val != m_int_configs[CONFIG_GAME_TYPE]) - sLog->outError(LOG_FILTER_GENERAL, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); } else m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0); @@ -648,7 +648,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); if (val != m_int_configs[CONFIG_REALM_ZONE]) - sLog->outError(LOG_FILTER_GENERAL, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); } else m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); @@ -670,21 +670,21 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2); if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME) { - sLog->outError(LOG_FILTER_GENERAL, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2; } m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2); if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME) { - sLog->outError(LOG_FILTER_GENERAL, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2; } m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2); if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME) { - sLog->outError(LOG_FILTER_GENERAL, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); m_int_configs[CONFIG_MIN_PET_NAME] = 2; } @@ -695,7 +695,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10); if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10) { - sLog->outError(LOG_FILTER_GENERAL, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10; } @@ -703,14 +703,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50); if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM]) { - sLog->outError(LOG_FILTER_GENERAL, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM]; } m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1); if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10) { - sLog->outError(LOG_FILTER_GENERAL, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1; } @@ -719,7 +719,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0); if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2) { - sLog->outError(LOG_FILTER_GENERAL, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); m_int_configs[CONFIG_SKIP_CINEMATICS] = 0; } @@ -727,14 +727,14 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) - sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); } else m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL) { - sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL; } @@ -743,25 +743,25 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1); if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1; } else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55); if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1) { - sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55; } else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } @@ -769,12 +769,12 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0); if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); m_int_configs[CONFIG_START_PLAYER_MONEY] = 0; } else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT) { - sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT); m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT; } @@ -782,20 +782,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000); if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0; } m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0); if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0); m_int_configs[CONFIG_START_HONOR_POINTS] = 0; } else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS]) { - sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS]; } @@ -803,20 +803,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000); if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0; } m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0); if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0) { - sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0); m_int_configs[CONFIG_START_ARENA_POINTS] = 0; } else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS]) { - sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS]; } @@ -824,7 +824,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60); if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60); m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60; } @@ -844,7 +844,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9); if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9) { - sLog->outError(LOG_FILTER_GENERAL, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9; } @@ -859,13 +859,13 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1); if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL]) { - sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", + sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]); m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL]; } else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL) { - sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); + sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL; } m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false); @@ -880,7 +880,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10); if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0) { - sLog->outError(LOG_FILTER_GENERAL, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); m_int_configs[CONFIG_UPTIME_UPDATE] = 10; } if (reload) @@ -893,7 +893,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10); if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0) { - sLog->outError(LOG_FILTER_GENERAL, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10; } if (reload) @@ -902,7 +902,7 @@ void World::LoadConfigSettings(bool reload) m_timers[WUPDATE_CLEANDB].Reset(); } m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default - sLog->outInfo(LOG_FILTER_GENERAL, "Will clear `logs` table of entries older than %i seconds every %u minutes.", + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.", m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100); @@ -927,7 +927,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2); if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2) { - sLog->outError(LOG_FILTER_GENERAL, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2; } @@ -942,7 +942,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = ConfigMgr::GetIntDefault("Expansion", 1); if (val != m_int_configs[CONFIG_EXPANSION]) - sLog->outError(LOG_FILTER_GENERAL, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); } else m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1); @@ -974,7 +974,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6); if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23) { - sLog->outError(LOG_FILTER_GENERAL, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6; } @@ -1041,10 +1041,10 @@ void World::LoadConfigSettings(bool reload) if (clientCacheId > 0) { m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId; - sLog->outInfo(LOG_FILTER_GENERAL, "Client cache version set to: %u", clientCacheId); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId); } else - sLog->outError(LOG_FILTER_GENERAL, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); + sLog->outError(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); } m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR); @@ -1060,12 +1060,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE); if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE; } @@ -1073,12 +1073,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE); if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE; } @@ -1086,12 +1086,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS); if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE) { - sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE; } @@ -1112,12 +1112,12 @@ void World::LoadConfigSettings(bool reload) if (reload) { if (dataPath != m_dataPath) - sLog->outError(LOG_FILTER_GENERAL, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); + sLog->outError(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); } else { m_dataPath = dataPath; - sLog->outInfo(LOG_FILTER_GENERAL, "Using DataDir %s", m_dataPath.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str()); } m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0); @@ -1128,19 +1128,19 @@ void World::LoadConfigSettings(bool reload) std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", ""); if (!enableHeight) - sLog->outError(LOG_FILTER_GENERAL, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); + sLog->outError(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str()); - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap data directory is: %svmaps", m_dataPath.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str()); m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49); m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true); m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false); if (m_bool_configs[CONFIG_START_ALL_SPELLS]) - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!"); + sLog->outWarn(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!"); m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0); m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false); m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false); @@ -1236,7 +1236,7 @@ void World::SetInitialWorldSettings() !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) || !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f)))) { - sLog->outError(LOG_FILTER_GENERAL, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); exit(1); } @@ -1248,7 +1248,7 @@ void World::SetInitialWorldSettings() ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) exit(1); // Error message displayed in function already @@ -1272,36 +1272,36 @@ void World::SetInitialWorldSettings() CharacterDatabase.Execute(stmt); ///- Load the DBC files - sLog->outInfo(LOG_FILTER_GENERAL, "Initialize data stores..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize data stores..."); LoadDBCStores(m_dataPath); DetectDBCLang(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell dbc data corrections..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell dbc data corrections..."); sSpellMgr->LoadDbcDataCorrections(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellInfo store..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SkillLineAbilityMultiMap Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data..."); sSpellMgr->LoadSkillLineAbilityMap(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell custom attributes..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObject models..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObject models..."); LoadGameObjectModelList(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Script Names..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Names..."); sObjectMgr->LoadScriptNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Instance Template..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); // Must be called before `creature_respawn`/`gameobject_respawn` tables - sLog->outInfo(LOG_FILTER_GENERAL, "Loading instances..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading instances..."); sInstanceSaveMgr->LoadInstances(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Localization strings..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Localization strings..."); uint32 oldMSTime = getMSTime(); sObjectMgr->LoadCreatureLocales(); sObjectMgr->LoadGameObjectLocales(); @@ -1314,308 +1314,308 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadPointOfInterestLocales(); sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) - sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Object Templates..."); // must be after LoadPageTexts + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts sObjectMgr->LoadGameObjectTemplate(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Rank Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data..."); sSpellMgr->LoadSpellRanks(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Required Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data..."); sSpellMgr->LoadSpellRequired(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group types..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types..."); sSpellMgr->LoadSpellGroups(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Skills..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills..."); sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc Event conditions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc conditions and data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Bonus Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Aggro Spells Definitions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group Stack Rules..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading NPC Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts..."); sObjectMgr->LoadGossipText(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Enchant Spells Proc datas..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas..."); sSpellMgr->LoadSpellEnchantProcData(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Random Enchantments Table..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Disables"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Disables"); DisableMgr::LoadDisables(); // must be before loading quests and items - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item set names..."); // must be after LoadItemPrototypes + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes sObjectMgr->LoadItemSetNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Model Based Info Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data..."); sObjectMgr->LoadCreatureModelInfo(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Equipment templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates..."); sObjectMgr->LoadEquipmentTemplates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates..."); sObjectMgr->LoadCreatureTemplates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature template addons..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons..."); sObjectMgr->LoadCreatureTemplateAddons(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Reward Rates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates..."); sObjectMgr->LoadReputationRewardRate(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Reputation OnKill Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data..."); sObjectMgr->LoadReputationOnKill(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Spillover Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data..."); sObjectMgr->LoadReputationSpilloverTemplate(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Points Of Interest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data..."); sObjectMgr->LoadPointsOfInterest(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Base Stats..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats..."); sObjectMgr->LoadCreatureClassLevelStats(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data..."); sObjectMgr->LoadCreatures(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet levelup spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells..."); sSpellMgr->LoadPetLevelupSpellMap(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet default spells additional to levelup spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells..."); sSpellMgr->LoadPetDefaultSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Addon Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data..."); sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gameobject Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data..."); sObjectMgr->LoadGameobjects(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Linked Respawn..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn..."); sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Weather Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Weather Data..."); WeatherMgr::LoadWeatherData(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests..."); sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables - sLog->outInfo(LOG_FILTER_GENERAL, "Checking Quest Disables"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables"); DisableMgr::CheckQuestDisables(); // must be after loading quests - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest POI"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest POI"); sObjectMgr->LoadQuestPOI(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations..."); sObjectMgr->LoadQuestRelations(); // must be after quest load - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Objects Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data..."); sPoolMgr->LoadFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Event Data..."); // must be after loading pools fully + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully sGameEventMgr->LoadFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests sObjectMgr->LoadNPCSpellClickSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Template Accessories..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories..."); sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Accessories..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories..."); sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Dungeon boss data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data..."); sObjectMgr->LoadInstanceEncounters(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading LFG rewards..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards..."); sLFGMgr->LoadRewards(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellArea Data..."); // must be after quest load + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load sSpellMgr->LoadSpellAreas(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger definitions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Access Requirements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements..."); sObjectMgr->LoadAccessRequirements(); // must be after item template load - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest Area Triggers..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Tavern Area Triggers..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger script names..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names..."); sObjectMgr->LoadAreaTriggerScripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Graveyard-zone links..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell pet auras..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell target coordinates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading enchant custom attributes..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes..."); sSpellMgr->LoadEnchantCustomAttr(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading linked spells..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading linked spells..."); sSpellMgr->LoadSpellLinked(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data..."); sObjectMgr->LoadPlayerInfo(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Exploration BaseXP Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data..."); sObjectMgr->LoadExplorationBaseXP(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Pet Name Parts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts..."); sObjectMgr->LoadPetNames(); CharacterDatabaseCleaner::CleanDatabase(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading the max pet number..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading the max pet number..."); sObjectMgr->LoadPetNumber(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet level stats..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet level stats..."); sObjectMgr->LoadPetLevelInfo(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Corpses..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses..."); sObjectMgr->LoadCorpses(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player level dependent mail rewards..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); // Loot tables LoadLootTables(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Discovery Table..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Extra Item Table..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Fishing base level requirements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievements..."); sAchievementMgr->LoadAchievementReferenceList(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Lists..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists..."); sAchievementMgr->LoadAchievementCriteriaList(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Rewards..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards..."); sAchievementMgr->LoadRewards(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Reward Locales..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales..."); sAchievementMgr->LoadRewardLocales(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Completed Achievements..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); // Delete expired auctions before loading - sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired auctions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions..."); sAuctionMgr->DeleteExpiredAuctionsAtStartup(); ///- Load dynamic data tables from the database - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Auctions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Auctions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Auctions..."); sAuctionMgr->LoadAuctions(); sGuildMgr->LoadGuilds(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading ArenaTeams..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams..."); sArenaTeamMgr->LoadArenaTeams(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Groups..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Groups..."); sGroupMgr->LoadGroups(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames..."); sObjectMgr->LoadReservedPlayersNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObjects for quests..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading BattleMasters..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters..."); sBattlegroundMgr->LoadBattleMastersEntry(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameTeleports..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports..."); sObjectMgr->LoadGameTele(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu..."); sObjectMgr->LoadGossipMenu(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu options..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options..."); sObjectMgr->LoadGossipMenuItems(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vendors..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vendors..."); sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trainers..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trainers..."); sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Waypoints..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Waypoints..."); sWaypointMgr->Load(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI Waypoints..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints..."); sSmartWaypointMgr->LoadFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Formations..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations..."); sFormationMgr->LoadCreatureFormations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Conditions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Conditions..."); sConditionMgr->LoadConditions(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change achievement pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs..."); sObjectMgr->LoadFactionChangeAchievements(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change spell pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs..."); sObjectMgr->LoadFactionChangeSpells(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change item pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs..."); sObjectMgr->LoadFactionChangeItems(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change reputation pairs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs..."); sObjectMgr->LoadFactionChangeReputations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM tickets..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets..."); sTicketMgr->LoadTickets(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM surveys..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM surveys..."); sTicketMgr->LoadSurveys(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading client addons..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading client addons..."); AddonMgr::LoadFromDB(); ///- Handle outdated emails (delete/return) - sLog->outInfo(LOG_FILTER_GENERAL, "Returning old mails..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Returning old mails..."); sObjectMgr->ReturnOrDeleteOldMails(false); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Autobroadcasts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts..."); LoadAutobroadcasts(); ///- Load and initialize scripts @@ -1626,42 +1626,42 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadWaypointScripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Scripts text locales..."); // must be after Load*Scripts calls + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls sObjectMgr->LoadDbScriptStrings(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts..."); sEventAIMgr->LoadCreatureEventAI_Texts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Summons..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Summons..."); sEventAIMgr->LoadCreatureEventAI_Summons(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts..."); sEventAIMgr->LoadCreatureEventAI_Scripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell script names..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell script names..."); sObjectMgr->LoadSpellScriptNames(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Text Locales..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales..."); sCreatureTextMgr->LoadCreatureTextLocales(); - sLog->outInfo(LOG_FILTER_GENERAL, "Initializing Scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initializing Scripts..."); sScriptMgr->Initialize(); sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized - sLog->outInfo(LOG_FILTER_GENERAL, "Validating spell scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Validating spell scripts..."); sObjectMgr->ValidateSpellScripts(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI scripts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Calendar data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Calendar data..."); sCalendarMgr->LoadFromDB(); ///- Initialize game time and timers - sLog->outInfo(LOG_FILTER_GENERAL, "Initialize game time and timers"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers"); m_gameTime = time(NULL); m_startTime = m_gameTime; @@ -1688,16 +1688,16 @@ void World::SetInitialWorldSettings() mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval()); //1440 mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); - sLog->outInfo(LOG_FILTER_GENERAL, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); ///- Initilize static helper structures AIRegistry::Initialize(); ///- Initialize MapManager - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Map System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Map System"); sMapMgr->Initialize(); - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Game Event system..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Game Event system..."); uint32 nextGameEvent = sGameEventMgr->StartSystem(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event @@ -1707,50 +1707,50 @@ void World::SetInitialWorldSettings() // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days. Channel::CleanOldChannelsInDB(); - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Arena Season..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Arena Season..."); sGameEventMgr->StartArenaSeason(); sTicketMgr->Initialize(); ///- Initialize Battlegrounds - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battleground System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System"); sBattlegroundMgr->CreateInitialBattlegrounds(); sBattlegroundMgr->InitAutomaticArenaPointDistribution(); ///- Initialize outdoor pvp - sLog->outInfo(LOG_FILTER_GENERAL, "Starting Outdoor PvP System"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transports..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); sMapMgr->LoadTransports(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transport NPCs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transport NPCs..."); sMapMgr->LoadTransportNPCs(); ///- Initialize Warden - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Checks..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks..."); sWardenCheckMgr->LoadWardenChecks(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Action Overrides..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides..."); sWardenCheckMgr->LoadWardenOverrides(); - sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired bans..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired bans..."); LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query - sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next daily quest reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time..."); InitDailyQuestResetTime(); - sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next weekly quest reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time..."); InitWeeklyQuestResetTime(); - sLog->outInfo(LOG_FILTER_GENERAL, "Calculate random battleground reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time..."); InitRandomBGResetTime(); LoadCharacterNameData(); uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); - sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); + sLog->outInfo(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); sLog->EnableDBAppenders(); } @@ -1760,7 +1760,7 @@ void World::DetectDBCLang() if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES) { - sLog->outError(LOG_FILTER_GENERAL, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); m_lang_confid = LOCALE_enUS; } @@ -1788,13 +1788,13 @@ void World::DetectDBCLang() if (default_locale >= TOTAL_LOCALES) { - sLog->outError(LOG_FILTER_GENERAL, "Unable to determine your DBC Locale! (corrupt DBC?)"); + sLog->outError(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)"); exit(1); } m_defaultDbcLocale = LocaleConstant(default_locale); - sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); } @@ -1834,7 +1834,7 @@ void World::LoadAutobroadcasts() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); return; } @@ -1852,7 +1852,7 @@ void World::LoadAutobroadcasts() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2019,7 +2019,7 @@ void World::Update(uint32 diff) if (m_timers[WUPDATE_PINGDB].Passed()) { m_timers[WUPDATE_PINGDB].Reset(); - sLog->outInfo(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive"); + sLog->outDebug(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive"); CharacterDatabase.KeepAlive(); LoginDatabase.KeepAlive(); WorldDatabase.KeepAlive(); @@ -2608,7 +2608,7 @@ void World::SendAutoBroadcast() sWorld->SendGlobalMessage(&data); } - sLog->outInfo(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str()); + sLog->outDebug(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str()); } void World::UpdateRealmCharCount(uint32 accountId) @@ -2835,7 +2835,7 @@ void World::LoadWorldStates() if (!result) { - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!"); return; } @@ -2850,7 +2850,7 @@ void World::LoadWorldStates() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2907,12 +2907,12 @@ void World::ProcessQueryCallbacks() void World::LoadCharacterNameData() { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading character name data"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data"); QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); if (!result) { - sLog->outError(LOG_FILTER_GENERAL, "No character name data loaded, empty query"); + sLog->outError(LOG_FILTER_SQL, "No character name data loaded, empty query"); return; } @@ -2926,7 +2926,7 @@ void World::LoadCharacterNameData() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GENERAL, "Loaded name data for %u characters", count); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count); } void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass) diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index be30a54ff0..1a24cb1d59 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -98,7 +98,7 @@ void Appender::write(LogMessage& message) message.prefix.push_back(' '); char text[MAX_QUERY_LEN]; - snprintf(text, MAX_QUERY_LEN, "[%-15s]", Appender::getLogFilterTypeString(message.type)); + snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type)); message.prefix.append(text); } @@ -172,13 +172,13 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) case LOG_FILTER_PLAYER: return "PLAYER"; case LOG_FILTER_PLAYER_LOADING: - return "PLAYER_LOADING"; + return "PLAYER LOADING"; case LOG_FILTER_PLAYER_ITEMS: - return "PLAYER_ITEMS"; + return "PLAYER ITEMS"; case LOG_FILTER_PLAYER_SKILLS: - return "PLAYER_SKILLS"; + return "PLAYER SKILLS"; case LOG_FILTER_PLAYER_CHATLOG: - return "PLAYER_CHATLOG"; + return "PLAYER CHATLOG"; case LOG_FILTER_LOOT: return "LOOT"; case LOG_FILTER_GUILD: @@ -209,6 +209,12 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "SQL DRIVER"; case LOG_FILTER_SQL_DEV: return "SQL DEV"; + case LOG_FILTER_PLAYER_DUMP: + return "PLAYER DUMP"; + case LOG_FILTER_BATTLEFIELD: + return "BATTLEFIELD"; + case LOG_FILTER_SERVER_LOADING: + return "SERVER LOADING"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index ebe7408d40..37b53178af 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -64,10 +64,11 @@ enum LogFilterType LOG_FILTER_SQL_DRIVER, LOG_FILTER_SQL_DEV, LOG_FILTER_PLAYER_DUMP, - LOG_FILTER_BATTLEFIELD + LOG_FILTER_BATTLEFIELD, + LOG_FILTER_SERVER_LOADING }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_BATTLEFIELD) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_SERVER_LOADING) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 789af4e371..13cd1bdcbd 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2691,47 +2691,49 @@ Appender.Chat=2,2,7,Chat.log # 37 - SQL Dev # 38 - Player Dump # 39 - Battlefield +# 40 - Server Loading Logger.Root=0,3,Console Server -Logger.Units=1,3,Console Server -Logger.Pets=2,3,Console Server -Logger.Vehicles=3,3,Console Server -Logger.TCSR=4,3,Console Server -Logger.AI=5,3,Console Server -Logger.MapScripts=6,3,Console Server -Logger.NetWork=7,3,Console Server -Logger.Spells=8,3,Console Server -Logger.Achievements=9,3,Console Server -Logger.Conditions=10,3,Console Server -Logger.Pool=11,3,Console Server -Logger.AuctionHouse=12,3,Console Server -Logger.Battlegrounds=13,3,Console Server -Logger.OutdoorPvP=14,3,Console Server -Logger.ChatSystem=15,3,Console Server -Logger.LFG=16,3,Console Server -Logger.Maps=17,3,Console Server -Logger.Player=18,3,Console Server -Logger.PlayerLoading=19,3,Console Server -Logger.PlayerItems=20,3,Console Server -Logger.PlayerSkills=21,3,Console Server +Logger.Units=1,5,Console Server +Logger.Pets=2,5,Console Server +Logger.Vehicles=3,5,Console Server +Logger.TCSR=4,5,Console Server +Logger.AI=5,5,Console Server +Logger.MapScripts=6,5,Console Server +Logger.NetWork=7,5,Console Server +Logger.Spells=8,5,Console Server +Logger.Achievements=9,5,Console Server +Logger.Conditions=10,5,Console Server +Logger.Pool=11,5,Console Server +Logger.AuctionHouse=12,5,Console Server +Logger.Battlegrounds=13,5,Console Server +Logger.OutdoorPvP=14,5,Console Server +Logger.ChatSystem=15,5,Console Server +Logger.LFG=16,5,Console Server +Logger.Maps=17,5,Console Server +Logger.Player=18,5,Console Server +Logger.PlayerLoading=19,5,Console Server +Logger.PlayerItems=20,5,Console Server +Logger.PlayerSkills=21,5,Console Server Logger.PlayerChat=22,3,Chat -Logger.Loot=23,3,Console Server -Logger.Guilds=24,3,Console Server -Logger.Transports=25,3,Console Server -Logger.SQL=26,2,Console Server DBErrors +Logger.Loot=23,5,Console Server +Logger.Guilds=24,5,Console Server +Logger.Transports=25,5,Console Server +Logger.SQL=26,5,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA Logger.Warden=29,3,Warden -Logger.Authserver=30,3,Console Server -Logger.Worldserver=31,3,Console Server -Logger.GameEvents=32,3,Console Server -Logger.Calendar=33,3,Console Server +Logger.Authserver=30,5,Console Server +Logger.Worldserver=31,5,Console Server +Logger.GameEvents=32,5,Console Server +Logger.Calendar=33,5,Console Server Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas Logger.SQLDriver=36,5,SQLDriver Logger.SQLDev=37,3,SQLDev -Logger.CharDump=38,5,CharDump -Logger.Battlefield=39,3,Console Server +Logger.CharDump=38,3,CharDump +Logger.Battlefield=39,5,Console Server +Logger.Load=40,3,Console Server # LogLevel # 0 - (Disabled) @@ -2758,4 +2760,4 @@ Appenders=Console Server GM Char Arenas Warden DBErrors CharDump # (Using spaces as separator). # Default: "root" -Loggers=Root GM Character Arenas Warden SQL +Loggers=Root GM Character Arenas Warden SQL Load From 3c42401d662104145bf55a6550b432dd8a4428e2 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Aug 2012 00:56:58 +0200 Subject: [PATCH 066/147] Core/Logging: Set config options to behave like old log system. --- src/server/shared/Logging/Appender.cpp | 2 + src/server/shared/Logging/Appender.h | 5 +- src/server/worldserver/worldserver.conf.dist | 96 +++++++------------- 3 files changed, 39 insertions(+), 64 deletions(-) diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 1a24cb1d59..348ec4b3c7 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -215,6 +215,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "BATTLEFIELD"; case LOG_FILTER_SERVER_LOADING: return "SERVER LOADING"; + case LOG_FILTER_OPCODES: + return "OPCODE"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 37b53178af..c0e03b13db 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -65,10 +65,11 @@ enum LogFilterType LOG_FILTER_SQL_DEV, LOG_FILTER_PLAYER_DUMP, LOG_FILTER_BATTLEFIELD, - LOG_FILTER_SERVER_LOADING + LOG_FILTER_SERVER_LOADING, + LOG_FILTER_OPCODES }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_SERVER_LOADING) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_OPCODES) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 13cd1bdcbd..ce084e2fb9 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2627,19 +2627,25 @@ PlayerDump.DisallowOverwrite = 1 # w - (Overwrite) # -Appender.Console=1,2,6 -Appender.Server=2,2,7,Server.log,w -Appender.GM=2,2,7,GM_%s.log -Appender.SQL=2,2,7,SQL.log -Appender.DBErrors=2,2,7,DBErrors.log -Appender.Char=2,2,7,Char.log,w -Appender.CharDump=2,2,0,chardumps/%s.log -Appender.RA=2,2,7,RA.log -Appender.Arenas=2,2,7,Arena.log +Appender.Console=1,5,0 +Appender.Server=2,2,0,Server.log,w +Appender.GM=2,2,0,GM.log +Appender.DBErrors=2,2,0,DBErrors.log +Appender.Char=2,2,0,Char.log,w +Appender.RA=2,2,0,RA.log +Appender.Warden=2,2,0,Warden.log +Appender.Chat=2,2,0,Chat.log +Appender.CharDump=2,2,0,%s.log +Appender.Arenas=2,2,0,Arena.log Appender.SQLDev=2,2,0,SQLDev.log -Appender.SQLDriver=2,2,7,SQLDriver.log -Appender.Warden=2,2,7,Warden.log -Appender.Chat=2,2,7,Chat.log +Appender.SQLDriver=2,2,0,SQLDriver.log + +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Server GM DBErrors Char RA Warden Chat" + +Appenders=Console Server GM DBErrors Char RA Warden Chat # Logger config values: Given a logger "name" # Logger.name @@ -2692,49 +2698,7 @@ Appender.Chat=2,2,7,Chat.log # 38 - Player Dump # 39 - Battlefield # 40 - Server Loading - -Logger.Root=0,3,Console Server -Logger.Units=1,5,Console Server -Logger.Pets=2,5,Console Server -Logger.Vehicles=3,5,Console Server -Logger.TCSR=4,5,Console Server -Logger.AI=5,5,Console Server -Logger.MapScripts=6,5,Console Server -Logger.NetWork=7,5,Console Server -Logger.Spells=8,5,Console Server -Logger.Achievements=9,5,Console Server -Logger.Conditions=10,5,Console Server -Logger.Pool=11,5,Console Server -Logger.AuctionHouse=12,5,Console Server -Logger.Battlegrounds=13,5,Console Server -Logger.OutdoorPvP=14,5,Console Server -Logger.ChatSystem=15,5,Console Server -Logger.LFG=16,5,Console Server -Logger.Maps=17,5,Console Server -Logger.Player=18,5,Console Server -Logger.PlayerLoading=19,5,Console Server -Logger.PlayerItems=20,5,Console Server -Logger.PlayerSkills=21,5,Console Server -Logger.PlayerChat=22,3,Chat -Logger.Loot=23,5,Console Server -Logger.Guilds=24,5,Console Server -Logger.Transports=25,5,Console Server -Logger.SQL=26,5,Console Server DBErrors -Logger.GM=27,3,Console Server GM -Logger.RA=28,3,RA -Logger.Warden=29,3,Warden -Logger.Authserver=30,5,Console Server -Logger.Worldserver=31,5,Console Server -Logger.GameEvents=32,5,Console Server -Logger.Calendar=33,5,Console Server -Logger.Character=34,3,Char -Logger.Arenas=35,3,Arenas -Logger.SQLDriver=36,5,SQLDriver -Logger.SQLDev=37,3,SQLDev -Logger.CharDump=38,3,CharDump -Logger.Battlefield=39,5,Console Server -Logger.Load=40,3,Console Server - +# 41 - Opcodes (just id and name sent / received) # LogLevel # 0 - (Disabled) # 1 - (Trace) @@ -2747,17 +2711,25 @@ Logger.Load=40,3,Console Server # AppenderList: List of appenders linked to logger # (Using spaces as separator). # -# Appenders -# Description: List of Appenders to read from config -# (Using spaces as separator). -# Default: "Console Server" -Appenders=Console Server GM Char Arenas Warden DBErrors CharDump +Logger.Root=0,3,Console Server +Logger.Chat=22,3,Chat +Logger.DBErrors=26,5,Console Server DBErrors +Logger.GM=27,3,Console Server GM +Logger.RA=28,3,RA +Logger.Warden=29,3,Warden +Logger.Character=34,3,Char +Logger.Arenas=35,3,Arenas +Logger.SQLDriver=36,5,SQLDriver +Logger.SQLDev=37,3,SQLDev +Logger.CharDump=38,3,CharDump +Logger.Load=40,3,Console Server # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). -# Default: "root" +# Default: "Root Chat DBErrors GM RA Warden Character Load" + +Loggers=Root Chat DBErrors GM RA Warden Character Load -Loggers=Root GM Character Arenas Warden SQL Load From a566e3e58bc54635c0caa019f6fdbe6f7adf8ceb Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Aug 2012 11:02:46 +0200 Subject: [PATCH 067/147] Core/Logging: Move more log messages to LOG_FILTER_SERVER_LOADING --- src/server/authserver/authserver.conf.dist | 28 ++--- .../game/Achievements/AchievementMgr.cpp | 36 ++---- .../game/Battlegrounds/ArenaTeamMgr.cpp | 6 +- .../game/Battlegrounds/BattlegroundMgr.cpp | 12 +- .../Battlegrounds/Zones/BattlegroundWS.cpp | 54 ++++---- src/server/game/DungeonFinding/LFGMgr.cpp | 6 +- .../game/Entities/Creature/CreatureGroups.cpp | 6 +- .../game/Entities/Item/ItemEnchantmentMgr.cpp | 6 +- .../game/Entities/Transport/Transport.cpp | 14 +-- src/server/game/Events/GameEventMgr.cpp | 115 +++++++---------- src/server/game/Globals/ObjectMgr.cpp | 117 ++---------------- src/server/game/Globals/ObjectMgr.h | 8 +- src/server/game/Groups/GroupMgr.cpp | 10 +- src/server/game/Guilds/GuildMgr.cpp | 65 ++++------ src/server/game/Loot/LootMgr.cpp | 69 ++++------- src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp | 6 +- src/server/game/Pools/PoolMgr.cpp | 32 ++--- src/server/game/Scripting/ScriptMgr.cpp | 5 +- src/server/game/Scripting/ScriptMgr.h | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 28 ++--- src/server/game/Spells/SpellMgr.cpp | 109 ++++++---------- src/server/shared/Logging/Log.cpp | 6 - src/server/worldserver/worldserver.conf.dist | 9 +- 23 files changed, 258 insertions(+), 491 deletions(-) diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 15dd02d905..9a4beca9bf 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -198,7 +198,7 @@ LoginDatabase.WorkerThreads = 1 # Example: "13 11 9 5 3 1" # # File: Name of the file (read as optional1 if Type = File) -# Allows to use one "%u" to create dynamic files +# Allows to use one "%s" to create dynamic files # # Mode: Mode to open the file (read as optional2 if Type = File) # a - (Append) @@ -208,19 +208,6 @@ LoginDatabase.WorkerThreads = 1 Appender.Console=1,2,6 Appender.Auth=2,2,7,Auth.log,w -# Logger config values: Given a logger "name" -# Logger.name -# Description: Defines 'What to log' -# Format: Type,LogLevel,AppenderList -# Type -# 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 7 - Network input/output, -# 30 - Authserver - -Logger.Root=0,3,Console Auth - # LogLevel # 0 - (Disabled) # 1 - (Trace) @@ -240,6 +227,19 @@ Logger.Root=0,3,Console Auth Appenders=Console Auth +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver + +Logger.Root=0,3,Console Auth + # # Loggers # Description: List of Loggers to read from config diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 191d91b61a..c607132dfe 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2201,8 +2201,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if (sAchievementCriteriaStore.GetNumRows() == 0) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria."); return; } @@ -2219,8 +2218,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria); } - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadAchievementReferenceList() @@ -2229,8 +2227,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (sAchievementStore.GetNumRows() == 0) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references."); return; } @@ -2250,8 +2247,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539)) const_cast(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadAchievementCriteriaData() @@ -2264,8 +2260,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!result) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); return; } @@ -2396,8 +2391,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadCompletedAchievements() @@ -2408,8 +2402,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!result) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); return; } @@ -2436,8 +2429,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() m_allCompletedAchievements.insert(achievementId); } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadRewards() @@ -2451,8 +2443,7 @@ void AchievementGlobalMgr::LoadRewards() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); return; } @@ -2543,8 +2534,7 @@ void AchievementGlobalMgr::LoadRewards() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadRewardLocales() @@ -2559,8 +2549,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (!result) { - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); return; } @@ -2586,6 +2575,5 @@ void AchievementGlobalMgr::LoadRewardLocales() } } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 665742c97b..55de445345 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -101,8 +101,7 @@ void ArenaTeamMgr::LoadArenaTeams() if (!result) { - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); return; } @@ -132,8 +131,7 @@ void ArenaTeamMgr::LoadArenaTeams() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ArenaTeamMgr::DistributeArenaPoints() diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 290da0bb31..0b10798337 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -683,8 +683,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); return; } @@ -792,8 +791,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void BattlegroundMgr::InitAutomaticArenaPointDistribution() @@ -1077,8 +1075,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() if (!result) { - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); return; } @@ -1102,8 +1099,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 483e8ffdaf..ededaf15bb 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -700,28 +700,40 @@ void BattlegroundWS::Reset() //call parent's class reset Battleground::Reset(); - m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; - m_FlagKeepers[BG_TEAM_HORDE] = 0; - m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; - m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; - _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; - _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; - m_TeamScores[BG_TEAM_ALLIANCE] = 0; - m_TeamScores[BG_TEAM_HORDE] = 0; - bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID()); - m_ReputationCapture = (isBGWeekend) ? 45 : 35; - m_HonorWinKills = (isBGWeekend) ? 3 : 1; - m_HonorEndKills = (isBGWeekend) ? 4 : 2; - // For WorldState - _minutesElapsed = 0; - _lastFlagCaptureTeam = 0; + m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; + m_FlagKeepers[BG_TEAM_HORDE] = 0; - /* Spirit nodes is static at this BG and then not required deleting at BG reset. - if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) - DelCreature(WS_SPIRIT_MAIN_ALLIANCE); - if (BgCreatures[WS_SPIRIT_MAIN_HORDE]) - DelCreature(WS_SPIRIT_MAIN_HORDE); - */ + m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; + m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; + + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + + m_TeamScores[BG_TEAM_ALLIANCE] = 0; + m_TeamScores[BG_TEAM_HORDE] = 0; + + if (sBattlegroundMgr->IsBGWeekend(GetTypeID())) + { + m_ReputationCapture = 45; + m_HonorWinKills = 3; + m_HonorEndKills = 4; + } + else + { + m_ReputationCapture = 35; + m_HonorWinKills = 1; + m_HonorEndKills = 2; + } + _minutesElapsed = 0; + _lastFlagCaptureTeam = 0; + _bothFlagsKept = false; + _flagDebuffState = 0; + _flagSpellForceTimer = 0; + _lastFlagCaptureTeam = 0; + _flagsDropTimer[BG_TEAM_ALLIANCE] = 0; + _flagsDropTimer[BG_TEAM_HORDE] = 0; + _flagsTimer[BG_TEAM_ALLIANCE] = 0; + _flagsTimer[BG_TEAM_HORDE] = 0; } void BattlegroundWS::EndBattleground(uint32 winner) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 3a2a044ca3..a7dd677313 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -135,8 +135,7 @@ void LFGMgr::LoadRewards() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); return; } @@ -183,8 +182,7 @@ void LFGMgr::LoadRewards() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void LFGMgr::Update(uint32 diff) diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 21ed1a2382..8823a78855 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -84,8 +84,7 @@ void FormationMgr::LoadCreatureFormations() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); return; } @@ -136,8 +135,7 @@ void FormationMgr::LoadCreatureFormations() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void CreatureGroup::AddMember(Creature* member) diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index 0478173b96..f85bf80e14 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -70,14 +70,10 @@ void LoadRandomEnchantmentsTable() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } else - { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); - - } } uint32 GetItemEnchantMod(int32 entry) diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 52d5c9114f..88d3108dbe 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -35,8 +35,7 @@ void MapManager::LoadTransports() if (!result) { - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transports. DB table `transports` is empty!"); return; } @@ -66,7 +65,7 @@ void MapManager::LoadTransports() continue; } - // sLog->outInfo(LOG_FILTER_TRANSPORTS, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); + // sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); std::set mapsUsed; @@ -121,8 +120,7 @@ void MapManager::LoadTransports() while (result->NextRow()); } - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void MapManager::LoadTransportNPCs() @@ -134,8 +132,7 @@ void MapManager::LoadTransportNPCs() if (!result) { - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); return; } @@ -166,8 +163,7 @@ void MapManager::LoadTransportNPCs() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index afbae063e5..bead65bbfd 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data..."); { uint32 oldMSTime = getMSTime(); @@ -273,7 +273,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); } else @@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Prerequisite Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data..."); { uint32 oldMSTime = getMSTime(); @@ -319,7 +319,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); } else @@ -357,12 +357,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Creature Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data..."); { uint32 oldMSTime = getMSTime(); @@ -372,7 +372,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); } else @@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data..."); { uint32 oldMSTime = getMSTime(); @@ -415,7 +415,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); } else @@ -443,12 +443,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Model/Equipment Change Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data..."); { uint32 oldMSTime = getMSTime(); @@ -458,8 +457,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); } else { @@ -500,12 +498,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -514,8 +511,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); } else { @@ -541,12 +537,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -555,8 +550,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); } else { @@ -582,12 +576,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Condition Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -596,8 +589,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); } else { @@ -625,12 +617,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -639,8 +630,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); } else { @@ -667,12 +657,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Save Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data..."); { uint32 oldMSTime = getMSTime(); @@ -681,8 +670,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); } else { @@ -715,12 +703,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event NPCflag Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data..."); { uint32 oldMSTime = getMSTime(); @@ -729,8 +716,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); } else { @@ -755,12 +741,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Seasonal Quest Relations..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations..."); { uint32 oldMSTime = getMSTime(); @@ -769,8 +754,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); } else { @@ -799,12 +783,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Vendor Additions Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data..."); { uint32 oldMSTime = getMSTime(); @@ -813,8 +796,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); } else { @@ -865,12 +847,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Battleground Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data..."); { uint32 oldMSTime = getMSTime(); @@ -879,8 +860,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); } else { @@ -903,12 +883,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Pool Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data..."); { uint32 oldMSTime = getMSTime(); @@ -918,8 +897,7 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); } else { @@ -952,8 +930,7 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index efe944d541..08a76008fd 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -297,7 +297,6 @@ void ObjectMgr::LoadCreatureLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -334,7 +333,6 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPointOfInterestLocales() @@ -361,7 +359,6 @@ void ObjectMgr::LoadPointOfInterestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadCreatureTemplates() @@ -389,7 +386,6 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); - return; } @@ -492,7 +488,6 @@ void ObjectMgr::LoadCreatureTemplates() CheckCreatureTemplate(&itr->second); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadCreatureTemplateAddons() @@ -505,7 +500,6 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); - return; } @@ -564,7 +558,6 @@ void ObjectMgr::LoadCreatureTemplateAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -882,7 +875,6 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); - return; } @@ -948,7 +940,6 @@ void ObjectMgr::LoadCreatureAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -987,7 +978,6 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); - return; } @@ -1040,7 +1030,6 @@ void ObjectMgr::LoadEquipmentTemplates() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1118,7 +1107,6 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); - return; } @@ -1163,7 +1151,6 @@ void ObjectMgr::LoadCreatureModelInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadLinkedRespawn() @@ -1349,7 +1336,6 @@ void ObjectMgr::LoadLinkedRespawn() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1536,7 +1522,6 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1841,7 +1826,6 @@ void ObjectMgr::LoadGameobjects() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2010,7 +1994,6 @@ void ObjectMgr::LoadItemLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadItemTemplates() @@ -2053,7 +2036,6 @@ void ObjectMgr::LoadItemTemplates() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty."); - return; } @@ -2615,7 +2597,6 @@ void ObjectMgr::LoadItemTemplates() sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -2651,7 +2632,6 @@ void ObjectMgr::LoadItemSetNameLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadItemSetNames() @@ -2680,7 +2660,6 @@ void ObjectMgr::LoadItemSetNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); - return; } @@ -2735,7 +2714,6 @@ void ObjectMgr::LoadItemSetNames() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -2792,7 +2770,6 @@ void ObjectMgr::LoadVehicleTemplateAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadVehicleAccessories() @@ -2809,7 +2786,6 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); - return; } @@ -2837,7 +2813,6 @@ void ObjectMgr::LoadVehicleAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPetLevelInfo() @@ -2930,7 +2905,6 @@ void ObjectMgr::LoadPetLevelInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -3072,12 +3046,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Load playercreate items - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Items Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -3086,7 +3059,6 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); - } else { @@ -3144,12 +3116,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Load playercreate spells - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Spell Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data..."); { uint32 oldMSTime = getMSTime(); @@ -3201,12 +3172,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Load playercreate actions - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Action Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data..."); { uint32 oldMSTime = getMSTime(); @@ -3248,12 +3218,11 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } // Loading levels data (class only dependent) - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level HP/Mana Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data..."); { uint32 oldMSTime = getMSTime(); @@ -3330,11 +3299,10 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } // Loading levels data (class/race dependent) - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level Stats Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data..."); { uint32 oldMSTime = getMSTime(); @@ -3444,11 +3412,10 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } // Loading xp per level data - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create XP Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data..."); { uint32 oldMSTime = getMSTime(); @@ -3503,7 +3470,6 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } @@ -4290,7 +4256,6 @@ void ObjectMgr::LoadQuests() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadQuestLocales() @@ -4339,7 +4304,6 @@ void ObjectMgr::LoadQuestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4357,7 +4321,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use. return; - sLog->outInfo(LOG_FILTER_GENERAL, "Loading %s...", tableName.c_str()); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str()); scripts->clear(); // need for reload support @@ -4368,7 +4332,6 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); - return; } @@ -4660,7 +4623,6 @@ void ObjectMgr::LoadScripts(ScriptsType type) while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGameObjectScripts() @@ -4805,7 +4767,6 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); - return; } @@ -4853,7 +4814,6 @@ void ObjectMgr::LoadSpellScriptNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::ValidateSpellScripts() @@ -4863,7 +4823,6 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts."); - return; } @@ -4911,7 +4870,6 @@ void ObjectMgr::ValidateSpellScripts() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPageTexts() @@ -4924,7 +4882,6 @@ void ObjectMgr::LoadPageTexts() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!"); - return; } @@ -4954,7 +4911,6 @@ void ObjectMgr::LoadPageTexts() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -4990,7 +4946,6 @@ void ObjectMgr::LoadPageTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadInstanceTemplate() @@ -5003,7 +4958,6 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); - return; } @@ -5033,7 +4987,6 @@ void ObjectMgr::LoadInstanceTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5123,7 +5076,6 @@ void ObjectMgr::LoadInstanceEncounters() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5144,7 +5096,6 @@ void ObjectMgr::LoadGossipText() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count); - return; } _gossipTextStore.rehash(result->GetRowCount()); @@ -5184,7 +5135,6 @@ void ObjectMgr::LoadGossipText() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadNpcTextLocales() @@ -5227,7 +5177,6 @@ void ObjectMgr::LoadNpcTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } //not very fast function but it is called only once a day, or on starting-up @@ -5253,7 +5202,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found."); - return; // any mails need to be returned or deleted } @@ -5357,7 +5305,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadQuestAreaTriggers() @@ -5371,7 +5318,6 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); - return; } @@ -5416,7 +5362,6 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadTavernAreaTriggers() @@ -5430,7 +5375,6 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); - return; } @@ -5455,7 +5399,6 @@ void ObjectMgr::LoadTavernAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadAreaTriggerScripts() @@ -5468,7 +5411,6 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); - return; } @@ -5493,7 +5435,6 @@ void ObjectMgr::LoadAreaTriggerScripts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) @@ -5612,7 +5553,6 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); - return; } @@ -5659,7 +5599,6 @@ void ObjectMgr::LoadGraveyardZones() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) @@ -5905,7 +5844,6 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); - return; } @@ -5952,7 +5890,6 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadAccessRequirements() @@ -5966,7 +5903,6 @@ void ObjectMgr::LoadAccessRequirements() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); - return; } @@ -6044,7 +5980,6 @@ void ObjectMgr::LoadAccessRequirements() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } /* @@ -6269,7 +6204,6 @@ void ObjectMgr::LoadGameObjectLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6346,7 +6280,6 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); - return; } @@ -6516,7 +6449,6 @@ void ObjectMgr::LoadGameObjectTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadExplorationBaseXP() @@ -6545,7 +6477,6 @@ void ObjectMgr::LoadExplorationBaseXP() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6569,7 +6500,6 @@ void ObjectMgr::LoadPetNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); - return; } @@ -6590,7 +6520,6 @@ void ObjectMgr::LoadPetNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPetNumber() @@ -6605,7 +6534,6 @@ void ObjectMgr::LoadPetNumber() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); - } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6639,7 +6567,6 @@ void ObjectMgr::LoadCorpses() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty."); - return; } @@ -6668,7 +6595,6 @@ void ObjectMgr::LoadCorpses() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadReputationRewardRate() @@ -6731,7 +6657,6 @@ void ObjectMgr::LoadReputationRewardRate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadReputationOnKill() @@ -6805,7 +6730,6 @@ void ObjectMgr::LoadReputationOnKill() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -6820,7 +6744,6 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty."); - return; } @@ -6917,7 +6840,6 @@ void ObjectMgr::LoadReputationSpilloverTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadPointsOfInterest() @@ -6964,7 +6886,6 @@ void ObjectMgr::LoadPointsOfInterest() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadQuestPOI() @@ -7036,7 +6957,6 @@ void ObjectMgr::LoadQuestPOI() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7104,7 +7024,6 @@ void ObjectMgr::LoadNPCSpellClickSpells() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7183,7 +7102,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGameobjectQuestRelations() @@ -7253,7 +7171,6 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); - return; } @@ -7280,7 +7197,6 @@ void ObjectMgr::LoadReservedPlayersNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7434,7 +7350,6 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests"); - return; } @@ -7483,7 +7398,6 @@ void ObjectMgr::LoadGameObjectForQuests() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) @@ -7575,7 +7489,6 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max else sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); - return true; } @@ -7632,7 +7545,6 @@ void ObjectMgr::LoadFishingBaseSkillLevel() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names) @@ -7758,7 +7670,6 @@ void ObjectMgr::LoadGameTele() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7903,7 +7814,6 @@ void ObjectMgr::LoadMailLevelRewards() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -8024,7 +7934,6 @@ void ObjectMgr::LoadTrainerSpell() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set *skip_vendors) @@ -8115,7 +8024,6 @@ void ObjectMgr::LoadVendors() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGossipMenu() @@ -8157,7 +8065,6 @@ void ObjectMgr::LoadGossipMenu() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadGossipMenuItems() @@ -8221,7 +8128,6 @@ void ObjectMgr::LoadGossipMenuItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8400,7 +8306,6 @@ void ObjectMgr::LoadScriptNames() std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8504,7 +8409,6 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); - return; } @@ -8553,7 +8457,6 @@ void ObjectMgr::LoadCreatureClassLevelStats() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeAchievements() @@ -8590,7 +8493,6 @@ void ObjectMgr::LoadFactionChangeAchievements() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeItems() @@ -8602,7 +8504,6 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); - return; } @@ -8627,7 +8528,6 @@ void ObjectMgr::LoadFactionChangeItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeSpells() @@ -8664,7 +8564,6 @@ void ObjectMgr::LoadFactionChangeSpells() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void ObjectMgr::LoadFactionChangeReputations() @@ -8676,7 +8575,6 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); - return; } @@ -8701,7 +8599,6 @@ void ObjectMgr::LoadFactionChangeReputations() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 59bb2fb536..da0d37cf27 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -787,13 +787,13 @@ class ObjectMgr void LoadQuests(); void LoadQuestRelations() { - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO Start Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data..."); LoadGameobjectQuestRelations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO End Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data..."); LoadGameobjectInvolvedRelations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Start Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data..."); LoadCreatureQuestRelations(); - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature End Quest Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data..."); LoadCreatureInvolvedRelations(); } void LoadGameobjectQuestRelations(); diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 7cb8a8ff7b..77b3a304f6 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -126,7 +126,6 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!"); - return; } @@ -152,10 +151,9 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group members..."); { uint32 oldMSTime = getMSTime(); @@ -170,7 +168,6 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!"); - return; } @@ -191,10 +188,9 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } - sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 @@ -204,7 +200,6 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); - return; } @@ -236,6 +231,5 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index dab67c59d2..cebcf6040f 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -93,7 +93,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const void GuildMgr::LoadGuilds() { // 1. Load all guilds - sLog->outInfo(LOG_FILTER_GUILD, "Loading guilds definitions..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions..."); { uint32 oldMSTime = getMSTime(); @@ -105,8 +105,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty."); return; } else @@ -128,13 +127,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 2. Load all guild ranks - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild ranks..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild ranks..."); { uint32 oldMSTime = getMSTime(); @@ -146,8 +144,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); } else { @@ -164,13 +161,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 3. Load all guild members - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild members..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild members..."); { uint32 oldMSTime = getMSTime(); @@ -189,8 +185,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty."); } else { @@ -208,13 +203,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 4. Load all guild bank tab rights - sLog->outInfo(LOG_FILTER_GUILD, "Loading bank tab rights..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights..."); { uint32 oldMSTime = getMSTime(); @@ -226,8 +220,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); } else { @@ -244,13 +237,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 5. Load all event logs - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild event logs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild event logs..."); { uint32 oldMSTime = getMSTime(); @@ -261,8 +253,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); } else { @@ -279,13 +270,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 6. Load all bank event logs - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank event logs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs..."); { uint32 oldMSTime = getMSTime(); @@ -297,8 +287,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); } else { @@ -315,13 +304,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 7. Load all guild bank tabs - sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank tabs..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs..."); { uint32 oldMSTime = getMSTime(); @@ -333,8 +321,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); } else { @@ -351,8 +338,7 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -371,8 +357,7 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); } else { @@ -389,8 +374,7 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -412,7 +396,6 @@ void GuildMgr::LoadGuilds() } } - sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 6f49a55595..72636a5d2a 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1450,7 +1450,7 @@ bool LootTemplate::isReference(uint32 id) void LoadLootTemplates_Creature() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading creature loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1477,16 +1477,14 @@ void LoadLootTemplates_Creature() LootTemplates_Creature.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); - - } void LoadLootTemplates_Disenchant() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading disenchanting loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1512,15 +1510,14 @@ void LoadLootTemplates_Disenchant() LootTemplates_Disenchant.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); - } void LoadLootTemplates_Fishing() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading fishing loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1537,16 +1534,14 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); - - } void LoadLootTemplates_Gameobject() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading gameobject loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1573,16 +1568,14 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); - - } void LoadLootTemplates_Item() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading item loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading item loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1599,16 +1592,14 @@ void LoadLootTemplates_Item() LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); - - } void LoadLootTemplates_Milling() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading milling loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1630,16 +1621,14 @@ void LoadLootTemplates_Milling() LootTemplates_Milling.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); - - } void LoadLootTemplates_Pickpocketing() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading pickpocketing loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1666,16 +1655,14 @@ void LoadLootTemplates_Pickpocketing() LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); - - } void LoadLootTemplates_Prospecting() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading prospecting loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1697,16 +1684,14 @@ void LoadLootTemplates_Prospecting() LootTemplates_Prospecting.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); - - } void LoadLootTemplates_Mail() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading mail loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1723,16 +1708,14 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); - - } void LoadLootTemplates_Skinning() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading skinning loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1759,16 +1742,14 @@ void LoadLootTemplates_Skinning() LootTemplates_Skinning.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); - - } void LoadLootTemplates_Spell() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading spell loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1803,15 +1784,14 @@ void LoadLootTemplates_Spell() LootTemplates_Spell.ReportUnusedIds(lootIdSet); if (count) - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); - } void LoadLootTemplates_Reference() { - sLog->outInfo(LOG_FILTER_LOOT, "Loading reference loot templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1834,6 +1814,5 @@ void LoadLootTemplates_Reference() // output error for any still listed ids (not referenced from any loot table) LootTemplates_Reference.ReportUnusedIds(lootIdSet); - sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 5ada88cdf7..ce987e25ee 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -46,8 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { - sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); - + sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); return; } @@ -106,8 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() m_OutdoorPvPSet.push_back(pvp); } - sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 6ee70101af..79e8d47aa9 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -571,7 +571,7 @@ void PoolMgr::LoadFromDB() if (!result) { mPoolTemplate.clear(); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 object pools. DB table `pool_template` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty."); return; } @@ -589,12 +589,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Creatures - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Creatures Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -603,7 +603,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); } else { @@ -644,13 +644,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Gameobjects - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Gameobject Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -659,7 +659,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); } else { @@ -712,13 +712,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Pool of pools - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Mother Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -727,7 +727,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 pools in pools"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools"); } else { @@ -796,11 +796,11 @@ void PoolMgr::LoadFromDB() } } - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Quest Pooling Data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -809,7 +809,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 quests in pools"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools"); } else { @@ -884,12 +884,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks - sLog->outInfo(LOG_FILTER_POOLSYS, "Starting objects pooling system..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system..."); { uint32 oldMSTime = getMSTime(); @@ -899,7 +899,7 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outInfo(LOG_FILTER_POOLSYS, ">> Pool handling system initialized, 0 pools spawned."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned."); } else { diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index f5adf67a9a..98675f118e 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -251,13 +251,12 @@ void ScriptMgr::Initialize() LoadDatabase(); - sLog->outInfo(LOG_FILTER_TSCR, "Loading C++ scripts"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts"); FillSpellSummary(); AddScripts(); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); } void ScriptMgr::Unload() diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 3c2ee81aff..270182509f 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -164,7 +164,7 @@ class ScriptObject protected: ScriptObject(const char* name) - : _name(std::string(name)) + : _name(name) { } diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index f24b01306c..41b41b9180 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -25,10 +25,10 @@ ScriptPointVector const SystemMgr::_empty; void SystemMgr::LoadScriptTexts() { - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts..."); LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2)); - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data..."); uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -36,8 +36,7 @@ void SystemMgr::LoadScriptTexts() if (!result) { - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); return; } @@ -83,23 +82,21 @@ void SystemMgr::LoadScriptTexts() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); } void SystemMgr::LoadScriptTextsCustom() { - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts..."); LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3)); - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts additional data..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data..."); QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts"); if (!result) { - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); return; } @@ -145,8 +142,7 @@ void SystemMgr::LoadScriptTextsCustom() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount); } void SystemMgr::LoadScriptWaypoints() @@ -163,15 +159,14 @@ void SystemMgr::LoadScriptWaypoints() if (result) uiCreatureCount = result->GetRowCount(); - sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (!result) { - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); return; } @@ -206,6 +201,5 @@ void SystemMgr::LoadScriptWaypoints() } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index e2b7df2889..c26e78f341 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1155,7 +1155,7 @@ void SpellMgr::LoadSpellRanks() if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); return; } @@ -1251,7 +1251,7 @@ void SpellMgr::LoadSpellRanks() while (true); } while (!finished); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1267,7 +1267,7 @@ void SpellMgr::LoadSpellRequired() if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); return; } @@ -1312,7 +1312,7 @@ void SpellMgr::LoadSpellRequired() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1350,8 +1350,7 @@ void SpellMgr::LoadSpellLearnSkills() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellLearnSpells() @@ -1364,8 +1363,7 @@ void SpellMgr::LoadSpellLearnSpells() QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); return; } @@ -1453,8 +1451,7 @@ void SpellMgr::LoadSpellLearnSpells() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellTargetPositions() @@ -1467,8 +1464,7 @@ void SpellMgr::LoadSpellTargetPositions() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); return; } @@ -1573,8 +1569,7 @@ void SpellMgr::LoadSpellTargetPositions() } }*/ - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellGroups() @@ -1588,8 +1583,7 @@ void SpellMgr::LoadSpellGroups() QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); return; } @@ -1655,8 +1649,7 @@ void SpellMgr::LoadSpellGroups() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellGroupStackRules() @@ -1669,8 +1662,7 @@ void SpellMgr::LoadSpellGroupStackRules() QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); return; } @@ -1700,8 +1692,7 @@ void SpellMgr::LoadSpellGroupStackRules() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellProcEvents() @@ -1714,8 +1705,7 @@ void SpellMgr::LoadSpellProcEvents() QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); return; } @@ -1762,9 +1752,9 @@ void SpellMgr::LoadSpellProcEvents() } while (result->NextRow()); if (customProc) - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1778,8 +1768,7 @@ void SpellMgr::LoadSpellProcs() QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); return; } @@ -1905,8 +1894,7 @@ void SpellMgr::LoadSpellProcs() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellBonusess() @@ -1919,8 +1907,7 @@ void SpellMgr::LoadSpellBonusess() QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); return; } @@ -1946,8 +1933,7 @@ void SpellMgr::LoadSpellBonusess() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellThreats() @@ -1960,8 +1946,7 @@ void SpellMgr::LoadSpellThreats() QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); return; } @@ -1987,8 +1972,7 @@ void SpellMgr::LoadSpellThreats() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSkillLineAbilityMap() @@ -2009,8 +1993,7 @@ void SpellMgr::LoadSkillLineAbilityMap() ++count; } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellPetAuras() @@ -2023,8 +2006,7 @@ void SpellMgr::LoadSpellPetAuras() QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); return; } @@ -2071,8 +2053,7 @@ void SpellMgr::LoadSpellPetAuras() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Fill custom data about enchancments @@ -2112,8 +2093,7 @@ void SpellMgr::LoadEnchantCustomAttr() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellEnchantProcData() @@ -2126,8 +2106,7 @@ void SpellMgr::LoadSpellEnchantProcData() QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); return; } @@ -2156,8 +2135,7 @@ void SpellMgr::LoadSpellEnchantProcData() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellLinked() @@ -2170,8 +2148,7 @@ void SpellMgr::LoadSpellLinked() QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); return; } @@ -2209,8 +2186,7 @@ void SpellMgr::LoadSpellLinked() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadPetLevelupSpellMap() @@ -2266,8 +2242,7 @@ void SpellMgr::LoadPetLevelupSpellMap() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2351,10 +2326,9 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates..."); oldMSTime = getMSTime(); // different summon spells @@ -2395,8 +2369,7 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellAreas() @@ -2414,7 +2387,7 @@ void SpellMgr::LoadSpellAreas() if (!result) { - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); return; } @@ -2595,8 +2568,7 @@ void SpellMgr::LoadSpellAreas() ++count; } while (result->NextRow()); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellInfoStore() @@ -2612,8 +2584,7 @@ void SpellMgr::LoadSpellInfoStore() mSpellInfoMap[i] = new SpellInfo(spellEntry); } - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::UnloadSpellInfoStore() @@ -2925,8 +2896,7 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadDbcDataCorrections() @@ -3565,6 +3535,5 @@ void SpellMgr::LoadDbcDataCorrections() properties = const_cast(sSummonPropertiesStore.LookupEntry(647)); // 52893 properties->Type = SUMMON_TYPE_TOTEM; - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 8e740ba83b..3a24190d8f 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -114,9 +114,6 @@ void Log::CreateAppenderFromConfig(const char* name) { case APPENDER_CONSOLE: { - if (flags == APPENDER_FLAGS_NONE) - flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE); - AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; if (++iter != tokens.end()) @@ -135,9 +132,6 @@ void Log::CreateAppenderFromConfig(const char* name) return; } - if (flags == APPENDER_FLAGS_NONE) - flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE | APPENDER_FLAGS_PREFIX_TIMESTAMP); - filename = *iter; if (++iter != tokens.end()) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index ce084e2fb9..bdeb60129e 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2620,14 +2620,14 @@ PlayerDump.DisallowOverwrite = 1 # Example: "13 11 9 5 3 1" # # File: Name of the file (read as optional1 if Type = File) -# Allows to use one "%u" to create dynamic files +# Allows to use one "%s" to create dynamic files # # Mode: Mode to open the file (read as optional2 if Type = File) # a - (Append) # w - (Overwrite) # -Appender.Console=1,5,0 +Appender.Console=1,3,0 Appender.Server=2,2,0,Server.log,w Appender.GM=2,2,0,GM.log Appender.DBErrors=2,2,0,DBErrors.log @@ -2712,12 +2712,13 @@ Appenders=Console Server GM DBErrors Char RA Warden Chat # (Using spaces as separator). # -Logger.Root=0,3,Console Server +Logger.Root=0,5,Console Server Logger.Chat=22,3,Chat Logger.DBErrors=26,5,Console Server DBErrors Logger.GM=27,3,Console Server GM Logger.RA=28,3,RA Logger.Warden=29,3,Warden +Logger.WorldServer=31,3,Console Server Logger.Character=34,3,Char Logger.Arenas=35,3,Arenas Logger.SQLDriver=36,5,SQLDriver @@ -2731,5 +2732,5 @@ Logger.Load=40,3,Console Server # (Using spaces as separator). # Default: "Root Chat DBErrors GM RA Warden Character Load" -Loggers=Root Chat DBErrors GM RA Warden Character Load +Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer From 7b9ed5afdd4888339aa98d83b547006ea2d21375 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 16 Aug 2012 21:42:00 +0200 Subject: [PATCH 068/147] DB/Spells: Add missing Invisibility (spell id 35009) to spell_dbc --- sql/updates/world/2012_08_16_00_world_spell_dbc.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2012_08_16_00_world_spell_dbc.sql diff --git a/sql/updates/world/2012_08_16_00_world_spell_dbc.sql b/sql/updates/world/2012_08_16_00_world_spell_dbc.sql new file mode 100644 index 0000000000..248674d17a --- /dev/null +++ b/sql/updates/world/2012_08_16_00_world_spell_dbc.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_dbc` WHERE `Id`=35009; +INSERT INTO `spell_dbc` (`Id`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`Targets`,`CastingTimeIndex`,`ProcCharges`,`SpellLevel`,`RangeIndex`,`Effect1`,`EffectDieSides1`,`EffectBasePoints1`,`EffectImplicitTargetA1`,`EffectImplicitTargetB1`,`EffectRadiusIndex1`,`SpellFamilyName`,`SpellFamilyFlags2`,`DmgMultiplier1`,`SchoolMask`,`Comment`) VALUES +(35009,134545792,1024,268435460,65536,64,1,101,1,13,125,1,-11,22,16,27,10,4,1,6,'Invisibility - Reducing threat'); From 77b7933ed364ff92287f275685f13a8195fe650c Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 17 Aug 2012 10:31:09 +0200 Subject: [PATCH 069/147] Core/Logging: Restore proper Log Filter to some arena messages --- src/server/game/Battlegrounds/Battleground.cpp | 8 ++++---- src/server/worldserver/worldserver.conf.dist | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index cfb4aec852..cf767a2986 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -771,17 +771,17 @@ void Battleground::EndBattleground(uint32 winner) winner_matchmaker_rating = GetArenaMatchmakerRating(winner); winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change); loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, + sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change); SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change); SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change); SetArenaTeamRatingChangeForTeam(winner, winner_change); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->first)) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); + sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); } // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes else @@ -1103,7 +1103,7 @@ void Battleground::StartBattleground() // and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this); if (m_IsRated) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); } void Battleground::AddPlayer(Player* player) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index bdeb60129e..5bdf805fb4 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2260,6 +2260,15 @@ Arena.ArenaStartPersonalRating = 0 Arena.ArenaStartMatchmakerRating = 1500 +# +# ArenaLog.ExtendedInfo +# Description: Include extended info to ArenaLogFile for each player after rated arena +# matches (guid, name, team, IP, healing/damage done, killing blows). +# Default: 0 - (Disabled) +# 1 - (Enabled) + +ArenaLog.ExtendedInfo = 0 + # ################################################################################################### From 13aa00d5f21610d4849767b1105709767a2ba408 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 17 Aug 2012 10:36:48 +0200 Subject: [PATCH 070/147] Core/Logging: Restore dumping packets in binary format --- src/server/game/Server/Protocol/PacketLog.cpp | 62 +++++++++++++++++++ src/server/game/Server/Protocol/PacketLog.h | 50 +++++++++++++++ src/server/game/Server/WorldSocket.cpp | 54 ++-------------- src/server/worldserver/worldserver.conf.dist | 9 +++ 4 files changed, 127 insertions(+), 48 deletions(-) create mode 100644 src/server/game/Server/Protocol/PacketLog.cpp create mode 100644 src/server/game/Server/Protocol/PacketLog.h diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp new file mode 100644 index 0000000000..cb6dcdbdb9 --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "PacketLog.h" +#include "Config.h" +#include "ByteBuffer.h" +#include "WorldPacket.h" + +PacketLog::PacketLog() : _file(NULL) +{ + Initialize(); +} + +PacketLog::~PacketLog() +{ + if (_file) + fclose(_file); + + _file = NULL; +} + +void PacketLog::Initialize() +{ + std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + + if (!logsDir.empty()) + if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\')) + logsDir.push_back('/'); + + std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", ""); + if (!logname.empty()) + _file = fopen((logsDir + logname).c_str(), "wb"); +} + +void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) +{ + ByteBuffer data(4+4+4+1+packet.size()); + data << int32(packet.GetOpcode()); + data << int32(packet.size()); + data << uint32(time(NULL)); + data << uint8(direction); + + for (uint32 i = 0; i < packet.size(); i++) + data << const_cast(packet)[i]; + + fwrite(data.contents(), 1, data.size(), _file); + fflush(_file); +} diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h new file mode 100644 index 0000000000..b899daae19 --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef TRINITY_PACKETLOG_H +#define TRINITY_PACKETLOG_H + +#include "Common.h" +#include + +enum Direction +{ + CLIENT_TO_SERVER, + SERVER_TO_CLIENT +}; + +class WorldPacket; + +class PacketLog +{ + friend class ACE_Singleton; + + private: + PacketLog(); + ~PacketLog(); + + public: + void Initialize(); + bool CanLogPacket() const { return (_file != NULL); } + void LogPacket(WorldPacket const& packet, Direction direction); + + private: + FILE* _file; +}; + +#define sPacketLog ACE_Singleton::instance() +#endif diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 5b04c3dc71..ed960fd969 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -42,6 +42,7 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" +#include "PacketLog.h" #include "ScriptMgr.h" #include "AccountMgr.h" @@ -159,30 +160,8 @@ int WorldSocket::SendPacket(WorldPacket const& pct) return -1; // Dump outgoing packet. - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) - { - char buff[250]; - snprintf(buff, 250, "SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - uint32(get_handle()), - uint32(pct.size()), - LookupOpcodeName (pct.GetOpcode()), - pct.GetOpcode()); - - std::string data(buff); - uint32 p = 0; - while (p < pct.size()) - { - for (uint32 j = 0; j < 16 && p < pct.size(); j++) - { - snprintf(buff, 250, "%.2X ", const_cast(pct)[p++]); - data.append(buff); - } - data.append("\n"); - } - - data.append("\n"); - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); - } + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(pct, SERVER_TO_CLIENT); // Create a copy of the original packet; this is to avoid issues if a hook modifies it. sScriptMgr->OnPacketSend(this, WorldPacket(pct)); @@ -691,30 +670,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) if (closing_) return -1; - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) - { - char buff[250]; - snprintf(buff, 250, "CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - uint32(get_handle()), - uint32(new_pct->size()), - LookupOpcodeName (new_pct->GetOpcode()), - new_pct->GetOpcode()); - - std::string data(buff); - uint32 p = 0; - while (p < new_pct->size()) - { - for (uint32 j = 0; j < 16 && p < new_pct->size(); j++) - { - snprintf(buff, 250, "%.2X ", const_cast(*new_pct)[p++]); - data.append(buff); - } - data.append("\n"); - } - - data.append("\n"); - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); - } + // Dump received packet. + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER); try { diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 5bdf805fb4..133fdff3dd 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -403,6 +403,15 @@ PersistentCharacterCleanFlags = 0 PidFile = "" +# +# PacketLogFile +# Description: Binary packet logging file for the world server. +# Filename extension must be .bin to be parsable with WowPacketParser. +# Example: "World.bin" - (Enabled) +# Default: "" - (Disabled) + +PacketLogFile = "" + # # ChatLogs.Channel # Description: Log custom channel chat. From 19cec23f396c0ab8cb6a574eea5665c73e5ce5a2 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 17 Aug 2012 15:43:42 +0200 Subject: [PATCH 071/147] DB/Spells: Fix a typo in 7b9ed5afdd4888339aa98d83b547006ea2d21375 (thx Destalker) --- sql/updates/world/2012_08_17_00_world_spell_dbc.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 sql/updates/world/2012_08_17_00_world_spell_dbc.sql diff --git a/sql/updates/world/2012_08_17_00_world_spell_dbc.sql b/sql/updates/world/2012_08_17_00_world_spell_dbc.sql new file mode 100644 index 0000000000..ee6d2d2f3b --- /dev/null +++ b/sql/updates/world/2012_08_17_00_world_spell_dbc.sql @@ -0,0 +1 @@ +UPDATE `spell_dbc` SET `ProcChance`=101,`ProcCharges`=0,`SpellFamilyName`=3,`SpellFamilyFlags2`=0 WHERE `Id`=35009; From 48e50b8254a2cc45ed561e4ff96180783787d93a Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 19 Aug 2012 11:07:21 -0500 Subject: [PATCH 072/147] Misc/Codestyle: Made some changes to function names --- .../game/Entities/GameObject/GameObject.cpp | 16 ++++++++-------- src/server/game/Maps/Map.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 20e5055dc1..bebed9ce0b 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -137,7 +137,7 @@ void GameObject::AddToWorld() // The state can be changed after GameObject::Create but before GameObject::AddToWorld bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; if (m_model) - GetMap()->Insert(*m_model); + GetMap()->InsertGameObjectModel(*m_model); EnableCollision(startOpen ^ toggledState); WorldObject::AddToWorld(); @@ -154,8 +154,8 @@ void GameObject::RemoveFromWorld() RemoveFromOwner(); if (m_model) - if (GetMap()->Contains(*m_model)) - GetMap()->Remove(*m_model); + if (GetMap()->ContainsGameObjectModel(*m_model)) + GetMap()->RemoveGameObjectModel(*m_model); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -1971,8 +1971,8 @@ void GameObject::EnableCollision(bool enable) if (!m_model) return; - /*if (enable && !GetMap()->Contains(*m_model)) - GetMap()->Insert(*m_model);*/ + /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model)) + GetMap()->InsertGameObjectModel(*m_model);*/ m_model->enable(enable ? GetPhaseMask() : 0); } @@ -1982,12 +1982,12 @@ void GameObject::UpdateModel() if (!IsInWorld()) return; if (m_model) - if (GetMap()->Contains(*m_model)) - GetMap()->Remove(*m_model); + if (GetMap()->ContainsGameObjectModel(*m_model)) + GetMap()->RemoveGameObjectModel(*m_model); delete m_model; m_model = GameObjectModel::Create(*this); if (m_model) - GetMap()->Insert(*m_model); + GetMap()->InsertGameObjectModel(*m_model); } Player* GameObject::GetLootRecipient() const diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 6d526f23a9..0743c4e545 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -439,9 +439,9 @@ class Map : public GridRefManager float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; void Balance() { _dynamicTree.balance(); } - void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); } - void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); } - bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);} + void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); } + void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); } + bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);} bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist); /* From 453158fe9d37683e9ac0785b39d81592f8b32985 Mon Sep 17 00:00:00 2001 From: Faq Date: Sun, 19 Aug 2012 19:54:46 +0300 Subject: [PATCH 073/147] DB/Loot: Some loot contents imported from UDB. Author Helias --- ...012_08_19_00_world_pickpocketing_loot_template.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sql/updates/world/2012_08_19_00_world_pickpocketing_loot_template.sql diff --git a/sql/updates/world/2012_08_19_00_world_pickpocketing_loot_template.sql b/sql/updates/world/2012_08_19_00_world_pickpocketing_loot_template.sql new file mode 100644 index 0000000000..773ad9b6eb --- /dev/null +++ b/sql/updates/world/2012_08_19_00_world_pickpocketing_loot_template.sql @@ -0,0 +1,11 @@ +-- Pickpocketing_loot_template +UPDATE creature_template SET pickpocketloot=entry WHERE entry=28200; +DELETE FROM `pickpocketing_loot_template` WHERE entry=28200; +INSERT INTO `pickpocketing_loot_template` (`entry`,`item`,`ChanceorQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +-- Dark Necromance +(28200,37467,100,1,0,1,1),-- A Steamy Romance Novel: Forbidden Love +(28200,43575,100,1,0,1,1),-- Reinforced Junkbox +(28200,35952,30,1,0,1,1),-- Briny Hardcheese +(28200,33447,22,1,0,1,1),-- Runic Healing Potion +(28200,35948,10,1,0,1,1),-- Savory Snowplum +(28200,35950,10,1,0,1,1);-- Sweet Potato Bread From 3a25fdeadec8449b6627854630ac16c8840fb3f6 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 19 Aug 2012 20:06:15 +0200 Subject: [PATCH 074/147] DB/Spells: * Fix spell target for 68184 * Add missing 'Resilience Will Fix It - achievement credit marker' (spell id 68620) to spell_dbc --- sql/updates/world/2012_08_19_01_world_spell_dbc.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sql/updates/world/2012_08_19_01_world_spell_dbc.sql diff --git a/sql/updates/world/2012_08_19_01_world_spell_dbc.sql b/sql/updates/world/2012_08_19_01_world_spell_dbc.sql new file mode 100644 index 0000000000..69a9c2a833 --- /dev/null +++ b/sql/updates/world/2012_08_19_01_world_spell_dbc.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_dbc` WHERE `Id` IN (68184,68620); +INSERT INTO `spell_dbc` (`Id`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`, `AttributesEx7`, `Stances`, `StancesNot`, `Targets`, `CastingTimeIndex`, `AuraInterruptFlags`, `ProcFlags`, `ProcChance`, `ProcCharges`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `Effect1`, `Effect2`, `Effect3`, `EffectDieSides1`, `EffectDieSides2`, `EffectDieSides3`, `EffectRealPointsPerLevel1`, `EffectRealPointsPerLevel2`, `EffectRealPointsPerLevel3`, `EffectBasePoints1`, `EffectBasePoints2`, `EffectBasePoints3`, `EffectMechanic1`, `EffectMechanic2`, `EffectMechanic3`, `EffectImplicitTargetA1`, `EffectImplicitTargetA2`, `EffectImplicitTargetA3`, `EffectImplicitTargetB1`, `EffectImplicitTargetB2`, `EffectImplicitTargetB3`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectRadiusIndex3`, `EffectApplyAuraName1`, `EffectApplyAuraName2`, `EffectApplyAuraName3`, `EffectAmplitude1`, `EffectAmplitude2`, `EffectAmplitude3`, `EffectMultipleValue1`, `EffectMultipleValue2`, `EffectMultipleValue3`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectMiscValue3`, `EffectMiscValueB1`, `EffectMiscValueB2`, `EffectMiscValueB3`, `EffectTriggerSpell1`, `EffectTriggerSpell2`, `EffectTriggerSpell3`, `EffectSpellClassMaskA1`, `EffectSpellClassMaskA2`, `EffectSpellClassMaskA3`, `EffectSpellClassMaskB1`, `EffectSpellClassMaskB2`, `EffectSpellClassMaskB3`, `EffectSpellClassMaskC1`, `EffectSpellClassMaskC2`, `EffectSpellClassMaskC3`, `MaxTargetLevel`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `MaxAffectedTargets`, `DmgClass`, `PreventionType`, `DmgMultiplier1`, `DmgMultiplier2`, `DmgMultiplier3`, `AreaGroupId`, `SchoolMask`, `Comment`) VALUES +(68184, 0, 0, 545259904, 0, 5, 268697856, 128, 0, 16777216, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 7, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faction Champions - credit marker'), +(68620, 0, 0, 545259904, 0, 5, 268697856, 128, 0, 16777216, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 7, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Resilience Will Fix It - achievement credit marker'); From 28c0874873a3b6ec32a644d0c458520c2e5e7633 Mon Sep 17 00:00:00 2001 From: Faq Date: Mon, 20 Aug 2012 10:59:07 +0200 Subject: [PATCH 075/147] Core/Spells: Fixed Libram of Wracking. thnx Vincent-Michael Closes #7094 --- ...2012_08_20_00_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_paladin.cpp | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 sql/updates/world/2012_08_20_00_world_spell_script_names.sql diff --git a/sql/updates/world/2012_08_20_00_world_spell_script_names.sql b/sql/updates/world/2012_08_20_00_world_spell_script_names.sql new file mode 100644 index 0000000000..d0aa185ea3 --- /dev/null +++ b/sql/updates/world/2012_08_20_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE (`spell_id`='33695'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(33695, 'spell_pal_exorcism_and_holy_wrath_damage'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 7d248b3585..0bf2e5664a 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -531,6 +531,41 @@ class spell_pal_righteous_defense : public SpellScriptLoader } }; +class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader +{ + public: + spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { } + + class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript); + + void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) + { + if (!spellMod) + { + spellMod = new SpellModifier(aurEff->GetBase()); + spellMod->op = SPELLMOD_DAMAGE; + spellMod->type = SPELLMOD_FLAT; + spellMod->spellId = GetId(); + spellMod->mask[1] = 0x200002; + } + + spellMod->value = aurEff->GetAmount(); + } + + void Register() + { + DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -543,4 +578,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_divine_storm_dummy(); new spell_pal_lay_on_hands(); new spell_pal_righteous_defense(); + new spell_pal_exorcism_and_holy_wrath_damage(); } From fb1ac16b0ce27567dc4bb435ee4fa0b0b228e4ad Mon Sep 17 00:00:00 2001 From: Chaplain Date: Mon, 20 Aug 2012 11:05:50 +0200 Subject: [PATCH 076/147] Core/Misc: Some fixes here and there Closes #7277 --- src/server/collision/Maps/TileAssembler.cpp | 10 ++++++++-- src/server/game/DungeonFinding/LFGMgr.cpp | 4 ++-- src/tools/vmap4_extractor/vmapexport.cpp | 22 ++++++++++----------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 3bfed7d322..207b652a4d 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -336,10 +336,16 @@ namespace VMAP void TileAssembler::exportGameobjectModels() { FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb"); - FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); - if (!model_list || !model_list_copy) + if (!model_list) return; + FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); + if (!model_list_copy) + { + fclose(model_list); + return; + } + uint32 name_length, displayId; char buff[500]; while (!feof(model_list)) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index a7dd677313..bb6c1dfdcc 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1239,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key) void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap) { lockMap.clear(); - for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it) + for (PlayerSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) { uint64 guid = (*it)->GetGUID(); LfgLockMap cachedLockMap = GetLockedDungeons(guid); - for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2) + for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2) { uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId); diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index e60a773c6d..126a543400 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -382,9 +382,9 @@ bool processArgv(int argc, char ** argv, const char *versionString) { bool result = true; hasInputPathParam = false; - bool preciseVectorData = false; + preciseVectorData = false; - for(int i=1; i< argc; ++i) + for(int i = 1; i < argc; ++i) { if(strcmp("-s",argv[i]) == 0) { @@ -447,7 +447,7 @@ int main(int argc, char ** argv) const char *versionString = "V4.00 2012_02"; // Use command line arguments, when some - if(!processArgv(argc, argv, versionString)) + if (!processArgv(argc, argv, versionString)) return 1; // some simple check if working dir is dirty @@ -469,7 +469,7 @@ int main(int argc, char ** argv) printf("Extract %s. Beginning work ....\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory - if(mkdir(szWorkDirWmo + if (mkdir(szWorkDirWmo #ifdef __linux__ , 0711 #endif @@ -482,11 +482,11 @@ int main(int argc, char ** argv) for (size_t i=0; i < archiveNames.size(); ++i) { MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); - if(!gOpenArchives.size() || gOpenArchives.front() != archive) + if (gOpenArchives.empty() || gOpenArchives.front() != archive) delete archive; } - if(gOpenArchives.empty()) + if (gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; @@ -494,15 +494,15 @@ int main(int argc, char ** argv) ReadLiquidTypeTableDBC(); // extract data - if(success) + if (success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc - if(success) + if (success) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); - if(!dbc->open()) + if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); @@ -510,7 +510,7 @@ int main(int argc, char ** argv) } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; - for(unsigned int x=0;xgetRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); @@ -527,7 +527,7 @@ int main(int argc, char ** argv) } printf("\n"); - if(!success) + if (!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); From 936c62ef4cfe85b04f689d08696a29a792815c2a Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 20 Aug 2012 16:49:19 +0200 Subject: [PATCH 077/147] Core/Players: Fixed uninitialized trade data --- src/server/game/Entities/Player/Player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 413d7fae32..271bf2b22f 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -981,7 +981,7 @@ class TradeData public: // constructors TradeData(Player* player, Player* trader) : m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false), - m_money(0), m_spell(0) {} + m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); } Player* GetTrader() const { return m_trader; } TradeData* GetTraderData() const; From 09192e23c14da9123cdd0d3d7e6c8c5bf9dc03c7 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 20 Aug 2012 13:21:53 -0400 Subject: [PATCH 078/147] Sql/Wintergrasp: add sql files for wintergrasp implementation --- ..._08_20_01_world_wintergrasp_conditions.sql | 31 +++++ ...2_08_20_02_world_wintergrasp_creatures.sql | 64 +++++++++++ ...08_20_03_world_wintergrasp_gameobjects.sql | 86 ++++++++++++++ ...012_08_20_04_world_wintergrasp_gossips.sql | 20 ++++ ...2012_08_20_05_world_wintergrasp_quests.sql | 16 +++ ...2012_08_20_06_world_wintergrasp_spells.sql | 81 +++++++++++++ .../2012_08_20_07_world_wintergrasp_texts.sql | 108 ++++++++++++++++++ 7 files changed, 406 insertions(+) create mode 100644 sql/updates/world/2012_08_20_01_world_wintergrasp_conditions.sql create mode 100644 sql/updates/world/2012_08_20_02_world_wintergrasp_creatures.sql create mode 100644 sql/updates/world/2012_08_20_03_world_wintergrasp_gameobjects.sql create mode 100644 sql/updates/world/2012_08_20_04_world_wintergrasp_gossips.sql create mode 100644 sql/updates/world/2012_08_20_05_world_wintergrasp_quests.sql create mode 100644 sql/updates/world/2012_08_20_06_world_wintergrasp_spells.sql create mode 100644 sql/updates/world/2012_08_20_07_world_wintergrasp_texts.sql diff --git a/sql/updates/world/2012_08_20_01_world_wintergrasp_conditions.sql b/sql/updates/world/2012_08_20_01_world_wintergrasp_conditions.sql new file mode 100644 index 0000000000..c97c753afa --- /dev/null +++ b/sql/updates/world/2012_08_20_01_world_wintergrasp_conditions.sql @@ -0,0 +1,31 @@ +-- Conditions +-- Add gossip_menu condition for 9904 Horde +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup` IN (9904,9923); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES +(14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal +(14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant +(14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal +(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant +-- Add gossip_menu condition for 9923 Alliance +(14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal +(14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant +(14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal +(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant +-- Add conditions to gossip options horde +(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant +-- Add conditions to gossip options alliance +(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant + +/* Spell target conditions for spawning WG siege machines in proper place while building it */ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56575,56661,56663,61408); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 56575, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 56661, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 56663, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 61408, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL); diff --git a/sql/updates/world/2012_08_20_02_world_wintergrasp_creatures.sql b/sql/updates/world/2012_08_20_02_world_wintergrasp_creatures.sql new file mode 100644 index 0000000000..1e75f37d32 --- /dev/null +++ b/sql/updates/world/2012_08_20_02_world_wintergrasp_creatures.sql @@ -0,0 +1,64 @@ +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31841; -- Taunka Spirit Guide +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31842; -- Dwarven Spirit Guide +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31052; -- Bowyer Randolph +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=39172; -- Marshal Magruder +UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry`=30488; -- Travis Day +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31053; -- Primalist Mulfort +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31107; -- Lieutenant Murp (?) +UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) +UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216, `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2, `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1, `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429, `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31091,31036,31101,31051,31153,31151,31102,31106); +UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; +UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; + +UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron +UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder +UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31347; -- Champion Ros'slai +UPDATE `creature_model_info` SET `bounding_radius`=0.305,`combat_reach`=5,`gender`=2 WHERE `modelid`=25301; -- Wintergrasp Siege Turret + +DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740,32629,28319,28366,32627,28312,28094,27881,30739); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(31841,0,0,1,0, '58729'), -- Taunka Spirit Guide (Spiritual Immunity, Spirit Heal Channel) FIX: Do we need the spell that revives players here (22011)? It has a duration (found in sniffs). +(31842,0,0,1,0, '58729'), -- Dwarven Spirit Guide This spell (and the spell it triggers, are used in the "ressurect system" in Battleground.cpp +(30400,0,0,1,0, NULL), -- Goblin Mechanic +(30499,0,0,1,0, NULL), -- Gnomish Engineer +(30489,0,0,1,0, NULL), -- Morgan Day +(30869,0,0,1,0, NULL), -- Arzo Safeflight +(31036,14337,0,257,0, NULL), -- Commander Zanneth +(31051,0,0,1,0, NULL), -- Sorceress Kaylana +(31052,0,0,257,0, NULL), -- Bowyer Randolph +(31054,0,0,257,0, NULL), -- Anchorite Tessa +(31108,0,0,257,0, NULL), -- Siege Master Stouthandle +(31109,0,0,257,0, NULL), -- Senior Demolitionist Legoso +(31153,6569,0,257,0, NULL), -- Tactical Officer Ahbramis +(32294,27247,0,1,0, NULL), -- Knight Dameron +(39172,28912,0,1,0, NULL), -- Marshal Magruder +(30870,0,0,1,0, NULL), -- Herzo Safeflight +(31053,0,0,257,0, '18950'), -- Primalist Mulfort (Invisibility and Stealth Detection ... why?) +(31091,0,0,257,0, '18950'), -- Commander Dardosh (Invisibility and Stealth Detection) +(31101,0,0,1,0, NULL), -- Hoodoo Master Fu'jin +(31102,0,0,1,0, NULL), -- Vieron Blazefeather +(31106,0,0,257,0, NULL), -- Siegesmith Stronghoof +(31107,0,0,257,0, NULL), -- Lieutenant Murp +(31151,0,0,257,0, NULL), -- Tactical Officer Kilrath +(32296,27245,0,1,0, NULL), -- Stone Guard Mukar +(39173,29261,0,1,0, NULL), -- Champion Ros'slai +(30740,0,0,257,375, NULL), -- Valiance Expedition Champion +(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon +(32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine +(28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine +(28094,0,0,257,0, NULL), -- Wintergrasp Demolisher +(27881,0,0,257,0, NULL), -- Wintergrasp Catapult +(30739,0,0,257,375, NULL); -- Warsong Champion diff --git a/sql/updates/world/2012_08_20_03_world_wintergrasp_gameobjects.sql b/sql/updates/world/2012_08_20_03_world_wintergrasp_gameobjects.sql new file mode 100644 index 0000000000..c309bf1d9d --- /dev/null +++ b/sql/updates/world/2012_08_20_03_world_wintergrasp_gameobjects.sql @@ -0,0 +1,86 @@ +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, +192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner + +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, +192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, +192255,192336); -- Horde Banner + +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, +193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, +193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, +193164,193165); -- nameless GOs + +UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter + +-- Before pushing to master check if guids are free. +-- Spawns Workshop Capture Points +SET @GUID := 71385; +DELETE FROM gameobject WHERE id IN (190475,190487,194959,194962); +DELETE FROM gameobject WHERE guid BETWEEN @GUID AND @GUID+3; +INSERT INTO gameobject (guid,id,position_x,position_y,position_z,orientation,map) VALUES +(@GUID+0, 190475, 4949.344238, 2432.585693, 320.176971, 1.386214, 571), -- ne +(@GUID+1, 190487, 4948.524414, 3342.337891, 376.875366, 4.400566, 571), -- nw +(@GUID+2, 194959, 4398.076660, 2356.503662, 376.190491, 0.525406, 571), -- se +(@GUID+3, 194962, 4390.776367, 3304.094482, 372.429077, 6.097023, 571); -- sw + +-- Misc objects in fortress phased properly +SET @OGUID := 71389; +DELETE FROM `gameobject` WHERE `id` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127,193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145,193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163,193164,193165); +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+55; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(@OGUID+0,193096,571,1,128,5379.885,3008.093,409.181915,-3.124123,0,0,0,0,120,0,1), +(@OGUID+1,193097,571,1,128,5381.73975,3008.15454,409.181915,2.98449826,0,0,0,0,120,0,1), +(@OGUID+2,193098,571,1,128,5383.672,3008.02783,409.181915,-3.115388,0,0,0,0,120,0,1), +(@OGUID+3,193099,571,1,128,5386.25342,3007.79614,409.181915,2.932139,0,0,0,0,120,0,1), +(@OGUID+4,193100,571,1,128,5387.354,3009.64941,409.181915,-1.30899549,0,0,0,0,120,0,1), +(@OGUID+5,193101,571,1,128,5381.12744,3010.09717,409.181915,-2.72271276,0,0,0,0,120,0,1), +(@OGUID+6,193102,571,1,128,5383.12061,3007.90967,410.8231,-2.530723,0,0,0,0,120,0,1), +(@OGUID+7,193103,571,1,128,5381.105,3007.89575,410.8231,-3.09791875,0,0,0,0,120,0,1), +(@OGUID+8,193104,571,1,128,5376.777,3010.619,409.191742,-2.60926127,0,0,0,0,120,0,1), +(@OGUID+9,193105,571,1,128,5381.47559,3010.24731,410.8231,-2.80997539,0,0,0,0,120,0,1), +(@OGUID+10,193106,571,1,128,5381.059,3009.85864,410.8231,2.66161919,0,0,0,0,120,0,1), +(@OGUID+11,193107,571,1,128,5381.038,3010.44263,410.8157,-2.0507617,0,0,0,0,120,0,1), +(@OGUID+12,193108,571,1,128,5379.83154,3007.82373,410.8161,-2.02457881,0,0,0,0,120,0,1), +(@OGUID+13,193109,571,1,128,5379.99463,3008.40356,410.815918,-3.03687477,0,0,0,0,120,0,1), +(@OGUID+14,193124,571,1,128,5293.65869,2924.44019,409.29306,1.20427489,0,0,0,0,120,0,1), +(@OGUID+15,193125,571,1,1,5293.28,2932.32813,409.065247,-2.49581814,0,0,0,0,120,0,1), +(@OGUID+16,193126,571,1,1,5292.30469,2930.5105,409.157135,-3.06302428,0,0,0,0,120,0,1), +(@OGUID+17,193127,571,1,64,5293.349,2923.712,409.844757,-1.8762306,0,0,0,0,120,0,1), +(@OGUID+18,193128,571,1,128,5293.12256,2895.22754,409.208771,-0.9861096,0,0,0,0,120,0,1), +(@OGUID+19,193129,571,1,128,5292.913,2895.54346,410.419617,-0.122171074,0,0,0,0,120,0,1), +(@OGUID+20,193130,571,1,128,5294.09473,2894.191,409.164063,-0.7330382,0,0,0,0,120,0,1), +(@OGUID+21,193131,571,1,128,5295.1875,2895.382,409.143219,-0.349065244,0,0,0,0,120,0,1), +(@OGUID+22,193132,571,1,128,5294.527,2895.57471,410.6591,-1.92858779,0,0,0,0,120,0,1), +(@OGUID+23,193133,571,1,128,5295.3916,2895.05737,410.6686,0.6894028,0,0,0,0,120,0,1), +(@OGUID+24,193134,571,1,128,5295.13525,2895.68481,410.618866,-2.22529364,0,0,0,0,120,0,1), +(@OGUID+25,193135,571,1,128,5294.97559,2895.33521,410.657684,-2.73143482,0,0,0,0,120,0,1), +(@OGUID+26,193136,571,1,128,5293.22559,2895.46436,410.413483,-0.802850962,0,0,0,0,120,0,1), +(@OGUID+27,193137,571,1,128,5295.56,2895.24146,410.628052,-2.11184788,0,0,0,0,120,0,1), +(@OGUID+28,193138,571,1,128,5293.741,2894.48169,409.183167,-2.72271276,0,0,0,0,120,0,1), +(@OGUID+29,193139,571,1,64,5294.599,2786.85254,409.8877,-2.356195,0,0,0,0,120,0,1), +(@OGUID+30,193140,571,1,64,5294.37939,2785.03833,409.175018,-2.33873963,0,0,0,0,120,0,1), +(@OGUID+31,193141,571,1,64,5293.205,2787.03052,409.218872,3.03687477,0,0,0,0,120,0,1), +(@OGUID+32,193142,571,1,64,5294.241,2786.42456,409.174347,0.0174524616,0,0,0,0,120,0,1), +(@OGUID+33,193143,571,1,64,5291.705,2785.86646,409.282135,-2.03330517,0,0,0,0,120,0,1), +(@OGUID+34,193144,571,1,64,5293.03369,2785.632,409.22522,-1.2915417,0,0,0,0,120,0,1), +(@OGUID+35,193145,571,1,64,5295.866,2787.7666,409.1923,2.155478,0,0,0,0,120,0,1), +(@OGUID+36,193146,571,1,64,5293.56445,2787.31079,410.55954,0.261798173,0,0,0,0,120,0,1), +(@OGUID+37,193147,571,1,128,5233.12061,2920.362,409.163544,-0.7243115,0,0,0,0,120,0,1), +(@OGUID+38,193148,571,1,128,5238.27539,2920.67358,409.256439,-0.418878615,0,0,0,0,120,0,1), +(@OGUID+39,193149,571,1,128,5235.902,2920.751,409.224457,-0.951203167,0,0,0,0,120,0,1), +(@OGUID+40,193150,571,1,128,5237.36963,2919.89771,409.556641,0.8202983,0,0,0,0,120,0,1), +(@OGUID+41,193151,571,1,128,5234.19775,2918.99731,409.322754,-2.33873963,0,0,0,0,120,0,1), +(@OGUID+42,193152,571,1,128,5234.52344,2921.76221,409.175781,-2.2165668,0,0,0,0,120,0,1), +(@OGUID+43,193153,571,1,128,5234.119,2918.93921,409.1339,-3.098036,0,0,0,0,120,0,1), +(@OGUID+44,193154,571,1,128,5234.26758,2919.40015,409.502869,-2.18166113,0,0,0,0,120,0,1), +(@OGUID+45,193155,571,1,128,5293.37939,2746.05566,409.22052,-0.06981169,0,0,0,0,120,0,1), +(@OGUID+46,193156,571,1,128,5293.65039,2755.67529,409.1913,-0.43633157,0,0,0,0,120,0,1), +(@OGUID+47,193157,571,1,128,5292.23535,2753.59473,409.0867,-0.357789934,0,0,0,0,120,0,1), +(@OGUID+48,193158,571,1,128,5292.42969,2748.62427,409.131042,0.253072351,0,0,0,0,120,0,1), +(@OGUID+49,193159,571,1,128,5293.384,2750.90283,409.234924,-0.0610866137,0,0,0,0,120,0,1), +(@OGUID+50,193160,571,1,64,5371.89746,2805.47583,409.3072,0.0610866137,0,0,0,0,120,0,1), +(@OGUID+51,193161,571,1,64,5376.616,2875.105,409.254822,1.59697616,0,0,0,0,120,0,1), +(@OGUID+52,193162,571,1,128,5377.54932,2870.92456,409.239166,-0.549776852,0,0,0,0,120,0,1), +(@OGUID+53,193163,571,1,128,5378.068,2813.61719,409.239166,1.55334139,0,0,0,0,120,0,1), +(@OGUID+54,193164,571,1,128,5378.921,2805.43677,409.239166,1.53588688,0,0,0,0,120,0,1), +(@OGUID+55,193165,571,1,128,5378.452,2876.67456,409.239166,1.54461825,0,0,0,0,120,0,1); diff --git a/sql/updates/world/2012_08_20_04_world_wintergrasp_gossips.sql b/sql/updates/world/2012_08_20_04_world_wintergrasp_gossips.sql new file mode 100644 index 0000000000..87b96b765a --- /dev/null +++ b/sql/updates/world/2012_08_20_04_world_wintergrasp_gossips.sql @@ -0,0 +1,20 @@ +-- Gossip Menu +DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; +DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; +DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172; +DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9904,13759), +(9904,13761), +(9923,14172), +(10229,14221); + +-- Gossip Menu Option +DELETE FROM `gossip_menu_option` WHERE `menu_id`=9904; +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); +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 +(9904,0,0, 'I would like to build a catapult.',1,1,0,0,0,0, ''), +(9904,1,0, 'I would like to build a demolisher.',1,1,0,0,0,0, ''), +(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''), +(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), +(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); diff --git a/sql/updates/world/2012_08_20_05_world_wintergrasp_quests.sql b/sql/updates/world/2012_08_20_05_world_wintergrasp_quests.sql new file mode 100644 index 0000000000..d456f5d5e7 --- /dev/null +++ b/sql/updates/world/2012_08_20_05_world_wintergrasp_quests.sql @@ -0,0 +1,16 @@ +-- Wintergrasp Quests - Horde +UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `id` IN (13180,13178); -- Slay them all! +UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `id` IN (13185,13223); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `id` IN (13201,13194); -- Healing with Roses +UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `id` IN (13193,13199); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `id` IN (13192,13202); -- Warding/Jinxing the Walls +UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `id` IN (13200,13191); -- Fueling the Demolishers + +-- Wintergrasp Quests - Alliance +UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `id` IN (13179,13177); -- No Mercy for the Merciless +UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `id` IN (13186,13222); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `id` IN (13195,13156); -- A Rare Herb +UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `id` IN (13196,13154); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `id` IN (13198,13153); -- Warding the Warriors + +-- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already? diff --git a/sql/updates/world/2012_08_20_06_world_wintergrasp_spells.sql b/sql/updates/world/2012_08_20_06_world_wintergrasp_spells.sql new file mode 100644 index 0000000000..cb2bd219e4 --- /dev/null +++ b/sql/updates/world/2012_08_20_06_world_wintergrasp_spells.sql @@ -0,0 +1,81 @@ +-- 54640 Teleport (Teleports defenders behind the walls on the Isle of Ulduran, Strand of the Ancients) - FIX THIS? +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54640; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(54640,54643,0, 'WG teleporter'); + +-- Spell area +DELETE FROM `spell_area` WHERE `spell` IN (58730,57940); +INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES +(58730,4581,0,0,0,0,0,2,1), -- Restricted Flight Area (Wintergrasp Eject) +(58730,4539,0,0,0,0,0,2,1), +(58730,4197,0,0,0,0,0,2,1), +(58730,4585,0,0,0,0,0,2,1), +(58730,4612,0,0,0,0,0,2,1), +(58730,4582,0,0,0,0,0,2,1), +(58730,4583,0,0,0,0,0,2,1), +(58730,4589,0,0,0,0,0,2,1), +(58730,4575,0,0,0,0,0,2,1), +(58730,4538,0,0,0,0,0,2,1), +(58730,4577,0,0,0,0,0,2,1), +(57940,65,0,0,0,0,0,2,1), -- Essence of Wintergrasp +(57940,66,0,0,0,0,0,2,1), +(57940,67,0,0,0,0,0,2,1), +(57940,206,0,0,0,0,0,2,1), +(57940,210,0,0,0,0,0,2,1), +(57940,394,0,0,0,0,0,2,1), +(57940,395,0,0,0,0,0,2,1), +(57940,1196,0,0,0,0,0,2,1), +(57940,2817,0,0,0,0,0,2,1), +(57940,3456,0,0,0,0,0,2,1), +(57940,3477,0,0,0,0,0,2,1), +(57940,3537,0,0,0,0,0,2,1), +(57940,3711,0,0,0,0,0,2,1), +(57940,4100,0,0,0,0,0,2,1), +(57940,4196,0,0,0,0,0,2,1), +(57940,4228,0,0,0,0,0,2,1), +(57940,4264,0,0,0,0,0,2,1), +(57940,4265,0,0,0,0,0,2,1), +(57940,4272,0,0,0,0,0,2,1), +(57940,4273,0,0,0,0,0,2,1), +(57940,4395,0,0,0,0,0,2,1), +(57940,4415,0,0,0,0,0,2,1), +(57940,4416,0,0,0,0,0,2,1), +(57940,4493,0,0,0,0,0,2,1), +(57940,4494,0,0,0,0,0,2,1), +(57940,4603,0,0,0,0,0,2,1); + +DELETE FROM `spell_area` WHERE `spell` IN (56618, 56617); +INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES +(56618, 4538, 1), +(56617, 4538, 1), +(56618, 4539, 1), +(56617, 4539, 1), +(56618, 4611, 1), +(56617, 4611, 1), +(56618, 4612, 1), +(56617, 4612, 1); + +-- Spell scripts. replace with SAI +DELETE FROM `spell_scripts` WHERE `id`=49899; +INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES +(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms + +-- Spell Target position for Wintergrasp Graveyard spells +DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769); +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(59760,571,5537.986,2897.493,517.057,4.819249), -- Teleport: Fortress Graveyard +(59762,571,5104.750,2300.940,368.579,0.733038), -- Teleport: Sunken Ring "area 4538" +(59763,571,5099.120,3466.036,368.484,5.317802), -- Teleport: Broken Temple "area 4539 & 4589" +(59765,571,5032.454,3711.382,372.468,3.971623), -- Teleport: Horde Landing Zone +(59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611" +(59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612" +(59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone + +DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(61409, 'spell_wintergrasp_force_building'), +(56659, 'spell_wintergrasp_force_building'), +(56662, 'spell_wintergrasp_force_building'), +(56664, 'spell_wintergrasp_force_building'), +(49899, 'spell_wintergrasp_force_building'), +(61178, 'spell_wintergrasp_grab_passenger'); diff --git a/sql/updates/world/2012_08_20_07_world_wintergrasp_texts.sql b/sql/updates/world/2012_08_20_07_world_wintergrasp_texts.sql new file mode 100644 index 0000000000..090c5350c7 --- /dev/null +++ b/sql/updates/world/2012_08_20_07_world_wintergrasp_texts.sql @@ -0,0 +1,108 @@ +-- Unused yet: +-- Wintergrasp is under attack! +-- Wintergrasp Fortress is under attack! +-- Winter's Edge Tower is under attack! +-- Eastern Bridge is under attack! +-- Western Bridge is under attack! +-- Westspark Bridge is under attack! +-- Flamewatch Tower is under attack! + +-- 'You have reached Rank 1: Corporal' Sent to player by raid leader +-- 'You have reached Rank 2: First Lieutenant' Sent to player by raid leader + +-- Wintergrasp coreside texts +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 12050 AND 12072; +INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES +(12050, '%s has been captured by %s ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12051, '%s is under attack by %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12052, 'The Broken Temple siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12053, 'Eastspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12054, 'Westspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12055, 'The Sunken Ring siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12057, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12056, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12058, 'The battle for Wintergrasp is about to begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12059, 'You have reached Rank 1: Corporal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12060, 'You have reached Rank 2: First Lieutenant', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12061, 'The south-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12062, 'The north-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12063, 'The south-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12064, 'The north-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12065, '%s has been damaged !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12066, '%s has been destroyed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12067, 'The battle for Wintergrasp begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12068, '%s has successfully defended the Wintergrasp fortress!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12069, 'The southern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12070, 'The eastern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12071, 'The western tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12072, 'The Wintergrasp fortress has been captured by %s !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- Wintergrasp script texts +DELETE FROM `script_texts` WHERE entry BETWEEN -1850507 AND -1850500; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`)VALUES +(0, -1850500, 'Guide me to the Fortress Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850501, 'Guide me to the Sunken Ring Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850502, 'Guide me to the Broken Temple Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850503, 'Guide me to the Westspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850504, 'Guide me to the Eastspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850505, 'Guide me back to the Horde landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850506, 'Guide me back to the Alliance landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text, maybe "Get in the queue for Wintergrasp."?) + +-- New support-commands for battlefield class +DELETE FROM `command` WHERE name IN ('bf start', 'bf stop', 'bf enable', 'bf switch', 'bf timer'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('bf start',3,'Syntax: .bf start #battleid'), +('bf stop',3,'Syntax: .bf stop #battleid'), +('bf enable',3,'Syntax: .bf enable #battleid'), +('bf switch',3,'Syntax: .bf switch #battleid'), +('bf timer',3,'Syntax: .bf timer #battleid #timer'); + +-- NPC talk text insert from sniff +DELETE FROM `creature_text` WHERE `entry`=15214 AND `groupid` BETWEEN 0 AND 30; +DELETE FROM `creature_text` WHERE `entry` IN (31036,31091) AND `groupid` BETWEEN 0 AND 3; +DELETE FROM `creature_text` WHERE `entry` IN (31108,31109,34924) AND `groupid`=0; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(15214,0,0, 'Let the battle begin!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,1,0, 'The southern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,2,0, 'The southern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,3,0, 'The eastern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,4,0, 'The eastern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,5,0, 'The western tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,6,0, 'The western tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,7,0, 'The north-western keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,8,0, 'The north-western keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,9,0, 'The south-eastern keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,10,0, 'The south-eastern keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,11,0, 'The Broken Temple siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,12,0, 'The Broken Temple siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,13,0, 'The Broken Temple siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,14,0, 'The Broken Temple siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,15,0, 'The Eastspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,16,0, 'The Eastspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,17,0, 'The Eastspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,18,0, 'The Eastspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,19,0, 'The Sunken Ring siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,20,0, 'The Sunken Ring siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,21,0, 'The Sunken Ring siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,22,0, 'The Sunken Ring siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,23,0, 'The Westspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,24,0, 'The Westspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,25,0, 'The Westspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,26,0, 'The Westspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,27,0, 'The Alliance has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,28,0, 'The Alliance has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,29,0, 'The Horde has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,30,0, 'The Horde has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +-- Not sure if all Alliance text is here, need horde text +(31036,0,0, 'The first of the Horde towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'), +(31036,1,0, 'The second tower has fallen! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'), +(31036,2,0, 'The Horde towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Zanneth'), +(31036,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Zanneth'), +(31091,0,0, 'The first of the Alliance towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'), +(31091,1,0, 'Lok''tar! The second tower falls! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'), +(31091,2,0, 'The Alliance towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Dardosh'), +(31091,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Dardosh'), -- ??? +(31108,0,0, 'Stop the Horde from retrieving the embers, $n. We cannot risk them having the advantage when the battle resumes!',0,7,100,0,0,0, 'Siege Master Stouthandle'), +(31109,0,0, 'Destroy their foul machines of war, $n!',0,7,100,0,0,0, 'Senior Demolitionist Legoso'), +(34924,0,0, 'The gates have been breached! Defend the keep!',1,0,100,0,0,0, 'High Commander Halford Wyrmbane'); From eb669c31e230eecd5467508261869414d12936c1 Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 13:06:35 +0300 Subject: [PATCH 079/147] Core/Battlefield: added enum for worldstates --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 1140 ++++++++++ .../game/Battlefield/Zones/BattlefieldWG.h | 1918 +++++++++++++++++ 2 files changed, 3058 insertions(+) create mode 100644 src/server/game/Battlefield/Zones/BattlefieldWG.cpp create mode 100644 src/server/game/Battlefield/Zones/BattlefieldWG.h diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp new file mode 100644 index 0000000000..977048361b --- /dev/null +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -0,0 +1,1140 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +// TODO: Implement proper support for vehicle+player teleportation +// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor +// TODO: Add proper implement of achievement + +#include "ObjectMgr.h" +#include "BattlefieldWG.h" +#include "SpellAuras.h" + +enum eWGBfData +{ + BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp + BATTLEFIELD_WG_MAPID = 571, // Northrend +}; + +bool BattlefieldWG::SetupBattlefield() +{ + InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); + + m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes + m_BattleId = BATTLEFIELD_BATTLEID_WG; + m_ZoneId = BATTLEFIELD_WG_ZONEID; + m_MapId = BATTLEFIELD_WG_MAPID; + + m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX); + m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); + m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN); + m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL); + m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE; + m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE; + m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE; + + m_TimeForAcceptInvite = 20; + m_StartGroupingTimer = 15 * MINUTE; + m_StartGrouping = false; + + m_tenacityStack = 0; + + KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0); + KickPosition.m_mapId = m_MapId; + + RegisterZone(m_ZoneId); + + m_Data32.resize(BATTLEFIELD_WG_DATA_MAX); + + m_saveTimer = 60000; + + // Init GraveYards + SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX); + + // Load from db + if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0) + && (sWorld->getWorldState(ClockWorldState[0]) == 0)) + { + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1)); + sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime); + } + + m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE); + m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); + + m_Timer = sWorld->getWorldState(ClockWorldState[0]); + if (m_BattlefieldActive) + { + m_BattlefieldActive = false; + m_Timer = m_RestartAfterCrash; + } + + for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) + { + BfGraveYardWG *gy = new BfGraveYardWG(this); + if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team + gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid); + else + gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + gy->SetTextId(WGGraveYard[i].textid); + m_GraveYardList[i] = gy; + } + + // Spawn workshop creatures and gameobjects + for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++) + { + BfWGWorkShopData *ws = new BfWGWorkShopData(this); // Create new object + // Init:setup variable + ws->Init(WGWorkShopDataBase[i].worldstate, WGWorkShopDataBase[i].type, WGWorkShopDataBase[i].nameid); + // Spawn associate npc on this point (Guard/Engineer) + for (uint8 c = 0; c < WGWorkShopDataBase[i].nbcreature; c++) + ws->AddCreature(WGWorkShopDataBase[i].CreatureData[c]); + + // Spawn associate gameobject on this point (Horde/Alliance flags) + for (uint8 g = 0; g < WGWorkShopDataBase[i].nbgob; g++) + ws->AddGameObject(WGWorkShopDataBase[i].GameObjectData[g]); + + // Create PvPCapturePoint + if (WGWorkShopDataBase[i].type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + { + ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point + // Create Object + BfCapturePointWG *workshop = new BfCapturePointWG(this, GetAttackerTeam()); + // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association) + workshop->SetCapturePointData(WGWorkShopDataBase[i].CapturePoint.entryh, 571, + WGWorkShopDataBase[i].CapturePoint.x, WGWorkShopDataBase[i].CapturePoint.y, WGWorkShopDataBase[i].CapturePoint.z, 0); + workshop->LinkToWorkShop(ws); // Link our point to the capture point (for faction changement) + AddCapturePoint(workshop); // Add this capture point to list for update this (view in Update() of OutdoorPvP) + } + else + ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep workshop= to deffender team) + + WorkShopList.insert(ws); + } + // Spawning npc in keep + for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) + { + // Horde npc + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) + KeepCreature[TEAM_HORDE].insert(creature->GetGUID()); + // Alliance npc + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) + KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); + } + // Hide keep npc + for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + // Spawn out of keep npc + // Horde npc + for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) + OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); + // Alliance npc + for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) + OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); + // Hide outside npc + for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + for (uint8 i = 0; i < WG_MAX_TURRET; i++) + { + if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0))) + { + CanonList.insert(creature->GetGUID()); + HideNpc(creature); + } + } + // Spawning Buiding + for (uint8 i = 0; i < WG_MAX_OBJ; i++) + { + GameObject* go = + SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o); + BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this); + b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid); + BuildingsInZone.insert(b); + } + // Spawning portal defender + for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++) + { + GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o); + DefenderPortalList.insert(go); + go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); + } + + // Spawn banner in keep + for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++) + { + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + { + go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY); + m_KeepGameObject[1].insert(go); + } + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + { + go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + m_KeepGameObject[0].insert(go); + } + } + + // Show defender banner in keep + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + // Hide attackant banner in keep + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + UpdateCounterVehicle(true); + return true; +} + +bool BattlefieldWG::Update(uint32 diff) +{ + bool m_return = Battlefield::Update(diff); + if (m_saveTimer <= diff) + { + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_BattlefieldActive); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam); + sWorld->setWorldState(ClockWorldState[0], m_Timer); + m_saveTimer = 60 * IN_MILLISECONDS; + } + else + m_saveTimer -= diff; + + for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) + { + const WorldSafeLocsEntry *graveyard = GetClosestGraveYard(player); + if (graveyard) + { + if (player->GetDistance2d(graveyard->x, graveyard->y) > 10.0f) + { + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + m_PlayersIsSpellImu.erase(player->GetGUID()); + } + } + } + } + + if (m_BattlefieldActive) + { + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (unit->IsInWater() && !unit->HasAura(SPELL_WINTERGRASP_WATER)) + unit->AddAura(SPELL_WINTERGRASP_WATER, unit); + if (!unit->IsInWater() && unit->HasAura(SPELL_WINTERGRASP_WATER)) + unit->RemoveAurasDueToSpell(SPELL_WINTERGRASP_WATER); + } + + } + + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) + { + if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 + { + player->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, player); + player->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); + break; + } + } + + return m_return; +} + +void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +{ + Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid); + if (IsWarTime()) + { + if (Player* player = sObjectMgr->GetPlayer(player_guid)) + { + if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) + { + player->CastSpell(player, SPELL_SPIRITUAL_IMMUNITY, true); + m_PlayersIsSpellImu.insert(player->GetGUID()); + } + } + } +} + +void BattlefieldWG::OnBattleStart() +{ + // Spawn titan relic + m_relic = SpawnGameObject(BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC, 5440.0f, 2840.8f, 430.43f, 0); + if (m_relic) + { + // Update faction of relic, only attacker can click on + m_relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]); + // Set in use (not allow to click on before last door is broken) + m_relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } + else + sLog->outError("WG: Failed to spawn titan relic."); + + + // Update tower visibility and update faction + for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + ShowNpc(creature, true); + creature->setFaction(WintergraspFaction[GetDefenderTeam()]); + } + } + } + + // Rebuild all wall + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + { + if ((*itr)) + { + (*itr)->Rebuild(); + (*itr)->UpdateTurretAttack(false); + } + } + + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] = 0; + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] = 0; + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT] = 0; + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0; + + // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + { + if ((*itr)) + (*itr)->UpdateGraveYardAndWorkshop(); + } + + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator p_itr = m_players[team].begin(); p_itr != m_players[team].end(); ++p_itr) + { + // Kick player in orb room, TODO: offline player ? + if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + { + float x, y, z; + player->GetPosition(x, y, z); + if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480) + player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f); + SendInitWorldStatesTo(player); + } + } + // Initialize vehicle counter + UpdateCounterVehicle(true); + // Send start warning to all players + SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START); +} + +void BattlefieldWG::UpdateCounterVehicle(bool init) +{ + if (init) + { + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H] = 0; + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A] = 0; + } + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0; + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0; + + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + { + if (BfWGWorkShopData * workshop = (*itr)) + { + if (workshop->m_TeamControl == TEAM_ALLIANCE) + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; + else if (workshop->m_TeamControl == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4; + } + } + + UpdateVehicleCountWG(); +} + +void BattlefieldWG::OnBattleEnd(bool endbytimer) +{ + // Remove relic + if (m_relic) + m_relic->RemoveFromWorld(); + m_relic = NULL; + + // Remove turret + for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + if (!endbytimer) + creature->setFaction(WintergraspFaction[GetDefenderTeam()]); + HideNpc(creature); + } + } + } + + // If endbytimer is false, battle is end by clicking on relic + if (!endbytimer) + { + // Change all npc in keep + for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + } + for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + ShowNpc(creature, true); + } + // Change all npc out of keep + for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + HideNpc(creature); + } + for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + ShowNpc(creature, true); + } + } + + // Update all graveyard, control is to defender when no wartime + for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++) + { + if (GetGraveYardById(i)) + { + GetGraveYardById(i)->ChangeControl(GetDefenderTeam()); + } + } + + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + // Update portal defender faction + for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr) + (*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); + + // Saving data + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + (*itr)->Save(); + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + (*itr)->Save(); + + uint32 WinHonor = 0; + uint32 LossHonor = 0; + + if (!endbytimer) + { + WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; + LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; + } + else + { + WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; + LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; + } + + for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); + if (player->HasAura(SPELL_LIEUTENANT)) + { + player->RewardHonor(NULL, 1, WinHonor); + RewardMarkOfHonor(player, 3); + } + else if (player->HasAura(SPELL_CORPORAL)) + { + player->RewardHonor(NULL, 1, WinHonor); + RewardMarkOfHonor(player, 2); + } + if (player->GetTeamId() == TEAM_HORDE) + IncrementQuest(player, 13183, true); + else + IncrementQuest(player, 13181, true); + // Send Wintergrasp victory achievement + DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); + // Award achievement for succeeding in Wintergrasp in 10 minutes or less + if (!endbytimer && GetTimer() <= 10000) + DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player); + } + } + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + if (player->HasAura(SPELL_LIEUTENANT)) + { + player->RewardHonor(NULL, 1, LossHonor); + RewardMarkOfHonor(player, 1); + } + else if (player->HasAura(SPELL_CORPORAL)) + { + player->RewardHonor(NULL, 1, LossHonor); + RewardMarkOfHonor(player, 1); + } + } + } + + for (uint8 team = 0; team < 2; ++team) + { + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->RemoveAura(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + } + } + m_PlayersInWar[team].clear(); + + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + if (creature->IsVehicle()) + creature->GetVehicleKit()->Dismiss(); + } + m_vehicles[team].clear(); + } + + if (!endbytimer) + { + for (uint8 team = 0; team < 2; ++team) + { + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + { + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID()); + player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); + } + } + } + } + + if (!endbytimer) + { // win alli/horde + SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1); + } + else + { // defend alli/horde + SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1); + } +} + +// ***************************************************** +// *******************Reward System********************* +// ***************************************************** +void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 /*incrementNumber */ ) +{ + AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement); + + switch (achievement) + { + case ACHIEVEMENTS_WIN_WG_100: + { + // player->GetAchievementMgr().UpdateAchievementCriteria(); + } + default: + { + if (player) + player->CompletedAchievement(AE); + } + break; + } + +} + +void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count) +{ + // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens + if (count == 0) + return; + + ItemPosCountVec dest; + uint32 no_space_count = 0; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count); + + if (msg == EQUIP_ERR_ITEM_NOT_FOUND) + { + return; + } + + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= no_space_count; + + if (count != 0 && !dest.empty()) // can add some + if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0)) + player->SendNewItem(item, count, true, false); +} + +void BattlefieldWG::OnStartGrouping() +{ + // Warn + SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); +} + +void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) +{ + if (IsWarTime()) + { + switch (creature->GetEntry()) + { + case 28312: + case 32627: + case 27881: + case 28094: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; + + if (add) + { + if (team == TEAM_HORDE) + { + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) + { + creature->AddAura(SPELL_HORDE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } + else + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } + } + else + { + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + { + creature->AddAura(SPELL_ALLIANCE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } + else + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } + } + } + else + { + m_vehicles[team].erase(creature->GetGUID()); + if (team == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; + else + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; + UpdateVehicleCountWG(); + } + break; + } + } + } +} + +// Called when player kill a unit in wg zone +void BattlefieldWG::HandleKill(Player* killer, Unit* victim) +{ + if (killer == victim) + return; + + bool again = false; + if (victim->GetTypeId() == TYPEID_PLAYER) + { + IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); + IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); + for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + { + if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (player->GetDistance2d(killer) < 40) + PromotePlayer(player); + } + return; + } + for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); + itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + if (victim->GetEntry() == creature->GetEntry() && !again) + { + again = true; + for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + { + if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (player->GetDistance2d(killer) < 40) + IncrementQuest(player, IncrementQuest(killer, WGQuest[killer->GetTeamId()][0])); + } + } + } + } + } + for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); + itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) + { + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature* creature = unit->ToCreature()) + { + if (victim->GetEntry() == creature->GetEntry() && !again) + { + again = true; + IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); + IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); + for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + { + if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (player->GetDistance2d(killer) < 40) + PromotePlayer(player); + } + } + } + } + } + // TODO:Recent PvP activity worldstate +} + +// Update rank for player +void BattlefieldWG::PromotePlayer(Player* killer) +{ + if (!m_BattlefieldActive) + return; + // Updating rank of player + if (Aura* aur = killer->GetAura(SPELL_RECRUIT)) + { + if (aur->GetStackAmount() >= 5) // 7 or more TODO: + { + killer->RemoveAura(SPELL_RECRUIT); + killer->CastSpell(killer, SPELL_CORPORAL, true); + SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK); + } + else + killer->CastSpell(killer, SPELL_RECRUIT, true); + } + else if (Aura* aur = killer->GetAura(SPELL_CORPORAL)) + { + if (aur->GetStackAmount() >= 5) // 7 or more TODO: + { + killer->RemoveAura(SPELL_CORPORAL); + killer->CastSpell(killer, SPELL_LIEUTENANT, true); + SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK); + } + else + killer->CastSpell(killer, SPELL_CORPORAL, true); + } +} + +void BattlefieldWG::OnPlayerJoinWar(Player* player) +{ + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + + player->CastSpell(player, SPELL_RECRUIT, true); + + if (player->GetZoneId() != m_ZoneId) + { + if (player->GetTeamId() == GetDefenderTeam()) + { + player->TeleportTo(571, 5345, 2842, 410, 3.14f); + } + else + { + if (player->GetTeamId() == TEAM_HORDE) + player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f); + else + player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f); + } + } + + UpdateTenacity(); + + if (player->GetTeamId() == GetAttackerTeam()) + { + if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + } + else + { + if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + } + SendInitWorldStatesTo(player); +} + +void BattlefieldWG::OnPlayerLeaveWar(Player* player) +{ + // Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG + if (!player->GetSession()->PlayerLogout()) + { + if (player->GetVehicle()) // Remove vehicle of player if he go out. + player->GetVehicle()->Dismiss(); + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + } + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT); +} + +void BattlefieldWG::OnPlayerLeaveZone(Player* player) +{ + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + if (!m_BattlefieldActive) + { + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + } + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); + player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT); +} + +void BattlefieldWG::OnPlayerEnterZone(Player* player) +{ + player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + if (!m_BattlefieldActive) + { + player->RemoveAurasDueToSpell(SPELL_RECRUIT); + player->RemoveAurasDueToSpell(SPELL_CORPORAL); + player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); + player->RemoveAurasDueToSpell(SPELL_TENACITY); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); + player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + if (player->GetTeamId() == GetDefenderTeam()) + player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); + } + + player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); + // Send worldstate to player + SendInitWorldStatesTo(player); +} + +// Method sending worldsate to player +WorldPacket BattlefieldWG::BuildInitWorldStates() +{ + WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkShopList.size() * 8))); + + data << uint32(m_MapId); + data << uint32(m_ZoneId); + data << uint32(0); + data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkShopList.size()); + + data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); + data << uint32(3710) << uint32(IsWarTime()? 1 : 0); + + for (uint32 i = 0; i < 2; ++i) + data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); + + data << uint32(3490) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + data << uint32(3491) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); + data << uint32(3680) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + data << uint32(3681) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); + + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + { + data << (*itr)->m_WorldState << (*itr)->m_State; + } + for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + { + data << (*itr)->m_WorldState << (*itr)->m_State; + } + return data; +} + +void BattlefieldWG::SendInitWorldStatesTo(Player *player) +{ + WorldPacket data = BuildInitWorldStates(); + player->GetSession()->SendPacket(&data); +} + +void BattlefieldWG::SendInitWorldStatesToAll() +{ + WorldPacket data = BuildInitWorldStates(); + for (uint8 team = 0; team < 2; team++) + for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->GetSession()->SendPacket(&data); +} + +void BattlefieldWG::BrokenWallOrTower(TeamId team) +{ + if (team == GetDefenderTeam()) + { + for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) + { + if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + { + if (player->GetTeamId() == TEAM_ALLIANCE) + IncrementQuest(player, 13222); + else + IncrementQuest(player, 13223); + } + } + } +} +// Called when a tower is broke +void BattlefieldWG::AddBrokenTower(TeamId team) +{ + // Destroy an attack tower + if (team == GetAttackerTeam()) + { + // Update counter + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]--; + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]++; + + // Remove buff stack + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); + + // Add buff stack + for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + { + player->CastSpell(player, SPELL_TOWER_CONTROL, true); + if (player->GetTeamId() == TEAM_HORDE) + IncrementQuest(player, 13539, true); + else + IncrementQuest(player, 13538, true); + DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); + } + // If the threw south tower is destroy + if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3) + { + // Remove 10 minutes to battle time + if (int32(m_Timer - 600000) < 0) + { + m_Timer = 0; + } + else + { + m_Timer -= 600000; + } + SendInitWorldStatesToAll(); + } + } + else + { + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]--; + m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF]++; + } +} + +void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId) +{ + if (!obj || !IsWarTime()) + return; + + // On click on titan relic + if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) + { + // Check that the door is break + if (m_CanClickOnOrb) + EndBattle(false); + else // if door is not break, respawn relic. + m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY); + } + + // if destroy or damage event, search the wall/tower and update worldstate/send warning message + for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) + { + if (obj->GetEntry() == (*itr)->m_Build->GetEntry()) + { + if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId) + (*itr)->Damaged(); + + if ((*itr)->m_Build->GetGOInfo()->building.destroyedEvent == eventId) + (*itr)->Destroyed(); + + break; + } + } +} + +// Called when a tower is damaged, used for honor reward calcul +void BattlefieldWG::AddDamagedTower(TeamId team) +{ + if (team == GetAttackerTeam()) + { + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]++; + } + else + { + m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]++; + } +} + +// Update vehicle count WorldState to player +void BattlefieldWG::UpdateVehicleCountWG() +{ + SendUpdateWorldState(3490, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + SendUpdateWorldState(3491, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); + SendUpdateWorldState(3680, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + SendUpdateWorldState(3681, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); +} + +void BattlefieldWG::UpdateTenacity() +{ + TeamId team = TEAM_NEUTRAL; + uint32 allianceNum = m_PlayersInWar[TEAM_ALLIANCE].size(); + uint32 hordeNum = m_PlayersInWar[TEAM_HORDE].size(); + int32 newStack = 0; + + if (allianceNum && hordeNum) + { + if (allianceNum < hordeNum) + newStack = int32((float (hordeNum) / float (allianceNum) - 1) *4); // positive, should cast on alliance + else if (allianceNum > hordeNum) + newStack = int32((1 - float (allianceNum) / float (hordeNum)) *4); // negative, should cast on horde + } + + if (newStack == int32(m_tenacityStack)) + return; + + if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance + team = TEAM_ALLIANCE; + else if (newStack >= 0) // old buff was on horde + team = TEAM_HORDE; + + m_tenacityStack = newStack; + // Remove old buff + if (team != TEAM_NEUTRAL) + { + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (player->getLevel() >= m_MinLevel) + player->RemoveAurasDueToSpell(SPELL_TENACITY); + + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE); + } + + // Apply new buff + if (newStack) + { + team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE; + + if (newStack < 0) + newStack = -newStack; + if (newStack > 20) + newStack = 20; + + uint32 buff_honor = SPELL_GREATEST_HONOR; + buff_honor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honor; + buff_honor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honor; + buff_honor = (newStack < 5) ? 0 : buff_honor; + + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->SetAuraStack(SPELL_TENACITY, player, newStack); + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack); + + if (buff_honor != 0) + { + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* player = sObjectMgr->GetPlayer((*itr))) + player->AddAura(buff_honor, player); + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Creature* creature = unit->ToCreature()) + creature->AddAura(buff_honor, creature); + } + } +} + +void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ ) +{ + m_WorkShop->ChangeControl(m_team, false); +} + +BfCapturePointWG::BfCapturePointWG(BattlefieldWG* bf, TeamId control) : BfCapturePoint(bf) +{ + m_Bf = bf; + m_team = control; +} + +BfGraveYardWG::BfGraveYardWG(BattlefieldWG* bf) : BfGraveYard(bf) +{ + m_Bf = bf; +} diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h new file mode 100644 index 0000000000..ffde7cb060 --- /dev/null +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -0,0 +1,1918 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef BATTLEFIELD_WG_ +#define BATTLEFIELD_WG_ + +#include "ObjectAccessor.h" +#include "WorldPacket.h" +#include "World.h" +#include "Group.h" +#include "Battlefield.h" + +const uint32 VehNumWorldState[2] = { 3680, 3490 }; +const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; +const uint32 ClockWorldState[2] = { 3781, 4354 }; +const uint32 WintergraspFaction[3] = { 1732, 1735, 35 }; + +const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; + +class BattlefieldWG; +class BfCapturePointWG; + +struct BfWGGameObjectBuilding; +struct BfWGWorkShopData; + +typedef std::setGameObjectSet; +typedef std::set GameObjectBuilding; +typedef std::set WorkShop; +//typedef std::set CapturePointSet; unused ? +typedef std::set GroupSet; + +enum eWGItem +{ +// *INDENT-OFF* + WG_MARK_OF_HONOR = 43589, +// *INDENT-ON* +}; + +enum eWGSpell +{ +// *INDENT-OFF* + // AWartime auras + SPELL_RECRUIT = 37795, + SPELL_CORPORAL = 33280, + SPELL_LIEUTENANT = 55629, + SPELL_TENACITY = 58549, + SPELL_TENACITY_VEHICLE = 59911, + SPELL_TOWER_CONTROL = 62064, + SPELL_SPIRITUAL_IMMUNITY = 58729, + SPELL_GREAT_HONOR = 58555, + SPELL_GREATER_HONOR = 58556, + SPELL_GREATEST_HONOR = 58557, + SPELL_ALLIANCE_FLAG = 14268, + SPELL_HORDE_FLAG = 14267, + + // Reward spells + SPELL_VICTORY_REWARD = 56902, + SPELL_DEFEAT_REWARD = 58494, + SPELL_DAMAGED_TOWER = 59135, + SPELL_DESTROYED_TOWER = 59136, + SPELL_DAMAGED_BUILDING = 59201, + SPELL_INTACT_BUILDING = 59203, + + SPELL_TELEPORT_BRIDGE = 59096, + SPELL_TELEPORT_FORTRESS = 60035, + + SPELL_TELEPORT_DALARAN = 53360, + SPELL_VICTORY_AURA = 60044, + + // Other spells + SPELL_WINTERGRASP_WATER = 36444, + SPELL_ESSENCE_OF_WINTERGRASP = 58045, + SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730, + + // Phasing spells + SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16 + SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617,// ADDS PHASE 32 + + SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64 + SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128 + +// *INDENT-ON* +}; + +enum eWGData32 +{ + BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, + BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, + BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, + BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, + BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, + BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, + BATTLEFIELD_WG_DATA_VEHICLE_A, + BATTLEFIELD_WG_DATA_VEHICLE_H, + BATTLEFIELD_WG_DATA_MAX, +}; + +enum WB_ACHIEVEMENTS +{ +// *INDENT-OFF* + ACHIEVEMENTS_WIN_WG = 1717, + ACHIEVEMENTS_WIN_WG_100 = 1718, // todo + ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo + ACHIEVEMENTS_WG_TOWER_DESTROY = 1727, + ACHIEVEMENTS_DESTRUCTION_DERBY_A = 1737, // todo + ACHIEVEMENTS_WG_TOWER_CANNON_KILL = 1751, // todo + ACHIEVEMENTS_WG_MASTER_A = 1752, // todo + ACHIEVEMENTS_WIN_WG_TIMER_10 = 1755, + ACHIEVEMENTS_STONE_KEEPER_50 = 2085, // todo + ACHIEVEMENTS_STONE_KEEPER_100 = 2086, // todo + ACHIEVEMENTS_STONE_KEEPER_250 = 2087, // todo + ACHIEVEMENTS_STONE_KEEPER_500 = 2088, // todo + ACHIEVEMENTS_STONE_KEEPER_1000 = 2089, // todo + ACHIEVEMENTS_WG_RANGER = 2199, // todo + ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo + ACHIEVEMENTS_WG_MASTER_H = 2776, // todo +// *INDENT-ON* +}; + +enum eWGWorldStates +{ + BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, + BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, + BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, +}; +/*######################### +*####### Graveyards ######* +#########################*/ + +class BfGraveYardWG : public BfGraveYard +{ + public: + BfGraveYardWG(BattlefieldWG *Bf); + + void SetTextId(uint32 textid) { m_GossipTextId = textid; } + uint32 GetTextId() { return m_GossipTextId; } + protected: + uint32 m_GossipTextId; +}; + +enum eWGGraveyardId +{ + BATTLEFIELD_WG_GY_WORKSHOP_NE, + BATTLEFIELD_WG_GY_WORKSHOP_NW, + BATTLEFIELD_WG_GY_WORKSHOP_SE, + BATTLEFIELD_WG_GY_WORKSHOP_SW, + BATTLEFIELD_WG_GY_KEEP, + BATTLEFIELD_WG_GY_HORDE, + BATTLEFIELD_WG_GY_ALLIANCE, + BATTLEFIELD_WG_GY_MAX, +}; + +enum eWGGossipText +{ +// *INDENT-OFF* + BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, + BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503, + BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500, + BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505, + BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506, +// *INDENT-ON* +}; + +enum eWGNpc +{ +// *INDENT-OFF* + BATTLEFIELD_WG_NPC_GUARD_H = 30739, + BATTLEFIELD_WG_NPC_GUARD_A = 30740, + BATTLEFIELD_WG_NPC_STALKER = 00000, + + BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102, + BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296,// + BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101,// + BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173,// + BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091, + BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151, + BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106, + BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053, + BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107, + + BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052, + BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294,// + BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051,// + BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172,// + BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036, + BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153, + BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108, + BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054, + BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109, + + NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp + NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp +// *INDENT-ON* +}; + +struct BfWGCoordGY +{ + float x; + float y; + float z; + float o; + uint32 gyid; + uint8 type; + uint32 textid; // for gossip menu + TeamId startcontrol; +}; + +const uint32 WGQuest[2][6] = { + { 13186, 13181, 13222, 13538, 13177, 13179 }, + { 13185, 13183, 13223, 13539, 13178, 13180 }, +}; +// 7 in sql, 7 in header +const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { + { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, + { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, + { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL }, + { 4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, BATTLEFIELD_WG_GY_WORKSHOP_SW, BATTLEFIELD_WG_GOSSIPTEXT_GY_SW, TEAM_NEUTRAL }, + { 5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP, TEAM_NEUTRAL }, + { 5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE, TEAM_HORDE }, + { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE }, +}; + +/*######################### +* BfCapturePointWG * +#########################*/ + +class BfCapturePointWG : public BfCapturePoint +{ + public: + BfCapturePointWG(BattlefieldWG *bf, TeamId control); + + void LinkToWorkShop(BfWGWorkShopData *ws) + { + m_WorkShop = ws; + } + + void ChangeTeam(TeamId oldteam); + TeamId GetTeam() const + { + return m_team; + } + + protected: + BfWGWorkShopData *m_WorkShop; +}; + +/*######################### +* WinterGrasp Battlefield * +#########################*/ + +class BattlefieldWG : public Battlefield +{ + public: + /** + * \brief Called when the battle start + * -Spawn relic and turret + * -Rebuild tower and wall + * -Invite player to war + */ + void OnBattleStart(); + + /** + * \brief Called when battle end + * -Remove relic and turret + * -Change banner/npc in keep if it needed + * -Saving battlestate + * -Reward honor/mark to player + * -Remove vehicle + * \param endbytimer : true if battle end when timer is at 00:00, false if battle end by clicking on relic + */ + void OnBattleEnd(bool endbytimer); + + /** + * \brief Called when grouping start (15 minutes before battlestart) + * -Invite all player in zone to join queue + */ + void OnStartGrouping(); + + /** + * \brief Called when player accept invite to join battle + * -Update aura + * -Teleport if it needed + * -Update worldstate + * -Update tenacity + * \param plr: Player who accept invite + */ + void OnPlayerJoinWar(Player *plr); + + /** + * \brief Called when player leave battle + * -Update player aura + * \param plr : Player who leave battle + */ + void OnPlayerLeaveWar(Player *plr); + + /** + * \brief Called when player leave WG zone + * \param plr : Player who leave zone + */ + void OnPlayerLeaveZone(Player *plr); + + /** + * \brief Called when player enter in WG zone + * -Update aura + * -Update worldstate + * \param plr : Player who leave zone + */ + void OnPlayerEnterZone(Player *plr); + + /** + * \brief Called for update battlefield data + * -Save battle timer in database every minutes + * -Update imunity aura from graveyard + * -Update water aura, if player is in water (HACK) + * \param diff : time ellapsed since the last call (in ms) + */ + bool Update(uint32 diff); + + /** + * \brief Called when a creature is spawn or remove from WG + * -Update vehicle count + * \param add : true > creature is spawn false > creature is remove + */ + void OnCreatureCreate(Creature *creature, bool add); + + /** + * \brief Called when a wall/tower is broken + * -Update quest + */ + void BrokenWallOrTower(TeamId team); + + /** + * \brief Called when a tower is damaged + * -Update tower count (for reward calcul) + */ + void AddDamagedTower(TeamId team); + + /** + * \brief Called when tower is broken + * -Update tower buff + * -check if three south tower is down for remove 10 minutes to wg + */ + void AddBrokenTower(TeamId team); + + void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); + + /** + * \brief called when a player is die, for add him to resurrect queue + */ + void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + + /** + * \brief Called when battlefield is setup, at server start + */ + bool SetupBattlefield(); + + /// Return pointer to relic object + GameObject *GetRelic() + { + return m_relic; + } + + /// Define relic object + void SetRelic(GameObject * relic) + { + m_relic = relic; + } + + /// Say if player can click or not on orb (last door broken) + bool CanClickOnOrb() + { + return m_CanClickOnOrb; + } + + /// Define if player can click or not on orb (if last door broken) + void AllowToClickOnOrb(bool allow) + { + m_CanClickOnOrb = allow; + } + + void RewardMarkOfHonor(Player *plr, uint32 count); + + void UpdateVehicleCountWG(); + void UpdateCounterVehicle(bool init); + + WorldPacket BuildInitWorldStates(); + void SendInitWorldStatesTo(Player * plr); + void SendInitWorldStatesToAll(); + + void HandleKill(Player *killer, Unit *victim); + void PromotePlayer(Player *killer); + + void UpdateTenacity(); + void ProcessEvent(GameObject *obj, uint32 eventId); + + protected: + bool m_CanClickOnOrb; + GameObject* m_relic; + GameObjectBuilding BuildingsInZone; + GuidSet KeepCreature[2]; + GuidSet OutsideCreature[2]; + WorkShop WorkShopList; + GuidSet CanonList; + GameObjectSet DefenderPortalList; + GameObjectSet m_KeepGameObject[2]; + GuidSet m_vehicles[2]; + GuidSet m_PlayersIsSpellImu; // Player is dead + uint32 m_tenacityStack; + uint32 m_saveTimer; +}; + +#define NORTHREND_WINTERGRASP 4197 + +enum eWGGameObjectBuildingType +{ + BATTLEFIELD_WG_OBJECTTYPE_DOOR, + BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC, + BATTLEFIELD_WG_OBJECTTYPE_WALL, + BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, + BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, + BATTLEFIELD_WG_OBJECTTYPE_TOWER, +}; + +enum eWGGameObjectState +{ + BATTLEFIELD_WG_OBJECTSTATE_NONE, + BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT, + BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DAMAGE, + BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DESTROY, + BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT, + BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE, + BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY, + BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT, + BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE, + BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY, +}; + +enum eWGWorkShopType +{ + BATTLEFIELD_WG_WORKSHOP_NE, + BATTLEFIELD_WG_WORKSHOP_NW, + BATTLEFIELD_WG_WORKSHOP_SE, + BATTLEFIELD_WG_WORKSHOP_SW, + BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, + BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, +}; + +enum eWGTeamControl +{ + BATTLEFIELD_WG_TEAM_ALLIANCE, + BATTLEFIELD_WG_TEAM_HORDE, + BATTLEFIELD_WG_TEAM_NEUTRAL, +}; + +// TODO: Handle this with creature_text ? +enum eWGText +{ +// *INDENT-OFF* + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW = 12054, + BATTLEFIELD_WG_TEXT_WORKSHOP_ATTACK = 12051, + BATTLEFIELD_WG_TEXT_WORKSHOP_TAKEN = 12050, + BATTLEFIELD_WG_TEXT_ALLIANCE = 12057, + BATTLEFIELD_WG_TEXT_HORDE = 12056, + BATTLEFIELD_WG_TEXT_WILL_START = 12058, + BATTLEFIELD_WG_TEXT_START = 12067, + BATTLEFIELD_WG_TEXT_FIRSTRANK = 12059, + BATTLEFIELD_WG_TEXT_SECONDRANK = 12060, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE = 12062, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW = 12064, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE = 12061, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW = 12063, + BATTLEFIELD_WG_TEXT_TOWER_DAMAGE = 12065, + BATTLEFIELD_WG_TEXT_TOWER_DESTROY = 12066, + BATTLEFIELD_WG_TEXT_TOWER_NAME_S = 12069, + BATTLEFIELD_WG_TEXT_TOWER_NAME_E = 12070, + BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071, + BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068, + BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072, +// *INDENT-ON* +}; + +enum eWGObject +{ +// *INDENT-OFF* + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475, + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW = 190487, + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE = 194959, + BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW = 194962, + BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC = 192829, +// *INDENT-ON* +}; +struct BfWGObjectPosition +{ + float x; + float y; + float z; + float o; + uint32 entryh; + uint32 entrya; +}; + +// ********************************************************* +// ************Destructible (Wall,Tower..)****************** +// ********************************************************* + +struct BfWGBuildingSpawnData +{ + uint32 entry; + uint32 WorldState; + float x; + float y; + float z; + float o; + uint32 type; + uint32 nameid; +}; + +#define WG_MAX_OBJ 32 +const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = { + // Wall (Not spawned in db) + // Entry WS X Y Z O type NameID + { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191796, 3772, 5384.45f, 2771.84f, 410.27f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191799, 3762, 5371.44f, 2630.61f, 408.816f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191800, 3766, 5301.84f, 2909.09f, 409.866f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191801, 3770, 5301.06f, 2771.41f, 409.901f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191802, 3751, 5280.2f, 2995.58f, 408.825f, 1.61443f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191803, 3752, 5279.14f, 2956.02f, 408.604f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191804, 3767, 5278.69f, 2882.51f, 409.539f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191806, 3769, 5279.5f, 2798.94f, 409.998f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191807, 3759, 5279.94f, 2724.77f, 409.945f, 1.56207f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191808, 3760, 5279.6f, 2683.79f, 409.849f, 1.55334f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191809, 3761, 5330.96f, 2630.78f, 409.283f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190369, 3753, 5256.08f, 2933.96f, 409.357f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190370, 3758, 5257.46f, 2747.33f, 409.743f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190371, 3754, 5214.96f, 2934.09f, 409.19f, -0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190372, 3757, 5215.82f, 2747.57f, 409.188f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190374, 3755, 5162.27f, 2883.04f, 410.256f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 190376, 3756, 5163.72f, 2799.84f, 409.227f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + + // Tower of keep (Not spawned in db) + { 190221, 3711, 5281.15f, 3044.59f, 407.843f, 3.11539f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW }, + { 190373, 3713, 5163.76f, 2932.23f, 409.19f, 3.12412f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW }, + { 190377, 3714, 5166.4f, 2748.37f, 409.188f, -1.5708f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE }, + { 190378, 3712, 5281.19f, 2632.48f, 409.099f, -1.58825f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE }, + + // Wall (with passage) (Not spawned in db) + { 191797, 3765, 5343.29f, 2908.86f, 409.576f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191798, 3771, 5342.72f, 2771.39f, 409.625f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + { 191805, 3768, 5279.13f, 2840.8f, 409.783f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, + + // South tower (Not spawned in db) + { 190356, 3704, 4557.17f, 3623.94f, 395.883f, 1.67552f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_W }, + { 190357, 3705, 4398.17f, 2822.5f, 405.627f, -3.12412f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_S }, + { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E }, + + // Door of forteress (Not spawned in db) + { 190375, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 }, + + // Last door (Not spawned in db) + { 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 }, +}; + + +// ********************************************************* +// **********Keep Element(GameObject,Creature)************** +// ********************************************************* + +// Keep gameobject +// 192488 : 10 in sql, 19 in header +// 192501 : 12 in sql, 17 in header +// 192416 : 1 in sql, 33 in header +// 192374 : 1 in sql, 1 in header +// 192375 : 1 in sql, 1 in header +// 192336 : 1 in sql, 1 in header +// 192255 : 1 in sql, 1 in header +// 192269 : 1 in sql, 7 in header +// 192254 : 1 in sql, 1 in header +// 192349 : 1 in sql, 1 in header +// 192366 : 1 in sql, 3 in header +// 192367 : 1 in sql, 1 in header +// 192364 : 1 in sql, 1 in header +// 192370 : 1 in sql, 1 in header +// 192369 : 1 in sql, 1 in header +// 192368 : 1 in sql, 1 in header +// 192362 : 1 in sql, 1 in header +// 192363 : 1 in sql, 1 in header +// 192379 : 1 in sql, 1 in header +// 192378 : 1 in sql, 1 in header +// 192355 : 1 in sql, 1 in header +// 192354 : 1 in sql, 1 in header +// 192358 : 1 in sql, 1 in header +// 192359 : 1 in sql, 1 in header +// 192338 : 1 in sql, 1 in header +// 192339 : 1 in sql, 1 in header +// 192284 : 1 in sql, 1 in header +// 192285 : 1 in sql, 1 in header +// 192371 : 1 in sql, 1 in header +// 192372 : 1 in sql, 1 in header +// 192373 : 1 in sql, 1 in header +// 192360 : 1 in sql, 1 in header +// 192361 : 1 in sql, 1 in header +// 192356 : 1 in sql, 1 in header +// 192352 : 1 in sql, 1 in header +// 192353 : 1 in sql, 1 in header +// 192357 : 1 in sql, 1 in header +// 192350 : 1 in sql, 1 in header +// 192351 : 1 in sql, 1 in header +#define WG_KEEPGAMEOBJECT_MAX 44 +const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { + { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower + { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect + { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect + { 5163.129883f, 2952.590088f, 433.502991f, 1.535890f, 192488, 192501 }, // Flag on tower + { 5145.109863f, 2935.000000f, 433.385986f, 3.141590f, 192488, 192501 }, // Flag on tower + { 5158.810059f, 2883.129883f, 431.618011f, 3.141590f, 192488, 192416 }, // Flag on wall + { 5154.490234f, 2862.149902f, 445.011993f, 3.141590f, 192336, 192416 }, // Flag on Wall Intersect + { 5154.520020f, 2853.310059f, 409.183014f, 3.141590f, 192255, 192269 }, // Flag on the floor + { 5154.459961f, 2828.939941f, 409.188995f, 3.141590f, 192254, 192269 }, // Flag on the floor + { 5155.310059f, 2820.739990f, 444.979004f, -3.13286f, 192349, 192416 }, // Flag on wall intersect + { 5160.339844f, 2798.610107f, 430.769012f, 3.141590f, 192488, 192416 }, // Flag on wall + { 5146.040039f, 2747.209961f, 433.584015f, 3.071770f, 192488, 192501 }, // Flag on tower + { 5163.779785f, 2729.679932f, 433.394012f, -1.58825f, 192488, 192501 }, // Flag on tower + { 5236.270020f, 2739.459961f, 444.992004f, -1.59698f, 192366, 192416 }, // Flag on wall intersect + { 5271.799805f, 2704.870117f, 445.183014f, -3.13286f, 192367, 192416 }, // Flag on wall intersect + { 5260.819824f, 2631.800049f, 433.324005f, 3.054330f, 192488, 192501 }, // Flag on tower + { 5278.379883f, 2613.830078f, 433.408997f, -1.58825f, 192488, 192501 }, // Flag on tower + { 5350.879883f, 2622.719971f, 444.686005f, -1.57080f, 192364, 192416 }, // Flag on wall intersect + { 5392.270020f, 2639.739990f, 435.330994f, 1.509710f, 192370, 192416 }, // Flag on wall intersect + { 5350.950195f, 2640.360107f, 435.407990f, 1.570800f, 192369, 192416 }, // Flag on wall intersect + { 5289.459961f, 2704.679932f, 435.875000f, -0.01745f, 192368, 192416 }, // Flag on wall intersect + { 5322.120117f, 2763.610107f, 444.973999f, -1.55334f, 192362, 192416 }, // Flag on wall intersect + { 5363.609863f, 2763.389893f, 445.023987f, -1.54462f, 192363, 192416 }, // Flag on wall intersect + { 5363.419922f, 2781.030029f, 435.763000f, 1.570800f, 192379, 192416 }, // Flag on wall intersect + { 5322.020020f, 2781.129883f, 435.811005f, 1.570800f, 192378, 192416 }, // Flag on wall intersect + { 5288.919922f, 2820.219971f, 435.721008f, 0.017452f, 192355, 192416 }, // Flag on wall intersect + { 5288.410156f, 2861.790039f, 435.721008f, 0.017452f, 192354, 192416 }, // Flag on wall intersect + { 5322.229980f, 2899.429932f, 435.808014f, -1.58825f, 192358, 192416 }, // Flag on wall intersect + { 5364.350098f, 2899.399902f, 435.838989f, -1.57080f, 192359, 192416 }, // Flag on wall intersect + { 5397.759766f, 2873.080078f, 455.460999f, 3.106650f, 192338, 192416 }, // Flag on keep + { 5397.390137f, 2809.330078f, 455.343994f, 3.106650f, 192339, 192416 }, // Flag on keep + { 5372.479980f, 2862.500000f, 409.049011f, 3.141590f, 192284, 192269 }, // Flag on floor + { 5371.490234f, 2820.800049f, 409.177002f, 3.141590f, 192285, 192269 }, // Flag on floor + { 5364.290039f, 2916.939941f, 445.330994f, 1.579520f, 192371, 192416 }, // Flag on wall intersect + { 5322.859863f, 2916.949951f, 445.153992f, 1.562070f, 192372, 192416 }, // Flag on wall intersect + { 5290.350098f, 2976.560059f, 435.221008f, 0.017452f, 192373, 192416 }, // Flag on wall intersect + { 5352.370117f, 3037.090088f, 435.252014f, -1.57080f, 192360, 192416 }, // Flag on wall intersect + { 5392.649902f, 3037.110107f, 433.713013f, -1.52716f, 192361, 192416 }, // Flag on wall intersect + { 5237.069824f, 2757.030029f, 435.795990f, 1.518440f, 192356, 192416 }, // Flag on wall intersect + { 5173.020020f, 2820.929932f, 435.720001f, 0.017452f, 192352, 192416 }, // Flag on wall intersect + { 5172.109863f, 2862.570068f, 435.721008f, 0.017452f, 192353, 192416 }, // Flag on wall intersect + { 5235.339844f, 2924.340088f, 435.040009f, -1.57080f, 192357, 192416 }, // Flag on wall intersect + { 5270.689941f, 2861.780029f, 445.058014f, -3.11539f, 192350, 192416 }, // Flag on wall intersect + { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect +}; + +// Keep turret +struct BfWGTurretPos +{ + float x; + float y; + float z; + float o; +}; + +#define WG_MAX_TURRET 15 +const BfWGTurretPos WGTurret[WG_MAX_TURRET] = { + { 5391.19f, 3060.8f, 419.616f, 1.69557f }, + { 5266.75f, 2976.5f, 421.067f, 3.20354f }, + { 5234.86f, 2948.8f, 420.88f, 1.61311f }, + { 5323.05f, 2923.7f, 421.645f, 1.5817f }, + { 5363.82f, 2923.87f, 421.709f, 1.60527f }, + { 5264.04f, 2861.34f, 421.587f, 3.21142f }, + { 5264.68f, 2819.78f, 421.656f, 3.15645f }, + { 5322.16f, 2756.69f, 421.646f, 4.69978f }, + { 5363.78f, 2756.77f, 421.629f, 4.78226f }, + { 5236.2f, 2732.68f, 421.649f, 4.72336f }, + { 5265.02f, 2704.63f, 421.7f, 3.12507f }, + { 5350.87f, 2616.03f, 421.243f, 4.72729f }, + { 5390.95f, 2615.5f, 421.126f, 4.6409f }, + { 5148.8f, 2820.24f, 421.621f, 3.16043f }, + { 5147.98f, 2861.93f, 421.63f, 3.18792f }, +}; + + +// Here there is all npc keeper spawn point +#define WG_MAX_KEEP_NPC 39 +const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = { + // X Y Z O horde alliance + // North East + { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Plumembrase + { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + // North + { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar + { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin + { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster + { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh + { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath + // X Y Z O horde alliance + // North West + { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof + { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort + { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + // South + { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp + // X Y Z O horde alliance + // Portal guards (from around the fortress) + { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard +}; + +#define WG_MAX_OUTSIDE_NPC 14 +#define WG_OUTSIDE_ALLIANCE_NPC 7 +const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = +{ + { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 }, + { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 }, + { 4994.85f, 3660.51f, 359.150f, 2.260f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 }, + { 5015.46f, 3677.11f, 362.970f, 6.009f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 }, + { 5031.12f, 3663.77f, 363.500f, 3.110f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 }, + { 5042.74f, 3675.82f, 363.060f, 3.358f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 }, + { 5014.45f, 3640.87f, 361.390f, 3.280f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 }, + { 5100.07f, 2168.89f, 365.779f, 1.972f, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, + { 5081.70f, 2173.73f, 365.878f, 0.855f, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, + { 5078.28f, 2183.70f, 365.029f, 1.466f, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, + { 5088.49f, 2188.18f, 365.647f, 5.253f, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, + { 5095.67f, 2193.28f, 365.924f, 4.939f, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, + { 5088.61f, 2167.66f, 365.689f, 0.680f, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, + { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, +}; + +struct BfWGWGTeleporterData +{ + uint32 entry; // gameobject entry + float x; + float y; + float z; + float o; +}; + +#define WG_MAX_TELEPORTER 12 +const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = +{ + // Player teleporter + { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f }, + { 190763, 5268.70f, 2666.42f, 409.099f, -0.715f }, + { 190763, 5197.05f, 2944.81f, 409.191f, 2.3387f }, + { 190763, 5196.67f, 2737.34f, 409.189f, -2.932f }, + { 190763, 5314.58f, 3055.85f, 408.862f, 0.5410f }, + { 190763, 5391.28f, 2828.09f, 418.675f, -2.164f }, + { 190763, 5153.93f, 2781.67f, 409.246f, 1.6580f }, + { 190763, 5311.44f, 2618.93f, 409.092f, -2.373f }, + { 190763, 5269.21f, 3013.84f, 408.828f, -1.762f }, + { 190763, 5401.62f, 2853.66f, 418.674f, 2.6354f }, + // Vehicle teleporter + { 192951, 5314.51f, 2703.69f, 408.550f, -0.890f }, + { 192951, 5316.25f, 2977.04f, 408.539f, -0.820f }, +}; + +// ********************************************************* +// **********Tower Element(GameObject,Creature)************* +// ********************************************************* + +struct BfWGTowerData +{ + uint32 towerentry; // Gameobject id of tower + uint8 nbObject; // Number of gameobjects spawned on this point + BfWGObjectPosition GameObject[6]; // Gameobject position and entry (Horde/Alliance) + + // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage? + uint8 nbCreatureBottom; + BfWGObjectPosition CreatureBottom[9]; + uint8 nbCreatureTop; + BfWGObjectPosition CreatureTop[5]; +}; + +#define WG_MAX_ATTACKTOWERS 3 +// 192414 : 0 in sql, 1 in header +// 192278 : 0 in sql, 3 in header +const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { + // West tower + { + 190356, + 6, + { + { 4559.109863f, 3606.219971f, 419.998993f, -1.483530f, 192488, 192501 }, // Flag on tower + { 4539.419922f, 3622.489990f, 420.033997f, -3.071770f, 192488, 192501 }, // Flag on tower + { 4555.259766f, 3641.649902f, 419.973999f, 1.675510f, 192488, 192501 }, // Flag on tower + { 4574.870117f, 3625.909912f, 420.079010f, 0.080117f, 192488, 192501 }, // Flag on tower + { 4433.899902f, 3534.139893f, 360.274994f, -1.850050f, 192269, 192278 }, // Flag near workshop + { 4572.930176f, 3475.520020f, 363.009003f, 1.42240f, 192269, 192278 } // Flag near bridge + }, + 1, + { + { 4418.688477f, 3506.251709f, 358.975494f, 4.293305f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + } + }, + + // South Tower + { + 190357, + 5, + { + { 4416.000000f, 2822.669922f, 429.851013f, -0.017452f, 192488, 192501 }, // Flag on tower + { 4398.819824f, 2804.699951f, 429.791992f, -1.588250f, 192488, 192501 }, // Flag on tower + { 4387.620117f, 2719.570068f, 389.934998f, -1.544620f, 192366, 192414 }, // Flag near tower + { 4464.120117f, 2855.449951f, 406.110992f, 0.829032f, 192366, 192429 }, // Flag near tower + { 4526.459961f, 2810.179932f, 391.200012f, -2.993220f, 192269, 192278 }, // Flag near bridge + { 0, 0, 0, 0, 0, 0 }, + }, + 6, + { + { 4452.859863f, 2808.870117f, 402.604004f, 6.056290f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4455.899902f, 2835.958008f, 401.122559f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4412.649414f, 2953.792236f, 374.799957f, 0.980838f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard + { 4362.089844f, 2811.510010f, 407.337006f, 3.193950f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4412.290039f, 2753.790039f, 401.015015f, 5.829400f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4421.939941f, 2773.189941f, 400.894989f, 5.707230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0}, + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + }, + + // East Tower + { + 190358, + 4, + { + { 4466.790039f, 1960.420044f, 459.144012f, 1.151920f, 192488, 192501 }, // Flag on tower + { 4475.350098f, 1937.030029f, 459.070007f, -0.43633f, 192488, 192501 }, // Flag on tower + { 4451.759766f, 1928.099976f, 459.075989f, -2.00713f, 192488, 192501 }, // Flag on tower + { 4442.990234f, 1951.900024f, 459.092987f, 2.740160f, 192488, 192501 }, // Flag on tower + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + 5, + { + { 4501.060059f, 1990.280029f, 431.157013f, 1.029740f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4463.830078f, 2015.180054f, 430.299988f, 1.431170f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4494.580078f, 1943.760010f, 435.627014f, 6.195920f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4450.149902f, 1897.579956f, 435.045013f, 4.398230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 4428.870117f, 1906.869995f, 432.648010f, 3.996800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + }, + }, +}; + +struct BfWGTurretData +{ + uint32 towerentry; + uint8 nbTurretBottom; + BfWGTurretPos TurretBottom[5]; + uint8 nbTurretTop; + BfWGTurretPos TurretTop[5]; +}; + +#define WG_MAX_TOWERTURRET 7 + +const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = +{ + { + 190221, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5255.88f, 3047.63f, 438.499f, 3.13677f }, + { 5280.9f, 3071.32f, 438.499f, 1.62879f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190373, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5138.59f, 2935.16f, 439.845f, 3.11723f }, + { 5163.06f, 2959.52f, 439.846f, 1.47258f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190377, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5163.84f, 2723.74f, 439.844f, 1.3994f }, + { 5139.69f, 2747.4f, 439.844f, 3.17221f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190378, + 0, + { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 5278.21f, 2607.23f, 439.755f, 4.71944f }, + { 5255.01f, 2631.98f, 439.755f, 3.15257f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190356, + 2, + { + {4537.380371f, 3599.531738f, 402.886993f, 3.998462f}, + {4581.497559f, 3604.087158f, 402.886963f, 5.651723f}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + }, + 2, + { + {4469.448242f, 1966.623779f, 465.647217f, 1.153573f}, + {4581.895996f, 3626.438477f, 426.539062f, 0.117806f}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + }, + }, + { + 190357, + 2, + { + { 4421.640137f, 2799.935791f, 412.630920f, 5.459298f }, + { 4420.263184f, 2845.340332f, 412.630951f, 0.742197f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 3, + { + { 4423.430664f, 2822.762939f, 436.283142f, 6.223487f }, + { 4397.825684f, 2847.629639f, 436.283325f, 1.579430f }, + { 4398.814941f, 2797.266357f, 436.283051f, 4.703747f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, + { + 190358, + 2, + { + { 4448.138184f, 1974.998779f, 441.995911f, 1.967238f }, + { 4448.713379f, 1955.148682f, 441.995178f, 0.380733f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + 2, + { + { 4469.448242f, 1966.623779f, 465.647217f, 1.153573f }, + { 4481.996582f, 1933.658325f, 465.647186f, 5.873029f }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + }, + }, +}; + +// ********************************************************* +// *****************WorkShop Data & Element***************** +// ********************************************************* + +struct BfWGWorkShopDataBase +{ + uint32 entry; + uint32 worldstate; + uint32 type; + uint32 nameid; + BfWGObjectPosition CapturePoint; + uint8 nbcreature; + BfWGObjectPosition CreatureData[10]; + uint8 nbgob; + BfWGObjectPosition GameObjectData[10]; +}; +// 6 engineer per faction in sql / 6 engineer per faction in header +#define WG_MAX_WORKSHOP 6 +const BfWGWorkShopDataBase WGWorkShopDataBase[WG_MAX_WORKSHOP] = { + { + 192031, + 3701, + BATTLEFIELD_WG_WORKSHOP_NE, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE, + { 4949.344238f, 2432.585693f, 320.176971f, 1.386214f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE }, + 1, + { + { 4939.759766f, 2389.060059f, 326.153015f, 3.263770f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 6, + { + { 4778.189f, 2438.060f, 345.644f, -2.940f, 192280, 192274 }, + { 5024.569f, 2532.750f, 344.023f, -1.937f, 192280, 192274 }, + { 4811.399f, 2441.899f, 358.207f, -2.003f, 192435, 192406 }, + { 4805.669f, 2407.479f, 358.191f, 1.780f, 192435, 192406 }, + { 5004.350f, 2486.360f, 358.449f, 2.172f, 192435, 192406 }, + { 4983.279f, 2503.090f, 358.177f, -0.427f, 192435, 192406 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192030, + 3700, + BATTLEFIELD_WG_WORKSHOP_NW, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW, + { 4948.524414f, 3342.337891f, 376.875366f, 4.400566f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW }, + 1, + { + { 4964.890137f, 3383.060059f, 382.911011f, 6.126110f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 4, + { + { 5006.339f, 3280.399f, 371.162f, 2.225f, 192280, 192274 }, + { 5041.609f, 3294.399f, 382.149f, -1.631f, 192434, 192406 }, + { 4857.970f, 3335.439f, 368.881f, -2.945f, 192280, 192274 }, + { 4855.629f, 3297.620f, 376.739f, -3.132f, 192435, 192406 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192033, + 3703, + BATTLEFIELD_WG_WORKSHOP_SE, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE, + { 4398.076660f, 2356.503662f, 376.190491f, 0.525406f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE }, + 9, + { + { 4417.919922f, 2331.239990f, 370.919006f, 5.846850f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4418.609863f, 2355.290039f, 372.490997f, 6.021390f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4391.669922f, 2300.610107f, 374.743011f, 4.921830f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4349.120117f, 2299.280029f, 374.743011f, 4.904380f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4333.549805f, 2333.909912f, 376.156006f, 0.973007f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4413.430176f, 2393.449951f, 376.359985f, 1.064650f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4388.129883f, 2411.979980f, 374.743011f, 1.640610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4349.540039f, 2411.260010f, 374.743011f, 2.059490f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4357.669922f, 2357.989990f, 382.006989f, 1.675520f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 } + }, + 2, + { + { 4417.250f, 2301.139f, 377.213f, 0.026f, 192435, 192406 }, + { 4417.939f, 2324.810f, 371.576f, 3.080f, 192280, 192274 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192032, + 3702, + BATTLEFIELD_WG_WORKSHOP_SW, + BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW, + { 4390.776367f, 3304.094482f, 372.429077f, 6.097023f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW }, + 9, + { + { 4425.290039f, 3291.510010f, 370.773987f, 0.122173f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4424.609863f, 3321.100098f, 369.800995f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4392.399902f, 3354.610107f, 369.597992f, 1.570800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4370.979980f, 3355.020020f, 371.196991f, 1.675520f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4394.660156f, 3231.989990f, 369.721985f, 4.625120f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4366.979980f, 3233.560059f, 371.584991f, 4.939280f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4337.029785f, 3261.659912f, 373.524994f, 3.263770f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4323.779785f, 3287.100098f, 378.894989f, 2.862340f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, + { 4354.149902f, 3312.820068f, 378.045990f, 1.675520f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 } + }, + 3, + { + { 4438.299f, 3361.080f, 371.567f, -0.017f, 192435, 192406 }, + { 4448.169f, 3235.629f, 370.411f, -1.562f, 192435, 192406 }, + { 4424.149f, 3286.540f, 371.545f, 3.124f, 192280, 192274 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192028, + 3698, + BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, + 0, + { 0, 0, 0, 0, 0, 0 }, + 1, + { + { 5392.910156f, 2975.260010f, 415.222992f, 4.555310f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + }, + { + 192029, + 3699, + BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, + 0, + { 0, 0, 0, 0, 0, 0 }, + 1, + { + { 5391.609863f, 2707.719971f, 415.050995f, 4.555310f, 30400, 30499 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }, + 0, + { + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + } + } +}; + +// ******************************************************************** +// * Structs using for Building,Graveyard,Workshop * +// ******************************************************************** +// Structure for different buildings that can be destroyed during battle +struct BfWGGameObjectBuilding +{ + BfWGGameObjectBuilding(BattlefieldWG *WG) + { + m_WG = WG; + m_Team = 0; + m_Build = NULL; + m_Type = 0; + m_WorldState = 0; + m_State = 0; + m_NameId = 0; + } + + // the team that controls this point + uint8 m_Team; + + // WG object + BattlefieldWG *m_WG; + + // Linked gameobject + GameObject *m_Build; + + // eWGGameObjectBuildingType + uint32 m_Type; + + // WorldState + uint32 m_WorldState; + + // eWGGameObjectState + uint32 m_State; + + // Name id for warning text + uint32 m_NameId; + + // GameObject associations + GameObjectSet m_GameObjectList[2]; + + // Creature associations + GuidSet m_CreatureBottomList[2]; + GuidSet m_CreatureTopList[2]; + GuidSet m_TurretBottomList; + GuidSet m_TurretTopList; + + void Rebuild() + { + switch (m_Type) + { + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR: + case BATTLEFIELD_WG_OBJECTTYPE_WALL: + m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's + break; + case BATTLEFIELD_WG_OBJECTTYPE_TOWER: + m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's + break; + default: + m_Team = TEAM_NEUTRAL; + break; + } + + // Rebuild gameobject + m_Build->Rebuild(); + + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + UpdateCreatureAndGo(); + m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]); + } + + // Called when associated gameobject is damaged + void Damaged() + { + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Send warning message + if (m_NameId) // tower damage + name + m_WG->SendWarningToAllInZone(m_NameId); + + for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER) + m_WG->AddDamagedTower(m_WG->GetDefenderTeam()); + else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER) + m_WG->AddDamagedTower(m_WG->GetAttackerTeam()); + } + + // Called when associated gameobject is destroyed + void Destroyed() + { + // Update worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY - (m_Team * 3); + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Warn players + if (m_NameId) + m_WG->SendWarningToAllInZone(m_NameId); + + switch (m_Type) + { + // Inform the global wintergrasp script of the destruction of this object + case BATTLEFIELD_WG_OBJECTTYPE_TOWER: + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + m_WG->AddBrokenTower(TeamId(m_Team)); + break; + case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + m_WG->AllowToClickOnOrb(true); + if (m_WG->GetRelic()) + m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + else + sLog->outError("BATTLEFIELD: WG: Relic cant be clickable"); + break; + } + + m_WG->BrokenWallOrTower(TeamId(m_Team)); + } + + void Init(GameObject *go, uint32 type, uint32 worldstate, uint32 nameid) + { + // GameObject associated to object + m_Build = go; + + // Type of building (WALL/TOWER/DOOR) + m_Type = type; + + // WorldState for client (icon on map) + m_WorldState = worldstate; + + // NameId for Warning text + m_NameId = nameid; + + switch (m_Type) + { + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + case BATTLEFIELD_WG_OBJECTTYPE_DOOR: + case BATTLEFIELD_WG_OBJECTTYPE_WALL: + m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's + break; + case BATTLEFIELD_WG_OBJECTTYPE_TOWER: + m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's + break; + default: + m_Team = TEAM_NEUTRAL; + break; + } + + m_State = sWorld->getWorldState(m_WorldState); + if (m_Build) + { + switch (m_State) + { + case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT: + case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT: + m_Build->Rebuild(); + break; + case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY: + case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY: + m_Build->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); + m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED); + m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.destroyedDisplayId); + break; + case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE: + case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE: + m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); + m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.damagedDisplayId); + break; + } + } + + int32 towerid = -1; + switch (go->GetEntry()) + { + case 190221: + towerid = 0; + break; + case 190373: + towerid = 1; + break; + case 190377: + towerid = 2; + break; + case 190378: + towerid = 3; + break; + case 190356: + towerid = 4; + break; + case 190357: + towerid = 5; + break; + case 190358: + towerid = 6; + break; + } + + if (towerid > 3) + { + // Spawn associate gameobjects + for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++) + { + BfWGObjectPosition gob = AttackTowers[towerid - 4].GameObject[i]; + if (GameObject *go = m_WG->SpawnGameObject(gob.entryh, gob.x, gob.y, gob.z, gob.o)) + m_GameObjectList[TEAM_HORDE].insert(go); + if (GameObject *go = m_WG->SpawnGameObject(gob.entrya, gob.x, gob.y, gob.z, gob.o)) + m_GameObjectList[TEAM_ALLIANCE].insert(go); + } + + // Spawn associate npc bottom + for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++) + { + BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureBottom[i]; + if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID()); + if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID()); + } + + // Spawn associate npc top + for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++) + { + BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureTop[i]; + if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID()); + if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID()); + } + } + + if (towerid >= 0) + { + // Spawn Turret bottom + for (uint8 i = 0; i < TowerTurret[towerid].nbTurretBottom; i++) + { + BfWGTurretPos turretpos = TowerTurret[towerid].TurretBottom[i]; + if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + { + m_TurretBottomList.insert(turret->GetGUID()); + switch (go->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(turret); + } + } + + // Spawn Turret top + for (uint8 i = 0; i < TowerTurret[towerid].nbTurretTop; i++) + { + BfWGTurretPos turretpos = TowerTurret[towerid].TurretTop[i]; + if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + { + m_TurretTopList.insert(turret->GetGUID()); + switch (go->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(turret); + } + } + UpdateCreatureAndGo(); + } + } + + void UpdateCreatureAndGo() + { + for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, true); + + for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, true); + + for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + } + + void UpdateTurretAttack(bool disable) + { + for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr) + { + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature *creature = unit->ToCreature()) + { + if (m_Build) + { + if (disable) + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(creature); + } + else + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->ShowNpc(creature, true); + } + } + } + } + } + + for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) + { + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + { + if (Creature *creature = unit->ToCreature()) + { + if (m_Build) + { + if (disable) + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->HideNpc(creature); + } + else + { + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } + } + m_WG->ShowNpc(creature, true); + } + } + } + } + } + } + + void Save() + { + sWorld->setWorldState(m_WorldState, m_State); + } +}; + +// Structure for the 6 workshop +struct BfWGWorkShopData +{ + BattlefieldWG* m_WG; // Object du joug + GameObject* m_Build; + uint32 m_Type; + uint32 m_State; // For worldstate + uint32 m_WorldState; + uint32 m_TeamControl; // Team witch control the workshop + GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point + GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point + uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message + + BfWGWorkShopData(BattlefieldWG * WG) + { + m_WG = WG; + m_Build = NULL; + m_Type = 0; + m_State = 0; + m_WorldState = 0; + m_TeamControl = 0; + m_NameId = 0; + } + + // Spawning associate creature and store them + void AddCreature(BfWGObjectPosition obj) + { + if (Creature *creature = m_WG->SpawnCreature(obj.entryh, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE)) + m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID()); + + if (Creature *creature = m_WG->SpawnCreature(obj.entrya, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE)) + m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID()); + + } + + // Spawning Associate gameobject and store them + void AddGameObject(BfWGObjectPosition obj) + { + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryh, obj.x, obj.y, obj.z, obj.o)) + m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject); + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entrya, obj.x, obj.y, obj.z, obj.o)) + m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject); + } + + // Init method, setup variable + void Init(uint32 worldstate, uint32 type, uint32 nameid) + { + m_WorldState = worldstate; + m_Type = type; + m_NameId = nameid; + } + + // Called on change faction in CapturePoint class + void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + { + switch (team) + { + case BATTLEFIELD_WG_TEAM_NEUTRAL: + { + // Send warning message to all player for inform a faction attack a workshop + // alliance / horde attacking workshop + m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); + break; + } + case BATTLEFIELD_WG_TEAM_ALLIANCE: + { + // Show Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30499); + + // Hide Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + // Show Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + // Hide Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + + // Updating worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Warning message + if (!init) // workshop taken - alliance + m_WG->SendWarningToAllInZone(m_NameId); + + // Found associate graveyard and update it + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveYardById(m_Type)) + m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_ALLIANCE); + + m_TeamControl = team; + break; + } + case BATTLEFIELD_WG_TEAM_HORDE: + { + // Show Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30400); + + // Hide Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Creature *creature = unit->ToCreature()) + m_WG->HideNpc(creature); + + // Hide Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + + // Show Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + + // Update worlstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); + + // Warning message + if (!init) // workshop taken - horde + m_WG->SendWarningToAllInZone(m_NameId + 1); + + // Update graveyard control + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveYardById(m_Type)) + m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_HORDE); + + m_TeamControl = team; + break; + } + } + if (!init) + m_WG->UpdateCounterVehicle(false); + } + + void UpdateGraveYardAndWorkshop() + { + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + m_WG->GetGraveYardById(m_Type)->ChangeControl(TeamId(m_TeamControl)); + else + ChangeControl(m_WG->GetDefenderTeam(), true); + } + + void Save() + { + sWorld->setWorldState(m_WorldState, m_State); + } +}; + +#endif From 4ac5301c9faa0e1260ee86aec86c4f19f5966b01 Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 13:34:04 +0300 Subject: [PATCH 080/147] Core/Battlefield: removed "magic numbers" --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 25 ++++++------------- .../game/Battlefield/Zones/BattlefieldWG.h | 10 +++++--- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 977048361b..2cfc262371 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -482,10 +482,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) player->RewardHonor(NULL, 1, WinHonor); RewardMarkOfHonor(player, 2); } - if (player->GetTeamId() == TEAM_HORDE) - IncrementQuest(player, 13183, true); - else - IncrementQuest(player, 13181, true); + IncrementQuest(player, WGQuest[killer->GetTeamId()][1], true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less @@ -939,12 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) { if (Player* player = sObjectMgr->GetPlayer((*p_itr))) - { - if (player->GetTeamId() == TEAM_ALLIANCE) - IncrementQuest(player, 13222); - else - IncrementQuest(player, 13223); - } + IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); } } } @@ -968,10 +960,7 @@ void BattlefieldWG::AddBrokenTower(TeamId team) if (Player* player = sObjectMgr->GetPlayer((*itr))) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); - if (player->GetTeamId() == TEAM_HORDE) - IncrementQuest(player, 13539, true); - else - IncrementQuest(player, 13538, true); + IncrementQuest(player, WGQuest[killer->GetTeamId()][3], true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } // If the threw south tower is destroy @@ -1043,10 +1032,10 @@ void BattlefieldWG::AddDamagedTower(TeamId team) // Update vehicle count WorldState to player void BattlefieldWG::UpdateVehicleCountWG() { - SendUpdateWorldState(3490, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); - SendUpdateWorldState(3491, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); - SendUpdateWorldState(3680, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); - SendUpdateWorldState(3681, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); } void BattlefieldWG::UpdateTenacity() diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index ffde7cb060..1e3d7a93d9 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -134,9 +134,13 @@ enum WB_ACHIEVEMENTS enum eWGWorldStates { - BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, - BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, - BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, + BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490, + BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491, + BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A = 3680, + BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A = 3681, + BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, + BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, + BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, }; /*######################### *####### Graveyards ######* From d45b66ce22b5fcb3b3ee31770510d3b309c071b9 Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 13:44:53 +0300 Subject: [PATCH 081/147] Core/Battlefield: missed changes --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 2cfc262371..17e28add39 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -898,10 +898,10 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() for (uint32 i = 0; i < 2; ++i) data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); - data << uint32(3490) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); - data << uint32(3491) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); - data << uint32(3680) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); - data << uint32(3681) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { @@ -936,7 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) { if (Player* player = sObjectMgr->GetPlayer((*p_itr))) - IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); + IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); } } } From c736dc3e34a695e9f141bb69d2d819e64d9db42b Mon Sep 17 00:00:00 2001 From: Imprtat Date: Tue, 28 Jun 2011 17:25:42 +0300 Subject: [PATCH 082/147] Core/Battlefield: fix copy/paste typo in prev commits --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 17e28add39..0c44ea766a 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -482,7 +482,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) player->RewardHonor(NULL, 1, WinHonor); RewardMarkOfHonor(player, 2); } - IncrementQuest(player, WGQuest[killer->GetTeamId()][1], true); + IncrementQuest(player, WGQuest[player->GetTeamId()][1], true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less @@ -712,7 +712,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) if (player->GetDistance2d(killer) < 40) - IncrementQuest(player, IncrementQuest(killer, WGQuest[killer->GetTeamId()][0])); + IncrementQuest(player, WGQuest[player->GetTeamId()][0]); } } } @@ -936,7 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) { if (Player* player = sObjectMgr->GetPlayer((*p_itr))) - IncrementQuest(player, WGQuest[killer->GetTeamId()][2], true); + IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } } } @@ -960,7 +960,7 @@ void BattlefieldWG::AddBrokenTower(TeamId team) if (Player* player = sObjectMgr->GetPlayer((*itr))) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); - IncrementQuest(player, WGQuest[killer->GetTeamId()][3], true); + IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } // If the threw south tower is destroy From 1e8814c8fa2bef69685cfe41634a39c583c35599 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 28 Jun 2011 21:41:42 +0100 Subject: [PATCH 083/147] Moved SQL and TXT files to Wintergrasp_temp; Clean-up and split up SQL files; Fixed SQL import errors; Add template updates for most creatures and GOs --- Wintergrasp_temp/Gossips.sql | 88 +++++ Wintergrasp_temp/Misc.sql | 69 ++++ Wintergrasp_temp/Quests.sql | 14 + Wintergrasp_temp/SAI.sql | 6 + Wintergrasp_temp/Scriptnames.sql | 14 + Wintergrasp_temp/Spawns.sql | 458 +++++++++++++++++++++++++++ Wintergrasp_temp/Spells.txt | 23 ++ Wintergrasp_temp/Strings.sql | 107 +++++++ Wintergrasp_temp/TODO.txt | 16 + Wintergrasp_temp/Template_update.sql | 87 +++++ 10 files changed, 882 insertions(+) create mode 100644 Wintergrasp_temp/Gossips.sql create mode 100644 Wintergrasp_temp/Misc.sql create mode 100644 Wintergrasp_temp/Quests.sql create mode 100644 Wintergrasp_temp/SAI.sql create mode 100644 Wintergrasp_temp/Scriptnames.sql create mode 100644 Wintergrasp_temp/Spawns.sql create mode 100644 Wintergrasp_temp/Spells.txt create mode 100644 Wintergrasp_temp/Strings.sql create mode 100644 Wintergrasp_temp/TODO.txt create mode 100644 Wintergrasp_temp/Template_update.sql diff --git a/Wintergrasp_temp/Gossips.sql b/Wintergrasp_temp/Gossips.sql new file mode 100644 index 0000000000..90f903b771 --- /dev/null +++ b/Wintergrasp_temp/Gossips.sql @@ -0,0 +1,88 @@ +-- Gossip Menu insert from sniff +DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9904,13759); +DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9904,13761); +DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9923,14172); +DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (10229,14221); + +-- Creature Gossip_menu_option Update from sniff +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9904); +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 +(9904,0,0, 'I would like to build a catapult.',1,1,0,0,0,0, ''), +(9904,1,0, 'I would like to build a demolisher.',1,1,0,0,0,0, ''), +(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''); +-- Add gossip_menu condition for 9904 Horde +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9904; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES +(14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal +(14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant +(14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal +(14,9904,13761,0,11,55629); -- Must not have Rank 2: First Lieutenant +-- Add gossip_menu condition for 9923 Alliance +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9923; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES +(14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal +(14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant +(14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal +(14,9923,14172,0,11,55629); -- Must not have Rank 2: First Lieutenant +-- Add conditions to gossip options horde +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9904; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES +(15,9904,0,0,1,33280,0), -- Must have reached Rank 1: Corporal +(15,9904,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant +(15,9904,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant +(15,9904,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant +-- Add conditions to gossip options alliance +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9923; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES +(15,9923,0,0,1,33280,0), -- Must have reached Rank 1: Corporal +(15,9923,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant +(15,9923,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant +(15,9923,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant + +-- Add Missing Horde Spirt Healer options Wintergrasp +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); +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 +(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), +(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); + +/* -- Add scripts to Wintergrasp spirit guide gossip +-- !!!should be scripted by SAI or cpp script!!! +UPDATE `gossip_menu_option` SET `action_script_id`=1012800 WHERE `menu_id` IN (10128,10129) AND `id`=0; +UPDATE `gossip_menu_option` SET `action_script_id`=1012801 WHERE `menu_id` IN (10128,10129) AND `id`=1; +UPDATE `gossip_menu_option` SET `action_script_id`=1012802 WHERE `menu_id` IN (10128,10129) AND `id`=2; +UPDATE `gossip_menu_option` SET `action_script_id`=1012803 WHERE `menu_id` IN (10128,10129) AND `id`=3; +UPDATE `gossip_menu_option` SET `action_script_id`=1012804 WHERE `menu_id` IN (10128,10129) AND `id`=4; +UPDATE `gossip_menu_option` SET `action_script_id`=1012805 WHERE `menu_id`=10128 AND `id`=5; +UPDATE `gossip_menu_option` SET `action_script_id`=1012806 WHERE `menu_id`=10129 AND `id`=5; + +-- Add Teleport graveyard Spells to gossip scripts +DELETE FROM `gossip_scripts` WHERE `id` IN (1012800,1012801,1012802,1012803,1012804,1012805,1012806); +INSERT INTO `gossip_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`) VALUES +(1012800,0,33,0,0),(1012800,0,15,59760,1), +(1012801,0,33,0,0),(1012801,0,15,59762,1), +(1012802,0,33,0,0),(1012802,0,15,59763,1), +(1012803,0,33,0,0),(1012803,0,15,59766,1), +(1012804,0,33,0,0),(1012804,0,15,59767,1), +(1012805,0,33,0,0),(1012805,0,15,59769,1), +(1012806,0,33,0,0),(1012806,0,15,59765,1); + +-- Add scripts to Wintergrasp engineers +-- already done by engineer's script +UPDATE `gossip_menu_option` SET `action_script_id`=990400 WHERE `menu_id` IN (9904,9923) AND `id`=0; +UPDATE `gossip_menu_option` SET `action_script_id`=990401 WHERE `menu_id` IN (9904,9923) AND `id`=1; +UPDATE `gossip_menu_option` SET `action_script_id`=990402 WHERE `menu_id` IN (9904) AND `id`=2; +UPDATE `gossip_menu_option` SET `action_script_id`=990403 WHERE `menu_id` IN (9923) AND `id`=2; + +-- Add create vehicle Spells to gossip scripts +DELETE FROM `gossip_scripts` WHERE `id` IN (990400,990401,990402); +INSERT INTO `gossip_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`) VALUES +(990400,0,33,0,0),(990400,0,15,56663,1), +(990401,0,33,0,0),(990401,0,15,56575,1), +(990402,0,33,0,0),(990402,0,15,61408,1), +(990403,0,33,0,0),(990403,0,15,56661,1); +*/ + diff --git a/Wintergrasp_temp/Misc.sql b/Wintergrasp_temp/Misc.sql new file mode 100644 index 0000000000..42817764fe --- /dev/null +++ b/Wintergrasp_temp/Misc.sql @@ -0,0 +1,69 @@ +-- 54640 Teleport (Teleports defenders behind the walls on the Isle of Ulduran, Strand of the Ancients) - FIX THIS? +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54640; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(54640,54643,0, 'WG teleporter'); + +-- 58730 Restricted Flight Area (Wintergrasp Eject) +DELETE FROM `spell_area` WHERE `spell`=58730; +INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES +(58730,4581,0,0,0,0,0,2,1), +(58730,4539,0,0,0,0,0,2,1), +(58730,4197,0,0,0,0,0,2,1), +(58730,4585,0,0,0,0,0,2,1), +(58730,4612,0,0,0,0,0,2,1), +(58730,4582,0,0,0,0,0,2,1), +(58730,4583,0,0,0,0,0,2,1), +(58730,4589,0,0,0,0,0,2,1), +(58730,4575,0,0,0,0,0,2,1), +(58730,4538,0,0,0,0,0,2,1), +(58730,4577,0,0,0,0,0,2,1); + +-- 57940 Essence of Wintergrasp +DELETE FROM `spell_area` WHERE `spell`=57940; +INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES +(57940,65,0,0,0,0,0,2,1), +(57940,66,0,0,0,0,0,2,1), +(57940,67,0,0,0,0,0,2,1), +(57940,206,0,0,0,0,0,2,1), +(57940,210,0,0,0,0,0,2,1), +(57940,394,0,0,0,0,0,2,1), +(57940,395,0,0,0,0,0,2,1), +(57940,1196,0,0,0,0,0,2,1), +(57940,2817,0,0,0,0,0,2,1), +(57940,3456,0,0,0,0,0,2,1), +(57940,3477,0,0,0,0,0,2,1), +(57940,3537,0,0,0,0,0,2,1), +(57940,3711,0,0,0,0,0,2,1), +(57940,4100,0,0,0,0,0,2,1), +(57940,4196,0,0,0,0,0,2,1), +(57940,4228,0,0,0,0,0,2,1), +(57940,4264,0,0,0,0,0,2,1), +(57940,4265,0,0,0,0,0,2,1), +(57940,4272,0,0,0,0,0,2,1), +(57940,4273,0,0,0,0,0,2,1), +(57940,4395,0,0,0,0,0,2,1), +(57940,4415,0,0,0,0,0,2,1), +(57940,4416,0,0,0,0,0,2,1), +(57940,4493,0,0,0,0,0,2,1), +(57940,4494,0,0,0,0,0,2,1), +(57940,4603,0,0,0,0,0,2,1); + +-- 49899 Activate Robotic Arms +DELETE FROM `spell_scripts` WHERE `id`=49899; +INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES +(49899,0,1,406,0,0,0,0,0,0); + +-- Add Spell Target position for Wintergrasp Graveyard spells +DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769); +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(59760,571,5537.986,2897.493,517.057,4.819249), -- Teleport: Fortress Graveyard +(59762,571,5104.750,2300.940,368.579,0.733038), -- Teleport: Sunken Ring "area 4538" +(59763,571,5099.120,3466.036,368.484,5.317802), -- Teleport: Broken Temple "area 4539 & 4589" +(59765,571,5032.454,3711.382,372.468,3.971623), -- Teleport: Horde Landing Zone +(59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611" +(59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612" +(59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone + + + + diff --git a/Wintergrasp_temp/Quests.sql b/Wintergrasp_temp/Quests.sql new file mode 100644 index 0000000000..277f9ebb03 --- /dev/null +++ b/Wintergrasp_temp/Quests.sql @@ -0,0 +1,14 @@ +-- Wintergrasp Quests - Horde +UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180, 13178); +UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185, 13223); +UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192, 13202); +UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193, 13199); +UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200, 13191); +UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201, 13194); + +-- Wintergrasp Quests - Alliance +UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179, 13177); +UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186, 13222); +UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195, 13156); +UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196, 13154); +UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198, 13153); \ No newline at end of file diff --git a/Wintergrasp_temp/SAI.sql b/Wintergrasp_temp/SAI.sql new file mode 100644 index 0000000000..098565ce01 --- /dev/null +++ b/Wintergrasp_temp/SAI.sql @@ -0,0 +1,6 @@ +-- Spirit healers SAI +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (31841,31842); +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (31841,31842); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(31841,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'cast Spirit Heal Channel every 30 sec'), +(31842,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Dwarven Spirit Guide - cast Spirit Heal Channel every 30 sec'); diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql new file mode 100644 index 0000000000..f8eb806fc6 --- /dev/null +++ b/Wintergrasp_temp/Scriptnames.sql @@ -0,0 +1,14 @@ +-- Wintergrasp queue template NPCs +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_dalaran_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); + +-- Wintergrasp spiritguide NPC script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_spiritguide' WHERE `entry` IN (31841,31842); + +-- Wintergrasp demolisher engineer NPC script +UPDATE `creature_template` SET `ScriptName`= 'npc_demolisher_engineerer' WHERE `entry` IN (30400,30499); + +-- Wintergrasp vehicle teleport +UPDATE `gameobject_template` SET `ScriptName`= 'go_wintergrasp_teleporter' WHERE `entry`=192951; + +-- Wintergrasp Questgiver NPCs - requires binding to Wintergrasp questgiver script +UPDATE `creature_template` SET `ScriptName`= 'npc_wintergrasp_quest_giver' WHERE `entry` IN (31054, 31052, 31091, 31036, 31101, 31107, 31053, 31051, 31153, 31151, 31102, 31106); diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/Spawns.sql new file mode 100644 index 0000000000..90840ba400 --- /dev/null +++ b/Wintergrasp_temp/Spawns.sql @@ -0,0 +1,458 @@ +-- Replace Wintergrasp spawns with properly phased spawns +SET @GUID := 290000; +DELETE FROM `creature` WHERE `id` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,39172,30870,31053,31091,31101,31102,31106,31107,31151,32294,39173,32296,30488); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES +-- Taunka Spirit Guide (Horde) +(@GUID+0,31841,571,1,0x00000010,0,0,4318.436,2408.06738,392.675751,6.23082542,120,0,0,1,0,0), -- Eastspark Workshop +(@GUID+1,31841,571,1,0x00000010,0,0,4336.25439,3235.51978,390.334,0.628318548,120,0,0,1,0,0), -- Westspark Workshop +(@GUID+2,31841,571,1,0x00000010,0,0,5104.753,2300.9458,368.568054,0.7330383,120,0,0,1,0,0), -- The Sunken Ring +(@GUID+3,31841,571,1,0x00000010,0,0,5103.133,3462.128,368.568054,5.270895,120,0,0,1,0,0), -- The Chilled Quagmire "Outside broker Temple" +(@GUID+4,31841,571,1,0x00000040,0,0,5537.482,2898.90674,517.2589,4.86946869,120,0,0,1,0,0), -- Fortress +(@GUID+5,31841,571,1,0x00000001,0,0,5031.84131,3710.74878,372.4835,0,120,5,0,1,0,0), -- Horde Landing Zone +-- Dwarven Spirit Guide (Alliance) +(@GUID+6,31842,571,1,0x00000020,0,0,4318.436,2408.06738,392.675751,6.23082542,120,0,0,1,0,0), -- Eastspark Workshop +(@GUID+7,31842,571,1,0x00000020,0,0,4336.25439,3235.51978,390.334,0.628318548,120,0,0,1,0,0), -- Westspark Workshop +(@GUID+8,31842,571,1,0x00000020,0,0,5104.753,2300.9458,368.568054,0.7330383,120,0,0,1,0,0), -- The Sunken Ring +(@GUID+9,31842,571,1,0x00000020,0,0,5103.133,3462.128,368.568054,5.270895,120,0,0,1,0,0), -- The Chilled Quagmire "Outside The Broken Temple" +(@GUID+10,31842,571,1,0x00000080,0,0,5537.482,2898.90674,517.2589,4.86946869,120,0,0,1,0,0), -- Fortress +(@GUID+11,31842,571,1,0x00000001,0,0,5140.7876,2179.12451,390.9512,1.97222209,120,0,0,1,0,0), -- Aliance Landing Zone +-- Goblin Mechanic (Horde) +(@GUID+12,30400,571,1,0x00000010,0,0,4964.89,3383.06,382.911,6.12611,180,0,0,1,0,0), -- The Broken Temple +(@GUID+13,30400,571,1,0x00000010,0,0,4939.76,2389.06,326.153,3.26377,180,0,0,1,0,0), -- The Sunken Ring +(@GUID+14,30400,571,1,0x00000010,0,0,4357.67,2357.99,382.007,1.67552,180,0,0,1,0,0), -- Eastspark Workshop +(@GUID+15,30400,571,1,0x00000010,0,0,4354.15,3312.82,378.046,1.67552,180,0,0,1,0,0), -- Westspark Workshop +(@GUID+16,30400,571,1,0x00000040,0,0,5391.61,2707.72,415.051,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress +(@GUID+17,30400,571,1,0x00000040,0,0,5392.91,2975.26,415.223,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress +-- Gnomish Engineer (Alliance) +(@GUID+18,30499,571,1,0x00000020,0,0,4964.89,3383.06,382.911,6.12611,180,0,0,1,0,0), -- The Broken Temple +(@GUID+19,30499,571,1,0x00000020,0,0,4939.76,2389.06,326.153,3.26377,180,0,0,1,0,0), -- The Sunken Ring +(@GUID+20,30499,571,1,0x00000020,0,0,4357.67,2357.99,382.007,1.67552,180,0,0,1,0,0), -- Eastspark Workshop +(@GUID+21,30499,571,1,0x00000020,0,0,4354.15,3312.82,378.046,1.67552,180,0,0,1,0,0), -- Westspark Workshop +(@GUID+22,30499,571,1,0x00000080,0,0,5391.61,2707.72,415.051,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress +(@GUID+23,30499,571,1,0x00000080,0,0,5392.91,2975.26,415.223,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress +-- Alliance NPC's +(@GUID+24,30489,571,1,0x00000080,0,0,5369.973,2874.83081,409.3225,3.12413931,120,0,0,1,0,0), -- Morgan Day +(@GUID+25,30869,571,1,0x00000001,0,0,5102.75049,2187.82837,365.707855,3.996804,120,0,0,1,0,0), -- Arzo Safeflight +(@GUID+26,31036,571,1,0x00000040,0,0,5078.281,2183.704,365.028564,1.46607661,120,0,0,1,0,0), -- Commander Zanneth +(@GUID+27,31036,571,1,0x00000080,0,0,5358.641,2841.76416,409.3225,1.13262534,120,0,0,1,0,0), +(@GUID+28,31051,571,1,0x00000040,0,0,5081.697,2173.73,365.8777,0.8552113,120,0,0,1,0,0), -- Sorceress Kaylana +(@GUID+29,31051,571,1,0x00000080,0,0,5296.869,2887.67114,409.274658,5.60250664,120,0,0,1,0,0), +(@GUID+30,31052,571,1,0x00000040,0,0,5100.06543,2168.89,365.7788,1.97222209,120,0,0,1,0,0), -- Bowyer Randolph +(@GUID+31,31052,571,1,0x00000080,0,0,5302.57373,2750.40332,409.274658,5.46288061,120,0,0,1,0,0), +(@GUID+32,31054,571,1,0x00000040,0,0,5088.611,2167.66235,365.688751,0.6806784,120,0,0,1,0,0), -- Anchorite Tessa +(@GUID+33,31054,571,1,0x00000080,0,0,5372.05859,3028.33618,409.206024,0.012565271,120,0,0,1,0,0), +(@GUID+34,31108,571,1,0x00000040,0,0,5095.673,2193.284,365.9236,4.939282,120,0,0,1,0,0), -- Siege Master Stouthandle +(@GUID+35,31108,571,1,0x00000080,0,0,5298.267,2924.97632,409.274658,0.9075712,120,0,0,1,0,0), +(@GUID+36,31109,571,1,0x00000040,0,0,5080.403,2199.00244,359.4894,2.96705961,120,0,0,1,0,0), -- Senior Demolitionist Legoso +(@GUID+37,31109,571,1,0x00000080,0,0,5228.2915,2809.888,409.274658,3.19395256,120,0,0,1,0,0), +(@GUID+38,31153,571,1,0x00000040,0,0,5088.48633,2188.17871,365.646973,5.253441,120,0,0,1,0,0), -- Tactical Officer Ahbramis +(@GUID+39,31153,571,1,0x00000080,0,0,5364.784,2835.135,409.3225,3.12413931,120,0,0,1,0,0), +(@GUID+40,32294,571,1,0x00000080,0,0,5374.568,2790.784,409.3225,2.72271371,120,0,0,1,0,0), -- Knight Dameron +(@GUID+41,39172,571,1,0x00000080,0,0,5372.672,2786.74048,409.4423,2.80998015,120,0,0,1,0,0), -- Marshal Magruder +(@GUID+42,30488,571,1,0x00000080,0,0,5370.428,2814.274,409.3225,3.054326,120,0,0,1,0,0), -- Travis Day +-- Horde NPC's +(@GUID+43,30870,571,1,0x00000001,0,0,5023.4043,3686.03345,363.1192,5.131268,120,0,0,1,0,0), -- Herzo Safeflight +(@GUID+44,31053,571,1,0x00000040,0,0,5379.875,3027.43359,409.206024,0,120,0,0,1,0,0), -- Primalist Mulfort +(@GUID+45,31053,571,1,0x00000080,0,0,5034.703125,3666.703125,363.273865,4.310963,120,0,0,1,0,0), +(@GUID+46,31091,571,1,0x00000040,0,0,5347.7915,2837.38574,409.3466,2.62603331,120,0,0,1,0,0), -- Commander Dardosh +(@GUID+47,31091,571,1,0x00000080,0,0,5018.662109,3672.279541,362.862885,2.209141,120,0,0,1,0,0), +(@GUID+48,31101,571,1,0x00000040,0,0,5296.564,2789.87378,409.274658,0.7330383,120,0,0,1,0,0), -- Hoodoo Master Fu'jin +(@GUID+49,31101,571,1,0x00000080,0,0,5014.065430,3678.846436,362.995575,5.096361,120,0,0,1,0,0), +(@GUID+50,31102,571,1,0x00000040,0,0,5295.455,2732.87549,409.274658,4.7211113,120,0,0,1,0,0), -- Vieron Blazefeather +(@GUID+51,31102,571,1,0x00000080,0,0,5031.676270,3655.820801,362.234558,5.131268,120,0,0,1,0,0), +(@GUID+52,31106,571,1,0x00000040,0,0,5295.56348,2926.67188,409.274658,0.87266463,120,0,0,1,0,0), -- Siegesmith Stronghoof +(@GUID+53,31106,571,1,0x00000080,0,0,5037.602051,3675.459717,363.147888,3.176499,120,0,0,1,0,0), +(@GUID+54,31107,571,1,0x00000040,0,0,5230.09033,2876.635,409.316254,-2.19854617,120,0,0,1,0,0), -- Lieutenant Murp +(@GUID+55,31107,571,1,0x00000080,0,0,5004.455078,3661.089111,361.335785,3.979351,120,0,0,1,0,0), +(@GUID+56,31151,571,1,0x00000040,0,0,5363.2876,2834.52954,409.3606,2.76273036,120,0,0,1,0,0), -- Tactical Officer Kilrath +(@GUID+57,31151,571,1,0x00000080,0,0,5034.698242,3683.268799,363.129120,4.310963,120,0,0,1,0,0), +(@GUID+58,32296,571,1,0x00000040,0,0,5374.568,2790.784,409.3225,2.60054,120,0,0,1,0,0), -- Stone Guard Mukar +-- Missing noc in fortress +(@GUID+60,39173,571,1,0x00000040,0,0,5372.672,2786.74048,409.4423,2.80998015,120,0,0,1,0,0); -- Champion Ros'slai + +-- Pathing for Anchorite Tessa Entry: 31054 +SET @NPC := @GUID+33; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `MovementType`=2 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,5382.507,3028.468,409.206,0,0,0,100,0), +(@PATH,2,5392.744,3028.737,409.206,0,0,0,100,0), +(@PATH,3,5382.507,3028.468,409.206,0,0,0,100,0), +(@PATH,4,5371.491,3028.329,409.206,0,0,0,100,0), +(@PATH,5,5360.032,3028.516,409.3161,0,0,0,100,0), +(@PATH,6,5371.491,3028.329,409.206,0,0,0,100,0); + +-- Pathing for Commander Zanneth Entry: 31036 +SET @NPC := @GUID+27; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=5358.854,`position_y`=2859.232,`position_z`=409.5425 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,14337, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,5359.788,2846.359,409.3642,0,0,0,100,0), +(@PATH,2,5359.187,2839.211,409.3642,0,0,0,100,0), +(@PATH,3,5360.083,2823.116,409.5381,0,0,0,100,0), +(@PATH,4,5359.187,2839.211,409.3642,0,0,0,100,0), +(@PATH,5,5359.788,2846.359,409.3642,0,0,0,100,0), +(@PATH,6,5358.854,2859.232,409.5425,0,0,0,100,0); + +-- Pathing for Commander Dardosh Entry: 31091 +SET @NPC := @GUID+46; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `MovementType`=2,`position_x`=5359.546,`position_y`=2858.049,`position_z`=409.3642 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,5359.202,2843.208,409.3642,0,0,0,100,0), +(@PATH,2,5358.997,2827.974,409.3639,0,0,0,100,0), +(@PATH,3,5359.202,2843.208,409.3642,0,0,0,100,0), +(@PATH,4,5359.546,2858.049,409.3642,0,0,0,100,0); + +-- Pathing for Commander Dardosh Entry: 31091 +SET @NPC := @GUID+47; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `MovementType`=2,`position_x`=5018.411133,`position_y`=3672.615967,`position_z`=362.863525 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,5022.827637,3666.665771,362.205750,0,0,0,100,0), +(@PATH,2,5024.270508,3658.739258,361.705750,0,0,0,100,0), +(@PATH,3,5022.827637,3666.665771,362.205750,0,0,0,100,0), +(@PATH,4,5018.411133,3672.615967,362.863525,0,0,0,100,0); + +-- Pathing for Primalist Mulfort Entry: 31053 +SET @NPC := @GUID+44; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `MovementType`=2 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,5390.624,3027.994,409.206,0,0,0,100,0), +(@PATH,2,5379.875,3027.434,409.206,0,0,0,100,0), +(@PATH,3,5371.404,3026.511,409.206,0,0,0,100,0), +(@PATH,4,5379.875,3027.434,409.206,0,0,0,100,0); + +-- Pathing for Vieron Blazefeather Entry: 31102 +SET @NPC := @GUID+50; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `MovementType`=2,`position_x`=5296.644,`position_y`=2731.107,`position_z`=409.3163 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,5295.544,2722.631,409.3163,0,0,0,100,0), +(@PATH,2,5296.644,2731.107,409.3163,0,0,0,100,0), +(@PATH,3,5297.874,2738.155,409.3163,0,0,0,100,0), +(@PATH,4,5305.192,2746.161,409.3061,0,0,0,100,0), +(@PATH,5,5297.874,2738.155,409.3163,0,0,0,100,0), +(@PATH,6,5296.644,2731.107,409.3163,0,0,0,100,0); + +-- Guards "Alliance" (Valiance Expedition Champion) +SET @GUID := 291000; +DELETE FROM `creature` WHERE `id`=30740; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES +-- Fortress +(@GUID+0,30740,571,1,0x00000080,0,0,5150.26855,2786.02173,409.5469,3.22885919,120,0,0,1,0,0), +(@GUID+1,30740,571,1,0x00000080,0,0,5150.657,2777.9502,409.4053,2.94960642,120,0,0,1,0,0), +(@GUID+2,30740,571,1,0x00000080,0,0,5193.632,2734.172,409.272552,4.694936,120,0,0,1,0,0), +(@GUID+3,30740,571,1,0x00000080,0,0,5200.497,2733.88843,409.272552,4.677482,120,0,0,1,0,0), +(@GUID+4,30740,571,1,0x00000080,0,0,5264.64648,2670.1936,409.1819,3.07177949,120,0,0,1,0,0), +(@GUID+5,30740,571,1,0x00000080,0,0,5265.30566,2663.15381,409.1819,3.12413931,120,0,0,1,0,0), +(@GUID+6,30740,571,1,0x00000080,0,0,5307.02051,2613.89771,409.172363,4.694936,120,0,0,1,0,0), +(@GUID+7,30740,571,1,0x00000080,0,0,5311.133,3061.04248,408.809937,1.50098312,120,0,0,1,0,0), +(@GUID+8,30740,571,1,0x00000080,0,0,5315.87354,2614.21924,408.972748,4.677482,120,0,0,1,0,0), +(@GUID+9,30740,571,1,0x00000080,0,0,5318.09,3060.634,408.882782,1.62315619,120,0,0,1,0,0), +(@GUID+10,30740,571,1,0x00000080,0,0,5149.395,2897.044,409.304443,3.03687286,120,0,0,1,0,0), +(@GUID+11,30740,571,1,0x00000080,0,0,5149.51953,2904.19336,409.276062,3.07177949,120,0,0,1,0,0), +(@GUID+12,30740,571,1,0x00000080,0,0,5192.79248,2948.454,409.2746,1.50098312,120,0,0,1,0,0), +(@GUID+13,30740,571,1,0x00000080,0,0,5201.645,2948.77612,409.2746,1.62315619,120,0,0,1,0,0), +(@GUID+14,30740,571,1,0x00000080,0,0,5265.28,3010.10083,408.895782,2.82743335,120,0,0,1,0,0), +(@GUID+15,30740,571,1,0x00000080,0,0,5265.47559,3017.39941,408.582977,3.07177949,120,0,0,1,0,0), +(@GUID+16,30740,571,1,0x00000080,0,0,5367.91455,2826.52026,409.3225,3.33357882,120,0,0,1,0,0), +(@GUID+17,30740,571,1,0x00000080,0,0,5368.71338,2856.36035,409.3225,2.94960642,120,0,0,1,0,0), +(@GUID+18,30740,571,1,0x00000080,0,0,5388.56,2834.76782,418.7585,3.07177949,120,0,0,1,0,0), +(@GUID+19,30740,571,1,0x00000080,0,0,5389.272,2847.36816,418.7585,3.106686,120,0,0,1,0,0), +(@GUID+20,30740,571,1,0x00000080,0,0,4684.475,2414.28979,369.9621,-2.85779858,120,0,0,1,0,0), +(@GUID+21,30740,571,1,0x00000080,0,0,4692.75635,2392.88574,369.0177,-2.82921553,120,0,0,1,0,0), +(@GUID+22,30740,571,1,0x00000080,0,0,5327.264648,2659.455322,409.178711,3.069901,120,0,0,1,0,0), -- F1307814000A2DAD path +(@GUID+23,30740,571,1,0x00000080,0,0,5154.225586,2833.824219,409.262451,3.124139,120,0,0,1,0,0), +(@GUID+24,30740,571,1,0x00000080,0,0,5154.119629,2847.892822,409.247559,3.071779,120,0,0,1,0,0), +(@GUID+25,30740,571,1,0x00000080,0,0,5179.111328,2837.129639,409.274658,3.211406,120,0,0,1,0,0), +(@GUID+26,30740,571,1,0x00000080,0,0,5179.666504,2846.597900,409.274658,3.089233,120,0,0,1,0,0), +(@GUID+27,30740,571,1,0x00000080,0,0,5270.163086,2833.479248,409.274658,3.124139,120,0,0,1,0,0), +(@GUID+28,30740,571,1,0x00000080,0,0,5270.057129,2847.547607,409.274658,3.071779,120,0,0,1,0,0), +(@GUID+29,30740,571,1,0x00000080,0,0,5307.750000,3008.872559,409.193024,4.781681,120,0,0,1,0,0), -- F1307814000A43AE path +(@GUID+30,30740,571,1,0x00000080,0,0,5335.117188,2916.802002,409.443756,1.500983,120,0,0,1,0,0), +(@GUID+31,30740,571,1,0x00000080,0,0,5350.681152,2917.011719,409.274658,1.466077,120,0,0,1,0,0), +(@GUID+32,30740,571,1,0x00000080,0,0,5335.306152,2764.110352,409.274567,4.834562,120,0,0,1,0,0), +(@GUID+33,30740,571,1,0x00000080,0,0,5349.811523,2763.634766,409.333374,4.660029,120,0,0,1,0,0), +-- Eastspark Workshop +(@GUID+34,30740,571,1,0x00000080,0,0,4349.537,2411.25781,374.743317,2.05948853,120,0,0,1,0,0), +(@GUID+35,30740,571,1,0x00000080,0,0,4388.13135,2411.97827,374.743317,1.6406095,120,0,0,1,0,0), +(@GUID+36,30740,571,1,0x00000080,0,0,4391.6665,2300.60913,374.7433,4.92182827,120,0,0,1,0,0), +(@GUID+37,30740,571,1,0x00000080,0,0,4413.42969,2393.44946,376.3599,1.06465089,120,0,0,1,0,0), +(@GUID+38,30740,571,1,0x00000080,0,0,4417.92,2331.237,370.9189,5.846853,120,0,0,1,0,0), +(@GUID+39,30740,571,1,0x00000080,0,0,4349.11768,2299.27954,374.7433,4.904375,120,0,0,1,0,0), +(@GUID+40,30740,571,1,0x00000080,0,0,4418.608,2355.28735,372.4907,6.02138567,120,0,0,1,0,0); + +-- banners +SET @OGUID := 281000; +DELETE FROM `gameobject` WHERE `id` IN (192269,192284,192285,192338,192339,192488,192254,192255,192336,192501,192502); +DELETE FROM `gameobject` WHERE `id` BETWEEN 192349 AND 192379; +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+115; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +-- Fortress Banners "Alliance" +(@OGUID+0,192286,571,1,128,5371.44873,2820.79346,409.426575,3.124123,0,0,0,0,120,0,1), +(@OGUID+1,192287,571,1,128,5372.42432,2862.47925,409.3659,3.14159274,0,0,0,0,120,0,1), +(@OGUID+2,192292,571,1,128,5154.35059,2862.08423,445.0105,3.14159274,0,0,0,0,120,0,1), +(@OGUID+3,192299,571,1,128,5155.21631,2820.63013,444.9789,-3.115388,0,0,0,0,120,0,1), +(@OGUID+4,192304,571,1,128,5398.03564,2873.013,455.203552,3.132858,0,0,0,0,120,0,1), +(@OGUID+5,192305,571,1,128,5397.31348,2809.264,455.101624,3.132858,0,0,0,0,120,0,1), +(@OGUID+6,192306,571,1,128,5270.55469,2861.68237,444.917236,-3.124123,0,0,0,0,120,0,1), +(@OGUID+7,192307,571,1,128,5271.16064,2820.10864,445.109,-3.132858,0,0,0,0,120,0,1), +(@OGUID+8,192308,571,1,128,5235.12744,2942.12329,444.2792,1.58824873,0,0,0,0,120,0,1), +(@OGUID+9,192309,571,1,128,5272.549,2976.54175,444.493,3.132858,0,0,0,0,120,0,1), +(@OGUID+10,192310,571,1,128,5352.19775,3055.0166,444.5646,1.57952213,0,0,0,0,120,0,1), +(@OGUID+11,192312,571,1,128,5236.315,2739.21533,444.992828,-1.60570168,0,0,0,0,120,0,1), +(@OGUID+12,192313,571,1,128,5271.634,2704.829,445.182617,-3.124123,0,0,0,0,120,0,1), +(@OGUID+13,192314,571,1,128,5350.905,2622.48,444.649323,-1.56206989,0,0,0,0,120,0,1), +(@OGUID+14,192316,571,1,128,5322.013,2781.13281,435.6727,1.57952213,0,0,0,0,120,0,1), +(@OGUID+15,192317,571,1,128,5363.387,2781.27856,435.634125,1.58824873,0,0,0,0,120,0,1), +(@OGUID+16,192318,571,1,128,5322.24854,2898.94629,435.642975,-1.57952213,0,0,0,0,120,0,1), +(@OGUID+17,192319,571,1,128,5364.30371,2899.216,435.690826,-1.55334139,0,0,0,0,120,0,1), +(@OGUID+18,192320,571,1,128,5289.048,2820.22656,435.6738,0,0,0,0,0,120,0,1), +(@OGUID+19,192321,571,1,128,5288.847,2861.82128,435.590485,0.0261791088,0,0,0,0,120,0,1), +(@OGUID+20,192322,571,1,128,5322.89258,2917.14233,445.1543,1.56206989,0,0,0,0,120,0,1), +(@OGUID+21,192323,571,1,128,5364.283,2917.264,445.332184,1.58824611,0,0,0,0,120,0,1), +(@OGUID+22,192324,571,1,128,5290.514,2976.56177,435.087463,0.008724241,0,0,0,0,120,0,1), +(@OGUID+23,192325,571,1,128,5352.37744,3036.95483,435.111053,-1.56206989,0,0,0,0,120,0,1), +(@OGUID+24,192326,571,1,128,5392.64063,3036.967,433.648682,-1.51843357,0,0,0,0,120,0,1), +(@OGUID+25,192327,571,1,128,5172.336,2862.57544,435.65802,0,0,0,0,0,120,0,1), +(@OGUID+26,192328,571,1,128,5173.12842,2820.95654,435.657623,0.0261791088,0,0,0,0,120,0,1), +(@OGUID+27,192329,571,1,128,5235.32227,2924.31079,434.8981,-1.56206989,0,0,0,0,120,0,1), +(@OGUID+28,192330,571,1,128,5237.02344,2757.35669,435.625641,1.55334139,0,0,0,0,120,0,1), +(@OGUID+29,192331,571,1,128,5289.78125,2704.62158,435.714325,0.008724241,0,0,0,0,120,0,1), +(@OGUID+30,192332,571,1,128,5350.93945,2640.43066,435.2642,1.56206989,0,0,0,0,120,0,1), +(@OGUID+31,192333,571,1,128,5392.28027,2639.84033,435.207916,1.52716041,0,0,0,0,120,0,1), +(@OGUID+32,192334,571,1,128,5322.17041,2763.20142,444.9744,-1.56206715,0,0,0,0,120,0,1), +(@OGUID+33,192335,571,1,128,5363.71631,2763.24731,445.023132,-1.54461551,0,0,0,0,120,0,1), +(@OGUID+34,192487,571,1,128,5145.11133,2934.948,433.254852,-3.10665226,0,0,0,0,120,0,1), +(@OGUID+35,192487,571,1,128,5146.04443,2747.30249,433.527039,3.124123,0,0,0,0,120,0,1), +(@OGUID+36,192487,571,1,128,5158.71,2882.90161,431.27417,3.14159274,0,0,0,0,120,0,1), +(@OGUID+37,192487,571,1,128,5160.28369,2798.59766,430.6037,-3.124123,0,0,0,0,120,0,1), +(@OGUID+38,192487,571,1,128,5162.90674,2952.59766,433.368,1.57079577,0,0,0,0,120,0,1), +(@OGUID+39,192487,571,1,128,5163.85,2729.677,433.327545,-1.60570168,0,0,0,0,120,0,1), +(@OGUID+40,192487,571,1,128,5260.82471,2631.81763,433.181061,3.124123,0,0,0,0,120,0,1), +(@OGUID+41,192487,571,1,128,5262.544,3047.93018,431.96524,3.124123,0,0,0,0,120,0,1), +(@OGUID+42,192487,571,1,128,5278.43066,2613.83276,433.294434,-1.62315571,0,0,0,0,120,0,1), +(@OGUID+43,192487,571,1,128,5280.894,3064.95386,431.9758,1.55334139,0,0,0,0,120,0,1), +-- Fortress Banners "Horde" +(@OGUID+44,192269,571,1,64,4526.46,2810.18,391.2,-2.99322,0,0,0,1,180,0,1), +(@OGUID+45,192284,571,1,64,5372.48,2862.5,409.049,3.14159,0,0,0,1,180,0,1), +(@OGUID+46,192285,571,1,64,5371.49,2820.8,409.177,3.14159,0,0,0,1,180,0,1), +(@OGUID+47,192338,571,1,64,5397.76,2873.08,455.461,3.10665,0,0,0,1,180,0,1), +(@OGUID+48,192339,571,1,64,5397.39,2809.33,455.344,3.10665,0,0,0,1,180,0,1), +(@OGUID+49,192349,571,1,64,5155.31,2820.74,444.979,-3.13286,0,0,0,1,180,0,1), +(@OGUID+50,192350,571,1,64,5270.69,2861.78,445.058,-3.11539,0,0,0,1,180,0,1), +(@OGUID+51,192351,571,1,64,5271.28,2820.16,445.201,-3.13286,0,0,0,1,180,0,1), +(@OGUID+52,192352,571,1,64,5173.02,2820.93,435.72,0.017452,0,0,0,1,180,0,1), +(@OGUID+53,192353,571,1,64,5172.11,2862.57,435.721,0.017452,0,0,0,1,180,0,1), +(@OGUID+54,192354,571,1,64,5288.41,2861.79,435.721,0.017452,0,0,0,1,180,0,1), +(@OGUID+55,192355,571,1,64,5288.92,2820.22,435.721,0.017452,0,0,0,1,180,0,1), +(@OGUID+56,192356,571,1,64,5237.07,2757.03,435.796,1.51844,0,0,0,1,180,0,1), +(@OGUID+57,192357,571,1,64,5235.34,2924.34,435.04,-1.5708,0,0,0,1,180,0,1), +(@OGUID+58,192358,571,1,64,5322.23,2899.43,435.808,-1.58825,0,0,0,1,180,0,1), +(@OGUID+59,192359,571,1,64,5364.35,2899.4,435.839,-1.5708,0,0,0,1,180,0,1), +(@OGUID+60,192360,571,1,64,5352.37,3037.09,435.252,-1.5708,0,0,0,1,180,0,1), +(@OGUID+61,192361,571,1,64,5392.65,3037.11,433.713,-1.52716,0,0,0,1,180,0,1), +(@OGUID+62,192362,571,1,64,5322.12,2763.61,444.974,-1.55334,0,0,0,1,180,0,1), +(@OGUID+63,192363,571,1,64,5363.61,2763.39,445.024,-1.54462,0,0,0,1,180,0,1), +(@OGUID+64,192364,571,1,64,5350.88,2622.72,444.686,-1.5708,0,0,0,1,180,0,1), +(@OGUID+65,192366,571,1,64,5236.27,2739.46,444.992,-1.59698,0,0,0,1,180,0,1), +(@OGUID+66,192367,571,1,64,5271.8,2704.87,445.183,-3.13286,0,0,0,1,180,0,1), +(@OGUID+67,192368,571,1,64,5289.46,2704.68,435.875,-0.017451,0,0,0,1,180,0,1), +(@OGUID+68,192369,571,1,64,5350.95,2640.36,435.408,1.5708,0,0,0,1,180,0,1), +(@OGUID+69,192370,571,1,64,5392.27,2639.74,435.331,1.50971,0,0,0,1,180,0,1), +(@OGUID+70,192371,571,1,64,5364.29,2916.94,445.331,1.57952,0,0,0,1,180,0,1), +(@OGUID+71,192372,571,1,64,5322.86,2916.95,445.154,1.56207,0,0,0,1,180,0,1), +(@OGUID+72,192373,571,1,64,5290.35,2976.56,435.221,0.017452,0,0,0,1,180,0,1), +(@OGUID+73,192374,571,1,64,5272.94,2976.55,444.492,3.12412,0,0,0,1,180,0,1), +(@OGUID+74,192375,571,1,64,5235.19,2941.9,444.278,1.58825,0,0,0,1,180,0,1), +(@OGUID+75,192376,571,1,64,5352.19775,3055.0166,444.5646,1.57952,0,0,0,0,120,0,1), +(@OGUID+76,192377,571,1,64,5414.19,3069.8,415.187,1.64061,0,0,0,1,180,0,1), +(@OGUID+77,192378,571,1,64,5322.02,2781.13,435.811,1.5708,0,0,0,1,180,0,1), +(@OGUID+78,192379,571,1,64,5363.42,2781.03,435.763,1.5708,0,0,0,1,180,0,1), +(@OGUID+79,192254,571,1,64,5154.46,2828.94,409.189,3.14159,0,0,0,1,180,0,1), +(@OGUID+80,192255,571,1,64,5154.52,2853.31,409.183,3.14159,0,0,0,1,180,0,1), +(@OGUID+81,192336,571,1,64,5154.49,2862.15,445.012,3.14159,0,0,0,1,180,0,1), +(@OGUID+82,192488,571,1,64,5160.34,2798.61,430.769,3.14159,0,0,0,1,180,0,1), +(@OGUID+83,192488,571,1,64,5158.81,2883.13,431.618,3.14159,0,0,0,1,180,0,1), +(@OGUID+84,192488,571,1,64,5278.38,2613.83,433.409,-1.58825,0,0,0,1,180,0,1), +(@OGUID+85,192488,571,1,64,5260.82,2631.8,433.324,3.05433,0,0,0,1,180,0,1), +(@OGUID+86,192488,571,1,64,5163.13,2952.59,433.503,1.53589,0,0,0,1,180,0,1), +(@OGUID+87,192488,571,1,64,5145.11,2935,433.386,3.14159,0,0,0,1,180,0,1), +(@OGUID+88,192488,571,1,64,5262.54,3047.95,432.055,3.10665,0,0,0,1,180,0,1), +(@OGUID+89,192488,571,1,64,5146.04,2747.21,433.584,3.07177,0,0,0,1,180,0,1), +(@OGUID+90,192488,571,1,64,5163.78,2729.68,433.394,-1.58825,0,0,0,1,180,0,1), +(@OGUID+91,192488,571,1,64,5280.894,3064.95386,431.9758,1.55334139,0,0,0,0,120,0,1), +-- Tower Banners "Alliance" +(@OGUID+92,192501,571,1,64,4398.82,2804.7,429.792,-1.58825,0,0,0,1,180,0,1), +(@OGUID+93,192501,571,1,64,4416,2822.67,429.851,-0.017452,0,0,0,1,180,0,1), +(@OGUID+94,192501,571,1,64,4559.11,3606.22,419.999,-1.48353,0,0,0,1,180,0,1), +(@OGUID+95,192501,571,1,64,4539.42,3622.49,420.034,-3.07177,0,0,0,1,180,0,1), +(@OGUID+96,192501,571,1,64,4555.26,3641.65,419.974,1.67551,0,0,0,1,180,0,1), +(@OGUID+97,192501,571,1,64,4574.87,3625.91,420.079,0.087266,0,0,0,1,180,0,1), +(@OGUID+98,192501,571,1,64,4466.79,1960.42,459.144,1.15192,0,0,0,1,180,0,1), +(@OGUID+99,192501,571,1,64,4475.35,1937.03,459.07,-0.436332,0,0,0,1,180,0,1), +(@OGUID+100,192501,571,1,64,4451.76,1928.1,459.076,-2.00713,0,0,0,1,180,0,1), +(@OGUID+101,192501,571,1,64,4442.99,1951.9,459.093,2.74016,0,0,0,1,180,0,1), +(@OGUID+102,192501,571,1,64,4380.36328,2822.38013,429.8818,-3.106652,0,0,0,0,120,0,1), +(@OGUID+103,192501,571,1,64,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1), +-- Tower Banners "Horde" +(@OGUID+104,192502,571,1,128,4398.82,2804.7,429.792,-1.58825,0,0,0,1,180,0,1), +(@OGUID+105,192502,571,1,128,4416,2822.67,429.851,-0.017452,0,0,0,1,180,0,1), +(@OGUID+106,192502,571,1,128,4559.11,3606.22,419.999,-1.48353,0,0,0,1,180,0,1), +(@OGUID+107,192502,571,1,128,4539.42,3622.49,420.034,-3.07177,0,0,0,1,180,0,1), +(@OGUID+108,192502,571,1,128,4555.26,3641.65,419.974,1.67551,0,0,0,1,180,0,1), +(@OGUID+109,192502,571,1,128,4574.87,3625.91,420.079,0.087266,0,0,0,1,180,0,1), +(@OGUID+110,192502,571,1,128,4466.79,1960.42,459.144,1.15192,0,0,0,1,180,0,1), +(@OGUID+111,192502,571,1,128,4475.35,1937.03,459.07,-0.436332,0,0,0,1,180,0,1), +(@OGUID+112,192502,571,1,128,4451.76,1928.1,459.076,-2.00713,0,0,0,1,180,0,1), +(@OGUID+113,192502,571,1,128,4442.99,1951.9,459.093,2.74016,0,0,0,1,180,0,1), +(@OGUID+114,192502,571,1,128,4380.36328,2822.38013,429.8818,-3.106652,0,0,0,0,120,0,1), +(@OGUID+115,192502,571,1,128,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1); + +SET @OGUID := 280000; +DELETE FROM `gameobject` WHERE `id` IN (192458,192459,192460,192461,192289,192290,192434,192435,192280,192283,192425,192426,192427,192428,192288,192291); +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +-- The Sunken Ring "Horde" +(@OGUID+0,192458,571,1,16,4811.4,2441.9,358.207,-2.0333,0,0,0,1,180,0,1), +(@OGUID+1,192459,571,1,16,4805.67,2407.48,358.191,1.78023,0,0,0,1,180,0,1), +(@OGUID+2,192460,571,1,16,5004.35,2486.36,358.449,2.17294,0,0,0,1,180,0,1), +(@OGUID+3,192461,571,1,16,4983.28,2503.09,358.177,-0.427603,0,0,0,1,180,0,1), +(@OGUID+4,192289,571,1,16,4778.19,2438.06,345.644,-2.94088,0,0,0,1,180,0,1), +(@OGUID+5,192290,571,1,16,5024.57,2532.75,344.023,-1.93732,0,0,0,1,180,0,1), +-- The Sunken Ring "Alliance" +(@OGUID+6,192425,571,1,32,4811.435,2441.84546,357.982483,-2.02457881,0,0,0,0,120,0,1), +(@OGUID+7,192426,571,1,32,4805.514,2407.84375,357.940765,1.7715075,0,0,0,0,120,0,1), +(@OGUID+8,192427,571,1,32,5004.35,2486.36,358.449,2.17294,0,0,0,1,180,0,1), +(@OGUID+9,192428,571,1,32,4983.221,2503.27271,357.959534,-0.43633157,0,0,0,0,120,0,1), +(@OGUID+10,192288,571,1,32,4778.065,2438.02441,345.7063,-2.932139,0,0,0,0,120,0,1), +(@OGUID+11,192291,571,1,32,5024.608,2532.72583,344.4308,-1.94604158,0,0,0,0,120,0,1), +-- The Broken Temple "Horde" +(@OGUID+12,192434,571,1,16,5041.61,3294.4,382.15,-1.63188,0,0,0,1,180,0,1), +(@OGUID+13,192435,571,1,16,4855.63,3297.62,376.739,-3.13286,0,0,0,1,180,0,1), +(@OGUID+14,192280,571,1,16,4857.97,3335.44,368.881,-2.94959,0,0,0,1,180,0,1), +(@OGUID+15,192283,571,1,16,5006.34,3280.4,371.163,2.22529,0,0,0,1,180,0,1), +-- The Broken Temple "Alliance" +(@OGUID+16,192400,571,1,32,5041.650879,3294.318604,381.919952,-1.605702,0,0,0,1,180,0,1), +(@OGUID+17,192401,571,1,32,4855.444336,3297.600830,376.495758,-3.115388,0,0,0,1,180,0,1), +(@OGUID+18,192281,571,1,32,4857.971191,3335.415771,369.291901,-2.888511,0,0,0,1,180,0,1), +(@OGUID+19,192282,571,1,32,5006.322754,3280.362061,371.242249,2.242746,0,0,0,1,180,0,1); + +-- EVERYTHING UNDER HERE IS WIP +/* +-- Eastspark Workshop "Horde" +(@OGUID+20,192452,571,1,16,4416.7993,2414.0383,377.4869,0.0087,0,0,0,0,120,0,1), +-- Eastspark Workshop "Alliance" +(@OGUID+21,192416,571,1,32,4408.57,2422.61,377.179,1.58825,0,0,0,1,180,0,1), +(@OGUID+22,192417,571,1,32,4416.59,2414.08,377.196,0,0,0,0,1,180,0,1), +(@OGUID+23,192418,571,1,32,4417.25,2301.14,377.214,0.026179,0,0,0,1,180,0,1), +(@OGUID+24,192273,571,1,32,4417.94,2324.81,371.577,3.08051,0,0,0,1,180,0,1), +-- Westspark Workshop "Horde" + +-- Westspark Workshop "Alliance" +(@OGUID+25,192274,571,1,32,4424.15,3286.54,371.546,3.12412,0,0,0,1,180,0,1), +(@OGUID+26,192406,571,1,32,4438.3,3361.08,371.568,-0.017451,0,0,0,1,180,0,1), +(@OGUID+27,192407,571,1,32,4448.17,3235.63,370.412,-1.56207,0,0,0,1,180,0,1), +(@OGUID+28,192433,571,1,32,4401.63,3377.46,363.365,1.55334,0,0,0,1,180,0,1), + +-- *** in progress zone horde banner in phase 128 + 32 + +-- Winters Edge tower alliance +(192429,571,1,64,4464.123535 2855.453125 406.110596,0.829032,0,0,0,0,120,0,1); +(192430,571,1,64,4434.555664,2883.448730,406.025299,0.759217,0,0,0,0,120,0,1); +(192431,571,1,64,4349.900391,2885.561768,406.104889,1.605702,0,0,0,0,120,0,1); +(192414,571,1,64,4387.621582 2719.565918 389.935120,-1.544616,0,0,0,0,120,0,1); +-- Winters Edge tower horde +(192442,571,1,128,4350.039,2885.61377,406.3287,1.58824873,0,0,0,0,120,0,1); +(192443,571,1,128,4434.32568,2883.244,406.3456,0.767943859,0,0,0,0,120,0,1); +(192444,571,1,128,4464.17432,2855.3186,406.390961,0.802850962,0,0,0,0,120,0,1); +(192450,571,1,128,4387.59033,2719.90015,390.200531,-1.51843357,0,0,0,0,120,0,1); + +(192449,571,1,129,4517.75342,2717.231,387.811981,-1.53588688,0,0,0,0,120,0,1); +(192424,571,1,417,4563.70166,2171.03125,367.607056,-1.82386875,0,0,0,0,120,0,1), +(192626,571,1,65,4938.364,2454.59863,320.391785,-2.513274,0,0,0,0,120,0,1); +(192627,571,1,65,4939.48535,3339.65259,376.874939,0.890116632,0,0,0,0,120,0,1); + +192271 4424.741211 2975.604980 367.226807 1.701696 -- banner pole shawdowsight +*/ + +-- Misc objects in fortress phased properly +SET @OGUID := 282000; +DELETE FROM `gameobject` WHERE `guid` IN (67165,67224,67222,67190,67195,67216,67193,67182,67186,67192,67161,67164,67180,67187); +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+55; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(@OGUID+0,193096,571,1,128,5379.885,3008.093,409.181915,-3.124123,0,0,0,0,120,0,1), +(@OGUID+1,193097,571,1,128,5381.73975,3008.15454,409.181915,2.98449826,0,0,0,0,120,0,1), +(@OGUID+2,193098,571,1,128,5383.672,3008.02783,409.181915,-3.115388,0,0,0,0,120,0,1), +(@OGUID+3,193099,571,1,128,5386.25342,3007.79614,409.181915,2.932139,0,0,0,0,120,0,1), +(@OGUID+4,193100,571,1,128,5387.354,3009.64941,409.181915,-1.30899549,0,0,0,0,120,0,1), +(@OGUID+5,193101,571,1,128,5381.12744,3010.09717,409.181915,-2.72271276,0,0,0,0,120,0,1), +(@OGUID+6,193102,571,1,128,5383.12061,3007.90967,410.8231,-2.530723,0,0,0,0,120,0,1), +(@OGUID+7,193103,571,1,128,5381.105,3007.89575,410.8231,-3.09791875,0,0,0,0,120,0,1), +(@OGUID+8,193104,571,1,128,5376.777,3010.619,409.191742,-2.60926127,0,0,0,0,120,0,1), +(@OGUID+9,193105,571,1,128,5381.47559,3010.24731,410.8231,-2.80997539,0,0,0,0,120,0,1), +(@OGUID+10,193106,571,1,128,5381.059,3009.85864,410.8231,2.66161919,0,0,0,0,120,0,1), +(@OGUID+11,193107,571,1,128,5381.038,3010.44263,410.8157,-2.0507617,0,0,0,0,120,0,1), +(@OGUID+12,193108,571,1,128,5379.83154,3007.82373,410.8161,-2.02457881,0,0,0,0,120,0,1), +(@OGUID+13,193109,571,1,128,5379.99463,3008.40356,410.815918,-3.03687477,0,0,0,0,120,0,1), +(@OGUID+14,193124,571,1,128,5293.65869,2924.44019,409.29306,1.20427489,0,0,0,0,120,0,1), +(@OGUID+15,193125,571,1,1,5293.28,2932.32813,409.065247,-2.49581814,0,0,0,0,120,0,1), +(@OGUID+16,193126,571,1,1,5292.30469,2930.5105,409.157135,-3.06302428,0,0,0,0,120,0,1), +(@OGUID+17,193127,571,1,64,5293.349,2923.712,409.844757,-1.8762306,0,0,0,0,120,0,1), +(@OGUID+18,193128,571,1,128,5293.12256,2895.22754,409.208771,-0.9861096,0,0,0,0,120,0,1), +(@OGUID+19,193129,571,1,128,5292.913,2895.54346,410.419617,-0.122171074,0,0,0,0,120,0,1), +(@OGUID+20,193130,571,1,128,5294.09473,2894.191,409.164063,-0.7330382,0,0,0,0,120,0,1), +(@OGUID+21,193131,571,1,128,5295.1875,2895.382,409.143219,-0.349065244,0,0,0,0,120,0,1), +(@OGUID+22,193132,571,1,128,5294.527,2895.57471,410.6591,-1.92858779,0,0,0,0,120,0,1), +(@OGUID+23,193133,571,1,128,5295.3916,2895.05737,410.6686,0.6894028,0,0,0,0,120,0,1), +(@OGUID+24,193134,571,1,128,5295.13525,2895.68481,410.618866,-2.22529364,0,0,0,0,120,0,1), +(@OGUID+25,193135,571,1,128,5294.97559,2895.33521,410.657684,-2.73143482,0,0,0,0,120,0,1), +(@OGUID+26,193136,571,1,128,5293.22559,2895.46436,410.413483,-0.802850962,0,0,0,0,120,0,1), +(@OGUID+27,193137,571,1,128,5295.56,2895.24146,410.628052,-2.11184788,0,0,0,0,120,0,1), +(@OGUID+28,193138,571,1,128,5293.741,2894.48169,409.183167,-2.72271276,0,0,0,0,120,0,1), +(@OGUID+29,193139,571,1,64,5294.599,2786.85254,409.8877,-2.356195,0,0,0,0,120,0,1), +(@OGUID+30,193140,571,1,64,5294.37939,2785.03833,409.175018,-2.33873963,0,0,0,0,120,0,1), +(@OGUID+31,193141,571,1,64,5293.205,2787.03052,409.218872,3.03687477,0,0,0,0,120,0,1), +(@OGUID+32,193142,571,1,64,5294.241,2786.42456,409.174347,0.0174524616,0,0,0,0,120,0,1), +(@OGUID+33,193143,571,1,64,5291.705,2785.86646,409.282135,-2.03330517,0,0,0,0,120,0,1), +(@OGUID+34,193144,571,1,64,5293.03369,2785.632,409.22522,-1.2915417,0,0,0,0,120,0,1), +(@OGUID+35,193145,571,1,64,5295.866,2787.7666,409.1923,2.155478,0,0,0,0,120,0,1), +(@OGUID+36,193146,571,1,64,5293.56445,2787.31079,410.55954,0.261798173,0,0,0,0,120,0,1), +(@OGUID+37,193147,571,1,128,5233.12061,2920.362,409.163544,-0.7243115,0,0,0,0,120,0,1), +(@OGUID+38,193148,571,1,128,5238.27539,2920.67358,409.256439,-0.418878615,0,0,0,0,120,0,1), +(@OGUID+39,193149,571,1,128,5235.902,2920.751,409.224457,-0.951203167,0,0,0,0,120,0,1), +(@OGUID+40,193150,571,1,128,5237.36963,2919.89771,409.556641,0.8202983,0,0,0,0,120,0,1), +(@OGUID+41,193151,571,1,128,5234.19775,2918.99731,409.322754,-2.33873963,0,0,0,0,120,0,1), +(@OGUID+42,193152,571,1,128,5234.52344,2921.76221,409.175781,-2.2165668,0,0,0,0,120,0,1), +(@OGUID+43,193153,571,1,128,5234.119,2918.93921,409.1339,-3.098036,0,0,0,0,120,0,1), +(@OGUID+44,193154,571,1,128,5234.26758,2919.40015,409.502869,-2.18166113,0,0,0,0,120,0,1), +(@OGUID+45,193155,571,1,128,5293.37939,2746.05566,409.22052,-0.06981169,0,0,0,0,120,0,1), +(@OGUID+46,193156,571,1,128,5293.65039,2755.67529,409.1913,-0.43633157,0,0,0,0,120,0,1), +(@OGUID+47,193157,571,1,128,5292.23535,2753.59473,409.0867,-0.357789934,0,0,0,0,120,0,1), +(@OGUID+48,193158,571,1,128,5292.42969,2748.62427,409.131042,0.253072351,0,0,0,0,120,0,1), +(@OGUID+49,193159,571,1,128,5293.384,2750.90283,409.234924,-0.0610866137,0,0,0,0,120,0,1), +(@OGUID+50,193160,571,1,64,5371.89746,2805.47583,409.3072,0.0610866137,0,0,0,0,120,0,1), +(@OGUID+51,193161,571,1,64,5376.616,2875.105,409.254822,1.59697616,0,0,0,0,120,0,1), +(@OGUID+52,193162,571,1,128,5377.54932,2870.92456,409.239166,-0.549776852,0,0,0,0,120,0,1), +(@OGUID+53,193163,571,1,128,5378.068,2813.61719,409.239166,1.55334139,0,0,0,0,120,0,1), +(@OGUID+54,193164,571,1,128,5378.921,2805.43677,409.239166,1.53588688,0,0,0,0,120,0,1), +(@OGUID+55,193165,571,1,128,5378.452,2876.67456,409.239166,1.54461825,0,0,0,0,120,0,1); diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.txt new file mode 100644 index 0000000000..b70507e700 --- /dev/null +++ b/Wintergrasp_temp/Spells.txt @@ -0,0 +1,23 @@ +Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32 +Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16 + +Spell 55773 "Horde Control Phase Shift" Adds Phase 64 +Spell 55774 "Alliance Control Phase Shift" Adds Phase 128 + +Spell 58045 "Essence of Wintergrasp" Adds Phase 256 + +Spell 37795 "Recruit" Gained when joining WG battle + +Spell 74411 "Battleground - Dampening" Gained when joining WG battle + +Spell 61409 "Build Siege Vehicle (Force)" is cast by npc 30400 "Goblin Mechanic " on player +Spell 56664 "Build Catapult (Force)" is cast by npc 30499 "Gnomish Engineer " on player +Spell 56662 "Build Siege Vehicle (Force)" is cast by npc 30499 "Gnomish Engineer " on player + +Spell 50398 "Riding Trainer Advertisement" is cast by npc 30869 "Arzo Safeflight " on self + +Wintergrasp Vehicle On spawn entries: 28312,27881,28094,32627 +set x,y,z,o to nearest trigger entry: 23472 +make player cast 60968 on vehicle +aura 14267 on self if player is horde +aura 14268 on self if player is alliance \ No newline at end of file diff --git a/Wintergrasp_temp/Strings.sql b/Wintergrasp_temp/Strings.sql new file mode 100644 index 0000000000..5be8799aeb --- /dev/null +++ b/Wintergrasp_temp/Strings.sql @@ -0,0 +1,107 @@ +-- Unused yet: +-- Wintergrasp is under attack! +-- Wintergrasp Fortress is under attack! +-- Winter's Edge Tower is under attack! +-- Eastern Bridge is under attack! +-- Western Bridge is under attack! +-- Westspark Bridge is under attack! +-- Flamewatch Tower is under attack! + +-- 'You have reached Rank 1: Corporal' Sent to player by raid leader +-- 'You have reached Rank 2: First Lieutenant' Sent to player by raid leader + +-- Wintergrasp coreside texts +DELETE FROM trinity_string WHERE entry BETWEEN 12050 AND 12072; +INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES +(12050, '%s has been captured by %s ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12051, '%s is under attack by %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12052, 'The Broken Temple siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12053, 'Eastspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12054, 'Westspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12055, 'The Sunken Ring siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12057, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12056, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12058, 'The battle for Wintergrasp is about to begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12059, 'You have reached Rank 1: Corporal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12060, 'You have reached Rank 2: First Lieutenant', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12061, 'The south-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12062, 'The north-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12063, 'The south-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12064, 'The north-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12065, '%s has been damaged !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12066, '%s has been destroyed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12067, 'The battle for Wintergrasp begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12068, '%s has successfully defended the Wintergrasp fortress!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12069, 'The southern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12070, 'The eastern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12071, 'The western tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12072, 'The Wintergrasp fortress has been captured by %s !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- Wintergrasp script texts +DELETE FROM `script_texts` WHERE entry BETWEEN -1850500 AND -1850507; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`)VALUES +(0, -1850500, 'Guide me to the Fortress Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850501, 'Guide me to the Sunken Ring Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850502, 'Guide me to the Broken Temple Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850503, 'Guide me to the Westspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850504, 'Guide me to the Eastspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850505, 'Guide me back to the Horde landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850506, 'Guide me back to the Alliance landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), +(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text) + +-- New support-commands for battlefield class +DELETE FROM `command` WHERE name IN ('bf start', 'bf stop', 'bf enable', 'bf switch', 'bf timer'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf start',3,'Syntaxe: .bf start #battleid'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf stop',3,'Syntaxe: .bf stop #battleid'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf enable',3,'Syntaxe: .bf enable #battleid'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf switch',3,'Syntaxe: .bf switch #battleid'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf timer',3,'Syntaxe: .bf timer #battleid #timer'); + +-- NPC talk text insert from sniff +DELETE FROM `creature_text` WHERE `entry`=15214 AND `groupid` BETWEEN 0 AND 30; +DELETE FROM `creature_text` WHERE `entry` IN (31036,31091) AND `groupid` BETWEEN 0 AND 3; +DELETE FROM `creature_text` WHERE `entry` IN (31108,31109,34924) AND `groupid`=0; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(15214,0,0, 'Let the battle begin!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,1,0, 'The southern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,2,0, 'The southern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,3,0, 'The eastern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,4,0, 'The eastern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,5,0, 'The western tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,6,0, 'The western tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,7,0, 'The north-western keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,8,0, 'The north-western keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,9,0, 'The south-eastern keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,10,0, 'The south-eastern keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,11,0, 'The Broken Temple siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,12,0, 'The Broken Temple siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,13,0, 'The Broken Temple siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,14,0, 'The Broken Temple siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,15,0, 'The Eastspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,16,0, 'The Eastspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,17,0, 'The Eastspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,18,0, 'The Eastspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,19,0, 'The Sunken Ring siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,20,0, 'The Sunken Ring siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,21,0, 'The Sunken Ring siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,22,0, 'The Sunken Ring siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,23,0, 'The Westspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,24,0, 'The Westspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,25,0, 'The Westspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,26,0, 'The Westspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,27,0, 'The Alliance has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,28,0, 'The Alliance has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,29,0, 'The Horde has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +(15214,30,0, 'The Horde has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), +-- Not sure if all Alliance text is here, need horde text +(31036,0,0, 'The first of the Horde towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'), +(31036,1,0, 'The second tower has fallen! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'), +(31036,2,0, 'The Horde towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Zanneth'), +(31036,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Zanneth'), +(31091,0,0, 'The first of the Alliance towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'), +(31091,1,0, 'Lok''tar! The second tower falls! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'), +(31091,2,0, 'The Alliance towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Dardosh'), +(31091,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Dardosh'), -- ??? +(31108,0,0, 'Stop the Horde from retrieving the embers, $n. We cannot risk them having the advantage when the battle resumes!',0,7,100,0,0,0, 'Siege Master Stouthandle'), +(31109,0,0, 'Destroy their foul machines of war, $n!',0,7,100,0,0,0, 'Senior Demolitionist Legoso'), +(34924,0,0, 'The gates have been breached! Defend the keep!',1,0,100,0,0,0, 'High Commander Halford Wyrmbane'); diff --git a/Wintergrasp_temp/TODO.txt b/Wintergrasp_temp/TODO.txt new file mode 100644 index 0000000000..16e1681c37 --- /dev/null +++ b/Wintergrasp_temp/TODO.txt @@ -0,0 +1,16 @@ +TODO (add new things to sort out here) : +* Core: + - Move spawns to database : NPCs / GOs (DB part mostly done, core needs to be adjusted) + - Fix teleport spells for vehicles/drivers + - Clean up code to use phases-system / spells instead of hardcoded spawn/despawn functionality + - Remove hardcoded entities from headerfile + - Spawn horde/alliance spiritguides spawn/change depending on holder + - Clean up some minor hacks + +* DB: + - Template updates for npcs and GOs (few missing) + - Npc 30488 (Travis Day) needs vendor data + - Get official texts for horde in db + - Spawn NPC/GO in their correct phase + +COMPLETED (move completed things from the above list here) : diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql new file mode 100644 index 0000000000..7cfcac4daa --- /dev/null +++ b/Wintergrasp_temp/Template_update.sql @@ -0,0 +1,87 @@ +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, + 192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner + + +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, + 192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, + 192255,192336); -- Horde Banner + +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, + 193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, + 193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, + 193164,193165); -- nameless GOs + +UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31841; -- Taunka Spirit Guide +UPDATE `creature_template` SET `exp`= WHERE `entry`=31842; -- Dwarven Spirit Guide +UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31052; -- Bowyer Randolph +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=39172; -- Marshal Magruder +UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry`=30488; -- Travis Day +UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31053; -- Primalist Mulfort +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4 WHERE `entry`=31107; -- Lieutenant Murp (?) +UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) +UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms + +/* +Sniff check these +-- Wintergrasp Cannons (Spell 51421 : Fire Cannon) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735 WHERE `entry`=28366; -- *** WRONG **** +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry` IN (30499,30740, 28319); -- Alliance +UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry` IN (30400,30739, 32629); -- Horde + +-- Added by Malcrom +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry` IN (28312); -- Alliance +UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry` IN (32627); -- Horde + +-- Wintergrasp Catapult speed adjustments +UPDATE `creature_template` SET `speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; + +-- Creature Gossip_menu_id Update from sniff +UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; +UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; +*/ + +UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron +UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder +UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31347; -- Champion Ros'slai + +DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(31841,0,0,1,0, '58729'), -- Taunka Spirit Guide (Spiritual Immunity, Spirit Heal Channel) FIX: Do we need the spell that revives players here (22011)? It has a duration (found in sniffs). +(31842,0,0,1,0, '58729'), -- Dwarven Spirit Guide This spell (and the spell it triggers, are used in the "ressurect system" in Battleground.cpp +(30400,0,0,1,0, NULL), -- Goblin Mechanic +(30499,0,0,1,0, NULL), -- Gnomish Engineer +(30489,0,0,1,0, NULL), -- Morgan Day +(30869,0,0,1,0, NULL), -- Arzo Safeflight +(31036,14337,0,257,0, NULL), -- Commander Zanneth +(31051,0,0,1,0, NULL), -- Sorceress Kaylana +(31052,0,0,257,0, NULL), -- Bowyer Randolph +(31054,0,0,257,0, NULL), -- Anchorite Tessa +(31108,0,0,257,0, NULL), -- Siege Master Stouthandle +(31109,0,0,257,0, NULL), -- Senior Demolitionist Legoso +(31153,6569,0,257,0, NULL), -- Tactical Officer Ahbramis +(32294,27247,0,1,0, NULL), -- Knight Dameron +(39172,28912,0,1,0, NULL), -- Marshal Magruder +(30870,0,0,1,0, NULL), -- Herzo Safeflight +(31053,0,0,257,0, '18950'), -- Primalist Mulfort (Invisibility and Stealth Detection ... why?) +(31091,0,0,257,0, '18950'), -- Commander Dardosh (Invisibility and Stealth Detection) +(31101,0,0,1,0, NULL), -- Hoodoo Master Fu'jin +(31102,0,0,1,0, NULL), -- Vieron Blazefeather +(31106,0,0,257,0, NULL), -- Siegesmith Stronghoof +(31107,0,0,257,0, NULL), -- Lieutenant Murp +(31151,0,0,257,0, NULL), -- Tactical Officer Kilrath +(32296,27245,0,1,0, NULL), -- Stone Guard Mukar +(39173,29261,0,1,0, NULL), -- Champion Ros'slai +(30740,0,0,257,375, NULL); -- Valiance Expedition Champion + +-- Wintergrasp creature addon cleanups +DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131258 AND 131322; +DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131326 AND 131328; +DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131350 AND 131353; +DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131376 AND 131380; +DELETE FROM `creature_addon` WHERE `guid`=131392; +DELETE FROM `creature_addon` WHERE `guid`=131437; +DELETE FROM `creature_addon` WHERE `guid`=131458; +DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131631 AND 131634; +DELETE FROM `creature_addon` WHERE `guid`=131706; +DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131727 AND 131731; From b1a300545ca36b54659aad0d6d47c947888fc0ad Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 28 Jun 2011 21:45:01 +0100 Subject: [PATCH 084/147] Missed changes on previous commit. --- Wintergrasp_temp/Spawns.sql | 8 +++++--- Wintergrasp_temp/Strings.sql | 4 ++-- Wintergrasp_temp/Template_update.sql | 15 ++------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/Spawns.sql index 90840ba400..72ade18933 100644 --- a/Wintergrasp_temp/Spawns.sql +++ b/Wintergrasp_temp/Spawns.sql @@ -204,8 +204,10 @@ INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equ -- banners SET @OGUID := 281000; -DELETE FROM `gameobject` WHERE `id` IN (192269,192284,192285,192338,192339,192488,192254,192255,192336,192501,192502); -DELETE FROM `gameobject` WHERE `id` BETWEEN 192349 AND 192379; +DELETE FROM `gameobject` WHERE `id` IN (192254,192255,192269,192284,192285,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309,192310,192312,192313,192314,192316,192317,192318,192319,192320,192321, + 192322,192323,192324,192325,192326,192327,192328,192329,192330,192331,192332,192333,192334,192335,192336,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356, + 192357,192358,192359,192360,192361,192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192487,192488,192501, + 192502); DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+115; INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES -- Fortress Banners "Alliance" @@ -330,7 +332,7 @@ INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x` (@OGUID+115,192502,571,1,128,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1); SET @OGUID := 280000; -DELETE FROM `gameobject` WHERE `id` IN (192458,192459,192460,192461,192289,192290,192434,192435,192280,192283,192425,192426,192427,192428,192288,192291); +DELETE FROM `gameobject` WHERE `id` IN (192458,192459,192460,192461,192289,192290,192434,192435,192280,192283,192425,192426,192427,192428,192288,192291,192400,192401,192281,192282); INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES -- The Sunken Ring "Horde" (@OGUID+0,192458,571,1,16,4811.4,2441.9,358.207,-2.0333,0,0,0,1,180,0,1), diff --git a/Wintergrasp_temp/Strings.sql b/Wintergrasp_temp/Strings.sql index 5be8799aeb..43038cc9fb 100644 --- a/Wintergrasp_temp/Strings.sql +++ b/Wintergrasp_temp/Strings.sql @@ -11,7 +11,7 @@ -- 'You have reached Rank 2: First Lieutenant' Sent to player by raid leader -- Wintergrasp coreside texts -DELETE FROM trinity_string WHERE entry BETWEEN 12050 AND 12072; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 12050 AND 12072; INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES (12050, '%s has been captured by %s ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (12051, '%s is under attack by %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), @@ -38,7 +38,7 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_ (12072, 'The Wintergrasp fortress has been captured by %s !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -- Wintergrasp script texts -DELETE FROM `script_texts` WHERE entry BETWEEN -1850500 AND -1850507; +DELETE FROM `script_texts` WHERE entry BETWEEN -1850507 AND -1850500; INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`)VALUES (0, -1850500, 'Guide me to the Fortress Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), (0, -1850501, 'Guide me to the Sunken Ring Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index 7cfcac4daa..c55f86fcee 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -10,9 +10,9 @@ UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,1 193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, 193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, 193164,193165); -- nameless GOs - + UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31841; -- Taunka Spirit Guide -UPDATE `creature_template` SET `exp`= WHERE `entry`=31842; -- Dwarven Spirit Guide +UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31842; -- Dwarven Spirit Guide UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31052; -- Bowyer Randolph UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=39172; -- Marshal Magruder UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry`=30488; -- Travis Day @@ -74,14 +74,3 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (39173,29261,0,1,0, NULL), -- Champion Ros'slai (30740,0,0,257,375, NULL); -- Valiance Expedition Champion --- Wintergrasp creature addon cleanups -DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131258 AND 131322; -DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131326 AND 131328; -DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131350 AND 131353; -DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131376 AND 131380; -DELETE FROM `creature_addon` WHERE `guid`=131392; -DELETE FROM `creature_addon` WHERE `guid`=131437; -DELETE FROM `creature_addon` WHERE `guid`=131458; -DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131631 AND 131634; -DELETE FROM `creature_addon` WHERE `guid`=131706; -DELETE FROM `creature_addon` WHERE `guid` BETWEEN 131727 AND 131731; From afd9c28d8e69885e9e58e7241d9ea6d21a7b294d Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 3 Jul 2011 19:18:20 +0100 Subject: [PATCH 085/147] - Rename scriptnames to keep naming consistent; - Template updates and spells to WG vehicles; - Cleanup SQL files a bit. --- Wintergrasp_temp/Gossips.sql | 70 +-- Wintergrasp_temp/Misc.sql | 24 +- Wintergrasp_temp/Quests.sql | 24 +- Wintergrasp_temp/SAI.sql | 3 + Wintergrasp_temp/Scriptnames.sql | 20 +- Wintergrasp_temp/Spells.txt | 8 +- Wintergrasp_temp/Strings.sql | 13 +- Wintergrasp_temp/Template_update.sql | 66 +-- src/server/scripts/Northrend/wintergrasp.cpp | 429 +++++++++++++++++++ 9 files changed, 549 insertions(+), 108 deletions(-) create mode 100644 src/server/scripts/Northrend/wintergrasp.cpp diff --git a/Wintergrasp_temp/Gossips.sql b/Wintergrasp_temp/Gossips.sql index 90f903b771..3f9ce230d5 100644 --- a/Wintergrasp_temp/Gossips.sql +++ b/Wintergrasp_temp/Gossips.sql @@ -1,53 +1,54 @@ --- Gossip Menu insert from sniff -DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9904,13759); -DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9904,13761); -DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9923,14172); -DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (10229,14221); +-- Template gossip updates +UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; +UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; --- Creature Gossip_menu_option Update from sniff -DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9904); +-- Gossip Menu +DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; +DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; +DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172; +DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9904,13759), +(9904,13761), +(9923,14172), +(10229,14221); + +-- Gossip Menu Option +DELETE FROM `gossip_menu_option` WHERE `menu_id`=9904; +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); 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 (9904,0,0, 'I would like to build a catapult.',1,1,0,0,0,0, ''), (9904,1,0, 'I would like to build a demolisher.',1,1,0,0,0,0, ''), -(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''); +(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''), +(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), +(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); + +-- Conditions -- Add gossip_menu condition for 9904 Horde DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9904; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9923; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9904; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9923; INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES (14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal (14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant (14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal -(14,9904,13761,0,11,55629); -- Must not have Rank 2: First Lieutenant +(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant -- Add gossip_menu condition for 9923 Alliance -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9923; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES (14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal (14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant (14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal -(14,9923,14172,0,11,55629); -- Must not have Rank 2: First Lieutenant +(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant -- Add conditions to gossip options horde -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9904; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES -(15,9904,0,0,1,33280,0), -- Must have reached Rank 1: Corporal -(15,9904,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant -(15,9904,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant -(15,9904,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant +(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant -- Add conditions to gossip options alliance -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9923; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES -(15,9923,0,0,1,33280,0), -- Must have reached Rank 1: Corporal -(15,9923,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant -(15,9923,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant -(15,9923,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant - --- Add Missing Horde Spirt Healer options Wintergrasp -DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); -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 -(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), -(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); +(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant /* -- Add scripts to Wintergrasp spirit guide gossip -- !!!should be scripted by SAI or cpp script!!! @@ -85,4 +86,3 @@ INSERT INTO `gossip_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`) VAL (990402,0,33,0,0),(990402,0,15,61408,1), (990403,0,33,0,0),(990403,0,15,56661,1); */ - diff --git a/Wintergrasp_temp/Misc.sql b/Wintergrasp_temp/Misc.sql index 42817764fe..d68853b6c0 100644 --- a/Wintergrasp_temp/Misc.sql +++ b/Wintergrasp_temp/Misc.sql @@ -3,10 +3,10 @@ DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54640; INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES (54640,54643,0, 'WG teleporter'); --- 58730 Restricted Flight Area (Wintergrasp Eject) -DELETE FROM `spell_area` WHERE `spell`=58730; +-- Spell area +DELETE FROM `spell_area` WHERE `spell` IN (58730,57940); INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES -(58730,4581,0,0,0,0,0,2,1), +(58730,4581,0,0,0,0,0,2,1), -- Restricted Flight Area (Wintergrasp Eject) (58730,4539,0,0,0,0,0,2,1), (58730,4197,0,0,0,0,0,2,1), (58730,4585,0,0,0,0,0,2,1), @@ -16,12 +16,8 @@ INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`que (58730,4589,0,0,0,0,0,2,1), (58730,4575,0,0,0,0,0,2,1), (58730,4538,0,0,0,0,0,2,1), -(58730,4577,0,0,0,0,0,2,1); - --- 57940 Essence of Wintergrasp -DELETE FROM `spell_area` WHERE `spell`=57940; -INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES -(57940,65,0,0,0,0,0,2,1), +(58730,4577,0,0,0,0,0,2,1), +(57940,65,0,0,0,0,0,2,1), -- Essence of Wintergrasp (57940,66,0,0,0,0,0,2,1), (57940,67,0,0,0,0,0,2,1), (57940,206,0,0,0,0,0,2,1), @@ -48,12 +44,12 @@ INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`que (57940,4494,0,0,0,0,0,2,1), (57940,4603,0,0,0,0,0,2,1); --- 49899 Activate Robotic Arms +-- Spell scripts DELETE FROM `spell_scripts` WHERE `id`=49899; INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES -(49899,0,1,406,0,0,0,0,0,0); +(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms --- Add Spell Target position for Wintergrasp Graveyard spells +-- Spell Target position for Wintergrasp Graveyard spells DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769); INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES (59760,571,5537.986,2897.493,517.057,4.819249), -- Teleport: Fortress Graveyard @@ -63,7 +59,3 @@ INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`targ (59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611" (59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612" (59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone - - - - diff --git a/Wintergrasp_temp/Quests.sql b/Wintergrasp_temp/Quests.sql index 277f9ebb03..75f2e93180 100644 --- a/Wintergrasp_temp/Quests.sql +++ b/Wintergrasp_temp/Quests.sql @@ -1,14 +1,16 @@ -- Wintergrasp Quests - Horde -UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180, 13178); -UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185, 13223); -UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192, 13202); -UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193, 13199); -UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200, 13191); -UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201, 13194); +UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180,13178); -- Slay them all! +UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185,13223); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201,13194); -- Healing with Roses +UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193,13199); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192,13202); -- Warding/Jinxing the Walls +UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200,13191); -- Fueling the Demolishers -- Wintergrasp Quests - Alliance -UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179, 13177); -UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186, 13222); -UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195, 13156); -UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196, 13154); -UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198, 13153); \ No newline at end of file +UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179,13177); -- No Mercy for the Merciless +UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186,13222); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195,13156); -- A Rare Herb +UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196,13154); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198,13153); -- Warding the Warriors + +-- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already? diff --git a/Wintergrasp_temp/SAI.sql b/Wintergrasp_temp/SAI.sql index 098565ce01..71d1b8de81 100644 --- a/Wintergrasp_temp/SAI.sql +++ b/Wintergrasp_temp/SAI.sql @@ -1,6 +1,9 @@ +/* +These two npcs already have a scriptname assigned (npc_wg_spiritguide). That core script should make these npcs cast the 22011 spell. -- Spirit healers SAI UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (31841,31842); DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (31841,31842); INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES (31841,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'cast Spirit Heal Channel every 30 sec'), (31842,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Dwarven Spirit Guide - cast Spirit Heal Channel every 30 sec'); +*/ diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql index f8eb806fc6..f9a121b3e7 100644 --- a/Wintergrasp_temp/Scriptnames.sql +++ b/Wintergrasp_temp/Scriptnames.sql @@ -1,14 +1,14 @@ --- Wintergrasp queue template NPCs -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_dalaran_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); +-- Wintergrasp queue template NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- --- Wintergrasp spiritguide NPC script -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_spiritguide' WHERE `entry` IN (31841,31842); +-- Wintergrasp spirit guide NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry` IN (31841,31842); -- Taunka Spirit Guide, Dwarven Spirit Guide --- Wintergrasp demolisher engineer NPC script -UPDATE `creature_template` SET `ScriptName`= 'npc_demolisher_engineerer' WHERE `entry` IN (30400,30499); +-- Wintergrasp demolisher engineer NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer --- Wintergrasp vehicle teleport -UPDATE `gameobject_template` SET `ScriptName`= 'go_wintergrasp_teleporter' WHERE `entry`=192951; +-- Wintergrasp Questgiver NPCs script +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31052,31091,31036,31101,31107,31053,31051,31153,31151,31102,31106); --- Wintergrasp Questgiver NPCs - requires binding to Wintergrasp questgiver script -UPDATE `creature_template` SET `ScriptName`= 'npc_wintergrasp_quest_giver' WHERE `entry` IN (31054, 31052, 31091, 31036, 31101, 31107, 31053, 31051, 31153, 31151, 31102, 31106); +-- Wintergrasp vehicle teleport GO script +UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.txt index b70507e700..583e46db04 100644 --- a/Wintergrasp_temp/Spells.txt +++ b/Wintergrasp_temp/Spells.txt @@ -20,4 +20,10 @@ Wintergrasp Vehicle On spawn entries: 28312,27881,28094,32627 set x,y,z,o to nearest trigger entry: 23472 make player cast 60968 on vehicle aura 14267 on self if player is horde -aura 14268 on self if player is alliance \ No newline at end of file +aura 14268 on self if player is alliance + +Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): +61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) +56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) +14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) +14267 (Horde Flag) \ No newline at end of file diff --git a/Wintergrasp_temp/Strings.sql b/Wintergrasp_temp/Strings.sql index 43038cc9fb..090c5350c7 100644 --- a/Wintergrasp_temp/Strings.sql +++ b/Wintergrasp_temp/Strings.sql @@ -47,15 +47,16 @@ INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1` (0, -1850504, 'Guide me to the Eastspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), (0, -1850505, 'Guide me back to the Horde landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), (0, -1850506, 'Guide me back to the Alliance landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text) +(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text, maybe "Get in the queue for Wintergrasp."?) -- New support-commands for battlefield class DELETE FROM `command` WHERE name IN ('bf start', 'bf stop', 'bf enable', 'bf switch', 'bf timer'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf start',3,'Syntaxe: .bf start #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf stop',3,'Syntaxe: .bf stop #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf enable',3,'Syntaxe: .bf enable #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf switch',3,'Syntaxe: .bf switch #battleid'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES ('bf timer',3,'Syntaxe: .bf timer #battleid #timer'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('bf start',3,'Syntax: .bf start #battleid'), +('bf stop',3,'Syntax: .bf stop #battleid'), +('bf enable',3,'Syntax: .bf enable #battleid'), +('bf switch',3,'Syntax: .bf switch #battleid'), +('bf timer',3,'Syntax: .bf timer #battleid #timer'); -- NPC talk text insert from sniff DELETE FROM `creature_text` WHERE `entry`=15214 AND `groupid` BETWEEN 0 AND 30; diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index c55f86fcee..1b1ff6d130 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -1,15 +1,14 @@ UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, - 192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner +192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner - UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, - 192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, - 192255,192336); -- Horde Banner - +192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, +192255,192336); -- Horde Banner + UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, - 193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, - 193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, - 193164,193165); -- nameless GOs +193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, +193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, +193164,193165); -- nameless GOs UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31841; -- Taunka Spirit Guide UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31842; -- Dwarven Spirit Guide @@ -21,31 +20,20 @@ UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4 WHERE `entry`=311 UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms - -/* -Sniff check these --- Wintergrasp Cannons (Spell 51421 : Fire Cannon) -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735 WHERE `entry`=28366; -- *** WRONG **** -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry` IN (30499,30740, 28319); -- Alliance -UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry` IN (30400,30739, 32629); -- Horde - --- Added by Malcrom -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry` IN (28312); -- Alliance -UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry` IN (32627); -- Horde - --- Wintergrasp Catapult speed adjustments -UPDATE `creature_template` SET `speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; - --- Creature Gossip_menu_id Update from sniff -UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; -UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; -*/ +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher +UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31347; -- Champion Ros'slai +UPDATE `creature_model_info` SET `bounding_radius`=0.305,`combat_reach`=5,`gender`=2 WHERE `modelid`=25301; -- Wintergrasp Siege Turret -DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740); +DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740,32629,28319,28366,32627,28312,28094,27881,30739); INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (31841,0,0,1,0, '58729'), -- Taunka Spirit Guide (Spiritual Immunity, Spirit Heal Channel) FIX: Do we need the spell that revives players here (22011)? It has a duration (found in sniffs). (31842,0,0,1,0, '58729'), -- Dwarven Spirit Guide This spell (and the spell it triggers, are used in the "ressurect system" in Battleground.cpp @@ -72,5 +60,25 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (31151,0,0,257,0, NULL), -- Tactical Officer Kilrath (32296,27245,0,1,0, NULL), -- Stone Guard Mukar (39173,29261,0,1,0, NULL), -- Champion Ros'slai -(30740,0,0,257,375, NULL); -- Valiance Expedition Champion +(30740,0,0,257,375, NULL), -- Valiance Expedition Champion +(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon +(32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine +(28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine +(28094,0,0,257,0, NULL), -- Wintergrasp Demolisher +(27881,0,0,257,0, NULL), -- Wintergrasp Catapult +(30739,0,0,257,375, NULL); -- Warsong Champion +-- Wintergrasp vehicles: +UPDATE `creature_template` SET `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon (Both) +UPDATE `creature_template` SET `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H) +UPDATE `creature_template` SET `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A) +UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H) +UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A) +UPDATE `creature_template` SET `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher (H) +UPDATE `creature_template` SET `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult (Both) + +-- Note: Siege Engines, Demolisher faction is guess (vehicles get the faction of his driver) +-- Demolisher spell positions is not confirmed +-- Wintergrasp Tower Cannon H: 1735 A: 1732 diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp new file mode 100644 index 0000000000..3e35500a55 --- /dev/null +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -0,0 +1,429 @@ +/* Copyright (C) 2008 - 2009 Trinity + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ScriptPCH.h" +#include "BattlefieldMgr.h" +#include "BattlefieldWG.h" +#include "Battlefield.h" +#include "ScriptSystem.h" +#include "WorldSession.h" +#include "ObjectMgr.h" + +#define GOSSIP_HELLO_DEMO1 "Build catapult." +#define GOSSIP_HELLO_DEMO2 "Build demolisher." +#define GOSSIP_HELLO_DEMO3 "Build siege engine." +#define GOSSIP_HELLO_DEMO4 "I cannot build more!" + +enum eWGqueuenpctext +{ + WG_NPCQUEUE_TEXT_H_NOWAR = 14775, + WG_NPCQUEUE_TEXT_H_QUEUE = 14790, + WG_NPCQUEUE_TEXT_H_WAR = 14777, + WG_NPCQUEUE_TEXT_A_NOWAR = 14782, + WG_NPCQUEUE_TEXT_A_QUEUE = 14791, + WG_NPCQUEUE_TEXT_A_WAR = 14781, + WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, +}; + +enum eWGdata +{ + // engineer spells + SPELL_BUILD_CATAPULT = 56663, + SPELL_BUILD_DEMOLISHER = 56575, + SPELL_BUILD_SIEGE_ENGINE = 61408, + SPELL_BUILD_SIEGE_ENGINE2 = 56661, // does it's really needed here? + SPELL_ACTIVATE_ROBOTIC_ARMS = 49899, + + // teleporter spells + SPELL_VEHICLE_TELEPORT = 49759, +}; + +class npc_wg_demolisher_engineer : public CreatureScript +{ + public: + npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + + if (!BfWG) + return true; + + if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + { + if (pPlayer->HasAura(SPELL_CORPORAL)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + else if (pPlayer->HasAura(SPELL_LIEUTENANT)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + } + } + else + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + + if (!BfWG) + return true; + + if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + { + switch (uiAction - GOSSIP_ACTION_INFO_DEF) + { + case 0: + pPlayer->CastSpell(pPlayer, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); + break; + case 1: + pPlayer->CastSpell(pPlayer, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); + break; + case 2: + pPlayer->CastSpell(pPlayer, pPlayer->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); + break; + } + //spell 49899 Emote : 406 from sniff + //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); + if (Creature* creature = pCreature->FindNearestCreature(27852, 30.0f, true)) + creature->CastSpell(creature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); + } + return true; + } +}; + +class npc_wg_spirit_guide : public CreatureScript +{ + public: + npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + GraveYardVect gy = BfWG->GetGraveYardVect(); + for (uint8 i = 0; i < gy.size(); i++) + { + if (gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, + GOSSIP_ACTION_INFO_DEF + i); + } + } + } + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + GraveYardVect gy = BfWG->GetGraveYardVect(); + for (uint8 i = 0; i < gy.size(); i++) + { + if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + { + WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); + pPlayer->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); + } + } + } + return true; + } +}; + +class npc_wg_queue : public CreatureScript +{ + public: + npc_wg_queue() : CreatureScript("npc_wg_queue") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + + if (BfWG->IsWarTime()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); + } + else + { + uint32 uiTime = BfWG->GetTimer() / 1000; + pPlayer->SendUpdateWorldState(4354, time(NULL) + uiTime); + if (uiTime < 15 * MINUTE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); + } + else + { + pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); + } + } + } + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + if (BfWG->IsWarTime()) + { + BfWG->InvitePlayerToWar(pPlayer); + } + else + { + uint32 uiTime = BfWG->GetTimer() / 1000; + if (uiTime < 15 * MINUTE) + BfWG->InvitePlayerToQueue(pPlayer); + } + } + return true; + } +}; + +const uint32 Vehicules[4] = { 32627, 28312, 28094, 27881 }; + +class go_wg_vehicle_teleporter : public GameObjectScript +{ + public: + go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") + { + } + + struct go_wg_vehicle_teleporterAI : public GameObjectAI + { + go_wg_vehicle_teleporterAI(GameObject* g) : GameObjectAI(g) + { + uiCheckTimer = 1000; + } + + void UpdateAI(const uint32 diff) + { + if (uiCheckTimer <= diff) + { + for (uint8 i = 0; i < 4; i++) + if (Creature* pVehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) + if (!pVehicle->HasAura(SPELL_VEHICLE_TELEPORT)) + { + if (pVehicle->GetVehicle()) + { + if (Unit* player = pVehicle->GetVehicle()->GetPassenger(0)) + { + uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); + uint32 plfaction = player->getFaction(); + if (gofaction == plfaction) + { + pVehicle->CastSpell(pVehicle, SPELL_VEHICLE_TELEPORT, true); + if (Creature* TargetTeleport = pVehicle->FindNearestCreature(23472, 100.0f, true)) + { + float x, y, z, o; + TargetTeleport->GetPosition(x, y, z, o); + pVehicle->GetVehicle()->TeleportVehicle(x, y, z, o); + } + } + } + } + } + uiCheckTimer = 1000; + } + else + uiCheckTimer -= diff; + } + private: + uint32 uiCheckTimer; + }; + + GameObjectAI *GetAI(GameObject* go) const + { + return new go_wg_vehicle_teleporterAI(go); + } +}; + +class npc_wg_quest_giver : public CreatureScript +{ + public: + npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") + { + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (BfWG) + { + if (pCreature->isQuestGiver()) + { + Object* pObject = (Object *) pCreature; + QuestRelations* pObjectQR = sObjectMgr->GetCreatureQuestRelationMap(); + QuestRelations* pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); + + QuestMenu & qm = pPlayer->PlayerTalkClass->GetQuestMenu(); + qm.ClearMenu(); + + for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) + { + uint32 quest_id = i->second; + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + if (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_INCOMPLETE) + qm.AddMenuItem(quest_id, 4); + } + + for (QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) + { + uint32 quest_id = i->second; + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); + if (!pQuest) + continue; + + switch (quest_id) + { + // Horde attacker + case 13193: + case 13202: + case 13180: + case 13200: + case 13201: + case 13223: + if (BfWG->GetAttackerTeam() == TEAM_HORDE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + // Horde defender + case 13199: + case 13192: + case 13178: + case 13191: + case 13194: + case 13539: + case 13185: + if (BfWG->GetDefenderTeam() == TEAM_HORDE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + // Alliance attacker + case 13196: + case 13198: + case 13179: + case 13222: + case 13195: + if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + // Alliance defender + case 13154: + case 13153: + case 13177: + case 13538: + case 13186: + case 13156: + if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE) + { + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + } + break; + default: + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + qm.AddMenuItem(quest_id, 2); + break; + } + } + } + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + return true; + } +}; + +void AddSC_wintergrasp() +{ + new npc_wg_queue(); + new npc_wg_spirit_guide(); + new npc_wg_demolisher_engineer(); + new go_wg_vehicle_teleporter(); + new npc_wg_quest_giver(); +} From ff85ebe632a2aa3ea87d97dfd684c6f7c94552f5 Mon Sep 17 00:00:00 2001 From: Shocker Date: Tue, 5 Jul 2011 01:48:03 +0300 Subject: [PATCH 086/147] Fix Didn't Stand a Chance achievement --- ..._05_00_world_achievement_criteria_data.sql | 4 +++ .../world/2011_07_05_00_world_disables.sql | 1 + src/server/scripts/Northrend/wintergrasp.cpp | 25 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql create mode 100644 sql/updates/world/2011_07_05_00_world_disables.sql diff --git a/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql b/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql new file mode 100644 index 0000000000..fa995e7804 --- /dev/null +++ b/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `achievement_criteria_data` WHERE criteria_id = 7703; +INSERT INTO `achievement_criteria_data` VALUES +(7703, 6, 4197, 0, ''), +(7703, 11, 0, 0, 'achievement_wg_didnt_stand_a_chance'); diff --git a/sql/updates/world/2011_07_05_00_world_disables.sql b/sql/updates/world/2011_07_05_00_world_disables.sql new file mode 100644 index 0000000000..fa5010b669 --- /dev/null +++ b/sql/updates/world/2011_07_05_00_world_disables.sql @@ -0,0 +1 @@ +DELETE FROM `disables` WHERE `entry` = 7703 AND `sourceType` = 4; diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 3e35500a55..a11a47a19f 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -419,6 +419,30 @@ class npc_wg_quest_giver : public CreatureScript } }; +class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript +{ +public: + achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { } + + bool OnCheck(Player* source, Unit* target) + { + if (!target) + return false; + + if (Player* victim = target->ToPlayer()) + { + if (!victim->IsMounted()) + return false; + + if (Vehicle* vehicle = source->GetVehicle()) + if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon + return true; + } + + return false; + } +}; + void AddSC_wintergrasp() { new npc_wg_queue(); @@ -426,4 +450,5 @@ void AddSC_wintergrasp() new npc_wg_demolisher_engineer(); new go_wg_vehicle_teleporter(); new npc_wg_quest_giver(); + new achievement_wg_didnt_stand_a_chance(); } From 23b59c560323a8414e2067bb53731e3e73d30e5a Mon Sep 17 00:00:00 2001 From: tobmaps Date: Wed, 27 Jul 2011 04:07:24 +0700 Subject: [PATCH 087/147] Core/Battlefield * Fix compile * Restored GO damage events after recent changes --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 11 ++++++++--- src/server/game/Battlefield/Zones/BattlefieldWG.h | 13 +++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 0c44ea766a..81e661bd02 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -985,13 +985,18 @@ void BattlefieldWG::AddBrokenTower(TeamId team) } } -void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId) +void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) { if (!obj || !IsWarTime()) return; + // We handle only gameobjects here + GameObject* go = obj->ToGameObject(); + if (!go) + return; + // On click on titan relic - if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) + if (go->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) { // Check that the door is break if (m_CanClickOnOrb) @@ -1003,7 +1008,7 @@ void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId) // if destroy or damage event, search the wall/tower and update worldstate/send warning message for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { - if (obj->GetEntry() == (*itr)->m_Build->GetEntry()) + if (go->GetEntry() == (*itr)->m_Build->GetEntry()) { if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId) (*itr)->Damaged(); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 1e3d7a93d9..74974041fa 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -412,7 +412,7 @@ class BattlefieldWG : public Battlefield void PromotePlayer(Player *killer); void UpdateTenacity(); - void ProcessEvent(GameObject *obj, uint32 eventId); + void ProcessEvent(WorldObject *obj, uint32 eventId); protected: bool m_CanClickOnOrb; @@ -1366,7 +1366,7 @@ struct BfWGGameObjectBuilding } // Rebuild gameobject - m_Build->Rebuild(); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); // Update worldstate m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); @@ -1469,18 +1469,15 @@ struct BfWGGameObjectBuilding { case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT: - m_Build->Rebuild(); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); break; case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY: - m_Build->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); - m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED); - m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.destroyedDisplayId); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED); break; case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE: - m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); - m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.damagedDisplayId); + m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); break; } } From c28a8aafc0cd0f2b8bd6aa4c5106eb52a4b768b2 Mon Sep 17 00:00:00 2001 From: tobmaps Date: Wed, 27 Jul 2011 04:07:46 +0700 Subject: [PATCH 088/147] Core/Battlefield * Fix battle start * cleanups and code style fixes --- src/server/game/Battlefield/Battlefield.cpp | 1151 +++++++++++++++++ .../game/Battlefield/Zones/BattlefieldWG.cpp | 88 +- .../game/Battlefield/Zones/BattlefieldWG.h | 48 +- 3 files changed, 1219 insertions(+), 68 deletions(-) create mode 100644 src/server/game/Battlefield/Battlefield.cpp diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp new file mode 100644 index 0000000000..62aebfe517 --- /dev/null +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -0,0 +1,1151 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Map.h" +#include "MapManager.h" +#include "Group.h" +#include "WorldPacket.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "CellImpl.h" +#include "CreatureTextMgr.h" + +#include "GroupMgr.h" + +Battlefield::Battlefield() +{ + m_Timer = 0; + m_enable = true; + m_BattlefieldActive = false; + m_DefenderTeam = TEAM_NEUTRAL; + + m_TypeId = 0; + m_BattleId = 0; + m_ZoneId = 0; + m_MapId = 0; + m_MaxPlayer = 0; + m_MinPlayer = 0; + m_BattleTime = 0; + m_NoWarBattleTime = 0; + m_TimeForAcceptInvite = 20; + m_uiKickDontAcceptTimer = 1000; + + m_uiKickAfkTimer = 1000; + + m_LastResurectTimer = 30 * IN_MILLISECONDS; + m_StartGroupingTimer = 0; + m_StartGrouping = false; + StalkerGuid = 0; +} + +Battlefield::~Battlefield() +{ +} + +void Battlefield::HandlePlayerEnterZone(Player *plr, uint32 /*zone */ ) +{ + //If battle is start, + // if it not fully > invite player to join the war + // if it fully > announce to player that BF is full and kick after few second if he dont leave + if (IsWarTime()) + { + if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) //Not fully + { + InvitePlayerToWar(plr); + } + else //Full + { + //TODO:Send packet for announce it to player + m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + InvitePlayerToQueue(plr); + } + } + else + { + //If time left is <15 minutes invite player to join queue + if (m_Timer <= m_StartGroupingTimer) + InvitePlayerToQueue(plr); + } + + //Add player in list of player in zone + m_players[plr->GetTeamId()].insert(plr->GetGUID()); + OnPlayerEnterZone(plr); //for scripting +} + +//Called when a player leave the zone +void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ ) +{ + if (IsWarTime()) + { + //if player is in war list + if (m_PlayersInWar[plr->GetTeamId()].find(plr->GetGUID()) != m_PlayersInWar[plr->GetTeamId()].end()) + { + m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID()); + plr->GetSession()->SendBfLeaveMessage(m_BattleId); + if (Group* group = GetGroupPlayer(plr->GetGUID(), plr->GetTeamId())) // remove from raid group if player is member + { + // I think that now is not a hack + if (!group->RemoveMember(plr->GetGUID())) // group was disbanded + { + m_Groups[plr->GetTeamId()].erase(group->GetGUID()); + group->SetBattlefieldGroup(NULL); + sGroupMgr->RemoveGroup(group); + delete group; + } + } + OnPlayerLeaveWar(plr); //For scripting + } + } + + for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) + itr->second->HandlePlayerLeave(plr); + + m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); + m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); + m_players[plr->GetTeamId()].erase(plr->GetGUID()); + SendRemoveWorldStates(plr); + RemovePlayerFromResurrectQueue(plr->GetGUID()); + OnPlayerLeaveZone(plr); //For scripting +} + +bool Battlefield::Update(uint32 diff) +{ + //When global timer is end + if (m_Timer <= diff) + { + //Here end of battle by timer + if (IsWarTime()) + EndBattle(true); + //Start of battle + else + StartBattle(); + } + else + m_Timer -= diff; + + //Some times before battle start invite player to queue + if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer) + { + m_StartGrouping = true; + InvitePlayerInZoneToQueue(); + OnStartGrouping(); // for scripting + } + + bool objective_changed = false; + if (IsWarTime()) + { + if (m_uiKickAfkTimer <= diff) + { + m_uiKickAfkTimer = 1000; + KickAfk(); + } + else + m_uiKickAfkTimer -= diff; + + //Here kick player witch dont have accept invitation to join the war when time is end (time of windows) + if (m_uiKickDontAcceptTimer <= diff) + { + for (int team = 0; team < 2; team++) + for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++) + if ((*itr).second <= time(NULL)) + KickPlayerFromBf((*itr).first); + InvitePlayerInZoneToWar(); + for (int team = 0; team < 2; team++) + for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++) + if ((*itr).second <= time(NULL)) + KickPlayerFromBf((*itr).first); + + m_uiKickDontAcceptTimer = 1000; + } + else + m_uiKickDontAcceptTimer -= diff; + + for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) + if (itr->second->Update(diff)) + objective_changed = true; + } + + + if (m_LastResurectTimer <= diff) + { + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + if (GetGraveYardById(i)) + m_GraveYardList[i]->Resurrect(); + m_LastResurectTimer = RESURRECTION_INTERVAL; + } + else + m_LastResurectTimer -= diff; + + return objective_changed; +} + +void Battlefield::InvitePlayerInZoneToQueue() +{ + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + InvitePlayerToQueue(plr); +} + +void Battlefield::InvitePlayerToQueue(Player *plr) +{ + if (m_PlayersInQueue[plr->GetTeamId()].count(plr->GetGUID())) + return; + + if (m_PlayersInQueue[plr->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[plr->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) + plr->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); +} + +void Battlefield::InvitePlayerInQueueToWar() +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + { + for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) + { + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + { + if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(plr); + else + { + //Full + } + } + } + m_PlayersInQueue[team].clear(); + } +} + +void Battlefield::InvitePlayerInZoneToWar() +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + { + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + { + if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + continue; + if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(plr); + else + { + //full + m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + } + } + } +} + +void Battlefield::InvitePlayerToWar(Player *plr) +{ + if (!plr) + return; + + // TODO : needed ? + if (plr->isInFlight()) + return; + + if (plr->InArena() || plr->GetBattleground()) + { + m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); + return; + } + + if (plr->getLevel() < m_MinLevel) + { + if (m_PlayersWillBeKick[plr->GetTeamId()].count(plr->GetGUID()) == 0) + m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + return; + } + //Check if player is not already in war + if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + return; + + m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); + m_InvitedPlayers[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; + plr->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); +} + +void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) +{ + if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL)) + StalkerGuid = creature->GetGUID(); + else + sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); +} + +void Battlefield::KickAfk() +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (plr->isAFK()) + KickPlayerFromBf(*itr); +} + +void Battlefield::KickPlayerFromBf(uint64 guid) +{ + if (Player* plr = sObjectAccessor->FindPlayer(guid)) + if (plr->GetZoneId() == GetZoneId()) + plr->TeleportTo(KickPosition); +} + +void Battlefield::StartBattle() +{ + if (m_BattlefieldActive) + return; + + for (int team = 0; team < BG_TEAMS_COUNT; team++) + { + m_PlayersInWar[team].clear(); + m_Groups[team].clear(); + } + + m_Timer = m_BattleTime; + m_BattlefieldActive = true; + + InvitePlayerInZoneToWar(); + InvitePlayerInQueueToWar(); + + PlaySoundToAll(BF_START); + + OnBattleStart(); +} + +void Battlefield::EndBattle(bool endbytimer) +{ + m_BattlefieldActive = false; + + m_StartGrouping = false; + + if (!endbytimer) + SetDefenderTeam(GetAttackerTeam()); + + if (GetDefenderTeam() == TEAM_ALLIANCE) + PlaySoundToAll(BF_ALLIANCE_WINS); // alliance wins sound + else + PlaySoundToAll(BF_HORDE_WINS); // horde wins sound + + OnBattleEnd(endbytimer); + + // reset bf timer + m_Timer = m_NoWarBattleTime; + SendInitWorldStatesToAll(); +} + +void Battlefield::PlaySoundToAll(uint32 SoundID) +{ + WorldPacket data; + data.Initialize(SMSG_PLAY_SOUND, 4); + data << uint32(SoundID); + + for (int team = 0; team < BG_TEAMS_COUNT; team++) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + { + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); + } +} + +bool Battlefield::HasPlayer(Player *plr) const +{ + return m_players[plr->GetTeamId()].find(plr->GetGUID()) != m_players[plr->GetTeamId()].end(); +} + +// Called in WorldSession::HandleBfQueueInviteResponse +void Battlefield::PlayerAcceptInviteToQueue(Player *plr) +{ + // Add player in queueVenez + m_PlayersInQueue[plr->GetTeamId()].insert(plr->GetGUID()); + // Send notification + plr->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); +} +// Called in WorldSession::HandleBfExitRequest +void Battlefield::AskToLeaveQueue(Player *plr) +{ + // Remove player from queue + m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); +} + +// Called in WorldSession::HandleBfEntryInviteResponse +void Battlefield::PlayerAcceptInviteToWar(Player *plr) +{ + if (!IsWarTime()) + return; + + if (AddOrSetPlayerToCorrectBfGroup(plr)) + { + plr->GetSession()->SendBfEntered(m_BattleId); + m_PlayersInWar[plr->GetTeamId()].insert(plr->GetGUID()); + m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); + //Remove player AFK + if (plr->isAFK()) + plr->ToggleAFK(); + + OnPlayerJoinWar(plr); //for scripting + } +} + +void Battlefield::TeamCastSpell(TeamId team, int32 spellId) +{ + if (spellId > 0) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->CastSpell(plr, (uint32) spellId, true); + else + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->RemoveAuraFromStack((uint32) - spellId); +} + +void Battlefield::BroadcastPacketZone(WorldPacket & data) const +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); +} + +void Battlefield::BroadcastPacketQueue(WorldPacket & data) const +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); +} + +void Battlefield::BroadcastPacketWar(WorldPacket & data) const +{ + for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) + for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->GetSession()->SendPacket(&data); +} + +WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg) +{ + WorldPacket data(SMSG_MESSAGECHAT, 200); + + data << uint8(CHAT_MSG_RAID_BOSS_EMOTE); + data << uint32(LANG_UNIVERSAL); + data << uint64(0); + data << uint32(0); // 2.1.0 + data << uint32(1); + data << uint8(0); + data << uint64(0); + data << uint32(strlen(msg.c_str()) + 1); + data << msg.c_str(); + data << uint8(0); + + return data; +} + +void Battlefield::SendWarningToAllInZone(uint32 entry) +{ + if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) + if (Creature* stalker = unit->ToCreature()) + // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/ + sCreatureTextMgr->SendChat(stalker, (uint8) entry, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE); +} + +/*void Battlefield::SendWarningToAllInWar(int32 entry,...) +{ + const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry); + va_list ap; + char str [1024]; + va_start(ap, entry); + vsnprintf(str,1024,format, ap); + va_end(ap); + std::string msg = (std::string)str; + + WorldPacket data = BuildWarningAnnPacket(msg); + BroadcastPacketWar(data); +}*/ +void Battlefield::SendWarningToPlayer(Player *plr, uint32 entry) +{ + if (!plr) + return; + + if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) + if (Creature* stalker = unit->ToCreature()) + sCreatureTextMgr->SendChat(stalker, (uint8)entry, plr->GetGUID()); +} + +void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) +{ + for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) + for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->SendUpdateWorldState(field, value); +} + +void Battlefield::RegisterZone(uint32 zoneId) +{ + sBattlefieldMgr.AddZone(zoneId, this); +} + +void Battlefield::HideNpc(Creature *p_Creature) +{ + p_Creature->CombatStop(); + p_Creature->SetReactState(REACT_PASSIVE); + p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + p_Creature->SetPhaseMask(2, true); + p_Creature->DisappearAndDie(); + p_Creature->SetVisible(false); +} + +void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive) +{ + p_Creature->SetPhaseMask(1, true); + p_Creature->SetVisible(true); + p_Creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + if (!p_Creature->isAlive()) + p_Creature->Respawn(true); + if (p_Aggressive) + p_Creature->SetReactState(REACT_AGGRESSIVE); + else + { + p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + p_Creature->SetReactState(REACT_PASSIVE); + } +} + +//***************************************************** +//*******************Group System********************** +//***************************************************** +Group *Battlefield::GetFreeBfRaid(TeamId TeamId) +{ + //if found free group we return it + for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) + if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) + if (!group->IsFull()) + return group; + + return NULL; +} + +Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) +{ + for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) + if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) + if (group->IsMember(guid)) + return group; + + return NULL; +} + +bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *plr) +{ + if (!plr->IsInWorld()) + return false; + + if (Group* group = plr->GetGroup()) + group->RemoveMember(plr->GetGUID()); + + Group* group = GetFreeBfRaid(plr->GetTeamId()); + if (!group) + { + group = new Group; + group->SetBattlefieldGroup(this); + group->Create(plr); + sGroupMgr->AddGroup(group); + m_Groups[plr->GetTeamId()].insert(group->GetGUID()); + } + else if (group->IsMember(plr->GetGUID())) + { + uint8 subgroup = group->GetMemberGroup(plr->GetGUID()); + plr->SetBattlegroundOrBattlefieldRaid(group, subgroup); + } + else + group->AddMember(plr); + + return true; +} + +//***************End of Group System******************* + +//***************************************************** +//***************Spirit Guide System******************* +//***************************************************** +//-------------------- +//-Battlefield Method- +//-------------------- +BfGraveYard *Battlefield::GetGraveYardById(uint32 id) +{ + if (id < m_GraveYardList.size()) + { + if (m_GraveYardList[id]) + return m_GraveYardList[id]; + else + sLog->outError("Battlefield::GetGraveYardById Id:%u not existed", id); + } + else + sLog->outError("Battlefield::GetGraveYardById Id:%u cant be found", id); + + return NULL; +} + +WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *plr) +{ + BfGraveYard* closestGY = NULL; + float maxdist = -1; + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + { + if (m_GraveYardList[i]) + { + if (m_GraveYardList[i]->GetControlTeamId() != plr->GetTeamId()) + continue; + + float dist = m_GraveYardList[i]->GetDistance(plr); + if (dist < maxdist || maxdist < 0) + { + closestGY = m_GraveYardList[i]; + maxdist = dist; + } + } + } + + if (closestGY) + return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveYardId()); + + return NULL; +} + +void Battlefield::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +{ + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + { + if (!m_GraveYardList[i]) + continue; + + if (m_GraveYardList[i]->HasNpc(npc_guid)) + { + m_GraveYardList[i]->AddPlayer(player_guid); + break; + } + } +} + +void Battlefield::RemovePlayerFromResurrectQueue(uint64 player_guid) +{ + for (uint8 i = 0; i < m_GraveYardList.size(); i++) + { + if (!m_GraveYardList[i]) + continue; + + if (m_GraveYardList[i]->HasPlayer(player_guid)) + { + m_GraveYardList[i]->RemovePlayer(player_guid); + break; + } + } +} + +void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid) +{ + sLog->outError("SendAreaSpiritHealerQueryOpcode"); + WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); + uint32 time = m_LastResurectTimer; // resurrect every 30 seconds + + data << guid << time; + ASSERT(pl && pl->GetSession()); + pl->GetSession()->SendPacket(&data); +} + +bool Battlefield::IncrementQuest(Player *player, uint32 quest, bool complete) +{ + if (!player) + return false; + + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); + if (!pQuest || player->GetQuestStatus(quest) == QUEST_STATUS_NONE) + return false; + + if (complete) + { + player->CompleteQuest(quest); + return true; + } + else + { + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + { + int32 creature = pQuest->ReqCreatureOrGOId[i]; + if (uint32 spell_id = pQuest->ReqSpell[i]) + { + player->CastedCreatureOrGO(creature, 0, spell_id); + return true; + } + else if (creature > 0) + { + player->KilledMonsterCredit(creature, 0); + return true; + } + else if (creature < 0) + { + player->CastedCreatureOrGO(creature, 0, 0); + return true; + } + } + } + return false; +} + +//-------------------- +//-BfGraveYard Method- +//-------------------- +BfGraveYard::BfGraveYard(Battlefield *Bf) +{ + m_Bf = Bf; + m_GraveyardId = 0; + m_ControlTeam = TEAM_NEUTRAL; + m_SpiritGuide[0] = NULL; + m_SpiritGuide[1] = NULL; + m_ResurrectQueue.clear(); +} + +void BfGraveYard::Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy) +{ + m_ControlTeam = startcontrol; + if (Creature* cre = m_Bf->SpawnCreature(horde_entry, x, y, z, o, TEAM_HORDE)) + { + m_SpiritGuide[TEAM_HORDE] = cre; + m_SpiritGuide[TEAM_HORDE]->SetReactState(REACT_PASSIVE); + if (m_ControlTeam == TEAM_ALLIANCE) + m_SpiritGuide[TEAM_HORDE]->SetVisible(false); + } + else + sLog->outError("BfGraveYard::Init can't spawn horde spiritguide %u", horde_entry); + + if (Creature* cre = m_Bf->SpawnCreature(alliance_entry, x, y, z, o, TEAM_ALLIANCE)) + { + m_SpiritGuide[TEAM_ALLIANCE] = cre; + m_SpiritGuide[TEAM_ALLIANCE]->SetReactState(REACT_PASSIVE); + if (m_ControlTeam == TEAM_HORDE) + m_SpiritGuide[TEAM_ALLIANCE]->SetVisible(false); + } + else + sLog->outError("BfGraveYard::Init can't spawn alliance spiritguide %u", alliance_entry); + + m_GraveyardId = gy; +} + +float BfGraveYard::GetDistance(Player *plr) +{ + const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); + return plr->GetDistance2d(ws->x, ws->y); +} + +void BfGraveYard::AddPlayer(uint64 player_guid) +{ + if (!m_ResurrectQueue.count(player_guid)) + { + m_ResurrectQueue.insert(player_guid); + + if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); + } +} + +void BfGraveYard::RemovePlayer(uint64 player_guid) +{ + m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); + + if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); +} + +void BfGraveYard::Resurrect() +{ + if (m_ResurrectQueue.empty()) + return; + + for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + { + // Get player object from his guid + Player* plr = sObjectMgr->GetPlayer(*itr); + if (!plr) + continue; + + // Check player isinworld and player is on good graveyard + if (plr->IsInWorld()) + if (m_SpiritGuide[m_ControlTeam]) + m_SpiritGuide[m_ControlTeam]->CastSpell(m_SpiritGuide[m_ControlTeam], SPELL_SPIRIT_HEAL, true); + + // Resurect player + plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); + plr->ResurrectPlayer(1.0f); + plr->CastSpell(plr, 6962, true); + plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true); + + sObjectAccessor->ConvertCorpseForPlayer(plr->GetGUID()); + } + + m_ResurrectQueue.clear(); +} + +// For changing graveyard control +void BfGraveYard::ChangeControl(TeamId team) +{ + // Guide switching + if (m_SpiritGuide[1 - team]) + m_SpiritGuide[1 - team]->SetVisible(false); + if (m_SpiritGuide[team]) + m_SpiritGuide[team]->SetVisible(true); + + m_ControlTeam = team; + // Teleport to other graveyard, player witch were on this graveyard + RelocateDeadPlayers(); +} + +void BfGraveYard::RelocateDeadPlayers() +{ + WorldSafeLocsEntry const* ClosestGrave = NULL; + for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + { + Player* plr = sObjectMgr->GetPlayer(*itr); + if (!plr) + continue; + + if (ClosestGrave) + plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + else + { + ClosestGrave = m_Bf->GetClosestGraveYard(plr); + if (ClosestGrave) + plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + } + } +} + +//***************End Spirit Guide system*************** + +//***************************************************** +//**********************Misc*************************** +//***************************************************** +//Method for spawn creature on map +Creature *Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team) +{ + return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team); +} + +Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) +{ + //Get map object + Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); + if (!map) + { + sLog->outError("Can't create creature entry: %u map not found", entry); + return 0; + } + + //Create creature + Creature* pCreature = new Creature; + if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) + { + sLog->outError("Can't create creature entry: %u", entry); + delete pCreature; + return NULL; + } + + pCreature->SetHomePosition(x, y, z, o); + + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); + if (!cinfo) + { + sLog->outErrorDb("Battleground::AddCreature: entry %u does not exist.", entry); + return NULL; + } + // force using DB speeds -- do we really need this? + pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk); + pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); + + // Set creature in world + map->Add(pCreature); + pCreature->setActive(true); + + return pCreature; +} + +// Method for spawning gameobject on map +GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o) +{ + // Get map object + Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571)); + if (!map) + return 0; + + // Create gameobject + GameObject* go = new GameObject; + if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) + { + sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry); + sLog->outError("Cannot create gameobject template %u! Battleground not created!", entry); + delete go; + return NULL; + } + + // Add in the world + map->Add(go); + go->setActive(true); + return go; +} + +//***************************************************** +//*******************CapturePoint********************** +//***************************************************** + +BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) +{ + m_team = TEAM_NEUTRAL; + m_value = 0; + m_maxValue = 0; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL; + m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL; + m_capturePointEntry = 0; + m_neutralValuePct = 0; + m_maxSpeed = 0; +} + +bool BfCapturePoint::HandlePlayerEnter(Player *plr) +{ + if (m_capturePoint) + { + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); + } + return m_activePlayers[plr->GetTeamId()].insert(plr->GetGUID()).second; +} + +void BfCapturePoint::HandlePlayerLeave(Player *plr) +{ + if (m_capturePoint) + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + m_activePlayers[plr->GetTeamId()].erase(plr->GetGUID()); +} + +void BfCapturePoint::SendChangePhase() +{ + if (!m_capturePoint) + return; + + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); + // send these updates to only the ones in this objective + SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + // send this too, sometimes it resets :S + SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); +} + +bool BfCapturePoint::SetCapturePointData(uint32 entry, uint32 /*map */ , float x, float y, float z, float o) +{ + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", entry); + + // check info existence + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) + { + sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); + return false; + } + m_capturePoint = m_Bf->SpawnGameObject(entry, x, y, z, o); + if (m_capturePoint) + { + // get the needed values from goinfo + m_maxValue = goinfo->capturePoint.maxTime; + m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); + m_neutralValuePct = goinfo->capturePoint.neutralPercent; + m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; + m_capturePointEntry = entry; + if (m_team == TEAM_ALLIANCE) + { + m_value = m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; + } + else + { + m_value = -m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; + } + return true; + } + + return false; +} + +bool BfCapturePoint::DelCapturePoint() +{ + if (m_capturePoint) + { + m_capturePoint->SetRespawnTime(0); // not save respawn time + m_capturePoint->Delete(); + m_capturePoint = NULL; + } + + return true; +} + +bool BfCapturePoint::Update(uint32 diff) +{ + if (!m_capturePoint) + return false; + + float radius = m_capturePoint->GetGOInfo()->capturePoint.radius; + + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) + HandlePlayerLeave(plr); + + std::list < Player * >players; + Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); + Trinity::PlayerListSearcher < Trinity::AnyPlayerInObjectRangeCheck > searcher(m_capturePoint, players, checker); + m_capturePoint->VisitNearbyWorldObject(radius, searcher); + + for (std::list < Player * >::iterator itr = players.begin(); itr != players.end(); ++itr) + if ((*itr)->IsOutdoorPvPActive()) + if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second) + HandlePlayerEnter(*itr); + + // get the difference of numbers + float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL; + if (!fact_diff) + return false; + + uint32 Challenger = 0; + float maxDiff = m_maxSpeed * diff; + + if (fact_diff < 0) + { + // horde is in majority, but it's already horde-controlled -> no change + if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE && m_value <= -m_maxValue) + return false; + + if (fact_diff < -maxDiff) + fact_diff = -maxDiff; + + Challenger = HORDE; + } + else + { + // ally is in majority, but it's already ally-controlled -> no change + if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue) + return false; + + if (fact_diff > maxDiff) + fact_diff = maxDiff; + + Challenger = ALLIANCE; + } + + float oldValue = m_value; + TeamId oldTeam = m_team; + + m_OldState = m_State; + + m_value += fact_diff; + + if (m_value < -m_minValue) // red + { + if (m_value < -m_maxValue) + m_value = -m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; + m_team = TEAM_HORDE; + } + else if (m_value > m_minValue) // blue + { + if (m_value > m_maxValue) + m_value = m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; + m_team = TEAM_ALLIANCE; + } + else if (oldValue * m_value <= 0) // grey, go through mid point + { + // if challenger is ally, then n->a challenge + if (Challenger == ALLIANCE) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE; + // if challenger is horde, then n->h challenge + else if (Challenger == HORDE) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE; + m_team = TEAM_NEUTRAL; + } + else // grey, did not go through mid point + { + // old phase and current are on the same side, so one team challenges the other + if (Challenger == ALLIANCE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE)) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE; + else if (Challenger == HORDE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE)) + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE; + m_team = TEAM_NEUTRAL; + } + + if (m_value != oldValue) + SendChangePhase(); + + if (m_OldState != m_State) + { + //sLog->outError("%u->%u", m_OldState, m_State); + if (oldTeam != m_team) + ChangeTeam(oldTeam); + return true; + } + + return false; +} + +void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) +{ + for (uint8 team = 0; team < 2; ++team) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->SendUpdateWorldState(field, value); +} + +void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) +{ + uint8 team; + switch (m_State) + { + case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE: + team = 0; + break; + case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE: + team = 1; + break; + default: + return; + } + + // send to all players present in the area + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + if (Player* plr = sObjectMgr->GetPlayer(*itr)) + plr->KilledMonsterCredit(id, guid); +} + +bool BfCapturePoint::IsInsideObjective(Player *plr) const +{ + return m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()) != m_activePlayers[plr->GetTeamId()].end(); +} diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 81e661bd02..43bce64f5f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -43,12 +43,12 @@ bool BattlefieldWG::SetupBattlefield() m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL); - m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE; - m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE; - m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE; + m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS; + m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS; + m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS; m_TimeForAcceptInvite = 20; - m_StartGroupingTimer = 15 * MINUTE; + m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS; m_StartGrouping = false; m_tenacityStack = 0; @@ -138,7 +138,7 @@ bool BattlefieldWG::SetupBattlefield() } // Hide keep npc for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); // Spawn out of keep npc @@ -152,7 +152,7 @@ bool BattlefieldWG::SetupBattlefield() OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); // Hide outside npc for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); for (uint8 i = 0; i < WG_MAX_TURRET; i++) @@ -221,7 +221,7 @@ bool BattlefieldWG::Update(uint32 diff) m_saveTimer -= diff; for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) { @@ -241,7 +241,7 @@ bool BattlefieldWG::Update(uint32 diff) { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (unit->IsInWater() && !unit->HasAura(SPELL_WINTERGRASP_WATER)) unit->AddAura(SPELL_WINTERGRASP_WATER, unit); @@ -253,7 +253,7 @@ bool BattlefieldWG::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) { if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 @@ -301,7 +301,7 @@ void BattlefieldWG::OnBattleStart() // Update tower visibility and update faction for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { @@ -314,7 +314,7 @@ void BattlefieldWG::OnBattleStart() // Rebuild all wall for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { - if ((*itr)) + if (*itr) { (*itr)->Rebuild(); (*itr)->UpdateTurretAttack(false); @@ -329,15 +329,15 @@ void BattlefieldWG::OnBattleStart() // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) { - if ((*itr)) + if (*itr) (*itr)->UpdateGraveYardAndWorkshop(); } for (uint8 team = 0; team < 2; ++team) - for (GuidSet::const_iterator p_itr = m_players[team].begin(); p_itr != m_players[team].end(); ++p_itr) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { // Kick player in orb room, TODO: offline player ? - if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { float x, y, z; player->GetPosition(x, y, z); @@ -364,7 +364,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) { - if (BfWGWorkShopData * workshop = (*itr)) + if (BfWGWorkShopData* workshop = *itr) { if (workshop->m_TeamControl == TEAM_ALLIANCE) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; @@ -386,7 +386,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // Remove turret for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { @@ -403,26 +403,26 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // Change all npc in keep for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); } for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); } // Change all npc out of keep for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); } for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); } @@ -469,7 +469,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); if (player->HasAura(SPELL_LIEUTENANT)) @@ -492,7 +492,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) } for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { if (player->HasAura(SPELL_LIEUTENANT)) { @@ -511,7 +511,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->RemoveAura(SPELL_TOWER_CONTROL); player->RemoveAurasDueToSpell(SPELL_RECRUIT); @@ -525,7 +525,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) if (creature->IsVehicle()) creature->GetVehicleKit()->Dismiss(); @@ -539,7 +539,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID()); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); @@ -690,9 +690,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); - for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) { - if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); } @@ -701,16 +701,16 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) { - if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (Player* player = sObjectAccessor->FindPlayer(*iter)) if (player->GetDistance2d(killer) < 40) IncrementQuest(player, WGQuest[player->GetTeamId()][0]); } @@ -721,7 +721,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) { - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { if (Creature* creature = unit->ToCreature()) { @@ -730,9 +730,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) again = true; IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); - for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr) + for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) { - if (Player* player = sObjectAccessor->FindPlayer(*p_itr)) + if (Player* player = sObjectAccessor->FindPlayer(*iter)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); } @@ -925,7 +925,7 @@ void BattlefieldWG::SendInitWorldStatesToAll() WorldPacket data = BuildInitWorldStates(); for (uint8 team = 0; team < 2; team++) for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->GetSession()->SendPacket(&data); } @@ -933,9 +933,9 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) { if (team == GetDefenderTeam()) { - for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer((*p_itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } } @@ -952,12 +952,12 @@ void BattlefieldWG::AddBrokenTower(TeamId team) // Remove buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); // Add buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); @@ -1071,12 +1071,12 @@ void BattlefieldWG::UpdateTenacity() if (team != TEAM_NEUTRAL) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) if (player->getLevel() >= m_MinLevel) player->RemoveAurasDueToSpell(SPELL_TENACITY); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE); } @@ -1097,20 +1097,20 @@ void BattlefieldWG::UpdateTenacity() buff_honor = (newStack < 5) ? 0 : buff_honor; for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->SetAuraStack(SPELL_TENACITY, player, newStack); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack); if (buff_honor != 0) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer((*itr))) + if (Player* player = sObjectMgr->GetPlayer(*itr)) player->AddAura(buff_honor, player); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) creature->AddAura(buff_honor, creature); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 74974041fa..6e604ef4e6 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1387,13 +1387,13 @@ struct BfWGGameObjectBuilding m_WG->SendWarningToAllInZone(m_NameId); for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER) @@ -1607,23 +1607,23 @@ struct BfWGGameObjectBuilding void UpdateCreatureAndGo() { for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, true); for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, true); for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr) @@ -1637,9 +1637,9 @@ struct BfWGGameObjectBuilding { for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr) { - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { - if (Creature *creature = unit->ToCreature()) + if (Creature* creature = unit->ToCreature()) { if (m_Build) { @@ -1694,9 +1694,9 @@ struct BfWGGameObjectBuilding for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) { - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { - if (Creature *creature = unit->ToCreature()) + if (Creature* creature = unit->ToCreature()) { if (m_Build) { @@ -1824,14 +1824,14 @@ struct BfWGWorkShopData { // Show Alliance creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, creature->GetEntry() != 30499); // Hide Horde creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); // Show Alliance gameobject @@ -1863,14 +1863,14 @@ struct BfWGWorkShopData { // Show Horde creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->ShowNpc(creature, creature->GetEntry() != 30400); // Hide Alliance creature for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit *unit = sObjectAccessor->FindUnit((*itr))) - if (Creature *creature = unit->ToCreature()) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); // Hide Alliance gameobject From 16f2c3a48e4909aab000a89fd4b4ced4a8bae43c Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 21 Feb 2012 11:33:49 -0500 Subject: [PATCH 089/147] merge master into wintergrasp and fix build errors. yay me! --- src/server/game/Battlefield/Battlefield.cpp | 40 +++++++++---------- .../game/Battlefield/Zones/BattlefieldWG.cpp | 31 +++++++------- src/server/game/Globals/ObjectMgr.h | 5 +++ .../game/Handlers/BattleGroundHandler.cpp | 40 ------------------- src/server/game/Spells/SpellMgr.cpp | 10 +++++ src/server/game/World/World.cpp | 8 ++++ src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 7 files changed, 60 insertions(+), 76 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 62aebfe517..6a5ca0b5c0 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -204,7 +204,7 @@ void Battlefield::InvitePlayerInZoneToQueue() { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) InvitePlayerToQueue(plr); } @@ -242,7 +242,7 @@ void Battlefield::InvitePlayerInZoneToWar() for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) { if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) continue; @@ -363,7 +363,7 @@ void Battlefield::PlaySoundToAll(uint32 SoundID) for (int team = 0; team < BG_TEAMS_COUNT; team++) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } } @@ -411,11 +411,11 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId) { if (spellId > 0) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->CastSpell(plr, (uint32) spellId, true); else for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->RemoveAuraFromStack((uint32) - spellId); } @@ -423,7 +423,7 @@ void Battlefield::BroadcastPacketZone(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } @@ -431,7 +431,7 @@ void Battlefield::BroadcastPacketQueue(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } @@ -439,7 +439,7 @@ void Battlefield::BroadcastPacketWar(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->GetSession()->SendPacket(&data); } @@ -496,7 +496,7 @@ void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->SendUpdateWorldState(field, value); } @@ -691,8 +691,8 @@ bool Battlefield::IncrementQuest(Player *player, uint32 quest, bool complete) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - int32 creature = pQuest->ReqCreatureOrGOId[i]; - if (uint32 spell_id = pQuest->ReqSpell[i]) + int32 creature = pQuest->RequiredNpcOrGo[i]; + if (uint32 spell_id = pQuest->RequiredSpellCast[i]) { player->CastedCreatureOrGO(creature, 0, spell_id); return true; @@ -763,7 +763,7 @@ void BfGraveYard::AddPlayer(uint64 player_guid) { m_ResurrectQueue.insert(player_guid); - if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); } } @@ -772,7 +772,7 @@ void BfGraveYard::RemovePlayer(uint64 player_guid) { m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); - if (Player* plr = sObjectMgr->GetPlayer(player_guid)) + if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); } @@ -784,7 +784,7 @@ void BfGraveYard::Resurrect() for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { // Get player object from his guid - Player* plr = sObjectMgr->GetPlayer(*itr); + Player* plr = sObjectAccessor->FindPlayer(*itr); if (!plr) continue; @@ -824,7 +824,7 @@ void BfGraveYard::RelocateDeadPlayers() WorldSafeLocsEntry const* ClosestGrave = NULL; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { - Player* plr = sObjectMgr->GetPlayer(*itr); + Player* plr = sObjectAccessor->FindPlayer(*itr); if (!plr) continue; @@ -882,7 +882,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); // Set creature in world - map->Add(pCreature); + map->AddToMap(pCreature); pCreature->setActive(true); return pCreature; @@ -907,7 +907,7 @@ GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z } // Add in the world - map->Add(go); + map->AddToMap(go); go->setActive(true); return go; } @@ -1016,7 +1016,7 @@ bool BfCapturePoint::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) HandlePlayerLeave(plr); @@ -1120,7 +1120,7 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->SendUpdateWorldState(field, value); } @@ -1141,7 +1141,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) // send to all players present in the area for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectMgr->GetPlayer(*itr)) + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) plr->KilledMonsterCredit(id, guid); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 43bce64f5f..7e27f9560b 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -23,6 +23,7 @@ #include "ObjectMgr.h" #include "BattlefieldWG.h" #include "SpellAuras.h" +#include "Vehicle.h" enum eWGBfData { @@ -221,7 +222,7 @@ bool BattlefieldWG::Update(uint32 diff) m_saveTimer -= diff; for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) { @@ -253,7 +254,7 @@ bool BattlefieldWG::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) { if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 @@ -272,7 +273,7 @@ void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_gui Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid); if (IsWarTime()) { - if (Player* player = sObjectMgr->GetPlayer(player_guid)) + if (Player* player = sObjectAccessor->FindPlayer(player_guid)) { if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) { @@ -337,7 +338,7 @@ void BattlefieldWG::OnBattleStart() for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { // Kick player in orb room, TODO: offline player ? - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { float x, y, z; player->GetPosition(x, y, z); @@ -469,7 +470,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); if (player->HasAura(SPELL_LIEUTENANT)) @@ -492,7 +493,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) } for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { if (player->HasAura(SPELL_LIEUTENANT)) { @@ -511,7 +512,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->RemoveAura(SPELL_TOWER_CONTROL); player->RemoveAurasDueToSpell(SPELL_RECRUIT); @@ -539,7 +540,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID()); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); @@ -925,7 +926,7 @@ void BattlefieldWG::SendInitWorldStatesToAll() WorldPacket data = BuildInitWorldStates(); for (uint8 team = 0; team < 2; team++) for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->GetSession()->SendPacket(&data); } @@ -935,7 +936,7 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) { for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } } @@ -952,12 +953,12 @@ void BattlefieldWG::AddBrokenTower(TeamId team) // Remove buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); // Add buff stack for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); @@ -1071,7 +1072,7 @@ void BattlefieldWG::UpdateTenacity() if (team != TEAM_NEUTRAL) { for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->getLevel() >= m_MinLevel) player->RemoveAurasDueToSpell(SPELL_TENACITY); @@ -1097,7 +1098,7 @@ void BattlefieldWG::UpdateTenacity() buff_honor = (newStack < 5) ? 0 : buff_honor; for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->SetAuraStack(SPELL_TENACITY, player, newStack); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) @@ -1107,7 +1108,7 @@ void BattlefieldWG::UpdateTenacity() if (buff_honor != 0) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = sObjectMgr->GetPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->AddAura(buff_honor, player); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index da0d37cf27..044bf7fb32 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -821,6 +821,11 @@ class ObjectMgr return &_creatureQuestRelations; } + QuestRelations* GetCreatureQuestInvolvedRelation() + { + return &_creatureQuestInvolvedRelations; + } + QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry) { return _creatureQuestRelations.equal_range(creature_entry); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 2e0bbf786a..475c1c42fc 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -565,46 +565,6 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) } } -void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); -} - -void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); -} - void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c26e78f341..93bb15d844 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1120,6 +1120,16 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; break; } + case 58730: // No fly Zone - Wintergrasp + { + if (!player) + return false; + + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))) + return false; + break; + } case 68719: // Oil Refinery - Isle of Conquest. case 68720: // Quarry - Isle of Conquest. { diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 9ec9849118..c0da783da7 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1201,6 +1201,14 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true); // call ScriptMgr if we're reloading the configuration + m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false); + m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMax", 100); + m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMin", 0); + m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMinLvl", 77); + m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30); + m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150); + m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10); + if (reload) sScriptMgr->OnConfigLoad(reload); } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index a11a47a19f..4533f40ad8 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -14,13 +14,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ScriptPCH.h" #include "BattlefieldMgr.h" #include "BattlefieldWG.h" #include "Battlefield.h" #include "ScriptSystem.h" #include "WorldSession.h" #include "ObjectMgr.h" +#include "Vehicle.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." From ba91b8bde9205954127070d62aeb254e804dd7b6 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 21 Feb 2012 14:26:46 -0500 Subject: [PATCH 090/147] change some packets. fix sql. --- Wintergrasp_temp/Quests.sql | 22 +-- .../game/Battlefield/BattlefieldHandler.cpp | 150 ++++++++++++++++++ .../game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/game/Server/WorldSession.h | 11 +- 4 files changed, 172 insertions(+), 13 deletions(-) create mode 100644 src/server/game/Battlefield/BattlefieldHandler.cpp diff --git a/Wintergrasp_temp/Quests.sql b/Wintergrasp_temp/Quests.sql index 75f2e93180..d456f5d5e7 100644 --- a/Wintergrasp_temp/Quests.sql +++ b/Wintergrasp_temp/Quests.sql @@ -1,16 +1,16 @@ -- Wintergrasp Quests - Horde -UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `entry` IN (13180,13178); -- Slay them all! -UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `entry` IN (13185,13223); -- Stop/Defend the Siege -UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `entry` IN (13201,13194); -- Healing with Roses -UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `entry` IN (13193,13199); -- Bones and Arrows -UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `entry` IN (13192,13202); -- Warding/Jinxing the Walls -UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `entry` IN (13200,13191); -- Fueling the Demolishers +UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `id` IN (13180,13178); -- Slay them all! +UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `id` IN (13185,13223); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `id` IN (13201,13194); -- Healing with Roses +UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `id` IN (13193,13199); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `id` IN (13192,13202); -- Warding/Jinxing the Walls +UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `id` IN (13200,13191); -- Fueling the Demolishers -- Wintergrasp Quests - Alliance -UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `entry` IN (13179,13177); -- No Mercy for the Merciless -UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `entry` IN (13186,13222); -- Stop/Defend the Siege -UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `entry` IN (13195,13156); -- A Rare Herb -UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `entry` IN (13196,13154); -- Bones and Arrows -UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `entry` IN (13198,13153); -- Warding the Warriors +UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `id` IN (13179,13177); -- No Mercy for the Merciless +UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `id` IN (13186,13222); -- Stop/Defend the Siege +UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `id` IN (13195,13156); -- A Rare Herb +UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `id` IN (13196,13154); -- Bones and Arrows +UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `id` IN (13198,13153); -- Warding the Warriors -- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already? diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp new file mode 100644 index 0000000000..950c9e3481 --- /dev/null +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Common.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "WorldPacket.h" +#include "WorldSession.h" + +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "Opcodes.h" + +//This send to player windows for invite player to join the war +//Param1:(BattleId) the BattleId of Bf +//Param2:(ZoneId) the zone where the battle is (4197 for wg) +//Param3:(time) Time in second that the player have for accept +void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time) +{ + //Send packet + WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12); + data << uint32(BattleId); + data << uint32(ZoneId); + data << uint32((time(NULL) + p_time)); + + //Sending the packet to player + SendPacket(&data); +} + +//This send invitation to player to join the queue +//Param1:(BattleId) the BattleId of Bf +void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId) +{ + WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5); + + data << uint32(BattleId); + data << uint8(1); //warmup ? used ? + + //Sending packet to player + SendPacket(&data); +} + +//This send packet for inform player that he join queue +//Param1:(BattleId) the BattleId of Bf +//Param2:(ZoneId) the zone where the battle is (4197 for wg) +//Param3:(CanQueue) if able to queue +//Param4:(Full) on log in is full +void WorldSession::SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full) +{ + WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11); + data << uint32(BattleId); + data << uint32(ZoneId); + data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued + data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming + data << uint8(1); //Warmup + SendPacket(&data); +} + +//This is call when player accept to join war +//Param1:(BattleId) the BattleId of Bf +void WorldSession::SendBfEntered(uint32 BattleId) +{ +// m_PlayerInWar[plr->GetTeamId()].insert(plr->GetGUID()); + WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7); + data << uint32(BattleId); + data << uint8(1); //unk + data << uint8(1); //unk + data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK + SendPacket(&data); +} + +void WorldSession::SendBfLeaveMessage(uint32 BattleId, uint8 reason) +{ + WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7); + data << uint32(BattleId); + data << uint8(reason);//byte Reason (1=close invite,8="exited",10="to low level") + data << uint8(2);//byte BattleStatus + data << uint8(0);//bool Relocated + SendPacket(&data); +} + +//Send by client when he click on accept for queue +void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data) +{ + uint32 BattleId; + uint8 Accepted; + + recv_data >> BattleId >> Accepted; + sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + if (!Bf) + return; + + if (Accepted) + { + Bf->PlayerAcceptInviteToQueue(_player); + } +} + +//Send by client on clicking in accept or refuse of invitation windows for join game +void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) +{ + uint32 BattleId; + uint8 Accepted; + + recv_data >> BattleId >> Accepted; + sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + if (!Bf) + return; + + //If player accept invitation + if (Accepted) + { + Bf->PlayerAcceptInviteToWar(_player); + } + else + { + if (_player->GetZoneId() == Bf->GetZoneId()) + Bf->KickPlayerFromBf(_player->GetGUID()); + } +} + +void WorldSession::HandleBfExitRequest(WorldPacket & recv_data) +{ + uint32 BattleId; + + recv_data >> BattleId; + sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId); + Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + if (!Bf) + return; + + Bf->AskToLeaveQueue(_player); +} diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 7e27f9560b..823691a60f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -25,7 +25,7 @@ #include "SpellAuras.h" #include "Vehicle.h" -enum eWGBfData +enum WGBfData { BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp BATTLEFIELD_WG_MAPID = 571, // Northrend diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index b8b0953108..413d0a586a 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -786,7 +786,16 @@ class WorldSession void HandleResetInstancesOpcode(WorldPacket& recv_data); void HandleHearthAndResurrect(WorldPacket& recv_data); void HandleInstanceLockResponse(WorldPacket& recvPacket); - void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); + + // Battlefield + void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time); + void SendBfInvitePlayerToQueue(uint32 BattleId); + void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); + void SendBfEntered(uint32 BattleId); + void SendBfLeaveMessage(uint32 BattleId, uint8 reason = 8); + void HandleBfQueueInviteResponse(WorldPacket &recv_data); + void HandleBfEntryInviteResponse(WorldPacket &recv_data); + void HandleBfExitRequest(WorldPacket &recv_data); // Looking for Dungeon/Raid void HandleLfgSetCommentOpcode(WorldPacket& recv_data); From f663f881f72a281218198363f4114adac895989a Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 11:52:54 -0500 Subject: [PATCH 091/147] fix broken stalker npc id. --- src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 6e604ef4e6..4c7afcdaee 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -187,7 +187,7 @@ enum eWGNpc // *INDENT-OFF* BATTLEFIELD_WG_NPC_GUARD_H = 30739, BATTLEFIELD_WG_NPC_GUARD_A = 30740, - BATTLEFIELD_WG_NPC_STALKER = 00000, + BATTLEFIELD_WG_NPC_STALKER = 15214, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296,// From 6318fd91ff3630923c0e2b088fe66c14f7c31101 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 12:55:51 -0500 Subject: [PATCH 092/147] added enum for battlefield leave reason. --- src/server/game/Battlefield/BattlefieldHandler.cpp | 11 ++++++++++- src/server/game/Server/WorldSession.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 950c9e3481..d21b285984 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -26,6 +26,15 @@ #include "BattlefieldMgr.h" #include "Opcodes.h" +enum BFLeaveReason +{ + BF_LEAVE_REASON_CLOSE = 0x00000001, + //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) + //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) + BF_LEAVE_REASON_EXITED = 0x00000008, + BF_LEAVE_REASON_LOW_LEVEL = 0x00000010, +}; + //This send to player windows for invite player to join the war //Param1:(BattleId) the BattleId of Bf //Param2:(ZoneId) the zone where the battle is (4197 for wg) @@ -84,7 +93,7 @@ void WorldSession::SendBfEntered(uint32 BattleId) SendPacket(&data); } -void WorldSession::SendBfLeaveMessage(uint32 BattleId, uint8 reason) +void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason) { WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7); data << uint32(BattleId); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 413d0a586a..6678ead6b7 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -792,7 +792,7 @@ class WorldSession void SendBfInvitePlayerToQueue(uint32 BattleId); void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); void SendBfEntered(uint32 BattleId); - void SendBfLeaveMessage(uint32 BattleId, uint8 reason = 8); + void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED); void HandleBfQueueInviteResponse(WorldPacket &recv_data); void HandleBfEntryInviteResponse(WorldPacket &recv_data); void HandleBfExitRequest(WorldPacket &recv_data); From dd05f1dcd278a2a50880d10a5df1549b4afbcc55 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 16:32:51 -0500 Subject: [PATCH 093/147] fix crash with groups, added enum for battlfield leave reasons --- src/server/game/Battlefield/Battlefield.cpp | 14 +++----------- src/server/game/Battlefield/BattlefieldHandler.cpp | 11 +---------- src/server/game/Server/WorldSession.h | 10 ++++++++++ 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 6a5ca0b5c0..aa9cc34a11 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -103,17 +103,9 @@ void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ ) { m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID()); plr->GetSession()->SendBfLeaveMessage(m_BattleId); - if (Group* group = GetGroupPlayer(plr->GetGUID(), plr->GetTeamId())) // remove from raid group if player is member - { - // I think that now is not a hack - if (!group->RemoveMember(plr->GetGUID())) // group was disbanded - { - m_Groups[plr->GetTeamId()].erase(group->GetGUID()); - group->SetBattlefieldGroup(NULL); - sGroupMgr->RemoveGroup(group); - delete group; - } - } + if (Group* group = plr->GetGroup()) // remove from raid group if player is member + group->RemoveMember(plr->GetGUID()); + OnPlayerLeaveWar(plr); //For scripting } } diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index d21b285984..7785fd3bff 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -26,15 +26,6 @@ #include "BattlefieldMgr.h" #include "Opcodes.h" -enum BFLeaveReason -{ - BF_LEAVE_REASON_CLOSE = 0x00000001, - //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) - //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) - BF_LEAVE_REASON_EXITED = 0x00000008, - BF_LEAVE_REASON_LOW_LEVEL = 0x00000010, -}; - //This send to player windows for invite player to join the war //Param1:(BattleId) the BattleId of Bf //Param2:(ZoneId) the zone where the battle is (4197 for wg) @@ -97,7 +88,7 @@ void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason) { WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7); data << uint32(BattleId); - data << uint8(reason);//byte Reason (1=close invite,8="exited",10="to low level") + data << uint8(reason);//byte Reason data << uint8(2);//byte BattleStatus data << uint8(0);//bool Relocated SendPacket(&data); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 6678ead6b7..8bddd63170 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -125,6 +125,16 @@ enum PartyResult ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30 }; + +enum BFLeaveReason +{ + BF_LEAVE_REASON_CLOSE = 0x00000001, + //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) + //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) + BF_LEAVE_REASON_EXITED = 0x00000008, + BF_LEAVE_REASON_LOW_LEVEL = 0x00000010, +}; + enum ChatRestrictionType { ERR_CHAT_RESTRICTED = 0, From 4c3692cc368d6217c095020a10a5b209b8dd4277 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 22 Feb 2012 17:18:51 -0500 Subject: [PATCH 094/147] Battlefield/Wintergrasp/Scripts: removed a few unneeded casts. --- src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/scripts/Northrend/wintergrasp.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index aa9cc34a11..dab41b5c4b 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -30,9 +30,9 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "CreatureTextMgr.h" - #include "GroupMgr.h" + Battlefield::Battlefield() { m_Timer = 0; diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 4533f40ad8..d7565fcfaf 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -63,7 +63,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -91,7 +91,7 @@ class npc_wg_demolisher_engineer : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -132,7 +132,7 @@ class npc_wg_spirit_guide : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -154,7 +154,7 @@ class npc_wg_spirit_guide : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -183,7 +183,7 @@ class npc_wg_queue : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { @@ -214,7 +214,7 @@ class npc_wg_queue : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (BfWG->IsWarTime()) @@ -302,7 +302,7 @@ class npc_wg_quest_giver : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - BattlefieldWG* BfWG = (BattlefieldWG *) sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (pCreature->isQuestGiver()) From ac2a95336e67cc1c28caa5d4d209fbd0c9c75ecd Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Tue, 28 Feb 2012 16:06:50 -0300 Subject: [PATCH 095/147] DB: Killed some DB errors. --- Wintergrasp_temp/Spawns.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/Spawns.sql index 72ade18933..7d6308b70b 100644 --- a/Wintergrasp_temp/Spawns.sql +++ b/Wintergrasp_temp/Spawns.sql @@ -1,3 +1,6 @@ +-- Delete unused creature_data rows +DELETE FROM creature_addon WHERE guid IN (131728,131282,131283,131284,131285,131286,131287,131288,131289,131290,131291,131292,131293,131294,131295,131296,131297,131298,131299,131300,131301,131302,131303,131304,131305,131306,131307,131308,131309,131310,131311,131312,131313,131314,131315,131316,131317,131318,131319,131320,131321,131322,131326,131327,131328,131350,131351,131352,131353,131354,131376,131377,131378,131379,131380,131392,131437,131458,131631,131632,131633,131634,131635,131636,131706,131727,13128,131729,131730,131731); + -- Replace Wintergrasp spawns with properly phased spawns SET @GUID := 290000; DELETE FROM `creature` WHERE `id` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,39172,30870,31053,31091,31101,31102,31106,31107,31151,32294,39173,32296,30488); From ecb5adef24b989df1b16d190764e28f903ab2302 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Tue, 28 Feb 2012 17:13:53 -0300 Subject: [PATCH 096/147] DB: Remove data already pushed to master. --- Wintergrasp_temp/Spawns.sql | 366 +----------------------------------- 1 file changed, 2 insertions(+), 364 deletions(-) diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/Spawns.sql index 7d6308b70b..ab061598df 100644 --- a/Wintergrasp_temp/Spawns.sql +++ b/Wintergrasp_temp/Spawns.sql @@ -1,369 +1,7 @@ --- Delete unused creature_data rows -DELETE FROM creature_addon WHERE guid IN (131728,131282,131283,131284,131285,131286,131287,131288,131289,131290,131291,131292,131293,131294,131295,131296,131297,131298,131299,131300,131301,131302,131303,131304,131305,131306,131307,131308,131309,131310,131311,131312,131313,131314,131315,131316,131317,131318,131319,131320,131321,131322,131326,131327,131328,131350,131351,131352,131353,131354,131376,131377,131378,131379,131380,131392,131437,131458,131631,131632,131633,131634,131635,131636,131706,131727,13128,131729,131730,131731); - --- Replace Wintergrasp spawns with properly phased spawns -SET @GUID := 290000; -DELETE FROM `creature` WHERE `id` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,39172,30870,31053,31091,31101,31102,31106,31107,31151,32294,39173,32296,30488); -INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES --- Taunka Spirit Guide (Horde) -(@GUID+0,31841,571,1,0x00000010,0,0,4318.436,2408.06738,392.675751,6.23082542,120,0,0,1,0,0), -- Eastspark Workshop -(@GUID+1,31841,571,1,0x00000010,0,0,4336.25439,3235.51978,390.334,0.628318548,120,0,0,1,0,0), -- Westspark Workshop -(@GUID+2,31841,571,1,0x00000010,0,0,5104.753,2300.9458,368.568054,0.7330383,120,0,0,1,0,0), -- The Sunken Ring -(@GUID+3,31841,571,1,0x00000010,0,0,5103.133,3462.128,368.568054,5.270895,120,0,0,1,0,0), -- The Chilled Quagmire "Outside broker Temple" -(@GUID+4,31841,571,1,0x00000040,0,0,5537.482,2898.90674,517.2589,4.86946869,120,0,0,1,0,0), -- Fortress -(@GUID+5,31841,571,1,0x00000001,0,0,5031.84131,3710.74878,372.4835,0,120,5,0,1,0,0), -- Horde Landing Zone --- Dwarven Spirit Guide (Alliance) -(@GUID+6,31842,571,1,0x00000020,0,0,4318.436,2408.06738,392.675751,6.23082542,120,0,0,1,0,0), -- Eastspark Workshop -(@GUID+7,31842,571,1,0x00000020,0,0,4336.25439,3235.51978,390.334,0.628318548,120,0,0,1,0,0), -- Westspark Workshop -(@GUID+8,31842,571,1,0x00000020,0,0,5104.753,2300.9458,368.568054,0.7330383,120,0,0,1,0,0), -- The Sunken Ring -(@GUID+9,31842,571,1,0x00000020,0,0,5103.133,3462.128,368.568054,5.270895,120,0,0,1,0,0), -- The Chilled Quagmire "Outside The Broken Temple" -(@GUID+10,31842,571,1,0x00000080,0,0,5537.482,2898.90674,517.2589,4.86946869,120,0,0,1,0,0), -- Fortress -(@GUID+11,31842,571,1,0x00000001,0,0,5140.7876,2179.12451,390.9512,1.97222209,120,0,0,1,0,0), -- Aliance Landing Zone --- Goblin Mechanic (Horde) -(@GUID+12,30400,571,1,0x00000010,0,0,4964.89,3383.06,382.911,6.12611,180,0,0,1,0,0), -- The Broken Temple -(@GUID+13,30400,571,1,0x00000010,0,0,4939.76,2389.06,326.153,3.26377,180,0,0,1,0,0), -- The Sunken Ring -(@GUID+14,30400,571,1,0x00000010,0,0,4357.67,2357.99,382.007,1.67552,180,0,0,1,0,0), -- Eastspark Workshop -(@GUID+15,30400,571,1,0x00000010,0,0,4354.15,3312.82,378.046,1.67552,180,0,0,1,0,0), -- Westspark Workshop -(@GUID+16,30400,571,1,0x00000040,0,0,5391.61,2707.72,415.051,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress -(@GUID+17,30400,571,1,0x00000040,0,0,5392.91,2975.26,415.223,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress --- Gnomish Engineer (Alliance) -(@GUID+18,30499,571,1,0x00000020,0,0,4964.89,3383.06,382.911,6.12611,180,0,0,1,0,0), -- The Broken Temple -(@GUID+19,30499,571,1,0x00000020,0,0,4939.76,2389.06,326.153,3.26377,180,0,0,1,0,0), -- The Sunken Ring -(@GUID+20,30499,571,1,0x00000020,0,0,4357.67,2357.99,382.007,1.67552,180,0,0,1,0,0), -- Eastspark Workshop -(@GUID+21,30499,571,1,0x00000020,0,0,4354.15,3312.82,378.046,1.67552,180,0,0,1,0,0), -- Westspark Workshop -(@GUID+22,30499,571,1,0x00000080,0,0,5391.61,2707.72,415.051,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress -(@GUID+23,30499,571,1,0x00000080,0,0,5392.91,2975.26,415.223,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress --- Alliance NPC's -(@GUID+24,30489,571,1,0x00000080,0,0,5369.973,2874.83081,409.3225,3.12413931,120,0,0,1,0,0), -- Morgan Day -(@GUID+25,30869,571,1,0x00000001,0,0,5102.75049,2187.82837,365.707855,3.996804,120,0,0,1,0,0), -- Arzo Safeflight -(@GUID+26,31036,571,1,0x00000040,0,0,5078.281,2183.704,365.028564,1.46607661,120,0,0,1,0,0), -- Commander Zanneth -(@GUID+27,31036,571,1,0x00000080,0,0,5358.641,2841.76416,409.3225,1.13262534,120,0,0,1,0,0), -(@GUID+28,31051,571,1,0x00000040,0,0,5081.697,2173.73,365.8777,0.8552113,120,0,0,1,0,0), -- Sorceress Kaylana -(@GUID+29,31051,571,1,0x00000080,0,0,5296.869,2887.67114,409.274658,5.60250664,120,0,0,1,0,0), -(@GUID+30,31052,571,1,0x00000040,0,0,5100.06543,2168.89,365.7788,1.97222209,120,0,0,1,0,0), -- Bowyer Randolph -(@GUID+31,31052,571,1,0x00000080,0,0,5302.57373,2750.40332,409.274658,5.46288061,120,0,0,1,0,0), -(@GUID+32,31054,571,1,0x00000040,0,0,5088.611,2167.66235,365.688751,0.6806784,120,0,0,1,0,0), -- Anchorite Tessa -(@GUID+33,31054,571,1,0x00000080,0,0,5372.05859,3028.33618,409.206024,0.012565271,120,0,0,1,0,0), -(@GUID+34,31108,571,1,0x00000040,0,0,5095.673,2193.284,365.9236,4.939282,120,0,0,1,0,0), -- Siege Master Stouthandle -(@GUID+35,31108,571,1,0x00000080,0,0,5298.267,2924.97632,409.274658,0.9075712,120,0,0,1,0,0), -(@GUID+36,31109,571,1,0x00000040,0,0,5080.403,2199.00244,359.4894,2.96705961,120,0,0,1,0,0), -- Senior Demolitionist Legoso -(@GUID+37,31109,571,1,0x00000080,0,0,5228.2915,2809.888,409.274658,3.19395256,120,0,0,1,0,0), -(@GUID+38,31153,571,1,0x00000040,0,0,5088.48633,2188.17871,365.646973,5.253441,120,0,0,1,0,0), -- Tactical Officer Ahbramis -(@GUID+39,31153,571,1,0x00000080,0,0,5364.784,2835.135,409.3225,3.12413931,120,0,0,1,0,0), -(@GUID+40,32294,571,1,0x00000080,0,0,5374.568,2790.784,409.3225,2.72271371,120,0,0,1,0,0), -- Knight Dameron -(@GUID+41,39172,571,1,0x00000080,0,0,5372.672,2786.74048,409.4423,2.80998015,120,0,0,1,0,0), -- Marshal Magruder -(@GUID+42,30488,571,1,0x00000080,0,0,5370.428,2814.274,409.3225,3.054326,120,0,0,1,0,0), -- Travis Day --- Horde NPC's -(@GUID+43,30870,571,1,0x00000001,0,0,5023.4043,3686.03345,363.1192,5.131268,120,0,0,1,0,0), -- Herzo Safeflight -(@GUID+44,31053,571,1,0x00000040,0,0,5379.875,3027.43359,409.206024,0,120,0,0,1,0,0), -- Primalist Mulfort -(@GUID+45,31053,571,1,0x00000080,0,0,5034.703125,3666.703125,363.273865,4.310963,120,0,0,1,0,0), -(@GUID+46,31091,571,1,0x00000040,0,0,5347.7915,2837.38574,409.3466,2.62603331,120,0,0,1,0,0), -- Commander Dardosh -(@GUID+47,31091,571,1,0x00000080,0,0,5018.662109,3672.279541,362.862885,2.209141,120,0,0,1,0,0), -(@GUID+48,31101,571,1,0x00000040,0,0,5296.564,2789.87378,409.274658,0.7330383,120,0,0,1,0,0), -- Hoodoo Master Fu'jin -(@GUID+49,31101,571,1,0x00000080,0,0,5014.065430,3678.846436,362.995575,5.096361,120,0,0,1,0,0), -(@GUID+50,31102,571,1,0x00000040,0,0,5295.455,2732.87549,409.274658,4.7211113,120,0,0,1,0,0), -- Vieron Blazefeather -(@GUID+51,31102,571,1,0x00000080,0,0,5031.676270,3655.820801,362.234558,5.131268,120,0,0,1,0,0), -(@GUID+52,31106,571,1,0x00000040,0,0,5295.56348,2926.67188,409.274658,0.87266463,120,0,0,1,0,0), -- Siegesmith Stronghoof -(@GUID+53,31106,571,1,0x00000080,0,0,5037.602051,3675.459717,363.147888,3.176499,120,0,0,1,0,0), -(@GUID+54,31107,571,1,0x00000040,0,0,5230.09033,2876.635,409.316254,-2.19854617,120,0,0,1,0,0), -- Lieutenant Murp -(@GUID+55,31107,571,1,0x00000080,0,0,5004.455078,3661.089111,361.335785,3.979351,120,0,0,1,0,0), -(@GUID+56,31151,571,1,0x00000040,0,0,5363.2876,2834.52954,409.3606,2.76273036,120,0,0,1,0,0), -- Tactical Officer Kilrath -(@GUID+57,31151,571,1,0x00000080,0,0,5034.698242,3683.268799,363.129120,4.310963,120,0,0,1,0,0), -(@GUID+58,32296,571,1,0x00000040,0,0,5374.568,2790.784,409.3225,2.60054,120,0,0,1,0,0), -- Stone Guard Mukar --- Missing noc in fortress -(@GUID+60,39173,571,1,0x00000040,0,0,5372.672,2786.74048,409.4423,2.80998015,120,0,0,1,0,0); -- Champion Ros'slai - --- Pathing for Anchorite Tessa Entry: 31054 -SET @NPC := @GUID+33; -SET @PATH := @NPC * 10; -UPDATE `creature` SET `MovementType`=2 WHERE `guid`=@NPC; -DELETE FROM `creature_addon` WHERE `guid`=@NPC; -INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); -DELETE FROM `waypoint_data` WHERE `id`=@PATH; -INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES -(@PATH,1,5382.507,3028.468,409.206,0,0,0,100,0), -(@PATH,2,5392.744,3028.737,409.206,0,0,0,100,0), -(@PATH,3,5382.507,3028.468,409.206,0,0,0,100,0), -(@PATH,4,5371.491,3028.329,409.206,0,0,0,100,0), -(@PATH,5,5360.032,3028.516,409.3161,0,0,0,100,0), -(@PATH,6,5371.491,3028.329,409.206,0,0,0,100,0); - --- Pathing for Commander Zanneth Entry: 31036 -SET @NPC := @GUID+27; -SET @PATH := @NPC * 10; -UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=5358.854,`position_y`=2859.232,`position_z`=409.5425 WHERE `guid`=@NPC; -DELETE FROM `creature_addon` WHERE `guid`=@NPC; -INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,14337, ''); -DELETE FROM `waypoint_data` WHERE `id`=@PATH; -INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES -(@PATH,1,5359.788,2846.359,409.3642,0,0,0,100,0), -(@PATH,2,5359.187,2839.211,409.3642,0,0,0,100,0), -(@PATH,3,5360.083,2823.116,409.5381,0,0,0,100,0), -(@PATH,4,5359.187,2839.211,409.3642,0,0,0,100,0), -(@PATH,5,5359.788,2846.359,409.3642,0,0,0,100,0), -(@PATH,6,5358.854,2859.232,409.5425,0,0,0,100,0); - --- Pathing for Commander Dardosh Entry: 31091 -SET @NPC := @GUID+46; -SET @PATH := @NPC * 10; -UPDATE `creature` SET `MovementType`=2,`position_x`=5359.546,`position_y`=2858.049,`position_z`=409.3642 WHERE `guid`=@NPC; -DELETE FROM `creature_addon` WHERE `guid`=@NPC; -INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); -DELETE FROM `waypoint_data` WHERE `id`=@PATH; -INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES -(@PATH,1,5359.202,2843.208,409.3642,0,0,0,100,0), -(@PATH,2,5358.997,2827.974,409.3639,0,0,0,100,0), -(@PATH,3,5359.202,2843.208,409.3642,0,0,0,100,0), -(@PATH,4,5359.546,2858.049,409.3642,0,0,0,100,0); - --- Pathing for Commander Dardosh Entry: 31091 -SET @NPC := @GUID+47; -SET @PATH := @NPC * 10; -UPDATE `creature` SET `MovementType`=2,`position_x`=5018.411133,`position_y`=3672.615967,`position_z`=362.863525 WHERE `guid`=@NPC; -DELETE FROM `creature_addon` WHERE `guid`=@NPC; -INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); -DELETE FROM `waypoint_data` WHERE `id`=@PATH; -INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES -(@PATH,1,5022.827637,3666.665771,362.205750,0,0,0,100,0), -(@PATH,2,5024.270508,3658.739258,361.705750,0,0,0,100,0), -(@PATH,3,5022.827637,3666.665771,362.205750,0,0,0,100,0), -(@PATH,4,5018.411133,3672.615967,362.863525,0,0,0,100,0); - --- Pathing for Primalist Mulfort Entry: 31053 -SET @NPC := @GUID+44; -SET @PATH := @NPC * 10; -UPDATE `creature` SET `MovementType`=2 WHERE `guid`=@NPC; -DELETE FROM `creature_addon` WHERE `guid`=@NPC; -INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); -DELETE FROM `waypoint_data` WHERE `id`=@PATH; -INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES -(@PATH,1,5390.624,3027.994,409.206,0,0,0,100,0), -(@PATH,2,5379.875,3027.434,409.206,0,0,0,100,0), -(@PATH,3,5371.404,3026.511,409.206,0,0,0,100,0), -(@PATH,4,5379.875,3027.434,409.206,0,0,0,100,0); - --- Pathing for Vieron Blazefeather Entry: 31102 -SET @NPC := @GUID+50; -SET @PATH := @NPC * 10; -UPDATE `creature` SET `MovementType`=2,`position_x`=5296.644,`position_y`=2731.107,`position_z`=409.3163 WHERE `guid`=@NPC; -DELETE FROM `creature_addon` WHERE `guid`=@NPC; -INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); -DELETE FROM `waypoint_data` WHERE `id`=@PATH; -INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES -(@PATH,1,5295.544,2722.631,409.3163,0,0,0,100,0), -(@PATH,2,5296.644,2731.107,409.3163,0,0,0,100,0), -(@PATH,3,5297.874,2738.155,409.3163,0,0,0,100,0), -(@PATH,4,5305.192,2746.161,409.3061,0,0,0,100,0), -(@PATH,5,5297.874,2738.155,409.3163,0,0,0,100,0), -(@PATH,6,5296.644,2731.107,409.3163,0,0,0,100,0); - --- Guards "Alliance" (Valiance Expedition Champion) -SET @GUID := 291000; -DELETE FROM `creature` WHERE `id`=30740; -INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES --- Fortress -(@GUID+0,30740,571,1,0x00000080,0,0,5150.26855,2786.02173,409.5469,3.22885919,120,0,0,1,0,0), -(@GUID+1,30740,571,1,0x00000080,0,0,5150.657,2777.9502,409.4053,2.94960642,120,0,0,1,0,0), -(@GUID+2,30740,571,1,0x00000080,0,0,5193.632,2734.172,409.272552,4.694936,120,0,0,1,0,0), -(@GUID+3,30740,571,1,0x00000080,0,0,5200.497,2733.88843,409.272552,4.677482,120,0,0,1,0,0), -(@GUID+4,30740,571,1,0x00000080,0,0,5264.64648,2670.1936,409.1819,3.07177949,120,0,0,1,0,0), -(@GUID+5,30740,571,1,0x00000080,0,0,5265.30566,2663.15381,409.1819,3.12413931,120,0,0,1,0,0), -(@GUID+6,30740,571,1,0x00000080,0,0,5307.02051,2613.89771,409.172363,4.694936,120,0,0,1,0,0), -(@GUID+7,30740,571,1,0x00000080,0,0,5311.133,3061.04248,408.809937,1.50098312,120,0,0,1,0,0), -(@GUID+8,30740,571,1,0x00000080,0,0,5315.87354,2614.21924,408.972748,4.677482,120,0,0,1,0,0), -(@GUID+9,30740,571,1,0x00000080,0,0,5318.09,3060.634,408.882782,1.62315619,120,0,0,1,0,0), -(@GUID+10,30740,571,1,0x00000080,0,0,5149.395,2897.044,409.304443,3.03687286,120,0,0,1,0,0), -(@GUID+11,30740,571,1,0x00000080,0,0,5149.51953,2904.19336,409.276062,3.07177949,120,0,0,1,0,0), -(@GUID+12,30740,571,1,0x00000080,0,0,5192.79248,2948.454,409.2746,1.50098312,120,0,0,1,0,0), -(@GUID+13,30740,571,1,0x00000080,0,0,5201.645,2948.77612,409.2746,1.62315619,120,0,0,1,0,0), -(@GUID+14,30740,571,1,0x00000080,0,0,5265.28,3010.10083,408.895782,2.82743335,120,0,0,1,0,0), -(@GUID+15,30740,571,1,0x00000080,0,0,5265.47559,3017.39941,408.582977,3.07177949,120,0,0,1,0,0), -(@GUID+16,30740,571,1,0x00000080,0,0,5367.91455,2826.52026,409.3225,3.33357882,120,0,0,1,0,0), -(@GUID+17,30740,571,1,0x00000080,0,0,5368.71338,2856.36035,409.3225,2.94960642,120,0,0,1,0,0), -(@GUID+18,30740,571,1,0x00000080,0,0,5388.56,2834.76782,418.7585,3.07177949,120,0,0,1,0,0), -(@GUID+19,30740,571,1,0x00000080,0,0,5389.272,2847.36816,418.7585,3.106686,120,0,0,1,0,0), -(@GUID+20,30740,571,1,0x00000080,0,0,4684.475,2414.28979,369.9621,-2.85779858,120,0,0,1,0,0), -(@GUID+21,30740,571,1,0x00000080,0,0,4692.75635,2392.88574,369.0177,-2.82921553,120,0,0,1,0,0), -(@GUID+22,30740,571,1,0x00000080,0,0,5327.264648,2659.455322,409.178711,3.069901,120,0,0,1,0,0), -- F1307814000A2DAD path -(@GUID+23,30740,571,1,0x00000080,0,0,5154.225586,2833.824219,409.262451,3.124139,120,0,0,1,0,0), -(@GUID+24,30740,571,1,0x00000080,0,0,5154.119629,2847.892822,409.247559,3.071779,120,0,0,1,0,0), -(@GUID+25,30740,571,1,0x00000080,0,0,5179.111328,2837.129639,409.274658,3.211406,120,0,0,1,0,0), -(@GUID+26,30740,571,1,0x00000080,0,0,5179.666504,2846.597900,409.274658,3.089233,120,0,0,1,0,0), -(@GUID+27,30740,571,1,0x00000080,0,0,5270.163086,2833.479248,409.274658,3.124139,120,0,0,1,0,0), -(@GUID+28,30740,571,1,0x00000080,0,0,5270.057129,2847.547607,409.274658,3.071779,120,0,0,1,0,0), -(@GUID+29,30740,571,1,0x00000080,0,0,5307.750000,3008.872559,409.193024,4.781681,120,0,0,1,0,0), -- F1307814000A43AE path -(@GUID+30,30740,571,1,0x00000080,0,0,5335.117188,2916.802002,409.443756,1.500983,120,0,0,1,0,0), -(@GUID+31,30740,571,1,0x00000080,0,0,5350.681152,2917.011719,409.274658,1.466077,120,0,0,1,0,0), -(@GUID+32,30740,571,1,0x00000080,0,0,5335.306152,2764.110352,409.274567,4.834562,120,0,0,1,0,0), -(@GUID+33,30740,571,1,0x00000080,0,0,5349.811523,2763.634766,409.333374,4.660029,120,0,0,1,0,0), --- Eastspark Workshop -(@GUID+34,30740,571,1,0x00000080,0,0,4349.537,2411.25781,374.743317,2.05948853,120,0,0,1,0,0), -(@GUID+35,30740,571,1,0x00000080,0,0,4388.13135,2411.97827,374.743317,1.6406095,120,0,0,1,0,0), -(@GUID+36,30740,571,1,0x00000080,0,0,4391.6665,2300.60913,374.7433,4.92182827,120,0,0,1,0,0), -(@GUID+37,30740,571,1,0x00000080,0,0,4413.42969,2393.44946,376.3599,1.06465089,120,0,0,1,0,0), -(@GUID+38,30740,571,1,0x00000080,0,0,4417.92,2331.237,370.9189,5.846853,120,0,0,1,0,0), -(@GUID+39,30740,571,1,0x00000080,0,0,4349.11768,2299.27954,374.7433,4.904375,120,0,0,1,0,0), -(@GUID+40,30740,571,1,0x00000080,0,0,4418.608,2355.28735,372.4907,6.02138567,120,0,0,1,0,0); - --- banners -SET @OGUID := 281000; -DELETE FROM `gameobject` WHERE `id` IN (192254,192255,192269,192284,192285,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309,192310,192312,192313,192314,192316,192317,192318,192319,192320,192321, - 192322,192323,192324,192325,192326,192327,192328,192329,192330,192331,192332,192333,192334,192335,192336,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356, - 192357,192358,192359,192360,192361,192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192487,192488,192501, - 192502); -DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+115; -INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES --- Fortress Banners "Alliance" -(@OGUID+0,192286,571,1,128,5371.44873,2820.79346,409.426575,3.124123,0,0,0,0,120,0,1), -(@OGUID+1,192287,571,1,128,5372.42432,2862.47925,409.3659,3.14159274,0,0,0,0,120,0,1), -(@OGUID+2,192292,571,1,128,5154.35059,2862.08423,445.0105,3.14159274,0,0,0,0,120,0,1), -(@OGUID+3,192299,571,1,128,5155.21631,2820.63013,444.9789,-3.115388,0,0,0,0,120,0,1), -(@OGUID+4,192304,571,1,128,5398.03564,2873.013,455.203552,3.132858,0,0,0,0,120,0,1), -(@OGUID+5,192305,571,1,128,5397.31348,2809.264,455.101624,3.132858,0,0,0,0,120,0,1), -(@OGUID+6,192306,571,1,128,5270.55469,2861.68237,444.917236,-3.124123,0,0,0,0,120,0,1), -(@OGUID+7,192307,571,1,128,5271.16064,2820.10864,445.109,-3.132858,0,0,0,0,120,0,1), -(@OGUID+8,192308,571,1,128,5235.12744,2942.12329,444.2792,1.58824873,0,0,0,0,120,0,1), -(@OGUID+9,192309,571,1,128,5272.549,2976.54175,444.493,3.132858,0,0,0,0,120,0,1), -(@OGUID+10,192310,571,1,128,5352.19775,3055.0166,444.5646,1.57952213,0,0,0,0,120,0,1), -(@OGUID+11,192312,571,1,128,5236.315,2739.21533,444.992828,-1.60570168,0,0,0,0,120,0,1), -(@OGUID+12,192313,571,1,128,5271.634,2704.829,445.182617,-3.124123,0,0,0,0,120,0,1), -(@OGUID+13,192314,571,1,128,5350.905,2622.48,444.649323,-1.56206989,0,0,0,0,120,0,1), -(@OGUID+14,192316,571,1,128,5322.013,2781.13281,435.6727,1.57952213,0,0,0,0,120,0,1), -(@OGUID+15,192317,571,1,128,5363.387,2781.27856,435.634125,1.58824873,0,0,0,0,120,0,1), -(@OGUID+16,192318,571,1,128,5322.24854,2898.94629,435.642975,-1.57952213,0,0,0,0,120,0,1), -(@OGUID+17,192319,571,1,128,5364.30371,2899.216,435.690826,-1.55334139,0,0,0,0,120,0,1), -(@OGUID+18,192320,571,1,128,5289.048,2820.22656,435.6738,0,0,0,0,0,120,0,1), -(@OGUID+19,192321,571,1,128,5288.847,2861.82128,435.590485,0.0261791088,0,0,0,0,120,0,1), -(@OGUID+20,192322,571,1,128,5322.89258,2917.14233,445.1543,1.56206989,0,0,0,0,120,0,1), -(@OGUID+21,192323,571,1,128,5364.283,2917.264,445.332184,1.58824611,0,0,0,0,120,0,1), -(@OGUID+22,192324,571,1,128,5290.514,2976.56177,435.087463,0.008724241,0,0,0,0,120,0,1), -(@OGUID+23,192325,571,1,128,5352.37744,3036.95483,435.111053,-1.56206989,0,0,0,0,120,0,1), -(@OGUID+24,192326,571,1,128,5392.64063,3036.967,433.648682,-1.51843357,0,0,0,0,120,0,1), -(@OGUID+25,192327,571,1,128,5172.336,2862.57544,435.65802,0,0,0,0,0,120,0,1), -(@OGUID+26,192328,571,1,128,5173.12842,2820.95654,435.657623,0.0261791088,0,0,0,0,120,0,1), -(@OGUID+27,192329,571,1,128,5235.32227,2924.31079,434.8981,-1.56206989,0,0,0,0,120,0,1), -(@OGUID+28,192330,571,1,128,5237.02344,2757.35669,435.625641,1.55334139,0,0,0,0,120,0,1), -(@OGUID+29,192331,571,1,128,5289.78125,2704.62158,435.714325,0.008724241,0,0,0,0,120,0,1), -(@OGUID+30,192332,571,1,128,5350.93945,2640.43066,435.2642,1.56206989,0,0,0,0,120,0,1), -(@OGUID+31,192333,571,1,128,5392.28027,2639.84033,435.207916,1.52716041,0,0,0,0,120,0,1), -(@OGUID+32,192334,571,1,128,5322.17041,2763.20142,444.9744,-1.56206715,0,0,0,0,120,0,1), -(@OGUID+33,192335,571,1,128,5363.71631,2763.24731,445.023132,-1.54461551,0,0,0,0,120,0,1), -(@OGUID+34,192487,571,1,128,5145.11133,2934.948,433.254852,-3.10665226,0,0,0,0,120,0,1), -(@OGUID+35,192487,571,1,128,5146.04443,2747.30249,433.527039,3.124123,0,0,0,0,120,0,1), -(@OGUID+36,192487,571,1,128,5158.71,2882.90161,431.27417,3.14159274,0,0,0,0,120,0,1), -(@OGUID+37,192487,571,1,128,5160.28369,2798.59766,430.6037,-3.124123,0,0,0,0,120,0,1), -(@OGUID+38,192487,571,1,128,5162.90674,2952.59766,433.368,1.57079577,0,0,0,0,120,0,1), -(@OGUID+39,192487,571,1,128,5163.85,2729.677,433.327545,-1.60570168,0,0,0,0,120,0,1), -(@OGUID+40,192487,571,1,128,5260.82471,2631.81763,433.181061,3.124123,0,0,0,0,120,0,1), -(@OGUID+41,192487,571,1,128,5262.544,3047.93018,431.96524,3.124123,0,0,0,0,120,0,1), -(@OGUID+42,192487,571,1,128,5278.43066,2613.83276,433.294434,-1.62315571,0,0,0,0,120,0,1), -(@OGUID+43,192487,571,1,128,5280.894,3064.95386,431.9758,1.55334139,0,0,0,0,120,0,1), --- Fortress Banners "Horde" -(@OGUID+44,192269,571,1,64,4526.46,2810.18,391.2,-2.99322,0,0,0,1,180,0,1), -(@OGUID+45,192284,571,1,64,5372.48,2862.5,409.049,3.14159,0,0,0,1,180,0,1), -(@OGUID+46,192285,571,1,64,5371.49,2820.8,409.177,3.14159,0,0,0,1,180,0,1), -(@OGUID+47,192338,571,1,64,5397.76,2873.08,455.461,3.10665,0,0,0,1,180,0,1), -(@OGUID+48,192339,571,1,64,5397.39,2809.33,455.344,3.10665,0,0,0,1,180,0,1), -(@OGUID+49,192349,571,1,64,5155.31,2820.74,444.979,-3.13286,0,0,0,1,180,0,1), -(@OGUID+50,192350,571,1,64,5270.69,2861.78,445.058,-3.11539,0,0,0,1,180,0,1), -(@OGUID+51,192351,571,1,64,5271.28,2820.16,445.201,-3.13286,0,0,0,1,180,0,1), -(@OGUID+52,192352,571,1,64,5173.02,2820.93,435.72,0.017452,0,0,0,1,180,0,1), -(@OGUID+53,192353,571,1,64,5172.11,2862.57,435.721,0.017452,0,0,0,1,180,0,1), -(@OGUID+54,192354,571,1,64,5288.41,2861.79,435.721,0.017452,0,0,0,1,180,0,1), -(@OGUID+55,192355,571,1,64,5288.92,2820.22,435.721,0.017452,0,0,0,1,180,0,1), -(@OGUID+56,192356,571,1,64,5237.07,2757.03,435.796,1.51844,0,0,0,1,180,0,1), -(@OGUID+57,192357,571,1,64,5235.34,2924.34,435.04,-1.5708,0,0,0,1,180,0,1), -(@OGUID+58,192358,571,1,64,5322.23,2899.43,435.808,-1.58825,0,0,0,1,180,0,1), -(@OGUID+59,192359,571,1,64,5364.35,2899.4,435.839,-1.5708,0,0,0,1,180,0,1), -(@OGUID+60,192360,571,1,64,5352.37,3037.09,435.252,-1.5708,0,0,0,1,180,0,1), -(@OGUID+61,192361,571,1,64,5392.65,3037.11,433.713,-1.52716,0,0,0,1,180,0,1), -(@OGUID+62,192362,571,1,64,5322.12,2763.61,444.974,-1.55334,0,0,0,1,180,0,1), -(@OGUID+63,192363,571,1,64,5363.61,2763.39,445.024,-1.54462,0,0,0,1,180,0,1), -(@OGUID+64,192364,571,1,64,5350.88,2622.72,444.686,-1.5708,0,0,0,1,180,0,1), -(@OGUID+65,192366,571,1,64,5236.27,2739.46,444.992,-1.59698,0,0,0,1,180,0,1), -(@OGUID+66,192367,571,1,64,5271.8,2704.87,445.183,-3.13286,0,0,0,1,180,0,1), -(@OGUID+67,192368,571,1,64,5289.46,2704.68,435.875,-0.017451,0,0,0,1,180,0,1), -(@OGUID+68,192369,571,1,64,5350.95,2640.36,435.408,1.5708,0,0,0,1,180,0,1), -(@OGUID+69,192370,571,1,64,5392.27,2639.74,435.331,1.50971,0,0,0,1,180,0,1), -(@OGUID+70,192371,571,1,64,5364.29,2916.94,445.331,1.57952,0,0,0,1,180,0,1), -(@OGUID+71,192372,571,1,64,5322.86,2916.95,445.154,1.56207,0,0,0,1,180,0,1), -(@OGUID+72,192373,571,1,64,5290.35,2976.56,435.221,0.017452,0,0,0,1,180,0,1), -(@OGUID+73,192374,571,1,64,5272.94,2976.55,444.492,3.12412,0,0,0,1,180,0,1), -(@OGUID+74,192375,571,1,64,5235.19,2941.9,444.278,1.58825,0,0,0,1,180,0,1), -(@OGUID+75,192376,571,1,64,5352.19775,3055.0166,444.5646,1.57952,0,0,0,0,120,0,1), -(@OGUID+76,192377,571,1,64,5414.19,3069.8,415.187,1.64061,0,0,0,1,180,0,1), -(@OGUID+77,192378,571,1,64,5322.02,2781.13,435.811,1.5708,0,0,0,1,180,0,1), -(@OGUID+78,192379,571,1,64,5363.42,2781.03,435.763,1.5708,0,0,0,1,180,0,1), -(@OGUID+79,192254,571,1,64,5154.46,2828.94,409.189,3.14159,0,0,0,1,180,0,1), -(@OGUID+80,192255,571,1,64,5154.52,2853.31,409.183,3.14159,0,0,0,1,180,0,1), -(@OGUID+81,192336,571,1,64,5154.49,2862.15,445.012,3.14159,0,0,0,1,180,0,1), -(@OGUID+82,192488,571,1,64,5160.34,2798.61,430.769,3.14159,0,0,0,1,180,0,1), -(@OGUID+83,192488,571,1,64,5158.81,2883.13,431.618,3.14159,0,0,0,1,180,0,1), -(@OGUID+84,192488,571,1,64,5278.38,2613.83,433.409,-1.58825,0,0,0,1,180,0,1), -(@OGUID+85,192488,571,1,64,5260.82,2631.8,433.324,3.05433,0,0,0,1,180,0,1), -(@OGUID+86,192488,571,1,64,5163.13,2952.59,433.503,1.53589,0,0,0,1,180,0,1), -(@OGUID+87,192488,571,1,64,5145.11,2935,433.386,3.14159,0,0,0,1,180,0,1), -(@OGUID+88,192488,571,1,64,5262.54,3047.95,432.055,3.10665,0,0,0,1,180,0,1), -(@OGUID+89,192488,571,1,64,5146.04,2747.21,433.584,3.07177,0,0,0,1,180,0,1), -(@OGUID+90,192488,571,1,64,5163.78,2729.68,433.394,-1.58825,0,0,0,1,180,0,1), -(@OGUID+91,192488,571,1,64,5280.894,3064.95386,431.9758,1.55334139,0,0,0,0,120,0,1), --- Tower Banners "Alliance" -(@OGUID+92,192501,571,1,64,4398.82,2804.7,429.792,-1.58825,0,0,0,1,180,0,1), -(@OGUID+93,192501,571,1,64,4416,2822.67,429.851,-0.017452,0,0,0,1,180,0,1), -(@OGUID+94,192501,571,1,64,4559.11,3606.22,419.999,-1.48353,0,0,0,1,180,0,1), -(@OGUID+95,192501,571,1,64,4539.42,3622.49,420.034,-3.07177,0,0,0,1,180,0,1), -(@OGUID+96,192501,571,1,64,4555.26,3641.65,419.974,1.67551,0,0,0,1,180,0,1), -(@OGUID+97,192501,571,1,64,4574.87,3625.91,420.079,0.087266,0,0,0,1,180,0,1), -(@OGUID+98,192501,571,1,64,4466.79,1960.42,459.144,1.15192,0,0,0,1,180,0,1), -(@OGUID+99,192501,571,1,64,4475.35,1937.03,459.07,-0.436332,0,0,0,1,180,0,1), -(@OGUID+100,192501,571,1,64,4451.76,1928.1,459.076,-2.00713,0,0,0,1,180,0,1), -(@OGUID+101,192501,571,1,64,4442.99,1951.9,459.093,2.74016,0,0,0,1,180,0,1), -(@OGUID+102,192501,571,1,64,4380.36328,2822.38013,429.8818,-3.106652,0,0,0,0,120,0,1), -(@OGUID+103,192501,571,1,64,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1), --- Tower Banners "Horde" -(@OGUID+104,192502,571,1,128,4398.82,2804.7,429.792,-1.58825,0,0,0,1,180,0,1), -(@OGUID+105,192502,571,1,128,4416,2822.67,429.851,-0.017452,0,0,0,1,180,0,1), -(@OGUID+106,192502,571,1,128,4559.11,3606.22,419.999,-1.48353,0,0,0,1,180,0,1), -(@OGUID+107,192502,571,1,128,4539.42,3622.49,420.034,-3.07177,0,0,0,1,180,0,1), -(@OGUID+108,192502,571,1,128,4555.26,3641.65,419.974,1.67551,0,0,0,1,180,0,1), -(@OGUID+109,192502,571,1,128,4574.87,3625.91,420.079,0.087266,0,0,0,1,180,0,1), -(@OGUID+110,192502,571,1,128,4466.79,1960.42,459.144,1.15192,0,0,0,1,180,0,1), -(@OGUID+111,192502,571,1,128,4475.35,1937.03,459.07,-0.436332,0,0,0,1,180,0,1), -(@OGUID+112,192502,571,1,128,4451.76,1928.1,459.076,-2.00713,0,0,0,1,180,0,1), -(@OGUID+113,192502,571,1,128,4442.99,1951.9,459.093,2.74016,0,0,0,1,180,0,1), -(@OGUID+114,192502,571,1,128,4380.36328,2822.38013,429.8818,-3.106652,0,0,0,0,120,0,1), -(@OGUID+115,192502,571,1,128,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1); - -SET @OGUID := 280000; -DELETE FROM `gameobject` WHERE `id` IN (192458,192459,192460,192461,192289,192290,192434,192435,192280,192283,192425,192426,192427,192428,192288,192291,192400,192401,192281,192282); -INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES --- The Sunken Ring "Horde" -(@OGUID+0,192458,571,1,16,4811.4,2441.9,358.207,-2.0333,0,0,0,1,180,0,1), -(@OGUID+1,192459,571,1,16,4805.67,2407.48,358.191,1.78023,0,0,0,1,180,0,1), -(@OGUID+2,192460,571,1,16,5004.35,2486.36,358.449,2.17294,0,0,0,1,180,0,1), -(@OGUID+3,192461,571,1,16,4983.28,2503.09,358.177,-0.427603,0,0,0,1,180,0,1), -(@OGUID+4,192289,571,1,16,4778.19,2438.06,345.644,-2.94088,0,0,0,1,180,0,1), -(@OGUID+5,192290,571,1,16,5024.57,2532.75,344.023,-1.93732,0,0,0,1,180,0,1), --- The Sunken Ring "Alliance" -(@OGUID+6,192425,571,1,32,4811.435,2441.84546,357.982483,-2.02457881,0,0,0,0,120,0,1), -(@OGUID+7,192426,571,1,32,4805.514,2407.84375,357.940765,1.7715075,0,0,0,0,120,0,1), -(@OGUID+8,192427,571,1,32,5004.35,2486.36,358.449,2.17294,0,0,0,1,180,0,1), -(@OGUID+9,192428,571,1,32,4983.221,2503.27271,357.959534,-0.43633157,0,0,0,0,120,0,1), -(@OGUID+10,192288,571,1,32,4778.065,2438.02441,345.7063,-2.932139,0,0,0,0,120,0,1), -(@OGUID+11,192291,571,1,32,5024.608,2532.72583,344.4308,-1.94604158,0,0,0,0,120,0,1), --- The Broken Temple "Horde" -(@OGUID+12,192434,571,1,16,5041.61,3294.4,382.15,-1.63188,0,0,0,1,180,0,1), -(@OGUID+13,192435,571,1,16,4855.63,3297.62,376.739,-3.13286,0,0,0,1,180,0,1), -(@OGUID+14,192280,571,1,16,4857.97,3335.44,368.881,-2.94959,0,0,0,1,180,0,1), -(@OGUID+15,192283,571,1,16,5006.34,3280.4,371.163,2.22529,0,0,0,1,180,0,1), --- The Broken Temple "Alliance" -(@OGUID+16,192400,571,1,32,5041.650879,3294.318604,381.919952,-1.605702,0,0,0,1,180,0,1), -(@OGUID+17,192401,571,1,32,4855.444336,3297.600830,376.495758,-3.115388,0,0,0,1,180,0,1), -(@OGUID+18,192281,571,1,32,4857.971191,3335.415771,369.291901,-2.888511,0,0,0,1,180,0,1), -(@OGUID+19,192282,571,1,32,5006.322754,3280.362061,371.242249,2.242746,0,0,0,1,180,0,1); - -- EVERYTHING UNDER HERE IS WIP /* +SET @OGUID := XXXXX; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES -- Eastspark Workshop "Horde" (@OGUID+20,192452,571,1,16,4416.7993,2414.0383,377.4869,0.0087,0,0,0,0,120,0,1), -- Eastspark Workshop "Alliance" From c580ec24a712390e55ac1c0be086aa73d349a7d2 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Tue, 28 Feb 2012 22:07:35 -0300 Subject: [PATCH 097/147] BF/Wintergrasp: Removed uneeded check , it has been performed on every tick update. It is already handled by the aura system. Furthermore, the aura is correctly added to the spirits using creature_template_addon, the statements for this are already in Template_update.sql --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 33 ------------------- .../game/Battlefield/Zones/BattlefieldWG.h | 6 ---- 2 files changed, 39 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 823691a60f..2638014b03 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -221,23 +221,6 @@ bool BattlefieldWG::Update(uint32 diff) else m_saveTimer -= diff; - for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr) - if (Player* player = sObjectAccessor->FindPlayer(*itr)) - { - if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) - { - const WorldSafeLocsEntry *graveyard = GetClosestGraveYard(player); - if (graveyard) - { - if (player->GetDistance2d(graveyard->x, graveyard->y) > 10.0f) - { - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - m_PlayersIsSpellImu.erase(player->GetGUID()); - } - } - } - } - if (m_BattlefieldActive) { for (uint8 team = 0; team < 2; ++team) @@ -268,22 +251,6 @@ bool BattlefieldWG::Update(uint32 diff) return m_return; } -void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) -{ - Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid); - if (IsWarTime()) - { - if (Player* player = sObjectAccessor->FindPlayer(player_guid)) - { - if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY)) - { - player->CastSpell(player, SPELL_SPIRITUAL_IMMUNITY, true); - m_PlayersIsSpellImu.insert(player->GetGUID()); - } - } - } -} - void BattlefieldWG::OnBattleStart() { // Spawn titan relic diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 4c7afcdaee..da16421df7 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -365,11 +365,6 @@ class BattlefieldWG : public Battlefield void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); - /** - * \brief called when a player is die, for add him to resurrect queue - */ - void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); - /** * \brief Called when battlefield is setup, at server start */ @@ -425,7 +420,6 @@ class BattlefieldWG : public Battlefield GameObjectSet DefenderPortalList; GameObjectSet m_KeepGameObject[2]; GuidSet m_vehicles[2]; - GuidSet m_PlayersIsSpellImu; // Player is dead uint32 m_tenacityStack; uint32 m_saveTimer; }; From 82b49c7b84c5b6e8a14eceed1ee54d1a71d396c0 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Wed, 29 Feb 2012 14:36:34 -0300 Subject: [PATCH 098/147] BF/Wintergrasp: Restored functionality to OnCreatureCreate function, which was out of date. --- src/server/game/Battlefield/Battlefield.h | 398 ++++++++++++++++++ .../game/Battlefield/Zones/BattlefieldWG.cpp | 88 ++-- .../game/Battlefield/Zones/BattlefieldWG.h | 11 +- 3 files changed, 460 insertions(+), 37 deletions(-) create mode 100644 src/server/game/Battlefield/Battlefield.h diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h new file mode 100644 index 0000000000..7617538285 --- /dev/null +++ b/src/server/game/Battlefield/Battlefield.h @@ -0,0 +1,398 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef BATTLEFIELD_H_ +#define BATTLEFIELD_H_ + +#include "Utilities/Util.h" +#include "SharedDefines.h" +#include "ZoneScript.h" +#include "WorldPacket.h" +#include "GameObject.h" +#include "Battleground.h" + +enum BattlefieldTypes +{ + BATTLEFIELD_WG, // Wintergrasp + BATTLEFIELD_TB, // Tol Barad (cataclysm) +}; + +enum BattlefieldIDs +{ + BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle +}; + +enum BattlefieldObjectiveStates +{ + BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0, + BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE, + BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE, + BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE, + BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE, + BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE, + BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE, +}; + +enum BattlefieldSounds +{ + BF_HORDE_WINS = 8454, + BF_ALLIANCE_WINS = 8455, + BF_START = 3439 +}; + +enum BattlefieldTimers +{ + BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000 +}; + +// some class predefs +class Player; +class GameObject; +class WorldPacket; +class Creature; +class Unit; + +class Battlefield; +class BfGraveYard; + +typedef std::set < uint64 > GuidSet; +typedef std::vector < BfGraveYard * >GraveYardVect; +typedef std::map < uint64, uint32 > PlayerTimerMap; + +class BfCapturePoint +{ +public: + BfCapturePoint(Battlefield * bf); + + virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + + // send world state update to all players present + void SendUpdateWorldState(uint32 field, uint32 value); + + // send kill notify to players in the controlling faction + void SendObjectiveComplete(uint32 id, uint64 guid); + + // used when player is activated/inactivated in the area + virtual bool HandlePlayerEnter(Player * plr); + virtual void HandlePlayerLeave(Player * plr); + //virtual void HandlePlayerActivityChanged(Player * plr); + + // checks if player is in range of a capture credit marker + bool IsInsideObjective(Player * plr) const; + + // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. + virtual bool Update(uint32 diff); + virtual void ChangeTeam(TeamId /*oldTeam */ ) {} + virtual void SendChangePhase(); + + bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o); + GameObject *GetCapturePointGo() { return m_capturePoint; } + + TeamId GetTeamId() {return m_team;} +protected: + bool DelCapturePoint(); + + // active players in the area of the objective, 0 - alliance, 1 - horde + GuidSet m_activePlayers[2]; + + // total shift needed to capture the objective + float m_maxValue; + float m_minValue; + + // maximum speed of capture + float m_maxSpeed; + + // the status of the objective + float m_value; + TeamId m_team; + + // objective states + BattlefieldObjectiveStates m_OldState; + BattlefieldObjectiveStates m_State; + + // neutral value on capture bar + uint32 m_neutralValuePct; + + // pointer to the Battlefield this objective belongs to + Battlefield *m_Bf; + uint32 m_capturePointEntry; + GameObject *m_capturePoint; +}; + +class BfGraveYard +{ +public: + BfGraveYard(Battlefield *Bf); + + // method for change who control the graveyard + void ChangeControl(TeamId team); + TeamId GetControlTeamId() { return m_ControlTeam; } + + // use for found the nearest graveyard + float GetDistance(Player * plr); + void Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy); + void AddPlayer(uint64 player_guid); + void RemovePlayer(uint64 player_guid); + + void Resurrect(); + void RelocateDeadPlayers(); + + bool HasNpc(uint64 guid) { return (m_SpiritGuide[0]->GetGUID() == guid || m_SpiritGuide[1]->GetGUID() == guid); } + bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } + uint32 GetGraveYardId() { return m_GraveyardId; } + +protected: + + TeamId m_ControlTeam; + uint32 m_GraveyardId; + Creature *m_SpiritGuide[2]; + GuidSet m_ResurrectQueue; + Battlefield *m_Bf; +}; + +class Battlefield:public ZoneScript +{ + friend class BattlefieldMgr; + + public: + /// Constructor + Battlefield(); + /// Destructor + virtual ~Battlefield(); + + /// typedef of map witch store capturepoint and the associate gameobject entry + typedef std::map < uint32 /*lowguid */ , BfCapturePoint * >BfCapturePointMap; + + /// Call this to init the Battlefield + virtual bool SetupBattlefield() { return true; } + + /// Generate packet which contain all worldstatedata of area + virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + + /// Update data of a worldstate to all players present in zone + void SendUpdateWorldState(uint32 field, uint32 value); + + /** + * \brief Called every time for update bf data and time + * -Update timer for start/end battle + * -Invite player in zone to queue x minutes before start (x = m_StartGroupingTimer) + * -Kick Afk players + * \param diff : time ellapsed since last call (in ms) + */ + virtual bool Update(uint32 diff); + + /// Invite all player in zone, to join the queue, called x minutes before battle start in Update() + void InvitePlayerInZoneToQueue(); + /// Invite all player in queue to join battle on battle start + void InvitePlayerInQueueToWar(); + /// Invite all player in zone to join battle on battle start + void InvitePlayerInZoneToWar(); + + /// Called when a Unit is kill in battlefield zone + virtual void HandleKill(Player * /*killer */ , Unit * /*killed */ ) {}; + + uint32 GetTypeId() { return m_TypeId; } + uint32 GetZoneId() { return m_ZoneId; } + + void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); + + /// Return true if battle is start, false if battle is not started + bool IsWarTime() { return m_BattlefieldActive; } + + /// Enable or Disable battlefield + void SetEnable(bool enable) { m_enable = enable; } + /// Return if battlefield is enable + bool GetEnable() { return m_enable; } + + /** + * \brief Kick player from battlefield and teleport him to kick-point location + * \param guid : guid of player who must be kick + */ + void KickPlayerFromBf(uint64 guid); + + /// Called when player (plr) enter in zone + void HandlePlayerEnterZone(Player * plr, uint32 zone); + /// Called when player (plr) leave the zone + void HandlePlayerLeaveZone(Player * plr, uint32 zone); + + // All-purpose data storage 64 bit + virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; } + virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; } + + // All-purpose data storage 32 bit + virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; } + virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; } + + // Battlefield - generic methods + TeamId GetDefenderTeam() { return m_DefenderTeam; } + TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); } + void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; } + + // Group methods + /** + * \brief Find a not full battlefield group, if there is no, create one + * \param TeamId : Id of player team for who we search a group (plr->GetTeamId()) + */ + Group *GetFreeBfRaid(TeamId TeamId); + /// Return battlefield group where player is. + Group *GetGroupPlayer(uint64 guid, TeamId TeamId); + /// Force player to join a battlefield group + bool AddOrSetPlayerToCorrectBfGroup(Player * plr); + + // Graveyard methods + // Find which graveyard the player must be teleported to to be resurrected by spiritguide + WorldSafeLocsEntry const *GetClosestGraveYard(Player * plr); + + virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + void RemovePlayerFromResurrectQueue(uint64 player_guid); + void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); } + BfGraveYard *GetGraveYardById(uint32 id); + + // Misc methods + Creature *SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); + Creature *SpawnCreature(uint32 entry, Position pos, TeamId team); + GameObject *SpawnGameObject(uint32 entry, float x, float y, float z, float o); + + // Script-methods + + /// Called on start + virtual void OnBattleStart() {}; + /// Called at the end of battle + virtual void OnBattleEnd(bool /*endbytimer */ ) {}; + /// Called x minutes before battle start when player in zone are invite to join queue + virtual void OnStartGrouping() {}; + /// Called when a player accept to join the battle + virtual void OnPlayerJoinWar(Player * /*plr */ ) {}; + /// Called when a player leave the battle + virtual void OnPlayerLeaveWar(Player * /*plr */ ) {}; + /// Called when a player leave battlefield zone + virtual void OnPlayerLeaveZone(Player * /*plr */ ) {}; + /// Called when a player enter in battlefield zone + virtual void OnPlayerEnterZone(Player * /*plr */ ) {}; + + WorldPacket BuildWarningAnnPacket(std::string msg); + void SendWarningToAllInZone(uint32 entry); + //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED + void SendWarningToPlayer(Player * plr, uint32 entry); + + void PlayerAcceptInviteToQueue(Player * plr); + void PlayerAcceptInviteToWar(Player * plr); + uint32 GetBattleId() { return m_BattleId; } + void AskToLeaveQueue(Player * plr); + + virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {}; + + /// Send all worldstate data to all player in zone. + virtual void SendInitWorldStatesToAll() {}; + + /// Return if we can use mount in battlefield + bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not + bool IncrementQuest(Player * player, uint32 quest, bool complete = false); + void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid); + + void StartBattle(); + void EndBattle(bool endbytimer); + + void HideNpc(Creature * p_Creature); + void ShowNpc(Creature * p_Creature, bool p_Aggressive); + + GraveYardVect GetGraveYardVect() { return m_GraveYardList; } + + uint32 GetTimer() { return m_Timer; } + void SetTimer(uint32 timer) { m_Timer = timer; } + + void PlaySoundToAll(uint32 SoundID); + + void InvitePlayerToQueue(Player * plr); + void InvitePlayerToWar(Player * plr); + + void InitStalker(uint32 entry, float x, float y, float z, float o); + +protected: + uint64 StalkerGuid; + uint32 m_Timer; // Global timer for event + bool m_enable; + bool m_BattlefieldActive; + TeamId m_DefenderTeam; + + // the map of the objectives belonging to this outdoorpvp + BfCapturePointMap m_capturePoints; + + // the set of player + GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone + GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue + GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat + PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT]; + PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT]; + + //Variables that must exist for each battlefield + uint32 m_TypeId; // See enum BattlefieldTypes + uint32 m_BattleId; // BattleID (for packet) + uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197 + uint32 m_MapId; // MapId where is Battlefield + uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield + uint32 m_MinPlayer; // Minimum number of player for Battlefield start + uint32 m_MinLevel; // Required level to participate at Battlefield + uint32 m_BattleTime; // Length of a battle + uint32 m_NoWarBattleTime; // Time between two battles + uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle. + uint32 m_TimeForAcceptInvite; + uint32 m_uiKickDontAcceptTimer; + WorldLocation KickPosition; // Position where player is teleport if they switch to afk during battle or if they dont accept invitation + + uint32 m_uiKickAfkTimer; // Timer for check Afk in war + + //Graveyard variables + GraveYardVect m_GraveYardList; // Vector witch contain the different GY of the battle + uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec + + uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle + bool m_StartGrouping; // bool for know if all players in area has been invited + + GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group + + std::vector < uint64 > m_Data64; + std::vector < uint32 > m_Data32; + + void KickAfk(); + // use for switch off all worldstate for client + virtual void SendRemoveWorldStates(Player * /*plr */ ) {} + + // use for send a packet for all player list + void BroadcastPacketZone(WorldPacket & data) const; + void BroadcastPacketQueue(WorldPacket & data) const; + void BroadcastPacketWar(WorldPacket & data) const; + + //CapturePoint system + void AddCapturePoint(BfCapturePoint * cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; } + + BfCapturePoint *GetCapturePoint(uint32 lowguid) const + { + Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); + if (itr != m_capturePoints.end()) + return itr->second; + return NULL; + } + + void RegisterZone(uint32 zoneid); + bool HasPlayer(Player * plr) const; + void TeamCastSpell(TeamId team, int32 spellId); + +}; + +#endif diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 2638014b03..cc4b4711b6 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -578,7 +578,7 @@ void BattlefieldWG::OnStartGrouping() SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } -void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) +void BattlefieldWG::OnCreatureCreate(Creature *creature) { if (IsWarTime()) { @@ -597,49 +597,37 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) else return; - if (add) + if (team == TEAM_HORDE) { - if (team == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) - { - creature->AddAura(SPELL_HORDE_FLAG, creature); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + creature->AddAura(SPELL_HORDE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); } else { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) - { - creature->AddAura(SPELL_ALLIANCE_FLAG, creature); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; } } else { - m_vehicles[team].erase(creature->GetGUID()); - if (team == TEAM_HORDE) - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + { + creature->AddAura(SPELL_ALLIANCE_FLAG, creature); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } else - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; - UpdateVehicleCountWG(); + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } } break; } @@ -647,6 +635,38 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add) } } +void BattlefieldWG::OnCreatureRemove(Creature* creature) +{ + if (IsWarTime()) + { + switch (creature->GetEntry()) + { + case 28312: + case 32627: + case 27881: + case 28094: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; + + m_vehicles[team].erase(creature->GetGUID()); + if (team == TEAM_HORDE) + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; + else + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; + UpdateVehicleCountWG(); + + break; + } + } + } +} + // Called when player kill a unit in wg zone void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index da16421df7..71a729f8ba 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -338,11 +338,16 @@ class BattlefieldWG : public Battlefield bool Update(uint32 diff); /** - * \brief Called when a creature is spawn or remove from WG + * \brief Called when a creature is created * -Update vehicle count - * \param add : true > creature is spawn false > creature is remove */ - void OnCreatureCreate(Creature *creature, bool add); + void OnCreatureCreate(Creature *creature); + + /** + * \brief Called when a creature is removed + * -Update vehicle count + */ + void OnCreatureRemove(Creature* creature); /** * \brief Called when a wall/tower is broken From 3478f3e7b791c57e98be1496c3c96e97457c8e88 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Thu, 1 Mar 2012 02:03:52 -0300 Subject: [PATCH 099/147] BF/Wintergrasp: Now graveyards use db spawned spirits. --- src/server/game/Battlefield/Battlefield.cpp | 43 +++++++-------- src/server/game/Battlefield/Battlefield.h | 18 +++++-- .../game/Battlefield/Zones/BattlefieldWG.cpp | 54 +++++++++++++++++-- .../game/Battlefield/Zones/BattlefieldWG.h | 16 +++++- 4 files changed, 99 insertions(+), 32 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index dab41b5c4b..2e9e4607ee 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -717,32 +717,24 @@ BfGraveYard::BfGraveYard(Battlefield *Bf) m_ResurrectQueue.clear(); } -void BfGraveYard::Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy) +void BfGraveYard::Initialize(TeamId startcontrol, uint32 gy) { m_ControlTeam = startcontrol; - if (Creature* cre = m_Bf->SpawnCreature(horde_entry, x, y, z, o, TEAM_HORDE)) - { - m_SpiritGuide[TEAM_HORDE] = cre; - m_SpiritGuide[TEAM_HORDE]->SetReactState(REACT_PASSIVE); - if (m_ControlTeam == TEAM_ALLIANCE) - m_SpiritGuide[TEAM_HORDE]->SetVisible(false); - } - else - sLog->outError("BfGraveYard::Init can't spawn horde spiritguide %u", horde_entry); - - if (Creature* cre = m_Bf->SpawnCreature(alliance_entry, x, y, z, o, TEAM_ALLIANCE)) - { - m_SpiritGuide[TEAM_ALLIANCE] = cre; - m_SpiritGuide[TEAM_ALLIANCE]->SetReactState(REACT_PASSIVE); - if (m_ControlTeam == TEAM_HORDE) - m_SpiritGuide[TEAM_ALLIANCE]->SetVisible(false); - } - else - sLog->outError("BfGraveYard::Init can't spawn alliance spiritguide %u", alliance_entry); - m_GraveyardId = gy; } +void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) +{ + if (!spirit) + { + sLog->outError(": Invalid Spirit."); + return; + } + + m_SpiritGuide[team] = spirit->GetGUID(); + spirit->SetReactState(REACT_PASSIVE); +} + float BfGraveYard::GetDistance(Player *plr) { const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); @@ -782,8 +774,8 @@ void BfGraveYard::Resurrect() // Check player isinworld and player is on good graveyard if (plr->IsInWorld()) - if (m_SpiritGuide[m_ControlTeam]) - m_SpiritGuide[m_ControlTeam]->CastSpell(m_SpiritGuide[m_ControlTeam], SPELL_SPIRIT_HEAL, true); + if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam])) + spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); // Resurect player plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); @@ -801,10 +793,11 @@ void BfGraveYard::Resurrect() void BfGraveYard::ChangeControl(TeamId team) { // Guide switching - if (m_SpiritGuide[1 - team]) + // Note: Visiblity changes are made by phasing + /*if (m_SpiritGuide[1 - team]) m_SpiritGuide[1 - team]->SetVisible(false); if (m_SpiritGuide[team]) - m_SpiritGuide[team]->SetVisible(true); + m_SpiritGuide[team]->SetVisible(true);*/ m_ControlTeam = team; // Teleport to other graveyard, player witch were on this graveyard diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 7617538285..77c9aa42c5 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -145,14 +145,26 @@ public: // use for found the nearest graveyard float GetDistance(Player * plr); - void Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy); + void Initialize(TeamId startcontrol, uint32 gy); + void SetSpirit(Creature* spirit, TeamId team); void AddPlayer(uint64 player_guid); void RemovePlayer(uint64 player_guid); void Resurrect(); void RelocateDeadPlayers(); - bool HasNpc(uint64 guid) { return (m_SpiritGuide[0]->GetGUID() == guid || m_SpiritGuide[1]->GetGUID() == guid); } + bool HasNpc(uint64 guid) + { + // npcs could not be loaded in the map yet. + if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) + return false; + + if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) || + !sObjectAccessor->FindUnit(m_SpiritGuide[1])) + return false; + + return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid); + } bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } uint32 GetGraveYardId() { return m_GraveyardId; } @@ -160,7 +172,7 @@ protected: TeamId m_ControlTeam; uint32 m_GraveyardId; - Creature *m_SpiritGuide[2]; + uint64 m_SpiritGuide[2]; GuidSet m_ResurrectQueue; Battlefield *m_Bf; }; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index cc4b4711b6..fdca7c0c52 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -88,10 +88,13 @@ bool BattlefieldWG::SetupBattlefield() for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) { BfGraveYardWG *gy = new BfGraveYardWG(this); - if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team - gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid); + + // When between games, the graveyard is controlled by the defending team + if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) + gy->Initialize(m_DefenderTeam, WGGraveYard[i].gyid); else - gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + gy->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + gy->SetTextId(WGGraveYard[i].textid); m_GraveYardList[i] = gy; } @@ -578,8 +581,53 @@ void BattlefieldWG::OnStartGrouping() SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } +uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) +{ + uint8 graveyardId = 0; + + switch (areaId) + { + case AREA_WINTERGRASP_FORTRESS: + return BATTLEFIELD_WG_GY_KEEP; + case AREA_THE_SUNKEN_RING: + return BATTLEFIELD_WG_GY_WORKSHOP_NE; + case AREA_THE_BROKEN_TEMPLATE: + return BATTLEFIELD_WG_GY_WORKSHOP_NW; + case AREA_WESTPARK_WORKSHOP: + return BATTLEFIELD_WG_GY_WORKSHOP_SW; + case AREA_EASTPARK_WORKSHOP: + return BATTLEFIELD_WG_GY_WORKSHOP_SE; + case AREA_WINTERGRASP: + return BATTLEFIELD_WG_GY_ALLIANCE; + case AREA_THE_CHILLED_QUAGMIRE: + return BATTLEFIELD_WG_GY_HORDE; + default: + sLog->outError(": Unexpected Area Id %u", areaId); + break; + } + + return graveyardId; +} + void BattlefieldWG::OnCreatureCreate(Creature *creature) { + // Accessing to db spawned creatures + switch (creature->GetEntry()) + { + // Alliance Spirit + case NPC_DWARVEN_SPIRIT_GUIDE: + // Horde Spirit + case NPC_TAUNKA_SPIRIT_GUIDE: + { + TeamId teamId = creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE; + uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId()); + if (m_GraveYardList[graveyardId]) + m_GraveYardList[graveyardId]->SetSpirit(creature, teamId); + } + break; + } + + // untested code - not sure if it is valid. if (IsWarTime()) { switch (creature->GetEntry()) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 71a729f8ba..d95b1bdab8 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -142,6 +142,18 @@ enum eWGWorldStates BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, }; + +enum WGAreaIds +{ + AREA_WINTERGRASP_FORTRESS = 4575, + AREA_THE_SUNKEN_RING = 4538, + AREA_THE_BROKEN_TEMPLATE = 4539, + AREA_WESTPARK_WORKSHOP = 4611, + AREA_EASTPARK_WORKSHOP = 4612, + AREA_WINTERGRASP = 4197, + AREA_THE_CHILLED_QUAGMIRE = 4589, +}; + /*######################### *####### Graveyards ######* #########################*/ @@ -157,7 +169,7 @@ class BfGraveYardWG : public BfGraveYard uint32 m_GossipTextId; }; -enum eWGGraveyardId +enum WGGraveyardId { BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GY_WORKSHOP_NW, @@ -414,6 +426,8 @@ class BattlefieldWG : public Battlefield void UpdateTenacity(); void ProcessEvent(WorldObject *obj, uint32 eventId); + // returns the graveyardId in the specified area. + uint8 GetSpiritGraveyardId(uint32 areaId); protected: bool m_CanClickOnOrb; GameObject* m_relic; From efcfdc4c397b12ddd0613cae74568e5df895c341 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Thu, 1 Mar 2012 19:27:00 -0300 Subject: [PATCH 100/147] BF/Wintergrasp: It's not necessary to remove Spell Spiritual Immunity manually. --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index fdca7c0c52..b04b63d031 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -862,7 +862,6 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); @@ -883,7 +882,6 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); @@ -903,7 +901,6 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); From 1f6eec4754f3fd8b6c74d19140010f4c057f0ddf Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Fri, 2 Mar 2012 15:23:07 -0300 Subject: [PATCH 101/147] BF/Wintergrasp: Implemented better support for Wintergrasp phasing. It has been done by checking player's distance to the Caputre Point on every tick. Now it is performed using spell_area. P.D: Reverted my last commit, it was wrong (my apologies) --- Wintergrasp_temp/{Spells.txt => Spells.sql} | 25 +++++++++++++- .../game/Battlefield/Zones/BattlefieldWG.cpp | 34 ++++++++++++------- .../game/Battlefield/Zones/BattlefieldWG.h | 2 ++ src/server/game/Spells/SpellMgr.cpp | 22 ++++++++++++ 4 files changed, 69 insertions(+), 14 deletions(-) rename Wintergrasp_temp/{Spells.txt => Spells.sql} (67%) diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.sql similarity index 67% rename from Wintergrasp_temp/Spells.txt rename to Wintergrasp_temp/Spells.sql index 583e46db04..91719f47e4 100644 --- a/Wintergrasp_temp/Spells.txt +++ b/Wintergrasp_temp/Spells.sql @@ -1,3 +1,24 @@ +SET @SPELL_HORDE := 56618; +SET @SPELL_ALLIANCE := 56617; + +SET @AREA_SUNKEN_RING := 4538; +SET @AREA_BROKEN_TEMPLE := 4539; +SET @AREA_W_WORKSHOP := 4611; +SET @AREA_E_WORKSHOP := 4612; + +DELETE FROM `spell_area` WHERE `spell` IN (@SPELL_HORDE, @SPELL_ALLIANCE); +INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES +(@SPELL_HORDE, @AREA_SUNKEN_RING, 1), +(@SPELL_ALLIANCE, @AREA_SUNKEN_RING, 1), +(@SPELL_HORDE, @AREA_BROKEN_TEMPLE, 1), +(@SPELL_ALLIANCE, @AREA_BROKEN_TEMPLE, 1), +(@SPELL_HORDE, @AREA_W_WORKSHOP, 1), +(@SPELL_ALLIANCE, @AREA_W_WORKSHOP, 1), +(@SPELL_HORDE, @AREA_E_WORKSHOP, 1), +(@SPELL_ALLIANCE, @AREA_E_WORKSHOP, 1); + +/* + Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32 Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16 @@ -26,4 +47,6 @@ Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): 61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) 56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) 14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) -14267 (Horde Flag) \ No newline at end of file +14267 (Horde Flag) + +*/ diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index b04b63d031..3e64894a8e 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -238,19 +238,6 @@ bool BattlefieldWG::Update(uint32 diff) } - for (uint8 team = 0; team < 2; ++team) - for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* player = sObjectAccessor->FindPlayer(*itr)) - for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr) - { - if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150 - { - player->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, player); - player->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); - break; - } - } - return m_return; } @@ -862,6 +849,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); @@ -882,6 +870,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); @@ -901,6 +890,7 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); @@ -913,6 +903,24 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) SendInitWorldStatesTo(player); } +uint32 BattlefieldWG::GetData(uint32 data) +{ + switch (data) + { + // Used to determine when the phasing spells must be casted + // See: SpellArea::IsFitToRequirements + case AREA_THE_SUNKEN_RING: + case AREA_THE_BROKEN_TEMPLATE: + case AREA_WESTPARK_WORKSHOP: + case AREA_EASTPARK_WORKSHOP: + // Graveyards and Workshops are controlled by the same team. + if (m_GraveYardList[GetSpiritGraveyardId(data)]) + return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); + } + + return 0; +} + // Method sending worldsate to player WorldPacket BattlefieldWG::BuildInitWorldStates() { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index d95b1bdab8..94210dd3fd 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -428,6 +428,8 @@ class BattlefieldWG : public Battlefield // returns the graveyardId in the specified area. uint8 GetSpiritGraveyardId(uint32 areaId); + + uint32 GetData(uint32 data); protected: bool m_CanClickOnOrb; GameObject* m_relic; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 93bb15d844..1d929d0021 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -30,6 +30,8 @@ #include "CreatureAI.h" #include "MapManager.h" #include "BattlegroundIC.h" +#include "BattlefieldWG.h" +#include "BattlefieldMgr.h" bool IsPrimaryProfessionSkill(uint32 skill) { @@ -1145,6 +1147,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; } + case 56618: // Horde Controls Factory Phase Shift + case 56617: // Alliance Controls Factory Phase Shift + { + if (!player) + return false; + + Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + + if (!bf || bf->GetTypeId() != BATTLEFIELD_WG) + return false; + + // team that controls the workshop in the specified area + uint32 team = bf->GetData(newArea); + + if (team == TEAM_HORDE) + return spellId == 56618; + else if (team == TEAM_ALLIANCE) + return spellId == 56617; + } + break; } return true; From d7a7a9800b734f71074da84338ba29a93009a198 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Fri, 2 Mar 2012 22:00:26 -0300 Subject: [PATCH 102/147] Battlefield: Make sBattlefieldMgr a pointer. By Subv. --- src/server/game/Battlefield/Battlefield.cpp | 2 +- .../game/Battlefield/BattlefieldHandler.cpp | 6 +- src/server/game/Battlefield/BattlefieldMgr.h | 79 ++++++++ src/server/game/Entities/Object/Object.cpp | 8 + src/server/game/Entities/Player/Player.cpp | 10 +- src/server/game/Entities/Unit/Unit.cpp | 5 + src/server/game/Handlers/MiscHandler.cpp | 53 ++++++ .../game/Spells/Auras/SpellAuraEffects.cpp | 4 + src/server/game/Spells/Spell.cpp | 1 + src/server/game/Spells/SpellMgr.cpp | 4 +- src/server/game/World/World.cpp | 7 + src/server/scripts/Commands/cs_bf.cpp | 180 ++++++++++++++++++ src/server/scripts/Northrend/wintergrasp.cpp | 14 +- 13 files changed, 359 insertions(+), 14 deletions(-) create mode 100644 src/server/game/Battlefield/BattlefieldMgr.h create mode 100644 src/server/scripts/Commands/cs_bf.cpp diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 2e9e4607ee..f9c4e4736d 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -494,7 +494,7 @@ void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) void Battlefield::RegisterZone(uint32 zoneId) { - sBattlefieldMgr.AddZone(zoneId, this); + sBattlefieldMgr->AddZone(zoneId, this); } void Battlefield::HideNpc(Creature *p_Creature) diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 7785fd3bff..0b26ae8dc5 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -102,7 +102,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data) recv_data >> BattleId >> Accepted; sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -120,7 +120,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) recv_data >> BattleId >> Accepted; sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -142,7 +142,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket & recv_data) recv_data >> BattleId; sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId); - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h new file mode 100644 index 0000000000..a447d787be --- /dev/null +++ b/src/server/game/Battlefield/BattlefieldMgr.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef BATTLEFIELD_MGR_H_ +#define BATTLEFIELD_MGR_H_ + +#include "Battlefield.h" +#include "ace/Singleton.h" + +class Player; +class GameObject; +class Creature; +class ZoneScript; +struct GossipMenuItems; + +// class to handle player enter / leave / areatrigger / GO use events +class BattlefieldMgr +{ + public: + // ctor + BattlefieldMgr(); + // dtor + ~BattlefieldMgr(); + + // create battlefield events + void InitBattlefield(); + // called when a player enters an battlefield area + void HandlePlayerEnterZone(Player * plr, uint32 areaflag); + // called when player leaves an battlefield area + void HandlePlayerLeaveZone(Player * plr, uint32 areaflag); + // called when player resurrects + void HandlePlayerResurrects(Player * plr, uint32 areaflag); + // return assigned battlefield + Battlefield *GetBattlefieldToZoneId(uint32 zoneid); + Battlefield *GetBattlefieldByBattleId(uint32 battleid); + + ZoneScript *GetZoneScript(uint32 zoneId); + + void AddZone(uint32 zoneid, Battlefield * handle); + + void Update(uint32 diff); + + void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid); + + bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso); + + void HandleDropFlag(Player * plr, uint32 spellId); + + typedef std::vector < Battlefield * >BattlefieldSet; + typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap; + private: + // contains all initiated battlefield events + // used when initing / cleaning up + BattlefieldSet m_BattlefieldSet; + // maps the zone ids to an battlefield event + // used in player event handling + BattlefieldMap m_BattlefieldMap; + // update interval + uint32 m_UpdateTimer; +}; + +#define sBattlefieldMgr ACE_Singleton::instance() + +#endif diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index b910fee951..b265648d0c 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2329,9 +2329,17 @@ void WorldObject::SetZoneScript() if (map->IsDungeon()) m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript(); else if (!map->IsBattlegroundOrArena()) + { + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); } } + m_zoneScript = bf; + else + m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); + } + } +} TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempSummonType spwtype, uint32 duration, uint32 /*vehId*/) const { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2814b7dba6..2cb38d615a 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2405,6 +2405,7 @@ void Player::RemoveFromWorld() StopCastingBindSight(); UnsummonPetTemporaryIfAny(); sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); + sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); } ///- Do not add/remove the player from the object storage @@ -5493,7 +5494,12 @@ void Player::RepopAtGraveyard() if (Battleground* bg = GetBattleground()) ClosestGrave = bg->GetClosestGraveYard(this); else - ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); + { + if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) + ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this); + else + ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); + } // stop countdown until repop m_deathTimer = 0; @@ -7413,6 +7419,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) { sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone); + sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); + sBattlefieldMgr->HandlePlayerEnterZone(this, newZone); SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange... } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d65d717c23..5e94ea3146 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15675,9 +15675,14 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh... // handle player kill only if not suicide (spirit of redemption for example) if (player && this != victim) + { if (OutdoorPvP* pvp = player->GetOutdoorPvP()) pvp->HandleKill(player, victim); + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId())) + bf->HandleKill(player, victim); + } + //if (victim->GetTypeId() == TYPEID_PLAYER) // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP()) // pvp->HandlePlayerActivityChangedpVictim->ToPlayer(); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 02b0ef9fc0..26b41a6292 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1687,11 +1687,64 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) SendPacket(&data); } +//Battlefield and Battleground +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->SendAreaSpiritHealerQueryOpcode(_player,guid); +} + +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); +} + void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) { if (_player->isInFlight()) return; + if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + { + // bf->PlayerAskToLeave(_player); FIXME + return; + } + AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId()); if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2)) return; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 610cd7d153..e8675d52b2 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5016,8 +5016,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool case 2584: // Waiting to Resurrect // Waiting to resurrect spell cancel, we must remove player from resurrect queue if (target->GetTypeId() == TYPEID_PLAYER) + { if (Battleground* bg = target->ToPlayer()->GetBattleground()) bg->RemovePlayerFromResurrectQueue(target->GetGUID()); + if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId())) + bf->RemovePlayerFromResurrectQueue(target->GetGUID()); + } break; case 36730: // Flame Strike { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 1dedf8ba91..5281eb16f0 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5442,6 +5442,7 @@ SpellCastResult Spell::CheckCast(bool strict) // allow always ghost flight spells if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive()) { + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId()); if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId())) if (pArea->flags & AREA_FLAG_NO_FLY_ZONE) return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 1d929d0021..9545a03a9f 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1127,7 +1127,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (!player) return false; - Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))) return false; break; @@ -1153,7 +1153,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (!player) return false; - Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); if (!bf || bf->GetTypeId() != BATTLEFIELD_WG) return false; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index c0da783da7..c4ff906bc3 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1729,6 +1729,10 @@ void World::SetInitialWorldSettings() sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); + ///- Initialize Battlefield + sLog->outString("Starting Battlefield System"); + sBattlefieldMgr->InitBattlefield(); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); sMapMgr->LoadTransports(); @@ -1993,6 +1997,9 @@ void World::Update(uint32 diff) sOutdoorPvPMgr->Update(diff); RecordTimeDiff("UpdateOutdoorPvPMgr"); + sBattlefieldMgr->Update(diff); + RecordTimeDiff("BattlefieldMgr"); + ///- Delete all characters which have been deleted X days before if (m_timers[WUPDATE_DELETECHARS].Passed()) { diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp new file mode 100644 index 0000000000..4eee7c391b --- /dev/null +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2008-2011 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +/* ScriptData +Name: bf_commandscript +%Complete: 100 +Comment: All bf related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "BattlefieldMgr.h" + +class bf_commandscript : public CommandScript +{ +public: + bf_commandscript() : CommandScript("bf_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand battlefieldcommandTable[] = + { + { "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "", NULL }, + { "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "", NULL }, + { "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "", NULL }, + { "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "", NULL }, + { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleBattlefieldStart(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->StartBattle(); + + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)"); + + return true; + } + + static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->EndBattle(true); + + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)"); + + return true; + } + + static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + if (bf->GetEnable()) + { + bf->SetEnable(false); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp is disabled"); + } + else + { + bf->SetEnable(true); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp is enabled"); + } + + return true; + } + + static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + + battleid = atoi(battleid_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->EndBattle(false); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)"); + + return true; + } + + static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args) + { + uint32 battleid = 0; + uint32 time = 0; + char* battleid_str = strtok((char*)args, " "); + if (!battleid_str) + return false; + char* time_str = strtok(NULL, " "); + if (!time_str) + return false; + + battleid = atoi(battleid_str); + + time = atoi(time_str); + + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); + + if (!bf) + return false; + + bf->SetTimer(time * IN_MILLISECONDS); + bf->SendInitWorldStatesToAll(); + if (battleid == 1) + handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)"); + + return true; + } +}; + +void AddSC_bf_commandscript() +{ + new bf_commandscript(); +} diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d7565fcfaf..936be459f9 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -63,7 +63,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -91,7 +91,7 @@ class npc_wg_demolisher_engineer : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); if (!BfWG) return true; @@ -132,7 +132,7 @@ class npc_wg_spirit_guide : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -154,7 +154,7 @@ class npc_wg_spirit_guide : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { GraveYardVect gy = BfWG->GetGraveYardVect(); @@ -183,7 +183,7 @@ class npc_wg_queue : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { @@ -214,7 +214,7 @@ class npc_wg_queue : public CreatureScript { pPlayer->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (BfWG->IsWarTime()) @@ -302,7 +302,7 @@ class npc_wg_quest_giver : public CreatureScript if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr.GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (pCreature->isQuestGiver()) From 27bfafe0e15ab07b98f3684c6f3ae98100cab1c2 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Sun, 4 Mar 2012 01:24:00 -0300 Subject: [PATCH 103/147] BF/Wintergrasp: Removed harcoded Workshops related spawns, db data is used now. --- Wintergrasp_temp/Spawns.sql | 10 + src/server/game/Battlefield/Battlefield.cpp | 48 +-- src/server/game/Battlefield/Battlefield.h | 4 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 103 ++++-- .../game/Battlefield/Zones/BattlefieldWG.h | 331 ++++++------------ 5 files changed, 215 insertions(+), 281 deletions(-) diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/Spawns.sql index ab061598df..3464ed3ee0 100644 --- a/Wintergrasp_temp/Spawns.sql +++ b/Wintergrasp_temp/Spawns.sql @@ -1,3 +1,13 @@ +-- Before pushing to master check if guids are free. +-- Spawns Workshop Capture Points +SET @GUID := 4594; +DELETE FROM gameobject WHERE guid IN (@GUID+1,@GUID+2,@GUID+3,@GUID+4); +INSERT INTO gameobject (guid,id,position_x,position_y,position_z,orientation,map) VALUES +(@GUID+1, 190475, 4949.344238, 2432.585693, 320.176971, 1.386214, 571), -- ne +(@GUID+2, 190487, 4948.524414, 3342.337891, 376.875366, 4.400566, 571), -- nw +(@GUID+3, 194959, 4398.076660, 2356.503662, 376.190491, 0.525406, 571), -- se +(@GUID+4, 194962, 4390.776367, 3304.094482, 372.429077, 6.097023, 571); -- sw + -- EVERYTHING UNDER HERE IS WIP /* SET @OGUID := XXXXX; diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index f9c4e4736d..b0bf1a4166 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -944,40 +944,40 @@ void BfCapturePoint::SendChangePhase() SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); } -bool BfCapturePoint::SetCapturePointData(uint32 entry, uint32 /*map */ , float x, float y, float z, float o) +bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) { - sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", entry); + ASSERT(capturePoint); + + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry()); + + m_capturePoint = capturePoint; // check info existence - GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(capturePoint->GetEntry()); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); + sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; } - m_capturePoint = m_Bf->SpawnGameObject(entry, x, y, z, o); - if (m_capturePoint) + + // get the needed values from goinfo + m_maxValue = goinfo->capturePoint.maxTime; + m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); + m_neutralValuePct = goinfo->capturePoint.neutralPercent; + m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; + m_capturePointEntry = capturePoint->GetEntry(); + if (m_team == TEAM_ALLIANCE) { - // get the needed values from goinfo - m_maxValue = goinfo->capturePoint.maxTime; - m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); - m_neutralValuePct = goinfo->capturePoint.neutralPercent; - m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; - m_capturePointEntry = entry; - if (m_team == TEAM_ALLIANCE) - { - m_value = m_maxValue; - m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; - } - else - { - m_value = -m_maxValue; - m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; - } - return true; + m_value = m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE; + } + else + { + m_value = -m_maxValue; + m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE; } - return false; + return true; } bool BfCapturePoint::DelCapturePoint() diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 77c9aa42c5..ba34e07a4e 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -100,8 +100,8 @@ public: virtual void ChangeTeam(TeamId /*oldTeam */ ) {} virtual void SendChangePhase(); - bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o); - GameObject *GetCapturePointGo() { return m_capturePoint; } + bool SetCapturePointData(GameObject* capturePoint); + GameObject* GetCapturePointGo() { return m_capturePoint; } TeamId GetTeamId() {return m_team;} protected: diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 3e64894a8e..4c39f75938 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -99,37 +99,21 @@ bool BattlefieldWG::SetupBattlefield() m_GraveYardList[i] = gy; } + // Spawn workshop creatures and gameobjects for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++) { - BfWGWorkShopData *ws = new BfWGWorkShopData(this); // Create new object - // Init:setup variable - ws->Init(WGWorkShopDataBase[i].worldstate, WGWorkShopDataBase[i].type, WGWorkShopDataBase[i].nameid); - // Spawn associate npc on this point (Guard/Engineer) - for (uint8 c = 0; c < WGWorkShopDataBase[i].nbcreature; c++) - ws->AddCreature(WGWorkShopDataBase[i].CreatureData[c]); - - // Spawn associate gameobject on this point (Horde/Alliance flags) - for (uint8 g = 0; g < WGWorkShopDataBase[i].nbgob; g++) - ws->AddGameObject(WGWorkShopDataBase[i].GameObjectData[g]); - - // Create PvPCapturePoint - if (WGWorkShopDataBase[i].type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - { - ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point - // Create Object - BfCapturePointWG *workshop = new BfCapturePointWG(this, GetAttackerTeam()); - // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association) - workshop->SetCapturePointData(WGWorkShopDataBase[i].CapturePoint.entryh, 571, - WGWorkShopDataBase[i].CapturePoint.x, WGWorkShopDataBase[i].CapturePoint.y, WGWorkShopDataBase[i].CapturePoint.z, 0); - workshop->LinkToWorkShop(ws); // Link our point to the capture point (for faction changement) - AddCapturePoint(workshop); // Add this capture point to list for update this (view in Update() of OutdoorPvP) - } + WGWorkshop* workshop = new WGWorkshop(this, i); + if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + workshop->ChangeControl(GetAttackerTeam(), true); else - ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep workshop= to deffender team) + workshop->ChangeControl(GetDefenderTeam(), true); - WorkShopList.insert(ws); + //Note: Capture point is added once the gameobject is created. + + WorkshopsList.insert(workshop); } + // Spawning npc in keep for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) { @@ -285,7 +269,7 @@ void BattlefieldWG::OnBattleStart() m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0; // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { if (*itr) (*itr)->UpdateGraveYardAndWorkshop(); @@ -320,13 +304,13 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0; m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0; - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { - if (BfWGWorkShopData* workshop = *itr) + if (WGWorkshop* workshop = (*itr)) { - if (workshop->m_TeamControl == TEAM_ALLIANCE) + if (workshop->teamControl == TEAM_ALLIANCE) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; - else if (workshop->m_TeamControl == TEAM_HORDE) + else if (workshop->teamControl == TEAM_HORDE) m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4; } } @@ -408,7 +392,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // Saving data for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) (*itr)->Save(); - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) (*itr)->Save(); uint32 WinHonor = 0; @@ -702,6 +686,52 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) } } +void BattlefieldWG::OnGameObjectCreate(GameObject* go) +{ + bool isWorkshop = false; + uint8 workshopId = 0; + + switch (go->GetEntry()) + { + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_NE; + break; + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_NW; + break; + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_SE; + break; + case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW: + isWorkshop = true; + workshopId = BATTLEFIELD_WG_WORKSHOP_SW; + break; + + } + + if (isWorkshop) + { + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) + { + if (WGWorkshop* workshop = (*itr)) + { + if (workshop->workshopId == workshopId) + { + BfCapturePointWG* capturePoint = new BfCapturePointWG(this, GetAttackerTeam()); + + capturePoint->SetCapturePointData(go); + capturePoint->LinkToWorkShop(workshop); + AddCapturePoint(capturePoint); + break; + } + } + } + } +} + // Called when player kill a unit in wg zone void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { @@ -924,12 +954,12 @@ uint32 BattlefieldWG::GetData(uint32 data) // Method sending worldsate to player WorldPacket BattlefieldWG::BuildInitWorldStates() { - WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkShopList.size() * 8))); + WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8))); data << uint32(m_MapId); data << uint32(m_ZoneId); data << uint32(0); - data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkShopList.size()); + data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkshopsList.size()); data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); @@ -948,9 +978,12 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() { data << (*itr)->m_WorldState << (*itr)->m_State; } - for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr) + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { - data << (*itr)->m_WorldState << (*itr)->m_State; + if (!*itr) + continue; + + data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; } return data; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 94210dd3fd..9d70d0b5ce 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -36,11 +36,11 @@ class BattlefieldWG; class BfCapturePointWG; struct BfWGGameObjectBuilding; -struct BfWGWorkShopData; +struct WGWorkshop; typedef std::setGameObjectSet; typedef std::set GameObjectBuilding; -typedef std::set WorkShop; +typedef std::set Workshop; //typedef std::set CapturePointSet; unused ? typedef std::set GroupSet; @@ -260,9 +260,9 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { class BfCapturePointWG : public BfCapturePoint { public: - BfCapturePointWG(BattlefieldWG *bf, TeamId control); + BfCapturePointWG(BattlefieldWG* bf, TeamId control); - void LinkToWorkShop(BfWGWorkShopData *ws) + void LinkToWorkShop(WGWorkshop* ws) { m_WorkShop = ws; } @@ -274,7 +274,7 @@ class BfCapturePointWG : public BfCapturePoint } protected: - BfWGWorkShopData *m_WorkShop; + WGWorkshop *m_WorkShop; }; /*######################### @@ -361,6 +361,8 @@ class BattlefieldWG : public Battlefield */ void OnCreatureRemove(Creature* creature); + void OnGameObjectCreate(GameObject* go); + /** * \brief Called when a wall/tower is broken * -Update quest @@ -436,7 +438,7 @@ class BattlefieldWG : public Battlefield GameObjectBuilding BuildingsInZone; GuidSet KeepCreature[2]; GuidSet OutsideCreature[2]; - WorkShop WorkShopList; + Workshop WorkshopsList; GuidSet CanonList; GameObjectSet DefenderPortalList; GameObjectSet m_KeepGameObject[2]; @@ -471,7 +473,7 @@ enum eWGGameObjectState BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY, }; -enum eWGWorkShopType +enum WGWorkshopId { BATTLEFIELD_WG_WORKSHOP_NE, BATTLEFIELD_WG_WORKSHOP_NW, @@ -481,6 +483,15 @@ enum eWGWorkShopType BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, }; +enum WGWorldstate +{ + WORLDSTATE_WORKSHOP_NE = 3701, + WORLDSTATE_WORKSHOP_NW = 3700, + WORLDSTATE_WORKSHOP_SE = 3703, + WORLDSTATE_WORKSHOP_SW = 3702, + WORLDSTATE_WORKSHOP_K_W = 3698, + WORLDSTATE_WORKSHOP_K_E = 3699 +}; enum eWGTeamControl { BATTLEFIELD_WG_TEAM_ALLIANCE, @@ -518,7 +529,7 @@ enum eWGText // *INDENT-ON* }; -enum eWGObject +enum WGObject { // *INDENT-OFF* BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475, @@ -1100,219 +1111,29 @@ const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = // *****************WorkShop Data & Element***************** // ********************************************************* -struct BfWGWorkShopDataBase -{ - uint32 entry; - uint32 worldstate; - uint32 type; - uint32 nameid; - BfWGObjectPosition CapturePoint; - uint8 nbcreature; - BfWGObjectPosition CreatureData[10]; - uint8 nbgob; - BfWGObjectPosition GameObjectData[10]; -}; -// 6 engineer per faction in sql / 6 engineer per faction in header #define WG_MAX_WORKSHOP 6 -const BfWGWorkShopDataBase WGWorkShopDataBase[WG_MAX_WORKSHOP] = { - { - 192031, - 3701, - BATTLEFIELD_WG_WORKSHOP_NE, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE, - { 4949.344238f, 2432.585693f, 320.176971f, 1.386214f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE }, - 1, - { - { 4939.759766f, 2389.060059f, 326.153015f, 3.263770f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 6, - { - { 4778.189f, 2438.060f, 345.644f, -2.940f, 192280, 192274 }, - { 5024.569f, 2532.750f, 344.023f, -1.937f, 192280, 192274 }, - { 4811.399f, 2441.899f, 358.207f, -2.003f, 192435, 192406 }, - { 4805.669f, 2407.479f, 358.191f, 1.780f, 192435, 192406 }, - { 5004.350f, 2486.360f, 358.449f, 2.172f, 192435, 192406 }, - { 4983.279f, 2503.090f, 358.177f, -0.427f, 192435, 192406 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192030, - 3700, - BATTLEFIELD_WG_WORKSHOP_NW, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW, - { 4948.524414f, 3342.337891f, 376.875366f, 4.400566f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW }, - 1, - { - { 4964.890137f, 3383.060059f, 382.911011f, 6.126110f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 4, - { - { 5006.339f, 3280.399f, 371.162f, 2.225f, 192280, 192274 }, - { 5041.609f, 3294.399f, 382.149f, -1.631f, 192434, 192406 }, - { 4857.970f, 3335.439f, 368.881f, -2.945f, 192280, 192274 }, - { 4855.629f, 3297.620f, 376.739f, -3.132f, 192435, 192406 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192033, - 3703, - BATTLEFIELD_WG_WORKSHOP_SE, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE, - { 4398.076660f, 2356.503662f, 376.190491f, 0.525406f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE }, - 9, - { - { 4417.919922f, 2331.239990f, 370.919006f, 5.846850f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4418.609863f, 2355.290039f, 372.490997f, 6.021390f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4391.669922f, 2300.610107f, 374.743011f, 4.921830f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4349.120117f, 2299.280029f, 374.743011f, 4.904380f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4333.549805f, 2333.909912f, 376.156006f, 0.973007f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4413.430176f, 2393.449951f, 376.359985f, 1.064650f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4388.129883f, 2411.979980f, 374.743011f, 1.640610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4349.540039f, 2411.260010f, 374.743011f, 2.059490f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4357.669922f, 2357.989990f, 382.006989f, 1.675520f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 } - }, - 2, - { - { 4417.250f, 2301.139f, 377.213f, 0.026f, 192435, 192406 }, - { 4417.939f, 2324.810f, 371.576f, 3.080f, 192280, 192274 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192032, - 3702, - BATTLEFIELD_WG_WORKSHOP_SW, - BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW, - { 4390.776367f, 3304.094482f, 372.429077f, 6.097023f, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW, BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW }, - 9, - { - { 4425.290039f, 3291.510010f, 370.773987f, 0.122173f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4424.609863f, 3321.100098f, 369.800995f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4392.399902f, 3354.610107f, 369.597992f, 1.570800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4370.979980f, 3355.020020f, 371.196991f, 1.675520f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4394.660156f, 3231.989990f, 369.721985f, 4.625120f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4366.979980f, 3233.560059f, 371.584991f, 4.939280f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4337.029785f, 3261.659912f, 373.524994f, 3.263770f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4323.779785f, 3287.100098f, 378.894989f, 2.862340f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, - { 4354.149902f, 3312.820068f, 378.045990f, 1.675520f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 } - }, - 3, - { - { 4438.299f, 3361.080f, 371.567f, -0.017f, 192435, 192406 }, - { 4448.169f, 3235.629f, 370.411f, -1.562f, 192435, 192406 }, - { 4424.149f, 3286.540f, 371.545f, 3.124f, 192280, 192274 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192028, - 3698, - BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, - 0, - { 0, 0, 0, 0, 0, 0 }, - 1, - { - { 5392.910156f, 2975.260010f, 415.222992f, 4.555310f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 0, - { - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - }, - { - 192029, - 3699, - BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, - 0, - { 0, 0, 0, 0, 0, 0 }, - 1, - { - { 5391.609863f, 2707.719971f, 415.050995f, 4.555310f, 30400, 30499 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }, - 0, - { - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - } - } + +struct WGWorkshopData +{ + uint8 id; + uint32 worldstate; + uint32 text; +}; + +const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] = +{ + // NE + {BATTLEFIELD_WG_WORKSHOP_NE, WORLDSTATE_WORKSHOP_NE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE}, + // NW + {BATTLEFIELD_WG_WORKSHOP_NW, WORLDSTATE_WORKSHOP_NW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW}, + // SE + {BATTLEFIELD_WG_WORKSHOP_SE, WORLDSTATE_WORKSHOP_SE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE}, + // SW + {BATTLEFIELD_WG_WORKSHOP_SW, WORLDSTATE_WORKSHOP_SW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW}, + // KEEP WEST - It can't be taken, so it doesn't have a textid + {BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, WORLDSTATE_WORKSHOP_K_W, NULL}, + // KEEP EAST - It can't be taken, so it doesn't have a textid + {BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, WORLDSTATE_WORKSHOP_K_E, NULL} }; // ******************************************************************** @@ -1771,6 +1592,76 @@ struct BfWGGameObjectBuilding } }; +struct WGWorkshop +{ + // pointer to the battlefield that the workshop belongs to + BattlefieldWG* bf; + // id of the workshop, useful to retrieve data of the WorkshopsData array + uint8 workshopId; + // team that controls the node + uint8 teamControl; + // for worldstate + uint32 state; + + WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId) + { + ASSERT(bf); + ASSERT(_workshopId < WG_MAX_WORKSHOP); + + bf = _bf; + workshopId = _workshopId; + } + + void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + { + switch (team) + { + case BATTLEFIELD_WG_TEAM_NEUTRAL: + { + // Send warning message to all player to inform a faction attack to a workshop + // alliance / horde attacking a workshop + bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1); + break; + } + case BATTLEFIELD_WG_TEAM_ALLIANCE: + case BATTLEFIELD_WG_TEAM_HORDE: + { + // Updating worldstate + state = team == BATTLEFIELD_WG_TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; + bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state); + + // Warning message + if (!init) // workshop taken - alliance + bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text+1); + + // Found associate graveyard and update it + if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (bf->GetGraveYardById(workshopId)) + bf->GetGraveYardById(workshopId)->ChangeControl(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); + + teamControl = team; + break; + } + } + + if (!init) + bf->UpdateCounterVehicle(false); + } + + void UpdateGraveYardAndWorkshop() + { + if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + bf->GetGraveYardById(workshopId)->ChangeControl(TeamId(teamControl)); + else + ChangeControl(bf->GetDefenderTeam(), true); + } + + void Save() + { + sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state); + } +}; + // Structure for the 6 workshop struct BfWGWorkShopData { From ce17607595a0fd83a0ed95bbccd132c5a5738598 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco Date: Sun, 4 Mar 2012 13:29:05 -0300 Subject: [PATCH 104/147] BF/Battlefield: Small improvement, thanks to Subv. --- src/server/game/Battlefield/Battlefield.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index b0bf1a4166..501351f2e4 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -953,8 +953,8 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) m_capturePoint = capturePoint; // check info existence - GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(capturePoint->GetEntry()); - if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) + GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); + if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; From f9c9622f86b963dbd7cf57d6dc73577797f11fd8 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 4 Mar 2012 13:01:50 -0500 Subject: [PATCH 105/147] Battlefields/WG: Refactored duplicated code --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 59 +++++-------------- .../game/Battlefield/Zones/BattlefieldWG.h | 6 +- 2 files changed, 18 insertions(+), 47 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 4c39f75938..6fafbf823e 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -452,18 +452,10 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (uint8 team = 0; team < 2; ++team) { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) - { - player->RemoveAura(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - } - } - m_PlayersInWar[team].clear(); + RemoveAurasFromPlayer(player); + + m_PlayersInWar[team].clear(); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) { @@ -826,7 +818,7 @@ void BattlefieldWG::PromotePlayer(Player* killer) } } -void BattlefieldWG::OnPlayerJoinWar(Player* player) +void BattlefieldWG::RemoveAurasFromPlayer(Player* player) { player->RemoveAurasDueToSpell(SPELL_RECRUIT); player->RemoveAurasDueToSpell(SPELL_CORPORAL); @@ -835,6 +827,12 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); + player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); +} + +void BattlefieldWG::OnPlayerJoinWar(Player* player) +{ + RemoveAurasFromPlayer(player); player->CastSpell(player, SPELL_RECRUIT, true); @@ -875,15 +873,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) { if (player->GetVehicle()) // Remove vehicle of player if he go out. player->GetVehicle()->Dismiss(); - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); - player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); + RemoveAurasFromPlayer(player); } player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); @@ -893,18 +883,9 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) void BattlefieldWG::OnPlayerLeaveZone(Player* player) { - player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); if (!m_BattlefieldActive) - { - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - } + RemoveAurasFromPlayer(player); + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); @@ -913,20 +894,8 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) void BattlefieldWG::OnPlayerEnterZone(Player* player) { - player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); if (!m_BattlefieldActive) - { - player->RemoveAurasDueToSpell(SPELL_RECRUIT); - player->RemoveAurasDueToSpell(SPELL_CORPORAL); - player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); - player->RemoveAurasDueToSpell(SPELL_TENACITY); - player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); - player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); - if (player->GetTeamId() == GetDefenderTeam()) - player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); - } + RemoveAurasFromPlayer(player); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); // Send worldstate to player diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 9d70d0b5ce..e46bf2b7e5 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -383,6 +383,8 @@ class BattlefieldWG : public Battlefield void AddBrokenTower(TeamId team); void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); + + void RemoveAurasFromPlayer(Player* player); /** * \brief Called when battlefield is setup, at server start @@ -390,13 +392,13 @@ class BattlefieldWG : public Battlefield bool SetupBattlefield(); /// Return pointer to relic object - GameObject *GetRelic() + GameObject* GetRelic() { return m_relic; } /// Define relic object - void SetRelic(GameObject * relic) + void SetRelic(GameObject* relic) { m_relic = relic; } From 29343947e9da820d19b3f003c3551caa38bfe927 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:34:19 -0500 Subject: [PATCH 106/147] Core/Battlefield: attempt to fix crashes. please test and confirm --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/game/Battlefield/Zones/BattlefieldWG.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6fafbf823e..7a3a151467 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -321,7 +321,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) void BattlefieldWG::OnBattleEnd(bool endbytimer) { // Remove relic - if (m_relic) + if (m_relic && m_relic->isSpawned()) m_relic->RemoveFromWorld(); m_relic = NULL; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index e46bf2b7e5..b5f4ffe8ad 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1607,7 +1607,7 @@ struct WGWorkshop WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId) { - ASSERT(bf); + ASSERT(_bf); ASSERT(_workshopId < WG_MAX_WORKSHOP); bf = _bf; From e9323b2c2def116360b987532ae7634fcd116122 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:37:05 -0500 Subject: [PATCH 107/147] Core/Battlefield: revert part of previous commit and correctly fix .bf stop crashing --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/scripts/Commands/cs_bf.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 7a3a151467..6fafbf823e 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -321,7 +321,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) void BattlefieldWG::OnBattleEnd(bool endbytimer) { // Remove relic - if (m_relic && m_relic->isSpawned()) + if (m_relic) m_relic->RemoveFromWorld(); m_relic = NULL; diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 4eee7c391b..750550353e 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -83,7 +83,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf) + if (!bf || !bf->IsWarTime()) return false; bf->EndBattle(true); From 00f88588380f5372cb66e31b67dae56e9da44de5 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:39:28 -0500 Subject: [PATCH 108/147] Core/Battlefield: attempt to correctly fix again. --- src/server/game/Battlefield/Battlefield.cpp | 2 ++ src/server/scripts/Commands/cs_bf.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 501351f2e4..e55000df32 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -327,6 +327,8 @@ void Battlefield::StartBattle() void Battlefield::EndBattle(bool endbytimer) { + if (!m_BattlefieldActive) + return false; m_BattlefieldActive = false; m_StartGrouping = false; diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 750550353e..d410ae890f 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -61,7 +61,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf) + if (!bf || bf->) return false; bf->StartBattle(); @@ -83,7 +83,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf || !bf->IsWarTime()) + if (!bf) return false; bf->EndBattle(true); From 7491926e0c800c71a6ee409129b4eb71190339cf Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:45:44 -0500 Subject: [PATCH 109/147] Core/Battlefield: fix stupid mistakes. sorry! --- src/server/game/Battlefield/Battlefield.cpp | 3 ++- src/server/scripts/Commands/cs_bf.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index e55000df32..3b1036ef3b 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -328,7 +328,8 @@ void Battlefield::StartBattle() void Battlefield::EndBattle(bool endbytimer) { if (!m_BattlefieldActive) - return false; + return; + m_BattlefieldActive = false; m_StartGrouping = false; diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index d410ae890f..4eee7c391b 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -61,7 +61,7 @@ public: Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid); - if (!bf || bf->) + if (!bf) return false; bf->StartBattle(); From 07c8eec9634cbb992c8ac3da8b6cd56c66262e66 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 09:51:04 -0500 Subject: [PATCH 110/147] Core/Battlefield: remove handling for aura application when entering water. handled by liquid data. --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6fafbf823e..6d04ab7874 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -208,20 +208,6 @@ bool BattlefieldWG::Update(uint32 diff) else m_saveTimer -= diff; - if (m_BattlefieldActive) - { - for (uint8 team = 0; team < 2; ++team) - for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - { - if (unit->IsInWater() && !unit->HasAura(SPELL_WINTERGRASP_WATER)) - unit->AddAura(SPELL_WINTERGRASP_WATER, unit); - if (!unit->IsInWater() && unit->HasAura(SPELL_WINTERGRASP_WATER)) - unit->RemoveAurasDueToSpell(SPELL_WINTERGRASP_WATER); - } - - } - return m_return; } From b04ad4401d986a8f7fb0a1b0928d67cbda86dd64 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 9 Mar 2012 10:14:02 -0500 Subject: [PATCH 111/147] Core/Battlefield: Cleaned up all incrementquest functions as this is a hacky way to do it --- src/server/game/Battlefield/Battlefield.cpp | 39 ------------------- src/server/game/Battlefield/Battlefield.h | 1 - .../game/Battlefield/Zones/BattlefieldWG.cpp | 17 ++------ 3 files changed, 3 insertions(+), 54 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 3b1036ef3b..009a197442 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -668,45 +668,6 @@ void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid pl->GetSession()->SendPacket(&data); } -bool Battlefield::IncrementQuest(Player *player, uint32 quest, bool complete) -{ - if (!player) - return false; - - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); - if (!pQuest || player->GetQuestStatus(quest) == QUEST_STATUS_NONE) - return false; - - if (complete) - { - player->CompleteQuest(quest); - return true; - } - else - { - for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - { - int32 creature = pQuest->RequiredNpcOrGo[i]; - if (uint32 spell_id = pQuest->RequiredSpellCast[i]) - { - player->CastedCreatureOrGO(creature, 0, spell_id); - return true; - } - else if (creature > 0) - { - player->KilledMonsterCredit(creature, 0); - return true; - } - else if (creature < 0) - { - player->CastedCreatureOrGO(creature, 0, 0); - return true; - } - } - } - return false; -} - //-------------------- //-BfGraveYard Method- //-------------------- diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index ba34e07a4e..9f3bcb18f5 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -314,7 +314,6 @@ class Battlefield:public ZoneScript /// Return if we can use mount in battlefield bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not - bool IncrementQuest(Player * player, uint32 quest, bool complete = false); void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid); void StartBattle(); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6d04ab7874..bd8a51c13f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -410,7 +410,6 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) player->RewardHonor(NULL, 1, WinHonor); RewardMarkOfHonor(player, 2); } - IncrementQuest(player, WGQuest[player->GetTeamId()][1], true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less @@ -719,8 +718,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) bool again = false; if (victim->GetTypeId() == TYPEID_PLAYER) { - IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); - IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) { if (Player* player = sObjectAccessor->FindPlayer(*itr)) @@ -739,12 +736,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) - { - if (Player* player = sObjectAccessor->FindPlayer(*iter)) - if (player->GetDistance2d(killer) < 40) - IncrementQuest(player, WGQuest[player->GetTeamId()][0]); - } } } } @@ -759,8 +750,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - IncrementQuest(killer, WGQuest[killer->GetTeamId()][4]); - IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]); for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) { if (Player* player = sObjectAccessor->FindPlayer(*iter)) @@ -960,14 +949,15 @@ void BattlefieldWG::SendInitWorldStatesToAll() void BattlefieldWG::BrokenWallOrTower(TeamId team) { - if (team == GetDefenderTeam()) +// might be some use for this in the future. old code commented out below. KL +/* if (team == GetDefenderTeam()) { for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) { if (Player* player = sObjectAccessor->FindPlayer(*itr)) IncrementQuest(player, WGQuest[player->GetTeamId()][2], true); } - } + }*/ } // Called when a tower is broke void BattlefieldWG::AddBrokenTower(TeamId team) @@ -989,7 +979,6 @@ void BattlefieldWG::AddBrokenTower(TeamId team) if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); - IncrementQuest(player, WGQuest[player->GetTeamId()][3], true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } // If the threw south tower is destroy From 547bb4757539aab76771061b9a25fdf7785978ed Mon Sep 17 00:00:00 2001 From: thomas33 Date: Mon, 12 Mar 2012 15:07:27 +0100 Subject: [PATCH 112/147] Core/Battlefield: plr -> player --- src/server/game/Battlefield/Battlefield.cpp | 270 +++++++++--------- src/server/game/Battlefield/Battlefield.h | 48 ++-- .../game/Battlefield/BattlefieldHandler.cpp | 2 +- .../game/Battlefield/BattlefieldMgr.cpp | 143 ++++++++++ src/server/game/Battlefield/BattlefieldMgr.h | 8 +- .../game/Battlefield/Zones/BattlefieldWG.h | 20 +- 6 files changed, 317 insertions(+), 174 deletions(-) create mode 100644 src/server/game/Battlefield/BattlefieldMgr.cpp diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 009a197442..085be81c98 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -63,62 +63,62 @@ Battlefield::~Battlefield() { } -void Battlefield::HandlePlayerEnterZone(Player *plr, uint32 /*zone */ ) +void Battlefield::HandlePlayerEnterZone(Player *player, uint32 /*zone */ ) { //If battle is start, // if it not fully > invite player to join the war // if it fully > announce to player that BF is full and kick after few second if he dont leave if (IsWarTime()) { - if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) //Not fully + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) //Not fully { - InvitePlayerToWar(plr); + InvitePlayerToWar(player); } else //Full { //TODO:Send packet for announce it to player - m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; - InvitePlayerToQueue(plr); + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; + InvitePlayerToQueue(player); } } else { //If time left is <15 minutes invite player to join queue if (m_Timer <= m_StartGroupingTimer) - InvitePlayerToQueue(plr); + InvitePlayerToQueue(player); } //Add player in list of player in zone - m_players[plr->GetTeamId()].insert(plr->GetGUID()); - OnPlayerEnterZone(plr); //for scripting + m_players[player->GetTeamId()].insert(player->GetGUID()); + OnPlayerEnterZone(player); //for scripting } //Called when a player leave the zone -void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ ) +void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ ) { if (IsWarTime()) { //if player is in war list - if (m_PlayersInWar[plr->GetTeamId()].find(plr->GetGUID()) != m_PlayersInWar[plr->GetTeamId()].end()) + if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end()) { - m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID()); - plr->GetSession()->SendBfLeaveMessage(m_BattleId); - if (Group* group = plr->GetGroup()) // remove from raid group if player is member - group->RemoveMember(plr->GetGUID()); + m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID()); + player->GetSession()->SendBfLeaveMessage(m_BattleId); + if (Group* group = player->GetGroup()) // remove from raid group if player is member + group->RemoveMember(player->GetGUID()); - OnPlayerLeaveWar(plr); //For scripting + OnPlayerLeaveWar(player); //For scripting } } for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - itr->second->HandlePlayerLeave(plr); + itr->second->HandlePlayerLeave(player); - m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); - m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); - m_players[plr->GetTeamId()].erase(plr->GetGUID()); - SendRemoveWorldStates(plr); - RemovePlayerFromResurrectQueue(plr->GetGUID()); - OnPlayerLeaveZone(plr); //For scripting + m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); + m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID()); + m_players[player->GetTeamId()].erase(player->GetGUID()); + SendRemoveWorldStates(player); + RemovePlayerFromResurrectQueue(player->GetGUID()); + OnPlayerLeaveZone(player); //For scripting } bool Battlefield::Update(uint32 diff) @@ -196,17 +196,17 @@ void Battlefield::InvitePlayerInZoneToQueue() { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - InvitePlayerToQueue(plr); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + InvitePlayerToQueue(player); } -void Battlefield::InvitePlayerToQueue(Player *plr) +void Battlefield::InvitePlayerToQueue(Player *player) { - if (m_PlayersInQueue[plr->GetTeamId()].count(plr->GetGUID())) + if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID())) return; - if (m_PlayersInQueue[plr->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[plr->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) - plr->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); + if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[player->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) + player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); } void Battlefield::InvitePlayerInQueueToWar() @@ -215,10 +215,10 @@ void Battlefield::InvitePlayerInQueueToWar() { for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) - InvitePlayerToWar(plr); + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(player); else { //Full @@ -234,49 +234,49 @@ void Battlefield::InvitePlayerInZoneToWar() for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID())) continue; - if (m_PlayersInWar[plr->GetTeamId()].size() + m_InvitedPlayers[plr->GetTeamId()].size() < m_MaxPlayer) - InvitePlayerToWar(plr); + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) + InvitePlayerToWar(player); else { //full - m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; } } } } -void Battlefield::InvitePlayerToWar(Player *plr) +void Battlefield::InvitePlayerToWar(Player *player) { - if (!plr) + if (!player) return; // TODO : needed ? - if (plr->isInFlight()) + if (player->isInFlight()) return; - if (plr->InArena() || plr->GetBattleground()) + if (player->InArena() || player->GetBattleground()) { - m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); + m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID()); return; } - if (plr->getLevel() < m_MinLevel) + if (player->getLevel() < m_MinLevel) { - if (m_PlayersWillBeKick[plr->GetTeamId()].count(plr->GetGUID()) == 0) - m_PlayersWillBeKick[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + 10; + if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; return; } //Check if player is not already in war - if (m_PlayersInWar[plr->GetTeamId()].count(plr->GetGUID()) || m_InvitedPlayers[plr->GetTeamId()].count(plr->GetGUID())) + if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID())) return; - m_PlayersWillBeKick[plr->GetTeamId()].erase(plr->GetGUID()); - m_InvitedPlayers[plr->GetTeamId()][plr->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; - plr->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); + m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID()); + m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; + player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); } void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) @@ -291,16 +291,16 @@ void Battlefield::KickAfk() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - if (plr->isAFK()) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + if (player->isAFK()) KickPlayerFromBf(*itr); } void Battlefield::KickPlayerFromBf(uint64 guid) { - if (Player* plr = sObjectAccessor->FindPlayer(guid)) - if (plr->GetZoneId() == GetZoneId()) - plr->TeleportTo(KickPosition); + if (Player* player = sObjectAccessor->FindPlayer(guid)) + if (player->GetZoneId() == GetZoneId()) + player->TeleportTo(KickPosition); } void Battlefield::StartBattle() @@ -358,47 +358,47 @@ void Battlefield::PlaySoundToAll(uint32 SoundID) for (int team = 0; team < BG_TEAMS_COUNT; team++) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } } -bool Battlefield::HasPlayer(Player *plr) const +bool Battlefield::HasPlayer(Player *player) const { - return m_players[plr->GetTeamId()].find(plr->GetGUID()) != m_players[plr->GetTeamId()].end(); + return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end(); } // Called in WorldSession::HandleBfQueueInviteResponse -void Battlefield::PlayerAcceptInviteToQueue(Player *plr) +void Battlefield::PlayerAcceptInviteToQueue(Player *player) { // Add player in queueVenez - m_PlayersInQueue[plr->GetTeamId()].insert(plr->GetGUID()); + m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID()); // Send notification - plr->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); + player->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); } // Called in WorldSession::HandleBfExitRequest -void Battlefield::AskToLeaveQueue(Player *plr) +void Battlefield::AskToLeaveQueue(Player *player) { // Remove player from queue - m_PlayersInQueue[plr->GetTeamId()].erase(plr->GetGUID()); + m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID()); } // Called in WorldSession::HandleBfEntryInviteResponse -void Battlefield::PlayerAcceptInviteToWar(Player *plr) +void Battlefield::PlayerAcceptInviteToWar(Player *player) { if (!IsWarTime()) return; - if (AddOrSetPlayerToCorrectBfGroup(plr)) + if (AddOrSetPlayerToCorrectBfGroup(player)) { - plr->GetSession()->SendBfEntered(m_BattleId); - m_PlayersInWar[plr->GetTeamId()].insert(plr->GetGUID()); - m_InvitedPlayers[plr->GetTeamId()].erase(plr->GetGUID()); + player->GetSession()->SendBfEntered(m_BattleId); + m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID()); + m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); //Remove player AFK - if (plr->isAFK()) - plr->ToggleAFK(); + if (player->isAFK()) + player->ToggleAFK(); - OnPlayerJoinWar(plr); //for scripting + OnPlayerJoinWar(player); //for scripting } } @@ -406,36 +406,36 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId) { if (spellId > 0) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->CastSpell(plr, (uint32) spellId, true); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->CastSpell(player, (uint32) spellId, true); else for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->RemoveAuraFromStack((uint32) - spellId); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->RemoveAuraFromStack((uint32) - spellId); } void Battlefield::BroadcastPacketZone(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } void Battlefield::BroadcastPacketQueue(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } void Battlefield::BroadcastPacketWar(WorldPacket & data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->GetSession()->SendPacket(&data); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg) @@ -477,22 +477,22 @@ void Battlefield::SendWarningToAllInZone(uint32 entry) WorldPacket data = BuildWarningAnnPacket(msg); BroadcastPacketWar(data); }*/ -void Battlefield::SendWarningToPlayer(Player *plr, uint32 entry) +void Battlefield::SendWarningToPlayer(Player *player, uint32 entry) { - if (!plr) + if (!player) return; if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) if (Creature* stalker = unit->ToCreature()) - sCreatureTextMgr->SendChat(stalker, (uint8)entry, plr->GetGUID()); + sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID()); } void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->SendUpdateWorldState(field, value); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->SendUpdateWorldState(field, value); } void Battlefield::RegisterZone(uint32 zoneId) @@ -550,30 +550,30 @@ Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) return NULL; } -bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *plr) +bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player) { - if (!plr->IsInWorld()) + if (!player->IsInWorld()) return false; - if (Group* group = plr->GetGroup()) - group->RemoveMember(plr->GetGUID()); + if (Group* group = player->GetGroup()) + group->RemoveMember(player->GetGUID()); - Group* group = GetFreeBfRaid(plr->GetTeamId()); + Group* group = GetFreeBfRaid(player->GetTeamId()); if (!group) { group = new Group; group->SetBattlefieldGroup(this); - group->Create(plr); + group->Create(player); sGroupMgr->AddGroup(group); - m_Groups[plr->GetTeamId()].insert(group->GetGUID()); + m_Groups[player->GetTeamId()].insert(group->GetGUID()); } - else if (group->IsMember(plr->GetGUID())) + else if (group->IsMember(player->GetGUID())) { - uint8 subgroup = group->GetMemberGroup(plr->GetGUID()); - plr->SetBattlegroundOrBattlefieldRaid(group, subgroup); + uint8 subgroup = group->GetMemberGroup(player->GetGUID()); + player->SetBattlegroundOrBattlefieldRaid(group, subgroup); } else - group->AddMember(plr); + group->AddMember(player); return true; } @@ -601,7 +601,7 @@ BfGraveYard *Battlefield::GetGraveYardById(uint32 id) return NULL; } -WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *plr) +WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *player) { BfGraveYard* closestGY = NULL; float maxdist = -1; @@ -609,10 +609,10 @@ WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *plr) { if (m_GraveYardList[i]) { - if (m_GraveYardList[i]->GetControlTeamId() != plr->GetTeamId()) + if (m_GraveYardList[i]->GetControlTeamId() != player->GetTeamId()) continue; - float dist = m_GraveYardList[i]->GetDistance(plr); + float dist = m_GraveYardList[i]->GetDistance(player); if (dist < maxdist || maxdist < 0) { closestGY = m_GraveYardList[i]; @@ -699,10 +699,10 @@ void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) spirit->SetReactState(REACT_PASSIVE); } -float BfGraveYard::GetDistance(Player *plr) +float BfGraveYard::GetDistance(Player *player) { const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); - return plr->GetDistance2d(ws->x, ws->y); + return player->GetDistance2d(ws->x, ws->y); } void BfGraveYard::AddPlayer(uint64 player_guid) @@ -711,8 +711,8 @@ void BfGraveYard::AddPlayer(uint64 player_guid) { m_ResurrectQueue.insert(player_guid); - if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) - plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); + if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true); } } @@ -720,8 +720,8 @@ void BfGraveYard::RemovePlayer(uint64 player_guid) { m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); - if (Player* plr = sObjectAccessor->FindPlayer(player_guid)) - plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); + if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); } void BfGraveYard::Resurrect() @@ -732,22 +732,22 @@ void BfGraveYard::Resurrect() for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { // Get player object from his guid - Player* plr = sObjectAccessor->FindPlayer(*itr); - if (!plr) + Player* player = sObjectAccessor->FindPlayer(*itr); + if (!player) continue; // Check player isinworld and player is on good graveyard - if (plr->IsInWorld()) + if (player->IsInWorld()) if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam])) spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); // Resurect player - plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); - plr->ResurrectPlayer(1.0f); - plr->CastSpell(plr, 6962, true); - plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true); + player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true); + player->ResurrectPlayer(1.0f); + player->CastSpell(player, 6962, true); + player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true); - sObjectAccessor->ConvertCorpseForPlayer(plr->GetGUID()); + sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID()); } m_ResurrectQueue.clear(); @@ -773,17 +773,17 @@ void BfGraveYard::RelocateDeadPlayers() WorldSafeLocsEntry const* ClosestGrave = NULL; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { - Player* plr = sObjectAccessor->FindPlayer(*itr); - if (!plr) + Player* player = sObjectAccessor->FindPlayer(*itr); + if (!player) continue; if (ClosestGrave) - plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); else { - ClosestGrave = m_Bf->GetClosestGraveYard(plr); + ClosestGrave = m_Bf->GetClosestGraveYard(player); if (ClosestGrave) - plr->TeleportTo(plr->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); } } } @@ -877,22 +877,22 @@ BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) m_maxSpeed = 0; } -bool BfCapturePoint::HandlePlayerEnter(Player *plr) +bool BfCapturePoint::HandlePlayerEnter(Player *player) { if (m_capturePoint) { - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); } - return m_activePlayers[plr->GetTeamId()].insert(plr->GetGUID()).second; + return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second; } -void BfCapturePoint::HandlePlayerLeave(Player *plr) +void BfCapturePoint::HandlePlayerLeave(Player *player) { if (m_capturePoint) - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - m_activePlayers[plr->GetTeamId()].erase(plr->GetGUID()); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + m_activePlayers[player->GetTeamId()].erase(player->GetGUID()); } void BfCapturePoint::SendChangePhase() @@ -965,9 +965,9 @@ bool BfCapturePoint::Update(uint32 diff) for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) - HandlePlayerLeave(plr); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) + HandlePlayerLeave(player); std::list < Player * >players; Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); @@ -1069,8 +1069,8 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) { for (uint8 team = 0; team < 2; ++team) for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->SendUpdateWorldState(field, value); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->SendUpdateWorldState(field, value); } void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) @@ -1090,11 +1090,11 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) // send to all players present in the area for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) - plr->KilledMonsterCredit(id, guid); + if (Player* player = sObjectAccessor->FindPlayer(*itr)) + player->KilledMonsterCredit(id, guid); } -bool BfCapturePoint::IsInsideObjective(Player *plr) const +bool BfCapturePoint::IsInsideObjective(Player *player) const { - return m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()) != m_activePlayers[plr->GetTeamId()].end(); + return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end(); } diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 9f3bcb18f5..e14a09e29e 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -88,12 +88,12 @@ public: void SendObjectiveComplete(uint32 id, uint64 guid); // used when player is activated/inactivated in the area - virtual bool HandlePlayerEnter(Player * plr); - virtual void HandlePlayerLeave(Player * plr); - //virtual void HandlePlayerActivityChanged(Player * plr); + virtual bool HandlePlayerEnter(Player * player); + virtual void HandlePlayerLeave(Player * player); + //virtual void HandlePlayerActivityChanged(Player * player); // checks if player is in range of a capture credit marker - bool IsInsideObjective(Player * plr) const; + bool IsInsideObjective(Player * player) const; // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. virtual bool Update(uint32 diff); @@ -144,7 +144,7 @@ public: TeamId GetControlTeamId() { return m_ControlTeam; } // use for found the nearest graveyard - float GetDistance(Player * plr); + float GetDistance(Player * player); void Initialize(TeamId startcontrol, uint32 gy); void SetSpirit(Creature* spirit, TeamId team); void AddPlayer(uint64 player_guid); @@ -237,10 +237,10 @@ class Battlefield:public ZoneScript */ void KickPlayerFromBf(uint64 guid); - /// Called when player (plr) enter in zone - void HandlePlayerEnterZone(Player * plr, uint32 zone); - /// Called when player (plr) leave the zone - void HandlePlayerLeaveZone(Player * plr, uint32 zone); + /// Called when player (player) enter in zone + void HandlePlayerEnterZone(Player * player, uint32 zone); + /// Called when player (player) leave the zone + void HandlePlayerLeaveZone(Player * player, uint32 zone); // All-purpose data storage 64 bit virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; } @@ -258,17 +258,17 @@ class Battlefield:public ZoneScript // Group methods /** * \brief Find a not full battlefield group, if there is no, create one - * \param TeamId : Id of player team for who we search a group (plr->GetTeamId()) + * \param TeamId : Id of player team for who we search a group (player->GetTeamId()) */ Group *GetFreeBfRaid(TeamId TeamId); /// Return battlefield group where player is. Group *GetGroupPlayer(uint64 guid, TeamId TeamId); /// Force player to join a battlefield group - bool AddOrSetPlayerToCorrectBfGroup(Player * plr); + bool AddOrSetPlayerToCorrectBfGroup(Player * player); // Graveyard methods // Find which graveyard the player must be teleported to to be resurrected by spiritguide - WorldSafeLocsEntry const *GetClosestGraveYard(Player * plr); + WorldSafeLocsEntry const *GetClosestGraveYard(Player * player); virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); void RemovePlayerFromResurrectQueue(uint64 player_guid); @@ -289,23 +289,23 @@ class Battlefield:public ZoneScript /// Called x minutes before battle start when player in zone are invite to join queue virtual void OnStartGrouping() {}; /// Called when a player accept to join the battle - virtual void OnPlayerJoinWar(Player * /*plr */ ) {}; + virtual void OnPlayerJoinWar(Player * /*player */ ) {}; /// Called when a player leave the battle - virtual void OnPlayerLeaveWar(Player * /*plr */ ) {}; + virtual void OnPlayerLeaveWar(Player * /*player */ ) {}; /// Called when a player leave battlefield zone - virtual void OnPlayerLeaveZone(Player * /*plr */ ) {}; + virtual void OnPlayerLeaveZone(Player * /*player */ ) {}; /// Called when a player enter in battlefield zone - virtual void OnPlayerEnterZone(Player * /*plr */ ) {}; + virtual void OnPlayerEnterZone(Player * /*player */ ) {}; WorldPacket BuildWarningAnnPacket(std::string msg); void SendWarningToAllInZone(uint32 entry); //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED - void SendWarningToPlayer(Player * plr, uint32 entry); + void SendWarningToPlayer(Player * player, uint32 entry); - void PlayerAcceptInviteToQueue(Player * plr); - void PlayerAcceptInviteToWar(Player * plr); + void PlayerAcceptInviteToQueue(Player * player); + void PlayerAcceptInviteToWar(Player * player); uint32 GetBattleId() { return m_BattleId; } - void AskToLeaveQueue(Player * plr); + void AskToLeaveQueue(Player * player); virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {}; @@ -329,8 +329,8 @@ class Battlefield:public ZoneScript void PlaySoundToAll(uint32 SoundID); - void InvitePlayerToQueue(Player * plr); - void InvitePlayerToWar(Player * plr); + void InvitePlayerToQueue(Player * player); + void InvitePlayerToWar(Player * player); void InitStalker(uint32 entry, float x, float y, float z, float o); @@ -382,7 +382,7 @@ protected: void KickAfk(); // use for switch off all worldstate for client - virtual void SendRemoveWorldStates(Player * /*plr */ ) {} + virtual void SendRemoveWorldStates(Player * /*player */ ) {} // use for send a packet for all player list void BroadcastPacketZone(WorldPacket & data) const; @@ -401,7 +401,7 @@ protected: } void RegisterZone(uint32 zoneid); - bool HasPlayer(Player * plr) const; + bool HasPlayer(Player * player) const; void TeamCastSpell(TeamId team, int32 spellId); }; diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 0b26ae8dc5..7f7613b395 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -75,7 +75,7 @@ void WorldSession::SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool //Param1:(BattleId) the BattleId of Bf void WorldSession::SendBfEntered(uint32 BattleId) { -// m_PlayerInWar[plr->GetTeamId()].insert(plr->GetGUID()); +// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID()); WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7); data << uint32(BattleId); data << uint8(1); //unk diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp new file mode 100644 index 0000000000..095ec4fd18 --- /dev/null +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "BattlefieldMgr.h" +#include "Zones/BattlefieldWG.h" +#include "ObjectMgr.h" +#include "Player.h" + +BattlefieldMgr::BattlefieldMgr() +{ + m_UpdateTimer = 0; + //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr"); +} + +BattlefieldMgr::~BattlefieldMgr() +{ + //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr"); + for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) + delete *itr; +} + +void BattlefieldMgr::InitBattlefield() +{ + Battlefield* pBf = new BattlefieldWG; + // respawn, init variables + if (!pBf->SetupBattlefield()) + { + sLog->outString(); + sLog->outString("Battlefield : Wintergrasp init failed."); + delete pBf; + } + else + { + m_BattlefieldSet.push_back(pBf); + sLog->outString(); + sLog->outString("Battlefield : Wintergrasp successfully initiated."); + } + + /* For Cataclysm: Tol Barad + pBf = new BattlefieldTB; + // respawn, init variables + if(!pBf->SetupBattlefield()) + { + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed."); + delete pBf; + } + else + { + m_BattlefieldSet.push_back(pBf); + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated."); + } */ +} + +void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle) +{ + m_BattlefieldMap[zoneid] = handle; +} + +void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid); + if (itr == m_BattlefieldMap.end()) + return; + + if (itr->second->HasPlayer(player)) + return; + if (itr->second->GetEnable() == false) + return; + itr->second->HandlePlayerEnterZone(player, zoneid); + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); +} + +void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid); + if (itr == m_BattlefieldMap.end()) + return; + + // teleport: remove once in removefromworld, once in updatezone + if (!itr->second->HasPlayer(player)) + return; + itr->second->HandlePlayerLeaveZone(player, zoneid); + sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); +} + +Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid); + if (itr == m_BattlefieldMap.end()) + { + // no handle for this zone, return + return NULL; + } + if (itr->second->GetEnable() == false) + return NULL; + return itr->second; +} + +Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid) +{ + for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) + { + if ((*itr)->GetBattleId() == battleid) + return (*itr); + } + return NULL; +} + +void BattlefieldMgr::Update(uint32 diff) +{ + m_UpdateTimer += diff; + if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL) + { + for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) + if ((*itr)->GetEnable()) + (*itr)->Update(m_UpdateTimer); + m_UpdateTimer = 0; + } +} + +ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId) +{ + BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId); + if (itr != m_BattlefieldMap.end()) + return itr->second; + else + return NULL; +} diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h index a447d787be..4ee37e424f 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.h +++ b/src/server/game/Battlefield/BattlefieldMgr.h @@ -40,11 +40,11 @@ class BattlefieldMgr // create battlefield events void InitBattlefield(); // called when a player enters an battlefield area - void HandlePlayerEnterZone(Player * plr, uint32 areaflag); + void HandlePlayerEnterZone(Player * player, uint32 areaflag); // called when player leaves an battlefield area - void HandlePlayerLeaveZone(Player * plr, uint32 areaflag); + void HandlePlayerLeaveZone(Player * player, uint32 areaflag); // called when player resurrects - void HandlePlayerResurrects(Player * plr, uint32 areaflag); + void HandlePlayerResurrects(Player * player, uint32 areaflag); // return assigned battlefield Battlefield *GetBattlefieldToZoneId(uint32 zoneid); Battlefield *GetBattlefieldByBattleId(uint32 battleid); @@ -59,7 +59,7 @@ class BattlefieldMgr bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso); - void HandleDropFlag(Player * plr, uint32 spellId); + void HandleDropFlag(Player * player, uint32 spellId); typedef std::vector < Battlefield * >BattlefieldSet; typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index b5f4ffe8ad..4ec448fe3e 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -315,30 +315,30 @@ class BattlefieldWG : public Battlefield * -Teleport if it needed * -Update worldstate * -Update tenacity - * \param plr: Player who accept invite + * \param player: Player who accept invite */ - void OnPlayerJoinWar(Player *plr); + void OnPlayerJoinWar(Player *player); /** * \brief Called when player leave battle * -Update player aura - * \param plr : Player who leave battle + * \param player : Player who leave battle */ - void OnPlayerLeaveWar(Player *plr); + void OnPlayerLeaveWar(Player *player); /** * \brief Called when player leave WG zone - * \param plr : Player who leave zone + * \param player : Player who leave zone */ - void OnPlayerLeaveZone(Player *plr); + void OnPlayerLeaveZone(Player *player); /** * \brief Called when player enter in WG zone * -Update aura * -Update worldstate - * \param plr : Player who leave zone + * \param player : Player who leave zone */ - void OnPlayerEnterZone(Player *plr); + void OnPlayerEnterZone(Player *player); /** * \brief Called for update battlefield data @@ -415,13 +415,13 @@ class BattlefieldWG : public Battlefield m_CanClickOnOrb = allow; } - void RewardMarkOfHonor(Player *plr, uint32 count); + void RewardMarkOfHonor(Player *player, uint32 count); void UpdateVehicleCountWG(); void UpdateCounterVehicle(bool init); WorldPacket BuildInitWorldStates(); - void SendInitWorldStatesTo(Player * plr); + void SendInitWorldStatesTo(Player * player); void SendInitWorldStatesToAll(); void HandleKill(Player *killer, Unit *victim); From 2a4b976e411727ebb361e8994f688579af791360 Mon Sep 17 00:00:00 2001 From: thomas33 Date: Mon, 12 Mar 2012 17:39:33 +0100 Subject: [PATCH 113/147] Core/Battlefield: pPlayer -> player --- src/server/scripts/Northrend/wintergrasp.cpp | 114 +++++++++---------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 936be459f9..ea73a2abe4 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -58,10 +58,10 @@ class npc_wg_demolisher_engineer : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); @@ -71,25 +71,25 @@ class npc_wg_demolisher_engineer : public CreatureScript if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { - if (pPlayer->HasAura(SPELL_CORPORAL)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - else if (pPlayer->HasAura(SPELL_LIEUTENANT)) + if (player->HasAura(SPELL_CORPORAL)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + else if (player->HasAura(SPELL_LIEUTENANT)) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); } } else - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); @@ -102,13 +102,13 @@ class npc_wg_demolisher_engineer : public CreatureScript switch (uiAction - GOSSIP_ACTION_INFO_DEF) { case 0: - pPlayer->CastSpell(pPlayer, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); break; case 1: - pPlayer->CastSpell(pPlayer, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); break; case 2: - pPlayer->CastSpell(pPlayer, pPlayer->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); break; } //spell 49899 Emote : 406 from sniff @@ -127,10 +127,10 @@ class npc_wg_spirit_guide : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -138,21 +138,21 @@ class npc_wg_spirit_guide : public CreatureScript GraveYardVect gy = BfWG->GetGraveYardVect(); for (uint8 i = 0; i < gy.size(); i++) { - if (gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + if (gy[i]->GetControlTeamId() == player->GetTeamId()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i); } } } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -160,10 +160,10 @@ class npc_wg_spirit_guide : public CreatureScript GraveYardVect gy = BfWG->GetGraveYardVect(); for (uint8 i = 0; i < gy.size(); i++) { - if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == pPlayer->GetTeamId()) + if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) { WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); - pPlayer->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); + player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); } } } @@ -178,10 +178,10 @@ class npc_wg_queue : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -189,43 +189,43 @@ class npc_wg_queue : public CreatureScript if (BfWG->IsWarTime()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); } else { uint32 uiTime = BfWG->GetTimer() / 1000; - pPlayer->SendUpdateWorldState(4354, time(NULL) + uiTime); + player->SendUpdateWorldState(4354, time(NULL) + uiTime); if (uiTime < 15 * MINUTE) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); } else { - pPlayer->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); } } } return true; } - bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) { - pPlayer->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { if (BfWG->IsWarTime()) { - BfWG->InvitePlayerToWar(pPlayer); + BfWG->InvitePlayerToWar(player); } else { uint32 uiTime = BfWG->GetTimer() / 1000; if (uiTime < 15 * MINUTE) - BfWG->InvitePlayerToQueue(pPlayer); + BfWG->InvitePlayerToQueue(player); } } return true; @@ -297,10 +297,10 @@ class npc_wg_quest_giver : public CreatureScript { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + player->PrepareQuestMenu(pCreature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -311,14 +311,14 @@ class npc_wg_quest_giver : public CreatureScript QuestRelations* pObjectQR = sObjectMgr->GetCreatureQuestRelationMap(); QuestRelations* pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); - QuestMenu & qm = pPlayer->PlayerTalkClass->GetQuestMenu(); + QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) { uint32 quest_id = i->second; - QuestStatus status = pPlayer->GetQuestStatus(quest_id); - if (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) + QuestStatus status = player->GetQuestStatus(quest_id); + if (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) qm.AddMenuItem(quest_id, 4); else if (status == QUEST_STATUS_INCOMPLETE) qm.AddMenuItem(quest_id, 4); @@ -342,11 +342,11 @@ class npc_wg_quest_giver : public CreatureScript case 13223: if (BfWG->GetAttackerTeam() == TEAM_HORDE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -360,11 +360,11 @@ class npc_wg_quest_giver : public CreatureScript case 13185: if (BfWG->GetDefenderTeam() == TEAM_HORDE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -376,11 +376,11 @@ class npc_wg_quest_giver : public CreatureScript case 13195: if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -393,26 +393,26 @@ class npc_wg_quest_giver : public CreatureScript case 13156: if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE) { - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); } break; default: - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) + if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && pPlayer->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, 2); break; } } } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } return true; From 7b0a7ef4f3d9d50160143b7cb3a68c00d17eeb4a Mon Sep 17 00:00:00 2001 From: thomas33 Date: Tue, 13 Mar 2012 14:59:26 +0100 Subject: [PATCH 114/147] Core/Battlefield: cleanup --- src/server/scripts/Northrend/wintergrasp.cpp | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index ea73a2abe4..0925a97356 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -87,7 +87,7 @@ class npc_wg_demolisher_engineer : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -99,7 +99,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { - switch (uiAction - GOSSIP_ACTION_INFO_DEF) + switch (action - GOSSIP_ACTION_INFO_DEF) { case 0: player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); @@ -150,7 +150,7 @@ class npc_wg_spirit_guide : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -160,7 +160,7 @@ class npc_wg_spirit_guide : public CreatureScript GraveYardVect gy = BfWG->GetGraveYardVect(); for (uint8 i = 0; i < gy.size(); i++) { - if (uiAction - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) + if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) { WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); @@ -210,7 +210,7 @@ class npc_wg_queue : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*uiSender */ , uint32 /*uiAction */ ) + bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 /*action */ ) { player->CLOSE_GOSSIP_MENU(); @@ -327,8 +327,8 @@ class npc_wg_quest_giver : public CreatureScript for (QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) { uint32 quest_id = i->second; - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); - if (!pQuest) + Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + if (!quest) continue; switch (quest_id) @@ -344,9 +344,9 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -362,9 +362,9 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -378,9 +378,9 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; @@ -395,18 +395,18 @@ class npc_wg_quest_giver : public CreatureScript { QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); } break; default: QuestStatus status = player->GetQuestStatus(quest_id); - if (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)) + if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(pQuest, false)) + else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) qm.AddMenuItem(quest_id, 2); break; } From c44a723ca082e9bfa37e6560c9badfc8f0003787 Mon Sep 17 00:00:00 2001 From: thomas33 Date: Tue, 13 Mar 2012 16:19:20 +0100 Subject: [PATCH 115/147] Core/Battlefield: more cleanup --- src/server/scripts/Northrend/wintergrasp.cpp | 70 ++++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 0925a97356..345f2f6898 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -58,18 +58,18 @@ class npc_wg_demolisher_engineer : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); if (!BfWG) return true; - if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { if (player->HasAura(SPELL_CORPORAL)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -83,11 +83,11 @@ class npc_wg_demolisher_engineer : public CreatureScript else player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -96,24 +96,24 @@ class npc_wg_demolisher_engineer : public CreatureScript if (!BfWG) return true; - if (BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(pCreature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > + BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) { switch (action - GOSSIP_ACTION_INFO_DEF) { case 0: - player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, creature->GetGUID()); break; case 1: - player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, creature->GetGUID()); break; case 2: - player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, pCreature->GetGUID()); + player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, creature->GetGUID()); break; } //spell 49899 Emote : 406 from sniff //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); - if (Creature* creature = pCreature->FindNearestCreature(27852, 30.0f, true)) + if (Creature* creature = creature->FindNearestCreature(27852, 30.0f, true)) creature->CastSpell(creature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); } return true; @@ -127,10 +127,10 @@ class npc_wg_spirit_guide : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -146,11 +146,11 @@ class npc_wg_spirit_guide : public CreatureScript } } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -178,10 +178,10 @@ class npc_wg_queue : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) @@ -190,7 +190,7 @@ class npc_wg_queue : public CreatureScript if (BfWG->IsWarTime()) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else { @@ -199,18 +199,18 @@ class npc_wg_queue : public CreatureScript if (uiTime < 15 * MINUTE) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); } else { - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID()); } } } return true; } - bool OnGossipSelect(Player* player, Creature* /*pCreature */ , uint32 /*sender */ , uint32 /*action */ ) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action */ ) { player->CLOSE_GOSSIP_MENU(); @@ -297,24 +297,24 @@ class npc_wg_quest_giver : public CreatureScript { } - bool OnGossipHello(Player* player, Creature* pCreature) + bool OnGossipHello(Player* player, Creature* creature) { - if (pCreature->isQuestGiver()) - player->PrepareQuestMenu(pCreature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (BfWG) { - if (pCreature->isQuestGiver()) + if (creature->isQuestGiver()) { - Object* pObject = (Object *) pCreature; - QuestRelations* pObjectQR = sObjectMgr->GetCreatureQuestRelationMap(); - QuestRelations* pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); + Object* object = (Object *) creature; + QuestRelations* objectQR = sObjectMgr->GetCreatureQuestRelationMap(); + QuestRelations* objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); - for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQIR->lower_bound(object->GetEntry()); i != objectQIR->upper_bound(object->GetEntry()); ++i) { uint32 quest_id = i->second; QuestStatus status = player->GetQuestStatus(quest_id); @@ -324,7 +324,7 @@ class npc_wg_quest_giver : public CreatureScript qm.AddMenuItem(quest_id, 4); } - for (QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQR->lower_bound(object->GetEntry()); i != objectQR->upper_bound(object->GetEntry()); ++i) { uint32 quest_id = i->second; Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); @@ -412,7 +412,7 @@ class npc_wg_quest_giver : public CreatureScript } } } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(pCreature), pCreature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } return true; From 7988edda1ce7e40e8d313923eaf6af8dc553e390 Mon Sep 17 00:00:00 2001 From: thomas33 Date: Wed, 14 Mar 2012 00:04:34 +0100 Subject: [PATCH 116/147] Core/Battlefield: Cleanup --- src/server/game/Battlefield/Battlefield.cpp | 18 +++++++++--------- src/server/scripts/Northrend/wintergrasp.cpp | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 085be81c98..e72be15f68 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -810,15 +810,15 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl } //Create creature - Creature* pCreature = new Creature; - if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) + Creature* creature = new Creature; + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { sLog->outError("Can't create creature entry: %u", entry); - delete pCreature; + delete creature; return NULL; } - pCreature->SetHomePosition(x, y, z, o); + creature->SetHomePosition(x, y, z, o); CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) @@ -827,14 +827,14 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl return NULL; } // force using DB speeds -- do we really need this? - pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk); - pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); + creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); + creature->SetSpeed(MOVE_RUN, cinfo->speed_run); // Set creature in world - map->AddToMap(pCreature); - pCreature->setActive(true); + map->AddToMap(creature); + creature->setActive(true); - return pCreature; + return creature; } // Method for spawning gameobject on map diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 345f2f6898..fd09edd7b5 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -253,23 +253,23 @@ class go_wg_vehicle_teleporter : public GameObjectScript if (uiCheckTimer <= diff) { for (uint8 i = 0; i < 4; i++) - if (Creature* pVehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) - if (!pVehicle->HasAura(SPELL_VEHICLE_TELEPORT)) + if (Creature* vehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) + if (!vehicle->HasAura(SPELL_VEHICLE_TELEPORT)) { - if (pVehicle->GetVehicle()) + if (vehicle->GetVehicle()) { - if (Unit* player = pVehicle->GetVehicle()->GetPassenger(0)) + if (Unit* player = vehicle->GetVehicle()->GetPassenger(0)) { uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); uint32 plfaction = player->getFaction(); if (gofaction == plfaction) { - pVehicle->CastSpell(pVehicle, SPELL_VEHICLE_TELEPORT, true); - if (Creature* TargetTeleport = pVehicle->FindNearestCreature(23472, 100.0f, true)) + vehicle->CastSpell(vehicle, SPELL_VEHICLE_TELEPORT, true); + if (Creature* TargetTeleport = vehicle->FindNearestCreature(23472, 100.0f, true)) { float x, y, z, o; TargetTeleport->GetPosition(x, y, z, o); - pVehicle->GetVehicle()->TeleportVehicle(x, y, z, o); + vehicle->GetVehicle()->TeleportVehicle(x, y, z, o); } } } From 6639347d37197e618118e45c9c706ebab35dd20d Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 14 Mar 2012 10:18:59 -0300 Subject: [PATCH 117/147] Core/Battlefield: Fix build. closes #5707 --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index bd8a51c13f..6fcd48efd1 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -482,7 +482,7 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) // ***************************************************** void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 /*incrementNumber */ ) { - AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement); + AchievementEntry const* AE = sAchievementStore.LookupEntry(achievement); switch (achievement) { From 5ec5bc1721ecd1e09544769f4c950a3d42d815f6 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 17 Mar 2012 20:52:31 -0500 Subject: [PATCH 118/147] Battlefields/Wintergrasp: Fixed a crash when leaving a capture point. Fixed the worldstate counters Signed-off-by: Subv --- src/server/game/Battlefield/Battlefield.cpp | 37 ++++++++++++++----- src/server/game/Battlefield/Battlefield.h | 4 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- .../game/Battlefield/Zones/BattlefieldWG.h | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index e72be15f68..5e1e530dbd 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -888,11 +888,18 @@ bool BfCapturePoint::HandlePlayerEnter(Player *player) return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second; } -void BfCapturePoint::HandlePlayerLeave(Player *player) +GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr) { if (m_capturePoint) - player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - m_activePlayers[player->GetTeamId()].erase(player->GetGUID()); + plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + + GuidSet::iterator current = m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()); + + if (current == m_activePlayers[plr->GetTeamId()].end()) + return current; // return end() + + m_activePlayers[plr->GetTeamId()].erase(current++); + return current; } void BfCapturePoint::SendChangePhase() @@ -964,17 +971,27 @@ bool BfCapturePoint::Update(uint32 diff) float radius = m_capturePoint->GetGOInfo()->capturePoint.radius; for (uint8 team = 0; team < 2; ++team) - for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* player = sObjectAccessor->FindPlayer(*itr)) - if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) - HandlePlayerLeave(player); + { + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) + { + if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + { + if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) + itr = HandlePlayerLeave(plr); + else + ++itr; + } + else + ++itr; + } + } - std::list < Player * >players; + std::list players; Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); - Trinity::PlayerListSearcher < Trinity::AnyPlayerInObjectRangeCheck > searcher(m_capturePoint, players, checker); + Trinity::PlayerListSearcher searcher(m_capturePoint, players, checker); m_capturePoint->VisitNearbyWorldObject(radius, searcher); - for (std::list < Player * >::iterator itr = players.begin(); itr != players.end(); ++itr) + for (std::list::iterator itr = players.begin(); itr != players.end(); ++itr) if ((*itr)->IsOutdoorPvPActive()) if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second) HandlePlayerEnter(*itr); diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index e14a09e29e..928e77c22b 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -88,8 +88,8 @@ public: void SendObjectiveComplete(uint32 id, uint64 guid); // used when player is activated/inactivated in the area - virtual bool HandlePlayerEnter(Player * player); - virtual void HandlePlayerLeave(Player * player); + virtual bool HandlePlayerEnter(Player* player); + virtual GuidSet::iterator HandlePlayerLeave(Player* player); //virtual void HandlePlayerActivityChanged(Player * player); // checks if player is in range of a capture credit marker diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6fcd48efd1..cb9a1ac795 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -892,7 +892,7 @@ uint32 BattlefieldWG::GetData(uint32 data) return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); } - return 0; + return Battlefield::GetData(data); } // Method sending worldsate to player diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 4ec448fe3e..a7d1d185c8 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -28,7 +28,7 @@ const uint32 VehNumWorldState[2] = { 3680, 3490 }; const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; const uint32 ClockWorldState[2] = { 3781, 4354 }; -const uint32 WintergraspFaction[3] = { 1732, 1735, 35 }; +const uint32 WintergraspFaction[3] = { 1, 116, 35 }; const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; From b700f545c553957f49741909e2ba0fdbd01a203c Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 20 Mar 2012 12:16:44 -0400 Subject: [PATCH 119/147] Core/Battlefield: fix issues with vehicles. return correct vehicle data when using getdata. small cleanups. codestyle --- src/server/game/Battlefield/Battlefield.h | 2 +- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 3 +++ src/server/game/Scripting/ScriptLoader.cpp | 2 ++ src/server/scripts/Northrend/wintergrasp.cpp | 13 ++++++++----- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 928e77c22b..2bc7ccca40 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -177,7 +177,7 @@ protected: Battlefield *m_Bf; }; -class Battlefield:public ZoneScript +class Battlefield : public ZoneScript { friend class BattlefieldMgr; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index cb9a1ac795..2068741b4e 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -890,6 +890,9 @@ uint32 BattlefieldWG::GetData(uint32 data) // Graveyards and Workshops are controlled by the same team. if (m_GraveYardList[GetSpiritGraveyardId(data)]) return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); + default: + if (m_Data32[data]) + return m_Data32[data]; } return Battlefield::GetData(data); diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 319fd1eb70..0c6948160e 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -508,6 +508,7 @@ void AddSC_howling_fjord(); void AddSC_icecrown(); void AddSC_sholazar_basin(); void AddSC_storm_peaks(); +void AddSC_wintergrasp(); void AddSC_zuldrak(); void AddSC_crystalsong_forest(); void AddSC_isle_of_conquest(); @@ -1224,6 +1225,7 @@ void AddNorthrendScripts() AddSC_icecrown(); AddSC_sholazar_basin(); AddSC_storm_peaks(); + AddSC_wintergrasp(); AddSC_zuldrak(); AddSC_crystalsong_forest(); AddSC_isle_of_conquest(); diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index fd09edd7b5..d8ecd042fc 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -38,7 +38,7 @@ enum eWGqueuenpctext WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, }; -enum eWGdata +enum WGscriptdata { // engineer spells SPELL_BUILD_CATAPULT = 56663, @@ -49,6 +49,9 @@ enum eWGdata // teleporter spells SPELL_VEHICLE_TELEPORT = 49759, + + // npcs + NPC_ROBOTIC_ARMS = 27852, }; class npc_wg_demolisher_engineer : public CreatureScript @@ -63,7 +66,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (!BfWG) return true; @@ -91,7 +94,7 @@ class npc_wg_demolisher_engineer : public CreatureScript { player->CLOSE_GOSSIP_MENU(); - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(1); + Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (!BfWG) return true; @@ -113,8 +116,8 @@ class npc_wg_demolisher_engineer : public CreatureScript } //spell 49899 Emote : 406 from sniff //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); - if (Creature* creature = creature->FindNearestCreature(27852, 30.0f, true)) - creature->CastSpell(creature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); + if (Creature* mechCreature = creature->FindNearestCreature(NPC_ROBOTIC_ARMS, 30.0f, true)) + creature->CastSpell(mechCreature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); } return true; } From cbc0f01da4e2b328f444881ccb3b710c2c4d8729 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 20 Mar 2012 13:21:16 -0400 Subject: [PATCH 120/147] DB/Battlefield: added sql for correct targetting for vehicle creation spell casts. --- Wintergrasp_temp/Template_update.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index 1b1ff6d130..84df0017b0 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -79,6 +79,14 @@ UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,` UPDATE `creature_template` SET `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher (H) UPDATE `creature_template` SET `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult (Both) +/* Spell target conditions for spawning WG siege machines in proper place while building it */ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56575,56661,56663,61408); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 56575, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 56661, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 56663, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 61408, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL); + -- Note: Siege Engines, Demolisher faction is guess (vehicles get the faction of his driver) -- Demolisher spell positions is not confirmed -- Wintergrasp Tower Cannon H: 1735 A: 1732 From 9c5b1b2bb6e2f633a6302438054c357ab04cf177 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 21 Mar 2012 08:53:46 -0400 Subject: [PATCH 121/147] Core/Battlefield: Correctly cast the teleport spell (data from sniffs). codestyle cleanup --- src/server/scripts/Northrend/wintergrasp.cpp | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d8ecd042fc..eb7b5dfefd 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -52,6 +52,7 @@ enum WGscriptdata // npcs NPC_ROBOTIC_ARMS = 27852, + NPC_WORLD_TRIGGER_WG = 23472, }; class npc_wg_demolisher_engineer : public CreatureScript @@ -256,28 +257,20 @@ class go_wg_vehicle_teleporter : public GameObjectScript if (uiCheckTimer <= diff) { for (uint8 i = 0; i < 4; i++) - if (Creature* vehicle = go->FindNearestCreature(Vehicules[i], 3.0f, true)) - if (!vehicle->HasAura(SPELL_VEHICLE_TELEPORT)) - { - if (vehicle->GetVehicle()) - { - if (Unit* player = vehicle->GetVehicle()->GetPassenger(0)) + if (Creature* vehicleCreature = go->FindNearestCreature(Vehicules[i], 3.0f, true)) + if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) + if (Vehicle* vehicle = vehicleCreature->GetVehicle()) + if (Unit* passenger = vehicle->GetPassenger(0)) { uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); - uint32 plfaction = player->getFaction(); + uint32 plfaction = passenger->getFaction(); if (gofaction == plfaction) { - vehicle->CastSpell(vehicle, SPELL_VEHICLE_TELEPORT, true); - if (Creature* TargetTeleport = vehicle->FindNearestCreature(23472, 100.0f, true)) - { - float x, y, z, o; - TargetTeleport->GetPosition(x, y, z, o); - vehicle->GetVehicle()->TeleportVehicle(x, y, z, o); - } + if (Creature teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) + teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); } } - } - } + uiCheckTimer = 1000; } else From d31902d85874d5c5f85bf590ceafb881934750c4 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 21 Mar 2012 09:26:07 -0400 Subject: [PATCH 122/147] Core/Battlefield: Fix issue with previous commit. codestyle cleanup and attempt to fix vehicle issues with worldstates. --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 32 ++++++++++++------- src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 2068741b4e..fac3b9cd04 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -31,6 +31,14 @@ enum WGBfData BATTLEFIELD_WG_MAPID = 571, // Northrend }; +enum WGVehicles +{ + NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312, + NPC_WG_SEIGE_ENGINE_HORDE = 32627, + NPC_WG_DEMOLISHER = 28094, + NPC_WG_CATAPULT = 27881, +}; + bool BattlefieldWG::SetupBattlefield() { InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); @@ -580,10 +588,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) { switch (creature->GetEntry()) { - case 28312: - case 32627: - case 27881: - case 28094: + case NPC_WG_SEIGE_ENGINE_ALLIANCE: + case NPC_WG_SEIGE_ENGINE_HORDE: + case NPC_WG_CATAPULT: + case NPC_WG_DEMOLISHER: { uint8 team; if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) @@ -595,10 +603,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) if (team == TEAM_HORDE) { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { - creature->AddAura(SPELL_HORDE_FLAG, creature); + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; + creature->CastSpell(creature, SPELL_HORDE_FLAG, true); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -611,10 +619,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) } else { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { - creature->AddAura(SPELL_ALLIANCE_FLAG, creature); + m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; + creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -637,10 +645,10 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) { switch (creature->GetEntry()) { - case 28312: - case 32627: - case 27881: - case 28094: + case NPC_WG_SEIGE_ENGINE_ALLIANCE: + case NPC_WG_SEIGE_ENGINE_HORDE: + case NPC_WG_CATAPULT: + case NPC_WG_DEMOLISHER: { uint8 team; if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index eb7b5dfefd..c7c6cc3725 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -266,7 +266,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript uint32 plfaction = passenger->getFaction(); if (gofaction == plfaction) { - if (Creature teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) + if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); } } From 094f98d3a955009a3f800e2b53ff62261a191f68 Mon Sep 17 00:00:00 2001 From: Warpten Date: Wed, 21 Mar 2012 18:52:07 +0100 Subject: [PATCH 123/147] Battlefield/Wintergrasp: * Use correct spells on losing and winning factions * Enums renaming, lowerCamelCase wherever applicable * Rename some methods and class attributes for them to sound more English and less Engrish or even Frenglish (\o/) * Use correct spells when trying to build mechanical units at the Workshops. --- src/server/game/Battlefield/Battlefield.cpp | 397 +++++----- src/server/game/Battlefield/Battlefield.h | 523 +++++++------- .../game/Battlefield/BattlefieldHandler.cpp | 4 +- .../game/Battlefield/BattlefieldMgr.cpp | 9 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 599 +++++++-------- .../game/Battlefield/Zones/BattlefieldWG.h | 680 +++++++++--------- src/server/game/Globals/ObjectMgr.h | 5 - src/server/game/Server/WorldSession.h | 2 +- src/server/scripts/Commands/cs_bf.cpp | 6 +- src/server/scripts/Northrend/wintergrasp.cpp | 589 ++++++++------- 10 files changed, 1389 insertions(+), 1425 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 5e1e530dbd..2ad6b24405 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -32,12 +32,11 @@ #include "CreatureTextMgr.h" #include "GroupMgr.h" - Battlefield::Battlefield() { m_Timer = 0; - m_enable = true; - m_BattlefieldActive = false; + m_IsEnabled = true; + m_isActive = false; m_DefenderTeam = TEAM_NEUTRAL; m_TypeId = 0; @@ -51,7 +50,7 @@ Battlefield::Battlefield() m_TimeForAcceptInvite = 20; m_uiKickDontAcceptTimer = 1000; - m_uiKickAfkTimer = 1000; + m_uiKickAfkPlayersTimer = 1000; m_LastResurectTimer = 30 * IN_MILLISECONDS; m_StartGroupingTimer = 0; @@ -63,50 +62,49 @@ Battlefield::~Battlefield() { } -void Battlefield::HandlePlayerEnterZone(Player *player, uint32 /*zone */ ) +// Called when a player enters the zone +void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/) { - //If battle is start, - // if it not fully > invite player to join the war - // if it fully > announce to player that BF is full and kick after few second if he dont leave + // If battle is started, + // If not full of players > invite player to join the war + // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave if (IsWarTime()) { - if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) //Not fully - { + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces InvitePlayerToWar(player); - } - else //Full + else // No more vacant places { - //TODO:Send packet for announce it to player + // TODO: Send a packet to announce it to player m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; InvitePlayerToQueue(player); } } else { - //If time left is <15 minutes invite player to join queue + // If time left is < 15 minutes invite player to join queue if (m_Timer <= m_StartGroupingTimer) InvitePlayerToQueue(player); } - //Add player in list of player in zone + // Add player in the list of player in zone m_players[player->GetTeamId()].insert(player->GetGUID()); - OnPlayerEnterZone(player); //for scripting + OnPlayerEnterZone(player); } -//Called when a player leave the zone -void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ ) +// Called when a player leave the zone +void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) { if (IsWarTime()) { - //if player is in war list + // If the player is participating to the battle if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end()) { m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID()); player->GetSession()->SendBfLeaveMessage(m_BattleId); - if (Group* group = player->GetGroup()) // remove from raid group if player is member + if (Group* group = player->GetGroup()) // Remove the player from the raid group group->RemoveMember(player->GetGUID()); - OnPlayerLeaveWar(player); //For scripting + OnPlayerLeaveWar(player); } } @@ -118,55 +116,54 @@ void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ ) m_players[player->GetTeamId()].erase(player->GetGUID()); SendRemoveWorldStates(player); RemovePlayerFromResurrectQueue(player->GetGUID()); - OnPlayerLeaveZone(player); //For scripting + OnPlayerLeaveZone(player); } bool Battlefield::Update(uint32 diff) { - //When global timer is end if (m_Timer <= diff) { - //Here end of battle by timer + // Battlefield ends on time if (IsWarTime()) EndBattle(true); - //Start of battle - else + else // Time to start a new battle! StartBattle(); } else m_Timer -= diff; - //Some times before battle start invite player to queue + // Invite players a few minutes before the battle's beginning if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer) { m_StartGrouping = true; - InvitePlayerInZoneToQueue(); - OnStartGrouping(); // for scripting + InvitePlayersInZoneToQueue(); + OnStartGrouping(); } bool objective_changed = false; if (IsWarTime()) { - if (m_uiKickAfkTimer <= diff) + if (m_uiKickAfkPlayersTimer <= diff) { - m_uiKickAfkTimer = 1000; - KickAfk(); + m_uiKickAfkPlayersTimer = 1000; + KickAfkPlayers(); } else - m_uiKickAfkTimer -= diff; + m_uiKickAfkPlayersTimer -= diff; - //Here kick player witch dont have accept invitation to join the war when time is end (time of windows) + // Kick players who chose not to accept invitation to the battle if (m_uiKickDontAcceptTimer <= diff) { for (int team = 0; team < 2; team++) for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++) if ((*itr).second <= time(NULL)) - KickPlayerFromBf((*itr).first); - InvitePlayerInZoneToWar(); + KickPlayerFromBattlefield((*itr).first); + + InvitePlayersInZoneToWar(); for (int team = 0; team < 2; team++) for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++) if ((*itr).second <= time(NULL)) - KickPlayerFromBf((*itr).first); + KickPlayerFromBattlefield((*itr).first); m_uiKickDontAcceptTimer = 1000; } @@ -181,9 +178,9 @@ bool Battlefield::Update(uint32 diff) if (m_LastResurectTimer <= diff) { - for (uint8 i = 0; i < m_GraveYardList.size(); i++) - if (GetGraveYardById(i)) - m_GraveYardList[i]->Resurrect(); + for (uint8 i = 0; i < m_GraveyardList.size(); i++) + if (GetGraveyardById(i)) + m_GraveyardList[i]->Resurrect(); m_LastResurectTimer = RESURRECTION_INTERVAL; } else @@ -192,7 +189,7 @@ bool Battlefield::Update(uint32 diff) return objective_changed; } -void Battlefield::InvitePlayerInZoneToQueue() +void Battlefield::InvitePlayersInZoneToQueue() { for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -200,16 +197,16 @@ void Battlefield::InvitePlayerInZoneToQueue() InvitePlayerToQueue(player); } -void Battlefield::InvitePlayerToQueue(Player *player) +void Battlefield::InvitePlayerToQueue(Player* player) { if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID())) return; - if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[player->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer) + if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); } -void Battlefield::InvitePlayerInQueueToWar() +void Battlefield::InvitePlayersInQueueToWar() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) { @@ -229,7 +226,7 @@ void Battlefield::InvitePlayerInQueueToWar() } } -void Battlefield::InvitePlayerInZoneToWar() +void Battlefield::InvitePlayersInZoneToWar() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -240,16 +237,13 @@ void Battlefield::InvitePlayerInZoneToWar() continue; if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) InvitePlayerToWar(player); - else - { - //full + else // Battlefield is full of players m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; - } } } } -void Battlefield::InvitePlayerToWar(Player *player) +void Battlefield::InvitePlayerToWar(Player* player) { if (!player) return; @@ -264,13 +258,15 @@ void Battlefield::InvitePlayerToWar(Player *player) return; } + // If the player does not match minimal level requirements for the battlefield, kick him if (player->getLevel() < m_MinLevel) { if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; return; } - //Check if player is not already in war + + // Check if player is not already in war if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID())) return; @@ -287,16 +283,16 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); } -void Battlefield::KickAfk() +void Battlefield::KickAfkPlayers() { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->isAFK()) - KickPlayerFromBf(*itr); + KickPlayerFromBattlefield(*itr); } -void Battlefield::KickPlayerFromBf(uint64 guid) +void Battlefield::KickPlayerFromBattlefield(uint64 guid) { if (Player* player = sObjectAccessor->FindPlayer(guid)) if (player->GetZoneId() == GetZoneId()) @@ -305,7 +301,7 @@ void Battlefield::KickPlayerFromBf(uint64 guid) void Battlefield::StartBattle() { - if (m_BattlefieldActive) + if (m_isActive) return; for (int team = 0; team < BG_TEAMS_COUNT; team++) @@ -315,41 +311,41 @@ void Battlefield::StartBattle() } m_Timer = m_BattleTime; - m_BattlefieldActive = true; + m_isActive = true; - InvitePlayerInZoneToWar(); - InvitePlayerInQueueToWar(); + InvitePlayersInZoneToWar(); + InvitePlayersInQueueToWar(); - PlaySoundToAll(BF_START); + DoPlaySoundToAll(BF_START); OnBattleStart(); } -void Battlefield::EndBattle(bool endbytimer) +void Battlefield::EndBattle(bool endByTimer) { - if (!m_BattlefieldActive) + if (!m_isActive) return; - m_BattlefieldActive = false; + m_isActive = false; m_StartGrouping = false; - if (!endbytimer) + if (!endByTimer) SetDefenderTeam(GetAttackerTeam()); if (GetDefenderTeam() == TEAM_ALLIANCE) - PlaySoundToAll(BF_ALLIANCE_WINS); // alliance wins sound + DoPlaySoundToAll(BF_ALLIANCE_WINS); else - PlaySoundToAll(BF_HORDE_WINS); // horde wins sound + DoPlaySoundToAll(BF_HORDE_WINS); - OnBattleEnd(endbytimer); + OnBattleEnd(endByTimer); - // reset bf timer + // Reset battlefield timer m_Timer = m_NoWarBattleTime; SendInitWorldStatesToAll(); } -void Battlefield::PlaySoundToAll(uint32 SoundID) +void Battlefield::DoPlaySoundToAll(uint32 SoundID) { WorldPacket data; data.Initialize(SMSG_PLAY_SOUND, 4); @@ -357,34 +353,33 @@ void Battlefield::PlaySoundToAll(uint32 SoundID) for (int team = 0; team < BG_TEAMS_COUNT; team++) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->GetSession()->SendPacket(&data); - } } -bool Battlefield::HasPlayer(Player *player) const +bool Battlefield::HasPlayer(Player* player) const { return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end(); } // Called in WorldSession::HandleBfQueueInviteResponse -void Battlefield::PlayerAcceptInviteToQueue(Player *player) +void Battlefield::PlayerAcceptInviteToQueue(Player* player) { - // Add player in queueVenez + // Add player in queue m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID()); // Send notification - player->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId); + player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId); } + // Called in WorldSession::HandleBfExitRequest -void Battlefield::AskToLeaveQueue(Player *player) +void Battlefield::AskToLeaveQueue(Player* player) { // Remove player from queue m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID()); } // Called in WorldSession::HandleBfEntryInviteResponse -void Battlefield::PlayerAcceptInviteToWar(Player *player) +void Battlefield::PlayerAcceptInviteToWar(Player* player) { if (!IsWarTime()) return; @@ -394,7 +389,7 @@ void Battlefield::PlayerAcceptInviteToWar(Player *player) player->GetSession()->SendBfEntered(m_BattleId); m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID()); m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); - //Remove player AFK + if (player->isAFK()) player->ToggleAFK(); @@ -407,14 +402,14 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId) if (spellId > 0) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) - player->CastSpell(player, (uint32) spellId, true); + player->CastSpell(player, uint32(spellId), true); else for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) - player->RemoveAuraFromStack((uint32) - spellId); + player->RemoveAuraFromStack(uint32(-spellId)); } -void Battlefield::BroadcastPacketZone(WorldPacket & data) const +void Battlefield::BroadcastPacketToZone(WorldPacket& data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -422,7 +417,7 @@ void Battlefield::BroadcastPacketZone(WorldPacket & data) const player->GetSession()->SendPacket(&data); } -void Battlefield::BroadcastPacketQueue(WorldPacket & data) const +void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) @@ -430,7 +425,7 @@ void Battlefield::BroadcastPacketQueue(WorldPacket & data) const player->GetSession()->SendPacket(&data); } -void Battlefield::BroadcastPacketWar(WorldPacket & data) const +void Battlefield::BroadcastPacketToWar(WorldPacket& data) const { for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) @@ -477,14 +472,13 @@ void Battlefield::SendWarningToAllInZone(uint32 entry) WorldPacket data = BuildWarningAnnPacket(msg); BroadcastPacketWar(data); }*/ -void Battlefield::SendWarningToPlayer(Player *player, uint32 entry) -{ - if (!player) - return; - if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) - if (Creature* stalker = unit->ToCreature()) - sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID()); +void Battlefield::SendWarningToPlayer(Player* player, uint32 entry) +{ + if (player) + if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid)) + if (Creature* stalker = unit->ToCreature()) + sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID()); } void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) @@ -500,38 +494,37 @@ void Battlefield::RegisterZone(uint32 zoneId) sBattlefieldMgr->AddZone(zoneId, this); } -void Battlefield::HideNpc(Creature *p_Creature) +void Battlefield::HideNpc(Creature* creature) { - p_Creature->CombatStop(); - p_Creature->SetReactState(REACT_PASSIVE); - p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - p_Creature->SetPhaseMask(2, true); - p_Creature->DisappearAndDie(); - p_Creature->SetVisible(false); + creature->CombatStop(); + creature->SetReactState(REACT_PASSIVE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + creature->SetPhaseMask(2, true); + creature->DisappearAndDie(); + creature->SetVisible(false); } -void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive) +void Battlefield::ShowNpc(Creature* creature, bool aggressive) { - p_Creature->SetPhaseMask(1, true); - p_Creature->SetVisible(true); - p_Creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - if (!p_Creature->isAlive()) - p_Creature->Respawn(true); - if (p_Aggressive) - p_Creature->SetReactState(REACT_AGGRESSIVE); + creature->SetPhaseMask(1, true); + creature->SetVisible(true); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + if (!creature->isAlive()) + creature->Respawn(true); + if (aggressive) + creature->SetReactState(REACT_AGGRESSIVE); else { - p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - p_Creature->SetReactState(REACT_PASSIVE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + creature->SetReactState(REACT_PASSIVE); } } -//***************************************************** -//*******************Group System********************** -//***************************************************** -Group *Battlefield::GetFreeBfRaid(TeamId TeamId) +// **************************************************** +// ******************* Group System ******************* +// **************************************************** +Group* Battlefield::GetFreeBfRaid(TeamId TeamId) { - //if found free group we return it for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) if (!group->IsFull()) @@ -540,7 +533,7 @@ Group *Battlefield::GetFreeBfRaid(TeamId TeamId) return NULL; } -Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) +Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) { for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) @@ -550,7 +543,7 @@ Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) return NULL; } -bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player) +bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) { if (!player->IsInWorld()) return false; @@ -583,97 +576,97 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player) //***************************************************** //***************Spirit Guide System******************* //***************************************************** + //-------------------- //-Battlefield Method- //-------------------- -BfGraveYard *Battlefield::GetGraveYardById(uint32 id) +BfGraveyard* Battlefield::GetGraveyardById(uint32 id) { - if (id < m_GraveYardList.size()) + if (id < m_GraveyardList.size()) { - if (m_GraveYardList[id]) - return m_GraveYardList[id]; + if (m_GraveyardList[id]) + return m_GraveyardList[id]; else - sLog->outError("Battlefield::GetGraveYardById Id:%u not existed", id); + sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id); } else - sLog->outError("Battlefield::GetGraveYardById Id:%u cant be found", id); + sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id); return NULL; } -WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *player) +WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player) { - BfGraveYard* closestGY = NULL; + BfGraveyard* closestGY = NULL; float maxdist = -1; - for (uint8 i = 0; i < m_GraveYardList.size(); i++) + for (uint8 i = 0; i < m_GraveyardList.size(); i++) { - if (m_GraveYardList[i]) + if (m_GraveyardList[i]) { - if (m_GraveYardList[i]->GetControlTeamId() != player->GetTeamId()) + if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId()) continue; - float dist = m_GraveYardList[i]->GetDistance(player); + float dist = m_GraveyardList[i]->GetDistance(player); if (dist < maxdist || maxdist < 0) { - closestGY = m_GraveYardList[i]; + closestGY = m_GraveyardList[i]; maxdist = dist; } } } if (closestGY) - return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveYardId()); + return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId()); return NULL; } -void Battlefield::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid) { - for (uint8 i = 0; i < m_GraveYardList.size(); i++) + for (uint8 i = 0; i < m_GraveyardList.size(); i++) { - if (!m_GraveYardList[i]) + if (!m_GraveyardList[i]) continue; - if (m_GraveYardList[i]->HasNpc(npc_guid)) + if (m_GraveyardList[i]->HasNpc(npcGuid)) { - m_GraveYardList[i]->AddPlayer(player_guid); + m_GraveyardList[i]->AddPlayer(playerGuid); break; } } } -void Battlefield::RemovePlayerFromResurrectQueue(uint64 player_guid) +void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid) { - for (uint8 i = 0; i < m_GraveYardList.size(); i++) + for (uint8 i = 0; i < m_GraveyardList.size(); i++) { - if (!m_GraveYardList[i]) + if (!m_GraveyardList[i]) continue; - if (m_GraveYardList[i]->HasPlayer(player_guid)) + if (m_GraveyardList[i]->HasPlayer(playerGuid)) { - m_GraveYardList[i]->RemovePlayer(player_guid); + m_GraveyardList[i]->RemovePlayer(playerGuid); break; } } } -void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid) +void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid) { - sLog->outError("SendAreaSpiritHealerQueryOpcode"); WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); uint32 time = m_LastResurectTimer; // resurrect every 30 seconds data << guid << time; - ASSERT(pl && pl->GetSession()); - pl->GetSession()->SendPacket(&data); + ASSERT(player && player->GetSession()); + player->GetSession()->SendPacket(&data); } -//-------------------- -//-BfGraveYard Method- -//-------------------- -BfGraveYard::BfGraveYard(Battlefield *Bf) +// ---------------------- +// - BfGraveyard Method - +// ---------------------- +BfGraveyard::BfGraveyard(Battlefield* battlefield) { - m_Bf = Bf; + m_Bf = battlefield; m_GraveyardId = 0; m_ControlTeam = TEAM_NEUTRAL; m_SpiritGuide[0] = NULL; @@ -681,17 +674,17 @@ BfGraveYard::BfGraveYard(Battlefield *Bf) m_ResurrectQueue.clear(); } -void BfGraveYard::Initialize(TeamId startcontrol, uint32 gy) +void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId) { - m_ControlTeam = startcontrol; - m_GraveyardId = gy; + m_ControlTeam = startControl; + m_GraveyardId = graveyardId; } -void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) +void BfGraveyard::SetSpirit(Creature* spirit, TeamId team) { if (!spirit) { - sLog->outError(": Invalid Spirit."); + sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit."); return; } @@ -699,32 +692,32 @@ void BfGraveYard::SetSpirit(Creature* spirit, TeamId team) spirit->SetReactState(REACT_PASSIVE); } -float BfGraveYard::GetDistance(Player *player) +float BfGraveyard::GetDistance(Player* player) { - const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); - return player->GetDistance2d(ws->x, ws->y); + const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId); + return player->GetDistance2d(safeLoc->x, safeLoc->y); } -void BfGraveYard::AddPlayer(uint64 player_guid) +void BfGraveyard::AddPlayer(uint64 playerGuid) { - if (!m_ResurrectQueue.count(player_guid)) + if (!m_ResurrectQueue.count(playerGuid)) { - m_ResurrectQueue.insert(player_guid); + m_ResurrectQueue.insert(playerGuid); - if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + if (Player* player = sObjectAccessor->FindPlayer(playerGuid)) player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true); } } -void BfGraveYard::RemovePlayer(uint64 player_guid) +void BfGraveyard::RemovePlayer(uint64 playerGuid) { - m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid)); + m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid)); - if (Player* player = sObjectAccessor->FindPlayer(player_guid)) + if (Player* player = sObjectAccessor->FindPlayer(playerGuid)) player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); } -void BfGraveYard::Resurrect() +void BfGraveyard::Resurrect() { if (m_ResurrectQueue.empty()) return; @@ -736,7 +729,7 @@ void BfGraveYard::Resurrect() if (!player) continue; - // Check player isinworld and player is on good graveyard + // Check if the player is in world and on the good graveyard if (player->IsInWorld()) if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam])) spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); @@ -754,7 +747,7 @@ void BfGraveYard::Resurrect() } // For changing graveyard control -void BfGraveYard::ChangeControl(TeamId team) +void BfGraveyard::GiveControlTo(TeamId team) { // Guide switching // Note: Visiblity changes are made by phasing @@ -768,52 +761,51 @@ void BfGraveYard::ChangeControl(TeamId team) RelocateDeadPlayers(); } -void BfGraveYard::RelocateDeadPlayers() +void BfGraveyard::RelocateDeadPlayers() { - WorldSafeLocsEntry const* ClosestGrave = NULL; + WorldSafeLocsEntry const* closestGrave = NULL; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { Player* player = sObjectAccessor->FindPlayer(*itr); if (!player) continue; - if (ClosestGrave) - player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); + if (closestGrave) + player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation()); else { - ClosestGrave = m_Bf->GetClosestGraveYard(player); - if (ClosestGrave) - player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); + closestGrave = m_Bf->GetClosestGraveYard(player); + if (closestGrave) + player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation()); } } } -//***************End Spirit Guide system*************** +// ******************************************************* +// *************** End Spirit Guide system *************** +// ******************************************************* +// ********************** Misc *************************** +// ******************************************************* -//***************************************************** -//**********************Misc*************************** -//***************************************************** -//Method for spawn creature on map -Creature *Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team) +Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team) { return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team); } -Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) +Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) { //Get map object Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); if (!map) { - sLog->outError("Can't create creature entry: %u map not found", entry); + sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); return 0; } - //Create creature Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { - sLog->outError("Can't create creature entry: %u", entry); + sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; return NULL; } @@ -823,7 +815,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - sLog->outErrorDb("Battleground::AddCreature: entry %u does not exist.", entry); + sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry); return NULL; } // force using DB speeds -- do we really need this? @@ -838,10 +830,10 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl } // Method for spawning gameobject on map -GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o) +GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o) { // Get map object - Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571)); + Map* map = const_cast(sMapMgr->CreateBaseMap(571)); // *vomits* if (!map) return 0; @@ -849,23 +841,24 @@ GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z GameObject* go = new GameObject; if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) { - sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry); - sLog->outError("Cannot create gameobject template %u! Battleground not created!", entry); + sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); + sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); delete go; return NULL; } - // Add in the world + // Add to world map->AddToMap(go); go->setActive(true); + return go; } -//***************************************************** -//*******************CapturePoint********************** -//***************************************************** +// ******************************************************* +// ******************* CapturePoint ********************** +// ******************************************************* -BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) +BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL) { m_team = TEAM_NEUTRAL; m_value = 0; @@ -877,28 +870,28 @@ BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL) m_maxSpeed = 0; } -bool BfCapturePoint::HandlePlayerEnter(Player *player) +bool BfCapturePoint::HandlePlayerEnter(Player* player) { if (m_capturePoint) { player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); - player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f))); player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); } return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second; } -GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr) +GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player) { if (m_capturePoint) - plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); + player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - GuidSet::iterator current = m_activePlayers[plr->GetTeamId()].find(plr->GetGUID()); + GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID()); - if (current == m_activePlayers[plr->GetTeamId()].end()) + if (current == m_activePlayers[player->GetTeamId()].end()) return current; // return end() - m_activePlayers[plr->GetTeamId()].erase(current++); + m_activePlayers[player->GetTeamId()].erase(current++); return current; } @@ -974,10 +967,10 @@ bool BfCapturePoint::Update(uint32 diff) { for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) { - if (Player* plr = sObjectAccessor->FindPlayer(*itr)) + if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive()) - itr = HandlePlayerLeave(plr); + if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) + itr = HandlePlayerLeave(player); else ++itr; } @@ -1111,7 +1104,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) player->KilledMonsterCredit(id, guid); } -bool BfCapturePoint::IsInsideObjective(Player *player) const +bool BfCapturePoint::IsInsideObjective(Player* player) const { return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end(); } diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 2bc7ccca40..217d6d62a2 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -68,342 +68,363 @@ class Creature; class Unit; class Battlefield; -class BfGraveYard; +class BfGraveyard; -typedef std::set < uint64 > GuidSet; -typedef std::vector < BfGraveYard * >GraveYardVect; -typedef std::map < uint64, uint32 > PlayerTimerMap; +typedef std::set GuidSet; +typedef std::vector GraveyardVect; +typedef std::map PlayerTimerMap; class BfCapturePoint { -public: - BfCapturePoint(Battlefield * bf); + public: + BfCapturePoint(Battlefield* bf); - virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} - // send world state update to all players present - void SendUpdateWorldState(uint32 field, uint32 value); + // Send world state update to all players present + void SendUpdateWorldState(uint32 field, uint32 value); - // send kill notify to players in the controlling faction - void SendObjectiveComplete(uint32 id, uint64 guid); + // Send kill notify to players in the controlling faction + void SendObjectiveComplete(uint32 id, uint64 guid); - // used when player is activated/inactivated in the area - virtual bool HandlePlayerEnter(Player* player); - virtual GuidSet::iterator HandlePlayerLeave(Player* player); - //virtual void HandlePlayerActivityChanged(Player * player); + // Used when player is activated/inactivated in the area + virtual bool HandlePlayerEnter(Player* player); + virtual GuidSet::iterator HandlePlayerLeave(Player* player); + //virtual void HandlePlayerActivityChanged(Player* player); - // checks if player is in range of a capture credit marker - bool IsInsideObjective(Player * player) const; + // Checks if player is in range of a capture credit marker + bool IsInsideObjective(Player* player) const; - // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. - virtual bool Update(uint32 diff); - virtual void ChangeTeam(TeamId /*oldTeam */ ) {} - virtual void SendChangePhase(); + // Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. + virtual bool Update(uint32 diff); + virtual void ChangeTeam(TeamId /*oldTeam*/) {} + virtual void SendChangePhase(); - bool SetCapturePointData(GameObject* capturePoint); - GameObject* GetCapturePointGo() { return m_capturePoint; } + bool SetCapturePointData(GameObject* capturePoint); + GameObject* GetCapturePointGo() { return m_capturePoint; } - TeamId GetTeamId() {return m_team;} -protected: - bool DelCapturePoint(); + TeamId GetTeamId() { return m_team; } + protected: + bool DelCapturePoint(); - // active players in the area of the objective, 0 - alliance, 1 - horde - GuidSet m_activePlayers[2]; + // active Players in the area of the objective, 0 - alliance, 1 - horde + GuidSet m_activePlayers[2]; - // total shift needed to capture the objective - float m_maxValue; - float m_minValue; + // Total shift needed to capture the objective + float m_maxValue; + float m_minValue; - // maximum speed of capture - float m_maxSpeed; + // Maximum speed of capture + float m_maxSpeed; - // the status of the objective - float m_value; - TeamId m_team; + // The status of the objective + float m_value; + TeamId m_team; - // objective states - BattlefieldObjectiveStates m_OldState; - BattlefieldObjectiveStates m_State; + // Objective states + BattlefieldObjectiveStates m_OldState; + BattlefieldObjectiveStates m_State; - // neutral value on capture bar - uint32 m_neutralValuePct; + // Neutral value on capture bar + uint32 m_neutralValuePct; - // pointer to the Battlefield this objective belongs to - Battlefield *m_Bf; - uint32 m_capturePointEntry; - GameObject *m_capturePoint; + // Pointer to the Battlefield this objective belongs to + Battlefield* m_Bf; + + // Capture point entry + uint32 m_capturePointEntry; + + // Gameobject related to that capture point + GameObject* m_capturePoint; }; -class BfGraveYard +class BfGraveyard { -public: - BfGraveYard(Battlefield *Bf); + public: + BfGraveyard(Battlefield* Bf); - // method for change who control the graveyard - void ChangeControl(TeamId team); - TeamId GetControlTeamId() { return m_ControlTeam; } + // Method to changing who controls the graveyard + void GiveControlTo(TeamId team); + TeamId GetControlTeamId() { return m_ControlTeam; } - // use for found the nearest graveyard - float GetDistance(Player * player); - void Initialize(TeamId startcontrol, uint32 gy); - void SetSpirit(Creature* spirit, TeamId team); - void AddPlayer(uint64 player_guid); - void RemovePlayer(uint64 player_guid); + // Find the nearest graveyard to a player + float GetDistance(Player* player); - void Resurrect(); - void RelocateDeadPlayers(); + // Initialize the graveyard + void Initialize(TeamId startcontrol, uint32 gy); - bool HasNpc(uint64 guid) - { - // npcs could not be loaded in the map yet. - if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) - return false; + // Set spirit service for the graveyard + void SetSpirit(Creature* spirit, TeamId team); - if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) || - !sObjectAccessor->FindUnit(m_SpiritGuide[1])) - return false; + // Add a player to the graveyard + void AddPlayer(uint64 player_guid); - return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid); - } - bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } - uint32 GetGraveYardId() { return m_GraveyardId; } + // Remove a player from the graveyard + void RemovePlayer(uint64 player_guid); -protected: + // Resurrect players + void Resurrect(); - TeamId m_ControlTeam; - uint32 m_GraveyardId; - uint64 m_SpiritGuide[2]; - GuidSet m_ResurrectQueue; - Battlefield *m_Bf; + // Move players waiting to that graveyard on the nearest one + void RelocateDeadPlayers(); + + // Check if this graveyard has a spirit guide + bool HasNpc(uint64 guid) + { + if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) + return false; + + if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) || + !sObjectAccessor->FindUnit(m_SpiritGuide[1])) + return false; + + return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid); + } + + // Check if a player is in this graveyard's ressurect queue + bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } + + // Get the graveyard's ID. + uint32 GetGraveyardId() { return m_GraveyardId; } + + protected: + TeamId m_ControlTeam; + uint32 m_GraveyardId; + uint64 m_SpiritGuide[2]; + GuidSet m_ResurrectQueue; + Battlefield* m_Bf; }; class Battlefield : public ZoneScript { friend class BattlefieldMgr; - public: - /// Constructor - Battlefield(); - /// Destructor - virtual ~Battlefield(); + public: + /// Constructor + Battlefield(); + /// Destructor + virtual ~Battlefield(); - /// typedef of map witch store capturepoint and the associate gameobject entry - typedef std::map < uint32 /*lowguid */ , BfCapturePoint * >BfCapturePointMap; + /// typedef of map witch store capturepoint and the associate gameobject entry + typedef std::map BfCapturePointMap; - /// Call this to init the Battlefield - virtual bool SetupBattlefield() { return true; } + /// Call this to init the Battlefield + virtual bool SetupBattlefield() { return true; } - /// Generate packet which contain all worldstatedata of area - virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {} + /// Generate packet which contain all worldstatedata of area + virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} - /// Update data of a worldstate to all players present in zone - void SendUpdateWorldState(uint32 field, uint32 value); + /// Update data of a worldstate to all players present in zone + void SendUpdateWorldState(uint32 field, uint32 value); - /** - * \brief Called every time for update bf data and time - * -Update timer for start/end battle - * -Invite player in zone to queue x minutes before start (x = m_StartGroupingTimer) - * -Kick Afk players - * \param diff : time ellapsed since last call (in ms) - */ - virtual bool Update(uint32 diff); + /** + * \brief Called every time for update bf data and time + * - Update timer for start/end battle + * - Invite player in zone to queue m_StartGroupingTimer minutes before start + * - Kick Afk players + * \param diff : time ellapsed since last call (in ms) + */ + virtual bool Update(uint32 diff); - /// Invite all player in zone, to join the queue, called x minutes before battle start in Update() - void InvitePlayerInZoneToQueue(); - /// Invite all player in queue to join battle on battle start - void InvitePlayerInQueueToWar(); - /// Invite all player in zone to join battle on battle start - void InvitePlayerInZoneToWar(); + /// Invite all players in zone to join the queue, called x minutes before battle start in Update() + void InvitePlayersInZoneToQueue(); + /// Invite all players in queue to join battle on battle start + void InvitePlayersInQueueToWar(); + /// Invite all players in zone to join battle on battle start + void InvitePlayersInZoneToWar(); - /// Called when a Unit is kill in battlefield zone - virtual void HandleKill(Player * /*killer */ , Unit * /*killed */ ) {}; + /// Called when a Unit is kill in battlefield zone + virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {}; - uint32 GetTypeId() { return m_TypeId; } - uint32 GetZoneId() { return m_ZoneId; } + uint32 GetTypeId() { return m_TypeId; } + uint32 GetZoneId() { return m_ZoneId; } - void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); + void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); - /// Return true if battle is start, false if battle is not started - bool IsWarTime() { return m_BattlefieldActive; } + /// Return true if battle is start, false if battle is not started + bool IsWarTime() { return m_isActive; } - /// Enable or Disable battlefield - void SetEnable(bool enable) { m_enable = enable; } - /// Return if battlefield is enable - bool GetEnable() { return m_enable; } + /// Enable or Disable battlefield + void ToggleBattlefield(bool enable) { m_IsEnabled = enable; } + /// Return if battlefield is enable + bool IsEnabled() { return m_IsEnabled; } - /** - * \brief Kick player from battlefield and teleport him to kick-point location - * \param guid : guid of player who must be kick - */ - void KickPlayerFromBf(uint64 guid); + /** + * \brief Kick player from battlefield and teleport him to kick-point location + * \param guid : guid of player who must be kick + */ + void KickPlayerFromBattlefield(uint64 guid); - /// Called when player (player) enter in zone - void HandlePlayerEnterZone(Player * player, uint32 zone); - /// Called when player (player) leave the zone - void HandlePlayerLeaveZone(Player * player, uint32 zone); + /// Called when player (player) enter in zone + void HandlePlayerEnterZone(Player* player, uint32 zone); + /// Called when player (player) leave the zone + void HandlePlayerLeaveZone(Player* player, uint32 zone); - // All-purpose data storage 64 bit - virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; } - virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; } + // All-purpose data storage 64 bit + virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; } + virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; } - // All-purpose data storage 32 bit - virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; } - virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; } + // All-purpose data storage 32 bit + virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; } + virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; } + virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; } - // Battlefield - generic methods - TeamId GetDefenderTeam() { return m_DefenderTeam; } - TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); } - void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; } + // Battlefield - generic methods + TeamId GetDefenderTeam() { return m_DefenderTeam; } + TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); } + TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); } + void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; } - // Group methods - /** - * \brief Find a not full battlefield group, if there is no, create one - * \param TeamId : Id of player team for who we search a group (player->GetTeamId()) - */ - Group *GetFreeBfRaid(TeamId TeamId); - /// Return battlefield group where player is. - Group *GetGroupPlayer(uint64 guid, TeamId TeamId); - /// Force player to join a battlefield group - bool AddOrSetPlayerToCorrectBfGroup(Player * player); + // Group methods + /** + * \brief Find a not full battlefield group, if there is no, create one + * \param TeamId : Id of player team for who we search a group (player->GetTeamId()) + */ + Group* GetFreeBfRaid(TeamId TeamId); + /// Return battlefield group where player is. + Group* GetGroupPlayer(uint64 guid, TeamId TeamId); + /// Force player to join a battlefield group + bool AddOrSetPlayerToCorrectBfGroup(Player* player); - // Graveyard methods - // Find which graveyard the player must be teleported to to be resurrected by spiritguide - WorldSafeLocsEntry const *GetClosestGraveYard(Player * player); + // Graveyard methods + // Find which graveyard the player must be teleported to to be resurrected by spiritguide + WorldSafeLocsEntry const * GetClosestGraveYard(Player* player); - virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); - void RemovePlayerFromResurrectQueue(uint64 player_guid); - void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); } - BfGraveYard *GetGraveYardById(uint32 id); + virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + void RemovePlayerFromResurrectQueue(uint64 player_guid); + void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); } + BfGraveyard* GetGraveyardById(uint32 id); - // Misc methods - Creature *SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); - Creature *SpawnCreature(uint32 entry, Position pos, TeamId team); - GameObject *SpawnGameObject(uint32 entry, float x, float y, float z, float o); + // Misc methods + Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); + Creature* SpawnCreature(uint32 entry, Position pos, TeamId team); + GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o); - // Script-methods + // Script-methods - /// Called on start - virtual void OnBattleStart() {}; - /// Called at the end of battle - virtual void OnBattleEnd(bool /*endbytimer */ ) {}; - /// Called x minutes before battle start when player in zone are invite to join queue - virtual void OnStartGrouping() {}; - /// Called when a player accept to join the battle - virtual void OnPlayerJoinWar(Player * /*player */ ) {}; - /// Called when a player leave the battle - virtual void OnPlayerLeaveWar(Player * /*player */ ) {}; - /// Called when a player leave battlefield zone - virtual void OnPlayerLeaveZone(Player * /*player */ ) {}; - /// Called when a player enter in battlefield zone - virtual void OnPlayerEnterZone(Player * /*player */ ) {}; + /// Called on start + virtual void OnBattleStart() {}; + /// Called at the end of battle + virtual void OnBattleEnd(bool /*endByTimer*/) {}; + /// Called x minutes before battle start when player in zone are invite to join queue + virtual void OnStartGrouping() {}; + /// Called when a player accept to join the battle + virtual void OnPlayerJoinWar(Player* /*player*/) {}; + /// Called when a player leave the battle + virtual void OnPlayerLeaveWar(Player* /*player*/) {}; + /// Called when a player leave battlefield zone + virtual void OnPlayerLeaveZone(Player* /*player*/) {}; + /// Called when a player enter in battlefield zone + virtual void OnPlayerEnterZone(Player* /*player*/) {}; - WorldPacket BuildWarningAnnPacket(std::string msg); - void SendWarningToAllInZone(uint32 entry); - //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED - void SendWarningToPlayer(Player * player, uint32 entry); + WorldPacket BuildWarningAnnPacket(std::string msg); + void SendWarningToAllInZone(uint32 entry); + //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED + void SendWarningToPlayer(Player* player, uint32 entry); - void PlayerAcceptInviteToQueue(Player * player); - void PlayerAcceptInviteToWar(Player * player); - uint32 GetBattleId() { return m_BattleId; } - void AskToLeaveQueue(Player * player); + void PlayerAcceptInviteToQueue(Player* player); + void PlayerAcceptInviteToWar(Player* player); + uint32 GetBattleId() { return m_BattleId; } + void AskToLeaveQueue(Player* player); - virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {}; + virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {}; - /// Send all worldstate data to all player in zone. - virtual void SendInitWorldStatesToAll() {}; + /// Send all worldstate data to all player in zone. + virtual void SendInitWorldStatesToAll() {}; - /// Return if we can use mount in battlefield - bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not - void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid); + /// Return if we can use mount in battlefield + bool CanFlyIn() { return !m_isActive; } - void StartBattle(); - void EndBattle(bool endbytimer); + void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid); - void HideNpc(Creature * p_Creature); - void ShowNpc(Creature * p_Creature, bool p_Aggressive); + void StartBattle(); + void EndBattle(bool endByTimer); - GraveYardVect GetGraveYardVect() { return m_GraveYardList; } + void HideNpc(Creature* creature); + void ShowNpc(Creature* creature, bool aggressive); - uint32 GetTimer() { return m_Timer; } - void SetTimer(uint32 timer) { m_Timer = timer; } + GraveyardVect GetGraveyardVector() { return m_GraveyardList; } - void PlaySoundToAll(uint32 SoundID); + uint32 GetTimer() { return m_Timer; } + void SetTimer(uint32 timer) { m_Timer = timer; } - void InvitePlayerToQueue(Player * player); - void InvitePlayerToWar(Player * player); + void DoPlaySoundToAll(uint32 SoundID); - void InitStalker(uint32 entry, float x, float y, float z, float o); + void InvitePlayerToQueue(Player* player); + void InvitePlayerToWar(Player* player); -protected: - uint64 StalkerGuid; - uint32 m_Timer; // Global timer for event - bool m_enable; - bool m_BattlefieldActive; - TeamId m_DefenderTeam; + void InitStalker(uint32 entry, float x, float y, float z, float o); - // the map of the objectives belonging to this outdoorpvp - BfCapturePointMap m_capturePoints; + protected: + uint64 StalkerGuid; + uint32 m_Timer; // Global timer for event + bool m_IsEnabled; + bool m_isActive; + TeamId m_DefenderTeam; - // the set of player - GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone - GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue - GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat - PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT]; - PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT]; + // Map of the objectives belonging to this OutdoorPvP + BfCapturePointMap m_capturePoints; - //Variables that must exist for each battlefield - uint32 m_TypeId; // See enum BattlefieldTypes - uint32 m_BattleId; // BattleID (for packet) - uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197 - uint32 m_MapId; // MapId where is Battlefield - uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield - uint32 m_MinPlayer; // Minimum number of player for Battlefield start - uint32 m_MinLevel; // Required level to participate at Battlefield - uint32 m_BattleTime; // Length of a battle - uint32 m_NoWarBattleTime; // Time between two battles - uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle. - uint32 m_TimeForAcceptInvite; - uint32 m_uiKickDontAcceptTimer; - WorldLocation KickPosition; // Position where player is teleport if they switch to afk during battle or if they dont accept invitation + // Players info maps + GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone + GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue + GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat + PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT]; + PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT]; - uint32 m_uiKickAfkTimer; // Timer for check Afk in war + // Variables that must exist for each battlefield + uint32 m_TypeId; // See enum BattlefieldTypes + uint32 m_BattleId; // BattleID (for packet) + uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197 + uint32 m_MapId; // MapId where is Battlefield + uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield + uint32 m_MinPlayer; // Minimum number of player for Battlefield start + uint32 m_MinLevel; // Required level to participate at Battlefield + uint32 m_BattleTime; // Length of a battle + uint32 m_NoWarBattleTime; // Time between two battles + uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle. + uint32 m_TimeForAcceptInvite; + uint32 m_uiKickDontAcceptTimer; + WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation - //Graveyard variables - GraveYardVect m_GraveYardList; // Vector witch contain the different GY of the battle - uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec + uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war - uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle - bool m_StartGrouping; // bool for know if all players in area has been invited + // Graveyard variables + GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle + uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec - GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group + uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle + bool m_StartGrouping; // bool for know if all players in area has been invited - std::vector < uint64 > m_Data64; - std::vector < uint32 > m_Data32; + GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group - void KickAfk(); - // use for switch off all worldstate for client - virtual void SendRemoveWorldStates(Player * /*player */ ) {} + std::vector m_Data64; + std::vector m_Data32; - // use for send a packet for all player list - void BroadcastPacketZone(WorldPacket & data) const; - void BroadcastPacketQueue(WorldPacket & data) const; - void BroadcastPacketWar(WorldPacket & data) const; + void KickAfkPlayers(); - //CapturePoint system - void AddCapturePoint(BfCapturePoint * cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; } + // use for switch off all worldstate for client + virtual void SendRemoveWorldStates(Player* /*player*/) {} - BfCapturePoint *GetCapturePoint(uint32 lowguid) const - { - Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); - if (itr != m_capturePoints.end()) - return itr->second; - return NULL; - } + // use for send a packet for all player list + void BroadcastPacketToZone(WorldPacket& data) const; + void BroadcastPacketToQueue(WorldPacket& data) const; + void BroadcastPacketToWar(WorldPacket& data) const; - void RegisterZone(uint32 zoneid); - bool HasPlayer(Player * player) const; - void TeamCastSpell(TeamId team, int32 spellId); + // CapturePoint system + void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; } + BfCapturePoint* GetCapturePoint(uint32 lowguid) const + { + Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); + if (itr != m_capturePoints.end()) + return itr->second; + return NULL; + } + + void RegisterZone(uint32 zoneid); + bool HasPlayer(Player* player) const; + void TeamCastSpell(TeamId team, int32 spellId); }; #endif diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 7f7613b395..e10c5c136d 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -60,7 +60,7 @@ void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId) //Param2:(ZoneId) the zone where the battle is (4197 for wg) //Param3:(CanQueue) if able to queue //Param4:(Full) on log in is full -void WorldSession::SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full) +void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full) { WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11); data << uint32(BattleId); @@ -132,7 +132,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) else { if (_player->GetZoneId() == Bf->GetZoneId()) - Bf->KickPlayerFromBf(_player->GetGUID()); + Bf->KickPlayerFromBattlefield(_player->GetGUID()); } } diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 095ec4fd18..9f821871c2 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -77,10 +77,9 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid) if (itr == m_BattlefieldMap.end()) return; - if (itr->second->HasPlayer(player)) - return; - if (itr->second->GetEnable() == false) + if (itr->second->HasPlayer(player) || !itr->second->IsEnabled()) return; + itr->second->HandlePlayerEnterZone(player, zoneid); sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); } @@ -106,7 +105,7 @@ Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid) // no handle for this zone, return return NULL; } - if (itr->second->GetEnable() == false) + if (!itr->second->IsEnabled()) return NULL; return itr->second; } @@ -127,7 +126,7 @@ void BattlefieldMgr::Update(uint32 diff) if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL) { for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) - if ((*itr)->GetEnable()) + if ((*itr)->IsEnabled()) (*itr)->Update(m_UpdateTimer); m_UpdateTimer = 0; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index fac3b9cd04..decc22105a 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -25,7 +25,7 @@ #include "SpellAuras.h" #include "Vehicle.h" -enum WGBfData +enum WintergrastData { BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp BATTLEFIELD_WG_MAPID = 571, // Northrend @@ -49,7 +49,7 @@ bool BattlefieldWG::SetupBattlefield() m_MapId = BATTLEFIELD_WG_MAPID; m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX); - m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); + m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS; @@ -72,39 +72,39 @@ bool BattlefieldWG::SetupBattlefield() m_saveTimer = 60000; // Init GraveYards - SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX); + SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX); // Load from db if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0) && (sWorld->getWorldState(ClockWorldState[0]) == 0)) { - sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false); - sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1)); - sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false)); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1))); + sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime)); } - m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE); + m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE)); m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); - + m_Timer = sWorld->getWorldState(ClockWorldState[0]); - if (m_BattlefieldActive) + if (m_isActive) { - m_BattlefieldActive = false; + m_isActive = false; m_Timer = m_RestartAfterCrash; } - for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) + for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++) { - BfGraveYardWG *gy = new BfGraveYardWG(this); + BfGraveyardWG* graveyard = new BfGraveyardWG(this); // When between games, the graveyard is controlled by the defending team if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) - gy->Initialize(m_DefenderTeam, WGGraveYard[i].gyid); + graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid); else - gy->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); - gy->SetTextId(WGGraveYard[i].textid); - m_GraveYardList[i] = gy; + graveyard->SetTextId(WGGraveYard[i].textid); + m_GraveyardList[i] = graveyard; } @@ -113,61 +113,68 @@ bool BattlefieldWG::SetupBattlefield() { WGWorkshop* workshop = new WGWorkshop(this, i); if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - workshop->ChangeControl(GetAttackerTeam(), true); + workshop->GiveControlTo(GetAttackerTeam(), true); else - workshop->ChangeControl(GetDefenderTeam(), true); - - //Note: Capture point is added once the gameobject is created. + workshop->GiveControlTo(GetDefenderTeam(), true); + // Note: Capture point is added once the gameobject is created. WorkshopsList.insert(workshop); } - // Spawning npc in keep + // Spawn NPCs in the defender's keep, both Horde and Alliance for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) { // Horde npc - if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) KeepCreature[TEAM_HORDE].insert(creature->GetGUID()); // Alliance npc - if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) + if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); } - // Hide keep npc + + // Hide NPCs from the Attacker's team in the keep for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - // Spawn out of keep npc - // Horde npc + + // Spawn Horde NPCs outside the keep for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) - if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); - // Alliance npc + + // Spawn Alliance NPCs outside the keep for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) - if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) + if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); - // Hide outside npc + + // Hide units outside the keep that are defenders for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); + + // Spawn turrets and hide them per default for (uint8 i = 0; i < WG_MAX_TURRET; i++) { - if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0))) + Position towerCannonPos; + WGTurret[i].GetPosition(&towerCannonPos); + if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE)) { CanonList.insert(creature->GetGUID()); HideNpc(creature); } } - // Spawning Buiding + + // Spawn all gameobjects for (uint8 i = 0; i < WG_MAX_OBJ; i++) { - GameObject* go = - SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o); - BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this); - b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid); + GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o); + BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this); + b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId); BuildingsInZone.insert(b); } + // Spawning portal defender for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++) { @@ -176,15 +183,15 @@ bool BattlefieldWG::SetupBattlefield() go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); } - // Spawn banner in keep + // Spawn banners in the keep for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++) { - if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) { go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY); m_KeepGameObject[1].insert(go); } - if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) + if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) { go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); m_KeepGameObject[0].insert(go); @@ -208,7 +215,7 @@ bool BattlefieldWG::Update(uint32 diff) bool m_return = Battlefield::Update(diff); if (m_saveTimer <= diff) { - sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_BattlefieldActive); + sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive); sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam); sWorld->setWorldState(ClockWorldState[0], m_Timer); m_saveTimer = 60 * IN_MILLISECONDS; @@ -222,13 +229,13 @@ bool BattlefieldWG::Update(uint32 diff) void BattlefieldWG::OnBattleStart() { // Spawn titan relic - m_relic = SpawnGameObject(BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC, 5440.0f, 2840.8f, 430.43f, 0); - if (m_relic) + m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0); + if (m_titansRelic) { // Update faction of relic, only attacker can click on - m_relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]); + m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]); // Set in use (not allow to click on before last door is broken) - m_relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } else sLog->outError("WG: Failed to spawn titan relic."); @@ -257,17 +264,15 @@ void BattlefieldWG::OnBattleStart() } } - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] = 0; - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] = 0; - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT] = 0; - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0; + SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0); + SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0); + SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0); + SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0); // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) - { if (*itr) - (*itr)->UpdateGraveYardAndWorkshop(); - } + (*itr)->UpdateGraveyardAndWorkshop(); for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) @@ -292,32 +297,32 @@ void BattlefieldWG::UpdateCounterVehicle(bool init) { if (init) { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H] = 0; - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A] = 0; + SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0); + SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0); } - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0; - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0; + SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0); + SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0); for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { if (WGWorkshop* workshop = (*itr)) { if (workshop->teamControl == TEAM_ALLIANCE) - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4; + UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4); else if (workshop->teamControl == TEAM_HORDE) - m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4; + UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4); } } UpdateVehicleCountWG(); } -void BattlefieldWG::OnBattleEnd(bool endbytimer) +void BattlefieldWG::OnBattleEnd(bool endByTimer) { // Remove relic - if (m_relic) - m_relic->RemoveFromWorld(); - m_relic = NULL; + if (m_titansRelic) + m_titansRelic->RemoveFromWorld(); + m_titansRelic = NULL; // Remove turret for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) @@ -326,52 +331,42 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) { if (Creature* creature = unit->ToCreature()) { - if (!endbytimer) + if (!endByTimer) creature->setFaction(WintergraspFaction[GetDefenderTeam()]); HideNpc(creature); } } } - // If endbytimer is false, battle is end by clicking on relic - if (!endbytimer) + if (!endByTimer) // One player triggered the relic { // Change all npc in keep for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - } + for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); - } + // Change all npc out of keep for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - } + for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) ShowNpc(creature, true); - } } // Update all graveyard, control is to defender when no wartime for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++) - { - if (GetGraveYardById(i)) - { - GetGraveYardById(i)->ChangeControl(GetDefenderTeam()); - } - } + if (BfGraveyard* graveyard = GetGraveyardById(i)) + graveyard->GiveControlTo(GetDefenderTeam()); for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); @@ -389,58 +384,23 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) (*itr)->Save(); - uint32 WinHonor = 0; - uint32 LossHonor = 0; - - if (!endbytimer) - { - WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; - LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; - } - else - { - WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]; - LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]; - } - for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); - if (player->HasAura(SPELL_LIEUTENANT)) - { - player->RewardHonor(NULL, 1, WinHonor); - RewardMarkOfHonor(player, 3); - } - else if (player->HasAura(SPELL_CORPORAL)) - { - player->RewardHonor(NULL, 1, WinHonor); - RewardMarkOfHonor(player, 2); - } + player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true); + player->CastSpell(player, SPELL_VICTORY_REWARD, true); // Send Wintergrasp victory achievement DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player); // Award achievement for succeeding in Wintergrasp in 10 minutes or less - if (!endbytimer && GetTimer() <= 10000) + if (!endByTimer && GetTimer() <= 10000) DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player); } } + for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) - { - if (player->HasAura(SPELL_LIEUTENANT)) - { - player->RewardHonor(NULL, 1, LossHonor); - RewardMarkOfHonor(player, 1); - } - else if (player->HasAura(SPELL_CORPORAL)) - { - player->RewardHonor(NULL, 1, LossHonor); - RewardMarkOfHonor(player, 1); - } - } - } + player->CastSpell(player, SPELL_DEFEAT_REWARD, true); for (uint8 team = 0; team < 2; ++team) { @@ -448,19 +408,18 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) if (Player* player = sObjectAccessor->FindPlayer(*itr)) RemoveAurasFromPlayer(player); - m_PlayersInWar[team].clear(); + m_PlayersInWar[team].clear(); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) - { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) if (creature->IsVehicle()) creature->GetVehicleKit()->Dismiss(); - } + m_vehicles[team].clear(); } - if (!endbytimer) + if (!endByTimer) { for (uint8 team = 0; team < 2; ++team) { @@ -475,72 +434,45 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer) } } - if (!endbytimer) - { // win alli/horde + if (!endByTimer) // win alli/horde SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1); - } - else - { // defend alli/horde + else // defend alli/horde SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1); - } } -// ***************************************************** -// *******************Reward System********************* -// ***************************************************** -void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 /*incrementNumber */ ) +// ******************************************************* +// ******************* Reward System ********************* +// ******************************************************* +void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/) { - AchievementEntry const* AE = sAchievementStore.LookupEntry(achievement); + AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement); + + if (!achievementEntry) + return; switch (achievement) { case ACHIEVEMENTS_WIN_WG_100: - { - // player->GetAchievementMgr().UpdateAchievementCriteria(); - } + { + // player->GetAchievementMgr().UpdateAchievementCriteria(); + } default: - { - if (player) - player->CompletedAchievement(AE); - } + { + if (player) + player->CompletedAchievement(achievementEntry); break; + } } } -void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count) -{ - // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens - if (count == 0) - return; - - ItemPosCountVec dest; - uint32 no_space_count = 0; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count); - - if (msg == EQUIP_ERR_ITEM_NOT_FOUND) - { - return; - } - - if (msg != EQUIP_ERR_OK) // convert to possible store amount - count -= no_space_count; - - if (count != 0 && !dest.empty()) // can add some - if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0)) - player->SendNewItem(item, count, true, false); -} - void BattlefieldWG::OnStartGrouping() { - // Warn SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) { - uint8 graveyardId = 0; - switch (areaId) { case AREA_WINTERGRASP_FORTRESS: @@ -558,29 +490,27 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) case AREA_THE_CHILLED_QUAGMIRE: return BATTLEFIELD_WG_GY_HORDE; default: - sLog->outError(": Unexpected Area Id %u", areaId); + sLog->outError("BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); break; } - return graveyardId; + return 0; } -void BattlefieldWG::OnCreatureCreate(Creature *creature) +void BattlefieldWG::OnCreatureCreate(Creature* creature) { // Accessing to db spawned creatures switch (creature->GetEntry()) { - // Alliance Spirit case NPC_DWARVEN_SPIRIT_GUIDE: - // Horde Spirit case NPC_TAUNKA_SPIRIT_GUIDE: - { - TeamId teamId = creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE; - uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId()); - if (m_GraveYardList[graveyardId]) - m_GraveYardList[graveyardId]->SetSpirit(creature, teamId); - } + { + TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE); + uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId()); + if (m_GraveyardList[graveyardId]) + m_GraveyardList[graveyardId]->SetSpirit(creature, teamId); break; + } } // untested code - not sure if it is valid. @@ -588,53 +518,53 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature) { switch (creature->GetEntry()) { - case NPC_WG_SEIGE_ENGINE_ALLIANCE: - case NPC_WG_SEIGE_ENGINE_HORDE: - case NPC_WG_CATAPULT: - case NPC_WG_DEMOLISHER: - { - uint8 team; - if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) - team = TEAM_ALLIANCE; - else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) - team = TEAM_HORDE; - else - return; + case NPC_WINTERGRASP_SIEGE_ENGINE_1: + case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_CATAPULT: + case NPC_WINTERGRASP_DEMOLISHER: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; - if (team == TEAM_HORDE) + if (team == TEAM_HORDE) + { + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) - { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++; - creature->CastSpell(creature, SPELL_HORDE_FLAG, true); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); + creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); } else { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) - { - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++; - creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); - m_vehicles[team].insert(creature->GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); - return; - } + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; } - break; } + else + { + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + { + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); + creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + m_vehicles[team].insert(creature->GetGUID()); + UpdateVehicleCountWG(); + } + else + { + creature->setDeathState(DEAD); + creature->SetRespawnTime(RESPAWN_ONE_DAY); + return; + } + } + break; + } } } } @@ -645,28 +575,28 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) { switch (creature->GetEntry()) { - case NPC_WG_SEIGE_ENGINE_ALLIANCE: - case NPC_WG_SEIGE_ENGINE_HORDE: - case NPC_WG_CATAPULT: - case NPC_WG_DEMOLISHER: - { - uint8 team; - if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) - team = TEAM_ALLIANCE; - else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) - team = TEAM_HORDE; - else - return; + case NPC_WINTERGRASP_SIEGE_ENGINE_1: + case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_CATAPULT: + case NPC_WINTERGRASP_DEMOLISHER: + { + uint8 team; + if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) + team = TEAM_ALLIANCE; + else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) + team = TEAM_HORDE; + else + return; - m_vehicles[team].erase(creature->GetGUID()); - if (team == TEAM_HORDE) - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--; - else - m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--; - UpdateVehicleCountWG(); + m_vehicles[team].erase(creature->GetGUID()); + if (team == TEAM_HORDE) + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1); + else + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1); + UpdateVehicleCountWG(); - break; - } + break; + } } } } @@ -678,40 +608,40 @@ void BattlefieldWG::OnGameObjectCreate(GameObject* go) switch (go->GetEntry()) { - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE: + case GO_WINTERGRASP_FACTORY_BANNER_NE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NE; break; - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW: + case GO_WINTERGRASP_FACTORY_BANNER_NW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NW; break; - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE: + case GO_WINTERGRASP_FACTORY_BANNER_SE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SE; break; - case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW: + case GO_WINTERGRASP_FACTORY_BANNER_SW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SW; break; } - if (isWorkshop) - { - for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) - { - if (WGWorkshop* workshop = (*itr)) - { - if (workshop->workshopId == workshopId) - { - BfCapturePointWG* capturePoint = new BfCapturePointWG(this, GetAttackerTeam()); + if (!isWorkshop) + return; - capturePoint->SetCapturePointData(go); - capturePoint->LinkToWorkShop(workshop); - AddCapturePoint(capturePoint); - break; - } + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) + { + if (WGWorkshop* workshop = (*itr)) + { + if (workshop->workshopId == workshopId) + { + WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam()); + + capturePoint->SetCapturePointData(go); + capturePoint->LinkToWorkshop(workshop); + AddCapturePoint(capturePoint); + break; } } } @@ -727,29 +657,20 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetTypeId() == TYPEID_PLAYER) { for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) - { if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); - } return; } - for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); - itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) - { + + for (GuidSet::const_iterator itr = m_vehicles[GetOtherTeam(killer->GetTeamId())].begin(); itr != m_vehicles[GetOtherTeam(killer->GetTeamId())].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - { if (Creature* creature = unit->ToCreature()) - { if (victim->GetEntry() == creature->GetEntry() && !again) - { again = true; - } - } - } - } - for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin(); - itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr) + + for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killer->GetTeamId())].begin(); + itr != KeepCreature[GetOtherTeam(killer->GetTeamId())].end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { @@ -759,11 +680,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) { again = true; for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) - { if (Player* player = sObjectAccessor->FindPlayer(*iter)) - if (player->GetDistance2d(killer) < 40) + if (player->GetDistance2d(killer) < 40.0f) PromotePlayer(player); - } } } } @@ -774,12 +693,12 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) // Update rank for player void BattlefieldWG::PromotePlayer(Player* killer) { - if (!m_BattlefieldActive) + if (!m_isActive) return; // Updating rank of player if (Aura* aur = killer->GetAura(SPELL_RECRUIT)) { - if (aur->GetStackAmount() >= 5) // 7 or more TODO: + if (aur->GetStackAmount() >= 5) { killer->RemoveAura(SPELL_RECRUIT); killer->CastSpell(killer, SPELL_CORPORAL, true); @@ -790,7 +709,7 @@ void BattlefieldWG::PromotePlayer(Player* killer) } else if (Aura* aur = killer->GetAura(SPELL_CORPORAL)) { - if (aur->GetStackAmount() >= 5) // 7 or more TODO: + if (aur->GetStackAmount() >= 5) { killer->RemoveAura(SPELL_CORPORAL); killer->CastSpell(killer, SPELL_LIEUTENANT, true); @@ -822,9 +741,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) if (player->GetZoneId() != m_ZoneId) { if (player->GetTeamId() == GetDefenderTeam()) - { player->TeleportTo(571, 5345, 2842, 410, 3.14f); - } else { if (player->GetTeamId() == TEAM_HORDE) @@ -838,13 +755,13 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) if (player->GetTeamId() == GetAttackerTeam()) { - if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) - player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT)); } else { - if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) - player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); + if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0) + player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT)); } SendInitWorldStatesTo(player); } @@ -858,6 +775,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) player->GetVehicle()->Dismiss(); RemoveAurasFromPlayer(player); } + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); @@ -866,7 +784,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) void BattlefieldWG::OnPlayerLeaveZone(Player* player) { - if (!m_BattlefieldActive) + if (!m_isActive) RemoveAurasFromPlayer(player); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); @@ -877,7 +795,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) void BattlefieldWG::OnPlayerEnterZone(Player* player) { - if (!m_BattlefieldActive) + if (!m_isActive) RemoveAurasFromPlayer(player); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); @@ -896,11 +814,8 @@ uint32 BattlefieldWG::GetData(uint32 data) case AREA_WESTPARK_WORKSHOP: case AREA_EASTPARK_WORKSHOP: // Graveyards and Workshops are controlled by the same team. - if (m_GraveYardList[GetSpiritGraveyardId(data)]) - return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); - default: - if (m_Data32[data]) - return m_Data32[data]; + if (m_GraveyardList[GetSpiritGraveyardId(data)]) + return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); } return Battlefield::GetData(data); @@ -918,8 +833,8 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); - data << uint32(3710) << uint32(IsWarTime()? 1 : 0); + data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); // Note: cleanup these two, their names look awkward + data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime()? 1 : 0); for (uint32 i = 0; i < 2; ++i) data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); @@ -930,20 +845,16 @@ WorldPacket BattlefieldWG::BuildInitWorldStates() data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) - { data << (*itr)->m_WorldState << (*itr)->m_State; - } - for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) - { - if (!*itr) - continue; - data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; - } + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) + if (*itr) + data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; + return data; } -void BattlefieldWG::SendInitWorldStatesTo(Player *player) +void BattlefieldWG::SendInitWorldStatesTo(Player* player) { WorldPacket data = BuildInitWorldStates(); player->GetSession()->SendPacket(&data); @@ -970,47 +881,44 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team) } }*/ } + // Called when a tower is broke -void BattlefieldWG::AddBrokenTower(TeamId team) +void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team) { // Destroy an attack tower if (team == GetAttackerTeam()) { // Update counter - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]--; - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]++; + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1); + UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1); - // Remove buff stack + // Remove buff stack on attackers for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->RemoveAuraFromStack(SPELL_TOWER_CONTROL); - // Add buff stack + // Add buff stack to defenders for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) { player->CastSpell(player, SPELL_TOWER_CONTROL, true); DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player); } - // If the threw south tower is destroy - if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3) + + // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time + if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3) { - // Remove 10 minutes to battle time if (int32(m_Timer - 600000) < 0) - { m_Timer = 0; - } else - { m_Timer -= 600000; - } SendInitWorldStatesToAll(); } } else { - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]--; - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF]++; + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1); + UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1); } } @@ -1025,13 +933,12 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) return; // On click on titan relic - if (go->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC) + if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC) { - // Check that the door is break - if (m_CanClickOnOrb) + if (CanInteractWithRelic()) EndBattle(false); - else // if door is not break, respawn relic. - m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY); + else + GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY); } // if destroy or damage event, search the wall/tower and update worldstate/send warning message @@ -1051,40 +958,36 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) } // Called when a tower is damaged, used for honor reward calcul -void BattlefieldWG::AddDamagedTower(TeamId team) +void BattlefieldWG::UpdateDamagedTowerCount(TeamId team) { if (team == GetAttackerTeam()) - { - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]++; - } + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1); else - { - m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]++; - } + UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1); } // Update vehicle count WorldState to player void BattlefieldWG::UpdateVehicleCountWG() { - SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); - SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); } void BattlefieldWG::UpdateTenacity() { TeamId team = TEAM_NEUTRAL; - uint32 allianceNum = m_PlayersInWar[TEAM_ALLIANCE].size(); - uint32 hordeNum = m_PlayersInWar[TEAM_HORDE].size(); + uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size(); + uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size(); int32 newStack = 0; - if (allianceNum && hordeNum) + if (alliancePlayers && hordePlayers) { - if (allianceNum < hordeNum) - newStack = int32((float (hordeNum) / float (allianceNum) - 1) *4); // positive, should cast on alliance - else if (allianceNum > hordeNum) - newStack = int32((1 - float (allianceNum) / float (hordeNum)) *4); // negative, should cast on horde + if (alliancePlayers < hordePlayers) + newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance + else if (alliancePlayers > hordePlayers) + newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde } if (newStack == int32(m_tenacityStack)) @@ -1121,13 +1024,17 @@ void BattlefieldWG::UpdateTenacity() newStack = 20; uint32 buff_honor = SPELL_GREATEST_HONOR; - buff_honor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honor; - buff_honor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honor; - buff_honor = (newStack < 5) ? 0 : buff_honor; + if (newStack < 15) + buff_honor = SPELL_GREATER_HONOR; + if (newStack < 10) + buff_honor = SPELL_GREAT_HONOR; + if (newStack < 5) + buff_honor = 0; for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) player->SetAuraStack(SPELL_TENACITY, player, newStack); + for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) @@ -1137,27 +1044,27 @@ void BattlefieldWG::UpdateTenacity() { for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) - player->AddAura(buff_honor, player); + player->CastSpell(player, buff_honor, true); for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) - creature->AddAura(buff_honor, creature); + creature->CastSpell(creature, buff_honor, true); } } } -void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ ) +WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield) { - m_WorkShop->ChangeControl(m_team, false); + m_Bf = battlefield; + m_team = teamInControl; } -BfCapturePointWG::BfCapturePointWG(BattlefieldWG* bf, TeamId control) : BfCapturePoint(bf) +void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/) { - m_Bf = bf; - m_team = control; + m_Workshop->GiveControlTo(m_team, false); } -BfGraveYardWG::BfGraveYardWG(BattlefieldWG* bf) : BfGraveYard(bf) +BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield) { - m_Bf = bf; + m_Bf = battlefield; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index a7d1d185c8..b2356e61d6 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -23,38 +23,30 @@ #include "WorldPacket.h" #include "World.h" #include "Group.h" +#include "GroupMgr.h" #include "Battlefield.h" const uint32 VehNumWorldState[2] = { 3680, 3490 }; const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; const uint32 ClockWorldState[2] = { 3781, 4354 }; const uint32 WintergraspFaction[3] = { 1, 116, 35 }; - const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; class BattlefieldWG; -class BfCapturePointWG; +class WintergraspCapturePoint; struct BfWGGameObjectBuilding; struct WGWorkshop; -typedef std::setGameObjectSet; -typedef std::set GameObjectBuilding; +typedef std::set GameObjectSet; +typedef std::set GameObjectBuilding; typedef std::set Workshop; -//typedef std::set CapturePointSet; unused ? -typedef std::set GroupSet; +typedef std::set GroupSet; +//typedef std::set CapturePointSet; unused ? -enum eWGItem +enum WintergraspSpells { -// *INDENT-OFF* - WG_MARK_OF_HONOR = 43589, -// *INDENT-ON* -}; - -enum eWGSpell -{ -// *INDENT-OFF* - // AWartime auras + // Wartime auras SPELL_RECRUIT = 37795, SPELL_CORPORAL = 33280, SPELL_LIEUTENANT = 55629, @@ -93,11 +85,9 @@ enum eWGSpell SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64 SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128 - -// *INDENT-ON* }; -enum eWGData32 +enum WintergraspData { BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, @@ -110,9 +100,8 @@ enum eWGData32 BATTLEFIELD_WG_DATA_MAX, }; -enum WB_ACHIEVEMENTS +enum WintergraspAchievements { -// *INDENT-OFF* ACHIEVEMENTS_WIN_WG = 1717, ACHIEVEMENTS_WIN_WG_100 = 1718, // todo ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo @@ -129,10 +118,9 @@ enum WB_ACHIEVEMENTS ACHIEVEMENTS_WG_RANGER = 2199, // todo ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo ACHIEVEMENTS_WG_MASTER_H = 2776, // todo -// *INDENT-ON* }; -enum eWGWorldStates +enum WintergraspWorldStates { BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490, BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491, @@ -141,9 +129,10 @@ enum eWGWorldStates BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801, BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802, BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803, + BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710, }; -enum WGAreaIds +enum WintergraspAreaIds { AREA_WINTERGRASP_FORTRESS = 4575, AREA_THE_SUNKEN_RING = 4538, @@ -155,18 +144,18 @@ enum WGAreaIds }; /*######################### -*####### Graveyards ######* -#########################*/ + *####### Graveyards ###### + *#########################*/ -class BfGraveYardWG : public BfGraveYard +class BfGraveyardWG : public BfGraveyard { - public: - BfGraveYardWG(BattlefieldWG *Bf); + public: + BfGraveyardWG(BattlefieldWG *Bf); - void SetTextId(uint32 textid) { m_GossipTextId = textid; } - uint32 GetTextId() { return m_GossipTextId; } - protected: - uint32 m_GossipTextId; + void SetTextId(uint32 textid) { m_GossipTextId = textid; } + uint32 GetTextId() { return m_GossipTextId; } + protected: + uint32 m_GossipTextId; }; enum WGGraveyardId @@ -178,12 +167,11 @@ enum WGGraveyardId BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GY_ALLIANCE, - BATTLEFIELD_WG_GY_MAX, + BATTLEFIELD_WG_GRAVEYARD_MAX, }; enum eWGGossipText { -// *INDENT-OFF* BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504, @@ -191,12 +179,10 @@ enum eWGGossipText BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506, -// *INDENT-ON* }; -enum eWGNpc +enum WintergraspNpcs { -// *INDENT-OFF* BATTLEFIELD_WG_NPC_GUARD_H = 30739, BATTLEFIELD_WG_NPC_GUARD_A = 30740, BATTLEFIELD_WG_NPC_STALKER = 15214, @@ -223,7 +209,13 @@ enum eWGNpc NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp -// *INDENT-ON* + NPC_TOWER_CANNON = 28366, + + NPC_WINTERGRASP_SIEGE_ENGINE_1 = 28312, + NPC_WINTERGRASP_SIEGE_ENGINE_2 = 32627, + NPC_WINTERGRASP_CATAPULT = 27881, + NPC_WINTERGRASP_DEMOLISHER = 28094, + NPC_WINTERGRASP_TOWER_CANNON = 28366, }; struct BfWGCoordGY @@ -243,7 +235,7 @@ const uint32 WGQuest[2][6] = { { 13185, 13183, 13223, 13539, 13178, 13180 }, }; // 7 in sql, 7 in header -const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { +const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = { { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL }, @@ -253,136 +245,132 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = { { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE }, }; -/*######################### -* BfCapturePointWG * -#########################*/ +/* ######################### * + * WintergraspCapturePoint * + * ######################### */ -class BfCapturePointWG : public BfCapturePoint +class WintergraspCapturePoint : public BfCapturePoint { public: - BfCapturePointWG(BattlefieldWG* bf, TeamId control); + WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl); - void LinkToWorkShop(WGWorkshop* ws) - { - m_WorkShop = ws; - } + void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; } void ChangeTeam(TeamId oldteam); - TeamId GetTeam() const - { - return m_team; - } + TeamId GetTeam() const { return m_team; } protected: - WGWorkshop *m_WorkShop; + WGWorkshop* m_Workshop; }; -/*######################### -* WinterGrasp Battlefield * -#########################*/ +/* ######################### * + * WinterGrasp Battlefield * + * ######################### */ class BattlefieldWG : public Battlefield { public: /** * \brief Called when the battle start - * -Spawn relic and turret - * -Rebuild tower and wall - * -Invite player to war + * - Spawn relic and turret + * - Rebuild tower and wall + * - Invite player to war */ void OnBattleStart(); /** * \brief Called when battle end - * -Remove relic and turret - * -Change banner/npc in keep if it needed - * -Saving battlestate - * -Reward honor/mark to player - * -Remove vehicle - * \param endbytimer : true if battle end when timer is at 00:00, false if battle end by clicking on relic + * - Remove relic and turret + * - Change banner/npc in keep if it needed + * - Saving battlestate + * - Reward honor/mark to player + * - Remove vehicle + * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic */ - void OnBattleEnd(bool endbytimer); + void OnBattleEnd(bool endByTimer); /** - * \brief Called when grouping start (15 minutes before battlestart) - * -Invite all player in zone to join queue + * \brief Called when grouping starts (15 minutes before battlestart) + * - Invite all player in zone to join queue */ void OnStartGrouping(); /** * \brief Called when player accept invite to join battle - * -Update aura - * -Teleport if it needed - * -Update worldstate - * -Update tenacity - * \param player: Player who accept invite + * - Update aura + * - Teleport if it needed + * - Update worldstate + * - Update tenacity + * \param player: Player who accepted invite */ - void OnPlayerJoinWar(Player *player); + void OnPlayerJoinWar(Player* player); /** - * \brief Called when player leave battle - * -Update player aura - * \param player : Player who leave battle + * \brief Called when player left the battle + * - Update player aura + * \param player : Player who left the battle */ - void OnPlayerLeaveWar(Player *player); + void OnPlayerLeaveWar(Player* player); /** - * \brief Called when player leave WG zone - * \param player : Player who leave zone + * \brief Called when player left the WG zone + * \param player : Player who left the zone */ - void OnPlayerLeaveZone(Player *player); + void OnPlayerLeaveZone(Player* player); /** - * \brief Called when player enter in WG zone - * -Update aura - * -Update worldstate - * \param player : Player who leave zone + * \brief Called when player enters in WG zone + * - Update aura + * - Update worldstate + * \param player : Player who enters the zone */ - void OnPlayerEnterZone(Player *player); + void OnPlayerEnterZone(Player* player); /** * \brief Called for update battlefield data - * -Save battle timer in database every minutes - * -Update imunity aura from graveyard - * -Update water aura, if player is in water (HACK) - * \param diff : time ellapsed since the last call (in ms) + * - Save battle timer in database every minutes + * - Update imunity aura from graveyard + * \param diff : time elapsed since the last call (in ms) */ bool Update(uint32 diff); /** * \brief Called when a creature is created - * -Update vehicle count + * - Update vehicle count */ - void OnCreatureCreate(Creature *creature); + void OnCreatureCreate(Creature* creature); - /** + /** * \brief Called when a creature is removed - * -Update vehicle count + * - Update vehicle count */ void OnCreatureRemove(Creature* creature); + /** + * \brief Called when a gameobject is created + */ void OnGameObjectCreate(GameObject* go); /** * \brief Called when a wall/tower is broken - * -Update quest + * - Update quest */ void BrokenWallOrTower(TeamId team); /** * \brief Called when a tower is damaged - * -Update tower count (for reward calcul) + * - Update tower count (for reward calcul) */ - void AddDamagedTower(TeamId team); + void UpdateDamagedTowerCount(TeamId team); /** * \brief Called when tower is broken - * -Update tower buff - * -check if three south tower is down for remove 10 minutes to wg + * - Update tower buff + * - check if three south tower is down for remove 10 minutes to wg */ - void AddBrokenTower(TeamId team); + void UpdatedDestroyedTowerCount(TeamId team); - void DoCompleteOrIncrementAchievement(uint32 achievement, Player *player, uint8 incrementNumber = 1); + void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1); void RemoveAurasFromPlayer(Player* player); @@ -392,40 +380,26 @@ class BattlefieldWG : public Battlefield bool SetupBattlefield(); /// Return pointer to relic object - GameObject* GetRelic() - { - return m_relic; - } + GameObject* GetRelic() { return m_titansRelic; } /// Define relic object - void SetRelic(GameObject* relic) - { - m_relic = relic; - } + void SetRelic(GameObject* relic) { m_titansRelic = relic; } - /// Say if player can click or not on orb (last door broken) - bool CanClickOnOrb() - { - return m_CanClickOnOrb; - } + /// Check if players can interact with the relic (Only if the last door has been broken) + bool CanInteractWithRelic() { return m_isRelicInteractible; } - /// Define if player can click or not on orb (if last door broken) - void AllowToClickOnOrb(bool allow) - { - m_CanClickOnOrb = allow; - } - - void RewardMarkOfHonor(Player *player, uint32 count); + /// Define if player can interact with the relic + void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; } void UpdateVehicleCountWG(); void UpdateCounterVehicle(bool init); WorldPacket BuildInitWorldStates(); - void SendInitWorldStatesTo(Player * player); + void SendInitWorldStatesTo(Player* player); void SendInitWorldStatesToAll(); - void HandleKill(Player *killer, Unit *victim); - void PromotePlayer(Player *killer); + void HandleKill(Player* killer, Unit* victim); + void PromotePlayer(Player* killer); void UpdateTenacity(); void ProcessEvent(WorldObject *obj, uint32 eventId); @@ -435,23 +409,35 @@ class BattlefieldWG : public Battlefield uint32 GetData(uint32 data); protected: - bool m_CanClickOnOrb; - GameObject* m_relic; - GameObjectBuilding BuildingsInZone; - GuidSet KeepCreature[2]; - GuidSet OutsideCreature[2]; + bool m_isRelicInteractible; + Workshop WorkshopsList; - GuidSet CanonList; + GameObjectSet DefenderPortalList; GameObjectSet m_KeepGameObject[2]; + GameObjectBuilding BuildingsInZone; + GuidSet m_vehicles[2]; + GuidSet CanonList; + GuidSet KeepCreature[2]; + GuidSet OutsideCreature[2]; + uint32 m_tenacityStack; uint32 m_saveTimer; + + GameObject* m_titansRelic; }; -#define NORTHREND_WINTERGRASP 4197 +const uint32 NORTHREND_WINTERGRASP = 4197; +const uint8 WG_MAX_OBJ = 32; +const uint8 WG_KEEPGAMEOBJECT_MAX = 44; +const uint8 WG_MAX_TURRET = 15; +const uint8 WG_MAX_KEEP_NPC = 39; +const uint8 WG_MAX_OUTSIDE_NPC = 14; +const uint8 WG_OUTSIDE_ALLIANCE_NPC = 7; +const uint8 WG_MAX_TELEPORTER = 12; -enum eWGGameObjectBuildingType +enum WintergraspGameObjectBuildingType { BATTLEFIELD_WG_OBJECTTYPE_DOOR, BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC, @@ -461,7 +447,7 @@ enum eWGGameObjectBuildingType BATTLEFIELD_WG_OBJECTTYPE_TOWER, }; -enum eWGGameObjectState +enum WintergraspGameObjectState { BATTLEFIELD_WG_OBJECTSTATE_NONE, BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT, @@ -475,7 +461,7 @@ enum eWGGameObjectState BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY, }; -enum WGWorkshopId +enum WintergraspWorkshopIds { BATTLEFIELD_WG_WORKSHOP_NE, BATTLEFIELD_WG_WORKSHOP_NW, @@ -485,7 +471,7 @@ enum WGWorkshopId BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, }; -enum WGWorldstate +enum WintergraspWorldstates { WORLDSTATE_WORKSHOP_NE = 3701, WORLDSTATE_WORKSHOP_NW = 3700, @@ -494,6 +480,7 @@ enum WGWorldstate WORLDSTATE_WORKSHOP_K_W = 3698, WORLDSTATE_WORKSHOP_K_E = 3699 }; + enum eWGTeamControl { BATTLEFIELD_WG_TEAM_ALLIANCE, @@ -504,7 +491,6 @@ enum eWGTeamControl // TODO: Handle this with creature_text ? enum eWGText { -// *INDENT-OFF* BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053, @@ -528,34 +514,42 @@ enum eWGText BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071, BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068, BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072, -// *INDENT-ON* }; -enum WGObject +enum WintergraspGameObject { -// *INDENT-OFF* - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475, - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW = 190487, - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE = 194959, - BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW = 194962, - BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC = 192829, -// *INDENT-ON* + GO_WINTERGRASP_FACTORY_BANNER_NE = 190475, + GO_WINTERGRASP_FACTORY_BANNER_NW = 190487, + GO_WINTERGRASP_FACTORY_BANNER_SE = 194959, + GO_WINTERGRASP_FACTORY_BANNER_SW = 194962, + + GO_WINTERGRASP_TITAN_S_RELIC = 192829, + + GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221, + GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373, + GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377, + GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378, + + GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356, + GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357, + GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358, }; -struct BfWGObjectPosition + +struct WintergraspObjectPositionData { float x; float y; float z; float o; - uint32 entryh; - uint32 entrya; + uint32 entryHorde; + uint32 entryAlliance; }; -// ********************************************************* -// ************Destructible (Wall,Tower..)****************** -// ********************************************************* +// ***************************************************** +// ************ Destructible (Wall,Tower..) ************ +// ***************************************************** -struct BfWGBuildingSpawnData +struct WintergraspBuildingSpawnData { uint32 entry; uint32 WorldState; @@ -564,13 +558,12 @@ struct BfWGBuildingSpawnData float z; float o; uint32 type; - uint32 nameid; + uint32 nameId; }; -#define WG_MAX_OBJ 32 -const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = { +const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { // Wall (Not spawned in db) - // Entry WS X Y Z O type NameID + // Entry WS X Y Z O type NameID { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 }, @@ -660,8 +653,7 @@ const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = { // 192357 : 1 in sql, 1 in header // 192350 : 1 in sql, 1 in header // 192351 : 1 in sql, 1 in header -#define WG_KEEPGAMEOBJECT_MAX 44 -const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { +const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect @@ -708,42 +700,31 @@ const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = { { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect }; -// Keep turret -struct BfWGTurretPos -{ - float x; - float y; - float z; - float o; -}; - -#define WG_MAX_TURRET 15 -const BfWGTurretPos WGTurret[WG_MAX_TURRET] = { - { 5391.19f, 3060.8f, 419.616f, 1.69557f }, - { 5266.75f, 2976.5f, 421.067f, 3.20354f }, - { 5234.86f, 2948.8f, 420.88f, 1.61311f }, - { 5323.05f, 2923.7f, 421.645f, 1.5817f }, +const Position WGTurret[WG_MAX_TURRET] = { + { 5391.19f, 3060.8f, 419.616f, 1.69557f }, + { 5266.75f, 2976.5f, 421.067f, 3.20354f }, + { 5234.86f, 2948.8f, 420.88f, 1.61311f }, + { 5323.05f, 2923.7f, 421.645f, 1.5817f }, { 5363.82f, 2923.87f, 421.709f, 1.60527f }, { 5264.04f, 2861.34f, 421.587f, 3.21142f }, { 5264.68f, 2819.78f, 421.656f, 3.15645f }, { 5322.16f, 2756.69f, 421.646f, 4.69978f }, { 5363.78f, 2756.77f, 421.629f, 4.78226f }, - { 5236.2f, 2732.68f, 421.649f, 4.72336f }, - { 5265.02f, 2704.63f, 421.7f, 3.12507f }, + { 5236.2f, 2732.68f, 421.649f, 4.72336f }, + { 5265.02f, 2704.63f, 421.7f, 3.12507f }, { 5350.87f, 2616.03f, 421.243f, 4.72729f }, - { 5390.95f, 2615.5f, 421.126f, 4.6409f }, - { 5148.8f, 2820.24f, 421.621f, 3.16043f }, - { 5147.98f, 2861.93f, 421.63f, 3.18792f }, + { 5390.95f, 2615.5f, 421.126f, 4.6409f }, + { 5148.8f, 2820.24f, 421.621f, 3.16043f }, + { 5147.98f, 2861.93f, 421.63f, 3.18792f }, }; - // Here there is all npc keeper spawn point -#define WG_MAX_KEEP_NPC 39 -const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = { +const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] = +{ // X Y Z O horde alliance // North East { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard - { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Plumembrase + { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard // North @@ -789,9 +770,7 @@ const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = { { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard }; -#define WG_MAX_OUTSIDE_NPC 14 -#define WG_OUTSIDE_ALLIANCE_NPC 7 -const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = +const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = { { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 }, { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 }, @@ -809,17 +788,16 @@ const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] = { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, }; -struct BfWGWGTeleporterData +struct WintergraspTeleporterData { - uint32 entry; // gameobject entry + uint32 entry; float x; float y; float z; float o; }; -#define WG_MAX_TELEPORTER 12 -const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = +const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = { // Player teleporter { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f }, @@ -841,23 +819,23 @@ const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] = // **********Tower Element(GameObject,Creature)************* // ********************************************************* -struct BfWGTowerData +struct WintergraspTowerData { - uint32 towerentry; // Gameobject id of tower + uint32 towerEntry; // Gameobject id of tower uint8 nbObject; // Number of gameobjects spawned on this point - BfWGObjectPosition GameObject[6]; // Gameobject position and entry (Horde/Alliance) + WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance) // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage? uint8 nbCreatureBottom; - BfWGObjectPosition CreatureBottom[9]; + WintergraspObjectPositionData CreatureBottom[9]; uint8 nbCreatureTop; - BfWGObjectPosition CreatureTop[5]; + WintergraspObjectPositionData CreatureTop[5]; }; -#define WG_MAX_ATTACKTOWERS 3 +uint8 const WG_MAX_ATTACKTOWERS = 3; // 192414 : 0 in sql, 1 in header // 192278 : 0 in sql, 3 in header -const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { +const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { // West tower { 190356, @@ -961,18 +939,18 @@ const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = { }, }; -struct BfWGTurretData +struct WintergraspTowerCannonData { - uint32 towerentry; - uint8 nbTurretBottom; - BfWGTurretPos TurretBottom[5]; + uint32 towerEntry; + uint8 nbTowerCannonBottom; + Position TowerCannonBottom[5]; uint8 nbTurretTop; - BfWGTurretPos TurretTop[5]; + Position TurretTop[5]; }; -#define WG_MAX_TOWERTURRET 7 +const uint8 WG_MAX_TOWER_CANNON = 7; -const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = +const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] = { { 190221, @@ -1113,7 +1091,7 @@ const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] = // *****************WorkShop Data & Element***************** // ********************************************************* -#define WG_MAX_WORKSHOP 6 +uint8 const WG_MAX_WORKSHOP = 6; struct WGWorkshopData { @@ -1162,7 +1140,7 @@ struct BfWGGameObjectBuilding BattlefieldWG *m_WG; // Linked gameobject - GameObject *m_Build; + GameObject* m_Build; // eWGGameObjectBuildingType uint32 m_Type; @@ -1182,7 +1160,7 @@ struct BfWGGameObjectBuilding // Creature associations GuidSet m_CreatureBottomList[2]; GuidSet m_CreatureTopList[2]; - GuidSet m_TurretBottomList; + GuidSet m_TowerCannonBottomList; GuidSet m_TurretTopList; void Rebuild() @@ -1235,9 +1213,9 @@ struct BfWGGameObjectBuilding m_WG->HideNpc(creature); if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER) - m_WG->AddDamagedTower(m_WG->GetDefenderTeam()); + m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam()); else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER) - m_WG->AddDamagedTower(m_WG->GetAttackerTeam()); + m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam()); } // Called when associated gameobject is destroyed @@ -1256,14 +1234,14 @@ struct BfWGGameObjectBuilding // Inform the global wintergrasp script of the destruction of this object case BATTLEFIELD_WG_OBJECTTYPE_TOWER: case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: - m_WG->AddBrokenTower(TeamId(m_Team)); + m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team)); break; case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: - m_WG->AllowToClickOnOrb(true); + m_WG->SetRelicInteractible(true); if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); else - sLog->outError("BATTLEFIELD: WG: Relic cant be clickable"); + sLog->outError("BattlefieldWG: Relic not found."); break; } @@ -1323,58 +1301,58 @@ struct BfWGGameObjectBuilding int32 towerid = -1; switch (go->GetEntry()) { - case 190221: + case GO_WINTERGRASP_FORTRESS_TOWER_1: towerid = 0; break; - case 190373: + case GO_WINTERGRASP_FORTRESS_TOWER_2: towerid = 1; break; - case 190377: + case GO_WINTERGRASP_FORTRESS_TOWER_3: towerid = 2; break; - case 190378: + case GO_WINTERGRASP_FORTRESS_TOWER_4: towerid = 3; break; - case 190356: + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: towerid = 4; break; - case 190357: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: towerid = 5; break; - case 190358: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: towerid = 6; break; } - if (towerid > 3) + if (towerid > 3) // Attacker towers { // Spawn associate gameobjects for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++) { - BfWGObjectPosition gob = AttackTowers[towerid - 4].GameObject[i]; - if (GameObject *go = m_WG->SpawnGameObject(gob.entryh, gob.x, gob.y, gob.z, gob.o)) + WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i]; + if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o)) m_GameObjectList[TEAM_HORDE].insert(go); - if (GameObject *go = m_WG->SpawnGameObject(gob.entrya, gob.x, gob.y, gob.z, gob.o)) + if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o)) m_GameObjectList[TEAM_ALLIANCE].insert(go); } // Spawn associate npc bottom for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++) { - BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureBottom[i]; - if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i]; + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE)) m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID()); - if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE)) m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID()); } // Spawn associate npc top for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++) { - BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureTop[i]; - if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE)) + WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i]; + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE)) m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID()); - if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE)) + if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE)) m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID()); } } @@ -1382,58 +1360,52 @@ struct BfWGGameObjectBuilding if (towerid >= 0) { // Spawn Turret bottom - for (uint8 i = 0; i < TowerTurret[towerid].nbTurretBottom; i++) + for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++) { - BfWGTurretPos turretpos = TowerTurret[towerid].TurretBottom[i]; - if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + Position turretPos; + TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos); + if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE)) { - m_TurretBottomList.insert(turret->GetGUID()); + m_TowerCannonBottomList.insert(turret->GetGUID()); switch (go->GetEntry()) { - case 190221: - case 190373: - case 190377: - case 190378: - { - turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + case GO_WINTERGRASP_FORTRESS_TOWER_1: + case GO_WINTERGRASP_FORTRESS_TOWER_2: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; } m_WG->HideNpc(turret); } } // Spawn Turret top - for (uint8 i = 0; i < TowerTurret[towerid].nbTurretTop; i++) + for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++) { - BfWGTurretPos turretpos = TowerTurret[towerid].TurretTop[i]; - if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0))) + Position towerCannonPos; + TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos); + if (Creature *turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0))) { m_TurretTopList.insert(turret->GetGUID()); switch (go->GetEntry()) { - case 190221: - case 190373: - case 190377: - case 190378: - { - turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } + case GO_WINTERGRASP_FORTRESS_TOWER_1: + case GO_WINTERGRASP_FORTRESS_TOWER_2: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: + turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: + turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; } m_WG->HideNpc(turret); } @@ -1473,7 +1445,7 @@ struct BfWGGameObjectBuilding void UpdateTurretAttack(bool disable) { - for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr) + for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { @@ -1607,14 +1579,13 @@ struct WGWorkshop WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId) { - ASSERT(_bf); - ASSERT(_workshopId < WG_MAX_WORKSHOP); + ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP); bf = _bf; workshopId = _workshopId; } - void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + void GiveControlTo(uint8 team, bool init /* for first call in setup*/) { switch (team) { @@ -1638,8 +1609,8 @@ struct WGWorkshop // Found associate graveyard and update it if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - if (bf->GetGraveYardById(workshopId)) - bf->GetGraveYardById(workshopId)->ChangeControl(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); + if (bf->GetGraveyardById(workshopId)) + bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); teamControl = team; break; @@ -1650,12 +1621,12 @@ struct WGWorkshop bf->UpdateCounterVehicle(false); } - void UpdateGraveYardAndWorkshop() + void UpdateGraveyardAndWorkshop() { if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - bf->GetGraveYardById(workshopId)->ChangeControl(TeamId(teamControl)); + bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl)); else - ChangeControl(bf->GetDefenderTeam(), true); + GiveControlTo(bf->GetDefenderTeam(), true); } void Save() @@ -1665,9 +1636,9 @@ struct WGWorkshop }; // Structure for the 6 workshop -struct BfWGWorkShopData +struct WintergraspWorkshopData { - BattlefieldWG* m_WG; // Object du joug + BattlefieldWG* m_WG; // Pointer to wintergrasp GameObject* m_Build; uint32 m_Type; uint32 m_State; // For worldstate @@ -1677,7 +1648,7 @@ struct BfWGWorkShopData GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message - BfWGWorkShopData(BattlefieldWG * WG) + WintergraspWorkshopData(BattlefieldWG * WG) { m_WG = WG; m_Build = NULL; @@ -1689,22 +1660,21 @@ struct BfWGWorkShopData } // Spawning associate creature and store them - void AddCreature(BfWGObjectPosition obj) + void AddCreature(WintergraspObjectPositionData obj) { - if (Creature *creature = m_WG->SpawnCreature(obj.entryh, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE)) + if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE)) m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID()); - if (Creature *creature = m_WG->SpawnCreature(obj.entrya, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE)) + if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE)) m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID()); - } // Spawning Associate gameobject and store them - void AddGameObject(BfWGObjectPosition obj) + void AddGameObject(WintergraspObjectPositionData obj) { - if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryh, obj.x, obj.y, obj.z, obj.o)) + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o)) m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject); - if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entrya, obj.x, obj.y, obj.z, obj.o)) + if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o)) m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject); } @@ -1717,105 +1687,105 @@ struct BfWGWorkShopData } // Called on change faction in CapturePoint class - void ChangeControl(uint8 team, bool init /* for first call in setup */ ) + void GiveControlTo(uint8 team, bool init /* for first call in setup*/) { switch (team) { case BATTLEFIELD_WG_TEAM_NEUTRAL: - { - // Send warning message to all player for inform a faction attack a workshop - // alliance / horde attacking workshop - m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); - break; - } + { + // Send warning message to all player for inform a faction attack a workshop + // alliance / horde attacking workshop + m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); + break; + } case BATTLEFIELD_WG_TEAM_ALLIANCE: - { - // Show Alliance creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->ShowNpc(creature, creature->GetEntry() != 30499); + { + // Show Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30499); - // Hide Horde creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->HideNpc(creature); + // Hide Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->HideNpc(creature); - // Show Alliance gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + // Show Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); - // Hide Horde gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + // Hide Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); - // Updating worldstate - m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT; - m_WG->SendUpdateWorldState(m_WorldState, m_State); + // Updating worldstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); - // Warning message - if (!init) // workshop taken - alliance - m_WG->SendWarningToAllInZone(m_NameId); + // Warning message + if (!init) // workshop taken - alliance + m_WG->SendWarningToAllInZone(m_NameId); - // Found associate graveyard and update it - if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - if (m_WG && m_WG->GetGraveYardById(m_Type)) - m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_ALLIANCE); + // Found associate graveyard and update it + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveyardById(m_Type)) + m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE); - m_TeamControl = team; - break; - } + m_TeamControl = team; + break; + } case BATTLEFIELD_WG_TEAM_HORDE: - { - // Show Horde creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->ShowNpc(creature, creature->GetEntry() != 30400); + { + // Show Horde creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->ShowNpc(creature, creature->GetEntry() != 30400); - // Hide Alliance creature - for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - m_WG->HideNpc(creature); + // Hide Alliance creature + for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr) + if (Unit* unit = sObjectAccessor->FindUnit(*itr)) + if (Creature* creature = unit->ToCreature()) + m_WG->HideNpc(creature); - // Hide Alliance gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); + // Hide Alliance gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); - // Show Horde gameobject - for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) - (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); + // Show Horde gameobject + for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr) + (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); - // Update worlstate - m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; - m_WG->SendUpdateWorldState(m_WorldState, m_State); + // Update worlstate + m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT; + m_WG->SendUpdateWorldState(m_WorldState, m_State); - // Warning message - if (!init) // workshop taken - horde - m_WG->SendWarningToAllInZone(m_NameId + 1); + // Warning message + if (!init) // workshop taken - horde + m_WG->SendWarningToAllInZone(m_NameId + 1); - // Update graveyard control - if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - if (m_WG && m_WG->GetGraveYardById(m_Type)) - m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_HORDE); + // Update graveyard control + if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) + if (m_WG && m_WG->GetGraveyardById(m_Type)) + m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE); - m_TeamControl = team; - break; - } + m_TeamControl = team; + break; + } } if (!init) m_WG->UpdateCounterVehicle(false); } - void UpdateGraveYardAndWorkshop() + void UpdateGraveyardAndWorkshop() { if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) - m_WG->GetGraveYardById(m_Type)->ChangeControl(TeamId(m_TeamControl)); + m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl)); else - ChangeControl(m_WG->GetDefenderTeam(), true); + GiveControlTo(m_WG->GetDefenderTeam(), true); } void Save() diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 044bf7fb32..da0d37cf27 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -821,11 +821,6 @@ class ObjectMgr return &_creatureQuestRelations; } - QuestRelations* GetCreatureQuestInvolvedRelation() - { - return &_creatureQuestInvolvedRelations; - } - QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry) { return _creatureQuestRelations.equal_range(creature_entry); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 8bddd63170..98a8f3e564 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -800,7 +800,7 @@ class WorldSession // Battlefield void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time); void SendBfInvitePlayerToQueue(uint32 BattleId); - void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); + void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false); void SendBfEntered(uint32 BattleId); void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED); void HandleBfQueueInviteResponse(WorldPacket &recv_data); diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp index 4eee7c391b..7284e6ad6b 100644 --- a/src/server/scripts/Commands/cs_bf.cpp +++ b/src/server/scripts/Commands/cs_bf.cpp @@ -108,15 +108,15 @@ public: if (!bf) return false; - if (bf->GetEnable()) + if (bf->IsEnabled()) { - bf->SetEnable(false); + bf->ToggleBattlefield(false); if (battleid == 1) handler->SendGlobalGMSysMessage("Wintergrasp is disabled"); } else { - bf->SetEnable(true); + bf->ToggleBattlefield(true); if (battleid == 1) handler->SendGlobalGMSysMessage("Wintergrasp is enabled"); } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index c7c6cc3725..787531b496 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -38,372 +38,414 @@ enum eWGqueuenpctext WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, }; -enum WGscriptdata +enum Spells { - // engineer spells - SPELL_BUILD_CATAPULT = 56663, - SPELL_BUILD_DEMOLISHER = 56575, - SPELL_BUILD_SIEGE_ENGINE = 61408, - SPELL_BUILD_SIEGE_ENGINE2 = 56661, // does it's really needed here? - SPELL_ACTIVATE_ROBOTIC_ARMS = 49899, + // Demolisher engineers spells + SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 = 61409, // + SPELL_BUILD_SIEGE_VEHICLE_FORCE_2 = 56662, // Which faction uses which ? + SPELL_BUILD_CATAPULT_FORCE = 56664, + SPELL_BUILD_DEMOLISHER_FORCE = 56659, + SPELL_ACTIVATE_CONTROL_ARMS = 49899, - // teleporter spells - SPELL_VEHICLE_TELEPORT = 49759, + SPELL_VEHICLE_TELEPORT = 49759, - // npcs - NPC_ROBOTIC_ARMS = 27852, - NPC_WORLD_TRIGGER_WG = 23472, + // Spirit guide + SPELL_CHANNEL_SPIRIT_HEAL = 22011, +}; + +enum CreatureIds +{ + NPC_GOBLIN_MECHANIC = 30400, + NPC_GNOMISH_ENGINEER = 30499, + + NPC_WINTERGRASP_CONTROL_ARMS = 27852, + + NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23742, +}; + +enum QuestIds +{ + QUEST_BONES_AND_ARROWS_HORDE_ATT = 13193, + QUEST_JINXING_THE_WALLS_HORDE_ATT = 13202, + QUEST_SLAY_THEM_ALL_HORDE_ATT = 13180, + QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT = 13200, + QUEST_HEALING_WITH_ROSES_HORDE_ATT = 13201, + QUEST_DEFEND_THE_SIEGE_HORDE_ATT = 13223, + + QUEST_BONES_AND_ARROWS_HORDE_DEF = 13199, + QUEST_WARDING_THE_WALLS_HORDE_DEF = 13192, + QUEST_SLAY_THEM_ALL_HORDE_DEF = 13178, + QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF = 13191, + QUEST_HEALING_WITH_ROSES_HORDE_DEF = 13194, + QUEST_TOPPLING_THE_TOWERS_HORDE_DEF = 13539, + QUEST_STOP_THE_SIEGE_HORDE_DEF = 13185, + + QUEST_BONES_AND_ARROWS_ALLIANCE_ATT = 13196, + QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT = 13198, + QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT = 13179, + QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT = 13222, + QUEST_A_RARE_HERB_ALLIANCE_ATT = 13195, + + QUEST_BONES_AND_ARROWS_ALLIANCE_DEF = 13154, + QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF = 13153, + QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF = 13177, + QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF = 13538, + QUEST_STOP_THE_SIEGE_ALLIANCE_DEF = 13186, + QUEST_A_RARE_HERB_ALLIANCE_DEF = 13156, +}; + +uint8 const MAX_WINTERGRASP_VEHICLES = 4; + +uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = { + NPC_WINTERGRASP_CATAPULT, + NPC_WINTERGRASP_DEMOLISHER, + NPC_WINTERGRASP_SIEGE_ENGINE_1, + NPC_WINTERGRASP_SIEGE_ENGINE_2 }; class npc_wg_demolisher_engineer : public CreatureScript { - public: - npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") - { - } + public: + npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - - if (!BfWG) - return true; - - if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) + bool OnGossipHello(Player* player, Creature* creature) { - if (player->HasAura(SPELL_CORPORAL)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - else if (player->HasAura(SPELL_LIEUTENANT)) + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1); + + if (canBuild(creature)) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + if (player->HasAura(SPELL_CORPORAL)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + else if (player->HasAura(SPELL_LIEUTENANT)) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + } + } + else + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) + { + player->CLOSE_GOSSIP_MENU(); + + Battlefield* wintergrasp= sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + + if (canBuild(creature)) + { + switch (action - GOSSIP_ACTION_INFO_DEF) + { + case 0: + creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true); + break; + case 1: + creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true); + break; + case 2: + creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 : SPELL_BUILD_SIEGE_VEHICLE_FORCE_2, true); + break; + } + if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true)) + creature->CastSpell(controlArms, SPELL_ACTIVATE_CONTROL_ARMS, true); + } + return true; + } + + private: + bool canBuild(Creature* creature) + { + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + + if (!wintergrasp) + return false; + switch (creature->GetEntry()) + { + case NPC_GOBLIN_MECHANIC: + return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + case NPC_GNOMISH_ENGINEER: + return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + default: + return false; } } - else - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) - { - player->CLOSE_GOSSIP_MENU(); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - - if (!BfWG) - return true; - - if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > - BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A)) - { - switch (action - GOSSIP_ACTION_INFO_DEF) - { - case 0: - player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, creature->GetGUID()); - break; - case 1: - player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, creature->GetGUID()); - break; - case 2: - player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, creature->GetGUID()); - break; - } - //spell 49899 Emote : 406 from sniff - //INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0'); - if (Creature* mechCreature = creature->FindNearestCreature(NPC_ROBOTIC_ARMS, 30.0f, true)) - creature->CastSpell(mechCreature, SPELL_ACTIVATE_ROBOTIC_ARMS, true); - } - return true; - } }; class npc_wg_spirit_guide : public CreatureScript { - public: - npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") - { - } + public: + npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipHello(Player* player, Creature* creature) { - GraveYardVect gy = BfWG->GetGraveYardVect(); - for (uint8 i = 0; i < gy.size(); i++) - { - if (gy[i]->GetControlTeamId() == player->GetTeamId()) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN, - GOSSIP_ACTION_INFO_DEF + i); - } - } + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; + + GraveyardVect graveyard = wintergrasp->GetGraveyardVector(); + for (uint8 i = 0; i < graveyard.size(); i++) + if (graveyard[i]->GetControlTeamId() == player->GetTeamId()) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i); + + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + return true; } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) - { - player->CLOSE_GOSSIP_MENU(); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action) { - GraveYardVect gy = BfWG->GetGraveYardVect(); - for (uint8 i = 0; i < gy.size(); i++) + player->CLOSE_GOSSIP_MENU(); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (wintergrasp) { - if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) - { - WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId()); - player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0); - } + GraveyardVect gy = wintergrasp->GetGraveyardVector(); + for (uint8 i = 0; i < gy.size(); i++) + if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId()) + if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId())) + player->TeleportTo(safeLoc->map_id, safeLoc->x, safeLoc->y, safeLoc->z, 0); } + return true; + } + + struct npc_wg_spirit_guideAI : public ScriptedAI + { + npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) + { } + + void UpdateAI(const uint32 /* diff */) + { + if (!me->HasUnitState(UNIT_STATE_CASTING)) + DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL); + } + }; + + CreatureAI *GetAI(Creature* creature) const + { + return new npc_wg_spirit_guideAI(creature); } - return true; - } }; class npc_wg_queue : public CreatureScript { - public: - npc_wg_queue() : CreatureScript("npc_wg_queue") - { - } + public: + npc_wg_queue() : CreatureScript("npc_wg_queue") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipHello(Player* player, Creature* creature) { + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - if (BfWG->IsWarTime()) + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; + + if (wintergrasp->IsWarTime()) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else { - uint32 uiTime = BfWG->GetTimer() / 1000; - player->SendUpdateWorldState(4354, time(NULL) + uiTime); - if (uiTime < 15 * MINUTE) + uint32 timer = wintergrasp->GetTimer() / 1000; + player->SendUpdateWorldState(4354, time(NULL) + timer); + if (timer < 15 * MINUTE) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); } else - { - player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID()); - } + player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID()); } + return true; } - return true; - } - bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action */ ) - { - player->CLOSE_GOSSIP_MENU(); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action*/) { - if (BfWG->IsWarTime()) - { - BfWG->InvitePlayerToWar(player); - } + player->CLOSE_GOSSIP_MENU(); + + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; + + if (wintergrasp->IsWarTime()) + wintergrasp->InvitePlayerToWar(player); else { - uint32 uiTime = BfWG->GetTimer() / 1000; - if (uiTime < 15 * MINUTE) - BfWG->InvitePlayerToQueue(player); + uint32 timer = wintergrasp->GetTimer() / 1000; + if (timer < 15 * MINUTE) + wintergrasp->InvitePlayerToQueue(player); } + return true; } - return true; - } }; -const uint32 Vehicules[4] = { 32627, 28312, 28094, 27881 }; - class go_wg_vehicle_teleporter : public GameObjectScript { - public: - go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") - { - } + public: + go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") { } - struct go_wg_vehicle_teleporterAI : public GameObjectAI - { - go_wg_vehicle_teleporterAI(GameObject* g) : GameObjectAI(g) + struct go_wg_vehicle_teleporterAI : public GameObjectAI { - uiCheckTimer = 1000; - } + go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), + _checkTimer(1000) + { } - void UpdateAI(const uint32 diff) - { - if (uiCheckTimer <= diff) + void UpdateAI(const uint32 diff) { - for (uint8 i = 0; i < 4; i++) - if (Creature* vehicleCreature = go->FindNearestCreature(Vehicules[i], 3.0f, true)) - if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) - if (Vehicle* vehicle = vehicleCreature->GetVehicle()) - if (Unit* passenger = vehicle->GetPassenger(0)) - { - uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION); - uint32 plfaction = passenger->getFaction(); - if (gofaction == plfaction) - { - if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) - teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); - } - } + if (_checkTimer <= diff) + { + // Tabulation madness in the hole! + for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++) + if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true)) + if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) + if (Vehicle* vehicle = vehicleCreature->GetVehicle()) + if (Unit* passenger = vehicle->GetPassenger(0)) + if (go->GetUInt32Value(GAMEOBJECT_FACTION) == passenger->getFaction()) + if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true)) + teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); - uiCheckTimer = 1000; + _checkTimer = 1000; + } + else _checkTimer -= diff; } - else - uiCheckTimer -= diff; - } - private: - uint32 uiCheckTimer; - }; + private: + uint32 _checkTimer; + }; - GameObjectAI *GetAI(GameObject* go) const - { - return new go_wg_vehicle_teleporterAI(go); - } + GameObjectAI* GetAI(GameObject* go) const + { + return new go_wg_vehicle_teleporterAI(go); + } }; class npc_wg_quest_giver : public CreatureScript { - public: - npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") - { - } + public: + npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (BfWG) + bool OnGossipHello(Player* player, Creature* creature) { if (creature->isQuestGiver()) - { - Object* object = (Object *) creature; - QuestRelations* objectQR = sObjectMgr->GetCreatureQuestRelationMap(); - QuestRelations* objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation(); + player->PrepareQuestMenu(creature->GetGUID()); - QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu(); + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return true; + + if (creature->isQuestGiver()) + { + QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); + + QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); - for (QuestRelations::const_iterator i = objectQIR->lower_bound(object->GetEntry()); i != objectQIR->upper_bound(object->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i) { uint32 quest_id = i->second; QuestStatus status = player->GetQuestStatus(quest_id); - if (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) + if (status == QUEST_STATUS_COMPLETE) qm.AddMenuItem(quest_id, 4); else if (status == QUEST_STATUS_INCOMPLETE) qm.AddMenuItem(quest_id, 4); + //else if (status == QUEST_STATUS_AVAILABLE) + // qm.AddMenuItem(quest_id, 2); } - for (QuestRelations::const_iterator i = objectQR->lower_bound(object->GetEntry()); i != objectQR->upper_bound(object->GetEntry()); ++i) + for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) { - uint32 quest_id = i->second; - Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + uint32 questId = i->second; + Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) continue; - switch (quest_id) + switch (questId) { // Horde attacker - case 13193: - case 13202: - case 13180: - case 13200: - case 13201: - case 13223: - if (BfWG->GetAttackerTeam() == TEAM_HORDE) + case QUEST_BONES_AND_ARROWS_HORDE_ATT: + case QUEST_JINXING_THE_WALLS_HORDE_ATT: + case QUEST_SLAY_THEM_ALL_HORDE_ATT: + case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT: + case QUEST_HEALING_WITH_ROSES_HORDE_ATT: + case QUEST_DEFEND_THE_SIEGE_HORDE_ATT: + if (wintergrasp->GetAttackerTeam() == TEAM_HORDE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; // Horde defender - case 13199: - case 13192: - case 13178: - case 13191: - case 13194: - case 13539: - case 13185: - if (BfWG->GetDefenderTeam() == TEAM_HORDE) + case QUEST_BONES_AND_ARROWS_HORDE_DEF: + case QUEST_WARDING_THE_WALLS_HORDE_DEF: + case QUEST_SLAY_THEM_ALL_HORDE_DEF: + case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF: + case QUEST_HEALING_WITH_ROSES_HORDE_DEF: + case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF: + case QUEST_STOP_THE_SIEGE_HORDE_DEF: + if (wintergrasp->GetDefenderTeam() == TEAM_HORDE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; // Alliance attacker - case 13196: - case 13198: - case 13179: - case 13222: - case 13195: - if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE) + case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT: + case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT: + case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT: + case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT: + case QUEST_A_RARE_HERB_ALLIANCE_ATT: + if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; // Alliance defender - case 13154: - case 13153: - case 13177: - case 13538: - case 13186: - case 13156: - if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE) + case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF: + case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF: + case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF: + case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF: + case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF: + case QUEST_A_RARE_HERB_ALLIANCE_DEF: + if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE) { - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); } break; default: - QuestStatus status = player->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(questId); if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 4); + qm.AddMenuItem(questId, 4); else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false)) - qm.AddMenuItem(quest_id, 2); + qm.AddMenuItem(questId, 2); break; } } @@ -411,8 +453,43 @@ class npc_wg_quest_giver : public CreatureScript player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - return true; - } +}; + +class spell_wintergrasp_force_building : public SpellScriptLoader +{ + public: + spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { } + + class spell_wintergrasp_force_building_SpellScript : public SpellScript + { + PrepareSpellScript(spell_wintergrasp_force_building_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_1) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_2)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_wintergrasp_force_building_SpellScript(); + } }; class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript @@ -444,7 +521,9 @@ void AddSC_wintergrasp() new npc_wg_queue(); new npc_wg_spirit_guide(); new npc_wg_demolisher_engineer(); - new go_wg_vehicle_teleporter(); new npc_wg_quest_giver(); new achievement_wg_didnt_stand_a_chance(); + new spell_wintergrasp_force_building(); + + new go_wg_vehicle_teleporter(); } From 34b93b455a540216f655fac2201de3dc0b865bb1 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 21 Mar 2012 14:08:08 -0400 Subject: [PATCH 124/147] Core/Battlefield: added spellscript names for force building. (thx warpte) --- Wintergrasp_temp/Scriptnames.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql index f9a121b3e7..ecf817e10d 100644 --- a/Wintergrasp_temp/Scriptnames.sql +++ b/Wintergrasp_temp/Scriptnames.sql @@ -12,3 +12,11 @@ UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` -- Wintergrasp vehicle teleport GO script UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter + +DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(61409, 'spell_wintergrasp_force_building'), +(56659, 'spell_wintergrasp_force_building'), +(56662, 'spell_wintergrasp_force_building'), +(56664, 'spell_wintergrasp_force_building'), +(49899, 'spell_wintergrasp_force_building'); From 17e2c3a800bbb284680fd275cbafd96b03b9da23 Mon Sep 17 00:00:00 2001 From: Kandera Date: Fri, 23 Mar 2012 07:52:18 -0400 Subject: [PATCH 125/147] Core/Battlefield: cleanup a magic number --- src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 787531b496..ff21f34d1e 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -113,7 +113,7 @@ class npc_wg_demolisher_engineer : public CreatureScript if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1); + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (canBuild(creature)) { From 9dd3789719352cc45521a57325e51676f84f5b43 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 26 Mar 2012 10:46:31 -0400 Subject: [PATCH 126/147] Core/Battlefield: correct wintergrasp faction for horde (thx kirkita), added grab passenger spell as per sniffs. --- Wintergrasp_temp/Scriptnames.sql | 3 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 2 ++ .../game/Battlefield/Zones/BattlefieldWG.h | 3 +- src/server/scripts/Northrend/wintergrasp.cpp | 30 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql index ecf817e10d..38e9a60e5b 100644 --- a/Wintergrasp_temp/Scriptnames.sql +++ b/Wintergrasp_temp/Scriptnames.sql @@ -13,10 +13,11 @@ UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` -- Wintergrasp vehicle teleport GO script UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter -DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899); +DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178); INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (61409, 'spell_wintergrasp_force_building'), (56659, 'spell_wintergrasp_force_building'), (56662, 'spell_wintergrasp_force_building'), (56664, 'spell_wintergrasp_force_building'), (49899, 'spell_wintergrasp_force_building'); +(61178, 'spell_wintergrasp_grab_passenger'); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index decc22105a..caac130ecc 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -563,6 +563,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) return; } } + if (creature->GetOwner()) + creature->CastSpell(creature->GetOwner(),SPELL_GRAB_PASSENGER,true); break; } } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index b2356e61d6..c711010baf 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -29,7 +29,7 @@ const uint32 VehNumWorldState[2] = { 3680, 3490 }; const uint32 MaxVehNumWorldState[2] = { 3681, 3491 }; const uint32 ClockWorldState[2] = { 3781, 4354 }; -const uint32 WintergraspFaction[3] = { 1, 116, 35 }; +const uint32 WintergraspFaction[3] = { 1, 2, 35 }; const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; class BattlefieldWG; @@ -59,6 +59,7 @@ enum WintergraspSpells SPELL_GREATEST_HONOR = 58557, SPELL_ALLIANCE_FLAG = 14268, SPELL_HORDE_FLAG = 14267, + SPELL_GRAB_PASSENGER = 61178, // Reward spells SPELL_VICTORY_REWARD = 56902, diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index ff21f34d1e..d765e3363a 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -492,6 +492,33 @@ class spell_wintergrasp_force_building : public SpellScriptLoader } }; +class spell_wintergrasp_grab_passenger : public SpellScriptLoader +{ + public: + spell_wintergrasp_grab_passenger() : SpellScriptLoader("spell_wintergrasp_grab_passenger") { } + + class spell_wintergrasp_grab_passenger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + if (Player* target = GetHitPlayer()) + GetCaster()->GetVehicleKit()->AddPassenger(target); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_grab_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_wintergrasp_grab_passenger_SpellScript(); + } +}; + class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript { public: @@ -516,6 +543,8 @@ public: } }; + + void AddSC_wintergrasp() { new npc_wg_queue(); @@ -524,6 +553,7 @@ void AddSC_wintergrasp() new npc_wg_quest_giver(); new achievement_wg_didnt_stand_a_chance(); new spell_wintergrasp_force_building(); + new spell_wintergrasp_grab_passenger(); new go_wg_vehicle_teleporter(); } From aa0ff294d2eeb910ef8e5b337a5b447e6d5a801a Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 26 Mar 2012 11:52:39 -0400 Subject: [PATCH 127/147] Core/Battlefield: Correct previous commit --- src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 2 +- src/server/scripts/Northrend/wintergrasp.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index caac130ecc..ce21559082 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -564,7 +564,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } } if (creature->GetOwner()) - creature->CastSpell(creature->GetOwner(),SPELL_GRAB_PASSENGER,true); + creature->CastSpell(creature->GetOwner(), SPELL_GRAB_PASSENGER, true); break; } } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d765e3363a..b4aa92b893 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -501,10 +501,10 @@ class spell_wintergrasp_grab_passenger : public SpellScriptLoader { PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript); - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { if (Player* target = GetHitPlayer()) - GetCaster()->GetVehicleKit()->AddPassenger(target); + target->EnterVehicle(GetCaster()); } void Register() From 73aee4409efbd56717ce65811c74ff2d77851f92 Mon Sep 17 00:00:00 2001 From: kandera Date: Tue, 27 Mar 2012 09:28:02 -0300 Subject: [PATCH 128/147] DB/Spells: fix typo in sql. (thx retriman) --- Wintergrasp_temp/Scriptnames.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql index 38e9a60e5b..10a5e6f815 100644 --- a/Wintergrasp_temp/Scriptnames.sql +++ b/Wintergrasp_temp/Scriptnames.sql @@ -19,5 +19,5 @@ INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (56659, 'spell_wintergrasp_force_building'), (56662, 'spell_wintergrasp_force_building'), (56664, 'spell_wintergrasp_force_building'), -(49899, 'spell_wintergrasp_force_building'); +(49899, 'spell_wintergrasp_force_building'), (61178, 'spell_wintergrasp_grab_passenger'); From 81ba249c790362e76e32a692bde794c2ff7bfb02 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 28 Mar 2012 08:49:01 -0400 Subject: [PATCH 129/147] Core/Battlefield: correct siege vehicle faction types. attempt to fix vehicle creation cast time. --- src/server/scripts/Northrend/wintergrasp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index b4aa92b893..d4cc8519da 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -41,8 +41,8 @@ enum eWGqueuenpctext enum Spells { // Demolisher engineers spells - SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 = 61409, // - SPELL_BUILD_SIEGE_VEHICLE_FORCE_2 = 56662, // Which faction uses which ? + SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE = 61409, + SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE = 56662, SPELL_BUILD_CATAPULT_FORCE = 56664, SPELL_BUILD_DEMOLISHER_FORCE = 56659, SPELL_ACTIVATE_CONTROL_ARMS = 49899, @@ -150,7 +150,7 @@ class npc_wg_demolisher_engineer : public CreatureScript creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true); break; case 2: - creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 : SPELL_BUILD_SIEGE_VEHICLE_FORCE_2, true); + creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE : SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE, true); break; } if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true)) @@ -477,7 +477,7 @@ class spell_wintergrasp_force_building : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), true); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false); } void Register() From 483f0a6a4e4bf30a567987e81ab17ec8201f29bc Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 28 Mar 2012 11:32:57 -0400 Subject: [PATCH 130/147] Core/Battlefield: attempt to fix vehicle counter when vehicle is killed. finish correcting alliance/horde siege engine --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 54 +++++++++++++------ .../game/Battlefield/Zones/BattlefieldWG.h | 7 ++- src/server/scripts/Northrend/wintergrasp.cpp | 8 +-- 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index ce21559082..6dbedf1ace 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -518,8 +518,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) { switch (creature->GetEntry()) { - case NPC_WINTERGRASP_SIEGE_ENGINE_1: - case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE: + case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE: case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { @@ -573,12 +573,13 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) void BattlefieldWG::OnCreatureRemove(Creature* creature) { +/* possibly can be used later if (IsWarTime()) { switch (creature->GetEntry()) { - case NPC_WINTERGRASP_SIEGE_ENGINE_1: - case NPC_WINTERGRASP_SIEGE_ENGINE_2: + case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE: + case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE: case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { @@ -600,7 +601,7 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature) break; } } - } + }*/ } void BattlefieldWG::OnGameObjectCreate(GameObject* go) @@ -656,23 +657,19 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) return; bool again = false; + TeamId killerTeam = killer->GetTeamId(); + if (victim->GetTypeId() == TYPEID_PLAYER) { - for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); return; - } + } - for (GuidSet::const_iterator itr = m_vehicles[GetOtherTeam(killer->GetTeamId())].begin(); itr != m_vehicles[GetOtherTeam(killer->GetTeamId())].end(); ++itr) - if (Unit* unit = sObjectAccessor->FindUnit(*itr)) - if (Creature* creature = unit->ToCreature()) - if (victim->GetEntry() == creature->GetEntry() && !again) - again = true; - - for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killer->GetTeamId())].begin(); - itr != KeepCreature[GetOtherTeam(killer->GetTeamId())].end(); ++itr) + for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin(); + itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit(*itr)) { @@ -681,7 +678,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (victim->GetEntry() == creature->GetEntry() && !again) { again = true; - for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter) + for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter) if (Player* player = sObjectAccessor->FindPlayer(*iter)) if (player->GetDistance2d(killer) < 40.0f) PromotePlayer(player); @@ -692,6 +689,31 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) // TODO:Recent PvP activity worldstate } +bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle) +{ + for (uint32 itr = 0; itr < 2; ++itr) + { + if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end()) + { + m_vehicles[itr].erase(vehicle->GetGUID()); + if (itr == WintergraspFaction[TEAM_HORDE]) + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1); + else + UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1); + return true; + } + } + return false; +} + +void BattlefieldWG::OnUnitDeath(Unit* unit) +{ + if (IsWarTime()) + if (unit->IsVehicle()) + if (FindAndRemoveVehicleFromList(unit)) + UpdateVehicleCountWG(); +} + // Update rank for player void BattlefieldWG::PromotePlayer(Player* killer) { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index c711010baf..f62d2d962f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -212,8 +212,8 @@ enum WintergraspNpcs NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp NPC_TOWER_CANNON = 28366, - NPC_WINTERGRASP_SIEGE_ENGINE_1 = 28312, - NPC_WINTERGRASP_SIEGE_ENGINE_2 = 32627, + NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312, + NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627, NPC_WINTERGRASP_CATAPULT = 27881, NPC_WINTERGRASP_DEMOLISHER = 28094, NPC_WINTERGRASP_TOWER_CANNON = 28366, @@ -400,11 +400,14 @@ class BattlefieldWG : public Battlefield void SendInitWorldStatesToAll(); void HandleKill(Player* killer, Unit* victim); + void OnUnitDeath(Unit* unit); void PromotePlayer(Player* killer); void UpdateTenacity(); void ProcessEvent(WorldObject *obj, uint32 eventId); + bool FindAndRemoveVehicleFromList(Unit* vehicle); + // returns the graveyardId in the specified area. uint8 GetSpiritGraveyardId(uint32 areaId); diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index d4cc8519da..db10e00f13 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -99,8 +99,8 @@ uint8 const MAX_WINTERGRASP_VEHICLES = 4; uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = { NPC_WINTERGRASP_CATAPULT, NPC_WINTERGRASP_DEMOLISHER, - NPC_WINTERGRASP_SIEGE_ENGINE_1, - NPC_WINTERGRASP_SIEGE_ENGINE_2 + NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE, + NPC_WINTERGRASP_SIEGE_ENGINE_HORDE }; class npc_wg_demolisher_engineer : public CreatureScript @@ -468,8 +468,8 @@ class spell_wintergrasp_force_building : public SpellScriptLoader { if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE) || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE) - || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_1) - || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_2)) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE) + || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE)) return false; return true; } From 2d45e260120445eaef310beed6cdd640919643cb Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 28 Mar 2012 17:24:45 -0400 Subject: [PATCH 131/147] Core/Battlefield: codystyle/whitespace cleanup. fix a stupid typo. attempt to get team using the vehicle creator instead of the vehicle --- .../game/Battlefield/Zones/BattlefieldWG.cpp | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 6dbedf1ace..b98e3b52e8 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -85,7 +85,7 @@ bool BattlefieldWG::SetupBattlefield() m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE)); m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); - + m_Timer = sWorld->getWorldState(ClockWorldState[0]); if (m_isActive) { @@ -142,18 +142,18 @@ bool BattlefieldWG::SetupBattlefield() for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); - + // Spawn Alliance NPCs outside the keep for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); - + // Hide units outside the keep that are defenders for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) if (Unit* unit = sObjectAccessor->FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); - + // Spawn turrets and hide them per default for (uint8 i = 0; i < WG_MAX_TURRET; i++) { @@ -523,17 +523,14 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { - uint8 team; - if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) - team = TEAM_ALLIANCE; - else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE]) - team = TEAM_HORDE; - else + if (!creature->GetCreatorGUID() || !sObjectAccessor->FindPlayer(creature->GetCreatorGUID())) return; + Player* creator = sObjectAccessor->FindPlayer(creature->GetCreatorGUID()); + TeamId team = creator->GetTeamId(); if (team == TEAM_HORDE) { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); creature->CastSpell(creature, SPELL_HORDE_FLAG, true); @@ -543,28 +540,29 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) else { creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); + creature->RemoveFromWorld(); return; } } else { - if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) + if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); - creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } else { creature->setDeathState(DEAD); - creature->SetRespawnTime(RESPAWN_ONE_DAY); + creature->RemoveFromWorld(); return; } } - if (creature->GetOwner()) - creature->CastSpell(creature->GetOwner(), SPELL_GRAB_PASSENGER, true); + + if (creature->GetCreatorGUID() && sObjectAccessor->FindUnit(creature->GetCreatorGUID())) + creature->CastSpell(sObjectAccessor->FindUnit(creature->GetCreatorGUID()), SPELL_GRAB_PASSENGER, true); break; } } @@ -666,7 +664,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); return; - } + } for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin(); itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr) @@ -698,7 +696,7 @@ bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle) m_vehicles[itr].erase(vehicle->GetGUID()); if (itr == WintergraspFaction[TEAM_HORDE]) UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1); - else + else UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1); return true; } @@ -810,7 +808,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player) { if (!m_isActive) RemoveAurasFromPlayer(player); - + player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT); player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT); From d6de7dec342d8e6f1dd316b18341e61705a55053 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 3 Apr 2012 13:49:51 -0400 Subject: [PATCH 132/147] Core/Battlefield: few more updates to wintergrasp vehicle stuff. --- Wintergrasp_temp/Template_update.sql | 18 +++++++++--------- .../game/Battlefield/Zones/BattlefieldWG.cpp | 13 +++++++++---- src/server/scripts/Northrend/wintergrasp.cpp | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index 84df0017b0..6bae79da4b 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -20,13 +20,13 @@ UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4 WHERE `entry`=311 UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher -UPDATE `creature_template` SET `faction_A`=35,`faction_H`=35,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder @@ -61,8 +61,8 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (32296,27245,0,1,0, NULL), -- Stone Guard Mukar (39173,29261,0,1,0, NULL), -- Champion Ros'slai (30740,0,0,257,375, NULL), -- Valiance Expedition Champion -(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret -(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(32629,0,0,257,0,46598), -- Wintergrasp Siege Turret +(28319,0,0,257,0,46598), -- Wintergrasp Siege Turret (28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon (32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine (28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index b98e3b52e8..8c68ee3f17 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -524,7 +524,11 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) case NPC_WINTERGRASP_DEMOLISHER: { if (!creature->GetCreatorGUID() || !sObjectAccessor->FindPlayer(creature->GetCreatorGUID())) + { + creature->setDeathState(DEAD); + creature->RemoveFromWorld(); return; + } Player* creator = sObjectAccessor->FindPlayer(creature->GetCreatorGUID()); TeamId team = creator->GetTeamId(); @@ -533,7 +537,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); - creature->CastSpell(creature, SPELL_HORDE_FLAG, true); + creature->AddAura(SPELL_HORDE_FLAG, creature); + creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -549,7 +554,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); - creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true); + creature->AddAura(SPELL_ALLIANCE_FLAG,creature); + creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -561,8 +567,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } } - if (creature->GetCreatorGUID() && sObjectAccessor->FindUnit(creature->GetCreatorGUID())) - creature->CastSpell(sObjectAccessor->FindUnit(creature->GetCreatorGUID()), SPELL_GRAB_PASSENGER, true); + creature->CastSpell(creator, SPELL_GRAB_PASSENGER, true); break; } } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index db10e00f13..61646d0cc1 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -46,6 +46,7 @@ enum Spells SPELL_BUILD_CATAPULT_FORCE = 56664, SPELL_BUILD_DEMOLISHER_FORCE = 56659, SPELL_ACTIVATE_CONTROL_ARMS = 49899, + SPELL_RIDE_WG_VEHICLE = 60968, SPELL_VEHICLE_TELEPORT = 49759, @@ -504,7 +505,7 @@ class spell_wintergrasp_grab_passenger : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { if (Player* target = GetHitPlayer()) - target->EnterVehicle(GetCaster()); + target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, true); } void Register() From 6b535ff41dc95b9493513072f34eee918f88191a Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 3 Apr 2012 14:14:48 -0400 Subject: [PATCH 133/147] DB/WG: mistake in sql. --- Wintergrasp_temp/Template_update.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/Template_update.sql index 6bae79da4b..7f3cd21e1c 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/Template_update.sql @@ -61,8 +61,8 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (32296,27245,0,1,0, NULL), -- Stone Guard Mukar (39173,29261,0,1,0, NULL), -- Champion Ros'slai (30740,0,0,257,375, NULL), -- Valiance Expedition Champion -(32629,0,0,257,0,46598), -- Wintergrasp Siege Turret -(28319,0,0,257,0,46598), -- Wintergrasp Siege Turret +(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret +(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret (28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon (32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine (28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine From 87c50a4ec3b0b952cb8ebd185432f7c33ac05ff9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 9 Apr 2012 12:47:39 -0400 Subject: [PATCH 134/147] Core/Battlefield: specify correct npc for vehicle teleportations. --- src/server/scripts/Northrend/wintergrasp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 61646d0cc1..41bb5f3f54 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -56,12 +56,12 @@ enum Spells enum CreatureIds { - NPC_GOBLIN_MECHANIC = 30400, - NPC_GNOMISH_ENGINEER = 30499, + NPC_GOBLIN_MECHANIC = 30400, + NPC_GNOMISH_ENGINEER = 30499, - NPC_WINTERGRASP_CONTROL_ARMS = 27852, + NPC_WINTERGRASP_CONTROL_ARMS = 27852, - NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23742, + NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23472, }; enum QuestIds From 4a39e02a6f820e0737eb7eb68e62f7ce9a0ce711 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 10 Apr 2012 09:48:10 -0400 Subject: [PATCH 135/147] DB/Files: make files more understandable and grouped better. these will be the base sql files for wg. all db updates after will be in the usual format in this folder --- Wintergrasp_temp/SAI.sql | 9 --- Wintergrasp_temp/Scriptnames.sql | 23 ------- Wintergrasp_temp/{Spells.sql => Spells.txt} | 25 +------ Wintergrasp_temp/WG_Conditions.sql | 31 +++++++++ .../{Spawns.sql => WG_GameObject_info.sql} | 14 ++++ .../{Gossips.sql => WG_Gossips.sql} | 31 --------- .../{Quests.sql => WG_Quests.sql} | 0 ...mplate_update.sql => WG_creature_info.sql} | 69 ++++++++----------- .../{Misc.sql => WG_spell_misc.sql} | 25 ++++++- .../{Strings.sql => WG_texts.sql} | 0 10 files changed, 97 insertions(+), 130 deletions(-) delete mode 100644 Wintergrasp_temp/SAI.sql delete mode 100644 Wintergrasp_temp/Scriptnames.sql rename Wintergrasp_temp/{Spells.sql => Spells.txt} (67%) create mode 100644 Wintergrasp_temp/WG_Conditions.sql rename Wintergrasp_temp/{Spawns.sql => WG_GameObject_info.sql} (86%) rename Wintergrasp_temp/{Gossips.sql => WG_Gossips.sql} (63%) rename Wintergrasp_temp/{Quests.sql => WG_Quests.sql} (100%) rename Wintergrasp_temp/{Template_update.sql => WG_creature_info.sql} (51%) rename Wintergrasp_temp/{Misc.sql => WG_spell_misc.sql} (77%) rename Wintergrasp_temp/{Strings.sql => WG_texts.sql} (100%) diff --git a/Wintergrasp_temp/SAI.sql b/Wintergrasp_temp/SAI.sql deleted file mode 100644 index 71d1b8de81..0000000000 --- a/Wintergrasp_temp/SAI.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* -These two npcs already have a scriptname assigned (npc_wg_spiritguide). That core script should make these npcs cast the 22011 spell. --- Spirit healers SAI -UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (31841,31842); -DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (31841,31842); -INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES -(31841,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'cast Spirit Heal Channel every 30 sec'), -(31842,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Dwarven Spirit Guide - cast Spirit Heal Channel every 30 sec'); -*/ diff --git a/Wintergrasp_temp/Scriptnames.sql b/Wintergrasp_temp/Scriptnames.sql deleted file mode 100644 index 10a5e6f815..0000000000 --- a/Wintergrasp_temp/Scriptnames.sql +++ /dev/null @@ -1,23 +0,0 @@ --- Wintergrasp queue template NPCs script -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- - --- Wintergrasp spirit guide NPCs script -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry` IN (31841,31842); -- Taunka Spirit Guide, Dwarven Spirit Guide - --- Wintergrasp demolisher engineer NPCs script -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer - --- Wintergrasp Questgiver NPCs script -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31052,31091,31036,31101,31107,31053,31051,31153,31151,31102,31106); - --- Wintergrasp vehicle teleport GO script -UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter - -DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178); -INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES -(61409, 'spell_wintergrasp_force_building'), -(56659, 'spell_wintergrasp_force_building'), -(56662, 'spell_wintergrasp_force_building'), -(56664, 'spell_wintergrasp_force_building'), -(49899, 'spell_wintergrasp_force_building'), -(61178, 'spell_wintergrasp_grab_passenger'); diff --git a/Wintergrasp_temp/Spells.sql b/Wintergrasp_temp/Spells.txt similarity index 67% rename from Wintergrasp_temp/Spells.sql rename to Wintergrasp_temp/Spells.txt index 91719f47e4..583e46db04 100644 --- a/Wintergrasp_temp/Spells.sql +++ b/Wintergrasp_temp/Spells.txt @@ -1,24 +1,3 @@ -SET @SPELL_HORDE := 56618; -SET @SPELL_ALLIANCE := 56617; - -SET @AREA_SUNKEN_RING := 4538; -SET @AREA_BROKEN_TEMPLE := 4539; -SET @AREA_W_WORKSHOP := 4611; -SET @AREA_E_WORKSHOP := 4612; - -DELETE FROM `spell_area` WHERE `spell` IN (@SPELL_HORDE, @SPELL_ALLIANCE); -INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES -(@SPELL_HORDE, @AREA_SUNKEN_RING, 1), -(@SPELL_ALLIANCE, @AREA_SUNKEN_RING, 1), -(@SPELL_HORDE, @AREA_BROKEN_TEMPLE, 1), -(@SPELL_ALLIANCE, @AREA_BROKEN_TEMPLE, 1), -(@SPELL_HORDE, @AREA_W_WORKSHOP, 1), -(@SPELL_ALLIANCE, @AREA_W_WORKSHOP, 1), -(@SPELL_HORDE, @AREA_E_WORKSHOP, 1), -(@SPELL_ALLIANCE, @AREA_E_WORKSHOP, 1); - -/* - Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32 Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16 @@ -47,6 +26,4 @@ Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): 61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) 56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) 14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) -14267 (Horde Flag) - -*/ +14267 (Horde Flag) \ No newline at end of file diff --git a/Wintergrasp_temp/WG_Conditions.sql b/Wintergrasp_temp/WG_Conditions.sql new file mode 100644 index 0000000000..a6dd9826c4 --- /dev/null +++ b/Wintergrasp_temp/WG_Conditions.sql @@ -0,0 +1,31 @@ +-- Conditions +-- Add gossip_menu condition for 9904 Horde +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup` IN (9904,9923); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES +(14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal +(14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant +(14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal +(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant +-- Add gossip_menu condition for 9923 Alliance +(14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal +(14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant +(14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal +(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant +-- Add conditions to gossip options horde +(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant +-- Add conditions to gossip options alliance +(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal +(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant +(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant +(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant + +/* Spell target conditions for spawning WG siege machines in proper place while building it */ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56575,56661,56663,61408); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 56575, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 56661, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 56663, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), +(13, 1, 61408, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL); \ No newline at end of file diff --git a/Wintergrasp_temp/Spawns.sql b/Wintergrasp_temp/WG_GameObject_info.sql similarity index 86% rename from Wintergrasp_temp/Spawns.sql rename to Wintergrasp_temp/WG_GameObject_info.sql index 3464ed3ee0..5cfc7864ad 100644 --- a/Wintergrasp_temp/Spawns.sql +++ b/Wintergrasp_temp/WG_GameObject_info.sql @@ -1,3 +1,17 @@ +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, +192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner + +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, +192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, +192255,192336); -- Horde Banner + +UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, +193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, +193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, +193164,193165); -- nameless GOs + +UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter + -- Before pushing to master check if guids are free. -- Spawns Workshop Capture Points SET @GUID := 4594; diff --git a/Wintergrasp_temp/Gossips.sql b/Wintergrasp_temp/WG_Gossips.sql similarity index 63% rename from Wintergrasp_temp/Gossips.sql rename to Wintergrasp_temp/WG_Gossips.sql index 3f9ce230d5..8e49bbf915 100644 --- a/Wintergrasp_temp/Gossips.sql +++ b/Wintergrasp_temp/WG_Gossips.sql @@ -1,7 +1,3 @@ --- Template gossip updates -UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; -UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; - -- Gossip Menu DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; @@ -23,33 +19,6 @@ INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`op (10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), (10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); --- Conditions --- Add gossip_menu condition for 9904 Horde -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9904; -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=9923; -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9904; -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9923; -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES -(14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal -(14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant -(14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal -(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant --- Add gossip_menu condition for 9923 Alliance -(14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal -(14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant -(14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal -(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant --- Add conditions to gossip options horde -(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal -(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant -(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant -(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant --- Add conditions to gossip options alliance -(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal -(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant -(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant -(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant - /* -- Add scripts to Wintergrasp spirit guide gossip -- !!!should be scripted by SAI or cpp script!!! UPDATE `gossip_menu_option` SET `action_script_id`=1012800 WHERE `menu_id` IN (10128,10129) AND `id`=0; diff --git a/Wintergrasp_temp/Quests.sql b/Wintergrasp_temp/WG_Quests.sql similarity index 100% rename from Wintergrasp_temp/Quests.sql rename to Wintergrasp_temp/WG_Quests.sql diff --git a/Wintergrasp_temp/Template_update.sql b/Wintergrasp_temp/WG_creature_info.sql similarity index 51% rename from Wintergrasp_temp/Template_update.sql rename to Wintergrasp_temp/WG_creature_info.sql index 7f3cd21e1c..e245a0bdf9 100644 --- a/Wintergrasp_temp/Template_update.sql +++ b/Wintergrasp_temp/WG_creature_info.sql @@ -1,32 +1,25 @@ -UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, -192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner - -UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, -192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, -192255,192336); -- Horde Banner - -UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, -193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, -193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, -193164,193165); -- nameless GOs - -UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31841; -- Taunka Spirit Guide -UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31842; -- Dwarven Spirit Guide -UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31052; -- Bowyer Randolph +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31841; -- Taunka Spirit Guide +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31842; -- Dwarven Spirit Guide +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31052; -- Bowyer Randolph UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=39172; -- Marshal Magruder UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry`=30488; -- Travis Day -UPDATE `creature_template` SET `exp`=0 WHERE `entry`=31053; -- Primalist Mulfort -UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4 WHERE `entry`=31107; -- Lieutenant Murp (?) +UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31053; -- Primalist Mulfort +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31107; -- Lieutenant Murp (?) UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216 WHERE `entry`=28366; -- Wintergrasp Tower Cannon -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=32629; -- Wintergrasp Siege Turret -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2 WHERE `entry`=28319; -- Wintergrasp Siege Turret -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=32627; -- Wintergrasp Siege Engine -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28312; -- Wintergrasp Siege Engine -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1 WHERE `entry`=28094; -- Wintergrasp Demolisher -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429 WHERE `entry`=27881; -- Wintergrasp Catapult +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216, `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2, `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A) +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1, `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher +UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429, `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer +UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31091,31036,31101,31051,31153,31151,31102,31106); +UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; +UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder @@ -70,23 +63,17 @@ INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote` (27881,0,0,257,0, NULL), -- Wintergrasp Catapult (30739,0,0,257,375, NULL); -- Warsong Champion --- Wintergrasp vehicles: -UPDATE `creature_template` SET `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon (Both) -UPDATE `creature_template` SET `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H) -UPDATE `creature_template` SET `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A) -UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H) -UPDATE `creature_template` SET `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A) -UPDATE `creature_template` SET `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher (H) -UPDATE `creature_template` SET `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult (Both) - -/* Spell target conditions for spawning WG siege machines in proper place while building it */ -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56575,56661,56663,61408); -INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES -(13, 1, 56575, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), -(13, 1, 56661, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), -(13, 1, 56663, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), -(13, 1, 61408, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL); - -- Note: Siege Engines, Demolisher faction is guess (vehicles get the faction of his driver) -- Demolisher spell positions is not confirmed -- Wintergrasp Tower Cannon H: 1735 A: 1732 + +/* +These two npcs already have a scriptname assigned (npc_wg_spiritguide). That core script should make these npcs cast the 22011 spell. +-- Spirit healers SAI +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (31841,31842); +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (31841,31842); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(31841,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'cast Spirit Heal Channel every 30 sec'), +(31842,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Dwarven Spirit Guide - cast Spirit Heal Channel every 30 sec'); +*/ + diff --git a/Wintergrasp_temp/Misc.sql b/Wintergrasp_temp/WG_spell_misc.sql similarity index 77% rename from Wintergrasp_temp/Misc.sql rename to Wintergrasp_temp/WG_spell_misc.sql index d68853b6c0..86bbde1139 100644 --- a/Wintergrasp_temp/Misc.sql +++ b/Wintergrasp_temp/WG_spell_misc.sql @@ -44,10 +44,21 @@ INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`que (57940,4494,0,0,0,0,0,2,1), (57940,4603,0,0,0,0,0,2,1); --- Spell scripts +DELETE FROM `spell_area` WHERE `spell` IN (56618, 56617); +INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES +(56618, 4538, 1), +(56617, 4538, 1), +(56618, 4539, 1), +(56617, 4539, 1), +(56618, 4611, 1), +(56617, 4611, 1), +(56618, 4612, 1), +(56617, 4612, 1); + +-- Spell scripts. replace with SAI DELETE FROM `spell_scripts` WHERE `id`=49899; INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES -(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms +(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms -- Spell Target position for Wintergrasp Graveyard spells DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769); @@ -59,3 +70,13 @@ INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`targ (59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611" (59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612" (59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone + +DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(61409, 'spell_wintergrasp_force_building'), +(56659, 'spell_wintergrasp_force_building'), +(56662, 'spell_wintergrasp_force_building'), +(56664, 'spell_wintergrasp_force_building'), +(49899, 'spell_wintergrasp_force_building'), +(61178, 'spell_wintergrasp_grab_passenger'); + diff --git a/Wintergrasp_temp/Strings.sql b/Wintergrasp_temp/WG_texts.sql similarity index 100% rename from Wintergrasp_temp/Strings.sql rename to Wintergrasp_temp/WG_texts.sql From e4bf9d5cd459624ec65e1dd8e691ca72d8ce63f2 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 17 Apr 2012 09:16:56 -0400 Subject: [PATCH 136/147] cleanup merge and some unneeded selects in functions --- .../game/Battlefield/Zones/BattlefieldWG.h | 118 ++++++------------ src/server/game/Scripting/ScriptMgr.cpp | 8 -- src/server/scripts/Northrend/wintergrasp.cpp | 2 +- 3 files changed, 39 insertions(+), 89 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index f62d2d962f..53c051a03d 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -372,7 +372,7 @@ class BattlefieldWG : public Battlefield void UpdatedDestroyedTowerCount(TeamId team); void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1); - + void RemoveAurasFromPlayer(Player* player); /** @@ -1458,48 +1458,27 @@ struct BfWGGameObjectBuilding if (m_Build) { if (disable) - { - switch (m_Build->GetEntry()) - { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } - } m_WG->HideNpc(creature); - } else - { - switch (m_Build->GetEntry()) - { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } - } m_WG->ShowNpc(creature, true); + + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } } } } @@ -1515,48 +1494,27 @@ struct BfWGGameObjectBuilding if (m_Build) { if (disable) - { - switch (m_Build->GetEntry()) - { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } - } - m_WG->HideNpc(creature); - } + m_WG->HideNpc(creature); else - { - switch (m_Build->GetEntry()) - { - case 190221: - case 190373: - case 190377: - case 190378: - { - creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); - break; - } - case 190356: - case 190357: - case 190358: - { - creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); - break; - } - } m_WG->ShowNpc(creature, true); + + switch (m_Build->GetEntry()) + { + case 190221: + case 190373: + case 190377: + case 190378: + { + creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); + break; + } + case 190356: + case 190357: + case 190358: + { + creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); + break; + } } } } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 98675f118e..2d7d86b5f7 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -972,14 +972,6 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } -GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) -{ - ASSERT(go); - - GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); - return tmpscript->GetAI(go); -} - bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger) { ASSERT(player); diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 41bb5f3f54..66a79a4be2 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -301,7 +301,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript _checkTimer(1000) { } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 diff) { if (_checkTimer <= diff) { From 8dfbff7b15225e04ec0ca660847fd848ee506259 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 6 Aug 2012 13:12:30 -0400 Subject: [PATCH 137/147] fix build --- src/server/game/Battlefield/Battlefield.cpp | 22 +++++++++---------- .../game/Battlefield/BattlefieldHandler.cpp | 6 ++--- .../game/Battlefield/BattlefieldMgr.cpp | 6 ++--- .../game/Battlefield/Zones/BattlefieldWG.cpp | 4 ++-- .../game/Battlefield/Zones/BattlefieldWG.h | 2 +- src/server/game/World/World.cpp | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 2ad6b24405..ec4acbec9e 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -280,7 +280,7 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL)) StalkerGuid = creature->GetGUID(); else - sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); } void Battlefield::KickAfkPlayers() @@ -587,10 +587,10 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) if (m_GraveyardList[id]) return m_GraveyardList[id]; else - sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u not existed", id); } else - sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u cant be found", id); return NULL; } @@ -684,7 +684,7 @@ void BfGraveyard::SetSpirit(Creature* spirit, TeamId team) { if (!spirit) { - sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit."); + sLog->outError(LOG_FILTER_GENERAL, "BfGraveyard::SetSpirit: Invalid Spirit."); return; } @@ -798,14 +798,14 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId)); if (!map) { - sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); return 0; } Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { - sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry); + sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; return NULL; } @@ -815,7 +815,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry); return NULL; } // force using DB speeds -- do we really need this? @@ -841,8 +841,8 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z GameObject* go = new GameObject; if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) { - sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); - sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); + sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); delete go; return NULL; } @@ -920,7 +920,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); + sLog->outError(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; } @@ -1066,7 +1066,7 @@ bool BfCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //sLog->outError("%u->%u", m_OldState, m_State); + //sLog->outError(LOG_FILTER_GENERAL, "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); return true; diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index e10c5c136d..09c6f18f79 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -101,7 +101,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data) uint8 Accepted; recv_data >> BattleId >> Accepted; - sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -119,7 +119,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data) uint8 Accepted; recv_data >> BattleId >> Accepted; - sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -141,7 +141,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket & recv_data) uint32 BattleId; recv_data >> BattleId; - sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId); + sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 9f821871c2..6122b25e8e 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -40,15 +40,13 @@ void BattlefieldMgr::InitBattlefield() // respawn, init variables if (!pBf->SetupBattlefield()) { - sLog->outString(); - sLog->outString("Battlefield : Wintergrasp init failed."); + sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed."); delete pBf; } else { m_BattlefieldSet.push_back(pBf); - sLog->outString(); - sLog->outString("Battlefield : Wintergrasp successfully initiated."); + sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated."); } /* For Cataclysm: Tol Barad diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 8c68ee3f17..c57f2bf059 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -238,7 +238,7 @@ void BattlefieldWG::OnBattleStart() m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } else - sLog->outError("WG: Failed to spawn titan relic."); + sLog->outError(LOG_FILTER_GENERAL, "WG: Failed to spawn titan relic."); // Update tower visibility and update faction @@ -490,7 +490,7 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) case AREA_THE_CHILLED_QUAGMIRE: return BATTLEFIELD_WG_GY_HORDE; default: - sLog->outError("BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); + sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); break; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 53c051a03d..738d82135d 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1245,7 +1245,7 @@ struct BfWGGameObjectBuilding if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); else - sLog->outError("BattlefieldWG: Relic not found."); + sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found."); break; } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index c4ff906bc3..b6e9ee1651 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1730,7 +1730,7 @@ void World::SetInitialWorldSettings() sOutdoorPvPMgr->InitOutdoorPvP(); ///- Initialize Battlefield - sLog->outString("Starting Battlefield System"); + sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battlefield System"); sBattlefieldMgr->InitBattlefield(); sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); From e56ff2e93a6d62ef1bcf68f2faf95a845b19bdb9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Wed, 8 Aug 2012 09:29:43 -0400 Subject: [PATCH 138/147] Core/Battlefield: fix crash (thx joschiwald) closes #6726 --- src/server/game/Battlefield/Battlefield.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index ec4acbec9e..eb74c53ccb 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -202,7 +202,7 @@ void Battlefield::InvitePlayerToQueue(Player* player) if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID())) return; - if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) + if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId); } From 830de47713bf972332836c952488a0169195ca7e Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 20 Aug 2012 13:23:13 -0400 Subject: [PATCH 139/147] Sql/Wintergrasp: Remove temporary sql files. --- Wintergrasp_temp/Spells.txt | 29 ------ Wintergrasp_temp/TODO.txt | 16 --- Wintergrasp_temp/WG_Conditions.sql | 31 ------ Wintergrasp_temp/WG_GameObject_info.sql | 125 ------------------------ Wintergrasp_temp/WG_Gossips.sql | 57 ----------- Wintergrasp_temp/WG_Quests.sql | 16 --- Wintergrasp_temp/WG_creature_info.sql | 79 --------------- Wintergrasp_temp/WG_spell_misc.sql | 82 ---------------- Wintergrasp_temp/WG_texts.sql | 108 -------------------- 9 files changed, 543 deletions(-) delete mode 100644 Wintergrasp_temp/Spells.txt delete mode 100644 Wintergrasp_temp/TODO.txt delete mode 100644 Wintergrasp_temp/WG_Conditions.sql delete mode 100644 Wintergrasp_temp/WG_GameObject_info.sql delete mode 100644 Wintergrasp_temp/WG_Gossips.sql delete mode 100644 Wintergrasp_temp/WG_Quests.sql delete mode 100644 Wintergrasp_temp/WG_creature_info.sql delete mode 100644 Wintergrasp_temp/WG_spell_misc.sql delete mode 100644 Wintergrasp_temp/WG_texts.sql diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.txt deleted file mode 100644 index 583e46db04..0000000000 --- a/Wintergrasp_temp/Spells.txt +++ /dev/null @@ -1,29 +0,0 @@ -Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32 -Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16 - -Spell 55773 "Horde Control Phase Shift" Adds Phase 64 -Spell 55774 "Alliance Control Phase Shift" Adds Phase 128 - -Spell 58045 "Essence of Wintergrasp" Adds Phase 256 - -Spell 37795 "Recruit" Gained when joining WG battle - -Spell 74411 "Battleground - Dampening" Gained when joining WG battle - -Spell 61409 "Build Siege Vehicle (Force)" is cast by npc 30400 "Goblin Mechanic " on player -Spell 56664 "Build Catapult (Force)" is cast by npc 30499 "Gnomish Engineer " on player -Spell 56662 "Build Siege Vehicle (Force)" is cast by npc 30499 "Gnomish Engineer " on player - -Spell 50398 "Riding Trainer Advertisement" is cast by npc 30869 "Arzo Safeflight " on self - -Wintergrasp Vehicle On spawn entries: 28312,27881,28094,32627 -set x,y,z,o to nearest trigger entry: 23472 -make player cast 60968 on vehicle -aura 14267 on self if player is horde -aura 14268 on self if player is alliance - -Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns): -61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons) -56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons) -14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons) -14267 (Horde Flag) \ No newline at end of file diff --git a/Wintergrasp_temp/TODO.txt b/Wintergrasp_temp/TODO.txt deleted file mode 100644 index 16e1681c37..0000000000 --- a/Wintergrasp_temp/TODO.txt +++ /dev/null @@ -1,16 +0,0 @@ -TODO (add new things to sort out here) : -* Core: - - Move spawns to database : NPCs / GOs (DB part mostly done, core needs to be adjusted) - - Fix teleport spells for vehicles/drivers - - Clean up code to use phases-system / spells instead of hardcoded spawn/despawn functionality - - Remove hardcoded entities from headerfile - - Spawn horde/alliance spiritguides spawn/change depending on holder - - Clean up some minor hacks - -* DB: - - Template updates for npcs and GOs (few missing) - - Npc 30488 (Travis Day) needs vendor data - - Get official texts for horde in db - - Spawn NPC/GO in their correct phase - -COMPLETED (move completed things from the above list here) : diff --git a/Wintergrasp_temp/WG_Conditions.sql b/Wintergrasp_temp/WG_Conditions.sql deleted file mode 100644 index a6dd9826c4..0000000000 --- a/Wintergrasp_temp/WG_Conditions.sql +++ /dev/null @@ -1,31 +0,0 @@ --- Conditions --- Add gossip_menu condition for 9904 Horde -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup` IN (9904,9923); -INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES -(14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal -(14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant -(14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal -(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant --- Add gossip_menu condition for 9923 Alliance -(14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal -(14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant -(14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal -(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant --- Add conditions to gossip options horde -(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal -(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant -(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant -(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant --- Add conditions to gossip options alliance -(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal -(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant -(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant -(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant - -/* Spell target conditions for spawning WG siege machines in proper place while building it */ -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56575,56661,56663,61408); -INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES -(13, 1, 56575, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), -(13, 1, 56661, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), -(13, 1, 56663, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL), -(13, 1, 61408, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL); \ No newline at end of file diff --git a/Wintergrasp_temp/WG_GameObject_info.sql b/Wintergrasp_temp/WG_GameObject_info.sql deleted file mode 100644 index 5cfc7864ad..0000000000 --- a/Wintergrasp_temp/WG_GameObject_info.sql +++ /dev/null @@ -1,125 +0,0 @@ -UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329, -192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner - -UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361, -192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254, -192255,192336); -- Horde Banner - -UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127, -193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145, -193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163, -193164,193165); -- nameless GOs - -UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter - --- Before pushing to master check if guids are free. --- Spawns Workshop Capture Points -SET @GUID := 4594; -DELETE FROM gameobject WHERE guid IN (@GUID+1,@GUID+2,@GUID+3,@GUID+4); -INSERT INTO gameobject (guid,id,position_x,position_y,position_z,orientation,map) VALUES -(@GUID+1, 190475, 4949.344238, 2432.585693, 320.176971, 1.386214, 571), -- ne -(@GUID+2, 190487, 4948.524414, 3342.337891, 376.875366, 4.400566, 571), -- nw -(@GUID+3, 194959, 4398.076660, 2356.503662, 376.190491, 0.525406, 571), -- se -(@GUID+4, 194962, 4390.776367, 3304.094482, 372.429077, 6.097023, 571); -- sw - --- EVERYTHING UNDER HERE IS WIP -/* -SET @OGUID := XXXXX; -INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES --- Eastspark Workshop "Horde" -(@OGUID+20,192452,571,1,16,4416.7993,2414.0383,377.4869,0.0087,0,0,0,0,120,0,1), --- Eastspark Workshop "Alliance" -(@OGUID+21,192416,571,1,32,4408.57,2422.61,377.179,1.58825,0,0,0,1,180,0,1), -(@OGUID+22,192417,571,1,32,4416.59,2414.08,377.196,0,0,0,0,1,180,0,1), -(@OGUID+23,192418,571,1,32,4417.25,2301.14,377.214,0.026179,0,0,0,1,180,0,1), -(@OGUID+24,192273,571,1,32,4417.94,2324.81,371.577,3.08051,0,0,0,1,180,0,1), --- Westspark Workshop "Horde" - --- Westspark Workshop "Alliance" -(@OGUID+25,192274,571,1,32,4424.15,3286.54,371.546,3.12412,0,0,0,1,180,0,1), -(@OGUID+26,192406,571,1,32,4438.3,3361.08,371.568,-0.017451,0,0,0,1,180,0,1), -(@OGUID+27,192407,571,1,32,4448.17,3235.63,370.412,-1.56207,0,0,0,1,180,0,1), -(@OGUID+28,192433,571,1,32,4401.63,3377.46,363.365,1.55334,0,0,0,1,180,0,1), - --- *** in progress zone horde banner in phase 128 + 32 - --- Winters Edge tower alliance -(192429,571,1,64,4464.123535 2855.453125 406.110596,0.829032,0,0,0,0,120,0,1); -(192430,571,1,64,4434.555664,2883.448730,406.025299,0.759217,0,0,0,0,120,0,1); -(192431,571,1,64,4349.900391,2885.561768,406.104889,1.605702,0,0,0,0,120,0,1); -(192414,571,1,64,4387.621582 2719.565918 389.935120,-1.544616,0,0,0,0,120,0,1); --- Winters Edge tower horde -(192442,571,1,128,4350.039,2885.61377,406.3287,1.58824873,0,0,0,0,120,0,1); -(192443,571,1,128,4434.32568,2883.244,406.3456,0.767943859,0,0,0,0,120,0,1); -(192444,571,1,128,4464.17432,2855.3186,406.390961,0.802850962,0,0,0,0,120,0,1); -(192450,571,1,128,4387.59033,2719.90015,390.200531,-1.51843357,0,0,0,0,120,0,1); - -(192449,571,1,129,4517.75342,2717.231,387.811981,-1.53588688,0,0,0,0,120,0,1); -(192424,571,1,417,4563.70166,2171.03125,367.607056,-1.82386875,0,0,0,0,120,0,1), -(192626,571,1,65,4938.364,2454.59863,320.391785,-2.513274,0,0,0,0,120,0,1); -(192627,571,1,65,4939.48535,3339.65259,376.874939,0.890116632,0,0,0,0,120,0,1); - -192271 4424.741211 2975.604980 367.226807 1.701696 -- banner pole shawdowsight -*/ - --- Misc objects in fortress phased properly -SET @OGUID := 282000; -DELETE FROM `gameobject` WHERE `guid` IN (67165,67224,67222,67190,67195,67216,67193,67182,67186,67192,67161,67164,67180,67187); -DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+55; -INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES -(@OGUID+0,193096,571,1,128,5379.885,3008.093,409.181915,-3.124123,0,0,0,0,120,0,1), -(@OGUID+1,193097,571,1,128,5381.73975,3008.15454,409.181915,2.98449826,0,0,0,0,120,0,1), -(@OGUID+2,193098,571,1,128,5383.672,3008.02783,409.181915,-3.115388,0,0,0,0,120,0,1), -(@OGUID+3,193099,571,1,128,5386.25342,3007.79614,409.181915,2.932139,0,0,0,0,120,0,1), -(@OGUID+4,193100,571,1,128,5387.354,3009.64941,409.181915,-1.30899549,0,0,0,0,120,0,1), -(@OGUID+5,193101,571,1,128,5381.12744,3010.09717,409.181915,-2.72271276,0,0,0,0,120,0,1), -(@OGUID+6,193102,571,1,128,5383.12061,3007.90967,410.8231,-2.530723,0,0,0,0,120,0,1), -(@OGUID+7,193103,571,1,128,5381.105,3007.89575,410.8231,-3.09791875,0,0,0,0,120,0,1), -(@OGUID+8,193104,571,1,128,5376.777,3010.619,409.191742,-2.60926127,0,0,0,0,120,0,1), -(@OGUID+9,193105,571,1,128,5381.47559,3010.24731,410.8231,-2.80997539,0,0,0,0,120,0,1), -(@OGUID+10,193106,571,1,128,5381.059,3009.85864,410.8231,2.66161919,0,0,0,0,120,0,1), -(@OGUID+11,193107,571,1,128,5381.038,3010.44263,410.8157,-2.0507617,0,0,0,0,120,0,1), -(@OGUID+12,193108,571,1,128,5379.83154,3007.82373,410.8161,-2.02457881,0,0,0,0,120,0,1), -(@OGUID+13,193109,571,1,128,5379.99463,3008.40356,410.815918,-3.03687477,0,0,0,0,120,0,1), -(@OGUID+14,193124,571,1,128,5293.65869,2924.44019,409.29306,1.20427489,0,0,0,0,120,0,1), -(@OGUID+15,193125,571,1,1,5293.28,2932.32813,409.065247,-2.49581814,0,0,0,0,120,0,1), -(@OGUID+16,193126,571,1,1,5292.30469,2930.5105,409.157135,-3.06302428,0,0,0,0,120,0,1), -(@OGUID+17,193127,571,1,64,5293.349,2923.712,409.844757,-1.8762306,0,0,0,0,120,0,1), -(@OGUID+18,193128,571,1,128,5293.12256,2895.22754,409.208771,-0.9861096,0,0,0,0,120,0,1), -(@OGUID+19,193129,571,1,128,5292.913,2895.54346,410.419617,-0.122171074,0,0,0,0,120,0,1), -(@OGUID+20,193130,571,1,128,5294.09473,2894.191,409.164063,-0.7330382,0,0,0,0,120,0,1), -(@OGUID+21,193131,571,1,128,5295.1875,2895.382,409.143219,-0.349065244,0,0,0,0,120,0,1), -(@OGUID+22,193132,571,1,128,5294.527,2895.57471,410.6591,-1.92858779,0,0,0,0,120,0,1), -(@OGUID+23,193133,571,1,128,5295.3916,2895.05737,410.6686,0.6894028,0,0,0,0,120,0,1), -(@OGUID+24,193134,571,1,128,5295.13525,2895.68481,410.618866,-2.22529364,0,0,0,0,120,0,1), -(@OGUID+25,193135,571,1,128,5294.97559,2895.33521,410.657684,-2.73143482,0,0,0,0,120,0,1), -(@OGUID+26,193136,571,1,128,5293.22559,2895.46436,410.413483,-0.802850962,0,0,0,0,120,0,1), -(@OGUID+27,193137,571,1,128,5295.56,2895.24146,410.628052,-2.11184788,0,0,0,0,120,0,1), -(@OGUID+28,193138,571,1,128,5293.741,2894.48169,409.183167,-2.72271276,0,0,0,0,120,0,1), -(@OGUID+29,193139,571,1,64,5294.599,2786.85254,409.8877,-2.356195,0,0,0,0,120,0,1), -(@OGUID+30,193140,571,1,64,5294.37939,2785.03833,409.175018,-2.33873963,0,0,0,0,120,0,1), -(@OGUID+31,193141,571,1,64,5293.205,2787.03052,409.218872,3.03687477,0,0,0,0,120,0,1), -(@OGUID+32,193142,571,1,64,5294.241,2786.42456,409.174347,0.0174524616,0,0,0,0,120,0,1), -(@OGUID+33,193143,571,1,64,5291.705,2785.86646,409.282135,-2.03330517,0,0,0,0,120,0,1), -(@OGUID+34,193144,571,1,64,5293.03369,2785.632,409.22522,-1.2915417,0,0,0,0,120,0,1), -(@OGUID+35,193145,571,1,64,5295.866,2787.7666,409.1923,2.155478,0,0,0,0,120,0,1), -(@OGUID+36,193146,571,1,64,5293.56445,2787.31079,410.55954,0.261798173,0,0,0,0,120,0,1), -(@OGUID+37,193147,571,1,128,5233.12061,2920.362,409.163544,-0.7243115,0,0,0,0,120,0,1), -(@OGUID+38,193148,571,1,128,5238.27539,2920.67358,409.256439,-0.418878615,0,0,0,0,120,0,1), -(@OGUID+39,193149,571,1,128,5235.902,2920.751,409.224457,-0.951203167,0,0,0,0,120,0,1), -(@OGUID+40,193150,571,1,128,5237.36963,2919.89771,409.556641,0.8202983,0,0,0,0,120,0,1), -(@OGUID+41,193151,571,1,128,5234.19775,2918.99731,409.322754,-2.33873963,0,0,0,0,120,0,1), -(@OGUID+42,193152,571,1,128,5234.52344,2921.76221,409.175781,-2.2165668,0,0,0,0,120,0,1), -(@OGUID+43,193153,571,1,128,5234.119,2918.93921,409.1339,-3.098036,0,0,0,0,120,0,1), -(@OGUID+44,193154,571,1,128,5234.26758,2919.40015,409.502869,-2.18166113,0,0,0,0,120,0,1), -(@OGUID+45,193155,571,1,128,5293.37939,2746.05566,409.22052,-0.06981169,0,0,0,0,120,0,1), -(@OGUID+46,193156,571,1,128,5293.65039,2755.67529,409.1913,-0.43633157,0,0,0,0,120,0,1), -(@OGUID+47,193157,571,1,128,5292.23535,2753.59473,409.0867,-0.357789934,0,0,0,0,120,0,1), -(@OGUID+48,193158,571,1,128,5292.42969,2748.62427,409.131042,0.253072351,0,0,0,0,120,0,1), -(@OGUID+49,193159,571,1,128,5293.384,2750.90283,409.234924,-0.0610866137,0,0,0,0,120,0,1), -(@OGUID+50,193160,571,1,64,5371.89746,2805.47583,409.3072,0.0610866137,0,0,0,0,120,0,1), -(@OGUID+51,193161,571,1,64,5376.616,2875.105,409.254822,1.59697616,0,0,0,0,120,0,1), -(@OGUID+52,193162,571,1,128,5377.54932,2870.92456,409.239166,-0.549776852,0,0,0,0,120,0,1), -(@OGUID+53,193163,571,1,128,5378.068,2813.61719,409.239166,1.55334139,0,0,0,0,120,0,1), -(@OGUID+54,193164,571,1,128,5378.921,2805.43677,409.239166,1.53588688,0,0,0,0,120,0,1), -(@OGUID+55,193165,571,1,128,5378.452,2876.67456,409.239166,1.54461825,0,0,0,0,120,0,1); diff --git a/Wintergrasp_temp/WG_Gossips.sql b/Wintergrasp_temp/WG_Gossips.sql deleted file mode 100644 index 8e49bbf915..0000000000 --- a/Wintergrasp_temp/WG_Gossips.sql +++ /dev/null @@ -1,57 +0,0 @@ --- Gossip Menu -DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759; -DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761; -DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172; -DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221; -INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES -(9904,13759), -(9904,13761), -(9923,14172), -(10229,14221); - --- Gossip Menu Option -DELETE FROM `gossip_menu_option` WHERE `menu_id`=9904; -DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4); -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 -(9904,0,0, 'I would like to build a catapult.',1,1,0,0,0,0, ''), -(9904,1,0, 'I would like to build a demolisher.',1,1,0,0,0,0, ''), -(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''), -(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''), -(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, ''); - -/* -- Add scripts to Wintergrasp spirit guide gossip --- !!!should be scripted by SAI or cpp script!!! -UPDATE `gossip_menu_option` SET `action_script_id`=1012800 WHERE `menu_id` IN (10128,10129) AND `id`=0; -UPDATE `gossip_menu_option` SET `action_script_id`=1012801 WHERE `menu_id` IN (10128,10129) AND `id`=1; -UPDATE `gossip_menu_option` SET `action_script_id`=1012802 WHERE `menu_id` IN (10128,10129) AND `id`=2; -UPDATE `gossip_menu_option` SET `action_script_id`=1012803 WHERE `menu_id` IN (10128,10129) AND `id`=3; -UPDATE `gossip_menu_option` SET `action_script_id`=1012804 WHERE `menu_id` IN (10128,10129) AND `id`=4; -UPDATE `gossip_menu_option` SET `action_script_id`=1012805 WHERE `menu_id`=10128 AND `id`=5; -UPDATE `gossip_menu_option` SET `action_script_id`=1012806 WHERE `menu_id`=10129 AND `id`=5; - --- Add Teleport graveyard Spells to gossip scripts -DELETE FROM `gossip_scripts` WHERE `id` IN (1012800,1012801,1012802,1012803,1012804,1012805,1012806); -INSERT INTO `gossip_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`) VALUES -(1012800,0,33,0,0),(1012800,0,15,59760,1), -(1012801,0,33,0,0),(1012801,0,15,59762,1), -(1012802,0,33,0,0),(1012802,0,15,59763,1), -(1012803,0,33,0,0),(1012803,0,15,59766,1), -(1012804,0,33,0,0),(1012804,0,15,59767,1), -(1012805,0,33,0,0),(1012805,0,15,59769,1), -(1012806,0,33,0,0),(1012806,0,15,59765,1); - --- Add scripts to Wintergrasp engineers --- already done by engineer's script -UPDATE `gossip_menu_option` SET `action_script_id`=990400 WHERE `menu_id` IN (9904,9923) AND `id`=0; -UPDATE `gossip_menu_option` SET `action_script_id`=990401 WHERE `menu_id` IN (9904,9923) AND `id`=1; -UPDATE `gossip_menu_option` SET `action_script_id`=990402 WHERE `menu_id` IN (9904) AND `id`=2; -UPDATE `gossip_menu_option` SET `action_script_id`=990403 WHERE `menu_id` IN (9923) AND `id`=2; - --- Add create vehicle Spells to gossip scripts -DELETE FROM `gossip_scripts` WHERE `id` IN (990400,990401,990402); -INSERT INTO `gossip_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`) VALUES -(990400,0,33,0,0),(990400,0,15,56663,1), -(990401,0,33,0,0),(990401,0,15,56575,1), -(990402,0,33,0,0),(990402,0,15,61408,1), -(990403,0,33,0,0),(990403,0,15,56661,1); -*/ diff --git a/Wintergrasp_temp/WG_Quests.sql b/Wintergrasp_temp/WG_Quests.sql deleted file mode 100644 index d456f5d5e7..0000000000 --- a/Wintergrasp_temp/WG_Quests.sql +++ /dev/null @@ -1,16 +0,0 @@ --- Wintergrasp Quests - Horde -UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `id` IN (13180,13178); -- Slay them all! -UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `id` IN (13185,13223); -- Stop/Defend the Siege -UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `id` IN (13201,13194); -- Healing with Roses -UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `id` IN (13193,13199); -- Bones and Arrows -UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `id` IN (13192,13202); -- Warding/Jinxing the Walls -UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `id` IN (13200,13191); -- Fueling the Demolishers - --- Wintergrasp Quests - Alliance -UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `id` IN (13179,13177); -- No Mercy for the Merciless -UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `id` IN (13186,13222); -- Stop/Defend the Siege -UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `id` IN (13195,13156); -- A Rare Herb -UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `id` IN (13196,13154); -- Bones and Arrows -UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `id` IN (13198,13153); -- Warding the Warriors - --- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already? diff --git a/Wintergrasp_temp/WG_creature_info.sql b/Wintergrasp_temp/WG_creature_info.sql deleted file mode 100644 index e245a0bdf9..0000000000 --- a/Wintergrasp_temp/WG_creature_info.sql +++ /dev/null @@ -1,79 +0,0 @@ -UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31841; -- Taunka Spirit Guide -UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31842; -- Dwarven Spirit Guide -UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31052; -- Bowyer Randolph -UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=39172; -- Marshal Magruder -UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry`=30488; -- Travis Day -UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31053; -- Primalist Mulfort -UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31107; -- Lieutenant Murp (?) -UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai -UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?) -UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216, `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H) -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2, `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A) -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H) -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A) -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1, `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher -UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429, `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer -UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31091,31036,31101,31051,31153,31151,31102,31106); -UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400; -UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091; - -UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron -UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder -UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31347; -- Champion Ros'slai -UPDATE `creature_model_info` SET `bounding_radius`=0.305,`combat_reach`=5,`gender`=2 WHERE `modelid`=25301; -- Wintergrasp Siege Turret - -DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740,32629,28319,28366,32627,28312,28094,27881,30739); -INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES -(31841,0,0,1,0, '58729'), -- Taunka Spirit Guide (Spiritual Immunity, Spirit Heal Channel) FIX: Do we need the spell that revives players here (22011)? It has a duration (found in sniffs). -(31842,0,0,1,0, '58729'), -- Dwarven Spirit Guide This spell (and the spell it triggers, are used in the "ressurect system" in Battleground.cpp -(30400,0,0,1,0, NULL), -- Goblin Mechanic -(30499,0,0,1,0, NULL), -- Gnomish Engineer -(30489,0,0,1,0, NULL), -- Morgan Day -(30869,0,0,1,0, NULL), -- Arzo Safeflight -(31036,14337,0,257,0, NULL), -- Commander Zanneth -(31051,0,0,1,0, NULL), -- Sorceress Kaylana -(31052,0,0,257,0, NULL), -- Bowyer Randolph -(31054,0,0,257,0, NULL), -- Anchorite Tessa -(31108,0,0,257,0, NULL), -- Siege Master Stouthandle -(31109,0,0,257,0, NULL), -- Senior Demolitionist Legoso -(31153,6569,0,257,0, NULL), -- Tactical Officer Ahbramis -(32294,27247,0,1,0, NULL), -- Knight Dameron -(39172,28912,0,1,0, NULL), -- Marshal Magruder -(30870,0,0,1,0, NULL), -- Herzo Safeflight -(31053,0,0,257,0, '18950'), -- Primalist Mulfort (Invisibility and Stealth Detection ... why?) -(31091,0,0,257,0, '18950'), -- Commander Dardosh (Invisibility and Stealth Detection) -(31101,0,0,1,0, NULL), -- Hoodoo Master Fu'jin -(31102,0,0,1,0, NULL), -- Vieron Blazefeather -(31106,0,0,257,0, NULL), -- Siegesmith Stronghoof -(31107,0,0,257,0, NULL), -- Lieutenant Murp -(31151,0,0,257,0, NULL), -- Tactical Officer Kilrath -(32296,27245,0,1,0, NULL), -- Stone Guard Mukar -(39173,29261,0,1,0, NULL), -- Champion Ros'slai -(30740,0,0,257,375, NULL), -- Valiance Expedition Champion -(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret -(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret -(28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon -(32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine -(28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine -(28094,0,0,257,0, NULL), -- Wintergrasp Demolisher -(27881,0,0,257,0, NULL), -- Wintergrasp Catapult -(30739,0,0,257,375, NULL); -- Warsong Champion - --- Note: Siege Engines, Demolisher faction is guess (vehicles get the faction of his driver) --- Demolisher spell positions is not confirmed --- Wintergrasp Tower Cannon H: 1735 A: 1732 - -/* -These two npcs already have a scriptname assigned (npc_wg_spiritguide). That core script should make these npcs cast the 22011 spell. --- Spirit healers SAI -UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (31841,31842); -DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (31841,31842); -INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES -(31841,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'cast Spirit Heal Channel every 30 sec'), -(31842,0,0,0,1,0,100,0,0,0,30000,30000,11,22011,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Dwarven Spirit Guide - cast Spirit Heal Channel every 30 sec'); -*/ - diff --git a/Wintergrasp_temp/WG_spell_misc.sql b/Wintergrasp_temp/WG_spell_misc.sql deleted file mode 100644 index 86bbde1139..0000000000 --- a/Wintergrasp_temp/WG_spell_misc.sql +++ /dev/null @@ -1,82 +0,0 @@ --- 54640 Teleport (Teleports defenders behind the walls on the Isle of Ulduran, Strand of the Ancients) - FIX THIS? -DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54640; -INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES -(54640,54643,0, 'WG teleporter'); - --- Spell area -DELETE FROM `spell_area` WHERE `spell` IN (58730,57940); -INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES -(58730,4581,0,0,0,0,0,2,1), -- Restricted Flight Area (Wintergrasp Eject) -(58730,4539,0,0,0,0,0,2,1), -(58730,4197,0,0,0,0,0,2,1), -(58730,4585,0,0,0,0,0,2,1), -(58730,4612,0,0,0,0,0,2,1), -(58730,4582,0,0,0,0,0,2,1), -(58730,4583,0,0,0,0,0,2,1), -(58730,4589,0,0,0,0,0,2,1), -(58730,4575,0,0,0,0,0,2,1), -(58730,4538,0,0,0,0,0,2,1), -(58730,4577,0,0,0,0,0,2,1), -(57940,65,0,0,0,0,0,2,1), -- Essence of Wintergrasp -(57940,66,0,0,0,0,0,2,1), -(57940,67,0,0,0,0,0,2,1), -(57940,206,0,0,0,0,0,2,1), -(57940,210,0,0,0,0,0,2,1), -(57940,394,0,0,0,0,0,2,1), -(57940,395,0,0,0,0,0,2,1), -(57940,1196,0,0,0,0,0,2,1), -(57940,2817,0,0,0,0,0,2,1), -(57940,3456,0,0,0,0,0,2,1), -(57940,3477,0,0,0,0,0,2,1), -(57940,3537,0,0,0,0,0,2,1), -(57940,3711,0,0,0,0,0,2,1), -(57940,4100,0,0,0,0,0,2,1), -(57940,4196,0,0,0,0,0,2,1), -(57940,4228,0,0,0,0,0,2,1), -(57940,4264,0,0,0,0,0,2,1), -(57940,4265,0,0,0,0,0,2,1), -(57940,4272,0,0,0,0,0,2,1), -(57940,4273,0,0,0,0,0,2,1), -(57940,4395,0,0,0,0,0,2,1), -(57940,4415,0,0,0,0,0,2,1), -(57940,4416,0,0,0,0,0,2,1), -(57940,4493,0,0,0,0,0,2,1), -(57940,4494,0,0,0,0,0,2,1), -(57940,4603,0,0,0,0,0,2,1); - -DELETE FROM `spell_area` WHERE `spell` IN (56618, 56617); -INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES -(56618, 4538, 1), -(56617, 4538, 1), -(56618, 4539, 1), -(56617, 4539, 1), -(56618, 4611, 1), -(56617, 4611, 1), -(56618, 4612, 1), -(56617, 4612, 1); - --- Spell scripts. replace with SAI -DELETE FROM `spell_scripts` WHERE `id`=49899; -INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES -(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms - --- Spell Target position for Wintergrasp Graveyard spells -DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769); -INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES -(59760,571,5537.986,2897.493,517.057,4.819249), -- Teleport: Fortress Graveyard -(59762,571,5104.750,2300.940,368.579,0.733038), -- Teleport: Sunken Ring "area 4538" -(59763,571,5099.120,3466.036,368.484,5.317802), -- Teleport: Broken Temple "area 4539 & 4589" -(59765,571,5032.454,3711.382,372.468,3.971623), -- Teleport: Horde Landing Zone -(59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611" -(59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612" -(59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone - -DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178); -INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES -(61409, 'spell_wintergrasp_force_building'), -(56659, 'spell_wintergrasp_force_building'), -(56662, 'spell_wintergrasp_force_building'), -(56664, 'spell_wintergrasp_force_building'), -(49899, 'spell_wintergrasp_force_building'), -(61178, 'spell_wintergrasp_grab_passenger'); - diff --git a/Wintergrasp_temp/WG_texts.sql b/Wintergrasp_temp/WG_texts.sql deleted file mode 100644 index 090c5350c7..0000000000 --- a/Wintergrasp_temp/WG_texts.sql +++ /dev/null @@ -1,108 +0,0 @@ --- Unused yet: --- Wintergrasp is under attack! --- Wintergrasp Fortress is under attack! --- Winter's Edge Tower is under attack! --- Eastern Bridge is under attack! --- Western Bridge is under attack! --- Westspark Bridge is under attack! --- Flamewatch Tower is under attack! - --- 'You have reached Rank 1: Corporal' Sent to player by raid leader --- 'You have reached Rank 2: First Lieutenant' Sent to player by raid leader - --- Wintergrasp coreside texts -DELETE FROM `trinity_string` WHERE `entry` BETWEEN 12050 AND 12072; -INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES -(12050, '%s has been captured by %s ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12051, '%s is under attack by %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12052, 'The Broken Temple siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12053, 'Eastspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12054, 'Westspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12055, 'The Sunken Ring siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12057, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12056, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12058, 'The battle for Wintergrasp is about to begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12059, 'You have reached Rank 1: Corporal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12060, 'You have reached Rank 2: First Lieutenant', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12061, 'The south-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12062, 'The north-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12063, 'The south-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12064, 'The north-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12065, '%s has been damaged !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12066, '%s has been destroyed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12067, 'The battle for Wintergrasp begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12068, '%s has successfully defended the Wintergrasp fortress!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12069, 'The southern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12070, 'The eastern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12071, 'The western tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), -(12072, 'The Wintergrasp fortress has been captured by %s !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - --- Wintergrasp script texts -DELETE FROM `script_texts` WHERE entry BETWEEN -1850507 AND -1850500; -INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`)VALUES -(0, -1850500, 'Guide me to the Fortress Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850501, 'Guide me to the Sunken Ring Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850502, 'Guide me to the Broken Temple Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850503, 'Guide me to the Westspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850504, 'Guide me to the Eastspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850505, 'Guide me back to the Horde landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850506, 'Guide me back to the Alliance landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''), -(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text, maybe "Get in the queue for Wintergrasp."?) - --- New support-commands for battlefield class -DELETE FROM `command` WHERE name IN ('bf start', 'bf stop', 'bf enable', 'bf switch', 'bf timer'); -INSERT INTO `command` (`name`,`security`,`help`) VALUES -('bf start',3,'Syntax: .bf start #battleid'), -('bf stop',3,'Syntax: .bf stop #battleid'), -('bf enable',3,'Syntax: .bf enable #battleid'), -('bf switch',3,'Syntax: .bf switch #battleid'), -('bf timer',3,'Syntax: .bf timer #battleid #timer'); - --- NPC talk text insert from sniff -DELETE FROM `creature_text` WHERE `entry`=15214 AND `groupid` BETWEEN 0 AND 30; -DELETE FROM `creature_text` WHERE `entry` IN (31036,31091) AND `groupid` BETWEEN 0 AND 3; -DELETE FROM `creature_text` WHERE `entry` IN (31108,31109,34924) AND `groupid`=0; -INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES -(15214,0,0, 'Let the battle begin!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,1,0, 'The southern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,2,0, 'The southern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,3,0, 'The eastern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,4,0, 'The eastern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,5,0, 'The western tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,6,0, 'The western tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,7,0, 'The north-western keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,8,0, 'The north-western keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,9,0, 'The south-eastern keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,10,0, 'The south-eastern keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,11,0, 'The Broken Temple siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,12,0, 'The Broken Temple siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,13,0, 'The Broken Temple siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,14,0, 'The Broken Temple siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,15,0, 'The Eastspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,16,0, 'The Eastspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,17,0, 'The Eastspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,18,0, 'The Eastspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,19,0, 'The Sunken Ring siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,20,0, 'The Sunken Ring siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,21,0, 'The Sunken Ring siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,22,0, 'The Sunken Ring siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,23,0, 'The Westspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,24,0, 'The Westspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,25,0, 'The Westspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,26,0, 'The Westspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,27,0, 'The Alliance has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,28,0, 'The Alliance has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,29,0, 'The Horde has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), -(15214,30,0, 'The Horde has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'), --- Not sure if all Alliance text is here, need horde text -(31036,0,0, 'The first of the Horde towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'), -(31036,1,0, 'The second tower has fallen! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'), -(31036,2,0, 'The Horde towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Zanneth'), -(31036,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Zanneth'), -(31091,0,0, 'The first of the Alliance towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'), -(31091,1,0, 'Lok''tar! The second tower falls! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'), -(31091,2,0, 'The Alliance towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Dardosh'), -(31091,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Dardosh'), -- ??? -(31108,0,0, 'Stop the Horde from retrieving the embers, $n. We cannot risk them having the advantage when the battle resumes!',0,7,100,0,0,0, 'Siege Master Stouthandle'), -(31109,0,0, 'Destroy their foul machines of war, $n!',0,7,100,0,0,0, 'Senior Demolitionist Legoso'), -(34924,0,0, 'The gates have been breached! Defend the keep!',1,0,100,0,0,0, 'High Commander Halford Wyrmbane'); From c428675048d2b6833ac055d7c5ed5d8f7659f667 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 20 Aug 2012 14:11:38 -0400 Subject: [PATCH 140/147] Cmake: fix cmake file for use with wintergrasp --- src/server/game/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index a83e77e663..68ae2d8ea3 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -17,6 +17,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h) file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h) file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h) file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h) +file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h) file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h) file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h) file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h) @@ -68,6 +69,7 @@ set(game_STAT_SRCS ${sources_Addons} ${sources_AI} ${sources_AuctionHouse} + ${sources_Battlefield} ${sources_Battlegrounds} ${sources_Calendar} ${sources_Chat} @@ -136,6 +138,8 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI ${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts ${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse + ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield + ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones ${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds ${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones ${CMAKE_CURRENT_SOURCE_DIR}/Calendar From b9f60fe56c86914c15f3a3064f9b8b91ea166012 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 20 Aug 2012 16:23:24 -0400 Subject: [PATCH 141/147] Core/Wintergrasp: finish implementation for battlefields. this is highly experimental enable at you're own risk. will almost definatly cause issues with the wintergrasp patch floating around --- src/server/game/Battlefield/Battlefield.cpp | 2 +- src/server/game/Entities/Object/Object.cpp | 5 +- src/server/game/Entities/Player/Player.cpp | 2 + src/server/game/Entities/Unit/Unit.cpp | 2 + src/server/game/Groups/Group.cpp | 12 ++++- src/server/game/Groups/Group.h | 5 ++ .../game/Handlers/BattleGroundHandler.cpp | 49 +++++++++++++++++++ src/server/game/Handlers/MiscHandler.cpp | 49 +------------------ src/server/game/Scripting/ScriptMgr.cpp | 8 +++ src/server/game/Server/WorldSession.h | 1 + .../game/Spells/Auras/SpellAuraEffects.cpp | 2 + src/server/game/Spells/Spell.cpp | 2 + src/server/game/World/World.cpp | 1 + src/server/game/World/World.h | 7 +++ src/server/scripts/CMakeLists.txt | 2 + src/server/scripts/Northrend/CMakeLists.txt | 1 + src/server/scripts/Northrend/wintergrasp.cpp | 3 +- 17 files changed, 100 insertions(+), 53 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index eb74c53ccb..cdb8e1999f 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -563,7 +563,7 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) else if (group->IsMember(player->GetGUID())) { uint8 subgroup = group->GetMemberGroup(player->GetGUID()); - player->SetBattlegroundOrBattlefieldRaid(group, subgroup); + player->SetBattlegroundRaid(group, subgroup); } else group->AddMember(player); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index b265648d0c..9138dcedc2 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -48,6 +48,8 @@ #include "MovementPacketBuilder.h" #include "DynamicTree.h" #include "Group.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" uint32 GuidHigh2TypeId(uint32 guid_hi) { @@ -2331,9 +2333,6 @@ void WorldObject::SetZoneScript() else if (!map->IsBattlegroundOrArena()) { if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) - m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); - } -} m_zoneScript = bf; else m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2cb38d615a..1dcdfa9d8b 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -74,6 +74,8 @@ #include "InstanceScript.h" #include #include "AccountMgr.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5e94ea3146..3f088c556f 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -57,6 +57,8 @@ #include "MoveSpline.h" #include "ConditionMgr.h" #include "UpdateFieldFlags.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" #include diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 5ace6da2f4..c270597d15 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -59,7 +59,7 @@ Loot* Roll::getLoot() Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL), m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL), -m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), +m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0) { for (uint8 i = 0; i < TARGETICONCOUNT; ++i) @@ -2149,6 +2149,11 @@ bool Group::isBGGroup() const return m_bgGroup != NULL; } +bool Group::isBFGroup() const +{ + return m_bfGroup != NULL; +} + bool Group::IsCreated() const { return GetMembersCount() > 0; @@ -2250,6 +2255,11 @@ void Group::SetBattlegroundGroup(Battleground* bg) m_bgGroup = bg; } +void Group::SetBattlefieldGroup(Battlefield *bg) +{ + m_bfGroup = bg; +} + void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) { // Assistants, main assistants and main tanks are only available in raid groups diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index e5f174c423..41f5cd0de5 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -26,6 +26,8 @@ #include "QueryResult.h" #include "SharedDefines.h" #include "Player.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" class Creature; class GroupReference; @@ -205,6 +207,7 @@ class Group bool isLFGGroup() const; bool isRaidGroup() const; bool isBGGroup() const; + bool isBFGroup() const; bool IsCreated() const; uint64 GetLeaderGUID() const; uint64 GetGUID() const; @@ -241,6 +244,7 @@ class Group void ConvertToRaid(); void SetBattlegroundGroup(Battleground* bg); + void SetBattlefieldGroup(Battlefield *bf); GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); void ChangeMembersGroup(uint64 guid, uint8 group); @@ -324,6 +328,7 @@ class Group Difficulty m_dungeonDifficulty; Difficulty m_raidDifficulty; Battleground* m_bgGroup; + Battlefield* m_bfGroup; uint64 m_targetIcons[TARGETICONCOUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 475c1c42fc..b47eaf5206 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -34,6 +34,8 @@ #include "Opcodes.h" #include "DisableMgr.h" #include "Group.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) { @@ -565,6 +567,53 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) } } +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->SendAreaSpiritHealerQueryOpcode(_player,guid); +} + +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + + Battleground* bg = _player->GetBattleground(); + + uint64 guid; + recv_data >> guid; + + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit) + return; + + if (!unit->isSpiritService()) // it's not spirit service + return; + + if (bg) + bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) + bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); +} + + void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 26b41a6292..bb0ca39fa3 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -52,6 +52,8 @@ #include "Group.h" #include "AccountMgr.h" #include "Spell.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -1687,53 +1689,6 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) SendPacket(&data); } -//Battlefield and Battleground -void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); - - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) - bf->SendAreaSpiritHealerQueryOpcode(_player,guid); -} - -void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) -{ - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - - Battleground* bg = _player->GetBattleground(); - - uint64 guid; - recv_data >> guid; - - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit) - return; - - if (!unit->isSpiritService()) // it's not spirit service - return; - - if (bg) - bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); - - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId())) - bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); -} - void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) { if (_player->isInFlight()) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 2d7d86b5f7..61d8711fd7 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -723,6 +723,14 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } +GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) +{ + ASSERT(go); + + GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); + return tmpscript->GetAI(go); +} + bool ScriptMgr::OnQuestAccept(Player* player, Item* item, Quest const* quest) { ASSERT(player); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 98a8f3e564..40485e2fa3 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -933,6 +933,7 @@ class WorldSession void HandleEjectPassenger(WorldPacket& data); void HandleEnterPlayerVehicle(WorldPacket& data); void HandleUpdateProjectilePosition(WorldPacket& recvPacket); + void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); private: void InitializeQueryCallbackParameters(); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e8675d52b2..f6cd5008b3 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -36,6 +36,8 @@ #include "CellImpl.h" #include "ScriptMgr.h" #include "Vehicle.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" class Aura; // diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 5281eb16f0..be92a86f95 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -53,6 +53,8 @@ #include "SpellScript.h" #include "InstanceScript.h" #include "SpellInfo.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS]; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index b6e9ee1651..d860530d97 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -77,6 +77,7 @@ #include "WardenCheckMgr.h" #include "Warden.h" #include "CalendarMgr.h" +#include "BattlefieldMgr.h" ACE_Atomic_Op World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index f0dbc3c84a..a6cdd4742f 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -164,6 +164,7 @@ enum WorldBoolConfigs CONFIG_QUEST_IGNORE_AUTO_ACCEPT, CONFIG_QUEST_IGNORE_AUTO_COMPLETE, CONFIG_WARDEN_ENABLED, + CONFIG_WINTERGRASP_ENABLE, BOOL_CONFIG_VALUE_COUNT }; @@ -318,6 +319,12 @@ enum WorldIntConfigs CONFIG_WARDEN_CLIENT_BAN_DURATION, CONFIG_WARDEN_NUM_MEM_CHECKS, CONFIG_WARDEN_NUM_OTHER_CHECKS, + CONFIG_WINTERGRASP_PLR_MAX, + CONFIG_WINTERGRASP_PLR_MIN, + CONFIG_WINTERGRASP_PLR_MIN_LVL, + CONFIG_WINTERGRASP_BATTLETIME, + CONFIG_WINTERGRASP_NOBATTLETIME, + CONFIG_WINTERGRASP_RESTART_AFTER_CRASH, INT_CONFIG_VALUE_COUNT }; diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 792fdeb3e7..f148ae2b3e 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -80,6 +80,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI ${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse + ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield + ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones ${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds ${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones ${CMAKE_SOURCE_DIR}/src/server/game/Calendar diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 3502e7fb10..dd8dd17c94 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -10,6 +10,7 @@ set(scripts_STAT_SRCS ${scripts_STAT_SRCS} + Northrend/wintergrasp.cpp Northrend/isle_of_conquest.cpp Northrend/storm_peaks.cpp Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 66a79a4be2..eba5b7f69d 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -21,6 +21,7 @@ #include "WorldSession.h" #include "ObjectMgr.h" #include "Vehicle.h" +#include "GameObjectAI.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." @@ -323,7 +324,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript uint32 _checkTimer; }; - GameObjectAI* GetAI(GameObject* go) const + GameObjectAI* GetGameObjectAI(GameObject* go) const { return new go_wg_vehicle_teleporterAI(go); } From 9a59dcb285d26bf9dc2724d95ab73e27f697ec07 Mon Sep 17 00:00:00 2001 From: Faq Date: Mon, 20 Aug 2012 23:35:44 +0300 Subject: [PATCH 142/147] Core/Questhandler: Fix qsharing. Thnx Chaplain for idea --- src/server/game/Handlers/QuestHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 7492edb35f..db18f2a01c 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -122,7 +122,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) // no or incorrect quest giver if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) || - (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId))) + (object->GetTypeId() == TYPEID_PLAYER && object != _player && !object->ToPlayer()->CanShareQuest(questId))) { _player->PlayerTalkClass->SendCloseGossip(); _player->SetDivider(0); @@ -582,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) continue; } - player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true); + player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true); player->SetDivider(_player->GetGUID()); } } From 16a0813c1b9871c53157bc1fc15612af578b2684 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 20 Aug 2012 22:48:26 +0200 Subject: [PATCH 143/147] Fix non PCH build --- src/server/game/Battlefield/Battlefield.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 217d6d62a2..5fa8d6b1bc 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -25,6 +25,7 @@ #include "WorldPacket.h" #include "GameObject.h" #include "Battleground.h" +#include "ObjectAccessor.h" enum BattlefieldTypes { From 9e0907874e3f461aa5650f7122af880301025b7f Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 20 Aug 2012 21:54:36 +0100 Subject: [PATCH 144/147] Core: Fix 4 warnings / SQL: Rename two SQL files --- ...ql => 2012_08_20_08_world_achievement_criteria_data.sql} | 0 ..._world_disables.sql => 2012_08_20_09_world_disables.sql} | 0 src/server/game/Battlefield/Zones/BattlefieldWG.cpp | 4 ++-- src/tools/vmap4_extractor/mpq_libmpq04.h | 6 +++--- 4 files changed, 5 insertions(+), 5 deletions(-) rename sql/updates/world/{2011_07_05_00_world_achievement_criteria_data.sql => 2012_08_20_08_world_achievement_criteria_data.sql} (100%) rename sql/updates/world/{2011_07_05_00_world_disables.sql => 2012_08_20_09_world_disables.sql} (100%) diff --git a/sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql b/sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql similarity index 100% rename from sql/updates/world/2011_07_05_00_world_achievement_criteria_data.sql rename to sql/updates/world/2012_08_20_08_world_achievement_criteria_data.sql diff --git a/sql/updates/world/2011_07_05_00_world_disables.sql b/sql/updates/world/2012_08_20_09_world_disables.sql similarity index 100% rename from sql/updates/world/2011_07_05_00_world_disables.sql rename to sql/updates/world/2012_08_20_09_world_disables.sql diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index c57f2bf059..48d6b59d00 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -574,7 +574,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } } -void BattlefieldWG::OnCreatureRemove(Creature* creature) +void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/) { /* possibly can be used later if (IsWarTime()) @@ -896,7 +896,7 @@ void BattlefieldWG::SendInitWorldStatesToAll() player->GetSession()->SendPacket(&data); } -void BattlefieldWG::BrokenWallOrTower(TeamId team) +void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/) { // might be some use for this in the future. old code commented out below. KL /* if (team == GetDefenderTeam()) diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h index ed51022de7..89f715e9e8 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq04.h +++ b/src/tools/vmap4_extractor/mpq_libmpq04.h @@ -24,7 +24,7 @@ public: void close(); void GetFileListTo(vector& filelist) { - uint32 filenum; + uint32_t filenum; if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; libmpq__off_t size, transferred; libmpq__file_unpacked_size(mpq_a, filenum, &size); @@ -60,8 +60,8 @@ class MPQFile libmpq__off_t pointer,size; // disable copying - MPQFile(const MPQFile &f) {} - void operator=(const MPQFile &f) {} + MPQFile(const MPQFile& /*f*/) {} + void operator=(const MPQFile& /*f*/) {} public: MPQFile(const char* filename); // filenames are not case sensitive From 9df6c4dd70a167fb8a52dd440bacf765609fcd6b Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 20 Aug 2012 23:12:31 +0200 Subject: [PATCH 145/147] Fix more non PCH build --- src/server/scripts/Northrend/wintergrasp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index eba5b7f69d..99152050a1 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -22,6 +22,7 @@ #include "ObjectMgr.h" #include "Vehicle.h" #include "GameObjectAI.h" +#include "ScriptedGossip.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." From d11e71b098740d1a14b60f380cde13600b7ae564 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 20 Aug 2012 23:37:33 +0200 Subject: [PATCH 146/147] Fix more non PCH build and code style --- src/server/game/Battlefield/Zones/BattlefieldWG.h | 8 +++++--- src/server/scripts/Northrend/wintergrasp.cpp | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 738d82135d..97807eb989 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -171,7 +171,7 @@ enum WGGraveyardId BATTLEFIELD_WG_GRAVEYARD_MAX, }; -enum eWGGossipText +enum WGGossipText { BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, @@ -231,12 +231,14 @@ struct BfWGCoordGY TeamId startcontrol; }; -const uint32 WGQuest[2][6] = { +uint32 const WGQuest[2][6] = +{ { 13186, 13181, 13222, 13538, 13177, 13179 }, { 13185, 13183, 13223, 13539, 13178, 13180 }, }; // 7 in sql, 7 in header -const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = { +BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = +{ { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL }, diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 99152050a1..37994e40b6 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -22,14 +22,16 @@ #include "ObjectMgr.h" #include "Vehicle.h" #include "GameObjectAI.h" +#include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "SpellScript.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." #define GOSSIP_HELLO_DEMO3 "Build siege engine." #define GOSSIP_HELLO_DEMO4 "I cannot build more!" -enum eWGqueuenpctext +enum WGqueuenpctext { WG_NPCQUEUE_TEXT_H_NOWAR = 14775, WG_NPCQUEUE_TEXT_H_QUEUE = 14790, @@ -99,7 +101,8 @@ enum QuestIds uint8 const MAX_WINTERGRASP_VEHICLES = 4; -uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = { +uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = +{ NPC_WINTERGRASP_CATAPULT, NPC_WINTERGRASP_DEMOLISHER, NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE, @@ -136,7 +139,7 @@ class npc_wg_demolisher_engineer : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */, uint32 action) { player->CLOSE_GOSSIP_MENU(); From 542521a026031764ddd98518e7f5bdab91bc0ebb Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 20 Aug 2012 23:42:33 +0100 Subject: [PATCH 147/147] Scripts/Achievements: Remove a duplicated achievement script --- .../scripts/World/achievement_scripts.cpp | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index 3dc737f0c9..60572ee3e6 100755 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -235,30 +235,6 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript } }; -class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript -{ -public: - achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { } - - bool OnCheck(Player* source, Unit* target) - { - if (!target) - return false; - - if (Player* victim = target->ToPlayer()) - { - if (!victim->IsMounted()) - return false; - - if (Vehicle* vehicle = source->GetVehicle()) - if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon - return true; - } - - return false; - } -}; - class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript { public: @@ -344,7 +320,6 @@ void AddSC_achievement_scripts() new achievement_bg_ic_mowed_down(); new achievement_bg_sa_artillery(); new achievement_sickly_gazelle(); - new achievement_wg_didnt_stand_a_chance(); new achievement_everything_counts(); new achievement_bg_av_perfection(); new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2);