stoneharry

Untitled

Aug 2nd, 2013
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.04 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 Wait_A_Second_Then_Update_Mirrorimage(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.  
  23.     pUnit:SetFaction(21)
  24.  
  25.     --plr:CastSpellOnTarget(69828, pUnit) -- change display
  26.     plr:CastSpellOnTarget(69837, pUnit) -- change name
  27.  
  28.     --[[local model = RaceDisplayMap[plr:GetPlayerRace()][plr:GetGender()+1]
  29.     if not model then
  30.         model = plr:GetDisplay()
  31.     end
  32.     pUnit:SetModel(model)]]
  33.  
  34.     pUnit:SetUInt32Value(60, bit_or(pUnit:GetUInt32Value(60), 16))
  35.    
  36.     local p = LuaPacket:CreatePacket(1026, 68)
  37.  
  38.     p:WriteGUID(pUnit:GetGUID())
  39.     p:WriteULong(plr:GetDisplay()) -- race display
  40.  
  41.     p:WriteUByte(plr:GetPlayerRace()) -- race ID
  42.     p:WriteUByte(plr:GetGender()) -- gender
  43.     p:WriteUByte(PlayerClassToInt[plr:GetPlayerClass()]) -- class ID
  44.     p:WriteUByte(plr:GetByteValue(153, 0)) -- skinID
  45.     p:WriteUByte(plr:GetByteValue(153, 1)) -- faceID
  46.     p:WriteUByte(plr:GetByteValue(153, 2)) -- Hair style ID
  47.     p:WriteUByte(plr:GetByteValue(153, 3)) -- Hair colour ID
  48.     p:WriteUByte(plr:GetByteValue(154, 0)) -- facial hair ID
  49.     local guild = plr:GetGuildId()
  50.     if not guild then
  51.         guild = 0
  52.     end
  53.     p:WriteULong(guild) -- guild
  54.  
  55.     local slot_ids = {0, 2, 3, 4, 5, 6, 7, 8, 9, 14, 18}
  56.    
  57.     local i;
  58.     for i = 0, 10 do
  59.         local item = plr:GetEquippedItemBySlot(slot_ids[i+1])
  60.         if not item then
  61.             p:WriteULong(0)
  62.         else
  63.             local display = item:GetDisplayId()
  64.             if not display then
  65.                 display = 0
  66.             end
  67.             if i == 0 and plr:HasFlag(150, 1024) then
  68.                 display = 0
  69.             elseif i == 14 and plr:HasFlag(150, 2048) then
  70.                 display = 0
  71.             end
  72.             p:WriteULong(display)
  73.         end
  74.     end
  75.    
  76.     local item = plr:GetEquippedItemBySlot(15)
  77.     if item then
  78.         pUnit:SetUInt32Value(0x0006 + 0x0032, item:GetEntryId()) -- main hand
  79.     else
  80.         pUnit:SetUInt32Value(0x0006 + 0x0032, 0)
  81.     end
  82.     item = plr:GetEquippedItemBySlot(16)
  83.     if item then
  84.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x1, item:GetEntryId()) -- offhand
  85.     else
  86.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x1, 0)
  87.     end
  88.     item = plr:GetEquippedItemBySlot(17)
  89.     if item then
  90.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x2, item:GetEntryId()) -- ranged
  91.     else
  92.         pUnit:SetUInt32Value(0x0006 + 0x0032 + 0x2, 0)
  93.     end
  94.  
  95.     pUnit:SetUInt32Value(0x0006 + 0x0074, 1) -- bytes2 1
  96.    
  97.     for _,v in pairs(pUnit:GetInRangePlayers()) do
  98.         v:SendPacketToPlayer(p)
  99.     end
  100.    
  101.     pUnit:SetMaxHealth(plr:GetMaxHealth() * 2)
  102.     pUnit:SetHealth(pUnit:GetMaxHealth())
  103.  
  104.     local mana_regen_time = 4000
  105.     local class = plr:GetPlayerClass()
  106.     pUnit:SetValue("class", class)
  107.     if class == "Warrior" then
  108.         pUnit:SetMaxPower(1000, 1)
  109.         pUnit:SetPower(100, 1)
  110.         pUnit:SetPowerType(1)
  111.         pUnit:RegisterEvent("GenerateRage", 3500, 0)
  112.         pUnit:SetMaxHealth(plr:GetMaxHealth() * 3.25)
  113.         pUnit:SetHealth(pUnit:GetMaxHealth())
  114.     elseif class == "Paladin" then
  115.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  116.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  117.         pUnit:SetPowerType(0)
  118.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  119.     elseif class == "Hunter" then
  120.         pUnit:SetMaxPower(100, 2)
  121.         pUnit:SetPower(100, 2)
  122.         pUnit:SetPowerType(2)
  123.         pUnit:RegisterEvent("RegenerateFocus", 500, 0)
  124.     elseif class == "Rogue" then
  125.         pUnit:SetMaxPower(100, 3)
  126.         pUnit:SetPower(100, 3)
  127.         pUnit:SetPowerType(3)
  128.         pUnit:RegisterEvent("RegenerateEnergy", 500, 0)
  129.     elseif class == "Priest" then
  130.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  131.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  132.         pUnit:SetPowerType(0)
  133.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  134.     elseif class == "Shaman" then
  135.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  136.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  137.         pUnit:SetPowerType(0)
  138.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  139.     elseif class == "Mage" then
  140.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  141.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  142.         pUnit:SetPowerType(0)
  143.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  144.     elseif class == "Warlock" then
  145.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  146.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  147.         pUnit:SetPowerType(0)
  148.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  149.     elseif class == "Druid" then
  150.         pUnit:SetMaxPower(plr:GetMaxMana() * 2, 0)
  151.         pUnit:SetPower(pUnit:GetMaxMana(), 0)
  152.         pUnit:SetPowerType(0)
  153.         pUnit:RegisterEvent("RegenerateMana", mana_regen_time, 0)
  154.     elseif class == "Demon Hunter" then
  155.         pUnit:SetMaxPower(100, 3)
  156.         pUnit:SetPower(100, 3)
  157.         pUnit:SetPowerType(3)
  158.         pUnit:RegisterEvent("RegenerateEnergy", 500, 0)
  159.     end
  160. end
Advertisement
Add Comment
Please, Sign In to add comment