Scripts/Draenor: Implement script for quest 34586 (Establish your Garrison) (#28057)

Co-authored-by: Naddley <64811442+Naddley@users.noreply.github.com>
This commit is contained in:
Aqua Deus
2022-08-22 22:17:42 +02:00
committed by GitHub
parent 889ea0eed4
commit bccfc203c0
3 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
UPDATE `creature_template` SET `scriptname` = 'npc_baros_alexston' WHERE `entry` = 79243;
UPDATE `gossip_menu_option` SET `OptionType`=1, `OptionNpcFlag`=1 WHERE `MenuID`=16871 AND `OptionID`=0;
-- TerrainSwap
DELETE FROM `terrain_swap_defaults` WHERE (`MapId` = 1116 AND `TerrainSwapMap` = 1158);
INSERT INTO `terrain_swap_defaults` (`MapId`, `TerrainSwapMap`, `Comment`) VALUES
(1116, 1158, 'SMV Alliance Garrison Level 1');
-- Condition
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 25 AND `SourceGroup` = 0 AND `SourceEntry` = 1158) OR (`SourceTypeOrReferenceId` = 13 AND `SourceGroup` = 1 AND `SourceEntry` = 160938) OR (`SourceTypeOrReferenceId`=15 AND `SourceGroup`=16871 AND `SourceEntry`=0 AND `SourceId`=0);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES
(25, 0, 1158, 0, 0, 47, 0, 36797, 66, 0, 0, 'TerrainSwap to 1158 if Quest: 36797 is complete/rewarded'),
(13, 1, 160938, 0, 0, 31, 0, 3, 79655, 0, 0, 'Spell "Despawn All Summons (Garrison Intro Only) can hit Vindicator Maraad'),
(13, 1, 160938, 0, 1, 31, 0, 3, 79635, 0, 0, 'Spell "Despawn All Summons (Garrison Intro Only) can hit Prophet Velen'),
(13, 1, 160938, 0, 2, 31, 0, 3, 79656, 0, 0, 'Spell "Despawn All Summons (Garrison Intro Only) can hit Yrel'),
(15, 16871, 0, 0, 0, 47, 0, 34586, 8, 0, 0, 'Show gossip option if player has Establish Your Garrison (34586) in state incomplete');
-- Hidden Tracker Quest
DELETE FROM `quest_template` WHERE `ID` = 36797;
INSERT INTO `quest_template` (`ID`, `QuestType`, `QuestPackageID`, `ContentTuningID`, `QuestSortID`, `QuestInfoID`, `SuggestedGroupNum`, `RewardNextQuest`, `RewardXPDifficulty`, `RewardXPMultiplier`, `RewardMoneyDifficulty`, `RewardMoneyMultiplier`, `RewardBonusMoney`, `RewardDisplaySpell1`, `RewardDisplaySpell2`, `RewardDisplaySpell3`, `RewardSpell`, `RewardHonor`, `RewardKillHonor`, `StartItem`, `RewardArtifactXPDifficulty`, `RewardArtifactXPMultiplier`, `RewardArtifactCategoryID`, `Flags`, `FlagsEx`, `FlagsEx2`, `RewardItem1`, `RewardAmount1`, `RewardItem2`, `RewardAmount2`, `RewardItem3`, `RewardAmount3`, `RewardItem4`, `RewardAmount4`, `ItemDrop1`, `ItemDropQuantity1`, `ItemDrop2`, `ItemDropQuantity2`, `ItemDrop3`, `ItemDropQuantity3`, `ItemDrop4`, `ItemDropQuantity4`, `RewardChoiceItemID1`, `RewardChoiceItemQuantity1`, `RewardChoiceItemDisplayID1`, `RewardChoiceItemID2`, `RewardChoiceItemQuantity2`, `RewardChoiceItemDisplayID2`, `RewardChoiceItemID3`, `RewardChoiceItemQuantity3`, `RewardChoiceItemDisplayID3`, `RewardChoiceItemID4`, `RewardChoiceItemQuantity4`, `RewardChoiceItemDisplayID4`, `RewardChoiceItemID5`, `RewardChoiceItemQuantity5`, `RewardChoiceItemDisplayID5`, `RewardChoiceItemID6`, `RewardChoiceItemQuantity6`, `RewardChoiceItemDisplayID6`, `POIContinent`, `POIx`, `POIy`, `POIPriority`, `RewardTitle`, `RewardArenaPoints`, `RewardSkillLineID`, `RewardNumSkillUps`, `PortraitGiver`, `PortraitGiverMount`, `PortraitGiverModelSceneID`, `PortraitTurnIn`, `RewardFactionID1`, `RewardFactionValue1`, `RewardFactionOverride1`, `RewardFactionCapIn1`, `RewardFactionID2`, `RewardFactionValue2`, `RewardFactionOverride2`, `RewardFactionCapIn2`, `RewardFactionID3`, `RewardFactionValue3`, `RewardFactionOverride3`, `RewardFactionCapIn3`, `RewardFactionID4`, `RewardFactionValue4`, `RewardFactionOverride4`, `RewardFactionCapIn4`, `RewardFactionID5`, `RewardFactionValue5`, `RewardFactionOverride5`, `RewardFactionCapIn5`, `RewardFactionFlags`, `RewardCurrencyID1`, `RewardCurrencyQty1`, `RewardCurrencyID2`, `RewardCurrencyQty2`, `RewardCurrencyID3`, `RewardCurrencyQty3`, `RewardCurrencyID4`, `RewardCurrencyQty4`, `AcceptedSoundKitID`, `CompleteSoundKitID`, `AreaGroupID`, `TimeAllowed`, `AllowableRaces`, `TreasurePickerID`, `Expansion`, `ManagedWorldStateID`, `QuestSessionBonus`, `LogTitle`, `LogDescription`, `QuestDescription`, `AreaDescription`, `PortraitGiverText`, `PortraitGiverName`, `PortraitTurnInText`, `PortraitTurnInName`, `QuestCompletionLog`, `VerifiedBuild`) VALUES
(36797, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, (0x00000400), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '[Hidden Tracker] Founded Garrison', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0);
DELETE FROM `spell_script_names` WHERE `spell_id`= 160938;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(160938, 'spell_despawn_all_summons_garrison_intro_only');
DELETE FROM `creature_text` WHERE `CreatureID` = 79243;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(79243, 0, 0, 'Let me know when you are ready to start construction, commander.', 12, 0, 100, 1, 0, 0, 81887, 5, 'Baros Alexston to Player - On Quest Accept 34586');

View File

@@ -0,0 +1,26 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* 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 <http://www.gnu.org/licenses/>.
*/
// This is where scripts' loading functions should be declared:
void AddSC_draenor_shadowmoon_valley();
// The name of this function should match:
// void Add${NameOfDirectory}Scripts()
void AddDraenorScripts()
{
AddSC_draenor_shadowmoon_valley();
}

View File

@@ -0,0 +1,97 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "PhasingHandler.h"
#include "Player.h"
#include "QuestDef.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
// 79243 - Baros Alexston
enum BarosAlexstonMisc
{
// Quest
QUEST_ESTABLISH_YOUR_GARRISON = 34586,
// Gossip
GOSSIP_OPTION_ESTABLISH_GARRISON = 0,
// Text
SAY_START_CONSTRUCTION = 0,
// Spells
SPELL_QUEST_34586_KILLCREDIT = 161033,
SPELL_CREATE_GARRISON_SHADOWMOON_VALLEY_ALLIANCE = 156020,
SPELL_DESPAWN_ALL_SUMMONS_GARRISON_INTRO_ONLY = 160938
};
Position const GarrisonLevelOneCreationPlayerPosition = { 1904.58f, 312.906f, 88.9542f, 4.303615f };
struct npc_baros_alexston : public ScriptedAI
{
npc_baros_alexston(Creature* creature) : ScriptedAI(creature) { }
bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
if (gossipListId == GOSSIP_OPTION_ESTABLISH_GARRISON)
{
CloseGossipMenuFor(player);
player->CastSpell(player, SPELL_QUEST_34586_KILLCREDIT, true);
player->CastSpell(player, SPELL_CREATE_GARRISON_SHADOWMOON_VALLEY_ALLIANCE, true);
player->CastSpell(player, SPELL_DESPAWN_ALL_SUMMONS_GARRISON_INTRO_ONLY, true);
player->NearTeleportTo(GarrisonLevelOneCreationPlayerPosition);
PhasingHandler::OnConditionChange(player);
}
return true;
}
void OnQuestAccept(Player* player , Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_ESTABLISH_YOUR_GARRISON)
Talk(SAY_START_CONSTRUCTION, player);
}
};
// 160938 - Despawn All Summons (Garrison Intro Only)
class spell_despawn_all_summons_garrison_intro_only : public SpellScript
{
PrepareSpellScript(spell_despawn_all_summons_garrison_intro_only);
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Creature* hitCreature = GetHitCreature())
{
if (hitCreature->GetOwner() == GetCaster())
hitCreature->DespawnOrUnsummon();
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_despawn_all_summons_garrison_intro_only::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_draenor_shadowmoon_valley()
{
RegisterCreatureAI(npc_baros_alexston);
RegisterSpellScript(spell_despawn_all_summons_garrison_intro_only);
};