private byte[] WriteWeapons(List <Model> weaponModels, int offset) { var headBytes = new byte[weaponModels.Count * 0x10]; var bodyBytes = new List <byte>(); int headLength = GetLength(headBytes.Length); offset += headLength; for (int i = 0; i < weaponModels.Count; i++) { WriteInt(headBytes, i * 0x10, weaponModels[i].id); MobyModel g = (MobyModel)weaponModels[i]; if (!g.isModel) { continue; } byte[] bodyByte = g.Serialize(offset); WriteInt(headBytes, i * 0x10 + 4, offset); WriteInt(headBytes, i * 0x10 + 8, bodyByte.Length); bodyBytes.AddRange(bodyByte); offset += bodyByte.Length; } var outBuff = new byte[headLength + bodyBytes.Count]; headBytes.CopyTo(outBuff, 0); bodyBytes.CopyTo(outBuff, headLength); return(outBuff); }
private byte[] WriteMobies(List <Model> mobyModels, int offset) { var headBytes = new byte[mobyModels.Count * 8 + 4]; var bodBytes = new List <byte>(); WriteInt(headBytes, 0, mobyModels.Count); offset += headBytes.Length; for (int i = 0; i < mobyModels.Count; i++) { WriteInt(headBytes, 4 + i * 8, mobyModels[i].id); MobyModel g = (MobyModel)mobyModels[i]; if (!g.isModel) { continue; } WriteInt(headBytes, 4 + i * 8 + 4, offset); byte[] bodyByte = g.Serialize(offset); bodBytes.AddRange(bodyByte); offset += bodyByte.Length; } var outBuff = new byte[headBytes.Length + bodBytes.Count]; headBytes.CopyTo(outBuff, 0); bodBytes.CopyTo(outBuff, headBytes.Length); return(outBuff); }