Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.55 KB | None | 0 0
  1. --[[
  2. *******************************************************************
  3. **                                                               **
  4. **          Author:         Skyrazer                             **
  5. **          Completion:     90%                                  **
  6. **          In Progress:    Acheivement tiggers                  **
  7. **                          Soul Harvest                         **
  8. **                                                               **
  9. *******************************************************************
  10. ]]
  11. SetDBCSpellVar(69146, "EffectRadiusIndex", 5)
  12. SetDBCSpellVar(69146, "EffectBasePoints", 6000)
  13. SetDBCSpellVar(70823, "EffectRadiusIndex", 5)
  14. SetDBCSpellVar(70823, "EffectBasePoints", 8000)
  15. SetDBCSpellVar(70824, "EffectRadiusIndex", 5)
  16. SetDBCSpellVar(70824, "EffectBasePoints", 9000)
  17. SetDBCSpellVar(70825, "EffectRadiusIndex", 5)
  18. SetDBCSpellVar(70825, "EffectBasePoints", 11000)
  19. --[[
  20. *******************************************************************
  21. **                                                               **
  22. **                      TABLES & VARIABLES                       **
  23. **                                                               **
  24. *******************************************************************
  25. ]]
  26. vars = {};
  27. lordm = {};
  28. spike = {};
  29. func = {};
  30. spell = {
  31.     flame = {
  32.         { spell = 69146 , life = 3000 , damage = 6000},
  33.         { spell = 70823 , life = 3000 , damage = 8000},
  34.         { spell = 70824 , life = 8000 , damage = 9000},
  35.         { spell = 70825 , life = 8000 , damage = 11000}
  36.     },
  37.     storm = {
  38.         { aura = 70834 , duration = 20000 , charge = 3 , maxdam = 6000},
  39.         { aura = 70835 , duration = 20000 , charge = 3 , maxdam = 12000},
  40.         { aura = 70835 , duration = 30000 , charge = 4 , maxdam = 12000},
  41.         { aura = 70836 , duration = 30000 , charge = 4 , maxdam = 14000}
  42.     },
  43.     slice = { 69055 , 70814 , 69055 , 70814 }
  44. };
  45. --[[
  46. *******************************************************************
  47. **                                                               **
  48. **                         LORD MARROWGAR                        **
  49. **                                                               **
  50. *******************************************************************
  51. ]]
  52. function func.lordm.onspawn(pUnit, event)
  53.     pUnit:RegisterEvent("func.lordm.firstenter", 1000, 0)
  54.     local id = pUnit:GetInstanceID()
  55.     vars[id].lordm.start = false
  56. end
  57. function func.lordm.firstenter(pUnit, event)
  58.     local plr = pUnit:GetClosestPlayer()
  59.     if plr ~= nil then
  60.         if pUnit:GetDistanceYards(player) <= 65 then
  61.             pUnit:RemoveEvents()
  62.             pUnit:PlaySoundToSet(16950)
  63.             pUnit:SendChatMessage(14, 0, "This is the beginning AND the end, mortals. None may enter the master's sanctum!")
  64.         end
  65.     end
  66. end
  67. function func.lordm.oncombat (pUnit, Event)
  68.     math.randomseed(os.time())
  69.     local sUnit = tostring(pUnit)
  70.     local id = pUnit:GetInstanceID()
  71.     local d = pUnit:GetDungeonDifficulty() + 1
  72.     lordm[id].dif = d
  73.     lordm[id].unit = sUnit
  74.     vars[id].starttime = os.time()
  75.     pUnit:SendChatMessage(14, 0, "The Scourge will wash over this world as a swarm of death and destruction!")
  76.     pUnit:PlaySoundToSet(16941)
  77.     pUnit:RegisterEvent("func.lordm.stand", 100, 1)
  78. end
  79. function func.lordm.enrage (pUnit, Event)
  80.     local id = pUnit:GetInstanceID()
  81.     if (os.difftime( os.time() , vars[id].starttime ) == 600) then
  82.         if (pUnit:HasAura(69076) == true) then pUnit:RemoveAura(69076) end
  83.         pUnit:RemoveEvents()
  84.         pUnit:CastSpell(26662)
  85.     end
  86. end
  87. function func.lordm.stand (pUnit, Event)
  88.     pUnit:RegisterEvent("func.lordm.enrage", 100, 0)
  89.     pUnit:RegisterEvent("func.lordm.boneslice", 2000, 0)
  90.     pUnit:RegisterEvent("func.lordm.bonestorm", 45000, 1)
  91.     pUnit:RegisterEvent("func.lordm.bonespike", 14000, 0)
  92.     pUnit:RegisterEvent("func.lordm.coldflame", 4000, 0)
  93. end
  94. function func.lordm.boneslice (pUnit, Event)
  95.     local id = pUnit:GetInstanceID()
  96.     local u = tostring(pUnit)
  97.     pUnit:CastSpell(spell.slice[lordm[id].dif])
  98. end
  99. function func.lordm.coldflame (pUnit, Event)
  100.     local plr = nil
  101.     local id = pUnit:GetInstanceID()
  102.     local t = false
  103.     lordm[id].cfcast = lordm[id].cfcast + 1
  104.     local cast = lordm[id].cfcast
  105.     for _, v in pairs (pUnit:GetInRangePlayers()) do
  106.         if pUnit:GetDistanceYards(v) > 10 then
  107.             t = true
  108.             vars[id].temp.m = 10
  109.             break
  110.         end
  111.     end
  112.     if (t == false) then
  113.         plr = pUnit:GetMainTank()
  114.         vars[id].temp.m = plr:GetDistance()
  115.     end
  116.     if (plr == nil) then plr = pUnit:GetRandomPlayer(2) end
  117.     if (plr == nil) then plr = pUnit:GetRandomPlayer(2) end
  118.     vars[id].temp.flametar = plr
  119.     pUnit:CastSpell(69138)
  120.     local x,y,z,o = pUnit:GetLocation()
  121.     pUnit:SpawnCreature(6, x, y, z, o, 14, 0)
  122. end
  123. function func.lordm.bonespike (pUnit, Event)
  124.     pUnit:SendChatMessage(14, 0, "Bound by bone!")
  125.     pUnit:PlaySoundToSet(16947)
  126.     pUnit:FullCastSpell(69057) -- Casts the spell "on himself", as it is really a dummy spell
  127. end
  128. function func.lordm.bonestorm (pUnit, Event)
  129.     pUnit:RemoveEvents()
  130.     local sUnit = tostring(pUnit)
  131.     local id = pUnit:GetInstanceID()
  132.     local d = lordm[id].dif
  133.     if (d == 3 or 4) then
  134.         local timer = (spell.storm[d].duration/spell.storm[d].charge) - 2000
  135.         local times = spell.storm[d].duration/timer
  136.         pUnit:RegisterEvent("func.lordm.bonespike", timer, times)
  137.     end
  138.     pUnit:Root()
  139.     pUnit:FullCastSpell(69076)
  140.     pUnit:SendChatMessage(14, 0, "BONE STORM!")
  141.     pUnit:SendChatMessage(42, 0, "BONE STORM!")
  142.     pUnit:PlaySoundToSet(16946)
  143.     local move = math.floor((spell.storm[d].duration/spell.storm[d].charge) - 1000)
  144.     pUnit:RegisterEvent("func.lordm.enrage", 100, 0)
  145.     pUnit:RegisterEvent("func.lordm.stormmove", move, spell.storm[d].charge)
  146.     pUnit:RegisterEvent("func.lordm.stormstop", spell.storm[d].duration, 1)
  147. end
  148. function func.lordm.stormmove (pUnit, Event)
  149.     local plr = pUnit:GetRandomPlayer(3)
  150.     if (plr == nil) then local plr = pUnit:GetRandomPlayer(2) end
  151.     if (plr == nil) then local plr = pUnit:GetRandomPlayer(0) end
  152.     pUnit:Unroot()
  153.     if (plr ~= nil) then
  154.         local x,y,z = plr:GetLocation()
  155.         pUnit:ModifyRunSpeed(18)
  156.         pUnit:MoveTo(x, y, z)
  157.         pUnit:Root()
  158.         pUnit:CastSpell(69138)
  159.         vars[id].temp.flametar = plr
  160.     end
  161. end
  162. function func.lordm.stormeffect (pUnit, Event)
  163.     local id = pUnit:GetInstanceID()
  164.     vars[id].bsplr = {}
  165.     local i = lordm[id].dif
  166.     for _, v in pairs (pUnit:GetInRangePlayers()) do
  167.         if pUnit:GetDistanceYards(v) <= 30 then
  168.             table.insert(vars[id].bsplr, v , pUnit:GetDistanceYards(v))
  169.         end
  170.     end
  171.     for n, d in next,vars[id].bsplr,nil do
  172.         if (d <= 10) then local dam = spell.storm[i].maxdam end
  173.         if (d > 10) then local dam = (1000 + (spell.storm[i].maxdam*(spell.storm[i].maxdam/100))) end
  174.         pUnit:DealDamage(n,dam,spell.storm[i].aura)
  175.     end
  176.     vars[id].bsplr = nil
  177. end
  178. function func.lordm.stormstop (pUnit, Event)
  179.     pUnit:Unroot()
  180.     pUnit:ModifyRunSpeed(1)
  181.     pUnit:RemoveAura(69076)
  182.     pUnit:ClearThreatList()
  183.     pUnit:RegisterEvent("func.lordm.stand", 100, 1)
  184. end
  185. function func.lordm.onkill (pUnit, Event)
  186.     local id = pUnit:GetInstanceID()
  187.     math.random(); math.random(); math.random()
  188.     local x = math.random(1, 2)
  189.     vars[id].yell = {
  190.         [1] = { num = 16942 , speech = "More bones for the offering!" },
  191.         [2] = { num = 16943 , speech = "Languish in damnation!" }
  192.         }
  193.     pUnit:PlaySoundToSet(vars[id].yell[x][num])
  194.     pUnit:SendChatMessage(14, 0, vars[id].yell[x][speech])
  195. end
  196. function func.lordm.ondeath (pUnit, Event)
  197.     pUnit:RemoveEvents()
  198.     local id = pUnit:GetInstanceID()
  199.     local d = lordm[id].dif
  200.     math.random(); math.random(); math.random()
  201.     -- Adding Shadowfrost shard if applicable
  202.     local x = nil
  203.     local plr = pUnit:GetRandomPlayer(0)
  204.     for _, v in pairs (plr:GetGroupPlayers()) do
  205.         if v:HasQuest(24548) == true then
  206.             if (d == 2 or 4) then
  207.                 if d == 2 then local n = 25 else local n = 50 end
  208.                 if (math.random(1, 100) >= math.random(n, 100)) == true then pUnit:AddLoot( 50274 , 1 , 1 , true ) end
  209.             end
  210.         break
  211.         end
  212.     end
  213.     vars[id] = nil
  214.     lordm[id] = nil
  215.     spike[id] = nil
  216.     pUnit:PlaySoundToSet(16944)
  217.     pUnit:SendChatMessage(12, 0, "I see... only darkness...")
  218. end
  219. function func.lordm.onleave (pUnit, Event)
  220.     pUnit:RemoveEvents()
  221.     vars[id] = nil
  222.     lordm[id] = nil
  223.     spike[id] = nil
  224.     pUnit:Despawn(2000, 20000)
  225. end
  226. --[[
  227. *******************************************************************
  228. **                                                               **
  229. **                     COLD FLAME  (and Kobold)                  **
  230. **                                                               **
  231. *******************************************************************
  232. ]]
  233. function func.kobold.onspawn(pUnit, event)
  234.     local id = pUnit:GetInstanceID()
  235.     pUnit:Root()
  236.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2)
  237.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  238.     pUnit:SetInvisible(true)
  239.     pUnit:SetCombatMeleeCapable(false)
  240.     pUnit:SetCombatRangedCapable(false)
  241.     local sUnit = tostring(pUnit)
  242.     vars[id].spcount[sUnit] = 1
  243.     local plr = vars[id].temp.flametar
  244.     local m = vars[id].temp.m
  245.     local d = lordm[id].dif
  246.     local bx,by = pUnit:GetLocation()
  247.     local px,py = plr:GetLocation()
  248.     local angle = pUnit:CalcRadAngle( bx, by, px, py )
  249.     pUnit:SetFaction(35)
  250.     local storming = lordm[id].unit:HasAura(69076)
  251.     if (storming == true) then
  252.         for i=1,16 do
  253.             table.insert ( vars[id].clmpts[sUnit], i, {
  254.                 ul = { x = bx + ((3 * i) * math.cos(angle + (math.pi / 4)) ) , y = by + ((3 * i) * math.sin(angle + (math.pi / 4)) ) },
  255.                 ll = { x = bx + ((3 * i) * math.cos(angle + (3 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (3 * (math.pi / 4))) ) },
  256.                 lr = { x = bx + ((3 * i) * math.cos(angle + (5 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (5 * (math.pi / 4))) ) },
  257.                 ur = { x = bx + ((3 * i) * math.cos(angle + (7 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (7 * (math.pi / 4))) ) }
  258.             })
  259.         end
  260.         pUnit:RegisterEvent("func.kobold.coldflames", 500, 16)
  261.     else
  262.         for i=1,16 do
  263.             local r = (m + (2.5 * (i - 1)))
  264.             table.insert (vars[id].cflmpt[sUnit], i,  { x = (bx + (r * math.cos(angle))) , y =  (by + (r * math.sin(angle)))})
  265.         end
  266.         pUnit:RegisterEvent("func.kobold.coldflame", 500, 16)
  267.     end
  268.     pUnit:RegisterEvent("func.kobold.remove", 8100, 1)
  269.     pUnit:RegisterEvent("func.kobold.bossdead", 100, 0)
  270. end
  271. function func.kobold.coldflames(pUnit, event)
  272.     local sUnit = tostring(pUnit)
  273.     local id = pUnit:GetInstanceID()
  274.     local v = vars[id].spcount[sUnit]
  275.     local bx,by = pUnit:GetLocation()
  276.     local d = lordm[id].dif
  277.     for _, i in next,vars[id].clmpts[sUnit][v] do
  278.         local z = pUnit:GetLandHeight( i.x, i.y )
  279.         local o = pUnit:CalcRadAngle( bx, by, i.x, i.y )
  280.         pUnit:SpawnCreature(36672, i.x, i.y, z, o, 14, spell.flame.life[d])
  281.     end
  282.     vars[id].spcount[sUnit] = v + 1
  283. end
  284. function func.kobold.coldflame(pUnit, event)
  285.     local sUnit = tostring(pUnit)
  286.     local id = pUnit:GetInstanceID()
  287.     local v = vars[id].spcount[sUnit]
  288.     local x = vars[id].cflmpts[sUnit][v].x
  289.     local y = vars[id].cflmpts[sUnit][v].y
  290.     local z = pUnit:GetLandHeight(x,y)
  291.     local o = pUnit:GetOrientation()
  292.     local d = lordm[id].dif
  293.     pUnit:SpawnCreature(36672, x, y, z, o, 14, spell.flame.life[d])
  294.     vars[id].spcount[sUnit] = v + 1
  295. end
  296. function func.kobold.remove(pUnit, event)
  297.     local sUnit = tostring(pUnit)
  298.     local id = pUnit:GetInstanceID()
  299.     vars[id].spcount[sUnit] = nil
  300.     vars[id].cflmpt[sUnit] = nil
  301.     pUnit:RemoveEvents()
  302.     pUnit:RemoveFromWorld()
  303. end
  304. function func.kobold.bossdead (pUnit, event)
  305.     if vars[id] = nil then pUnit:RegisterEvent("func.kobold.remove", 100, 1) end
  306. end
  307. function func.flame.onspawn(pUnit, event)
  308.     local id = pUnit:GetInstanceID()
  309.     local d = lordm[id].dif
  310.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2)
  311.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  312.     pUnit:Root()
  313.     pUnit:SetCombatMeleeCapable(false)
  314.     pUnit:SetCombatRangedCapable(false)
  315.     local times = spell.flame[d].life / 1000
  316.     local timer = spell.flame[d].life / times
  317.     pUnit:RegisterEvent("func.flame.spell", timer, times)
  318. end
  319. function func.flame.spell(pUnit, event)
  320.     local id = pUnit:GetInstanceID()
  321.     local d = lordm[id].dif
  322.     local x,y,z = pUnit:GetLocation()
  323.     pUnit:CastSpellAoF(x, y, z, spell.flame[d].spell)
  324. end
  325. --[[
  326. *******************************************************************
  327. **                                                               **
  328. **                           BONE SPIKE                          **
  329. **                                                               **
  330. *******************************************************************
  331. ]]
  332. function func.spike.onspawn (pUnit, Event)
  333.     local sUnit = tostring(pUnit)
  334.     local id = pUnit:GetInstanceID()
  335.     pUnit:Root()
  336.     spike[id][sUnit] = pUnit:GetClosestPlayer()
  337.     pUnit:CastSpellOnTarget( 69065, spike[id][sUnit] )
  338. end
  339. function func.spike.death (pUnit, Event)
  340.     local sUnit = tostring(pUnit)
  341.     local id = pUnit:GetInstanceID()
  342.     spike[id][sUnit]:RemoveAura(69065)
  343.     spike[id][sUnit] = nil
  344. end
  345. function func.spike.kill (pUnit, Event)
  346.     local sUnit = tostring(pUnit)
  347.     local id = pUnit:GetInstanceID()
  348.     pUnit:RemoveFromWorld()
  349.     spike[id][sUnit] = nil
  350. end
  351. --[[
  352. *******************************************************************
  353. **                                                               **
  354. **                          DUMMY SPELLS                         **
  355. **                                                               **
  356. *******************************************************************
  357. ]]
  358. function spell.dummy.bonespike (effectIndex, spell)
  359.     local sUnit = spell:GetCaster()
  360.     local id = sUnit:GetInstanceID()
  361.     -- For 10 Man
  362.     if (lordm[id].dif == 1 or 3) then
  363.         local plr = spell:GetRandomPlayer(7)
  364.         local x,y,z,o = plr:GetLocation()
  365.         sUnit:SpawnCreature(38711,x,y,z,o,14,0)
  366.     end
  367.     -- For 25 Man
  368.     if (lordm[id].dif == 2 or 4) then
  369.         local tar = 0
  370.         local tmp = nil
  371.         -- This section is here to ensure he targets 3 separate people
  372.         for tar=1, 3 do
  373.             tmp = spell:GetRandomPlayer(7)
  374.             vars[id].bsplr = nil
  375.             if tar == 1 then
  376.                 vars[id].bsplr[tar] = tmp
  377.             end
  378.             if tar == 2 then
  379.                 while (vars[id].bsplr[1] == tmp) do
  380.                     tmp = spell:GetRandomPlayer(7)
  381.                 end
  382.                 vars[id].bsplr[tar] = tmp
  383.             end
  384.             if tar == 3 then
  385.                 while (vars[id].bsplr[1] == tmp) or (vars[id].bsplr[2] == tmp) do
  386.                     tmp = spell:GetRandomPlayer(7)
  387.                 end
  388.                 vars[id].bsplr[tar] = tmp
  389.             end
  390.         end
  391.         for v=1,3 do
  392.             local x,y,z,o = vars[id].bsplr[v]:GetLocation()
  393.             sUnit:SpawnCreature(38711,x,y,z,o,14,0)
  394.         end
  395.     end
  396.  end
  397. --[[
  398. *******************************************************************
  399. **                                                               **
  400. **                        MISC & REGISTERS                       **
  401. **                                                               **
  402. *******************************************************************
  403. ]]
  404. function func.hook.logout(event, pPlayer)
  405.     if pPlayer:HasAura(69065) then pPlayer:RemoveAura(69065) end -- in case someone DCs during fight, they won't comeback with the aura
  406. end
  407. RegisterServerHook(13, "func.hook.logout")
  408. RegisterDummySpell(69057, "spell.dummy.bonespike")
  409. RegisterUnitEvent(6, 18, "func.kobold.onspawn")
  410. RegisterUnitEvent(36672, 18, "func.flame.onspawn")
  411. RegisterUnitEvent(36612, 18, "func.lordm.onspawn")
  412. RegisterUnitEvent(36612, 1, "func.lordm.oncombat")
  413. RegisterUnitEvent(36612, 2, "func.lordm.onleave")
  414. RegisterUnitEvent(36612, 3, "func.lordm.onkill")
  415. RegisterUnitEvent(36612, 4, "func.lordm.ondeath")
  416. RegisterUnitEvent(38711, 18, "func.spike.onspawn")
  417. RegisterUnitEvent(38711, 3, "func.spike.onkill")
  418. RegisterUnitEvent(38711, 4, "func.spike.ondeath")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement