aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond B Krokli <tkrokli@gmail.com>2016-05-02 22:22:17 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2016-05-02 22:22:17 +0200
commitd82534a7bbd401f4b672786749f10f5a95f6e76c (patch)
tree6521f90f0608e00c181d4d23ad179570dbc28687
parent9064968a4dee9413abe8a480cf1c6984b28721d2 (diff)
Core/Scripts/DB: remove hardcoded text from npc_beaten_corpse (#16907)
- remove hardcoded text from script npc_beaten_corpse - remove OnGossipHello() hook, gossip text moved to DB - use sGossipSelect() hook instead of OnGossipSelect() - add npc_text 3557 and 3558 as text_id to gossip_menu - add gossip_menu_option 2871 to NPC 10668 Beaten Corpse - add condition for gossip_menu_option 2871 in Quest ID 4921 Tested on 4 different characters/classes, male & female. Thanks to joschiwald for the sGossipSelect() script change.
-rw-r--r--sql/updates/world/3.3.5/2016_05_02_01_world.sql18
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp43
2 files changed, 39 insertions, 22 deletions
diff --git a/sql/updates/world/3.3.5/2016_05_02_01_world.sql b/sql/updates/world/3.3.5/2016_05_02_01_world.sql
new file mode 100644
index 00000000000..1671abee38f
--- /dev/null
+++ b/sql/updates/world/3.3.5/2016_05_02_01_world.sql
@@ -0,0 +1,18 @@
+-- Beaten Corpse (Mankrik's wife) in quest 4921 "Lost in Battle":
+UPDATE `creature_template` SET `gossip_menu_id`= 2871 WHERE `entry`= 10668;
+
+-- new gossip_menu.entry for creature 10668 (Beaten Corpse):
+DELETE FROM `gossip_menu` WHERE `entry` IN (2871,2872) AND `text_id` IN (3557,3558);
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
+(2871, 3557),
+(2872, 3558);
+
+-- new gossip_menu_option for creature 10668 (Beaten Corpse):
+DELETE FROM `gossip_menu_option` WHERE `menu_id`= 2871 AND `OptionBroadcastTextID`= 5964;
+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
+(2871, 0, 0, 'I inspect the body further.', 5964, 1, 1, 2872, 0, 0, 0, '', 0);
+
+-- condition for gossip_menu_option 2871 in Quest ID 4921 "Lost in Battle":
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 15 AND `SourceGroup`= 2871;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15, 2871,0, 0,0, 9,0, 4921, 0,0,0,0,0, '', 'Show gossip menu option 2871 only if Quest 4921 is taken (active)');
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index b113615ca50..7a963d066b6 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -43,38 +43,37 @@ EndContentData */
## npc_beaten_corpse
######*/
-#define GOSSIP_CORPSE "Examine corpse in detail..."
-
enum BeatenCorpse
{
- QUEST_LOST_IN_BATTLE = 4921
+ GOSSIP_OPTION_ID_BEATEN_CORPSE = 0,
+ GOSSIP_MENU_OPTION_INSPECT_BODY = 2871
};
class npc_beaten_corpse : public CreatureScript
{
-public:
- npc_beaten_corpse() : CreatureScript("npc_beaten_corpse") { }
+ public:
+ npc_beaten_corpse() : CreatureScript("npc_beaten_corpse") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- player->PlayerTalkClass->ClearMenus();
- if (action == GOSSIP_ACTION_INFO_DEF +1)
+ struct npc_beaten_corpseAI : public ScriptedAI
{
- player->SEND_GOSSIP_MENU(3558, creature->GetGUID());
- player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ npc_beaten_corpseAI(Creature* creature) : ScriptedAI(creature)
+ {
+ }
- player->SEND_GOSSIP_MENU(3557, creature->GetGUID());
- return true;
- }
+ void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
+ {
+ if (menuId == GOSSIP_MENU_OPTION_INSPECT_BODY && gossipListId == GOSSIP_OPTION_ID_BEATEN_CORPSE)
+ {
+ player->CLOSE_GOSSIP_MENU();
+ player->TalkedToCreature(me->GetEntry(), me->GetGUID());
+ }
+ }
+ };
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_beaten_corpseAI(creature);
+ }
};
/*######