Advertisement
stoneharry

Untitled

Aug 1st, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.52 KB | None | 0 0
  1. function MirrorSpawnImage165(creature, Event)
  2.     creature:RegisterEvent("Wait_A_Second_Then_Update_Mirrorimage", 1000, 1)
  3. end
  4.  
  5. function Wait_A_Second_Then_Update_Mirrorimage(creature)
  6.     local plr = creature:GetClosestPlayer()
  7.     if not plr then
  8.         creature:SendChatMessage(12,0,"Player not found!")
  9.         return
  10.     end
  11.    
  12.     local model = plr:GetDisplay()
  13.     creature:SendChatMessage(12,0,"My model = "..tostring(model))
  14.    
  15.     creature:SetModel(plr:GetDisplay())
  16.    
  17.     local p = LuaPacket:CreatePacket(1026, 68)
  18.    
  19.     model = creature:GetGUID()
  20.     creature:SendChatMessage(12,0,"My GUID = "..tostring(model))
  21.    
  22.     p:WriteGUID(creature:GetGUID())
  23.     p:WriteULong(plr:GetDisplay()) -- race display
  24.    
  25.     model = plr:GetPlayerRace()
  26.     creature:SendChatMessage(12,0,"My race = "..tostring(model))
  27.     model = plr:GetGender()
  28.     creature:SendChatMessage(12,0,"My gender = "..tostring(model))
  29.     model = PlayerClassToInt[plr:GetPlayerClass()]
  30.     creature:SendChatMessage(12,0,"My class = "..tostring(model))
  31.     model = tostring(plr:GetByteValue(153, 0)).." | "..tostring(plr:GetByteValue(153, 0)).." | "..tostring(plr:GetByteValue(153, 1)).." | "..tostring(plr:GetByteValue(153, 2)).." | "..tostring(plr:GetByteValue(154, 0))
  32.     creature:SendChatMessage(12,0,"My face data = "..tostring(model))  
  33.        
  34.  
  35.     p:WriteUByte(plr:GetPlayerRace()) -- race ID
  36.     p:WriteUByte(plr:GetGender()) -- gender
  37.     p:WriteUByte(PlayerClassToInt[plr:GetPlayerClass()]) -- class ID
  38.     p:WriteUByte(plr:GetByteValue(153, 0)) -- skinID
  39.     p:WriteUByte(plr:GetByteValue(153, 1)) -- faceID
  40.     p:WriteUByte(plr:GetByteValue(153, 2)) -- Hair style ID
  41.     p:WriteUByte(plr:GetByteValue(153, 3)) -- Hair colour ID
  42.     p:WriteUByte(plr:GetByteValue(154, 0)) -- facial hair ID
  43.     local guild = plr:GetGuildId()
  44.     if not guild then
  45.         guild = 0
  46.     end
  47.     p:WriteULong(guild) -- guild
  48.    
  49.     creature:SendChatMessage(12,0,"My guild data = "..tostring(guild))
  50.    
  51.     local slot_ids = {0, 2, 3, 4, 5, 6, 7, 8, 9, 14, 18}
  52.    
  53.     local i;
  54.     for i = 0, 10 do
  55.         local item = plr:GetEquippedItemBySlot(slot_ids[i+1])
  56.         if not item then
  57.             p:WriteULong(0)
  58.             creature:SendChatMessage(12,0,"My item data = "..tostring(i).." : 0")
  59.         else
  60.             p:WriteULong(item:GetEntryId())
  61.             creature:SendChatMessage(12,0,"My item data = "..tostring(i).." : "..tostring(item:GetEntryId()))
  62.         end
  63.         --[[    ITEM_SLOT_HEAD              = 0,
  64.                 ITEM_SLOT_SHOULDER          = 1,
  65.                 ITEM_SLOT_BODY              = 2,
  66.                 ITEM_SLOT_CHEST             = 3,
  67.                 ITEM_SLOT_WAIST             = 4,
  68.                 ITEM_SLOT_LEGS              = 5,
  69.                 ITEM_SLOT_FEET              = 6,
  70.                 ITEM_SLOT_WRITST            = 7,
  71.                 ITEM_SLOT_HAND              = 8,
  72.                 ITEM_SlOT_BACK              = 9,
  73.                 ITEM_SLOT_TABARD            = 10,
  74.         ]]
  75.     end
  76.    
  77.     local item = plr:GetEquippedItemBySlot(15)
  78.     if item then
  79.         creature:SetUInt32Value(0x0006 + 0x0032, item:GetEntryId()) -- main hand
  80.     else
  81.         creature:SetUInt32Value(0x0006 + 0x0032, 0)
  82.     end
  83.     item = plr:GetEquippedItemBySlot(16)
  84.     if item then
  85.         creature:SetUInt32Value(0x0006 + 0x0032 + 0x1, item:GetEntryId()) -- offhand
  86.     else
  87.         creature:SetUInt32Value(0x0006 + 0x0032 + 0x1, 0)
  88.     end
  89.     item = plr:GetEquippedItemBySlot(17)
  90.     if item then
  91.         creature:SetUInt32Value(0x0006 + 0x0032 + 0x2, item:GetEntryId()) -- ranged
  92.     else
  93.         creature:SetUInt32Value(0x0006 + 0x0032 + 0x2, 0)
  94.     end
  95.  
  96.     creature:SetUInt32Value(0x0006 + 0x0074, 1) -- bytes2 1
  97.    
  98.     for _,v in pairs(creature:GetInRangePlayers()) do
  99.         creature:SendPacketToPlayer(p)
  100.     end
  101.    
  102.     creature:SetUInt32Value(60, bit_or(creature:GetUInt32Value(60), 16))
  103.    
  104.     creature:SendChatMessage(12,0,"I am now a mirror image of "..plr:GetName().."!")
  105. end
  106.  
  107. RegisterUnitEvent(165, 18, "MirrorSpawnImage165")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement