Advertisement
Guest User

Untitled

a guest
May 12th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 139.60 KB | None | 0 0
  1. /*
  2. * Class Player
  3. *
  4. * Version 1.0
  5. *
  6. * Thursday, August 14, 2008
  7. *
  8. * Created by Palidino76 Codeusa
  9. */
  10.  
  11. package net.com.codeusa.model;
  12.  
  13. import java.io.FileWriter;
  14. import java.io.BufferedReader;
  15. import java.io.BufferedWriter;
  16. import java.io.FileReader;
  17. import java.io.IOException;
  18. import java.net.Socket;
  19. import java.util.*;
  20. import java.lang.*;
  21. import net.com.codeusa.test.TestWorldLoader;
  22. import net.com.codeusa.model.misc.*;
  23. import net.com.codeusa.model.games.*;
  24. import net.com.codeusa.clanchat.ClanChat;
  25. import net.com.codeusa.model.skills.*;
  26. import net.com.codeusa.model.combat.*;
  27. import net.com.codeusa.model.quest.*;
  28. import net.com.codeusa.*;
  29. import net.com.codeusa.io.*;
  30. import net.com.codeusa.net.PlayerSocket;
  31. import net.com.codeusa.util.ByteVector;
  32. import net.com.codeusa.util.Misc;
  33. import net.com.codeusa.npcs.NPC;
  34. import net.com.codeusa.model.items.*;
  35. import net.com.codeusa.model.items.PlayerWeapon;
  36. import net.com.codeusa.model.ptrade.PTrade;
  37.  
  38. public class Player implements Entity {
  39.  
  40. /* Pvp Degrading Author Tim*/
  41. public int vls = 325;//Vesta longsword
  42. public int sw = 325;//Statius Warhammer
  43. public int vs = 325;//Vesta's Spear
  44. public int zs = 325;//Zuriel's Staff
  45. public int stpl = 325;//Statius's Platebody
  46. public int stl = 325;//Statius's Platelegs
  47. public int sth = 325;//Statius's Fullhelm
  48. public int vch = 325;//Vesta's Chainbody
  49. public int vps = 325;//Vesta's Plateskirt
  50. public int mc = 325;//Morrigan's Coif
  51. public int ml = 325;//Morrigans Leather body
  52. public int mlc = 325;//Morrigans leather chaps
  53. public int zrt = 325;//Zuriel Robe top
  54. public int zrh = 325;//Zuriel robe hat
  55. public int zrb = 325;//Zuriel Robe Bottom
  56. public int cvls = 150;//Vesta longsword
  57. public int csw = 150;//Statius Warhammer
  58. public int cvs = 150;//Vesta's Spear
  59. public int czs = 150;//Zuriel's Staff
  60. public int cstpl = 150;//Statius's Platebody
  61. public int cstl = 150;//Statius's Platelegs
  62. public int csth = 150;//Statius's Fullhelm
  63. public int cvch = 150;//Vesta's Chainbody
  64. public int cvps = 150;//Vesta's Plateskirt
  65. public int cmc = 150;//Morrigan's Coif
  66. public int cml = 150;//Morrigans Leather body
  67. public int cmlc = 150;//Morrigans leather chaps
  68. public int czrt = 150;//Zuriel Robe top
  69. public int czrh = 150;//Zuriel robe hat
  70. public int czrb = 150;//Zuriel Robe Bottom
  71. /* End Of Degrading */
  72.  
  73. public boolean noteItems = false;
  74. public String clanRoom = "";
  75. public List<Long> friends = new ArrayList<Long>(200);
  76. public List<Long> ignores = new ArrayList<Long>(100);
  77. /*
  78. * AutoCasting
  79. * Tim
  80. *
  81. */
  82. public int autocastSpell = 0;
  83. public boolean autocast = false;
  84. public int autocastSpellbook = 0;
  85.  
  86. public boolean specdeleh;
  87. public boolean inLowBounty = false;
  88. public boolean inMedBounty = false;
  89. public boolean inHighBounty = false;
  90. public int bountyMaxPlayers = 100;
  91. public boolean bountyInterface = false;
  92. public int BhTimer;
  93. public int leftBhTimer = 0;
  94. public int bhPickup;
  95. public int bhLeave;
  96. public int bhTarget = 0;
  97. public int switchSpells = 0;
  98. public int fleeTimer = 0;
  99. public int bhLeave1;
  100. public boolean inBounty = false;
  101. public int serverMsg;
  102. public int pickedUp;
  103. public int InBounty = 0;
  104.  
  105. /*Miasmic Spell timer*/
  106. public int miasmicSpell;
  107.  
  108. public transient int hitDelay = 0;
  109. public int direction = 0;
  110.  
  111. public int followPlayer;
  112. public boolean followingPlayer;
  113. public int playFollow;
  114.  
  115. public boolean DFSSpecial;
  116. public long lastDFS;
  117. public int DFSDelay = -1;
  118.  
  119. public int points = 0; //bandos
  120. public int apoints = 0; //armadyl
  121. public int spoints = 0; //saradomin
  122. public int zpoints = 0; //zamorak
  123.  
  124. public boolean wildWarned = false;
  125. public boolean swapAsNote = false;
  126.  
  127. public boolean initialAttack;
  128.  
  129. public int PlayerItems;
  130.  
  131. public boolean dboltspecial;
  132. public boolean diamondboltspecial;
  133. public boolean morriganjavs;
  134. public boolean morriganaxes;
  135.  
  136. public String nameSet;
  137. public int setDrop;
  138.  
  139. public int KC;
  140. public int DC;
  141.  
  142. public int msgTimer = 8;
  143. public int safeTimer = 0;
  144. public boolean underAttack = false;
  145. public boolean inWild = false;
  146. public boolean safed = false;
  147.  
  148. public String chatName;
  149. public final String ACTIVE_CHAT_DEFAULT = "NewEra";
  150. public String activeChat = ACTIVE_CHAT_DEFAULT;
  151. public final String ACTIVE_CHAT_OWNER_DEFAULT = "Public Channel";
  152. public String activeChatOwner = ACTIVE_CHAT_OWNER_DEFAULT;
  153.  
  154. String[][] itemPrices = {{"Warrior helm", "536"}, {"Dwarf remains", "1000000000"}, {"Enchanted robe", "495"}, {"Enchanted top", "741"}, {"Enchanted hat", "89"}, {"Adamant knife", "2"}, {"Adamant knife(p)", "4"}, {"Adamant knife(p+)", "5"}, {"Adamant knife(p++)", "13"}, {"Adamant dart", "1"}, {"Adamant dart(p)", "3"}, {"Adamant dart(p+)", "4"}, {"Adamant dart(p++)", "12"}, {"Tzhaar-ket-em", "891"}, {"Barrelchest anchor", "2300"}, {"Crystal bow full", "9000"}, {"Crystal shield full", "9000"}, {"Rune chainbody", "315"}, {"Zamorakian spear", "14395"}, {"Saradomin staff", "800"}, {"Guthix staff", "800"}, {"Zamorak staff", "800"}, {"Bolt rack", "2"}, {"Santa hat", "131601"}, {"Tuna potato", "14"}, {"Wizard boots", "3319"}, {"Regen bracelet", "2570"}, {"Combat bracelet", "137"}, {"Combat bracelet(1)", "137"}, {"Combat bracelet(2)", "137"}, {"Combat bracelet(3)", "137"}, {"Combat bracelet(4)", "137"}, {"Splitbark body", "271"}, {"Splitbark boots", "28"}, {"Splitbark gauntlets", "28"}, {"Splitback helm", "59"}, {"Splitback legs", "240"}, {"Dwarven helmet", "358"}, {"Abyssal whip", "14570"}, {"Fire cape", "10000"}, {"Armadyl godsword", "675018"}, {"Bandos godsword", "188580"}, {"Saradomin godsword", "496437"}, {"Zamorak godsword", "267983"}, {"Dragon med helm", "885"}, {"Dragon sq shield", "5630"}, {"Dragon dagger", "292"}, {"Dragon dagger(p)", "305"}, {"Dragon dagger(p+)", "312"}, {"Drag dagger(p++)", "350"}, {"Dragon spear", "451"}, {"Dragon spear(p)", "460"}, {"Dragon spear(p+)", "465"}, {"Dragon spear(p++)", "506"}, {"Dragon longsword", "956"}, {"Dragon battleaxe", "1200"}, {"Dragon mace", "298"}, {"Dragon claws", "277832"}, {"Dragon chainbody", "50565"}, {"Dragon halberd", "1948"}, {"Dragon platelegs", "6323"}, {"Dragon plateskirt", "1979"}, {"Dragon scimitar", "998"}, {"Dragon platebody", "99230"}, {"Dragon axe", "16880"}, {"Dragon 2h sword", "8921"}, {"Dragon bolts (e)", "46"}, {"Diamond bolts (e)", "8"}, {"Dragon arrow", "29"}, {"Dragon arrow(p)", "31"}, {"Dragon arrow(p+)", "32"}, {"Dragon arrow(p++)", "40"}, {"Dragon fire arrows", "26"}, {"Dragonfire shield", "177038"}, {"Dragon full helm", "125349"}, {"Dragon boots", "2407"}, {"Dragon dart", "6"}, {"Dragon dart(p)", "8"}, {"Dragon dart(p+)", "9"}, {"Dragon dart(p++)", "17"}, {"Dragon bones", "24"}, {"Big bones", "3"}, {"Astral rune", "1"}, {"Blood rune", "3"}, {"Death rune", "3"}, {"Law rune", "3"}, {"Nature rune", "2"}, {"Soul rune", "3"}, {"Rune arrow", "2"}, {"Rune arrow(p)", "4"}, {"Rune arrow(p+)", "5"}, {"Rune arrow(p++)", "13"}, {"Rune fire arrows", "2"}, {"Rune c'bow", "95"}, {"Rune dart", "2"}, {"Rune dart(p)", "4"}, {"Rune dart(p+)", "5"}, {"Rune dart(p++)", "13"}, {"Rune fire arrows", "2"}, {"Rune full helm (t)", "3160"}, {"Rune full helm(g)", "4792"}, {"Rune kiteshield (g)", "4307"}, {"Rune kiteshield (t)", "2838"}, {"Rune platebody (g)", "6296"}, {"Rune platebody (t)", "3995"}, {"Rune platelegs (g)", "6296"}, {"Rune platelegs (t)", "2076"}, {"Rune plateskirt (g)", "639"}, {"Rune plateskirt (t)", "569"}, {"Rune full helm", "211"}, {"Rune boots", "460"}, {"Rune kiteshield", "499"}, {"Rune med helm", "114"}, {"Rune platebody", "578"}, {"Rune platelegs", "507"}, {"Rune plateskirt", "443"}, {"Rune sq shield", "230"}, {"Rune thrownaxe", "3"}, {"Gilded full helm", "3957"}, {"Gilded kiteshield", "4460"}, {"Gilded platebody", "15019"}, {"Gilded platelegs", "5902"}, {"Gilded plateskirt", "1618"}, {"Guthix full helm", "38888"}, {"Guthix kiteshield", "3763"}, {"Guthix platebody", "6185"}, {"Guthix platelegs", "2935"}, {"Guthix plateskirt", "577"}, {"Saradomin full", "8430"}, {"Saradomin kite", "8776"}, {"Saradomin plate", "16213"}, {"Saradomin legs", "3694"}, {"Saradomin skirt", "1003"}, {"Zamorak full helm", "5814"}, {"Zamorak kiteshield", "6221"}, {"Zamorak platebody", "11047"}, {"Zamorak platelegs", "3534"}, {"Zamorak plateskirt", "991"}, {"Adam full helm(g)", "1121"}, {"Adam full helm(t)", "601"}, {"Adam kiteshield (g)", "1159"}, {"Adam kiteshield (t)", "414"}, {"Adam platebody (g)", "2009"}, {"Adam platebody (t)", "908"}, {"Adam platelegs (g)", "792"}, {"Adam plateskirt (t)", "152"}, {"Adamant arrow", "1"}, {"Adamant arrow(p)", "3"}, {"Adamant arrow(p+)", "4"}, {"Adamant arrow(p++)", "12"}, {"Adamant fire arrows", "9"}, {"Adamant javelin", "1"}, {"Adamant javelin(p)", "3"}, {"Adamant javelin(p+)", "4"}, {"Adamant javelin(p++)", "12"}, {"Adamant chainbody", "27"}, {"Adamant boots", "20"}, {"Adamant full helm", "23"}, {"Adamant kiteshield", "31"}, {"Adamant platebody", "98"}, {"Adamant platelegs", "37"}, {"Adamant plateskirt", "37"}, {"Adamant med helm", "12"}, {"Adamant thrownaxe", "1"}, {"Adamant spear", "10"}, {"Adamant spear(p)", "20"}, {"Adamant spear(p+)", "25"}, {"Adamant spear(p++)", "66"}, {"Spined boots", "36"}, {"Spined gloves", "17"}, {"Spined body", "45"}, {"Spined chaps", "21"}, {"Spined helm", "358"}, {"Rock-shell boots", "11"}, {"Rock-shell gloves", "28"}, {"Rock-shell helm", "209"}, {"Rock-shell legs", "486"}, {"Rock-shell plate", "397"}, {"Skeletal boots", "194"}, {"Skeletal bottoms", "238"}, {"Skeletal gloves", "432"}, {"Skeletal helm", "58"}, {"Skeletal top", "267"}, {"Archers ring", "5783"}, {"Berserker ring", "18367"}, {"Seer's ring", "599"}, {"Warrior ring", "1163"}, {"Toktz-xil-ul", "3"}, {"Toktz-ket-xil", "2108"}, {"Toktz-mej-tal", "1092"}, {"Toktz-xil-ak", "1231"}, {"Toktz-xil-ek", "739"}, {"Toktz-ket-em", "935"}, {"Tzhaar-ket-om", "1579"}, {"Obsidian cape", "1864"}, {"Berserker necklace", "1787"}, {"Granite maul", "1458"}, {"Granite body", "490"}, {"Granite helm", "274"}, {"Granite legs", "1999"}, {"Granite shield", "348"}, {"Amulet of defence", "7"}, {"Amulet of fury", "25823"}, {"Amulet of glory", "386"}, {"Amulet of glory(1)", "386"}, {"Amulet of glory(2)", "386"}, {"Amulet of glory(3)", "386"}, {"Amulet of glory(4)", "386"}, {"Amulet of glory(t)", "2090"}, {"Amulet of glory(t1)", "2090"}, {"Amulet of glory(t2)", "2090"}, {"Amulet of glory(t3)", "2090"}, {"Amulet of glory(t4)", "2090"}, {"Amulet glory(t2)", "2090"}, {"Amulet glory(t3)", "2090"}, {"Amulet glory(t4)", "2090"}, {"Amulet of magic", "5"}, {"Amulet of magic(t)", "1042"}, {"Amulet of power", "31"}, {"Amulet of strength", "15"}, {"3rd age amulet", "561623"}, {"Strength amulet(t)", "5439"}, {"Antipoison(1)", "1"}, {"Antipoison(2)", "3"}, {"Antipoison(3)", "4"}, {"Antipoison(4)", "5"}, {"Antipoison+(1)", "23"}, {"Antipoison+(2)", "45"}, {"Antipoison+(3)", "68"}, {"Antipoison+(4)", "90"}, {"Antipoison++(1)", "37"}, {"Antipoison++(2)", "74"}, {"Antipoison++(3)", "110"}, {"Antipoison++(4)", "147"}, {"Super attack(1)", "2"}, {"Super attack(2)", "4"}, {"Super attack(3)", "5"}, {"Super attack(4)", "7"}, {"Super strength(1)", "10"}, {"Super strength(2)", "20"}, {"Super strength(3)", "30"}, {"Super strength(4)", "40"}, {"Super defence(1)", "2"}, {"Super defence(2)", "4"}, {"Super defence(3)", "5"}, {"Super defence(4)", "8"}, {"Saradomin brew(1)", "7"}, {"Saradomin brew(2)", "15"}, {"Saradomin brew(3)", "22"}, {"Saradomin brew(4)", "29"}, {"Zamorak brew(1)", "12"}, {"Zamorak brew(2)", "24"}, {"Zamorak brew(3)", "36"}, {"Zamorak brew(4)", "48"}, {"Super restore(1)", "36"}, {"Super restore(2)", "72"}, {"Super restore(3)", "108"}, {"Super restore(4)", "144"}, {"Super antipoison(1)", "3"}, {"Super antipoison(2)", "6"}, {"Super antipoison(3)", "9"}, {"Super antipoison(4)", "11"}, {"Prayer potion(1)", "21"}, {"Prayer potion(2)", "42"}, {"Prayer potion(3)", "64"}, {"Prayer potion(4)", "85"}, {"3rd age mage hat", "406772"}, {"3rd age robe", "422061"}, {"3rd age robe top", "644626"}, {"3rd age full helmet", "559838"}, {"3rd age kiteshield", "848461"}, {"3rd age platebody", "849293"}, {"3rd age platelegs", "757609"}, {"3rd age range coif", "282814"}, {"3rd age range legs", "427202"}, {"3rd age range top", "501644"}, {"3rd age vambraces", "210575"}, {"Ahrim's hood", "608"}, {"Ahrim's robeskirt", "7747"}, {"Ahrim's robetop", "3582"}, {"Ahrim's staff", "511"}, {"Torag's hammers", "960"}, {"Torag's helm", "4919"}, {"Torag's platebody", "2196"}, {"Torag's platelegs", "3563"}, {"Karil's coif", "428"}, {"Karil's crossbow", "1265"}, {"Karil's leatherskirt", "2165"}, {"Karil's leathertop", "11627"}, {"Dharok's greataxe", "2181"}, {"Dharok's helm", "32601"}, {"Dharok's platebody", "2247"}, {"Dharok's platelegs", "3242"}, {"Verac's brassard", "2181"}, {"Verac's flail", "1592"}, {"Verac's helm", "19233"}, {"Verac's plateskirt", "5590"}, {"Guthan's chainskirt", "2090"}, {"Guthan's helm", "21675"}, {"Guthan's platebody", "2160"}, {"Guthan's warspear", "13720"}, {"Saradomin sword", "71022"}, {"Ava's accumulator", "113"}, {"Archer helm", "553"}, {"Berserker helm", "773"}, {"Farseer helm", "536"}, {"Helm of neitiznot", "521"}, {"Infinity boots", "8277"}, {"Infinity bottoms", "3089"}, {"Infinity gloves", "1957"}, {"Infinity hat", "6382"}, {"Infinity top", "4317"}, {"Master wand", "4265"}, {"Teacher wand", "432"}, {"Mage's book", "19198"}, {"Initiate cuisse", "47"}, {"Initiate hauberk", "59"}, {"Initiate sallet", "34"}, {"Proselyte cuisse", "61"}, {"Proselyte hauberk", "75"}, {"Proselyte sallet", "46"}, {"Proselyte tasset", "61"}, {"Bandos boots", "8567"}, {"Bandos chestplate", "137022"}, {"Bandos tassets", "119478"}, {"Armadyl chestplate", "110821"}, {"Armadyl helmet", "48086"}, {"Armadyl plateskirt", "119685"}, {"Black d'hide body", "80"}, {"Black d'hide chaps", "62"}, {"Black d'hide vamb", "25"}, {"Zamorak d'hide", "12302"}, {"Zamorak chaps", "1175"}, {"Zamorak bracers", "5754"}, {"Zamorak coif", "2072"}, {"Saradomin d'hide", "9908"}, {"Saradomin chaps", "1005"}, {"Saradomin bracers", "4112"}, {"Saradomin coif", "1172"}, {"Guthix chaps", "279"}, {"Guthix coif", "1044"}, {"Guthix dragonhide", "949"}, {"Guthix bracers", "138"}, {"Guthix cloak", "6229"}, {"Guthix crozier", "29"}, {"Guthix mitre", "972"}, {"Guthix mjolnir", "60"}, {"Guthix robe legs", "993"}, {"Guthix robe top", "1095"}, {"Guthix stole", "144"}, {"Zamorak cloak", "10332"}, {"Zamorak crozier", "54"}, {"Zamorak mitre", "1382"}, {"Zamorak mjolnir", "91"}, {"Zamorak robe legs", "1626"}, {"Zamorak robe top", "1967"}, {"Zamorak stole", "864"}, {"Saradomin cloak", "9206"}, {"Saradomin crozier", "51"}, {"Saradomin mitre", "1634"}, {"Saradomin mjolnir", "113"}, {"Saradomin robe legs", "1071"}, {"Saradomin robe top", "1242"}, {"Saradomin stole", "650"}, {"Dark bow", "7900"}, {"Blue partyhat", "3166068"}, {"Green partyhat", "971385"}, {"Purple partyhat", "833622"}, {"Red partyhat", "1173043"}, {"White partyhat", "1638634"}, {"Yellow partyhat", "928302"}, {"Blue h'ween mask", "123047"}, {"Green h'ween mask", "102486"}, {"Red h'ween mask", "166275"}, {"Scythe", "273844"}, {"Bunny ears", "170376"}, {"Easter egg", "46282"}, {"Pumpkin", "53056"}, {"Manta ray", "0"}, {"Shark", "8"}, {"Cooked karambwan", "6"}, {"Rune knife", "5"}, {"Rune knife(p)", "7"}, {"Rune knife(p+)", "8"}, {"Rune knife(p++)", "16"}, {"Attack cape(t)", "990"}, {"Attack cape(t)", "990"}, {"Attack hood", "10"}, {"Strength cape", "990"}, {"Strength cape(t)", "990"}, {"Strength hood", "10"}, {"Defence cape", "990"}, {"Defence cape(t)", "990"}, {"Defence hood", "10"}, {"Ranging cape", "990"}, {"Ranging cape(t)", "990"}, {"Ranging hood", "10"}, {"Prayer cape", "990"}, {"Prayer cape(t)", "990"}, {"Prayer hood", "10"}, {"Magic cape", "990"}, {"Magic cape(t)", "990"}, {"Magic hood", "10"}, {"Runecraft cape", "990"}, {"Runecraft cape(t)", "990"}, {"Runecrafting hood", "10"}, {"Hitpoints cape", "990"}, {"Hitpoints cape(t)", "990"}, {"Hitpoints hood", "10"}, {"Agility cape", "990"}, {"Agility cape(t)", "990"}, {"Agility hood", "10"}, {"Herblore cape", "990"}, {"Herblore cape(t)", "990"}, {"Herblore hood", "10"}, {"Thieving cape", "990"}, {"Thieving cape(t)", "990"}, {"Thieving hood", "10"}, {"Crafting cape", "990"}, {"Crafting cape(t)", "990"}, {"Crafting hood", "10"}, {"Fletching cape", "990"}, {"Fletching cape(t)", "990"}, {"Fletching hood", "10"}, {"Slayer cape", "990"}, {"Slayer cape(t)", "990"}, {"Slayer hood", "10"}, {"Construct. cape", "990"}, {"Construct. cape(t)", "990"}, {"Construct. hood", "10"}, {"Mining cape", "990"}, {"Mining cape(t)", "990"}, {"Mining hood", "10"}, {"Smithing cape", "990"}, {"Smithing cape(t)", "990"}, {"Smithing hood", "10"}, {"Fishing cape", "990"}, {"Fishing cape(t)", "990"}, {"Fishing hood", "10"}, {"Cooking cape", "990"}, {"Cooking cape(t)", "990"}, {"Cooking hood", "10"}, {"Firemaking cape", "990"}, {"Firemaking cape(t)", "990"}, {"Firemaking hood", "10"}, {"Woodcutting cape", "990"}, {"Woodcut. cape(t)", "990"}, {"Woodcutting hood", "10"}, {"Farming cape", "990"}, {"Farming cape(t)", "990"}, {"Farming hood", "10"}, {"Quest point cape", "990"}, {"Quest point hood", "10"}, {"Summoning cape", "990"}, {"Summoning cape(t)", "990"}, {"Summoning hood", "10"}, {"Robin hood hat", "20395"}, {"Ranger boots", "66372"}, {"Arcane spirit shield", "1533295"}, {"Blessed spirit shield", "41387"}, {"Divine spirit shield", "2113049"}, {"Elysian spirit shield", "2515283"}, {"Spectral spirit shield", "1552932"}, {"Spirit shield", "626"}, {"Vesta's longsword", "100"}, {"Dragon claws", "277832"}, {"Dagon'hai hat", "331540"}, {"Dagon'hai robe top", "793450"}, {"Dagon'hai robe bottom", "522590"}, {"Elite black platelegs", "2729823"}, {"Elite black platebody", "3344210"}, {"Elite black full helm", "2576421"}};
  155.  
  156. String[][] killPrices = {{"Void knight top", "0"}, {"Void knight robe", "0"}, {"Void knight mace", "0"}, {"Void knight gloves", "0"}, {"Void mage helm", "0"}, {"Void ranger helm", "0"}, {"Void melee helm", "0"}, {"Runner hat", "0"}, {"Healer hat", "0"}, {"Ranger hat", "0"}, {"Runner boots", "0"}, {"Penance gloves", "0"}, {"Penance skirt", "0"}, {"Fighter torso", "0"}, {"Fire cape", "0"}, {"Zuriel's staff", "20"}, {"Zuriel's hood", "20"}, {"Zuriel's robe bottom", "20"}, {"Zuriel's robe top", "20"}, {"Statius's platelegs", "20"}, {"Statius's platelegs", "20"}, {"Statius's platebody", "20"}, {"Statius's full helm", "20"}, {"Statius's warhammer", "0"}, {"Statius's platelegs", "20"}, {"Bandos tassets", "0"}, {"Vesta's chainbody", "20"}, {"Vesta's plateskirt", "20"}, {"Vesta's longsword", "30"}, {"Armadyl chestplate", "0"}, {"Armadyl plateskirt", "0"}, {"Armadyl helmet", "0"}, {"Blessed spirit shield", "60"}, {"Arcane spirit shield", "0"}, {"Divine spirit shield", "0"}, {"Elysian spirit shield", "0"}, {"Spectral spirit shield", "0"}, {"Morrigan's leather body", "20"}, {"Corrupt Zuriel's hood", "20"}, {"Corrupt Zuriel's robetop", "20"}, {"Corrupt Zuriel's robebottom", "20"}, {"Corrupt Zuriel's staff", "20"}, {"Corrupt Vesta's chainbody", "20"}, {"Corrupt Vesta's plateskirt", "20"}, {"Corrupt Statius's hammer", "20"}, {"Corrupt Statius's full helm", "20"}, {"Corrupt Statius's platebody", "20"}, {"Corrupt Statius's platelegs", "20"}, {"Morrigan's leather chaps", "20"}, {"Morrigan's coif", "20"}};
  157.  
  158. int[][] otherPrices = {{7653, 1}, {7454, 1}, {7455, 3}, {7456, 5}, {7457, 10}, {7458, 15}, {7459, 25}, {7460, 50}, {7461, 1000}, {7462, 1000}, {4097, 59}, {4107, 153}, {4117, 61}, {4105, 59}, {4115, 59}, {4095, 58}, {4099, 92}, {4109, 118}, {4089, 145}, {4093, 482}, {4103, 478}, {4113, 480}, {4091, 721}, {4101, 720}, {4111, 720}};
  159.  
  160. int[][] killRequirments = {{8844, 0}, {8845, 0}, {8846, 0}, {8847, 0}, {8848, 0}, {8849, 0}, {8850, 0}, {10887, 0}, {4214, 0}, {4225, 0}, {2412, 0}, {2413, 0}, {2414, 0}, {2415, 0}, {2416, 0}, {2417, 0}, {7453, 0}, {7454, 0}, {7455, 0}, {7456, 0}, {7457, 0}, {7458, 0}, {7459, 0}, {7460, 0}, {7461, 0}, {7462, 0}};
  161.  
  162.  
  163. public int getItemValue(int item) {
  164. if (item == 995) {
  165. return 1;
  166. }
  167. int value = 0;
  168. for (String[] s : itemPrices) {
  169. String name = Engine.items.getItemName(item);
  170. if (name.equals(s[0])) {
  171. value = 100 * Integer.parseInt(s[1]);
  172. }
  173. }
  174. for (int[] i : otherPrices) {
  175. if (item == i[0]) {
  176. value = 100 * i[1];
  177. }
  178. }
  179. if (Engine.items.stackable(item) && value == 0) {
  180. value = 1;
  181. }
  182. return value;
  183. }
  184.  
  185. public int getXPForLevel(int level) {
  186. int points = 0;
  187. int output = 0;
  188. for (int lvl = 1; lvl <= level; lvl++) {
  189. points += Math.floor((double) lvl + 300.0 * Math.pow(2.0, (double) lvl / 7.0));
  190. if (lvl >= level) {
  191. return output;
  192. }
  193. output = (int) Math.floor(points / 4);
  194. }
  195. return 0;
  196. }
  197.  
  198. public int getKillRequirment(int item) {
  199. int requirment = 0;
  200. for (int[] i : killRequirments) {
  201. if (item == i[0]) {
  202. requirment = i[1];
  203. }
  204. }
  205. return requirment;
  206. }
  207.  
  208. public int getKillCost(int item) {
  209. int cost = 0;
  210. for (String[] s : killPrices) {
  211. String name = Engine.items.getItemName(item);
  212. if (name.equals(s[0])) {
  213. cost = Integer.parseInt(s[1]);
  214. }
  215. }
  216. return cost;
  217. }
  218.  
  219. public int Donator;
  220.  
  221. public long getItemValue2(int item) {
  222. if (item == 995) {
  223. return 1;
  224. }
  225. int value = 0;
  226. long value2 = 0;
  227. for (String[] s : itemPrices) {
  228. String name = Engine.items.getItemName(item);
  229. if (name.equals(s[0])) {
  230. value = 100 * Integer.parseInt(s[1]);
  231. value2 = 100 * Integer.parseInt(s[1]);
  232. }
  233. }
  234. for (int[] i : otherPrices) {
  235. if (item == i[0]) {
  236. value = 100 * i[1];
  237. value2 = 100 * i[1];
  238. }
  239. }
  240. if (Engine.items.stackable(item) && value == 0) {
  241. value = 1;
  242. value2 = 1;
  243. }
  244. return value2;
  245. }
  246.  
  247. public double PVPPotential;
  248.  
  249. public int totalKills;
  250. public int kills;
  251.  
  252. public void message(String message) {
  253. getActionSender().sendMessage(this, message);
  254. }
  255.  
  256. public boolean teleblocked;
  257. public int teleblockTimer = 500;
  258.  
  259. public boolean teletab;
  260. public int leverTeleportX;
  261. public int leverTeleportY;
  262. public int leverTeleportH;
  263. public int leverTeleportDelay = -1;
  264.  
  265. public boolean hitOne;
  266. public boolean hitTwo;
  267. public boolean hitThree;
  268. public boolean hitFour;
  269. public double hit1;
  270. public double hit2;
  271. public double hit3;
  272. public double hit4;
  273.  
  274. public int specials;
  275.  
  276. public int spendingExperience = 1000000;
  277.  
  278. public int degrade = 6000;
  279. public boolean degrades = degrade < 6000;
  280.  
  281. //Combat variables
  282.  
  283. public double rangedMax;
  284. public String OriginalAttacker;
  285. public int attackedByCount;
  286. public String attacking;
  287. public String attackedBy;
  288.  
  289. public int spell;
  290. public int spell2;
  291. public int cuedSpell;
  292. public int cuedSpells;
  293. public int magicOppIndex;
  294. public int graphicMSDelay;
  295. public int magicGraphicDelay = -1;
  296. public int magicDamageDelay = -1;
  297. public int magicAffectDelay = -1;
  298. public boolean successfulCast;
  299. public boolean usingMage;
  300. public boolean orb;
  301.  
  302. public int weapon;
  303. public int strengthBonus;
  304. public int oppIndex;
  305. public int hitIndex;
  306.  
  307. public boolean getExperience = true;
  308.  
  309. public PTrade pTrade;
  310.  
  311. public void statSpy(Player other) {
  312. int[] strings = {1, 25, 13, 5, 37, 49, 61, 45, 69, 65, 33, 57, 53, 21, 9, 29, 17, 41, 77, 81, 73, 85, 89, 93};
  313. getActionSender().setString(this, other.username.substring(0, 1).toUpperCase() + other.username.substring(1), 523, 99);
  314. for (int i = 0; i < strings.length; i++) {
  315. getActionSender().setString(this, ""+other.skillLvl[i], 523, strings[i]);
  316. getActionSender().setString(this, ""+other.getLevelForXP(i), 523, strings[i] + 1);
  317. }
  318. getActionSender().setTab(this, 79, 523);
  319. }
  320.  
  321. public void clearItem(int item) {
  322. for (int i = 0; i < bankItems.length; i++) {
  323. if (item == bankItems[i]) {
  324. bankItems[i] = -1;
  325. bankItemsN[i] = 0;
  326. }
  327. }
  328. for (int i = 0; i < equipment.length; i++) {
  329. if (item == equipment[i]) {
  330. equipment[i] = -1;
  331. equipmentN[i] = 0;
  332. }
  333. }
  334. for (int i = 0; i < items.length; i++) {
  335. if (item == items[i]) {
  336. items[i] = -1;
  337. itemsN[i] = 0;
  338. }
  339. }
  340. }
  341.  
  342. public void clearItem(String item) {
  343. String name = item;
  344. for (int i = 0; i < bankItems.length; i++) {
  345. if (name.equals(Engine.items.getItemName(bankItems[i]))) {
  346. bankItems[i] = -1;
  347. bankItemsN[i] = 0;
  348. }
  349. }
  350. for (int i = 0; i < equipment.length; i++) {
  351. if (name.equals(Engine.items.getItemName(equipment[i]))) {
  352. equipment[i] = -1;
  353. equipmentN[i] = 0;
  354. }
  355. }
  356. for (int i = 0; i < items.length; i++) {
  357. if (name.equals(Engine.items.getItemName(items[i]))) {
  358. items[i] = -1;
  359. itemsN[i] = 0;
  360. }
  361. }
  362. }
  363.  
  364. public boolean lever;
  365. public void leverTeleport(String location) {
  366. if (teleblocked) {
  367. getActionSender().sendMessage(this, "You are teleport blocked!");
  368. return;
  369. }
  370. int x = absX;
  371. int y = absY;
  372. int h = heightLevel;
  373. if (location != null) {
  374. if (location.equals("Deep Wilderness")) {
  375. x = 3153;
  376. y = 3923;
  377. }
  378. if (location.equals("Ardougne Lever")) {
  379. x = 2561;
  380. y = 3311;
  381. }
  382. if (location.equals("Mage Bank (Inside)")) {
  383. x = 2539;
  384. y = 4712;
  385. }
  386. if (location.equals("Mage Bank (Outside)")) {
  387. x = 3090;
  388. y = 3956;
  389. }
  390. }
  391. getActionSender().removeShownInterface(this);
  392. requestAnim(2140, 0);
  393. leverTeleportX = x;
  394. leverTeleportY = y;
  395. leverTeleportH = h;
  396. leverTeleportDelay = 2;
  397. lever = true;
  398. }
  399.  
  400. public void teletab(String city) {
  401. int x = absX;
  402. int y = absY;
  403. int h = heightLevel;
  404. int r = 0;
  405. teletab = true;
  406. if (this.InBounty == 1) {
  407. this.getActionSender().sendMessage (this, "You cannot use this inside bounty hunter");
  408. return;
  409. }
  410. if (city != null) {
  411. if (city.equals("Varrock")) {
  412. x = 3210;
  413. y = 3421;
  414. r = 4;
  415. }
  416. if (city.equals("Lumbridge")) {
  417. x = 3221;
  418. y = 3218;
  419. r = 2;
  420. }
  421. if (city.equals("Falador")) {
  422. x = 2964;
  423. y = 3378;
  424. r = 3;
  425. }
  426. if (city.equals("Camelot")) {
  427. x = 2756;
  428. y = 3476;
  429. r = 3;
  430. }
  431. if (city.equals("Ardougne")) {
  432. x = 2660;
  433. y = 3301;
  434. r = 4;
  435. }
  436. }
  437. getActionSender().removeShownInterface(this);
  438. x += getRandom(r);
  439. y += getRandom(r);
  440. teleportTo(x, y, h, 3, 0, 9597, 4071, 1680, 0, 678, 0);
  441. }
  442.  
  443.  
  444. public void cityTeleport(String city) {
  445. int x = absX;
  446. int y = absY;
  447. int h = heightLevel;
  448. int r = 0;
  449. if (city != null) {
  450. if (city.equals("Varrock")) {
  451. x = 3210;
  452. y = 3421;
  453. r = 4;
  454. }
  455. if (city.equals("Lumbridge")) {
  456. x = 3221;
  457. y = 3218;
  458. r = 2;
  459. }
  460. if (city.equals("Falador")) {
  461. x = 2964;
  462. y = 3378;
  463. r = 3;
  464. }
  465. if (city.equals("Camelot")) {
  466. x = 2756;
  467. y = 3476;
  468. r = 3;
  469. }
  470. if (city.equals("Ardougne")) {
  471. x = 2660;
  472. y = 3301;
  473. r = 4;
  474. }
  475. }
  476. getActionSender().removeShownInterface(this);
  477. x += getRandom(r);
  478. y += getRandom(r);
  479. teleportTo(x, y, h, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
  480. }
  481.  
  482. public boolean isPVP() {
  483. return heightLevel == 4;
  484. }
  485. public boolean hotZone(int x, int y) {
  486. if ((x >= 3205 && x <= 3222 && y >= 3420 && y <= 3438) || //Varrock
  487. (x >= 3231 && x <= 3238 && y >= 3212 && y <= 3225) || //Lumbridge
  488. (x >= 2949 && x <= 2978 && y >= 3367 && y <= 3391) || //Falador
  489. (x >= 2741 && x <= 2774 && y >= 3464 && y <= 3481) || //Camelot
  490. (x >= 2652 && x <= 2672 && y >= 3294 && y <= 3318)) { //Ardougne
  491. return true;
  492. }
  493. return false;
  494. }
  495. public boolean DoorArea(int x, int y) {
  496. if ((x >= 3124 && x <= 3124 && y >= 3665 && y <= 3665) ||
  497. (x >= 3138 && x <= 3138 && y >= 3669 && y <= 3669) ||
  498. (x >= 3146 && x <= 3146 && y >= 3681 && y <= 3681) ||
  499. (x >= 3163 && x <= 3163 && y >= 3696 && y <= 3696) ||
  500. (x >= 3180 && x <= 3180 && y >= 3708 && y <= 3708) ||
  501. (x >= 3181 && x <= 3181 && y >= 3720 && y <= 3720) ||
  502. (x >= 3171 && x <= 3171 && y >= 3737 && y <= 3737) ||
  503. (x >= 3101 && x <= 3101 && y >= 3682 && y <= 3682) ||
  504. (x >= 3170 && x <= 3170 && y >= 3746 && y <= 3746) ||
  505. (x >= 3163 && x <= 3163 && y >= 3753 && y <= 3753) ||
  506. (x >= 3147 && x <= 3147 && y >= 3758 && y <= 3758) ||
  507. (x >= 3135 && x <= 3135 && y >= 3758 && y <= 3758) ||
  508. (x >= 3121 && x <= 3121 && y >= 3754 && y <= 3754) ||
  509. (x >= 3110 && x <= 3110 && y >= 3747 && y <= 3747) ||
  510. (x >= 3091 && x <= 3091 && y >= 3735 && y <= 3735) ||
  511. (x >= 3086 && x <= 3086 && y >= 3717 && y <= 3717) ||
  512. (x >= 3091 && x <= 3091 && y >= 3706 && y <= 3706) ||
  513. (x >= 3096 && x <= 3096 && y >= 3692 && y <= 3692) ||
  514. (x >= 3108 && x <= 3108 && y >= 3670 && y <= 3670) ||
  515. (x >= 3171 && x <= 3171 && y >= 3701 && y <= 3701)) {
  516. return true;
  517. }
  518. return false;
  519. }
  520. public boolean Safezone(int x, int y) {
  521. if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
  522. (x >= 3135 && x <= 3192 && y >= 3652 && y <= 3702) ||
  523. (x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
  524. (x >= 3250 && x <= 3257 && y >= 3416 && y <= 3423) ||
  525. (x >= 2943 && x <= 2947 && y >= 2946 && y <= 3373) ||
  526. (x >= 2943 && x <= 2949 && y >= 3368 && y <= 3368) ||
  527. (x >= 3009 && x <= 3018 && y >= 3353 && y <= 3358) ||
  528. (x >= 3009 && x <= 3022 && y >= 3353 && y <= 3356) ||
  529. (x >= 2649 && x <= 2658 && y >= 3280 && y <= 3287) ||
  530. (x >= 2612 && x <= 2621 && y >= 3330 && y <= 3335) ||
  531. (x >= 3201 && x <= 3229 && y >= 3217 && y <= 3220) ||
  532. (x >= 3201 && x <= 3226 && y >= 3209 && y <= 3228) ||
  533. (x >= 3201 && x <= 3225 && y >= 3208 && y <= 3229) ||
  534. (x >= 3201 && x <= 3224 && y >= 3207 && y <= 3230) ||
  535. (x >= 3201 && x <= 3223 && y >= 3206 && y <= 3231) ||
  536. (x >= 3201 && x <= 3222 && y >= 3205 && y <= 3232) ||
  537. (x >= 3201 && x <= 3221 && y >= 3204 && y <= 3233) ||
  538. (x >= 3201 && x <= 3220 && y >= 3203 && y <= 3234) ||
  539. (x >= 3201 && x <= 3213 && y >= 3202 && y <= 3235) ||
  540. (x >= 3201 && x <= 3212 && y >= 3201 && y <= 3236) ||
  541. (x >= 3201 && x <= 3203 && y >= 3202 && y <= 3235) ||
  542. (x >= 3201 && x <= 3202 && y >= 3203 && y <= 3234) ||
  543. (x >= 2526 && x <= 2550 && y >= 4709 && y <= 4725) ||
  544. (x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
  545. return true;
  546. }
  547. return false;
  548. }
  549.  
  550. public void Welcome() {
  551. if (this == null || this.disconnected[0]) {
  552. return;
  553. }
  554. requestGFX(1844, 0);
  555. clearItem("null");
  556. getActionSender().setWindowPane(this, 549);
  557. getActionSender().setInterface(this, 1, 549, 2, 378);
  558. getActionSender().setInterface(this, 1, 549, 3, 17);
  559. getActionSender().setString(this, "Message of the Week", 17, 0);
  560. getActionSender().setString(this, "PK Spots: ::44s for 44 ports, ::mb for mage bank, ::wests and ::easts, ::edge for 1v1, ::pvp for cities, ::barbpk for multi, and ::gdz and ::newgate for deep multi.", 17, 3);
  561. getActionSender().setString(this, "69 unread messages", 378, 37);
  562. getActionSender().setString(this, "69", 378, 39);
  563. getActionSender().setString(this, "69 days of member credit", 378, 94);
  564. getActionSender().setString(this, "You have 69 days of member credit remaining.", 378, 93);
  565. getActionSender().setString(this, "69", 378, 96);
  566. getActionSender().setString(this, "Welcome to New Era", 378, 115);
  567. getActionSender().setString(this, "You last logged in yesterday from: " + Server.socketListener.getAddress(socket.socket) + "", 378, 116);
  568. }
  569.  
  570. public String getKillMessage(String player) {
  571. String[][] selection = {{"You just took a steamy shit on ", "'s forehead."},
  572. {"You cum in ", "'s eye."},
  573. {"Well done, you've slayed ", "."},
  574. {"You gwas all over ", "."},
  575. {"", "'s nan was clearly no match for you."},
  576. {"You wipe your ass with ", "."},
  577. {"Ooh, ", "'s nan just bent over and took it hard."},
  578. {"", " has fallen before your mighty penis."},
  579. {"", " is now your african slave."}};
  580. int index = (int)Math.floor(Math.random() * 9);
  581. return selection[index][0] + player + selection[index][1];
  582. }
  583. public boolean multi1() {
  584. return absX > 3072 && absX < 3107 && absY > 3401 && absY < 3448;
  585. }
  586. public boolean multi2() {
  587. return absX > 2946 && absX < 3004 && absY > 3333 && absY < 3424;
  588. }
  589. public boolean multi3() {
  590. return absX > 3193 && absX < 3332 && absY > 3665 && absY < 3752;
  591. }
  592. public boolean multi4() {
  593. return absX > 3203 && absX < 3331 && absY > 3519 && absY < 3666;
  594. }
  595. public boolean multi5() {
  596. return absX > 3134 && absX < 3328 && absY > 3519 && absY < 3658;
  597. }
  598. public boolean multi6() {
  599. return absX > 2945 && absX < 2961 && absY > 3812 && absY < 3828;
  600. }
  601. public boolean multi7() {
  602. return absX > 2982 && absX < 3010 && absY > 3913 && absY < 3929;
  603. }
  604. public boolean multi8() {
  605. return absX > 3203 && absX < 3392 && absY > 3904 && absY < 4031;
  606. }
  607. public boolean multi9() {
  608. return absX > 3149 && absX < 3331 && absY > 3799 && absY < 3850;
  609. }
  610. public boolean multi10() {
  611. return absX > 3064 && absX < 3391 && absY > 3864 && absY < 3903;
  612. }
  613. public boolean multi11() {
  614. return absX > 3006 && absX < 3072 && absY > 3601 && absY < 3713;
  615. }
  616. public boolean multi() {
  617. return multi1() || multi2() || multi3() || multi4() || multi5() || multi6() || multi7() || multi8() || multi9() || multi10() || multi11();
  618. }
  619. public boolean multiwayCombatZone(int x, int y) {
  620. if ((x > 3072 && x < 3107 && y > 3401 && y < 3448) ||
  621. (x > 3093 && x < 3117 && y > 3921 && y < 3946) ||
  622. (x > 2946 && x < 3004 && y > 3333 && y < 3424) ||
  623. (x > 3193 && x < 3332 && y > 3665 && y < 3752) ||
  624. (x > 3203 && x < 3331 && y > 3519 && y < 3666) ||
  625. (x > 3134 && x < 3328 && y > 3519 && y < 3658) ||
  626. (x > 2945 && x < 2961 && y > 3812 && y < 3828) ||
  627. (x > 2982 && x < 3010 && y > 3913 && y < 3929) ||
  628. (x > 3203 && x < 3392 && y > 3904 && y < 4031) ||
  629. (x > 3149 && x < 3331 && y > 3799 && y < 3850) ||
  630. (x > 3064 && x < 3391 && y > 3864 && y < 3903) ||
  631. (x > 3006 && x < 3072 && y > 3601 && y < 3713)) {
  632. getActionSender().setInterfaceConfig(this, 745, 1, true);
  633. return true;
  634. }
  635. return false;
  636. }
  637.  
  638. public boolean timerStarted;
  639. public long PVPTimer;
  640.  
  641. public boolean wildernessZone(int x, int y) {
  642. if (!isPVP()) {
  643. return (x >= 2945 && x <= 3395 && y >= 3523 && y <= 3967);
  644. }
  645. if (isPVP()) {
  646. if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
  647. (x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
  648. (x >= 3146 && x <= 3179 && y >= 3473 && y <= 3510) ||
  649. (x >= 3250 && x <= 3257 && y >= 3416 && y <= 3423) ||
  650. (x >= 2943 && x <= 2947 && y >= 2946 && y <= 3373) ||
  651. (x >= 2943 && x <= 2949 && y >= 3368 && y <= 3368) ||
  652. (x >= 3009 && x <= 3018 && y >= 3353 && y <= 3358) ||
  653. (x >= 3009 && x <= 3022 && y >= 3353 && y <= 3356) ||
  654. (x >= 2721 && x <= 2730 && y >= 3490 && y <= 3493) ||
  655. (x >= 2724 && x <= 2727 && y >= 3487 && y <= 3489) ||
  656. (x >= 2649 && x <= 2658 && y >= 3280 && y <= 3287) ||
  657. (x >= 2612 && x <= 2621 && y >= 3330 && y <= 3335) ||
  658. (x >= 3201 && x <= 3229 && y >= 3217 && y <= 3220) ||
  659. (x >= 3201 && x <= 3226 && y >= 3209 && y <= 3228) ||
  660. (x >= 3201 && x <= 3225 && y >= 3208 && y <= 3229) ||
  661. (x >= 3201 && x <= 3224 && y >= 3207 && y <= 3230) ||
  662. (x >= 3201 && x <= 3223 && y >= 3206 && y <= 3231) ||
  663. (x >= 3201 && x <= 3222 && y >= 3205 && y <= 3232) ||
  664. (x >= 3201 && x <= 3221 && y >= 3204 && y <= 3233) ||
  665. (x >= 3201 && x <= 3220 && y >= 3203 && y <= 3234) ||
  666. (x >= 3201 && x <= 3213 && y >= 3202 && y <= 3235) ||
  667. (x >= 3201 && x <= 3212 && y >= 3201 && y <= 3236) ||
  668. (x >= 3201 && x <= 3203 && y >= 3202 && y <= 3235) ||
  669. (x >= 3201 && x <= 3202 && y >= 3203 && y <= 3234) ||
  670. (x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
  671. if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
  672. if (timerStarted) {
  673. removeWilderness();
  674. timerStarted = false;
  675. attackedBy = null;
  676. attacking = null;
  677. }
  678. return false;
  679. } else if (!timerStarted && (attacking == null || attackedBy != null || attacking != null || attackedBy == null)) {
  680. PVPTimer = System.currentTimeMillis();
  681. timerStarted = true;
  682. }
  683.  
  684. }
  685. return true;
  686. }
  687. return false;
  688. }
  689.  
  690. public int getWildernessLevel() {
  691. int level = 0;
  692. if (absY >= 3525 && absY <= 3527) {
  693. level = 1;
  694. } else if (absY >= 3526 && absY <= 3535) {
  695. level = 2;
  696. } else {
  697. level = 3 + (int)Math.ceil((absY - 3536) / 8);
  698. }
  699. if (level < 0 || absY < 3525) {
  700. level = 0;
  701. }
  702. if (!isPVP()) {
  703. return level;
  704. }
  705. if (isPVP()) {
  706. double base = 5 + (combatLevel * 0.10);
  707. int total = (int)Math.round(base) + level;
  708. if (wildernessZone(absX, absY)) {
  709. return total;
  710. } else {
  711. return 0;
  712. }
  713. }
  714. return level;
  715. }
  716.  
  717. public boolean properWildernessLevel(int thisCombat, int opponentCombat) {
  718. int difference = thisCombat >= opponentCombat ? thisCombat - opponentCombat : opponentCombat - thisCombat;
  719. return getWildernessLevel() >= difference;
  720. }
  721.  
  722. public void restoreTabs(Player p) {
  723. for (int b = 16; b <= 21; b++) {
  724. p.getActionSender().setInterfaceConfig(p, 548, b, false);
  725. }
  726.  
  727. for (int a = 32; a <= 38; a++) {
  728. p.getActionSender().setInterfaceConfig(p, 548, a, false);
  729. }
  730. p.calculateEquipmentBonus();
  731.  
  732. p.getActionSender().setInterfaceConfig(p, 548, 14, false);
  733. p.getActionSender().setInterfaceConfig(p, 548, 31, false);
  734. p.getActionSender().setInterfaceConfig(p, 548, 63, false);
  735.  
  736. p.getActionSender().setInterfaceConfig(p, 548, 72, false);
  737. }
  738. public void hideTabs(Player p) {
  739. for (int b = 16; b <= 21; b++) {
  740. p.getActionSender().setInterfaceConfig(p, 548, b, true);
  741. }
  742.  
  743. for (int a = 32; a <= 38; a++) {
  744. p.getActionSender().setInterfaceConfig(p, 548, a, true);
  745. }
  746. p.calculateEquipmentBonus();
  747.  
  748. p.getActionSender().setInterfaceConfig(p, 548, 14, true);
  749. p.getActionSender().setInterfaceConfig(p, 548, 31, true);
  750. p.getActionSender().setInterfaceConfig(p, 548, 63, true);
  751.  
  752. p.getActionSender().setInterfaceConfig(p, 548, 72, true);
  753. }
  754.  
  755. /**
  756. * Player count in clan.
  757. */
  758. public static int blackCount, whiteCount;
  759. /**
  760. * Clan wars teams
  761. */
  762. public static boolean blackTeam, whiteTeam;
  763. /**
  764. * Clan wars handler
  765. */
  766. public ClanWars clanWars = Engine.clanWars;
  767. /**
  768. * Wilderness level
  769. */
  770. public int wildLevel;
  771. /**
  772. * If player updated the Wilderness level.
  773. */
  774. public boolean updatedLevel;
  775. public int savedLevel;
  776. /**
  777. * Thieving.
  778. */
  779. public int[] thievingArray = new int[4];
  780. public int maxArrays = 10;
  781. public boolean[] optionArray = new boolean[maxArrays];
  782. public TestWorldLoader worldLoader = new TestWorldLoader(this);
  783. /**
  784. * Quest variables
  785. */
  786. public int questId;
  787. public int questStage;
  788. public QuestDevelopment quest = new QuestDevelopment(this);
  789. /**
  790. * Has entered defence room Warrior guild.
  791. */
  792. public boolean enteredDefenceRoom;
  793. /**
  794. * Prevents XLogging.
  795. */
  796. public int combatType;
  797. /**
  798. * The delay for making a fire.
  799. */
  800. public int[] firemaking = new int[4];
  801. /**
  802. * Next graphic creating delay for MSB Special attack
  803. */
  804. public int nextDamageDelay = -1;
  805. public int nextGraphicDelay = -1;
  806. /**
  807. * Item ids of which are not spawnable.
  808. */
  809. public int[] economyItems = {
  810. 11696, 11698, 11700, 11694, 11730, 3140, 11718, 11720, 11722, 11724, 11726, 11728,
  811. 11690, 11702, 11704, 11706, 11708, 10581, 10566, 10637, 385, 391, 2440, 2434, 6685,
  812. 11235, 4151, 12670, 12671, 4153
  813. };
  814. /**
  815. * Option variable
  816. */
  817. public int optionId;
  818. /**
  819. * Call Warrior guild class
  820. */
  821. public WarriorGuild warriorGuild = new WarriorGuild(this);
  822. /**
  823. * Defender dropping types variable
  824. */
  825. public int defenderId;
  826.  
  827. /**
  828. * Wilderness Levels
  829. */
  830. public int wildernessLevel;
  831.  
  832. /**
  833. * Summoning variables
  834. */
  835. public int summonTeleDelay = -1;
  836. public int summonDrainDelay = -1;
  837. public boolean callFamiliar;
  838. public boolean familiarDissMiss;
  839. public boolean summonedFamiliar;
  840.  
  841. /**
  842. * Warrior Guild variables
  843. */
  844. public int[] randomItemIds = {
  845. 8843, 8844, 8845, 8846, 8847, 8848, 8849, 8850
  846. };
  847. public String warriorArmour;
  848.  
  849. /**
  850. * autoCast Variables
  851. */
  852. public int[] regularStaffs = {
  853. 1381
  854. };
  855. public int[] otherStaffs = {
  856. 4675
  857. };
  858. public int autoCastDmgDelay = -1;
  859. public int autoCastDelay;
  860. public int[] autoCast = new int[3];
  861. public boolean castAuto;
  862. public boolean usingAutoCast;
  863. /**
  864. * If player is disturbing commander zilyana.
  865. */
  866. public boolean disturbSara;
  867. /**
  868. * Death Delays
  869. */
  870. public int deathEmoteDelay = -1;
  871. /**
  872. * Yell delay
  873. */
  874. public int massYellDelay = 0;
  875.  
  876. /**
  877. * Crystal bow shots.
  878. */
  879. public int crystalShots;
  880.  
  881. /**
  882. * Fight Cave variables
  883. */
  884. public int neededKills;
  885. public int[] waveType = new int[5];
  886. public int waveCount;
  887. public int waveDelay = -1;
  888. public FightCave fCave = new FightCave(this);
  889.  
  890. /**
  891. * Fletching variables
  892. */
  893. public int deletedItem, addedItem;
  894. public int fletchAmt;
  895. public boolean isFletching;
  896. public int[] fletching;
  897. public int fletchDelay;
  898. public int fletchType, fletchExp;
  899. PlayerFletching fletchingClass = new PlayerFletching(this);
  900.  
  901. public int equipSpecDelay;
  902. public int[] miningAxes = {
  903. 1265, 1267, 1269, 1271, 1273, 1275
  904. };
  905. public boolean isBanking;
  906.  
  907. /**
  908. * Dueling variables
  909. */
  910. public int countDelay = -1;
  911. public int countType = -1;
  912. public boolean duelDeath;
  913. public boolean acceptDuel;
  914. public boolean acceptScreen1, acceptScreen2;
  915. public DuelArena duelArena = new DuelArena(this);
  916. public int duelFriend;
  917. public boolean duelScreen1, duelScreen2;
  918.  
  919. public int explodeType;
  920. public int explodeDelay = -1;
  921.  
  922. public int[] godWarsKills = new int[5];
  923.  
  924. public int watchId = -1;
  925.  
  926. public int spellType;
  927.  
  928. public int playerStart;
  929.  
  930. public boolean muteExpect, muteExpect2;
  931. public int muteType;
  932. public int mute;
  933. public int[] hugeNpcs = {
  934. 50, 1155, 1157, 1158, 1160, 2745, 6222, 6203
  935. };
  936.  
  937. /**
  938. * Woodcutting variables
  939. */
  940. public int cutDelay;
  941. public boolean isWoodcutting;
  942.  
  943. /**
  944. * Dueling variables
  945. */
  946. public boolean isBusy;
  947. public int duelEnemy;
  948. public boolean inDuelFight;
  949.  
  950. /**
  951. * Pet variables
  952. */
  953. public int petKeeper;
  954. public boolean summonedPet;
  955.  
  956. /**
  957. * Mage Arena variables
  958. */
  959. public int kolodionDelay;
  960. public boolean arenaActive;
  961.  
  962. /**
  963. * Slayer variables
  964. */
  965. public int slayerAmount1;
  966. public int slayerType1;
  967. public int[] slayerType = {
  968. 1615, 5363, 55, 54
  969. };
  970. public boolean slayerTask;
  971. public int[] slayerArray = {
  972. 1, 2, 3, 4
  973. };
  974. public int slayerAmount;
  975.  
  976. /**
  977. * Pvn variables
  978. */
  979. public int damageSpecDelay = -1;
  980. public boolean enableSpecDamage;
  981. public int damageDelay1 = -1;
  982. public boolean enableDamage;
  983. public int atkDelay;
  984. public boolean attackingNpc;
  985. public int attackNpc;
  986.  
  987. /**
  988. * Clan wars variables.
  989. */
  990. public boolean blackClan;
  991. public boolean whiteClan;
  992.  
  993. /**
  994. * Thieving variables.
  995. */
  996. public int pickPocketDelay;
  997.  
  998. /**
  999. * This variable is added to add facing if player is gonna pickpocket.
  1000. */
  1001. public int npcClick2;
  1002.  
  1003. /**
  1004. * Mining variables.
  1005. */
  1006. public int rockId;
  1007. public boolean isMining;
  1008. public int receiveOreDelay;
  1009. public int miningDelay;
  1010.  
  1011. /**
  1012. * Wilderness variables.
  1013. */
  1014. public int wildyLevel;
  1015.  
  1016. public int statDelay = 100; //Stat update delay
  1017. public int hpDelay = 100; //HP update delay
  1018.  
  1019. /**
  1020. * Emote clicking delay.
  1021. */
  1022. public int animClickDelay;
  1023. public boolean usingPrayer;
  1024. public int buryDelay;
  1025. public int drainDelay;
  1026. public boolean rangedPrayer;
  1027. public boolean meleePrayer;
  1028. public boolean magicPrayer;
  1029. public boolean retriPrayer;
  1030. public boolean redempPrayer;
  1031.  
  1032. //Prayer
  1033.  
  1034. public double[][] prayers = {{1, 0, 5}, {4, 0, 5}, {7, 0, 5}, {8, 0, 5}, {9, 0, 5}, {10, 0, 10}, {13, 0, 10}, {16, 0, 10}, {19, 0, 1.67}, {22, 0, 3.33}, {25, 0, 3.33}, {26, 0, 10}, {27, 0, 10}, {28, 0, 20}, {31, 0, 20}, {34, 0, 20}, {36, 0, 20}, {37, 0, 20}, {40, 0, 20}, {43, 0, 20}, {44, 0, 20}, {45, 0, 20}, {46, 0, 5}, {49, 0, 10}, {52, 0, 30}, {60, 0, 38.33}, {70, 0, 38.33}};
  1035. public int headIconPrayer = -1;
  1036. public double drainCount = 0;
  1037.  
  1038. public boolean canPray(int prayer) {
  1039. if (skillLvl[5] > 0 && getLevelForXP(5) >= prayers[prayer][0]) {
  1040. return true;
  1041. }
  1042. return false;
  1043. }
  1044.  
  1045. public boolean usingPrayer(int prayer) {
  1046. return prayers[prayer][1] == 1;
  1047. }
  1048.  
  1049. public boolean usingPrayer() {
  1050. int i = 0;
  1051. while (i <= 26) {
  1052. if (prayers[i][1] == 1) return true;
  1053. i++;
  1054. }
  1055. return false;
  1056. }
  1057.  
  1058. public void togglePrayer(int prayer, int toggle) {
  1059. int[] configuration = {83, 84, 85, 862, 863, 86, 87, 88, 89, 90, 91, 864, 865, 92, 93, 94, 1168, 95, 96, 97, 866, 867, 98, 99, 100, 1052, 1053};
  1060. prayers[prayer][1] = toggle;
  1061. getActionSender().setConfig(this, configuration[prayer], toggle);
  1062. }
  1063.  
  1064. public double prayerDrain() {
  1065. int i = 0;
  1066. double drainPerMinute = 0;
  1067. while (i <= 26) {
  1068. if (usingPrayer(i)) drainPerMinute += prayers[i][2];
  1069. i++;
  1070. }
  1071. drainPerMinute *= 1 + (equipmentBonus[11] / 30);
  1072. return drainPerMinute / 175;
  1073. }
  1074.  
  1075. public void switchPrayers(int[] prayers, int prayer) {
  1076. if (!canPray(prayer)) {
  1077. return;
  1078. }
  1079. for (int i : prayers) {
  1080. if (usingPrayer(i)) {
  1081. togglePrayer(i, 0);
  1082. }
  1083. }
  1084. }
  1085.  
  1086. public void prayerSounds(int prayer) {
  1087. int sound = 0;
  1088. switch (prayer) {
  1089. case 0: sound = 2690; break;
  1090. case 1: sound = 2688; break;
  1091. case 2: sound = 2664; break;
  1092. case 3: sound = 2685; break;
  1093. case 4: sound = 2668; break;
  1094. case 5: sound = 2684; break;
  1095. case 6: sound = 2689; break;
  1096. case 7: sound = 2662; break;
  1097. case 8: sound = 2679; break;
  1098. case 9: sound = 2678; break;
  1099. case 10: sound = 0; break;
  1100. case 11: sound = 2666; break;
  1101. case 12: sound = 2670; break;
  1102. case 13: sound = 2687; break;
  1103. case 14: sound = 2691; break;
  1104. case 15: sound = 2667; break;
  1105. case 16: sound = 0; break;
  1106. case 17: sound = 2675; break;
  1107. case 18: sound = 2677; break;
  1108. case 19: sound = 2676; break;
  1109. case 20: sound = 2665; break;
  1110. case 21: sound = 2669; break;
  1111. case 22: sound = 2682; break;
  1112. case 23: sound = 2680; break;
  1113. case 24: sound = 2686; break;
  1114. case 25: sound = 3826; break;
  1115. case 26: sound = 3825; break;
  1116. }
  1117. if (sound != 0) {
  1118. getActionSender().addSoundEffect(this, sound, 1, 0, 0);
  1119. }
  1120. }
  1121.  
  1122. public void resetPrayer() {
  1123. int i = 0;
  1124. while (i <= 26) {
  1125. togglePrayer(i, 0);
  1126. i++;
  1127. }
  1128. drainCount = 0;
  1129. headIconPrayer = -1;
  1130. updateReq = true;
  1131. appearanceUpdateReq = true;
  1132. }
  1133.  
  1134.  
  1135. /**
  1136. * Magic combat variables
  1137. */
  1138. public int freezeDelay;
  1139. public int vengeanceDelay;
  1140. public int lunarDelay;
  1141. public boolean vengeance;
  1142. public int spellbookSwapTimer;
  1143. public boolean spellbookSwap;
  1144. public boolean usedSpellbookSwap;
  1145. public int mageDelay;
  1146.  
  1147. /**
  1148. * Agility Variables
  1149. */
  1150. public int[] agilityX = {
  1151. 2476, 2475, 2474, 2473, 2472, 2471
  1152. };
  1153. public int[] agilityY = {
  1154. 3426
  1155. };
  1156. public boolean agilityPerforming;
  1157. public int agilityDelay;
  1158. public int agilityType;
  1159.  
  1160. /**
  1161. * Combat variables
  1162. */
  1163. public boolean fadeAway;
  1164. public int enemyFadeAwayDelay = -1;
  1165. public int fightStyle = 1;
  1166. public int[] strangeItems = {
  1167. 6570
  1168. };
  1169. public int battleCDelay;
  1170. public int battleCount;
  1171. public int poisonDelay;
  1172. public int poisonHitCount;
  1173. public boolean isPoisoned;
  1174. public int headIconSkull = -1;
  1175. public boolean isSkulled;
  1176. public int skullVanishDelay;
  1177. public int rangeDmgDelay = -1;
  1178. public int rangeDmgDelay2 = -1;
  1179.  
  1180. public int[] rangeBows = {
  1181. 841, 843, 845, 847, 849, 851, 853,
  1182. 855, 857, 859, 861,6724, 9174, 9176, 9177,
  1183. 9179, 9181, 9183, 9185
  1184. };
  1185. public int[] rangeArrows = {
  1186. 882, 884, 886, 888, 890, 892
  1187. };
  1188. public int[] godSwords = {
  1189. 11694, 11696, 11698, 11700
  1190. };
  1191. public int myBonus;
  1192. public int meleeDef;
  1193. public int waitDeathDelay = -1;
  1194. public boolean randomVariable;
  1195. public int deathDelay = -1;
  1196. public boolean isDead;
  1197. public int specDelay = -1;
  1198. public int secondSpecDelay = -1;
  1199. public int delayedDamageDelay = -1;
  1200. public int delayedDamageHit = -1;
  1201. public boolean expectSpec;
  1202. public boolean autoRetaliate = true;
  1203. public int specFillDelay = 50;
  1204. public boolean usingSpecial;
  1205. public int specAmount;
  1206. public int damageDelay;
  1207. public boolean damagePending;
  1208. public int combatDelay;
  1209. public int enemyIndex;
  1210. public boolean attackingPlayer;
  1211.  
  1212. /**
  1213. * Player's index.
  1214. */
  1215. public int playerId = 0;
  1216. /**
  1217. * Class for storing and converting bytes.
  1218. */
  1219. public ByteVector stream = new ByteVector(500, 5000);
  1220. /**
  1221. * Player's socket for handling most io operations.
  1222. */
  1223. public PlayerSocket socket;
  1224. /**
  1225. * Set to true if the player has finished the login stage.
  1226. */
  1227. public boolean online = false;
  1228. /**
  1229. * Player's username.
  1230. */
  1231. public String username = "null";
  1232. /**
  1233. * Player's password.
  1234. */
  1235. public String password = "";
  1236. /**
  1237. * Player's rights.
  1238. */
  1239. public int rights = 0;
  1240. /**
  1241. * Player's jail status.
  1242. */
  1243. public int jailed = 0;
  1244. /**
  1245. * Player s starter.
  1246. */
  1247. public int starter = 0;
  1248.  
  1249. /**
  1250. * 1 set to true means socket disconnected but logged in, both for removing the player.
  1251. */
  1252. public boolean[] disconnected = new boolean[2];
  1253. /**
  1254. * The region this player is in.
  1255. */
  1256. public int mapRegionX = 0;
  1257. public int mapRegionY = 0;
  1258. /**
  1259. * The position this player is at in the map region.
  1260. */
  1261. public int currentX = 0;
  1262. public int currentY = 0;
  1263. /**
  1264. * Absolute coordinates this player is at.
  1265. */
  1266. public int absX = 0;
  1267. public int absY = 0;
  1268. /**
  1269. * The height level this player is at.
  1270. */
  1271. public int heightLevel = 0;
  1272. /**
  1273. * Storing players spellbook
  1274. */
  1275. public int spellbook = 192;
  1276. /**
  1277. * If either are above -1 then the player is in motion.
  1278. */
  1279. public int walkDir = -1;
  1280. public int runDir = -1;
  1281. /**
  1282. * True if the player is running, false if it isn't.
  1283. */
  1284. public boolean isRunning = false;
  1285. /**
  1286. * Set to true if the player has entered a new map region.
  1287. */
  1288. public boolean mapRegionDidChange = false;
  1289. /**
  1290. * Set to true if teleported.
  1291. */
  1292. public boolean didTeleport = false;
  1293. /**
  1294. * Set Absolute coordinates to these.
  1295. */
  1296. public int teleportToX = -1;
  1297. public int teleportToY = -1;
  1298. /**
  1299. * True if the player is Reqing an update.
  1300. */
  1301. public boolean updateReq = false;
  1302. /**
  1303. * Max number of steps this player can have pending.
  1304. */
  1305. public int walkingQueueSize = 50;
  1306. public int wQueueReadPtr = 0;
  1307. public int wQueueWritePtr = 0;
  1308. /**
  1309. * Positions the player is Reqing to walk to.
  1310. */
  1311. public int[] walkingQueueX = new int[walkingQueueSize];
  1312. public int[] walkingQueueY = new int[walkingQueueSize];
  1313. public int[] walkingQueue = new int[walkingQueueSize];
  1314. /**
  1315. * All the players within distance.
  1316. */
  1317. public Player[] playerList = new Player[Engine.players.length];
  1318. /**
  1319. * All the players stored in distance.
  1320. */
  1321. public byte[] playersInList = new byte[Engine.players.length];
  1322. public int playerListSize = 0;
  1323. /**
  1324. * True if chatting is Reqing to be sent.
  1325. */
  1326. public boolean chatTextUpdateReq = false;
  1327. public String chatText = "";
  1328. public int chatTextEffects = 0;
  1329. /**
  1330. * True if an appearance update is needed.
  1331. */
  1332. public boolean appearanceUpdateReq = false;
  1333. /**
  1334. * Animation data.
  1335. */
  1336. public boolean animUpdateReq = false;
  1337. public int animReq = -1;
  1338. public int animDelay = 0;
  1339. /**
  1340. * GFX data.
  1341. */
  1342. public boolean gfxUpdateReq = false;
  1343. public int gfxReq = -1;
  1344. public int gfxDelay = 0;
  1345. /**
  1346. * Player and NPC facing data.
  1347. */
  1348. public boolean faceToUpdateReq = false;
  1349. public int faceToReq = -1;
  1350. /**
  1351. * Damage data.
  1352. */
  1353. public boolean hit1UpdateReq = false;
  1354. public boolean hit2UpdateReq = false;
  1355. public int hitDiff1 = 0;
  1356. public int hitDiff2 = 0;
  1357. public int poisonHit1 = 0;
  1358. public int poisonHit2 = 0;
  1359. /**
  1360. * Skill level data.
  1361. */
  1362. public int[] skillLvl = new int[25];
  1363. public int[] skillXP = new int[25];
  1364. public int combatLevel = 0;
  1365. /**
  1366. * Equipment data.
  1367. */
  1368. public int[] equipment = new int[14];
  1369. public int[] equipmentN = new int[14];
  1370. public int[] equipmentBonus = new int[12];
  1371. /**
  1372. * Player appearance.
  1373. */
  1374. public int[] color = new int[5];
  1375. public int[] look = new int[7];
  1376. public int npcType = -1;
  1377. public int gender = 0;
  1378. /**
  1379. * Player emotes.
  1380. */
  1381. public int runEmote = 0x338;
  1382. public int walkEmote = 0x333;
  1383. public int standEmote = 0x328;
  1384. /**
  1385. * All the NPCs within distance.
  1386. */
  1387. public NPC[] npcList = new NPC[Engine.npcs.length];
  1388. /**
  1389. * All the npcs stored in distance.
  1390. */
  1391. public byte[] npcsInList = new byte[Engine.npcs.length];
  1392. public int npcListSize = 0;
  1393. /**
  1394. * Rebuild the entire NPC list.
  1395. */
  1396. public boolean rebuildNPCList = false;
  1397. /**
  1398. * An array storing all the players items.
  1399. */
  1400. public int[] items = new int[28];
  1401. public int[] itemsN = new int[28];
  1402. /**
  1403. * Open interfaces, use these to confirm an interface is open when trying to use one.
  1404. */
  1405. public int interfaceId = -1;
  1406. public int chatboxInterfaceId = -1;
  1407. /**
  1408. * The current position in the login stage.
  1409. */
  1410. public int loginStage = 0;
  1411. /**
  1412. * Click x position.
  1413. */
  1414. public int clickX = 0;
  1415. /**
  1416. * Click y position.
  1417. */
  1418. public int clickY = 0;
  1419. /**
  1420. * Click id.
  1421. */
  1422. public int clickId = 0;
  1423. /**
  1424. * Eat delay.
  1425. */
  1426. public int eatDelay;
  1427. public int drinkDelay;
  1428. /**
  1429. * True if the player is trying to pickup an item.
  1430. */
  1431. public boolean itemPickup = false;
  1432. /**
  1433. * Set run energy.
  1434. */
  1435. public boolean runEnergyUpdateReq = false;
  1436. /**
  1437. * Amount of current run energy.
  1438. */
  1439. public int runEnergy = 100;
  1440. /**
  1441. * Delay before run energy can increase.
  1442. */
  1443. public int runEnergyDelay = 0;
  1444. /**
  1445. * Clicked the first option on a player.
  1446. */
  1447. public boolean playerOption1 = false;
  1448. /**
  1449. * Clicked the second option on a player.
  1450. */
  1451. public boolean playerOption2 = false;
  1452. /**
  1453. * Clicked the third option on a player.
  1454. */
  1455. public boolean playerOption3 = false;
  1456. /**
  1457. * Clicked the first option on a NPC.
  1458. */
  1459. public boolean npcOption1 = false;
  1460. /**
  1461. * Clicked the first option on an object.
  1462. */
  1463. public boolean objectOption1 = false;
  1464. /**
  1465. * Setting the prayer system effects.
  1466. */
  1467. public PrayerSystem prayerSystem = new PrayerSystem(this);
  1468. /**
  1469. * Setting the players weapon.
  1470. */
  1471. public PlayerWeapon playerWeapon = new PlayerWeapon(this);
  1472. /**
  1473. * Clicked the second option on an object.
  1474. */
  1475. public boolean objectOption2 = false;
  1476. /**
  1477. * Clicked the second option on a NPC.
  1478. */
  1479. public boolean npcOption2 = false;
  1480. /**
  1481. * Forced chat.
  1482. */
  1483. public String forceChat = "";
  1484. public boolean forceChatUpdateReq = false;
  1485. /**
  1486. * Teleporting variables.
  1487. */
  1488. public int teleX = -1;
  1489. public int teleY = -1;
  1490. public int teleH = -1;
  1491. public int teleDelay = -1;
  1492. public int teleFinishGFX = 0;
  1493. public int teleFinishGFXHeight = 0;
  1494. public int teleFinishAnim = 0;
  1495. /**
  1496. * Delay before recieving packets.
  1497. */
  1498. public int clickDelay = -1;
  1499. public long loginTimeout = System.currentTimeMillis();
  1500. public int[] bankItems = new int[500];
  1501. public int[] bankItemsN = new int[500];
  1502.  
  1503. /**
  1504. * Constructs a new Player.
  1505. * @param socket The socket this Player belongs to.
  1506. * @param id The index this player is at.
  1507. */
  1508. public Player(Socket socket, int id) {
  1509. this.socket = new PlayerSocket(this, socket);
  1510. playerId = id;
  1511. look[0] = 0;
  1512. look[1] = 10;
  1513. look[2] = 18;
  1514. look[3] = 26;
  1515. look[4] = 33;
  1516. look[5] = 36;
  1517. look[6] = 42;
  1518. for (int i = 0; i < skillLvl.length; i++) {
  1519. skillLvl[i] = 1;
  1520. skillXP[i] = 0;
  1521. skillLvl[3] = 10;
  1522. skillXP[3] = 1155;
  1523. }
  1524. for (int i = 0; i < items.length; i++) {
  1525. items[i] = -1;
  1526. itemsN[i] = 0;
  1527. }
  1528. for (int i = 0; i < equipment.length; i++) {
  1529. equipment[i] = -1;
  1530. }
  1531. for (int i = 0; i < bankItems.length; i++) {
  1532. bankItems[i] = -1;
  1533. }
  1534. pTrade = new PTrade(this);
  1535. }
  1536.  
  1537. public boolean skillCapeEquiped() {
  1538. for (int i = 10639; i < 10663; i++) {
  1539. for (int j = 9747; j < 9812; j++) {
  1540. if (equipment[1] == i || equipment[1] == j || equipment[1] == 12169 || equipment[1] == 12170) {
  1541. return true;
  1542. }
  1543. }
  1544. }
  1545. return false;
  1546. }
  1547.  
  1548. public int logoutTimer;
  1549. public int restoreSpecialTimer;
  1550. int tellAll = 700;
  1551.  
  1552. public void processTimers() { //Processes evenly at 1000 milliseconds
  1553. if (tellAll > 0) {
  1554. tellAll--;
  1555. }
  1556. if (tellAll == 700) {
  1557. message("<img=3><col=336600>[NEW-ERA] <col=990099>Remember to log and save your progress every few minutes.");
  1558. }
  1559. if (tellAll == 500) {
  1560. message("<img=3><col=336600>[NEW-ERA] <col=990099>Do not edge hybrid, use ::easts, ::wests, ::mb, or ::44s.");
  1561. }
  1562. if (tellAll == 350) {
  1563. message("<img=3><col=336600>[NEW-ERA] <col=990099>DO NOT spam admins and DO NOT ask for staff.");
  1564. }
  1565. if (tellAll == 150) {
  1566. message("<img=3><col=336600>[NEW-ERA] <col=990099>Remember to stay active and idle in #NewEra on mIRC or SwiftIRC.");
  1567. }
  1568. if (tellAll == 0) {
  1569. message("<img=3><col=336600>[NEW-ERA] <col=990099>If you are interested in purchasing donor, type ::donate.");
  1570. tellAll = 850;
  1571. }
  1572. if (freezeDelay > 0) {
  1573. freezeDelay--;
  1574. }
  1575. if (vengeanceDelay > 0) {
  1576. vengeanceDelay--;
  1577. }
  1578. if (spellbookSwapTimer > 0) {
  1579. spellbookSwapTimer--;
  1580. } else if (spellbookSwap) {
  1581. getActionSender().setTab(this, 79, spellbook);
  1582. spellbookSwap = false;
  1583. usedSpellbookSwap = false;
  1584. }
  1585. if (attackedBy != null) {
  1586. count++;
  1587. if (count == 4) {
  1588. attackedBy = null;
  1589. attackedByCount--;
  1590. count = 0;
  1591. }
  1592. }
  1593. if (serverMsg == 0) {
  1594. serverMsg = 150;
  1595. }
  1596. if (fleeTimer > 0) {
  1597. fleeTimer--;
  1598. }
  1599. if (serverMsg > 0) {
  1600. serverMsg--;
  1601. }
  1602. if (leftBhTimer > 0) {
  1603. leftBhTimer--;
  1604. }
  1605. if (bhLeave1 > 0) {
  1606. bhLeave1--;
  1607. }
  1608. if(bhPickup < 1 && (InBounty == 1)) {
  1609. bhPickup--;
  1610. this.getActionSender().setString(this, "", 653, 11);
  1611. this.getActionSender().setString(this, "", 653, 10);
  1612. }
  1613. if(bhPickup > 0 && (InBounty == 1)) {
  1614. bhPickup--;
  1615. this.getActionSender().setString(this, + bhPickup +" Sec", 653, 11);
  1616. this.getActionSender().setString(this, "Can't leave for:", 653, 10);
  1617. }
  1618. if(bhLeave > 0 && (InBounty == 1)) {
  1619. bhLeave--;
  1620. this.getActionSender().setString(this, + bhLeave +" Sec", 653, 11);
  1621. this.getActionSender().setString(this, "Pickup penalty:", 653, 10);
  1622. }
  1623. if (logoutTimer > 0) {
  1624. logoutTimer--;
  1625. }
  1626. if (restoreSpecialTimer > 0) {
  1627. restoreSpecialTimer--;
  1628. }
  1629. }
  1630.  
  1631.  
  1632. /**
  1633. * This method is called every 600 milliseconds.
  1634. * <p>While this is good for for changing integers, this
  1635. * should not be abused. Things that can be handled else where should
  1636. * be done in that way, such as clicking the accept button in trade
  1637. * should update in the ActionsButton class rather than Reqing
  1638. * an update for the process to handle.
  1639. */
  1640.  
  1641. public void attackPlayer() {
  1642. PlayerCombat pc = new PlayerCombat(this);
  1643. pc.attackPlayer();
  1644. }
  1645.  
  1646. public int count;
  1647. public boolean usedLogout;
  1648.  
  1649. public void process() {
  1650.  
  1651. if (DFSDelay > 0) {
  1652. DFSDelay--;
  1653. } else if (DFSDelay == 0) {
  1654. append1Hit((int)Math.round(Math.random() * 25), 0);
  1655. DFSDelay = -1;
  1656. }
  1657. if (attackedBy == null) {
  1658. OriginalAttacker = null;
  1659.  
  1660. }
  1661. if(followingPlayer)
  1662. Engine.playerFollow.followPlayer(this);
  1663. if (leverTeleportDelay > 0) {
  1664. leverTeleportDelay--;
  1665. } else if (leverTeleportDelay == 0) {
  1666. teleportTo(leverTeleportX, leverTeleportY, leverTeleportH, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
  1667. lever = false;
  1668. leverTeleportDelay--;
  1669. }
  1670.  
  1671. if (teleblocked && teleblockTimer > 0) {
  1672. if (teleblockTimer == 500) {
  1673. getActionSender().sendMessage(this, "You have been teleport blocked!");
  1674. if (usingPrayer(17)) {
  1675. teleblockTimer = 250;
  1676. }
  1677. }
  1678. teleblockTimer--;
  1679. }
  1680. if (teleblockTimer == 0) {
  1681. teleblocked = false;
  1682. teleblockTimer = 500;
  1683. getActionSender().sendMessage(this, "The teleport block has worn off.");
  1684. }
  1685.  
  1686. if (degrades && equipment[3] == 13290) {
  1687. degrade--;
  1688. if (degrade == 0) {
  1689. boolean deleted = false;
  1690. PlayerItems playerItems = new PlayerItems();
  1691. for (int i = 0; i < equipment.length; i++) {
  1692. if (equipment[i] == 13290) {
  1693. equipment[i] = -1;
  1694. equipmentN[i] = 0;
  1695. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  1696. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  1697. deleted = true;
  1698. break;
  1699. }
  1700. }
  1701. if (!deleted) {
  1702. for (int i = 0; i < items.length; i++) {
  1703. if (items[i] == 13290) {
  1704. playerItems.deleteItem(this, 13290, playerItems.getItemSlot(this, 13290), 1);
  1705. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  1706. deleted = true;
  1707. break;
  1708. }
  1709. }
  1710. }
  1711. if (!deleted) {
  1712. for (int i = 0; i < bankItems.length; i++) {
  1713. if (bankItems[i] == 13290) {
  1714. bankItemsN[i]--;
  1715. if (bankItemsN[i] <= 0) {
  1716. bankItems[i] = -1;
  1717. }
  1718. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  1719. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  1720. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  1721. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  1722. break;
  1723. }
  1724. }
  1725. }
  1726. degrade = 6000;
  1727. degrades = false;
  1728. }
  1729. }
  1730.  
  1731.  
  1732.  
  1733. if (magicGraphicDelay > 0) {
  1734. magicGraphicDelay--;
  1735. } else if (magicGraphicDelay == 0) {
  1736. PlayerMagic playerMagic = new PlayerMagic(this);
  1737. playerMagic.appendGraphic(spellbook, spell);
  1738. magicGraphicDelay--;
  1739. }
  1740. if (magicDamageDelay > 0) {
  1741. magicDamageDelay--;
  1742. } else if (magicDamageDelay == 0) {
  1743. PlayerMagic playerMagic = new PlayerMagic(this);
  1744. playerMagic.appendDamage(spellbook, spell);
  1745. magicDamageDelay--;
  1746. }
  1747. if (magicAffectDelay > 0) {
  1748. magicAffectDelay--;
  1749. } else if (magicAffectDelay == 0) {
  1750. PlayerMagic playerMagic = new PlayerMagic(this);
  1751. playerMagic.appendAffect(spellbook, spell);
  1752. magicAffectDelay--;
  1753. }
  1754. if (cuedSpells > 0 && combatDelay == 0) {
  1755. try {
  1756. Player opp = Server.engine.players[magicOppIndex];
  1757. PlayerMagic playerMagic = new PlayerMagic(this);
  1758. playerMagic.combatMagic(opp, spellbook, cuedSpell);
  1759. cuedSpells = 0;
  1760. } catch (Exception e) {
  1761. }
  1762. }
  1763.  
  1764. if (usingPrayer()) {
  1765. drainCount += prayerDrain();
  1766. if (!isDead) {
  1767. if (drainCount >= 1) {
  1768. skillLvl[5]--;
  1769. getActionSender().setSkillLvl(this, 5);
  1770. drainCount--;
  1771. }
  1772. }
  1773. if (skillLvl[5] <= 0) {
  1774. skillLvl[5] = 0;
  1775. getActionSender().addSoundEffect(this, 2672, 1, 0, 0);
  1776. getActionSender().setSkillLvl(this, 5);
  1777. getActionSender().sendMessage(this, "You have run out of Prayer points; you must recharge at an altar.");
  1778. resetPrayer();
  1779. }
  1780. }
  1781.  
  1782. getDuelClass().process();
  1783. if (disconnected[0] && (usedLogout || attackedBy == null)) {
  1784. try {
  1785. if (heightLevel != 0) heightLevel = heightLevel;
  1786. Engine.fileManager.saveCharacter(this);
  1787. } catch (Exception e) {
  1788. }
  1789. if (clanRoom.length() > 0) {
  1790. Engine.clanChat.leave(this);
  1791. }
  1792. if (pTrade.getPartner() != null) {
  1793. pTrade.declineTrade();
  1794. }
  1795. disconnected[1] = true;
  1796. }
  1797. /**
  1798. * Warrior Guild
  1799. */
  1800. if (!enteredDefenceRoom) {
  1801. if (absX == 2842 && absY == 3545 && heightLevel == 1)
  1802. getWarriorClass().addWarriorDefenceEvent();
  1803. enteredDefenceRoom = false;
  1804. }
  1805. if (thievingArray[0] > 0)
  1806. thievingArray[0]--;
  1807. if (thievingArray[0] == 0) {
  1808. PlayerThieving thievClass = new PlayerThieving(this);
  1809. thievClass.addStallThievingEvent();
  1810. }
  1811. if (thievingArray[3] > 0)
  1812. thievingArray[3]--;
  1813. if (nextGraphicDelay > 0)
  1814. nextGraphicDelay--;
  1815. if (nextGraphicDelay == 0) {
  1816. PlayerCombat playerAttacking = new PlayerCombat(this);
  1817. playerAttacking.addNextAttack();
  1818. }
  1819. if (nextDamageDelay > 0)
  1820. nextDamageDelay--;
  1821. if (nextDamageDelay == 0) {
  1822. PlayerCombat playerAttacking = new PlayerCombat(this);
  1823. playerAttacking.addNextDamage();
  1824. }
  1825. if (fletchDelay > 0)
  1826. fletchDelay--;
  1827.  
  1828. if (fletchDelay == 0 && isFletching)
  1829. getFletchingClass().appendFletchingEngine();
  1830.  
  1831. if (summonTeleDelay > 0) {
  1832. summonTeleDelay--;
  1833. }
  1834. if (summonTeleDelay == 0) {
  1835. setCoords(3069, 10257, 0);
  1836. summonTeleDelay = -1;
  1837. requestAnim(715, 0);
  1838. }
  1839. if (summonDrainDelay > 0) {
  1840. summonDrainDelay--;
  1841. }
  1842. if (summonDrainDelay == 0) {
  1843. if (skillLvl[23] > 0) {
  1844. skillLvl[23]--;
  1845. getActionSender().setSkillLvl(this, 23);
  1846. summonDrainDelay = 14;
  1847. } else {
  1848. familiarDissMiss = true;
  1849. summonedFamiliar = false;
  1850. summonDrainDelay = -1;
  1851. getActionSender().sendMessage(this, "You ran out of Summoning skill points, Please restore them.");
  1852. }
  1853. }
  1854. if (deathEmoteDelay > 0) {
  1855. deathEmoteDelay--;
  1856. }
  1857. if (deathEmoteDelay == 0) {
  1858. requestAnim(9055, 0); //836, 2261
  1859. if (usingPrayer(22)) {
  1860. requestGFX(437, 0);
  1861. if (multiwayCombatZone(absX, absY)) {
  1862. try {
  1863. for (Player player : Server.engine.players) {
  1864. if (Misc.getDistance(absX, absY, player.absX, player.absY) <= 1) {
  1865. player.append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
  1866. }
  1867. }
  1868. } catch (Exception e) {
  1869. }
  1870. } else {
  1871. try {
  1872. Server.engine.players[hitIndex].append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
  1873. } catch (Exception e) {
  1874. }
  1875. }
  1876. }
  1877.  
  1878. isDead = true;
  1879. deathDelay = 4;
  1880. deathEmoteDelay = -1;
  1881. }
  1882. if (massYellDelay > 0) {
  1883. massYellDelay--;
  1884. }
  1885. if (clickDelay > 0) {
  1886. clickDelay--;
  1887. }
  1888. if (teleDelay > 0) {
  1889. teleDelay--;
  1890. }
  1891. if (equipSpecDelay > 0) {
  1892. equipSpecDelay--;
  1893. }
  1894. if (waveDelay > 0) {
  1895. waveDelay--;
  1896. }
  1897. if (waveDelay == 0) {
  1898. fCave.fightSystem();
  1899. }
  1900. if (countDelay > 0) {
  1901. countDelay--;
  1902. }
  1903. if (countDelay == 0) {
  1904. if (countType >= 0) {
  1905. if (countType == 3) {
  1906. requestForceChat("3");
  1907. } else if (countType == 2) {
  1908. requestForceChat("2");
  1909. } else if (countType == 1) {
  1910. requestForceChat("1");
  1911. } else if (countType == 0) {
  1912. requestForceChat("FIGHT!");
  1913. }
  1914. countType--;
  1915. countDelay = 3;
  1916. } else {
  1917. countType = -1;
  1918. countDelay = -1;
  1919. }
  1920. }
  1921. if (explodeDelay > 0) {
  1922. explodeDelay--;
  1923. }
  1924. if (explodeDelay == 0) {
  1925. appendPotion();
  1926. }
  1927. if (rangeDmgDelay > 0) {
  1928. rangeDmgDelay--;
  1929. }
  1930. if (rangeDmgDelay == 0) {
  1931. PlayerCombat PC2 = new PlayerCombat(this);
  1932. PC2.appendRangeDamage();
  1933. }
  1934. if (rangeDmgDelay2 > 0) {
  1935. rangeDmgDelay2--;
  1936. }
  1937. if (rangeDmgDelay2 == 0) {
  1938. PlayerCombat PC2 = new PlayerCombat(this);
  1939. PC2.appendRangeDamage();
  1940. }
  1941. if (damageSpecDelay > 0) {
  1942. damageSpecDelay--;
  1943. }
  1944. if (damageSpecDelay == 0 && enableSpecDamage) {
  1945. PlayerCombat playCb2 = new PlayerCombat(this);
  1946. playCb2.appendNpcDamageMeleeSpec();
  1947. }
  1948. if (damageDelay1 > 0) {
  1949. damageDelay1--;
  1950. }
  1951. if (damageDelay1 == 0 && enableDamage) {
  1952. PlayerCombat playerCb = new PlayerCombat(this);
  1953. playerCb.appendNpcDamageMelee();
  1954. }
  1955. if (atkDelay > 0) {
  1956. atkDelay--;
  1957. }
  1958. if (atkDelay == 0 && attackingNpc) {
  1959. PlayerCombat playCb = new PlayerCombat(this);
  1960. playCb.attackNpc();
  1961. }
  1962. if (buryDelay > 0) {
  1963. buryDelay--;
  1964. }
  1965. if (battleCDelay > 0) {
  1966. battleCDelay--;
  1967. }
  1968. if (battleCDelay == 0) {
  1969. battleCount = 0;
  1970. battleCDelay = -1;
  1971. }
  1972. if (pickPocketDelay > 0) {
  1973. pickPocketDelay--;
  1974. }
  1975. if (skullVanishDelay > 0) {
  1976. skullVanishDelay--;
  1977. }
  1978. if (skullVanishDelay == 0 && isSkulled) {
  1979. headIconSkull = -1;
  1980. isSkulled = false;
  1981. skullVanishDelay = 0;
  1982. appearanceUpdateReq = true;
  1983. updateReq = true;
  1984. }
  1985. if (eatDelay > 0) {
  1986. eatDelay--;
  1987. }
  1988. if (drinkDelay > 0) {
  1989. drinkDelay--;
  1990. }
  1991.  
  1992. if (statDelay > 0) {
  1993. statDelay -= usingPrayer(8) ? 2 : 1;
  1994. } else {
  1995. updateStats();
  1996. }
  1997. if (hpDelay > 0) {
  1998. hpDelay -= usingPrayer(9) ? 2 : 1;
  1999. } else {
  2000. restoreHP();
  2001. }
  2002.  
  2003. if (poisonDelay > 0) {
  2004. poisonDelay--;
  2005. }
  2006. if (isPoisoned && poisonDelay == 0) {
  2007. double intreval = (poisonHitCount / 3) - poisonIntrevals;
  2008. if (poisonHitCount == 0) {
  2009. poisonDamage = getStartingPoisonDamage(Server.engine.players[enemyIndex]);
  2010. } else if (intreval == 1) {
  2011. poisonIntrevals++;
  2012. poisonDamage -= poisonIntrevals;
  2013. }
  2014. if (poisonDamage == 0) {
  2015. isPoisoned = false;
  2016. poisonHitCount = 0;
  2017. poisonIntrevals = 0;
  2018. getActionSender().sendMessage(this, "The poison wears off.");
  2019. return;
  2020. }
  2021. appendHit(poisonDamage, 1);
  2022. poisonDelay = 100;
  2023. poisonHitCount++;
  2024. }
  2025.  
  2026. if (specFillDelay > 0) {
  2027. if (specAmount < 1000) {
  2028. specFillDelay--;
  2029. } else {
  2030. specFillDelay = 50;
  2031. }
  2032. } else {
  2033. if (specAmount < 1000) {
  2034. if (specAmount - 100 > 900) {
  2035. specAmount = 1000;
  2036. } else {
  2037. specAmount += 100;
  2038. }
  2039. getActionSender().setConfig2(this, 300, specAmount);
  2040. }
  2041. specFillDelay = 50;
  2042. }
  2043.  
  2044. if (animClickDelay > 0) {
  2045. animClickDelay--;
  2046. }
  2047. if (agilityDelay > 0) {
  2048. agilityDelay--;
  2049. }
  2050. if (agilityDelay == 0 && agilityPerforming) {
  2051. PlayerAgility pa = new PlayerAgility(this);
  2052. pa.resetPerforming();
  2053. }
  2054. if (deathDelay > 0) {
  2055. deathDelay--;
  2056. }
  2057. if (waitDeathDelay > 0) {
  2058. waitDeathDelay--;
  2059. }
  2060.  
  2061. //if (skillLvl[3] <= 0 && waitDeathDelay == -1 && !randomVariable) {
  2062. // waitDeathDelay = 3;
  2063. // resetAttack();
  2064. // deathEmoteDelay = 3;
  2065. // if (duelFight())
  2066. // duelDeath = true;
  2067. // randomVariable = true;
  2068. // isDead = true;
  2069. //}
  2070.  
  2071. if (deathDelay == 0 && isDead) {
  2072. appendDeath();
  2073. }
  2074. if (combatDelay > 0) {
  2075. combatDelay--;
  2076. }
  2077. if (attackingPlayer) {
  2078. attackPlayer();
  2079. }
  2080. if (damageDelay > 0) {
  2081. damageDelay--;
  2082. }
  2083. if (damageDelay == 0) {
  2084. PlayerCombat PC = new PlayerCombat(this);
  2085. PC.appendDamages();
  2086. }
  2087. if (mageDelay > 0) {
  2088. mageDelay--;
  2089. }
  2090. if (specDelay > 0) {
  2091. specDelay--;
  2092. }
  2093. if (specDelay == 0) {
  2094. PlayerCombat PC1 = new PlayerCombat(this);
  2095. PC1.appendSpecDamage();
  2096. }
  2097. if (secondSpecDelay > 0) {
  2098. secondSpecDelay--;
  2099. }
  2100. if (secondSpecDelay == 0) {
  2101. PlayerCombat PC1 = new PlayerCombat(this);
  2102. PC1.appendSecondSpecDamage();
  2103. }
  2104. if (delayedDamageDelay > 0) {
  2105. delayedDamageDelay--;
  2106. }
  2107. if (delayedDamageDelay == 0) {
  2108. PlayerCombat PC1 = new PlayerCombat(this);
  2109. PC1.appendDelayedDamage(delayedDamageHit);
  2110. }
  2111. if (runEnergyDelay > 0) {
  2112. runEnergyDelay--;
  2113. } else {
  2114. if (runEnergy < 100) {
  2115. runEnergy++;
  2116. runEnergyUpdateReq = true;
  2117. }
  2118. runEnergyDelay = 4;
  2119. }
  2120. if (itemPickup) {
  2121. Engine.packets.pickupItem.handlePacket(this, 0, 0);
  2122. }
  2123. if (playerOption1) {
  2124. Engine.packets.playerOption1.handlePacket(this, 0, 0);
  2125. }
  2126. if (playerOption2) {
  2127. Engine.packets.playerOption2.handlePacket(this, 0, 0);
  2128. }
  2129. if (playerOption3) {
  2130. Engine.packets.playerOption3.handlePacket(this, 0, 0);
  2131. }
  2132. if (npcOption1) {
  2133. Engine.packets.npcOption1.handlePacket(this, 0, 0);
  2134. }
  2135. if (npcOption2) {
  2136. Engine.packets.npcOption2.handlePacket(this, 0, 0);
  2137. }
  2138. if (objectOption1) {
  2139. Engine.packets.objectOption1.handlePacket(this, 0, 0);
  2140. }
  2141. if (objectOption2) {
  2142. Engine.packets.objectOption2.handlePacket(this, 0, 0);
  2143. }
  2144. if (runEnergyUpdateReq) {
  2145. getActionSender().setEnergy(this);
  2146. runEnergyUpdateReq = false;
  2147. }
  2148. appendWilderness();
  2149. if (teleDelay == 0) {
  2150. teleDelay = -1;
  2151. if (teletab) {
  2152. requestAnim(teleFinishAnim, 0);
  2153. requestGFX(teleFinishGFX, teleFinishGFXHeight);
  2154. teleDelay = 2;
  2155. teleFinishAnim = playerWeapon.getStandEmote(equipment[3]);
  2156. teleFinishGFX = -1;
  2157. } else {
  2158. setCoords(teleX, teleY, teleH);
  2159. if (teleFinishAnim != -1) {
  2160. requestAnim(teleFinishAnim, 0);
  2161. }
  2162. if (teleFinishGFX != -1) {
  2163. requestGFX(teleFinishGFX, teleFinishGFXHeight);
  2164. }
  2165. }
  2166. if (!teletab) {
  2167. teleX = teleY = -1;
  2168. }
  2169. teletab = false;
  2170. }
  2171. if (clickDelay == 0) {
  2172. clickDelay = -1;
  2173. }
  2174. }
  2175.  
  2176.  
  2177. public void potion(int potionID) {
  2178. int root = 0;
  2179. int toAdd = 0;
  2180. int i = 0;
  2181. switch (potionID) {
  2182. case 2436:
  2183. case 145:
  2184. case 147:
  2185. case 149:
  2186. root = getLevelForXP(0);
  2187. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  2188. if ((skillLvl[0] + toAdd) > (root + toAdd)) {
  2189. skillLvl[0] = root + toAdd;
  2190. } else {
  2191. skillLvl[0] += toAdd;
  2192. }
  2193. getActionSender().setSkillLvl(this, 0);
  2194. break;
  2195.  
  2196. case 2440:
  2197. case 157:
  2198. case 159:
  2199. case 161:
  2200. root = getLevelForXP(2);
  2201. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  2202. if ((skillLvl[2] + toAdd) > (root + toAdd)) {
  2203. skillLvl[2] = root + toAdd;
  2204. } else {
  2205. skillLvl[2] += toAdd;
  2206. }
  2207. getActionSender().setSkillLvl(this, 2);
  2208. break;
  2209.  
  2210. case 2442:
  2211. case 163:
  2212. case 165:
  2213. case 167:
  2214. root = getLevelForXP(1);
  2215. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  2216. if ((skillLvl[1] + toAdd) > (root + toAdd)) {
  2217. skillLvl[1] = root + toAdd;
  2218. } else {
  2219. skillLvl[1] += toAdd;
  2220. }
  2221. getActionSender().setSkillLvl(this, 1);
  2222. break;
  2223.  
  2224. case 2444:
  2225. case 169:
  2226. case 171:
  2227. case 173:
  2228. root = getLevelForXP(4);
  2229. toAdd = 4 + (int)Math.round(root * 0.0909090909);
  2230. if ((skillLvl[4] + toAdd) > (root + toAdd)) {
  2231. skillLvl[4] = root + toAdd;
  2232. } else {
  2233. skillLvl[4] += toAdd;
  2234. }
  2235. getActionSender().setSkillLvl(this, 4);
  2236. break;
  2237.  
  2238. case 3040:
  2239. case 3042:
  2240. case 3044:
  2241. case 3046:
  2242. if (skillLvl[6] + 4 > getLevelForXP(6) + 4) {
  2243. skillLvl[6] = getLevelForXP(6) + 4;
  2244. } else {
  2245. skillLvl[6] += 4;
  2246. }
  2247. getActionSender().setSkillLvl(this, 6);
  2248. break;
  2249.  
  2250. case 2428:
  2251. case 121:
  2252. case 123:
  2253. case 125:
  2254. root = getLevelForXP(0);
  2255. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  2256. if ((skillLvl[0] + toAdd) > (root + toAdd)) {
  2257. skillLvl[0] = root + toAdd;
  2258. } else {
  2259. skillLvl[0] += toAdd;
  2260. }
  2261. getActionSender().setSkillLvl(this, 0);
  2262. break;
  2263.  
  2264. case 113:
  2265. case 115:
  2266. case 117:
  2267. case 119:
  2268. root = getLevelForXP(2);
  2269. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  2270. if ((skillLvl[2] + toAdd) > (root + toAdd)) {
  2271. skillLvl[2] = root + toAdd;
  2272. } else {
  2273. skillLvl[2] += toAdd;
  2274. }
  2275. getActionSender().setSkillLvl(this, 2);
  2276. break;
  2277.  
  2278. case 2432:
  2279. case 133:
  2280. case 135:
  2281. case 137:
  2282. root = getLevelForXP(1);
  2283. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  2284. if ((skillLvl[1] + toAdd) > (root + toAdd)) {
  2285. skillLvl[1] = root + toAdd;
  2286. } else {
  2287. skillLvl[1] += toAdd;
  2288. }
  2289. getActionSender().setSkillLvl(this, 1);
  2290. break;
  2291.  
  2292. case 2434:
  2293. case 139:
  2294. case 141:
  2295. case 143:
  2296. root = getLevelForXP(5);
  2297. toAdd = 7 + (int)Math.round(root * 0.2424242424);
  2298. if ((skillLvl[5] + toAdd) > root) {
  2299. if (skillLvl[5] < root) {
  2300. skillLvl[5] = root;
  2301. }
  2302. } else {
  2303. skillLvl[5] += toAdd;
  2304. }
  2305. getActionSender().setSkillLvl(this, 5);
  2306. break;
  2307.  
  2308. case 2430:
  2309. case 127:
  2310. case 129:
  2311. case 131:
  2312. while (i <= 6) {
  2313. if (i == 3 || i == 5) {
  2314. i++;
  2315. }
  2316. root = getLevelForXP(i);
  2317. toAdd = 10 + (int)Math.round(root * 0.2929292929);
  2318. if ((skillLvl[i] + toAdd) > root) {
  2319. if (skillLvl[i] < root) {
  2320. skillLvl[i] = root;
  2321. }
  2322. } else {
  2323. skillLvl[i] += toAdd;
  2324. }
  2325. getActionSender().setSkillLvl(this, i);
  2326. i++;
  2327. }
  2328. break;
  2329.  
  2330. case 3024:
  2331. case 3026:
  2332. case 3028:
  2333. case 3030:
  2334. while (i <= 23) {
  2335. if (i == 3) {
  2336. i++;
  2337. }
  2338. root = getLevelForXP(i);
  2339. toAdd = 8 + (int)Math.round(root * 0.2424242424);
  2340. if ((skillLvl[i] + toAdd) > root) {
  2341. if (skillLvl[i] < root) {
  2342. skillLvl[i] = root;
  2343. }
  2344. } else {
  2345. skillLvl[i] += toAdd;
  2346. }
  2347. getActionSender().setSkillLvl(this, i);
  2348. i++;
  2349. }
  2350. break;
  2351.  
  2352. case 6685:
  2353. case 6687:
  2354. case 6689:
  2355. case 6691:
  2356. while (i <= 6) {
  2357. if (i == 5) {
  2358. i++;
  2359. }
  2360. root = getLevelForXP(i);
  2361. if (i == 0 || i == 2 || i == 4 || i == 6) {
  2362. toAdd = -1 * (2 + (int)Math.round(root * 0.0707070707));
  2363. if ((skillLvl[i] + toAdd) < 0) {
  2364. skillLvl[i] = 0;
  2365. } else {
  2366. skillLvl[i] += toAdd;
  2367. }
  2368. } else {
  2369. toAdd = 2 + (int)Math.round(root * (i == 1 ? 0.1919191919 : 0.1414141414));
  2370. if (skillLvl[i] + toAdd > root + toAdd) {
  2371. skillLvl[i] = root + toAdd;
  2372. } else {
  2373. skillLvl[i] += toAdd;
  2374. }
  2375. }
  2376. getActionSender().setSkillLvl(this, i);
  2377. i++;
  2378. }
  2379. break;
  2380.  
  2381. case 2450:
  2382. case 189:
  2383. case 191:
  2384. case 193:
  2385. while (i <= 5) {
  2386. if (i == 4) {
  2387. i++;
  2388. }
  2389. root = getLevelForXP(i);
  2390. if (i == 5) {
  2391. toAdd = 9;
  2392. if (skillLvl[i] + toAdd > root) {
  2393. if (skillLvl[i] < root) {
  2394. skillLvl[i] = root;
  2395. }
  2396. } else {
  2397. skillLvl[i] += toAdd;
  2398. }
  2399. break;
  2400. }
  2401. if (i == 1 || i == 3) {
  2402. toAdd = -1 * (2 + (int)Math.round(root * 0.0909090909));
  2403. if (i == 3) {
  2404. append1Hit(-1 * toAdd, 0);
  2405. } else {
  2406. if ((skillLvl[i] + toAdd) < 0) {
  2407. skillLvl[i] = 0;
  2408. } else {
  2409. skillLvl[i] += toAdd;
  2410. }
  2411. }
  2412. } else {
  2413. toAdd = 2 + (int)Math.round(root * (i == 0 ? 0.1919191919 : 0.1111111111));
  2414. if (skillLvl[i] + toAdd > root + toAdd) {
  2415. skillLvl[i] = root + toAdd;
  2416. } else {
  2417. skillLvl[i] += toAdd;
  2418. }
  2419. }
  2420. getActionSender().setSkillLvl(this, i);
  2421. i++;
  2422. }
  2423. break;
  2424. }
  2425. requestAnim(829, 0);
  2426. getActionSender().addSoundEffect(this, 2401, 1, 0, 0);
  2427. combatDelay = 6;
  2428. eatDelay = 3;
  2429. drinkDelay = 3;
  2430. }
  2431.  
  2432. public void food(int foodID) {
  2433. int healAmount = 0;
  2434. int toDelayCombat = 6;
  2435. int toDelayEat = 3;
  2436. switch (foodID) {
  2437. case 373: healAmount = 14; break;
  2438. case 379: healAmount = 12; break;
  2439. case 385: healAmount = 20; break;
  2440. case 391: healAmount = 22; break;
  2441. case 3144:
  2442. healAmount = 18;
  2443. toDelayCombat = combatDelay;
  2444. drinkDelay = 3;
  2445. break;
  2446. case 7060: healAmount = 22; break;
  2447. case 7946: healAmount = 16; break;
  2448. case 10476:
  2449. healAmount = 1 + Misc.random(2);
  2450. runEnergy += runEnergy * .10;
  2451. runEnergyUpdateReq = true;
  2452. if (runEnergy + (runEnergy * .10) > 100) {
  2453. runEnergy = 100;
  2454. }
  2455. break;
  2456. }
  2457. requestAnim(829, 0);
  2458. getActionSender().addSoundEffect(this, 2393, 1, 0, 0);
  2459. updateHP(healAmount, true);
  2460. getActionSender().sendMessage(this, "You eat the "+Engine.items.getItemName(foodID)+".");
  2461. combatDelay = toDelayCombat;
  2462. eatDelay = toDelayEat;
  2463. }
  2464.  
  2465. public String lastKilled = "";
  2466. public boolean receivesPVPDrop(Player p, Player opp) {
  2467. if (Server.socketListener.getAddress(p.socket.socket).equals(Server.socketListener.getAddress(opp.socket.socket))) {
  2468. return false;
  2469. }
  2470. return true;
  2471. }
  2472.  
  2473.  
  2474. public void appendDeath() {
  2475. public void appendDeath() {
  2476. if (deathDelay == 0 && isDead) {
  2477. Player opp = Server.engine.players[hitIndex];
  2478.  
  2479. try {
  2480. if (rights < 4) {
  2481. dropStuff(opp.username);
  2482. }
  2483.  
  2484. if (!inBounty) {
  2485. getActionSender().sendMessage(opp, getKillMessage(username));
  2486. }
  2487. if (receivesPVPDrop(this, opp)) {
  2488. opp.kills++;
  2489. opp.totalKills++;
  2490.  
  2491. DC++;
  2492. opp.KC++;
  2493. }
  2494.  
  2495. if (Server.socketListener.getAddress(socket.socket).equals(opp.lastKilled)) {
  2496. Engine.fileManager.appendData("characters/logs/flagged.txt", opp.username);
  2497. }
  2498. opp.lastKilled = Server.socketListener.getAddress(socket.socket);
  2499. Engine.fileManager.appendData("characters/logs/kills/"+opp.username+".txt", username);
  2500. } catch (Exception e) {
  2501. }
  2502.  
  2503. for (int i = 0; i < skillLvl.length; i++) {
  2504. skillLvl[i] = getLevelForXP(i);
  2505. getActionSender().setSkillLvl(this, i);
  2506. }
  2507. for (int i = 0; i < 1000; i++) {
  2508. requestAnim(playerWeapon.getStandEmote(equipment[3]), 0);
  2509. }
  2510.  
  2511. if (opp != null) {
  2512. opp.attacking = null;
  2513. opp.attackedBy = null;
  2514. opp.oppIndex = 0;
  2515. opp.hitIndex = 0;
  2516. opp.resetAttack();
  2517. opp.requestFaceTo(65535);
  2518. }
  2519. attacking = null;
  2520. attackedBy = null;
  2521. oppIndex = 0;
  2522. hitIndex = 0;
  2523. resetAttack();
  2524.  
  2525. if(inBounty) {
  2526. int i = heightLevel;
  2527. if(opp != null) {
  2528. if (opp.playerId == bhTarget || (playerId == opp.bhTarget)) {
  2529. opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
  2530. getActionSender().sendMessage(opp, "You killed "+username+". They were your target, so your Hunter PvP rating increases!");
  2531. leftBhTimer = 120;
  2532. this.InBounty = 0;
  2533. //opp.bhTarget = Engine.BountyHunter.getTargetHigh(opp);
  2534. Engine.BountyHunter.removeHigh(this);
  2535. Engine.BountyHunter.exit(this, 3);
  2536. Engine.BountyHunter.exit(this, 2);
  2537. Engine.BountyHunter.exit(this, 1);
  2538. }
  2539.  
  2540. if(inBounty) {
  2541. if(opp != null) {
  2542. if (opp.playerId != bhTarget || (playerId != opp.bhTarget)) {
  2543. opp.bhLeave = 180;
  2544. opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
  2545. getActionSender().sendMessage(opp, "You killed "+username+". They were not your target, so your Rougue PvP rating increases!");
  2546. getActionSender().sendMessage(opp, "This means that you got the pickup penalty, pick up anything and you cant leave!");
  2547. leftBhTimer = 120;
  2548. this.InBounty = 0;
  2549. this.bhLeave = 0;
  2550. this.bhPickup = 0;
  2551. Engine.BountyHunter.removeHigh(this);
  2552. Engine.BountyHunter.exit(this, 3);
  2553. Engine.BountyHunter.exit(this, 2);
  2554. Engine.BountyHunter.exit(this, 1);
  2555. }
  2556. } else {
  2557. //opp.bhTarget = Engine.BountyHunter.getTargetHigh(this);
  2558. }
  2559. Player p3 = Engine.players[opp.bhTarget];
  2560. if(p3 != null) {
  2561. opp.getActionSender().setString(opp, "" + p3.username , 653, 8);
  2562. } else {
  2563. opp.getActionSender().setString(opp, "None" , 653, 8);
  2564. }
  2565. }
  2566. getActionSender().removeOverlay(this);
  2567. headIconSkull = -1;
  2568. appearanceUpdateReq = updateReq = true;
  2569. if(i == 0) {
  2570. Engine.BountyHunter.removeLow(this);
  2571. } else if(i == 0) {
  2572. Engine.BountyHunter.removeMid(this);
  2573. } else {
  2574. Engine.BountyHunter.removeHigh(this);
  2575. }
  2576. setCoords(3172, 3675, 0);
  2577. } else {
  2578. Engine.BountyHunter.exit(this, 3);
  2579. Engine.BountyHunter.exit(this, 2);
  2580. Engine.BountyHunter.exit(this, 1);
  2581. setCoords(3661, 3497, 0);
  2582. }
  2583. }
  2584.  
  2585. else setCoords(3167, 3477, 4);
  2586. getActionSender().sendMessage(this, "Oh dear, forehead down!");
  2587.  
  2588.  
  2589. deathDelay = -1;
  2590. isDead = false;
  2591.  
  2592. magicGraphicDelay = -1;
  2593. magicDamageDelay = -1;
  2594.  
  2595. initialAttack = false;
  2596. isSkulled = false;
  2597. headIconSkull = -1;
  2598. skullVanishDelay = 0;
  2599.  
  2600. isPoisoned = false;
  2601. poisonHitCount = 0;
  2602. poisonDelay = 0;
  2603.  
  2604. specAmount = 1000;
  2605. getActionSender().setConfig2(this, 300, 1000);
  2606.  
  2607. resetPrayer();
  2608.  
  2609. getActionSender().removeOverlay(this);
  2610.  
  2611. appearanceUpdateReq = true;
  2612. updateReq = true;
  2613. }
  2614. }
  2615.  
  2616. public void resetAttack() {
  2617. attackingPlayer = false;
  2618. enemyIndex = 0;
  2619. oppIndex = 0;
  2620. hitOne = false;
  2621. hitTwo = false;
  2622. hitThree = false;
  2623. hitFour = false;
  2624. hit1 = 0;
  2625. hit2 = 0;
  2626. hit3 = 0;
  2627. hit4 = 0;
  2628. specDelay = -1;
  2629. secondSpecDelay = -1;
  2630. }
  2631.  
  2632. /**
  2633. * Get xp based on your level.
  2634. * @param skillId The skill level to get the level based off XP for.
  2635. * @return Returns the level based on the amount of XP the specified skill has.
  2636. */
  2637. public int getLevelForXP(int skillId) {
  2638. int exp = skillXP[skillId];
  2639. int points = 0;
  2640. int output = 0;
  2641. for (int lvl = 1; lvl < 100; lvl++) {
  2642. points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
  2643. output = (int)Math.floor(points / 4);
  2644. if ((output - 1) >= exp) {
  2645. return lvl;
  2646. }
  2647. }
  2648. return 99;
  2649. }
  2650.  
  2651. /**
  2652. * Calculates equipment bonus.
  2653. */
  2654. public void calculateEquipmentBonus() {
  2655. for (int i = 0; i < equipmentBonus.length; i++) {
  2656. equipmentBonus[i] = 0;
  2657. }
  2658. for (int i = 0; i < equipment.length; i++) {
  2659. if (equipment[i] > -1) {
  2660. for (int j = 0; j < Engine.items.maxListedItems; j++) {
  2661. if (Engine.items.itemLists[j] != null) {
  2662. if (Engine.items.itemLists[j].itemId == equipment[i]) {
  2663. for (int k = 0; k < equipmentBonus.length; k++) {
  2664. equipmentBonus[k] += Engine.items.itemLists[j].bonuses[k];
  2665. }
  2666. break;
  2667. }
  2668. }
  2669. }
  2670. }
  2671. }
  2672. }
  2673.  
  2674. /**
  2675. * Writes the equipment bonus.
  2676. */
  2677. public void setEquipmentBonus() {
  2678. String[] bonusNames = Misc.bonusNames;
  2679. int id = 35;
  2680. for (int i = 0; i < equipmentBonus.length; i++) {
  2681. getActionSender().setString(this, bonusNames[i] + ": " + (equipmentBonus[i] >= 0 ? "+" : "") + equipmentBonus[i], 667, id++);
  2682. if (id == 45) {
  2683. id = 47;
  2684. }
  2685. }
  2686. getActionSender().setString(this, "Summoning: +0", 667, 45);
  2687. }
  2688.  
  2689. public void openBank() {
  2690. getActionSender().setConfig2(this, 563, 4194304);
  2691. getActionSender().setConfig2(this, 1248, -2013265920);
  2692. getActionSender().showInterface(this, 762);
  2693. getActionSender().setInventory(this, 763);
  2694. getActionSender().setBankOptions(this);
  2695. getActionSender().setString(this, "Bank of New Era" , 762, 24);
  2696. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2697. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2698. isBanking = true;
  2699. }
  2700.  
  2701. public void updateHP(int difference, boolean heal) {
  2702. if (skillLvl[3] == 0) {
  2703. return;
  2704. }
  2705. if (heal) {
  2706. skillLvl[3] += difference;
  2707. if (skillLvl[3] > getLevelForXP(3)) {
  2708. skillLvl[3] = getLevelForXP(3);
  2709. }
  2710. } else if (!heal) {
  2711. skillLvl[3] -= difference;
  2712. if (skillLvl[3] <= 0) {
  2713. skillLvl[3] = 0;
  2714. deathEmoteDelay = 3;
  2715. isDead = true;
  2716. attacking = null;
  2717. attackedBy = null;
  2718. Engine.playerMovement.resetWalkingQueue(this);
  2719. requestFaceTo(65535);
  2720. }
  2721. }
  2722. getActionSender().setSkillLvl(this, 3);
  2723. if ((skillLvl[3] <= Math.round(getLevelForXP(3) * 0.10) && skillLvl[3] > 0) && usingPrayer(23)) {
  2724. requestGFX(436, 0);
  2725. getActionSender().addSoundEffect(this, 2681, 1, 0, 0);
  2726. skillLvl[3] += Math.round(getLevelForXP(5) * 0.25);
  2727. skillLvl[5] = 0;
  2728. getActionSender().setSkillLvl(this, 5);
  2729. }
  2730. }
  2731.  
  2732. /**
  2733. * Teleports a player.
  2734. * @param x The x coordinate to teleport to.
  2735. * @param y The y coordinate to teleport to.
  2736. * @param height The height level to teleport to.
  2737. * @param delay The delay before the teleport is done.
  2738. * @param distance The offset you can teleport to, such as 1 for a max offset of x +/- 1 and y +/- 1.
  2739. * @param emoteStart The emote to do right away.
  2740. * @param emoteEnd The emote to do after teleporting.
  2741. * @param gfxStart The graphic to do right away.
  2742. * @param gfxStartH The height level to create the start graphic at.
  2743. * @param gfxEnd The graphic to do after the teleport is done.
  2744. * @param gfxEndH The finish graphic height.
  2745. */
  2746. public void teleportTo(int x, int y, int height, int delay, int distance, int emoteStart, int emoteEnd, int gfxStart,
  2747. int gfxStartH, int gfxEnd, int gfxEndH) {
  2748. if (teleblocked) {
  2749. getActionSender().sendMessage(this, "You are teleport blocked!");
  2750. return;
  2751. }
  2752. if (jailed == 1) {
  2753. getActionSender().sendMessage(this, "You are jailed!");
  2754. return;
  2755. }
  2756. if (getWildernessLevel() >= 20 && !lever && getWildernessLevel() <= 60 && !bountySafe()) {
  2757.  
  2758. getActionSender().sendMessage(this, "A magical force stops you from teleporting.");
  2759. return;
  2760. }
  2761. itemPickup = false;
  2762. playerOption1 = false;
  2763. playerOption2 = false;
  2764. playerOption3 = false;
  2765. npcOption1 = false;
  2766. npcOption2 = false;
  2767. objectOption1 = false;
  2768. objectOption2 = false;
  2769. attackingPlayer = false;
  2770. clickDelay = delay + 2;
  2771. teleDelay = delay;
  2772. if (distance > 0) {
  2773. int xType = Misc.random(1);
  2774. int yType = Misc.random(1);
  2775. int xOffset = Misc.random(distance);
  2776. int yOffset = Misc.random(distance);
  2777. if (xType == 1)
  2778. x += -xOffset;
  2779. else
  2780. x += xOffset;
  2781. if(yType == 1)
  2782. y += -yOffset;
  2783. else
  2784. y += yOffset;
  2785. }
  2786. teleX = x;
  2787. teleY = y;
  2788. teleH = height;
  2789. Engine.playerMovement.resetWalkingQueue(this);
  2790. requestAnim(emoteStart, 0);
  2791. requestGFX(gfxStart, gfxStartH);
  2792. teleFinishGFX = gfxEnd;
  2793. teleFinishGFXHeight = gfxEndH;
  2794. teleFinishAnim = emoteEnd;
  2795. }
  2796.  
  2797. /**
  2798. * Set the player's coordinates.
  2799. * @param x The x coordinate to teleport to.
  2800. * @param y The y coordinate to teleport to.
  2801. */
  2802. public void setCoords(int x, int y, int height) {
  2803. teleportToX = x;
  2804. teleportToY = y;
  2805. heightLevel = height;
  2806. didTeleport = true;
  2807. }
  2808. /**
  2809. *Pm void
  2810. */
  2811. public void friendsLoggedIn() {
  2812. for(Long friend : friends) {
  2813. getActionSender().sendFriend(this, friend, 66);
  2814. }
  2815. long[] array = new long[ignores.size()];
  2816. int i = 0;
  2817. for(Long ignore : ignores) {
  2818. if(ignore != null)
  2819. array[i++] = ignore;
  2820. }
  2821. getActionSender().sendIgnores(this, array);
  2822. long me = Misc.stringToLong(username);
  2823. for(Player p : Engine.players) {
  2824. if(p == null) continue;
  2825. if(p.friends.contains(me)) {
  2826. p.getActionSender().sendFriend(p, me, 66);
  2827. }
  2828. }
  2829. }
  2830.  
  2831. /**
  2832. * Req an animation for this player.
  2833. * @param animId The amination to perform.
  2834. * @param animD The delay before doing the animation.
  2835. */
  2836. public void requestAnim(int animId, int animD) {
  2837. animReq = animId;
  2838. animDelay = animD;
  2839. animUpdateReq = true;
  2840. updateReq = true;
  2841. }
  2842.  
  2843. /**
  2844. * Req an graphic for this player.
  2845. * @param gfxId The graphic to perform.
  2846. * @param gfxD The delay or height or the gfx depending on the value.
  2847. */
  2848. public void requestGFX(int gfxId, int gfxD) {
  2849. if (gfxD >= 100) {
  2850. gfxD += 6553500;
  2851. }
  2852. gfxReq = gfxId;
  2853. gfxDelay = gfxD;
  2854. gfxUpdateReq = true;
  2855. updateReq = true;
  2856. }
  2857.  
  2858. /**
  2859. * Req this player faces NPC or player.
  2860. * @param faceId The target to face.
  2861. */
  2862. public void requestFaceTo(int faceId) {
  2863. faceToReq = faceId;
  2864. faceToUpdateReq = true;
  2865. updateReq = true;
  2866. }
  2867.  
  2868. int poisonDamage;
  2869. int poisonIntrevals = 0;
  2870. public int getStartingPoisonDamage(Player p2) {
  2871. String name = "";
  2872. int damage = 0;
  2873. boolean usingRange = false;
  2874. if ((p2.equipment[3] >= 839 && p2.equipment[3] <= 861) || (p2.equipment[3] >= 9174 && p2.equipment[3] <= 9185) || p2.equipment[3] == 11235) { //Ranged
  2875. name = Engine.items.getItemName(equipment[13]);
  2876. usingRange = true;
  2877. } else { //Melee
  2878. name = Engine.items.getItemName(p2.equipment[3]);
  2879. }
  2880. if (name.contains("(p++)")) {
  2881. damage = usingRange ? 4 : 6;
  2882. }
  2883. if (name.contains("(p+)")) {
  2884. damage = usingRange ? 3 : 5;
  2885. }
  2886. if (name.contains("(p)")) {
  2887. damage = usingRange ? 2 : 4;
  2888. }
  2889. return damage;
  2890. }
  2891.  
  2892. public int totalDamageRecoiled;
  2893.  
  2894. public void appendNPCHit(int damage, int poison) {
  2895. if (damage > skillLvl[3]) {
  2896. damage = skillLvl[3];
  2897. }
  2898. updateHP(damage, false);
  2899. if (!hit1UpdateReq) {
  2900. hitDiff1 = damage;
  2901. poisonHit1 = poison;
  2902. hit1UpdateReq = true;
  2903. } else {
  2904. hitDiff2 = damage;
  2905. poisonHit2 = poison;
  2906. hit2UpdateReq = true;
  2907. }
  2908. updateReq = true;
  2909. }
  2910.  
  2911. public void appendHit(int damage, int poison) {
  2912. Player opp = Server.engine.players[hitIndex];
  2913. if (opp != null) {
  2914. if (opp.isDead) {
  2915. return;
  2916. }
  2917. if (damage > skillLvl[3]) {
  2918. damage = skillLvl[3];
  2919. }
  2920. updateHP(damage, false);
  2921. if (autoRetaliate) {
  2922. enemyIndex = hitIndex;
  2923. attackingPlayer = true;
  2924. }
  2925. int[] skill = {-1, -1, -1};
  2926. if (!usingMage) {
  2927. switch (opp.attackStyle()) {
  2928. case 1:
  2929. skill[0] = 0;
  2930. skill[1] = 0;
  2931. skill[2] = 0;
  2932. break;
  2933. case 2:
  2934. skill[0] = 2;
  2935. skill[1] = 2;
  2936. skill[2] = 2;
  2937. break;
  2938. case 3:
  2939. skill[0] = 1;
  2940. skill[1] = 1;
  2941. skill[2] = 1;
  2942. break;
  2943. case 4:
  2944. skill[0] = 0;
  2945. skill[1] = 1;
  2946. skill[2] = 2;
  2947. break;
  2948. case 5:
  2949. case 6:
  2950. skill[0] = 4;
  2951. skill[1] = 4;
  2952. skill[2] = 4;
  2953. break;
  2954. case 7:
  2955. opp.appendExperience((damage * 200), 4);
  2956. opp.appendExperience((damage * 200), 1);
  2957. opp.appendExperience((damage * 133), 3);
  2958. break;
  2959. }
  2960. for (int i : skill) {
  2961. if (i != -1) {
  2962. opp.appendExperience((damage * 133), i);
  2963. }
  2964. }
  2965. opp.appendExperience((damage * 133), 3);
  2966. }
  2967. if (opp.usingPrayer(24) && poison == 0) { //Smite
  2968. if (skillLvl[5] - (int)Math.round(damage * 0.25) > 0) {
  2969. skillLvl[5] -= (int)Math.round(damage / 4);
  2970. getActionSender().setSkillLvl(this, 5);
  2971. } else {
  2972. skillLvl[5] = 0;
  2973. getActionSender().setSkillLvl(this, 5);
  2974. }
  2975. }
  2976. if (vengeance && poison == 0) { //Vengeance
  2977. if (damage > 0) {
  2978. if (skillLvl[3] > 0) {
  2979. opp.append1Hit(((int)Math.floor(damage * 0.75)), 0);
  2980. } else {
  2981. opp.append1Hit(0, 0);
  2982. }
  2983. requestForceChat("Taste vengeance!");
  2984. vengeance = false;
  2985. }
  2986. }
  2987. if (equipment[12] == 2550 && poison == 0) { //Ring of recoil
  2988. if (damage > 0) {
  2989. if (skillLvl[3] > 0) {
  2990. int recoil = 1 + ((int)Math.floor(damage * 0.10));
  2991. opp.append1Hit(recoil, 0);
  2992. totalDamageRecoiled += recoil;
  2993. if (totalDamageRecoiled >= 40) {
  2994. equipment[12] = -1;
  2995. equipmentN[12] = 0;
  2996. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2997. getActionSender().sendMessage(this, "Your ring of recoil has shattered.");
  2998. totalDamageRecoiled = 0;
  2999. }
  3000. } else {
  3001. opp.append1Hit(0, 0);
  3002. }
  3003. }
  3004. }
  3005. if (opp.barrowsSet(3) && poison == 0) { //Guthans affect
  3006. if (Math.random() <= 0.25) {
  3007. opp.updateHP(damage, true);
  3008. requestGFX(398, 0);
  3009. }
  3010. }
  3011. if (!hit1UpdateReq) {
  3012. hitDiff1 = damage;
  3013. poisonHit1 = poison;
  3014. hit1UpdateReq = true;
  3015. } else {
  3016. hitDiff2 = damage;
  3017. poisonHit2 = poison;
  3018. hit2UpdateReq = true;
  3019. }
  3020. updateReq = true;
  3021. }
  3022. }
  3023.  
  3024. /**
  3025. * Append damage.
  3026. */
  3027. public void append1Hit(int damage, int poison) {
  3028. if (damage > skillLvl[3]) {
  3029. damage = skillLvl[3];
  3030. }
  3031. updateHP(damage, false);
  3032. if (!hit1UpdateReq) {
  3033. hitDiff1 = damage;
  3034. poisonHit1 = poison;
  3035. hit1UpdateReq = true;
  3036. } else {
  3037. hitDiff2 = damage;
  3038. poisonHit2 = poison;
  3039. hit2UpdateReq = true;
  3040. }
  3041. updateReq = true;
  3042. }
  3043.  
  3044. /**
  3045. * Block anims.
  3046. */
  3047. public int getBlockAnim() {
  3048. if (equipment[3] == 4031) {
  3049. return 221;
  3050. }
  3051. if (equipment[5] == 8850) {
  3052. return 4177;
  3053. }
  3054. return 1156;
  3055. }
  3056.  
  3057. /**
  3058. * Block anims.
  3059. */
  3060. public int getBlockAnim1() {
  3061. if (equipment[3] == 4031) {
  3062. return 221;
  3063. }
  3064. if (equipment[3] == 4151) {
  3065. return 1659;
  3066. }
  3067. if (equipment[3] == 4718 ||
  3068. equipment[3] == -1) {
  3069. return 424;
  3070. }
  3071. if (equipment[3] == 4755) {
  3072. return 2063;
  3073. }
  3074. if (equipment[3] == 10887) {
  3075. return 5866;
  3076. }
  3077. if (equipment[3] == 4153) {
  3078. return 1666;
  3079. }
  3080. if (equipment[3] == 11694 ||
  3081. equipment[3] == 11696 ||
  3082. equipment[3] == 11698 ||
  3083. equipment[3] == 11700 ||
  3084. equipment[3] == 1307 ||
  3085. equipment[3] == 1309 ||
  3086. equipment[3] == 1311 ||
  3087. equipment[3] == 1313 ||
  3088. equipment[3] == 1315 ||
  3089. equipment[3] == 1317 ||
  3090. equipment[3] == 1319 ||
  3091. equipment[3] == 7158 ||
  3092. equipment[3] == 11730) {
  3093. return 7050;
  3094. }
  3095. if (equipment[3] == 3204) {
  3096. return 420;
  3097. }
  3098. return 404;
  3099. }
  3100.  
  3101. /**
  3102. * Force chat text.
  3103. */
  3104. public void requestForceChat(String s) {
  3105. forceChat = s;
  3106. forceChatUpdateReq = true;
  3107. updateReq = true;
  3108. }
  3109. public boolean quickChat;
  3110. public void requestForceChat2(String s) {
  3111. quickChat = true;
  3112. chatTextUpdateReq = true;
  3113. chatText = s;
  3114. updateReq = true;
  3115. }
  3116.  
  3117. public int getArmourDef() {
  3118. switch (equipment[4]) {
  3119.  
  3120. case 1127: return 80;
  3121. case 4712: return 120;
  3122. case 4757: return 140;
  3123. case 4720: return 140;
  3124. case 3140: return 100;
  3125. case 10551: return 70;
  3126. case 11720: return 215;
  3127. case 11724: return 220;
  3128. }
  3129. return 10;
  3130. }
  3131.  
  3132. public int getRangeArmourDef() {
  3133. switch (equipment[4]) {
  3134.  
  3135. case 1135: return 115;
  3136. case 2499: return 140;
  3137. case 2501: return 165;
  3138. case 2503: return 190;
  3139. case 11720: return 200;
  3140. }
  3141. return 40;
  3142. }
  3143.  
  3144. public int getRangeBonus() {
  3145. switch (equipment[3]) {
  3146.  
  3147. case 841: return 65;
  3148. case 843: return 80;
  3149. case 845: return 85;
  3150. case 847: return 90;
  3151. case 849: return 95;
  3152. case 851: return 100;
  3153. case 853: return 120;
  3154. case 855: return 130;
  3155. case 857: return 150;
  3156. case 859: return 165;
  3157. case 861: return 180;
  3158. case 9185: return 280;
  3159. case 11235: return 160;
  3160. }
  3161. return 60;
  3162. }
  3163.  
  3164. public boolean defile;
  3165.  
  3166. public void checkVeracs() {
  3167. if (barrowsSet(6)) {
  3168. if (Math.random() <= 0.15) {
  3169. defile = true;
  3170. }
  3171. } else {
  3172. defile = false;
  3173. }
  3174. }
  3175.  
  3176. public double accuracy = 1;
  3177.  
  3178. public double meleeAccuracy(Player opp) {
  3179. if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
  3180. return 1;
  3181. }
  3182. double attack = skillLvl[0];
  3183. double defence = opp.skillLvl[1];
  3184. int activeAttackBonus = weaponStyle(equipment[3]) - 1;
  3185. int activeDefenceBonus = activeAttackBonus + 5;
  3186. double attackBonus = equipmentBonus[activeAttackBonus];
  3187. double defenceBonus = opp.equipmentBonus[activeDefenceBonus];
  3188. if (usingPrayer(2)) {
  3189. attack *= 1.05;
  3190. }
  3191. if (usingPrayer(7)) {
  3192. attack *= 1.10;
  3193. }
  3194. if (usingPrayer(15)) {
  3195. attack *= 1.15;
  3196. }
  3197. if (usingPrayer(25)) {
  3198. attack *= 1.15;
  3199. }
  3200. if (usingPrayer(26)) {
  3201. attack *= 1.20;
  3202. }
  3203. if (attackStyle() == 4) {
  3204. attack += 1;
  3205. }
  3206. if (attackStyle() == 1) {
  3207. attack += 3;
  3208. }
  3209. if (opp.usingPrayer(0)) {
  3210. defence *= 1.05;
  3211. }
  3212. if (opp.usingPrayer(5)) {
  3213. defence *= 1.10;
  3214. }
  3215. if (opp.usingPrayer(13)) {
  3216. defence *= 1.15;
  3217. }
  3218. if (opp.usingPrayer(25)) {
  3219. defence *= 1.20;
  3220. }
  3221. if (opp.usingPrayer(26)) {
  3222. defence *= 1.25;
  3223. }
  3224. if (opp.attackStyle() == 4) {
  3225. defence += 1;
  3226. }
  3227. if (opp.attackStyle() == 3) {
  3228. defence += 3;
  3229. }
  3230. if (attackBonus < 0) {
  3231. attackBonus = 0;
  3232. }
  3233. if (defenceBonus < 0) {
  3234. defenceBonus = 0;
  3235. }
  3236. if (defile) {
  3237. defenceBonus = 0;
  3238. }
  3239. double offensiveAttribute = (attack * 1.5) + attackBonus;
  3240. double defensiveAttribute = (defence * 1.5) + defenceBonus;
  3241. double difference = Math.abs(offensiveAttribute - defensiveAttribute);
  3242. boolean positive = offensiveAttribute > defensiveAttribute;
  3243. double interval = difference * 0.0015;
  3244. double percentage = 0.55;
  3245. if (!positive) {
  3246. percentage -= interval;
  3247. }
  3248. if (positive) {
  3249. percentage += interval;
  3250. }
  3251. if (accuracy != 1) {
  3252. percentage *= accuracy;
  3253. accuracy = 1;
  3254. }
  3255. return percentage;
  3256. }
  3257.  
  3258. public boolean hitPlayer(Player opp) {
  3259. return Math.random() <= meleeAccuracy(opp);
  3260. }
  3261.  
  3262. public double rangeAccuracy(Player opp) {
  3263. if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
  3264. return 1;
  3265. }
  3266. double range = skillLvl[4];
  3267. double defence = opp.skillLvl[1];
  3268. double rangeBonus = equipmentBonus[4];
  3269. double defenceBonus = opp.equipmentBonus[9];
  3270. if (usingPrayer(3)) {
  3271. range *= 1.05;
  3272. }
  3273. if (usingPrayer(11)) {
  3274. range *= 1.10;
  3275. }
  3276. if (usingPrayer(20)) {
  3277. range *= 1.15;
  3278. }
  3279. if (attackStyle() == 5) {
  3280. range += 1;
  3281. }
  3282. if (opp.usingPrayer(0)) {
  3283. defence *= 1.05;
  3284. }
  3285. if (opp.usingPrayer(5)) {
  3286. defence *= 1.10;
  3287. }
  3288. if (opp.usingPrayer(13)) {
  3289. defence *= 1.15;
  3290. }
  3291. if (opp.usingPrayer(25)) {
  3292. defence *= 1.20;
  3293. }
  3294. if (opp.usingPrayer(26)) {
  3295. defence *= 1.25;
  3296. }
  3297. if (opp.attackStyle() == 4) {
  3298. defence += 1;
  3299. }
  3300. if (opp.attackStyle() == 3) {
  3301. defence += 3;
  3302. }
  3303. if (rangeBonus < 0) {
  3304. rangeBonus = 0;
  3305. }
  3306. if (defenceBonus < 0) {
  3307. defenceBonus = 0;
  3308. }
  3309. double offensiveAttribute = range + rangeBonus;
  3310. double defensiveAttribute = defence + defenceBonus;
  3311. double difference = Math.abs(offensiveAttribute - defensiveAttribute);
  3312. boolean positive = offensiveAttribute > defensiveAttribute;
  3313. double interval = difference * 0.00175;
  3314. double percentage = 0.50;
  3315. if (!positive) {
  3316. percentage -= interval;
  3317. }
  3318. if (positive) {
  3319. percentage += interval;
  3320. }
  3321. if (accuracy != 1) {
  3322. percentage *= accuracy;
  3323. accuracy = 1;
  3324. }
  3325. return percentage;
  3326. }
  3327.  
  3328. public boolean hitPlayerRange(Player opp) {
  3329. return Math.random() <= rangeAccuracy(opp);
  3330. }
  3331.  
  3332. public boolean barrowsSet(int setID) {
  3333. String helmet = Engine.items.getItemName(equipment[0]);
  3334. String platebody = Engine.items.getItemName(equipment[4]);
  3335. String weapon = Engine.items.getItemName(equipment[3]);
  3336. String platelegs = Engine.items.getItemName(equipment[7]);
  3337. String set = "";
  3338. switch (setID) {
  3339. case 1: //Ahrim's
  3340. set = "Ahrim";
  3341. break;
  3342. case 2: //Dharok's
  3343. set = "Dharok";
  3344. break;
  3345. case 3: //Guthan's
  3346. set = "Guthan";
  3347. break;
  3348. case 4: //Karil's
  3349. set = "Karil";
  3350. break;
  3351. case 5: //Torag's
  3352. set = "Torag";
  3353. break;
  3354. case 6: //Verac's
  3355. set = "Verac";
  3356. break;
  3357. }
  3358. boolean hasHelmet = helmet.contains(set);
  3359. boolean hasPlatebody = platebody.contains(set);
  3360. boolean hasWeapon = weapon.contains(set);
  3361. boolean hasPlatelegs = platelegs.contains(set);
  3362. if (hasHelmet && hasPlatebody && hasWeapon && hasPlatelegs) {
  3363. return true;
  3364. }
  3365. return false;
  3366. }
  3367. public boolean voidSet(int setID) {
  3368. String helmet = Engine.items.getItemName(equipment[0]);
  3369. String set = "";
  3370. switch (setID) {
  3371. case 1: //Melee
  3372. set = "Void melee";
  3373. break;
  3374. case 2: //Range
  3375. set = "Void ranger";
  3376. break;
  3377. case 3: //Mage
  3378. set = "Void mage";
  3379. break;
  3380. }
  3381. boolean hasHelmet = helmet.contains(set);
  3382. boolean hasTop = equipment[4] == 8839;
  3383. boolean hasGloves = equipment[9] == 8842;
  3384. boolean hasBottom = equipment[7] == 8840;
  3385. if (hasHelmet && hasTop && hasGloves && hasBottom) {
  3386. return true;
  3387. }
  3388. return false;
  3389. }
  3390.  
  3391. public boolean hasProperArrows(int bow, int arrows) {
  3392. if (usingSpecial) {
  3393. if (weapon == 861 || weapon == 11235) {
  3394. if (equipmentN[13] <= 1) {
  3395. getActionSender().sendMessage(this, "You don't have enough ammo!");
  3396. return false;
  3397. }
  3398. }
  3399. }
  3400. if (bow >= 839 && bow <= 861) {
  3401. switch (arrows) {
  3402. case 882:
  3403. case 884:
  3404. case 886:
  3405. case 888:
  3406. case 890:
  3407. case 892: return true;
  3408. }
  3409. }
  3410. if (bow == 6724) {
  3411. switch (arrows) {
  3412. case 882:
  3413. case 884:
  3414. case 886:
  3415. case 888:
  3416. case 890:
  3417. case 892: return true;
  3418. }
  3419. }
  3420. if (bow == 11235) {
  3421. switch (arrows) {
  3422. case 882:
  3423. case 884:
  3424. case 886:
  3425. case 888:
  3426. case 890:
  3427. case 892:
  3428. case 11212:
  3429. if (equipmentN[13] > 1) {
  3430. return true;
  3431. } else {
  3432. getActionSender().sendMessage(this, "You don't have enough ammo!");
  3433. return false;
  3434. }
  3435. }
  3436. }
  3437. if (bow == 4214 || bow == 868 || bow == 11230 || bow == 13879 || bow == 13883) {
  3438. return true;
  3439. }
  3440. if (bow == 9185) {
  3441. switch (arrows) {
  3442. case 9243:
  3443. case 9244: return true;
  3444. }
  3445. }
  3446. if (bow == 4734) {
  3447. if (arrows == 4740) return true;
  3448. }
  3449. return false;
  3450. }
  3451.  
  3452. public boolean hitNpcRange() {
  3453. PlayerCombat playCb = new PlayerCombat(this);
  3454. if (getRandom(equipmentBonus[8] + getRangeBonus()) > getRandom(playCb.getNpcDefenceRange())) {
  3455. return true;
  3456. }
  3457. return false;
  3458. }
  3459.  
  3460. private int getRandom(int range) {
  3461. return (int)(Math.random() * (range + 1));
  3462. }
  3463.  
  3464. /**
  3465. * Gives experience to a player.
  3466. * @param amount The amount which will gives to the player
  3467. * @param skillId the skill Id of the player which the exp will go to.
  3468. */
  3469. public void appendExperience(int amount, int skillId) {
  3470. if (!getExperience) {
  3471. return;
  3472. }
  3473. int oldLvl = getLevelForXP(skillId);
  3474. if (skillXP[skillId] > 200000000) {
  3475. return;
  3476. }
  3477. skillXP[skillId] += amount;
  3478. int newLvl = getLevelForXP(skillId);
  3479. if (oldLvl < newLvl) {
  3480. skillLvl[skillId] += (newLvl - oldLvl);
  3481. switch (skillId) {
  3482.  
  3483. case 0:
  3484. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Attack level!");
  3485. break;
  3486.  
  3487. case 1:
  3488. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Defence level!");
  3489. break;
  3490.  
  3491. case 2:
  3492. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Strength level!");
  3493. break;
  3494.  
  3495. case 3:
  3496. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new hitpoints level!");
  3497. break;
  3498.  
  3499. case 4:
  3500. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Ranged level!");
  3501. break;
  3502.  
  3503. case 5:
  3504. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Prayer level!");
  3505. break;
  3506.  
  3507. case 6:
  3508. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Magic level!");
  3509. break;
  3510.  
  3511. case 7:
  3512. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Cooking level!");
  3513. break;
  3514.  
  3515. case 8:
  3516. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Woodcutting level!");
  3517. break;
  3518.  
  3519. case 16:
  3520. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Agility level!");
  3521. break;
  3522.  
  3523. case 17:
  3524. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Thieving level!");
  3525. break;
  3526.  
  3527. case 18:
  3528. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Slayer level!");
  3529. break;
  3530.  
  3531. case 19:
  3532. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Farming level!");
  3533. break;
  3534.  
  3535. case 20:
  3536. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Runecrafting level!");
  3537. break;
  3538.  
  3539. default:
  3540. getActionSender().sendMessage(this, "This level is unknown, Please report this to an administrator.");
  3541. break;
  3542. }
  3543. requestGFX(1635, 0);
  3544. appearanceUpdateReq = true;
  3545. updateReq = true;
  3546. }
  3547. getActionSender().setSkillLvl(this, skillId);
  3548. }
  3549.  
  3550. /**
  3551. * Checks special amount and gets config.
  3552. */
  3553. public void checkAmount() {
  3554. int amount = specAmount;
  3555. getActionSender().setConfig2(this, 300, amount);
  3556. }
  3557.  
  3558. /**
  3559. * Walking request.
  3560. */
  3561. public void playerWalk(int x, int y, int emote, int delay) {
  3562. int firstX = x - (mapRegionX - 6) * 8;
  3563. int firstY = y - (mapRegionY - 6) * 8;
  3564. Engine.playerMovement.resetWalkingQueue(this);
  3565. Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
  3566. appearanceUpdateReq = true;
  3567. updateReq = true;
  3568. }
  3569. public void WalkingTo(int i, int j)
  3570. {
  3571. int k = i - (mapRegionX - 6) * 8;
  3572. int l = j - (mapRegionY - 6) * 8;
  3573. Engine.playerMovement.resetWalkingQueue(this);
  3574. Engine.playerMovement.addToWalkingQueue(this, k, l);
  3575. appearanceUpdateReq = true;
  3576. updateReq = true;
  3577. }
  3578. public boolean inWilderness() {
  3579. return absX >= 3136 && absX <= 3350 && absY >= 3523 && absY <= 3597;
  3580. }
  3581.  
  3582. /**
  3583. * Cross wilderness ditch
  3584. */
  3585. public void crossDitch() {
  3586. int y = 3520;
  3587. if (!wildernessZone(absX, absY)) {
  3588. y = 3523;
  3589. }
  3590. playerWalk(absX, y, 6132, 0);
  3591. appearanceUpdateReq = true;
  3592. updateReq = true;
  3593. }
  3594.  
  3595.  
  3596. /**
  3597. * Boolean which returns coords ids to get safezone of bounty hunter place.
  3598. */
  3599. public boolean pkArenaPart1() {
  3600. return absX >= 3067 && absX <= 3134 && absY >= 3650 && absY <= 3698;
  3601. }
  3602.  
  3603. public boolean pkArenaPart2() {
  3604. return absX >= 3135 && absX <= 3144 && absY >= 3672 && absY <= 3714;
  3605. }
  3606.  
  3607. public boolean inPkArena() {
  3608. return pkArenaPart1() && pkArenaPart2();
  3609. }
  3610.  
  3611. void updateStats() {
  3612. if (isDead) {
  3613. return;
  3614. }
  3615. int skill = 0;
  3616. while (skill <= 22) {
  3617. if (skill == 3 || skill == 5) {
  3618. skill++;
  3619. }
  3620. if (skillLvl[skill] > getLevelForXP(skill)) {
  3621. skillLvl[skill]--;
  3622. }
  3623. if (skillLvl[skill] < getLevelForXP(skill)) {
  3624. skillLvl[skill]++;
  3625. }
  3626. statDelay = 100;
  3627. getActionSender().setSkillLvl(this, skill);
  3628. skill++;
  3629. }
  3630. }
  3631. void restoreHP() {
  3632. if (isDead) {
  3633. return;
  3634. }
  3635. if (skillLvl[3] > getLevelForXP(3)) {
  3636. skillLvl[3]--;
  3637. }
  3638. if (skillLvl[3] < getLevelForXP(3)) {
  3639. skillLvl[3] += equipment[9] == 11133 ? 2 : 1;
  3640. }
  3641. hpDelay = 100;
  3642. getActionSender().setSkillLvl(this, 3);
  3643. }
  3644.  
  3645. /**
  3646. * Unequip and delete all items player has.
  3647. */
  3648. public void dropAllStuff() {
  3649. if (this == null)
  3650. return;
  3651. PlayerItems pi = new PlayerItems();
  3652. for(int i = 0; i < items.length; i++)
  3653. {
  3654. if(items[i] == 6570)
  3655. break;
  3656. if(items[i] >= 0)
  3657. {
  3658. if(Engine.items.isUntradable((items[i])))
  3659. {
  3660. Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
  3661. }
  3662. else
  3663. {
  3664. Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
  3665. }
  3666. }
  3667. }
  3668. for(int i = 0; i < equipment.length; i++)
  3669. {
  3670. if(equipment[i] == 6570)
  3671. break;
  3672. if(equipment[i] >= 0)
  3673. {
  3674. getActionSender().removeEquipment(this, equipment[i], i);
  3675. if(Engine.items.isUntradable((items[0])))
  3676. {
  3677. Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
  3678.  
  3679. }
  3680. else
  3681. {
  3682. Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
  3683. }
  3684. }
  3685. }
  3686. combatType = 0;
  3687. }
  3688.  
  3689. public boolean arrayContains(int[] array, int value) {
  3690. for (int i : array) {
  3691. if (value == i) {
  3692. return true;
  3693. }
  3694. }
  3695. return false;
  3696. }
  3697.  
  3698. public int[] removeValueFromArray(int[] array, int value) {
  3699. int index = -1;
  3700. for (int i = 0; i < array.length; i++) {
  3701. if (value == array[i]) {
  3702. index = i;
  3703. }
  3704. }
  3705. if (index != -1) {
  3706. array[index] = 0;
  3707. }
  3708. return array;
  3709. }
  3710.  
  3711. public int[][] removeValueFromArray(int[][] array, int value) {
  3712. int indexI = -1;
  3713. int indexJ = -1;
  3714. for (int i = 0; i < array.length; i++) {
  3715. for (int j = 0; j < array[i].length; j++) {
  3716. if (value == array[i][j]) {
  3717. indexI = i;
  3718. indexJ = j;
  3719. }
  3720. }
  3721. }
  3722. if (indexI != -1 && indexJ != -1) {
  3723. array[indexI][indexJ] = -1;
  3724. }
  3725. return array;
  3726. }
  3727.  
  3728. void dropStuff(String opp) {
  3729. try {
  3730. int amountOfKeptItems = isSkulled ? (usingPrayer(10) ? 1 : 0) : (usingPrayer(10) ? 4 : 3);
  3731. int[] allItems = new int[items.length + equipment.length];
  3732. int[] allItemsN = new int[itemsN.length + equipmentN.length];
  3733. int[] keptItems = new int[amountOfKeptItems];
  3734. int[] toAdd = new int[keptItems.length];
  3735. System.arraycopy(items, 0, allItems, 0, items.length);
  3736. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  3737. System.arraycopy(itemsN, 0, allItemsN, 0, itemsN.length);
  3738. System.arraycopy(equipmentN, 0, allItemsN, itemsN.length, equipmentN.length);
  3739. for (int i = 0; i < keptItems.length; i++) {
  3740. int index = 0;
  3741. int standing = 0;
  3742. for (int j = 0; j < allItems.length; j++) {
  3743. if (allItems[j] < 1) {
  3744. continue;
  3745. }
  3746. int price = Engine.items.itemLists[allItems[j]].shopValue;
  3747. if (price > standing) {
  3748. index = j;
  3749. standing = price;
  3750. }
  3751. }
  3752. keptItems[i] = allItems[index];
  3753. toAdd[i] = allItems[index];
  3754. allItemsN[index]--;
  3755. if (allItemsN[index] == 0) {
  3756. allItems[index] = 0;
  3757. }
  3758. }
  3759. for(int i = 0; i < items.length; i++) {
  3760. if(items[i] > 0) {
  3761. if (!arrayContains(keptItems, items[i])) {
  3762. if (Engine.items.isUntradable((items[i]))) {
  3763. if (items[i] != 13290) {
  3764. Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, username);
  3765. } else {
  3766. getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
  3767. degrade = 6000;
  3768. degrades = false;
  3769. }
  3770. Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
  3771. } else {
  3772. if (!isPVP()) {
  3773. Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, opp);
  3774. }
  3775. }
  3776. } else {
  3777. keptItems = removeValueFromArray(keptItems, items[i]);
  3778. }
  3779. Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
  3780. }
  3781. }
  3782. for(int i = 0; i < equipment.length; i++) {
  3783. if (equipment[i] > 0) {
  3784. getActionSender().removeEquipment(this, equipment[i], i);
  3785. if (!arrayContains(keptItems, items[0])) {
  3786. if(Engine.items.isUntradable((items[0]))) {
  3787. if (items[0] != 13290) {
  3788. Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, username);
  3789. } else {
  3790. getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
  3791. degrade = 6000;
  3792. degrades = false;
  3793. }
  3794. Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
  3795. } else {
  3796. if (!isPVP()) {
  3797. Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, opp);
  3798. }
  3799. }
  3800. } else {
  3801. keptItems = removeValueFromArray(keptItems, items[0]);
  3802. }
  3803. Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
  3804. }
  3805. }
  3806. for (int i : toAdd) {
  3807. if (i > 0) {
  3808. Engine.playerItems.addItem(this, i, 1);
  3809. }
  3810. }
  3811. Engine.items.createGroundItem(526, 1, absX, absY, heightLevel, opp);
  3812. int[] lostItems = allItems;
  3813. if (inWilderness() && receivesPVPDrop(this, Server.engine.players[Server.engine.getIdFromName(opp)])) {
  3814. PVPDrop(opp, lostItems);
  3815. }
  3816. } catch (Exception e) {
  3817. e.printStackTrace();
  3818. System.out.println("Null drop: "+opp);
  3819. return;
  3820. }
  3821. }
  3822.  
  3823. public int totalValue(int[] items) {
  3824. int totalValue = 0;
  3825. try {
  3826. int[] allItems = new int[items.length + equipment.length];
  3827. System.arraycopy(items, 0, allItems, 0, items.length);
  3828. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  3829.  
  3830. for (int i : allItems) {
  3831. totalValue += getItemValue(i);
  3832. }
  3833. } catch (Exception e) {
  3834. e.printStackTrace();
  3835. return 0;
  3836. }
  3837. return totalValue;
  3838. }
  3839.  
  3840.  
  3841. void PVPDrop(String player, int[] lostItems) {
  3842. Player dropFor = Server.engine.players[Server.engine.getIdFromName(player)];
  3843. try {
  3844. if (dropFor.setDrop != 0) {
  3845. Engine.items.createGroundItem(dropFor.setDrop, 1, absX, absY, heightLevel, player);
  3846. dropFor.setDrop = 0;
  3847. }
  3848. if (Double.isInfinite(dropFor.PVPPotential) || Double.isNaN(dropFor.PVPPotential)) {
  3849. dropFor.PVPPotential = 0.0;
  3850. }
  3851. double chance = 0.00;
  3852. int randomDrops = 0;
  3853. for (int i : lostItems) {
  3854. if (Math.random() <= 0.75) {
  3855. lostItems = removeValueFromArray(lostItems, i);
  3856. } else {
  3857. if (getItemValue(i) >= 3000) {
  3858. randomDrops++;
  3859. } else if (Math.random() <= 0.25) {
  3860. randomDrops++;
  3861. }
  3862. }
  3863.  
  3864. }
  3865. for (int i : lostItems) {
  3866. if (i == 0 || Engine.items.isUntradable(i)) {
  3867. continue;
  3868. }
  3869. Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
  3870. }
  3871. int[] potentialDrops = {1145,1147,2605,2613,2619,2627,2657,2673,3385,3486,3749,3751,3753,3755,4716,4724,4745,4753,5574,6128,6131,6137,10350,10589,10606,10828,11200,11335,1073,1079,1091,1093,1123,1127,2599,2601,2607,2609,2615,2617,2623,2625,2653,2655,2661,2669,2671,3474,3476,3480,3481,3483,3485,3670,3476,3674,3676,4087,4585,4720,4722,4728,4749,4751,4759,5575,5576,6129,6617,10346,10348,11720,11722,11724,1199,1201,2603,2611,2621,2629,2659,2667,2675,3488,10352,11726,11728,11730,11720,11718,11694,11696,11698,11700,11283,1187,1215,1231,1249,1263,1305,1377,1434,3101,3140,3204,4087,3587,5680,5698,6739,7158,9244,11212,11217,11227,11228,11229,11230,11231,11233,11234,11732,4091,4093,4095,4097,4099,4101,4103,4105,4107,4109,4111,4113,4115,4117,6916,6918,6920,6922,6924,4708,4710,4712,4714,4755,4757,4726,4730,4747,4732,4734,4735,4738,4740,4718,2491,2497,2503,10370,10386,6764,10368,10372,10374,10444,10450,10456,10460,10468,10474,10786,2663,3479,4151,6762,10384,10386,10388,10390,10440,10446,10452,10458,10464,10470,10784,6760,10376,10378,10380,10382,10442,10448,1454,10462,10466,10472,9672,9674,9676,9678,3122,4153,6809,10564,10330,10332,10334,10336,10338,10340,10342,10344,6731,6733,6735,6737,9185,1704,1706,1708,1710,1712,1725,1727,1729,1731,6585,10354,10356,10358,10360,10362,10364,10366,10719,10736,10738,6889,4129,4131,2579,6914,6912,139,141,143,169,171,173,175,177,179,2430,2442,2444,3040,3042,3044,3046,145,147,149,157,159,161,163,165,167,181,183,185,2436,2440,2448,3024,3026,3028,3030,6568,6524,6526,6523,6525,6522,6527,6528,11126,11124,11122,11120,11118,11133,13290}; //PVP Drops
  3872. for (int i = 0; i < randomDrops; i++) {
  3873. int item = potentialDrops[(int)Math.floor(Math.random() * potentialDrops.length)];
  3874. chance = getPVPDropPercentage(item, totalValue(lostItems), dropFor.PVPPotential);
  3875. if (Math.random() <= chance) {
  3876. Engine.items.createGroundItem(item, 1, absX, absY, heightLevel, player);
  3877. dropFor.PVPPotential -= ((1.00 - chance) / 10);
  3878. } else {
  3879. dropFor.PVPPotential += ((1.00 - chance) / 10);
  3880. }
  3881. }
  3882. } catch (Exception e) {
  3883. }
  3884. }
  3885.  
  3886. double getPVPDropPercentage(int item, int risk, double potential) {
  3887. double base = 0.10 + potential * (hotZone(absX, absY) ? 3.00 : 1.50);
  3888. double ratio = getItemValue(item) / 1457000;
  3889. double value = base / ratio;
  3890. if (value > 0.95) {
  3891. value = 0.95;
  3892. }
  3893. return value;
  3894. }
  3895.  
  3896. void drainPrayer() {
  3897. if (usingPrayer) {
  3898. if (drainDelay == 0) {
  3899. if (skillLvl[5] <= 1) {
  3900. resetPrayer();
  3901. skillLvl[5]--;
  3902. getActionSender().setSkillLvl(this, 5);
  3903. appearanceUpdateReq = true;
  3904. updateReq = true;
  3905. getActionSender().sendMessage(this, "You are out of prayer points. Please restore them at an prayer altar.");
  3906. return;
  3907. }
  3908. skillLvl[5]--;
  3909. getActionSender().setSkillLvl(this, 5);
  3910. }
  3911. drainDelay = 8;
  3912. appearanceUpdateReq = true;
  3913. updateReq = true;
  3914. }
  3915. }
  3916. public void appendWilderness() {
  3917. wildyLevel = getWildernessLevel();
  3918. if (savedLevel != wildyLevel) {
  3919. savedLevel = wildyLevel;
  3920. if (wildyLevel > 0 && !bountySafe()) {
  3921. addWilderness();
  3922. } else {
  3923. removeWilderness();
  3924. }
  3925. }
  3926. }
  3927. public void removeWilderness() {
  3928. getActionSender().setPlayerOption(this, "Null", 1, true);
  3929. getActionSender().removeOverlay(this);
  3930. getActionSender().setInterfaceConfig(this, 745, 6, true);
  3931. getActionSender().setInterfaceConfig(this, 745, 3, false);
  3932. }
  3933. public void addWilderness() {
  3934. getActionSender().setPlayerOption(this, "Attack", 1, true);
  3935. if (InBounty == 0) {
  3936. if (!isPVP()) {
  3937. getActionSender().setOverlay(this, 381);
  3938. } else {
  3939. getActionSender().setInterfaceConfig(this, 745, 6, false);
  3940. getActionSender().setInterfaceConfig(this, 745, 3, true);
  3941. getActionSender().setOverlay(this, 494);
  3942. int max = combatLevel + wildyLevel;
  3943. if (max > 126) {
  3944. max = 126;
  3945. }
  3946. int min = (combatLevel - wildyLevel) + (((combatLevel % 10 >= 5) && ((combatLevel - wildyLevel) % 10 < 5) || (combatLevel >= 114)) ? 2 : 1);
  3947. if (min < 3) {
  3948. min = 3;
  3949. }
  3950. String range = min+" - "+max ;
  3951. getActionSender().setString(this, range, 494, 1);
  3952. getActionSender().setString(this, "", 494, 2);
  3953. }
  3954. }
  3955. }
  3956. public int wildernessLevels(int coordY) {
  3957. wildyLevel = (coordY - 3254 / 7);
  3958. if (wildyLevel < 1)
  3959. wildyLevel = 1;
  3960. return wildyLevel;
  3961. }
  3962.  
  3963. public boolean inEdge() {
  3964. return absX >= 3040 && absX <= 3125 && absY >= 3523 && absY <= 3551;
  3965. }
  3966.  
  3967.  
  3968. /**
  3969. * Dharok's equipment check.
  3970. */
  3971. public boolean fullDharok() {
  3972. return equipment[3] == 4718 && equipment[4] == 4720 && equipment[7] == 4722 && equipment[0] == 4716;
  3973. }
  3974.  
  3975. /**
  3976. * Verac's equipment check.
  3977. */
  3978. public boolean fullVerac() {
  3979. return equipment[3] == 4755 && equipment[4] == 4757 && equipment[7] == 4759 && equipment[0] == 4753;
  3980. }
  3981.  
  3982. /**
  3983. * Guthan equipment chck
  3984. */
  3985. public boolean hasGuthanEquipment() {
  3986. return equipment[3] == 4726 && equipment[4] == 4728 && equipment[7] == 4730 && equipment[0] == 4724;
  3987. }
  3988.  
  3989. /**
  3990. * Safezone.
  3991. */
  3992. public boolean inClan() {
  3993. return absX >= 3264 && absY >= 3672 && absX <= 3279 && absY <= 3695;
  3994. }
  3995.  
  3996. /**
  3997. * clan wars arena
  3998. */
  3999. public boolean inClanFight() {
  4000. return absX >= 3258 && absY >= 3710 && absX <= 3330 && absY <= 3842;
  4001. }
  4002.  
  4003. public void addClanWarsScreen() {
  4004. getActionSender().setString(this, ""+Server.engine.getWhiteClanPlayerCount(whiteCount)+"", 265, 6);
  4005. getActionSender().setString(this, ""+Server.engine.getBlackClanPlayerCount(blackCount)+"", 265, 7);
  4006. getActionSender().setOverlay(this, 265);
  4007. }
  4008.  
  4009. public int distanceToPoint(int pointX, int pointY) {
  4010. return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  4011. }
  4012.  
  4013. public boolean fullVoidKnightRange() {
  4014. return equipment[0] == 11675 && equipment[4] == 8839 && equipment[7] == 8840;
  4015. }
  4016.  
  4017. public boolean fullArmadyl() {
  4018. return equipment[0] == 11718 && equipment[4] == 11720 && equipment[7] == 11722;
  4019. }
  4020.  
  4021. public boolean saraChamber() {
  4022. return absX >= 2889 && absX <= 2907 && absY >= 5258 && absY <= 5276;
  4023. }
  4024.  
  4025. public boolean zammyChamber() {
  4026. return absX >= 2919 && absX <= 2935 && absY >= 5319 && absY <= 5330;
  4027. }
  4028.  
  4029. public boolean graardorChamber() {
  4030. return absX >= 2864 && absX <= 2876 && absY >= 5351 && absY <= 5369;
  4031. }
  4032.  
  4033. public boolean armadylChamber() {
  4034. return absX >= 2823 && absX <= 2843 && absY >= 5295 && absY <= 5310;
  4035. }
  4036.  
  4037. public boolean armadylChamber1() {
  4038. return absX >= 2825 && absX <= 2841 && absY >= 5297 && absY <= 5307;
  4039. }
  4040.  
  4041. public boolean inMageArena() {
  4042. return absX >= 3079 && absX <= 3126 && absY >= 3906 && absY <= 3951;
  4043. }
  4044.  
  4045. public boolean inDuelArena() {
  4046. return absX >= 3349 && absX <= 3388 && absY >= 3262 && absY <= 3280;
  4047. }
  4048.  
  4049. public boolean godWarsDung() {
  4050. return absX >= 2819 && absX <= 2946 && absY >= 5254 && absY <= 5362;
  4051. }
  4052.  
  4053. public boolean inJadCave() {
  4054. return absX >= 2375 && absX <= 2425 && absY >= 5128 && absY <= 5169;
  4055. }
  4056.  
  4057. /**
  4058. * Sets the strings for kill counts for god wars dungeon.
  4059. */
  4060. public void setGodWarsStrings() {
  4061. if (zammyChamber() || addZamorakCheckEventGodWars())
  4062. for (int i = 7; i < 11; i++)
  4063. for (int k = 0; k < 5; k++)
  4064. if (this != null)
  4065. getActionSender().setString(this, ""+godWarsKills[k]+"", 598, i);
  4066. else
  4067. for (int s = 7; s < 11; s++)
  4068. for (int d = 0; d < 5; d++)
  4069. if (this != null)
  4070. getActionSender().setString(this, ""+godWarsKills[d]+"", 601, s);
  4071. }
  4072.  
  4073. public ActionSender getActionSender() {
  4074. return Engine.actionSender;
  4075. }
  4076.  
  4077. public DuelArena getDuelClass() {
  4078. return duelArena;
  4079. }
  4080.  
  4081. public FightCave getFightClass() {
  4082. return fCave;
  4083. }
  4084.  
  4085. public WarriorGuild getWarriorClass() {
  4086. return warriorGuild;
  4087. }
  4088.  
  4089. public QuestDevelopment getQuestClass() {
  4090. return quest;
  4091. }
  4092.  
  4093. public TestWorldLoader getWorldLoader() {
  4094. return worldLoader;
  4095. }
  4096.  
  4097. public ByteVector getByteVector() {
  4098. return stream;
  4099. }
  4100.  
  4101. public boolean duelFight() {
  4102. return absX >= 3361 && absX <= 3392 && absY >= 3223 && absY <= 3241;
  4103. }
  4104.  
  4105. public boolean slayerTower() {
  4106. return absX >= 3402 && absX <= 3458 && absY >= 3529 && absY <= 3581;
  4107. }
  4108.  
  4109. public void appendPotion() {
  4110. if (explodeDelay == 0) {
  4111. if (explodeType == 1) {
  4112. appendHit(25, 0);
  4113. requestForceChat("Ow!");
  4114. getActionSender().sendMessage(this, "The unidentified liquid potion exploded!");
  4115. }
  4116. explodeType = 0;
  4117. explodeDelay = -1;
  4118. }
  4119. }
  4120.  
  4121. public boolean castleLobby() {
  4122. return absX >= 2435 && absX <= 2449 && absY >= 3079 && absY <= 3099;
  4123. }
  4124.  
  4125. public boolean castleArea() {
  4126. return absX >= 2358 && absX <= 2438 && absY >= 3066 && absY <= 3142;
  4127. }
  4128.  
  4129. public boolean correctDistance(int j, int k, int l, int i1, int j1)
  4130. {
  4131. for(int k1 = 0; k1 <= j1; k1++)
  4132. {
  4133. for(int l1 = 0; l1 <= j1; l1++)
  4134. {
  4135. if(j + k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  4136. return true;
  4137. if(j - k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  4138. return true;
  4139. if(j == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  4140. return true;
  4141. }
  4142.  
  4143. }
  4144.  
  4145. return false;
  4146. }
  4147.  
  4148. public int getLoginSpecial() {
  4149. if (specAmount <= 0) {
  4150. return 0;
  4151. } else {
  4152. return specAmount;
  4153. }
  4154. }
  4155.  
  4156. public int getLoginSpellbook() {
  4157. if (spellbook <= 0) {
  4158. return 192;
  4159. } else {
  4160. return spellbook;
  4161. }
  4162. }
  4163.  
  4164. public PlayerFletching getFletchingClass() {
  4165. return fletchingClass;
  4166. }
  4167.  
  4168. /**
  4169. * Edgeville 1 V 1
  4170. */
  4171. public boolean inEdgePk() {
  4172. return absX >= 3040 && absX <= 3118 && absY >= 3522 && absY <= 3553;
  4173. }
  4174.  
  4175. /**
  4176. * Checking if combat level difference is correct for attacking in wild.
  4177. */
  4178. public boolean combatDifference(int cbLvl) {
  4179. return wildLevel >= combatLevel && combatLevel + cbLvl >= wildLevel || cbLvl < combatLevel && combatLevel - wildLevel <= cbLvl || cbLvl == combatLevel;
  4180. }
  4181.  
  4182. /**
  4183. * Update the wilderness levels.
  4184. */
  4185. void addWildernessUpdating() {
  4186. getActionSender().setString(this, "Level: "+getWildernessLevel(), 380, 1);
  4187. if (updatedLevel != wildernessZone(absX, absY)) {
  4188. updatedLevel = wildernessZone(absX, absY);
  4189. if (updatedLevel && !inClan() && !clanWarsFightArea()) {
  4190. getActionSender().setOverlay(this, 380);
  4191. } else {
  4192. wildyLevel = 0;
  4193. getActionSender().removeOverlay(this);
  4194. }
  4195. }
  4196. }
  4197.  
  4198. public String getMessageString(int economyId) {
  4199. switch (economyId) {
  4200. case 0:
  4201. return"No more duping faggots.";
  4202. case 4153:
  4203. return "Granite mauls are now disabled, Please kill Gargoyles in the Slayer tower.";
  4204.  
  4205. case 4151:
  4206. case 11235:
  4207. return "Abyssal whips and Dark bows are disabled, Please go to Slayer tower.";
  4208.  
  4209. case 2440:
  4210. case 2434:
  4211. case 6685:
  4212. return "You cannot spawn the super strength potion, Prayer potion and Brews anymore, Please steal potions from the stalls at home.";
  4213.  
  4214. case 385:
  4215. case 391:
  4216. return "You cannot spawn food anymore, Please steal food from the stalls at home.";
  4217.  
  4218. case 10581:
  4219. return "Please go to the Slayer Tower for a Keris dagger.";
  4220.  
  4221. case 11690:
  4222. case 11702:
  4223. case 11704:
  4224. case 11706:
  4225. case 11708:
  4226. return "You can only get a God hilt or Godsword blade by Defeating the Generals of the Gods in the God wars Dungeon.";
  4227.  
  4228. case 11718:
  4229. case 11720:
  4230. case 11722:
  4231. case 12670:
  4232. case 12671:
  4233. return "You can only get a piece of Armadyl armour by Visitting Armadyl's Eyrie in the Godwars dungeon.";
  4234.  
  4235. case 11724:
  4236. case 11726:
  4237. case 11728:
  4238. return "You can only get a piece of Bandos armour by Visitting Bandos's Stronghold in the Godwars dungeon.";
  4239.  
  4240. case 3140:
  4241. return "You can only get a Dragon chainbody by Killing the Kalphite Queen in her Kalphite Lair.";
  4242.  
  4243. case 6570:
  4244. case 10566:
  4245. case 10637:
  4246. return "Please visit The fight cave for a Fire cape.";
  4247.  
  4248. case 11694:
  4249. case 11696:
  4250. case 11698:
  4251. case 11700:
  4252. return "Please visit the Godwars dungeon to get this item.";
  4253.  
  4254. default:
  4255. return "";
  4256. }
  4257. }
  4258.  
  4259. /**
  4260. * Loads objects at Map region loading.
  4261. */
  4262. public void loadStaticObjects() {
  4263. getActionSender().addStaticObject(23610, 2, 3509, 9497, 0, 10);
  4264. //getActionSender().addStaticObject(3831, 0, 3227, 3108, 0, 10);
  4265. }
  4266.  
  4267.  
  4268. /**
  4269. * Zammys part of god wars area check boolean
  4270. */
  4271. public boolean addZamorakCheckEventGodWars() {
  4272. return absX >= 2879 && absX <= 2945 && absY >= 5342 && absY <= 5364;
  4273. }
  4274.  
  4275. /**
  4276. * Update the player.
  4277. */
  4278. public void updatePlayer(boolean updateIsNeccesary) {
  4279. appearanceUpdateReq = updateReq = updateIsNeccesary;
  4280. }
  4281.  
  4282. public int getX() {
  4283. return absX;
  4284. }
  4285.  
  4286. public int getY() {
  4287. return absY;
  4288. }
  4289.  
  4290. public int getHeight() {
  4291. return heightLevel;
  4292. }
  4293.  
  4294. public int getPlayerId() {
  4295. return playerId;
  4296. }
  4297.  
  4298. public void convertPlayerToNpc(int npcType) {
  4299. this.npcType = npcType;
  4300. }
  4301.  
  4302. public void updatePlayerAppearance(int walkAnim, int standAnim, int runAnim) {
  4303. standEmote = standAnim;
  4304. walkEmote = walkAnim;
  4305. runEmote = runAnim;
  4306. }
  4307.  
  4308. public void appendToIPBanned(Player player) {
  4309. BufferedWriter bw = null;
  4310. try {
  4311. bw = new BufferedWriter(new FileWriter("./data/banned/bannedhosts.dat", true));
  4312. bw.write(Server.socketListener.getAddress(player.socket.socket));
  4313. bw.newLine();
  4314. bw.flush();
  4315. Server.socketListener.loadBannedHosts();
  4316. player.disconnected[0] = true;
  4317. player.disconnected[1] = true;
  4318. } catch (IOException ioe) {
  4319. } finally {
  4320. if (bw != null) {
  4321. try {
  4322. bw.close();
  4323. } catch (IOException ioe2) {
  4324. }
  4325. }
  4326. }
  4327. }
  4328. public void appendToBanned(String player) {
  4329. BufferedWriter bw = null;
  4330. try {
  4331. bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
  4332. bw.write(player);
  4333. bw.newLine();
  4334. bw.flush();
  4335. Server.loadBannedUsers();
  4336. } catch (IOException ioe) {
  4337. } finally {
  4338. if (bw != null) {
  4339. try {
  4340. bw.close();
  4341. } catch (IOException ioe2) {
  4342. }
  4343. }
  4344. }
  4345. }
  4346.  
  4347. String Directory = "./data/banned/bannedusers.dat";
  4348. String MaxBan[] = new String[1000];
  4349. String UserThatBan = new String();
  4350. int Ban = 0;
  4351.  
  4352. public void UnBanPlayer(String Player) {
  4353. try {
  4354. BufferedReader dataStream = new BufferedReader(new FileReader("./data/banned/bannedusers.dat"));
  4355. while ((UserThatBan = dataStream.readLine()) != null) {
  4356. if(UserThatBan.equalsIgnoreCase(Player)) {
  4357. } else
  4358. if(!UserThatBan.equalsIgnoreCase(Player)) {
  4359. MaxBan[Ban] = UserThatBan;
  4360. Ban++;
  4361. }
  4362. }
  4363. } catch(Exception e) {
  4364. e.printStackTrace();
  4365. }
  4366. BufferedWriter bw = null;
  4367. try {
  4368. bw = new BufferedWriter(new FileWriter(Directory, false));
  4369. bw.write("");
  4370. bw.flush();
  4371. bw.close();
  4372. } catch(Exception e) {
  4373. e.printStackTrace();
  4374. }
  4375. try {
  4376. bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
  4377. for(int a = 0; a < MaxBan.length; a++) {
  4378. if(MaxBan[a] != null) {
  4379. bw.write(MaxBan[a]);
  4380. bw.newLine();
  4381. bw.flush();
  4382. }
  4383. }
  4384. bw.close();
  4385. } catch(Exception e) {
  4386. e.printStackTrace();
  4387. }
  4388. Server.loadBannedUsers();
  4389. }
  4390. public boolean nonMultiPlace() {
  4391. return absX >= 3400 && absX <= 3457 && absY >= 3527 && absY <= 3579 && heightLevel == 2;
  4392. }
  4393.  
  4394. public int neededSpecialAmount() {
  4395. switch (equipment[3]) {
  4396. case 1215:
  4397. case 1231:
  4398. case 5680:
  4399. case 5698:
  4400. case 1305:
  4401. case 1434:
  4402. return 250;
  4403. case 10887:
  4404. case 11694:
  4405. case 11698:
  4406. case 4151:
  4407. return 500;
  4408. case 11235:
  4409. return 550;
  4410. case 11700:
  4411. return 600;
  4412. case 11696:
  4413. case 11730:
  4414. return 1000;
  4415. default:
  4416. return 0;
  4417. }
  4418. }
  4419.  
  4420. public int weaponType;
  4421.  
  4422. public int attackStyle() {
  4423.  
  4424. /*
  4425. * Melee weapon styles
  4426. * 1 : accurate
  4427. * 2 : agressive
  4428. * 3 : defensive
  4429. * 4 : controlled
  4430. *
  4431. * Ranged weapon styles
  4432. * 5 : accurate
  4433. * 6 : rapid
  4434. * 7 : longrange
  4435. */
  4436.  
  4437. switch (weaponType) {
  4438. case 0: return fightStyle;
  4439. case 1: return fightStyle;
  4440. case 2:
  4441. if (fightStyle == 1) {
  4442. return 1;
  4443. }
  4444. if (fightStyle == 3) {
  4445. return 2;
  4446. }
  4447. if (fightStyle == 2) {
  4448. return 3;
  4449. }
  4450. case 3:
  4451. if (fightStyle == 1) {
  4452. return 1;
  4453. }
  4454. if (fightStyle == 2) {
  4455. return 2;
  4456. }
  4457. if (fightStyle == 3) {
  4458. return 4;
  4459. }
  4460. if (fightStyle == 4) {
  4461. return 3;
  4462. }
  4463. case 4:
  4464. if (fightStyle == 1) {
  4465. return 5;
  4466. }
  4467. if (fightStyle == 3) {
  4468. return 6;
  4469. }
  4470. if (fightStyle == 2) {
  4471. return 7;
  4472. }
  4473. case 5: break;
  4474. case 6: return fightStyle;
  4475. case 7:
  4476. if (fightStyle == 1) {
  4477. return 1;
  4478. }
  4479. if (fightStyle == 2 || fightStyle == 3) {
  4480. return 2;
  4481. }
  4482. if (fightStyle == 4) {
  4483. return 3;
  4484. }
  4485. case 8:
  4486. if (fightStyle == 1) {
  4487. return 1;
  4488. }
  4489. if (fightStyle == 4 || fightStyle == 3) {
  4490. return 2;
  4491. }
  4492. if (fightStyle == 2) {
  4493. return 3;
  4494. }
  4495. case 9:
  4496. if (fightStyle == 1) {
  4497. return 4;
  4498. }
  4499. if (fightStyle == 2) {
  4500. return 2;
  4501. }
  4502. if (fightStyle == 3) {
  4503. return 3;
  4504. }
  4505. case 10:
  4506. if (fightStyle == 1) {
  4507. return 1;
  4508. }
  4509. if (fightStyle == 2) {
  4510. return 2;
  4511. }
  4512. if (fightStyle == 3) {
  4513. return 4;
  4514. }
  4515. if (fightStyle == 4) {
  4516. return 3;
  4517. }
  4518. case 11:
  4519. if (fightStyle == 1) {
  4520. return 1;
  4521. }
  4522. if (fightStyle == 4) {
  4523. return 2;
  4524. }
  4525. if (fightStyle == 3) {
  4526. return 4;
  4527. }
  4528. if (fightStyle == 2) {
  4529. return 3;
  4530. }
  4531. case 12:
  4532. if (fightStyle == 1 || fightStyle == 2) {
  4533. return fightStyle;
  4534. }
  4535. if (fightStyle == 3) {
  4536. return 4;
  4537. }
  4538. if (fightStyle == 4) {
  4539. return 3;
  4540. }
  4541. }
  4542. return 8;
  4543. }
  4544.  
  4545. public int weaponStyle(int weaponID) {
  4546. switch (weaponID) {
  4547. case 4151: return 2;
  4548. case 4153: return 3;
  4549. case 1277:
  4550. case 1279:
  4551. case 1281:
  4552. case 1283:
  4553. case 1285:
  4554. case 1287:
  4555. case 1289:
  4556. case 1291:
  4557. case 1293:
  4558. case 1295:
  4559. case 1297:
  4560. case 1299:
  4561. case 1301:
  4562. case 1303:
  4563. case 1305:
  4564. case 1329:
  4565. case 1331:
  4566. case 1337:
  4567. case 4587:
  4568. if (fightStyle != 3) {
  4569. return 2;
  4570. } else {
  4571. return 1;
  4572. }
  4573. case 1434:
  4574. case 4755:
  4575. case 10887:
  4576. if (fightStyle != 3) {
  4577. return 3;
  4578. } else {
  4579. return 1;
  4580. }
  4581. case 1215:
  4582. case 1231:
  4583. case 5680:
  4584. case 5698:
  4585. if (fightStyle != 3) {
  4586. return 1;
  4587. } else {
  4588. return 2;
  4589. }
  4590. case 1307:
  4591. case 1309:
  4592. case 1311:
  4593. case 1313:
  4594. case 1315:
  4595. case 1317:
  4596. case 1319:
  4597. case 1349:
  4598. case 1351:
  4599. case 1353:
  4600. case 1355:
  4601. case 1357:
  4602. case 1359:
  4603. case 1361:
  4604. case 1363:
  4605. case 1365:
  4606. case 1367:
  4607. case 1369:
  4608. case 1371:
  4609. case 1373:
  4610. case 1375:
  4611. case 1377:
  4612. case 4718:
  4613. case 6739:
  4614. case 7158:
  4615. case 11694:
  4616. case 11696:
  4617. case 11698:
  4618. case 11700:
  4619. case 11730:
  4620. if (fightStyle != 3) {
  4621. return 2;
  4622. } else {
  4623. return 3;
  4624. }
  4625. }
  4626. return 1;
  4627. }
  4628.  
  4629. public int getAttackSound() {
  4630. String weapon = Engine.items.getItemName(equipment[3]);
  4631. if (weapon.equals("Abyssal whip")) {
  4632. return 2720;
  4633. }
  4634. if (weapon.contains("godsword") || weapon.equals("Saradomin sword")) {
  4635. switch (fightStyle) {
  4636. case 1:
  4637. case 2:
  4638. case 4: return 3846;
  4639. case 3: return 3882;
  4640. }
  4641. }
  4642. if (weapon.equals("Granite maul")) {
  4643. return 2714;
  4644. }
  4645. return -1;
  4646. }
  4647.  
  4648. public int getSpecialAttackSound() {
  4649. return -1;
  4650. }
  4651.  
  4652. public ClanWars getClanWarsHandler() {
  4653. return clanWars;
  4654. }
  4655.  
  4656. public boolean clanWarsFightArea() {
  4657. return absX >= 3263 && absX <= 3327 && absY >= 3713 && absY <= 3840;
  4658. }
  4659. public boolean bountySafe1() {
  4660. return absX >=3173 && absX <=3193 && absY >=3669 && absY <=3701;
  4661. }
  4662. public boolean bountySafe2() {
  4663. return absX >=3154 && absX <=3173 && absY >=3669 && absY <=3690;
  4664. }
  4665. public boolean bountySafe3() {
  4666. return absX >=3145 && absX <=3167 && absY >=3662 && absY <=3668;
  4667. }
  4668. public boolean bountySafe4() {
  4669. return absX >=3143 && absX <=3154 && absY >=3669 && absY <=3675;
  4670. }
  4671. public boolean bountySafe5() {
  4672. return absX >=3136 && absX <=3145 && absY >=3652 && absY <=3662;
  4673. }
  4674. public boolean bountySafe(){
  4675. return bountySafe1() || bountySafe2() || bountySafe3() || bountySafe4() || bountySafe5();
  4676. }
  4677.  
  4678.  
  4679. /**
  4680. * Prepare player for removal.
  4681. */
  4682. public void destruct() {
  4683. stream = null;
  4684. try {
  4685. socket.input.close();
  4686. socket.output.close();
  4687. socket.socket.close();
  4688. } catch (Exception e) {
  4689. }
  4690. socket.input = null;
  4691. socket.output = null;
  4692. socket.socket = null;
  4693. socket = null;
  4694. absX = absY = mapRegionX = mapRegionY = -1;
  4695. long me = Misc.stringToLong(username);
  4696. for(Player p : Engine.players) {
  4697. if(p == null) continue;
  4698. if(p.friends.contains(me)) {
  4699. p.getActionSender().sendFriend(p, me, 0);
  4700. }
  4701. }
  4702. }
  4703. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement