stoneharry

Untitled

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