stoneharry

Untitled

Mar 1st, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.17 KB | None | 0 0
  1.  
  2. local i = 0
  3. local can_start = false
  4. local obja = nil
  5. local objb = nil
  6.  
  7. local OBJECT_END = 0x0006
  8. local UNIT_FIELD_FLAGS = OBJECT_END + 0x0035 -- Size: 1, Type: INT, Flags: PUBLIC
  9. local UNIT_FLAG_NOT_SELECTABLE = 0x02000000 -- 26    33554432  cannot select the unit
  10.  
  11. function ThoradinWall_Gossip(pUnit, event, player)
  12.     pUnit:GossipCreateMenu(205820, player, 0)
  13.     pUnit:GossipMenuAddItem(4, "|cff00ff00|TInterface\\icons\\INV_Misc_EngGizmos_31:30|t|r Hand over the resources required.", 1, 0)
  14.     pUnit:GossipMenuAddItem(0, "Nevermind.", 2, 0)
  15.     pUnit:GossipSendMenu(player)
  16. end
  17.  
  18. function ThoradinWall_GossipClick(pUnit, event, player, id, intid, code)
  19.     if intid == 1 then
  20.         pUnit:SetNPCFlags(2)
  21.         pUnit:SendChatMessage(12,0,"Fantastic work, "..player:GetName().."! Time to show those gnomes what goblin technology can achieve.")
  22.         can_start = true
  23.     end
  24.     player:GossipComplete()
  25. end
  26.  
  27. RegisterUnitGossipEvent(205820, 1, "ThoradinWall_Gossip")
  28. RegisterUnitGossipEvent(205820, 2, "ThoradinWall_GossipClick")
  29.  
  30. function Goblin_ThoradinSpawn(pUnit, Event)
  31.     pUnit:RegisterEvent("Thoradin_StartEvent", 3000, 0)
  32. end
  33.  
  34. RegisterUnitEvent(205820, 18, "Goblin_ThoradinSpawn")
  35.  
  36. function Thoradin_StartEvent(pUnit)
  37.     if can_start then
  38.         can_start = false
  39.         pUnit:MoveTo(-842.5, -1597.9, 53.8, 0.934246)
  40.         pUnit:RegisterEvent("Thoradin_Events_Handle", 1000, 0)
  41.     end
  42. end
  43.  
  44. function Thoradin_Events_Handle(pUnit)
  45.     i = i + 1
  46.     if i == 6 then
  47.         pUnit:SendChatMessage(12,0,"Let's see...")
  48.         pUnit:Emote(69, 2500)
  49.     elseif i == 8 then
  50.         objb = pUnit:SpawnGameObject(690377, -841.65, -1596.6, 53.5, 0, 0, 100)
  51.         pUnit:SpawnCreature(18392, -841.65, -1596.6, 54, 1, 35, 0):SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  52.         pUnit:MoveTo(-846.6, -1594.5, 53.6, 0.890507)
  53.     elseif i == 11 then
  54.         pUnit:Emote(69, 2500)
  55.     elseif i == 13 then
  56.         obja = pUnit:SpawnGameObject(690377, -845.5, -1593.2, 53.5, 1, 0, 100)
  57.         pUnit:SpawnCreature(18392, -845.5, -1593.2, 54, 1, 35, 0):SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  58.     elseif i == 15 then
  59.         pUnit:SendChatMessage(12,0,"Right. Time for plan Beta-Bravo-Brandy!")
  60.         pUnit:Emote(15, 0)
  61.     elseif i == 19 then
  62.         pUnit:Emote(60, 0)
  63.     elseif i == 20 then
  64.         pUnit:SendChatMessage(14,0,"Run! Run for your lives!")
  65.         pUnit:SetMovementFlags(1)
  66.         pUnit:MoveTo(-862.4, -1617.5, 52.8, 0.924264)
  67.     elseif i == 29 then
  68.         pUnit:Emote(4,0)
  69.         local npc = pUnit:GetCreatureNearestCoords(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 205821)
  70.         if npc then
  71.             npc:SendChatMessage(12,0,"Oh my.")
  72.         end
  73.         local a = pUnit:GetCreatureNearestCoords(-841.65, -1596.6, 54, 18392)
  74.         local b = pUnit:GetCreatureNearestCoords(-845.5, -1593.2, 54, 18392)
  75.         if a then
  76.             a:CastSpell(60852)
  77.             a:Despawn(15000, 0)
  78.         end
  79.         if b then
  80.             b:CastSpell(60852)
  81.             b:Despawn(15000, 0)
  82.         end
  83.         local gate = pUnit:GetGameObjectNearestCoords(-841.2, -1592.44, 54.1486, 690376)
  84.         if gate then
  85.             gate:SetUInt32Value(0x0006+0x0003,0x200) -- damaged
  86.         end
  87.         if obja then
  88.             obja:Despawn(1,0)
  89.         end
  90.         if objb then
  91.             objb:Despawn(1,0)
  92.         end
  93.     elseif i == 33 then
  94.         pUnit:SendChatMessage(12,0,"It didn't go down, but we can soon fix that.")
  95.         pUnit:SetMovementFlags(0)
  96.         pUnit:MoveTo(-845.8, -1597.8, 53.6, 0.887626)
  97.     elseif i == 45 then
  98.         pUnit:SendChatMessage(12,0,"...and this is why I'm called Mr. Smith.")
  99.         pUnit:Emote(69, 5000)
  100.     elseif i == 49 then
  101.         obja = pUnit:SpawnGameObject(690377, -843, -1595, 53.6, 2, 0, 200)
  102.     elseif i == 51 then
  103.         pUnit:Emote(60, 0)
  104.     elseif i == 52 then
  105.         pUnit:Emote(60, 0)
  106.     elseif i == 53 then
  107.         pUnit:Emote(60, 0)
  108.     elseif i == 54 then
  109.         pUnit:SendChatMessage(14,0,"Time to run!")
  110.         pUnit:SetMovementFlags(1)
  111.         pUnit:MoveTo(-862.4, -1617.5, 52.8, 0.924264)
  112.         pUnit:SpawnCreature(18392, -843, -1595, 54, 0, 35, 0):SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  113.     elseif i == 63 then
  114.         pUnit:Emote(11,0)
  115.         local a = pUnit:GetCreatureNearestCoords(-843, -1595, 54, 18392)
  116.         if a then
  117.             a:CastSpell(60852)
  118.             a:Despawn(15000, 0)
  119.         end
  120.         local b = pUnit:GetGameObjectNearestCoords(-843, -1595, 53.6, 690377)
  121.         if b then
  122.             b:Despawn(1,0)
  123.         end
  124.         local gate = pUnit:GetGameObjectNearestCoords(-841.2, -1592.44, 54.1486, 690376)
  125.         if gate then
  126.             gate:SetUInt32Value(0x0006+0x0003,0x400) -- destroyed
  127.         end
  128.         pUnit:SetMovementFlags(0)
  129.     elseif i == 66 then
  130.         pUnit:SendChatMessage(12,0,"Come on honey, we're going on an adventure. The profits will be wonderful, we can live how we want as we want. Nobody tells the Smith's what to do...")
  131.         pUnit:MoveTo(-811.4, -1553.8, 54.2, 1.174046)
  132.     elseif i == 72 then
  133.         local npc = pUnit:GetCreatureNearestCoords(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 205821)
  134.         if npc then
  135.             npc:SendChatMessage(12,0,"It sounds so wonderful.")
  136.         end
  137.     elseif i == 75 then
  138.         pUnit:SendChatMessage(12,0,"You bet! The rabbits of Southshore are said to be the fluffiest in all of Azeroth.")
  139.     elseif i == 120 then
  140.         pUnit:ReturnToSpawnPoint()
  141.     elseif i == 160 then
  142.         local gate = pUnit:GetGameObjectNearestCoords(-841.2, -1592.44, 54.1486, 690376)
  143.         if gate then
  144.             gate:RemoveFlag(0x0006+0x0003,0x400)
  145.             gate:RemoveFlag(0x0006+0x0003,0x200)
  146.         end
  147.         pUnit:RemoveEvents()
  148.         i = 0
  149.         pUnit:SetNPCFlags(3)
  150.     end
  151. end
Advertisement
Add Comment
Please, Sign In to add comment