mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 00:48:39 +01:00
Core/PacketIO: Implemented CMSG_CONVERSATION_LINE_STARTED (#27036)
* Added OnConversationLineStarted hook to ConversationScripts * Added example for Defender of Azeroth conversation
This commit is contained in:
@@ -15,6 +15,41 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Conversation.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
|
||||
class conversation_allied_race_dk_defender_of_azeroth : public ConversationScript
|
||||
{
|
||||
public:
|
||||
enum DefenderOfAzerothIds : uint32
|
||||
{
|
||||
NPC_TALK_TO_YOUR_COMMANDER_CREDIT = 161709,
|
||||
NPC_LISTEN_TO_YOUR_COMMANDER_CREDIT = 163027,
|
||||
|
||||
CONVERSATION_LINE_PLAYER = 32926
|
||||
};
|
||||
|
||||
conversation_allied_race_dk_defender_of_azeroth() : ConversationScript("conversation_allied_race_dk_defender_of_azeroth") { }
|
||||
|
||||
void OnConversationCreate(Conversation* conversation, Unit* creator) override
|
||||
{
|
||||
conversation->AddActor(ObjectGuid::Create<HighGuid::Player>(0xFFFFFFFFFFFFFFFF), 1);
|
||||
if (Player* player = creator->ToPlayer())
|
||||
player->KilledMonsterCredit(NPC_TALK_TO_YOUR_COMMANDER_CREDIT);
|
||||
}
|
||||
|
||||
void OnConversationLineStarted(Conversation* /*conversation*/, uint32 lineId, Player* sender) override
|
||||
{
|
||||
if (lineId != CONVERSATION_LINE_PLAYER)
|
||||
return;
|
||||
|
||||
sender->KilledMonsterCredit(NPC_LISTEN_TO_YOUR_COMMANDER_CREDIT);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_conversation_scripts()
|
||||
{
|
||||
new conversation_allied_race_dk_defender_of_azeroth();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user