public static void HandleUpdateTalentData(ref WorldClass session) { var pChar = session.Character; const byte glyphCount = 6; PacketWriter updateTalentData = new PacketWriter(ServerMessage.UpdateTalentData); BitPack BitPack = new BitPack(updateTalentData); BitPack.Write(pChar.SpecGroupCount, 19); for (int i = 0; i < pChar.SpecGroupCount; i++) { var talents = SpecializationMgr.GetTalentsBySpecGroup(pChar, (byte)i); BitPack.Write(talents.Count, 23); } BitPack.Flush(); for (int i = 0; i < pChar.SpecGroupCount; i++) { var talents = SpecializationMgr.GetTalentsBySpecGroup(pChar, (byte)i); var specId = (i == 0) ? pChar.PrimarySpec : pChar.SecondarySpec; for (int j = 0; j < glyphCount; j++) updateTalentData.WriteInt16(0); // Glyph Id for (int j = 0; j < talents.Count; j++) updateTalentData.WriteUInt16(talents[j].Id); // Talent Id updateTalentData.WriteUInt32(specId); // Spec Id } updateTalentData.WriteUInt8(pChar.ActiveSpecGroup); // Active Spec (0 or 1) session.Send(ref updateTalentData); }
public static void HandleTalentUpdate(ref WorldClass session) { var pChar = session.Character; const byte glyphCount = 6; PacketWriter writer = new PacketWriter(); writer.WriteUInt8((byte)pChar.SpecGroupCount); // Spec Count (Default 1) writer.WriteUInt8((byte)pChar.ActiveSpecGroup); // Active Spec (0 or 1) for (int i = 0; i < pChar.SpecGroupCount; i++) { var specId = (i == 0) ? pChar.PrimarySpec : pChar.SecondarySpec; writer.WriteUInt32(specId); // Spec Id var talents = SpecializationMgr.GetTalentsBySpecGroup(pChar, (byte)i); writer.WriteUInt8((byte)talents.Count); // Spent Talent Row Count for (int j = 0; j < talents.Count; j++) writer.WriteUInt16(talents[j].Id); // Talent Id writer.WriteUInt8(glyphCount); // Glyph Count - NYI for (int j = 0; j < glyphCount; j++) writer.WriteInt16(0); // Glyph Id - NYI } session.Send(ref writer); }