// TextIDs from npc_text
enum eEnums
{
TEXT_MAIN_H = 300000, //Horde main menu text
TEXT_MAIN_A = 300001, //Alliance main menu text
TEXT_DUNGEON = 300002, //Dungeon teleport menu texts
TEXT_RAID = 300003, //Raid teleport menu text
TEXT_AREA = 300004, //Area teleport location menu texts
TELEPORT_COUNT = sizeof TeLe/sizeof(*TeLe),
};
#define ARE_YOU_SURE "Вы хотите отправиться в "
#define ERROR_COMBAT "|cffff0000Вы в бою!|r"
bool Custom_FactCheck (uint32 Fact, unsigned char Key)
{
bool Show = false;
switch (TeLe[Key].faction)
{
case 0:
Show = true;
break;
case 1:
if (Fact == HORDE)
Show = true;
break;
case 2:
if (Fact == ALLIANCE)
Show = true;
break;
}
return (Show);
}
uint32 Custom_GetText (unsigned int menu, Player* pPlayer)
{
uint32 TEXT = TEXT_AREA;
switch (menu)
{
case 0:
switch (pPlayer->GetTeam())
{
case ALLIANCE:
TEXT = TEXT_MAIN_A;
break;
case HORDE:
TEXT = TEXT_MAIN_H;
break;
}
case 1:
case 2:
case 3:
TEXT = TEXT_DUNGEON;
break;
case 4:
TEXT = TEXT_RAID;
break;
}
return (TEXT);
}
void Custom_GetMenu (Player* pPlayer, Creature* pCreature, uint32 Key)
{
bool ENDMENU = false;
for(uint32 i = 0; i < TELEPORT_COUNT; i++)
{
if (ENDMENU && TeLe.menu_id != Key)
break;
if (TeLe.menu_id == Key && pPlayer->getLevel() >= TeLe.level && Custom_FactCheck(pPlayer->GetTeam(), i))
{
if (TeLe.next_menu_id != 0)
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe.icon, TeLe.name, GOSSIP_SENDER_MAIN, i, "", TeLe.cost, false);
else
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe.icon, TeLe.name, GOSSIP_SENDER_MAIN, i, ARE_YOU_SURE+TeLe.name, TeLe.cost, false);
ENDMENU = true;
}
}
pPlayer->PlayerTalkClass->SendGossipMenu(Custom_GetText(Key, pPlayer), pCreature->GetGUID());
}
class TeLe_gossip_codebox : public CreatureScript
{
public:
TeLe_gossip_codebox()
: CreatureScript("TeLe_gossip_codebox")
{
}