View difference between Paste ID: jQ0a7KyW and CDLDyrvP
SHOW: | | - or go back to the newest paste.
1
#include "ScriptPCH.h"
2
3-
enum eTexts
3+
4
{
5-
	TEXT_ON_DANCE = -1700004,
5+
6-
	TEXT_ON_SALUTE = -1700005,
6+
    levelnpc_teleporter() : CreatureScript("levelnpc_teleporter") { } // levelnpc_teleporter is the scriptname to put to DB to the scriptname column
7-
	TEXT_ON_SPIT = -1700006,
7+
8-
	TEXT_ON_LAUGH = -1700007,
8+
    bool OnGossipHello(Player* pPlayer, Creature* pCreature) // when the player opens the gossip menu
9-
	TEXT_ON_BYE = -1700008
9+
10
        if (pPlayer->isInCombat()) // check combat
11
        {
12-
enum eRidingSkills
12+
            pPlayer->GetSession()->SendNotification("You are in combat"); // send a red areatriggermessage
13
            return false; // this causes the function to stop executing further and returns false value, which prevents any further gossip
14-
	RIDING_APPRENTICE = 33388,
14+
15-
	RIDING_JOURNEYMAN = 33391,
15+
        // if not in combat :
16-
	RIDING_EXPERT = 34090,
16+
        pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport somewhere", GOSSIP_SENDER_MAIN, 1); // GOSSIP_SENDER_MAIN is basically just a number, which is the uiSender in OnGossipSelect function, you can ignore it in simple teleporters
17-
	RIDING_ARTISAN = 34091,
17+
        pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go to raids submenu", GOSSIP_SENDER_MAIN, 2); // 1, 2 are the intids, but in here we call them uiAction
18-
	COLD_WEATHER_FLYING = 54197
18+
        pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); // This sends the options to the player. 907 is the entry of the npc_text row (text at the top of the menu)
19
        return true; // it is a bool function, we must return true or false. Returning false should prevent all further gossip
20
    }
21-
enum eEmblems
21+
22
    bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
23-
	EMBLEM_OF_FROST = 49426,
23+
24-
	EMBLEM_OF_TRIUMPH = 47241,
24+
        pPlayer->PlayerTalkClass->ClearMenus();
25-
	EMBLEM_OF_VALOR = 40753,
25+
26-
	EMBLEM_OF_CONQUEST = 45624,
26+
        switch (uiAction) // google switch :3, its like IF END IF END, but not quite.
27-
	EMBLEM_OF_HEROISM = 40752
27+
28
        case 1: // intid 1
29
            {
30
                pPlayer->TeleportTo(1, 4620.84f, -3847.99f, 943.92f, 1.0814f); // map, x, y, z, orientation All float (decimal) values need an f after them: 1.5f
31
            } break; // stop here, do not execute other cases
32
        case 2: // intid 2
33-
	levelnpc_teleporter()
33+
            {
34-
		: CreatureScript("levelnpc_teleporter")
34+
                pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport somewhere", GOSSIP_SENDER_MAIN, 3); // GOSSIP_SENDER_MAIN is basically just a number, which is the uiSender in OnGossipSelect function, you can ignore it in simple teleporters
35-
	{
35+
                pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Back..", GOSSIP_SENDER_MAIN, 4); // 1, 2 are the intids, but in here we call them uiAction
36-
	}
36+
                pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); // This sends the options to the player. 907 is the entry of the npc_text row (text at the top of the menu)
37
                return true; // prevent the code for going to the close gossip menu. It would just close our newly created gossip menu :(
38-
	struct levelnpc_teleporterAI : public ScriptedAI
38+
            } break; // stop here, do not execute other cases
39-
	{
39+
        case 3: // intid 3
40-
		levelnpc_teleporterAI(Creature *c) : ScriptedAI(c)
40+
            {
41-
		{
41+
                pPlayer->TeleportTo(1, 4620.84f, -3847.99f, 943.92f, 1.0814f); // map, x, y, z, orientation All float (decimal) values need an f after them: 1.5f
42-
		}
42+
            } break; // stop here, do not execute other cases
43
        case 4: // intid 4
44-
		void Reset()
44+
            {
45-
		{
45+
                // this shows the OnGossipHello menu (main menu)
46-
			me->RestoreFaction();
46+
                OnGossipHello(pPlayer, pCreature);
47-
		}
47+
                return true; // prevent the code for going to the close gossip menu. It would just close our newly created gossip menu :(
48
            } break; // stop here, do not execute other cases
49-
		void EnterEvadeMode()
49+
50
        pPlayer->CLOSE_GOSSIP_MENU(); // close the gossip menu
51-
            me->GetMotionMaster()->Clear();
51+
52-
            ScriptedAI::EnterEvadeMode();
52+
53
};
54
55-
				void ReceiveEmote(Player *pPlayer, uint32 uiTextEmote)
55+
56-
		{
56+
57-
			if (me->IsInEvadeMode() || me->isInCombat())
57+
    new levelnpc_teleporter();
58-
				return;
58+