--http://pastebin.ca/388695
-- Create the Mango Script Base object
My_Teleporter = Mango.Scripts.Create('my_instance');
My_Teleporter:ForceLUA(); -- Don't use the CPP version if valid
-- Function prototypes (to keep it clean)
local My_Teleporter_GossipHello
local My_Teleporter_GossipSelect
local My_Teleporter_TestMoney
local My_Teleporter_SendDefaultMenu
local My_Teleporter_SendInstance1Menu
local My_Teleporter_SendInstance2Menu
local My_Teleporter_SendInstance3Menu
local My_Teleporter_SendInstance4Menu
local My_Teleporter_SendInstance5Menu
local My_Teleporter_SendRaidMenu
travelok = 0
GOSSIP_SENDER_INSTANCE1= 7
GOSSIP_SENDER_INSTANCE2= 8
GOSSIP_SENDER_INSTANCE3= 9
GOSSIP_SENDER_INSTANCE4= 10
GOSSIP_SENDER_INSTANCE5= 11
GOSSIP_SENDER_RAID= 12
-- main menu array
don_choice = {"Instances (Level 13-17) Prix: 25 Po", "Instances (Level 22-29) Prix: 30 Po", "Instances (Level 33-44) Prix: 40 Po", "Instances (Level 45-52) Prix: 50 Po", "Instances (Level 55-60) Prix: 100 Po", "Raids (Level 60+) Prix: 300 Po" }
-- price array
price = { 250000, 300000, 400000, 500000, 1000000, 3000000 }
--instances menu array
-- all coord ok
instance1 = { "Gouffre de Ragefeu (13-18)" , "Cavernes des lamentations (17-24)" , "Les Mortemines (17-26)" }
instcoord1 = { 389, 3.25, -16.5, -18.3, 4.5, 43, -135.46, 120.64, -78.10, 3, 36, -15.95, -377.01, 60.60, 2.89 }
-- all coord ok
instance2 = { "Donjon d\'Ombrecroc (22-30)" , "Profondeurs de Brassenoire (24-32)", "Kraal de Tranchebauge (25-30)", "Gnomeregan (29-38)" }
instcoord2 = { "0, -237.90, 1510.50, 75.36, 2.3", "48, -152.49, 102.79, -40.73, 4.23", "1, -4468.41, -1672.81, 81.84, 4.34", "0, -5179.82, 682.93, 379.35, 1.50"}
-- all coord ok
instance3 = { "Souilles de Tranchebauge (33-45)", "Monast\195\168re \195\169carlate (34-45)", "Uldaman (35-47)", "Zul'Farrak (44-54)" }
instcoord3 = {"129, 2593.53, 1106.08, 51.44, 4.46", "0, 2847.39, -699.08, 139.34, 5.17", "70, -227.86, 52.19, -46.04, 1.50", "209, 1219.90, 848.60, 10.15, 5.75"}
-- all coord ok
instance4 = { "Le temple englouti (45-55)", "Maraudon (46-55)", "Profondeurs de Blackrock (52-60)" }
instcoord4 = {"109, -320.65, 99.84, -131.85, 3.19", "349, 423.39, 26.21, -132.43, 3.96", "230, 456.65, 29.36, -70.47, 5.16"}
instance5 = { "Hache-Tripes (55-60)", "Scholomance (57-60)", "Stratholme (58-60)", "Pic Blackrock (58-60)", "Repaire de l\'Aile noire (58-60)", "C\197\147ur du Magma (58-60)" }
instcoord5 = { "1, -3772.53, 1185.90, 127.44, 5.57", "289, 201.65, 128.14, 134.92, 4.68", "0, 3356.82, -3379.40, 144.79, 0", "229, 78.91, -230.18, 50.24, 4.8", "", ""}
raid = { "Le temple d\'Ahn\'Qiraj (Raid 60+)" , "Ruines d'Ahn'Qiraj (Raid 60+)", "Naxxramas (Raid 60+)", "Repaire d\'Onyxia (Raid 60+)", "Zul'Gurub (Raid 60+)" }
raidcoord = {"", "", "533, 3006.32, -3406.93, 299.15, 4.66", "249, 26.17, -68.26, -6.80, 4.77", "309, -11945.92, -1260.86, 85.37, 5.33"}
-- The actual functions
-- Send the first menu (with the selections)
function My_Teleporter_GossipHello(player,_Creature)
local i = 1
while don_choice[i] do
player:ADD_GOSSIP_ITEM( 0, don_choice[i] , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499 ,_Creature:GetGUID());
return RETURN_OK
end
-- Called when you chose an option
function My_Teleporter_GossipSelect(player, _Creature, sender, action)
if sender == GOSSIP_SENDER_MAIN then
My_Teleporter_SendDefaultMenu(player, _Creature, action)
elseif sender == GOSSIP_SENDER_INSTANCE1 then
My_Teleporter_SendInstance1Menu(player, _Creature, action)
elseif sender == GOSSIP_SENDER_INSTANCE2 then
My_Teleporter_SendInstance2Menu(player, _Creature, action)
elseif sender == GOSSIP_SENDER_INSTANCE3 then
My_Teleporter_SendInstance3Menu(player, _Creature, action)
elseif sender == GOSSIP_SENDER_INSTANCE4 then
My_Teleporter_SendInstance4Menu(player, _Creature, action)
elseif sender == GOSSIP_SENDER_INSTANCE5 then
My_Teleporter_SendInstance5Menu(player, _Creature, action)
elseif sender == GOSSIP_SENDER_RAID then
My_Teleporter_SendRaidMenu(player, _Creature, action)
end
return RETURN_OK
end
function My_Teleporter_SendDefaultMenu(player, _Creature, action)
-- define price of travel
if action == GOSSIP_ACTION_INFO_DEF + 1 then
local i = 1
while instance1[i] do
player:ADD_GOSSIP_ITEM( 1, instance1[i] , GOSSIP_SENDER_INSTANCE1, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499,_Creature:GetGUID())
elseif action == GOSSIP_ACTION_INFO_DEF + 2 then
local i = 1
while instance2[i] do
player:ADD_GOSSIP_ITEM( 2, instance2[i] , GOSSIP_SENDER_INSTANCE2, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499,_Creature:GetGUID())
elseif action == GOSSIP_ACTION_INFO_DEF + 3 then
local i = 1
while instance3[i] do
player:ADD_GOSSIP_ITEM( 3, instance3[i] , GOSSIP_SENDER_INSTANCE3, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499,_Creature:GetGUID())
elseif action == GOSSIP_ACTION_INFO_DEF + 4 then
local i = 1
while instance4[i] do
player:ADD_GOSSIP_ITEM( 4, instance4[i] , GOSSIP_SENDER_INSTANCE4, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499,_Creature:GetGUID())
elseif action == GOSSIP_ACTION_INFO_DEF + 5 then
local i = 1
while instance5[i] do
player:ADD_GOSSIP_ITEM( 5, instance5[i] , GOSSIP_SENDER_INSTANCE5, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499,_Creature:GetGUID())
elseif action == GOSSIP_ACTION_INFO_DEF + 6 then
local i = 1
while raid[i] do
player:ADD_GOSSIP_ITEM( 6, raid[i] , GOSSIP_SENDER_RAID, GOSSIP_ACTION_INFO_DEF + i )
i = i + 1
end
player:SEND_GOSSIP_MENU(7499,_Creature:GetGUID())
end
return RETURN_OK
end
-- Procedure of money test
function My_Teleporter_TestMoney(player,_Creature,action)
travelok = 0
local money = player:GetMoney()
local prix = price[action]
local cout = ( money - prix )
if cout >= 0 then
player:SetMoney(cout);
travelok = 1
end
return travelok
end
function My_Teleporter_SendInstance1Menu(player, _Creature, action)
local i = 1
while instance1[i] do i = i + 1 end
-- Test if the player have the money
if action < GOSSIP_ACTION_INFO_DEF + i then
My_Teleporter_TestMoney(player,_Creature,1);
end
if travelok == 1 then
local action = action - 1000
player:getSelectedCreature():MonsterSay("Destination: " ..instance1[action], 0);
-- Procedure for Teleport
--player:TeleportTo( map, x, y, z, o, true, true );
return RETURN_OK
end
end
function My_Teleporter_SendInstance2Menu(player, _Creature, action)
local i = 1
while instance2[i] do
i = i + 1
end
if action < GOSSIP_ACTION_INFO_DEF + i then
My_Teleporter_TestMoney(player,_Creature,2);
end
if travelok == 1 then
local action = action - 1000
player:TeleportTo(instcoord2[action], false, true );
end
return RETURN_OK
end
function My_Teleporter_SendInstance3Menu(player, _Creature, action)
local i = 1
while instance3[i] do
i = i + 1
end
if action < GOSSIP_ACTION_INFO_DEF + i then
My_Teleporter_TestMoney(player,_Creature,3);
end
if travelok == 1 then
local action = action - 1000
player:TeleportTo(instcoord3[action], false, true );
end
return RETURN_OK
end
function My_Teleporter_SendInstance4Menu(player, _Creature, action)
local i = 1
while instance4[i] do
i = i + 1
end
if action < GOSSIP_ACTION_INFO_DEF + i then
My_Teleporter_TestMoney(player,_Creature,4);
end
if travelok == 1 then
local action = action - 1000
player:TeleportTo(instcoord4[action], false, true );
end
return RETURN_OK
end
function My_Teleporter_SendInstance5Menu(player, _Creature, action)
local i = 1
while instance5[i] do
i = i + 1
end
if action < GOSSIP_ACTION_INFO_DEF + i then
My_Teleporter_TestMoney(player,_Creature,5);
end
if travelok == 1 then
local action = action - 1000
player:TeleportTo(instcoord5[action], false, true );
end
return RETURN_OK
end
function My_Teleporter_SendRaidMenu(player, _Creature, action)
local i = 1
while raid[i] do
i = i + 1
end
if action < GOSSIP_ACTION_INFO_DEF + i then
My_Teleporter_TestMoney(player,_Creature,6);
end
if travelok == 1 then
local action = action - 1000
player:TeleportTo(raidcoord[action], false, true );
end
return RETURN_OK
end
-- Assign the functions
My_Teleporter.GossipHello = My_Teleporter_GossipHello;
My_Teleporter.GossipSelect= My_Teleporter_GossipSelect;
-- Activate (run) the script
My_Teleporter:Activate();