All pastes #409020 Raw Edit

Miscellany

public text v1 · immutable
#409020 ·published 2007-03-25 11:27 UTC
rendered paste body
--         /\/\   __ _ _ __   __ _  ___ / _\ ___ _ __(_)_ __ | |_
--        /    \ / _` | '_ \ / _` |/ _ \\ \ / __| '__| | '_ \| __|
--       / /\/\ \ (_| | | | | (_| | (_) |\ \ (__| |  | | |_) | |_
--       \/    \/\__,_|_| |_|\__, |\___/\__/\___|_|  |_| .__/ \__|
--                           |___/                     |_|
--                        A WHOLE NEW WORLD
--         MangoScript - Bringing a whole new world to MaNGOS
--
--      AllInOne_Teleporter.lua - The Transportation master allinone script
--                               By Sanaell ( core ) from an idea of Biglad
---                              rev 1.0
--Features:
-- Can replace the transportation boat & zeppelin
-- Idea from biglad buddies transportation
-- SOON : multilanguage support
--
--Credits: biglad, demon
--
--http://mangoscript.org/forum/
--
-- Create the Mango Script Base object
AllInOne_Teleporter = Mango.Scripts.Create('allinone_teleporter');
AllInOne_Teleporter:ForceLUA(); -- Don't use the CPP version if valid

-- Function prototypes (to keep it clean)
local AllInOne_Teleporter_GossipHello
local AllInOne_Teleporter_GossipSelect

-- GUID of Transportation Master
local npc0menu= { "Ironforge", "GoldShire", "BootyBay", "Menthil Harbor", "Auberdine", "Theramore Isle", "Rut'Theran Village", "Feathermoon Stronghold", "Feralas Coast", "Ratchet", "Undercity", "Grom'Gol Basecamp", "Durotar", "Thunderbluff", "Mob Spawning Ground"}
if lng == "FR" then local npc0menu= { "Forgefer", "Compt\195\169-de-l'or", "Baie-du-butin", "Port de Menethil", "Auberdine", "\195\174le de Theramore", "Village de Rut'Theran", "Bastion de Feathermoon", "C\195\180te de Feralas", "Ratchet", "Faucheuse", "Campement Grom'Gol", "Durotar", "Piton-du-tonnerre", "\195\174le des programmeur"}
local npc0coord= { 0, -4919.979980 , -957.887024 , 501.503998 , 0, -9443.450195 , 59.894402  , 56.070400 , 0, -14289.0 , 556.6  , 8.9 , 0, -3779.526611 , -734.663025  , 8.090954 , 1, 6439.279785 , 614.956970  , 10.469187 , 1, -3994.240967 , -4722.521484  , 4.718028 , 1, 8549.147461 , 1020.227905  , 5.824060, 1, -4214.979492 , 3285.962158  , 6.361742 , 1, -4346.529297 , 2429.156494  , 6.317777 , 1, -997.727234 , -3823.210205 , 5.358360 , 0, 2058.840088 , 253.284988  , 99.760002 , 0, -12441.599609 , 215.000000  , 31.200001 , 1, 1338.453491 , -4663.950195 , 54.048733 , 1, -1285.42 , 176.523 , 129.994 , 451, 16957.70 , 15812.03 , 84.808733}
local npc1menu= { "BootyBay", "Ratchet"}
if lng == "FR" then local npc1menu= { "Baie-du-butin", "Ratchet"}
local npc1coord= { 0, -14289.0 , 556.6  , 8.9 , 1, -997.727234 , -3823.210205 , 5.358360}
local npc2menu= { "Menthil Harbor", "Auberdine", "Theramore Isle"}
if lng == "FR" then local npc2menu= { "Port de Menethil", "Auberdine", "\195\174le de Theramore"}
local npc2coord= { 0, -3779.526611 , -734.663025  , 8.090954 , 1, 6439.279785 , 614.956970  , 10.469187 , 1, -3994.240967 , -4722.521484  , 4.718028}
local npc3menu= { "Durotar", "Undercity", "Grom'Gol Basecamp", "Thunderbluff"}
if lng == "FR" then local npc3menu= { "Durotar", "Faucheuse", "Campement Grom'Gol", "Piton-du-tonnerre"}
local npc3coord= { 1, 1338.453491 , -4663.950195 , 54.048733 , 0, 2058.840088 , 253.284988  , 99.760002 , 0, -12441.599609 , 215.000000  , 31.200001 , 1, -1285.42 , 176.523 , 129.994}

-- data group
local npctmenu = { npc1menu, npc2menu, npc3menu}
local npctcoord = { npc1coord, npc2coord, npc3coord}
-- The actual functions
-- Send the first menu (with the selections)
function AllInOne_Teleporter_GossipHello(player,_Creature)
   local ID_NPC = _Creature:GetEntry()
   local idnpc = ID_NPC - 25000
   local i = 1
   if ( ( player:GetSecurity() > 0 ) and ( ID_NPC == 25000 ) ) then
          npcdata= npc0menu;
   elseif ID_NPC > 25000 and ID_NPC < 25004 then
          npcdata= npctmenu[idnpc];
   end
   while npcdata[i] do
            player:ADD_GOSSIP_ITEM( 5, "Travel to "..npcdata[i]      , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i)
            i = i + 1
   end
   player:SEND_GOSSIP_MENU(1  ,_Creature:GetGUID()); -- Says " Greetings <Playername>
   return RETURN_OK
end

-- Called when you chose an option
function AllInOne_Teleporter_GossipSelect(player, _Creature, sender, action)

   if sender == GOSSIP_SENDER_MAIN then
     local i = 1
     local ID_NPC = _Creature:GetEntry()
     local idnpc = ID_NPC - 25000
     if ( ( player:GetSecurity() > 0 ) and ( ID_NPC == 25000 ) ) then
        npcdata= npc0menu;
        npcdatac= npc0coord;
     elseif ID_NPC > 25000 and ID_NPC < 25004 then
        npcdata= npctmenu[idnpc];
        npcdatac= npctcoord[idnpc];
     end
     while npcdata[i] do
              if action == GOSSIP_ACTION_INFO_DEF + i then
                 local action = action - GOSSIP_ACTION_INFO_DEF
                 local c_min= ((action * 4) - 3)
                 if npcdatac[c_min] == nil then
                    player:TeleportTo( 0, npcdatac[c_min + 1], npcdatac[c_min + 2], npcdatac[c_min + 3], 0, true, true );
                 else
                    player:TeleportTo( npcdatac[c_min], npcdatac[c_min + 1], npcdatac[c_min + 2], npcdatac[c_min + 3], 0, true, true );
                 end
              end
              i = i + 1
        end
     player:SEND_GOSSIP_MENU(1  ,_Creature:GetGUID()); -- Says " Greetings <Playername>
     return RETURN_OK
   end
return RETURN_OK
end

-- Assign the functions
AllInOne_Teleporter.GossipHello = AllInOne_Teleporter_GossipHello;
AllInOne_Teleporter.GossipSelect= AllInOne_Teleporter_GossipSelect;

-- Activate (run) the script
AllInOne_Teleporter:Activate();