Core/Scripts: move npc_tirion_fordring to DB/SAI

This removes the current core script npc_tirion_fordring
and replaces it with database entries in:

- `conditions` 9 (quest taken) + 41 (unit_state)
- `gossip_menu_option` (3502,3681,3682,3683)
- `smart_scripts` (SmartAI)

Gossip text / `npc_text` is already in the database.

Closes  #16430 (my old attempt at removing hardcoded text)
This commit is contained in:
tkrokli
2016-02-25 20:06:16 +01:00
parent b6720af4cb
commit 7c9a26c608
2 changed files with 26 additions and 56 deletions

View File

@@ -0,0 +1,25 @@
-- new gossip_menus for Quest 5742 Redemption (Tirion's Tale)
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (3502,3681,3682,3683) AND `id` = 0;
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
(3502, 0,0, 'I am ready to hear your tale, Tirion.', 7219, 1,1, 3681, 0,0,0,'',0),
(3681, 0,0, 'Thank you, Tirion. What of your identity?', 7221, 1,1, 3682, 0,0,0,'',0),
(3682, 0,0, 'That is terrible.', 7223, 1,1, 3683, 0,0,0,'',0),
(3683, 0,0, 'I will, Tirion.', 7225, 1,1, 0, 0,0,0,'',0);
-- update creature entry 1855 Tirion Fordring
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName`= '' WHERE `entry` = 1855;
-- SmartAI script actions for Quest 5742 Redemption (Tirion's Tale)
DELETE FROM `smart_scripts` WHERE `entryorguid`= 1855 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
(1855,0, 0,0, 62, 0,100,0, 3502, 0,0,0, 98, 3681, 4493, 0,0,0,0, 7,0,0,0,0,0,0,0, 'Tirion Fordring - on gossip_menu 3502 selected - Send Gossip text 4493 with menu option 3681'),
(1855,0, 1,0, 62, 0,100,0, 3681, 0,0,0, 98, 3682, 4494, 0,0,0,0, 7,0,0,0,0,0,0,0, 'Tirion Fordring - on gossip_menu 3681 selected - Send Gossip text 4494 with menu option 3682'),
(1855,0, 2,0, 62, 0,100,0, 3682, 0,0,0, 98, 3683, 4495, 0,0,0,0, 7,0,0,0,0,0,0,0, 'Tirion Fordring - on gossip_menu 3682 selected - Send Gossip text 4495 with menu option 3683'),
(1855,0, 3,4, 62, 0,100,0, 3683, 0,0,0, 15, 5742, 0, 0,0,0,0, 7,0,0,0,0,0,0,0, 'Tirion Fordring - on gossip_menu 3683 selected - Give credit for Quest 5742 Redemption'),
(1855,0, 4,0, 61, 0,100,0, 0, 0,0,0, 72, 0, 0, 0,0,0,0, 7,0,0,0,0,0,0,0, 'Tirion Fordring - on gossip_menu 3683 selected - Close Gossip');
-- conditions for Quest 5742 Redemption (Tirion's Tale)
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 15 AND `SourceGroup`= 3502;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(15, 3502,0, 0,1, 9,0, 5742, 0,0,0,0,0, '', 'Show gossip menu option 3502 only if Quest 5742 is taken (active)'),
(15, 3502,0, 0,1, 41,0, 1, 1,0,0,0,0, '', 'Show gossip menu option 3502 only if player is sitting (any type)');

View File

@@ -19,7 +19,7 @@
/* ScriptData
SDName: Eastern_Plaguelands
SD%Complete: 100
SDComment: Quest support: 5211, 5742. Special vendor Augustus the Touched
SDComment: Quest support: 5211. Special vendor Augustus the Touched
SDCategory: Eastern Plaguelands
EndScriptData */
@@ -27,7 +27,6 @@ EndScriptData */
npc_ghoul_flayer
npc_augustus_the_touched
npc_darrowshire_spirit
npc_tirion_fordring
EndContentData */
#include "ScriptMgr.h"
@@ -133,63 +132,9 @@ public:
};
};
/*######
## npc_tirion_fordring
######*/
#define GOSSIP_HELLO "I am ready to hear your tale, Tirion."
#define GOSSIP_SELECT1 "Thank you, Tirion. What of your identity?"
#define GOSSIP_SELECT2 "That is terrible."
#define GOSSIP_SELECT3 "I will, Tirion."
class npc_tirion_fordring : public CreatureScript
{
public:
npc_tirion_fordring() : CreatureScript("npc_tirion_fordring") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
case GOSSIP_ACTION_INFO_DEF+1:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->SEND_GOSSIP_MENU(4493, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
player->SEND_GOSSIP_MENU(4494, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
player->SEND_GOSSIP_MENU(4495, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->CLOSE_GOSSIP_MENU();
player->AreaExploredOrEventHappens(5742);
break;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (player->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && player->getStandState() == UNIT_STAND_STATE_SIT)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
};
void AddSC_eastern_plaguelands()
{
new npc_ghoul_flayer();
new npc_augustus_the_touched();
new npc_darrowshire_spirit();
new npc_tirion_fordring();
}