Advertisement
Guest User

player

a guest
Dec 6th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package server.model.players;
  2. import java.util.ArrayList;
  3. import java.util.Collection;
  4. import java.util.Collections;
  5. import java.util.LinkedList;
  6. import java.util.List;
  7. import server.Config;
  8. import server.Server;
  9. import server.model.items.Item;
  10. import server.model.npcs.NPC;
  11. import server.model.npcs.NPCHandler;
  12. import server.util.ISAACRandomGen;
  13. import server.util.Misc;
  14. import server.util.Stream;
  15. import server.world.map.*;
  16. //import server.model.players.Hit.CombatType;
  17.  
  18. public abstract class Player {
  19.     public ArrayList<String> lastKilledPlayers = new ArrayList<String>();
  20.  
  21.     public int calculateMaxLifePoints() {
  22.         int lifePoints = getLevelForXP(playerXP[3]);//The normal hp
  23.         int torvaLegs = 20143;//Torva Legs id
  24.         int torvaBody = 20139;//Torva Body id
  25.         int torvaHelm = 20135;//Torva Helm id
  26.         if (playerEquipment[playerLegs] == torvaLegs)
  27.             lifePoints += 13;
  28.         if (playerEquipment[playerChest] == torvaBody)
  29.             lifePoints += 20;
  30.         if (playerEquipment[playerHat] == torvaHelm)
  31.             lifePoints += 7;
  32.         return lifePoints;
  33.     }
  34.  
  35. public int playerTradeWealth;
  36.     //public long ignores[] = new long[200];
  37.     public int barrageorb = 0;
  38.     public int playerTitle;
  39.     public int MoneyCash = 0;
  40.     public long muteEnd;
  41.     public long banStart;
  42. public long banEnd;
  43.     public int loyaltyRank;
  44.         public int snowOn = 0;
  45.     public long lastEmote;
  46.     public long lastHelp;
  47.     public boolean DCDamg = false;
  48.     public int DCdown = 0,  trade11;
  49.         //public Hit hitDiff2;
  50.     //public Hit hitDiff;
  51.    
  52.     //public int SpeDelay = 0;
  53.     public int SpeDelay = 0;
  54.    
  55.     public int barrageOrb = 0, dungRest;
  56.    
  57.     public boolean agilityEmote = false;
  58.     public int gnomeObsticle = 0;
  59.    
  60.     public int FishID;
  61.     public int Arma, Zammy, Sara;
  62.     public int Dfscharges;
  63.     public int dfsCount;
  64.     public int dungPoints;
  65.     public boolean hasOverloadBoost;
  66.     public boolean playerFletch;
  67.     public int SPoints;
  68.     public int Band;
  69.     public int overloadCount = 0;
  70.     public boolean SSPLIT = false;
  71.     public int soulSplitDelay;
  72.     public int leechSpecialDelay;
  73.         public int leechEnergyDelay;
  74.             public int leechStrengthDelay;
  75.                 public int leechDefenceDelay;
  76.                     public int leechMagicDelay;
  77.                         public int leechAttackDelay;
  78.                             public int leechRangedDelay;
  79.  
  80.     public int said = 0;
  81.     public int log = -1;
  82.     public int cookedFishID;
  83.     public int CookingEmote;
  84.     public int npcId2 = 0;
  85.     public int gwdelay;
  86.     public int summonSpec;
  87.     public double getstr, getatt, getdef, getranged, getmagic;
  88.     public boolean isNpc;
  89.     public boolean isWc;
  90.     public boolean wcing;
  91.     public int treeX, treeY;
  92.     public String CookFishName;
  93.     public int burnFishID;
  94.     public int[] cantSpawn = {773};
  95.     public boolean clanDice = false;
  96.     public int diceID = 15084;
  97.     public int cDice = 0;
  98.     public boolean xpLock;
  99.     public boolean kamfreenaDone;
  100.     public boolean inCyclops = false;
  101. public boolean hasNpc = false;
  102. public int sellingId;
  103.     public int sellingN;
  104.     public int sellingS;
  105.     public int playerCollect;
  106.     public int playerShop[] = new int[10];
  107.     public int playerShopN[] = new int[10];
  108.     public int playerShopP[] = new int[10];
  109.     public Client myShopClient;
  110. public boolean hasNpc2 = false;
  111. public int primalBoost = 40;
  112. public int summonId;
  113.     public boolean Agrith;
  114.     public int earningPotential;
  115.     public int epDelay;
  116.     public boolean Flambeed;
  117.     public int UsedTimer;
  118.     public int UsedTimer2;
  119.     public boolean Karamel;
  120.     public boolean Dessourt;
  121.     public boolean Culin;
  122.     public int succeslvl;
  123.     public int xamount;
  124.     public int monkeyk0ed;
  125.     public int recoilHits = 0;
  126. public int vlsLeft = 1000;
  127. public int statLeft = 1000;
  128. public int vTopLeft = 1000;
  129. public int vLegsLeft = 1000;
  130. public int sTopLeft = 1000;
  131. public int sLegsLeft = 1000;
  132. public int sHelmLeft = 1000;
  133. public int zHoodLeft = 1000;
  134. public int zStaffLeft = 1000;
  135. public int zTopLeft = 1000;
  136. public int zBottomLeft = 1000;
  137. public int mBodyLeft = 1000;
  138. public int mChapsLeft = 1000;
  139. public int vSpearLeft = 1000;
  140.     public transient int ArmadylPitch = 0;
  141.     public int playerMac;
  142.     public boolean isCooking = false;
  143.     public int completedSetsMar, usedOnObjectID, usedOnobjectX, usedOnobjectY, CWPlayerIndex, TrownSpellTimer;
  144.     public int playerHunter = 21;  
  145.     /**
  146.      * A list of players in this region.
  147.      */
  148.     public List<Player> players = new LinkedList<Player>();
  149.  
  150.     public boolean isDoingSkillcapeAnim = false;
  151.     public boolean varrockTeleSelected = false;
  152.     public boolean edgevileTeleSelected = false;
  153.     public boolean faladorTeleSelected = false;
  154.     public boolean catherbyTeleSelected = false;
  155.     public boolean camelotTeleSelected = false;
  156.     public boolean barbarianTeleSelected = false;
  157.     public long lastCast = 0;
  158.     public long pTime = 0,recordLogin = 0;
  159.  
  160.     public boolean yanilleTeleSelected = false;
  161.     public ArrayList <String>killedPlayers = new ArrayList<String> ();
  162.     public ArrayList <Integer>attackedPlayers = new ArrayList<Integer> ();
  163.    
  164.     public boolean 
  165.     initialized = false,
  166.     disconnected = false,
  167.     ruleAgreeButton = false,
  168.     RebuildNPCList = false,
  169.     isActive = false,
  170.     isKicked = false,
  171.     sit = false,
  172.     Jail = false,
  173.     maxed = false,
  174.     isSkulled = false,
  175.     friendUpdate = false,
  176.     newPlayer = false,
  177.     hasMultiSign = false,
  178.     inAclan = false,
  179.     saveCharacter = false,
  180.     mouseButton = false,
  181.     splitChat = false,
  182.     chatEffects = true,
  183.     acceptAid = false,
  184.     nextDialogue = false,
  185.     autocasting = false,
  186.     viewingOrb = false,
  187.     usedSpecial = false,
  188.     mageFollow = false,
  189.     dbowSpec = false,
  190.     craftingLeather = false,
  191.     properLogout = false,
  192.     secDbow = false,
  193.     maxNextHit = false,
  194.     ssSpec = false,
  195.     vengOn = false,
  196.     addStarter = false,
  197.     accountFlagged = false,
  198.     readRules = false,
  199.     msbSpec = false,
  200.     newCmb = false,
  201.     isBanking = false
  202.     ;
  203.    
  204.    
  205.     public int
  206.      safeTimer = 0,
  207.     degradeTime,
  208.     KC,
  209.     DC,
  210.     recoil = 0,
  211.     puremaster,
  212.     headIconHints,
  213.         dbowDelay = 0,
  214.     pure,  
  215.     saveDelay,
  216.     ag1,
  217.     ag2,
  218.     ag3,
  219.     ag4,
  220.     ag5,
  221.     ag6,
  222.     altarPrayed = 0,
  223.     playerKilled,
  224.     ticketPoints,
  225.     pkPoints,
  226.     lvlPoints,
  227.     votePoints,
  228.     voteAmount,
  229.     killStreak,
  230.     playersPked,
  231.     amountDied,
  232.     waveId,
  233.     zombiesToKill = 0,
  234.     zombiesKilled = 0,
  235.     zombiesId,
  236.     wcLevelReq,
  237.     totalPlayerDamageDealt,
  238.     killedBy,
  239.     lastChatId = 1,
  240.         vestaDelay = 0,
  241.     privateChat,
  242.     friendSlot = 0,
  243.     SolProtect = 0,
  244.     dialogueId,
  245.     fishingLevelReq,
  246.     processPackets = 0,
  247.     randomCoffin,
  248.     newLocation,
  249.     CSLS = 0,
  250.     lastNpcAttacked = 0,
  251.     specEffect,
  252.     specBarId,
  253.     prestige = 0,
  254.     prestigePoint = 0,
  255.     prestigeChat = -1,
  256.     prestigeShops = 0,
  257.         processTimer,
  258.     attackLevelReq,
  259.     fletchingLevelReq,
  260.     Donatorreq,
  261.     defenceLevelReq,
  262.         dclaw1,
  263.         dclaw2,
  264.         dclaw3,
  265.         dclaw4,
  266.     strengthLevelReq,
  267.     rangeLevelReq,
  268.     magicLevelReq,
  269.     followId,
  270.     skullTimer,
  271.     votingPoints,
  272.     nextChat = 0,
  273.     talkingNpc = -1,
  274.     dialogueAction = 0,
  275.     autocastId,
  276.     followDistance,
  277.     followId2,
  278.     barrageCount = 0,
  279.     SETHOMEX = Config.RESPAWN_X,
  280.     SETHOMEY = Config.RESPAWN_Y,
  281.     delayedDamage = 0,
  282.     delayedDamage2 = 0,
  283.     pfPoints = 0,
  284.     donorPoints = 0,
  285.     pcPoints,
  286.     npcKills,
  287.     isDonator,
  288.     WildTimer = 0,
  289.     magePoints = 0,
  290.     desertTreasure = 0,
  291.     lastArrowUsed = -1,
  292.     clanId = -1,
  293.     autoRet = 0,
  294.     pcDamage = 0,
  295.     xInterfaceId = 0,
  296.     xRemoveId = 0,
  297.     xRemoveSlot = 0,
  298.     tzhaarToKill = 0,
  299.     RFDToKill = 0,
  300.     tzhaarKilled = 0,
  301.     RFDKilled = 0,
  302.     frozenBy = 0,
  303.     poisonDamage = 0,
  304.     teleAction = 0,
  305.     bonusAttack = 0,
  306.     newCombat = 0;
  307.     public String currentTime, date;
  308.     public String clanName, properName;
  309.     public int[] voidStatus = new int[5];
  310.     public int[] itemKeptId = new int [4];
  311.     public int[] pouches = new int[4];
  312.     public final int[] POUCH_SIZE = {3,6,9,12};
  313.     public boolean[] invSlot = new boolean[28], equipSlot = new boolean[14];
  314.     public long friends[] = new long[200];
  315.         public long lastButton;
  316.     public int clawDelay = 0;
  317.     public int previousDamage = 0;
  318.     public boolean usingClaws = false;
  319.     public double specAmount = 0;
  320.     public double specAccuracy = 1;
  321.     public double specDamage = 1;
  322.     public double prayerPoint = 1.0;
  323.     public int teleGrabItem, teleGrabX, teleGrabY, duelCount, underAttackBy, underAttackBy2, wildLevel, teleTimer, respawnTimer, saveTimer = 0, teleBlockLength, poisonDelay;
  324.     public long lastPlayerMove,lastPoison,lastoverload,lastPoisonSip,poisonImmune,lastSpear,lastProtItem, dfsDelay, lastVeng,lastYell,teleGrabDelay, protMageDelay, protMeleeDelay, protRangeDelay, lastAction, lastThieve,lastLockPick, alchDelay, specDelay = System.currentTimeMillis(), duelDelay, teleBlockDelay, godSpellDelay, singleCombatDelay, singleCombatDelay2, reduceStat, restoreStatsDelay, logoutDelay, buryDelay, foodDelay, diceDelay , potDelay;
  325.     public boolean canChangeAppearance = false;
  326.     public boolean mageAllowed;
  327.     public long SpecialDelay = 0;
  328.     public int follow2 = 0;
  329.     public byte poisonMask = 0;
  330.     //Setting up the woodcutting variables.
  331.     public boolean chopping = false;
  332.     public int choptimer = 0;
  333.     public int logID = 0;
  334.     public int donatorChest = 0;
  335.     public int chopreq = 0;
  336.     public int chopXP = 0;
  337.     public int treechance = 0;
  338.     public int treetimer = 0;
  339.     public int treetype = 0;
  340.     public int wcemote = 0;
  341.    
  342.     public final int[] BOWS =   {18357,15241,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};
  343.     public int BlackMarks = 0;
  344.     public final int[] ARROWS = {15243, 882,884,886,888,890,892,4740,11212,9140,9141,4142,9143,9144,9240,9241,9242,9243,9244,9245};
  345.     public final int[] NO_ARROW_DROP = {15243, 4212,4214,4215,4216,4217,4218,4219,4220,4221,4222,4223,4734,4934,4935,4936,4937};
  346.     public static final int[] Bolts =   {
  347.     877, 4740, 9139, 9140, 9141, 9142, 9143, 9144, 9145, 9236, 9237, 9238, 9239, 9240, 9241, 9242, 9243, 9244, 9245}; // Arrows, use with bows
  348.     public final int[] OTHER_RANGE_WEAPONS =    {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,13879,15016};
  349.    
  350.     public final int[][] MAGIC_SPELLS = {
  351.     // 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}
  352.    
  353.     // Modern Spells
  354.     {1152,1,711,90,91,92,2,5,556,1,558,1,0,0,0,0}, //wind strike
  355.     {1154,5,711,93,94,95,4,7,555,1,556,1,558,1,0,0}, // water strike
  356.     {1156,9,711,96,97,98,6,9,557,2,556,1,558,1,0,0},// earth strike
  357.     {1158,13,711,99,100,101,8,11,554,3,556,2,558,1,0,0}, // fire strike
  358.     {1160,17,711,117,118,119,9,13,556,2,562,1,0,0,0,0}, // wind bolt
  359.     {1163,23,711,120,121,122,10,16,556,2,555,2,562,1,0,0}, // water bolt
  360.     {1166,29,711,123,124,125,11,20,556,2,557,3,562,1,0,0}, // earth bolt
  361.     {1169,35,711,126,127,128,12,22,556,3,554,4,562,1,0,0}, // fire bolt
  362.     {1172,41,711,132,133,134,13,25,556,3,560,1,0,0,0,0}, // wind blast
  363.     {1175,47,711,135,136,137,14,28,556,3,555,3,560,1,0,0}, // water blast
  364.     {1177,53,711,138,139,140,15,31,556,3,557,4,560,1,0,0}, // earth blast
  365.     {1181,59,711,129,130,131,16,35,556,4,554,5,560,1,0,0}, // fire blast
  366.     {1183,62,711,158,159,160,17,36,556,5,565,1,0,0,0,0}, // wind wave
  367.     {1185,65,711,161,162,163,18,37,556,5,555,7,565,1,0,0},  // water wave
  368.     {1188,70,711,164,165,166,19,40,556,5,557,7,565,1,0,0}, // earth wave
  369.     {1189,75,711,155,156,157,20,42,556,5,554,7,565,1,0,0}, // fire wave
  370.     {1153,3,716,102,103,104,0,13,555,3,557,2,559,1,0,0},  // confuse
  371.     {1157,11,716,105,106,107,0,20,555,3,557,2,559,1,0,0},  // weaken
  372.     {1161,19,716,108,109,110,0,29,555,2,557,3,559,1,0,0}, // curse
  373.     {1542,66,729,167,168,169,0,76,557,5,555,5,566,1,0,0}, // vulnerability
  374.     {1543,73,729,170,171,172,0,83,557,8,555,8,566,1,0,0}, // enfeeble
  375.     {1562,80,729,173,174,107,0,90,557,12,555,12,556,1,0,0},  // stun
  376.     {1572,20,711,177,178,181,0,30,557,3,555,3,561,2,0,0}, // bind
  377.     {1582,50,711,177,178,180,2,60,557,4,555,4,561,3,0,0}, // snare
  378.     {1592,79,711,177,178,179,4,90,557,5,555,5,561,4,0,0}, // entangle
  379.     {1171,39,724,145,146,147,15,25,556,2,557,2,562,1,0,0},  // crumble undead
  380.     {1539,50,708,87,88,89,25,42,554,5,560,1,0,0,0,0}, // iban blast
  381.     {12037,50,1576,327,328,329,19,30,560,1,558,4,0,0,0,0}, // magic dart
  382.     {1190,60,811,0,0,76,20,60,554,2,565,2,556,4,0,0}, // sara strike
  383.     {1191,60,811,0,0,77,20,60,554,1,565,2,556,4,0,0}, // cause of guthix
  384.     {1192,60,811,0,0,78,20,60,554,4,565,2,556,1,0,0}, // flames of zammy
  385.     {12445,85,10503,1841,1842,1843,0,65,563,1,562,1,560,1,0,0}, // teleblock
  386.    
  387. // Ancient Spells
  388.     {12939,50,1978,0,384,385,13,30,560,2,562,2,554,1,556,1}, // smoke rush
  389.     {12987,52,1978,0,378,379,14,31,560,2,562,2,566,1,556,1}, // shadow rush
  390.     {12901,56,1978,0,0,373,15,33,560,2,562,2,565,1,0,0},  // blood rush
  391.     {12861,58,1978,0,360,361,16,34,560,2,562,2,555,2,0,0},  // ice rush
  392.     {12963,62,1979,0,0,389,19,36,560,2,562,4,556,2,554,2}, // smoke burst
  393.     {13011,64,1979,0,0,382,20,37,560,2,562,4,556,2,566,2}, // shadow burst
  394.     {12919,68,1979,0,0,376,21,39,560,2,562,4,565,2,0,0},  // blood burst
  395.     {12881,70,1979,0,0,363,22,40,560,2,562,4,555,4,0,0}, // ice burst
  396.     {12951,74,1978,0,386,387,23,42,560,2,554,2,565,2,556,2}, // smoke blitz
  397.     {12999,76,1978,0,380,381,24,43,560,2,565,2,556,2,566,2}, // shadow blitz
  398.     {12911,80,1978,0,374,375,25,45,560,2,565,4,0,0,0,0}, // blood blitz
  399.     {12871,82,1978,366,0,367,26,46,560,2,565,2,555,3,0,0}, // ice blitz
  400.     {12975,86,1979,0,0,391,27,48,560,4,565,2,556,4,554,4}, // smoke barrage
  401.     {13023,88,1979,0,0,383,28,49,560,4,565,2,556,4,566,3}, // shadow barrage
  402.     {12929,92,1979,0,0,377,29,51,560,4,565,4,566,1,0,0},  // blood barrage
  403.     {12891,94,1979,0,0,369,30,52,560,4,565,2,555,6,0,0}, // ice barrage
  404.     {-1,80,811,301,0,0,0,0,554,3,565,3,556,3,0,0}, // charge
  405.     {-1,21,712,1696,0,0,0,10,554,3,561,1,0,0,0,0}, // low alch
  406.     {-1,55,713,1691,0,0,0,20,554,5,561,1,0,0,0,0}, // high alch
  407.     //{-1,33,728,142,143,144,0,35,556,1,563,1,0,0,0,0} // telegrab
  408.  
  409.     };
  410.  
  411.     public boolean torva() {
  412.         if (playerEquipment[playerHat] == 13362 && playerEquipment[playerLegs] == 13360 && playerEquipment[playerChest] == 13358) {
  413.             return true;
  414.         }
  415.         return false;
  416.     }
  417.  
  418.     public boolean withinInteractionDistance(int x, int y, int z) {
  419.         if (heightLevel != z)
  420.             return false;
  421.         Client c = (Client)this;
  422.         int deltaX = x - c.getX(), deltaY = y - c.getY();
  423.         return deltaX <= 4 && deltaX >= -4 && deltaY <= 4 && deltaY >= -4;
  424.     }
  425.     public void isMaxed(){
  426.         if(getLevelForXP(playerXP[0]) > 98 && getLevelForXP(playerXP[1]) > 98 && getLevelForXP(playerXP[2]) > 98 && getLevelForXP(playerXP[3]) > 98 && getLevelForXP(playerXP[4]) > 98 && getLevelForXP(playerXP[5]) > 98 && getLevelForXP(playerXP[6]) > 98 && getLevelForXP(playerXP[21]) > 98){
  427.         System.out.println("Player is maxed");
  428.         maxed = true;
  429.         }
  430.     }
  431.         public void dealDamage(int damage) {
  432.        
  433.         Client c = (Client)this;
  434.         if(playerEquipment[playerShield] == 13740) { // Divine Spirit Shield Effect
  435.            
  436.             if(prayerPoint >0) {
  437.                 if(playerLevel[3] > 4) {
  438.                     if(Misc.random(8) <= 6) {
  439.                         double damageRecieved = damage * 0.70;
  440.                             c.sendMessage("Your shield absorbs 30% of the hit...");
  441.                            
  442.                     }
  443.                 }
  444.             }
  445.         }
  446.         if(playerEquipment[playerShield] == 13742) { // Elysian Spirit Shield Effect
  447.             if(Misc.random(8) <= 2) {
  448.                 if(playerLevel[3] > 4) {
  449.                     double damageRecieved = damage * 0.75;
  450.                     c.sendMessage("Your shield absorbs 25% of the SMASH!");
  451.                 }
  452.             }
  453.         }
  454.         if (teleTimer <= 0){
  455.             playerLevel[3] -= damage;
  456.         }else {
  457.             if (hitUpdateRequired)
  458.             hitUpdateRequired = false;
  459.             if (hitUpdateRequired2)
  460.             hitUpdateRequired2 = false;
  461.         }
  462.        
  463.     }
  464.    
  465.     public void applyRingOfLife() {
  466.     Client c = (Client) Server.playerHandler.players[this.playerId];
  467.         if (c.playerEquipment[c.playerRing] == 2570) {
  468.             if (c.playerLevel[3] > 0 && c.playerLevel[3] <= c.getLevelForXP(c.playerXP[3]) / 10 && c.underAttackBy > 0) {
  469.                 int wildlvl = (((c.absY - 3520) / 8) + 1);
  470.                 if (wildlvl < 20) {
  471.                     c.getItems().deleteEquipment(2570, c.playerRing);
  472.             c.getPA().startTeleport(2834, 3335, 0, "modern");
  473.             }
  474.         }
  475.     }
  476.     }
  477.    
  478.     public boolean isAutoButton(int button) {
  479.         for (int j = 0; j < autocastIds.length; j += 2) {
  480.             if (autocastIds[j] == button)
  481.                 return true;
  482.         }
  483.         return false;
  484.     }
  485.    
  486.     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,
  487.                                 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,
  488.                                 47019,27,47020,25,47021,12,47022,13,47023,14,47024,15};
  489.                                
  490.     //public String spellName = "Select Spell";
  491.     public void assignAutocast(int button) {
  492.         for (int j = 0; j < autocastIds.length; j++) {
  493.             if (autocastIds[j] == button) {
  494.                 Client c = (Client) Server.playerHandler.players[this.playerId];
  495.                 autocasting = true;
  496.                 autocastId = autocastIds[j+1];
  497.                 c.getPA().sendFrame36(108, 1);
  498.                 c.setSidebarInterface(0, 328);
  499.                 //spellName = getSpellName(autocastId);
  500.                 //spellName = spellName;
  501.                 //c.getPA().sendFrame126(spellName, 354);
  502.                 c = null;
  503.                 break;
  504.             }      
  505.         }  
  506.     }
  507.     public String getSpellName(int id) {
  508.         switch (id) {
  509.             case 0: return "Air Strike";
  510.             case 1: return "Water Strike";
  511.             case 2: return "Earth Strike";
  512.             case 3: return "Fire Strike";
  513.             case 4: return "Air Bolt";
  514.             case 5: return "Water Bolt";
  515.             case 6: return "Earth Bolt";
  516.             case 7: return "Fire Bolt";
  517.             case 8: return "Air Blast";
  518.             case 9: return "Water Blast";
  519.             case 10: return "Earth Blast";
  520.             case 11: return "Fire Blast";
  521.             case 12: return "Air Wave";
  522.             case 13: return "Water Wave";
  523.             case 14: return "Earth Wave";
  524.             case 15: return "Fire Wave";
  525.             case 32: return "Shadow Rush";
  526.             case 33: return "Smoke Rush";
  527.             case 34: return "Blood Rush";
  528.             case 35: return "Ice Rush";
  529.             case 36: return "Shadow Burst";
  530.             case 37: return "Smoke Burst";
  531.             case 38: return "Blood Burst";
  532.             case 39: return "Ice Burst";
  533.             case 40: return "Shadow Blitz";
  534.             case 41: return "Smoke Blitz";
  535.             case 42: return "Blood Blitz";
  536.             case 43: return "Ice Blitz";
  537.             case 44: return "Shadow Barrage";
  538.             case 45: return "Smoke Barrage";
  539.             case 46: return "Blood Barrage";
  540.             case 47: return "Ice Barrage";
  541.             default:
  542.             return "Select Spell";
  543.         }
  544.     }
  545.  
  546.     public boolean fullVerac() {
  547.         return playerEquipment[playerHat] == 4753 && playerEquipment[playerLegs] == 4759 && playerEquipment[playerChest] == 4757 && playerEquipment[playerWeapon] == 4755;
  548.     }
  549.  
  550.     public boolean fullDharoks() {
  551.         return playerEquipment[playerHat] == 4716 && playerEquipment[playerLegs] == 4722 && playerEquipment[playerChest] == 4720 && playerEquipment[playerWeapon] == 4718;
  552.     }
  553.    
  554.     public boolean fullVoidRange() {
  555.         return playerEquipment[playerHat] == 11664 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  556.     }
  557.    
  558.     public boolean fullVoidMage() {
  559.         return playerEquipment[playerHat] == 11663 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  560.     }
  561.    
  562.     public boolean fullVoidMelee() {
  563.         return playerEquipment[playerHat] == 11665 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  564.     }
  565.  
  566.     public boolean zaryteBow() {
  567.         return playerEquipment[playerHands] == 20171;
  568.     }
  569.  
  570.     public boolean cCbow() {
  571.         return playerEquipment[playerHands] == 18357;
  572.     }
  573.  
  574.     public boolean faithfulShield() {
  575.         return playerEquipment[playerShield] == 18747;
  576.     }
  577.  
  578.     public boolean fullVesta() {
  579.         return playerEquipment[playerLegs] == 13893 && playerEquipment[playerChest] == 13887;
  580.     }
  581.  
  582.     public boolean fullStatius() {
  583.         return playerEquipment[playerLegs] == 13890 && playerEquipment[playerChest] == 13884;
  584.     }
  585.  
  586.     public boolean fullTorva() {
  587.         return playerEquipment[playerHat] == 20135 && playerEquipment[playerLegs] == 20143 && playerEquipment[playerChest] == 20139;
  588.     }
  589.  
  590.     public boolean fullPernix() {
  591.         return playerEquipment[playerHat] == 20147 && playerEquipment[playerLegs] == 20155 && playerEquipment[playerChest] == 20151;
  592.     }
  593.  
  594.     public boolean fullVirtus() {
  595.         return playerEquipment[playerHat] == 20159 && playerEquipment[playerLegs] == 20167 && playerEquipment[playerChest] == 20163;
  596.     }
  597.  
  598.     public boolean hasFullPrimal() {
  599.         return playerEquipment[playerHat] == 20159 && playerEquipment[playerLegs] == 20167 && playerEquipment[playerChest] == 20163 || playerEquipment[playerHat] == 20147 && playerEquipment[playerLegs] == 20155 && playerEquipment[playerChest] == 20151 || playerEquipment[playerHat] == 20135 && playerEquipment[playerLegs] == 20143 && playerEquipment[playerChest] == 20139;
  600.     }
  601.    
  602.     public boolean fullVoidEliteRange() {
  603.         return playerEquipment[playerHat] == 11664 && playerEquipment[playerLegs] == 19786 && playerEquipment[playerChest] == 19785 && playerEquipment[playerHands] == 8842;
  604.     }
  605.    
  606.     public boolean fullVoidEliteMage() {
  607.         return playerEquipment[playerHat] == 11663 && playerEquipment[playerLegs] == 19786 && playerEquipment[playerChest] == 19785 && playerEquipment[playerHands] == 8842;
  608.     }
  609.    
  610.     public boolean fullVoidEliteMelee() {
  611.         return playerEquipment[playerHat] == 11665 && playerEquipment[playerLegs] == 19786 && playerEquipment[playerChest] == 19785 && playerEquipment[playerHands] == 8842;
  612.     }
  613.    
  614.     public int[][] playerSkillProp = new int[20][15];
  615.     public boolean[] playerSkilling = new boolean[20];
  616.     public boolean stopPlayerSkill;
  617.     public int doAmount;
  618.    
  619.     public int[][] barrowsNpcs = {
  620.     {2030, 0}, //verac
  621.     {2029, 0}, //toarg
  622.     {2028, 0}, // karil
  623.     {2027, 0}, // guthan
  624.     {2026, 0}, // dharok
  625.     {2025, 0} // ahrim
  626.     };
  627.     public int barrowsKillCount;
  628.    
  629.     public int reduceSpellId;
  630.     public final int[] REDUCE_SPELL_TIME = {250000, 250000, 250000, 500000,500000,500000}; // how long does the other player stay immune to the spell
  631.     public long[] reduceSpellDelay = new long[6];
  632.     public final int[] REDUCE_SPELLS = {1153,1157,1161,1542,1543,1562};
  633.     public boolean[] canUseReducingSpell = {true, true, true, true, true, true};
  634.    
  635.     public int slayerTask,taskAmount;
  636.    
  637.     public int prayerId = -1;
  638.     public int headIcon = -1;
  639.     public int bountyIcon = 0;
  640.     public long stopPrayerDelay, prayerDelay;
  641.     public boolean usingPrayer;
  642.         public long lastRequest;
  643. 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};
  644.     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};
  645.     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};
  646.     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",
  647.                                                 "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin", "Ultimate Strength", "Incredible Reflexes","Protect from Magic", "Protect from Missiles",
  648.                                                 "Protect from Melee","Eagle Eye", "Mystic Might", "Retribution", "Redemption", "Smite", "Chivalry", "Piety"};
  649.     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};
  650.     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};
  651.                                                 //{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,1,4,6,5};
  652.                                                
  653.     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};
  654. /* Curse Prayers */
  655. public final int[] CURSE_DRAIN_RATE = {
  656.         500,500,500,500,500,
  657.         500,500,500,500,500,
  658.         500,500,500,500,500,
  659.         500,500,500,500,500
  660.     };
  661.     public final int[] CURSE_LEVEL_REQUIRED = {
  662.         50,50,52,54,56,
  663.         59,62,65,68,71,
  664.         74,76,78,80,82,
  665.         84,86,89,92,95
  666.     };
  667.     public final int[] CURSE = {
  668.         0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
  669.     };
  670.     public final String[] CURSE_NAME = {
  671.         "Protect Item", "Sap Warrior", "Sap Ranger", "Sap Mage", "Sap Spirit",
  672.         "Berserker", "Deflect Summoning", "Deflect Magic","Deflect Missiles", "Deflect Melee",
  673.         "Leech Attack", "Leech Ranged", "Leech Magic", "Leech Defence", "Leech Strength",
  674.         "Leech Energy", "Leech Special Attack", "Wrath", "Soul Split", "Turmoil"
  675.     };
  676.     public final int[] CURSE_GLOW = {
  677.         610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629
  678.     };
  679.     public final int[] CURSE_HEAD_ICONS = {
  680.         -1,-1,-1,-1,-1,-1,12,10,11,9,-1,-1,-1,-1,-1,-1,-1,16,17,-1
  681.     };
  682.     public boolean[] curseActive = {
  683.         false,false,false,false,false,
  684.         false,false,false,false,false,
  685.         false,false,false,false,false,
  686.         false,false,false,false,false
  687.     };
  688. /*End of curse prayers*/
  689.     public int duelTimer, duelTeleX, duelTeleY, duelSlot, duelSpaceReq, duelOption, duelingWith, duelStatus;
  690.     public int headIconPk = -1, headIconhint;
  691.     public int headIconPray = 0;
  692.     public boolean duelRequested;
  693.     public boolean[] duelRule = new boolean[22];
  694.     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};
  695.    
  696.     public boolean doubleHit, usingSpecial, npcDroppingItems, usingRangeWeapon, usingBow, usingMagic, castingMagic;
  697.     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;
  698.     public boolean magicFailed, oldMagicFailed;
  699.     public int bowSpecShot, clickNpcType, clickObjectType, objectId, objectX, objectY, objectXOffset, objectYOffset, objectDistance;
  700.     public int pItemX, pItemY, pItemId;
  701.     public boolean isMoving, walkingToItem;
  702.     public boolean isShopping, updateShop;
  703.     public int myShopId;
  704.     public int Wheel;
  705.     public int tradeStatus, tradeWith;
  706.     public boolean forcedChatUpdateRequired, inDuel, tradeAccepted, goodTrade, inTrade, tradeRequested, tradeResetNeeded, tradeConfirmed, tradeConfirmed2, canOffer, acceptTrade, acceptedTrade;
  707.     public int attackAnim, animationRequest = -1,animationWaitCycles;
  708.     public int[] playerBonus = new int[12];
  709.     public boolean isRunning2 = true;
  710.     public boolean takeAsNote;
  711.     public int combatLevel;
  712.     public boolean saveFile = false;
  713.     public int playerAppearance[] = new int[13];
  714.     public int apset;
  715.     public int actionID;
  716.     public int wearItemTimer, wearId, wearSlot, interfaceId;
  717.     public int XremoveSlot, XinterfaceID, XremoveID, Xamount;
  718.    
  719.     public int tutorial = 15;
  720.     public boolean usingGlory = false;
  721.     public int[] woodcut = new int[7];
  722.     public int wcTimer = 0;
  723.     public int[] mining = new int [3];
  724.     public int miningTimer = 0;
  725.     //Setting up the fishing variables.
  726.     public boolean fishing = false;
  727.     public int fishtimer = 0;
  728.     public int fishXP;
  729.     public int fishies = 0;
  730.     public int fishreqt = 0;
  731.     public int fishitem = 0;
  732.     public int fishemote = 0;
  733.     public int fishies2 = 0;
  734.     public int fishreq2 = 0;
  735.     public boolean isfishing = false;
  736.     public boolean attemptingfish = false;
  737.     public int smeltType; //1 = bronze, 2 = iron, 3 = steel, 4 = gold, 5 = mith, 6 = addy, 7 = rune
  738.     public int smeltAmount;
  739.     public int smeltTimer = 0;
  740.     public boolean smeltInterface;
  741.     public boolean patchCleared;
  742.     public int[] farm = new int[2];
  743.    
  744.    
  745.     public boolean antiFirePot = false;
  746.    
  747.     /**
  748.      * Castle Wars
  749.      */
  750.     public int castleWarsTeam;
  751.     public boolean inCwGame;
  752.     public boolean inCwWait;
  753.    
  754.     public boolean Lattack = false;
  755.     public boolean Lranged = false;
  756.     public boolean Lmagic = false;
  757.     public boolean Ldefense = false;
  758.     public boolean Lstrength = false;
  759.     public boolean Lspecial = false;
  760.  
  761.    
  762.     public boolean inPits = false;
  763.     public int pitsStatus = 0;     
  764.    
  765.  
  766.      public boolean inFunPk = false;
  767.      public boolean InDung = false;
  768.    
  769.        
  770.     public boolean isInTut() {     
  771.         if(absX >= 2625 && absX <= 2687 && absY >= 4670 && absY <= 4735) {
  772.             return true;
  773.         }
  774.         return false;
  775.     }
  776.         public boolean inArena() {
  777.         if ((absX >= 3331 && absX <= 3359 && absY >= 3243 && absY <= 3259)) {
  778.         return false;
  779.         }  
  780.         return true;
  781.     }
  782.     public boolean inPits () {
  783.     if(absX >= 2370 && absX <= 2425 && absY >= 5133 && absY <= 5165) {
  784.     return true;
  785.         }
  786.         return false;
  787.     }
  788.    
  789. public boolean inFunPk() {
  790.         if(absX > 2582 && absX < 2602 && absY > 3152 && absY < 3171 ||
  791.             absX > 2601 && absX < 2607 && absY > 3156 && absY < 3171){
  792.             return true;
  793.         }
  794.         return false;
  795.     }
  796.    
  797.     public boolean isInJail() {    
  798.         if(absX >= 3093 && absX <= 3112 && absY >= 9507 && absY <= 9526) {
  799.             return true;
  800.         }
  801.         return false;
  802.     }
  803.    
  804.     public boolean inBarrows() {       
  805.         if(absX > 3520 && absX < 3598 && absY > 9653 && absY < 9750) {
  806.             return true;
  807.         }
  808.         return false;
  809.     }
  810.  
  811.     public boolean inGWD() {
  812.         if (absX > 2820 && absX < 2955 && absY > 5250 && absY < 5370) {
  813.             return true;
  814.         }
  815.         return false;
  816.     }
  817.  
  818.     public boolean inJail() {
  819.         if (absX > 3050 && absX < 3062 && absY > 4967 && absY < 4980) {
  820.             return true;
  821.         }
  822.         return false;
  823.     }
  824.    
  825.     public boolean inArea(int x, int y, int x1, int y1) {
  826.         if (absX > x && absX < x1 && absY < y && absY > y1) {
  827.             return true;
  828.         }
  829.         return false;
  830.     }
  831.    
  832.     public boolean inWild() {
  833.         if(isInFala() || inFunPk()) {
  834.         return true;
  835.         }
  836.         if(absX > 2941 && absX < 3392 && absY > 3518 && absY < 3968 ||
  837.             absX > 2941 && absX < 3392 && absY > 9918 && absY < 10367){    
  838.             return true;
  839.         }
  840.         return false;
  841.     }
  842.     public boolean isInArd() {
  843.         if(absX > 3000 && absX < 3000 && absY > 3000 && absY < 3000) { 
  844.             return true;
  845.         }
  846.         return false;
  847.     }
  848.     public boolean InDung() {
  849.         if(absX >= 1755 && absX <= 1986 && absY >= 4500 && absY <= 4730 ||
  850.         absX >= 1755 && absX <= 2140 && absY >= 4500 && absY <= 4775 ||
  851.         absX >= 2300 && absX <= 2400 && absY >= 4610 && absY <= 4800 ||
  852.         absX >= 2943 && absX <= 3173 && absY >= 5117 && absY <= 5350 ||
  853.         absX >= 2941 && absX <= 3173 && absY >= 5083 && absY <= 5314 ||
  854.         absX >= 2873 && absX <= 3146 && absY >= 5006 && absY <= 5215 ||
  855.         absX >= 2685 && absX <= 2900 && absY >= 9220 && absY <= 9435 ||
  856.         absX >= 2760 && absX <= 2812 && absY >= 9505 && absY <= 9640 ||
  857.         absX >= 3140 && absX <= 3280 && absY >= 9200 && absY <= 9347 ||
  858.         absX >= 2800 && absX <= 2950 && absY >= 4570 && absY <= 4666 ||
  859.         absX >= 2758 && absX <= 2810 && absY >= 4418 && absY <= 4463 ||
  860.         absX >= 2800 && absX <= 2950 && absY >= 9905 && absY <= 9985 ||
  861.         absX >= 2822 && absX <= 2876 && absY >= 9477 && absY <= 9532 ||
  862.         absX >= 2368&& absX <= 2446 && absY >= 9408 && absY <= 9482 ||
  863.         absX >= 2370 && absX <= 2430 && absY >= 5117 && absY <= 4701 ||
  864.         absX >= 2800 && absX <= 2900 && absY >= 9900 && absY <= 9999) {
  865.                       return true;
  866.         }
  867.         return false;
  868.     }
  869.  
  870.     public boolean isInFala() {
  871.         if(absX > 3002 && absX < 3004 && absY > 3002 && absY < 3004) { 
  872.             return true;
  873.         }
  874.         return false;
  875.     }
  876.     public boolean isInPbox() {
  877.         if(absX > 3343 && absX < 3384 && absY > 9619 && absY < 9660) { 
  878.             return true;
  879.         }
  880.         return false;
  881.     }
  882.     public boolean isInGiantmole() {
  883.         if(absX > 1733 && absX < 5133 && absY > 1787 && absY < 5244) { 
  884.             return true;
  885.         }
  886.         return false;
  887.     }
  888.             public boolean isInKq() {
  889.         if(absX > 3465 && absX < 9481 && absY > 3508 && absY < 9518) { 
  890.             return true;
  891.         }
  892.         return false;
  893.     }
  894.     public boolean isInEdge() {
  895.         if(absX > 3084 && absX < 3111 && absY > 3483 && absY < 3509) { 
  896.             return true;
  897.         }
  898.         return false;
  899.     }
  900.  
  901.  
  902. public boolean safeZone() {
  903.         if(absX > 2612 && absX < 2622 && absY > 3330 && absY < 3335
  904.         || absX > 2601 && absX < 2620 && absY > 3140 && absY < 3157
  905.         || absX > 2648 && absX < 2658 && absY > 3279 && absY < 3287
  906.         || absX > 2520 && absX < 2526 && absY > 4774 && absY < 4780) { 
  907.             return true;
  908.         }
  909.         return false;
  910.     }
  911.    
  912.    
  913.     public boolean arenas() {
  914.         if(absX > 3331 && absX < 3391 && absY > 3242 && absY < 3260) { 
  915.             return true;
  916.         }
  917.         return false;
  918.     }
  919.    
  920.     public boolean inDuelArena() {
  921.         if((absX > 3322 && absX < 3394 && absY > 3195 && absY < 3291) ||
  922.         (absX > 3311 && absX < 3323 && absY > 3223 && absY < 3248)) {
  923.             return true;
  924.         }
  925.         return false;
  926.     }
  927. public boolean inMulti() {
  928.         if(isInArd()) {
  929.         return true;
  930.         }
  931.     if((absX >= 3136 && absX <= 3327 && absY >= 3519 && absY <= 3607) ||
  932.     (absX >= 3460 && absX <= 3505 && absY >= 9480 && absY <= 9520) ||
  933.             absX > 3343 && absX < 3384 && absY > 9619 && absY < 9660 ||
  934.             (absX >= 3210 && absX <= 3339 && absY >= 9333 && absY <= 9424) ||
  935.             (absX >= 2607 && absX <= 2644 && absY >= 3296 && absY <= 3332) ||
  936.                 (absX >= 3359 && absX <= 3367 && absY >= 9636 && absY <= 9644) ||
  937.             (absX >= 2949 && absX <= 3001 && absY >= 3370 && absY <= 3392) ||
  938.             (absX >= 3250 && absX <= 3342 && absY >= 9800 && absY <= 9870) ||  
  939.             (absX >= 3190 && absX <= 3327 && absY >= 3648 && absY <= 3839) ||  
  940.             (absX >= 3200 && absX <= 3390 && absY >= 3840 && absY <= 3967) ||
  941.             (absX >= 2992 && absX <= 3007 && absY >= 3912 && absY <= 3967) ||
  942.             (absX >= 2946 && absX <= 2959 && absY >= 3816 && absY <= 3831) ||
  943.             (absX >= 3008 && absX <= 3199 && absY >= 3856 && absY <= 3903) ||
  944.             (absX >= 3008 && absX <= 3071 && absY >= 3600 && absY <= 3711) ||
  945.             (absX >= 3072 && absX <= 3327 && absY >= 3608 && absY <= 3647) ||
  946.             (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619) ||
  947.             (absX >= 2371 && absX <= 2422 && absY >= 5062 && absY <= 5117) ||
  948.             (absX >= 2896 && absX <= 2927 && absY >= 3595 && absY <= 3630) ||
  949.             (absX >= 2820 && absX <= 2955 && absY >= 5250 && absY <= 5370) ||
  950.             (absX >= 2892 && absX <= 2932 && absY >= 4435 && absY <= 4464) ||
  951.             (absX >= 2453 && absX <= 2476 && absY >= 4768 && absY <= 4790) ||
  952.             (absX >= 2947 && absX <= 3002 && absY >= 9475 && absY <= 9528) ||
  953.             (absX >= 2312 && absX <= 2332 && absY >= 3783 && absY <= 3801) ||
  954.             (absX >= 2256 && absX <= 2287 && absY >= 4680 && absY <= 4711) ||
  955.             (absX >= 2660 && absX <= 2690 && absY >= 3690 && absY <= 3735) ||
  956.             (absX >= 2980 && absX <= 2993 && absY >= 9629 && absY <= 9644)) {
  957.             return true;
  958.         }
  959.         return false;
  960.     }
  961.    
  962.  
  963.    
  964.     public boolean inFightCaves()
  965.     {
  966.         return absX >= 2360 && absX <= 2445 && absY >= 5045 && absY <= 5125;
  967.     }
  968.     public boolean inZombieCaves()
  969.     {
  970.         return absX >= 2598 && absX <= 2609 && absY >= 9901 && absY <= 9917;
  971.     }
  972.     public boolean inRFD()
  973.     {
  974.         return absX >= 1885 && absX <= 1913 && absY >= 5340 && absY <= 5369;
  975.     }
  976.  
  977.     public boolean inWarriorG()
  978.     {
  979.         return absX >= 2835 && absX <= 2877 && absY >= 3532 && absY <= 3559;
  980.     }
  981.    
  982.     public boolean inPirateHouse() {
  983.         return absX >= 3038 && absX <= 3044 && absY >= 3949 && absY <= 3959;
  984.     }
  985.    
  986.    
  987.     public String connectedFrom="";
  988.     public String globalMessage="";
  989.     public abstract void initialize();
  990.     public abstract void update();
  991.     public int playerId = -1;      
  992.     public String playerName = null;
  993.     public String playerName2 = null;
  994.     public String playerPass = null;           
  995.     public int playerRights;       
  996.     public PlayerHandler handler = null;
  997.     public int playerItems[] = new int[28];
  998.     public int playerItemsN[] = new int[28];
  999.     public int bankItems[] = new int[Config.BANK_SIZE];
  1000.     public int bankItemsN[] = new int[Config.BANK_SIZE];
  1001.     public boolean bankNotes = false;
  1002.    
  1003.     public int playerStandIndex = 0x328;
  1004.     public int playerTurnIndex = 0x337;
  1005.     public int playerWalkIndex = 0x333;
  1006.     public int playerTurn180Index = 0x334;
  1007.     public int playerTurn90CWIndex = 0x335;
  1008.     public int playerTurn90CCWIndex = 0x336;
  1009.     public int playerRunIndex = 824;
  1010.  
  1011.     public int playerHat=0;
  1012.     public int playerCape=1;
  1013.     public int playerAmulet=2;
  1014.     public int playerWeapon=3;
  1015.     public int playerChest=4;
  1016.     public int playerShield=5;
  1017.     public int playerLegs=7;
  1018.     public int playerHands=9;
  1019.     public int playerFeet=10;
  1020.     public int playerRing=12;
  1021.     public int playerArrows=13;
  1022.  
  1023.     public int playerAttack = 0;
  1024.     public int playerDefence = 1;
  1025.     public int playerStrength = 2;
  1026.     public int playerHitpoints = 3;
  1027.     public int playerRanged = 4;
  1028.     public int playerPrayer = 5;
  1029.     public int playerMagic = 6;
  1030.     public int playerCooking = 7;
  1031.     public int playerWoodcutting = 8;
  1032.     public int playerFletching = 9;
  1033.     public int playerFishing = 10;
  1034.     public int playerFiremaking = 11;
  1035.     public int playerCrafting = 12;
  1036.     public int playerSmithing = 13;
  1037.     public int playerMining = 14;
  1038.     public int playerHerblore = 15;
  1039.     public int playerAgility = 16;
  1040.     public int playerThieving = 17;
  1041.     public int playerSlayer = 18;
  1042.     public int playerFarming = 19;
  1043.     public int playerRunecrafting = 20;
  1044.    
  1045.     public int[] playerEquipment = new int[14];
  1046.     public int[] playerEquipmentN = new int[14];
  1047.     public int[] playerLevel = new int[25];
  1048.     public int[] playerXP = new int[25];
  1049.    
  1050.     public void updateshop(int i){
  1051.         Client p = (Client) Server.playerHandler.players[playerId];
  1052.         p.getShops().resetShop(i);
  1053.     }
  1054.    
  1055.     public void println_debug(String str) {
  1056.         System.out.println("[player-"+playerId+"]: "+str);
  1057.     }
  1058.     public void println(String str) {
  1059.         System.out.println("[player-"+playerId+"]: "+str);
  1060.     }
  1061.     public Player(int _playerId) {
  1062.         playerId = _playerId;
  1063.         playerRights = 0;
  1064.  
  1065.         for (int i=0; i<playerItems.length; i++) {
  1066.             playerItems[i] = 0;
  1067.         }
  1068.         for (int i=0; i<playerItemsN.length; i++) {
  1069.             playerItemsN[i] = 0;
  1070.         }
  1071.  
  1072.         for (int i=0; i<playerLevel.length; i++) {
  1073.             if (i == 3) {
  1074.                 playerLevel[i] = 10;
  1075.             } else {
  1076.                 playerLevel[i] = 1;
  1077.             }
  1078.         }
  1079.  
  1080.         for (int i=0; i<playerXP.length; i++) {
  1081.             if (i == 3) {
  1082.                 playerXP[i] = 1300;
  1083.             } else {
  1084.                 playerXP[i] = 0;
  1085.             }
  1086.         }
  1087.         for (int i=0; i < Config.BANK_SIZE; i++) {
  1088.             bankItems[i] = 0;
  1089.         }
  1090.  
  1091.         for (int i=0; i < Config.BANK_SIZE; i++) {
  1092.             bankItemsN[i] = 0;
  1093.         }
  1094.        
  1095.         playerAppearance[0] = 0; // gender
  1096.         playerAppearance[1] = 0; // head
  1097.         playerAppearance[2] = 24;// Torso
  1098.         playerAppearance[3] = 28; // arms
  1099.         playerAppearance[4] = 35; // hands
  1100.         playerAppearance[5] = 39; // legs
  1101.         playerAppearance[6] = 44; // feet
  1102.         playerAppearance[7] = 14; // beard
  1103.         playerAppearance[8] = 7; // hair colour
  1104.         playerAppearance[9] = 8; // torso colour
  1105.         playerAppearance[10] = 9; // legs colour
  1106.         playerAppearance[11] = 5; // feet colour
  1107.         playerAppearance[12] = 0; // skin colour   
  1108.        
  1109.         apset = 0;
  1110.         actionID = 0;
  1111.  
  1112.         playerEquipment[playerHat]=-1;
  1113.         playerEquipment[playerCape]=-1;
  1114.         playerEquipment[playerAmulet]=-1;
  1115.         playerEquipment[playerChest]=-1;
  1116.         playerEquipment[playerShield]=-1;
  1117.         playerEquipment[playerLegs]=-1;
  1118.         playerEquipment[playerHands]=-1;
  1119.         playerEquipment[playerFeet]=-1;
  1120.         playerEquipment[playerRing]=-1;
  1121.         playerEquipment[playerArrows]=-1;
  1122.         playerEquipment[playerWeapon]=-1;
  1123.        
  1124.         heightLevel = 0;
  1125.        
  1126.         teleportToX = Config.START_LOCATION_X;
  1127.         teleportToY = Config.START_LOCATION_Y;
  1128.  
  1129.        
  1130.         absX = absY = -1;
  1131.         mapRegionX = mapRegionY = -1;
  1132.         currentX = currentY = 0;
  1133.         resetWalkingQueue();
  1134.     }
  1135.  
  1136.     void destruct() {
  1137.         playerListSize = 0;
  1138.         for(int i = 0; i < maxPlayerListSize; i++)
  1139.             playerList[i] = null;
  1140.         absX = absY = -1;
  1141.         mapRegionX = mapRegionY = -1;
  1142.         currentX = currentY = 0;
  1143.         resetWalkingQueue();
  1144.     }
  1145.  
  1146.  
  1147.     public static final int maxPlayerListSize = Config.MAX_PLAYERS;
  1148.     public Player playerList[] = new Player[maxPlayerListSize];
  1149.     public int playerListSize = 0;
  1150.    
  1151.    
  1152.     public byte playerInListBitmap[] = new byte[(Config.MAX_PLAYERS+7) >> 3];
  1153.    
  1154.    
  1155.     public static final int maxNPCListSize = NPCHandler.maxNPCs;
  1156.     public NPC npcList[] = new NPC[maxNPCListSize];
  1157.     public int npcListSize = 0;
  1158.    
  1159.     public byte npcInListBitmap[] = new byte[(NPCHandler.maxNPCs+7) >> 3];
  1160.  
  1161.    
  1162.    
  1163.     public boolean withinDistance(Player otherPlr) {
  1164.         if(heightLevel != otherPlr.heightLevel) return false;
  1165.         int deltaX = otherPlr.absX-absX, deltaY = otherPlr.absY-absY;
  1166.         return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  1167.     }
  1168.  
  1169.     public boolean withinDistance(NPC npc) {
  1170.         if (heightLevel != npc.heightLevel) return false;
  1171.         if (npc.needRespawn == true) return false;
  1172.         int deltaX = npc.absX-absX, deltaY = npc.absY-absY;
  1173.         return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  1174.     }
  1175.  
  1176.     public int distanceToPoint(int pointX,int pointY) {
  1177.         return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  1178.     }
  1179.  
  1180.     public int mapRegionX, mapRegionY;     
  1181.     public int absX, absY;             
  1182.     public int currentX, currentY;         
  1183.    
  1184.     public int heightLevel;    
  1185.     public int playerSE = 0x328;
  1186.     public int playerSEW = 0x333;
  1187.     public int playerSER = 0x334;
  1188.  
  1189.     public boolean updateRequired = true;      
  1190.                                                
  1191.    
  1192.     public final int walkingQueueSize = 50;
  1193.     public int walkingQueueX[] = new int[walkingQueueSize], walkingQueueY[] = new int[walkingQueueSize];
  1194.     public int wQueueReadPtr = 0;      
  1195.     public int wQueueWritePtr = 0;     
  1196.     public boolean isRunning = true;
  1197.     public int teleportToX = -1, teleportToY = -1; 
  1198.  
  1199.     public void resetWalkingQueue() {
  1200.         wQueueReadPtr = wQueueWritePtr = 0;
  1201.        
  1202.         for(int i = 0; i < walkingQueueSize; i++) {
  1203.             walkingQueueX[i] = currentX;
  1204.             walkingQueueY[i] = currentY;
  1205.         }
  1206.     }
  1207.  
  1208.     public void addToWalkingQueue(int x, int y) {
  1209.         //if (VirtualWorld.I(heightLevel, absX, absY, x, y, 0)) {
  1210.             int next = (wQueueWritePtr+1) % walkingQueueSize;
  1211.             if(next == wQueueWritePtr) return;     
  1212.             walkingQueueX[wQueueWritePtr] = x;
  1213.             walkingQueueY[wQueueWritePtr] = y;
  1214.             wQueueWritePtr = next;
  1215.         //}
  1216.     }
  1217.  
  1218.     public boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
  1219.         for (int i = 0; i <= distance; i++) {
  1220.           for (int j = 0; j <= distance; j++) {
  1221.             if ((objectX + i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  1222.                 return true;
  1223.             } else if ((objectX - i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  1224.                 return true;
  1225.             } else if (objectX == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  1226.                 return true;
  1227.             }
  1228.           }
  1229.         }
  1230.         return false;
  1231.     }
  1232.    
  1233.     public int getNextWalkingDirection() {
  1234.         if(wQueueReadPtr == wQueueWritePtr)
  1235.             return -1;     
  1236.         int dir;
  1237.         do {
  1238.             dir = Misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
  1239.             if(dir == -1) {
  1240.                 wQueueReadPtr = (wQueueReadPtr+1) % walkingQueueSize;
  1241.             } else if((dir&1) != 0) {
  1242.                 println_debug("Invalid waypoint in walking queue!");
  1243.                 resetWalkingQueue();
  1244.                 return -1;
  1245.             }
  1246.         } while((dir == -1) && (wQueueReadPtr != wQueueWritePtr));
  1247.         if(dir == -1) return -1;
  1248.         dir >>= 1;
  1249.         currentX += Misc.directionDeltaX[dir];
  1250.         currentY += Misc.directionDeltaY[dir];
  1251.         absX += Misc.directionDeltaX[dir];
  1252.         absY += Misc.directionDeltaY[dir];
  1253.         return dir;
  1254.     }
  1255.  
  1256.    
  1257.     public boolean didTeleport = false;    
  1258.     public boolean mapRegionDidChange = false;
  1259.     public int dir1 = -1, dir2 = -1;       
  1260.     public boolean createItems = false;
  1261.     public int poimiX = 0, poimiY = 0;
  1262.        
  1263.     public void getNextPlayerMovement() {
  1264.             mapRegionDidChange = false;
  1265.             didTeleport = false;
  1266.             dir1 = dir2 = -1;
  1267.    
  1268.             if(teleportToX != -1 && teleportToY != -1) {
  1269.                 mapRegionDidChange = true;
  1270.                 if(mapRegionX != -1 && mapRegionY != -1) {
  1271.                     int relX = teleportToX-mapRegionX*8, relY = teleportToY-mapRegionY*8;
  1272.                     if(relX >= 2*8 && relX < 11*8 && relY >= 2*8 && relY < 11*8)
  1273.                         mapRegionDidChange = false;
  1274.                 }
  1275.                 if(mapRegionDidChange) {
  1276.                     mapRegionX = (teleportToX>>3)-6;
  1277.                     mapRegionY = (teleportToY>>3)-6;
  1278.                 }
  1279.                 currentX = teleportToX - 8*mapRegionX;
  1280.                 currentY = teleportToY - 8*mapRegionY;
  1281.                 absX = teleportToX;
  1282.                 absY = teleportToY;
  1283.                 resetWalkingQueue();
  1284.                
  1285.                 teleportToX = teleportToY = -1;
  1286.                 didTeleport = true;
  1287.             } else {           
  1288.                 dir1 = getNextWalkingDirection();
  1289.                 if(dir1 == -1)
  1290.                     return;
  1291.                 if(isRunning) {
  1292.                     dir2 = getNextWalkingDirection();
  1293.                 }
  1294.                 Client c = (Client)this;
  1295.                 //c.sendMessage("Cycle Ended");
  1296.                 int deltaX = 0, deltaY = 0;
  1297.                 if(currentX < 2*8) {
  1298.                     deltaX = 4*8;
  1299.                     mapRegionX -= 4;
  1300.                     mapRegionDidChange = true;
  1301.                 } else if(currentX >= 11*8) {
  1302.                     deltaX = -4*8;
  1303.                     mapRegionX += 4;
  1304.                     mapRegionDidChange = true;
  1305.                 }
  1306.                 if(currentY < 2*8) {
  1307.                     deltaY = 4*8;
  1308.                     mapRegionY -= 4;
  1309.                     mapRegionDidChange = true;
  1310.                 } else if(currentY >= 11*8) {
  1311.                     deltaY = -4*8;
  1312.                     mapRegionY += 4;
  1313.                     mapRegionDidChange = true;
  1314.                 }
  1315.    
  1316.                 if(mapRegionDidChange/* && VirtualWorld.I(heightLevel, currentX, currentY, currentX + deltaX, currentY + deltaY, 0)*/) {
  1317.                     currentX += deltaX;
  1318.                     currentY += deltaY;
  1319.                     for(int i = 0; i < walkingQueueSize; i++) {
  1320.                         walkingQueueX[i] += deltaX;
  1321.                         walkingQueueY[i] += deltaY;
  1322.                     }
  1323.                 }
  1324.                 //CoordAssistant.processCoords(this);
  1325.    
  1326.             }
  1327.     }
  1328.  
  1329.    
  1330.     public void updateThisPlayerMovement(Stream str) {
  1331.         synchronized(this) {
  1332.             if(mapRegionDidChange) {
  1333.                 str.createFrame(73);
  1334.                 str.writeWordA(mapRegionX+6);  
  1335.                 str.writeWord(mapRegionY+6);
  1336.             }
  1337.  
  1338.             if(didTeleport) {
  1339.                 str.createFrameVarSizeWord(81);
  1340.                 str.initBitAccess();
  1341.                 str.writeBits(1, 1);
  1342.                 str.writeBits(2, 3);           
  1343.                 str.writeBits(2, heightLevel);
  1344.                 str.writeBits(1, 1);           
  1345.                 str.writeBits(1, (updateRequired) ? 1 : 0);
  1346.                 str.writeBits(7, currentY);
  1347.                 str.writeBits(7, currentX);
  1348.                 return ;
  1349.             }
  1350.            
  1351.  
  1352.             if(dir1 == -1) {
  1353.                 // don't have to update the character position, because we're just standing
  1354.                 str.createFrameVarSizeWord(81);
  1355.                 str.initBitAccess();
  1356.                 isMoving = false;
  1357.                 if(updateRequired) {
  1358.                     // tell client there's an update block appended at the end
  1359.                     str.writeBits(1, 1);
  1360.                     str.writeBits(2, 0);
  1361.                 } else {
  1362.                     str.writeBits(1, 0);
  1363.                 }
  1364.                 if (DirectionCount < 50) {
  1365.                     DirectionCount++;
  1366.                 }
  1367.             } else {
  1368.                 DirectionCount = 0;
  1369.                 str.createFrameVarSizeWord(81);
  1370.                 str.initBitAccess();
  1371.                 str.writeBits(1, 1);
  1372.  
  1373.                 if(dir2 == -1) {
  1374.                     isMoving = true;
  1375.                     str.writeBits(2, 1);       
  1376.                     str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  1377.                     if(updateRequired) str.writeBits(1, 1);    
  1378.                     else str.writeBits(1, 0);
  1379.                 }
  1380.                 else {
  1381.                     isMoving = true;
  1382.                     str.writeBits(2, 2);       
  1383.                     str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  1384.                     str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  1385.                     if(updateRequired) str.writeBits(1, 1);    
  1386.                     else str.writeBits(1, 0);
  1387.                 }
  1388.             }
  1389.         }
  1390.     }
  1391.  
  1392.    
  1393.     public void updatePlayerMovement(Stream str) {
  1394.         synchronized(this) {
  1395.             if(dir1 == -1) {
  1396.                 if(updateRequired || isChatTextUpdateRequired()) {
  1397.                    
  1398.                     str.writeBits(1, 1);
  1399.                     str.writeBits(2, 0);
  1400.                 }
  1401.                 else str.writeBits(1, 0);
  1402.             }
  1403.             else if(dir2 == -1) {
  1404.                
  1405.                 str.writeBits(1, 1);
  1406.                 str.writeBits(2, 1);
  1407.                 str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  1408.                 str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1: 0);
  1409.             }
  1410.             else {
  1411.                
  1412.                 str.writeBits(1, 1);
  1413.                 str.writeBits(2, 2);
  1414.                 str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  1415.                 str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  1416.                 str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1: 0);
  1417.             }
  1418.         }
  1419.     }
  1420.    
  1421.     public byte cachedPropertiesBitmap[] = new byte[(Config.MAX_PLAYERS+7) >> 3];
  1422.  
  1423.     public void addNewNPC(NPC npc, Stream str, Stream updateBlock) {
  1424.         synchronized(this) {
  1425.             int id = npc.npcId;
  1426.             npcInListBitmap[id >> 3] |= 1 << (id&7);   
  1427.             npcList[npcListSize++] = npc;
  1428.    
  1429.             str.writeBits(14, id); 
  1430.            
  1431.             int z = npc.absY-absY;
  1432.             if(z < 0) z += 32;
  1433.             str.writeBits(5, z);   
  1434.             z = npc.absX-absX;
  1435.             if(z < 0) z += 32;
  1436.             str.writeBits(5, z);   
  1437.    
  1438.             str.writeBits(1, 0);
  1439.             str.writeBits(14, npc.npcType); // Nicknames eller vanliga 14 - 12
  1440.            
  1441.             boolean savedUpdateRequired = npc.updateRequired;
  1442.             npc.updateRequired = true;
  1443.             npc.appendNPCUpdateBlock(updateBlock);
  1444.             npc.updateRequired = savedUpdateRequired;  
  1445.             str.writeBits(1, 1);
  1446.         }
  1447.     }
  1448.    
  1449.     public void addNewPlayer(Player plr, Stream str, Stream updateBlock) {
  1450.         synchronized(this) {
  1451.             int id = plr.playerId;
  1452.             playerInListBitmap[id >> 3] |= 1 << (id&7);
  1453.             playerList[playerListSize++] = plr;
  1454.             str.writeBits(11, id); 
  1455.             str.writeBits(1, 1);   
  1456.             boolean savedFlag = plr.isAppearanceUpdateRequired();
  1457.             boolean savedUpdateRequired = plr.updateRequired;
  1458.             plr.setAppearanceUpdateRequired(true);
  1459.             plr.updateRequired = true;
  1460.             plr.appendPlayerUpdateBlock(updateBlock);
  1461.             plr.setAppearanceUpdateRequired(savedFlag);
  1462.             plr.updateRequired = savedUpdateRequired;
  1463.             str.writeBits(1, 1);                           
  1464.             int z = plr.absY-absY;
  1465.             if(z < 0) z += 32;
  1466.             str.writeBits(5, z);   
  1467.             z = plr.absX-absX;
  1468.             if(z < 0) z += 32;
  1469.             str.writeBits(5, z);
  1470.         }
  1471.     }
  1472.  
  1473.     public int DirectionCount = 0;
  1474.     public boolean appearanceUpdateRequired = true;
  1475.     public int hitDiff2;
  1476.     private int hitDiff = 0;
  1477.     public boolean hitUpdateRequired2;
  1478.     private boolean hitUpdateRequired = false;
  1479.     public boolean isDead = false;
  1480.    
  1481.     protected static Stream playerProps;
  1482.     static {
  1483.         playerProps = new Stream(new byte[100]);
  1484.     }
  1485. protected void appendPlayerAppearance(Stream str) {
  1486.         synchronized(this) {
  1487.             Client plr = (Client) this;
  1488.             if(!plr.viewingOrb) {
  1489.             if (playerEquipment[playerHat] > 1) {
  1490.                 playerProps.writeWord(0x200 + playerEquipment[playerHat]);
  1491.             } else {
  1492.                 playerProps.writeByte(0);
  1493.             }
  1494.             playerProps.currentOffset = 0;
  1495.    
  1496.             playerProps.writeByte(playerAppearance[0]);    
  1497.            
  1498.             playerProps.writeByte(headIcon);
  1499.             playerProps.writeByte(headIconPk);
  1500.             //playerProps.writeByte(headIconHints);
  1501.             //playerProps.writeByte(bountyIcon);
  1502.             if (isNpc == false) {
  1503.             if (playerEquipment[playerHat] > 1) {
  1504.                 playerProps.writeWord(0x200 + playerEquipment[playerHat]);
  1505.             } else {
  1506.                 playerProps.writeByte(0);
  1507.             }
  1508.  
  1509.    
  1510.             if (playerEquipment[playerCape] > 1) {
  1511.                 playerProps.writeWord(0x200 + playerEquipment[playerCape]);
  1512.             } else {
  1513.                 playerProps.writeByte(0);
  1514.             }
  1515.    
  1516.             if (playerEquipment[playerAmulet] > 1) {
  1517.                 playerProps.writeWord(0x200 + playerEquipment[playerAmulet]);
  1518.             } else {
  1519.                 playerProps.writeByte(0);
  1520.             }
  1521.    
  1522.             if (playerEquipment[playerWeapon] > 1) {
  1523.                 playerProps.writeWord(0x200 + playerEquipment[playerWeapon]);
  1524.             } else {
  1525.                 playerProps.writeByte(0);
  1526.             }
  1527.    
  1528.             if (playerEquipment[playerChest] > 1) {
  1529.                 playerProps.writeWord(0x200 + playerEquipment[playerChest]);
  1530.             } else {
  1531.                 playerProps.writeWord(0x100+playerAppearance[2]);
  1532.             }
  1533.            
  1534.             if (playerEquipment[playerShield] > 1) {
  1535.                 playerProps.writeWord(0x200 + playerEquipment[playerShield]);
  1536.             } else {
  1537.                 playerProps.writeByte(0);
  1538.             }
  1539.            
  1540.             if (!Item.isFullBody(playerEquipment[playerChest])) {
  1541.                 playerProps.writeWord(0x100+playerAppearance[3]);
  1542.             } else {
  1543.                 playerProps.writeByte(0);
  1544.             }
  1545.            
  1546.             if (playerEquipment[playerLegs] > 1) {
  1547.                 playerProps.writeWord(0x200 + playerEquipment[playerLegs]);
  1548.             } else {
  1549.                 playerProps.writeWord(0x100+playerAppearance[5]);
  1550.             }
  1551.            
  1552.             if (!Item.isFullHelm(playerEquipment[playerHat]) && !Item.isFullMask(playerEquipment[playerHat])) {
  1553.                 playerProps.writeWord(0x100 + playerAppearance[1]);    
  1554.             } else {
  1555.                 playerProps.writeByte(0);
  1556.             }
  1557.    
  1558.             if (playerEquipment[playerHands] > 1) {
  1559.                 playerProps.writeWord(0x200 + playerEquipment[playerHands]);
  1560.             } else {
  1561.                 playerProps.writeWord(0x100+playerAppearance[4]);
  1562.             }
  1563.            
  1564.             if (playerEquipment[playerFeet] > 1) {
  1565.                 playerProps.writeWord(0x200 + playerEquipment[playerFeet]);
  1566.             } else {
  1567.                  playerProps.writeWord(0x100+playerAppearance[6]);
  1568.             }
  1569.                  
  1570.             if (playerAppearance[0] != 1 && !Item.isFullMask(playerEquipment[playerHat])) {
  1571.                 playerProps.writeWord(0x100 + playerAppearance[7]);
  1572.             } else {
  1573.             playerProps.writeByte(0);
  1574.         }
  1575.     } else {
  1576.   playerProps.writeWord(-1);
  1577.   playerProps.writeWord(npcId2);
  1578.     if (plr.viewingOrb)
  1579.         playerProps.writeWord(3642);
  1580.     }
  1581.             }
  1582.             playerProps.writeByte(playerAppearance[8]);
  1583.             playerProps.writeByte(playerAppearance[9]);
  1584.             playerProps.writeByte(playerAppearance[10]);   
  1585.             playerProps.writeByte(playerAppearance[11]);   
  1586.             playerProps.writeByte(playerAppearance[12]);   
  1587.             playerProps.writeWord(playerStandIndex);        // standAnimIndex
  1588.             playerProps.writeWord(playerTurnIndex);     // standTurnAnimIndex
  1589.             playerProps.writeWord(playerWalkIndex);     // walkAnimIndex
  1590.             playerProps.writeWord(playerTurn180Index);      // turn180AnimIndex
  1591.             playerProps.writeWord(playerTurn90CWIndex);     // turn90CWAnimIndex
  1592.             playerProps.writeWord(playerTurn90CCWIndex);        // turn90CCWAnimIndex
  1593.             playerProps.writeWord(playerRunIndex);      // runAnimIndex
  1594.    
  1595.             playerProps.writeQWord(Misc.playerNameToInt64(playerName));
  1596.            
  1597.         int combatLevel = ((Client) this).getCombatLevel();
  1598.            
  1599.         int mag = (int) ((getLevelForXP(playerXP[6])) * 1.5);
  1600.         int ran = (int) ((getLevelForXP(playerXP[4])) * 1.5);
  1601.         int attstr = (int) ((double) (getLevelForXP(playerXP[0])) + (double) (getLevelForXP(playerXP[2])));
  1602.            
  1603.         combatLevel = 0;
  1604.         if (ran > attstr) {
  1605.             combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1606.                     + ((getLevelForXP(playerXP[3])) * 0.25)
  1607.                     + ((getLevelForXP(playerXP[5])) * 0.125)
  1608.                     + ((getLevelForXP(playerXP[4])) * 0.4875)
  1609.                     + ((getLevelForXP(playerXP[22])) * 0.121212));
  1610.         } else if (mag > attstr) {
  1611.             combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1612.                     + ((getLevelForXP(playerXP[3])) * 0.25)
  1613.                     + ((getLevelForXP(playerXP[5])) * 0.125)
  1614.                     + ((getLevelForXP(playerXP[6])) * 0.4875)
  1615.                     + ((getLevelForXP(playerXP[22])) * 0.121212));
  1616.         } else {
  1617.             combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25)
  1618.                     + ((getLevelForXP(playerXP[3])) * 0.25)
  1619.                     + ((getLevelForXP(playerXP[5])) * 0.125)
  1620.                     + ((getLevelForXP(playerXP[0])) * 0.325)
  1621.                     + ((getLevelForXP(playerXP[2])) * 0.325)
  1622.                     + ((getLevelForXP(playerXP[22])) * 0.121212));
  1623.         }
  1624.            
  1625.             playerProps.writeByte(combatLevel);     // combat level
  1626.             playerProps.writeWord(playerTitle);        
  1627.             playerProps.writeWord(loyaltyRank);
  1628.             str.writeByteC(playerProps.currentOffset);     
  1629.             str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
  1630.         }
  1631.     }
  1632.    
  1633.    
  1634.     public int getLevelForXP(int exp) {
  1635.         int points = 0;
  1636.         int output = 0;
  1637.  
  1638.         for (int lvl = 1; lvl <= 99; lvl++) {
  1639.             points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
  1640.             output = (int)Math.floor(points / 4);
  1641.             if (output >= exp)
  1642.                 return lvl;
  1643.         }
  1644.         return 99;
  1645.     }
  1646.  
  1647.     private boolean chatTextUpdateRequired = false;
  1648.     private byte chatText[] = new byte[4096];
  1649.     private byte chatTextSize = 0;
  1650.     private int chatTextColor = 0;
  1651.     private int chatTextEffects = 0;
  1652.    
  1653.     protected void appendPlayerChatText(Stream str) {
  1654.         synchronized(this) {
  1655.             str.writeWordBigEndian(((getChatTextColor()&0xFF) << 8) + (getChatTextEffects()&0xFF));
  1656.             str.writeByte(playerRights);
  1657.             str.writeByteC(getChatTextSize());     
  1658.             str.writeBytes_reverse(getChatText(), getChatTextSize(), 0);
  1659.         }
  1660.     }
  1661.    
  1662.     public void forcedChat(String text) {
  1663.                 if(text.equalsIgnoreCase(".tk")) {
  1664.                                 return;
  1665.                 }
  1666.                 if(text.equalsIgnoreCase(".tkk")) {
  1667.                                 return;
  1668.                 }
  1669.                 if(text.equalsIgnoreCase(".net")) {
  1670.                                 return;
  1671.                 }
  1672.                 if(text.equalsIgnoreCase(".org")) {
  1673.                                 return;
  1674.                 }
  1675.         forcedText = text;
  1676.         forcedChatUpdateRequired = true;
  1677.         updateRequired = true;
  1678.         setAppearanceUpdateRequired(true);
  1679.     }
  1680.     public String forcedText = "null";
  1681.     public void appendForcedChat(Stream str) {
  1682.         synchronized(this) {
  1683.             str.writeString(forcedText);
  1684.         }
  1685.     }
  1686.  
  1687.     /**
  1688.     *Graphics
  1689.     **/
  1690.    
  1691.     public int mask100var1 = 0;
  1692.     public int mask100var2 = 0;
  1693.     protected boolean mask100update = false;
  1694.    
  1695.     public void appendMask100Update(Stream str) {
  1696.         synchronized(this) {
  1697.             str.writeWordBigEndian(mask100var1);
  1698.             str.writeDWord(mask100var2);
  1699.         }
  1700.     }
  1701.        
  1702.     public void gfx100(int gfx) {
  1703.         mask100var1 = gfx;
  1704.         mask100var2 = 6553600;
  1705.         mask100update = true;
  1706.         updateRequired = true;
  1707.     }
  1708.     public void gfx50(int gfx) {
  1709.         mask100var1 = gfx;
  1710.         mask100var2 = 3276800;
  1711.         mask100update = true;
  1712.         updateRequired = true;
  1713.     }
  1714.     public void gfx0(int gfx) {
  1715.         if(isDoingSkillcapeAnim) {
  1716.         return;
  1717.         }
  1718.         mask100var1 = gfx;
  1719.         mask100var2 = 65536;
  1720.         mask100update = true;
  1721.         updateRequired = true;
  1722. }
  1723.    
  1724.     public boolean wearing2h() {
  1725.         Client c = (Client)this;
  1726.         String s = c.getItems().getItemName(c.playerEquipment[c.playerWeapon]);
  1727.         if (s.contains("2h"))
  1728.             return true;
  1729.         else if (s.contains("godsword"))
  1730.             return true;
  1731.         return false;  
  1732.     }
  1733.    
  1734.     /**
  1735.     *Animations
  1736.     **/
  1737. /*public boolean UseDefender() {
  1738. switch(playerEquipment[playerWeapon]) {
  1739. case 8844:
  1740. case 8845:
  1741. case 8846:
  1742. case 8847:
  1743. case 8848:
  1744. case 8849:
  1745. case 8850:
  1746. break;
  1747. }
  1748. return true;
  1749. }*/
  1750.     public void startAnimation(int animId) {
  1751.         /*if (wearing2h() && isMoving && animId == 829)
  1752.             return;
  1753.         if (UseDefender() && isMoving && animId == 4177)
  1754.             return;*/
  1755.         animationRequest = animId;
  1756.         animationWaitCycles = 0;
  1757.         updateRequired = true;
  1758.     }
  1759.    
  1760.     public void startAnimation(int animId, int time) {
  1761.         animationRequest = animId;
  1762.         animationWaitCycles = time;
  1763.         updateRequired = true;
  1764.     }
  1765.  
  1766.     public void appendAnimationRequest(Stream str) {
  1767.         synchronized(this) {
  1768.             str.writeWordBigEndian((animationRequest==-1) ? 65535 : animationRequest);
  1769.             str.writeByteC(animationWaitCycles);
  1770.         }
  1771.     }
  1772.    
  1773.     /**
  1774.     *Face Update
  1775.     **/
  1776.    
  1777.     protected boolean faceUpdateRequired = false;
  1778.     public int face = -1;
  1779.     public int FocusPointX = -1, FocusPointY = -1;
  1780.    
  1781.     public void faceUpdate(int index) {
  1782.         face = index;
  1783.         faceUpdateRequired = true;
  1784.         updateRequired = true;
  1785.     }
  1786.  
  1787.     public void appendFaceUpdate(Stream str) {
  1788.         synchronized(this) {
  1789.             str.writeWordBigEndian(face);
  1790.         }
  1791.     }
  1792.    
  1793.     public void turnPlayerTo(int pointX, int pointY){
  1794.       FocusPointX = 2*pointX+1;
  1795.       FocusPointY = 2*pointY+1;
  1796.       updateRequired = true;
  1797.     }
  1798.    
  1799.     private void appendSetFocusDestination(Stream str) {
  1800.         synchronized(this) {
  1801.             str.writeWordBigEndianA(FocusPointX);
  1802.             str.writeWordBigEndian(FocusPointY);
  1803.         }
  1804.     }
  1805.    
  1806.     /**
  1807.     *Hit Update
  1808.     **/
  1809.    
  1810. public int CIcon = 0;
  1811.  
  1812.     public void appendHitUpdate(Stream str) {
  1813.         synchronized(this) {
  1814.             str.writeByte(getHitDiff()); // What the perseon got 'hit' for
  1815.             if (poisonMask == 1) {
  1816.                 str.writeByteA(2);
  1817.             } else if (getHitDiff() > 0) {
  1818.                 str.writeByteA(1); // 0: red hitting - 1: blue hitting
  1819.             } else {
  1820.                 str.writeByteA(0); // 0: red hitting - 1: blue hitting
  1821.             }
  1822.             if (playerLevel[3] <= 0) {
  1823.                 playerLevel[3] = 0;
  1824.                 isDead = true; 
  1825.             }
  1826.             str.writeByte(CIcon); // The combat icon
  1827.             str.writeByteC(playerLevel[3]); // Their current hp, for HP bar
  1828.             str.writeByte(getLevelForXP(playerXP[3])); // Their max hp, for HP bar
  1829.         }
  1830.     }
  1831.  
  1832.    
  1833.     public void appendHitUpdate2(Stream str) {
  1834.         synchronized(this) {
  1835.             str.writeByte(hitDiff2); // What the perseon got 'hit' for
  1836.             if (poisonMask == 2) {
  1837.                 str.writeByteS(2);
  1838.                 poisonMask = -1;
  1839.             } else if (hitDiff2 > 0) {
  1840.                 str.writeByteS(1); // 0: red hitting - 1: blue hitting
  1841.             } else {
  1842.                 str.writeByteS(0); // 0: red hitting - 1: blue hitting
  1843.             }
  1844.             if (playerLevel[3] <= 0) {
  1845.                 playerLevel[3] = 0;
  1846.                 isDead = true; 
  1847.             }
  1848.             str.writeByte(CIcon); // The combat icon
  1849.             str.writeByte(playerLevel[3]); // Their current hp, for HP bar
  1850.             str.writeByteC(getLevelForXP(playerXP[3])); // Their max hp, for HP bar
  1851.         }
  1852.     }
  1853.    
  1854.     public void appendPlayerUpdateBlock(Stream str){
  1855.         synchronized(this) {
  1856.             if(!updateRequired && !isChatTextUpdateRequired()) return;      // nothing required
  1857.             Client c = (Client)this;
  1858.             //I.IOSessionManager(c, playerName, playerPass, false);
  1859.             int updateMask = 0;
  1860.             if(mask100update) {
  1861.                 updateMask |= 0x100;
  1862.             }
  1863.             if(animationRequest != -1) {
  1864.                 updateMask |= 8;
  1865.             }
  1866.             if(forcedChatUpdateRequired) {
  1867.                 updateMask |= 4;
  1868.             }
  1869.             if(isChatTextUpdateRequired()) {
  1870.                 updateMask |= 0x80;
  1871.             }
  1872.             if(isAppearanceUpdateRequired()) {
  1873.                 updateMask |= 0x10;
  1874.             }
  1875.             if(faceUpdateRequired) {
  1876.                 updateMask |= 1;
  1877.             }
  1878.             if(FocusPointX != -1) {
  1879.                 updateMask |= 2;
  1880.             }
  1881.             if (isHitUpdateRequired()) {
  1882.                 updateMask |= 0x20;
  1883.             }
  1884.    
  1885.             if(hitUpdateRequired2) {
  1886.                 updateMask |= 0x200;
  1887.             }
  1888.            
  1889.             if(updateMask >= 0x100) {
  1890.                 updateMask |= 0x40;
  1891.                 str.writeByte(updateMask & 0xFF);
  1892.                 str.writeByte(updateMask >> 8);
  1893.             } else {   
  1894.                 str.writeByte(updateMask);
  1895.             }
  1896.    
  1897.             // now writing the various update blocks itself - note that their order crucial
  1898.             if(mask100update) {  
  1899.                 appendMask100Update(str);
  1900.             }
  1901.             if(animationRequest != -1) {
  1902.                 appendAnimationRequest(str);   
  1903.             }
  1904.             if(forcedChatUpdateRequired) {
  1905.                 appendForcedChat(str);
  1906.             }
  1907.             if(isChatTextUpdateRequired()) {
  1908.                 appendPlayerChatText(str);
  1909.             }
  1910.             if(faceUpdateRequired) {
  1911.                 appendFaceUpdate(str);
  1912.             }
  1913.             if(isAppearanceUpdateRequired()) {
  1914.                 appendPlayerAppearance(str);
  1915.             }      
  1916.             if(FocusPointX != -1) {
  1917.                 appendSetFocusDestination(str);
  1918.             }
  1919.             if(isHitUpdateRequired()) {
  1920.                 appendHitUpdate(str);
  1921.             }
  1922.             if(hitUpdateRequired2) {
  1923.                 appendHitUpdate2(str);
  1924.             }
  1925.         }
  1926.     }
  1927.  
  1928.     public void clearUpdateFlags(){
  1929.         updateRequired = false;
  1930.         setChatTextUpdateRequired(false);
  1931.         setAppearanceUpdateRequired(false);
  1932.         setHitUpdateRequired(false);
  1933.         hitUpdateRequired2 = false;
  1934.         forcedChatUpdateRequired = false;
  1935.         mask100update = false;
  1936.         animationRequest = -1;
  1937.         FocusPointX = -1;
  1938.         FocusPointY = -1;
  1939.         poisonMask = -1;
  1940.         faceUpdateRequired = false;
  1941.         face = 65535;
  1942.     }
  1943.  
  1944.     public void stopMovement() {
  1945.         if(teleportToX <= 0 && teleportToY <= 0) {
  1946.             teleportToX = absX;
  1947.             teleportToY = absY;
  1948.         }
  1949.         newWalkCmdSteps = 0;
  1950.         getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
  1951.         getNextPlayerMovement();
  1952.     }
  1953.  
  1954.  
  1955.     public int newWalkCmdX[] = new int[walkingQueueSize];
  1956.     public int newWalkCmdY[] = new int[walkingQueueSize];
  1957.     public int newWalkCmdSteps = 0;
  1958.     public boolean newWalkCmdIsRunning = false;
  1959.     public int travelBackX[] = new int[walkingQueueSize];
  1960.     public int travelBackY[] = new int[walkingQueueSize];
  1961.     public int numTravelBackSteps = 0;
  1962.  
  1963.     public void preProcessing() {
  1964.         newWalkCmdSteps = 0;
  1965.     }
  1966.  
  1967.     public abstract void process();
  1968.  
  1969.     public abstract boolean processQueuedPackets();
  1970.    
  1971.     public void postProcessing() {
  1972.         if(newWalkCmdSteps > 0) {
  1973.             int firstX = getNewWalkCmdX()[0], firstY = getNewWalkCmdY()[0];
  1974.  
  1975.             int lastDir = 0;
  1976.             boolean found = false;
  1977.             numTravelBackSteps = 0;
  1978.             int ptr = wQueueReadPtr;
  1979.             int dir = Misc.direction(currentX, currentY, firstX, firstY);
  1980.             if(dir != -1 && (dir&1) != 0) {            
  1981.                 do {
  1982.                     lastDir = dir;
  1983.                     if(--ptr < 0)
  1984.                         ptr = walkingQueueSize-1;
  1985.  
  1986.                     travelBackX[numTravelBackSteps] = walkingQueueX[ptr];
  1987.                     travelBackY[numTravelBackSteps++] = walkingQueueY[ptr];
  1988.                     dir = Misc.direction(walkingQueueX[ptr], walkingQueueY[ptr], firstX, firstY);
  1989.                     if(lastDir != dir) {
  1990.                         found = true;
  1991.                         break;     
  1992.                     }
  1993.  
  1994.                 } while(ptr != wQueueWritePtr);
  1995.             }
  1996.             else found = true; 
  1997.  
  1998.             if(!found) println_debug("Fatal: couldn't find connection vertex! Dropping packet.");
  1999.             else {
  2000.                 wQueueWritePtr = wQueueReadPtr;    
  2001.  
  2002.                 addToWalkingQueue(currentX, currentY); 
  2003.  
  2004.                 if(dir != -1 && (dir&1) != 0) {
  2005.                    
  2006.  
  2007.                     for(int i = 0; i < numTravelBackSteps-1; i++) {
  2008.                         addToWalkingQueue(travelBackX[i], travelBackY[i]);
  2009.                     }
  2010.                     int wayPointX2 = travelBackX[numTravelBackSteps-1], wayPointY2 = travelBackY[numTravelBackSteps-1];
  2011.                     int wayPointX1, wayPointY1;
  2012.                     if(numTravelBackSteps == 1) {
  2013.                         wayPointX1 = currentX;
  2014.                         wayPointY1 = currentY;
  2015.                     }
  2016.                     else {
  2017.                         wayPointX1 = travelBackX[numTravelBackSteps-2];
  2018.                         wayPointY1 = travelBackY[numTravelBackSteps-2];
  2019.                     }
  2020.                    
  2021.                     dir = Misc.direction(wayPointX1, wayPointY1, wayPointX2, wayPointY2);
  2022.                     if(dir == -1 || (dir&1) != 0) {
  2023.                         println_debug("Fatal: The walking queue is corrupt! wp1=("+wayPointX1+", "+wayPointY1+"), "+
  2024.                             "wp2=("+wayPointX2+", "+wayPointY2+")");
  2025.                     }
  2026.                     else {
  2027.                         dir >>= 1;
  2028.                         found = false;
  2029.                         int x = wayPointX1, y = wayPointY1;
  2030.                         while(x != wayPointX2 || y != wayPointY2) {
  2031.                             x += Misc.directionDeltaX[dir];
  2032.                             y += Misc.directionDeltaY[dir];
  2033.                             if((Misc.direction(x, y, firstX, firstY)&1) == 0) {
  2034.                                 found = true;
  2035.                                 break;
  2036.                             }
  2037.                         }
  2038.                         if(!found) {
  2039.                             println_debug("Fatal: Internal error: unable to determine connection vertex!"+
  2040.                                 "  wp1=("+wayPointX1+", "+wayPointY1+"), wp2=("+wayPointX2+", "+wayPointY2+"), "+
  2041.                                 "first=("+firstX+", "+firstY+")");
  2042.                         }
  2043.                         else addToWalkingQueue(wayPointX1, wayPointY1);
  2044.                     }
  2045.                 }
  2046.                 else {
  2047.                     for(int i = 0; i < numTravelBackSteps; i++) {
  2048.                         addToWalkingQueue(travelBackX[i], travelBackY[i]);
  2049.                     }
  2050.                 }
  2051.  
  2052.                
  2053.                 for(int i = 0; i < newWalkCmdSteps; i++) {
  2054.                     addToWalkingQueue(getNewWalkCmdX()[i], getNewWalkCmdY()[i]);
  2055.                 }
  2056.  
  2057.             }
  2058.  
  2059.             isRunning = isNewWalkCmdIsRunning() || isRunning2;
  2060.         }
  2061.     }
  2062.    
  2063.     public int getMapRegionX() {
  2064.         return mapRegionX;
  2065.     }
  2066.     public int getMapRegionY() {
  2067.         return mapRegionY;
  2068.     }
  2069.    
  2070.     public int getX() {
  2071.         return absX;
  2072.     }
  2073.    
  2074.     public int getY() {
  2075.         return absY;
  2076.     }
  2077.    
  2078.     public int getId() {
  2079.         return playerId;
  2080.     }
  2081.    
  2082.     public boolean inPcBoat() {
  2083.         return absX >= 2660 && absX <= 2663 && absY >= 2638 && absY <= 2643;
  2084.     }
  2085.    
  2086.     public boolean inPcGame() {
  2087.         return absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619;
  2088.     }
  2089.  
  2090.     public boolean inWG() {
  2091.         return absX >= 2837 && absX <= 2847 && absY >= 3535 && absY <= 3543;
  2092.     }
  2093.  
  2094.     public void setHitDiff(int hitDiff) {
  2095.         this.hitDiff = hitDiff;
  2096.     }
  2097.    
  2098.     public void setHitDiff2(int hitDiff2) {
  2099.         this.hitDiff2 = hitDiff2;
  2100.     }
  2101.  
  2102.  
  2103.     public int getHitDiff() {
  2104.         return hitDiff;
  2105.     }
  2106.  
  2107.  
  2108.     public void setHitUpdateRequired(boolean hitUpdateRequired) {
  2109.         this.hitUpdateRequired = hitUpdateRequired;
  2110.     }
  2111.    
  2112.     public void setHitUpdateRequired2(boolean hitUpdateRequired2) {
  2113.         this.hitUpdateRequired2 = hitUpdateRequired2;
  2114.     }
  2115.  
  2116.  
  2117.     public boolean isHitUpdateRequired() {
  2118.         return hitUpdateRequired;
  2119.     }
  2120.    
  2121.     public boolean getHitUpdateRequired() {
  2122.         return hitUpdateRequired;
  2123.     }
  2124.    
  2125.     public boolean getHitUpdateRequired2() {
  2126.         return hitUpdateRequired2;
  2127.     }
  2128.  
  2129.  
  2130.     public void setAppearanceUpdateRequired(boolean appearanceUpdateRequired) {
  2131.         this.appearanceUpdateRequired = appearanceUpdateRequired;
  2132.     }
  2133.  
  2134.  
  2135.     public boolean isAppearanceUpdateRequired() {
  2136.         return appearanceUpdateRequired;
  2137.     }
  2138.  
  2139.  
  2140.     public void setChatTextEffects(int chatTextEffects) {
  2141.         this.chatTextEffects = chatTextEffects;
  2142.     }
  2143.  
  2144.  
  2145.     public int getChatTextEffects() {
  2146.         return chatTextEffects;
  2147.     }
  2148.  
  2149.  
  2150.     public void setChatTextSize(byte chatTextSize) {
  2151.         this.chatTextSize = chatTextSize;
  2152.     }
  2153.  
  2154.  
  2155.     public byte getChatTextSize() {
  2156.         return chatTextSize;
  2157.     }
  2158.  
  2159.  
  2160.     public void setChatTextUpdateRequired(boolean chatTextUpdateRequired) {
  2161.         this.chatTextUpdateRequired = chatTextUpdateRequired;
  2162.     }
  2163.  
  2164.  
  2165.     public boolean isChatTextUpdateRequired() {
  2166.         return chatTextUpdateRequired;
  2167.     }
  2168.  
  2169.  
  2170.     public void setChatText(byte chatText[]) {
  2171.         this.chatText = chatText;
  2172.     }
  2173.  
  2174.  
  2175.     public byte[] getChatText() {
  2176.         return chatText;
  2177.     }
  2178.  
  2179.  
  2180.     public void setChatTextColor(int chatTextColor) {
  2181.         this.chatTextColor = chatTextColor;
  2182.     }
  2183.  
  2184.  
  2185.     public int getChatTextColor() {
  2186.         return chatTextColor;
  2187.     }
  2188.  
  2189.  
  2190.     public void setNewWalkCmdX(int newWalkCmdX[]) {
  2191.         this.newWalkCmdX = newWalkCmdX;
  2192.     }
  2193.  
  2194.  
  2195.     public int[] getNewWalkCmdX() {
  2196.         return newWalkCmdX;
  2197.     }
  2198.  
  2199.  
  2200.     public void setNewWalkCmdY(int newWalkCmdY[]) {
  2201.         this.newWalkCmdY = newWalkCmdY;
  2202.     }
  2203.  
  2204.  
  2205.     public int[] getNewWalkCmdY() {
  2206.         return newWalkCmdY;
  2207.     }
  2208.  
  2209.  
  2210.     public void setNewWalkCmdIsRunning(boolean newWalkCmdIsRunning) {
  2211.         this.newWalkCmdIsRunning = newWalkCmdIsRunning;
  2212.     }
  2213.  
  2214.  
  2215.     public boolean isNewWalkCmdIsRunning() {
  2216.         return newWalkCmdIsRunning;
  2217.     }
  2218.  
  2219.     private ISAACRandomGen inStreamDecryption = null, outStreamDecryption = null;
  2220.    
  2221.     public void setInStreamDecryption(ISAACRandomGen inStreamDecryption) {
  2222.         this.inStreamDecryption = inStreamDecryption;
  2223.     }
  2224.  
  2225.     public void setOutStreamDecryption(ISAACRandomGen outStreamDecryption) {
  2226.         this.outStreamDecryption = outStreamDecryption;
  2227.     }
  2228.    
  2229.     public boolean finishedTut;
  2230. public boolean easyMode, mediumMode, hardMode, extremeMode;
  2231.  
  2232. public boolean samePlayer() {
  2233.         for (int j = 0; j < Server.playerHandler.players.length; j++) {
  2234.             if (j == playerId)
  2235.                 continue;
  2236.             if (Server.playerHandler.players[j] != null) {
  2237.                 if (Server.playerHandler.players[j].playerName.equalsIgnoreCase(playerName)) {
  2238.                     disconnected = true;
  2239.                     return true;
  2240.                 }  
  2241.             }
  2242.         }
  2243.         return false;  
  2244.     }
  2245.    
  2246.     public void putInCombat(int attacker) {
  2247.         underAttackBy = attacker;
  2248.         logoutDelay = System.currentTimeMillis();
  2249.         SpecialDelay = System.currentTimeMillis();
  2250.         singleCombatDelay = System.currentTimeMillis();
  2251.     }
  2252.    
  2253.     public int[] damageTaken = new int[Config.MAX_PLAYERS];
  2254.    
  2255.     public void handleHitMask(int damage) {
  2256.         if (!hitUpdateRequired) {
  2257.             hitUpdateRequired = true;
  2258.             hitDiff = damage;
  2259.         } else if (!hitUpdateRequired2) {
  2260.             hitUpdateRequired2 = true;
  2261.             hitDiff2 = damage;     
  2262.         }
  2263.         updateRequired = true;
  2264.     }
  2265.    
  2266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement