Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. package com.emulation.model;
  2.  
  3. import java.util.LinkedList;
  4. import java.util.List;
  5.  
  6. import com.emulation.model.item.Item;
  7. import com.emulation.model.npc.NPC;
  8. import com.emulation.model.object.Object;
  9. import com.emulation.model.player.Player;
  10. import com.emulation.model.player.Walking;
  11. import com.emulation.world.Location;
  12.  
  13. public abstract class Entity {
  14.  
  15. private Location location;
  16. private int id;
  17. private int walkingDirection;
  18. private int runningDirection;
  19. private String name;
  20. private String pass;
  21. private UpdateFlags updateFlags;
  22. private boolean isMapChanging;
  23. private boolean isTeleporting;
  24. private Walking walking = new Walking(this);
  25. private Location teleportingLocation;
  26. private List<Player> playerList = new LinkedList<Player>();
  27. private int combatLevel;
  28. private int width;
  29. private int height;
  30.  
  31. public Entity(int id) {
  32. this.id = id;
  33. }
  34.  
  35. public Entity() {
  36. this.updateFlags = new UpdateFlags();
  37. }
  38.  
  39. public void setLocation(Location location) {
  40. this.location = location;
  41. }
  42.  
  43. public Location getLocation() {
  44. return this.location;
  45. }
  46.  
  47. public void setID(int id) {
  48. this.id = id;
  49. }
  50.  
  51. public int getID() {
  52. return this.id;
  53. }
  54.  
  55. public void setWalkingDirection(int walkingDirection) {
  56. this.walkingDirection = walkingDirection;
  57. }
  58.  
  59. public int getWalkingDirection() {
  60. return this.walkingDirection;
  61. }
  62.  
  63. public void setRunningDirection(int runningDirection) {
  64. this.runningDirection = runningDirection;
  65. }
  66.  
  67. public int getRunningDirection() {
  68. return this.runningDirection;
  69. }
  70.  
  71. public void setName(String name) {
  72. this.name = name;
  73. }
  74.  
  75. public String getName() {
  76. return this.name;
  77. }
  78.  
  79. public void setPass(String pass) {
  80. this.pass = pass;
  81. }
  82.  
  83. public String getPass() {
  84. return this.pass;
  85. }
  86.  
  87. public UpdateFlags getUpdateFlags() {
  88. return this.updateFlags;
  89. }
  90.  
  91. public void setMapChanging(boolean isMapChanging) {
  92. this.isMapChanging = isMapChanging;
  93. }
  94.  
  95. public boolean isMapChanging() {
  96. return this.isMapChanging;
  97. }
  98.  
  99. public void setTeleporting(boolean isTeleporting) {
  100. this.isTeleporting = isTeleporting;
  101. }
  102.  
  103. public boolean isTeleporting() {
  104. return this.isTeleporting;
  105. }
  106.  
  107. public Walking getWalking() {
  108. return this.walking;
  109. }
  110.  
  111. public void setTeleportingLocation(Location teleportingLocation) {
  112. this.teleportingLocation = teleportingLocation;
  113. }
  114.  
  115. public Location getTeleportingLocation() {
  116. return this.teleportingLocation;
  117. }
  118.  
  119. public boolean hasTeleportingLocation() {
  120. return this.teleportingLocation != null;
  121. }
  122.  
  123. public void resetTeleportingLocation() {
  124. this.teleportingLocation = null;
  125. }
  126.  
  127. public List<Player> getPlayerList() {
  128. return this.playerList;
  129. }
  130.  
  131. public void setCombatLevel(int combatLevel) {
  132. this.combatLevel = combatLevel;
  133. }
  134.  
  135. public int getCombatLevel() {
  136. return this.combatLevel;
  137. }
  138.  
  139. public boolean isClicked() {
  140. if (this instanceof NPC) {
  141. NPC npc = (NPC) this;
  142. return (this.location.getX() > npc.getLocation().getX()) && (this.location.getX() < npc.getLocation().getX() + this.width) && (this.location.getY() > npc.getLocation().getY()) && (this.location.getY() < npc.getLocation().getY() + this.height);
  143. } else if (this instanceof Player) {
  144. Player player = (Player) this;
  145. return (this.location.getX() > player.getLocation().getX()) && (this.location.getX() < player.getLocation().getX() + this.width) && (this.location.getY() > player.getLocation().getY()) && (this.location.getY() < player.getLocation().getY() + this.height);
  146. } else if (this instanceof Object) {
  147. Object object = (Object) this;
  148. return (this.location.getX() > object.getLocation().getX()) && (this.location.getX() < object.getLocation().getX() + this.width) && (this.location.getY() > object.getLocation().getY()) && (this.location.getY() < object.getLocation().getY() + this.height);
  149. } else if (this instanceof Item) {
  150. Item item = (Item) this;
  151. return (this.location.getX() > item.getLocation().getX()) && (this.location.getX() < item.getLocation().getX() + this.width) && (this.location.getY() > item.getLocation().getY()) && (this.location.getY() < item.getLocation().getY() + this.height);
  152. }
  153. return false;
  154. }
  155.  
  156. public boolean isHovered() {
  157. return false;
  158. }
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement