stoneharry

Untitled

Jan 16th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.88 KB | None | 0 0
  1. local PlayerClassToInt = {["Warrior"] = 1, ["Paladin"] = 2, ["Hunter"] = 3, ["Rogue"] = 4, ["Priest"] = 5,
  2. ["Death Knight"] = 6, ["Shaman"] = 7, ["Mage"] = 8, ["Warlock"] = 9, ["Druid"] = 11, ["Demon Hunter"] = 12}
  3.  
  4. local RaceDisplayMap = {
  5.     {49, 50}, {51, 52}, {53, 54}, {55, 56}, {57, 58},
  6.     {59, 60}, {1563, 1564}, {1478, 1479}, {6894, 6895}, {15476, 15475},
  7.     {16125, 16126}, {16981, 16980}, {17402, 17403}, {17576,
  8.     17577}, {17578, 17579}, {21685, 21686}, {21780,21780},{21963,
  9.     21964}, {26316, 26317}, {26871, 26872}, {26873, 26874}
  10. };
  11.  
  12. function DisplaySetDelay(pUnit)
  13.     local plr = pUnit:GetClosestPlayer()
  14.     if not plr then
  15.         return
  16.     end
  17.     if plr:GetGender() == 0 then
  18.         plr:RemoveAura(35480)
  19.     else
  20.         plr:RemoveAura(35481)
  21.     end
  22.     local model = RaceDisplayMap[plr:GetPlayerRace()][plr:GetGender()+1]
  23.     if not model then
  24.         model = plr:GetDisplay()
  25.     end
  26.     pUnit:SetModel(model)
  27. end
  28.  
  29. function MirrorSpawnImage165(pUnit, Event)
  30.     if Event == 18 then
  31.         pUnit:SetUInt32Value(0x0006 + 0x0035, 0x02000000)
  32.         pUnit:RegisterEvent("DisplaySetDelay", 600, 1)
  33.         pUnit:RegisterEvent("Wait_A_Second_Then_Update_Mirrorimage", 1000, 1)
  34.     elseif Event == 4 then
  35.         pUnit:RemoveEvents()
  36.     elseif Event == 1 then
  37.         local class = pUnit:GetValue("class")
  38.         if class == "Warrior" then
  39.             local plr = pUnit:GetMainTank()
  40.             if plr then
  41.                 pUnit:FullCastSpellOnTarget(41581, plr) -- charge0
  42.             end
  43.             pUnit:RegisterEvent("ThunderClapEtc", 6000, 0)
  44.         elseif class == "Paladin" then
  45.             --pUnit:FullCastSpell(20217) -- blessing of kings
  46.             pUnit:RegisterEvent("HealPeoplePaladin", 5000, 0)
  47.         elseif class == "Hunter" then
  48.             pUnit:RegisterEvent("HunterAIEtc", 2500, 0)
  49.         elseif class == "Rogue" then
  50.             pUnit:RegisterEvent("RogueAIEtc", 2500, 0)
  51.         elseif class == "Priest" then
  52.             pUnit:RegisterEvent("PriestAIEtc", 1000, 0)
  53.         elseif class == "Shaman" then
  54.             pUnit:RegisterEvent("ShamanAIEtc", 5000, 0)
  55.         elseif class == "Mage" then
  56.             pUnit:RegisterEvent("MageAIEtc", 3000, 0)
  57.         elseif class == "Warlock" then
  58.             pUnit:RegisterEvent("WarlockAIEtc", 1000, 0)
  59.         elseif class == "Druid" then
  60.             pUnit:RegisterEvent("DruidAIEtc", 1000, 0)
  61.         elseif class == "Demon Hunter" then
  62.             pUnit:RegisterEvent("DemonAIEtc", 2500, 0)
  63.             pUnit:FullCastSpell(50046)
  64.         end    
  65.     end
  66. end
  67.  
  68. function WarlockAIEtc(pUnit)
  69.     if pUnit:IsCasting() then
  70.         return
  71.     end
  72.     local plr = pUnit:GetMainTank()
  73.     if not plr then
  74.         return
  75.     end
  76.     if not pUnit:HasAura(696) then
  77.         pUnit:FullCastSpell(696)
  78.         return
  79.     end
  80.     if not plr:HasAura(1094) then
  81.         pUnit:FullCastSpellOnTarget(1094, plr) -- immolate
  82.         return
  83.     end
  84.     if not plr:HasAura(6223) then
  85.         pUnit:FullCastSpellOnTarget(6223, plr) -- affliction
  86.         return
  87.     end
  88.     if not plr:HasAura(1014) then
  89.         pUnit:FullCastSpellOnTarget(1014, plr) -- curse of agony
  90.         return
  91.     end
  92.     local chance = math.random(1,3)
  93.     if chance == 1 then
  94.         pUnit:FullCastSpellOnTarget(1088, plr) -- shadowbolt
  95.     elseif chance == 2 then
  96.         pUnit:FullCastSpellOnTarget(5676, plr) -- searing pain
  97.     elseif chance == 3 then
  98.         pUnit:FullCastSpellOnTarget(709, plr) -- drain life
  99.     end
  100. end
  101.  
  102. function MageAIEtc(pUnit)
  103.     if pUnit:IsCasting() then
  104.         return
  105.     end
  106.     if not pUnit:HasAura(7302) then
  107.         pUnit:FullCastSpell(7302)
  108.         return
  109.     end
  110.     local plr = pUnit:GetMainTank()
  111.     if not plr then
  112.         return
  113.     end
  114.     local chance = math.random(1,5)
  115.     if chance == 1 then
  116.         pUnit:FullCastSpellOnTarget(51103, plr) -- frostbomb
  117.     elseif chance == 2 then
  118.         pUnit:FullCastSpellOnTarget(8406, plr) -- frostbolt
  119.     elseif chance == 3 then
  120.         pUnit:FullCastSpellOnTarget(8401, plr) -- fireball
  121.     elseif chance == 4 then
  122.         pUnit:CastSpellAoF(plr:GetX(), plr:GetY(), plr:GetZ(), 2121) -- flamestrike
  123.     elseif chance == 5 then
  124.         pUnit:FullCastSpellOnTarget(5145, plr) -- arcane missiles
  125.     end
  126. end
  127.  
  128. function RejuvinateDruid(pUnit)
  129.     pUnit:CastSpell(9840)
  130. end
  131.  
  132. function DruidAIEtc(pUnit)
  133.     if pUnit:IsCasting() then
  134.         return
  135.     end
  136.     if pUnit:GetHealthPct() < 75 and math.random(1,2) == 1 then
  137.         pUnit:FullCastSpell(8938)
  138.         pUnit:RegisterEvent("RejuvinateDruid", 3050, 1)
  139.         return
  140.     end
  141.     --[[if not pUnit:HasAura(6756) then
  142.         pUnit:FullCastSpell(6756)
  143.     end]]
  144.     local plr = pUnit:GetMainTank()
  145.     if not plr then
  146.         return
  147.     end
  148.     local chance = math.random(1,3)
  149.     if chance == 1 then
  150.         pUnit:FullCastSpellOnTarget(2912, plr) -- starfire
  151.     elseif chance == 2 then
  152.         pUnit:FullCastSpellOnTarget(8926, plr) -- moonfire
  153.     elseif chance == 3 then
  154.         pUnit:FullCastSpellOnTarget(5179, plr) -- wrath
  155.     end
  156. end
  157.  
  158. function ShamanAIEtc(pUnit)
  159.     if pUnit:IsCasting() then
  160.         return
  161.     end
  162.     if pUnit:GetHealthPct() < 60 and math.random(1,2) == 1 then
  163.         pUnit:FullCastSpell(1064)
  164.         return
  165.     end
  166.     if not pUnit:HasAura(325) then
  167.         pUnit:FullCastSpell(325)
  168.     end
  169.     local plr = pUnit:GetMainTank()
  170.     if not plr then
  171.         return
  172.     end
  173.     local chance = math.random(1,3)
  174.     if chance == 1 then
  175.         pUnit:CastSpellAoF(plr:GetX(), plr:GetY(), plr:GetZ(), 50068)
  176.     elseif chance == 2 then
  177.         pUnit:FullCastSpellOnTarget(421, plr) -- chain lightning
  178.     elseif chance == 3 then
  179.         pUnit:FullCastSpellOnTarget(8045, plr) -- earth shock
  180.     end
  181. end
  182.  
  183. function PriestAIEtc(pUnit)
  184.     if pUnit:IsCasting() then
  185.         return
  186.     end
  187.     if pUnit:GetHealthPct() < 75 and math.random(1,2) == 1 then
  188.         pUnit:FullCastSpell(1026)
  189.         return
  190.     end
  191.     for _,v in pairs(pUnit:GetInRangeFriends()) do
  192.         if v:GetDistanceYards(pUnit) < 30 and v:GetHealthPct() < 75 then
  193.             pUnit:FullCastSpellOnTarget(1026, v)
  194.             return
  195.         end
  196.     end
  197.     --[[if not (pUnit:HasAura(21084)) then
  198.         pUnit:FullCastSpell(21084)
  199.         return
  200.     end]]
  201.     local plr = pUnit:GetMainTank()
  202.     if plr then
  203.         pUnit:FullCastSpellOnTarget(15238, plr)
  204.     end
  205. end
  206.  
  207. function HealPeoplePaladin(pUnit)
  208.     if pUnit:IsCasting() then
  209.         return
  210.     end
  211.     if pUnit:GetHealthPct() < 75 and math.random(1,2) == 1 then
  212.         pUnit:FullCastSpell(2055)
  213.         return
  214.     end
  215.     for _,v in pairs(pUnit:GetInRangeFriends()) do
  216.         if v:GetDistanceYards(pUnit) < 30 and v:GetHealthPct() < 50 then
  217.             pUnit:FullCastSpellOnTarget(2055, v)
  218.             return
  219.         end
  220.     end
  221.     --[[if not (pUnit:HasAura(1245)) then
  222.         pUnit:FullCastSpell(1245)
  223.         return
  224.     end]]
  225.     local plr = pUnit:GetMainTank()
  226.     if plr then
  227.         pUnit:FullCastSpellOnTarget(15262, plr)
  228.     end
  229. end
  230.  
  231. function HunterAIEtc(pUnit)
  232.     local plr = pUnit:GetMainTank()
  233.     if not plr then
  234.         return
  235.     end
  236.     if plr:GetDistanceYards(pUnit) > 30 then
  237.         pUnit:Unroot()
  238.         return
  239.     else
  240.         pUnit:Root()
  241.     end
  242.     local chance = math.random(1,2)
  243.     if chance == 1 then
  244.         pUnit:FullCastSpellOnTarget(14282, plr) -- arcane shot
  245.     elseif chance == 2 then
  246.         pUnit:FullCastSpellOnTarget(14443, plr) -- multi-shot
  247.     end
  248. end
  249.  
  250. function RogueAIEtc(pUnit)
  251.     local plr = pUnit:GetMainTank()
  252.     if not plr then
  253.         return
  254.     end
  255.     if math.random(1,6) == 1 then
  256.         pUnit:CastSpell(31224)
  257.     elseif math.random(1,6) == 1 then
  258.         pUnit:FullCastSpellOnTarget(72335, plr)
  259.     end
  260.     pUnit:FullCastSpellOnTarget(8621, plr) -- sinister strike
  261. end
  262.  
  263. function DemonAIEtc(pUnit)
  264.     local plr = pUnit:GetMainTank()
  265.     if not plr then
  266.         return
  267.     end
  268.     if pUnit:GetHealthPct() < 30 then
  269.         pUnit:FullCastSpell(33247) -- heal
  270.         return
  271.     end
  272.     if math.random(1,3) == 1 then
  273.         pUnit:FullCastSpellOnTarget(50059, plr) -- burn
  274.         return
  275.     end
  276.     if math.random(1,2) == 1 then
  277.         pUnit:FullCastSpellOnTarget(50071, plr) -- blow
  278.     else
  279.         pUnit:FullCastSpellOnTarget(50050, plr) -- black cleave
  280.     end
  281. end
  282.  
  283. function ThunderClapEtc(pUnit)
  284.     local plr = pUnit:GetMainTank()
  285.     if not plr then
  286.         return
  287.     end
  288.     local chance = math.random(1,3)
  289.     if chance == 1 then
  290.         pUnit:FullCastSpell(25264)
  291.     elseif chance == 2 then
  292.         pUnit:FullCastSpellOnTarget(15284, plr)
  293.     elseif chance == 3 then
  294.         pUnit:FullCastSpell(11555)
  295.     end
  296. end
  297.  
  298. function Wait_A_Second_Then_Update_Mirrorimage(pUnit)
  299.     pUnit:SetUInt32Value(0x0006 + 0x0035, 0)
  300.     local plr = pUnit:GetClosestPlayer()
  301.     if not plr then
  302.         return
  303.     end
  304.     if plr:GetGender() == 0 then
  305.         plr:RemoveAura(35480)
  306.     else
  307.         plr:RemoveAura(35481)
  308.     end
  309.  
  310.     pUnit:SetFaction(21)
  311.  
  312.     --plr:CastSpellOnTarget(69828, pUnit) -- change display
  313.     plr:CastSpellOnTarget(69837, pUnit) -- change name
  314.  
  315.     --[[local model = RaceDisplayMap[plr:GetPlayerRace()][plr:GetGender()+1]
  316.     if not model then
  317.         model = plr:GetDisplay()
  318.     end
  319.     pUnit:SetModel(model)]]
  320.  
  321.     pUnit:SetUInt32Value(60, bit_or(pUnit:GetUInt32Value(60), 16))
  322.    
  323.     local p = LuaPacket:CreatePacket(1026, 68)
  324.  
  325.     p:WriteGUID(pUnit:GetGUID())
  326.     p:WriteULong(plr:GetDisplay()) -- race display
  327.  
  328.     p:WriteUByte(plr:GetPlayerRace()) -- race ID
  329.     p:WriteUByte(plr:GetGender()) -- gender
  330.     p:WriteUByte(PlayerClassToInt[plr:GetPlayerClass()]) -- class ID
  331.     p:WriteUByte(plr:GetByteValue(153, 0)) -- skinID
  332.     p:WriteUByte(plr:GetByteValue(153, 1)) -- faceID
  333.     p:WriteUByte(plr:GetByteValue(153, 2)) -- Hair style ID
  334.     p:WriteUByte(plr:GetByteValue(153, 3)) -- Hair colour ID
  335.     p:WriteUByte(plr:GetByteValue(154, 0)) -- facial hair ID
  336.     local guild = plr:GetGuildId()
  337.     if not guild then
  338.         guild = 0
  339.     end
  340.     p:WriteULong(guild) -- guild
  341.  
  342.     local slot_ids = {0, 2, 3, 4, 5, 6, 7, 8, 9, 14, 18}
  343.    
  344.     local i;
  345.     for i = 0, 10 do
  346.         local item = plr:GetEquippedItemBySlot(slot_ids[i+1])
  347.         if not item then
  348.             p:WriteULong(0)
  349.         else
  350.             local display = item:GetDisplayId()
  351.             if not display then
  352.                 display = 0
  353.             end
  354.             if i == 0 and plr:HasFlag(150, 1024) then
  355.                 display = 0
  356.             elseif i == 9 and plr:HasFlag(150, 2048) then
  357.                 display = 0
  358.             end
  359.             p:WriteULong(display)
  360.         end
  361.     end
  362.    
  363.     local item = plr:GetEquippedItemBySlot(15)
  364.     if item then
  365.         pUnit:SetUInt32Value(0x0006 + 0x0032, item:GetEntryId()) -- main hand
  366.     else
  367.         pUnit:SetUInt32Value(0x0006 + 0x0032, 0)
  368.     end
  369.     item = plr:GetEquippedItemBySlot(16)
  370.     if item then
  371.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x1, item:GetEntryId()) -- offhand
  372.     else
  373.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x1, 0)
  374.     end
  375.     item = plr:GetEquippedItemBySlot(17)
  376.     if item then
  377.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x2, item:GetEntryId()) -- ranged
  378.     else
  379.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x2, 0)
  380.     end
  381.  
  382.     pUnit:SetUInt32Value(0x0006 + 0x0074, 1) -- bytes2 1
  383.    
  384.     for _,v in pairs(pUnit:GetInRangePlayers()) do
  385.         v:SendPacketToPlayer(p)
  386.     end
  387.    
  388.     pUnit:SetMaxHealth(plr:GetMaxHealth() * 2)
  389.     pUnit:SetHealth(pUnit:GetMaxHealth())
  390.  
  391.     local mana_regen_time = 4000
  392.     local class = plr:GetPlayerClass()
  393.     pUnit:SetValue("class", class)
  394.     if class == "Warrior" then
  395.         pUnit:SetMaxPower(1000, 1)
  396.         pUnit:SetPower(100, 1)
  397.         pUnit:SetPowerType(1)
  398.         pUnit:RegisterEvent("GenerateRage", 3500, 0)
  399.         pUnit:SetMaxHealth(plr:GetMaxHealth() * 3.25)
  400.         pUnit:SetHealth(pUnit:GetMaxHealth())
  401.     elseif class == "Paladin" then
  402.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  403.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  404.         pUnit:SetPowerType(0)
  405.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  406.     elseif class == "Hunter" then
  407.         pUnit:SetMaxPower(100, 2)
  408.         pUnit:SetPower(100, 2)
  409.         pUnit:SetPowerType(2)
  410.         pUnit:RegisterEvent("RegenerateFocus", 500, 0)
  411.     elseif class == "Rogue" then
  412.         pUnit:SetMaxPower(100, 3)
  413.         pUnit:SetPower(100, 3)
  414.         pUnit:SetPowerType(3)
  415.         pUnit:RegisterEvent("RegenerateEnergy", 500, 0)
  416.     elseif class == "Priest" then
  417.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  418.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  419.         pUnit:SetPowerType(0)
  420.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  421.     elseif class == "Shaman" then
  422.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  423.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  424.         pUnit:SetPowerType(0)
  425.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  426.     elseif class == "Mage" then
  427.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  428.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  429.         pUnit:SetPowerType(0)
  430.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  431.     elseif class == "Warlock" then
  432.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  433.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  434.         pUnit:SetPowerType(0)
  435.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  436.     elseif class == "Druid" then
  437.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  438.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  439.         pUnit:SetPowerType(0)
  440.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  441.     elseif class == "Demon Hunter" then
  442.         pUnit:SetMaxPower(100, 3)
  443.         pUnit:SetPower(100, 3)
  444.         pUnit:SetPowerType(3)
  445.         pUnit:RegisterEvent("RegenerateEnergy", 500, 0)
  446.     end
  447. end
  448.  
  449. function RegenerateEnergy(pUnit)
  450.     local p = pUnit:GetPower(3) + 2
  451.     if p > 100 then
  452.         p = 100
  453.     end
  454.     pUnit:SetPower(p, 3)
  455. end
  456.  
  457. function RegenerateFocus(pUnit)
  458.     local p = pUnit:GetPower(2) + 2
  459.     if p > 100 then
  460.         p = 100
  461.     end
  462.     pUnit:SetPower(p, 2)
  463. end
  464.  
  465. function GenerateRage(pUnit)
  466.     local p = pUnit:GetPower(1) + 100
  467.     if p > 1000 then
  468.         p = 1000
  469.     end
  470.     pUnit:SetPower(p, 1)
  471. end
  472.  
  473. function RegenerateMana(pUnit)
  474.     local p = pUnit:GetMana() + (pUnit:GetMaxMana() / 100)
  475.     if p > pUnit:GetMaxMana() then
  476.         p = pUnit:GetMaxMana()
  477.     end
  478.     pUnit:SetMana(p)
  479. end
  480.  
  481. RegisterUnitEvent(165, 18, "MirrorSpawnImage165")
  482. RegisterUnitEvent(165, 4, "MirrorSpawnImage165")
  483. RegisterUnitEvent(165, 2, "MirrorSpawnImage165")
  484. RegisterUnitEvent(165, 1, "MirrorSpawnImage165")
Advertisement
Add Comment
Please, Sign In to add comment