rendered paste body--http://pastebin.ca/389581 (1.07)
-- version 1.10
-- 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_SendInstanceMenu
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_SendInstanceMenu(player, _Creature, action, 1)
elseif sender == GOSSIP_SENDER_INSTANCE2 then
My_Teleporter_SendInstanceMenu(player, _Creature, action, 2)
elseif sender == GOSSIP_SENDER_INSTANCE3 then
My_Teleporter_SendInstanceMenu(player, _Creature, action, 3)
elseif sender == GOSSIP_SENDER_INSTANCE4 then
My_Teleporter_SendInstanceMenu(player, _Creature, action, 4)
elseif sender == GOSSIP_SENDER_INSTANCE5 then
My_Teleporter_SendInstanceMenu(player, _Creature, action, 5)
elseif sender == GOSSIP_SENDER_RAID then
My_Teleporter_SendInstanceMenu(player, _Creature, action, 6)
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 cquery = sDatabase:Query("SELECT `data` FROM `character` WHERE `guid`="..gplayer)
--local fquery = cquery:Fetch()
--level is row 35 in data player database
-- levelok = fquery[34] - nlevel
--if levelok > -1 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_SendInstanceMenu(player, _Creature, action, instance)
-- Create the variable choice
if instance == 1 then
minst= instance1
linst= inst1level
cinst= instcoord1
elseif instance == 2 then
minst= instance2
linst= inst2level
cinst= instcoord2
elseif instance == 3 then
minst= instance3
linst= inst3level
cinst= instcoord3
elseif instance == 4 then
minst= instance4
linst= inst4level
cinst= instcoord4
elseif instance == 5 then
minst= instance5
linst= inst5level
cinst= instcoord5
elseif instance == 6 then
minst= raid
linst= raidlevel
cinst= raidcoord
end
-- Continue...
local i = 1
while minst[i] do i = i + 1 end
-- Check if the player can travel
if action < GOSSIP_ACTION_INFO_DEF + i then
local nlevel = action - GOSSIP_ACTION_INFO_DEF
My_Teleporter_CheckPlayer(player,_Creature,instance,linst[nlevel]);
end
if travelok == 1 then
local action = action - GOSSIP_ACTION_INFO_DEF
local c_min= ((action * 5) - 4)
local map= cinst[c_min]
local cx= cinst[c_min + 1]
local cy= cinst[c_min + 2]
local cz= cinst[c_min + 3]
local co= cinst[c_min + 4]
player:getSelectedCreature():MonsterSay("Bon courage pour " ..minst[action], 0);
local i
for i=0, 100 do
local j= 0
end
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();