Created
September 4, 2011 19:05
-
-
Save LordJZ/1193348 to your computer and use it in GitHub Desktop.
SMSG_PHASE_SHIFT_CHANGE 4.2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
namespace Kamilla.WorldOfWarcraft.Latest.OpcodeDatas | |
{ | |
public sealed class SetPhaseShift : PackedData | |
{ | |
public readonly byte[][] Data = new byte[4][]; | |
public WowGuid Guid; | |
public uint Unk; | |
protected override int ByteXorValue | |
{ | |
get { return 1; } | |
} | |
protected override int[] MaskSequence | |
{ | |
get { return new int[] { 4, 6, 3, 4, 1, 2, 0, 7 }; } | |
} | |
protected override int[] ByteSequence | |
{ | |
get { return new int[] { 6, 5, -1, 3, 7, -2, -3, 2, 4, -5, 0, 1, -4 }; } | |
} | |
protected override void ElementRead(StreamHandler reader, int index) | |
{ | |
if (index == -5) | |
this.Unk = reader.ReadUInt32(); | |
else | |
this.Data[-index - 1] = reader.ReadBytes(reader.ReadInt32()); | |
} | |
protected override void ElementWrite(StreamHandler writer, int index) | |
{ | |
if (index == -5) | |
{ | |
writer.WriteUInt32(this.Unk); | |
} | |
else | |
{ | |
index = -index - 1; | |
writer.WriteInt32(this.Data[index].Length); | |
writer.WriteBytes(this.Data[index]); | |
} | |
} | |
protected override void PackedRead(StreamHandler reader) | |
{ | |
this.Guid = reader.ReadGuid(); | |
} | |
protected override void PackedSave(StreamHandler writer) | |
{ | |
writer.WriteGuid(this.Guid); | |
} | |
public override CustomPacket CreatePacket() | |
{ | |
return base.CreatePacket(WowOpcodes.SMSG_PHASE_SHIFT_CHANGE, Direction.ToClient); | |
} | |
public override void ToString(StringBuilder builder) | |
{ | |
builder.AppendLine("Guid: " + this.Guid); | |
builder.AppendLine("Unk: " + this.Unk); | |
for (int i = 0; i < this.Data.Length; ++i) | |
{ | |
var arr = this.Data[i]; | |
if ((arr.Length & 1) == 0) | |
{ | |
builder.Append("Maps: "); | |
for (int j = 0; j < arr.Length; j += 2) | |
builder.Append((Maps)BitConverter.ToUInt16(arr, j)).Append(j == arr.Length - 2 ? "" : ", "); | |
builder.AppendLine(); | |
} | |
else | |
builder.AppendLine("Bytes: " + arr.ToHexString()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment