aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkrokli <tkrokli@gmail.com>2016-06-12 08:36:42 +0200
committerAokromes <Aokromes@users.noreply.github.com>2016-06-12 08:36:42 +0200
commitd6f0e74cdba9c21e8fc506ecf06d0f3c4fc9b19a (patch)
tree90fcca057d9dc7aff5a26e67f1ec70503234c9a9
parente607b3995988b9d3bf0504e187999ca8dce33979 (diff)
Core/Scripts: move script 'npc_plucky' to DB/SAI (#17071)
1 more text line removed in the ongoing series: "Remove hardcoded text from core scripts". Core script for "Plucky" Johnson : - move the actual gossip handling to DB - create new gossip_menu_option entry - link the option to gossip_menu.text_id - add correct default gossip to the NPC - create SAI script with alternate emotes - add condition check for quest taken - remove the script from zone script - extra enum cleanup in zone script
-rw-r--r--sql/updates/world/3.3.5/2016_05_31_16_world.sql33
-rw-r--r--src/server/scripts/Kalimdor/zone_thousand_needles.cpp183
2 files changed, 59 insertions, 157 deletions
diff --git a/sql/updates/world/3.3.5/2016_05_31_16_world.sql b/sql/updates/world/3.3.5/2016_05_31_16_world.sql
new file mode 100644
index 00000000000..82adc269298
--- /dev/null
+++ b/sql/updates/world/3.3.5/2016_05_31_16_world.sql
@@ -0,0 +1,33 @@
+-- "Plucky" Johnson (Magus Tirth's assistant) in quest 1950 "Get the Scoop":
+SET @CHICKEN := 6626;
+SET @HUMAN := 6666;
+
+UPDATE `creature_template` SET `gossip_menu_id`= 231, `AIName`= 'SmartAI' WHERE `entry`= @HUMAN;
+UPDATE `creature_template` SET `AIName`= 'SmartAI', `ScriptName`= '' WHERE `entry`= @CHICKEN;
+
+DELETE FROM `gossip_menu` WHERE `entry` IN (231,232) AND `text_id` IN (720,738);
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
+(231, 720),
+(232, 738);
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id`= 231 AND `OptionBroadcastTextID`= 2707;
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`OptionBroadcastTextID`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`,`BoxBroadcastTextID`) VALUES
+(231, 0, 0, "Tell me the phrase to Tirth's lockbox.", 2707, 1, 1, 232, 0, 0, 0, '', 0);
+
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@CHICKEN,@HUMAN) AND `source_type`= 0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@CHICKEN,0,0,1,22,0,100,0, 22,0,0,0,11, 9192, 2,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 22 - Cast "Plucky" Resumes Human Form'),
+(@CHICKEN,0,1,2,61,0,100,0, 0,0,0,0, 3, @HUMAN,6194,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 22 - Morph To Creature "Plucky" Johnson\'s Human Form'),
+(@CHICKEN,0,2,3,61,0,100,0, 0,0,0,0, 5, 3, 0,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 22 - Play Emote 3'),
+(@CHICKEN,0,3,4,61,0,100,0, 0,0,0,0,11, 9220, 0,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 22 - Cast "Plucky" Resumes Chicken Form'),
+(@CHICKEN,0,4,0,61,0,100,0, 0,0,0,0, 3,@CHICKEN,5369,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 22 - Morph To Creature "Plucky" Johnson'),
+(@CHICKEN,0,5,6,22,0,100,0, 7,0,0,0,11, 9192, 2,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 7 - Cast "Plucky" Resumes Human Form'),
+(@CHICKEN,0,6,7,61,0,100,0, 0,0,0,0, 3, @HUMAN,6194,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 7 - Morph To Creature "Plucky" Johnson\'s Human Form'),
+(@CHICKEN,0,7,8,61,0,100,0, 0,0,0,0,82, 1, 0,0,0,0,0,1,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 7 - Add Npc Flags Gossip'),
+(@CHICKEN,0,8,0,61,0,100,0, 0,0,0,0,69, 0, 0,0,0,0,0,7,0,0,0,0,0,0,'"Plucky" Johnson - Received Emote 7 - Move To Invoker'),
+(@HUMAN, 0,0,1,62,0,100,0,231,0,0,0,72, 0, 0,0,0,0,0,7,0,0,0,0,0,0,'"Plucky" Johnson\'s Human Form - On Gossip Option 0 Selected - Close Gossip'),
+(@HUMAN, 0,1,0,61,0,100,0, 0,0,0,0,15, 1950, 0,0,0,0,0,7,0,0,0,0,0,0,'"Plucky" Johnson\'s Human Form - On Gossip Option 0 Selected - Credit Quest 1950');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 15 AND `SourceGroup`= 231;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,231,0, 0,0,9,0,1950,0,0,0,0,0,'', 'Show gossip menu option 231 only if Quest 1950 is taken (active)');
diff --git a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
index 85c3a621239..44d850621f1 100644
--- a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
@@ -19,7 +19,7 @@
/* ScriptData
SDName: Thousand Needles
SD%Complete: 100
-SDComment: Support for Quest: 1950, 4770, 4904, 4966, 5151.
+SDComment: Support for Quest: 4770, 4904, 4966, 5151.
SDCategory: Thousand Needles
EndScriptData */
@@ -27,7 +27,6 @@ EndScriptData */
npc_kanati
npc_lakota_windsong
npc_swiftmountain
-npc_plucky
npc_enraged_panther
go_panther_cage
EndContentData */
@@ -44,10 +43,9 @@ EndContentData */
enum Kanati
{
- SAY_KAN_START = 0,
-
- QUEST_PROTECT_KANATI = 4966,
- NPC_GALAK_ASS = 10720
+ SAY_KAN_START = 0,
+ QUEST_PROTECT_KANATI = 4966,
+ NPC_GALAK_ASS = 10720
};
Position const GalakLoc = {-4867.387695f, -1357.353760f, -48.226f, 0.0f};
@@ -112,19 +110,19 @@ public:
enum Lakota
{
- SAY_LAKO_START = 0,
- SAY_LAKO_LOOK_OUT = 1,
- SAY_LAKO_HERE_COME = 2,
- SAY_LAKO_MORE = 3,
- SAY_LAKO_END = 4,
-
- QUEST_FREE_AT_LAST = 4904,
- NPC_GRIM_BANDIT = 10758,
- FACTION_ESCORTEE_LAKO = 232, //guessed
-
- ID_AMBUSH_1 = 0,
- ID_AMBUSH_2 = 2,
- ID_AMBUSH_3 = 4
+ SAY_LAKO_START = 0,
+ SAY_LAKO_LOOK_OUT = 1,
+ SAY_LAKO_HERE_COME = 2,
+ SAY_LAKO_MORE = 3,
+ SAY_LAKO_END = 4,
+
+ QUEST_FREE_AT_LAST = 4904,
+ NPC_GRIM_BANDIT = 10758,
+ FACTION_ESCORTEE_LAKO = 232, //guessed
+
+ ID_AMBUSH_1 = 0,
+ ID_AMBUSH_2 = 2,
+ ID_AMBUSH_3 = 4
};
Position const BanditLoc[6] =
@@ -195,7 +193,6 @@ public:
me->SummonCreature(NPC_GRIM_BANDIT, BanditLoc[i+AmbushId], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
}
};
-
};
/*######
@@ -204,13 +201,13 @@ public:
enum Packa
{
- SAY_START = 0,
- SAY_WYVERN = 1,
- SAY_COMPLETE = 2,
+ SAY_START = 0,
+ SAY_WYVERN = 1,
+ SAY_COMPLETE = 2,
- QUEST_HOMEWARD = 4770,
- NPC_WYVERN = 4107,
- FACTION_ESCORTEE = 232 //guessed
+ QUEST_HOMEWARD = 4770,
+ NPC_WYVERN = 4107,
+ FACTION_ESCORTEE = 232 //guessed
};
Position const WyvernLoc[3] =
@@ -275,137 +272,10 @@ public:
};
};
-/*#####
-# npc_plucky
-######*/
-
-#define GOSSIP_P "Please tell me the Phrase.."
-
-enum Plucky
-{
- FACTION_FRIENDLY = 35,
- QUEST_SCOOP = 1950,
- SPELL_PLUCKY_HUMAN = 9192,
- SPELL_PLUCKY_CHICKEN = 9220
-};
-
-class npc_plucky : public CreatureScript
-{
-public:
- npc_plucky() : CreatureScript("npc_plucky") { }
-
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- player->CLOSE_GOSSIP_MENU();
- player->CompleteQuest(QUEST_SCOOP);
- break;
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
-
- player->SEND_GOSSIP_MENU(738, creature->GetGUID());
-
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_pluckyAI(creature);
- }
-
- struct npc_pluckyAI : public ScriptedAI
- {
- npc_pluckyAI(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- NormFaction = creature->getFaction();
- }
-
- void Initialize()
- {
- ResetTimer = 120000;
- }
-
- uint32 NormFaction;
- uint32 ResetTimer;
-
- void Reset() override
- {
- Initialize();
-
- if (me->getFaction() != NormFaction)
- me->setFaction(NormFaction);
-
- if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
- me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
-
- DoCast(me, SPELL_PLUCKY_CHICKEN, false);
- }
-
- void ReceiveEmote(Player* player, uint32 TextEmote) override
- {
- if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE)
- {
- if (TextEmote == TEXT_EMOTE_BECKON)
- {
- me->setFaction(FACTION_FRIENDLY);
- me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- DoCast(me, SPELL_PLUCKY_HUMAN, false);
- }
- }
-
- if (TextEmote == TEXT_EMOTE_CHICKEN)
- {
- if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
- return;
- else
- {
- me->setFaction(FACTION_FRIENDLY);
- me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- DoCast(me, SPELL_PLUCKY_HUMAN, false);
- me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);
- }
- }
- }
-
- void UpdateAI(uint32 Diff) override
- {
- if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
- {
- if (ResetTimer <= Diff)
- {
- if (!me->GetVictim())
- EnterEvadeMode();
- else
- me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
-
- return;
- }
- else
- ResetTimer -= Diff;
- }
-
- if (!UpdateVictim())
- return;
-
- DoMeleeAttackIfReady();
- }
- };
-
-};
-
enum PantherCage
{
- ENRAGED_PANTHER = 10992
+ QUEST_HYPERCAPACITOR_GIZMO = 5151,
+ ENRAGED_PANTHER = 10992
};
class go_panther_cage : public GameObjectScript
@@ -416,7 +286,7 @@ public:
bool OnGossipHello(Player* player, GameObject* go) override
{
go->UseDoorOrButton();
- if (player->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_HYPERCAPACITOR_GIZMO) == QUEST_STATUS_INCOMPLETE)
{
if (Creature* panther = go->FindNearestCreature(ENRAGED_PANTHER, 5, true))
{
@@ -466,7 +336,6 @@ void AddSC_thousand_needles()
new npc_kanati();
new npc_lakota_windsong();
new npc_paoka_swiftmountain();
- new npc_plucky();
new npc_enraged_panther();
new go_panther_cage();
}