Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. public void handle(ClientOperations op, SeekableLittleEndianAccessor slea) {
  2. PacketOutputStream output = null;
  3. switch (op) {
  4. case PUBLIC_CHAT:
  5. slea.readInt();
  6. String text = slea.readMapleAsciiString();
  7. output = new PacketOutputStream(ServerOperations.PUBLIC_CHAT);
  8. output.writeInt(charId);
  9. output.writeByte(gmLevel != 0 ? 1 : 0);
  10. output.writeAsciiString(text);
  11. output.writeByte(slea.readByte()); // SHOW
  12. map.characters.broadcast(output.toByteArray());
  13. break;
  14. case FACE_EXPRESSION:
  15. int emote = slea.readInt();
  16. if (emote > 7) {
  17. // TODO: check if player has item
  18. output = new PacketOutputStream(ServerOperations.FACE_EXPRESSION);
  19. output.writeInt(charId);
  20. output.writeInt(emote);
  21. output.writeInt(-1);
  22. output.writeByte(0);
  23. }
  24. break;
  25. case DISTRIBUTE_SP:
  26. slea.skip(4);
  27. int skill = slea.readInt();
  28. if (remainingSp > 0) {
  29. remainingSp -= 1;
  30. if (hasExtendedSP) {
  31. spTable.addSPToTable(job, remainingSp);
  32. }
  33. }
  34. updateStats(new Statistics[]{Statistics.AvailableSp}, false);
  35. session.write(skills.getSkill(skill).updateSkill());
  36. break;
  37. case USE_SKILL:
  38. slea.readInt();
  39. int skillId = slea.readInt();
  40. Point pos = null;
  41. byte skillLevel = slea.readByte();
  42. if (slea.available() >= 4) {
  43. pos = new Point(slea.readShort(), slea.readShort());
  44. skills.useSkill(skillId, skillLevel, pos);
  45. }
  46. break;
  47. }
  48. if (output != null) {
  49. output = null;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement