Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.59 KB | None | 0 0
  1. package dragonkk.rs2rsps.model.player;
  2.  
  3. import java.io.Serializable;
  4. import java.util.ArrayList;
  5. import java.util.Calendar;
  6. import java.util.Date;
  7. import java.util.GregorianCalendar;
  8. import java.util.LinkedList;
  9. import java.util.List;
  10. import java.util.Queue;
  11.  
  12. import dragonkk.rs2rsps.model.Animation;
  13. import dragonkk.rs2rsps.model.Entity;
  14. import dragonkk.rs2rsps.model.Graphics;
  15. import dragonkk.rs2rsps.model.Heal;
  16. import dragonkk.rs2rsps.model.Hits;
  17. import dragonkk.rs2rsps.model.World;
  18. import dragonkk.rs2rsps.model.Hits.Hit;
  19. import dragonkk.rs2rsps.model.Hits.HitType;
  20. import dragonkk.rs2rsps.net.Frames;
  21. import dragonkk.rs2rsps.net.codec.ConnectionHandler;
  22. import dragonkk.rs2rsps.skills.construction.Construction;
  23. import dragonkk.rs2rsps.skills.prayer.Prayer;
  24. import dragonkk.rs2rsps.skills.woodcutting.WoodCutting;
  25. import dragonkk.rs2rsps.util.Misc;
  26. import dragonkk.rs2rsps.util.RSTile;
  27. import dragonkk.rs2rsps.util.Serializer;
  28.  
  29.  
  30. public class Player extends Entity implements Serializable {
  31.  
  32.  
  33. public double epAmount = 50.6;
  34. public int epTimer = 0;
  35. private static final long serialVersionUID = -393308022192269041L;
  36. public boolean playerMuted = false;
  37. public boolean hasReset = false;
  38. public boolean isDonator = false;
  39. public boolean extremeDonator = false;
  40. public int saveTimer = 600;
  41. public String skulledOn = "";
  42. public int skullTimer = 0;
  43. public boolean wasReset = false;
  44.  
  45. public int[] resetItems = {};
  46. public int[] donators = { 13887, 13888, 13893, 13894, 13899, 13900, 13905, 13906, 13912, 13913, 13917, 13918, 13923, 13924, 13929, 13930, 13736, 13737, 13738, 13739, 13740, 13741, 13742, 13743, 13744, 13745 };
  47. public int[] playerHits = new int[10];
  48. public int[] hitsDelay = new int[10];
  49. public int[] dealtDamage = new int[10];
  50. public long lastResponce;
  51. public int pickupDelay;
  52. public int isMember, isExtremeMember;
  53. public boolean founder, admin, developer, jrAdmin, jrMod;
  54. public boolean lolTest = false;
  55. private transient ShopHandler shophandler;
  56.  
  57. public final int[][] ITEM_PRICES = {
  58. {11849, 11300000}, // Barrows - Dharok's Set
  59. {4178, 782700}, // Dharok's Greataxe
  60. {4716, 732700}, // Dharok's Helm
  61. {4720, 1100000}, // Dharok's Platebody
  62. {4722, 1600000}, // Dharok's Platelegs
  63. {11846, 6600000}, // Barrows - Ahrim's Set
  64. {4708, 92400}, // Ahrim's Hood
  65. {4710, 105200}, // Ahrim's Staff
  66. {4712, 1700000}, // Ahrim's Robetop
  67. {4714, 4700000}, // Ahrim's Robeskirt
  68. {11850, 5500000}, // Barrows - Guthan's Set
  69. {4724, 2500000}, // Guthan's Helm
  70. {4726, 1600000}, // Guthan's Warspear
  71. {4728, 607500}, // Guthan's Platebody
  72. {4730, 744700}, // Guthan's Chainskirt
  73. {11852, 6100000}, // Barrows - Karil's Set
  74. {4732, 101700}, // Karil's Coif
  75. {4734, 532400}, // Karil's Crossbow
  76. {4736, 4900000}, // Karil's Top
  77. {4738, 628000}, // Karil's Skirt
  78. {4740, 313}, // Bolt Rack
  79. {11854, 3200000}, // Barrows - Torag's Set
  80. {4745, 866200}, // Torag's Helm
  81. {4747, 105500}, // Torag's Hammers
  82. {4749, 672400}, // Torag's Platebody
  83. {4751, 1500000}, // Torag's Platelegs
  84. {11856, 6300000}, // Barrows - Verac's Set
  85. {4753, 3800000}, // Verac's Helm
  86. {4755, 256300}, // Verac's Flail
  87. {4757, 435100}, // Verac's Brassard
  88. {4759, 1800000}, // Verac's Plateskirt
  89. {11938, 4700000}, // Gilded Armour Set (lg)
  90. {11940, 3300000}, // Gilded Armour Set (sk)
  91. {3481, 1800000}, // Gilded Platebody
  92. {3483, 1700000}, // Gilded Platelegs
  93. {3485, 335500}, // Gilded Plateskirt
  94. {3486, 649200}, // Gilded Full Helm
  95. {3488, 515800}, // Gilded Kiteshield
  96. {11860, 103500000}, // Third-age Ranger Set
  97. {13544, 44900000}, // Third-age Range Top
  98. {13545, 34000000}, // Third-age Range Legs
  99. {13546, 12200000}, // Third-age Range Coif
  100. {13547, 12400000}, // Third-age Vambraces
  101. {11862, 140500000}, // Third-age Mage Set
  102. {13548, 60400000}, // Third-age Robe Top
  103. {13549, 22500000}, // Third-age Robe
  104. {13550, 34400000}, // Third-age Mage Hat
  105. {13551, 23100000}, // Third-age Amulet
  106. {11858, 352900000}, // Third-age Melee Set
  107. {13552, 127100000}, // Third-age Platelegs
  108. {13553, 116300000}, // Third-age Platebody
  109. {13554, 36000000}, // Third-age Full Helmet
  110. {13555, 73500000}, // Third-age Kiteshield
  111. {19580, 240800000}, // Third-age Prayer Set
  112. {19308, 16900000}, // Third-age druidic Staff
  113. {19311, 52300000}, // Third-age Druidic Cloak
  114. {19314, 47100000}, // Third-age Druidic Wreath
  115. {19317, 94200000}, // Third-age Druidic Robe Top
  116. {19320, 47100000}, // Third-age Druidic Robe
  117. {6916, 1700000}, // Infinity Top
  118. {6918, 2300000}, // Infinity Hat
  119. {6920, 935200}, // Infinity Boots
  120. {6922, 1500000}, // Infinity Gloves
  121. {6924, 2700000}, // Infinity Bottoms
  122. {11874, 9200000}, // Infinity Robes Set
  123. {11838, 183500}, // Rune Armour Set (lg)
  124. {1079, 48400}, // Rune Platelegs
  125. {1127, 67400}, // Rune Platebody
  126. {1163, 21000}, // Rune Full Helm
  127. {1201, 46700}, // Rune Kiteshield
  128. {11840, 178300}, // Rune Armour Set (sk)
  129. {1093, 43200}, // Rune Plateskirt
  130. {1127, 67400}, // Rune Platebody
  131. {1163, 21000}, // Rune Full Helm
  132. {1201, 46700}, // Rune Kiteshield
  133. {14484, 31600000}, // Dragon Claws
  134. {13450, 77600000}, // Armadyl Godsword
  135. {13451, 20100000}, // Bandos Godsword
  136. {13452, 54700000}, // Saradomin Godsword
  137. {13461, 8500000}, // Saradomin Sword
  138. {13453, 21900000}, // Zamorak Godsword
  139. {13454, 5300000}, // Zamorakian Spear
  140. {13455, 2900000}, // Armadyl Helmet
  141. {13456, 15500000}, // Armadyl Chestplate
  142. {13457, 15400000}, // Armadyl Plateskirt
  143. {13458, 22300000}, // Bandos Chestplate
  144. {13459, 25000000}, // Bandos Tassets
  145. {13460, 765300}, // Bandos Boots
  146. {13462, 464400}, // Dragon Boots
  147. {13531, 446300000}, // Red Partyhat
  148. {13532, 429400000}, // Yellow Partyhat
  149. {13533, 570000000}, // Blue Partyhat
  150. {13534, 431800000}, // Green Partyhat
  151. {13535, 428100000}, // Purple Partyhat
  152. {13536, 477300000}, // White Partyhat
  153. {13537, 94000000}, // Santa Hat
  154. {13538, 88800000}, // Green H'ween Mask
  155. {13539, 104800000}, // Blue H'ween Mask
  156. {13540, 135600000}, // Red H'ween Mask
  157. {13529, 61600}, // Seercull
  158. {13736, 3900000}, // Blessed Spirit Shield
  159. {13738, 63600000}, // Arcane Spirit Shield
  160. {13740, 533900000}, // Divine Spirit Shield
  161. {13742, 529900000}, // Elysian Spirit Shield
  162. {13744, 62600000}, // Spectral Spirit Shield
  163. {4151, 3400000}, // Abyssal Whip
  164. {4152, 3400000}, //Abyssal whip
  165. {4153, 237700}, // Granite Maul
  166. {6739, 1700000}, // Dragon Hatchet
  167. {11335, 33300000}, // Dragon Full Helm
  168. {1149, 60300}, // Dragon Med Helm
  169. {14479, 11200000}, // Dragon Platebody
  170. {2513, 6300000}, // Dragon Chainbody
  171. {4087, 668600}, // Dragon Platelegs
  172. {4585, 197600}, // Dragon Plateskirt
  173. {13405, 985400} // Dark Bow
  174. };
  175.  
  176. public int getItemPrice(int itemId) {
  177. for(int[] data: ITEM_PRICES) {
  178. if(itemId == data[0] || itemId + 1 == data[0]) {
  179. return data[1];
  180. }
  181. }
  182. return 1;
  183. }
  184. public final int[] RANGED_WEAPONS = {
  185. 861, 9185
  186. };
  187.  
  188. public boolean rangedWeapon() {
  189. for(int i = 0; i < RANGED_WEAPONS.length; i++) {
  190. if(getEquipment().contains(RANGED_WEAPONS[i])) {
  191. return true;
  192. }
  193. }
  194. return false;
  195. }
  196.  
  197. public void setHit(int hit, int delay, Entity opp) {
  198. for(int i = 0; i < playerHits.length; i ++) {
  199. if(playerHits[i] != -1) {
  200. playerHits[i] = hit;
  201. hitsDelay[i] = delay;
  202. dealtDamage[i] = opp.getIndex();
  203. break;
  204. }
  205. }
  206. }
  207. public int specTimer = 0;
  208.  
  209. public void tick() {
  210. if(saveTimer > 0) {
  211. saveTimer--;
  212. if(saveTimer == 0) {
  213. Serializer.SaveAccount(this);
  214. getFrames().sendChatMessage(0, "Game saved.");
  215. saveTimer = 600;
  216. }
  217. }
  218. if(!this.getCombat().isSafe(this)) {
  219. if(epAmount < 100) {
  220. epTimer++;
  221. if(epTimer == 200) {
  222. epAmount += 25;
  223. epTimer = 0;
  224. this.getFrames().sendChatMessage(0, "You drop potential has increased to: "+epAmount+"% !");
  225. }
  226. }
  227. }
  228. if(pickupDelay > 0){
  229. pickupDelay--;
  230. }
  231. if(this.getCombatDefinitions().specpercentage < 100) {
  232. specTimer++;
  233. if(specTimer == 120) {
  234. this.getCombatDefinitions().specpercentage += 25;
  235. this.getCombatDefinitions().refreshSpecial();
  236. specTimer = 0;
  237. }
  238. }
  239. }
  240.  
  241. public void tickHits() {
  242. for(int i = 0; i < playerHits.length; i++) {
  243. if(playerHits[i] != -1) {
  244. if(hitsDelay[i] > 0) {
  245. hitsDelay[i]--;
  246. }
  247. if(hitsDelay[i] == 0) {
  248. applyDamagePlayer(playerHits[i]);
  249. resetHit(i);
  250. }
  251. }
  252. }
  253. }
  254.  
  255. public HitType getDamageType(int hit) {
  256. if(hit == 0) {
  257. return HitType.NO_DAMAGE;
  258. }
  259. if(hit < 100) {
  260. return HitType.NORMAL_DAMAGE;
  261. }
  262. return HitType.NORMAL_BIG_DAMAGE;
  263. }
  264.  
  265. public void applyDamagePlayer(int damage) {
  266. if(!this.getMask().isHitUpdate()) {
  267. this.hits.setHit1(new Hit(damage, getDamageType(damage)));
  268. this.getMask().setHitUpdate(true);
  269. this.getSkills().hit(damage);
  270. } else if(!this.getMask().isHit2Update()) {
  271. this.hits.setHit2(new Hit(damage, getDamageType(damage)));
  272. this.getMask().setHit2Update(true);
  273. this.getSkills().hit(damage);
  274. }
  275. }
  276.  
  277. public void resetHit(int slot) {
  278. playerHits[slot] = -1;
  279. hitsDelay[slot] = -1;
  280. dealtDamage[slot] = -1;
  281. }
  282.  
  283.  
  284. //Main Information Start
  285. private int combatDelay;
  286. private boolean isAttacking;
  287. private Entity attackingEntity;
  288. private String Username;
  289. private String DisplayName;
  290. private String Password;
  291. private Calendar BirthDate;
  292. private Calendar RegistDate;
  293. private short Country;
  294. private String Email;
  295. private byte Settings;
  296. private boolean isBanned;
  297. private Date Membership;
  298. private List<String> friends;
  299. private transient List<String> ignores;
  300. private List<String> Messages;
  301. private int LastIp;
  302. private byte rights;
  303.  
  304. //Saving classes here
  305. private Appearence appearence;
  306. private Inventory inventory;
  307. private Equipment equipment;
  308. private Skills skills;
  309. private Banking bank;
  310. private CombatDefinitions combatdefinitions;
  311. private Construction construction;
  312. private Prayer prayer;
  313. private MusicManager musicmanager;
  314.  
  315. private transient ConnectionHandler connection;
  316. private transient Frames frames;
  317. private transient Mask mask;
  318. private transient Gpi gpi;
  319. private transient Gni gni;
  320. private transient Queue<Hit> queuedHits;
  321. private transient Hits hits;
  322. private transient InterfaceManager intermanager;
  323. private transient HintIconManager hinticonmanager;
  324. private transient MinigameManager Minigamemanager;
  325. private transient Dialogue dialogue;
  326. private transient WoodCutting woodcutting;
  327. //login stuff
  328. private transient boolean isOnline;
  329. private transient boolean inClient;
  330.  
  331.  
  332.  
  333. public Player(String Username, String Password, Calendar Birth, Calendar ThisDate, short Country, String Email, byte Settings) {
  334. this.setUsername(Username);
  335. this.setDisplayName(Username);
  336. this.setPassword(Password);
  337. this.setBirthDate(BirthDate);
  338. this.setRegistDate(ThisDate);
  339. this.setCountry(Country);
  340. this.setEmail(Email);
  341. this.setSettings(Settings);
  342. this.setMuted(false);
  343. this.setBanned(false);
  344. this.setMembership(new Date());
  345. this.setFriends(new ArrayList<String>(200));
  346. //this.setIgnores(new ArrayList<String>(100));
  347. this.setMessages(new ArrayList<String>());
  348. this.setLocation(RSTile.createRSTile(3170, 3490, (byte) 0));
  349. this.setAppearence(new Appearence());
  350. this.setInventory(new Inventory());
  351. this.setEquipment(new Equipment());
  352. this.setSkills(new Skills());
  353. this.setCombatDefinitions(new CombatDefinitions());
  354. this.setConstruction(new Construction());
  355. this.setPrayer(new Prayer());
  356. this.setBank(new Banking());
  357. this.setMusicmanager(new MusicManager());
  358. }
  359.  
  360. public void LoadPlayer(ConnectionHandler connection) {
  361. this.setConnection(connection);
  362. this.setFrames(new Frames(this));
  363. this.setMask(new Mask(this));
  364. this.setGpi(new Gpi(this));
  365. this.setGni(new Gni(this));
  366. this.setQueuedHits(new LinkedList<Hit>());
  367. this.setHits(new Hits());
  368. this.setIntermanager(new InterfaceManager(this));
  369. this.setHinticonmanager(new HintIconManager(this));
  370. this.setMinigamemanager(new MinigameManager(this));
  371. this.setDialogue(new Dialogue(this));
  372. this.setWoodcutting(new WoodCutting(this));
  373. if(this.appearence == null)
  374. this.appearence = new Appearence();
  375. if(this.inventory == null)
  376. this.inventory = new Inventory();
  377. this.getInventory().setPlayer(this);
  378. if(this.equipment == null)
  379. this.equipment = new Equipment();
  380. this.getEquipment().setPlayer(this);
  381. if(this.skills == null)
  382. this.skills = new Skills();
  383. this.getSkills().setPlayer(this);
  384. if(this.combatdefinitions == null)
  385. this.combatdefinitions = new CombatDefinitions();
  386. this.getCombatDefinitions().setPlayer(this);
  387. if(this.construction == null)
  388. this.construction = new Construction();
  389. this.getConstruction().setPlayer(this);
  390. if(this.prayer == null)
  391. this.prayer = new Prayer();
  392. this.getPrayer().setPlayer(this);
  393. if(this.musicmanager == null)
  394. this.musicmanager = new MusicManager();
  395. this.getMusicmanager().setPlayer(this);
  396. if(this.bank == null)
  397. this.bank = new Banking();
  398. this.getBank().setPlayer(this);
  399. this.setIgnores(new ArrayList<String>(100)); //Resets list for now...
  400. this.EntityLoad();
  401. this.getFrames().loginResponce();
  402. this.getFrames().sendLoginInterfaces();
  403. this.getFrames().sendLoginConfigurations();
  404. this.getFrames().sendOtherLoginPackets();
  405. this.LoadFriend_Ignore_Lists();
  406. this.reset();
  407. this.setOnline(true);
  408. for (Player p2 : World.getPlayers()) {
  409. if(p2 == null || p2 == this)
  410. continue;
  411. p2.getGpi().addPlayer(this);
  412. }
  413. this.setShophandler(new ShopHandler(this));
  414. this.getCombatDefinitions().startHealing();
  415. this.getSkills().startBoostingSkill();
  416. this.getCombatDefinitions().startGettingSpecialUp();
  417.  
  418. if(this.isDead())
  419. this.getSkills().sendDead();
  420. }
  421. private void reset() {
  422. if(this.getConnection().getChannel() == null)
  423. return;
  424. if(this.LastIp == 0) {
  425. this.getFrames().sendChatMessage(0, "Enjoy your starter!");
  426. this.getInventory().addItem(12852, wasReset ? 1000 : 50);
  427. int[] starter = {10828, 1704, 1127, 1079, 1201, 7460, 3105, 4151, 1052};
  428. for(int i : starter) {
  429. this.getInventory().addItem(i, 1);
  430. }
  431. }
  432. String ip = "" + this.getConnection().getChannel().getLocalAddress();
  433. ip = ip.replaceAll("/", "");
  434. ip = ip.replaceAll(" ", "");
  435. ip = ip.substring(0, ip.indexOf(":"));
  436. this.setLastIp(Misc.IPAddressToNumber(ip));
  437. if(World.getIps().containsKey(this.LastIp))
  438. World.getIps().remove(this.LastIp);
  439. World.getIps().put(this.LastIp, System.currentTimeMillis());
  440. }
  441.  
  442. private void LoadFriend_Ignore_Lists() {
  443. this.getFrames().sendUnlockIgnoreList();
  444. this.getFrames().sendUnlockFriendList();
  445. LoadIgnoreList();
  446. LoadFriendList();
  447. }
  448.  
  449. private void LoadFriendList() {
  450. for (String Friend : getFriends()) {
  451. short WorldId = (short) (World.isOnline(Misc.formatPlayerNameForProtocol(Friend)) ? 1 : 0);//getWorld("Player");
  452. boolean isOnline = WorldId != 0;
  453. this.getFrames().sendFriend(Friend, Friend, WorldId, isOnline, false);
  454. }
  455. }
  456.  
  457. private void LoadIgnoreList() {
  458. for (String Ignore : getIgnores()) {
  459. this.getFrames().sendIgnore(Ignore, Ignore);
  460. }
  461. }
  462.  
  463.  
  464. public void UpdateFriendStatus(String Friend, short worldId, boolean isOnline) {
  465. this.getFrames().sendFriend(Friend, Friend, worldId, isOnline, true);
  466. }
  467.  
  468. public void AddFriend(String Friend) {
  469. if ((getMembershipCredit() == 0 && getFriends().size() >= 100)
  470. || getFriends().size() >= 200
  471. || Friend == null
  472. || Friend.equals("")
  473. || getFriends().contains(Friend)
  474. || getIgnores().contains(Friend)
  475. || Friend.equals(Misc.formatPlayerNameForDisplay(this.getUsername())
  476. ))
  477. return;
  478. getFriends().add(Friend);
  479. short WorldId = (short) (World.isOnline(Misc.formatPlayerNameForProtocol(Friend)) ? 1 : 0);//getWorld("Player");
  480. boolean isOnline = WorldId != 0;
  481. this.getFrames().sendFriend(Friend, Friend, WorldId, false, false);
  482. if (isOnline)
  483. UpdateFriendStatus(Friend, WorldId, isOnline);
  484. }
  485.  
  486. public void AddIgnore(String Ignore) {
  487. if (getIgnores().size() >= 100
  488. || Ignore == null
  489. || getFriends().contains(Ignore)
  490. || getIgnores().contains(Ignore)
  491. || getIgnores().equals(Misc.formatPlayerNameForDisplay(this.getUsername())
  492. ))
  493. return;
  494. getIgnores().add(Ignore);
  495. this.getFrames().sendIgnore(Ignore, Ignore);
  496. }
  497.  
  498. public void RemoveIgnore(String Ignore) {
  499. if (Ignore == null || !getIgnores().contains(Ignore))
  500. return;
  501. getIgnores().remove(Ignore);
  502. }
  503.  
  504. public void RemoveFriend(String Friend) {
  505. if (Friend == null || !getFriends().contains(Friend))
  506. return;
  507. getFriends().remove(Friend);
  508. }
  509.  
  510. @SuppressWarnings("deprecation")
  511. public void MakeMember(int numberofmonths) {
  512. if (getMembership().before(new Date()))
  513. setMembership(new Date());
  514. getMembership().setMonth(getMembership().getMonth() + numberofmonths);
  515.  
  516. }
  517.  
  518. public int getMembershipCredit() {
  519. Date today = new Date();
  520. if (getMembership().before(today))
  521. return 0;
  522. long MembershipTime = getMembership().getTime();
  523. long TodayTime = today.getTime();
  524. int DayOfFinish = (int) (MembershipTime / 1000 / 60 / 60 / 24);
  525. int DayOfToday = (int) (TodayTime / 1000 / 60 / 60 / 24);
  526. return DayOfFinish - DayOfToday;
  527. }
  528.  
  529. public void setFrames(Frames frames) {
  530. this.frames = frames;
  531. }
  532.  
  533. public Frames getFrames() {
  534. if (frames == null)
  535. frames = new Frames(this);
  536. return frames;
  537. }
  538.  
  539. public void setConnection(ConnectionHandler connection) {
  540. this.connection = connection;
  541. }
  542.  
  543. public ConnectionHandler getConnection() {
  544. return connection;
  545. }
  546.  
  547. public void setUsername(String username) {
  548. Username = username;
  549. }
  550.  
  551. public String getUsername() {
  552. if (Username == null)
  553. Username = "";
  554. return Username;
  555. }
  556.  
  557. public void setDisplayName(String displayName) {
  558. DisplayName = displayName;
  559. }
  560.  
  561. public String getDisplayName() {
  562. if (DisplayName == null)
  563. DisplayName = "";
  564. return DisplayName;
  565. }
  566.  
  567. public void setPassword(String password) {
  568. Password = password;
  569. }
  570.  
  571. public String getPassword() {
  572. if (Password == null)
  573. Password = "";
  574. return Password;
  575. }
  576.  
  577. public void setBirthDate(Calendar birthDate) {
  578. BirthDate = birthDate;
  579. }
  580.  
  581. public Calendar getBirthDate() {
  582. if (BirthDate == null)
  583. BirthDate = new GregorianCalendar();
  584. return BirthDate;
  585. }
  586.  
  587. public void setCountry(short country) {
  588. Country = country;
  589. }
  590.  
  591. public short getCountry() {
  592. return Country;
  593. }
  594.  
  595. public void setEmail(String email) {
  596. Email = email;
  597. }
  598.  
  599. public String getEmail() {
  600. if (Email == null)
  601. Email = "";
  602. return Email;
  603. }
  604.  
  605. public void setSettings(byte settings) {
  606. Settings = settings;
  607. }
  608.  
  609. public byte getSettings() {
  610. return Settings;
  611. }
  612.  
  613. public void setRegistDate(Calendar registDate) {
  614. RegistDate = registDate;
  615. }
  616.  
  617. public Calendar getRegistDate() {
  618. if (RegistDate == null)
  619. RegistDate = new GregorianCalendar();
  620. return RegistDate;
  621. }
  622.  
  623. public void setOnline(boolean isOnline) {
  624. this.isOnline = isOnline;
  625. }
  626.  
  627. public boolean isOnline() {
  628. return isOnline;
  629. }
  630.  
  631. public void setMembership(Date membership) {
  632. Membership = membership;
  633. }
  634.  
  635. public Date getMembership() {
  636. if (Membership == null)
  637. Membership = new Date();
  638. return Membership;
  639. }
  640.  
  641. public void setFriends(List<String> friends) {
  642. this.friends = friends;
  643. }
  644.  
  645. public List<String> getFriends() {
  646. if (friends == null)
  647. friends = new ArrayList<String>(200);
  648. return friends;
  649. }
  650.  
  651. public void setIgnores(List<String> ignores) {
  652. this.ignores = ignores;
  653. }
  654.  
  655. public List<String> getIgnores() {
  656. if (ignores == null)
  657. ignores = new ArrayList<String>(100);
  658. return ignores;
  659. }
  660.  
  661. public void setMuted(boolean isMuted) {
  662. this.playerMuted = isMuted;
  663. }
  664.  
  665. public boolean isMuted() {
  666. return playerMuted;
  667. }
  668.  
  669. public void setBanned(boolean isBanned) {
  670. this.isBanned = isBanned;
  671. }
  672.  
  673. public boolean isBanned() {
  674. return isBanned;
  675. }
  676.  
  677. public void setMessages(List<String> messages) {
  678. Messages = messages;
  679. }
  680.  
  681. public List<String> getMessages() {
  682. if (Messages == null)
  683. Messages = new ArrayList<String>();
  684. return Messages;
  685. }
  686.  
  687. public void setLastIp(int lastIp) {
  688. LastIp = lastIp;
  689. }
  690.  
  691. public int getLastIp() {
  692. return LastIp;
  693. }
  694.  
  695. public void setRights(byte rights) {
  696. this.rights = rights;
  697. }
  698.  
  699. public byte getRights() {
  700. return rights;
  701. }
  702.  
  703. @Override
  704. public void animate(int id) {
  705. this.getMask().setLastAnimation(new Animation((short)id, (short)0));
  706. this.getMask().setAnimationUpdate(true);
  707.  
  708. }
  709.  
  710. @Override
  711. public void animate(int id, int delay) {
  712. this.getMask().setLastAnimation(new Animation((short)id,(short)delay));
  713. this.getMask().setAnimationUpdate(true);
  714.  
  715. }
  716.  
  717. @Override
  718. public void graphics(int id) {
  719. this.getMask().setLastGraphics(new Graphics((short)id, (short)0));
  720. this.getMask().setGraphicUpdate(true);
  721. }
  722.  
  723. public void graphics2(int id) {
  724. this.getMask().setLastGraphics2(new Graphics((short)id, (short)0));
  725. this.getMask().setGraphic2Update(true);
  726. }
  727.  
  728. public void graphics2(int id, int delay) {
  729. this.getMask().setLastGraphics2(new Graphics((short)id, (short)delay));
  730. this.getMask().setGraphic2Update(true);
  731. }
  732.  
  733. @Override
  734. public void graphics(int id, int delay) {
  735. this.getMask().setLastGraphics(new Graphics((short)id, (short)delay));
  736. this.getMask().setGraphicUpdate(true);
  737. }
  738.  
  739. @Override
  740. public void heal(int amount) {
  741. // TODO Auto-generated method stub
  742.  
  743. }
  744.  
  745. public void heal(int healdelay, int bardelay, int healspeed) {
  746. getMask().setLastHeal(new Heal((short)healdelay, (byte)bardelay, (byte)healspeed));
  747. getMask().setHealUpdate(true);
  748.  
  749. }
  750.  
  751. public void processQueuedHits() {
  752. if(!this.getMask().isHitUpdate()) {
  753. if(queuedHits.size() > 0) {
  754. Hit h = queuedHits.poll();
  755. this.hit(h.getDamage(), h.getType());
  756. }
  757. }
  758. if(!this.getMask().isHit2Update()) {
  759. if(queuedHits.size() > 0) {
  760. Hit h = queuedHits.poll();
  761. this.hit(h.getDamage(), h.getType());
  762. }
  763. }
  764. }
  765.  
  766. public void hit(int damage, Hits.HitType type) {
  767.  
  768. if(System.currentTimeMillis() < this.getCombatDefinitions().getLastEmote()-600) {
  769. queuedHits.add(new Hit(damage, type));
  770. }else if(!this.getMask().isHitUpdate()) {
  771. this.hits.setHit1(new Hit(damage, type));
  772. this.getMask().setHitUpdate(true);
  773. this.getSkills().hit(damage);
  774. }else if(!this.getMask().isHit2Update()) {
  775. this.hits.setHit2(new Hit(damage, type));
  776. this.getMask().setHit2Update(true);
  777. this.getSkills().hit(damage);
  778. }else{
  779. if(this.skills.getHitPoints() <= 0) {
  780. return;
  781. }
  782. queuedHits.add(new Hit(damage, type));
  783. }
  784. }
  785.  
  786.  
  787. @Override
  788. public void hit(int damage) {
  789. if(damage > this.skills.getHitPoints())
  790. damage = this.skills.getHitPoints();
  791. if(damage == 0) {
  792. hit(damage, Hits.HitType.NO_DAMAGE);
  793. } else if(damage >= 100) {
  794. hit(damage, Hits.HitType.NORMAL_BIG_DAMAGE);
  795. }else {
  796. hit(damage, Hits.HitType.NORMAL_DAMAGE);
  797. }
  798. }
  799. public void hit(int damage, Player opp) {
  800. this.getSkills().killerName = opp.getUsername();
  801. if(damage > this.skills.getHitPoints())
  802. damage = this.skills.getHitPoints();
  803. if(damage == 0) {
  804. hit(damage, Hits.HitType.NO_DAMAGE);
  805. } else if(damage >= 100) {
  806. hit(damage, Hits.HitType.NORMAL_BIG_DAMAGE);
  807. }else {
  808. hit(damage, Hits.HitType.NORMAL_DAMAGE);
  809. }
  810. }
  811.  
  812. public void hitType(int damage, HitType hitType) {
  813. if(damage > this.skills.getHitPoints())
  814. damage = this.skills.getHitPoints();
  815. hit(damage, hitType);
  816. }
  817.  
  818. @Override
  819. public void resetTurnTo() {
  820. this.mask.setTurnToIndex(-1);
  821. this.mask.setTurnToReset(true);
  822. this.mask.setTurnToUpdate(true);
  823. }
  824.  
  825. @Override
  826. public void turnTemporarilyTo(Entity entity) {
  827. // TODO Auto-generated method stub
  828. this.mask.setTurnToIndex(entity.getClientIndex());
  829. this.mask.setTurnToReset(true);
  830. this.mask.setTurnToUpdate(true);
  831. }
  832.  
  833. public void turnTemporarilyTo(RSTile location) {
  834. this.mask.setTurnToLocation( location);
  835. this.mask.setTurnToUpdate1(true);
  836. }
  837.  
  838. @Override
  839. public void turnTo(Entity entity) {
  840. this.mask.setTurnToIndex(entity.getClientIndex());
  841. this.mask.setTurnToReset(false);
  842. this.mask.setTurnToUpdate(true);
  843. }
  844.  
  845. public void setMask(Mask mask) {
  846. this.mask = mask;
  847. }
  848.  
  849. public Mask getMask() {
  850. return mask;
  851. }
  852.  
  853. public void setAppearence(Appearence appearence) {
  854. this.appearence = appearence;
  855. }
  856.  
  857. public Appearence getAppearence() {
  858. return appearence;
  859. }
  860.  
  861. public void setInventory(Inventory inventory) {
  862. this.inventory = inventory;
  863. }
  864.  
  865. public Inventory getInventory() {
  866. return inventory;
  867. }
  868.  
  869. public void setEquipment(Equipment equipment) {
  870. this.equipment = equipment;
  871. }
  872.  
  873. public Equipment getEquipment() {
  874. return equipment;
  875. }
  876.  
  877. public void setSkills(Skills skills) {
  878. this.skills = skills;
  879. }
  880.  
  881. public Skills getSkills() {
  882. return skills;
  883. }
  884.  
  885. public void setIntermanager(InterfaceManager intermanager) {
  886. this.intermanager = intermanager;
  887. }
  888.  
  889. public InterfaceManager getIntermanager() {
  890. return intermanager;
  891. }
  892.  
  893. public void setInClient(boolean inClient) {
  894. this.inClient = inClient;
  895. }
  896.  
  897. public boolean isInClient() {
  898. return inClient;
  899. }
  900.  
  901. public void setCombatDefinitions(CombatDefinitions combat) {
  902. this.combatdefinitions = combat;
  903. }
  904.  
  905. public CombatDefinitions getCombatDefinitions() {
  906. return combatdefinitions;
  907. }
  908.  
  909. public void setConstruction(Construction construction) {
  910. this.construction = construction;
  911. }
  912.  
  913. public Construction getConstruction() {
  914. return construction;
  915. }
  916.  
  917. public void setDialogue(Dialogue dialogue) {
  918. this.dialogue = dialogue;
  919. }
  920.  
  921. public Dialogue getDialogue() {
  922. return dialogue;
  923. }
  924.  
  925. public void setPrayer(Prayer prayer) {
  926. this.prayer = prayer;
  927. }
  928.  
  929. public Prayer getPrayer() {
  930. return prayer;
  931. }
  932.  
  933. public void setQueuedHits(Queue<Hit> queuedHits) {
  934. this.queuedHits = queuedHits;
  935. }
  936.  
  937. public Queue<Hit> getQueuedHits() {
  938. return queuedHits;
  939. }
  940.  
  941. public void setHits(Hits hits) {
  942. this.hits = hits;
  943. }
  944.  
  945. public Hits getHits() {
  946. return hits;
  947. }
  948.  
  949. public void setGpi(Gpi gpi) {
  950. this.gpi = gpi;
  951. }
  952.  
  953. public Gpi getGpi() {
  954. return gpi;
  955. }
  956.  
  957. public void setMusicmanager(MusicManager musicmanager) {
  958. this.musicmanager = musicmanager;
  959. }
  960.  
  961. public MusicManager getMusicmanager() {
  962. return musicmanager;
  963. }
  964.  
  965. public void setBank(Banking bank) {
  966. this.bank = bank;
  967. }
  968.  
  969. public Banking getBank() {
  970. return bank;
  971. }
  972.  
  973. public void setHinticonmanager(HintIconManager hinticonmanager) {
  974. this.hinticonmanager = hinticonmanager;
  975. }
  976.  
  977. public HintIconManager getHinticonmanager() {
  978. return hinticonmanager;
  979. }
  980.  
  981. public void setMinigamemanager(MinigameManager minigamemanager) {
  982. Minigamemanager = minigamemanager;
  983. }
  984.  
  985. public MinigameManager getMinigamemanager() {
  986. return Minigamemanager;
  987. }
  988.  
  989. public void setGni(Gni gni) {
  990. this.gni = gni;
  991. }
  992.  
  993. public Gni getGni() {
  994. return gni;
  995. }
  996.  
  997. public void setWoodcutting(WoodCutting woodcutting) {
  998. this.woodcutting = woodcutting;
  999. }
  1000.  
  1001. public WoodCutting getWoodcutting() {
  1002. return woodcutting;
  1003. }
  1004.  
  1005. public void setCombatDelay(int combatDelay) {
  1006. this.combatDelay = combatDelay;
  1007. }
  1008.  
  1009. public int getCombatDelay() {
  1010. return combatDelay;
  1011. }
  1012.  
  1013. public void setAttacking(boolean isAttacking) {
  1014. this.isAttacking = isAttacking;
  1015. }
  1016.  
  1017. public boolean isAttacking() {
  1018. return isAttacking;
  1019. }
  1020.  
  1021. public void setAttackingEntity(Entity attackingEntity) {
  1022. this.attackingEntity = attackingEntity;
  1023. }
  1024.  
  1025. public Entity getAttackingEntity() {
  1026. return attackingEntity;
  1027. }
  1028.  
  1029. /**
  1030. * @param shophandler the shophandler to set
  1031. */
  1032. public void setShophandler(ShopHandler shophandler) {
  1033. this.shophandler = shophandler;
  1034. }
  1035.  
  1036. /**
  1037. * @return the shophandler
  1038. */
  1039. public ShopHandler getShophandler() {
  1040. return shophandler;
  1041. }
  1042.  
  1043.  
  1044. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement