|
Whats new in 145 identitykit compared to 474?
packed it but it doesn't show on my character once done?
curious as why it wouldnt have different skin tones too? like green,black etc.
This should get it to work.
Client-sided:
Server-sided:Code:public final class IdentityKitDefinition { public static void unpackConfig(StreamLoader streamLoader) { Stream stream = new Stream(streamLoader.getDataForName("idk.dat")); length = stream.readUnsignedShort(); if (cache == null) { cache = new IdentityKitDefinition[length]; } for (int index = 0; index < length; index++) { if (cache[index] == null) { cache[index] = new IdentityKitDefinition(); } cache[index].readValues(stream); cache[index].srcColors[0] = 55232; cache[index].dstColors[0] = 6798; } } private void readValues(Stream stream) { do { int i = stream.readUnsignedByte(); if (i == 0) return; if (i == 1) type = stream.readUnsignedByte(); else if (i == 2) { int j = stream.readUnsignedByte(); modeles = new int[j]; for (int k = 0; k < j; k++) modeles[k] = stream.readUnsignedShort(); } else if (i == 3) isUnselectable = true; else if (i >= 40 && i < 50) srcColors[i - 40] = stream.readUnsignedShort(); else if (i >= 50 && i < 60) dstColors[i - 50] = stream.readUnsignedShort(); else if (i >= 60 && i < 70) { faceModeles[i - 60] = stream.readUnsignedShort(); if (faceModeles[i - 60] == 65535) { faceModeles[i - 60] = -1; } } else System.out.println("Error unrecognised config code: " + i); } while (true); } public boolean modelIsValid() { if(modeles == null) return true; boolean flag = true; for(int j = 0; j < modeles.length; j++) if(!Model.method463(modeles[j])) flag = false; return flag; } public Model getModel() { if(modeles == null) return null; Model aclass30_sub2_sub4_sub6s[] = new Model[modeles.length]; for(int i = 0; i < modeles.length; i++) aclass30_sub2_sub4_sub6s[i] = Model.method462(modeles[i]); Model model; if(aclass30_sub2_sub4_sub6s.length == 1) model = aclass30_sub2_sub4_sub6s[0]; else model = new Model(aclass30_sub2_sub4_sub6s.length, aclass30_sub2_sub4_sub6s); for(int j = 0; j < 6; j++) { if(srcColors[j] == 0) break; model.method476(srcColors[j], dstColors[j]); } return model; } public boolean method539() { boolean flag1 = true; for(int i = 0; i < 5; i++) if(faceModeles[i] != -1 && !Model.method463(faceModeles[i])) flag1 = false; return flag1; } public Model getHead() { Model aclass30_sub2_sub4_sub6s[] = new Model[5]; int j = 0; for(int k = 0; k < 5; k++) if(faceModeles[k] != -1) aclass30_sub2_sub4_sub6s[j++] = Model.method462(faceModeles[k]); Model model = new Model(j, aclass30_sub2_sub4_sub6s); for(int l = 0; l < 6; l++) { if(srcColors[l] == 0) break; model.method476(srcColors[l], dstColors[l]); } return model; } private IdentityKitDefinition() { type = -1; srcColors = new int[6]; dstColors = new int[6]; isUnselectable = false; } public static int length; public static IdentityKitDefinition cache[]; public int type; private int[] modeles; private final int[] srcColors; private final int[] dstColors; private final int[] faceModeles = { -1, -1, -1, -1, -1 }; public boolean isUnselectable; }
Skin tones aren't in the IDK.Code:public class AppearancePacketHandler implements IncomingPacketListener { @Override public void processPacket(Player player, int packetType, int packetSize) { byte gender = player.getInStream().readSignedByte(); int head = player.getInStream().readSignedByte(); if (head < 0) { head = 256 + head; } int jaw = player.getInStream().readSignedByte(); int torso = player.getInStream().readSignedByte(); int arms = player.getInStream().readSignedByte(); int hands = player.getInStream().readSignedByte(); int legs = player.getInStream().readSignedByte(); int feet = player.getInStream().readSignedByte(); byte[] col = { player.getInStream().readSignedByte(), player.getInStream().readSignedByte(), player.getInStream().readSignedByte(), player.getInStream().readSignedByte(), player.getInStream().readSignedByte() }; int[] app = new int[7]; app[0] = head; app[1] = torso; app[2] = arms; app[3] = hands; app[4] = legs; app[5] = feet; app[6] = jaw; if (!validate(new int[] { head, jaw, torso, arms, hands, legs, feet }, col, gender, player.getAppearance().getSkinColour())) { player.sendOutgoingPacket(new Message("Your appearance could not be validated.")); return; } int[] look = new int[13]; look[0] = gender; for (int i = 0; i < col.length; i++) { look[i + 1] = col[i]; } for (int i = 0; i < app.length; i++) { look[i + 6] = app[i]; } player.getAppearance().setLook(look); player.setAppearanceUpdateRequired(true); player.sendOutgoingPacket(new WindowRemoval()); } private static final int[][] MALE_VALUES = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 129, 130, 131, 132, 133, 134, 142, 144, 145, 146, 147, 148, 149, 150 }, // head { 10, 11, 12, 13, 14, 15, 16, 17, 111, 112, 113, 114, 115, 116, 117 }, // jaw { 18, 19, 20, 21, 22, 23, 24, 25, 105, 106, 107, 108, 109, 110 }, // torso { 26, 27, 28, 29, 30, 31, 32, 84, 85, 86, 87, 88 }, // arms { 33, 34, 35 }, // hands { 36, 37, 38, 39, 40, 41, 100, 101, 102, 103, 104 }, // legs { 42, 43, 44, 82 }, // feet }; private static final int[][] FEMALE_VALUES = { { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 141, 143 }, // head { -1, -1 }, // jaw { 56, 57, 58, 59, 60, 89, 90, 91, 92, 93, 94 }, // torso { 61, 62, 63, 64, 65, 66, 95, 96, 97, 98, 99 }, // arms { 67, 68, 69 }, // hands { 70, 71, 72, 73, 74, 75, 76, 77, 78, 135, 136, 137, 138, 139, 140 }, // legs { 79, 80, 81, 83 }, // feet }; private static final int[][] IDK_COLORS = { { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, -31839, 22433, 2983, -11343, 8, 5281, 10438, 3650, -27322, -21845, 200, 571, 908, 21830, 28946, -15701, -14010 }, { 8741, 12, -1506, -22374, 7735, 8404, 1701, -27106, 24094, 10153, -8915, 4783, 1341, 16578, -30533, 25239, 8, 5281, 10438, 3650, -27322, -21845, 200, 571, 908, 21830, 28946, -15701, -14010 }, { 25238, 8742, 12, -1506, -22374, 7735, 8404, 1701, -27106, 24094, 10153, -8915, 4783, 1341, 16578, -30533, 8, 5281, 10438, 3650, -27322, -21845, 200, 571, 908, 21830, 28946, -15701, -14010 }, { 4626, 11146, 6439, 12, 4758, 10270 }, { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } }; // 17050, 0, 127 for special colors (green-black-pale) private static final int[][] ALLOWED_COLORS = { { 0, IDK_COLORS[0].length }, // hair // color { 0, IDK_COLORS[1].length }, // torso color { 0, IDK_COLORS[2].length }, // legs color { 0, IDK_COLORS[3].length }, // feet color { 0, IDK_COLORS[4].length } // skin color }; public static boolean validate(int[] app, byte[] col, byte gender, int currentSkin) { if (gender == 0) { for (int i = 0; i < app.length; i++) { boolean found = false; for (int j : MALE_VALUES[i]) if (app[i] == j) { found = true; break; } if (!found) return false; } } else if (gender == 1) { for (int i = 0; i < app.length; i++) { boolean found = false; for (int j : FEMALE_VALUES[i]) if (app[i] == j) { found = true; break; } if (!found) return false; } } else { return false; } for (int i = 0; i < col.length; i++) { if (i == 4 && col[i] == currentSkin) continue; if ((col[i] < ALLOWED_COLORS[i][0]) || (col[i] > ALLOWED_COLORS[i][1])) return false; } return true; } }
In you Client.java you'll see this somewhere:
{ 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
You can just add colors to that, for example for the new ones:
{ 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574, 17050, 0, 127 } };
alright thanks guys. i'll try a few of these methods out!
@Stan where would i add the code you're referring to? or would i create a new file for those methods?
Not my code, only edited the male & female values to support the new stuff
But yeah indeed you're right, it's pretty dirty.
The first one is just the Identikit class in your client.
The server sided is just an example, check how your server currently validates the IDK values sent by the client, and support the values from the ones I posted instead to get the new ones working.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |