Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. private void updateAppearance(PacketBuilder packet, Player player) {
  2. System.out.println("Setting the appearance for " + player.getName() + ".");
  3. Appearance appearance = player.getAppearance();
  4. PacketBuilder playerProps = new PacketBuilder();
  5. System.out.println("Setting the gender for " + player.getName() + ".");
  6. playerProps.putByte((byte) appearance.getGender());
  7. for (int i = 0; i < 5; i++) {
  8. playerProps.putByte((byte) 0);
  9. }
  10. System.out.println("Setting the chest for " + player.getName() + ".");
  11. playerProps.putShort((short) 0x100 + appearance.getChest());
  12. playerProps.putByte((byte) 0);
  13. int[] appearanceItems = {
  14. 0x100 + appearance.getArms(), 0x100 + appearance.getLegs(), 0x100 + appearance.getHead(),
  15. 0x100 + appearance.getFeet(), 0x100 + appearance.getBeard()
  16. };
  17. System.out.println("Setting the arms, legs, head, feet and beard for " + player.getName() + ".");
  18. for (int i = 0; i < appearanceItems.length; i++) {
  19. playerProps.putShort((short) appearanceItems[i]);
  20. }
  21. int[] appearanceColor = {
  22. appearance.getHairColor(), appearance.getTorsoColor(), appearance.getLegColor(),
  23. appearance.getFeetColor(), appearance.getSkinColor()
  24. };
  25. System.out.println("Setting the colors for " + player.getName() + ".");
  26. for (int i = 0; i < appearanceColor.length; i++) {
  27. playerProps.putByte((byte) appearanceColor[i]);
  28. }
  29. int[] animation = {
  30. 0x328, 0x337, 0x333, 0x334, 0x335, 0x336, 0x338
  31. };
  32. System.out.println("Setting the animations for " + player.getName() + ".");
  33. for (int i = 0; i < animation.length; i++) {
  34. playerProps.putShort((short) animation[i]);
  35. }
  36. System.out.println("Setting the long name for " + player.getName() + ".");
  37. playerProps.putLong(NameUtility.nameToLong(player.getName()));
  38. System.out.println("Setting the combat level for " + player.getName() + ".");
  39. playerProps.putByte((byte) 3);
  40. System.out.println("Setting the total level for " + player.getName() + ".");
  41. playerProps.putShort(0);
  42. Packet playerPacket = playerProps.toPacket();
  43. System.out.println("Putting the bytes for the length and buffer for " + player.getName() + ".");
  44. packet.putByte((byte) playerPacket.getLength());
  45. packet.putBytes(playerPacket.getBuffer());
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement