--http://pastebin.ca/389581 (1.07) -- version 1.09 -- 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_CheckPlayer 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 GOSSIP_SENDER_INSTANCE1= 7 GOSSIP_SENDER_INSTANCE2= 8 GOSSIP_SENDER_INSTANCE3= 9 GOSSIP_SENDER_INSTANCE4= 10 GOSSIP_SENDER_INSTANCE5= 11 GOSSIP_SENDER_RAID= 12 -- instances main menu don_choice = {"Instances (Level 13-17) Prix: 5 Po", "Instances (Level 22-29) Prix: 10 Po", "Instances (Level 33-44) Prix: 20 Po", "Instances (Level 45-52) Prix: 40 Po", "Instances (Level 55-60) Prix: 80 Po", "Raids (Level 60+) Prix: 200 Po" } -- instances prices price = { 50000, 100000, 200000, 400000, 800000, 2000000 } -- instances min level 13 to 17 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, -163.35, 131.49, -73.70, 6, 36, -15.95, -377.01, 60.60, 2.89 } inst1level = { 13, 17, 17 } -- instance min level 22 to 29 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 } inst2level = { 22, 24, 25, 29 } -- instance min level 33 to 44 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 } inst3level = { 33, 34, 35, 44 } -- instance min level 45 to 52 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 } inst4level = { 45, 46, 52 } -- instance min level 55 to 58 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, 469, -7666.35, -1101.79, 399.68, 0.6, 409, 1095.98, -470.06, -105.20, 3.9 } inst5level = { 55, 57, 58, 58, 58, 58 } -- instance min level 60+ raid = { "Naxxramas (Raid 60+)", "Repaire d\'Onyxia (Raid 60+)", "Zul'Gurub (Raid 60+)", "Le temple d\'Ahn\'Qiraj (Raid 60+)" , "Ruines d'Ahn\'Qiraj (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, 531, -8205, 2025.81, 129.08, 1.2, 509, -8442.05, 1516.65, 31.93, 2.9 } raidlevel = { 60, 60, 60, 60, 60 } -- 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) local i = 1 if action == GOSSIP_ACTION_INFO_DEF + 1 then 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 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 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 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 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 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 -- Check player (money and level and GM) function My_Teleporter_CheckPlayer(player,_Creature,action,nlevel) travelok = 0 levelok = 0 -- Game master don t pay if (player:GetSecurity() > 0) then travelok = 1 else --local gplayer = player:GetGUID() --local query1 = sDatabase:Query("SELECT `data` FROM `character` WHERE `guid`="..gplayer) --local pquery1 = query1:Fetch() --local playlevel = pquery1[34] --level is row 35 in data player database --if levelok > 0 then local money = player:GetMoney() local prix = price[action] local cout = ( money - prix ) if cout >= 0 then player:SetMoney(cout); travelok = 1 else player:getSelectedCreature():MonsterSay("Tu n'as pas assez d'argent pour voyager!", 0); end --else -- player:getSelectedCreature():MonsterSay("Tu n'as pas le niveau pour faire cette instance", 0); --end 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 local nlevel = action - GOSSIP_ACTION_INFO_DEF My_Teleporter_CheckPlayer(player,_Creature,1,inst1level[nlevel]); end if travelok == 1 then local action = action - GOSSIP_ACTION_INFO_DEF local c_min= ((action * 5) - 4) local map= instcoord1[c_min] local cx= instcoord1[c_min + 1] local cy= instcoord1[c_min + 2] local cz= instcoord1[c_min + 3] local co= instcoord1[c_min + 4] player:getSelectedCreature():MonsterSay("Bon courage pour " ..instance1[action], 0); player:TeleportTo( map, cx, cy, cz, co, true, true ); end return RETURN_OK 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 local nlevel = action - GOSSIP_ACTION_INFO_DEF My_Teleporter_CheckPlayer(player,_Creature,2,inst2level[nlevel]); end if travelok == 1 then local action = action - GOSSIP_ACTION_INFO_DEF local c_min= ((action * 5) - 4) local map= instcoord2[c_min] local cx= instcoord2[c_min + 1] local cy= instcoord2[c_min + 2] local cz= instcoord2[c_min + 3] local co= instcoord2[c_min + 4] player:getSelectedCreature():MonsterSay("Bon courage pour " ..instance2[action], 0); player:TeleportTo( map, cx, cy, cz, co, true, 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 local nlevel = action - GOSSIP_ACTION_INFO_DEF My_Teleporter_CheckPlayer(player,_Creature,3,inst3level[nlevel]); end if travelok == 1 then local action = action - GOSSIP_ACTION_INFO_DEF local c_min= ((action * 5) - 4) local map= instcoord3[c_min] local cx= instcoord3[c_min + 1] local cy= instcoord3[c_min + 2] local cz= instcoord3[c_min + 3] local co= instcoord3[c_min + 4] player:getSelectedCreature():MonsterSay("Bon courage pour " ..instance3[action], 0); player:TeleportTo( map, cx, cy, cz, co, true, 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 local nlevel = action - GOSSIP_ACTION_INFO_DEF My_Teleporter_CheckPlayer(player,_Creature,4,inst4level[nlevel]); end if travelok == 1 then local action = action - GOSSIP_ACTION_INFO_DEF local c_min= ((action * 5) - 4) local map= instcoord4[c_min] local cx= instcoord4[c_min + 1] local cy= instcoord4[c_min + 2] local cz= instcoord4[c_min + 3] local co= instcoord4[c_min + 4] player:getSelectedCreature():MonsterSay("Bon courage pour " ..instance4[action], 0); player:TeleportTo( map, cx, cy, cz, co, true, 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 local nlevel = action - GOSSIP_ACTION_INFO_DEF My_Teleporter_CheckPlayer(player,_Creature,5,inst5level[nlevel]); end if travelok == 1 then local action = action - GOSSIP_ACTION_INFO_DEF local c_min= ((action * 5) - 4) local map= instcoord5[c_min] local cx= instcoord5[c_min + 1] local cy= instcoord5[c_min + 2] local cz= instcoord5[c_min + 3] local co= instcoord5[c_min + 4] player:getSelectedCreature():MonsterSay("Bon courage pour " ..instance5[action], 0); player:TeleportTo( map, cx, cy, cz, co, true, 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 local nlevel = action - GOSSIP_ACTION_INFO_DEF My_Teleporter_CheckPlayer(player,_Creature,6,raidlevel[nlevel]); end if travelok == 1 then local action = action - GOSSIP_ACTION_INFO_DEF local c_min= ((action * 5) - 4) local map= raidcoord[c_min] local cx= raidcoord[c_min + 1] local cy= raidcoord[c_min + 2] local cz= raidcoord[c_min + 3] local co= raidcoord[c_min + 4] player:getSelectedCreature():MonsterSay("Bon courage pour " ..raid[action], 0); player:TeleportTo( map, cx, cy, cz, co, true, 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();