item_teleport.cpp :code:
/*
test send
*/
#include "ScriptPCH.h"
class item_teleporter : public ItemScript
{
public:
item_teleporter() : ItemScript("item_teleporter") { }
bool OnGossipSelect(Player *pPlayer, Item * pitem, uint32 sender, uint32 action)
{
pPlayer->PlayerTalkClass->ClearMenus();
if (sender != GOSSIP_SENDER_MAIN)
SendDefaultMenu_item_teleport(pPlayer, pitem, action);
return true;
switch(action)
{
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->TeleportTo(603, -706.122f, -92.6024f, 429.876f, 0.0f);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->TeleportTo(603, 131.248f, -35.3802f, 409.804f, 0.0f);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0.0f);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF+4:
pPlayer->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0.0f);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF+5:
pPlayer->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0.0f);
pPlayer->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF+6:
pPlayer->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0.0f);
pPlayer->CLOSE_GOSSIP_MENU();
break;
}
return true;
}
bool OnGossipHello(Player *pPlayer, Item * pitem)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to text1", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to text2", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to text3", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
pPlayer->PlayerTalkClass->SendGossipMenu(907,pitem->GetGUID());
return true;
}
void SendDefaultMenu_item_teleport(Player *player, Item * pitem, uint32 action)
{
switch(action) {
// Teleport to text1_1
case GOSSIP_ACTION_INFO_DEF + 1 :
pPlayer->ADD_GOSSIP_ITEM( 2, " |cff8000FFTeleport to text1_1|CFF009933 ", 2, GOSSIP_ACTION_INFO_DEF + 1);
pPlayer->ADD_GOSSIP_ITEM( 2, " |CFF0000FFTeleport to text1_2|CFF009933 ", 2, GOSSIP_ACTION_INFO_DEF + 2);
pPlayer->PlayerTalkClass->SendGossipMenu(907,pitem->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF + 2 :
pPlayer->ADD_GOSSIP_ITEM( 2, " |cff8000FFTeleport to text2_1 ", 2, GOSSIP_ACTION_INFO_DEF + 3);
pPlayer->ADD_GOSSIP_ITEM( 2, " |CFF0000FFTeleport to text2_2 ", 2, GOSSIP_ACTION_INFO_DEF + 4);
pPlayer->PlayerTalkClass->SendGossipMenu(907,pitem->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF + 3 :
player->ADD_GOSSIP_ITEM( 2, " |CFF0000FFTeleport to text3_1 ", 2, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 2, " |CFF0000FFTeleport to text3_2 ", 2, GOSSIP_ACTION_INFO_DEF + 6);
pPlayer->PlayerTalkClass->SendGossipMenu(907,pitem->GetGUID());
break;
}
}
}
void AddSC_item_teleport()
{
new item_teleport();
}
and in scritpsloader.cpp
//examples
void AddSC_item_teleport();
void AddCustomScripts()
{
#ifdef SCRIPTS
/* This is where custom scripts should be added. */
//TeleNPC2
AddSC_npc_teleport();
AddSC_item_teleport();
#endif
}
Can not compile
help thx