Guest User

Untitled

a guest
Jul 13th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. package org.rsbot.script.wrappers;
  2.  
  3. import org.rsbot.accessors.ObjectDef;
  4. import org.rsbot.bot.Bot;
  5. import org.rsbot.script.Calculations;
  6.  
  7. public class RSObject {
  8. long uid;
  9.  
  10. public RSObject(final long uid) {
  11. this.uid = uid;
  12. }
  13.  
  14. public RSObjectDef getDef() {
  15. return new RSObjectDef((ObjectDef) Calculations.findNodeByID(getID()));
  16. }
  17.  
  18. public int getID() {
  19. return (int) (uid >>> 32) & 0x7fffffff;
  20. }
  21.  
  22. public RSTile getLocation() {
  23. return new RSTile((int) (Bot.getClient().getBaseX() + (uid & 0x7f)),
  24. (int) (Bot.getClient().getBaseY() + (uid >> 7 & 0x7f)));
  25. }
  26.  
  27. /**
  28. * type is a one-digit integer 0 - object player 1 - object npc 2 - object
  29. * which doesn't move (rock, tree) 3 - object item
  30. */
  31. public int getType() {
  32. return (int) (uid >> 29) & 0x3;
  33. }
  34.  
  35. }
Add Comment
Please, Sign In to add comment