Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.20 KB | None | 0 0
  1. package server.model.players;
  2. import java.util.ArrayList;
  3.  
  4. import server.Config;
  5. import server.Server;
  6. import server.model.items.Item;
  7. import server.model.npcs.NPC;
  8. import server.model.npcs.NPCHandler;
  9. import server.util.ISAACRandomGen;
  10. import server.util.Misc;
  11. import server.util.Stream;
  12. import server.world.map.VirtualWorld;
  13.  
  14. public abstract class Player {
  15.  
  16. public ArrayList <String>killedPlayers = new ArrayList<String> ();
  17. public ArrayList <Integer>attackedPlayers = new ArrayList<Integer> ();
  18.  
  19. public boolean
  20. initialized = false,
  21. disconnected = false,
  22. ruleAgreeButton = false,
  23. RebuildNPCList = false,
  24. isActive = false,
  25. isKicked = false,
  26. isSkulled = false,
  27. friendUpdate = false,
  28. newPlayer = false,
  29. hasMultiSign = false,
  30. saveCharacter = false,
  31. mouseButton = false,
  32. splitChat = true,
  33. chatEffects = true,
  34. acceptAid = false,
  35. nextDialogue = false,
  36. autocasting = false,
  37. usedSpecial = false,
  38. mageFollow = false,
  39. dbowSpec = false,
  40. craftingLeather = false,
  41. properLogout = false,
  42. secDbow = false,
  43. maxNextHit = false,
  44. ssSpec = false,
  45. vengOn = false,
  46. addStarter = false,
  47. accountFlagged = false,
  48. msbSpec = false
  49. ;
  50.  
  51.  
  52. public int
  53. combatTimer = 0,
  54. grimPrize = 0,
  55. ratCheck = 0,
  56. brotherCheck = 0,
  57. firecape = 0,
  58. saveDelay,
  59. playerKilled,
  60. pkPoints,
  61. totalPlayerDamageDealt,
  62. killedBy,
  63. lastChatId = 1,
  64. privateChat,
  65. friendSlot = 0,
  66. dialogueId,
  67. randomCoffin,
  68. newLocation,
  69. specEffect,
  70. specBarId,
  71. attackLevelReq,
  72. defenceLevelReq,
  73. strengthLevelReq,
  74. rangeLevelReq,
  75. magicLevelReq,
  76. followId,
  77. skullTimer,
  78. votingPoints,
  79. nextChat = 0,
  80. talkingNpc = -1,
  81. dialogueAction = 0,
  82. autocastId,
  83. followDistance,
  84. followId2,
  85. barrageCount = 0,
  86. delayedDamage = 0,
  87. delayedDamage2 = 0,
  88. pcPoints = 0,
  89. magePoints = 0,
  90. desertTreasure = 0,
  91. lastArrowUsed = -1,
  92. clanId = -1,
  93. autoRet = 0,
  94. pcDamage = 0,
  95. xInterfaceId = 0,
  96. xRemoveId = 0,
  97. xRemoveSlot = 0,
  98. tzhaarToKill = 0,
  99. tzhaarKilled = 0,
  100. waveId,
  101. frozenBy = 0,
  102. poisonDamage = 0,
  103. teleAction = 0,
  104. bonusAttack = 0,
  105. lastNpcAttacked = 0,
  106. killCount = 0;
  107. public String clanName, properName;
  108. public int[] voidStatus = new int[5];
  109. public int[] itemKeptId = new int [4];
  110. public int[] pouches = new int[4];
  111. public final int[] POUCH_SIZE = {3,6,9,12};
  112. public boolean[] invSlot = new boolean[28], equipSlot = new boolean[14];
  113. public long friends[] = new long[200];
  114. public double specAmount = 0;
  115. public double specAccuracy = 1;
  116. public double specDamage = 1;
  117. public double prayerPoint = 1.0;
  118. public int teleGrabItem, teleGrabX, teleGrabY, duelCount, underAttackBy, underAttackBy2, wildLevel, teleTimer, respawnTimer, saveTimer = 0, teleBlockLength, poisonDelay;
  119. public long lastPlayerMove,lastPoison,lastPoisonSip,poisonImmune,lastSpear,lastProtItem, dfsDelay, lastSpec, lastVeng,lastYell,teleGrabDelay, protMageDelay, protMeleeDelay, protRangeDelay, lastAction, lastThieve,lastLockPick, alchDelay, specDelay = System.currentTimeMillis(), duelDelay, teleBlockDelay, godSpellDelay, singleCombatDelay, singleCombatDelay2, reduceStat, restoreStatsDelay, logoutDelay, buryDelay, foodDelay, potDelay;
  120. public boolean canChangeAppearance = false;
  121. public boolean mageAllowed;
  122. public byte poisonMask = 0;
  123. public boolean isNpc = false;
  124. public int npcId2 = 0;
  125. public int memberStatus = 0;
  126.  
  127. public final int[] BOWS = {9185,839,845,847,851,855,859,841,843,849,853,857,861,4212,4214,4215,11235,4216,4217,4218,4219,4220,4221,4222,4223,6724,4734,4934,4935,4936,4937};
  128. public final int[] ARROWS = {882,884,886,888,890,892,4740,11212,9140,9141,4142,9143,9144,9240,9241,9242,9243,9244,9245};
  129. public final int[] NO_ARROW_DROP = {4212,4214,4215,4216,4217,4218,4219,4220,4221,4222,4223,4734,4934,4935,4936,4937};
  130. public final int[] OTHER_RANGE_WEAPONS = {11230,863,864,865,866,867,868,869,806,807,808,809,810,811,825,826,827,828,829,830,800,801,802,803,804,805,6522};
  131.  
  132. public final int[][] MAGIC_SPELLS = {
  133. // example {magicId, level req, animation, startGFX, projectile Id, endGFX, maxhit, exp gained, rune 1, rune 1 amount, rune 2, rune 2 amount, rune 3, rune 3 amount, rune 4, rune 4 amount}
  134.  
  135. // Modern Spells
  136. {1152,1,711,90,91,92,2,5,556,1,558,1,0,0,0,0}, //wind strike
  137. {1154,5,711,93,94,95,4,7,555,1,556,1,558,1,0,0}, // water strike
  138. {1156,9,711,96,97,98,6,9,557,2,556,1,558,1,0,0},// earth strike
  139. {1158,13,711,99,100,101,8,11,554,3,556,2,558,1,0,0}, // fire strike
  140. {1160,17,711,117,118,119,9,13,556,2,562,1,0,0,0,0}, // wind bolt
  141. {1163,23,711,120,121,122,10,16,556,2,555,2,562,1,0,0}, // water bolt
  142. {1166,29,711,123,124,125,11,20,556,2,557,3,562,1,0,0}, // earth bolt
  143. {1169,35,711,126,127,128,12,22,556,3,554,4,562,1,0,0}, // fire bolt
  144. {1172,41,711,132,133,134,13,25,556,3,560,1,0,0,0,0}, // wind blast
  145. {1175,47,711,135,136,137,14,28,556,3,555,3,560,1,0,0}, // water blast
  146. {1177,53,711,138,139,140,15,31,556,3,557,4,560,1,0,0}, // earth blast
  147. {1181,59,711,129,130,131,16,35,556,4,554,5,560,1,0,0}, // fire blast
  148. {1183,62,711,158,159,160,17,36,556,5,565,1,0,0,0,0}, // wind wave
  149. {1185,65,711,161,162,163,18,37,556,5,555,7,565,1,0,0}, // water wave
  150. {1188,70,711,164,165,166,19,40,556,5,557,7,565,1,0,0}, // earth wave
  151. {1189,75,711,155,156,157,20,42,556,5,554,7,565,1,0,0}, // fire wave
  152. {1153,3,716,102,103,104,0,13,555,3,557,2,559,1,0,0}, // confuse
  153. {1157,11,716,105,106,107,0,20,555,3,557,2,559,1,0,0}, // weaken
  154. {1161,19,716,108,109,110,0,29,555,2,557,3,559,1,0,0}, // curse
  155. {1542,66,729,167,168,169,0,76,557,5,555,5,566,1,0,0}, // vulnerability
  156. {1543,73,729,170,171,172,0,83,557,8,555,8,566,1,0,0}, // enfeeble
  157. {1562,80,729,173,174,107,0,90,557,12,555,12,556,1,0,0}, // stun
  158. {1572,20,711,177,178,181,0,30,557,3,555,3,561,2,0,0}, // bind
  159. {1582,50,711,177,178,180,2,60,557,4,555,4,561,3,0,0}, // snare
  160. {1592,79,711,177,178,179,4,90,557,5,555,5,561,4,0,0}, // entangle
  161. {1171,39,724,145,146,147,15,25,556,2,557,2,562,1,0,0}, // crumble undead
  162. {1539,50,708,87,88,89,25,42,554,5,560,1,0,0,0,0}, // iban blast
  163. {12037,50,1576,327,328,329,19,30,560,1,558,4,0,0,0,0}, // magic dart
  164. {1190,60,811,0,0,76,20,60,554,2,565,2,556,4,0,0}, // sara strike
  165. {1191,60,811,0,0,77,20,60,554,1,565,2,556,4,0,0}, // cause of guthix
  166. {1192,60,811,0,0,78,20,60,554,4,565,2,556,1,0,0}, // flames of zammy
  167. {12445,85,1819,0,344,345,0,65,563,1,562,1,560,1,0,0}, // teleblock
  168.  
  169. // Ancient Spells
  170. {12939,50,1978,0,384,385,13,30,560,2,562,2,554,1,556,1}, // smoke rush
  171. {12987,52,1978,0,378,379,14,31,560,2,562,2,566,1,556,1}, // shadow rush
  172. {12901,56,1978,0,0,373,15,33,560,2,562,2,565,1,0,0}, // blood rush
  173. {12861,58,1978,0,360,361,16,34,560,2,562,2,555,2,0,0}, // ice rush
  174. {12963,62,1979,0,0,389,19,36,560,2,562,4,556,2,554,2}, // smoke burst
  175. {13011,64,1979,0,0,382,20,37,560,2,562,4,556,2,566,2}, // shadow burst
  176. {12919,68,1979,0,0,376,21,39,560,2,562,4,565,2,0,0}, // blood burst
  177. {12881,70,1979,0,0,363,22,40,560,2,562,4,555,4,0,0}, // ice burst
  178. {12951,74,1978,0,386,387,23,42,560,2,554,2,565,2,556,2}, // smoke blitz
  179. {12999,76,1978,0,380,381,24,43,560,2,565,2,556,2,566,2}, // shadow blitz
  180. {12911,80,1978,0,374,375,25,45,560,2,565,4,0,0,0,0}, // blood blitz
  181. {12871,82,1978,366,0,367,26,46,560,2,565,2,555,3,0,0}, // ice blitz
  182. {12975,86,1979,0,0,391,27,48,560,4,565,2,556,4,554,4}, // smoke barrage
  183. {13023,88,1979,0,0,383,28,49,560,4,565,2,556,4,566,3}, // shadow barrage
  184. {12929,92,1979,0,0,377,29,51,560,4,565,4,566,1,0,0}, // blood barrage
  185. {12891,94,1979,0,0,369,30,52,560,4,565,2,555,6,0,0}, // ice barrage
  186.  
  187. {-1,80,811,301,0,0,0,0,554,3,565,3,556,3,0,0}, // charge
  188. {-1,21,712,112,0,0,0,10,554,3,561,1,0,0,0,0}, // low alch
  189. {-1,55,713,113,0,0,0,20,554,5,561,1,0,0,0,0}, // high alch
  190. {-1,33,728,142,143,144,0,35,556,1,563,1,0,0,0,0} // telegrab
  191.  
  192. };
  193.  
  194. public int magicHitBonus() {
  195. if (playerEquipment[playerWeapon] == 15001) {
  196. return 4;
  197. } else if (playerEquipment[playerWeapon] == 6914) {
  198. return 3;
  199. } else {
  200. return 0;
  201. }
  202. }
  203.  
  204. public int totalMagicBonus() {
  205. if (playerEquipment[playerAmulet] == 15000) {
  206. return 4 + magicHitBonus();
  207. } else {
  208. return magicHitBonus();
  209. }
  210. }
  211.  
  212. public boolean isAutoButton(int button) {
  213. for (int j = 0; j < autocastIds.length; j += 2) {
  214. if (autocastIds[j] == button)
  215. return true;
  216. }
  217. return false;
  218. }
  219.  
  220. public int[] autocastIds = {51133,32,51185,33,51091,34,24018,35,51159,36,51211,37,51111,38,51069,39,51146,40,51198,41,51102,42,51058,43,51172,44,51224,45,51122,46,51080,47,
  221. 7038,0,7039,1,7040,2,7041,3,7042,4,7043,5,7044,6,7045,7,7046,8,7047,9,7048,10,7049,11,7050,12,7051,13,7052,14,7053,15,
  222. 47019,27,47020,25,47021,12,47022,13,47023,14,47024,15};
  223.  
  224. //public String spellName = "Select Spell";
  225. public void assignAutocast(int button) {
  226. for (int j = 0; j < autocastIds.length; j++) {
  227. if (autocastIds[j] == button) {
  228. Client c = (Client) Server.playerHandler.players[this.playerId];
  229. autocasting = true;
  230. autocastId = autocastIds[j+1];
  231. c.getPA().sendFrame36(108, 1);
  232. c.setSidebarInterface(0, 328);
  233. //spellName = getSpellName(autocastId);
  234. //spellName = spellName;
  235. //c.getPA().sendFrame126(spellName, 354);
  236. c = null;
  237. break;
  238. }
  239. }
  240. }
  241.  
  242. public String getSpellName(int id) {
  243. switch (id) {
  244. case 0: return "Air Strike";
  245. case 1: return "Water Strike";
  246. case 2: return "Earth Strike";
  247. case 3: return "Fire Strike";
  248. case 4: return "Air Bolt";
  249. case 5: return "Water Bolt";
  250. case 6: return "Earth Bolt";
  251. case 7: return "Fire Bolt";
  252. case 8: return "Air Blast";
  253. case 9: return "Water Blast";
  254. case 10: return "Earth Blast";
  255. case 11: return "Fire Blast";
  256. case 12: return "Air Wave";
  257. case 13: return "Water Wave";
  258. case 14: return "Earth Wave";
  259. case 15: return "Fire Wave";
  260. case 32: return "Shadow Rush";
  261. case 33: return "Smoke Rush";
  262. case 34: return "Blood Rush";
  263. case 35: return "Ice Rush";
  264. case 36: return "Shadow Burst";
  265. case 37: return "Smoke Burst";
  266. case 38: return "Blood Burst";
  267. case 39: return "Ice Burst";
  268. case 40: return "Shadow Blitz";
  269. case 41: return "Smoke Blitz";
  270. case 42: return "Blood Blitz";
  271. case 43: return "Ice Blitz";
  272. case 44: return "Shadow Barrage";
  273. case 45: return "Smoke Barrage";
  274. case 46: return "Blood Barrage";
  275. case 47: return "Ice Barrage";
  276. default:
  277. return "Select Spell";
  278. }
  279. }
  280.  
  281. public boolean fullVoidRange() {
  282. return playerEquipment[playerHat] == 11664 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  283. }
  284.  
  285. public boolean fullVoidMage() {
  286. return playerEquipment[playerHat] == 11663 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  287. }
  288.  
  289. public boolean fullVoidMelee() {
  290. return playerEquipment[playerHat] == 11665 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  291. }
  292.  
  293. public int[][] barrowsNpcs = {
  294. {2030, 0}, //verac
  295. {2029, 0}, //toarg
  296. {2028, 0}, // karil
  297. {2027, 0}, // guthan
  298. {2026, 0}, // dharok
  299. {2025, 0} // ahrim
  300. };
  301. public int barrowsKillCount;
  302.  
  303. public int reduceSpellId;
  304. public final int[] REDUCE_SPELL_TIME = {250000, 250000, 250000, 500000,500000,500000}; // how long does the other player stay immune to the spell
  305. public long[] reduceSpellDelay = new long[6];
  306. public final int[] REDUCE_SPELLS = {1153,1157,1161,1542,1543,1562};
  307. public boolean[] canUseReducingSpell = {true, true, true, true, true, true};
  308.  
  309. public int slayerTask,taskAmount;
  310.  
  311. public int prayerId = -1;
  312. public int headIcon = -1;
  313. public int bountyIcon = 0;
  314. public long stopPrayerDelay, prayerDelay;
  315. public boolean usingPrayer;
  316. public final int[] PRAYER_DRAIN_RATE = {500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500};
  317. public final int[] PRAYER_LEVEL_REQUIRED = {1,4,7,8,9,10,13,16,19,22,25,26,27,28,31,34,37,40,43,44,45,46,49,52,60,70};
  318. public final int[] PRAYER = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25};
  319. public final String[] PRAYER_NAME = {"Thick Skin", "Burst of Strength", "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin", "Superhuman Strength", "Improved Reflexes","Rapid Restore",
  320. "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin", "Ultimate Strength", "Incredible Reflexes","Protect from Magic", "Protect from Missiles",
  321. "Protect from Melee","Eagle Eye", "Mystic Might", "Retribution", "Redemption", "Smite", "Chivalry", "Piety"};
  322. public final int[] PRAYER_GLOW = {83,84,85,601,602,86,87,88,89,90,91,603,604,92,93,94,95,96,97,605,606,98,99,100,607,608};
  323. public final int[] PRAYER_HEAD_ICONS = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,1,0,-1,-1,3,5,4,-1,-1};
  324. //{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,1,4,6,5};
  325.  
  326. public boolean[] prayerActive = {false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false};
  327.  
  328. public int duelTimer, duelTeleX, duelTeleY, duelSlot, duelSpaceReq, duelOption, duelingWith, duelStatus;
  329. public int headIconPk = -1, headIconHints;
  330. public boolean duelRequested;
  331. public boolean[] duelRule = new boolean[22];
  332. public final int[] DUEL_RULE_ID = {1, 2, 16, 32, 64, 128, 256, 512, 1024, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 2097152, 8388608, 16777216, 67108864, 134217728};
  333.  
  334. public boolean doubleHit, usingSpecial, npcDroppingItems, usingRangeWeapon, usingBow, usingMagic, castingMagic;
  335. public int specMaxHitIncrease, freezeDelay, freezeTimer = -6, killerId, playerIndex, oldPlayerIndex, lastWeaponUsed, projectileStage, crystalBowArrowCount, playerMagicBook, teleGfx, teleEndAnimation, teleHeight, teleX, teleY, rangeItemUsed, killingNpcIndex, totalDamageDealt, oldNpcIndex, fightMode, attackTimer, npcIndex,npcClickIndex, npcType, castingSpellId, oldSpellId, spellId, hitDelay;
  336. public boolean magicFailed, oldMagicFailed;
  337. public int bowSpecShot, clickNpcType, clickObjectType, objectId, objectX, objectY, objectXOffset, objectYOffset, objectDistance;
  338. public int pItemX, pItemY, pItemId;
  339. public boolean isMoving, walkingToItem;
  340. public boolean isShopping, updateShop;
  341. public int myShopId;
  342. public int tradeStatus, tradeWith;
  343. public boolean forcedChatUpdateRequired, inDuel, tradeAccepted, goodTrade, inTrade, tradeRequested, tradeResetNeeded, tradeConfirmed, tradeConfirmed2, canOffer, acceptTrade, acceptedTrade;
  344. public int attackAnim, animationRequest = -1,animationWaitCycles;
  345. public int[] playerBonus = new int[12];
  346. public boolean isRunning2 = true;
  347. public boolean takeAsNote;
  348. public int combatLevel;
  349. public boolean saveFile = false;
  350. public int playerAppearance[] = new int[13];
  351. public int apset;
  352. public int actionID;
  353. public int wearItemTimer, wearId, wearSlot, interfaceId;
  354. public int XremoveSlot, XinterfaceID, XremoveID, Xamount;
  355.  
  356. public int tutorial = 15;
  357. public boolean usingGlory = false;
  358. public boolean usingROD = false;
  359. public boolean usingGamesNeck = false;
  360. public int[] woodcut = new int [3];
  361. public int wcTimer = 0;
  362. public int[] mining = new int [3];
  363. public int miningTimer = 0;
  364. public boolean fishing = false;
  365. public int fishTimer = 0;
  366. public int smeltType; //1 = bronze, 2 = iron, 3 = steel, 4 = gold, 5 = mith, 6 = addy, 7 = rune
  367. public int smeltAmount;
  368. public int smeltTimer = 0;
  369. public boolean smeltInterface;
  370. public boolean patchCleared;
  371. public int[] farm = new int[2];
  372.  
  373.  
  374. public boolean antiFirePot = false;
  375.  
  376. /**
  377. * Castle Wars
  378. */
  379. public int castleWarsTeam;
  380. public boolean inCwGame;
  381. public boolean inCwWait;
  382.  
  383. /**
  384. * Fight Pits
  385. */
  386. public boolean inPits = false;
  387. public int pitsStatus = 0;
  388.  
  389.  
  390. /**
  391. * SouthWest, NorthEast, SouthWest, NorthEast
  392. */
  393.  
  394. public boolean isInTut() {
  395. if(absX >= 2625 && absX <= 2687 && absY >= 4670 && absY <= 4735) {
  396. return true;
  397. }
  398. return false;
  399. }
  400.  
  401.  
  402.  
  403.  
  404. public boolean inArea(int x, int y, int x1, int y1) {
  405. if (absX > x && absX < x1 && absY < y && absY > y1) {
  406. return true;
  407. }
  408. return false;
  409. }
  410.  
  411. public boolean inWild() {
  412. if((absX <= 2600 && absX >= 2500 && absY <= 9950 && absY >= 9850) ||
  413. (absX <= 2880 && absX >= 2860 && absY <= 3560 && absY >= 3530) ||
  414. (absX <= 3098 && absX >= 3091 && absY <= 3499 && absY >= 3488) ||
  415. (absX <= 3700 && absX >= 3400 && absY <= 9800 && absY >= 9600) ||
  416. (absX <= 2861 && absX >= 2849 && absY <= 3555 && absY >= 3534) ||
  417. (absY >= 4768 && absY <= 4790) ||
  418. (absX <= 3590 && absX >= 3540 && absY <= 3310 && absY >= 3260) ||
  419. (absX <= 2930 && absX >= 2890 && absY <= 4500 && absY >= 4400) ||
  420. (absX <= 1950 && absX >= 1800 && absY <= 4450 && absY >= 4300) ||
  421. (absX <= 2600 && absX >= 2400 && absY <= 10180 && absY >= 10100) ||
  422. (absX <= 2600 && absX >= 2400 && absY <= 10180 && absY >= 10100) ||
  423. (absX <= 3000 && absX >= 2800 && absY <= 5400 && absY >= 5200) ||
  424. (absX <= 2690 && absX >= 2620 && absY <= 2620 && absY >= 2560) ||
  425. (absX <= 3400 && absX >= 3300 && absY <= 3350 && absY >= 3200) ||
  426. (absX <= 3000 && absX >= 2800 && absY <= 9900 && absY >= 9650) ||
  427. (absX <= 3229 && absX >= 3201 && absY <= 3236 && absY >= 3201) ||
  428. (absX <= 2695 && absX >= 2600 && absY <= 3735 && absY >= 3640) ||
  429. (absX <= 2675 && absX >= 2635 && absY <= 2680 && absY >= 2630) ||
  430. //var
  431. (absX <= 3190 && absX >= 3180 && absY <= 3447 && absY >= 3433) ||
  432. //castle
  433. (absX == 3230 && absY <= 3224 && absY >= 3222) ||
  434. (absX == 3230 && absY <= 3215 && absY >= 3213) ||
  435. //barrelchest
  436. (absX <= 1990 && absX >= 1960 && absY <= 5020 && absY >= 4980) ||
  437. (absX <= 2500 && absX >= 2300 && absY <= 5300 && absY >= 5000)) {
  438. return false;
  439. }
  440.  
  441. return true;
  442. }
  443.  
  444. public boolean arenas() {
  445. if(absX > 3331 && absX < 3391 && absY > 3242 && absY < 3260) {
  446. return true;
  447. }
  448. return false;
  449. }
  450.  
  451. public boolean inDuelArena() {
  452. if((absX > 3322 && absX < 3394 && absY > 3195 && absY < 3291) ||
  453. (absX > 3311 && absX < 3323 && absY > 3223 && absY < 3248)) {
  454. return true;
  455. }
  456. return false;
  457. }
  458.  
  459. public boolean inMulti() {
  460. if((absX >= 3136 && absX <= 3327 && absY >= 3519 && absY <= 3607) ||
  461. (absX >= 3190 && absX <= 3327 && absY >= 3648 && absY <= 3839) ||
  462. (absX >= 3200 && absX <= 3390 && absY >= 3840 && absY <= 3967) ||
  463. (absX >= 2992 && absX <= 3007 && absY >= 3912 && absY <= 3967) ||
  464. (absX >= 2946 && absX <= 2959 && absY >= 3816 && absY <= 3831) ||
  465. (absX >= 3008 && absX <= 3199 && absY >= 3856 && absY <= 3903) ||
  466. (absX >= 3008 && absX <= 3071 && absY >= 3600 && absY <= 3711) ||
  467. (absX >= 3072 && absX <= 3327 && absY >= 3608 && absY <= 3647) ||
  468. (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619) ||
  469. (absX >= 2371 && absX <= 2422 && absY >= 5062 && absY <= 5117) ||
  470. (absX >= 2896 && absX <= 2927 && absY >= 3595 && absY <= 3630) ||
  471. (absX >= 2892 && absX <= 2932 && absY >= 4435 && absY <= 4464) ||
  472. (absX >= 2256 && absX <= 2287 && absY >= 4680 && absY <= 4711) ||
  473. (absX <= 1990 && absX >= 1960 && absY <= 5020 && absY >= 4980) ||
  474. (absX >= 3157 && absX <= 3191 && absY >= 2965 && absY <= 2995) ||
  475. //(absX >= 3071 && absX <= 3133 && absY >= 3460 && absY <= 3520) ||
  476. //Varrock
  477. (absX >= 3174 && absX <= 3273 && absY >= 3370 && absY <= 3466) ||
  478. //Varrock
  479. (absX <= 2600 && absX >= 2500 && absY <= 9950 && absY >= 9850) ||
  480. (absY >= 9800 && absY <= 9830) ||
  481. (absX >= 2785 && absX <= 2809 && absY >= 2775 && absY <= 2795)) {
  482. return true;
  483. }
  484. return false;
  485. }
  486.  
  487.  
  488. public boolean rugAreas() {
  489. if ((absX >= 3175 && absX <= 3184 && absY >= 3040 && absY <= 3045)) {
  490. return true;
  491. }
  492. return false;
  493. }
  494.  
  495. public boolean inFightCaves()
  496. {
  497. return absX >= 2360 && absX <= 2445 && absY >= 5045 && absY <= 5125;
  498. }
  499.  
  500. public boolean inPirateHouse() {
  501. return absX >= 3038 && absX <= 3044 && absY >= 3949 && absY <= 3959;
  502. }
  503.  
  504. public boolean inEdge() {
  505. if ((absX >= 3070 && absX <= 3129 && absY >= 3477 && absY <= 3519) ||
  506. (absX >= 2530 && absX <= 2550 && absY >= 4705 && absY <= 4725)) {
  507. return true;
  508. }
  509. return false;
  510. }
  511.  
  512. public boolean inAxeHut() {
  513. return absX >= 3187 && absX <= 3194 && absY >= 3958 && absY <= 3962;
  514. }
  515.  
  516. public String connectedFrom="";
  517. public String globalMessage="";
  518. public abstract void initialize();
  519. public abstract void update();
  520. public int playerId = -1;
  521. public String playerName = null;
  522. public String playerName2 = null;
  523. public String playerPass = null;
  524. public int playerRights;
  525. public PlayerHandler handler = null;
  526. public int playerItems[] = new int[28];
  527. public int playerItemsN[] = new int[28];
  528. public int bankItems[] = new int[Config.BANK_SIZE];
  529. public int bankItemsN[] = new int[Config.BANK_SIZE];
  530. public boolean bankNotes = false;
  531.  
  532. public int playerStandIndex = 0x328;
  533. public int playerTurnIndex = 0x337;
  534. public int playerWalkIndex = 0x333;
  535. public int playerTurn180Index = 0x334;
  536. public int playerTurn90CWIndex = 0x335;
  537. public int playerTurn90CCWIndex = 0x336;
  538. public int playerRunIndex = 0x338;
  539.  
  540. public int playerHat=0;
  541. public int playerCape=1;
  542. public int playerAmulet=2;
  543. public int playerWeapon=3;
  544. public int playerChest=4;
  545. public int playerShield=5;
  546. public int playerLegs=7;
  547. public int playerHands=9;
  548. public int playerFeet=10;
  549. public int playerRing=12;
  550. public int playerArrows=13;
  551.  
  552. public int playerAttack = 0;
  553. public int playerDefence = 1;
  554. public int playerStrength = 2;
  555. public int playerHitpoints = 3;
  556. public int playerRanged = 4;
  557. public int playerPrayer = 5;
  558. public int playerMagic = 6;
  559. public int playerCooking = 7;
  560. public int playerWoodcutting = 8;
  561. public int playerFletching = 9;
  562. public int playerFishing = 10;
  563. public int playerFiremaking = 11;
  564. public int playerCrafting = 12;
  565. public int playerSmithing = 13;
  566. public int playerMining = 14;
  567. public int playerHerblore = 15;
  568. public int playerAgility = 16;
  569. public int playerThieving = 17;
  570. public int playerSlayer = 18;
  571. public int playerFarming = 19;
  572. public int playerRunecrafting = 20;
  573.  
  574. public int[] playerEquipment = new int[14];
  575. public int[] playerEquipmentN = new int[14];
  576. public int[] playerLevel = new int[25];
  577. public int[] playerXP = new int[25];
  578.  
  579. public void updateshop(int i){
  580. Client p = (Client) Server.playerHandler.players[playerId];
  581. p.getShops().resetShop(i);
  582. }
  583.  
  584. public void println_debug(String str) {
  585. System.out.println("[player-"+playerId+"]: "+str);
  586. }
  587. public void println(String str) {
  588. System.out.println("[player-"+playerId+"]: "+str);
  589. }
  590. public Player(int _playerId) {
  591. playerId = _playerId;
  592. playerRights = 0;
  593.  
  594. for (int i=0; i<playerItems.length; i++) {
  595. playerItems[i] = 0;
  596. }
  597. for (int i=0; i<playerItemsN.length; i++) {
  598. playerItemsN[i] = 0;
  599. }
  600.  
  601. for (int i=0; i<playerLevel.length; i++) {
  602. if (i == 3) {
  603. playerLevel[i] = 10;
  604. } else {
  605. playerLevel[i] = 1;
  606. }
  607. }
  608.  
  609. for (int i=0; i<playerXP.length; i++) {
  610. if (i == 3) {
  611. playerXP[i] = 1300;
  612. } else {
  613. playerXP[i] = 0;
  614. }
  615. }
  616. for (int i=0; i < Config.BANK_SIZE; i++) {
  617. bankItems[i] = 0;
  618. }
  619.  
  620. for (int i=0; i < Config.BANK_SIZE; i++) {
  621. bankItemsN[i] = 0;
  622. }
  623.  
  624. playerAppearance[0] = 0; // gender
  625. playerAppearance[1] = 7; // head
  626. playerAppearance[2] = 25;// Torso
  627. playerAppearance[3] = 29; // arms
  628. playerAppearance[4] = 35; // hands
  629. playerAppearance[5] = 39; // legs
  630. playerAppearance[6] = 44; // feet
  631. playerAppearance[7] = 14; // beard
  632. playerAppearance[8] = 7; // hair colour
  633. playerAppearance[9] = 8; // torso colour
  634. playerAppearance[10] = 9; // legs colour
  635. playerAppearance[11] = 5; // feet colour
  636. playerAppearance[12] = 0; // skin colour
  637.  
  638. apset = 0;
  639. actionID = 0;
  640.  
  641. playerEquipment[playerHat]=-1;
  642. playerEquipment[playerCape]=-1;
  643. playerEquipment[playerAmulet]=-1;
  644. playerEquipment[playerChest]=-1;
  645. playerEquipment[playerShield]=-1;
  646. playerEquipment[playerLegs]=-1;
  647. playerEquipment[playerHands]=-1;
  648. playerEquipment[playerFeet]=-1;
  649. playerEquipment[playerRing]=-1;
  650. playerEquipment[playerArrows]=-1;
  651. playerEquipment[playerWeapon]=-1;
  652.  
  653. heightLevel = 0;
  654.  
  655. teleportToX = Config.START_LOCATION_X;
  656. teleportToY = Config.START_LOCATION_Y;
  657.  
  658.  
  659. absX = absY = -1;
  660. mapRegionX = mapRegionY = -1;
  661. currentX = currentY = 0;
  662. resetWalkingQueue();
  663. }
  664.  
  665. void destruct() {
  666. playerListSize = 0;
  667. for(int i = 0; i < maxPlayerListSize; i++)
  668. playerList[i] = null;
  669. absX = absY = -1;
  670. mapRegionX = mapRegionY = -1;
  671. currentX = currentY = 0;
  672. resetWalkingQueue();
  673. }
  674.  
  675.  
  676. public static final int maxPlayerListSize = Config.MAX_PLAYERS;
  677. public Player playerList[] = new Player[maxPlayerListSize];
  678. public int playerListSize = 0;
  679.  
  680.  
  681. public byte playerInListBitmap[] = new byte[(Config.MAX_PLAYERS+7) >> 3];
  682.  
  683.  
  684. public static final int maxNPCListSize = NPCHandler.maxNPCs;
  685. public NPC npcList[] = new NPC[maxNPCListSize];
  686. public int npcListSize = 0;
  687.  
  688. public byte npcInListBitmap[] = new byte[(NPCHandler.maxNPCs+7) >> 3];
  689.  
  690.  
  691.  
  692. public boolean withinDistance(Player otherPlr) {
  693. if(heightLevel != otherPlr.heightLevel) return false;
  694. int deltaX = otherPlr.absX-absX, deltaY = otherPlr.absY-absY;
  695. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  696. }
  697.  
  698. public boolean withinDistance(NPC npc) {
  699. if (heightLevel != npc.heightLevel) return false;
  700. if (npc.needRespawn == true) return false;
  701. int deltaX = npc.absX-absX, deltaY = npc.absY-absY;
  702. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  703. }
  704.  
  705. public int distanceToPoint(int pointX,int pointY) {
  706. return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  707. }
  708.  
  709. public int mapRegionX, mapRegionY;
  710. public int absX, absY;
  711. public int currentX, currentY;
  712.  
  713. public int heightLevel;
  714. public int playerSE = 0x328;
  715. public int playerSEW = 0x333;
  716. public int playerSER = 0x334;
  717.  
  718. public boolean updateRequired = true;
  719.  
  720.  
  721. public final int walkingQueueSize = 50;
  722. public int walkingQueueX[] = new int[walkingQueueSize], walkingQueueY[] = new int[walkingQueueSize];
  723. public int wQueueReadPtr = 0;
  724. public int wQueueWritePtr = 0;
  725. public boolean isRunning = true;
  726. public int teleportToX = -1, teleportToY = -1;
  727.  
  728. public void resetWalkingQueue() {
  729. wQueueReadPtr = wQueueWritePtr = 0;
  730.  
  731. for(int i = 0; i < walkingQueueSize; i++) {
  732. walkingQueueX[i] = currentX;
  733. walkingQueueY[i] = currentY;
  734. }
  735. }
  736.  
  737. public void addToWalkingQueue(int x, int y) {
  738. //if (VirtualWorld.I(heightLevel, absX, absY, x, y, 0)) {
  739. int next = (wQueueWritePtr+1) % walkingQueueSize;
  740. if(next == wQueueWritePtr) return;
  741. walkingQueueX[wQueueWritePtr] = x;
  742. walkingQueueY[wQueueWritePtr] = y;
  743. wQueueWritePtr = next;
  744. //}
  745. }
  746.  
  747. public boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
  748. for (int i = 0; i <= distance; i++) {
  749. for (int j = 0; j <= distance; j++) {
  750. if ((objectX + i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  751. return true;
  752. } else if ((objectX - i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  753. return true;
  754. } else if (objectX == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  755. return true;
  756. }
  757. }
  758. }
  759. return false;
  760. }
  761.  
  762. public int getNextWalkingDirection() {
  763. if(wQueueReadPtr == wQueueWritePtr)
  764. return -1;
  765. int dir;
  766. do {
  767. dir = Misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
  768. if(dir == -1) {
  769. wQueueReadPtr = (wQueueReadPtr+1) % walkingQueueSize;
  770. } else if((dir&1) != 0) {
  771. println_debug("Invalid waypoint in walking queue!");
  772. resetWalkingQueue();
  773. return -1;
  774. }
  775. } while((dir == -1) && (wQueueReadPtr != wQueueWritePtr));
  776. if(dir == -1) return -1;
  777. dir >>= 1;
  778. currentX += Misc.directionDeltaX[dir];
  779. currentY += Misc.directionDeltaY[dir];
  780. absX += Misc.directionDeltaX[dir];
  781. absY += Misc.directionDeltaY[dir];
  782. return dir;
  783. }
  784.  
  785.  
  786. public boolean didTeleport = false;
  787. public boolean mapRegionDidChange = false;
  788. public int dir1 = -1, dir2 = -1;
  789. public boolean createItems = false;
  790. public int poimiX = 0, poimiY = 0;
  791.  
  792. public synchronized void getNextPlayerMovement() {
  793. mapRegionDidChange = false;
  794. didTeleport = false;
  795. dir1 = dir2 = -1;
  796.  
  797. if(teleportToX != -1 && teleportToY != -1) {
  798. mapRegionDidChange = true;
  799. if(mapRegionX != -1 && mapRegionY != -1) {
  800. int relX = teleportToX-mapRegionX*8, relY = teleportToY-mapRegionY*8;
  801. if(relX >= 2*8 && relX < 11*8 && relY >= 2*8 && relY < 11*8)
  802. mapRegionDidChange = false;
  803. }
  804. if(mapRegionDidChange) {
  805. mapRegionX = (teleportToX>>3)-6;
  806. mapRegionY = (teleportToY>>3)-6;
  807. }
  808. currentX = teleportToX - 8*mapRegionX;
  809. currentY = teleportToY - 8*mapRegionY;
  810. absX = teleportToX;
  811. absY = teleportToY;
  812. resetWalkingQueue();
  813.  
  814. teleportToX = teleportToY = -1;
  815. didTeleport = true;
  816. } else {
  817. dir1 = getNextWalkingDirection();
  818. if(dir1 == -1)
  819. return;
  820. if(isRunning) {
  821. dir2 = getNextWalkingDirection();
  822. }
  823. Client c = (Client)this;
  824. //c.sendMessage("Cycle Ended");
  825. int deltaX = 0, deltaY = 0;
  826. if(currentX < 2*8) {
  827. deltaX = 4*8;
  828. mapRegionX -= 4;
  829. mapRegionDidChange = true;
  830. } else if(currentX >= 11*8) {
  831. deltaX = -4*8;
  832. mapRegionX += 4;
  833. mapRegionDidChange = true;
  834. }
  835. if(currentY < 2*8) {
  836. deltaY = 4*8;
  837. mapRegionY -= 4;
  838. mapRegionDidChange = true;
  839. } else if(currentY >= 11*8) {
  840. deltaY = -4*8;
  841. mapRegionY += 4;
  842. mapRegionDidChange = true;
  843. }
  844.  
  845. if(mapRegionDidChange/* && VirtualWorld.I(heightLevel, currentX, currentY, currentX + deltaX, currentY + deltaY, 0)*/) {
  846. currentX += deltaX;
  847. currentY += deltaY;
  848. for(int i = 0; i < walkingQueueSize; i++) {
  849. walkingQueueX[i] += deltaX;
  850. walkingQueueY[i] += deltaY;
  851. }
  852. }
  853. //CoordAssistant.processCoords(this);
  854.  
  855. }
  856. }
  857.  
  858.  
  859. public void updateThisPlayerMovement(Stream str) {
  860. synchronized(this) {
  861. if(mapRegionDidChange) {
  862. str.createFrame(73);
  863. str.writeWordA(mapRegionX+6);
  864. str.writeWord(mapRegionY+6);
  865. }
  866.  
  867. if(didTeleport) {
  868. str.createFrameVarSizeWord(81);
  869. str.initBitAccess();
  870. str.writeBits(1, 1);
  871. str.writeBits(2, 3);
  872. str.writeBits(2, heightLevel);
  873. str.writeBits(1, 1);
  874. str.writeBits(1, (updateRequired) ? 1 : 0);
  875. str.writeBits(7, currentY);
  876. str.writeBits(7, currentX);
  877. return ;
  878. }
  879.  
  880.  
  881. if(dir1 == -1) {
  882. // don't have to update the character position, because we're just standing
  883. str.createFrameVarSizeWord(81);
  884. str.initBitAccess();
  885. isMoving = false;
  886. if(updateRequired) {
  887. // tell client there's an update block appended at the end
  888. str.writeBits(1, 1);
  889. str.writeBits(2, 0);
  890. } else {
  891. str.writeBits(1, 0);
  892. }
  893. if (DirectionCount < 50) {
  894. DirectionCount++;
  895. }
  896. } else {
  897. DirectionCount = 0;
  898. str.createFrameVarSizeWord(81);
  899. str.initBitAccess();
  900. str.writeBits(1, 1);
  901.  
  902. if(dir2 == -1) {
  903. isMoving = true;
  904. str.writeBits(2, 1);
  905. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  906. if(updateRequired) str.writeBits(1, 1);
  907. else str.writeBits(1, 0);
  908. }
  909. else {
  910. isMoving = true;
  911. str.writeBits(2, 2);
  912. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  913. str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  914. if(updateRequired) str.writeBits(1, 1);
  915. else str.writeBits(1, 0);
  916. }
  917. }
  918. }
  919. }
  920.  
  921.  
  922. public void updatePlayerMovement(Stream str) {
  923. synchronized(this) {
  924. if(dir1 == -1) {
  925. if(updateRequired || isChatTextUpdateRequired()) {
  926.  
  927. str.writeBits(1, 1);
  928. str.writeBits(2, 0);
  929. }
  930. else str.writeBits(1, 0);
  931. }
  932. else if(dir2 == -1) {
  933.  
  934. str.writeBits(1, 1);
  935. str.writeBits(2, 1);
  936. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  937. str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1: 0);
  938. }
  939. else {
  940.  
  941. str.writeBits(1, 1);
  942. str.writeBits(2, 2);
  943. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  944. str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  945. str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1: 0);
  946. }
  947. }
  948. }
  949.  
  950.  
  951. public byte cachedPropertiesBitmap[] = new byte[(Config.MAX_PLAYERS+7) >> 3];
  952.  
  953. public void addNewNPC(NPC npc, Stream str, Stream updateBlock) {
  954. synchronized(this) {
  955. int id = npc.npcId;
  956. npcInListBitmap[id >> 3] |= 1 << (id&7);
  957. npcList[npcListSize++] = npc;
  958.  
  959. str.writeBits(14, id);
  960.  
  961. int z = npc.absY-absY;
  962. if(z < 0) z += 32;
  963. str.writeBits(5, z);
  964. z = npc.absX-absX;
  965. if(z < 0) z += 32;
  966. str.writeBits(5, z);
  967.  
  968. str.writeBits(1, 0);
  969. str.writeBits(14, npc.npcType);
  970.  
  971. boolean savedUpdateRequired = npc.updateRequired;
  972. npc.updateRequired = true;
  973. npc.appendNPCUpdateBlock(updateBlock);
  974. npc.updateRequired = savedUpdateRequired;
  975. str.writeBits(1, 1);
  976. }
  977. }
  978.  
  979. public void addNewPlayer(Player plr, Stream str, Stream updateBlock) {
  980. synchronized(this) {
  981. if(playerListSize >= 255) {
  982. return;
  983. }
  984. int id = plr.playerId;
  985. playerInListBitmap[id >> 3] |= 1 << (id&7);
  986. playerList[playerListSize++] = plr;
  987. str.writeBits(11, id);
  988. str.writeBits(1, 1);
  989. boolean savedFlag = plr.isAppearanceUpdateRequired();
  990. boolean savedUpdateRequired = plr.updateRequired;
  991. plr.setAppearanceUpdateRequired(true);
  992. plr.updateRequired = true;
  993. plr.appendPlayerUpdateBlock(updateBlock);
  994. plr.setAppearanceUpdateRequired(savedFlag);
  995. plr.updateRequired = savedUpdateRequired;
  996. str.writeBits(1, 1);
  997. int z = plr.absY-absY;
  998. if(z < 0) z += 32;
  999. str.writeBits(5, z);
  1000. z = plr.absX-absX;
  1001. if(z < 0) z += 32;
  1002. str.writeBits(5, z);
  1003. }
  1004. }
  1005.  
  1006. public int DirectionCount = 0;
  1007. public boolean appearanceUpdateRequired = true;
  1008. protected int hitDiff2;
  1009. private int hitDiff = 0;
  1010. protected boolean hitUpdateRequired2;
  1011. private boolean hitUpdateRequired = false;
  1012. public boolean isDead = false;
  1013.  
  1014. protected static Stream playerProps;
  1015. static {
  1016. playerProps = new Stream(new byte[100]);
  1017. }
  1018. protected void appendPlayerAppearance(Stream str) {
  1019. synchronized(this) {
  1020. playerProps.currentOffset = 0;
  1021.  
  1022. playerProps.writeByte(playerAppearance[0]);
  1023.  
  1024. playerProps.writeByte(headIcon);
  1025. playerProps.writeByte(headIconPk);
  1026. //playerProps.writeByte(headIconHints);
  1027. //playerProps.writeByte(bountyIcon);
  1028.  
  1029. if (playerEquipment[playerHat] > 1) {
  1030. playerProps.writeWord(0x200 + playerEquipment[playerHat]);
  1031. } else {
  1032. playerProps.writeByte(0);
  1033. }
  1034.  
  1035. if (playerEquipment[playerCape] > 1) {
  1036. playerProps.writeWord(0x200 + playerEquipment[playerCape]);
  1037. } else {
  1038. playerProps.writeByte(0);
  1039. }
  1040.  
  1041. if (playerEquipment[playerAmulet] > 1) {
  1042. playerProps.writeWord(0x200 + playerEquipment[playerAmulet]);
  1043. } else {
  1044. playerProps.writeByte(0);
  1045. }
  1046.  
  1047. if (playerEquipment[playerWeapon] > 1) {
  1048. playerProps.writeWord(0x200 + playerEquipment[playerWeapon]);
  1049. } else {
  1050. playerProps.writeByte(0);
  1051. }
  1052.  
  1053. if (playerEquipment[playerChest] > 1) {
  1054. playerProps.writeWord(0x200 + playerEquipment[playerChest]);
  1055. } else {
  1056. playerProps.writeWord(0x100+playerAppearance[2]);
  1057. }
  1058.  
  1059. if (playerEquipment[playerShield] > 1) {
  1060. playerProps.writeWord(0x200 + playerEquipment[playerShield]);
  1061. } else {
  1062. playerProps.writeByte(0);
  1063. }
  1064.  
  1065. if (!Item.isFullBody(playerEquipment[playerChest])) {
  1066. playerProps.writeWord(0x100+playerAppearance[3]);
  1067. } else {
  1068. playerProps.writeByte(0);
  1069. }
  1070.  
  1071. if (playerEquipment[playerLegs] > 1) {
  1072. playerProps.writeWord(0x200 + playerEquipment[playerLegs]);
  1073. } else {
  1074. playerProps.writeWord(0x100+playerAppearance[5]);
  1075. }
  1076.  
  1077. if (!Item.isFullHelm(playerEquipment[playerHat]) && !Item.isFullMask(playerEquipment[playerHat])) {
  1078. playerProps.writeWord(0x100 + playerAppearance[1]);
  1079. } else {
  1080. playerProps.writeByte(0);
  1081. }
  1082.  
  1083. if (playerEquipment[playerHands] > 1) {
  1084. playerProps.writeWord(0x200 + playerEquipment[playerHands]);
  1085. } else {
  1086. playerProps.writeWord(0x100+playerAppearance[4]);
  1087. }
  1088.  
  1089. if (playerEquipment[playerFeet] > 1) {
  1090. playerProps.writeWord(0x200 + playerEquipment[playerFeet]);
  1091. } else {
  1092. playerProps.writeWord(0x100+playerAppearance[6]);
  1093. }
  1094.  
  1095. if (playerAppearance[0] != 1 && !Item.isFullMask(playerEquipment[playerHat])) {
  1096. playerProps.writeWord(0x100 + playerAppearance[7]);
  1097. } else {
  1098. playerProps.writeByte(0);
  1099. }
  1100.  
  1101. playerProps.writeByte(playerAppearance[8]);
  1102. playerProps.writeByte(playerAppearance[9]);
  1103. playerProps.writeByte(playerAppearance[10]);
  1104. playerProps.writeByte(playerAppearance[11]);
  1105. playerProps.writeByte(playerAppearance[12]);
  1106. playerProps.writeWord(playerStandIndex); // standAnimIndex
  1107. playerProps.writeWord(playerTurnIndex); // standTurnAnimIndex
  1108. playerProps.writeWord(playerWalkIndex); // walkAnimIndex
  1109. playerProps.writeWord(playerTurn180Index); // turn180AnimIndex
  1110. playerProps.writeWord(playerTurn90CWIndex); // turn90CWAnimIndex
  1111. playerProps.writeWord(playerTurn90CCWIndex); // turn90CCWAnimIndex
  1112. playerProps.writeWord(playerRunIndex); // runAnimIndex
  1113.  
  1114. playerProps.writeQWord(Misc.playerNameToInt64(playerName));
  1115.  
  1116. int mag = (int) ((getLevelForXP(playerXP[6])) * 1.5);
  1117. int ran = (int) ((getLevelForXP(playerXP[4])) * 1.5);
  1118. int attstr = (int) ((double) (getLevelForXP(playerXP[0])) + (double) (getLevelForXP(playerXP[2])));
  1119.  
  1120. combatLevel = 0;
  1121. if (ran > attstr) {
  1122. combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1123. + ((getLevelForXP(playerXP[3])) * 0.25)
  1124. + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[4])) * 0.4875));
  1125. } else if (mag > attstr) {
  1126. combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1127. + ((getLevelForXP(playerXP[3])) * 0.25)
  1128. + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[6])) * 0.4875));
  1129. } else {
  1130. combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1131. + ((getLevelForXP(playerXP[3])) * 0.25)
  1132. + ((getLevelForXP(playerXP[5])) * 0.125)
  1133. + ((getLevelForXP(playerXP[0])) * 0.325) + ((getLevelForXP(playerXP[2])) * 0.325));
  1134. }
  1135. playerProps.writeByte(combatLevel); // combat level
  1136. playerProps.writeWord(0);
  1137. str.writeByteC(playerProps.currentOffset);
  1138. str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
  1139. }
  1140. }
  1141. public void getCombat2() {
  1142. int mag = (int) ((getLevelForXP(playerXP[6])) * 1.5);
  1143. int ran = (int) ((getLevelForXP(playerXP[4])) * 1.5);
  1144. int attstr = (int) ((double) (getLevelForXP(playerXP[0])) + (double) (getLevelForXP(playerXP[2])));
  1145.  
  1146. combatLevel = 0;
  1147. if (ran > attstr) {
  1148. combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1149. + ((getLevelForXP(playerXP[3])) * 0.25)
  1150. + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[4])) * 0.4875));
  1151. } else if (mag > attstr) {
  1152. combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1153. + ((getLevelForXP(playerXP[3])) * 0.25)
  1154. + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[6])) * 0.4875));
  1155. } else {
  1156. combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1157. + ((getLevelForXP(playerXP[3])) * 0.25)
  1158. + ((getLevelForXP(playerXP[5])) * 0.125)
  1159. + ((getLevelForXP(playerXP[0])) * 0.325) + ((getLevelForXP(playerXP[2])) * 0.325));
  1160. }
  1161. Client c = (Client)this;
  1162. c.getPA().sendFrame126(""+combatLevel+"", 1326);
  1163. playerProps.writeByte(combatLevel); // combat level
  1164. playerProps.writeWord(0);
  1165. playerProps.writeByteC(playerProps.currentOffset);
  1166. playerProps.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
  1167. }
  1168.  
  1169.  
  1170. public int getLevelForXP(int exp) {
  1171. int points = 0;
  1172. int output = 0;
  1173.  
  1174. for (int lvl = 1; lvl <= 99; lvl++) {
  1175. points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
  1176. output = (int)Math.floor(points / 4);
  1177. if (output >= exp)
  1178. return lvl;
  1179. }
  1180. return 99;
  1181. }
  1182.  
  1183. private boolean chatTextUpdateRequired = false;
  1184. private byte chatText[] = new byte[4096];
  1185. private byte chatTextSize = 0;
  1186. private int chatTextColor = 0;
  1187. private int chatTextEffects = 0;
  1188.  
  1189. protected void appendPlayerChatText(Stream str) {
  1190. synchronized(this) {
  1191. str.writeWordBigEndian(((getChatTextColor()&0xFF) << 8) + (getChatTextEffects()&0xFF));
  1192. str.writeByte(playerRights);
  1193. str.writeByteC(getChatTextSize());
  1194. str.writeBytes_reverse(getChatText(), getChatTextSize(), 0);
  1195. }
  1196. }
  1197.  
  1198. public void forcedChat(String text) {
  1199. forcedText = text;
  1200. forcedChatUpdateRequired = true;
  1201. updateRequired = true;
  1202. setAppearanceUpdateRequired(true);
  1203. }
  1204. public String forcedText = "null";
  1205. public void appendForcedChat(Stream str) {
  1206. synchronized(this) {
  1207. str.writeString(forcedText);
  1208. }
  1209. }
  1210.  
  1211. /**
  1212. *Graphics
  1213. **/
  1214.  
  1215. public int mask100var1 = 0;
  1216. public int mask100var2 = 0;
  1217. protected boolean mask100update = false;
  1218.  
  1219. public void appendMask100Update(Stream str) {
  1220. synchronized(this) {
  1221. str.writeWordBigEndian(mask100var1);
  1222. str.writeDWord(mask100var2);
  1223. }
  1224. }
  1225.  
  1226. public void gfx100(int gfx) {
  1227. mask100var1 = gfx;
  1228. mask100var2 = 6553600;
  1229. mask100update = true;
  1230. updateRequired = true;
  1231. }
  1232. public void gfx0(int gfx) {
  1233. mask100var1 = gfx;
  1234. mask100var2 = 65536;
  1235. mask100update = true;
  1236. updateRequired = true;
  1237. }
  1238.  
  1239. public boolean wearing2h() {
  1240. Client c = (Client)this;
  1241. String s = c.getItems().getItemName(c.playerEquipment[c.playerWeapon]);
  1242. if (s.contains("2h"))
  1243. return true;
  1244. else if (s.contains("godsword"))
  1245. return true;
  1246. return false;
  1247. }
  1248.  
  1249. /**
  1250. *Animations
  1251. **/
  1252. public void startAnimation(int animId) {
  1253. if (wearing2h() && animId == 829)
  1254. return;
  1255. animationRequest = animId;
  1256. animationWaitCycles = 0;
  1257. updateRequired = true;
  1258. }
  1259.  
  1260. public void startAnimation(int animId, int time) {
  1261. animationRequest = animId;
  1262. animationWaitCycles = time;
  1263. updateRequired = true;
  1264. }
  1265.  
  1266. public void appendAnimationRequest(Stream str) {
  1267. synchronized(this) {
  1268. str.writeWordBigEndian((animationRequest==-1) ? 65535 : animationRequest);
  1269. str.writeByteC(animationWaitCycles);
  1270. }
  1271. }
  1272.  
  1273. /**
  1274. *Face Update
  1275. **/
  1276.  
  1277. protected boolean faceUpdateRequired = false;
  1278. public int face = -1;
  1279. public int FocusPointX = -1, FocusPointY = -1;
  1280.  
  1281. public void faceUpdate(int index) {
  1282. face = index;
  1283. faceUpdateRequired = true;
  1284. updateRequired = true;
  1285. }
  1286.  
  1287. public void appendFaceUpdate(Stream str) {
  1288. synchronized(this) {
  1289. str.writeWordBigEndian(face);
  1290. }
  1291. }
  1292.  
  1293. public void turnPlayerTo(int pointX, int pointY){
  1294. FocusPointX = 2*pointX+1;
  1295. FocusPointY = 2*pointY+1;
  1296. updateRequired = true;
  1297. }
  1298.  
  1299. private void appendSetFocusDestination(Stream str) {
  1300. synchronized(this) {
  1301. str.writeWordBigEndianA(FocusPointX);
  1302. str.writeWordBigEndian(FocusPointY);
  1303. }
  1304. }
  1305.  
  1306. /**
  1307. *Hit Update
  1308. **/
  1309.  
  1310. protected void appendHitUpdate(Stream str) {
  1311. synchronized(this) {
  1312. str.writeByte(getHitDiff()); // What the perseon got 'hit' for
  1313. if (poisonMask == 1) {
  1314. str.writeByteA(2);
  1315. } else if (getHitDiff() > 0) {
  1316. str.writeByteA(1); // 0: red hitting - 1: blue hitting
  1317. } else {
  1318. str.writeByteA(0); // 0: red hitting - 1: blue hitting
  1319. }
  1320. if (playerLevel[3] <= 0) {
  1321. playerLevel[3] = 0;
  1322. isDead = true;
  1323. }
  1324. str.writeByteC(playerLevel[3]); // Their current hp, for HP bar
  1325. str.writeByte(getLevelForXP(playerXP[3])); // Their max hp, for HP bar
  1326. }
  1327. }
  1328.  
  1329.  
  1330. protected void appendHitUpdate2(Stream str) {
  1331. synchronized(this) {
  1332. str.writeByte(hitDiff2); // What the perseon got 'hit' for
  1333. if (poisonMask == 2) {
  1334. str.writeByteS(2);
  1335. poisonMask = -1;
  1336. } else if (hitDiff2 > 0) {
  1337. str.writeByteS(1); // 0: red hitting - 1: blue hitting
  1338. } else {
  1339. str.writeByteS(0); // 0: red hitting - 1: blue hitting
  1340. }
  1341. if (playerLevel[3] <= 0) {
  1342. playerLevel[3] = 0;
  1343. isDead = true;
  1344. }
  1345. str.writeByte(playerLevel[3]); // Their current hp, for HP bar
  1346. str.writeByteC(getLevelForXP(playerXP[3])); // Their max hp, for HP bar
  1347. }
  1348. }
  1349.  
  1350.  
  1351. public void appendPlayerUpdateBlock(Stream str){
  1352. synchronized(this) {
  1353. if(!updateRequired && !isChatTextUpdateRequired()) return; // nothing required
  1354. int updateMask = 0;
  1355. if(mask100update) {
  1356. updateMask |= 0x100;
  1357. }
  1358. if(animationRequest != -1) {
  1359. updateMask |= 8;
  1360. }
  1361. if(forcedChatUpdateRequired) {
  1362. updateMask |= 4;
  1363. }
  1364. if(isChatTextUpdateRequired()) {
  1365. updateMask |= 0x80;
  1366. }
  1367. if(isAppearanceUpdateRequired()) {
  1368. updateMask |= 0x10;
  1369. }
  1370. if(faceUpdateRequired) {
  1371. updateMask |= 1;
  1372. }
  1373. if(FocusPointX != -1) {
  1374. updateMask |= 2;
  1375. }
  1376. if (isHitUpdateRequired()) {
  1377. updateMask |= 0x20;
  1378. }
  1379.  
  1380. if(hitUpdateRequired2) {
  1381. updateMask |= 0x200;
  1382. }
  1383.  
  1384. if(updateMask >= 0x100) {
  1385. updateMask |= 0x40;
  1386. str.writeByte(updateMask & 0xFF);
  1387. str.writeByte(updateMask >> 8);
  1388. } else {
  1389. str.writeByte(updateMask);
  1390. }
  1391.  
  1392. // now writing the various update blocks itself - note that their order crucial
  1393. if(mask100update) {
  1394. appendMask100Update(str);
  1395. }
  1396. if(animationRequest != -1) {
  1397. appendAnimationRequest(str);
  1398. }
  1399. if(forcedChatUpdateRequired) {
  1400. appendForcedChat(str);
  1401. }
  1402. if(isChatTextUpdateRequired()) {
  1403. appendPlayerChatText(str);
  1404. }
  1405. if(faceUpdateRequired) {
  1406. appendFaceUpdate(str);
  1407. }
  1408. if(isAppearanceUpdateRequired()) {
  1409. appendPlayerAppearance(str);
  1410. }
  1411. if(FocusPointX != -1) {
  1412. appendSetFocusDestination(str);
  1413. }
  1414. if(isHitUpdateRequired()) {
  1415. appendHitUpdate(str);
  1416. }
  1417. if(hitUpdateRequired2) {
  1418. appendHitUpdate2(str);
  1419. }
  1420. }
  1421. }
  1422.  
  1423. public void clearUpdateFlags(){
  1424. updateRequired = false;
  1425. setChatTextUpdateRequired(false);
  1426. setAppearanceUpdateRequired(false);
  1427. setHitUpdateRequired(false);
  1428. hitUpdateRequired2 = false;
  1429. forcedChatUpdateRequired = false;
  1430. mask100update = false;
  1431. animationRequest = -1;
  1432. FocusPointX = -1;
  1433. FocusPointY = -1;
  1434. poisonMask = -1;
  1435. faceUpdateRequired = false;
  1436. face = 65535;
  1437. }
  1438.  
  1439. public void stopMovement() {
  1440. if(teleportToX <= 0 && teleportToY <= 0) {
  1441. teleportToX = absX;
  1442. teleportToY = absY;
  1443. }
  1444. newWalkCmdSteps = 0;
  1445. getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
  1446. getNextPlayerMovement();
  1447. }
  1448.  
  1449.  
  1450. private int newWalkCmdX[] = new int[walkingQueueSize];
  1451. private int newWalkCmdY[] = new int[walkingQueueSize];
  1452. public int newWalkCmdSteps = 0;
  1453. private boolean newWalkCmdIsRunning = false;
  1454. protected int travelBackX[] = new int[walkingQueueSize];
  1455. protected int travelBackY[] = new int[walkingQueueSize];
  1456. protected int numTravelBackSteps = 0;
  1457.  
  1458. public void preProcessing() {
  1459. newWalkCmdSteps = 0;
  1460. }
  1461.  
  1462. public abstract void process();
  1463. public abstract boolean processQueuedPackets();
  1464.  
  1465. public synchronized void postProcessing() {
  1466. if(newWalkCmdSteps > 0) {
  1467. int firstX = getNewWalkCmdX()[0], firstY = getNewWalkCmdY()[0];
  1468.  
  1469. int lastDir = 0;
  1470. boolean found = false;
  1471. numTravelBackSteps = 0;
  1472. int ptr = wQueueReadPtr;
  1473. int dir = Misc.direction(currentX, currentY, firstX, firstY);
  1474. if(dir != -1 && (dir&1) != 0) {
  1475. do {
  1476. lastDir = dir;
  1477. if(--ptr < 0)
  1478. ptr = walkingQueueSize-1;
  1479.  
  1480. travelBackX[numTravelBackSteps] = walkingQueueX[ptr];
  1481. travelBackY[numTravelBackSteps++] = walkingQueueY[ptr];
  1482. dir = Misc.direction(walkingQueueX[ptr], walkingQueueY[ptr], firstX, firstY);
  1483. if(lastDir != dir) {
  1484. found = true;
  1485. break;
  1486. }
  1487.  
  1488. } while(ptr != wQueueWritePtr);
  1489. }
  1490. else found = true;
  1491.  
  1492. if(!found) println_debug("Fatal: couldn't find connection vertex! Dropping packet.");
  1493. else {
  1494. wQueueWritePtr = wQueueReadPtr;
  1495.  
  1496. addToWalkingQueue(currentX, currentY);
  1497.  
  1498. if(dir != -1 && (dir&1) != 0) {
  1499.  
  1500.  
  1501. for(int i = 0; i < numTravelBackSteps-1; i++) {
  1502. addToWalkingQueue(travelBackX[i], travelBackY[i]);
  1503. }
  1504. int wayPointX2 = travelBackX[numTravelBackSteps-1], wayPointY2 = travelBackY[numTravelBackSteps-1];
  1505. int wayPointX1, wayPointY1;
  1506. if(numTravelBackSteps == 1) {
  1507. wayPointX1 = currentX;
  1508. wayPointY1 = currentY;
  1509. }
  1510. else {
  1511. wayPointX1 = travelBackX[numTravelBackSteps-2];
  1512. wayPointY1 = travelBackY[numTravelBackSteps-2];
  1513. }
  1514.  
  1515. dir = Misc.direction(wayPointX1, wayPointY1, wayPointX2, wayPointY2);
  1516. if(dir == -1 || (dir&1) != 0) {
  1517. println_debug("Fatal: The walking queue is corrupt! wp1=("+wayPointX1+", "+wayPointY1+"), "+
  1518. "wp2=("+wayPointX2+", "+wayPointY2+")");
  1519. }
  1520. else {
  1521. dir >>= 1;
  1522. found = false;
  1523. int x = wayPointX1, y = wayPointY1;
  1524. while(x != wayPointX2 || y != wayPointY2) {
  1525. x += Misc.directionDeltaX[dir];
  1526. y += Misc.directionDeltaY[dir];
  1527. if((Misc.direction(x, y, firstX, firstY)&1) == 0) {
  1528. found = true;
  1529. break;
  1530. }
  1531. }
  1532. if(!found) {
  1533. println_debug("Fatal: Internal error: unable to determine connection vertex!"+
  1534. " wp1=("+wayPointX1+", "+wayPointY1+"), wp2=("+wayPointX2+", "+wayPointY2+"), "+
  1535. "first=("+firstX+", "+firstY+")");
  1536. }
  1537. else addToWalkingQueue(wayPointX1, wayPointY1);
  1538. }
  1539. }
  1540. else {
  1541. for(int i = 0; i < numTravelBackSteps; i++) {
  1542. addToWalkingQueue(travelBackX[i], travelBackY[i]);
  1543. }
  1544. }
  1545.  
  1546.  
  1547. for(int i = 0; i < newWalkCmdSteps; i++) {
  1548. addToWalkingQueue(getNewWalkCmdX()[i], getNewWalkCmdY()[i]);
  1549. }
  1550.  
  1551. }
  1552.  
  1553. isRunning = isNewWalkCmdIsRunning() || isRunning2;
  1554. }
  1555. }
  1556.  
  1557. public int getMapRegionX() {
  1558. return mapRegionX;
  1559. }
  1560. public int getMapRegionY() {
  1561. return mapRegionY;
  1562. }
  1563.  
  1564. public int getX() {
  1565. return absX;
  1566. }
  1567.  
  1568. public int getY() {
  1569. return absY;
  1570. }
  1571.  
  1572. public int getId() {
  1573. return playerId;
  1574. }
  1575.  
  1576. public boolean inPcBoat() {
  1577. return absX >= 2660 && absX <= 2663 && absY >= 2638 && absY <= 2643;
  1578. }
  1579.  
  1580. public boolean inPcGame() {
  1581. return absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619;
  1582. }
  1583.  
  1584.  
  1585. public void setHitDiff(int hitDiff) {
  1586. this.hitDiff = hitDiff;
  1587. }
  1588.  
  1589. public void setHitDiff2(int hitDiff2) {
  1590. this.hitDiff2 = hitDiff2;
  1591. }
  1592.  
  1593.  
  1594. public int getHitDiff() {
  1595. return hitDiff;
  1596. }
  1597.  
  1598.  
  1599. public void setHitUpdateRequired(boolean hitUpdateRequired) {
  1600. this.hitUpdateRequired = hitUpdateRequired;
  1601. }
  1602.  
  1603. public void setHitUpdateRequired2(boolean hitUpdateRequired2) {
  1604. this.hitUpdateRequired2 = hitUpdateRequired2;
  1605. }
  1606.  
  1607.  
  1608. public boolean isHitUpdateRequired() {
  1609. return hitUpdateRequired;
  1610. }
  1611.  
  1612. public boolean getHitUpdateRequired() {
  1613. return hitUpdateRequired;
  1614. }
  1615.  
  1616. public boolean getHitUpdateRequired2() {
  1617. return hitUpdateRequired2;
  1618. }
  1619.  
  1620.  
  1621. public void setAppearanceUpdateRequired(boolean appearanceUpdateRequired) {
  1622. this.appearanceUpdateRequired = appearanceUpdateRequired;
  1623. }
  1624.  
  1625.  
  1626. public boolean isAppearanceUpdateRequired() {
  1627. return appearanceUpdateRequired;
  1628. }
  1629.  
  1630.  
  1631. public void setChatTextEffects(int chatTextEffects) {
  1632. this.chatTextEffects = chatTextEffects;
  1633. }
  1634.  
  1635.  
  1636. public int getChatTextEffects() {
  1637. return chatTextEffects;
  1638. }
  1639.  
  1640.  
  1641. public void setChatTextSize(byte chatTextSize) {
  1642. this.chatTextSize = chatTextSize;
  1643. }
  1644.  
  1645.  
  1646. public byte getChatTextSize() {
  1647. return chatTextSize;
  1648. }
  1649.  
  1650.  
  1651. public void setChatTextUpdateRequired(boolean chatTextUpdateRequired) {
  1652. this.chatTextUpdateRequired = chatTextUpdateRequired;
  1653. }
  1654.  
  1655.  
  1656. public boolean isChatTextUpdateRequired() {
  1657. return chatTextUpdateRequired;
  1658. }
  1659.  
  1660.  
  1661. public void setChatText(byte chatText[]) {
  1662. this.chatText = chatText;
  1663. }
  1664.  
  1665.  
  1666. public byte[] getChatText() {
  1667. return chatText;
  1668. }
  1669.  
  1670.  
  1671. public void setChatTextColor(int chatTextColor) {
  1672. this.chatTextColor = chatTextColor;
  1673. }
  1674.  
  1675.  
  1676. public int getChatTextColor() {
  1677. return chatTextColor;
  1678. }
  1679.  
  1680. public int kills = 0;
  1681. public int deaths = 0;
  1682. public void setNewWalkCmdX(int newWalkCmdX[]) {
  1683. this.newWalkCmdX = newWalkCmdX;
  1684. }
  1685.  
  1686.  
  1687. public int[] getNewWalkCmdX() {
  1688. return newWalkCmdX;
  1689. }
  1690.  
  1691.  
  1692. public void setNewWalkCmdY(int newWalkCmdY[]) {
  1693. this.newWalkCmdY = newWalkCmdY;
  1694. }
  1695.  
  1696.  
  1697. public int[] getNewWalkCmdY() {
  1698. return newWalkCmdY;
  1699. }
  1700.  
  1701.  
  1702. public void setNewWalkCmdIsRunning(boolean newWalkCmdIsRunning) {
  1703. this.newWalkCmdIsRunning = newWalkCmdIsRunning;
  1704. }
  1705.  
  1706.  
  1707. public boolean isNewWalkCmdIsRunning() {
  1708. return newWalkCmdIsRunning;
  1709. }
  1710.  
  1711. private ISAACRandomGen inStreamDecryption = null, outStreamDecryption = null;
  1712.  
  1713. public void setInStreamDecryption(ISAACRandomGen inStreamDecryption) {
  1714. this.inStreamDecryption = inStreamDecryption;
  1715. }
  1716.  
  1717. public void setOutStreamDecryption(ISAACRandomGen outStreamDecryption) {
  1718. this.outStreamDecryption = outStreamDecryption;
  1719. }
  1720.  
  1721. public boolean samePlayer() {
  1722. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  1723. if (j == playerId)
  1724. continue;
  1725. if (Server.playerHandler.players[j] != null) {
  1726. if (Server.playerHandler.players[j].playerName.equalsIgnoreCase(playerName)) {
  1727. disconnected = true;
  1728. return true;
  1729. }
  1730. }
  1731. }
  1732. return false;
  1733. }
  1734.  
  1735. public void putInCombat(int attacker) {
  1736. underAttackBy = attacker;
  1737. logoutDelay = System.currentTimeMillis();
  1738. singleCombatDelay = System.currentTimeMillis();
  1739. }
  1740.  
  1741. public void dealDamage(int damage) {
  1742. if (teleTimer <= 0)
  1743. playerLevel[3] -= damage;
  1744. else {
  1745. if (hitUpdateRequired)
  1746. hitUpdateRequired = false;
  1747. if (hitUpdateRequired2)
  1748. hitUpdateRequired2 = false;
  1749. }
  1750.  
  1751. }
  1752.  
  1753. public int[] damageTaken = new int[Config.MAX_PLAYERS];
  1754.  
  1755. public void handleHitMask(int damage) {
  1756. if (!hitUpdateRequired) {
  1757. hitUpdateRequired = true;
  1758. hitDiff = damage;
  1759. } else if (!hitUpdateRequired2) {
  1760. hitUpdateRequired2 = true;
  1761. hitDiff2 = damage;
  1762. }
  1763. updateRequired = true;
  1764. }
  1765.  
  1766. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement