SHARE
TWEET

Untitled

a guest Jun 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     local
  178. end
  179. function func.lordm.stormstop (pUnit, Event)
  180.     pUnit:Unroot()
  181.     pUnit:ModifyRunSpeed(1)
  182.     pUnit:RemoveAura(69076)
  183.     pUnit:ClearThreatList()
  184.     pUnit:RegisterEvent("func.lordm.stand", 100, 1)
  185. end
  186. function func.lordm.onkill (pUnit, Event)
  187.     local id = pUnit:GetInstanceID()
  188.     math.random(),math.random(),math.random()
  189.     local x = math.random(1, 2)
  190.     vars[id].yell = {
  191.         [1] = { num = 16942 , speech = "More bones for the offering!" },
  192.         [2] = { num = 16943 , speech = "Languish in damnation!" }
  193.         }
  194.     pUnit:PlaySoundToSet(vars[id].yell[x][num])
  195.     pUnit:SendChatMessage(14, 0, vars[id].yell[x][speech])
  196. end
  197. function func.lordm.ondeath (pUnit, Event)
  198.     pUnit:RemoveEvents()
  199.     local id = pUnit:GetInstanceID()
  200.     local d = lordm[id].dif
  201.     math.random(),math.random(),math.random()
  202.     -- Adding Shadowfrost shard if applicable
  203.     local x = nil
  204.     local plr = pUnit:GetRandomPlayer(0)
  205.     for _, v in pairs (plr:GetGroupPlayers()) do
  206.         if v:HasQuest(24548) == true then
  207.             if (d == 2 or 4) then
  208.                 if d == 2 then local n = 25 else local n = 50 end
  209.                 if (math.random(1, 100) >= math.random(n, 100)) == true then pUnit:AddLoot( 50274 , 1 , 1 , true ) end
  210.             end
  211.         break
  212.         end
  213.     end
  214.     vars[id] = nil
  215.     lordm[id] = nil
  216.     spike[id] = nil
  217.     pUnit:PlaySoundToSet(16944)
  218.     pUnit:SendChatMessage(12, 0, "I see... only darkness...")
  219. end
  220. function func.lordm.onleave (pUnit, Event)
  221.     pUnit:RemoveEvents()
  222.     vars[id] = nil
  223.     lordm[id] = nil
  224.     spike[id] = nil
  225.     pUnit:Despawn(2000, 20000)
  226. end
  227. --[[
  228. *******************************************************************
  229. **                                                               **
  230. **                     COLD FLAME  (and Kobold)                  **
  231. **                                                               **
  232. *******************************************************************
  233. ]]
  234. function func.kobold.onspawn(pUnit, event)
  235.     local id = pUnit:GetInstanceID()
  236.     pUnit:Root()
  237.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2)
  238.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  239.     pUnit:SetInvisible(true)
  240.     pUnit:SetCombatMeleeCapable(false)
  241.     pUnit:SetCombatRangedCapable(false)
  242.     local sUnit = tostring(pUnit)
  243.     vars[id].spcount[sUnit] = 1
  244.     local plr = vars[id].temp.flametar
  245.     local m = vars[id].temp.m
  246.     local d = lordm[id].dif
  247.     local bx,by = pUnit:GetLocation()
  248.     local px,py = plr:GetLocation
  249.     local angle = pUnit:CalcRadAngle( bx, by, px, py )
  250.     pUnit:SetFaction(35)
  251.     local storming = lordm[id].unit:HasAura(69076)
  252.     if (storming == true) then
  253.         for i=1,16 do
  254.             table.insert ( vars[id].clmpts[sUnit], i, {
  255.                 ul = { x = bx + ((3 * i) * math.cos(angle + (math.pi / 4)) ) , y = by + ((3 * i) * math.sin(angle + (math.pi / 4)) ) },
  256.                 ll = { x = bx + ((3 * i) * math.cos(angle + (3 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (3 * (math.pi / 4))) ) },
  257.                 lr = { x = bx + ((3 * i) * math.cos(angle + (5 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (5 * (math.pi / 4))) ) },
  258.                 ur = { x = bx + ((3 * i) * math.cos(angle + (7 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (7 * (math.pi / 4))) ) }
  259.             })
  260.         end
  261.         pUnit:RegisterEvent("func.kobold.coldflames", 500, 16)
  262.     else
  263.         for i=1,16 do
  264.             local r = (m + (2.5 * (i - 1)))
  265.             table.insert (vars[id].cflmpt[sUnit], i,  { x = (bx + (r * math.cos(angle))) , y =  (by + (r * math.sin(angle)))})
  266.         end
  267.         pUnit:RegisterEvent("func.kobold.coldflame", 500, 16)
  268.     end
  269.     pUnit:RegisterEvent("func.kobold.remove", 8100, 1)
  270.     pUnit:RegisterEvent("func.kobold.bossdead", 100, 0)
  271. end
  272. function func.kobold.coldflames(pUnit, event)
  273.     local sUnit = tostring(pUnit)
  274.     local id = pUnit:GetInstanceID()
  275.     local v = vars[id].spcount[sUnit]
  276.     local bx,by = pUnit:GetLocation()
  277.     local d = lordm[id].dif
  278.     for _, i in next,vars[id]clmpts[sUnit][v] do
  279.         local z = pUnit:GetLandHeight( i.x, i.y )
  280.         local o = pUnit:CalcRadAngle( bx, by, i.x, i.y )
  281.         pUnit:SpawnCreature(36672, i.x, i.y, z, o, 14, spell.flame.life[d])
  282.     end
  283.     vars[id].spcount[sUnit] = v + 1
  284. end
  285. function func.kobold.coldflame(pUnit, event)
  286.     local sUnit = tostring(pUnit)
  287.     local id = pUnit:GetInstanceID()
  288.     local v = vars[id].spcount[sUnit]
  289.     local x = vars[id].cflmpts[sUnit][v].x
  290.     local y = vars[id].cflmpts[sUnit][v].y
  291.     local z = pUnit:GetLandHeight(x,y)
  292.     local o = pUnit:GetOrientation()
  293.     local d = lordm[id].dif
  294.     pUnit:SpawnCreature(36672, x, y, z, o, 14, spell.flame.life[d])
  295.     vars[id].spcount[sUnit] = v + 1
  296. end
  297. function func.kobold.remove(pUnit, event)
  298.     local sUnit = tostring(pUnit)
  299.     local id = pUnit:GetInstanceID()
  300.     vars[id].spcount[sUnit] = nil
  301.     vars[id].cflmpt[sUnit] = nil
  302.     pUnit:RemoveEvents()
  303.     pUnit:RemoveFromWorld()
  304. end
  305. function func.kobold.bossdead (pUnit, event)
  306.     if vars[id] = nil then pUnit:RegisterEvent("func.kobold.remove", 100, 1) end
  307. end
  308. function func.flame.onspawn(pUnit, event)
  309.     local id = pUnit:GetInstanceID()
  310.     local d = lordm[id].dif
  311.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2)
  312.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  313.     pUnit:Root()
  314.     pUnit:SetCombatMeleeCapable(false)
  315.     pUnit:SetCombatRangedCapable(false)
  316.     local times = spell.flame[d].life / 1000
  317.     local timer = spell.flame[d].life / times
  318.     pUnit:RegisterEvent("func.flame.spell", timer, times)
  319. end
  320. function func.flame.spell(pUnit, event)
  321.     local id = pUnit:GetInstanceID()
  322.     local d = lordm[id].dif
  323.     local x,y,z = pUnit:GetLocation()
  324.     pUnit:CastSpellAoF(x, y, z, spell.flame[d].spell)
  325. end
  326. --[[
  327. *******************************************************************
  328. **                                                               **
  329. **                           BONE SPIKE                          **
  330. **                                                               **
  331. *******************************************************************
  332. ]]
  333. function func.spike.onspawn (pUnit, Event)
  334.     local sUnit = tostring(pUnit)
  335.     local id = pUnit:GetInstanceID()
  336.     pUnit:Root()
  337.     spike[id][sUnit] = pUnit:GetClosestPlayer()
  338.     pUnit:CastSpellOnTarget( 69065, spike[id][sUnit] )
  339. end
  340. function func.spike.death (pUnit, Event)
  341.     local sUnit = tostring(pUnit)
  342.     local id = pUnit:GetInstanceID()
  343.     spike[id][sUnit]:RemoveAura(69065)
  344.     spike[id][sUnit] = nil
  345. end
  346. function func.spike.kill (pUnit, Event)
  347.     local sUnit = tostring(pUnit)
  348.     local id = pUnit:GetInstanceID()
  349.     pUnit:RemoveFromWorld()
  350.     spike[id][sUnit] = nil
  351. end
  352. --[[
  353. *******************************************************************
  354. **                                                               **
  355. **                          DUMMY SPELLS                         **
  356. **                                                               **
  357. *******************************************************************
  358. ]]
  359. function spell.dummy.bonespike (effectIndex, spell)
  360.     local sUnit = spell:GetCaster()
  361.     local id = sUnit:GetInstanceID()
  362.     -- For 10 Man
  363.     if (lordm[id].dif == 1 or 3) then
  364.         local plr = spell:GetRandomPlayer(7)
  365.         local x,y,z,o = plr:GetLocation()
  366.         pUnit:SpawnCreature(38711,x,y,z,o,14,0)
  367.     end
  368.     -- For 25 Man
  369.     if (lordm[id].dif == 2 or 4) then
  370.         local tar = 0
  371.         local tmp = nil
  372.         -- This section is here to ensure he targets 3 separate people
  373.         for tar=1, 3 do
  374.             tmp = spell:GetRandomPlayer(7)
  375.             vars[id].bsplr = nil
  376.             if tar == 1 then
  377.                 vars[id].bsplr[tar] = tmp
  378.             end
  379.             if tar == 2 then
  380.                 while (vars[id].bsplr[1] == tmp) do
  381.                     tmp = spell:GetRandomPlayer(7)
  382.                 end
  383.                 vars[id].bsplr[tar] = tmp
  384.             end
  385.             if tar == 3 then
  386.                 while (vars[id].bsplr[1] == tmp) or (vars[id].bsplr[2] == tmp) do
  387.                     tmp = spell:GetRandomPlayer(7)
  388.                 end
  389.                 vars[id].bsplr[tar] = tmp
  390.             end
  391.         end
  392.         for v=1,3 do
  393.             local x,y,z,o = vars[id].bsplr[v]:GetLocation()
  394.             pUnit:SpawnCreature(38711,x,y,z,o,14,0)
  395.         end
  396.     end
  397.  end
  398. --[[
  399. *******************************************************************
  400. **                                                               **
  401. **                        MISC & REGISTERS                       **
  402. **                                                               **
  403. *******************************************************************
  404. ]]
  405. function func.hook.logout(event, pPlayer)
  406.     if pPlayer:HasAura(69065) then pPlayer:RemoveAura(69065) end -- in case someone DCs during fight, they won't comeback with the aura
  407. end
  408. RegisterServerHook(13, "func.hook.logout")
  409. RegisterDummySpell(69057, "spell.dummy.bonespike")
  410. RegisterUnitEvent(6, 18, "func.kobold.onspawn")
  411. RegisterUnitEvent(36672, 18, "func.flame.onspawn")
  412. RegisterUnitEvent(36612, 18, "func.lordm.onspawn")
  413. RegisterUnitEvent(36612, 1, "func.lordm.oncombat")
  414. RegisterUnitEvent(36612, 2, "func.lordm.onleave")
  415. RegisterUnitEvent(36612, 3, "func.lordm.onkill")
  416. RegisterUnitEvent(36612, 4, "func.lordm.ondeath")
  417. RegisterUnitEvent(38711, 18, "func.spike.onspawn")
  418. RegisterUnitEvent(38711, 3, "func.spike.onkill")
  419. RegisterUnitEvent(38711, 4, "func.spike.ondeath")
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top