Advertisement
Rochet2

Untitled

Jul 24th, 2014
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.97 KB | None | 0 0
  1. --[==[
  2.     = How to add new locations =
  3.  
  4.     Example:
  5.  
  6.     The first line will be the main menu ID (Here [1],
  7.     increment this for each main menu option!),
  8.     the main menu gossip title (Here "Horde Cities"),
  9.     as well as which faction can use the said menu (Here 1 (Horde)).
  10.     0 = Alliance, 1 = Horde, 2 = Both
  11.  
  12.     The second line is the name of the main menu's sub menus,
  13.     separated by name (Here "Orgrimmar") and teleport coordinates
  14.     using Map, X, Y, Z, O (Here 1, 1503, -4415.5, 22, 0)
  15.  
  16.     [1] = { "Horde Cities", 1,  --  This will be the main menu title, as well as which faction can use the said menu. 0 = Alliance, 1 = Horde, 2 = Both
  17.         {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
  18.     },
  19.  
  20.     You can copy paste the above into the script and change the values as informed.
  21. ]==]
  22.  
  23. local UnitEntry = 200006
  24.  
  25. local T = {
  26.     [1] = { "Horde Mall And Locations", 1,
  27.         {"Thunderbluff", 1, -1278, 122, 132, 0},
  28.     },
  29.     [2] = { "Alliance Mall And Locations", 0,
  30.         {"Thunderbluff", 1, -1278, 122, 132, 0},
  31.     },
  32.     [3] = { "OldCruel Zones", 2,
  33.         {"Duel Zone", 1, 1503, -4415.5, 22, 0},
  34.     },
  35.     [4] = { "PvP Locations (FFA)", 2,
  36.         {"Gurubashi Arena", 0, -13229, 226, 33, 1},
  37.         {"Dire Maul Arena", 1, -3669, 1094, 160, 3},
  38.         {"Nagrand Arena", 530, -1983, 6562, 12, 2},
  39.         {"Blade's Edge Arena", 530, 2910, 5976, 2, 4},
  40.     },
  41.     [5] = { "War Zone", 2,
  42.         { "War Zone Entry 1", 1, -6932, -4931.6, 0.7, 1},
  43.         { "War Zone Entry 2", 1, -7076, -4867.4, 0.6, 0},
  44.         { "War Zone Entry 3", 1, -6932, -4931.6, 0.7, 1},
  45.         { "War Zone Entry 4", 1, -6932, -4931.6, 0.7, 1},
  46.     },
  47. }
  48.  
  49. -- CODE STUFFS! DO NOT EDIT BELOW
  50. -- UNLESS YOU KNOW WHAT YOU'RE DOING!
  51.  
  52. local function OnGossipHello(event, player, unit)
  53.     -- Show main menu
  54.     for i, v in ipairs(T) do
  55.         if (v[2] == 2 or v[2] == player:GetTeam()) then
  56.             player:GossipMenuAddItem(0, v[1], i, 0)
  57.         end
  58.     end
  59.     player:GossipSendMenu(1, unit)
  60. end
  61.  
  62. local function OnGossipSelect(event, player, unit, sender, intid, code)
  63.     if (sender == 0) then
  64.         -- return to main menu
  65.         OnGossipHello(event, player, unit)
  66.         return
  67.     end
  68.  
  69.     if (intid == 0) then
  70.         -- Show teleport menu
  71.         for i, v in ipairs(T[sender]) do
  72.             if (i > 2) then
  73.                 player:GossipMenuAddItem(0, v[1], sender, i)
  74.             end
  75.         end
  76.         player:GossipMenuAddItem(7, "Back..", 0, 0)
  77.         player:GossipSendMenu(1, unit)
  78.         return
  79.     else
  80.         if (player:IsInCombat()) then
  81.             player:SendNotification("You are in combat")
  82.         else
  83.             -- teleport
  84.             local name, map, x, y, z, o = table.unpack(T[sender][intid])
  85.             player:Teleport(map, x, y, z, o)
  86.         end
  87.     end
  88.    
  89.     player:GossipComplete()
  90. end
  91.  
  92. RegisterCreatureGossipEvent(UnitEntry, 1, OnGossipHello)
  93. RegisterCreatureGossipEvent(UnitEntry, 2, OnGossipSelect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement